This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #9720] document what can be assigned to a shared scalar
[perl5.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Tue Jun 21 21:45:01 CEST 2005 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.org)
25
26 cat >c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat c1$$ c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f c1$$ c2$$
49
50 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
51         cat >&4 <<EOF
52 ***
53 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
54 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
55 *** Please read the README.plan9 for further instructions.
56 *** Cannot continue, aborting.
57 ***
58 EOF
59         exit 1
60 fi
61
62 : compute my invocation name
63 me=$0
64 case "$0" in
65 */*)
66         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
67         test "$me" || me=$0
68         ;;
69 esac
70
71 : Proper separator for the PATH environment variable
72 p_=:
73 : On OS/2 this directory should exist if this is not floppy only system :-]
74 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
75     if test -n "$OS2_SHELL"; then
76                 p_=\;
77                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
78                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
79                 is_os2=yes
80         elif test -n "$DJGPP"; then
81                 case "X${MACHTYPE:-nonesuchmach}" in
82                 *cygwin) ;;
83                 *) p_=\; ;;
84                 esac
85         fi
86 fi
87
88 : Proper PATH setting
89 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
90 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
91 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
92 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
93 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
94 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
95 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
96 paths="$paths /sbin /usr/sbin /usr/libexec"
97 paths="$paths /system/gnu_library/bin"
98
99 for p in $paths
100 do
101         case "$p_$PATH$p_" in
102         *$p_$p$p_*) ;;
103         *) test -d $p && PATH=$PATH$p_$p ;;
104         esac
105 done
106
107 PATH=.$p_$PATH
108 export PATH
109
110 : shall we be using ksh?
111 inksh=''
112 needksh=''
113 avoidksh=''
114 newsh=/bin/ksh
115 changesh=''
116 if (PATH=.; alias -x) >/dev/null 2>&1; then
117                 inksh=true
118 fi
119 if test -f /hp-ux -a -f /bin/ksh; then
120         needksh='to avoid sh bug in "here document" expansion'
121 fi
122 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
123         if test X`/usr/bin/uname -v` = X4; then
124                 avoidksh="to avoid AIX 4's /bin/sh"
125                 newsh=/usr/bin/bsh
126         fi
127 fi
128 if test -f /osf_boot -a -f /usr/sbin/setld; then
129         if test X`/usr/bin/uname -s` = XOSF1; then
130                 avoidksh="to avoid Digital UNIX' ksh"
131                 newsh=/bin/sh
132                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
133         fi
134 fi
135 case "$inksh/$needksh" in
136 /[a-z]*)
137                 ENV=''
138                 changesh=true
139                 reason="$needksh"
140         ;;
141 esac
142 case "$inksh/$avoidksh" in
143 true/[a-z]*)
144         changesh=true
145         reason="$avoidksh"
146         ;;
147 esac
148 case "$inksh/$needksh-$avoidksh-" in
149 true/--)
150                 cat <<EOM
151 (I see you are using the Korn shell.  Some ksh's blow up on $me,
152 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
153 EOM
154         ;;
155 esac
156 case "$changesh" in
157 true)
158         export newsh
159         echo "(Feeding myself to $newsh $reason.)"
160         case "$0" in
161         Configure|*/Configure) exec $newsh $0 "$@";;
162         *) exec $newsh Configure "$@";;
163         esac
164         ;;
165 esac
166
167 : if needed set CDPATH to a harmless value that is not chatty
168 : avoid bash 2.02 problems with empty CDPATH.
169 case "$CDPATH" in
170 '')     ;;
171 *)      case "$SHELL" in
172         *bash*) CDPATH='.' ;;
173         *)              CDPATH='' ;;
174         esac
175         ;;
176 esac
177 : Configure runs within the UU subdirectory
178 test -d UU || mkdir UU
179 cd UU && rm -f ./*
180
181 ccname=''
182 ccversion=''
183 ccsymbols=''
184 cppccsymbols=''
185 cppsymbols=''
186 from=''
187 run=''
188 targetarch=''
189 to=''
190 usecrosscompile=''
191 mistrustnm=''
192 perllibs=''
193 dynamic_ext=''
194 extensions=''
195 known_extensions=''
196 nonxs_ext=''
197 static_ext=''
198 useopcode=''
199 useposix=''
200 extras=''
201 d_bsd=''
202 d_eunice=''
203 d_xenix=''
204 eunicefix=''
205 Mcc=''
206 ar=''
207 awk=''
208 bash=''
209 bison=''
210 byacc=''
211 cat=''
212 chgrp=''
213 chmod=''
214 chown=''
215 comm=''
216 compress=''
217 cp=''
218 cpio=''
219 cpp=''
220 csh=''
221 date=''
222 echo=''
223 egrep=''
224 emacs=''
225 expr=''
226 find=''
227 flex=''
228 gmake=''
229 grep=''
230 gzip=''
231 inews=''
232 ksh=''
233 less=''
234 line=''
235 lint=''
236 ln=''
237 lp=''
238 lpr=''
239 ls=''
240 mail=''
241 mailx=''
242 make=''
243 mkdir=''
244 more=''
245 mv=''
246 nm=''
247 nroff=''
248 perl=''
249 pg=''
250 pmake=''
251 pr=''
252 rm=''
253 rmail=''
254 sed=''
255 sendmail=''
256 shar=''
257 sleep=''
258 smail=''
259 sort=''
260 submit=''
261 tail=''
262 tar=''
263 tbl=''
264 tee=''
265 test=''
266 touch=''
267 tr=''
268 troff=''
269 uname=''
270 uniq=''
271 uuname=''
272 vi=''
273 zcat=''
274 zip=''
275 full_ar=''
276 full_sed=''
277 libswanted=''
278 hint=''
279 myuname=''
280 osname=''
281 osvers=''
282 Author=''
283 Date=''
284 Header=''
285 Id=''
286 Locker=''
287 Log=''
288 RCSfile=''
289 Revision=''
290 Source=''
291 State=''
292 _a=''
293 _exe=''
294 _o=''
295 archobjs=''
296 exe_ext=''
297 firstmakefile=''
298 lib_ext=''
299 obj_ext=''
300 path_sep=''
301 afs=''
302 afsroot=''
303 alignbytes=''
304 ansi2knr=''
305 archlib=''
306 archlibexp=''
307 d_archlib=''
308 installarchlib=''
309 archname=''
310 myarchname=''
311 d_atolf=''
312 d_atoll=''
313 baserev=''
314 bin=''
315 binexp=''
316 installbin=''
317 byteorder=''
318 cc=''
319 ccflags=''
320 cppflags=''
321 ldflags=''
322 lkflags=''
323 locincpth=''
324 optimize=''
325 cf_email=''
326 cf_by=''
327 cf_time=''
328 charsize=''
329 contains=''
330 cpp_stuff=''
331 cpplast=''
332 cppminus=''
333 cpprun=''
334 cppstdin=''
335 d__fwalk=''
336 d_access=''
337 d_accessx=''
338 d_aintl=''
339 d_alarm=''
340 asctime_r_proto=''
341 d_asctime_r=''
342 d_attribute_format=''
343 d_attribute_malloc=''
344 d_attribute_nonnull=''
345 d_attribute_noreturn=''
346 d_attribute_pure=''
347 d_attribute_unused=''
348 d_attribute_warn_unused_result=''
349 d_bcmp=''
350 d_bcopy=''
351 d_bzero=''
352 d_casti32=''
353 castflags=''
354 d_castneg=''
355 d_chown=''
356 d_chroot=''
357 d_chsize=''
358 d_class=''
359 d_closedir=''
360 d_void_closedir=''
361 d_cmsghdr_s=''
362 d_const=''
363 d_copysignl=''
364 cryptlib=''
365 d_crypt=''
366 crypt_r_proto=''
367 d_crypt_r=''
368 d_csh=''
369 full_csh=''
370 ctermid_r_proto=''
371 d_ctermid_r=''
372 ctime_r_proto=''
373 d_ctime_r=''
374 d_cuserid=''
375 d_dbl_dig=''
376 d_dbminitproto=''
377 d_difftime=''
378 d_dirfd=''
379 d_dlerror=''
380 d_dlopen=''
381 d_dlsymun=''
382 d_dosuid=''
383 d_suidsafe=''
384 d_drand48_r=''
385 drand48_r_proto=''
386 d_drand48proto=''
387 d_dup2=''
388 d_eaccess=''
389 d_endgrent=''
390 d_endgrent_r=''
391 endgrent_r_proto=''
392 d_endhent=''
393 d_endhostent_r=''
394 endhostent_r_proto=''
395 d_endnent=''
396 d_endnetent_r=''
397 endnetent_r_proto=''
398 d_endpent=''
399 d_endprotoent_r=''
400 endprotoent_r_proto=''
401 d_endpwent=''
402 d_endpwent_r=''
403 endpwent_r_proto=''
404 d_endsent=''
405 d_endservent_r=''
406 endservent_r_proto=''
407 d_faststdio=''
408 d_fchdir=''
409 d_fchmod=''
410 d_fchown=''
411 d_fcntl=''
412 d_fcntl_can_lock=''
413 d_fd_macros=''
414 d_fd_set=''
415 d_fds_bits=''
416 d_fgetpos=''
417 d_finite=''
418 d_finitel=''
419 d_flexfnam=''
420 d_flock=''
421 d_flockproto=''
422 d_fork=''
423 d_fp_class=''
424 d_fpclass=''
425 d_fpclassify=''
426 d_fpclassl=''
427 d_fpos64_t=''
428 d_frexpl=''
429 d_fs_data_s=''
430 d_fseeko=''
431 d_fsetpos=''
432 d_fstatfs=''
433 d_fsync=''
434 d_ftello=''
435 d_ftime=''
436 d_gettimeod=''
437 d_Gconvert=''
438 d_getcwd=''
439 d_getespwnam=''
440 d_getfsstat=''
441 d_getgrent=''
442 d_getgrent_r=''
443 getgrent_r_proto=''
444 d_getgrgid_r=''
445 getgrgid_r_proto=''
446 d_getgrnam_r=''
447 getgrnam_r_proto=''
448 d_getgrps=''
449 d_gethbyaddr=''
450 d_gethbyname=''
451 d_gethent=''
452 aphostname=''
453 d_gethname=''
454 d_phostname=''
455 d_uname=''
456 d_gethostbyaddr_r=''
457 gethostbyaddr_r_proto=''
458 d_gethostbyname_r=''
459 gethostbyname_r_proto=''
460 d_gethostent_r=''
461 gethostent_r_proto=''
462 d_gethostprotos=''
463 d_getitimer=''
464 d_getlogin=''
465 d_getlogin_r=''
466 getlogin_r_proto=''
467 d_getmnt=''
468 d_getmntent=''
469 d_getnbyaddr=''
470 d_getnbyname=''
471 d_getnent=''
472 d_getnetbyaddr_r=''
473 getnetbyaddr_r_proto=''
474 d_getnetbyname_r=''
475 getnetbyname_r_proto=''
476 d_getnetent_r=''
477 getnetent_r_proto=''
478 d_getnetprotos=''
479 d_getpagsz=''
480 d_getpent=''
481 d_getpgid=''
482 d_getpgrp2=''
483 d_bsdgetpgrp=''
484 d_getpgrp=''
485 d_getppid=''
486 d_getprior=''
487 d_getpbyname=''
488 d_getpbynumber=''
489 d_getprotobyname_r=''
490 getprotobyname_r_proto=''
491 d_getprotobynumber_r=''
492 getprotobynumber_r_proto=''
493 d_getprotoent_r=''
494 getprotoent_r_proto=''
495 d_getprotoprotos=''
496 d_getprpwnam=''
497 d_getpwent=''
498 d_getpwent_r=''
499 getpwent_r_proto=''
500 d_getpwnam_r=''
501 getpwnam_r_proto=''
502 d_getpwuid_r=''
503 getpwuid_r_proto=''
504 d_getsent=''
505 d_getservbyname_r=''
506 getservbyname_r_proto=''
507 d_getservbyport_r=''
508 getservbyport_r_proto=''
509 d_getservent_r=''
510 getservent_r_proto=''
511 d_getservprotos=''
512 d_getspnam=''
513 d_getspnam_r=''
514 getspnam_r_proto=''
515 d_getsbyname=''
516 d_getsbyport=''
517 d_gmtime_r=''
518 gmtime_r_proto=''
519 d_gnulibc=''
520 gnulibc_version=''
521 d_hasmntopt=''
522 d_htonl=''
523 d_ilogbl=''
524 d_inetaton=''
525 d_int64_t=''
526 d_isascii=''
527 d_isfinite=''
528 d_isinf=''
529 d_isnan=''
530 d_isnanl=''
531 d_killpg=''
532 d_lchown=''
533 d_ldbl_dig=''
534 d_libm_lib_version=''
535 d_link=''
536 d_localtime_r=''
537 localtime_r_proto=''
538 d_locconv=''
539 d_lockf=''
540 d_longdbl=''
541 longdblsize=''
542 d_longlong=''
543 longlongsize=''
544 d_lseekproto=''
545 d_lstat=''
546 d_madvise=''
547 d_mblen=''
548 d_mbstowcs=''
549 d_mbtowc=''
550 d_memchr=''
551 d_memcmp=''
552 d_memcpy=''
553 d_memmove=''
554 d_memset=''
555 d_mkdir=''
556 d_mkdtemp=''
557 d_mkfifo=''
558 d_mkstemp=''
559 d_mkstemps=''
560 d_mktime=''
561 d_mmap=''
562 mmaptype=''
563 d_modfl=''
564 d_modfl_pow32_bug=''
565 d_modflproto=''
566 d_mprotect=''
567 d_msg=''
568 d_msgctl=''
569 d_msgget=''
570 d_msghdr_s=''
571 d_msgrcv=''
572 d_msgsnd=''
573 d_msync=''
574 d_munmap=''
575 d_nice=''
576 d_nl_langinfo=''
577 d_off64_t=''
578 d_open3=''
579 d_fpathconf=''
580 d_pathconf=''
581 d_pause=''
582 d_pipe=''
583 d_poll=''
584 d_portable=''
585 d_procselfexe=''
586 procselfexe=''
587 d_old_pthread_create_joinable=''
588 old_pthread_create_joinable=''
589 d_pthread_atfork=''
590 d_pthread_attr_setscope=''
591 d_pthread_yield=''
592 d_sched_yield=''
593 sched_yield=''
594 d_qgcvt=''
595 d_random_r=''
596 random_r_proto=''
597 d_readdir64_r=''
598 readdir64_r_proto=''
599 d_readdir=''
600 d_rewinddir=''
601 d_seekdir=''
602 d_telldir=''
603 d_readdir_r=''
604 readdir_r_proto=''
605 d_readlink=''
606 d_readv=''
607 d_recvmsg=''
608 d_rename=''
609 d_rmdir=''
610 d_safebcpy=''
611 d_safemcpy=''
612 d_sanemcmp=''
613 d_sbrkproto=''
614 d_scalbnl=''
615 d_select=''
616 d_sem=''
617 d_semctl=''
618 d_semget=''
619 d_semop=''
620 d_sendmsg=''
621 d_setegid=''
622 d_seteuid=''
623 d_setgrent=''
624 d_setgrent_r=''
625 setgrent_r_proto=''
626 d_setgrps=''
627 d_sethent=''
628 d_sethostent_r=''
629 sethostent_r_proto=''
630 d_setitimer=''
631 d_setlinebuf=''
632 d_setlocale=''
633 d_setlocale_r=''
634 setlocale_r_proto=''
635 d_setnent=''
636 d_setnetent_r=''
637 setnetent_r_proto=''
638 d_setpent=''
639 d_setpgid=''
640 d_setpgrp2=''
641 d_bsdsetpgrp=''
642 d_setpgrp=''
643 d_setprior=''
644 d_setproctitle=''
645 d_setprotoent_r=''
646 setprotoent_r_proto=''
647 d_setpwent=''
648 d_setpwent_r=''
649 setpwent_r_proto=''
650 d_setregid=''
651 d_setresgid=''
652 d_setresuid=''
653 d_setreuid=''
654 d_setrgid=''
655 d_setruid=''
656 d_setsent=''
657 d_setservent_r=''
658 setservent_r_proto=''
659 d_setsid=''
660 d_setvbuf=''
661 d_sfio=''
662 usesfio=''
663 d_shm=''
664 d_shmat=''
665 d_shmatprototype=''
666 shmattype=''
667 d_shmctl=''
668 d_shmdt=''
669 d_shmget=''
670 d_sigaction=''
671 d_sigprocmask=''
672 d_sigsetjmp=''
673 usesitecustomize=''
674 d_sockatmark=''
675 d_sockatmarkproto=''
676 d_msg_ctrunc=''
677 d_msg_dontroute=''
678 d_msg_oob=''
679 d_msg_peek=''
680 d_msg_proxy=''
681 d_oldsock=''
682 d_scm_rights=''
683 d_socket=''
684 d_sockpair=''
685 sockethdr=''
686 socketlib=''
687 d_socklen_t=''
688 d_socks5_init=''
689 d_sqrtl=''
690 d_srand48_r=''
691 srand48_r_proto=''
692 d_srandom_r=''
693 srandom_r_proto=''
694 d_sresgproto=''
695 d_sresuproto=''
696 d_statblks=''
697 d_statfs_f_flags=''
698 d_statfs_s=''
699 d_fstatvfs=''
700 d_statvfs=''
701 d_stdio_cnt_lval=''
702 d_stdio_ptr_lval=''
703 d_stdio_ptr_lval_nochange_cnt=''
704 d_stdio_ptr_lval_sets_cnt=''
705 d_stdiobase=''
706 d_stdstdio=''
707 stdio_base=''
708 stdio_bufsiz=''
709 stdio_cnt=''
710 stdio_filbuf=''
711 stdio_ptr=''
712 d_index=''
713 d_strchr=''
714 d_strcoll=''
715 d_strctcpy=''
716 d_strerrm=''
717 d_strerror=''
718 d_sysernlst=''
719 d_syserrlst=''
720 d_strerror_r=''
721 strerror_r_proto=''
722 d_strftime=''
723 d_strlcat=''
724 d_strlcpy=''
725 d_strtod=''
726 d_strtol=''
727 d_strtold=''
728 d_strtoll=''
729 d_strtoq=''
730 d_strtoul=''
731 d_strtoull=''
732 d_strtouq=''
733 d_strxfrm=''
734 d_symlink=''
735 d_syscall=''
736 d_syscallproto=''
737 d_sysconf=''
738 d_system=''
739 d_tcgetpgrp=''
740 d_tcsetpgrp=''
741 d_telldirproto=''
742 d_time=''
743 timetype=''
744 clocktype=''
745 d_times=''
746 d_tmpnam_r=''
747 tmpnam_r_proto=''
748 d_truncate=''
749 d_ttyname_r=''
750 ttyname_r_proto=''
751 d_tzname=''
752 d_u32align=''
753 d_ualarm=''
754 d_umask=''
755 d_semctl_semid_ds=''
756 d_semctl_semun=''
757 d_union_semun=''
758 d_unordered=''
759 d_usleep=''
760 d_usleepproto=''
761 d_ustat=''
762 d_vfork=''
763 usevfork=''
764 d_voidsig=''
765 signal_t=''
766 d_volatile=''
767 d_charvspr=''
768 d_vprintf=''
769 d_wait4=''
770 d_waitpid=''
771 d_wcstombs=''
772 d_wctomb=''
773 d_writev=''
774 dlext=''
775 cccdlflags=''
776 ccdlflags=''
777 dlsrc=''
778 ld=''
779 lddlflags=''
780 usedl=''
781 doublesize=''
782 ebcdic=''
783 fflushNULL=''
784 fflushall=''
785 fpossize=''
786 fpostype=''
787 gccansipedantic=''
788 gccosandvers=''
789 gccversion=''
790 gidformat=''
791 gidsign=''
792 gidsize=''
793 gidtype=''
794 groupstype=''
795 h_fcntl=''
796 h_sysfile=''
797 html1dir=''
798 html1direxp=''
799 installhtml1dir=''
800 html3dir=''
801 html3direxp=''
802 installhtml3dir=''
803 i_arpainet=''
804 i_crypt=''
805 db_hashtype=''
806 db_prefixtype=''
807 db_version_major=''
808 db_version_minor=''
809 db_version_patch=''
810 i_db=''
811 i_dbm=''
812 i_rpcsvcdbm=''
813 d_dirnamlen=''
814 direntrytype=''
815 i_dirent=''
816 i_dld=''
817 i_dlfcn=''
818 i_fcntl=''
819 i_float=''
820 i_fp=''
821 i_fp_class=''
822 i_gdbm=''
823 d_grpasswd=''
824 i_grp=''
825 i_ieeefp=''
826 i_inttypes=''
827 i_langinfo=''
828 i_libutil=''
829 i_limits=''
830 i_locale=''
831 i_machcthr=''
832 i_malloc=''
833 i_math=''
834 i_memory=''
835 i_mntent=''
836 i_ndbm=''
837 i_netdb=''
838 i_neterrno=''
839 i_netinettcp=''
840 i_niin=''
841 i_sysin=''
842 i_poll=''
843 i_prot=''
844 i_pthread=''
845 d_pwage=''
846 d_pwchange=''
847 d_pwclass=''
848 d_pwcomment=''
849 d_pwexpire=''
850 d_pwgecos=''
851 d_pwpasswd=''
852 d_pwquota=''
853 i_pwd=''
854 i_sfio=''
855 i_shadow=''
856 i_socks=''
857 i_stddef=''
858 i_stdlib=''
859 i_string=''
860 strings=''
861 i_sunmath=''
862 i_sysaccess=''
863 i_sysdir=''
864 i_sysfile=''
865 d_voidtty=''
866 i_bsdioctl=''
867 i_sysfilio=''
868 i_sysioctl=''
869 i_syssockio=''
870 i_syslog=''
871 i_sysmman=''
872 i_sysmode=''
873 i_sysmount=''
874 i_sysndir=''
875 i_sysparam=''
876 i_sysresrc=''
877 i_syssecrt=''
878 i_sysselct=''
879 i_sysstat=''
880 i_sysstatfs=''
881 i_sysstatvfs=''
882 i_systimes=''
883 i_systypes=''
884 i_sysuio=''
885 i_sysun=''
886 i_sysutsname=''
887 i_sysvfs=''
888 i_syswait=''
889 i_sgtty=''
890 i_termio=''
891 i_termios=''
892 d_tm_tm_gmtoff=''
893 d_tm_tm_zone=''
894 i_systime=''
895 i_systimek=''
896 i_time=''
897 timeincl=''
898 i_unistd=''
899 i_ustat=''
900 i_utime=''
901 i_values=''
902 i_stdarg=''
903 i_varargs=''
904 i_varhdr=''
905 i_vfork=''
906 inc_version_list=''
907 inc_version_list_init=''
908 installprefix=''
909 installprefixexp=''
910 installstyle=''
911 installusrbinperl=''
912 intsize=''
913 longsize=''
914 shortsize=''
915 issymlink=''
916 libc=''
917 ldlibpthname=''
918 libperl=''
919 shrpenv=''
920 useshrplib=''
921 glibpth=''
922 libpth=''
923 loclibpth=''
924 plibpth=''
925 xlibpth=''
926 ignore_versioned_solibs=''
927 libs=''
928 libsdirs=''
929 libsfiles=''
930 libsfound=''
931 libspath=''
932 lns=''
933 d_PRIEUldbl=''
934 d_PRIFUldbl=''
935 d_PRIGUldbl=''
936 d_PRIeldbl=''
937 d_PRIfldbl=''
938 d_PRIgldbl=''
939 d_SCNfldbl=''
940 sPRIEUldbl=''
941 sPRIFUldbl=''
942 sPRIGUldbl=''
943 sPRIeldbl=''
944 sPRIfldbl=''
945 sPRIgldbl=''
946 sSCNfldbl=''
947 lseeksize=''
948 lseektype=''
949 make_set_make=''
950 d_mymalloc=''
951 freetype=''
952 mallocobj=''
953 mallocsrc=''
954 malloctype=''
955 usemallocwrap=''
956 usemymalloc=''
957 installman1dir=''
958 man1dir=''
959 man1direxp=''
960 man1ext=''
961 installman3dir=''
962 man3dir=''
963 man3direxp=''
964 man3ext=''
965 modetype=''
966 multiarch=''
967 mydomain=''
968 myhostname=''
969 phostname=''
970 c=''
971 n=''
972 d_eofnblk=''
973 eagain=''
974 o_nonblock=''
975 rd_nodata=''
976 need_va_copy=''
977 netdb_hlen_type=''
978 netdb_host_type=''
979 netdb_name_type=''
980 netdb_net_type=''
981 groupcat=''
982 hostcat=''
983 passcat=''
984 orderlib=''
985 ranlib=''
986 d_perl_otherlibdirs=''
987 otherlibdirs=''
988 package=''
989 spackage=''
990 pager=''
991 api_revision=''
992 api_subversion=''
993 api_version=''
994 api_versionstring=''
995 patchlevel=''
996 perl_patchlevel=''
997 revision=''
998 subversion=''
999 version=''
1000 version_patchlevel_string=''
1001 perl5=''
1002 perladmin=''
1003 perlpath=''
1004 d_nv_preserves_uv=''
1005 d_nv_zero_is_allbits_zero=''
1006 i16size=''
1007 i16type=''
1008 i32size=''
1009 i32type=''
1010 i64size=''
1011 i64type=''
1012 i8size=''
1013 i8type=''
1014 ivsize=''
1015 ivtype=''
1016 nv_preserves_uv_bits=''
1017 nvsize=''
1018 nvtype=''
1019 u16size=''
1020 u16type=''
1021 u32size=''
1022 u32type=''
1023 u64size=''
1024 u64type=''
1025 u8size=''
1026 u8type=''
1027 uvsize=''
1028 uvtype=''
1029 ivdformat=''
1030 nvEUformat=''
1031 nvFUformat=''
1032 nvGUformat=''
1033 nveformat=''
1034 nvfformat=''
1035 nvgformat=''
1036 uvXUformat=''
1037 uvoformat=''
1038 uvuformat=''
1039 uvxformat=''
1040 pidtype=''
1041 prefix=''
1042 prefixexp=''
1043 installprivlib=''
1044 privlib=''
1045 privlibexp=''
1046 prototype=''
1047 ptrsize=''
1048 d_PRIXU64=''
1049 d_PRId64=''
1050 d_PRIi64=''
1051 d_PRIo64=''
1052 d_PRIu64=''
1053 d_PRIx64=''
1054 sPRIXU64=''
1055 sPRId64=''
1056 sPRIi64=''
1057 sPRIo64=''
1058 sPRIu64=''
1059 sPRIx64=''
1060 d_quad=''
1061 quadkind=''
1062 quadtype=''
1063 uquadtype=''
1064 drand01=''
1065 randbits=''
1066 randfunc=''
1067 randseedtype=''
1068 seedfunc=''
1069 installscript=''
1070 scriptdir=''
1071 scriptdirexp=''
1072 selectminbits=''
1073 selecttype=''
1074 sh=''
1075 sig_count=''
1076 sig_name=''
1077 sig_name_init=''
1078 sig_num=''
1079 sig_num_init=''
1080 sig_size=''
1081 installsitearch=''
1082 sitearch=''
1083 sitearchexp=''
1084 installsitebin=''
1085 sitebin=''
1086 sitebinexp=''
1087 installsitehtml1dir=''
1088 sitehtml1dir=''
1089 sitehtml1direxp=''
1090 installsitehtml3dir=''
1091 sitehtml3dir=''
1092 sitehtml3direxp=''
1093 installsitelib=''
1094 sitelib=''
1095 sitelib_stem=''
1096 sitelibexp=''
1097 installsiteman1dir=''
1098 siteman1dir=''
1099 siteman1direxp=''
1100 installsiteman3dir=''
1101 siteman3dir=''
1102 siteman3direxp=''
1103 siteprefix=''
1104 siteprefixexp=''
1105 installsitescript=''
1106 sitescript=''
1107 sitescriptexp=''
1108 sizesize=''
1109 sizetype=''
1110 so=''
1111 socksizetype=''
1112 sharpbang=''
1113 shsharp=''
1114 spitshell=''
1115 src=''
1116 ssizetype=''
1117 startperl=''
1118 startsh=''
1119 stdchar=''
1120 d_stdio_stream_array=''
1121 stdio_stream_array=''
1122 sysman=''
1123 trnl=''
1124 uidformat=''
1125 uidsign=''
1126 uidsize=''
1127 uidtype=''
1128 archname64=''
1129 use64bitall=''
1130 use64bitint=''
1131 usefaststdio=''
1132 ccflags_uselargefiles=''
1133 ldflags_uselargefiles=''
1134 libswanted_uselargefiles=''
1135 uselargefiles=''
1136 uselongdouble=''
1137 usemorebits=''
1138 usemultiplicity=''
1139 nm_opt=''
1140 nm_so_opt=''
1141 runnm=''
1142 usenm=''
1143 useperlio=''
1144 userelocatableinc=''
1145 usesocks=''
1146 d_oldpthreads=''
1147 use5005threads=''
1148 useithreads=''
1149 usereentrant=''
1150 usethreads=''
1151 incpath=''
1152 mips_type=''
1153 usrinc=''
1154 d_vendorarch=''
1155 installvendorarch=''
1156 vendorarch=''
1157 vendorarchexp=''
1158 d_vendorbin=''
1159 installvendorbin=''
1160 vendorbin=''
1161 vendorbinexp=''
1162 installvendorhtml1dir=''
1163 vendorhtml1dir=''
1164 vendorhtml1direxp=''
1165 installvendorhtml3dir=''
1166 vendorhtml3dir=''
1167 vendorhtml3direxp=''
1168 d_vendorlib=''
1169 installvendorlib=''
1170 vendorlib=''
1171 vendorlib_stem=''
1172 vendorlibexp=''
1173 installvendorman1dir=''
1174 vendorman1dir=''
1175 vendorman1direxp=''
1176 installvendorman3dir=''
1177 vendorman3dir=''
1178 vendorman3direxp=''
1179 usevendorprefix=''
1180 vendorprefix=''
1181 vendorprefixexp=''
1182 d_vendorscript=''
1183 installvendorscript=''
1184 vendorscript=''
1185 vendorscriptexp=''
1186 versiononly=''
1187 defvoidused=''
1188 voidflags=''
1189 yacc=''
1190 yaccflags=''
1191 CONFIG=''
1192
1193 define='define'
1194 undef='undef'
1195 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1196 rmlist=''
1197
1198 : We must find out about Eunice early
1199 eunicefix=':'
1200 if test -f /etc/unixtovms; then
1201         eunicefix=/etc/unixtovms
1202 fi
1203 if test -f /etc/unixtovms.exe; then
1204         eunicefix=/etc/unixtovms.exe
1205 fi
1206
1207 : Set executable suffix now -- needed before hints available
1208 if test -f "/libs/version.library"; then
1209 : Amiga OS
1210     _exe=""
1211 elif test -f "/system/gnu_library/bin/ar.pm"; then
1212 : Stratus VOS
1213     _exe=".pm"
1214 elif test -n "$DJGPP"; then
1215 : DOS DJGPP
1216     _exe=".exe"
1217 elif test -d c:/. -o -n "$is_os2" ; then
1218 : OS/2 or cygwin
1219     _exe=".exe"
1220 fi
1221
1222 i_whoami=''
1223 ccname=''
1224 ccversion=''
1225 perllibs=''
1226 : set useposix=false in your hint file to disable the POSIX extension.
1227 useposix=true
1228 : set useopcode=false in your hint file to disable the Opcode extension.
1229 useopcode=true
1230 : Trailing extension.  Override this in a hint file, if needed.
1231 : Extra object files, if any, needed on this platform.
1232 archobjs=''
1233 archname=''
1234 : Possible local include directories to search.
1235 : Set locincpth to "" in a hint file to defeat local include searches.
1236 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1237 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1238 :
1239 : no include file wanted by default
1240 inclwanted=''
1241
1242 groupstype=''
1243 libnames=''
1244 : change the next line if compiling for Xenix/286 on Xenix/386
1245 xlibpth='/usr/lib/386 /lib/386'
1246 : Possible local library directories to search.
1247 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1248 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1249
1250 : general looking path for locating libraries
1251 glibpth="/lib /usr/lib $xlibpth"
1252 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1253 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1254 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1255
1256 : Private path used by Configure to find libraries.  Its value
1257 : is prepended to libpth. This variable takes care of special
1258 : machines, like the mips.  Usually, it should be empty.
1259 plibpth=''
1260
1261 : default library list
1262 libswanted=''
1263 : some systems want to use only the non-versioned libso:s
1264 ignore_versioned_solibs=''
1265 siteman1dir=''
1266 siteman3dir=''
1267 sitescript=''
1268 archname64=''
1269 ccflags_uselargefiles=''
1270 ldflags_uselargefiles=''
1271 libswanted_uselargefiles=''
1272 : set usemultiplicity on the Configure command line to enable multiplicity.
1273 : set usesocks on the Configure command line to enable socks.
1274 : set usethreads on the Configure command line to enable threads.
1275 usereentrant='undef'
1276 : full support for void wanted by default
1277 defvoidused=15
1278
1279 : List of libraries we want.
1280 : If anyone needs extra -lxxx, put those in a hint file.
1281 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1282 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1283 : We probably want to search /usr/shlib before most other libraries.
1284 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1285 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1286 glibpth="/usr/shlib $glibpth"
1287 : Do not use vfork unless overridden by a hint file.
1288 usevfork=false
1289
1290 : Find the basic shell for Bourne shell scripts
1291 case "$sh" in
1292 '')
1293         case "$SYSTYPE" in
1294         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1295         *) xxx='/bin/sh';;
1296         esac
1297         if test -f "$xxx"; then
1298                 sh="$xxx"
1299         else
1300                 : Build up a list and do a single loop so we can 'break' out.
1301                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1302                 for xxx in sh bash ksh pdksh ash; do
1303                         for p in $pth; do
1304                                 try="$try ${p}/${xxx}"
1305                         done
1306                 done
1307                 for xxx in $try; do
1308                         if test -f "$xxx"; then
1309                                 sh="$xxx";
1310                                 break
1311                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1312                                 sh="$xxx";
1313                                 break
1314                         elif test -f "$xxx.exe"; then
1315                                 sh="$xxx";
1316                                 break
1317                         fi
1318                 done
1319         fi
1320         ;;
1321 esac
1322
1323 case "$sh" in
1324 '')     cat >&2 <<EOM
1325 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1326
1327 Usually it's in /bin/sh.  How did you even get this far?
1328 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1329 we'll try to straighten this all out.
1330 EOM
1331         exit 1
1332         ;;
1333 esac
1334
1335 : see if sh knows # comments
1336 if `$sh -c '#' >/dev/null 2>&1`; then
1337         shsharp=true
1338         spitshell=cat
1339         xcat=/bin/cat
1340         test -f $xcat$_exe || xcat=/usr/bin/cat
1341         if test ! -f $xcat$_exe; then
1342                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1343                         if test -f $p/cat$_exe; then
1344                                 xcat=$p/cat
1345                                 break
1346                         fi
1347                 done
1348                 if test ! -f $xcat$_exe; then
1349                         echo "Can't find cat anywhere!"
1350                         exit 1
1351                 fi
1352         fi
1353         echo "#!$xcat" >sharp
1354         $eunicefix sharp
1355         chmod +x sharp
1356         ./sharp > today
1357         if test -s today; then
1358                 sharpbang='#!'
1359         else
1360                 echo "#! $xcat" > sharp
1361                 $eunicefix sharp
1362                 chmod +x sharp
1363                 ./sharp > today
1364                 if test -s today; then
1365                         sharpbang='#! '
1366                 else
1367                         sharpbang=': use '
1368                 fi
1369         fi
1370 else
1371         echo " "
1372         echo "Your $sh doesn't grok # comments--I will strip them later on."
1373         shsharp=false
1374         cd ..
1375         echo "exec grep -v '^[  ]*#'" >spitshell
1376         chmod +x spitshell
1377         $eunicefix spitshell
1378         spitshell=`pwd`/spitshell
1379         cd UU
1380         echo "I presume that if # doesn't work, #! won't work either!"
1381         sharpbang=': use '
1382 fi
1383 rm -f sharp today
1384
1385 : figure out how to guarantee sh startup
1386 case "$startsh" in
1387 '') startsh=${sharpbang}${sh} ;;
1388 *)
1389 esac
1390 cat >sharp <<EOSS
1391 $startsh
1392 set abc
1393 test "$?abc" != 1
1394 EOSS
1395
1396 chmod +x sharp
1397 $eunicefix sharp
1398 if ./sharp; then
1399         : echo "Yup, it does."
1400 else
1401         echo "Hmm... '$startsh' does not guarantee sh startup..."
1402         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1403 fi
1404 rm -f sharp
1405
1406
1407 : Save command line options in file UU/cmdline.opt for later use in
1408 : generating config.sh.
1409 cat > cmdline.opt <<EOSH
1410 # Configure command line arguments.
1411 config_arg0='$0'
1412 config_args='$*'
1413 config_argc=$#
1414 EOSH
1415 argn=1
1416 args_exp=''
1417 args_sep=''
1418 for arg in "$@"; do
1419         cat >>cmdline.opt <<EOSH
1420 config_arg$argn='$arg'
1421 EOSH
1422         # Extreme backslashitis: replace each ' by '"'"'
1423         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1424 $arg
1425 EOC
1426         arg_exp=`cat cmdl.opt`
1427         args_exp="$args_exp$args_sep'$arg_exp'"
1428         argn=`expr $argn + 1`
1429         args_sep=' '
1430 done
1431 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1432 # used by ./hints/os2.sh
1433 rm -f cmdl.opt
1434
1435 : produce awk script to parse command line options
1436 cat >options.awk <<'EOF'
1437 BEGIN {
1438         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1439
1440         len = length(optstr);
1441         for (i = 1; i <= len; i++) {
1442                 c = substr(optstr, i, 1);
1443                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1444                 if (a == ":") {
1445                         arg[c] = 1;
1446                         i++;
1447                 }
1448                 opt[c] = 1;
1449         }
1450 }
1451 {
1452         expect = 0;
1453         str = $0;
1454         if (substr(str, 1, 1) != "-") {
1455                 printf("'%s'\n", str);
1456                 next;
1457         }
1458         len = length($0);
1459         for (i = 2; i <= len; i++) {
1460                 c = substr(str, i, 1);
1461                 if (!opt[c]) {
1462                         printf("-%s\n", substr(str, i));
1463                         next;
1464                 }
1465                 printf("-%s\n", c);
1466                 if (arg[c]) {
1467                         if (i < len)
1468                                 printf("'%s'\n", substr(str, i + 1));
1469                         else
1470                                 expect = 1;
1471                         next;
1472                 }
1473         }
1474 }
1475 END {
1476         if (expect)
1477                 print "?";
1478 }
1479 EOF
1480
1481 : process the command line options
1482 set X `for arg in "$@"; do echo "X$arg"; done |
1483         sed -e s/X// | awk -f options.awk`
1484 eval "set $*"
1485 shift
1486 rm -f options.awk
1487
1488 : set up default values
1489 fastread=''
1490 reuseval=false
1491 config_sh=''
1492 alldone=''
1493 error=''
1494 silent=''
1495 extractsh=''
1496 override=''
1497 knowitall=''
1498 rm -f optdef.sh posthint.sh
1499 cat >optdef.sh <<EOS
1500 $startsh
1501 EOS
1502
1503
1504 : option parsing
1505 while test $# -gt 0; do
1506         case "$1" in
1507         -d) shift; fastread=yes;;
1508         -e) shift; alldone=cont;;
1509         -f)
1510                 shift
1511                 cd ..
1512                 if test -r "$1"; then
1513                         config_sh="$1"
1514                 else
1515                         echo "$me: cannot read config file $1." >&2
1516                         error=true
1517                 fi
1518                 cd UU
1519                 shift;;
1520         -h) shift; error=true;;
1521         -r) shift; reuseval=true;;
1522         -s) shift; silent=true; realsilent=true;;
1523         -E) shift; alldone=exit;;
1524         -K) shift; knowitall=true;;
1525         -O) shift; override=true;;
1526         -S) shift; silent=true; extractsh=true;;
1527         -D)
1528                 shift
1529                 case "$1" in
1530                 *=)
1531                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1532                         echo "$me: ignoring -D $1" >&2
1533                         ;;
1534                 *=*) echo "$1" | \
1535                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1536                 *) echo "$1='define'" >> optdef.sh;;
1537                 esac
1538                 shift
1539                 ;;
1540         -U)
1541                 shift
1542                 case "$1" in
1543                 *=) echo "$1" >> optdef.sh;;
1544                 *=*)
1545                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1546                         echo "$me: ignoring -U $1" >&2
1547                         ;;
1548                 *) echo "$1='undef'" >> optdef.sh;;
1549                 esac
1550                 shift
1551                 ;;
1552         -A)
1553             shift
1554             xxx=''
1555             yyy="$1"
1556             zzz=''
1557             uuu=undef
1558             case "$yyy" in
1559             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1560                  case "$zzz" in
1561                  *:*) zzz='' ;;
1562                  *)   xxx=append
1563                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1564                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1565                  esac
1566                  ;;
1567             esac
1568             case "$xxx" in
1569             '')  case "$yyy" in
1570                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1571                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1572                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1573                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1574                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1575                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1576                  esac
1577                  ;;       
1578             esac
1579             case "$xxx" in
1580             append)
1581                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1582             clear)
1583                 echo "$yyy=''"                  >> posthint.sh ;;
1584             define)
1585                 case "$zzz" in
1586                 '') zzz=define ;;
1587                 esac
1588                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1589             eval)
1590                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1591             prepend)
1592                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1593             undef)
1594                 case "$zzz" in
1595                 '') zzz="$uuu" ;;
1596                 esac
1597                 echo "$yyy=$zzz"                >> posthint.sh ;;
1598             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1599             esac
1600             shift
1601             ;;
1602         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1603             exit 0;;
1604         --) break;;
1605         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1606         *) break;;
1607         esac
1608 done
1609
1610 case "$error" in
1611 true)
1612         cat >&2 <<EOM
1613 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1614                  [-U symbol] [-U symbol=] [-A command:symbol...]
1615   -d : use defaults for all answers.
1616   -e : go on without questioning past the production of config.sh.
1617   -f : specify an alternate default configuration file.
1618   -h : print this help message and exit (with an error status).
1619   -r : reuse C symbols value if possible (skips costly nm extraction).
1620   -s : silent mode, only echoes questions and essential information.
1621   -D : define symbol to have some value:
1622          -D symbol         symbol gets the value 'define'
1623          -D symbol=value   symbol gets the value 'value'
1624   -E : stop at the end of questions, after having produced config.sh.
1625   -K : do not use unless you know what you are doing.
1626   -O : let -D and -U override definitions from loaded configuration file.
1627   -S : perform variable substitutions on all .SH files (can mix with -f)
1628   -U : undefine symbol:
1629          -U symbol    symbol gets the value 'undef'
1630          -U symbol=   symbol gets completely empty
1631   -A : manipulate symbol after the platform specific hints have been applied:
1632          -A symbol=value                append " "value to symbol
1633          -A append:symbol=value         append value to symbol
1634          -A define:symbol=value         define symbol to have value
1635          -A clear:symbol                define symbol to be ''
1636          -A define:symbol               define symbol to be 'define'
1637          -A eval:symbol=value           define symbol to be eval of value
1638          -A prepend:symbol=value        prepend value to symbol
1639          -A undef:symbol                define symbol to be 'undef'
1640          -A undef:symbol=               define symbol to be ''
1641   -V : print version number and exit (with a zero status).
1642 EOM
1643         exit 1
1644         ;;
1645 esac
1646
1647 : Sanity checks
1648 case "$fastread$alldone" in
1649 yescont|yesexit) ;;
1650 *)
1651         case "$extractsh" in
1652         true) ;;
1653         *)
1654                 if test ! -t 0; then
1655                         echo "Say 'sh Configure', not 'sh <Configure'"
1656                         exit 1
1657                 fi
1658                 ;;
1659         esac
1660         ;;
1661 esac
1662
1663 exec 4>&1
1664 case "$silent" in
1665 true) exec 1>/dev/null;;
1666 esac
1667
1668 : run the defines and the undefines, if any, but leave the file out there...
1669 touch optdef.sh
1670 . ./optdef.sh
1671 : create the posthint manipulation script and leave the file out there...
1672 touch posthint.sh
1673
1674 : set package name
1675 package=perl5
1676 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1677 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1678 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1679 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1680 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1681 esac
1682
1683 : Some greps do not return status, grrr.
1684 echo "grimblepritz" >grimble
1685 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1686         contains=contains
1687 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1688         contains=grep
1689 else
1690         contains=contains
1691 fi
1692 rm -f grimble
1693 : the following should work in any shell
1694 case "$contains" in
1695 contains*)
1696         echo " "
1697         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1698         cat >contains <<'EOSS'
1699 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1700 EOSS
1701 chmod +x contains
1702 esac
1703
1704 : Find the path to the source tree
1705 case "$src" in
1706 '') case "$0" in
1707     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1708          case "$src" in
1709          /*)    ;;
1710          .)     ;;
1711          *)     src=`cd ../$src && pwd` ;;
1712          esac
1713          ;;
1714     *)   src='.';;
1715     esac;;
1716 esac
1717 case "$src" in
1718 '')     src=/
1719         rsrc=/
1720         ;;
1721 /*) rsrc="$src";;
1722 *) rsrc="../$src";;
1723 esac
1724 if test -f $rsrc/Configure && \
1725         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1726 then
1727    : found it, so we are ok.
1728 else
1729         rsrc=''
1730         for src in . .. ../.. ../../.. ../../../..; do
1731                 if test -f ../$src/Configure && \
1732                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1733                 then
1734                         rsrc=../$src
1735                         break
1736                 fi
1737         done
1738 fi
1739 case "$rsrc" in
1740 '')
1741         cat <<EOM >&4
1742
1743 Sorry, I can't seem to locate the source dir for $package.  Please start
1744 Configure with an explicit path -- i.e. /some/path/Configure.
1745
1746 EOM
1747         exit 1
1748         ;;
1749 ../.)   rsrc='..';;
1750 *)
1751         echo " "
1752         echo "Sources for $package found in \"$src\"." >&4
1753         ;;
1754 esac
1755
1756 : script used to extract .SH files with variable substitutions
1757 cat >extract <<'EOS'
1758 PERL_CONFIG_SH=true
1759 echo "Doing variable substitutions on .SH files..."
1760 if test -f MANIFEST; then
1761         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1762 else
1763         echo "(Looking for .SH files under the source directory.)"
1764         set x `(cd "$src"; find . -name "*.SH" -print)`
1765 fi
1766 shift
1767 case $# in
1768 0) set x `(cd "$src"; echo *.SH)`; shift;;
1769 esac
1770 if test ! -f "$src/$1"; then
1771         shift
1772 fi
1773 mkdir_p='
1774 name=$1;
1775 create="";
1776 while test $name; do
1777         if test ! -d "$name"; then
1778                 create="$name $create";
1779                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1780                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1781         else
1782                 name="";
1783         fi;
1784 done;
1785 for file in $create; do
1786         mkdir $file;
1787 done
1788 '
1789 for file in $*; do
1790         case "$src" in
1791         ".")
1792                 case "$file" in
1793                 */*)
1794                         dir=`expr X$file : 'X\(.*\)/'`
1795                         file=`expr X$file : 'X.*/\(.*\)'`
1796                         (cd "$dir" && . ./$file)
1797                         ;;
1798                 *)
1799                         . ./$file
1800                         ;;
1801                 esac
1802                 ;;
1803         *)
1804                 case "$file" in
1805                 */*)
1806                         dir=`expr X$file : 'X\(.*\)/'`
1807                         file=`expr X$file : 'X.*/\(.*\)'`
1808                         (set x $dir; shift; eval $mkdir_p)
1809                         sh <"$src/$dir/$file"
1810                         ;;
1811                 *)
1812                         sh <"$src/$file"
1813                         ;;
1814                 esac
1815                 ;;
1816         esac
1817 done
1818 if test -f "$src/config_h.SH"; then
1819         if test ! -f config.h; then
1820         : oops, they left it out of MANIFEST, probably, so do it anyway.
1821         . "$src/config_h.SH"
1822         fi
1823 fi
1824 EOS
1825
1826 : extract files and exit if asked to do so
1827 case "$extractsh" in
1828 true)
1829         case "$realsilent" in
1830         true) ;;
1831         *) exec 1>&4;;
1832         esac
1833         case "$config_sh" in
1834         '') config_sh='config.sh';;
1835         esac
1836         echo " "
1837         echo "Fetching answers from $config_sh..."
1838         cd ..
1839         . $config_sh
1840         test "$override" && . ./optdef.sh
1841         echo " "
1842         . UU/extract
1843         rm -rf UU
1844         echo "Extraction done."
1845         exit 0
1846         ;;
1847 esac
1848
1849 : Eunice requires " " instead of "", can you believe it
1850 echo " "
1851 : Here we go...
1852 echo "Beginning of configuration questions for $package."
1853
1854 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1855
1856 : first determine how to suppress newline on echo command
1857 echo " "
1858 echo "Checking echo to see how to suppress newlines..."
1859 (echo "hi there\c" ; echo " ") >.echotmp
1860 if $contains c .echotmp >/dev/null 2>&1 ; then
1861         echo "...using -n."
1862         n='-n'
1863         c=''
1864 else
1865         cat <<'EOM'
1866 ...using \c
1867 EOM
1868         n=''
1869         c='\c'
1870 fi
1871 echo $n "The star should be here-->$c"
1872 echo '*'
1873 rm -f .echotmp
1874
1875 : Now test for existence of everything in MANIFEST
1876 echo " "
1877 if test -f "$rsrc/MANIFEST"; then
1878         echo "First let's make sure your kit is complete.  Checking..." >&4
1879         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1880         rm -f missing
1881         tmppwd=`pwd`
1882         for filelist in x??; do
1883                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1884         done
1885         if test -s missing; then
1886                 cat missing >&4
1887                 cat >&4 <<'EOM'
1888
1889 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1890
1891 You have the option of continuing the configuration process, despite the
1892 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1893 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1894 and contact the author (perlbug@perl.org).
1895
1896 EOM
1897                 echo $n "Continue? [n] $c" >&4
1898                 read ans
1899                 case "$ans" in
1900                 y*)
1901                         echo "Continuing..." >&4
1902                         rm -f missing
1903                         ;;
1904                 *)
1905                         echo "ABORTING..." >&4
1906                         kill $$
1907                         ;;
1908                 esac
1909         else
1910                 echo "Looks good..."
1911         fi
1912 else
1913         echo "There is no MANIFEST file.  I hope your kit is complete !"
1914 fi
1915 rm -f missing x??
1916
1917 echo " "
1918 : Find the appropriate value for a newline for tr
1919 if test -n "$DJGPP"; then
1920        trnl='\012'
1921 fi
1922 if test X"$trnl" = X; then
1923         case "`echo foo|tr '\n' x 2>/dev/null`" in
1924         foox) trnl='\n' ;;
1925         esac
1926 fi
1927 if test X"$trnl" = X; then
1928         case "`echo foo|tr '\012' x 2>/dev/null`" in
1929         foox) trnl='\012' ;;
1930         esac
1931 fi
1932 if test X"$trnl" = X; then
1933        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1934        fooxy) trnl='\n\r' ;;
1935        esac
1936 fi
1937 if test X"$trnl" = X; then
1938         cat <<EOM >&2
1939
1940 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1941
1942 EOM
1943         exit 1
1944 fi
1945
1946 : compute the number of columns on the terminal for proper question formatting
1947 case "$COLUMNS" in
1948 '') COLUMNS='80';;
1949 esac
1950
1951 : set up the echo used in my read
1952 myecho="case \"\$xxxm\" in
1953 '') echo $n \"\$rp $c\" >&4;;
1954 *) case \"\$rp\" in
1955         '') echo $n \"[\$xxxm] $c\";;
1956         *)
1957                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1958                         echo \"\$rp\" >&4
1959                         echo $n \"[\$xxxm] $c\" >&4
1960                 else
1961                         echo $n \"\$rp [\$xxxm] $c\" >&4
1962                 fi
1963                 ;;
1964         esac;;
1965 esac"
1966
1967 : now set up to do reads with possible shell escape and default assignment
1968 cat <<EOSC >myread
1969 $startsh
1970 xxxm=\$dflt
1971 $myecho
1972 ans='!'
1973 case "\$fastread" in
1974 yes) case "\$dflt" in
1975         '') ;;
1976         *) ans='';
1977                 case "\$silent-\$rp" in
1978                 true-) ;;
1979                 *) echo " " >&4;;
1980                 esac;;
1981         esac;;
1982 *) case "\$silent" in
1983         true) case "\$rp" in
1984                 '') ans='';;
1985                 esac;;
1986         esac;;
1987 esac
1988 while expr "X\$ans" : "X!" >/dev/null; do
1989         read answ
1990         set x \$xxxm
1991         shift
1992         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1993         case  "\$answ" in
1994         "!")
1995                 sh 1>&4
1996                 echo " "
1997                 $myecho
1998                 ;;
1999         !*)
2000                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2001                 shift
2002                 sh 1>&4 -c "\$*"
2003                 echo " "
2004                 $myecho
2005                 ;;
2006         "\$ans")
2007                 case "\$ans" in
2008                 \\&*)
2009                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2010                         shift
2011                         case "\$1" in
2012                         -d)
2013                                 fastread=yes
2014                                 echo "(OK, I'll run with -d after this question.)" >&4
2015                                 ;;
2016                         -*)
2017                                 echo "*** Sorry, \$1 not supported yet." >&4
2018                                 ;;
2019                         esac
2020                         $myecho
2021                         ans=!
2022                         ;;
2023                 esac;;
2024         *)
2025                 case "\$aok" in
2026                 y)
2027                         echo "*** Substitution done -- please confirm."
2028                         xxxm="\$ans"
2029                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2030                         xxxm="\$ans"
2031                         ans=!
2032                         ;;
2033                 *)
2034                         echo "*** Error -- try again."
2035                         ans=!
2036                         ;;
2037                 esac
2038                 $myecho
2039                 ;;
2040         esac
2041         case "\$ans\$xxxm\$nostick" in
2042         '')
2043                 ans=!
2044                 $myecho
2045                 ;;
2046         esac
2047 done
2048 case "\$ans" in
2049 '') ans="\$xxxm";;
2050 esac
2051 EOSC
2052
2053 : create .config dir to save info across Configure sessions
2054 test -d ../.config || mkdir ../.config
2055 cat >../.config/README <<EOF
2056 This directory created by Configure to save information that should
2057 persist across sessions for $package.
2058
2059 You may safely delete it if you wish.
2060 EOF
2061
2062 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2063 case "$usedevel" in
2064 $define|true|[yY]*) ;;
2065 *) case "$xversion" in
2066    *[13579])
2067         cat >&4 <<EOH
2068 *** WHOA THERE!!! ***
2069
2070     This is an UNSTABLE DEVELOPMENT release.
2071     The version of this $package distribution is $xversion, that is, odd,
2072     (as opposed to even) and that signifies a development release.
2073     If you want a maintenance release, you want an even-numbered version.
2074
2075     Do ***NOT*** install this into production use.
2076     Data corruption and crashes are possible.
2077
2078     It is most seriously suggested that you do not continue any further
2079     unless you want to help in developing and debugging Perl.
2080
2081     If you *still* want to build perl, you can answer 'y' now,
2082     or pass -Dusedevel to Configure.
2083
2084 EOH
2085         rp='Do you really want to continue?'
2086         dflt='n'
2087         . ./myread
2088         case "$ans" in
2089         [yY]) echo >&4 "Okay, continuing."
2090               usedevel="$define" ;;
2091         *) echo >&4 "Okay, bye."
2092            exit 1
2093            ;;
2094         esac
2095         ;;
2096     esac
2097     ;;
2098 esac
2099 case "$usedevel" in
2100 $define|true|[yY]*)
2101         case "$versiononly" in
2102         '') versiononly="$define" ;;
2103         esac
2104         case "$installusrbinperl" in
2105         '') installusrbinperl="$undef" ;;
2106         esac
2107         ;;
2108 esac
2109
2110 : general instructions
2111 needman=true
2112 firsttime=true
2113 user=`(logname) 2>/dev/null`
2114 case "$user" in
2115 '') user=`whoami 2>&1`;;
2116 esac
2117 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2118         firsttime=false
2119         echo " "
2120         rp='Would you like to see the instructions?'
2121         dflt=n
2122         . ./myread
2123         case "$ans" in
2124         [yY]*) ;;
2125         *) needman=false;;
2126         esac
2127 fi
2128 if $needman; then
2129         cat <<EOH
2130
2131 This installation shell script will examine your system and ask you questions
2132 to determine how the perl5 package should be installed. If you get
2133 stuck on a question, you may use a ! shell escape to start a subshell or
2134 execute a command.  Many of the questions will have default answers in square
2135 brackets; typing carriage return will give you the default.
2136
2137 On some of the questions which ask for file or directory names you are allowed
2138 to use the ~name construct to specify the login directory belonging to "name",
2139 even if you don't have a shell which knows about that.  Questions where this is
2140 allowed will be marked "(~name ok)".
2141
2142 EOH
2143         rp=''
2144         dflt='Type carriage return to continue'
2145         . ./myread
2146         cat <<'EOH'
2147
2148 The prompter used in this script allows you to use shell variables and
2149 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2150 in the default answer, as if the default line was a set of arguments given to a
2151 script shell.  This means you may also use $* to repeat the whole default line,
2152 so you do not have to re-type everything to add something to the default.
2153
2154 Everytime there is a substitution, you will have to confirm.  If there is an
2155 error (e.g. an unmatched backtick), the default answer will remain unchanged
2156 and you will be prompted again.
2157
2158 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2159 the questions and use the computed defaults (or the previous answers if there
2160 was already a config.sh file). Type 'Configure -h' for a list of options.
2161 You may also start interactively and then answer '& -d' at any prompt to turn
2162 on the non-interactive behaviour for the remainder of the execution.
2163
2164 EOH
2165         . ./myread
2166         cat <<EOH
2167
2168 Much effort has been expended to ensure that this shell script will run on any
2169 Unix system.  If despite that it blows up on yours, your best bet is to edit
2170 Configure and run it again.  If you can't run Configure for some reason,
2171 you'll have to generate a config.sh file by hand.  Whatever problems you
2172 have, let me (perlbug@perl.org) know how I blew it.
2173
2174 This installation script affects things in two ways:
2175
2176 1) it may do direct variable substitutions on some of the files included
2177    in this kit.
2178 2) it builds a config.h file for inclusion in C programs.  You may edit
2179    any of these files as the need arises after running this script.
2180
2181 If you make a mistake on a question, there is no easy way to back up to it
2182 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2183 files.  Configure will offer to let you do this before it runs the SH files.
2184
2185 EOH
2186         dflt='Type carriage return to continue'
2187         . ./myread
2188         case "$firsttime" in
2189         true) echo $user >>../.config/instruct;;
2190         esac
2191 fi
2192
2193 : find out where common programs are
2194 echo " "
2195 echo "Locating common programs..." >&4
2196 cat <<EOSC >loc
2197 $startsh
2198 case \$# in
2199 0) exit 1;;
2200 esac
2201 thing=\$1
2202 shift
2203 dflt=\$1
2204 shift
2205 for dir in \$*; do
2206         case "\$thing" in
2207         .)
2208         if test -d \$dir/\$thing; then
2209                 echo \$dir
2210                 exit 0
2211         fi
2212         ;;
2213         *)
2214         for thisthing in \$dir/\$thing; do
2215                 : just loop through to pick last item
2216         done
2217         if test -f \$thisthing; then
2218                 echo \$thisthing
2219                 exit 0
2220         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2221                 echo \$thisthing
2222                 exit 0
2223         elif test -f \$dir/\$thing.exe; then
2224                 if test -n "$DJGPP"; then
2225                         echo \$dir/\$thing.exe
2226                 elif test "$eunicefix" != ":"; then
2227                         : on Eunice apparently
2228                         echo \$dir/\$thing
2229                         exit 0
2230                 fi
2231                 exit 0
2232         fi
2233         ;;
2234         esac
2235 done
2236 echo \$dflt
2237 exit 1
2238 EOSC
2239 chmod +x loc
2240 $eunicefix loc
2241 loclist="
2242 awk
2243 cat
2244 chmod
2245 comm
2246 cp
2247 echo
2248 expr
2249 grep
2250 ls
2251 mkdir
2252 rm
2253 sed
2254 sort
2255 touch
2256 tr
2257 uniq
2258 "
2259 trylist="
2260 Mcc
2261 ar
2262 bison
2263 byacc
2264 cpp
2265 csh
2266 date
2267 egrep
2268 gmake
2269 gzip
2270 less
2271 ln
2272 make
2273 more
2274 nm
2275 nroff
2276 pg
2277 test
2278 uname
2279 zip
2280 "
2281 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2282 pth="$pth /lib /usr/lib"
2283 for file in $loclist; do
2284         eval xxx=\$$file
2285         case "$xxx" in
2286         /*|?:[\\/]*)
2287                 if test -f "$xxx"; then
2288                         : ok
2289                 else
2290                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2291                         xxx=`./loc $file $file $pth`
2292                 fi
2293                 ;;
2294         '') xxx=`./loc $file $file $pth`;;
2295         *) xxx=`./loc $xxx $xxx $pth`;;
2296         esac
2297         eval $file=$xxx$_exe
2298         eval _$file=$xxx
2299         case "$xxx" in
2300         /*)
2301                 echo $file is in $xxx.
2302                 ;;
2303         ?:[\\/]*)
2304                 echo $file is in $xxx.
2305                 ;;
2306         *)
2307                 echo "I don't know where '$file' is, and my life depends on it." >&4
2308                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2309                 exit 1
2310                 ;;
2311         esac
2312 done
2313 echo " "
2314 echo "Don't worry if any of the following aren't found..."
2315 say=offhand
2316 for file in $trylist; do
2317         eval xxx=\$$file
2318         case "$xxx" in
2319         /*|?:[\\/]*)
2320                 if test -f "$xxx"; then
2321                         : ok
2322                 else
2323                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2324                         xxx=`./loc $file $file $pth`
2325                 fi
2326                 ;;
2327         '') xxx=`./loc $file $file $pth`;;
2328         *) xxx=`./loc $xxx $xxx $pth`;;
2329         esac
2330         eval $file=$xxx$_exe
2331         eval _$file=$xxx
2332         case "$xxx" in
2333         /*)
2334                 echo $file is in $xxx.
2335                 ;;
2336         ?:[\\/]*)
2337                 echo $file is in $xxx.
2338                 ;;
2339         *)
2340                 echo "I don't see $file out there, $say."
2341                 say=either
2342                 ;;
2343         esac
2344 done
2345 case "$egrep" in
2346 egrep)
2347         echo "Substituting grep for egrep."
2348         egrep=$grep
2349         _egrep=$grep
2350         ;;
2351 esac
2352 case "$ln" in
2353 ln)
2354         echo "Substituting cp for ln."
2355         ln=$cp
2356         _ln=$cp
2357         ;;
2358 esac
2359 case "$make" in
2360 make)   
2361         case "$gmake" in
2362         gmake)
2363         echo "I can't find make or gmake, and my life depends on it." >&4
2364         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2365         exit 1
2366         ;;
2367         esac
2368         ;;
2369 esac    
2370 case "$gmake" in
2371 gmake)  ;;
2372 *)      # We can't have osname yet.
2373         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2374                 # Assume that gmake, if found, is definitely GNU make
2375                 # and prefer it over the system make.
2376                 echo "Substituting gmake for make."
2377                 make=$gmake
2378                 _make=$gmake
2379         fi
2380         ;;
2381 esac
2382 case "$test" in
2383 test)
2384         echo "Hopefully test is built into your sh."
2385         ;;
2386 *)
2387         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2388                 echo "Using the test built into your sh."
2389                 test=test
2390                 _test=test
2391         fi
2392         ;;
2393 esac
2394 case "$echo" in
2395 echo)
2396         echo "Hopefully echo is built into your sh."
2397         ;;
2398 '') ;;
2399 *)
2400         echo " "
2401 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2402         $echo $n "hi there$c" >foo1
2403         echo $n "hi there$c" >foo2
2404         if cmp foo1 foo2 >/dev/null 2>&1; then
2405                 echo "They are compatible.  In fact, they may be identical."
2406         else
2407                 case "$n" in
2408                 '-n') n='' c='\c';;
2409                 *) n='-n' c='';;
2410                 esac
2411                 cat <<FOO
2412 They are not compatible!  You are probably running ksh on a non-USG system.
2413 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2414 have echo built in and we may have to run some Bourne shell scripts.  That
2415 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2416
2417 FOO
2418                 $echo $n "The star should be here-->$c"
2419                 $echo "*"
2420         fi
2421         $rm -f foo1 foo2
2422         ;;
2423 esac
2424
2425 cat <<EOS >trygcc
2426 $startsh
2427 EOS
2428 cat <<'EOSC' >>trygcc
2429 case "$cc" in
2430 '') ;;
2431 *)  $rm -f try try.*
2432     $cat >try.c <<EOM
2433 int main(int argc, char *argv[]) {
2434   return 0;
2435 }
2436 EOM
2437     if $cc -o try $ccflags $ldflags try.c; then
2438        :
2439     else
2440         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2441         despair=yes
2442         trygcc=yes
2443         case "$cc" in
2444         *gcc*) trygcc=no ;;
2445         esac
2446         case "`$cc -v -c try.c 2>&1`" in
2447         *gcc*) trygcc=no ;;
2448         esac
2449         if $test X"$trygcc" = Xyes; then
2450             if gcc -o try -c try.c; then
2451                 echo " "
2452                 echo "You seem to have a working gcc, though." >&4
2453                 rp="Would you like to use it?"
2454                 dflt=y
2455                 if $test -f myread; then
2456                     . ./myread
2457                 else
2458                     if $test -f UU/myread; then
2459                         . ./UU/myread
2460                     else
2461                         echo "Cannot find myread, sorry.  Aborting." >&2
2462                         exit 1
2463                     fi
2464                 fi  
2465                 case "$ans" in
2466                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2467                        if $test -f usethreads.cbu; then
2468                            $cat >&4 <<EOM 
2469
2470 *** However, any setting of the C compiler flags (e.g. for thread support)
2471 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2472 *** (together with e.g. -Dusethreads).
2473
2474 EOM
2475                        fi;;
2476                 esac
2477             fi
2478         fi
2479     fi
2480     $rm -f try try.*
2481     ;;
2482 esac
2483 EOSC
2484
2485 cat <<EOS >checkcc
2486 $startsh
2487 EOS
2488 cat <<'EOSC' >>checkcc
2489 case "$cc" in        
2490 '') ;;
2491 *)  $rm -f try try.*              
2492     $cat >try.c <<EOM
2493 int main(int argc, char *argv[]) {
2494   return 0;
2495 }
2496 EOM
2497     if $cc -o try $ccflags $ldflags try.c; then
2498        :
2499     else
2500         if $test X"$despair" = Xyes; then
2501            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2502         fi
2503         $cat >&4 <<EOM         
2504 You need to find a working C compiler.
2505 Either (purchase and) install the C compiler supplied by your OS vendor,
2506 or for a free C compiler try http://gcc.gnu.org/
2507 I cannot continue any further, aborting.
2508 EOM
2509         exit 1
2510     fi
2511     $rm -f try try.*
2512     ;;
2513 esac
2514 EOSC
2515
2516 : determine whether symbolic links are supported
2517 echo " "
2518 $touch blurfl
2519 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2520         echo "Symbolic links are supported." >&4
2521         lns="$ln -s"
2522 else
2523         echo "Symbolic links are NOT supported." >&4
2524         lns="$ln"
2525 fi
2526 $rm -f blurfl sym
2527
2528 : determine whether symbolic links are supported
2529 echo " "
2530 case "$lns" in
2531 *"ln"*" -s")
2532         echo "Checking how to test for symbolic links..." >&4
2533         $lns blurfl sym
2534         if $test "X$issymlink" = X; then
2535                 case "$newsh" in
2536                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2537                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2538                 esac
2539                 if test $? = 0; then
2540                         issymlink="test -h"
2541                 else
2542                         echo "Your builtin 'test -h' may be broken." >&4
2543                         case "$test" in
2544                         /*)     ;;
2545                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2546                                 for p in $pth
2547                                 do
2548                                         if test -f "$p/$test"; then
2549                                                 test="$p/$test"
2550                                                 break
2551                                         fi
2552                                 done
2553                                 ;;
2554                         esac
2555                         case "$test" in
2556                         /*)
2557                                 echo "Trying external '$test -h'." >&4
2558                                 issymlink="$test -h"
2559                                 if $test ! -h sym >/dev/null 2>&1; then
2560                                         echo "External '$test -h' is broken, too." >&4
2561                                         issymlink=''
2562                                 fi
2563                                 ;;
2564                         *)      issymlink='' ;;
2565                         esac
2566                 fi              
2567         fi
2568         if $test "X$issymlink" = X; then
2569                 if $test -L sym 2>/dev/null; then
2570                         issymlink="$test -L"
2571                         echo "The builtin '$test -L' worked." >&4
2572                 fi
2573         fi
2574         if $test "X$issymlink" != X; then
2575                 echo "You can test for symbolic links with '$issymlink'." >&4
2576         else
2577                 echo "I do not know how you can test for symbolic links." >&4
2578         fi
2579         $rm -f blurfl sym
2580         ;;
2581 *)      echo "No symbolic links, so not testing for their testing..." >&4
2582         ;;
2583 esac
2584 echo " "
2585
2586
2587 case "$mksymlinks" in
2588 $define|true|[yY]*)
2589         case "$src" in
2590         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2591                 exit 1
2592                 ;;
2593         *)      case "$lns:$issymlink" in
2594                 *"ln"*" -s:"*"test -"?)
2595                         echo "Creating the symbolic links..." >&4
2596                         echo "(First creating the subdirectories...)" >&4
2597                         cd ..
2598                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2599                                 read directory
2600                                 test -z "$directory" && break
2601                                 mkdir -p $directory
2602                         done
2603                         # Sanity check 1.
2604                         if test ! -d t/base; then
2605                                 echo "Failed to create the subdirectories.  Aborting." >&4
2606                                 exit 1
2607                         fi
2608                         echo "(Then creating the symlinks...)" >&4
2609                         awk '{print $1}' $src/MANIFEST | while true; do
2610                                 read filename
2611                                 test -z "$filename" && break
2612                                 if test -f $filename; then
2613                                         if $issymlink $filename; then
2614                                                 rm -f $filename
2615                                         fi
2616                                 fi
2617                                 if test -f $filename; then
2618                                         echo "$filename already exists, not symlinking."
2619                                 else
2620                                         ln -s $src/$filename $filename
2621                                 fi
2622                         done
2623                         # Sanity check 2.
2624                         if test ! -f t/base/lex.t; then
2625                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2626                                 exit 1
2627                         fi
2628                         cd UU
2629                         ;;
2630                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2631                         ;;
2632                 esac
2633                 ;;
2634         esac
2635         ;;
2636 esac
2637
2638
2639 case "$usecrosscompile" in
2640 $define|true|[yY]*)
2641         $echo "Cross-compiling..."
2642         croak=''
2643         case "$cc" in
2644         *-*-gcc) # A cross-compiling gcc, probably.
2645             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2646             ar=$targetarch-ar
2647             # leave out ld, choosing it is more complex
2648             nm=$targetarch-nm
2649             ranlib=$targetarch-ranlib
2650             $echo 'extern int foo;' > try.c
2651             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2652             shift
2653             if $test $# -gt 0; then
2654                 incpth="$incpth $*"
2655                 incpth="`$echo $incpth|$sed 's/^ //'`"
2656                 echo "Guessing incpth '$incpth'." >&4
2657                 for i in $*; do
2658                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2659                     if $test -d $j; then
2660                         libpth="$libpth $j"
2661                     fi
2662                 done   
2663                 libpth="`$echo $libpth|$sed 's/^ //'`"
2664                 echo "Guessing libpth '$libpth'." >&4
2665             fi
2666             $rm -f try.c
2667             ;;
2668         esac
2669         case "$targetarch" in
2670         '') echo "Targetarch not defined." >&4; croak=y ;;
2671         *)  echo "Using targetarch $targetarch." >&4 ;;
2672         esac
2673         case "$incpth" in
2674         '') echo "Incpth not defined." >&4; croak=y ;;
2675         *)  echo "Using incpth '$incpth'." >&4 ;;
2676         esac
2677         case "$libpth" in
2678         '') echo "Libpth not defined." >&4; croak=y ;;
2679         *)  echo "Using libpth '$libpth'." >&4 ;;
2680         esac
2681         case "$usrinc" in
2682         '') for i in $incpth; do
2683                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2684                     usrinc=$i
2685                     echo "Guessing usrinc $usrinc." >&4
2686                     break
2687                 fi
2688             done
2689             case "$usrinc" in
2690             '') echo "Usrinc not defined." >&4; croak=y ;;
2691             esac
2692             ;;
2693         *)  echo "Using usrinc $usrinc." >&4 ;;
2694         esac
2695         case "$targethost" in
2696         '') echo "Targethost not defined." >&4; croak=y ;;
2697         *)  echo "Using targethost $targethost." >&4
2698         esac
2699         locincpth=' '
2700         loclibpth=' '
2701         case "$croak" in
2702         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2703         esac
2704         case "$src" in
2705         /*) run=$src/Cross/run
2706             targetmkdir=$src/Cross/mkdir
2707             to=$src/Cross/to
2708             from=$src/Cross/from
2709             ;;
2710         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2711             run=$pwd/Cross/run
2712             targetmkdir=$pwd/Cross/mkdir
2713             to=$pwd/Cross/to
2714             from=$pwd/Cross/from
2715             ;;
2716         esac
2717         case "$targetrun" in
2718         '') targetrun=ssh ;;
2719         esac
2720         case "$targetto" in
2721         '') targetto=scp ;;
2722         esac
2723         case "$targetfrom" in
2724         '') targetfrom=scp ;;
2725         esac
2726         run=$run-$targetrun
2727         to=$to-$targetto
2728         from=$from-$targetfrom
2729         case "$targetdir" in
2730         '')  targetdir=/tmp
2731              echo "Guessing targetdir $targetdir." >&4
2732              ;;
2733         esac
2734         case "$targetuser" in
2735         '')  targetuser=root
2736              echo "Guessing targetuser $targetuser." >&4
2737              ;;
2738         esac
2739         case "$targetfrom" in
2740         scp)    q=-q ;;
2741         *)      q='' ;;
2742         esac
2743         case "$targetrun" in
2744         ssh|rsh)
2745             cat >$run <<EOF
2746 #!/bin/sh
2747 case "\$1" in
2748 -cwd)
2749   shift
2750   cwd=\$1
2751   shift
2752   ;;
2753 esac
2754 case "\$cwd" in
2755 '') cwd=$targetdir ;;
2756 esac
2757 exe=\$1
2758 shift
2759 if $test ! -f \$exe.xok; then
2760   $to \$exe
2761   $touch \$exe.xok
2762 fi
2763 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2764 EOF
2765             ;;
2766         *)  echo "Unknown targetrun '$targetrun'" >&4
2767             exit 1
2768             ;;
2769         esac
2770         case "$targetmkdir" in
2771         */Cross/mkdir)
2772             cat >$targetmkdir <<EOF
2773 #!/bin/sh
2774 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2775 EOF
2776             $chmod a+rx $targetmkdir
2777             ;;
2778         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2779             exit 1
2780             ;;
2781         esac
2782         case "$targetto" in
2783         scp|rcp)
2784             cat >$to <<EOF
2785 #!/bin/sh
2786 for f in \$@
2787 do
2788   case "\$f" in
2789   /*)
2790     $targetmkdir \`dirname \$f\`
2791     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2792     ;;
2793   *)
2794     $targetmkdir $targetdir/\`dirname \$f\`
2795     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2796     ;;
2797   esac
2798 done
2799 exit 0
2800 EOF
2801             ;;
2802         cp) cat >$to <<EOF
2803 #!/bin/sh
2804 for f in \$@
2805 do
2806   case "\$f" in
2807   /*)
2808     $mkdir -p $targetdir/\`dirname \$f\`
2809     $cp \$f $targetdir/\$f || exit 1
2810     ;;
2811   *)
2812     $targetmkdir $targetdir/\`dirname \$f\`
2813     $cp \$f $targetdir/\$f || exit 1
2814     ;;
2815   esac
2816 done
2817 exit 0
2818 EOF
2819             ;;
2820         *)  echo "Unknown targetto '$targetto'" >&4
2821             exit 1
2822             ;;
2823         esac
2824         case "$targetfrom" in
2825         scp|rcp)
2826           cat >$from <<EOF
2827 #!/bin/sh
2828 for f in \$@
2829 do
2830   $rm -f \$f
2831   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2832 done
2833 exit 0
2834 EOF
2835             ;;
2836         cp) cat >$from <<EOF
2837 #!/bin/sh
2838 for f in \$@
2839 do
2840   $rm -f \$f
2841   cp $targetdir/\$f . || exit 1
2842 done
2843 exit 0
2844 EOF
2845             ;;
2846         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2847             exit 1
2848             ;;
2849         esac
2850         if $test ! -f $run; then
2851             echo "Target 'run' script '$run' not found." >&4
2852         else
2853             $chmod a+rx $run
2854         fi
2855         if $test ! -f $to; then
2856             echo "Target 'to' script '$to' not found." >&4
2857         else
2858             $chmod a+rx $to
2859         fi
2860         if $test ! -f $from; then
2861             echo "Target 'from' script '$from' not found." >&4
2862         else
2863             $chmod a+rx $from
2864         fi
2865         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2866             exit 1
2867         fi
2868         cat >&4 <<EOF
2869 Using '$run' for remote execution,
2870 and '$from' and '$to'
2871 for remote file transfer.
2872 EOF
2873         ;;
2874 *)      run=''
2875         to=:
2876         from=:
2877         usecrosscompile='undef'
2878         targetarch=''
2879         ;;
2880 esac
2881
2882 : see whether [:lower:] and [:upper:] are supported character classes
2883 echo " "
2884 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2885 ABYZ)
2886         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2887         up='[:upper:]'
2888         low='[:lower:]'
2889         ;;
2890 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2891         # (0xd9 and 0xe2), therefore that is a nice testing point.
2892         if test "X$up" = X -o "X$low" = X; then
2893             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2894             rs) up='[A-Z]'
2895                 low='[a-z]'
2896                 ;;
2897             esac
2898         fi
2899         if test "X$up" = X -o "X$low" = X; then
2900             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2901             rs) up='A-Z'
2902                 low='a-z'
2903                 ;;
2904             esac
2905         fi
2906         if test "X$up" = X -o "X$low" = X; then
2907             case "`echo RS | od -x 2>/dev/null`" in
2908             *D9E2*|*d9e2*)
2909                 echo "Hey, this might be EBCDIC." >&4
2910                 if test "X$up" = X -o "X$low" = X; then
2911                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2912                     rs) up='[A-IJ-RS-Z]'
2913                         low='[a-ij-rs-z]'
2914                         ;;
2915                     esac
2916                 fi
2917                 if test "X$up" = X -o "X$low" = X; then
2918                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2919                     rs) up='A-IJ-RS-Z'
2920                         low='a-ij-rs-z'
2921                         ;;
2922                     esac
2923                 fi
2924                 ;;
2925             esac
2926         fi
2927 esac
2928 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2929 rs)
2930     echo "Using $up and $low to convert case." >&4
2931     ;;
2932 *)
2933     echo "I don't know how to translate letters from upper to lower case." >&4
2934     echo "Your tr is not acting any way I know of." >&4
2935     exit 1
2936     ;;
2937 esac
2938 : set up the translation script tr, must be called with ./tr of course
2939 cat >tr <<EOSC
2940 $startsh
2941 case "\$1\$2" in
2942 '[A-Z][a-z]') exec $tr '$up' '$low';;
2943 '[a-z][A-Z]') exec $tr '$low' '$up';;
2944 esac
2945 exec $tr "\$@"
2946 EOSC
2947 chmod +x tr
2948 $eunicefix tr
2949
2950 : Try to determine whether config.sh was made on this system
2951 case "$config_sh" in
2952 '')
2953 myuname=`$uname -a 2>/dev/null`
2954 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2955 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2956 # because the A-Z/a-z are not consecutive.
2957 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2958         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2959 newmyuname="$myuname"
2960 dflt=n
2961 case "$knowitall" in
2962 '')
2963         if test -f ../config.sh; then
2964                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2965                         eval "`grep myuname= ../config.sh`"
2966                 fi
2967                 if test "X$myuname" = "X$newmyuname"; then
2968                         dflt=y
2969                 fi
2970         fi
2971         ;;
2972 *) dflt=y;;
2973 esac
2974
2975 : Get old answers from old config file if Configure was run on the
2976 : same system, otherwise use the hints.
2977 hint=default
2978 cd ..
2979 if test -f config.sh; then
2980         echo " "
2981         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2982         . UU/myread
2983         case "$ans" in
2984         n*|N*) echo "OK, I'll ignore it."
2985                 mv config.sh config.sh.old
2986                 myuname="$newmyuname"
2987                 ;;
2988         *)  echo "Fetching default answers from your old config.sh file..." >&4
2989                 tmp_n="$n"
2990                 tmp_c="$c"
2991                 tmp_sh="$sh"
2992                 . ./config.sh
2993                 cp config.sh UU
2994                 n="$tmp_n"
2995                 c="$tmp_c"
2996                 : Older versions did not always set $sh.  Catch re-use of such
2997                 : an old config.sh.
2998                 case "$sh" in
2999                 '') sh="$tmp_sh" ;;
3000                 esac
3001                 hint=previous
3002                 ;;
3003         esac
3004 fi
3005 . ./UU/checkcc
3006 if test ! -f config.sh; then
3007         $cat <<EOM
3008
3009 First time through, eh?  I have some defaults handy for some systems
3010 that need some extra help getting the Configure answers right:
3011
3012 EOM
3013         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3014         dflt=''
3015         : Half the following guesses are probably wrong... If you have better
3016         : tests or hints, please send them to perlbug@perl.org
3017         : The metaconfig authors would also appreciate a copy...
3018         $test -f /irix && osname=irix
3019         $test -f /xenix && osname=sco_xenix
3020         $test -f /dynix && osname=dynix
3021         $test -f /dnix && osname=dnix
3022         $test -f /lynx.os && osname=lynxos
3023         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3024         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3025         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3026         $test -f /bin/mips && /bin/mips && osname=mips
3027         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3028                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3029         $test -d /usr/apollo/bin && osname=apollo
3030         $test -f /etc/saf/_sactab && osname=svr4
3031         $test -d /usr/include/minix && osname=minix
3032         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3033         if $test -d /MachTen -o -d /MachTen_Folder; then
3034                 osname=machten
3035                 if $test -x /sbin/version; then
3036                         osvers=`/sbin/version | $awk '{print $2}' |
3037                         $sed -e 's/[A-Za-z]$//'`
3038                 elif $test -x /usr/etc/version; then
3039                         osvers=`/usr/etc/version | $awk '{print $2}' |
3040                         $sed -e 's/[A-Za-z]$//'`
3041                 else
3042                         osvers="$2.$3"
3043                 fi
3044         fi
3045
3046         $test -f /sys/posix.dll &&
3047                 $test -f /usr/bin/what &&
3048                 set X `/usr/bin/what /sys/posix.dll` &&
3049                 $test "$3" = UWIN &&
3050                 osname=uwin &&
3051                 osvers="$5"
3052
3053         if $test -f $uname; then
3054                 set X $myuname
3055                 shift
3056
3057                 case "$5" in
3058                 fps*) osname=fps ;;
3059                 mips*)
3060                         case "$4" in
3061                         umips) osname=umips ;;
3062                         *) osname=mips ;;
3063                         esac;;
3064                 [23]100) osname=mips ;;
3065                 next*) osname=next ;;
3066                 i386*)
3067                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3068                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3069                                 osname='sco'
3070                                 osvers=$tmp
3071                         elif $test -f /etc/kconfig; then
3072                                 osname=isc
3073                                 if test "$lns" = "$ln -s"; then
3074                                         osvers=4
3075                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3076                                         osvers=3
3077                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3078                                         osvers=2
3079                                 fi
3080                         fi
3081                         tmp=''
3082                         ;;
3083                 pc*)
3084                         if test -n "$DJGPP"; then
3085                                 osname=dos
3086                                 osvers=djgpp
3087                         fi
3088                         ;;
3089                 esac
3090
3091                 case "$1" in
3092                 aix) osname=aix
3093                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3094                         case "$tmp" in
3095                         # oslevel can fail with:
3096                         # oslevel: Unable to acquire lock.
3097                         *not\ found) osvers="$4"."$3" ;;
3098                         '<3240'|'<>3240') osvers=3.2.0 ;;
3099                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3100                         '=3250'|'>3250') osvers=3.2.5 ;;
3101                         *) osvers=$tmp;;
3102                         esac
3103                         ;;
3104                 bsd386) osname=bsd386
3105                         osvers=`$uname -r`
3106                         ;;
3107                 cygwin*) osname=cygwin
3108                         osvers="$3"
3109                         ;;
3110                 *dc.osx) osname=dcosx
3111                         osvers="$3"
3112                         ;;
3113                 dnix) osname=dnix
3114                         osvers="$3"
3115                         ;;
3116                 domainos) osname=apollo
3117                         osvers="$3"
3118                         ;;
3119                 dgux)   osname=dgux 
3120                         osvers="$3"
3121                         ;;
3122                 dynixptx*) osname=dynixptx
3123                         osvers=`echo "$4"|sed 's/^v//'`
3124                         ;;
3125                 freebsd) osname=freebsd 
3126                         osvers="$3" ;;
3127                 genix)  osname=genix ;;
3128                 gnu)    osname=gnu
3129                         osvers="$3" ;;
3130                 hp*)    osname=hpux 
3131                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3132                         ;;
3133                 irix*)  osname=irix
3134                         case "$3" in
3135                         4*) osvers=4 ;;
3136                         5*) osvers=5 ;;
3137                         *)      osvers="$3" ;;
3138                         esac
3139                         ;;
3140                 linux)  osname=linux
3141                         case "$3" in
3142                         *)      osvers="$3" ;;
3143                         esac
3144                         ;;
3145                 MiNT)   osname=mint
3146                         ;;
3147                 netbsd*) osname=netbsd
3148                         osvers="$3"
3149                         ;;
3150                 news-os) osvers="$3"
3151                         case "$3" in
3152                         4*) osname=newsos4 ;;
3153                         *) osname=newsos ;;
3154                         esac
3155                         ;;
3156                 next*) osname=next ;;
3157                 nonstop-ux) osname=nonstopux ;;
3158                 openbsd) osname=openbsd
3159                         osvers="$3"
3160                         ;;
3161                 os2)    osname=os2
3162                         osvers="$4"
3163                         ;;
3164                 POSIX-BC | posix-bc ) osname=posix-bc
3165                         osvers="$3"
3166                         ;;
3167                 powerux | power_ux | powermax_os | powermaxos | \
3168                 powerunix | power_unix) osname=powerux
3169                         osvers="$3"
3170                         ;;
3171                 qnx) osname=qnx
3172                         osvers="$4"
3173                         ;;
3174                 solaris) osname=solaris
3175                         case "$3" in
3176                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3177                         *)      osvers="$3" ;;
3178                         esac
3179                         ;;
3180                 sunos) osname=sunos
3181                         case "$3" in
3182                         5*) osname=solaris
3183                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3184                         *)      osvers="$3" ;;
3185                         esac
3186                         ;;
3187                 titanos) osname=titanos
3188                         case "$3" in
3189                         1*) osvers=1 ;;
3190                         2*) osvers=2 ;;
3191                         3*) osvers=3 ;;
3192                         4*) osvers=4 ;;
3193                         *)      osvers="$3" ;;
3194                         esac
3195                         ;;
3196                 ultrix) osname=ultrix
3197                         osvers="$3"
3198                         ;;
3199                 osf1|mls+)      case "$5" in
3200                                 alpha)
3201                                         osname=dec_osf
3202                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3203                                         case "$osvers" in
3204                                         [1-9].[0-9]*) ;;
3205                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3206                                         esac
3207                                         ;;
3208                         hp*)    osname=hp_osf1  ;;
3209                         mips)   osname=mips_osf1 ;;
3210                         esac
3211                         ;;
3212                 # UnixWare 7.1.2 is known as Open UNIX 8
3213                 openunix|unixware) osname=svr5
3214                         osvers="$4"
3215                         ;;
3216                 uts)    osname=uts
3217                         osvers="$3"
3218                         ;;
3219                 vos) osvers="$3"
3220                         ;;
3221                 $2) case "$osname" in
3222                         *isc*) ;;
3223                         *freebsd*) ;;
3224                         svr*)
3225                                 : svr4.x or possibly later
3226                                 case "svr$3" in 
3227                                 ${osname}*)
3228                                         osname=svr$3
3229                                         osvers=$4
3230                                         ;;
3231                                 esac
3232                                 case "$osname" in
3233                                 svr4.0)
3234                                         : Check for ESIX
3235                                         if test -f /stand/boot ; then
3236                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3237                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3238                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3239                                                         if test -n "$isesix"; then
3240                                                                 osname=esix4
3241                                                         fi
3242                                                 fi
3243                                         fi
3244                                         ;;
3245                                 esac
3246                                 ;;
3247                         *)      if test -f /etc/systemid; then
3248                                         osname=sco
3249                                         set `echo $3 | $sed 's/\./ /g'` $4
3250                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3251                                                 osvers=$1.$2.$3
3252                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3253                                                 osvers=$1.$2
3254                                         elif $test -f $src/hints/sco_$1.sh; then
3255                                                 osvers=$1
3256                                         fi
3257                                 else
3258                                         case "$osname" in
3259                                         '') : Still unknown.  Probably a generic Sys V.
3260                                                 osname="sysv"
3261                                                 osvers="$3"
3262                                                 ;;
3263                                         esac
3264                                 fi
3265                                 ;;
3266                         esac
3267                         ;;
3268                 *)      case "$osname" in
3269                         '') : Still unknown.  Probably a generic BSD.
3270                                 osname="$1"
3271                                 osvers="$3"
3272                                 ;;
3273                         esac
3274                         ;;
3275                 esac
3276         else
3277                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3278                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3279                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3280                                 osname=news_os
3281                         fi
3282                         $rm -f UU/kernel.what
3283                 elif test -d c:/. -o -n "$is_os2" ; then
3284                         set X $myuname
3285                         osname=os2
3286                         osvers="$5"
3287                 fi
3288         fi
3289         
3290         case "$targetarch" in
3291         '') ;;
3292         *)  hostarch=$osname
3293             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3294             osvers=''
3295             ;;
3296         esac
3297
3298         : Now look for a hint file osname_osvers, unless one has been
3299         : specified already.
3300         case "$hintfile" in
3301         ''|' ')
3302                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3303                 : Also try without trailing minor version numbers.
3304                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3305                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3306                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3307                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3308                 case "$file" in
3309                 '') dflt=none ;;
3310                 *)  case "$osvers" in
3311                         '') dflt=$file
3312                                 ;;
3313                         *)  if $test -f $src/hints/$file.sh ; then
3314                                         dflt=$file
3315                                 elif $test -f $src/hints/$xfile.sh ; then
3316                                         dflt=$xfile
3317                                 elif $test -f $src/hints/$xxfile.sh ; then
3318                                         dflt=$xxfile
3319                                 elif $test -f $src/hints/$xxxfile.sh ; then
3320                                         dflt=$xxxfile
3321                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3322                                         dflt=$xxxxfile
3323                                 elif $test -f "$src/hints/${osname}.sh" ; then
3324                                         dflt="${osname}"
3325                                 else
3326                                         dflt=none
3327                                 fi
3328                                 ;;
3329                         esac
3330                         ;;
3331                 esac
3332                 if $test -f Policy.sh ; then
3333                         case "$dflt" in
3334                         *Policy*) ;;
3335                         none) dflt="Policy" ;;
3336                         *) dflt="Policy $dflt" ;;
3337                         esac
3338                 fi
3339                 ;;
3340         *)
3341                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3342                 ;;
3343         esac
3344
3345         if $test -f Policy.sh ; then
3346                 $cat <<EOM
3347
3348 There's also a Policy hint file available, which should make the
3349 site-specific (policy) questions easier to answer.
3350 EOM
3351
3352         fi
3353
3354         $cat <<EOM
3355
3356 You may give one or more space-separated answers, or "none" if appropriate.
3357 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3358 is a good thing.  DO NOT give a wrong version or a wrong OS.
3359
3360 EOM
3361
3362         rp="Which of these apply, if any?"
3363         . UU/myread
3364         tans=$ans
3365         for file in $tans; do
3366                 if $test X$file = XPolicy -a -f Policy.sh; then
3367                         . Policy.sh
3368                         $cat Policy.sh >> UU/config.sh
3369                 elif $test -f $src/hints/$file.sh; then
3370                         . $src/hints/$file.sh
3371                         $cat $src/hints/$file.sh >> UU/config.sh
3372                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3373                         : nothing
3374                 else
3375                         : Give one chance to correct a possible typo.
3376                         echo "$file.sh does not exist"
3377                         dflt=$file
3378                         rp="hint to use instead?"
3379                         . UU/myread
3380                         for file in $ans; do
3381                                 if $test -f "$src/hints/$file.sh"; then
3382                                         . $src/hints/$file.sh
3383                                         $cat $src/hints/$file.sh >> UU/config.sh
3384                                 elif $test X$ans = X -o X$ans = Xnone ; then
3385                                         : nothing
3386                                 else
3387                                         echo "$file.sh does not exist -- ignored."
3388                                 fi
3389                         done
3390                 fi
3391         done
3392
3393         hint=recommended
3394         : Remember our hint file for later.
3395         if $test -f "$src/hints/$file.sh" ; then
3396                 hintfile="$file"
3397         else
3398                 hintfile=''
3399         fi
3400 fi
3401 cd UU
3402 ;;
3403 *)
3404         echo " "
3405         echo "Fetching default answers from $config_sh..." >&4
3406         tmp_n="$n"
3407         tmp_c="$c"
3408         cd ..
3409         cp $config_sh config.sh 2>/dev/null
3410         chmod +w config.sh
3411         . ./config.sh
3412         cd UU
3413         cp ../config.sh .
3414         n="$tmp_n"
3415         c="$tmp_c"
3416         hint=previous
3417         ;;
3418 esac
3419 test "$override" && . ./optdef.sh
3420
3421 : Restore computed paths
3422 for file in $loclist $trylist; do
3423         eval $file="\$_$file"
3424 done
3425
3426 cat << EOM
3427
3428 Configure uses the operating system name and version to set some defaults.
3429 The default value is probably right if the name rings a bell. Otherwise,
3430 since spelling matters for me, either accept the default or answer "none"
3431 to leave it blank.
3432
3433 EOM
3434 case "$osname" in
3435         ''|' ')
3436                 case "$hintfile" in
3437                 ''|' '|none) dflt=none ;;
3438                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3439                 esac
3440                 ;;
3441         *) dflt="$osname" ;;
3442 esac
3443 rp="Operating system name?"
3444 . ./myread
3445 case "$ans" in
3446 none)  osname='' ;;
3447 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3448 esac
3449 echo " "
3450 case "$osvers" in
3451         ''|' ')
3452                 case "$hintfile" in
3453                 ''|' '|none) dflt=none ;;
3454                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3455                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3456                         case "$dflt" in
3457                         ''|' ') dflt=none ;;
3458                         esac
3459                         ;;
3460                 esac
3461                 ;;
3462         *) dflt="$osvers" ;;
3463 esac
3464 rp="Operating system version?"
3465 . ./myread
3466 case "$ans" in
3467 none)  osvers='' ;;
3468 *) osvers="$ans" ;;
3469 esac
3470
3471
3472 . ./posthint.sh
3473
3474 : who configured the system
3475 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3476 case "$cf_by" in
3477 "")
3478         cf_by=`(logname) 2>/dev/null`
3479         case "$cf_by" in
3480         "")
3481                 cf_by=`(whoami) 2>/dev/null`
3482                 case "$cf_by" in
3483                 "") cf_by=unknown ;;
3484                 esac ;;
3485         esac ;;
3486 esac
3487
3488 : set up the script used to warn in case of inconsistency
3489 cat <<EOS >whoa
3490 $startsh
3491 EOS
3492 cat <<'EOSC' >>whoa
3493 dflt=y
3494 echo " "
3495 echo "*** WHOA THERE!!! ***" >&4
3496 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3497 rp="    Keep the $hint value?"
3498 . ./myread
3499 case "$ans" in
3500 y) td=$was; tu=$was;;
3501 esac
3502 EOSC
3503
3504 : function used to set $1 to $val
3505 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3506 case "$val$was" in
3507 $define$undef) . ./whoa; eval "$var=\$td";;
3508 $undef$define) . ./whoa; eval "$var=\$tu";;
3509 *) eval "$var=$val";;
3510 esac'
3511
3512 case "$usesocks" in
3513 $define|true|[yY]*)     dflt='y';;
3514 *) dflt='n';;
3515 esac
3516 cat <<EOM
3517
3518 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3519 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3520 to use the PerlIO abstraction layer, this will be implicitly selected.
3521
3522 If this doesn't make any sense to you, just accept the default '$dflt'.
3523 EOM
3524 rp='Build Perl for SOCKS?'
3525 . ./myread
3526 case "$ans" in
3527 y|Y)    val="$define" ;;     
3528 *)      val="$undef" ;;
3529 esac
3530 set usesocks
3531 eval $setvar
3532
3533 case "$usesocks" in
3534 $define|true|[yY]*) useperlio="$define";;
3535 esac
3536
3537 case "$useperlio" in
3538 $define|true|[yY]*|'')  dflt='y';;
3539 *) dflt='n';;
3540 esac
3541 cat <<EOM
3542
3543 Previous version of $package used the standard IO mechanisms as
3544 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
3545 alternate IO mechanisms via the PerlIO abstraction layer, but the
3546 stdio mechanism is still available if needed.  The abstraction layer
3547 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3548 Using PerlIO with sfio may cause problems with some extension modules.
3549
3550 If this doesn't make any sense to you, just accept the default '$dflt'.
3551 EOM
3552 rp='Use the PerlIO abstraction layer?'
3553 . ./myread
3554 case "$ans" in
3555 y|Y) 
3556         val="$define"
3557         ;;
3558 *)      
3559         echo "Ok, doing things the stdio way."
3560         val="$undef"
3561         ;;
3562 esac
3563 set useperlio
3564 eval $setvar 
3565
3566 case "$usesocks" in
3567 $define|true|[yY]*)
3568         case "$useperlio" in
3569         $define|true|[yY]*) ;;
3570         *)      cat >&4 <<EOM
3571
3572 You are using the SOCKS proxy protocol library which means that you
3573 should also use the PerlIO layer.  You may be headed for trouble.
3574
3575 EOM
3576                 ;;
3577         esac
3578         ;;
3579 esac
3580
3581         
3582 case "$usethreads" in
3583 $define|true|[yY]*)     dflt='y';;
3584 *)     # Catch case where user specified ithreads or 5005threads but
3585        # forgot -Dusethreads (A.D. 4/2002)
3586        case "$useithreads$use5005threads" in
3587        *$define*)      
3588                 case "$useperlio" in
3589                 "$define")      dflt='y' ;;
3590                 *)              dflt='n' ;;
3591                 esac
3592                 ;;
3593        *)       dflt='n';;
3594        esac
3595        ;;
3596 esac
3597 cat <<EOM
3598
3599 Perl can be built to take advantage of threads on some systems.
3600 To do so, Configure can be run with -Dusethreads.
3601
3602 Note that Perl built with threading support runs slightly slower
3603 and uses more memory than plain Perl. The current implementation
3604 is believed to be stable, but it is fairly new, and so should be
3605 treated with caution.
3606
3607 If this doesn't make any sense to you, just accept the default '$dflt'.
3608 EOM
3609 rp='Build a threading Perl?'
3610 . ./myread
3611 case "$ans" in
3612 y|Y)    val="$define" ;;
3613 *)      val="$undef" ;;
3614 esac
3615 set usethreads
3616 eval $setvar
3617
3618 case "$usethreads" in
3619 $define)
3620         $cat <<EOM
3621
3622 Since release 5.6, Perl has had two different threading implementations,
3623 the newer interpreter-based version (ithreads) with one interpreter per
3624 thread, and the older 5.005 version (5005threads).
3625 The 5005threads version is effectively unmaintained and will probably be
3626 removed in Perl 5.10, so there should be no need to build a Perl using it
3627 unless needed for backwards compatibility with some existing 5.005threads
3628 code.
3629
3630 EOM
3631         : Default to ithreads unless overridden on command line or with
3632         : old config.sh
3633         dflt='y'
3634         case "$use5005threads" in
3635                 $define|true|[yY]*) dflt='n';;
3636         esac
3637         case "$useithreads" in
3638                 $undef|false|[nN]*) dflt='n';;
3639         esac
3640         rp='Use the newer interpreter-based ithreads?'
3641         . ./myread
3642         case "$ans" in
3643         y|Y)    val="$define" ;;
3644         *)      val="$undef" ;;
3645         esac
3646         set useithreads
3647         eval $setvar
3648         : Now set use5005threads to the opposite value.
3649         case "$useithreads" in
3650         $define) val="$undef" ;;
3651         *) val="$define" ;;
3652         esac
3653         set use5005threads
3654         eval $setvar
3655         ;;
3656 *)
3657         useithreads="$undef"
3658         use5005threads="$undef"
3659         ;;
3660 esac
3661
3662 case "$useithreads$use5005threads" in
3663 "$define$define")
3664         $cat >&4 <<EOM
3665
3666 You cannot have both the ithreads and the 5.005 threads enabled
3667 at the same time.  Disabling the 5.005 threads since they are
3668 much less stable than the ithreads.
3669
3670 EOM
3671         use5005threads="$undef"
3672         ;;
3673 esac
3674
3675 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
3676         cat >&4 <<EOF
3677 ***
3678 *** To build with ithreads you must also use the PerlIO layer.
3679 *** Cannot continue, aborting.
3680 ***
3681 EOF
3682         exit 1
3683 fi
3684
3685 case "$d_oldpthreads" in
3686 '')     : Configure tests would be welcome here.  For now, assume undef.
3687         val="$undef" ;;
3688 *)      val="$d_oldpthreads" ;;
3689 esac
3690 set d_oldpthreads
3691 eval $setvar
3692
3693
3694 : Look for a hint-file generated 'call-back-unit'.  If the
3695 : user has specified that a threading perl is to be built,
3696 : we may need to set or change some other defaults.
3697 if $test -f usethreads.cbu; then
3698     echo "Your platform has some specific hints regarding threaded builds, using them..."
3699     . ./usethreads.cbu
3700 else
3701     case "$usethreads" in
3702         "$define"|true|[yY]*)
3703                 $cat <<EOM
3704 (Your platform does not have any specific hints for threaded builds.
3705  Assuming POSIX threads, then.)
3706 EOM
3707         ;;
3708     esac
3709 fi
3710
3711 cat <<EOM
3712
3713 Perl can be built so that multiple Perl interpreters can coexist
3714 within the same Perl executable.
3715 EOM
3716
3717 case "$useithreads" in
3718 $define)
3719         cat <<EOM
3720 This multiple interpreter support is required for interpreter-based threads.
3721 EOM
3722         val="$define"
3723         ;;
3724 *)      case "$usemultiplicity" in
3725         $define|true|[yY]*)     dflt='y';;
3726         *) dflt='n';;
3727         esac
3728         echo " "
3729         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3730         rp='Build Perl for multiplicity?'
3731         . ./myread
3732         case "$ans" in
3733         y|Y)    val="$define" ;;
3734         *)      val="$undef" ;;
3735         esac
3736         ;;
3737 esac
3738 set usemultiplicity
3739 eval $setvar
3740
3741
3742 case "$usemorebits" in
3743 "$define"|true|[yY]*)
3744         use64bitint="$define"
3745         uselongdouble="$define"
3746         usemorebits="$define"
3747         ;;
3748 *)      usemorebits="$undef"
3749         ;;
3750 esac
3751
3752 : make some quick guesses about what we are up against
3753 echo " "
3754 $echo $n "Hmm...  $c"
3755 echo exit 1 >bsd
3756 echo exit 1 >usg
3757 echo exit 1 >v7
3758 echo exit 1 >osf1
3759 echo exit 1 >eunice
3760 echo exit 1 >xenix
3761 echo exit 1 >venix
3762 echo exit 1 >os2
3763 d_bsd="$undef"
3764 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3765 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3766 then
3767         echo "Looks kind of like an OSF/1 system, but we'll see..."
3768         echo exit 0 >osf1
3769 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3770         xxx=`./loc addbib blurfl $pth`
3771         if $test -f $xxx; then
3772         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3773                 echo exit 0 >bsd
3774                 echo exit 0 >usg
3775         else
3776                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3777                         echo "Looks kind of like an extended USG system, but we'll see..."
3778                 else
3779                         echo "Looks kind of like a USG system, but we'll see..."
3780                 fi
3781                 echo exit 0 >usg
3782         fi
3783 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3784         echo "Looks kind of like a BSD system, but we'll see..."
3785         d_bsd="$define"
3786         echo exit 0 >bsd
3787 else
3788         echo "Looks kind of like a Version 7 system, but we'll see..."
3789         echo exit 0 >v7
3790 fi
3791 case "$eunicefix" in
3792 *unixtovms*)
3793         $cat <<'EOI'
3794 There is, however, a strange, musty smell in the air that reminds me of
3795 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3796 EOI
3797         echo exit 0 >eunice
3798         d_eunice="$define"
3799 : it so happens the Eunice I know will not run shell scripts in Unix format
3800         ;;
3801 *)
3802         echo " "
3803         echo "Congratulations.  You aren't running Eunice."
3804         d_eunice="$undef"
3805         ;;
3806 esac
3807 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3808 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3809 : semicolon as a patch separator
3810 case "$p_" in
3811 :) ;;
3812 *)
3813         $cat <<'EOI'
3814 I have the feeling something is not exactly right, however...don't tell me...
3815 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3816 (Or you may be running DOS with DJGPP.)
3817 EOI
3818         echo exit 0 >os2
3819         ;;
3820 esac
3821 if test -f /xenix; then
3822         echo "Actually, this looks more like a XENIX system..."
3823         echo exit 0 >xenix
3824         d_xenix="$define"
3825 else
3826         echo " "
3827         echo "It's not Xenix..."
3828         d_xenix="$undef"
3829 fi
3830 chmod +x xenix
3831 $eunicefix xenix
3832 if test -f /venix; then
3833         echo "Actually, this looks more like a VENIX system..."
3834         echo exit 0 >venix
3835 else
3836         echo " "
3837         if ./xenix; then
3838                 : null
3839         else
3840                 echo "Nor is it Venix..."
3841         fi
3842 fi
3843 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3844 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3845 $rm -f foo
3846
3847 case "$cc" in
3848 '') dflt=cc;;
3849 *) dflt="$cc";;
3850 esac
3851 rp="Use which C compiler?"
3852 . ./myread
3853 cc="$ans"
3854
3855 : See if they have not cc but they do have gcc
3856 . ./trygcc
3857 : Look for a hint-file generated 'call-back-unit'.  Now that the
3858 : user has specified the compiler, we may need to set or change some
3859 : other defaults.
3860 if $test -f cc.cbu; then
3861     . ./cc.cbu
3862 fi
3863 . ./checkcc
3864
3865 echo " "
3866 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3867 $cat >try.c <<EOM
3868 #include <stdio.h>
3869 int main() {
3870 #ifdef __GNUC__
3871 #ifdef __VERSION__
3872         printf("%s\n", __VERSION__);
3873 #else
3874         printf("%s\n", "1");
3875 #endif
3876 #endif
3877         return(0);
3878 }
3879 EOM
3880 if $cc -o try $ccflags $ldflags try.c; then
3881         gccversion=`$run ./try`
3882         case "$gccversion" in
3883         '') echo "You are not using GNU cc." ;;
3884         *)  echo "You are using GNU cc $gccversion."
3885             ccname=gcc
3886             ;;
3887         esac
3888 else
3889         echo " "
3890         echo "*** WHOA THERE!!! ***" >&4
3891         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3892         case "$knowitall" in
3893         '')
3894         echo "    You'd better start hunting for one and let me know about it." >&4
3895                 exit 1
3896                 ;;
3897         esac
3898 fi
3899 $rm -f try try.*
3900 case "$gccversion" in
3901 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3902 esac
3903 case "$gccversion" in
3904 '') gccosandvers='' ;;
3905 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3906    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3907    gccshortvers=''
3908    case "$gccosandvers" in
3909    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3910    $osname$osvers) ;; # looking good
3911    $osname*) cat <<EOM >&4
3912
3913 *** WHOA THERE!!! ***
3914
3915     Your gcc has not been compiled for the exact release of
3916     your operating system ($gccosandvers versus $osname$osvers).
3917
3918     In general it is a good idea to keep gcc synchronized with
3919     the operating system because otherwise serious problems
3920     may ensue when trying to compile software, like Perl.
3921
3922     I'm trying to be optimistic here, though, and will continue.
3923     If later during the configuration and build icky compilation
3924     problems appear (headerfile conflicts being the most common
3925     manifestation), I suggest reinstalling the gcc to match
3926     your operating system release.
3927
3928 EOM
3929       ;;
3930    *) gccosandvers='' ;; # failed to parse, better be silent
3931    esac
3932    ;;
3933 esac
3934 case "$ccname" in
3935 '') ccname="$cc" ;;
3936 esac
3937
3938 # gcc 3.* complain about adding -Idirectories that they already know about,
3939 # so we will take those off from locincpth.
3940 case "$gccversion" in
3941 3*)
3942     echo "main(){}">try.c
3943     for incdir in $locincpth; do
3944        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
3945              grep '^c[cp]p*[01]: warning: changing search order '`
3946        if test "X$warn" != X; then
3947            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
3948        fi
3949     done
3950     $rm -f try try.*
3951 esac
3952
3953 : decide how portable to be.  Allow command line overrides.
3954 case "$d_portable" in
3955 "$undef") ;;
3956 *)      d_portable="$define" ;;
3957 esac
3958
3959 : set up shell script to do ~ expansion
3960 cat >filexp <<EOSS
3961 $startsh
3962 : expand filename
3963 case "\$1" in
3964  ~/*|~)
3965         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3966         ;;
3967  ~*)
3968         if $test -f /bin/csh; then
3969                 /bin/csh -f -c "glob \$1"
3970                 failed=\$?
3971                 echo ""
3972                 exit \$failed
3973         else
3974                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3975                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3976                 if $test ! -d "\$dir"; then
3977                         me=\`basename \$0\`
3978                         echo "\$me: can't locate home directory for: \$name" >&2
3979                         exit 1
3980                 fi
3981                 case "\$1" in
3982                 */*)
3983                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3984                         ;;
3985                 *)
3986                         echo \$dir
3987                         ;;
3988                 esac
3989         fi
3990         ;;
3991 *)
3992         echo \$1
3993         ;;
3994 esac
3995 EOSS
3996 chmod +x filexp
3997 $eunicefix filexp
3998
3999 : now set up to get a file name
4000 cat <<EOS >getfile
4001 $startsh
4002 EOS
4003 cat <<'EOSC' >>getfile
4004 tilde=''
4005 fullpath=''
4006 already=''
4007 skip=''
4008 none_ok=''
4009 exp_file=''
4010 nopath_ok=''
4011 orig_rp="$rp"
4012 orig_dflt="$dflt"
4013 case "$gfpth" in
4014 '') gfpth='.' ;;
4015 esac
4016
4017 case "$fn" in
4018 *\(*)
4019         : getfile will accept an answer from the comma-separated list
4020         : enclosed in parentheses even if it does not meet other criteria.
4021         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
4022         fn=`echo $fn | sed 's/(.*)//'`
4023         ;;
4024 esac
4025
4026 case "$fn" in
4027 *:*)
4028         loc_file=`expr $fn : '.*:\(.*\)'`
4029         fn=`expr $fn : '\(.*\):.*'`
4030         ;;
4031 esac
4032
4033 case "$fn" in
4034 *~*) tilde=true;;
4035 esac
4036 case "$fn" in
4037 */*) fullpath=true;;
4038 esac
4039 case "$fn" in
4040 *+*) skip=true;;
4041 esac
4042 case "$fn" in
4043 *n*) none_ok=true;;
4044 esac
4045 case "$fn" in
4046 *e*) exp_file=true;;
4047 esac
4048 case "$fn" in
4049 *p*) nopath_ok=true;;
4050 esac
4051
4052 case "$fn" in
4053 *f*) type='File';;
4054 *d*) type='Directory';;
4055 *l*) type='Locate';;
4056 esac
4057
4058 what="$type"
4059 case "$what" in
4060 Locate) what='File';;
4061 esac
4062
4063 case "$exp_file" in
4064 '')
4065         case "$d_portable" in
4066         "$define") ;;
4067         *) exp_file=true;;
4068         esac
4069         ;;
4070 esac
4071
4072 cd ..
4073 while test "$type"; do
4074         redo=''
4075         rp="$orig_rp"
4076         dflt="$orig_dflt"
4077         case "$tilde" in
4078         true) rp="$rp (~name ok)";;
4079         esac
4080         . UU/myread
4081         if test -f UU/getfile.ok && \
4082                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4083         then
4084                 value="$ans"
4085                 ansexp="$ans"
4086                 break
4087         fi
4088         case "$ans" in
4089         none)
4090                 value=''
4091                 ansexp=''
4092                 case "$none_ok" in
4093                 true) type='';;
4094                 esac
4095                 ;;
4096         *)
4097                 case "$tilde" in
4098                 '') value="$ans"
4099                         ansexp="$ans";;
4100                 *)
4101                         value=`UU/filexp $ans`
4102                         case $? in
4103                         0)
4104                                 if test "$ans" != "$value"; then
4105                                         echo "(That expands to $value on this system.)"
4106                                 fi
4107                                 ;;
4108                         *) value="$ans";;
4109                         esac
4110                         ansexp="$value"
4111                         case "$exp_file" in
4112                         '') value="$ans";;
4113                         esac
4114                         ;;
4115                 esac
4116                 case "$fullpath" in
4117                 true)
4118                         case "$ansexp" in
4119                         /*) value="$ansexp" ;;
4120                         [a-zA-Z]:/*) value="$ansexp" ;;
4121                         *)
4122                                 redo=true
4123                                 case "$already" in
4124                                 true)
4125                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4126                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4127                                         ;;
4128                                 *)
4129                                 echo "Please give a full path name, starting with slash." >&4
4130                                         case "$tilde" in
4131                                         true)
4132                                 echo "Note that using ~name is ok provided it expands well." >&4
4133                                                 already=true
4134                                                 ;;
4135                                         esac
4136                                 esac
4137                                 ;;
4138                         esac
4139                         ;;
4140                 esac
4141                 case "$redo" in
4142                 '')
4143                         case "$type" in
4144                         File)
4145                                 for fp in $gfpth; do
4146                                         if test "X$fp" = X.; then
4147                                             pf="$ansexp"
4148                                         else    
4149                                             pf="$fp/$ansexp"
4150                                         fi
4151                                         if test -f "$pf"; then
4152                                                 type=''
4153                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4154                                         then
4155                                                 echo "($value is not a plain file, but that's ok.)"
4156                                                 type=''
4157                                         fi
4158                                         if test X"$type" = X; then
4159                                             value="$pf"
4160                                             break
4161                                         fi
4162                                 done
4163                                 ;;
4164                         Directory)
4165                                 for fp in $gfpth; do
4166                                         if test "X$fp" = X.; then
4167                                             dir="$ans"
4168                                             direxp="$ansexp"
4169                                         else    
4170                                             dir="$fp/$ansexp"
4171                                             direxp="$fp/$ansexp"
4172                                         fi
4173                                         if test -d "$direxp"; then
4174                                                 type=''
4175                                                 value="$dir"
4176                                                 break
4177                                         fi
4178                                 done
4179                                 ;;
4180                         Locate)
4181                                 if test -d "$ansexp"; then
4182                                         echo "(Looking for $loc_file in directory $value.)"
4183                                         value="$value/$loc_file"
4184                                         ansexp="$ansexp/$loc_file"
4185                                 fi
4186                                 if test -f "$ansexp"; then
4187                                         type=''
4188                                 fi
4189                                 case "$nopath_ok" in
4190                                 true)   case "$value" in
4191                                         */*) ;;
4192                                         *)      echo "Assuming $value will be in people's path."
4193                                                 type=''
4194                                                 ;;
4195                                         esac
4196                                         ;;
4197                                 esac
4198                                 ;;
4199                         esac
4200
4201                         case "$skip" in
4202                         true) type='';
4203                         esac
4204
4205                         case "$type" in
4206                         '') ;;
4207                         *)
4208                                 if test "$fastread" = yes; then
4209                                         dflt=y
4210                                 else
4211                                         dflt=n
4212                                 fi
4213                                 rp="$what $value doesn't exist.  Use that name anyway?"
4214                                 . UU/myread
4215                                 dflt=''
4216                                 case "$ans" in
4217                                 y*) type='';;
4218                                 *) echo " ";;
4219                                 esac
4220                                 ;;
4221                         esac
4222                         ;;
4223                 esac
4224                 ;;
4225         esac
4226 done
4227 cd UU
4228 ans="$value"
4229 rp="$orig_rp"
4230 dflt="$orig_dflt"
4231 rm -f getfile.ok
4232 test "X$gfpthkeep" != Xy && gfpth=""
4233 EOSC
4234
4235 : What should the include directory be ?
4236 echo " "
4237 $echo $n "Hmm...  $c"
4238 dflt='/usr/include'
4239 incpath=''
4240 mips_type=''
4241 if $test -f /bin/mips && /bin/mips; then
4242         echo "Looks like a MIPS system..."
4243         $cat >usr.c <<'EOCP'
4244 #ifdef SYSTYPE_BSD43
4245 /bsd43
4246 #endif
4247 EOCP
4248         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4249                 dflt='/bsd43/usr/include'
4250                 incpath='/bsd43'
4251                 mips_type='BSD 4.3'
4252         else
4253                 mips_type='System V'
4254         fi
4255         $rm -f usr.c usr.out
4256         echo "and you're compiling with the $mips_type compiler and libraries."
4257         xxx_prompt=y
4258         echo "exit 0" >mips
4259 else
4260         echo "Doesn't look like a MIPS system."
4261         xxx_prompt=n
4262         echo "exit 1" >mips
4263 fi
4264 chmod +x mips
4265 $eunicefix mips
4266 case "$usrinc" in
4267 '') ;;
4268 *) dflt="$usrinc";;
4269 esac
4270 case "$xxx_prompt" in
4271 y)      fn=d/
4272         echo " "
4273         rp='Where are the include files you want to use?'
4274         . ./getfile
4275         usrinc="$ans"
4276         ;;
4277 *)      usrinc="$dflt"
4278         ;;
4279 esac
4280
4281 : see how we invoke the C preprocessor
4282 echo " "
4283 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4284 cat <<'EOT' >testcpp.c
4285 #define ABC abc
4286 #define XYZ xyz
4287 ABC.XYZ
4288 EOT
4289 cd ..
4290 if test ! -f cppstdin; then
4291         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4292                 # AIX cc -E doesn't show the absolute headerfile
4293                 # locations but we'll cheat by using the -M flag.
4294                 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
4295         else
4296                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4297         fi
4298 else
4299         echo "Keeping your $hint cppstdin wrapper."
4300 fi
4301 chmod 755 cppstdin
4302 wrapper=`pwd`/cppstdin
4303 ok='false'
4304 cd UU
4305
4306 if $test "X$cppstdin" != "X" && \
4307         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4308         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4309 then
4310         echo "You used to use $cppstdin $cppminus so we'll use that again."
4311         case "$cpprun" in
4312         '') echo "But let's see if we can live without a wrapper..." ;;
4313         *)
4314                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4315                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4316                 then
4317                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4318                         ok='true'
4319                 else
4320                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4321                 fi
4322                 ;;
4323         esac
4324 else
4325         case "$cppstdin" in
4326         '') ;;
4327         *)
4328                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4329                 ;;
4330         esac
4331 fi
4332
4333 if $ok; then
4334         : nothing
4335 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4336         $cc -E <testcpp.c >testcpp.out 2>&1; \
4337         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4338         echo "Yup, it does."
4339         x_cpp="$cc -E"
4340         x_minus='';
4341 elif echo 'Nope...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"' -P" will work...'; \
4348         $cc -P <testcpp.c >testcpp.out 2>&1; \
4349         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4350         echo "Yipee, that works!"
4351         x_cpp="$cc -P"
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 "At long last!"
4357         x_cpp="$cc -P"
4358         x_minus='-';
4359 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4360         $cpp <testcpp.c >testcpp.out 2>&1; \
4361         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4362         echo "It works!"
4363         x_cpp="$cpp"
4364         x_minus='';
4365 elif echo 'Nixed again...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 "Hooray, it works!  I was beginning to wonder."
4369         x_cpp="$cpp"
4370         x_minus='-';
4371 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4372         $wrapper <testcpp.c >testcpp.out 2>&1; \
4373         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4374         x_cpp="$wrapper"
4375         x_minus=''
4376         echo "Eureka!"
4377 else
4378         dflt=''
4379         rp="No dice.  I can't find a C preprocessor.  Name one:"
4380         . ./myread
4381         x_cpp="$ans"
4382         x_minus=''
4383         $x_cpp <testcpp.c >testcpp.out 2>&1
4384         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4385                 echo "OK, that will do." >&4
4386         else
4387 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4388                 exit 1
4389         fi
4390 fi
4391
4392 case "$ok" in
4393 false)
4394         cppstdin="$x_cpp"
4395         cppminus="$x_minus"
4396         cpprun="$x_cpp"
4397         cpplast="$x_minus"
4398         set X $x_cpp
4399         shift
4400         case "$1" in
4401         "$cpp")
4402                 echo "Perhaps can we force $cc -E using a wrapper..."
4403                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4404                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4405                 then
4406                         echo "Yup, we can."
4407                         cppstdin="$wrapper"
4408                         cppminus='';
4409                 else
4410                         echo "Nope, we'll have to live without it..."
4411                 fi
4412                 ;;
4413         esac
4414         case "$cpprun" in
4415         "$wrapper")
4416                 cpprun=''
4417                 cpplast=''
4418                 ;;
4419         esac
4420         ;;
4421 esac
4422
4423 case "$cppstdin" in
4424 "$wrapper"|'cppstdin') ;;
4425 *) $rm -f $wrapper;;
4426 esac
4427 $rm -f testcpp.c testcpp.out
4428
4429 : Set private lib path
4430 case "$plibpth" in
4431 '') if ./mips; then
4432                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4433         fi;;
4434 esac
4435 case "$libpth" in
4436 ' ') dlist='';;
4437 '') dlist="$loclibpth $plibpth $glibpth";;
4438 *) dlist="$libpth";;
4439 esac
4440
4441 : Now check and see which directories actually exist, avoiding duplicates
4442 libpth=''
4443 for xxx in $dlist
4444 do
4445     if $test -d $xxx; then
4446                 case " $libpth " in
4447                 *" $xxx "*) ;;
4448                 *) libpth="$libpth $xxx";;
4449                 esac
4450     fi
4451 done
4452 $cat <<'EOM'
4453
4454 Some systems have incompatible or broken versions of libraries.  Among
4455 the directories listed in the question below, please remove any you
4456 know not to be holding relevant libraries, and add any that are needed.
4457 Say "none" for none.
4458
4459 EOM
4460 case "$libpth" in
4461 '') dflt='none';;
4462 *)
4463         set X $libpth
4464         shift
4465         dflt=${1+"$@"}
4466         ;;
4467 esac
4468 rp="Directories to use for library searches?"
4469 . ./myread
4470 case "$ans" in
4471 none) libpth=' ';;
4472 *) libpth="$ans";;
4473 esac
4474
4475 : compute shared library extension
4476 case "$so" in
4477 '')
4478         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4479                 dflt='sl'
4480         else
4481                 dflt='so'
4482         fi
4483         ;;
4484 *) dflt="$so";;
4485 esac
4486 $cat <<EOM
4487
4488 On some systems, shared libraries may be available.  Answer 'none' if
4489 you want to suppress searching of shared libraries for the remainder
4490 of this configuration.
4491
4492 EOM
4493 rp='What is the file extension used for shared libraries?'
4494 . ./myread
4495 so="$ans"
4496
4497 : Define several unixisms.
4498 : Hints files or command line option can be used to override them.
4499 : The convoluted testing is in case hints files set either the old
4500 : or the new name.
4501 case "$_exe" in
4502 '')     case "$exe_ext" in
4503         '')     ;;
4504         *)      _exe="$exe_ext" ;;
4505         esac
4506         ;;
4507 esac
4508 case "$_a" in
4509 '')     case "$lib_ext" in
4510     '') _a='.a';;
4511         *)      _a="$lib_ext" ;;
4512         esac
4513         ;;
4514 esac
4515 case "$_o" in
4516 '') case "$obj_ext" in
4517         '')     _o='.o';;
4518         *)      _o="$obj_ext";;
4519         esac
4520         ;;
4521 esac
4522 case "$p_" in
4523 '') case "$path_sep" in
4524         '')     p_=':';;
4525         *)      p_="$path_sep";;
4526         esac
4527         ;;
4528 esac
4529 exe_ext=$_exe
4530 lib_ext=$_a
4531 obj_ext=$_o
4532 path_sep=$p_
4533
4534 : Which makefile gets called first.  This is used by make depend.
4535 case "$firstmakefile" in
4536 '') firstmakefile='makefile';;
4537 esac
4538
4539 case "$ccflags" in
4540 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4541 esac
4542
4543 case "$uselongdouble" in
4544 $define|true|[yY]*)     dflt='y';;
4545 *) dflt='n';;
4546 esac
4547 cat <<EOM
4548
4549 Perl can be built to take advantage of long doubles which
4550 (if available) may give more accuracy and range for floating point numbers.
4551
4552 If this doesn't make any sense to you, just accept the default '$dflt'.
4553 EOM
4554 rp='Try to use long doubles if available?'
4555 . ./myread
4556 case "$ans" in
4557 y|Y)    val="$define"   ;;
4558 *)      val="$undef"    ;;
4559 esac
4560 set uselongdouble
4561 eval $setvar
4562
4563 case "$uselongdouble" in
4564 true|[yY]*) uselongdouble="$define" ;;
4565 esac
4566
4567 : Look for a hint-file generated 'call-back-unit'.  If the
4568 : user has specified that long doubles should be used,
4569 : we may need to set or change some other defaults.
4570 if $test -f uselongdouble.cbu; then
4571     echo "Your platform has some specific hints regarding long doubles, using them..."
4572     . ./uselongdouble.cbu
4573 else
4574     case "$uselongdouble" in
4575         $define)
4576                 $cat <<EOM
4577 (Your platform does not have any specific hints for long doubles.)
4578 EOM
4579         ;;
4580     esac
4581 fi
4582
4583 : Looking for optional libraries
4584 echo " "
4585 echo "Checking for optional libraries..." >&4
4586 case "$libs" in
4587 ' '|'') dflt='';;
4588 *) dflt="$libs";;
4589 esac
4590 case "$libswanted" in
4591 '') libswanted='c_s';;
4592 esac
4593 case "$usesocks" in
4594 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4595 esac
4596 libsfound=''
4597 libsfiles=''
4598 libsdirs=''
4599 libspath=''
4600 for thisdir in $libpth $xlibpth; do
4601   test -d $thisdir && libspath="$libspath $thisdir"
4602 done
4603 for thislib in $libswanted; do
4604         for thisdir in $libspath; do
4605             xxx=''
4606             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4607                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4608                 $test -f "$xxx" && eval $libscheck
4609                 $test -f "$xxx" && libstyle=shared
4610             fi
4611             if test ! -f "$xxx"; then
4612                 xxx=$thisdir/lib$thislib.$so
4613                 $test -f "$xxx" && eval $libscheck
4614                 $test -f "$xxx" && libstyle=shared
4615             fi  
4616             if test ! -f "$xxx"; then
4617                 xxx=$thisdir/lib$thislib$_a
4618                 $test -f "$xxx" && eval $libscheck
4619                 $test -f "$xxx" && libstyle=static
4620             fi
4621             if test ! -f "$xxx"; then
4622                 xxx=$thisdir/$thislib$_a
4623                 $test -f "$xxx" && eval $libscheck
4624                 $test -f "$xxx" && libstyle=static
4625             fi
4626             if test ! -f "$xxx"; then
4627                 xxx=$thisdir/lib${thislib}_s$_a
4628                 $test -f "$xxx" && eval $libscheck
4629                 $test -f "$xxx" && libstyle=static
4630                 $test -f "$xxx" && thislib=${thislib}_s
4631             fi
4632             if test ! -f "$xxx"; then
4633                 xxx=$thisdir/Slib$thislib$_a
4634                 $test -f "$xxx" && eval $libscheck
4635                 $test -f "$xxx" && libstyle=static
4636             fi
4637             if $test -f "$xxx"; then
4638                 case "$libstyle" in
4639                 shared) echo "Found -l$thislib (shared)." ;;
4640                 static) echo "Found -l$thislib." ;;
4641                 *)      echo "Found -l$thislib ($libstyle)." ;;
4642                 esac
4643                 case " $dflt " in
4644                 *"-l$thislib "*);;
4645                 *) dflt="$dflt -l$thislib"
4646                    libsfound="$libsfound $xxx"
4647                    yyy=`basename $xxx`
4648                    libsfiles="$libsfiles $yyy"
4649                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4650                    case " $libsdirs " in
4651                    *" $yyy "*) ;;
4652                    *) libsdirs="$libsdirs $yyy" ;;
4653                    esac
4654                    ;;
4655                 esac
4656                 break
4657             fi  
4658         done
4659         if $test ! -f "$xxx"; then
4660             echo "No -l$thislib."
4661         fi
4662 done
4663 set X $dflt
4664 shift
4665 dflt="$*"
4666 case "$libs" in
4667 '') dflt="$dflt";;
4668 *) dflt="$libs";;
4669 esac
4670 case "$dflt" in
4671 ' '|'') dflt='none';;
4672 esac
4673
4674 $cat <<EOM
4675
4676 In order to compile $package on your machine, a number of libraries
4677 are usually needed.  Include any other special libraries here as well.
4678 Say "none" for none.  The default list is almost always right.
4679 EOM
4680
4681 echo " "
4682 rp="What libraries to use?"
4683 . ./myread
4684 case "$ans" in
4685 none) libs=' ';;
4686 *) libs="$ans";;
4687 esac
4688
4689 : determine optimization, if desired, or use for debug flag also
4690 case "$optimize" in
4691 ' '|$undef) dflt='none';;
4692 '') dflt='-O';;
4693 *) dflt="$optimize";;
4694 esac
4695 $cat <<EOH
4696
4697 By default, $package compiles with the -O flag to use the optimizer.
4698 Alternately, you might want to use the symbolic debugger, which uses
4699 the -g flag (on traditional Unix systems).  Either flag can be
4700 specified here.  To use neither flag, specify the word "none".
4701
4702 EOH
4703 rp="What optimizer/debugger flag should be used?"
4704 . ./myread
4705 optimize="$ans"
4706 case "$optimize" in
4707 'none') optimize=" ";;
4708 esac
4709
4710 dflt=''
4711 : We will not override a previous value, but we might want to
4712 : augment a hint file
4713 case "$hint" in
4714 default|recommended)
4715         case "$gccversion" in
4716         1*) dflt='-fpcc-struct-return' ;;
4717         esac
4718         case "$optimize" in
4719         *-g*) dflt="$dflt -DDEBUGGING";;
4720         esac
4721         case "$gccversion" in
4722         2*) if test -d /etc/conf/kconfig.d &&
4723                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4724                 then
4725                         # Interactive Systems (ISC) POSIX mode.
4726                         dflt="$dflt -posix"
4727                 fi
4728                 ;;
4729         esac
4730         case "$gccversion" in
4731         1*) ;;
4732         2.[0-8]*) ;;
4733         ?*)     echo " "
4734                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4735                 echo 'int main(void) { return 0; }' > gcctest.c
4736                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4737                         echo "Yes, it does." 2>&1
4738                         case "$ccflags" in
4739                         *strict-aliasing*)
4740                                 echo "Leaving current flags $ccflags alone." 2>&1
4741                                 ;;
4742                         *) dflt="$dflt -fno-strict-aliasing" ;;
4743                         esac
4744                 else
4745                         echo "Nope, it doesn't, but that's ok." 2>&1
4746                 fi
4747                 ;;
4748         esac
4749         # For gcc, adding -pipe speeds up compilations for some, but apparently
4750         # some assemblers can't read from stdin.  (It also slows down compilations
4751         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
4752         case "$gccversion" in
4753         ?*)     echo " "
4754                 echo "Checking if your compiler accepts -pipe" 2>&1
4755                 echo 'int main(void) { return 0; }' > gcctest.c
4756                 if $cc -pipe -o gcctest gcctest.c; then
4757                         echo "Yes, it does." 2>&1
4758                         case "$ccflags" in
4759                         *-pipe*)
4760                                 echo "Leaving current flags $ccflags alone." 2>&1
4761                                 ;;
4762                         *) dflt="$dflt -pipe" ;;
4763                         esac
4764                 else
4765                         echo "Nope, it doesn't, but that's ok." 2>&1
4766                 fi
4767
4768                 echo "Checking if your compiler accepts -Wdeclaration-after-statement" 2>&1
4769                 echo 'int main(void) { return 0; }' > gcctest.c
4770                 if $cc -Wdeclaration-after-statement -o gcctest gcctest.c; then
4771                         echo "Yes, it does." 2>&1
4772                         case "$ccflags" in
4773                         *-Wdeclaration-after-statement*)
4774                                 echo "Leaving current flags $ccflags alone." 2>&1
4775                                 ;;
4776                         *) dflt="$dflt -Wdeclaration-after-statement" ;;
4777                         esac
4778                 else
4779                         echo "Nope, it doesn't, but that's ok." 2>&1
4780                 fi
4781                 ;;
4782         esac
4783         ;;
4784 esac
4785
4786 case "$mips_type" in
4787 *BSD*|'') inclwanted="$locincpth $usrinc";;
4788 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4789 esac
4790 for thisincl in $inclwanted; do
4791         if $test -d $thisincl; then
4792                 if $test x$thisincl != x$usrinc; then
4793                         case "$dflt" in
4794                         *" -I$thisincl "*);;
4795                         *) dflt="$dflt -I$thisincl ";;
4796                         esac
4797                 fi
4798         fi
4799 done
4800
4801 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4802         xxx=true;
4803 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4804         xxx=true;
4805 else
4806         xxx=false;
4807 fi;
4808 if $xxx; then
4809         case "$dflt" in
4810         *$2*);;
4811         *) dflt="$dflt -D$2";;
4812         esac;
4813 fi'
4814
4815 set signal.h LANGUAGE_C; eval $inctest
4816
4817 case "$usesocks" in
4818 $define)
4819         ccflags="$ccflags -DSOCKS"
4820         ;;
4821 esac
4822
4823 case "$hint" in
4824 default|recommended) dflt="$ccflags $dflt" ;;
4825 *) dflt="$ccflags";;
4826 esac
4827
4828 case "$dflt" in
4829 ''|' ') dflt=none;;
4830 esac
4831
4832 $cat <<EOH
4833
4834 Your C compiler may want other flags.  For this question you should include
4835 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4836 but you should NOT include libraries or ld flags like -lwhatever.  If you
4837 want $package to honor its debug switch, you should include -DDEBUGGING here.
4838 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4839
4840 To use no flags, specify the word "none".
4841
4842 EOH
4843 set X $dflt
4844 shift
4845 dflt=${1+"$@"}
4846 rp="Any additional cc flags?"
4847 . ./myread
4848 case "$ans" in
4849 none) ccflags='';;
4850 *) ccflags="$ans";;
4851 esac
4852
4853 : the following weeds options from ccflags that are of no interest to cpp
4854 case "$cppflags" in
4855 '') cppflags="$ccflags" ;;
4856 *)  cppflags="$cppflags $ccflags" ;;
4857 esac
4858 case "$gccversion" in
4859 1*) cppflags="$cppflags -D__GNUC__"
4860 esac
4861 case "$mips_type" in
4862 '');;
4863 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4864 esac
4865 case "$cppflags" in
4866 '');;
4867 *)
4868         echo " "
4869         echo "Let me guess what the preprocessor flags are..." >&4
4870         set X $cppflags
4871         shift
4872         cppflags=''
4873         $cat >cpp.c <<'EOM'
4874 #define BLURFL foo
4875
4876 BLURFL xx LFRULB
4877 EOM
4878         previous=''
4879         for flag in $*
4880         do
4881                 case "$flag" in
4882                 -*) ftry="$flag";;
4883                 *) ftry="$previous $flag";;
4884                 esac
4885                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4886                         >cpp1.out 2>/dev/null && \
4887                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4888                         >cpp2.out 2>/dev/null && \
4889                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4890                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4891                 then
4892                         cppflags="$cppflags $ftry"
4893                         previous=''
4894                 else
4895                         previous="$flag"
4896                 fi
4897         done
4898         set X $cppflags
4899         shift
4900         cppflags=${1+"$@"}
4901         case "$cppflags" in
4902         *-*)  echo "They appear to be: $cppflags";;
4903         esac
4904         $rm -f cpp.c cpp?.out
4905         ;;
4906 esac
4907
4908 : flags used in final linking phase
4909 case "$ldflags" in
4910 '') if ./venix; then
4911                 dflt='-i -z'
4912         else
4913                 dflt=''
4914         fi
4915         case "$ccflags" in
4916         *-posix*) dflt="$dflt -posix" ;;
4917         esac
4918         ;;
4919 *) dflt="$ldflags";;
4920 esac
4921
4922 : Try to guess additional flags to pick up local libraries.
4923 for thislibdir in $libpth; do
4924         case " $loclibpth " in
4925         *" $thislibdir "*)
4926                 case "$dflt " in
4927                 *"-L$thislibdir "*) ;;
4928                 *)  dflt="$dflt -L$thislibdir" ;;
4929                 esac
4930                 ;;
4931         esac
4932 done
4933
4934 case "$dflt" in
4935 '') dflt='none' ;;
4936 esac
4937
4938 $cat <<EOH
4939
4940 Your C linker may need flags.  For this question you should
4941 include -L/whatever and any other flags used by the C linker, but you
4942 should NOT include libraries like -lwhatever.
4943
4944 Make sure you include the appropriate -L/path flags if your C linker
4945 does not normally search all of the directories you specified above,
4946 namely
4947         $libpth
4948 To use no flags, specify the word "none".
4949
4950 EOH
4951
4952 rp="Any additional ld flags (NOT including libraries)?"
4953 . ./myread
4954 case "$ans" in
4955 none) ldflags='';;
4956 *) ldflags="$ans";;
4957 esac
4958 rmlist="$rmlist pdp11"
4959
4960 : coherency check
4961 echo " "
4962 echo "Checking your choice of C compiler and flags for coherency..." >&4
4963 $cat > try.c <<'EOF'
4964 #include <stdio.h>
4965 int main() { printf("Ok\n"); return(0); }
4966 EOF
4967 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4968 shift
4969 $cat >try.msg <<'EOM'
4970 I've tried to compile and run the following simple program:
4971
4972 EOM
4973 $cat try.c >> try.msg
4974
4975 $cat >> try.msg <<EOM
4976
4977 I used the command:
4978
4979         $*
4980         $run ./try
4981
4982 and I got the following output:
4983
4984 EOM
4985 dflt=y
4986 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4987         if $sh -c "$run ./try" >>try.msg 2>&1; then
4988                 xxx=`$run ./try`
4989                 case "$xxx" in
4990                 "Ok") dflt=n ;;
4991                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4992                         case " $libs " in
4993                         *" -lsfio "*)
4994                                 cat >> try.msg <<'EOQS'
4995 If $libs contains -lsfio, and sfio is mis-configured, then it
4996 sometimes (apparently) runs and exits with a 0 status, but with no
4997 output!  It may have to do with sfio's use of _exit vs. exit.
4998
4999 EOQS
5000                                 rp="You have a big problem.  Shall I abort Configure"
5001                                 dflt=y
5002                                 ;;
5003                         esac
5004                         ;;
5005                 esac
5006         else
5007                 echo "The program compiled OK, but exited with status $?." >>try.msg
5008                 rp="You have a problem.  Shall I abort Configure"
5009                 dflt=y
5010         fi
5011 else
5012         echo "I can't compile the test program." >>try.msg
5013         rp="You have a BIG problem.  Shall I abort Configure"
5014         dflt=y
5015 fi
5016 case "$dflt" in
5017 y)
5018         $cat try.msg >&4
5019         case "$knowitall" in
5020         '')
5021                 echo "(The supplied flags or libraries might be incorrect.)"
5022                 ;;
5023         *) dflt=n;;
5024         esac
5025         echo " "
5026         . ./myread
5027         case "$ans" in
5028         n*|N*) ;;
5029         *)      echo "Ok.  Stopping Configure." >&4
5030                 exit 1
5031                 ;;
5032         esac
5033         ;;
5034 n) echo "OK, that should do.";;
5035 esac
5036 $rm -f try try.* core
5037
5038 : define a shorthand compile call
5039 compile='
5040 mc_file=$1;
5041 shift;
5042 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5043 : define a shorthand compile call for compilations that should be ok.
5044 compile_ok='
5045 mc_file=$1;
5046 shift;
5047 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5048
5049 : determine filename position in cpp output
5050 echo " "
5051 echo "Computing filename position in cpp output for #include directives..." >&4
5052 case "$osname" in
5053 vos) testaccess=-e ;;
5054 *)   testaccess=-r ;;
5055 esac
5056 echo '#include <stdio.h>' > foo.c
5057 $cat >fieldn <<EOF
5058 $startsh
5059 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5060 $grep '^[       ]*#.*stdio\.h' | \
5061 while read cline; do
5062         pos=1
5063         set \$cline
5064         while $test \$# -gt 0; do
5065                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5066                         echo "\$pos"
5067                         exit 0
5068                 fi
5069                 shift
5070                 pos=\`expr \$pos + 1\`
5071         done
5072 done
5073 EOF
5074 chmod +x fieldn
5075 fieldn=`./fieldn`
5076 $rm -f foo.c fieldn
5077 case $fieldn in
5078 '') pos='???';;
5079 1) pos=first;;
5080 2) pos=second;;
5081 3) pos=third;;
5082 *) pos="${fieldn}th";;
5083 esac
5084 echo "Your cpp writes the filename in the $pos field of the line."
5085
5086 case "$osname" in
5087 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5088 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5089 *)   cppfilter='' ;;
5090 esac
5091 : locate header file
5092 $cat >findhdr <<EOF
5093 $startsh
5094 wanted=\$1
5095 name=''
5096 for usrincdir in $usrinc
5097 do
5098         if test -f \$usrincdir/\$wanted; then
5099                 echo "\$usrincdir/\$wanted"
5100                 exit 0
5101         fi
5102 done
5103 awkprg='{ print \$$fieldn }'
5104 echo "#include <\$wanted>" > foo\$\$.c
5105 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5106 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5107 while read cline; do
5108         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5109         case "\$name" in
5110         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5111         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5112         *) exit 2;;
5113         esac;
5114 done;
5115 #
5116 # status = 0: grep returned 0 lines, case statement not executed
5117 # status = 1: headerfile found
5118 # status = 2: while loop executed, no headerfile found
5119 #
5120 status=\$?
5121 $rm -f foo\$\$.c;
5122 if test \$status -eq 1; then
5123         exit 0;
5124 fi
5125 exit 1
5126 EOF
5127 chmod +x findhdr
5128
5129 : define an alternate in-header-list? function
5130 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5131 cont=true; xxf="echo \"<\$1> found.\" >&4";
5132 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5133 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5134 esac;
5135 case $# in 4) instead=instead;; *) instead="at last";; esac;
5136 while $test "$cont"; do
5137         xxx=`./findhdr $1`
5138         var=$2; eval "was=\$$2";
5139         if $test "$xxx" && $test -r "$xxx";
5140         then eval $xxf;
5141         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5142                 cont="";
5143         else eval $xxnf;
5144         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5145         set $yyy; shift; shift; yyy=$@;
5146         case $# in 0) cont="";;
5147         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5148                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5149         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5150                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5151         esac;
5152 done;
5153 while $test "$yyy";
5154 do set $yyy; var=$2; eval "was=\$$2";
5155         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5156         set $yyy; shift; shift; yyy=$@;
5157 done'
5158
5159 : see if stdlib is available
5160 set stdlib.h i_stdlib
5161 eval $inhdr
5162
5163 : check for lengths of integral types
5164 echo " "
5165 case "$intsize" in
5166 '')
5167         echo "Checking to see how big your integers are..." >&4
5168         $cat >try.c <<EOCP
5169 #include <stdio.h>
5170 #$i_stdlib I_STDLIB
5171 #ifdef I_STDLIB
5172 #include <stdlib.h>
5173 #endif
5174 int main()
5175 {
5176         printf("intsize=%d;\n", (int)sizeof(int));
5177         printf("longsize=%d;\n", (int)sizeof(long));
5178         printf("shortsize=%d;\n", (int)sizeof(short));
5179         exit(0);
5180 }
5181 EOCP
5182         set try
5183         if eval $compile_ok && $run ./try > /dev/null; then
5184                 eval `$run ./try`
5185                 echo "Your integers are $intsize bytes long."
5186                 echo "Your long integers are $longsize bytes long."
5187                 echo "Your short integers are $shortsize bytes long."
5188         else
5189                 $cat >&4 <<EOM
5190 !
5191 Help! I can't compile and run the intsize test program: please enlighten me!
5192 (This is probably a misconfiguration in your system or libraries, and
5193 you really ought to fix it.  Still, I'll try anyway.)
5194 !
5195 EOM
5196                 dflt=4
5197                 rp="What is the size of an integer (in bytes)?"
5198                 . ./myread
5199                 intsize="$ans"
5200                 dflt=$intsize
5201                 rp="What is the size of a long integer (in bytes)?"
5202                 . ./myread
5203                 longsize="$ans"
5204                 dflt=2
5205                 rp="What is the size of a short integer (in bytes)?"
5206                 . ./myread
5207                 shortsize="$ans"
5208         fi
5209         ;;
5210 esac
5211 $rm -f try try.*
5212
5213 : check for long long
5214 echo " "
5215 echo "Checking to see if you have long long..." >&4
5216 echo 'int main() { long long x = 7; return 0; }' > try.c
5217 set try
5218 if eval $compile; then
5219         val="$define"
5220         echo "You have long long."
5221 else
5222         val="$undef"
5223         echo "You do not have long long."
5224 fi
5225 $rm try.*
5226 set d_longlong
5227 eval $setvar
5228
5229 : check for length of long long
5230 case "${d_longlong}${longlongsize}" in
5231 $define)
5232         echo " "
5233         echo "Checking to see how big your long longs are..." >&4
5234         $cat >try.c <<'EOCP'
5235 #include <stdio.h>
5236 int main()
5237 {
5238     printf("%d\n", (int)sizeof(long long));
5239     return(0);
5240 }
5241 EOCP
5242         set try
5243         if eval $compile_ok; then
5244                 longlongsize=`$run ./try`
5245                 echo "Your long longs are $longlongsize bytes long."
5246         else
5247                 dflt='8'
5248                 echo " "
5249                 echo "(I can't seem to compile the test program.  Guessing...)"
5250                 rp="What is the size of a long long (in bytes)?"
5251                 . ./myread
5252                 longlongsize="$ans"
5253         fi
5254         if $test "X$longsize" = "X$longlongsize"; then
5255                 echo "(That isn't any different from an ordinary long.)"
5256         fi      
5257         ;;
5258 esac
5259 $rm -f try.* try
5260
5261 : see if inttypes.h is available
5262 : we want a real compile instead of Inhdr because some systems
5263 : have an inttypes.h which includes non-existent headers
5264 echo " "
5265 $cat >try.c <<EOCP
5266 #include <inttypes.h>
5267 int main() {
5268         static int32_t foo32 = 0x12345678;
5269 }
5270 EOCP
5271 set try
5272 if eval $compile; then
5273         echo "<inttypes.h> found." >&4
5274         val="$define"
5275 else
5276         echo "<inttypes.h> NOT found." >&4
5277         val="$undef"
5278 fi
5279 $rm -f try.c try
5280 set i_inttypes
5281 eval $setvar
5282
5283 : check for int64_t
5284 echo " "
5285 echo "Checking to see if you have int64_t..." >&4
5286 $cat >try.c <<EOCP
5287 #include <sys/types.h>
5288 #$i_inttypes I_INTTYPES
5289 #ifdef I_INTTYPES
5290 #include <inttypes.h>
5291 #endif
5292 int main() { int64_t x = 7; }
5293 EOCP
5294 set try
5295 if eval $compile; then
5296         val="$define"
5297         echo "You have int64_t."
5298 else
5299         val="$undef"
5300         echo "You do not have int64_t."
5301 fi
5302 $rm -f try try.*
5303 set d_int64_t
5304 eval $setvar
5305
5306
5307 echo " "
5308 echo "Checking which 64-bit integer type we could use..." >&4
5309
5310 case "$intsize" in
5311 8) val=int
5312    set quadtype
5313    eval $setvar
5314    val='"unsigned int"'
5315    set uquadtype
5316    eval $setvar
5317    quadkind=1
5318    ;;
5319 *) case "$longsize" in
5320    8) val=long
5321       set quadtype
5322       eval $setvar
5323       val='"unsigned long"'
5324       set uquadtype
5325       eval $setvar
5326       quadkind=2
5327       ;;
5328    *) case "$d_longlong:$longlongsize" in
5329       define:8)
5330         val='"long long"'
5331         set quadtype
5332         eval $setvar
5333         val='"unsigned long long"'
5334         set uquadtype
5335         eval $setvar
5336         quadkind=3
5337         ;;
5338       *) case "$d_int64_t" in
5339          define)
5340            val=int64_t
5341            set quadtype
5342            eval $setvar
5343            val=uint64_t
5344            set uquadtype
5345            eval $setvar
5346            quadkind=4
5347            ;;
5348          esac
5349          ;;
5350       esac
5351       ;;
5352    esac
5353    ;;
5354 esac
5355
5356 case "$quadtype" in
5357 '')     echo "Alas, no 64-bit integer types in sight." >&4
5358         d_quad="$undef"
5359         ;;
5360 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5361         d_quad="$define"
5362         ;;
5363 esac
5364
5365
5366 case "$uselonglong" in
5367 "$define"|true|[yY]*)
5368         cat <<EOM >&4
5369
5370 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5371 EOM
5372         use64bitint="$define"
5373         ;;
5374 esac                          
5375 case "$use64bits" in
5376 "$define"|true|[yY]*)
5377         cat <<EOM >&4
5378
5379 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5380 EOM
5381         use64bitint="$define"
5382         ;;
5383 esac                          
5384 case "$use64bitints" in
5385 "$define"|true|[yY]*)
5386         cat <<EOM >&4
5387
5388 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5389 EOM
5390         use64bitint="$define"
5391         ;;
5392 esac                          
5393 case "$use64bitsint" in
5394 "$define"|true|[yY]*)
5395         cat <<EOM >&4
5396
5397 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5398 EOM
5399         use64bitint="$define"
5400         ;;
5401 esac                          
5402 case "$uselonglongs" in
5403 "$define"|true|[yY]*)
5404         cat <<EOM >&4
5405
5406 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5407 EOM
5408         use64bitint="$define"
5409         ;;
5410 esac                          
5411 case "$use64bitsall" in
5412 "$define"|true|[yY]*)
5413         cat <<EOM >&4
5414
5415 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5416 EOM
5417         use64bitall="$define"
5418         ;;
5419 esac                          
5420
5421 case "$ccflags" in
5422 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5423 esac
5424 case "$use64bitall" in
5425 "$define"|true|[yY]*) use64bitint="$define" ;;
5426 esac
5427
5428 case "$longsize" in
5429 8) cat <<EOM
5430
5431 You have natively 64-bit long integers.
5432 EOM
5433    val="$define"
5434    ;;
5435 *) case "$use64bitint" in
5436    "$define"|true|[yY]*) dflt='y';;
5437    *) dflt='n';;
5438    esac
5439    case "$d_quad" in
5440    "$define") ;;
5441    *) dflt='n' ;;
5442    esac
5443    cat <<EOM
5444
5445 Perl can be built to take advantage of 64-bit integer types
5446 on some systems.  To do so, Configure can be run with -Duse64bitint.
5447 Choosing this option will most probably introduce binary incompatibilities.
5448
5449 If this doesn't make any sense to you, just accept the default '$dflt'.
5450 (The default has been chosen based on your configuration.)
5451 EOM
5452    rp='Try to use 64-bit integers, if available?'
5453    . ./myread
5454    case "$ans" in
5455    [yY]*) val="$define" ;;
5456    *)     val="$undef"  ;;
5457    esac
5458    ;;
5459 esac
5460 set use64bitint
5461 eval $setvar
5462
5463 case "$use64bitall" in
5464 "$define"|true|[yY]*) dflt='y' ;;
5465 *) case "$longsize" in
5466    8) dflt='y' ;;
5467    *) dflt='n' ;;
5468    esac
5469    ;;
5470 esac    
5471 cat <<EOM
5472
5473 You may also choose to try maximal 64-bitness.  It means using as much
5474 64-bitness as possible on the platform.  This in turn means even more
5475 binary incompatibilities.  On the other hand, your platform may not
5476 have any more 64-bitness available than what you already have chosen.
5477
5478 If this doesn't make any sense to you, just accept the default '$dflt'.
5479 (The default has been chosen based on your configuration.)
5480 EOM
5481 rp='Try to use maximal 64-bit support, if available?'
5482 . ./myread
5483 case "$ans" in
5484 [yY]*) val="$define" ;;
5485 *)     val="$undef"  ;;
5486 esac
5487 set use64bitall
5488 eval $setvar
5489 case "$use64bitall" in
5490 "$define")
5491         case "$use64bitint" in
5492         "$undef")
5493                 cat <<EOM
5494
5495 Since you have chosen a maximally 64-bit build, I'm also turning on
5496 the use of 64-bit integers.
5497 EOM
5498                 use64bitint="$define" ;;
5499         esac
5500         ;;
5501 esac
5502
5503 : Look for a hint-file generated 'call-back-unit'.  If the
5504 : user has specified that a 64-bit perl is to be built,
5505 : we may need to set or change some other defaults.
5506 if $test -f use64bitint.cbu; then
5507         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5508         . ./use64bitint.cbu
5509 fi
5510 case "$use64bitint" in
5511 "$define"|true|[yY]*)
5512         case "$longsize" in
5513         4) case "$archname64" in
5514            '') archname64=64int ;;
5515            esac
5516            ;;
5517         esac
5518         ;;
5519 esac
5520
5521 : Look for a hint-file generated 'call-back-unit'.  If the
5522 : user has specified that a maximally 64-bit perl is to be built,
5523 : we may need to set or change some other defaults.
5524 if $test -f use64bitall.cbu; then
5525         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5526         . ./use64bitall.cbu
5527 fi
5528 case "$use64bitall" in
5529 "$define"|true|[yY]*)
5530         case "$longsize" in
5531         4) case "$archname64" in
5532            ''|64int) archname64=64all ;;
5533            esac
5534            ;;
5535         esac
5536         ;;
5537 esac
5538
5539 case "$d_quad:$use64bitint" in
5540 $undef:$define)
5541         cat >&4 <<EOF
5542
5543 *** You have chosen to use 64-bit integers,
5544 *** but none can be found.
5545 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5546 *** Cannot continue, aborting.
5547
5548 EOF
5549         exit 1
5550         ;;
5551 esac
5552
5553 : check for length of double
5554 echo " "
5555 case "$doublesize" in
5556 '')
5557         echo "Checking to see how big your double precision numbers are..." >&4
5558         $cat >try.c <<EOCP
5559 #include <stdio.h>
5560 #$i_stdlib I_STDLIB
5561 #ifdef I_STDLIB
5562 #include <stdlib.h>
5563 #endif
5564 int main()
5565 {
5566     printf("%d\n", (int)sizeof(double));
5567     exit(0);
5568 }
5569 EOCP
5570         set try
5571         if eval $compile_ok; then
5572                 doublesize=`$run ./try`
5573                 echo "Your double is $doublesize bytes long."
5574         else
5575                 dflt='8'
5576                 echo "(I can't seem to compile the test program.  Guessing...)"
5577                 rp="What is the size of a double precision number (in bytes)?"
5578                 . ./myread
5579                 doublesize="$ans"
5580         fi
5581         ;;
5582 esac
5583 $rm -f try.c try
5584
5585 : check for long doubles
5586 echo " "
5587 echo "Checking to see if you have long double..." >&4
5588 echo 'int main() { long double x = 7.0; }' > try.c
5589 set try
5590 if eval $compile; then
5591         val="$define"
5592         echo "You have long double."
5593 else
5594         val="$undef"
5595         echo "You do not have long double."
5596 fi
5597 $rm try.*
5598 set d_longdbl
5599 eval $setvar
5600
5601 : check for length of long double
5602 case "${d_longdbl}${longdblsize}" in
5603 $define)
5604         echo " "
5605         echo "Checking to see how big your long doubles are..." >&4
5606         $cat >try.c <<'EOCP'
5607 #include <stdio.h>
5608 int main()
5609 {
5610         printf("%d\n", sizeof(long double));
5611 }
5612 EOCP
5613         set try
5614         set try
5615         if eval $compile; then
5616                 longdblsize=`$run ./try`
5617                 echo "Your long doubles are $longdblsize bytes long."
5618         else
5619                 dflt='8'
5620                 echo " "
5621                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5622                 rp="What is the size of a long double (in bytes)?"
5623                 . ./myread
5624                 longdblsize="$ans"
5625         fi
5626         if $test "X$doublesize" = "X$longdblsize"; then
5627                 echo "That isn't any different from an ordinary double."
5628                 echo "I'll keep your setting anyway, but you may see some"
5629                 echo "harmless compilation warnings."
5630         fi      
5631         ;;
5632 esac
5633 $rm -f try.* try
5634
5635 : determine the architecture name
5636 echo " "
5637 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5638         tarch=`arch`"-$osname"
5639 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5640         if uname -m > tmparch 2>&1 ; then
5641                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5642                         -e 's/$/'"-$osname/" tmparch`
5643         else
5644                 tarch="$osname"
5645         fi
5646         $rm -f tmparch
5647 else
5648         tarch="$osname"
5649 fi
5650 case "$myarchname" in
5651 ''|"$tarch") ;;
5652 *)
5653         echo "(Your architecture name used to be $myarchname.)"
5654         archname=''
5655         ;;
5656 esac
5657 case "$targetarch" in
5658 '') ;;
5659 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5660 esac
5661 myarchname="$tarch"
5662 case "$archname" in
5663 '') dflt="$tarch";;
5664 *) dflt="$archname";;
5665 esac
5666 rp='What is your architecture name'
5667 . ./myread
5668 archname="$ans"
5669 case "$usethreads" in
5670 $define)
5671         echo "Threads selected." >&4
5672         case "$archname" in
5673         *-thread*) echo "...and architecture name already has -thread." >&4
5674                 ;;
5675         *)      archname="$archname-thread"
5676                 echo "...setting architecture name to $archname." >&4
5677                 ;;
5678         esac
5679         ;;
5680 esac
5681 case "$usemultiplicity" in
5682 $define)
5683         echo "Multiplicity selected." >&4
5684         case "$archname" in
5685         *-multi*) echo "...and architecture name already has -multi." >&4
5686                 ;;
5687         *)      archname="$archname-multi"
5688                 echo "...setting architecture name to $archname." >&4
5689                 ;;
5690         esac
5691         ;;
5692 esac
5693 case "$use64bitint$use64bitall" in
5694 *"$define"*)
5695         case "$archname64" in
5696         '')
5697                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5698                 ;;
5699         *)
5700                 case "$use64bitint" in
5701                 "$define") echo "64 bit integers selected." >&4 ;;
5702                 esac
5703                 case "$use64bitall" in
5704                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5705                 esac
5706                 case "$archname" in
5707                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5708                         ;;
5709                 *)      archname="$archname-$archname64"
5710                         echo "...setting architecture name to $archname." >&4
5711                         ;;
5712                 esac
5713                 ;;
5714         esac
5715 esac
5716 case "$uselongdouble" in
5717 $define)
5718         echo "Long doubles selected." >&4
5719         case "$longdblsize" in
5720         $doublesize)
5721                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
5722                 ;;
5723         *)
5724                 case "$archname" in
5725                 *-ld*) echo "...and architecture name already has -ld." >&4
5726                         ;;
5727                 *)      archname="$archname-ld"
5728                         echo "...setting architecture name to $archname." >&4
5729                         ;;
5730                 esac
5731                 ;;
5732         esac
5733         ;;
5734 esac
5735 case "$useperlio" in
5736 $define)
5737         echo "Perlio selected." >&4
5738         ;;
5739 *)
5740         echo "Perlio not selected, using stdio." >&4
5741         case "$archname" in
5742         *-stdio*) echo "...and architecture name already has -stdio." >&4
5743                 ;;
5744         *)      archname="$archname-stdio"
5745                 echo "...setting architecture name to $archname." >&4
5746                 ;;
5747         esac
5748         ;;
5749 esac
5750 if $test -f archname.cbu; then
5751         echo "Your platform has some specific hints for architecture name, using them..."
5752         . ./archname.cbu
5753 fi
5754
5755 : determine root of directory hierarchy where package will be installed.
5756 case "$prefix" in
5757 '')
5758         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5759         ;;
5760 *?/)
5761         dflt=`echo "$prefix" | sed 's/.$//'`
5762         ;;
5763 *)
5764         dflt="$prefix"
5765         ;;
5766 esac
5767 $cat <<EOM
5768
5769 By default, $package will be installed in $dflt/bin, manual pages
5770 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5771 installation directories. Typically this is something like /usr/local.
5772 If you wish to have binaries under /usr/bin but other parts of the
5773 installation under /usr/local, that's ok: you will be prompted
5774 separately for each of the installation directories, the prefix being
5775 only used to set the defaults.
5776
5777 EOM
5778 fn=d~
5779 rp='Installation prefix to use?'
5780 . ./getfile
5781 oldprefix=''
5782 case "$prefix" in
5783 '') ;;
5784 *)
5785         case "$ans" in
5786         "$prefix") ;;
5787         *) oldprefix="$prefix";;
5788         esac
5789         ;;
5790 esac
5791 prefix="$ans"
5792 prefixexp="$ansexp"
5793
5794 case "$afsroot" in
5795 '')     afsroot=/afs ;;
5796 *)      afsroot=$afsroot ;;
5797 esac
5798
5799 : is AFS running?
5800 echo " "
5801 case "$afs" in
5802 $define|true)   afs=true ;;
5803 $undef|false)   afs=false ;;
5804 *)      if test -d $afsroot; then
5805                 afs=true
5806         else
5807                 afs=false
5808         fi
5809         ;;
5810 esac
5811 if $afs; then
5812         echo "AFS may be running... I'll be extra cautious then..." >&4
5813 else
5814         echo "AFS does not seem to be running..." >&4
5815 fi
5816
5817 : determine installation prefix for where package is to be installed.
5818 if $afs; then 
5819 $cat <<EOM
5820
5821 Since you are running AFS, I need to distinguish the directory in which
5822 files will reside from the directory in which they are installed (and from
5823 which they are presumably copied to the former directory by occult means).
5824
5825 EOM
5826         case "$installprefix" in
5827         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5828         *) dflt="$installprefix";;
5829         esac
5830 else
5831 $cat <<EOM
5832
5833 In some special cases, particularly when building $package for distribution,
5834 it is convenient to distinguish the directory in which files should be
5835 installed from the directory ($prefix) in which they will
5836 eventually reside.  For most users, these two directories are the same.
5837
5838 EOM
5839         case "$installprefix" in
5840         '') dflt=$prefix ;;
5841         *) dflt=$installprefix;;
5842         esac
5843 fi
5844 fn=d~
5845 rp='What installation prefix should I use for installing files?'
5846 . ./getfile
5847 installprefix="$ans"
5848 installprefixexp="$ansexp"
5849
5850 : set the prefixit variable, to compute a suitable default value
5851 prefixit='case "$3" in
5852 ""|none)
5853         case "$oldprefix" in
5854         "") eval "$1=\"\$$2\"";;
5855         *)
5856                 case "$3" in
5857                 "") eval "$1=";;
5858                 none)
5859                         eval "tp=\"\$$2\"";
5860                         case "$tp" in
5861                         ""|" ") eval "$1=\"\$$2\"";;
5862                         *) eval "$1=";;
5863                         esac;;
5864                 esac;;
5865         esac;;
5866 *)
5867         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5868         case "$tp" in
5869         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5870         /*-$oldprefix/*|\~*-$oldprefix/*)
5871                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5872         *) eval "$1=\"\$$2\"";;
5873         esac;;
5874 esac'
5875
5876 : get the patchlevel
5877 echo " "
5878 echo "Getting the current patchlevel..." >&4
5879 if $test -r $rsrc/patchlevel.h;then
5880         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5881         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5882         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5883         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5884         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5885         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5886        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
5887 else
5888         revision=0
5889         patchlevel=0
5890         subversion=0
5891         api_revision=0
5892         api_version=0
5893         api_subversion=0
5894         perl_patchlevel=0
5895         $echo "(You do not have patchlevel.h.  Eek.)"
5896 fi
5897 if $test -r $rsrc/.patch ; then  
5898         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
5899                 perl_patchlevel=`cat $rsrc/.patch`
5900         fi
5901 fi
5902 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
5903 version_patchlevel_string="version $patchlevel subversion $subversion"
5904 case "$perl_patchlevel" in
5905 0|'') ;;
5906 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
5907 esac
5908
5909 $echo "(You have $package $version_patchlevel_string.)"
5910
5911 case "$osname" in
5912 dos|vms)
5913         : XXX Should be a Configure test for double-dots in filenames.
5914         version=`echo $revision $patchlevel $subversion | \
5915                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5916         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5917                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5918         ;;
5919 *)
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 esac
5926 : Special case the 5.005_xx maintenance series, which used 5.005
5927 : without any subversion label as a subdirectory in $sitelib
5928 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5929         api_versionstring='5.005'
5930 fi
5931
5932 : determine installation style
5933 : For now, try to deduce it from prefix unless it is already set.
5934 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5935 case "$installstyle" in
5936 '')     case "$prefix" in
5937                 *perl*) dflt='lib';;
5938                 *) dflt='lib/perl5' ;;
5939         esac
5940         ;;
5941 *)      dflt="$installstyle" ;;
5942 esac
5943 : Probably not worth prompting for this since we prompt for all
5944 : the directories individually, and the prompt would be too long and
5945 : confusing anyway.
5946 installstyle=$dflt
5947
5948 : determine where private library files go
5949 : Usual default is /usr/local/lib/perl5/$version.
5950 : Also allow things like /opt/perl/lib/$version, since 
5951 : /opt/perl/lib/perl5... would be redundant.
5952 : The default "style" setting is made in installstyle.U
5953 case "$installstyle" in
5954 *lib/perl5*) set dflt privlib lib/$package/$version ;;
5955 *)       set dflt privlib lib/$version ;;
5956 esac
5957 eval $prefixit
5958 $cat <<EOM
5959
5960 There are some auxiliary files for $package that need to be put into a
5961 private library directory that is accessible by everyone.
5962
5963 EOM
5964 fn=d~+
5965 rp='Pathname where the private library files will reside?'
5966 . ./getfile
5967 privlib="$ans"
5968 privlibexp="$ansexp"
5969 : Change installation prefix, if necessary.
5970 if $test X"$prefix" != X"$installprefix"; then
5971         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5972 else
5973         installprivlib="$privlibexp"
5974 fi
5975
5976 : set the prefixup variable, to restore leading tilda escape
5977 prefixup='case "$prefixexp" in
5978 "$prefix") ;;
5979 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5980 esac'
5981
5982 : determine where public architecture dependent libraries go
5983 set archlib archlib
5984 eval $prefixit
5985 : privlib default is /usr/local/lib/$package/$version
5986 : archlib default is /usr/local/lib/$package/$version/$archname
5987 : privlib may have an optional trailing /share.
5988 tdflt=`echo $privlib | $sed 's,/share$,,'`
5989 tdflt=$tdflt/$archname
5990 case "$archlib" in
5991 '')     dflt=$tdflt
5992         ;;
5993 *)      dflt="$archlib"
5994     ;;
5995 esac
5996 $cat <<EOM
5997
5998 $spackage contains architecture-dependent library files.  If you are
5999 sharing libraries in a heterogeneous environment, you might store
6000 these files in a separate location.  Otherwise, you can just include
6001 them with the rest of the public library files.
6002
6003 EOM
6004 fn=d+~
6005 rp='Where do you want to put the public architecture-dependent libraries?'
6006 . ./getfile
6007 archlib="$ans"
6008 archlibexp="$ansexp"
6009 if $test X"$archlib" = X"$privlib"; then
6010         d_archlib="$undef"
6011 else
6012         d_archlib="$define"
6013 fi
6014 : Change installation prefix, if necessary.
6015 if $test X"$prefix" != X"$installprefix"; then
6016         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6017 else
6018         installarchlib="$archlibexp"
6019 fi
6020
6021 : see if setuid scripts can be secure
6022 $cat <<EOM
6023
6024 Some kernels have a bug that prevents setuid #! scripts from being
6025 secure.  Some sites have disabled setuid #! scripts because of this.
6026
6027 First let's decide if your kernel supports secure setuid #! scripts.
6028 (If setuid #! scripts would be secure but have been disabled anyway,
6029 don't say that they are secure if asked.)
6030
6031 EOM
6032
6033 val="$undef"
6034 if $test -d /dev/fd; then
6035         echo "#!$ls" >reflect
6036         chmod +x,u+s reflect
6037         ./reflect >flect 2>&1
6038         if $contains "/dev/fd" flect >/dev/null; then
6039                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6040                 val="$define"
6041         else
6042                 $cat <<EOM
6043 If you are not sure if they are secure, I can check but I'll need a
6044 username and password different from the one you are using right now.
6045 If you don't have such a username or don't want me to test, simply
6046 enter 'none'.
6047
6048 EOM
6049                 rp='Other username to test security of setuid scripts with?'
6050                 dflt='none'
6051                 . ./myread
6052                 case "$ans" in
6053                 n|none)
6054                         case "$d_suidsafe" in
6055                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6056                                 dflt=n;;
6057                         "$undef")
6058                                 echo "Well, the $hint value is *not* secure." >&4
6059                                 dflt=n;;
6060                         *)      echo "Well, the $hint value *is* secure." >&4
6061                                 dflt=y;;
6062                         esac
6063                         ;;
6064                 *)
6065                         $rm -f reflect flect
6066                         echo "#!$ls" >reflect
6067                         chmod +x,u+s reflect
6068                         echo >flect
6069                         chmod a+w flect
6070                         echo '"su" will (probably) prompt you for '"$ans's password."
6071                         su $ans -c './reflect >flect'
6072                         if $contains "/dev/fd" flect >/dev/null; then
6073                                 echo "Okay, it looks like setuid scripts are secure." >&4
6074                                 dflt=y
6075                         else
6076                                 echo "I don't think setuid scripts are secure." >&4
6077                                 dflt=n
6078                         fi
6079                         ;;
6080                 esac
6081                 rp='Does your kernel have *secure* setuid scripts?'
6082                 . ./myread
6083                 case "$ans" in
6084                 [yY]*)  val="$define";;
6085                 *)      val="$undef";;
6086                 esac
6087         fi
6088 else
6089         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6090         echo "(That's for file descriptors, not floppy disks.)"
6091         val="$undef"
6092 fi
6093 set d_suidsafe
6094 eval $setvar
6095
6096 $rm -f reflect flect
6097
6098 : now see if they want to do setuid emulation
6099 echo " "
6100 val="$undef"
6101 case "$d_suidsafe" in
6102 "$define")
6103         val="$undef"
6104         echo "No need to emulate SUID scripts since they are secure here." >&4
6105         ;;
6106 *)
6107         $cat <<EOM
6108 Some systems have disabled setuid scripts, especially systems where
6109 setuid scripts cannot be secure.  On systems where setuid scripts have
6110 been disabled, the setuid/setgid bits on scripts are currently
6111 useless.  It is possible for $package to detect those bits and emulate
6112 setuid/setgid in a secure fashion.  This emulation will only work if
6113 setuid scripts have been disabled in your kernel.
6114
6115 EOM
6116         case "$d_dosuid" in
6117         "$define") dflt=y ;;
6118         *) dflt=n ;;
6119         esac
6120         rp="Do you want to do setuid/setgid emulation?"
6121         . ./myread
6122         case "$ans" in
6123         [yY]*)  val="$define";;
6124         *)      val="$undef";;
6125         esac
6126         ;;
6127 esac
6128 set d_dosuid
6129 eval $setvar
6130
6131 : see if this is a malloc.h system
6132 : we want a real compile instead of Inhdr because some systems have a
6133 : malloc.h that just gives a compile error saying to use stdlib.h instead
6134 echo " "
6135 $cat >try.c <<EOCP
6136 #include <stdlib.h>
6137 #include <malloc.h>
6138 int main () { return 0; }
6139 EOCP
6140 set try
6141 if eval $compile; then
6142     echo "<malloc.h> found." >&4
6143     val="$define"
6144 else
6145     echo "<malloc.h> NOT found." >&4
6146     val="$undef"
6147 fi
6148 $rm -f try.c try
6149 set i_malloc
6150 eval $setvar
6151
6152 : check for void type
6153 echo " "
6154 echo "Checking to see how well your C compiler groks the void type..." >&4
6155 case "$voidflags" in
6156 '')
6157         $cat >try.c <<EOCP
6158 #$i_stdlib I_STDLIB
6159 #ifdef I_STDLIB
6160 #include <stdlib.h>
6161 #endif
6162 #if TRY & 1
6163 void sub() {
6164 #else
6165 sub() {
6166 #endif
6167         extern void moo();      /* function returning void */
6168         void (*goo)();          /* ptr to func returning void */
6169 #if TRY & 8
6170         void *hue;              /* generic ptr */
6171 #endif
6172 #if TRY & 2
6173         void (*foo[10])();
6174 #endif
6175
6176 #if TRY & 4
6177         if(goo == moo) {
6178                 exit(0);
6179         }
6180 #endif
6181         exit(0);
6182 }
6183 int main() { sub(); }
6184 EOCP
6185         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6186                 voidflags=$defvoidused
6187         echo "Good.  It appears to support void to the level $package wants.">&4
6188                 if $contains warning .out >/dev/null 2>&1; then
6189                         echo "However, you might get some warnings that look like this:"
6190                         $cat .out
6191                 fi
6192         else
6193 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6194                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6195                         echo "It supports 1..."
6196                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6197                                 echo "It also supports 2..."
6198                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6199                                         voidflags=7
6200                                         echo "And it supports 4 but not 8 definitely."
6201                                 else
6202                                         echo "It doesn't support 4..."
6203                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6204                                                 voidflags=11
6205                                                 echo "But it supports 8."
6206                                         else
6207                                                 voidflags=3
6208                                                 echo "Neither does it support 8."
6209                                         fi
6210                                 fi
6211                         else
6212                                 echo "It does not support 2..."
6213                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6214                                         voidflags=13
6215                                         echo "But it supports 4 and 8."
6216                                 else
6217                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6218                                                 voidflags=5
6219                                                 echo "And it supports 4 but has not heard about 8."
6220                                         else
6221                                                 echo "However it supports 8 but not 4."
6222                                         fi
6223                                 fi
6224                         fi
6225                 else
6226                         echo "There is no support at all for void."
6227                         voidflags=0
6228                 fi
6229         fi
6230 esac
6231 case "$voidflags" in
6232 "$defvoidused") ;;
6233 *)      $cat >&4 <<'EOM'
6234   Support flag bits are:
6235     1: basic void declarations.
6236     2: arrays of pointers to functions returning void.
6237     4: operations between pointers to and addresses of void functions.
6238     8: generic void pointers.
6239 EOM
6240         dflt="$voidflags";
6241         rp="Your void support flags add up to what?"
6242         . ./myread
6243         voidflags="$ans"
6244         ;;
6245 esac
6246 $rm -f try.* .out
6247
6248 : check for length of pointer
6249 echo " "
6250 case "$ptrsize" in
6251 '')
6252         echo "Checking to see how big your pointers are..." >&4
6253         if test "$voidflags" -gt 7; then
6254                 echo '#define VOID_PTR char *' > try.c
6255         else
6256                 echo '#define VOID_PTR void *' > try.c
6257         fi
6258         $cat >>try.c <<EOCP
6259 #include <stdio.h>
6260 #$i_stdlib I_STDLIB
6261 #ifdef I_STDLIB
6262 #include <stdlib.h>
6263 #endif
6264 int main()
6265 {
6266     printf("%d\n", (int)sizeof(VOID_PTR));
6267     exit(0);
6268 }
6269 EOCP
6270         set try
6271         if eval $compile_ok; then
6272                 ptrsize=`$run ./try`
6273                 echo "Your pointers are $ptrsize bytes long."
6274         else
6275                 dflt='4'
6276                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6277                 rp="What is the size of a pointer (in bytes)?"
6278                 . ./myread
6279                 ptrsize="$ans"
6280         fi
6281         ;;
6282 esac
6283 $rm -f try.c try
6284 case "$use64bitall" in
6285 "$define"|true|[yY]*)
6286         case "$ptrsize" in
6287         4)      cat <<EOM >&4
6288
6289 *** You have chosen a maximally 64-bit build,
6290 *** but your pointers are only 4 bytes wide.
6291 *** Please rerun Configure without -Duse64bitall.
6292 EOM
6293                 case "$d_quad" in
6294                 define)
6295                         cat <<EOM >&4
6296 *** Since you have quads, you could possibly try with -Duse64bitint.
6297 EOM
6298                         ;;
6299                 esac
6300                 cat <<EOM >&4
6301 *** Cannot continue, aborting.
6302
6303 EOM
6304
6305                 exit 1
6306                 ;;
6307         esac
6308         ;;
6309 esac
6310
6311
6312 : determine whether to use malloc wrapping
6313 echo " "
6314 case "$usemallocwrap" in
6315 [yY]*|true|$define)     dflt='y' ;;
6316 [nN]*|false|$undef)     dflt='n' ;;
6317 *)      case "$usedevel" in
6318         [yY]*|true|$define)     dflt='y' ;;
6319         *) dflt='n' ;;
6320         esac
6321         ;;
6322 esac
6323 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6324 . ./myread
6325 usemallocwrap="$ans"
6326 case "$ans" in
6327 y*|true)
6328         usemallocwrap="$define" ;;
6329 *)
6330         usemallocwrap="$undef" ;;
6331 esac
6332
6333 : determine which malloc to compile in
6334 echo " "
6335 case "$usemymalloc" in
6336 [yY]*|true|$define)     dflt='y' ;;
6337 [nN]*|false|$undef)     dflt='n' ;;
6338 *)      case "$ptrsize" in
6339         4) dflt='y' ;;
6340         *) dflt='n' ;;
6341         esac
6342         ;;
6343 esac
6344 rp="Do you wish to attempt to use the malloc that comes with $package?"
6345 . ./myread
6346 usemymalloc="$ans"
6347 case "$ans" in
6348 y*|true)
6349         usemymalloc='y'
6350         mallocsrc='malloc.c'
6351         mallocobj="malloc$_o"
6352         d_mymalloc="$define"
6353         case "$libs" in
6354         *-lmalloc*)
6355                 : Remove malloc from list of libraries to use
6356                 echo "Removing unneeded -lmalloc from library list" >&4
6357                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6358                 shift
6359                 libs="$*"
6360                 echo "libs = $libs" >&4
6361                 ;;
6362         esac
6363         ;;
6364 *)
6365         usemymalloc='n'
6366         mallocsrc=''
6367         mallocobj=''
6368         d_mymalloc="$undef"
6369         ;;
6370 esac
6371
6372 : compute the return types of malloc and free
6373 echo " "
6374 $cat >malloc.c <<END
6375 #$i_malloc I_MALLOC
6376 #$i_stdlib I_STDLIB
6377 #include <stdio.h>
6378 #include <sys/types.h>
6379 #ifdef I_MALLOC
6380 #include <malloc.h>
6381 #endif
6382 #ifdef I_STDLIB
6383 #include <stdlib.h>
6384 #endif
6385 #ifdef TRY_MALLOC
6386 void *malloc();
6387 #endif
6388 #ifdef TRY_FREE
6389 void free();
6390 #endif
6391 END
6392 case "$malloctype" in
6393 '')
6394         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6395                 malloctype='void *'
6396         else
6397                 malloctype='char *'
6398         fi
6399         ;;
6400 esac
6401 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6402
6403 case "$freetype" in
6404 '')
6405         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6406                 freetype='void'
6407         else
6408                 freetype='int'
6409         fi
6410         ;;
6411 esac
6412 echo "Your system uses $freetype free(), it would seem." >&4
6413 $rm -f malloc.[co]
6414 $cat <<EOM
6415
6416 After $package is installed, you may wish to install various
6417 add-on modules and utilities.  Typically, these add-ons will
6418 be installed under $prefix with the rest
6419 of this package.  However, you may wish to install such add-ons
6420 elsewhere under a different prefix.
6421
6422 If you do not wish to put everything under a single prefix, that's
6423 ok.  You will be prompted for the individual locations; this siteprefix
6424 is only used to suggest the defaults.
6425
6426 The default should be fine for most people.
6427
6428 EOM
6429 fn=d~+
6430 rp='Installation prefix to use for add-on modules and utilities?'
6431 : XXX Here might be another good place for an installstyle setting.
6432 case "$siteprefix" in
6433 '') dflt=$prefix ;;
6434 *)  dflt=$siteprefix ;;
6435 esac
6436 . ./getfile
6437 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6438 oldsiteprefix=''
6439 case "$siteprefix" in
6440 '') ;;
6441 *)      case "$ans" in
6442         "$prefix") ;;
6443         *) oldsiteprefix="$prefix";;
6444         esac
6445         ;;
6446 esac
6447 siteprefix="$ans"
6448 siteprefixexp="$ansexp"
6449
6450 : determine where site specific libraries go.
6451 : Usual default is /usr/local/lib/perl5/site_perl/$version
6452 : The default "style" setting is made in installstyle.U
6453 : XXX No longer works with Prefixit stuff.
6454 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6455 case "$sitelib" in
6456 '') case "$installstyle" in
6457         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6458         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6459         esac
6460         ;;
6461 *)      dflt="$sitelib"
6462         ;;
6463 esac
6464 $cat <<EOM
6465
6466 The installation process will create a directory for
6467 site-specific extensions and modules.  Most users find it convenient
6468 to place all site-specific files in this directory rather than in the
6469 main distribution directory.
6470
6471 EOM
6472 fn=d~+
6473 rp='Pathname for the site-specific library files?'
6474 . ./getfile
6475 sitelib="$ans"
6476 sitelibexp="$ansexp"
6477 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6478 : Change installation prefix, if necessary.
6479 if $test X"$prefix" != X"$installprefix"; then
6480         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6481 else
6482         installsitelib="$sitelibexp"
6483 fi
6484
6485 : determine where site specific architecture-dependent libraries go.
6486 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6487 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6488 : sitelib may have an optional trailing /share.
6489 case "$sitearch" in
6490 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6491         dflt="$dflt/$archname"
6492         ;;
6493 *)      dflt="$sitearch"
6494         ;;
6495 esac
6496 set sitearch sitearch none
6497 eval $prefixit
6498 $cat <<EOM
6499
6500 The installation process will also create a directory for
6501 architecture-dependent site-specific extensions and modules.
6502
6503 EOM
6504 fn=d~+
6505 rp='Pathname for the site-specific architecture-dependent library files?'
6506 . ./getfile
6507 sitearch="$ans"
6508 sitearchexp="$ansexp"
6509 : Change installation prefix, if necessary.
6510 if $test X"$prefix" != X"$installprefix"; then
6511         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6512 else
6513         installsitearch="$sitearchexp"
6514 fi
6515
6516 $cat <<EOM
6517
6518 The installation process will also create a directory for
6519 vendor-supplied add-ons.  Vendors who supply perl with their system
6520 may find it convenient to place all vendor-supplied files in this
6521 directory rather than in the main distribution directory.  This will
6522 ease upgrades between binary-compatible maintenance versions of perl.
6523
6524 Of course you may also use these directories in whatever way you see
6525 fit.  For example, you might use them to access modules shared over a
6526 company-wide network.
6527
6528 The default answer should be fine for most people.
6529 This causes further questions about vendor add-ons to be skipped
6530 and no vendor-specific directories will be configured for perl.
6531
6532 EOM
6533 rp='Do you want to configure vendor-specific add-on directories?'
6534 case "$usevendorprefix" in
6535 define|true|[yY]*) dflt=y ;;
6536 *)      : User may have set vendorprefix directly on Configure command line.
6537         case "$vendorprefix" in
6538         ''|' ') dflt=n ;;
6539         *)      dflt=y ;;
6540         esac
6541         ;;
6542 esac
6543 . ./myread
6544 case "$ans" in
6545 [yY]*)  fn=d~+
6546         rp='Installation prefix to use for vendor-supplied add-ons?'
6547         case "$vendorprefix" in
6548         '') dflt='' ;;
6549         *)  dflt=$vendorprefix ;;
6550         esac
6551         . ./getfile
6552         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6553         oldvendorprefix=''
6554         case "$vendorprefix" in
6555         '') ;;
6556         *)      case "$ans" in
6557                 "$prefix") ;;
6558                 *) oldvendorprefix="$prefix";;
6559                 esac
6560                 ;;
6561         esac
6562         usevendorprefix="$define"
6563         vendorprefix="$ans"
6564         vendorprefixexp="$ansexp"
6565         ;;
6566 *)      usevendorprefix="$undef"
6567         vendorprefix=''
6568         vendorprefixexp=''
6569         ;;
6570 esac
6571
6572 case "$vendorprefix" in
6573 '')     d_vendorlib="$undef"
6574         vendorlib=''
6575         vendorlibexp=''
6576         ;;
6577 *)      d_vendorlib="$define"
6578         : determine where vendor-supplied modules go.
6579         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6580         case "$vendorlib" in
6581         '')
6582                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6583                 case "$installstyle" in
6584                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6585                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6586                 esac
6587                 ;;
6588         *)      dflt="$vendorlib"
6589                 ;;
6590         esac
6591         fn=d~+
6592         rp='Pathname for the vendor-supplied library files?'
6593         . ./getfile
6594         vendorlib="$ans"
6595         vendorlibexp="$ansexp"
6596         ;;
6597 esac
6598 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6599 : Change installation prefix, if necessary.
6600 if $test X"$prefix" != X"$installprefix"; then
6601         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6602 else
6603         installvendorlib="$vendorlibexp"
6604 fi
6605
6606 case "$vendorprefix" in
6607 '')     d_vendorarch="$undef"
6608         vendorarch=''
6609         vendorarchexp=''
6610         ;;
6611 *)      d_vendorarch="$define"
6612         : determine where vendor-supplied architecture-dependent libraries go.
6613         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6614         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6615         : vendorlib may have an optional trailing /share.
6616         case "$vendorarch" in
6617         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6618                 dflt="$dflt/$archname"
6619                 ;;
6620         *)      dflt="$vendorarch" ;;
6621         esac
6622         fn=d~+
6623         rp='Pathname for vendor-supplied architecture-dependent files?'
6624         . ./getfile
6625         vendorarch="$ans"
6626         vendorarchexp="$ansexp"
6627         ;;
6628 esac
6629 : Change installation prefix, if necessary.
6630 if $test X"$prefix" != X"$installprefix"; then
6631         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6632 else
6633         installvendorarch="$vendorarchexp"
6634 fi
6635
6636 : Final catch-all directories to search
6637 $cat <<EOM
6638
6639 Lastly, you can have perl look in other directories for extensions and
6640 modules in addition to those already specified.
6641 These directories will be searched after 
6642         $sitearch 
6643         $sitelib 
6644 EOM
6645 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6646 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6647 echo ' '
6648 case "$otherlibdirs" in
6649 ''|' ') dflt='none' ;;
6650 *)      dflt="$otherlibdirs" ;;
6651 esac
6652 $cat <<EOM
6653 Enter a colon-separated set of extra paths to include in perl's @INC
6654 search path, or enter 'none' for no extra paths.
6655
6656 EOM
6657
6658 rp='Colon-separated list of additional directories for perl to search?'
6659 . ./myread
6660 case "$ans" in
6661 ' '|''|none)    otherlibdirs=' ' ;;     
6662 *)      otherlibdirs="$ans" ;;
6663 esac
6664 case "$otherlibdirs" in
6665 ' ') val=$undef ;;
6666 *)      val=$define ;;
6667 esac
6668 set d_perl_otherlibdirs
6669 eval $setvar
6670
6671 : Cruising for prototypes
6672 echo " "
6673 echo "Checking out function prototypes..." >&4
6674 $cat >prototype.c <<EOCP
6675 #$i_stdlib I_STDLIB
6676 #ifdef I_STDLIB
6677 #include <stdlib.h>
6678 #endif
6679 int main(int argc, char *argv[]) {
6680         exit(0);}
6681 EOCP
6682 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6683         echo "Your C compiler appears to support function prototypes."
6684         val="$define"
6685 else
6686         echo "Your C compiler doesn't seem to understand function prototypes."
6687         val="$undef"
6688 fi
6689 set prototype
6690 eval $setvar
6691 $rm -f prototype*
6692
6693 case "$prototype" in
6694 "$define") ;;
6695 *)      ansi2knr='ansi2knr'
6696         echo " "
6697         cat <<EOM >&4
6698
6699 $me:  FATAL ERROR:
6700 This version of $package can only be compiled by a compiler that 
6701 understands function prototypes.  Unfortunately, your C compiler 
6702         $cc $ccflags
6703 doesn't seem to understand them.  Sorry about that.
6704
6705 If GNU cc is available for your system, perhaps you could try that instead.  
6706
6707 Eventually, we hope to support building Perl with pre-ANSI compilers.
6708 If you would like to help in that effort, please contact <perlbug@perl.org>.
6709
6710 Aborting Configure now.
6711 EOM
6712         exit 2
6713         ;;
6714 esac
6715
6716 : determine where public executables go
6717 echo " "
6718 set dflt bin bin
6719 eval $prefixit
6720 fn=d~
6721 rp='Pathname where the public executables will reside?'
6722 . ./getfile
6723 if $test "X$ansexp" != "X$binexp"; then
6724         installbin=''
6725 fi
6726 bin="$ans"
6727 binexp="$ansexp"
6728 : Change installation prefix, if necessary.
6729 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6730 if $test X"$prefix" != X"$installprefix"; then
6731         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6732 else
6733         installbin="$binexp"
6734 fi
6735
6736 echo " "
6737 case "$extras" in
6738 '') dflt='n';;
6739 *) dflt='y';;
6740 esac
6741 cat <<EOM
6742 Perl can be built with extra modules or bundles of modules which
6743 will be fetched from the CPAN and installed alongside Perl.
6744
6745 Notice that you will need access to the CPAN; either via the Internet,
6746 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
6747 be asked later to configure the CPAN.pm module which will in turn do
6748 the installation of the rest of the extra modules or bundles.)
6749
6750 Notice also that if the modules require any external software such as
6751 libraries and headers (the libz library and the zlib.h header for the
6752 Compress::Zlib module, for example) you MUST have any such software
6753 already installed, this configuration process will NOT install such
6754 things for you.
6755
6756 If this doesn't make any sense to you, just accept the default '$dflt'.
6757 EOM
6758 rp='Install any extra modules (y or n)?'
6759 . ./myread
6760 case "$ans" in
6761 y|Y)
6762         cat <<EOM
6763
6764 Please list any extra modules or bundles to be installed from CPAN,
6765 with spaces between the names.  The names can be in any format the
6766 'install' command of CPAN.pm will understand.  (Answer 'none',
6767 without the quotes, to install no extra modules or bundles.)
6768 EOM
6769         rp='Extras?'
6770         dflt="$extras"
6771         . ./myread
6772         extras="$ans"
6773 esac
6774 case "$extras" in
6775 ''|'none')
6776         val=''
6777         $rm -f ../extras.lst
6778         ;;
6779 *)      echo "(Saving the list of extras for later...)"
6780         echo "$extras" > ../extras.lst
6781         val="'$extras'"
6782         ;;
6783 esac
6784 set extras
6785 eval $setvar
6786 echo " "
6787
6788 : determine where html pages for programs go
6789 set html1dir html1dir none
6790 eval $prefixit
6791 $cat <<EOM
6792
6793 If you wish to install html files for programs in $spackage, indicate 
6794 the appropriate directory here.  To skip installing html files,
6795 answer "none".
6796 EOM
6797 case "$html1dir" in
6798 ''|none|$undef|' ') dflt=none ;;
6799 *) dflt=$html1dir ;;
6800 esac
6801 fn=dn+~
6802 rp="Directory for the main $spackage html pages?"
6803 . ./getfile
6804 html1dir="$ans"
6805 html1direxp="$ansexp"
6806 : Use ' ' for none so value is preserved next time through Configure
6807 $test X"$html1dir" = "X" && html1dir=' '
6808 : Change installation prefix, if necessary.
6809 if $test X"$prefix" != X"$installprefix"; then
6810         installhtml1dir=`echo $html1direxp | sed "s#^$prefix#$installprefix#"`
6811 else
6812         installhtml1dir="$html1direxp"
6813 fi
6814
6815 : determine where html pages for libraries and modules go
6816 set html3dir html3dir none
6817 eval $prefixit
6818 $cat <<EOM
6819
6820 If you wish to install html files for modules associated with $spackage,
6821 indicate the appropriate directory here.  To skip installing html files,
6822 answer "none".
6823 EOM
6824 : There is no obvious default.  If they have specified html1dir, then
6825 : try to key off that, possibly changing .../html1 into .../html3.
6826 case "$html3dir" in
6827 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
6828 *) dflt=$html3dir ;;
6829 esac
6830 fn=dn+~
6831 rp="Directory for the $spackage module html pages?"
6832 . ./getfile
6833 html3dir="$ans"
6834 html3direxp="$ansexp"
6835 : Use ' ' for none so value is preserved next time through Configure
6836 $test X"$html3dir" = "X" && html3dir=' '
6837 : Change installation prefix, if necessary.
6838 if $test X"$prefix" != X"$installprefix"; then
6839         installhtml3dir=`echo $html3direxp | sed "s#^$prefix#$installprefix#"`
6840 else
6841         installhtml3dir="$html3direxp"
6842 fi
6843
6844 : Find perl5.005 or later.
6845 echo "Looking for a previously installed perl5.005 or later... "
6846 case "$perl5" in
6847 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6848                 : Check if this perl is recent and can load a simple module
6849                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6850                         perl5=$tdir/perl
6851                         break;
6852                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6853                         perl5=$tdir/perl5
6854                         break;
6855                 fi
6856         done
6857         ;;
6858 *)      perl5="$perl5"
6859         ;;
6860 esac
6861 case "$perl5" in
6862 '')     echo "None found.  That's ok.";;
6863 *)      echo "Using $perl5." ;;
6864 esac
6865
6866 : Determine list of previous versions to include in @INC
6867 $cat > getverlist <<EOPL
6868 #!$perl5 -w
6869 use File::Basename;
6870 \$api_versionstring = "$api_versionstring";
6871 \$version = "$version";
6872 \$stem = "$sitelib_stem";
6873 \$archname = "$archname";
6874 EOPL
6875         $cat >> getverlist <<'EOPL'
6876 # Can't have leading @ because metaconfig interprets it as a command!
6877 ;@inc_version_list=();
6878 # XXX Redo to do opendir/readdir? 
6879 if (-d $stem) {
6880     chdir($stem);
6881     ;@candidates = glob("5.*");
6882 }
6883 else {
6884     ;@candidates = ();
6885 }
6886
6887 # XXX ToDo:  These comparisons must be reworked when two-digit
6888 # subversions come along, so that 5.7.10 compares as greater than
6889 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6890 # widespread that we can use the built-in version vectors rather
6891 # than reinventing them here.  For 5.6.0, however, we must
6892 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6893 foreach $d (@candidates) {
6894     if ($d lt $version) {
6895         if ($d ge $api_versionstring) {
6896             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6897         }
6898         elsif ($d ge "5.005") {
6899             unshift(@inc_version_list, grep { -d } $d);
6900         }
6901     }
6902     else {
6903         # Skip newer version.  I.e. don't look in
6904         # 5.7.0 if we're installing 5.6.1.
6905     }
6906 }
6907
6908 if (@inc_version_list) {
6909     print join(' ', @inc_version_list);
6910 }
6911 else {
6912     # Blank space to preserve value for next Configure run.
6913     print " ";
6914 }
6915 EOPL
6916 chmod +x getverlist
6917 case "$inc_version_list" in
6918 '')     if test -x "$perl5$exe_ext"; then
6919                 dflt=`$perl5 getverlist`
6920         else
6921                 dflt='none'
6922         fi
6923         ;;
6924 $undef) dflt='none' ;;
6925 *)  eval dflt=\"$inc_version_list\" ;;
6926 esac
6927 case "$dflt" in
6928 ''|' ') dflt=none ;;
6929 esac
6930 case "$dflt" in
6931 5.005) dflt=none ;;
6932 esac
6933 $cat <<EOM
6934
6935 In order to ease the process of upgrading, this version of perl 
6936 can be configured to use modules built and installed with earlier 
6937 versions of perl that were installed under $prefix.  Specify here
6938 the list of earlier versions that this version of perl should check.
6939 If Configure detected no earlier versions of perl installed under
6940 $prefix, then the list will be empty.  Answer 'none' to tell perl
6941 to not search earlier versions.
6942
6943 The default should almost always be sensible, so if you're not sure,
6944 just accept the default.
6945 EOM
6946
6947 rp='List of earlier versions to include in @INC?'
6948 . ./myread
6949 case "$ans" in
6950 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6951 *) inc_version_list="$ans" ;;
6952 esac
6953 case "$inc_version_list" in
6954 ''|' ') 
6955         inc_version_list_init='0';;
6956 *)      inc_version_list_init=`echo $inc_version_list |
6957                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6958         ;;
6959 esac
6960 $rm -f getverlist
6961
6962 : determine whether to install perl also as /usr/bin/perl
6963
6964 echo " "
6965 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6966         $cat <<EOM
6967 Many scripts expect perl to be installed as /usr/bin/perl.
6968
6969 If you want to, I can install the perl you are about to compile
6970 as /usr/bin/perl (in addition to $bin/perl).
6971 EOM
6972         if test -f /usr/bin/perl; then
6973             $cat <<EOM
6974
6975 However, please note that because you already have a /usr/bin/perl,
6976 overwriting that with a new Perl would very probably cause problems.
6977 Therefore I'm assuming you don't want to do that (unless you insist).
6978
6979 EOM
6980             case "$installusrbinperl" in
6981             "$define"|[yY]*)    dflt='y';;
6982             *)                  dflt='n';;
6983             esac
6984         else
6985             $cat <<EOM
6986
6987 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
6988
6989 EOM
6990             case "$installusrbinperl" in
6991             "$undef"|[nN]*)     dflt='n';;
6992             *)                  dflt='y';;
6993             esac
6994         fi
6995         rp="Do you want to install perl as /usr/bin/perl?"
6996         . ./myread
6997         case "$ans" in
6998         [yY]*)  val="$define";;
6999         *)      val="$undef" ;;
7000         esac
7001 else
7002         val="$undef"
7003 fi
7004 set installusrbinperl
7005 eval $setvar
7006
7007 echo " "
7008 echo "Checking for GNU C Library..." >&4
7009 cat >try.c <<'EOCP'
7010 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7011    alone are insufficient to distinguish different versions, such as
7012    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7013    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7014 */
7015 #include <stdio.h>
7016 int main(void)
7017 {
7018 #ifdef __GLIBC__
7019 #   ifdef __GLIBC_MINOR__
7020 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
7021 #           include <gnu/libc-version.h>
7022             printf("%s\n",  gnu_get_libc_version());
7023 #       else
7024             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7025 #       endif
7026 #   else
7027         printf("%d\n",  __GLIBC__);
7028 #   endif
7029     return 0;
7030 #else
7031     return 1;
7032 #endif
7033 }
7034 EOCP
7035 set try
7036 if eval $compile_ok && $run ./try > glibc.ver; then
7037         val="$define"
7038         gnulibc_version=`$cat glibc.ver`
7039         echo "You are using the GNU C Library version $gnulibc_version"
7040 else
7041         val="$undef"
7042         gnulibc_version=''
7043         echo "You are not using the GNU C Library"
7044 fi
7045 $rm -f try try.* glibc.ver
7046 set d_gnulibc
7047 eval $setvar
7048
7049 : see if nm is to be used to determine whether a symbol is defined or not
7050 case "$usenm" in
7051 '')
7052         dflt=''
7053         case "$d_gnulibc" in
7054         "$define")
7055                 echo " "
7056                 echo "nm probably won't work on the GNU C Library." >&4
7057                 dflt=n
7058                 ;;
7059         esac
7060         case "$dflt" in
7061         '') 
7062                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7063                         echo " "
7064                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7065                         echo "'nm' won't be sufficient on this sytem." >&4
7066                         dflt=n
7067                 fi
7068                 ;;
7069         esac
7070         case "$dflt" in
7071         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7072                 if $test $dflt -gt 20; then
7073                         dflt=y
7074                 else
7075                         dflt=n
7076                 fi
7077                 ;;
7078         esac
7079         ;;
7080 *)
7081         case "$usenm" in
7082         true|$define) dflt=y;;
7083         *) dflt=n;;
7084         esac
7085         ;;
7086 esac
7087 $cat <<EOM
7088
7089 I can use $nm to extract the symbols from your C libraries. This
7090 is a time consuming task which may generate huge output on the disk (up
7091 to 3 megabytes) but that should make the symbols extraction faster. The
7092 alternative is to skip the 'nm' extraction part and to compile a small
7093 test program instead to determine whether each symbol is present. If
7094 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7095 this may be the best solution.
7096
7097 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7098
7099 EOM
7100 rp="Shall I use $nm to extract C symbols from the libraries?"
7101 . ./myread
7102 case "$ans" in
7103 [Nn]*) usenm=false;;
7104 *) usenm=true;;
7105 esac
7106
7107 runnm=$usenm
7108 case "$reuseval" in
7109 true) runnm=false;;
7110 esac
7111
7112 : nm options which may be necessary
7113 case "$nm_opt" in
7114 '') if $test -f /mach_boot; then
7115                 nm_opt=''       # Mach
7116         elif $test -d /usr/ccs/lib; then
7117                 nm_opt='-p'     # Solaris (and SunOS?)
7118         elif $test -f /dgux; then
7119                 nm_opt='-p'     # DG-UX
7120         elif $test -f /lib64/rld; then
7121                 nm_opt='-p'     # 64-bit Irix
7122         else
7123                 nm_opt=''
7124         fi;;
7125 esac
7126
7127 : nm options which may be necessary for shared libraries but illegal
7128 : for archive libraries.  Thank you, Linux.
7129 case "$nm_so_opt" in
7130 '')     case "$myuname" in
7131         *linux*|gnu*)
7132                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7133                         nm_so_opt='--dynamic'
7134                 fi
7135                 ;;
7136         esac
7137         ;;
7138 esac
7139
7140 case "$runnm" in
7141 true)
7142 : get list of predefined functions in a handy place
7143 echo " "
7144 case "$libc" in
7145 '') libc=unknown
7146         case "$libs" in
7147         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7148         esac
7149         ;;
7150 esac
7151 case "$libs" in
7152 '') ;;
7153 *)  for thislib in $libs; do
7154         case "$thislib" in
7155         -lc|-lc_s)
7156                 : Handle C library specially below.
7157                 ;;
7158         -l*)
7159                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7160                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7161                         :
7162                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7163                         :
7164                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7165                         :
7166                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7167                         :
7168                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7169                         :
7170                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7171                         :
7172                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7173                         :
7174                 else
7175                         try=''
7176                 fi
7177                 libnames="$libnames $try"
7178                 ;;
7179         *) libnames="$libnames $thislib" ;;
7180         esac
7181         done
7182         ;;
7183 esac
7184 xxx=normal
7185 case "$libc" in
7186 unknown)
7187         set /lib/libc.$so
7188         for xxx in $libpth; do
7189                 $test -r $1 || set $xxx/libc.$so
7190                 : The messy sed command sorts on library version numbers.
7191                 $test -r $1 || \
7192                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7193                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7194                                 h
7195                                 s/[0-9][0-9]*/0000&/g
7196                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7197                                 G
7198                                 s/\n/ /' | \
7199                          $sort | $sed -e 's/^.* //'`
7200                 eval set \$$#
7201         done
7202         $test -r $1 || set /usr/ccs/lib/libc.$so
7203         $test -r $1 || set /lib/libsys_s$_a
7204         ;;
7205 *)
7206         set blurfl
7207         ;;
7208 esac
7209 if $test -r "$1"; then
7210         echo "Your (shared) C library seems to be in $1."
7211         libc="$1"
7212 elif $test -r /lib/libc && $test -r /lib/clib; then
7213         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7214         xxx=apollo
7215         libc='/lib/clib /lib/libc'
7216         if $test -r /lib/syslib; then
7217                 echo "(Your math library is in /lib/syslib.)"
7218                 libc="$libc /lib/syslib"
7219         fi
7220 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7221         echo "Your C library seems to be in $libc, as you said before."
7222 elif $test -r $incpath/usr/lib/libc$_a; then
7223         libc=$incpath/usr/lib/libc$_a;
7224         echo "Your C library seems to be in $libc.  That's fine."
7225 elif $test -r /lib/libc$_a; then
7226         libc=/lib/libc$_a;
7227         echo "Your C library seems to be in $libc.  You're normal."
7228 else
7229         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7230                 :
7231         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7232                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7233         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7234                 :
7235         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7236                 :
7237         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7238                 :
7239         else
7240                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7241         fi
7242         if $test -r "$tans"; then
7243                 echo "Your C library seems to be in $tans, of all places."
7244                 libc=$tans
7245         else
7246                 libc='blurfl'
7247         fi
7248 fi
7249 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7250         dflt="$libc"
7251         cat <<EOM
7252
7253 If the guess above is wrong (which it might be if you're using a strange
7254 compiler, or your machine supports multiple models), you can override it here.
7255
7256 EOM
7257 else
7258         dflt=''
7259         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7260         cat >&4 <<EOM
7261 I can't seem to find your C library.  I've looked in the following places:
7262
7263 EOM
7264         $sed 's/^/      /' libpath
7265         cat <<EOM
7266
7267 None of these seems to contain your C library. I need to get its name...
7268
7269 EOM
7270 fi
7271 fn=f
7272 rp='Where is your C library?'
7273 . ./getfile
7274 libc="$ans"
7275
7276 echo " "
7277 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7278 set X `cat libnames`
7279 shift
7280 xxx=files
7281 case $# in 1) xxx=file; esac
7282 echo "Extracting names from the following $xxx for later perusal:" >&4
7283 echo " "
7284 $sed 's/^/      /' libnames >&4
7285 echo " "
7286 $echo $n "This may take a while...$c" >&4
7287
7288 for file in $*; do
7289         case $file in
7290         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7291         *) $nm $nm_opt $file 2>/dev/null;;
7292         esac
7293 done >libc.tmp
7294
7295 $echo $n ".$c"
7296 $grep fprintf libc.tmp > libc.ptf
7297 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7298 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7299 xxx='[ADTSIW]'
7300 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7301         eval $xscan;\
7302         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7303                 eval $xrun
7304 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7305         eval $xscan;\
7306         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7307                 eval $xrun
7308 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7309         eval $xscan;\
7310         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7311                 eval $xrun
7312 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7313         eval $xscan;\
7314         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7315                 eval $xrun
7316 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7317         eval $xscan;\
7318         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7319                 eval $xrun
7320 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7321         eval $xscan;\
7322         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7323                 eval $xrun
7324 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7325                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7326         eval $xscan;\
7327         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7328                 eval $xrun
7329 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7330         eval $xscan;\
7331         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7332                 eval $xrun
7333 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7334         eval $xscan;\
7335         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7336                 eval $xrun
7337 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7338         eval $xscan;\
7339         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7340                 eval $xrun
7341 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7342         eval $xscan;\
7343         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7344                 eval $xrun
7345 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7346         eval $xscan;\
7347         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7348                 eval $xrun
7349 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7350         eval $xscan;\
7351         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7352                 eval $xrun
7353 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7354         eval $xscan;\
7355         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7356                 eval $xrun
7357 else
7358         $nm -p $* 2>/dev/null >libc.tmp
7359         $grep fprintf libc.tmp > libc.ptf
7360         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7361                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7362         then
7363                 nm_opt='-p'
7364                 eval $xrun
7365         else
7366                 echo " "
7367                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7368                 com=''
7369                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7370                         for thisname in $libnames $libc; do
7371                                 $ar t $thisname >>libc.tmp
7372                         done
7373                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7374                         echo "Ok." >&4
7375                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7376                         # Repeat libc to extract forwarders to DLL entries too
7377                         for thisname in $libnames $libc; do
7378                                 $ar tv $thisname >>libc.tmp
7379                                 # Revision 50 of EMX has bug in $ar.
7380                                 # it will not extract forwarders to DLL entries
7381                                 # Use emximp which will extract exactly them.
7382                                 emximp -o tmp.imp $thisname \
7383                                     2>/dev/null && \
7384                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7385                                     < tmp.imp >>libc.tmp
7386                                 $rm tmp.imp
7387                         done
7388                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7389                         echo "Ok." >&4
7390                 else
7391                         echo "$ar didn't seem to work right." >&4
7392                         echo "Maybe this is a Cray...trying bld instead..." >&4
7393                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7394                         then
7395                                 for thisname in $libnames; do
7396                                         bld t $libnames | \
7397                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7398                                         $ar t $thisname >>libc.tmp
7399                                 done
7400                                 echo "Ok." >&4
7401                         else
7402                                 echo "That didn't work either.  Giving up." >&4
7403                                 exit 1
7404                         fi
7405                 fi
7406         fi
7407 fi
7408 nm_extract="$com"
7409 case "$PASE" in
7410 define)
7411     echo " "
7412     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7413     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7414     ;;
7415 *)  if $test -f /lib/syscalls.exp; then
7416         echo " "
7417         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7418         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7419     fi
7420     ;;
7421 esac
7422 ;;
7423 esac
7424 $rm -f libnames libpath
7425
7426 : see if dld is available
7427 set dld.h i_dld
7428 eval $inhdr
7429
7430 : is a C symbol defined?
7431 csym='tlook=$1;
7432 case "$3" in
7433 -v) tf=libc.tmp; tdc="";;
7434 -a) tf=libc.tmp; tdc="[]";;
7435 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7436 esac;
7437 tx=yes;
7438 case "$reuseval-$4" in
7439 true-) ;;
7440 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7441 esac;
7442 case "$tx" in
7443 yes)
7444         tval=false;
7445         if $test "$runnm" = true; then
7446                 if $contains $tlook $tf >/dev/null 2>&1; then
7447                         tval=true;
7448                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7449                         echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7450                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7451                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7452                         $rm -f try$_exe try.c core core.* try.core;
7453                 fi;
7454         else
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 $libs >/dev/null 2>&1 && tval=true;
7457                 $rm -f try$_exe try.c;
7458         fi;
7459         ;;
7460 *)
7461         case "$tval" in
7462         $define) tval=true;;
7463         *) tval=false;;
7464         esac;
7465         ;;
7466 esac;
7467 eval "$2=$tval"'
7468
7469 : define an is-in-libc? function
7470 inlibc='echo " "; td=$define; tu=$undef;
7471 sym=$1; var=$2; eval "was=\$$2";
7472 tx=yes;
7473 case "$reuseval$was" in
7474 true) ;;
7475 true*) tx=no;;
7476 esac;
7477 case "$tx" in
7478 yes)
7479         set $sym tres -f;
7480         eval $csym;
7481         case "$tres" in
7482         true)
7483                 echo "$sym() found." >&4;
7484                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7485         *)
7486                 echo "$sym() NOT found." >&4;
7487                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7488         esac;;
7489 *)
7490         case "$was" in
7491         $define) echo "$sym() found." >&4;;
7492         *) echo "$sym() NOT found." >&4;;
7493         esac;;
7494 esac'
7495
7496 : see if dlopen exists
7497 xxx_runnm="$runnm"
7498 runnm=false
7499 set dlopen d_dlopen
7500 eval $inlibc
7501 runnm="$xxx_runnm"
7502
7503 : determine which dynamic loading, if any, to compile in
7504 echo " "
7505 dldir="ext/DynaLoader"
7506 case "$usedl" in
7507 $define|y|true)
7508         dflt='y'
7509         usedl="$define"
7510         ;;
7511 $undef|n|false)
7512         dflt='n'
7513         usedl="$undef"
7514         ;;
7515 *) 
7516         dflt='n'
7517         case "$d_dlopen" in
7518             $define) dflt='y' ;;
7519         esac
7520         case "$i_dld" in
7521             $define) dflt='y' ;;
7522         esac
7523         : Does a dl_xxx.xs file exist for this operating system
7524         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7525         ;;
7526 esac
7527 rp="Do you wish to use dynamic loading?"
7528 . ./myread
7529 usedl="$ans"
7530 case "$ans" in
7531 y*) usedl="$define"
7532         case "$dlsrc" in
7533         '')
7534                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7535                         dflt="$dldir/dl_${osname}.xs"
7536                 elif $test "$d_dlopen" = "$define" ; then
7537                         dflt="$dldir/dl_dlopen.xs"
7538                 elif $test "$i_dld" = "$define" ; then
7539                         dflt="$dldir/dl_dld.xs"
7540                 else
7541                         dflt=''
7542                 fi
7543                 ;;
7544         *)      dflt="$dldir/$dlsrc"
7545                 ;;
7546         esac
7547     echo "The following dynamic loading files are available:"
7548         : Can not go over to $dldir because getfile has path hard-coded in.
7549         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7550         rp="Source file to use for dynamic loading"
7551         fn="fne"
7552         gfpth="$src"
7553         . ./getfile
7554         usedl="$define"
7555         : emulate basename
7556         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7557
7558         $cat << EOM
7559
7560 Some systems may require passing special flags to $cc -c to
7561 compile modules that will be used to create a shared library.
7562 To use no flags, say "none".
7563
7564 EOM
7565     case "$cccdlflags" in
7566     '') case "$gccversion" in
7567                 '') case "$osname" in
7568                         hpux)   dflt='+z' ;;
7569                         next)   dflt='none' ;;
7570                         irix*)  dflt='-KPIC' ;;
7571                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7572                         sunos)  dflt='-pic' ;;
7573                         *)      dflt='none' ;;
7574                     esac
7575                         ;;
7576                 *)  case "$osname" in
7577                         darwin) dflt='none' ;;
7578                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7579                         *)      dflt='-fpic' ;;
7580                     esac ;;
7581             esac ;;
7582         ' ') dflt='none' ;;
7583     *)  dflt="$cccdlflags" ;;
7584     esac
7585     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7586     . ./myread
7587     case "$ans" in
7588     none) cccdlflags=' ' ;;
7589     *) cccdlflags="$ans" ;;
7590     esac
7591
7592     cat << EOM
7593
7594 Some systems use ld to create libraries that can be dynamically loaded,
7595 while other systems (such as those using ELF) use $cc.
7596
7597 EOM
7598         case "$ld" in
7599         '')     $cat >try.c <<EOM
7600 /* Test for whether ELF binaries are produced */
7601 #include <fcntl.h>
7602 #$i_stdlib I_STDLIB
7603 #ifdef I_STDLIB
7604 #include <stdlib.h>
7605 #endif
7606 int main() {
7607         char b[4];
7608         int i = open("a.out",O_RDONLY);
7609         if(i == -1) 
7610                 exit(1); /* fail */
7611         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7612                 exit(0); /* succeed (yes, it's ELF) */
7613         else
7614                 exit(1); /* fail */
7615 }
7616 EOM
7617                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7618                         cat <<EOM
7619 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7620 EOM
7621                         dflt="$cc"
7622                 else
7623                         echo "I'll use ld to build dynamic libraries."
7624                         dflt='ld'
7625                 fi
7626                 rm -f try.c a.out
7627                 ;;
7628         *)      dflt="$ld"
7629                 ;;
7630         esac
7631
7632     rp="What command should be used to create dynamic libraries?"
7633     . ./myread
7634         ld="$ans"
7635
7636     cat << EOM
7637
7638 Some systems may require passing special flags to $ld to create a
7639 library that can be dynamically loaded.  If your ld flags include
7640 -L/other/path options to locate libraries outside your loader's normal
7641 search path, you may need to specify those -L options here as well.  To
7642 use no flags, say "none".
7643
7644 EOM
7645     case "$lddlflags" in
7646     '') case "$osname" in
7647                         beos) dflt='-nostart' ;;
7648                         hpux) dflt='-b';
7649                               case "$gccversion" in
7650                               '') dflt="$dflt +vnocompatwarnings" ;;
7651                               esac
7652                               ;;        
7653                         linux|irix*|gnu*)       dflt='-shared' ;;
7654                         next)  dflt='none' ;;
7655                         solaris) dflt='-G' ;;
7656                         sunos) dflt='-assert nodefinitions' ;;
7657                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7658                 *)     dflt='none' ;;
7659                         esac
7660                         ;;
7661     *) dflt="$lddlflags" ;;
7662     esac
7663
7664         : Try to guess additional flags to pick up local libraries.
7665         : Be careful not to append to a plain 'none'
7666         case "$dflt" in
7667         none) dflt='' ;;
7668         esac
7669         for thisflag in $ldflags; do
7670                 case "$thisflag" in
7671                 -L*|-R*|-Wl,-R*)
7672                         case " $dflt " in
7673                         *" $thisflag "*) ;;
7674                         *) dflt="$dflt $thisflag" ;;
7675                         esac
7676                         ;;
7677                 esac
7678         done
7679
7680         case "$dflt" in
7681         ''|' ') dflt='none' ;;
7682         esac
7683
7684     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7685     . ./myread
7686     case "$ans" in
7687     none) lddlflags=' ' ;;
7688     *) lddlflags="$ans" ;;
7689     esac
7690
7691         cat <<EOM
7692
7693 Some systems may require passing special flags to $cc to indicate that
7694 the resulting executable will use dynamic linking.  To use no flags,
7695 say "none".
7696
7697 EOM
7698     case "$ccdlflags" in
7699     '') case "$osname" in
7700             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
7701             next|sunos) dflt='none' ;;
7702             *)          dflt='none' ;;
7703             esac ;;
7704     ' ')  dflt='none' ;;
7705     *)  dflt="$ccdlflags" ;;
7706     esac
7707     rp="Any special flags to pass to $cc to use dynamic linking?"
7708     . ./myread
7709     case "$ans" in
7710     none) ccdlflags=' ' ;;
7711     *) ccdlflags="$ans" ;;
7712     esac
7713     ;;
7714 *)  usedl="$undef"
7715         ld='ld'
7716     dlsrc='dl_none.xs'
7717     lddlflags=''
7718     ccdlflags=''
7719     ;;
7720 esac
7721
7722 also=''
7723 case "$usedl" in
7724 $undef)
7725         # No dynamic loading being used, so don't bother even to prompt.
7726         useshrplib='false'
7727         ;;
7728 *)      case "$useshrplib" in
7729         '')     case "$osname" in
7730                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7731                         dflt=y
7732                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7733                         ;;
7734                 next*)
7735                         case "$osvers" in
7736                         4*)     dflt=y
7737                                 also='Building a shared libperl is needed for MAB support.'
7738                                 ;;
7739                         *)      dflt=n
7740                                 ;;
7741                         esac
7742                         ;;
7743                 *)      dflt=n
7744                         ;;
7745                 esac
7746                 ;;
7747         $define|true|[Yy]*)
7748                 dflt=y
7749                 ;;
7750         *)      dflt=n
7751                 ;;
7752         esac
7753         $cat << EOM
7754
7755 The perl executable is normally obtained by linking perlmain.c with
7756 libperl${_a}, any static extensions (usually just DynaLoader), and
7757 any other libraries needed on this system (such as -lm, etc.).  Since
7758 your system supports dynamic loading, it is probably possible to build
7759 a shared libperl.$so.  If you will have more than one executable linked
7760 to libperl.$so, this will significantly reduce the size of each
7761 executable, but it may have a noticeable affect on performance.  The
7762 default is probably sensible for your system.
7763 $also
7764
7765 EOM
7766         rp="Build a shared libperl.$so (y/n)"
7767         . ./myread
7768         case "$ans" in
7769         true|$define|[Yy]*)
7770                 useshrplib='true'  ;;
7771         *)      useshrplib='false' ;;
7772         esac
7773         ;;
7774 esac
7775
7776 case "$useshrplib" in
7777 true)
7778         case "$libperl" in
7779         '')
7780                 # Figure out a good name for libperl.so.  Since it gets stored in
7781                 # a version-specific architecture-dependent library, the version
7782                 # number isn't really that important, except for making cc/ld happy.
7783                 #
7784                 # A name such as libperl.so.3.1
7785                 majmin="libperl.$so.$patchlevel.$subversion"
7786                 # A name such as libperl.so.301
7787                 majonly=`echo $patchlevel $subversion |
7788                         $awk '{printf "%d%02d", $1, $2}'`
7789                 majonly=libperl.$so.$majonly
7790                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7791                 # rely on figuring it out from the naming of libc.
7792                 case "${osname}${osvers}" in
7793                 next4*)
7794                         dflt=libperl.5.$so
7795                         # XXX How handle the --version stuff for MAB?
7796                         ;;
7797                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
7798                         dflt=libperl.$so
7799                         ;;
7800                 cygwin*) # ld links against an importlib
7801                         dflt=libperl$lib_ext
7802                         ;;
7803                 *)      # Try to guess based on whether libc has major.minor.
7804                         case "$libc" in
7805                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7806                         *libc.$so.[0-9]*) dflt=$majonly ;;
7807                         *)      dflt=libperl.$so ;;
7808                         esac
7809                         ;;
7810                 esac
7811                 ;;
7812         *)      dflt=$libperl
7813                 ;;
7814         esac
7815         cat << EOM
7816
7817 I need to select a good name for the shared libperl.  If your system uses
7818 library names with major and minor numbers, then you might want something
7819 like $majmin.  Alternatively, if your system uses a single version
7820 number for shared libraries, then you might want to use $majonly.
7821 Or, your system might be quite happy with a simple libperl.$so.
7822
7823 Since the shared libperl will get installed into a version-specific
7824 architecture-dependent directory, the version number of the shared perl
7825 library probably isn't important, so the default should be o.k.
7826
7827 EOM
7828         rp='What name do you want to give to the shared libperl?'
7829         . ./myread
7830         libperl=$ans
7831         echo "Ok, I'll use $libperl"
7832         ;;
7833 *)
7834         libperl="libperl${_a}"
7835         ;;
7836 esac
7837
7838 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7839 case "$shrpdir" in
7840 '') ;;
7841 *)      $cat >&4 <<EOM
7842 WARNING:  Use of the shrpdir variable for the installation location of
7843 the shared $libperl is not supported.  It was never documented and
7844 will not work in this version.  Let me (perlbug@perl.org)
7845 know of any problems this may cause.
7846
7847 EOM
7848         case "$shrpdir" in
7849         "$archlibexp/CORE")
7850                 $cat >&4 <<EOM
7851 But your current setting of $shrpdir is
7852 the default anyway, so it's harmless.
7853 EOM
7854                 ;;
7855         *)
7856                 $cat >&4 <<EOM
7857 Further, your current attempted setting of $shrpdir
7858 conflicts with the value of $archlibexp/CORE
7859 that installperl will use.
7860 EOM
7861                 ;;
7862         esac
7863         ;;
7864 esac
7865
7866 # How will the perl executable find the installed shared $libperl?
7867 # Add $xxx to ccdlflags.
7868 # If we can't figure out a command-line option, use $shrpenv to
7869 # set env LD_RUN_PATH.  The main perl makefile uses this.
7870 shrpdir=$archlibexp/CORE
7871 xxx=''
7872 tmp_shrpenv=''
7873 if "$useshrplib"; then
7874     case "$osname" in 
7875         aix)
7876                 # We'll set it in Makefile.SH...
7877                 ;;
7878         solaris)
7879                 xxx="-R $shrpdir"
7880                 ;;
7881         freebsd|netbsd|openbsd|interix)
7882                 xxx="-Wl,-R$shrpdir"
7883                 ;;
7884         bsdos|linux|irix*|dec_osf|gnu*)
7885                 xxx="-Wl,-rpath,$shrpdir"
7886                 ;;
7887         next)
7888                 # next doesn't like the default...
7889                 ;;
7890         beos)
7891                 # beos doesn't like the default, either.
7892                 ;;
7893         hpux*)
7894                 # hpux doesn't like the default, either.
7895                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7896                 ;;
7897         *)
7898                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7899                 ;;
7900         esac
7901         case "$xxx" in
7902         '') ;;
7903         *)      
7904                 # Only add $xxx if it isn't already in ccdlflags.
7905                 case " $ccdlflags " in
7906                 *" $xxx "*)     ;;
7907                 *)      ccdlflags="$ccdlflags $xxx"
7908                         cat <<EOM >&4
7909
7910 Adding $xxx to the flags
7911 passed to $ld so that the perl executable will find the 
7912 installed shared $libperl.
7913
7914 EOM
7915                         ;;
7916                 esac
7917                 ;;
7918         esac
7919 fi
7920 # Fix ccdlflags in AIX for building external extensions.
7921 # (For building Perl itself bare -bE:perl.exp is needed,
7922 #  Makefile.SH takes care of this.)
7923 case "$osname" in
7924 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7925 esac
7926 # Respect a hint or command-line value.
7927 case "$shrpenv" in
7928 '') shrpenv="$tmp_shrpenv" ;;
7929 esac
7930 case "$ldlibpthname" in
7931 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7932 none)   ldlibpthname='' ;;
7933 esac
7934
7935 : determine where manual pages are on this system
7936 echo " "
7937 case "$sysman" in
7938 '') 
7939         syspath='/usr/share/man/man1 /usr/man/man1'
7940         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7941         syspath="$syspath /usr/man/u_man/man1"
7942         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7943         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7944         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7945         sysman=`./loc . /usr/man/man1 $syspath`
7946         ;;
7947 esac
7948 if $test -d "$sysman"; then
7949         echo "System manual is in $sysman." >&4
7950 else
7951         echo "Could not find manual pages in source form." >&4
7952 fi
7953
7954 : determine where manual pages go
7955 set man1dir man1dir none
7956 eval $prefixit
7957 $cat <<EOM
7958
7959 $spackage has manual pages available in source form.
7960 EOM
7961 case "$nroff" in
7962 nroff)
7963         echo "However, you don't have nroff, so they're probably useless to you."
7964         case "$man1dir" in
7965         '') man1dir="none";;
7966         esac;;
7967 esac
7968 echo "If you don't want the manual sources installed, answer 'none'."
7969 case "$man1dir" in
7970 ' ') dflt=none
7971         ;;
7972 '')
7973         lookpath="$prefixexp/share/man/man1"
7974         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
7975         lookpath="$lookpath $prefixexp/man/p_man/man1"
7976         lookpath="$lookpath $prefixexp/man/u_man/man1"
7977         lookpath="$lookpath $prefixexp/man/man.1"
7978         case "$sysman" in
7979         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7980         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7981         esac
7982         set dflt
7983         eval $prefixup
7984         ;;
7985 *)  dflt="$man1dir"
7986         ;;
7987 esac
7988 echo " "
7989 fn=dn+~
7990 rp="Where do the main $spackage manual pages (source) go?"
7991 . ./getfile
7992 if $test "X$man1direxp" != "X$ansexp"; then
7993         installman1dir=''
7994 fi
7995 man1dir="$ans"
7996 man1direxp="$ansexp"
7997 case "$man1dir" in
7998 '')     man1dir=' '
7999         installman1dir='';;
8000 esac
8001
8002 : Change installation prefix, if necessary.
8003 if $test X"$prefix" != X"$installprefix"; then
8004         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
8005 else
8006         installman1dir="$man1direxp"
8007 fi
8008
8009 : What suffix to use on installed man pages
8010
8011 case "$man1dir" in
8012 ' ')
8013         man1ext='0'
8014         ;;
8015 *)
8016         rp="What suffix should be used for the main $spackage man pages?"
8017         case "$man1ext" in
8018         '')     case "$man1dir" in
8019                 *1)  dflt=1 ;;
8020                 *1p) dflt=1p ;;
8021                 *1pm) dflt=1pm ;;
8022                 *l) dflt=l;;
8023                 *n) dflt=n;;
8024                 *o) dflt=o;;
8025                 *p) dflt=p;;
8026                 *C) dflt=C;;
8027                 *L) dflt=L;;
8028                 *L1) dflt=L1;;
8029                 *) dflt=1;;
8030                 esac
8031                 ;;
8032         *)      dflt="$man1ext";;
8033         esac
8034         . ./myread
8035         man1ext="$ans"
8036         ;;
8037 esac
8038
8039 : see if we can have long filenames
8040 echo " "
8041 first=123456789abcdef
8042 $rm -f $first
8043 if (echo hi >$first) 2>/dev/null; then
8044         if $test -f 123456789abcde; then
8045                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8046                 val="$undef"
8047         else
8048                 echo 'You can have filenames longer than 14 characters.'>&4
8049                 val="$define"
8050         fi
8051 else
8052         $cat <<'EOM'
8053 You can't have filenames longer than 14 chars.
8054 You can't even think about them!
8055 EOM
8056         val="$undef"
8057 fi 
8058 set d_flexfnam
8059 eval $setvar
8060 $rm -rf 123456789abcde*
8061
8062 : determine where library module manual pages go
8063 set man3dir man3dir none
8064 eval $prefixit
8065 $cat <<EOM
8066
8067 $spackage has manual pages for many of the library modules.
8068 EOM
8069
8070 case "$nroff" in
8071 nroff)
8072         $cat <<'EOM'
8073 However, you don't have nroff, so they're probably useless to you.
8074 EOM
8075         case "$man3dir" in
8076         '') man3dir="none";;
8077         esac;;
8078 esac
8079
8080 case "$d_flexfnam" in
8081 undef)
8082         $cat <<'EOM'
8083 However, your system can't handle the long file names like File::Basename.3. 
8084 EOM
8085         case "$man3dir" in
8086         '') man3dir="none";;
8087         esac;;
8088 esac
8089
8090 echo "If you don't want the manual sources installed, answer 'none'."
8091 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8092 case "$man3dir" in
8093 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8094         if $test -d "$privlib/man/man3"; then
8095                 cat <<EOM >&4
8096
8097 WARNING:  Previous versions of perl installed man3 pages into
8098 $privlib/man/man3.  This version will suggest a 
8099 new default of $dflt.  
8100 EOM
8101                 tdflt=$dflt
8102                 dflt='n'
8103                 rp='Do you wish to preserve the old behavior?(y/n)'
8104                 . ./myread
8105                 case "$ans" in
8106                 y*) dflt="$privlib/man/man3" ;;
8107                 *)  dflt=$tdflt ;;
8108                 esac
8109     fi
8110         ;;
8111 *)      dflt="$man3dir" ;;
8112 esac
8113 case "$dflt" in
8114 ' ') dflt=none ;;
8115 esac
8116 echo " "
8117 fn=dn+~
8118 rp="Where do the $package library man pages (source) go?"
8119 . ./getfile
8120 man3dir="$ans"
8121 man3direxp="$ansexp"
8122 case "$man3dir" in
8123 '')     man3dir=' '
8124         installman3dir='';;
8125 esac
8126
8127 : Change installation prefix, if necessary.
8128 if $test X"$prefix" != X"$installprefix"; then
8129         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8130 else
8131         installman3dir="$man3direxp"
8132 fi
8133
8134 : What suffix to use on installed man pages
8135 case "$man3dir" in
8136 ' ')
8137         man3ext='0'
8138         ;;
8139 *)
8140         rp="What suffix should be used for the $package library man pages?"
8141         case "$man3ext" in
8142         '')     case "$man3dir" in
8143                 *3)  dflt=3 ;;
8144                 *3p) dflt=3p ;;
8145                 *3pm) dflt=3pm ;;
8146                 *l) dflt=l;;
8147                 *n) dflt=n;;
8148                 *o) dflt=o;;
8149                 *p) dflt=p;;
8150                 *C) dflt=C;;
8151                 *L) dflt=L;;
8152                 *L3) dflt=L3;;
8153                 *) dflt=3;;
8154                 esac
8155                 ;;
8156         *)      dflt="$man3ext";;
8157         esac
8158         . ./myread
8159         man3ext="$ans"
8160         ;;
8161 esac
8162
8163 : see if we have to deal with yellow pages, now NIS.
8164 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8165         if $test -f /usr/etc/nibindd; then
8166                 echo " "
8167                 echo "I'm fairly confident you're on a NeXT."
8168                 echo " "
8169                 rp='Do you get the hosts file via NetInfo?'
8170                 dflt=y
8171                 case "$hostcat" in
8172                 nidump*) ;;
8173                 '') ;;
8174                 *) dflt=n;;
8175                 esac
8176                 . ./myread
8177                 case "$ans" in
8178                 y*) hostcat='nidump hosts .';;
8179                 *)      case "$hostcat" in
8180                         nidump*) hostcat='';;
8181                         esac
8182                         ;;
8183                 esac
8184         fi
8185         case "$hostcat" in
8186         nidump*) ;;
8187         *)
8188                 case "$hostcat" in
8189                 *ypcat*) dflt=y;;
8190                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8191                                 dflt=y
8192                         else
8193                                 dflt=n
8194                         fi;;
8195                 *) dflt=n;;
8196                 esac
8197                 echo " "
8198                 rp='Are you getting the hosts file via yellow pages?'
8199                 . ./myread
8200                 case "$ans" in
8201                 y*) hostcat='ypcat hosts';;
8202                 *) hostcat='cat /etc/hosts';;
8203                 esac
8204                 ;;
8205         esac
8206 fi
8207 case "$hostcat" in
8208 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8209 esac
8210 case "$groupcat" in
8211 '') test -f /etc/group && groupcat='cat /etc/group';;
8212 esac
8213 case "$passcat" in
8214 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8215 esac
8216
8217 : now get the host name
8218 echo " "
8219 echo "Figuring out host name..." >&4
8220 case "$myhostname" in
8221 '') cont=true
8222         echo 'Maybe "hostname" will work...'
8223         if tans=`sh -c hostname 2>&1` ; then
8224                 myhostname=$tans
8225                 phostname=hostname
8226                 cont=''
8227         fi
8228         ;;
8229 *) cont='';;
8230 esac
8231 if $test "$cont"; then
8232         if ./xenix; then
8233                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8234                 if tans=`cat /etc/systemid 2>&1` ; then
8235                         myhostname=$tans
8236                         phostname='cat /etc/systemid'
8237                         echo "Whadyaknow.  Xenix always was a bit strange..."
8238                         cont=''
8239                 fi
8240         elif $test -r /etc/systemid; then
8241                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8242         fi
8243 fi
8244 if $test "$cont"; then
8245         echo 'No, maybe "uuname -l" will work...'
8246         if tans=`sh -c 'uuname -l' 2>&1` ; then
8247                 myhostname=$tans
8248                 phostname='uuname -l'
8249         else
8250                 echo 'Strange.  Maybe "uname -n" will work...'
8251                 if tans=`sh -c 'uname -n' 2>&1` ; then
8252                         myhostname=$tans
8253                         phostname='uname -n'
8254                 else
8255                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8256                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8257                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8258                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8259                         else
8260                                 case "$myhostname" in
8261                                 '') echo "Does this machine have an identity crisis or something?"
8262                                         phostname='';;
8263                                 *)
8264                                         echo "Well, you said $myhostname before..."
8265                                         phostname='echo $myhostname';;
8266                                 esac
8267                         fi
8268                 fi
8269         fi
8270 fi
8271 case "$myhostname" in
8272 '') myhostname=noname ;;
8273 esac
8274 : you do not want to know about this
8275 set $myhostname
8276 myhostname=$1
8277
8278 : verify guess
8279 if $test "$myhostname" ; then
8280         dflt=y
8281         rp='Your host name appears to be "'$myhostname'".'" Right?"
8282         . ./myread
8283         case "$ans" in
8284         y*) ;;
8285         *) myhostname='';;
8286         esac
8287 fi
8288
8289 : bad guess or no guess
8290 while $test "X$myhostname" = X ; do
8291         dflt=''
8292         rp="Please type the (one word) name of your host:"
8293         . ./myread
8294         myhostname="$ans"
8295 done
8296
8297 : translate upper to lower if necessary
8298 case "$myhostname" in
8299 *[A-Z]*)
8300         echo "(Normalizing case in your host name)"
8301         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8302         ;;
8303 esac
8304
8305 case "$myhostname" in
8306 *.*)
8307         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8308         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8309         echo "(Trimming domain name from host name--host name is now $myhostname)"
8310         ;;
8311 *) case "$mydomain" in
8312         '')
8313                 {
8314                         test "X$hostcat" = "Xypcat hosts" &&
8315                         ypmatch "$myhostname" hosts 2>/dev/null |\
8316                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8317                         $test -s hosts
8318                 } || {
8319                         test "X$hostcat" != "X" &&
8320                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8321                                         /[       ]$myhostname[  . ]/p" > hosts
8322                 }
8323                 tmp_re="[       . ]"
8324                 if $test -f hosts; then
8325                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8326                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8327                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8328                                 hosts | $sort | $uniq | \
8329                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8330                         case `$echo X$dflt` in
8331                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8332                                 dflt=.
8333                                 ;;
8334                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8335                                 ;;
8336                         esac
8337                 else
8338                         echo "(I cannot locate a hosts database anywhere)"
8339                         dflt=.
8340                 fi
8341                 case "$dflt" in
8342                 .)
8343                         tans=`./loc resolv.conf X /etc /usr/etc`
8344                         if $test -f "$tans"; then
8345                                 echo "(Attempting domain name extraction from $tans)"
8346                                 dflt=.`$sed -n -e 's/   / /g' \
8347                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8348                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8349                                 case "$dflt" in
8350                                 .) dflt=.`$sed -n -e 's/        / /g' \
8351                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8352                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8353                                         ;;
8354                                 esac
8355                         fi
8356                         ;;
8357                 esac
8358                 case "$dflt" in
8359                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8360                         dflt=.`sh -c domainname 2>/dev/null`
8361                         case "$dflt" in
8362                         '') dflt='.';;
8363                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8364                         esac
8365                         ;;
8366                 esac
8367                 case "$dflt$osname" in
8368                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8369                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8370                         ;;
8371                 esac
8372                 case "$dflt" in
8373                 .) echo "(Lost all hope -- silly guess then)"
8374                         dflt='.nonet'
8375                         ;;
8376                 esac
8377                 $rm -f hosts
8378                 ;;
8379         *) dflt="$mydomain";;
8380         esac;;
8381 esac
8382 echo " "
8383 rp="What is your domain name?"
8384 . ./myread
8385 tans="$ans"
8386 case "$ans" in
8387 '') ;;
8388 .*) ;;
8389 *) tans=".$tans";;
8390 esac
8391 mydomain="$tans"
8392
8393 : translate upper to lower if necessary
8394 case "$mydomain" in
8395 *[A-Z]*)
8396         echo "(Normalizing case in your domain name)"
8397         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8398         ;;
8399 esac
8400
8401 : a little sanity check here
8402 case "$phostname" in
8403 '') ;;
8404 *)
8405         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8406         $myhostname$mydomain|$myhostname) ;;
8407         *)
8408                 case "$phostname" in
8409                 sed*)
8410                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8411                         ;;
8412                 *)
8413                         echo "(That doesn't agree with your $phostname command, by the way.)"
8414                         ;;
8415                 esac
8416         ;;
8417         esac
8418         ;;
8419 esac
8420
8421 $cat <<EOM
8422
8423 I need to get your e-mail address in Internet format if possible, i.e.
8424 something like user@host.domain. Please answer accurately since I have
8425 no easy means to double check it. The default value provided below
8426 is most probably close to reality but may not be valid from outside
8427 your organization...
8428
8429 EOM
8430 cont=x
8431 while test "$cont"; do
8432         case "$cf_email" in
8433         '') dflt="$cf_by@$myhostname$mydomain";;
8434         *) dflt="$cf_email";;
8435         esac
8436         rp='What is your e-mail address?'
8437         . ./myread
8438         cf_email="$ans"
8439         case "$cf_email" in
8440         *@*.*) cont='' ;;
8441         *)
8442                 rp='Address does not look like an Internet one.  Use it anyway?'
8443                 case "$fastread" in
8444                 yes) dflt=y ;;
8445                 *) dflt=n ;;
8446                 esac
8447                 . ./myread
8448                 case "$ans" in
8449                 y*) cont='' ;;
8450                 *) echo " " ;;
8451                 esac
8452                 ;;
8453         esac
8454 done
8455
8456 $cat <<EOM
8457
8458 If you or somebody else will be maintaining perl at your site, please
8459 fill in the correct e-mail address here so that they may be contacted
8460 if necessary. Currently, the "perlbug" program included with perl
8461 will send mail to this address in addition to perlbug@perl.org. You may
8462 enter "none" for no administrator.
8463
8464 EOM
8465 case "$perladmin" in
8466 '') dflt="$cf_email";;
8467 *) dflt="$perladmin";;
8468 esac
8469 rp='Perl administrator e-mail address'
8470 . ./myread
8471 perladmin="$ans"
8472
8473 : determine whether to only install version-specific parts.
8474 echo " "
8475 $cat <<EOM
8476 Do you want to install only the version-specific parts of the perl
8477 distribution?  Usually you do *not* want to do this.
8478 EOM
8479 case "$versiononly" in
8480 "$define"|[Yy]*|true) dflt='y' ;;
8481 *) dflt='n';
8482 esac
8483 rp="Do you want to install only the version-specific parts of perl?"
8484 . ./myread
8485 case "$ans" in
8486 [yY]*)  val="$define";;
8487 *)      val="$undef" ;;
8488 esac
8489 set versiononly
8490 eval $setvar
8491
8492 case "$versiononly" in
8493 "$define") inc_version_list=''
8494            inc_version_list_init=0
8495            ;;
8496 esac
8497
8498 : figure out how to guarantee perl startup
8499 case "$startperl" in
8500 '')
8501         case "$sharpbang" in
8502         *!)
8503                 $cat <<EOH
8504
8505 I can use the #! construct to start perl on your system. This will
8506 make startup of perl scripts faster, but may cause problems if you
8507 want to share those scripts and perl is not in a standard place
8508 ($binexp/perl) on all your platforms. The alternative is to force
8509 a shell by starting the script with a single ':' character.
8510
8511 EOH
8512                 case "$versiononly" in
8513                 "$define")      dflt="$binexp/perl$version";;  
8514                 *)              dflt="$binexp/perl";;
8515                 esac
8516                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8517                 . ./myread
8518                 case "$ans" in
8519                 none)   startperl=": # use perl";;
8520                 *)      startperl="#!$ans"
8521                         if $test 30 -lt `echo "$ans" | wc -c`; then
8522                                 $cat >&4 <<EOM
8523
8524 WARNING:  Some systems limit the #! command to 32 characters.
8525 If you experience difficulty running Perl scripts with #!, try
8526 installing Perl in a directory with a shorter pathname.
8527
8528 EOM
8529                         fi ;;
8530                 esac
8531                 ;;
8532         *) startperl=": # use perl"
8533                 ;;
8534         esac
8535         ;;
8536 esac
8537 echo "I'll use $startperl to start perl scripts."
8538
8539 : figure best path for perl in scripts
8540 case "$perlpath" in
8541 '')
8542         case "$versiononly" in
8543         "$define")      perlpath="$binexp/perl$version";;
8544         *)              perlpath="$binexp/perl";;
8545         esac
8546         case "$startperl" in
8547         *!*) ;;
8548         *)
8549                 $cat <<EOH
8550
8551 I will use the "eval 'exec'" idiom to start Perl on your system.
8552 I can use the full path of your Perl binary for this purpose, but
8553 doing so may cause problems if you want to share those scripts and
8554 Perl is not always in a standard place ($binexp/perl).
8555
8556 EOH
8557                 dflt="$binexp/perl"
8558                 rp="What path shall I use in \"eval 'exec'\"?"
8559                 . ./myread
8560                 perlpath="$ans"
8561                 ;;
8562         esac
8563         ;;
8564 esac
8565 case "$startperl" in
8566 *!*)    ;;
8567 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8568 esac
8569
8570 : determine where public executable scripts go
8571 set scriptdir scriptdir
8572 eval $prefixit
8573 case "$scriptdir" in
8574 '')
8575         dflt="$bin"
8576         : guess some guesses
8577         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8578         $test -d /usr/share/bin     && dflt=/usr/share/bin
8579         $test -d /usr/local/script  && dflt=/usr/local/script
8580         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8581         $test -d $prefixexp/script  && dflt=$prefixexp/script
8582         set dflt
8583         eval $prefixup
8584         ;;
8585 *)  dflt="$scriptdir"
8586         ;;
8587 esac
8588 $cat <<EOM
8589  
8590 Some installations have a separate directory just for executable scripts so
8591 that they can mount it across multiple architectures but keep the scripts in
8592 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8593 Or you might just lump your scripts in with all your other executables.
8594  
8595 EOM
8596 fn=d~
8597 rp='Where do you keep publicly executable scripts?'
8598 . ./getfile
8599 if $test "X$ansexp" != "X$scriptdirexp"; then
8600         installscript=''
8601 fi
8602 scriptdir="$ans"
8603 scriptdirexp="$ansexp"
8604 : Change installation prefix, if necessary.
8605 if $test X"$prefix" != X"$installprefix"; then
8606         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8607 else
8608         installscript="$scriptdirexp"
8609 fi
8610
8611 : determine where add-on public executables go
8612 case "$sitebin" in
8613 '')     dflt=$siteprefix/bin ;;
8614 *)      dflt=$sitebin ;;
8615 esac
8616 fn=d~
8617 rp='Pathname where the add-on public executables should be installed?'
8618 . ./getfile
8619 sitebin="$ans"
8620 sitebinexp="$ansexp"
8621 : Change installation prefix, if necessary.
8622 if $test X"$prefix" != X"$installprefix"; then
8623         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8624 else
8625         installsitebin="$sitebinexp"
8626 fi
8627
8628 : determine where add-on html pages go
8629 : There is no standard location, so try to copy the previously-selected
8630 : directory structure for the core html pages.
8631 case "$sitehtml1dir" in
8632 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8633 *)     dflt=$sitehtml1dir ;;
8634 esac
8635 case "$dflt" in
8636 ''|' ') dflt=none ;;
8637 esac
8638 fn=dn+~
8639 rp='Pathname where the site-specific html pages should be installed?'
8640 . ./getfile
8641 sitehtml1dir="$ans"
8642 sitehtml1direxp="$ansexp"
8643 : Change installation prefix, if necessary.
8644 if $test X"$prefix" != X"$installprefix"; then
8645         installsitehtml1dir=`echo $sitehtml1direxp | $sed "s#^$prefix#$installprefix#"`
8646 else
8647         installsitehtml1dir="$sitehtml1direxp"
8648 fi
8649
8650 : determine where add-on library html pages go
8651 : There is no standard location, so try to copy the previously-selected
8652 : directory structure for the core html pages.
8653 case "$sitehtml3dir" in
8654 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8655 *)     dflt=$sitehtml3dir ;;
8656 esac
8657 case "$dflt" in
8658 ''|' ') dflt=none ;;
8659 esac
8660 fn=dn+~
8661 rp='Pathname where the site-specific library html pages should be installed?'
8662 . ./getfile
8663 sitehtml3dir="$ans"
8664 sitehtml3direxp="$ansexp"
8665 : Change installation prefix, if necessary.
8666 if $test X"$prefix" != X"$installprefix"; then
8667         installsitehtml3dir=`echo $sitehtml3direxp | $sed "s#^$prefix#$installprefix#"`
8668 else
8669         installsitehtml3dir="$sitehtml3direxp"
8670 fi
8671
8672 : determine where add-on manual pages go
8673 case "$siteman1dir" in
8674 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8675 *)      dflt=$siteman1dir ;;
8676 esac
8677 case "$dflt" in
8678 ''|' ') dflt=none ;;
8679 esac
8680 fn=dn+~
8681 rp='Pathname where the site-specific manual pages should be installed?'
8682 . ./getfile
8683 siteman1dir="$ans"
8684 siteman1direxp="$ansexp"
8685 : Change installation prefix, if necessary.
8686 if $test X"$prefix" != X"$installprefix"; then
8687         installsiteman1dir=`echo $siteman1direxp | $sed "s#^$prefix#$installprefix#"`
8688 else
8689         installsiteman1dir="$siteman1direxp"
8690 fi
8691
8692 : determine where add-on library man pages go
8693 case "$siteman3dir" in
8694 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8695 *)      dflt=$siteman3dir ;;
8696 esac
8697 case "$dflt" in
8698 ''|' ') dflt=none ;;
8699 esac
8700 fn=dn+~
8701 rp='Pathname where the site-specific library manual pages should be installed?'
8702 . ./getfile
8703 siteman3dir="$ans"
8704 siteman3direxp="$ansexp"
8705 : Change installation prefix, if necessary.
8706 if $test X"$prefix" != X"$installprefix"; then
8707         installsiteman3dir=`echo $siteman3direxp | $sed "s#^$prefix#$installprefix#"`
8708 else
8709         installsiteman3dir="$siteman3direxp"
8710 fi
8711
8712 : determine where add-on public executable scripts go
8713 case "$sitescript" in
8714 '')     dflt=$siteprefix/script
8715         $test -d $dflt || dflt=$sitebin ;;
8716 *)  dflt="$sitescript" ;;
8717 esac
8718 fn=d~+
8719 rp='Pathname where add-on public executable scripts should be installed?'
8720 . ./getfile
8721 sitescript="$ans"
8722 sitescriptexp="$ansexp"
8723 : Change installation prefix, if necessary.
8724 if $test X"$prefix" != X"$installprefix"; then
8725         installsitescript=`echo $sitescriptexp | sed "s#^$prefix#$installprefix#"`
8726 else
8727         installsitescript="$sitescriptexp"
8728 fi
8729
8730 case "$usefaststdio" in
8731 $define|true|[yY]*|'')
8732         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8733         case "$xversion" in
8734         [68])   dflt='y' ;;
8735         *)      dflt='n' ;;
8736         esac
8737         ;;
8738 *) dflt='n';;
8739 esac
8740 cat <<EOM
8741
8742 Perl can be built to use 'fast stdio', which means using the stdio
8743 library but also directly manipulating the stdio buffers to enable
8744 faster I/O.  Using stdio is better for backward compatibility (especially
8745 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8746 interface has been preferred instead of stdio.
8747
8748 If this doesn't make any sense to you, just accept the default '$dflt'.
8749 EOM
8750 rp='Use the "fast stdio" if available?'
8751 . ./myread
8752 case "$ans" in
8753 y|Y)    val="$define" ;;     
8754 *)      val="$undef" ;;
8755 esac
8756 set usefaststdio
8757 eval $setvar
8758
8759
8760 : define an is-a-typedef? function
8761 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8762 case "$inclist" in
8763 "") inclist="sys/types.h";;
8764 esac;
8765 eval "varval=\$$var";
8766 case "$varval" in
8767 "")
8768         $rm -f temp.c;
8769         for inc in $inclist; do
8770                 echo "#include <$inc>" >>temp.c;
8771         done;
8772         echo "#ifdef $type" >> temp.c;
8773         echo "printf(\"We have $type\");" >> temp.c;
8774         echo "#endif" >> temp.c;
8775         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8776         if $contains $type temp.E >/dev/null 2>&1; then
8777                 eval "$var=\$type";
8778         else
8779                 eval "$var=\$def";
8780         fi;
8781         $rm -f temp.?;;
8782 *) eval "$var=\$varval";;
8783 esac'
8784
8785 : define an is-a-typedef? function that prompts if the type is not available.
8786 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8787 case "$inclist" in
8788 "") inclist="sys/types.h";;
8789 esac;
8790 eval "varval=\$$var";
8791 case "$varval" in
8792 "")
8793         $rm -f temp.c;
8794         for inc in $inclist; do
8795                 echo "#include <$inc>" >>temp.c;
8796         done;
8797         echo "#ifdef $type" >> temp.c;
8798         echo "printf(\"We have $type\");" >> temp.c;
8799         echo "#endif" >> temp.c;
8800         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8801         echo " " ;
8802         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8803         if $contains $type temp.E >/dev/null 2>&1; then
8804                 echo "$type found." >&4;
8805                 eval "$var=\$type";
8806         else
8807                 echo "$type NOT found." >&4;
8808                 dflt="$def";
8809                 . ./myread ;
8810                 eval "$var=\$ans";
8811         fi;
8812         $rm -f temp.?;;
8813 *) eval "$var=\$varval";;
8814 esac'
8815
8816 : see what type lseek is declared as in the kernel
8817 rp="What is the type used for lseek's offset on this system?"
8818 set off_t lseektype long stdio.h sys/types.h
8819 eval $typedef_ask
8820
8821 echo " "
8822 echo "Checking to see how big your file offsets are..." >&4
8823 $cat >try.c <<EOCP
8824 #include <sys/types.h>
8825 #include <stdio.h>
8826 int main()
8827 {
8828     printf("%d\n", (int)sizeof($lseektype));
8829     return(0); 
8830 }
8831 EOCP
8832 set try
8833 if eval $compile_ok; then
8834         lseeksize=`$run ./try`
8835         echo "Your file offsets are $lseeksize bytes long."
8836 else
8837         dflt=$longsize
8838         echo " "
8839         echo "(I can't seem to compile the test program.  Guessing...)"
8840         rp="What is the size of your file offsets (in bytes)?"
8841         . ./myread
8842         lseeksize="$ans"
8843 fi
8844 $rm -f try.c try
8845
8846 : see what type file positions are declared as in the library
8847 rp="What is the type for file position used by fsetpos()?"
8848 set fpos_t fpostype long stdio.h sys/types.h
8849 eval $typedef_ask
8850
8851 echo " "
8852 case "$fpostype" in
8853 *_t) zzz="$fpostype"    ;;
8854 *)   zzz="fpos_t"       ;;
8855 esac
8856 echo "Checking the size of $zzz..." >&4 
8857 cat > try.c <<EOCP
8858 #include <sys/types.h>
8859 #include <stdio.h>
8860 #$i_stdlib I_STDLIB
8861 #ifdef I_STDLIB
8862 #include <stdlib.h>
8863 #endif
8864 int main() {
8865     printf("%d\n", (int)sizeof($fpostype));
8866     exit(0);
8867 }
8868 EOCP
8869 set try
8870 if eval $compile_ok; then
8871         yyy=`$run ./try`
8872         case "$yyy" in
8873         '')     fpossize=4
8874                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8875                 ;;
8876         *)      fpossize=$yyy
8877                 echo "Your $zzz is $fpossize bytes long."
8878                 ;;
8879         esac
8880 else
8881         dflt="$longsize"
8882         echo " " >&4
8883         echo "(I can't compile the test program.  Guessing...)" >&4
8884         rp="What is the size of your file positions (in bytes)?"
8885         . ./myread
8886         fpossize="$ans"
8887 fi
8888
8889 # Backward compatibility (uselfs is deprecated).
8890 case "$uselfs" in
8891 "$define"|true|[yY]*)
8892         cat <<EOM >&4
8893
8894 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8895 EOM
8896         uselargefiles="$define"
8897         ;;
8898 esac                          
8899
8900 case "$lseeksize:$fpossize" in
8901 8:8) cat <<EOM
8902
8903 You can have files larger than 2 gigabytes.
8904 EOM
8905    val="$define" ;;
8906 *)    case "$uselargefiles" in
8907    "$undef"|false|[nN]*) dflt='n' ;;
8908    *)   dflt='y' ;;
8909    esac
8910    cat <<EOM
8911
8912 Perl can be built to understand large files (files larger than 2 gigabytes)
8913 on some systems.  To do so, Configure can be run with -Duselargefiles.
8914
8915 If this doesn't make any sense to you, just accept the default '$dflt'.
8916 EOM
8917    rp='Try to understand large files, if available?'
8918    . ./myread
8919    case "$ans" in
8920    y|Y)         val="$define" ;;
8921    *)           val="$undef"  ;;
8922    esac
8923    ;;
8924 esac
8925 set uselargefiles
8926 eval $setvar
8927 : Look for a hint-file generated 'call-back-unit'.  If the
8928 : user has specified that a large files perl is to be built,
8929 : we may need to set or change some other defaults.
8930 if $test -f uselargefiles.cbu; then
8931         echo "Your platform has some specific hints regarding large file builds, using them..."
8932         . ./uselargefiles.cbu
8933 fi
8934 case "$uselargefiles" in
8935 "$define")
8936         if $test -f uselargefiles.cbu; then
8937                 echo " "
8938                 echo "Rechecking to see how big your file offsets are..." >&4
8939                 $cat >try.c <<EOCP
8940 #include <sys/types.h>
8941 #include <stdio.h>
8942 int main()
8943 {
8944     printf("%d\n", (int)sizeof($lseektype));
8945     return(0); 
8946 }
8947 EOCP
8948                 set try
8949                 if eval $compile_ok; then
8950                         lseeksize=`$run ./try`
8951                         $echo "Your file offsets are now $lseeksize bytes long."
8952                 else
8953                         dflt="$lseeksize"
8954                         echo " "
8955                         echo "(I can't seem to compile the test program.  Guessing...)"
8956                         rp="What is the size of your file offsets (in bytes)?"
8957                         . ./myread
8958                         lseeksize="$ans"
8959                 fi
8960                 case "$fpostype" in
8961                 *_t) zzz="$fpostype"    ;;
8962                 *)   zzz="fpos_t"       ;;
8963                 esac
8964                 $echo $n "Rechecking the size of $zzz...$c" >&4 
8965                 $cat > try.c <<EOCP
8966 #include <sys/types.h>
8967 #include <stdio.h>
8968 #$i_stdlib I_STDLIB
8969 #ifdef I_STDLIB
8970 #include <stdlib.h>
8971 #endif
8972 int main() {
8973     printf("%d\n", (int)sizeof($fpostype));
8974     return(0);
8975 }
8976 EOCP
8977                 set try
8978                 if eval $compile_ok; then
8979                         yyy=`$run ./try`
8980                         dflt="$lseeksize"
8981                         case "$yyy" in
8982                         '')     echo " "
8983                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8984                                 ;;
8985                         *)      fpossize=$yyy
8986                                 echo " $fpossize bytes." >&4
8987                                 ;;
8988                         esac
8989                 else
8990                         dflt="$fpossize"
8991                         echo " "
8992                         echo "(I can't compile the test program.  Guessing...)" >&4
8993                         rp="What is the size of your file positions (in bytes)?"
8994                         . ./myread
8995                         fpossize="$ans"
8996                 fi
8997                 $rm -f try.c try
8998         fi
8999         ;;
9000 esac
9001
9002 # probably will refer to
9003 #   $archlib $privlib $sitearch $sitelib $vendorarch $vendorlib
9004 need_relocation=0
9005 userelocatableinc=undef
9006
9007 case "$vendorprefix" in
9008 '')     d_vendorbin="$undef"
9009         vendorbin=''
9010         vendorbinexp=''
9011         ;;
9012 *)      d_vendorbin="$define"
9013         : determine where vendor-supplied executables go.
9014         case "$vendorbin" in
9015         '') dflt=$vendorprefix/bin ;;
9016         *)      dflt="$vendorbin" ;;
9017         esac
9018         fn=d~+
9019         rp='Pathname for the vendor-supplied executables directory?'
9020         . ./getfile
9021         vendorbin="$ans"
9022         vendorbinexp="$ansexp"
9023         ;;
9024 esac
9025 : Change installation prefix, if necessary.
9026 if $test X"$prefix" != X"$installprefix"; then
9027         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
9028 else
9029         installvendorbin="$vendorbinexp"
9030 fi
9031
9032 case "$vendorprefix" in
9033 '')     vendorhtml1dir=''
9034         vendorhtml1direxp=''
9035         ;;
9036 *)      : determine where vendor-supplied html pages go.
9037         : There is no standard location, so try to copy the previously-selected
9038         : directory structure for the core html pages.
9039         : XXX Better default suggestions would be welcome.
9040         case "$vendorhtml1dir" in
9041         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9042         *)      dflt=$vendorhtml1dir ;;
9043         esac
9044         case "$dflt" in
9045         ''|' ') dflt=none ;;
9046         esac
9047         fn=dn+~
9048         rp='Pathname for the vendor-supplied html pages?'
9049         . ./getfile
9050         vendorhtml1dir="$ans"
9051         vendorhtml1direxp="$ansexp"
9052         ;;
9053 esac
9054 : Use ' ' for none so value is preserved next time through Configure
9055 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9056 : Change installation prefix, if necessary.
9057 if $test X"$prefix" != X"$installprefix"; then
9058         installvendorhtml1dir=`echo $vendorhtml1direxp | $sed "s#^$prefix#$installprefix#"`
9059 else
9060         installvendorhtml1dir="$vendorhtml1direxp"
9061 fi
9062
9063 case "$vendorprefix" in
9064 '')     vendorhtml3dir=''
9065         vendorhtml3direxp=''
9066         ;;
9067 *)      : determine where vendor-supplied module html pages go.
9068         : There is no standard location, so try to copy the previously-selected
9069         : directory structure for the core html pages.
9070         : XXX Better default suggestions would be welcome.
9071         case "$vendorhtml3dir" in
9072         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9073         *)      dflt=$vendorhtml3dir ;;
9074         esac
9075         case "$dflt" in
9076         ''|' ') dflt=none ;;
9077         esac
9078         fn=dn+~
9079         rp='Pathname for the vendor-supplied html pages?'
9080         . ./getfile
9081         vendorhtml3dir="$ans"
9082         vendorhtml3direxp="$ansexp"
9083         ;;
9084 esac
9085 : Use ' ' for none so value is preserved next time through Configure
9086 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9087 : Change installation prefix, if necessary.
9088 if $test X"$prefix" != X"$installprefix"; then
9089         installvendorhtml3dir=`echo $vendorhtml3direxp | $sed "s#^$prefix#$installprefix#"`
9090 else
9091         installvendorhtml3dir="$vendorhtml3direxp"
9092 fi
9093
9094 case "$vendorprefix" in
9095 '')     vendorman1dir=''
9096         vendorman1direxp=''
9097         ;;
9098 *)      : determine where vendor-supplied manual pages go.
9099         case "$vendorman1dir" in
9100         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9101         *)      dflt=$vendorman1dir ;;
9102         esac
9103         case "$dflt" in
9104         ''|' ') dflt=none ;;
9105         esac
9106         fn=nd~+
9107         rp='Pathname for the vendor-supplied manual section 1 pages?'
9108         . ./getfile
9109         vendorman1dir="$ans"
9110         vendorman1direxp="$ansexp"
9111         ;;
9112 esac
9113 : Use ' ' for none so value is preserved next time through Configure
9114 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9115 : Change installation prefix, if necessary.
9116 if $test X"$prefix" != X"$installprefix"; then
9117         installvendorman1dir=`echo "$vendorman1direxp" | $sed "s#^$prefix#$installprefix#"`
9118 else
9119         installvendorman1dir="$vendorman1direxp"
9120 fi
9121
9122 case "$vendorprefix" in
9123 '')     vendorman3dir=''
9124         vendorman3direxp=''
9125         ;;
9126 *)      : determine where vendor-supplied module manual pages go.
9127         case "$vendorman3dir" in
9128         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9129         *)      dflt=$vendorman3dir ;;
9130         esac
9131         case "$dflt" in
9132         ''|' ') dflt=none ;;
9133         esac
9134         fn=nd~+
9135         rp='Pathname for the vendor-supplied manual section 3 pages?'
9136         . ./getfile
9137         vendorman3dir="$ans"
9138         vendorman3direxp="$ansexp"
9139         ;;
9140 esac
9141 : Use ' ' for none so value is preserved next time through Configure
9142 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9143 : Change installation prefix, if necessary.
9144 if $test X"$prefix" != X"$installprefix"; then
9145         installvendorman3dir=`echo "$vendorman3direxp" | $sed "s#^$prefix#$installprefix#"`
9146 else
9147         installvendorman3dir="$vendorman3direxp"
9148 fi
9149
9150 case "$vendorprefix" in
9151 '')     d_vendorscript="$undef"
9152         vendorscript=''
9153         vendorscriptexp=''
9154         ;;
9155 *)      d_vendorscript="$define"
9156         : determine where vendor-supplied scripts go.
9157         case "$vendorscript" in
9158         '')     dflt=$vendorprefix/script
9159                 $test -d $dflt || dflt=$vendorbin ;;
9160         *)  dflt="$vendorscript" ;;
9161         esac
9162         $cat <<EOM
9163
9164 The installation process will create a directory for 
9165 vendor-supplied scripts.
9166
9167 EOM
9168         fn=d~+
9169         rp='Pathname for the vendor-supplied scripts directory?'
9170         . ./getfile
9171         vendorscript="$ans"
9172         vendorscriptexp="$ansexp"
9173         ;;
9174 esac
9175 : Change installation prefix, if necessary.
9176 if $test X"$prefix" != X"$installprefix"; then
9177         installvendorscript=`echo $vendorscriptexp | $sed "s#^$prefix#$installprefix#"`
9178 else
9179         installvendorscript="$vendorscriptexp"
9180 fi
9181
9182 : see if qgcvt exists
9183 set qgcvt d_qgcvt
9184 eval $inlibc
9185
9186 echo " "
9187
9188 if $test X"$d_longdbl" = X"$define"; then
9189
9190 echo "Checking how to print long doubles..." >&4
9191
9192 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9193         $cat >try.c <<'EOCP'
9194 #include <sys/types.h>
9195 #include <stdio.h>
9196 int main() {
9197   double d = 123.456;
9198   printf("%.3f\n", d);
9199 }
9200 EOCP
9201         set try
9202         if eval $compile; then
9203                 yyy=`$run ./try`
9204                 case "$yyy" in
9205                 123.456)
9206                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9207                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9208                         echo "We will use %f."
9209                         ;;
9210                 esac
9211         fi
9212 fi
9213
9214 if $test X"$sPRIfldbl" = X; then
9215         $cat >try.c <<'EOCP'
9216 #include <sys/types.h>
9217 #include <stdio.h>
9218 int main() {
9219   long double d = 123.456;
9220   printf("%.3Lf\n", d);
9221 }
9222 EOCP
9223         set try
9224         if eval $compile; then
9225                 yyy=`$run ./try`
9226                 case "$yyy" in
9227                 123.456)
9228                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9229                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9230                         echo "We will use %Lf."
9231                         ;;
9232                 esac
9233         fi
9234 fi
9235
9236 if $test X"$sPRIfldbl" = X; then
9237         $cat >try.c <<'EOCP'
9238 #include <sys/types.h>
9239 #include <stdio.h>
9240 int main() {
9241   long double d = 123.456;
9242   printf("%.3llf\n", d);
9243 }
9244 EOCP
9245         set try
9246         if eval $compile; then
9247                 yyy=`$run ./try`
9248                 case "$yyy" in
9249                 123.456)
9250                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9251                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9252                         echo "We will use %llf."
9253                         ;;
9254                 esac
9255         fi
9256 fi
9257
9258 if $test X"$sPRIfldbl" = X; then
9259         $cat >try.c <<'EOCP'
9260 #include <sys/types.h>
9261 #include <stdio.h>
9262 int main() {
9263   long double d = 123.456;
9264   printf("%.3lf\n", d);
9265 }
9266 EOCP
9267         set try
9268         if eval $compile; then
9269                 yyy=`$run ./try`
9270                 case "$yyy" in
9271                 123.456)
9272                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9273                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9274                         echo "We will use %lf."
9275                         ;;
9276                 esac
9277         fi
9278 fi
9279
9280 if $test X"$sPRIfldbl" = X; then
9281         echo "Cannot figure out how to print long doubles." >&4
9282 else
9283         sSCNfldbl=$sPRIfldbl    # expect consistency
9284 fi
9285
9286 $rm -f try try.*
9287
9288 fi # d_longdbl
9289
9290 case "$sPRIfldbl" in
9291 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
9292         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
9293         d_SCNfldbl="$undef";
9294         ;;
9295 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
9296         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
9297         d_SCNfldbl="$define";
9298         ;;
9299 esac
9300
9301 : Check how to convert floats to strings.
9302
9303 if test "X$d_Gconvert" = X; then
9304
9305 echo " "
9306 echo "Checking for an efficient way to convert floats to strings."
9307 echo " " > try.c
9308 case "$uselongdouble" in
9309 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9310 esac
9311 case "$d_longdbl" in
9312 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9313 esac
9314 case "$d_PRIgldbl" in
9315 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9316 esac
9317 $cat >>try.c <<EOP
9318 #ifdef TRY_gconvert
9319 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9320 char *myname = "gconvert";
9321 #endif
9322 #ifdef TRY_gcvt
9323 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9324 char *myname = "gcvt";
9325 #endif
9326 #ifdef TRY_qgcvt
9327 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9328 char *myname = "qgcvt";
9329 #define DOUBLETYPE long double
9330 #endif
9331 #ifdef TRY_sprintf
9332 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9333 #ifdef HAS_PRIgldbl
9334 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9335 #else
9336 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9337 #endif
9338 #else
9339 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9340 #endif
9341 char *myname = "sprintf";
9342 #endif
9343
9344 #ifndef DOUBLETYPE
9345 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9346 #define DOUBLETYPE long double
9347 #else
9348 #define DOUBLETYPE double
9349 #endif
9350 #endif
9351
9352 #include <stdio.h>
9353
9354 #define I_STDLIB $i_stdlib
9355 #ifdef I_STDLIB
9356 #include <stdlib.h>
9357 #endif
9358
9359 int
9360 checkit(expect, got)
9361 char *expect;
9362 char *got;
9363 {
9364     if (strcmp(expect, got)) {
9365                 printf("%s oddity:  Expected %s, got %s\n",
9366                         myname, expect, got);
9367                 exit(1);
9368         }
9369 }
9370
9371 int main()
9372
9373         char buf[64]; 
9374         buf[63] = '\0';
9375
9376         /* This must be 1st test on (which?) platform */
9377         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9378         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9379         checkit("0.1", buf);
9380
9381         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
9382         checkit("0.01", buf);
9383
9384         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
9385         checkit("0.001", buf);
9386
9387         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
9388         checkit("0.0001", buf);
9389
9390         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9391         if (strlen(buf) > 5)
9392             checkit("9e-005", buf); /* for Microsoft ?? */
9393         else
9394             checkit("9e-05", buf);
9395
9396         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
9397         checkit("1", buf);
9398
9399         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
9400         checkit("1.1", buf);
9401
9402         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
9403         checkit("1.01", buf);
9404
9405         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
9406         checkit("1.001", buf);
9407
9408         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
9409         checkit("1.0001", buf);
9410
9411         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
9412         checkit("1.00001", buf);
9413
9414         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
9415         checkit("1.000001", buf);
9416
9417         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
9418         checkit("0", buf);
9419
9420         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
9421         checkit("-1", buf);
9422
9423         /* Some Linux gcvt's give 1.e+5 here. */
9424         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
9425         checkit("100000", buf);
9426         
9427         /* Some Linux gcvt's give -1.e+5 here. */
9428         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
9429         checkit("-100000", buf);
9430
9431         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
9432         checkit("123.456", buf);
9433
9434         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9435         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9436         /* 34 should be enough to scare even long double
9437          * places into using the e notation. */
9438         if (strlen(buf) > 5)
9439             checkit("1e+034", buf); /* for Microsoft */
9440         else
9441             checkit("1e+34", buf);
9442
9443         /* For Perl, if you add additional tests here, also add them to
9444          * t/base/num.t for benefit of platforms not using Configure or
9445          * overriding d_Gconvert */
9446
9447         exit(0);
9448 }
9449 EOP
9450 : first add preferred functions to our list
9451 xxx_list=""
9452 for xxx_convert in $gconvert_preference; do
9453     case $xxx_convert in
9454     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9455     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9456     esac 
9457 done
9458 : then add any others
9459 for xxx_convert in gconvert gcvt sprintf; do
9460     case "$xxx_list" in
9461     *$xxx_convert*) ;;
9462     *) xxx_list="$xxx_list $xxx_convert" ;;
9463     esac 
9464 done
9465
9466 case "$d_longdbl$uselongdouble" in
9467 "$define$define")
9468     : again, add prefered functions to our list first
9469     xxx_ld_list=""
9470     for xxx_convert in $gconvert_ld_preference; do
9471         case $xxx_convert in
9472         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9473         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9474         esac
9475     done
9476     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9477     for xxx_convert in qgcvt sprintf $xxx_list; do
9478         case "$xxx_ld_list" in
9479         $xxx_convert*|*" $xxx_convert"*) ;;
9480         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9481         esac
9482     done
9483     : if sprintf cannot do long doubles, move it to the end
9484     if test "$d_PRIgldbl" != "$define"; then
9485         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9486     fi
9487     : if no qgcvt, remove it
9488     if test "$d_qgcvt" != "$define"; then
9489         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9490     fi
9491     : use the ld_list
9492     xxx_list="$xxx_ld_list"
9493     ;;
9494 esac
9495
9496 for xxx_convert in $xxx_list; do
9497         echo "Trying $xxx_convert..."
9498         $rm -f try try$_o
9499         set try -DTRY_$xxx_convert
9500         if eval $compile; then
9501                 echo "$xxx_convert() found." >&4
9502                 if $run ./try; then
9503                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9504                         break;
9505                 else
9506                         echo "...But $xxx_convert didn't work as I expected."
9507                         xxx_convert=''
9508                 fi
9509         else
9510                 echo "$xxx_convert NOT found." >&4
9511         fi
9512 done
9513
9514 if test X$xxx_convert = X; then
9515     echo "*** WHOA THERE!!! ***" >&4
9516     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9517     xxx_convert=sprintf
9518 fi
9519
9520 case "$xxx_convert" in
9521 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9522 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9523 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9524 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9525    "$define$define$define")
9526       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9527    "$define$define$undef")
9528       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9529    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9530    esac
9531    ;;  
9532 esac
9533
9534 fi
9535
9536 : see if _fwalk exists
9537 set fwalk d__fwalk
9538 eval $inlibc
9539
9540 : Initialize h_fcntl
9541 h_fcntl=false
9542
9543 : Initialize h_sysfile
9544 h_sysfile=false
9545
9546 : access call always available on UNIX
9547 set access d_access
9548 eval $inlibc
9549
9550 : locate the flags for 'access()'
9551 case "$d_access" in
9552 "$define")
9553         echo " "
9554         $cat >access.c <<EOCP
9555 #include <sys/types.h>
9556 #ifdef I_FCNTL
9557 #include <fcntl.h>
9558 #endif
9559 #ifdef I_SYS_FILE
9560 #include <sys/file.h>
9561 #endif
9562 #ifdef I_UNISTD
9563 #include <unistd.h>
9564 #endif
9565 #$i_stdlib I_STDLIB
9566 #ifdef I_STDLIB
9567 #include <stdlib.h>
9568 #endif
9569 int main() {
9570         exit(R_OK);
9571 }
9572 EOCP
9573         : check sys/file.h first, no particular reason here
9574         if $test `./findhdr sys/file.h` && \
9575                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9576                 h_sysfile=true;
9577                 echo "<sys/file.h> defines the *_OK access constants." >&4
9578         elif $test `./findhdr fcntl.h` && \
9579                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9580                 h_fcntl=true;
9581                 echo "<fcntl.h> defines the *_OK access constants." >&4
9582         elif $test `./findhdr unistd.h` && \
9583                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9584                 echo "<unistd.h> defines the *_OK access constants." >&4
9585         else
9586                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9587         fi
9588         ;;
9589 esac
9590 $rm -f access*
9591
9592 : see if accessx exists
9593 set accessx d_accessx
9594 eval $inlibc
9595
9596 : see if aintl exists
9597 set aintl d_aintl
9598 eval $inlibc
9599
9600 : see if alarm exists
9601 set alarm d_alarm
9602 eval $inlibc
9603
9604 : see if POSIX threads are available
9605 set pthread.h i_pthread
9606 eval $inhdr
9607
9608 : define a fucntion to check prototypes
9609 $cat > protochk <<EOSH
9610 $startsh
9611 cc="$cc"
9612 optimize="$optimize"
9613 ccflags="$ccflags"
9614 prototype="$prototype"
9615 define="$define"
9616 rm=$rm
9617 usethreads=$usethreads
9618 i_pthread=$i_pthread
9619 pthread_h_first=$pthread_h_first
9620 EOSH
9621
9622 $cat >> protochk <<'EOSH'
9623
9624 $rm -f try.c
9625 foo="$1"
9626 shift
9627 while test $# -ge 2; do
9628         case "$1" in
9629                 $define) echo "#include <$2>" >> try.c ;;
9630                 literal) echo "$2" >> try.c ;;
9631         esac
9632     # Extra magic for the benefit of systems that need pthread.h
9633     # to be included early to correctly detect threadsafe functions.
9634     # Such functions must guarantee themselves, though, that the usethreads
9635     # and i_pthread have been defined, before calling protochk.
9636     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9637         echo "#include <pthread.h>" >> try.c
9638         pthread_h_done=yes
9639     fi
9640     shift 2
9641 done
9642 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9643 cat >> try.c <<'EOCP'
9644 #ifdef CAN_PROTOTYPE
9645 #define _(args) args
9646 #else
9647 #define _(args) ()
9648 #endif
9649 EOCP
9650 echo "$foo" >> try.c
9651 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9652 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9653 status=$?
9654 $rm -f try.[co]
9655 exit $status
9656 EOSH
9657 chmod +x protochk
9658 $eunicefix protochk
9659
9660 hasproto='varname=$1; func=$2; shift; shift;
9661 while $test $# -ge 2; do
9662         case "$1" in
9663         $define) echo "#include <$2>";;
9664         esac ;
9665     shift 2;
9666 done > try.c;
9667 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9668 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9669         echo "$func() prototype found.";
9670         val="$define";
9671 else
9672         echo "$func() prototype NOT found.";
9673         val="$undef";
9674 fi;
9675 set $varname;
9676 eval $setvar;
9677 $rm -f try.c tryout.c'
9678
9679 : see if sys/types.h has to be included
9680 set sys/types.h i_systypes
9681 eval $inhdr
9682
9683 : see if sys/select.h has to be included
9684 set sys/select.h i_sysselct
9685 eval $inhdr
9686
9687 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9688 while $test $# -ge 2; do
9689         case "$1" in
9690         $define) echo "#include <$2>";;
9691         esac ;
9692     shift 2;
9693 done > try.c;
9694 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9695 set try;
9696 if eval $compile; then
9697         val="$define";
9698 else
9699         val="$undef";
9700 fi;
9701 set $varname;
9702 eval $setvar;
9703 $rm -f try.c try.o'
9704
9705 : see if we should include time.h, sys/time.h, or both
9706 echo " "
9707 if test "X$timeincl" = X; then
9708         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9709         $echo $n "I'm now running the test program...$c"
9710         $cat >try.c <<EOCP
9711 #include <sys/types.h>
9712 #ifdef I_TIME
9713 #include <time.h>
9714 #endif
9715 #ifdef I_SYSTIME
9716 #ifdef SYSTIMEKERNEL
9717 #define KERNEL
9718 #endif
9719 #include <sys/time.h>
9720 #endif
9721 #ifdef I_SYSSELECT
9722 #include <sys/select.h>
9723 #endif
9724 #$i_stdlib I_STDLIB
9725 #ifdef I_STDLIB
9726 #include <stdlib.h>
9727 #endif
9728 int main()
9729 {
9730         struct tm foo;
9731 #ifdef S_TIMEVAL
9732         struct timeval bar;
9733 #endif
9734 #ifdef S_TIMEZONE
9735         struct timezone tzp;
9736 #endif
9737         if (foo.tm_sec == foo.tm_sec)
9738                 exit(0);
9739 #ifdef S_TIMEVAL
9740         if (bar.tv_sec == bar.tv_sec)
9741                 exit(0);
9742 #endif
9743         exit(1);
9744 }
9745 EOCP
9746         flags=''
9747         for s_timezone in '-DS_TIMEZONE' ''; do
9748         sysselect=''
9749         for s_timeval in '-DS_TIMEVAL' ''; do
9750         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9751         for i_time in '' '-DI_TIME'; do
9752         for i_systime in '-DI_SYSTIME' ''; do
9753                 case "$flags" in
9754                 '') $echo $n ".$c"
9755                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9756                         if eval $compile; then
9757                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9758                                 shift
9759                                 flags="$*"
9760                                 echo " "
9761                                 $echo $n "Succeeded with $flags$c"
9762                         fi
9763                         ;;
9764                 esac
9765         done
9766         done
9767         done
9768         done
9769         done
9770         timeincl=''
9771         echo " "
9772         case "$flags" in
9773         *SYSTIMEKERNEL*) i_systimek="$define"
9774                 timeincl=`./findhdr sys/time.h`
9775                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9776         *) i_systimek="$undef";;
9777         esac
9778         case "$flags" in
9779         *I_TIME*) i_time="$define"
9780                 timeincl=`./findhdr time.h`" $timeincl"
9781                 echo "We'll include <time.h>." >&4;;
9782         *) i_time="$undef";;
9783         esac
9784         case "$flags" in
9785         *I_SYSTIME*) i_systime="$define"
9786                 timeincl=`./findhdr sys/time.h`" $timeincl"
9787                 echo "We'll include <sys/time.h>." >&4;;
9788         *) i_systime="$undef";;
9789         esac
9790         $rm -f try.c try
9791 fi
9792 : see if struct tm knows about tm_zone
9793 case "$i_systime$i_time" in
9794 *$define*) 
9795         echo " "
9796         echo "Checking to see if your struct tm has tm_zone field..." >&4
9797         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9798         eval $hasfield
9799         ;;
9800 *)      val="$undef"
9801         set d_tm_tm_zone
9802         eval $setvar
9803         ;;
9804 esac
9805 case "$d_tm_tm_zone" in
9806 "$define")      echo "Yes, it does."   ;;
9807 *)              echo "No, it doesn't." ;;
9808 esac
9809 : see if struct tm knows about tm_gmtoff
9810 case "$i_systime$i_time" in
9811 *$define*) 
9812         echo " "
9813         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9814         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9815         eval $hasfield
9816         ;;
9817 *)      val="$undef"
9818         set d_tm_tm_gmtoff
9819         eval $setvar
9820         ;;
9821 esac
9822 case "$d_tm_tm_gmtoff" in
9823 "$define")      echo "Yes, it does."   ;;
9824 *)              echo "No, it doesn't." ;;
9825 esac
9826
9827 : see if asctime_r exists
9828 set asctime_r d_asctime_r
9829 eval $inlibc
9830 case "$d_asctime_r" in
9831 "$define")
9832         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9833         case "$d_asctime_r_proto:$usethreads" in
9834         ":define")      d_asctime_r_proto=define
9835                 set d_asctime_r_proto asctime_r $hdrs
9836                 eval $hasproto ;;
9837         *)      ;;
9838         esac
9839         case "$d_asctime_r_proto" in
9840         define)
9841         case "$asctime_r_proto" in
9842         ''|0) try='char* asctime_r(const struct tm*, char*);'
9843         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9844         esac
9845         case "$asctime_r_proto" in
9846         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9847         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9848         esac
9849         case "$asctime_r_proto" in
9850         ''|0) try='int asctime_r(const struct tm*, char*);'
9851         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9852         esac
9853         case "$asctime_r_proto" in
9854         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9855         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9856         esac
9857         case "$asctime_r_proto" in
9858         ''|0)   d_asctime_r=undef
9859                 asctime_r_proto=0
9860                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9861         * )     case "$asctime_r_proto" in
9862                 REENTRANT_PROTO*) ;;
9863                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9864                 esac
9865                 echo "Prototype: $try" ;;
9866         esac
9867         ;;
9868         *)      case "$usethreads" in
9869                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9870                 esac
9871                 d_asctime_r=undef
9872                 asctime_r_proto=0
9873                 ;;
9874         esac
9875         ;;
9876 *)      asctime_r_proto=0
9877         ;;
9878 esac
9879
9880 : see if atolf exists
9881 set atolf d_atolf
9882 eval $inlibc
9883
9884 : see if atoll exists
9885 set atoll d_atoll
9886 eval $inlibc
9887
9888 : Look for GCC-style attribute format
9889 case "$d_attribute_format" in
9890 '')
9891 echo " "
9892 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
9893 $cat >attrib.c <<'EOCP'
9894 #include <stdio.h>
9895 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
9896 EOCP
9897 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9898         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9899                 echo "Your C compiler doesn't support __attribute__((format))."
9900                 val="$undef"
9901         else
9902                 echo "Your C compiler supports __attribute__((format))."
9903                 val="$define"
9904         fi
9905 else
9906         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9907         val="$undef"
9908 fi
9909 ;;
9910 *) val="$d_attribute_format" ;;
9911 esac
9912 set d_attribute_format
9913 eval $setvar
9914 $rm -f attrib*
9915
9916 : Look for GCC-style attribute malloc
9917 case "$d_attribute_malloc" in
9918 '')
9919 echo " "
9920 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
9921 $cat >attrib.c <<'EOCP'
9922 #include <stdio.h>
9923 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
9924 EOCP
9925 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9926         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9927                 echo "Your C compiler doesn't support __attribute__((malloc))."
9928                 val="$undef"
9929         else
9930                 echo "Your C compiler supports __attribute__((malloc))."
9931                 val="$define"
9932         fi
9933 else
9934         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9935         val="$undef"
9936 fi
9937 ;;
9938 *) val="$d_attribute_malloc" ;;
9939 esac
9940 set d_attribute_malloc
9941 eval $setvar
9942 $rm -f attrib*
9943
9944 : Look for GCC-style attribute nonnull
9945 case "$d_attribute_nonnull" in
9946 '')
9947 echo " "
9948 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
9949 $cat >attrib.c <<'EOCP'
9950 #include <stdio.h>
9951 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
9952 EOCP
9953 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9954         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9955                 echo "Your C compiler doesn't support __attribute__((nonnull))."
9956                 val="$undef"
9957         else
9958                 echo "Your C compiler supports __attribute__((nonnull))."
9959                 val="$define"
9960         fi
9961 else
9962         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9963         val="$undef"
9964 fi
9965 ;;
9966 *) val="$d_attribute_nonnull" ;;
9967 esac
9968 set d_attribute_nonnull
9969 eval $setvar
9970 $rm -f attrib*
9971
9972 : Look for GCC-style attribute noreturn
9973 case "$d_attribute_noreturn" in
9974 '')
9975 echo " "
9976 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
9977 $cat >attrib.c <<'EOCP'
9978 #include <stdio.h>
9979 void fall_over_dead( void ) __attribute__((noreturn));
9980 EOCP
9981 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9982         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9983                 echo "Your C compiler doesn't support __attribute__((noreturn))."
9984                 val="$undef"
9985         else
9986                 echo "Your C compiler supports __attribute__((noreturn))."
9987                 val="$define"
9988         fi
9989 else
9990         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9991         val="$undef"
9992 fi
9993 ;;
9994 *) val="$d_attribute_noreturn" ;;
9995 esac
9996 set d_attribute_noreturn
9997 eval $setvar
9998 $rm -f attrib*
9999
10000 : Look for GCC-style attribute pure
10001 case "$d_attribute_pure" in
10002 '')
10003 echo " "
10004 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10005 $cat >attrib.c <<'EOCP'
10006 #include <stdio.h>
10007 int square( int n ) __attribute__((pure));
10008 EOCP
10009 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10010         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10011                 echo "Your C compiler doesn't support __attribute__((pure))."
10012                 val="$undef"
10013         else
10014                 echo "Your C compiler supports __attribute__((pure))."
10015                 val="$define"
10016         fi
10017 else
10018         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10019         val="$undef"
10020 fi
10021 ;;
10022 *) val="$d_attribute_pure" ;;
10023 esac
10024 set d_attribute_pure
10025 eval $setvar
10026 $rm -f attrib*
10027
10028 : Look for GCC-style attribute unused
10029 case "$d_attribute_unused" in
10030 '')
10031 echo " "
10032 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10033 $cat >attrib.c <<'EOCP'
10034 #include <stdio.h>
10035 int do_something( int dummy __attribute__((unused)), int n );
10036 EOCP
10037 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10038         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10039                 echo "Your C compiler doesn't support __attribute__((unused))."
10040                 val="$undef"
10041         else
10042                 echo "Your C compiler supports __attribute__((unused))."
10043                 val="$define"
10044         fi
10045 else
10046         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10047         val="$undef"
10048 fi
10049 ;;
10050 *) val="$d_attribute_unused" ;;
10051 esac
10052 set d_attribute_unused
10053 eval $setvar
10054 $rm -f attrib*
10055
10056 : Look for GCC-style attribute warn_unused_result
10057 case "$d_attribute_warn_unused_result" in
10058 '')
10059 echo " "
10060 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10061 $cat >attrib.c <<'EOCP'
10062 #include <stdio.h>
10063 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10064 EOCP
10065 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10066         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10067                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10068                 val="$undef"
10069         else
10070                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10071                 val="$define"
10072         fi
10073 else
10074         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10075         val="$undef"
10076 fi
10077 ;;
10078 *) val="$d_attribute_warn_unused_result" ;;
10079 esac
10080 set d_attribute_warn_unused_result
10081 eval $setvar
10082 $rm -f attrib*
10083
10084 : see if bcmp exists
10085 set bcmp d_bcmp
10086 eval $inlibc
10087
10088 : see if bcopy exists
10089 set bcopy d_bcopy
10090 eval $inlibc
10091
10092 : see if this is a unistd.h system
10093 set unistd.h i_unistd
10094 eval $inhdr
10095
10096 : see if getpgrp exists
10097 set getpgrp d_getpgrp
10098 eval $inlibc
10099
10100 case "$d_getpgrp" in
10101 "$define")
10102         echo " "
10103         echo "Checking to see which flavor of getpgrp is in use..."
10104         $cat >try.c <<EOP
10105 #$i_unistd I_UNISTD
10106 #include <sys/types.h>
10107 #ifdef I_UNISTD
10108 #  include <unistd.h>
10109 #endif
10110 #$i_stdlib I_STDLIB
10111 #ifdef I_STDLIB
10112 #include <stdlib.h>
10113 #endif
10114 int main()
10115 {
10116         if (getuid() == 0) {
10117                 printf("(I see you are running Configure as super-user...)\n");
10118                 setuid(1);
10119         }
10120 #ifdef TRY_BSD_PGRP
10121         if (getpgrp(1) == 0)
10122                 exit(0);
10123 #else
10124         if (getpgrp() > 0)
10125                 exit(0);
10126 #endif
10127         exit(1);
10128 }
10129 EOP
10130         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10131                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10132                 val="$define"
10133         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10134                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10135                 val="$undef"
10136         else
10137                 echo "I can't seem to compile and run the test program."
10138                 if ./usg; then
10139                         xxx="a USG one, i.e. you use getpgrp()."
10140                 else
10141                         # SVR4 systems can appear rather BSD-ish.
10142                         case "$i_unistd" in
10143                         $undef)
10144                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10145                                 val="$define"
10146                                 ;;
10147                         $define)
10148                                 xxx="probably a USG one, i.e. you use getpgrp()."
10149                                 val="$undef"
10150                                 ;;
10151                         esac
10152                 fi
10153                 echo "Assuming your getpgrp is $xxx" >&4
10154         fi
10155         ;;
10156 *) val="$undef";;
10157 esac
10158 set d_bsdgetpgrp
10159 eval $setvar
10160 $rm -f try try.*
10161
10162 : see if setpgrp exists
10163 set setpgrp d_setpgrp
10164 eval $inlibc
10165
10166 case "$d_setpgrp" in
10167 "$define")
10168         echo " "
10169         echo "Checking to see which flavor of setpgrp is in use..."
10170         $cat >try.c <<EOP
10171 #$i_unistd I_UNISTD
10172 #include <sys/types.h>
10173 #ifdef I_UNISTD
10174 #  include <unistd.h>
10175 #endif
10176 #$i_stdlib I_STDLIB
10177 #ifdef I_STDLIB
10178 #include <stdlib.h>
10179 #endif
10180 int main()
10181 {
10182         if (getuid() == 0) {
10183                 printf("(I see you are running Configure as super-user...)\n");
10184                 setuid(1);
10185         }
10186 #ifdef TRY_BSD_PGRP
10187         if (-1 == setpgrp(1, 1))
10188                 exit(0);
10189 #else
10190         if (setpgrp() != -1)
10191                 exit(0);
10192 #endif
10193         exit(1);
10194 }
10195 EOP
10196         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10197                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10198                 val="$define"
10199         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10200                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10201                 val="$undef"
10202         else
10203                 echo "(I can't seem to compile and run the test program.)"
10204                 if ./usg; then
10205                         xxx="a USG one, i.e. you use setpgrp()."
10206                 else
10207                         # SVR4 systems can appear rather BSD-ish.
10208                         case "$i_unistd" in
10209                         $undef)
10210                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10211                                 val="$define"
10212                                 ;;
10213                         $define)
10214                                 xxx="probably a USG one, i.e. you use setpgrp()."
10215                                 val="$undef"
10216                                 ;;
10217                         esac
10218                 fi
10219                 echo "Assuming your setpgrp is $xxx" >&4
10220         fi
10221         ;;
10222 *) val="$undef";;
10223 esac
10224 set d_bsdsetpgrp
10225 eval $setvar
10226 $rm -f try try.*
10227 : see if bzero exists
10228 set bzero d_bzero
10229 eval $inlibc
10230
10231 : see if signal is declared as pointer to function returning int or void
10232 echo " "
10233 xxx=`./findhdr signal.h`
10234 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10235 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10236         echo "You have int (*signal())() instead of void." >&4
10237         val="$undef"
10238 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10239         echo "You have void (*signal())()." >&4
10240         val="$define"
10241 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10242         echo "You have int (*signal())() instead of void." >&4
10243         val="$undef"
10244 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10245         echo "You have void (*signal())()." >&4
10246         val="$define"
10247 else
10248         case "$d_voidsig" in
10249         '')
10250         echo "I can't determine whether signal handler returns void or int..." >&4
10251                 dflt=void
10252                 rp="What type does your signal handler return?"
10253                 . ./myread
10254                 case "$ans" in
10255                 v*) val="$define";;
10256                 *) val="$undef";;
10257                 esac;;
10258         "$define")
10259                 echo "As you already told me, signal handler returns void." >&4
10260                 val="$define"
10261                 ;;
10262         *)      echo "As you already told me, signal handler returns int." >&4
10263                 val="$undef"
10264                 ;;
10265         esac
10266 fi
10267 set d_voidsig
10268 eval $setvar
10269 case "$d_voidsig" in
10270 "$define") signal_t="void";;
10271 *) signal_t="int";;
10272 esac
10273 $rm -f $$.tmp
10274
10275 : check for ability to cast large floats to 32-bit ints.
10276 echo " "
10277 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10278 if $test "$intsize" -ge 4; then
10279         xxx=int
10280 else
10281         xxx=long
10282 fi
10283 $cat >try.c <<EOCP
10284 #include <stdio.h>
10285 #$i_stdlib I_STDLIB
10286 #ifdef I_STDLIB
10287 #include <stdlib.h>
10288 #endif
10289 #include <sys/types.h>
10290 #include <signal.h>
10291 $signal_t blech(s) int s; { exit(3); }
10292 int main()
10293 {
10294         $xxx i32;
10295         double f, g;
10296         int result = 0;
10297         char str[16];
10298         signal(SIGFPE, blech);
10299
10300         /* Don't let compiler optimize the test away.  Store the number 
10301            in a writable string for gcc to pass to sscanf under HP/UX.
10302         */
10303         sprintf(str, "2147483647");
10304         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10305         g = 10 * f;
10306         i32  = ($xxx) g;
10307
10308         /* x86 processors will probably give 0x8000 0000, which is a
10309            sign change.  We don't want that.  We want to mimic SPARC
10310            behavior here, which is to preserve the sign and give
10311            back 0x7fff ffff.
10312         */
10313         if (i32 != ($xxx) f)
10314                 result |= 1;
10315         exit(result);
10316 }
10317 EOCP
10318 set try
10319 if eval $compile_ok; then
10320         $run ./try
10321         yyy=$?
10322 else
10323         echo "(I can't seem to compile the test program--assuming it can't)"
10324         yyy=1
10325 fi
10326 case "$yyy" in
10327 0)      val="$define"
10328         echo "Yup, it can."
10329         ;;
10330 *)      val="$undef"
10331         echo "Nope, it can't."
10332         ;;
10333 esac
10334 set d_casti32
10335 eval $setvar
10336 $rm -f try try.*
10337
10338 : check for ability to cast negative floats to unsigned
10339 echo " "
10340 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10341 $cat >try.c <<EOCP
10342 #include <stdio.h>
10343 #$i_stdlib I_STDLIB
10344 #ifdef I_STDLIB
10345 #include <stdlib.h>
10346 #endif
10347 #include <sys/types.h>
10348 #include <signal.h>
10349 $signal_t blech(s) int s; { exit(7); }
10350 $signal_t blech_in_list(s) int s; { exit(4); }
10351 unsigned long dummy_long(p) unsigned long p; { return p; }
10352 unsigned int dummy_int(p) unsigned int p; { return p; }
10353 unsigned short dummy_short(p) unsigned short p; { return p; }
10354 int main()
10355 {
10356         double f;
10357         unsigned long along;
10358         unsigned int aint;
10359         unsigned short ashort;
10360         int result = 0;
10361         char str[16];
10362         
10363         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10364            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10365            optimized the whole file away
10366         */
10367         /* Store the number in a writable string for gcc to pass to 
10368            sscanf under HP/UX.
10369         */
10370         sprintf(str, "-123");
10371         sscanf(str, "%lf", &f);  /* f = -123.; */
10372
10373         signal(SIGFPE, blech);
10374         along = (unsigned long)f;
10375         aint = (unsigned int)f;
10376         ashort = (unsigned short)f;
10377         if (along != (unsigned long)-123)
10378                 result |= 1;
10379         if (aint != (unsigned int)-123)
10380                 result |= 1;
10381         if (ashort != (unsigned short)-123)
10382                 result |= 1;
10383         sprintf(str, "1073741824.");
10384         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10385         f = f + f;
10386         along = 0;
10387         along = (unsigned long)f;
10388         if (along != 0x80000000)
10389                 result |= 2;
10390         f -= 1.;
10391         along = 0;
10392         along = (unsigned long)f;
10393         if (along != 0x7fffffff)
10394                 result |= 1;
10395         f += 2.;
10396         along = 0;
10397         along = (unsigned long)f;
10398         if (along != 0x80000001)
10399                 result |= 2;
10400         if (result)
10401                 exit(result);
10402         signal(SIGFPE, blech_in_list);
10403         sprintf(str, "123.");
10404         sscanf(str, "%lf", &f);  /* f = 123.; */
10405         along = dummy_long((unsigned long)f);
10406         aint = dummy_int((unsigned int)f);
10407         ashort = dummy_short((unsigned short)f);
10408         if (along != (unsigned long)123)
10409                 result |= 4;
10410         if (aint != (unsigned int)123)
10411                 result |= 4;
10412         if (ashort != (unsigned short)123)
10413                 result |= 4;
10414         exit(result);
10415
10416 }
10417 EOCP
10418 set try
10419 if eval $compile_ok; then
10420         $run ./try
10421         castflags=$?
10422 else
10423         echo "(I can't seem to compile the test program--assuming it can't)"
10424         castflags=7
10425 fi
10426 case "$castflags" in
10427 0)      val="$define"
10428         echo "Yup, it can."
10429         ;;
10430 *)      val="$undef"
10431         echo "Nope, it can't."
10432         ;;
10433 esac
10434 set d_castneg
10435 eval $setvar
10436 $rm -f try.*
10437
10438 : see if vprintf exists
10439 echo " "
10440 if set vprintf val -f d_vprintf; eval $csym; $val; then
10441         echo 'vprintf() found.' >&4
10442         val="$define"
10443         $cat >try.c <<EOF
10444 #include <varargs.h>
10445 #$i_stdlib I_STDLIB
10446 #ifdef I_STDLIB
10447 #include <stdlib.h>
10448 #endif
10449
10450 int main() { xxx("foo"); }
10451
10452 xxx(va_alist)
10453 va_dcl
10454 {
10455         va_list args;
10456         char buf[10];
10457
10458         va_start(args);
10459         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10460 }
10461 EOF
10462         set try
10463         if eval $compile && $run ./try; then
10464                 echo "Your vsprintf() returns (int)." >&4
10465                 val2="$undef"
10466         else
10467                 echo "Your vsprintf() returns (char*)." >&4
10468                 val2="$define"
10469         fi
10470 else
10471         echo 'vprintf() NOT found.' >&4
10472                 val="$undef"
10473                 val2="$undef"
10474 fi
10475 $rm -f try try.*
10476 set d_vprintf
10477 eval $setvar
10478 val=$val2
10479 set d_charvspr
10480 eval $setvar
10481
10482 : see if chown exists
10483 set chown d_chown
10484 eval $inlibc
10485
10486 : see if chroot exists
10487 set chroot d_chroot
10488 eval $inlibc
10489
10490 : see if chsize exists
10491 set chsize d_chsize
10492 eval $inlibc
10493
10494 : see if class exists
10495 set class d_class
10496 eval $inlibc
10497
10498 hasstruct='varname=$1; struct=$2; shift; shift;
10499 while $test $# -ge 2; do
10500         case "$1" in
10501         $define) echo "#include <$2>";;
10502         esac ;
10503     shift 2;
10504 done > try.c;
10505 echo "int main () { struct $struct foo; }" >> try.c;
10506 set try;
10507 if eval $compile; then
10508         val="$define";
10509 else
10510         val="$undef";
10511 fi;
10512 set $varname;
10513 eval $setvar;
10514 $rm -f try.c try.o'
10515
10516 socketlib=''
10517 sockethdr=''
10518 : see whether socket exists
10519 echo " "
10520 $echo $n "Hmm... $c" >&4
10521 if set socket val -f d_socket; eval $csym; $val; then
10522         echo "Looks like you have Berkeley networking support." >&4
10523         d_socket="$define"
10524         if set setsockopt val -f; eval $csym; $val; then
10525                 d_oldsock="$undef"
10526         else
10527                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10528                 d_oldsock="$define"
10529         fi
10530 else
10531         if $contains socklib libc.list >/dev/null 2>&1; then
10532                 echo "Looks like you have Berkeley networking support." >&4
10533                 d_socket="$define"
10534                 : we will have to assume that it supports the 4.2 BSD interface
10535                 d_oldsock="$undef"
10536         else
10537                 echo "You don't have Berkeley networking in libc$_a..." >&4
10538                 if test "X$d_socket" = "X$define"; then
10539                    echo "...but you seem to believe that you have sockets." >&4
10540                 else
10541                         for net in net socket
10542                         do
10543                                 if test -f /usr/lib/lib$net$_a; then
10544                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10545                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10546                                         if $contains socket libc.list >/dev/null 2>&1; then
10547                                                 d_socket="$define"
10548                                                 socketlib="-l$net"
10549                                                 case "$net" in
10550                                                 net)
10551                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10552                                                         sockethdr="-I/usr/netinclude"
10553                                                         ;;
10554                                                 esac
10555                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
10556                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10557                                                         d_oldsock="$undef"
10558                                                 else
10559                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10560                                                         d_oldsock="$define"
10561                                                 fi
10562                                                 break
10563                                         fi
10564                                 fi
10565                         done
10566                         if test "X$d_socket" != "X$define"; then
10567                            echo "or anywhere else I see." >&4
10568                            d_socket="$undef"
10569                            d_oldsock="$undef"
10570                         fi
10571                 fi
10572         fi
10573 fi
10574
10575 : see if socketpair exists
10576 set socketpair d_sockpair
10577 eval $inlibc
10578
10579
10580 echo " "
10581 echo "Checking the availability of certain socket constants..." >&4
10582 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10583         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10584         $cat >try.c <<EOF
10585 #include <sys/types.h>
10586 #include <sys/socket.h>
10587 int main() {
10588     int i = $ENUM;
10589 }
10590 EOF
10591         val="$undef"
10592         set try; if eval $compile; then
10593                 val="$define"
10594         fi
10595         set d_${enum}; eval $setvar
10596         $rm -f try.c try
10597 done
10598
10599 : see if this is a sys/uio.h system
10600 set sys/uio.h i_sysuio
10601 eval $inhdr
10602
10603
10604 echo " "
10605 echo "Checking to see if your system supports struct cmsghdr..." >&4
10606 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10607 eval $hasstruct
10608 case "$d_cmsghdr_s" in
10609 "$define")      echo "Yes, it does."   ;;
10610 *)              echo "No, it doesn't." ;;
10611 esac
10612
10613
10614 : check for const keyword
10615 echo " "
10616 echo 'Checking to see if your C compiler knows about "const"...' >&4
10617 $cat >const.c <<'EOCP'
10618 typedef struct spug { int drokk; } spug;
10619 int main()
10620 {
10621         const char *foo;
10622         const spug y;
10623 }
10624 EOCP
10625 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10626         val="$define"
10627         echo "Yup, it does."
10628 else
10629         val="$undef"
10630         echo "Nope, it doesn't."
10631 fi
10632 set d_const
10633 eval $setvar
10634
10635 : see if copysignl exists
10636 set copysignl d_copysignl
10637 eval $inlibc
10638
10639 : see if crypt exists
10640 echo " "
10641 set crypt d_crypt
10642 eval $inlibc
10643 case "$d_crypt" in
10644 $define) cryptlib='' ;;
10645 *)      if set crypt val -f d_crypt; eval $csym; $val; then
10646                 echo 'crypt() found.' >&4
10647                 val="$define"
10648                 cryptlib=''
10649         else
10650                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10651                 if $test -z "$cryptlib"; then
10652                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10653                 else
10654                         cryptlib=-lcrypt
10655                 fi
10656                 if $test -z "$cryptlib"; then
10657                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10658                 else
10659                         cryptlib=-lcrypt
10660                 fi
10661                 if $test -z "$cryptlib"; then
10662                         cryptlib=`./loc libcrypt$_a "" $libpth`
10663                 else
10664                         cryptlib=-lcrypt
10665                 fi
10666                 if $test -z "$cryptlib"; then
10667                         echo 'crypt() NOT found.' >&4
10668                         val="$undef"
10669                 else
10670                         val="$define"
10671                 fi
10672         fi
10673         set d_crypt
10674         eval $setvar
10675         ;;
10676 esac
10677
10678 : see if this is a crypt.h system
10679 set crypt.h i_crypt
10680 eval $inhdr
10681
10682 : see if crypt_r exists
10683 set crypt_r d_crypt_r
10684 eval $inlibc
10685 case "$d_crypt_r" in
10686 "$define")
10687         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
10688         case "$d_crypt_r_proto:$usethreads" in
10689         ":define")      d_crypt_r_proto=define
10690                 set d_crypt_r_proto crypt_r $hdrs
10691                 eval $hasproto ;;
10692         *)      ;;
10693         esac
10694         case "$d_crypt_r_proto" in
10695         define)
10696         case "$crypt_r_proto" in
10697         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10698         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10699         esac
10700         case "$crypt_r_proto" in
10701         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10702         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10703         esac
10704         case "$crypt_r_proto" in
10705         ''|0)   d_crypt_r=undef
10706                 crypt_r_proto=0
10707                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10708         * )     case "$crypt_r_proto" in
10709                 REENTRANT_PROTO*) ;;
10710                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10711                 esac
10712                 echo "Prototype: $try" ;;
10713         esac
10714         ;;
10715         *)      case "$usethreads" in
10716                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10717                 esac
10718                 d_crypt_r=undef
10719                 crypt_r_proto=0
10720                 ;;
10721         esac
10722         ;;
10723 *)      crypt_r_proto=0
10724         ;;
10725 esac
10726
10727 : get csh whereabouts
10728 case "$csh" in
10729 'csh') val="$undef" ;;
10730 *) val="$define" ;;
10731 esac
10732 set d_csh
10733 eval $setvar
10734 : Respect a hint or command line value for full_csh.
10735 case "$full_csh" in
10736 '') full_csh=$csh ;;
10737 esac
10738
10739 : see if ctermid_r exists
10740 set ctermid_r d_ctermid_r
10741 eval $inlibc
10742 case "$d_ctermid_r" in
10743 "$define")
10744         hdrs="$i_systypes sys/types.h define stdio.h "
10745         case "$d_ctermid_r_proto:$usethreads" in
10746         ":define")      d_ctermid_r_proto=define
10747                 set d_ctermid_r_proto ctermid_r $hdrs
10748                 eval $hasproto ;;
10749         *)      ;;
10750         esac
10751         case "$d_ctermid_r_proto" in
10752         define)
10753         case "$ctermid_r_proto" in
10754         ''|0) try='char* ctermid_r(char*);'
10755         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10756         esac
10757         case "$ctermid_r_proto" in
10758         ''|0)   d_ctermid_r=undef
10759                 ctermid_r_proto=0
10760                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10761         * )     case "$ctermid_r_proto" in
10762                 REENTRANT_PROTO*) ;;
10763                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10764                 esac
10765                 echo "Prototype: $try" ;;
10766         esac
10767         ;;
10768         *)      case "$usethreads" in
10769                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10770                 esac
10771                 d_ctermid_r=undef
10772                 ctermid_r_proto=0
10773                 ;;
10774         esac
10775         ;;
10776 *)      ctermid_r_proto=0
10777         ;;
10778 esac
10779
10780 : see if ctime_r exists
10781 set ctime_r d_ctime_r
10782 eval $inlibc
10783 case "$d_ctime_r" in
10784 "$define")
10785         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10786         case "$d_ctime_r_proto:$usethreads" in
10787         ":define")      d_ctime_r_proto=define
10788                 set d_ctime_r_proto ctime_r $hdrs
10789                 eval $hasproto ;;
10790         *)      ;;
10791         esac
10792         case "$d_ctime_r_proto" in
10793         define)
10794         case "$ctime_r_proto" in
10795         ''|0) try='char* ctime_r(const time_t*, char*);'
10796         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10797         esac
10798         case "$ctime_r_proto" in
10799         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10800         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10801         esac
10802         case "$ctime_r_proto" in
10803         ''|0) try='int ctime_r(const time_t*, char*);'
10804         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10805         esac
10806         case "$ctime_r_proto" in
10807         ''|0) try='int ctime_r(const time_t*, char*, int);'
10808         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10809         esac
10810         case "$ctime_r_proto" in
10811         ''|0)   d_ctime_r=undef
10812                 ctime_r_proto=0
10813                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10814         * )     case "$ctime_r_proto" in
10815                 REENTRANT_PROTO*) ;;
10816                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10817                 esac
10818                 echo "Prototype: $try" ;;
10819         esac
10820         ;;
10821         *)      case "$usethreads" in
10822                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10823                 esac
10824                 d_ctime_r=undef
10825                 ctime_r_proto=0
10826                 ;;
10827         esac
10828         ;;
10829 *)      ctime_r_proto=0
10830         ;;
10831 esac
10832
10833 : see if cuserid exists
10834 set cuserid d_cuserid
10835 eval $inlibc
10836
10837 : see if this is a limits.h system
10838 set limits.h i_limits
10839 eval $inhdr
10840
10841 : see if this is a float.h system
10842 set float.h i_float
10843 eval $inhdr
10844
10845 : See if number of significant digits in a double precision number is known
10846 echo " "
10847 $cat >dbl_dig.c <<EOM
10848 #$i_limits I_LIMITS
10849 #$i_float I_FLOAT
10850 #ifdef I_LIMITS
10851 #include <limits.h>
10852 #endif
10853 #ifdef I_FLOAT
10854 #include <float.h>
10855 #endif
10856 #ifdef DBL_DIG
10857 printf("Contains DBL_DIG");
10858 #endif
10859 EOM
10860 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10861 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10862         echo "DBL_DIG found." >&4
10863         val="$define"
10864 else
10865         echo "DBL_DIG NOT found." >&4
10866         val="$undef"
10867 fi
10868 $rm -f dbl_dig.?
10869 set d_dbl_dig
10870 eval $setvar
10871
10872 : see if dbm.h is available
10873 : see if dbmclose exists
10874 set dbmclose d_dbmclose
10875 eval $inlibc
10876
10877 case "$d_dbmclose" in
10878 $define)
10879         set dbm.h i_dbm
10880         eval $inhdr
10881         case "$i_dbm" in
10882         $define)
10883                 val="$undef"
10884                 set i_rpcsvcdbm
10885                 eval $setvar
10886                 ;;
10887         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10888                 eval $inhdr
10889                 ;;
10890         esac
10891         ;;
10892 *)      echo "We won't be including <dbm.h>"
10893         val="$undef"
10894         set i_dbm
10895         eval $setvar
10896         val="$undef"
10897         set i_rpcsvcdbm
10898         eval $setvar
10899         ;;
10900 esac
10901
10902 : see if prototype for dbminit is available
10903 echo " "
10904 set d_dbminitproto dbminit $i_dbm dbm.h
10905 eval $hasproto
10906
10907 : see if difftime exists
10908 set difftime d_difftime
10909 eval $inlibc
10910
10911 : see if this is a dirent system
10912 echo " "
10913 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10914         val="$define"
10915         echo "<dirent.h> found." >&4
10916 else
10917         val="$undef"
10918         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10919                 echo "<sys/dir.h> found." >&4
10920                 echo " "
10921         else
10922                 xinc=`./findhdr sys/ndir.h`
10923         fi
10924         echo "<dirent.h> NOT found." >&4
10925 fi
10926 set i_dirent
10927 eval $setvar
10928
10929 : Look for type of directory structure.
10930 echo " "
10931 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10932
10933 case "$direntrytype" in
10934 ''|' ')
10935         case "$i_dirent" in
10936         $define) guess1='struct dirent' ;;
10937         *) guess1='struct direct'  ;;
10938         esac
10939         ;;
10940 *)      guess1="$direntrytype"
10941         ;;
10942 esac
10943
10944 case "$guess1" in
10945 'struct dirent') guess2='struct direct' ;;
10946 *) guess2='struct dirent' ;;
10947 esac
10948                 
10949 if $contains "$guess1" try.c >/dev/null 2>&1; then
10950         direntrytype="$guess1"
10951         echo "Your directory entries are $direntrytype." >&4
10952 elif $contains "$guess2" try.c >/dev/null 2>&1; then
10953         direntrytype="$guess2"
10954         echo "Your directory entries seem to be $direntrytype." >&4
10955 else
10956         echo "I don't recognize your system's directory entries." >&4
10957         rp="What type is used for directory entries on this system?"
10958         dflt="$guess1"
10959         . ./myread
10960         direntrytype="$ans"
10961 fi
10962 $rm -f try.c
10963
10964
10965 : see if the directory entry stores field length
10966 echo " "
10967 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10968 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10969         echo "Good, your directory entry keeps length information in d_namlen." >&4
10970         val="$define"
10971 else
10972         echo "Your directory entry does not know about the d_namlen field." >&4
10973         val="$undef"
10974 fi
10975 set d_dirnamlen
10976 eval $setvar
10977 $rm -f try.c
10978
10979 : see if this is an sysdir system
10980 set sys/dir.h i_sysdir
10981 eval $inhdr
10982
10983 : see if this is an sysndir system
10984 set sys/ndir.h i_sysndir
10985 eval $inhdr
10986
10987 : Look for dirfd
10988 echo " "
10989 $cat >dirfd.c <<EOM
10990 #include <stdio.h>
10991 #$i_stdlib I_STDLIB
10992 #ifdef I_STDLIB
10993 #include <stdlib.h>
10994 #endif
10995 #$i_dirent I_DIRENT             /**/
10996 #$i_sysdir I_SYS_DIR            /**/
10997 #$i_sysndir I_SYS_NDIR          /**/
10998 #$i_systypes I_SYS_TYPES        /**/
10999 #if defined(I_SYS_TYPES)
11000 #include <sys/types.h>
11001 #endif
11002 #if defined(I_DIRENT)
11003 #include <dirent.h>
11004 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11005 #include <sys/dir.h>
11006 #endif
11007 #else
11008 #ifdef I_SYS_NDIR
11009 #include <sys/ndir.h>
11010 #else
11011 #ifdef I_SYS_DIR
11012 #ifdef hp9000s500
11013 #include <ndir.h>       /* may be wrong in the future */
11014 #else
11015 #include <sys/dir.h>
11016 #endif
11017 #endif
11018 #endif
11019 #endif 
11020 int main() {
11021         DIR *dirp = opendir(".");
11022         if (dirfd(dirp) >= 0)
11023                 exit(0);
11024         else
11025                 exit(1);
11026 }
11027 EOM
11028 set dirfd
11029 if eval $compile; then
11030         val="$define"
11031 fi
11032 case "$val" in
11033 $define)        echo "dirfd() found." >&4       ;;
11034 *)              echo "dirfd() NOT found." >&4   ;;
11035 esac
11036 set d_dirfd
11037 eval $setvar
11038 $rm -f dirfd*
11039
11040 : see if dlerror exists
11041 xxx_runnm="$runnm"
11042 runnm=false
11043 set dlerror d_dlerror
11044 eval $inlibc
11045 runnm="$xxx_runnm"
11046
11047 : see if dlfcn is available
11048 set dlfcn.h i_dlfcn
11049 eval $inhdr
11050
11051 case "$usedl" in
11052 $define|y|true)
11053         $cat << EOM
11054
11055 On a few systems, the dynamically loaded modules that perl generates and uses
11056 will need a different extension than shared libs. The default will probably
11057 be appropriate.
11058
11059 EOM
11060         case "$dlext" in
11061         '')     dflt="$so" ;;
11062         *)      dflt="$dlext" ;;
11063         esac
11064         rp='What is the extension of dynamically loaded modules'
11065         . ./myread
11066         dlext="$ans"
11067         ;;
11068 *)
11069         dlext="none"
11070         ;;
11071 esac
11072
11073 : Check if dlsym need a leading underscore
11074 echo " "
11075 val="$undef"
11076
11077 case "$dlsrc" in
11078 dl_dlopen.xs)
11079         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11080         $cat >dyna.c <<'EOM'
11081 fred () { }
11082 EOM
11083
11084 $cat >fred.c<<EOM
11085
11086 #include <stdio.h>
11087 #$i_stdlib I_STDLIB
11088 #ifdef I_STDLIB
11089 #include <stdlib.h>
11090 #endif
11091 #$i_dlfcn I_DLFCN
11092 #ifdef I_DLFCN
11093 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11094 #else
11095 #include <sys/types.h>
11096 #include <nlist.h>
11097 #include <link.h>
11098 #endif
11099
11100 extern int fred() ;
11101
11102 int main()
11103 {
11104     void * handle ;
11105     void * symbol ;
11106 #ifndef RTLD_LAZY
11107     int mode = 1 ;
11108 #else
11109     int mode = RTLD_LAZY ;
11110 #endif
11111     handle = dlopen("./dyna.$dlext", mode) ;
11112     if (handle == NULL) {
11113         printf ("1\n") ;
11114         fflush (stdout) ;
11115         exit(0);
11116     }
11117     symbol = dlsym(handle, "fred") ;
11118     if (symbol == NULL) {
11119         /* try putting a leading underscore */
11120         symbol = dlsym(handle, "_fred") ;
11121         if (symbol == NULL) {
11122             printf ("2\n") ;
11123             fflush (stdout) ;
11124             exit(0);
11125         }
11126         printf ("3\n") ;
11127     }
11128     else
11129         printf ("4\n") ;
11130     fflush (stdout) ;
11131     exit(0);
11132 }
11133 EOM
11134         : Call the object file tmp-dyna.o in case dlext=o.
11135         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
11136                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
11137                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
11138                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11139                 xxx=`$run ./fred`
11140                 case $xxx in
11141                 1)      echo "Test program failed using dlopen." >&4
11142                         echo "Perhaps you should not use dynamic loading." >&4;;
11143                 2)      echo "Test program failed using dlsym." >&4
11144                         echo "Perhaps you should not use dynamic loading." >&4;;
11145                 3)      echo "dlsym needs a leading underscore" >&4
11146                         val="$define" ;;
11147                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11148                 esac
11149         else
11150                 echo "I can't compile and run the test program." >&4
11151                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11152         fi
11153         ;;
11154 esac
11155                 
11156 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11157
11158 set d_dlsymun
11159 eval $setvar
11160
11161 : see if drand48_r exists
11162 set drand48_r d_drand48_r
11163 eval $inlibc
11164 case "$d_drand48_r" in
11165 "$define")
11166         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11167         case "$d_drand48_r_proto:$usethreads" in
11168         ":define")      d_drand48_r_proto=define
11169                 set d_drand48_r_proto drand48_r $hdrs
11170                 eval $hasproto ;;
11171         *)      ;;
11172         esac
11173         case "$d_drand48_r_proto" in
11174         define)
11175         case "$drand48_r_proto" in
11176         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11177         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11178         esac
11179         case "$drand48_r_proto" in
11180         ''|0)   d_drand48_r=undef
11181                 drand48_r_proto=0
11182                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11183         * )     case "$drand48_r_proto" in
11184                 REENTRANT_PROTO*) ;;
11185                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11186                 esac
11187                 echo "Prototype: $try" ;;
11188         esac
11189         ;;
11190         *)      case "$usethreads" in
11191                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11192                 esac
11193                 d_drand48_r=undef
11194                 drand48_r_proto=0
11195                 ;;
11196         esac
11197         ;;
11198 *)      drand48_r_proto=0
11199         ;;
11200 esac
11201
11202 : see if prototype for drand48 is available
11203 echo " "
11204 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11205 eval $hasproto
11206
11207 : see if dup2 exists
11208 set dup2 d_dup2
11209 eval $inlibc
11210
11211 : see if eaccess exists
11212 set eaccess d_eaccess
11213 eval $inlibc
11214
11215 : see if endgrent exists
11216 set endgrent d_endgrent
11217 eval $inlibc
11218
11219 : see if this is an grp system
11220 set grp.h i_grp
11221 eval $inhdr
11222
11223 case "$i_grp" in
11224 $define)
11225         xxx=`./findhdr grp.h`
11226         $cppstdin $cppflags $cppminus < $xxx >$$.h
11227
11228         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11229                 val="$define"
11230         else
11231                 val="$undef"
11232         fi
11233         set d_grpasswd
11234         eval $setvar
11235
11236         $rm -f $$.h
11237         ;;
11238 *)
11239         val="$undef";
11240         set d_grpasswd; eval $setvar
11241         ;;
11242 esac
11243
11244 : see if endgrent_r exists
11245 set endgrent_r d_endgrent_r
11246 eval $inlibc
11247 case "$d_endgrent_r" in
11248 "$define")
11249         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11250         case "$d_endgrent_r_proto:$usethreads" in
11251         ":define")      d_endgrent_r_proto=define
11252                 set d_endgrent_r_proto endgrent_r $hdrs
11253                 eval $hasproto ;;
11254         *)      ;;
11255         esac
11256         case "$d_endgrent_r_proto" in
11257         define)
11258         case "$endgrent_r_proto" in
11259         ''|0) try='int endgrent_r(FILE**);'
11260         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11261         esac
11262         case "$endgrent_r_proto" in
11263         ''|0) try='void endgrent_r(FILE**);'
11264         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11265         esac
11266         case "$endgrent_r_proto" in
11267         ''|0)   d_endgrent_r=undef
11268                 endgrent_r_proto=0
11269                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11270         * )     case "$endgrent_r_proto" in
11271                 REENTRANT_PROTO*) ;;
11272                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11273                 esac
11274                 echo "Prototype: $try" ;;
11275         esac
11276         ;;
11277         *)      case "$usethreads" in
11278                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11279                 esac
11280                 d_endgrent_r=undef
11281                 endgrent_r_proto=0
11282                 ;;
11283         esac
11284         ;;
11285 *)      endgrent_r_proto=0
11286         ;;
11287 esac
11288
11289 : see if endhostent exists
11290 set endhostent d_endhent
11291 eval $inlibc
11292
11293 : see if this is a netdb.h system
11294 set netdb.h i_netdb
11295 eval $inhdr
11296
11297 : see if endhostent_r exists
11298 set endhostent_r d_endhostent_r
11299 eval $inlibc
11300 case "$d_endhostent_r" in
11301 "$define")
11302         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11303         case "$d_endhostent_r_proto:$usethreads" in
11304         ":define")      d_endhostent_r_proto=define
11305                 set d_endhostent_r_proto endhostent_r $hdrs
11306                 eval $hasproto ;;
11307         *)      ;;
11308         esac
11309         case "$d_endhostent_r_proto" in
11310         define)
11311         case "$endhostent_r_proto" in
11312         ''|0) try='int endhostent_r(struct hostent_data*);'
11313         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11314         esac
11315         case "$endhostent_r_proto" in
11316         ''|0) try='void endhostent_r(struct hostent_data*);'
11317         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11318         esac
11319         case "$endhostent_r_proto" in
11320         ''|0)   d_endhostent_r=undef
11321                 endhostent_r_proto=0
11322                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11323         * )     case "$endhostent_r_proto" in
11324                 REENTRANT_PROTO*) ;;
11325                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11326                 esac
11327                 echo "Prototype: $try" ;;
11328         esac
11329         ;;
11330         *)      case "$usethreads" in
11331                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11332                 esac
11333                 d_endhostent_r=undef
11334                 endhostent_r_proto=0
11335                 ;;
11336         esac
11337         ;;
11338 *)      endhostent_r_proto=0
11339         ;;
11340 esac
11341
11342 : see if endnetent exists
11343 set endnetent d_endnent
11344 eval $inlibc
11345
11346 : see if endnetent_r exists
11347 set endnetent_r d_endnetent_r
11348 eval $inlibc
11349 case "$d_endnetent_r" in
11350 "$define")
11351         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11352         case "$d_endnetent_r_proto:$usethreads" in
11353         ":define")      d_endnetent_r_proto=define
11354                 set d_endnetent_r_proto endnetent_r $hdrs
11355                 eval $hasproto ;;
11356         *)      ;;
11357         esac
11358         case "$d_endnetent_r_proto" in
11359         define)
11360         case "$endnetent_r_proto" in
11361         ''|0) try='int endnetent_r(struct netent_data*);'
11362         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11363         esac
11364         case "$endnetent_r_proto" in
11365         ''|0) try='void endnetent_r(struct netent_data*);'
11366         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11367         esac
11368         case "$endnetent_r_proto" in
11369         ''|0)   d_endnetent_r=undef
11370                 endnetent_r_proto=0
11371                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11372         * )     case "$endnetent_r_proto" in
11373                 REENTRANT_PROTO*) ;;
11374                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11375                 esac
11376                 echo "Prototype: $try" ;;
11377         esac
11378         ;;
11379         *)      case "$usethreads" in
11380                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11381                 esac
11382                 d_endnetent_r=undef
11383                 endnetent_r_proto=0
11384                 ;;
11385         esac
11386         ;;
11387 *)      endnetent_r_proto=0
11388         ;;
11389 esac
11390
11391 : see if endprotoent exists
11392 set endprotoent d_endpent
11393 eval $inlibc
11394
11395 : see if endprotoent_r exists
11396 set endprotoent_r d_endprotoent_r
11397 eval $inlibc
11398 case "$d_endprotoent_r" in
11399 "$define")
11400         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11401         case "$d_endprotoent_r_proto:$usethreads" in
11402         ":define")      d_endprotoent_r_proto=define
11403                 set d_endprotoent_r_proto endprotoent_r $hdrs
11404                 eval $hasproto ;;
11405         *)      ;;
11406         esac
11407         case "$d_endprotoent_r_proto" in
11408         define)
11409         case "$endprotoent_r_proto" in
11410         ''|0) try='int endprotoent_r(struct protoent_data*);'
11411         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11412         esac
11413         case "$endprotoent_r_proto" in
11414         ''|0) try='void endprotoent_r(struct protoent_data*);'
11415         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11416         esac
11417         case "$endprotoent_r_proto" in
11418         ''|0)   d_endprotoent_r=undef
11419                 endprotoent_r_proto=0
11420                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11421         * )     case "$endprotoent_r_proto" in
11422                 REENTRANT_PROTO*) ;;
11423                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11424                 esac
11425                 echo "Prototype: $try" ;;
11426         esac
11427         ;;
11428         *)      case "$usethreads" in
11429                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11430                 esac
11431                 d_endprotoent_r=undef
11432                 endprotoent_r_proto=0
11433                 ;;
11434         esac
11435         ;;
11436 *)      endprotoent_r_proto=0
11437         ;;
11438 esac
11439
11440 : see if endpwent exists
11441 set endpwent d_endpwent
11442 eval $inlibc
11443
11444 : see if this is a pwd.h system
11445 set pwd.h i_pwd
11446 eval $inhdr
11447
11448 case "$i_pwd" in
11449 $define)
11450         xxx=`./findhdr pwd.h`
11451         $cppstdin $cppflags $cppminus < $xxx >$$.h
11452
11453         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11454                 val="$define"
11455         else
11456                 val="$undef"
11457         fi
11458         set d_pwquota
11459         eval $setvar
11460
11461         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11462                 val="$define"
11463         else
11464                 val="$undef"
11465         fi
11466         set d_pwage
11467         eval $setvar
11468
11469         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11470                 val="$define"
11471         else
11472                 val="$undef"
11473         fi
11474         set d_pwchange
11475         eval $setvar
11476
11477         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11478                 val="$define"
11479         else
11480                 val="$undef"
11481         fi
11482         set d_pwclass
11483         eval $setvar
11484
11485         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11486                 val="$define"
11487         else
11488                 val="$undef"
11489         fi
11490         set d_pwexpire
11491         eval $setvar
11492
11493         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11494                 val="$define"
11495         else
11496                 val="$undef"
11497         fi
11498         set d_pwcomment
11499         eval $setvar
11500
11501         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11502                 val="$define"
11503         else
11504                 val="$undef"
11505         fi
11506         set d_pwgecos
11507         eval $setvar
11508
11509         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11510                 val="$define"
11511         else
11512                 val="$undef"
11513         fi
11514         set d_pwpasswd
11515         eval $setvar
11516
11517         $rm -f $$.h
11518         ;;
11519 *)
11520         val="$undef"; 
11521         set d_pwquota; eval $setvar
11522         set d_pwage; eval $setvar
11523         set d_pwchange; eval $setvar
11524         set d_pwclass; eval $setvar
11525         set d_pwexpire; eval $setvar
11526         set d_pwcomment; eval $setvar
11527         set d_pwgecos; eval $setvar
11528         set d_pwpasswd; eval $setvar
11529         ;;
11530 esac
11531
11532 : see if endpwent_r exists
11533 set endpwent_r d_endpwent_r
11534 eval $inlibc
11535 case "$d_endpwent_r" in
11536 "$define")
11537         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11538         case "$d_endpwent_r_proto:$usethreads" in
11539         ":define")      d_endpwent_r_proto=define
11540                 set d_endpwent_r_proto endpwent_r $hdrs
11541                 eval $hasproto ;;
11542         *)      ;;
11543         esac
11544         case "$d_endpwent_r_proto" in
11545         define)
11546         case "$endpwent_r_proto" in
11547         ''|0) try='int endpwent_r(FILE**);'
11548         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11549         esac
11550         case "$endpwent_r_proto" in
11551         ''|0) try='void endpwent_r(FILE**);'
11552         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11553         esac
11554         case "$endpwent_r_proto" in
11555         ''|0)   d_endpwent_r=undef
11556                 endpwent_r_proto=0
11557                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
11558         * )     case "$endpwent_r_proto" in
11559                 REENTRANT_PROTO*) ;;
11560                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11561                 esac
11562                 echo "Prototype: $try" ;;
11563         esac
11564         ;;
11565         *)      case "$usethreads" in
11566                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11567                 esac
11568                 d_endpwent_r=undef
11569                 endpwent_r_proto=0
11570                 ;;
11571         esac
11572         ;;
11573 *)      endpwent_r_proto=0
11574         ;;
11575 esac
11576
11577 : see if endservent exists
11578 set endservent d_endsent
11579 eval $inlibc
11580
11581 : see if endservent_r exists
11582 set endservent_r d_endservent_r
11583 eval $inlibc
11584 case "$d_endservent_r" in
11585 "$define")
11586         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11587         case "$d_endservent_r_proto:$usethreads" in
11588         ":define")      d_endservent_r_proto=define
11589                 set d_endservent_r_proto endservent_r $hdrs
11590                 eval $hasproto ;;
11591         *)      ;;
11592         esac
11593         case "$d_endservent_r_proto" in
11594         define)
11595         case "$endservent_r_proto" in
11596         ''|0) try='int endservent_r(struct servent_data*);'
11597         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
11598         esac
11599         case "$endservent_r_proto" in
11600         ''|0) try='void endservent_r(struct servent_data*);'
11601         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
11602         esac
11603         case "$endservent_r_proto" in
11604         ''|0)   d_endservent_r=undef
11605                 endservent_r_proto=0
11606                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
11607         * )     case "$endservent_r_proto" in
11608                 REENTRANT_PROTO*) ;;
11609                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11610                 esac
11611                 echo "Prototype: $try" ;;
11612         esac
11613         ;;
11614         *)      case "$usethreads" in
11615                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11616                 esac
11617                 d_endservent_r=undef
11618                 endservent_r_proto=0
11619                 ;;
11620         esac
11621         ;;
11622 *)      endservent_r_proto=0
11623         ;;
11624 esac
11625
11626 : Locate the flags for 'open()'
11627 echo " "
11628 $cat >try.c <<EOCP
11629 #include <sys/types.h>
11630 #ifdef I_FCNTL
11631 #include <fcntl.h>
11632 #endif
11633 #ifdef I_SYS_FILE
11634 #include <sys/file.h>
11635 #endif
11636 #$i_stdlib I_STDLIB
11637 #ifdef I_STDLIB
11638 #include <stdlib.h>
11639 #endif
11640 int main() {
11641         if(O_RDONLY);
11642 #ifdef O_TRUNC
11643         exit(0);
11644 #else
11645         exit(1);
11646 #endif
11647 }
11648 EOCP
11649 : check sys/file.h first to get FREAD on Sun
11650 if $test `./findhdr sys/file.h` && \
11651                 set try -DI_SYS_FILE && eval $compile; then
11652         h_sysfile=true;
11653         echo "<sys/file.h> defines the O_* constants..." >&4
11654         if $run ./try; then
11655                 echo "and you have the 3 argument form of open()." >&4
11656                 val="$define"
11657         else
11658                 echo "but not the 3 argument form of open().  Oh, well." >&4
11659                 val="$undef"
11660         fi
11661 elif $test `./findhdr fcntl.h` && \
11662                 set try -DI_FCNTL && eval $compile; then
11663         h_fcntl=true;
11664         echo "<fcntl.h> defines the O_* constants..." >&4
11665         if $run ./try; then
11666                 echo "and you have the 3 argument form of open()." >&4
11667                 val="$define"
11668         else
11669                 echo "but not the 3 argument form of open().  Oh, well." >&4
11670                 val="$undef"
11671         fi
11672 else
11673         val="$undef"
11674         echo "I can't find the O_* constant definitions!  You got problems." >&4
11675 fi
11676 set d_open3
11677 eval $setvar
11678 $rm -f try try.*
11679
11680 : see which of string.h or strings.h is needed
11681 echo " "
11682 strings=`./findhdr string.h`
11683 if $test "$strings" && $test -r "$strings"; then
11684         echo "Using <string.h> instead of <strings.h>." >&4
11685         val="$define"
11686 else
11687         val="$undef"
11688         strings=`./findhdr strings.h`
11689         if $test "$strings" && $test -r "$strings"; then
11690                 echo "Using <strings.h> instead of <string.h>." >&4
11691         else
11692                 echo "No string header found -- You'll surely have problems." >&4
11693         fi
11694 fi
11695 set i_string
11696 eval $setvar
11697 case "$i_string" in
11698 "$undef") strings=`./findhdr strings.h`;;
11699 *)        strings=`./findhdr string.h`;;
11700 esac
11701
11702 : see if this is a sys/file.h system
11703 val=''
11704 set sys/file.h val
11705 eval $inhdr
11706
11707 : do we need to include sys/file.h ?
11708 case "$val" in
11709 "$define")
11710         echo " "
11711         if $h_sysfile; then
11712                 val="$define"
11713                 echo "We'll be including <sys/file.h>." >&4
11714         else
11715                 val="$undef"
11716                 echo "We won't be including <sys/file.h>." >&4
11717         fi
11718         ;;
11719 *)
11720         h_sysfile=false
11721         ;;
11722 esac
11723 set i_sysfile
11724 eval $setvar
11725
11726 : see if fcntl.h is there
11727 val=''
11728 set fcntl.h val
11729 eval $inhdr
11730
11731 : see if we can include fcntl.h
11732 case "$val" in
11733 "$define")
11734         echo " "
11735         if $h_fcntl; then
11736                 val="$define"
11737                 echo "We'll be including <fcntl.h>." >&4
11738         else
11739                 val="$undef"
11740                 if $h_sysfile; then
11741         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11742                 else
11743                         echo "We won't be including <fcntl.h>." >&4
11744                 fi
11745         fi
11746         ;;
11747 *)
11748         h_fcntl=false
11749         val="$undef"
11750         ;;
11751 esac
11752 set i_fcntl
11753 eval $setvar
11754
11755 : check for non-blocking I/O stuff
11756 case "$h_sysfile" in
11757 true) echo "#include <sys/file.h>" > head.c;;
11758 *)
11759        case "$h_fcntl" in
11760        true) echo "#include <fcntl.h>" > head.c;;
11761        *) echo "#include <sys/fcntl.h>" > head.c;;
11762        esac
11763        ;;
11764 esac
11765 echo " "
11766 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11767 case "$o_nonblock" in
11768 '')
11769         $cat head.c > try.c
11770         $cat >>try.c <<EOCP
11771 #include <stdio.h>
11772 #$i_stdlib I_STDLIB
11773 #ifdef I_STDLIB
11774 #include <stdlib.h>
11775 #endif
11776 #$i_fcntl I_FCNTL
11777 #ifdef I_FCNTL
11778 #include <fcntl.h>
11779 #endif
11780 int main() {
11781 #ifdef O_NONBLOCK
11782         printf("O_NONBLOCK\n");
11783         exit(0);
11784 #endif
11785 #ifdef O_NDELAY
11786         printf("O_NDELAY\n");
11787         exit(0);
11788 #endif
11789 #ifdef FNDELAY
11790         printf("FNDELAY\n");
11791         exit(0);
11792 #endif
11793         exit(0);
11794 }
11795 EOCP
11796         set try
11797         if eval $compile_ok; then
11798                 o_nonblock=`$run ./try`
11799                 case "$o_nonblock" in
11800                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11801                 *) echo "Seems like we can use $o_nonblock.";;
11802                 esac
11803         else
11804                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11805         fi
11806         ;;
11807 *) echo "Using $hint value $o_nonblock.";;
11808 esac
11809 $rm -f try try.* .out core
11810
11811 echo " "
11812 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11813 case "$eagain" in
11814 '')
11815         $cat head.c > try.c
11816         $cat >>try.c <<EOCP
11817 #include <errno.h>
11818 #include <sys/types.h>
11819 #include <signal.h>
11820 #include <stdio.h> 
11821 #$i_stdlib I_STDLIB
11822 #ifdef I_STDLIB
11823 #include <stdlib.h>
11824 #endif
11825 #$i_fcntl I_FCNTL
11826 #ifdef I_FCNTL
11827 #include <fcntl.h>
11828 #endif
11829 #define MY_O_NONBLOCK $o_nonblock
11830 #ifndef errno  /* XXX need better Configure test */
11831 extern int errno;
11832 #endif
11833 #$i_unistd I_UNISTD
11834 #ifdef I_UNISTD
11835 #include <unistd.h>
11836 #endif
11837 #$i_string I_STRING
11838 #ifdef I_STRING
11839 #include <string.h>
11840 #else
11841 #include <strings.h>
11842 #endif
11843 $signal_t blech(x) int x; { exit(3); }
11844 EOCP
11845         $cat >> try.c <<'EOCP'
11846 int main()
11847 {
11848         int pd[2];
11849         int pu[2];
11850         char buf[1];
11851         char string[100];
11852
11853         pipe(pd);       /* Down: child -> parent */
11854         pipe(pu);       /* Up: parent -> child */
11855         if (0 != fork()) {
11856                 int ret;
11857                 close(pd[1]);   /* Parent reads from pd[0] */
11858                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11859 #ifdef F_SETFL
11860                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11861                         exit(1);
11862 #else
11863                 exit(4);
11864 #endif
11865                 signal(SIGALRM, blech);
11866                 alarm(5);
11867                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11868                         exit(2);
11869                 sprintf(string, "%d\n", ret);
11870                 write(2, string, strlen(string));
11871                 alarm(0);
11872 #ifdef EAGAIN
11873                 if (errno == EAGAIN) {
11874                         printf("EAGAIN\n");
11875                         goto ok;
11876                 }
11877 #endif
11878 #ifdef EWOULDBLOCK
11879                 if (errno == EWOULDBLOCK)
11880                         printf("EWOULDBLOCK\n");
11881 #endif
11882         ok:
11883                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11884                 sleep(2);                               /* Give it time to close our pipe */
11885                 alarm(5);
11886                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11887                 alarm(0);
11888                 sprintf(string, "%d\n", ret);
11889                 write(4, string, strlen(string));
11890                 exit(0);
11891         }
11892
11893         close(pd[0]);                   /* We write to pd[1] */
11894         close(pu[1]);                   /* We read from pu[0] */
11895         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11896         close(pd[1]);                   /* Pipe pd is now fully closed! */
11897         exit(0);                                /* Bye bye, thank you for playing! */
11898 }
11899 EOCP
11900         set try
11901         if eval $compile_ok; then
11902                 echo "$startsh" >mtry
11903                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11904                 chmod +x mtry
11905                 ./mtry >/dev/null 2>&1
11906                 case $? in
11907                 0) eagain=`$cat try.out`;;
11908                 1) echo "Could not perform non-blocking setting!";;
11909                 2) echo "I did a successful read() for something that was not there!";;
11910                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
11911                 4) echo "Could not find F_SETFL!";;
11912                 *) echo "Something terribly wrong happened during testing.";;
11913                 esac
11914                 rd_nodata=`$cat try.ret`
11915                 echo "A read() system call with no data present returns $rd_nodata."
11916                 case "$rd_nodata" in
11917                 0|-1) ;;
11918                 *)
11919                         echo "(That's peculiar, fixing that to be -1.)"
11920                         rd_nodata=-1
11921                         ;;
11922                 esac
11923                 case "$eagain" in
11924                 '')
11925                         echo "Forcing errno EAGAIN on read() with no data available."
11926                         eagain=EAGAIN
11927                         ;;
11928                 *)
11929                         echo "Your read() sets errno to $eagain when no data is available."
11930                         ;;
11931                 esac
11932                 status=`$cat try.err`
11933                 case "$status" in
11934                 0) echo "And it correctly returns 0 to signal EOF.";;
11935                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11936                 *) echo "However, your read() returns '$status' on EOF??";;
11937                 esac
11938                 val="$define"
11939                 if test "$status" = "$rd_nodata"; then
11940                         echo "WARNING: you can't distinguish between EOF and no data!"
11941                         val="$undef"
11942                 fi
11943         else
11944                 echo "I can't compile the test program--assuming errno EAGAIN will do."
11945                 eagain=EAGAIN
11946         fi
11947         set d_eofnblk
11948         eval $setvar
11949         ;;
11950 *)
11951         echo "Using $hint value $eagain."
11952         echo "Your read() returns $rd_nodata when no data is present."
11953         case "$d_eofnblk" in
11954         "$define") echo "And you can see EOF because read() returns 0.";;
11955         "$undef") echo "But you can't see EOF status from read() returned value.";;
11956         *)
11957                 echo "(Assuming you can't see EOF status from read anyway.)"
11958                 d_eofnblk=$undef
11959                 ;;
11960         esac
11961         ;;
11962 esac
11963 $rm -f try try.* .out core head.c mtry
11964
11965 : see if _ptr and _cnt from stdio act std
11966 echo " "
11967
11968 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11969         echo "(Looks like you have stdio.h from BSD.)"
11970         case "$stdio_ptr" in
11971         '') stdio_ptr='((fp)->_p)'
11972                 ptr_lval=$define
11973                 ;;
11974         *)      ptr_lval=$d_stdio_ptr_lval;;
11975         esac
11976         case "$stdio_cnt" in
11977         '') stdio_cnt='((fp)->_r)'
11978                 cnt_lval=$define
11979                 ;;
11980         *)      cnt_lval=$d_stdio_cnt_lval;;
11981         esac
11982         case "$stdio_base" in
11983         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
11984         esac
11985         case "$stdio_bufsiz" in
11986         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
11987         esac
11988 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11989         echo "(Looks like you have stdio.h from Linux.)"
11990         case "$stdio_ptr" in
11991         '') stdio_ptr='((fp)->_IO_read_ptr)'
11992                 ptr_lval=$define
11993                 ;;
11994         *)      ptr_lval=$d_stdio_ptr_lval;;
11995         esac
11996         case "$stdio_cnt" in
11997         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11998                 cnt_lval=$undef
11999                 ;;
12000         *)      cnt_lval=$d_stdio_cnt_lval;;
12001         esac
12002         case "$stdio_base" in
12003         '') stdio_base='((fp)->_IO_read_base)';;
12004         esac
12005         case "$stdio_bufsiz" in
12006         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12007         esac
12008 else
12009         case "$stdio_ptr" in
12010         '') stdio_ptr='((fp)->_ptr)'
12011                 ptr_lval=$define
12012                 ;;
12013         *)      ptr_lval=$d_stdio_ptr_lval;;
12014         esac
12015         case "$stdio_cnt" in
12016         '') stdio_cnt='((fp)->_cnt)'
12017                 cnt_lval=$define
12018                 ;;
12019         *)      cnt_lval=$d_stdio_cnt_lval;;
12020         esac
12021         case "$stdio_base" in
12022         '') stdio_base='((fp)->_base)';;
12023         esac
12024         case "$stdio_bufsiz" in
12025         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12026         esac
12027 fi
12028
12029 : test whether _ptr and _cnt really work
12030 echo "Checking how std your stdio is..." >&4
12031 $cat >try.c <<EOP
12032 #include <stdio.h>
12033 #$i_stdlib I_STDLIB
12034 #ifdef I_STDLIB
12035 #include <stdlib.h>
12036 #endif
12037 #define FILE_ptr(fp)    $stdio_ptr
12038 #define FILE_cnt(fp)    $stdio_cnt
12039 int main() {
12040         FILE *fp = fopen("try.c", "r");
12041         char c = getc(fp);
12042         if (
12043                 18 <= FILE_cnt(fp) &&
12044                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12045         )
12046                 exit(0);
12047         exit(1);
12048 }
12049 EOP
12050 val="$undef"
12051 set try
12052 if eval $compile && $to try.c; then
12053         if $run ./try; then
12054                 echo "Your stdio acts pretty std."
12055                 val="$define"
12056         else
12057                 echo "Your stdio isn't very std."
12058         fi
12059 else
12060         echo "Your stdio doesn't appear very std."
12061 fi
12062 $rm -f try.c try
12063
12064 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12065 # direct buffer manipulation no longer works.  The Configure tests
12066 # should be changed to correctly detect this, but until then,
12067 # the following check should at least let perl compile and run.
12068 # (This quick fix should be updated before 5.8.1.)
12069 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12070 # A. Dougherty, June 3, 2002.
12071 case "$d_gnulibc" in
12072 $define)
12073         case "$gnulibc_version" in
12074         2.[01]*)  ;;
12075         2.2) ;;
12076         2.2.[0-9]) ;;
12077         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12078                 val="$undef"
12079                 ;;
12080         esac
12081         ;;
12082 esac
12083 set d_stdstdio
12084 eval $setvar
12085
12086 : Can _ptr be used as an lvalue?
12087 case "$d_stdstdio$ptr_lval" in
12088 $define$define) val=$define ;;
12089 *) val=$undef ;;
12090 esac
12091 set d_stdio_ptr_lval
12092 eval $setvar
12093
12094 : Can _cnt be used as an lvalue?
12095 case "$d_stdstdio$cnt_lval" in
12096 $define$define) val=$define ;;
12097 *) val=$undef ;;
12098 esac
12099 set d_stdio_cnt_lval
12100 eval $setvar
12101
12102
12103 : test whether setting _ptr sets _cnt as a side effect
12104 d_stdio_ptr_lval_sets_cnt="$undef"
12105 d_stdio_ptr_lval_nochange_cnt="$undef"
12106 case "$d_stdio_ptr_lval$d_stdstdio" in
12107 $define$define)
12108         echo "Checking to see what happens if we set the stdio ptr..." >&4
12109 $cat >try.c <<EOP
12110 #include <stdio.h>
12111 /* Can we scream? */
12112 /* Eat dust sed :-) */
12113 /* In the buffer space, no one can hear you scream. */
12114 #$i_stdlib I_STDLIB
12115 #ifdef I_STDLIB
12116 #include <stdlib.h>
12117 #endif
12118 #define FILE_ptr(fp)    $stdio_ptr
12119 #define FILE_cnt(fp)    $stdio_cnt
12120 #include <sys/types.h>
12121 int main() {
12122         FILE *fp = fopen("try.c", "r");
12123         int c;
12124         char *ptr;
12125         size_t cnt;
12126         if (!fp) {
12127             puts("Fail even to read");
12128             exit(1);
12129         }
12130         c = getc(fp); /* Read away the first # */
12131         if (c == EOF) {
12132             puts("Fail even to read");
12133             exit(1);
12134         }
12135         if (!(
12136                 18 <= FILE_cnt(fp) &&
12137                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12138         )) {
12139                 puts("Fail even to read");
12140                 exit (1);
12141         }
12142         ptr = (char*) FILE_ptr(fp);
12143         cnt = (size_t)FILE_cnt(fp);
12144
12145         FILE_ptr(fp) += 42;
12146
12147         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12148                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12149                 exit (1);
12150         }
12151         if (FILE_cnt(fp) <= 20) {
12152                 printf ("Fail (<20 chars to test)");
12153                 exit (1);
12154         }
12155         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12156                 puts("Fail compare");
12157                 exit (1);
12158         }
12159         if (cnt == FILE_cnt(fp)) {
12160                 puts("Pass_unchanged");
12161                 exit (0);
12162         }       
12163         if (FILE_cnt(fp) == (cnt - 42)) {
12164                 puts("Pass_changed");
12165                 exit (0);
12166         }
12167         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12168         return 1;
12169
12170 }
12171 EOP
12172         set try
12173         if eval $compile && $to try.c; then
12174                 case `$run ./try` in
12175                 Pass_changed)
12176                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12177                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12178                 Pass_unchanged)
12179                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12180                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12181                 Fail*)
12182                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12183                 *)
12184                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12185         esac
12186         else
12187                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12188         fi
12189         $rm -f try.c try
12190         ;;
12191 esac
12192
12193 : see if _base is also standard
12194 val="$undef"
12195 case "$d_stdstdio" in
12196 $define)
12197         $cat >try.c <<EOP
12198 #include <stdio.h>
12199 #$i_stdlib I_STDLIB
12200 #ifdef I_STDLIB
12201 #include <stdlib.h>
12202 #endif
12203 #define FILE_base(fp)   $stdio_base
12204 #define FILE_bufsiz(fp) $stdio_bufsiz
12205 int main() {
12206         FILE *fp = fopen("try.c", "r");
12207         char c = getc(fp);
12208         if (
12209                 19 <= FILE_bufsiz(fp) &&
12210                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12211         )
12212                 exit(0);
12213         exit(1);
12214 }
12215 EOP
12216         set try
12217         if eval $compile && $to try.c; then
12218                 if $run ./try; then
12219                         echo "And its _base field acts std."
12220                         val="$define"
12221                 else
12222                         echo "But its _base field isn't std."
12223                 fi
12224         else
12225                 echo "However, it seems to be lacking the _base field."
12226         fi
12227         $rm -f try.c try
12228         ;;
12229 esac
12230 set d_stdiobase
12231 eval $setvar
12232
12233 : see if fast_stdio exists
12234 val="$undef"
12235 case "$d_stdstdio:$d_stdio_ptr_lval" in
12236 "$define:$define")
12237         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12238         *$define*)
12239                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12240                 val="$define"
12241                 ;;
12242         esac
12243         ;;
12244 esac
12245 set d_faststdio
12246 eval $setvar
12247
12248
12249
12250 : see if fchdir exists
12251 set fchdir d_fchdir
12252 eval $inlibc
12253
12254 : see if fchmod exists
12255 set fchmod d_fchmod
12256 eval $inlibc
12257
12258 : see if fchown exists
12259 set fchown d_fchown
12260 eval $inlibc
12261
12262 : see if this is an fcntl system
12263 set fcntl d_fcntl
12264 eval $inlibc
12265
12266 echo " "
12267 : See if fcntl-based locking works.
12268 $cat >try.c <<EOCP
12269 #$i_stdlib I_STDLIB
12270 #ifdef I_STDLIB
12271 #include <stdlib.h>
12272 #endif
12273 #include <unistd.h>
12274 #include <fcntl.h>
12275 #include <signal.h>
12276 $signal_t blech(x) int x; { exit(3); }
12277 int main() {
12278 #if defined(F_SETLK) && defined(F_SETLKW)
12279      struct flock flock;
12280      int retval, fd;
12281      fd = open("try.c", O_RDONLY);
12282      flock.l_type = F_RDLCK;
12283      flock.l_whence = SEEK_SET;
12284      flock.l_start = flock.l_len = 0;
12285      signal(SIGALRM, blech);
12286      alarm(10);
12287      retval = fcntl(fd, F_SETLK, &flock);
12288      close(fd);
12289      (retval < 0 ? exit(2) : exit(0));
12290 #else
12291      exit(2);
12292 #endif
12293 }
12294 EOCP
12295 echo "Checking if fcntl-based file locking works... "
12296 case "$d_fcntl" in
12297 "$define")
12298         set try
12299         if eval $compile_ok; then
12300                 if $run ./try; then
12301                         echo "Yes, it seems to work."
12302                         val="$define"
12303                 else
12304                         echo "Nope, it didn't work."
12305                         val="$undef"
12306                         case "$?" in
12307                         3) $cat >&4 <<EOM
12308 ***
12309 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12310 *** This is (almost) impossible.
12311 *** If your NFS lock daemons are not feeling well, something like
12312 *** this may happen, please investigate.  Cannot continue, aborting.
12313 ***
12314 EOM
12315                                 exit 1
12316                                 ;;
12317                         esac
12318                 fi
12319         else
12320                 echo "I'm unable to compile the test program, so I'll assume not."
12321                 val="$undef"
12322         fi
12323         ;;
12324 *) val="$undef";
12325         echo "Nope, since you don't even have fcntl()."
12326         ;;
12327 esac
12328 set d_fcntl_can_lock
12329 eval $setvar
12330 $rm -f try*
12331
12332
12333 : check for fd_set items
12334 $cat <<EOM
12335
12336 Checking to see how well your C compiler handles fd_set and friends ...
12337 EOM
12338 $cat >try.c <<EOCP
12339 #$i_stdlib I_STDLIB
12340 #ifdef I_STDLIB
12341 #include <stdlib.h>
12342 #endif
12343 #$i_systime I_SYS_TIME
12344 #$i_sysselct I_SYS_SELECT
12345 #$d_socket HAS_SOCKET
12346 #include <sys/types.h>
12347 #ifdef HAS_SOCKET
12348 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12349 #endif
12350 #ifdef I_SYS_TIME
12351 #include <sys/time.h>
12352 #endif
12353 #ifdef I_SYS_SELECT
12354 #include <sys/select.h>
12355 #endif
12356 int main() {
12357         fd_set fds;
12358
12359 #ifdef TRYBITS
12360         if(fds.fds_bits);
12361 #endif
12362
12363 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12364         exit(0);
12365 #else
12366         exit(1);
12367 #endif
12368 }
12369 EOCP
12370 set try -DTRYBITS
12371 if eval $compile; then
12372         d_fds_bits="$define"
12373         d_fd_set="$define"
12374         echo "Well, your system knows about the normal fd_set typedef..." >&4
12375         if $run ./try; then
12376                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12377                 d_fd_macros="$define"
12378         else
12379                 $cat >&4 <<'EOM'
12380 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12381 EOM
12382                 d_fd_macros="$undef"
12383         fi
12384 else
12385         $cat <<'EOM'
12386 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12387 EOM
12388         set try
12389         if eval $compile; then
12390                 d_fds_bits="$undef"
12391                 d_fd_set="$define"
12392                 echo "Well, your system has some sort of fd_set available..." >&4
12393                 if $run ./try; then
12394                         echo "and you have the normal fd_set macros." >&4
12395                         d_fd_macros="$define"
12396                 else
12397                         $cat <<'EOM'
12398 but not the normal fd_set macros!  Gross!  More work for me...
12399 EOM
12400                         d_fd_macros="$undef"
12401                 fi
12402         else
12403         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
12404                 d_fd_set="$undef"
12405                 d_fds_bits="$undef"
12406                 d_fd_macros="$undef"
12407         fi
12408 fi
12409 $rm -f try try.*
12410
12411 : see if fgetpos exists
12412 set fgetpos d_fgetpos
12413 eval $inlibc
12414
12415 : see if finite exists
12416 set finite d_finite
12417 eval $inlibc
12418
12419 : see if finitel exists
12420 set finitel d_finitel
12421 eval $inlibc
12422
12423 : see if flock exists
12424 set flock d_flock
12425 eval $inlibc
12426
12427 : see if prototype for flock is available
12428 echo " "
12429 set d_flockproto flock $i_sysfile sys/file.h
12430 eval $hasproto
12431
12432 : see if fork exists
12433 set fork d_fork
12434 eval $inlibc
12435
12436 : see if fp_class exists
12437 set fp_class d_fp_class
12438 eval $inlibc
12439
12440 : see if pathconf exists
12441 set pathconf d_pathconf
12442 eval $inlibc
12443
12444 : see if fpathconf exists
12445 set fpathconf d_fpathconf
12446 eval $inlibc
12447
12448 : see if fpclass exists
12449 set fpclass d_fpclass
12450 eval $inlibc
12451
12452 : see if fpclassify exists
12453 set fpclassify d_fpclassify
12454 eval $inlibc
12455
12456 : see if fpclassl exists
12457 set fpclassl d_fpclassl
12458 eval $inlibc
12459
12460
12461 : check for fpos64_t
12462 echo " "
12463 echo "Checking to see if you have fpos64_t..." >&4
12464 $cat >try.c <<EOCP
12465 #include <stdio.h>
12466 int main() { fpos64_t x = 7; }
12467 EOCP
12468 set try
12469 if eval $compile; then
12470         val="$define"
12471         echo "You have fpos64_t."
12472 else
12473         val="$undef"
12474         echo "You do not have fpos64_t."
12475         case "$fpossize" in
12476         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12477         esac
12478 fi
12479 $rm -f try.* try
12480 set d_fpos64_t
12481 eval $setvar
12482
12483 : see if frexpl exists
12484 set frexpl d_frexpl
12485 eval $inlibc
12486
12487 : see if this is a sys/param system
12488 set sys/param.h i_sysparam
12489 eval $inhdr
12490
12491 : see if this is a sys/mount.h system
12492 set sys/mount.h i_sysmount
12493 eval $inhdr
12494
12495
12496 echo " "
12497 echo "Checking to see if your system supports struct fs_data..." >&4
12498 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12499 eval $hasstruct
12500 case "$d_fs_data_s" in
12501 "$define")      echo "Yes, it does."   ;;
12502 *)              echo "No, it doesn't." ;;
12503 esac
12504
12505 : see if fseeko exists
12506 set fseeko d_fseeko
12507 eval $inlibc
12508 case "$longsize" in
12509 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12510 esac
12511
12512 : see if fsetpos exists
12513 set fsetpos d_fsetpos
12514 eval $inlibc
12515
12516
12517 : see if fstatfs exists
12518 set fstatfs d_fstatfs
12519 eval $inlibc
12520
12521
12522 : see if statvfs exists
12523 set statvfs d_statvfs
12524 eval $inlibc
12525
12526 : see if fstatvfs exists
12527 set fstatvfs d_fstatvfs
12528 eval $inlibc
12529
12530
12531 : see if fsync exists
12532 set fsync d_fsync
12533 eval $inlibc
12534
12535 : see if ftello exists
12536 set ftello d_ftello
12537 eval $inlibc
12538 case "$longsize" in
12539 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12540 esac
12541
12542 : see if getcwd exists
12543 set getcwd d_getcwd
12544 eval $inlibc
12545
12546 : see if getespwnam exists
12547 set getespwnam d_getespwnam
12548 eval $inlibc
12549
12550
12551 : see if getfsstat exists
12552 set getfsstat d_getfsstat
12553 eval $inlibc
12554
12555 : see if getgrent exists
12556 set getgrent d_getgrent
12557 eval $inlibc
12558
12559 : see if getgrent_r exists
12560 set getgrent_r d_getgrent_r
12561 eval $inlibc
12562 case "$d_getgrent_r" in
12563 "$define")
12564         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12565         case "$d_getgrent_r_proto:$usethreads" in
12566         ":define")      d_getgrent_r_proto=define
12567                 set d_getgrent_r_proto getgrent_r $hdrs
12568                 eval $hasproto ;;
12569         *)      ;;
12570         esac
12571         case "$d_getgrent_r_proto" in
12572         define)
12573         case "$getgrent_r_proto" in
12574         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
12575         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
12576         esac
12577         case "$getgrent_r_proto" in
12578         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
12579         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
12580         esac
12581         case "$getgrent_r_proto" in
12582         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12583         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12584         esac
12585         case "$getgrent_r_proto" in
12586         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12587         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12588         esac
12589         case "$getgrent_r_proto" in
12590         ''|0) try='int getgrent_r(struct group*, char*, int);'
12591         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12592         esac
12593         case "$getgrent_r_proto" in
12594         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12595         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12596         esac
12597         case "$getgrent_r_proto" in
12598         ''|0)   d_getgrent_r=undef
12599                 getgrent_r_proto=0
12600                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
12601         * )     case "$getgrent_r_proto" in
12602                 REENTRANT_PROTO*) ;;
12603                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12604                 esac
12605                 echo "Prototype: $try" ;;
12606         esac
12607         ;;
12608         *)      case "$usethreads" in
12609                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12610                 esac
12611                 d_getgrent_r=undef
12612                 getgrent_r_proto=0
12613                 ;;
12614         esac
12615         ;;
12616 *)      getgrent_r_proto=0
12617         ;;
12618 esac
12619
12620 : see if getgrgid_r exists
12621 set getgrgid_r d_getgrgid_r
12622 eval $inlibc
12623 case "$d_getgrgid_r" in
12624 "$define")
12625         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12626         case "$d_getgrgid_r_proto:$usethreads" in
12627         ":define")      d_getgrgid_r_proto=define
12628                 set d_getgrgid_r_proto getgrgid_r $hdrs
12629                 eval $hasproto ;;
12630         *)      ;;
12631         esac
12632         case "$d_getgrgid_r_proto" in
12633         define)
12634         case "$getgrgid_r_proto" in
12635         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12636         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12637         esac
12638         case "$getgrgid_r_proto" in
12639         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12640         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12641         esac
12642         case "$getgrgid_r_proto" in
12643         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12644         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12645         esac
12646         case "$getgrgid_r_proto" in
12647         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12648         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12649         esac
12650         case "$getgrgid_r_proto" in
12651         ''|0)   d_getgrgid_r=undef
12652                 getgrgid_r_proto=0
12653                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
12654         * )     case "$getgrgid_r_proto" in
12655                 REENTRANT_PROTO*) ;;
12656                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12657                 esac
12658                 echo "Prototype: $try" ;;
12659         esac
12660         ;;
12661         *)      case "$usethreads" in
12662                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12663                 esac
12664                 d_getgrgid_r=undef
12665                 getgrgid_r_proto=0
12666                 ;;
12667         esac
12668         ;;
12669 *)      getgrgid_r_proto=0
12670         ;;
12671 esac
12672
12673 : see if getgrnam_r exists
12674 set getgrnam_r d_getgrnam_r
12675 eval $inlibc
12676 case "$d_getgrnam_r" in
12677 "$define")
12678         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12679         case "$d_getgrnam_r_proto:$usethreads" in
12680         ":define")      d_getgrnam_r_proto=define
12681                 set d_getgrnam_r_proto getgrnam_r $hdrs
12682                 eval $hasproto ;;
12683         *)      ;;
12684         esac
12685         case "$d_getgrnam_r_proto" in
12686         define)
12687         case "$getgrnam_r_proto" in
12688         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12689         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12690         esac
12691         case "$getgrnam_r_proto" in
12692         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12693         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12694         esac
12695         case "$getgrnam_r_proto" in
12696         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12697         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12698         esac
12699         case "$getgrnam_r_proto" in
12700         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
12701         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
12702         esac
12703         case "$getgrnam_r_proto" in
12704         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
12705         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
12706         esac
12707         case "$getgrnam_r_proto" in
12708         ''|0)   d_getgrnam_r=undef
12709                 getgrnam_r_proto=0
12710                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
12711         * )     case "$getgrnam_r_proto" in
12712                 REENTRANT_PROTO*) ;;
12713                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
12714                 esac
12715                 echo "Prototype: $try" ;;
12716         esac
12717         ;;
12718         *)      case "$usethreads" in
12719                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
12720                 esac
12721                 d_getgrnam_r=undef
12722                 getgrnam_r_proto=0
12723                 ;;
12724         esac
12725         ;;
12726 *)      getgrnam_r_proto=0
12727         ;;
12728 esac
12729
12730 : see if gethostbyaddr exists
12731 set gethostbyaddr d_gethbyaddr
12732 eval $inlibc
12733
12734 : see if gethostbyname exists
12735 set gethostbyname d_gethbyname
12736 eval $inlibc
12737
12738 : see if gethostent exists
12739 set gethostent d_gethent
12740 eval $inlibc
12741
12742 : see how we will look up host name
12743 echo " "
12744 call=''
12745 if set gethostname val -f d_gethname; eval $csym; $val; then
12746         echo 'gethostname() found.' >&4
12747         d_gethname="$define"
12748         call=gethostname
12749 fi
12750 if set uname val -f d_uname; eval $csym; $val; then
12751         if ./xenix; then
12752                 $cat <<'EOM'
12753 uname() was found, but you're running xenix, and older versions of xenix
12754 have a broken uname(). If you don't really know whether your xenix is old
12755 enough to have a broken system call, use the default answer.
12756
12757 EOM
12758                 dflt=y
12759                 case "$d_uname" in
12760                 "$define") dflt=n;;
12761                 esac
12762                 rp='Is your uname() broken?'
12763                 . ./myread
12764                 case "$ans" in
12765                 n*) d_uname="$define"; call=uname;;
12766                 esac
12767         else
12768                 echo 'uname() found.' >&4
12769                 d_uname="$define"
12770                 case "$call" in
12771                 '') call=uname ;;
12772                 esac
12773         fi
12774 fi
12775 case "$d_gethname" in
12776 '') d_gethname="$undef";;
12777 esac
12778 case "$d_uname" in
12779 '') d_uname="$undef";;
12780 esac
12781 case "$d_uname$d_gethname" in
12782 *define*)
12783         dflt=n
12784         cat <<EOM
12785  
12786 Every now and then someone has a $call() that lies about the hostname
12787 but can't be fixed for political or economic reasons.  If you wish, I can
12788 pretend $call() isn't there and maybe compute hostname at run-time
12789 thanks to the '$phostname' command.
12790
12791 EOM
12792         rp="Shall I ignore $call() from now on?"
12793         . ./myread
12794         case "$ans" in
12795         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
12796         esac;;
12797 esac
12798 case "$phostname" in
12799 '') aphostname='';;
12800 *) case "$aphostname" in
12801         /*) ;;
12802         *) set X $phostname
12803                 shift
12804                 file=$1
12805                 shift
12806                 file=`./loc $file $file $pth`
12807                 aphostname=`echo $file $*`
12808                 ;;
12809         esac
12810         ;;
12811 esac
12812 case "$d_uname$d_gethname" in
12813 *define*) ;;
12814 *)
12815         case "$phostname" in
12816         '')
12817                 echo "There will be no way for $package to get your hostname." >&4;;
12818         *)
12819         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
12820                 ;;
12821         esac;;
12822 esac
12823 case "$d_phostname" in
12824 '') d_phostname="$undef";;
12825 esac
12826
12827 : see if gethostbyaddr_r exists
12828 set gethostbyaddr_r d_gethostbyaddr_r
12829 eval $inlibc
12830 case "$d_gethostbyaddr_r" in
12831 "$define")
12832         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12833         case "$d_gethostbyaddr_r_proto:$usethreads" in
12834         ":define")      d_gethostbyaddr_r_proto=define
12835                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
12836                 eval $hasproto ;;
12837         *)      ;;
12838         esac
12839         case "$d_gethostbyaddr_r_proto" in
12840         define)
12841         case "$gethostbyaddr_r_proto" in
12842         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12843         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
12844         esac
12845         case "$gethostbyaddr_r_proto" in
12846         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
12847         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
12848         esac
12849         case "$gethostbyaddr_r_proto" in
12850         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
12851         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
12852         esac
12853         case "$gethostbyaddr_r_proto" in
12854         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
12855         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
12856         esac
12857         case "$gethostbyaddr_r_proto" in
12858         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
12859         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
12860         esac
12861         case "$gethostbyaddr_r_proto" in
12862         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
12863         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
12864         esac
12865         case "$gethostbyaddr_r_proto" in
12866         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
12867         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
12868         esac
12869         case "$gethostbyaddr_r_proto" in
12870         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
12871         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
12872         esac
12873         case "$gethostbyaddr_r_proto" in
12874         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
12875         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
12876         esac
12877         case "$gethostbyaddr_r_proto" in
12878         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
12879         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
12880         esac
12881         case "$gethostbyaddr_r_proto" in
12882         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12883         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
12884         esac
12885         case "$gethostbyaddr_r_proto" in
12886         ''|0)   d_gethostbyaddr_r=undef
12887                 gethostbyaddr_r_proto=0
12888                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
12889         * )     case "$gethostbyaddr_r_proto" in
12890                 REENTRANT_PROTO*) ;;
12891                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
12892                 esac
12893                 echo "Prototype: $try" ;;
12894         esac
12895         ;;
12896         *)      case "$usethreads" in
12897                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
12898                 esac
12899                 d_gethostbyaddr_r=undef
12900                 gethostbyaddr_r_proto=0
12901                 ;;
12902         esac
12903         ;;
12904 *)      gethostbyaddr_r_proto=0
12905         ;;
12906 esac
12907
12908 : see if gethostbyname_r exists
12909 set gethostbyname_r d_gethostbyname_r
12910 eval $inlibc
12911 case "$d_gethostbyname_r" in
12912 "$define")
12913         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12914         case "$d_gethostbyname_r_proto:$usethreads" in
12915         ":define")      d_gethostbyname_r_proto=define
12916                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
12917                 eval $hasproto ;;
12918         *)      ;;
12919         esac
12920         case "$d_gethostbyname_r_proto" in
12921         define)
12922         case "$gethostbyname_r_proto" in
12923         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
12924         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
12925         esac
12926         case "$gethostbyname_r_proto" in
12927         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
12928         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
12929         esac
12930         case "$gethostbyname_r_proto" in
12931         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
12932         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
12933         esac
12934         case "$gethostbyname_r_proto" in
12935         ''|0)   d_gethostbyname_r=undef
12936                 gethostbyname_r_proto=0
12937                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
12938         * )     case "$gethostbyname_r_proto" in
12939                 REENTRANT_PROTO*) ;;
12940                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
12941                 esac
12942                 echo "Prototype: $try" ;;
12943         esac
12944         ;;
12945         *)      case "$usethreads" in
12946                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
12947                 esac
12948                 d_gethostbyname_r=undef
12949                 gethostbyname_r_proto=0
12950                 ;;
12951         esac
12952         ;;
12953 *)      gethostbyname_r_proto=0
12954         ;;
12955 esac
12956
12957 : see if gethostent_r exists
12958 set gethostent_r d_gethostent_r
12959 eval $inlibc
12960 case "$d_gethostent_r" in
12961 "$define")
12962         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12963         case "$d_gethostent_r_proto:$usethreads" in
12964         ":define")      d_gethostent_r_proto=define
12965                 set d_gethostent_r_proto gethostent_r $hdrs
12966                 eval $hasproto ;;
12967         *)      ;;
12968         esac
12969         case "$d_gethostent_r_proto" in
12970         define)
12971         case "$gethostent_r_proto" in
12972         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
12973         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
12974         esac
12975         case "$gethostent_r_proto" in
12976         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
12977         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
12978         esac
12979         case "$gethostent_r_proto" in
12980         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
12981         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
12982         esac
12983         case "$gethostent_r_proto" in
12984         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
12985         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
12986         esac
12987         case "$gethostent_r_proto" in
12988         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
12989         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
12990         esac
12991         case "$gethostent_r_proto" in
12992         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
12993         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
12994         esac
12995         case "$gethostent_r_proto" in
12996         ''|0)   d_gethostent_r=undef
12997                 gethostent_r_proto=0
12998                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
12999         * )     case "$gethostent_r_proto" in
13000                 REENTRANT_PROTO*) ;;
13001                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13002                 esac
13003                 echo "Prototype: $try" ;;
13004         esac
13005         ;;
13006         *)      case "$usethreads" in
13007                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13008                 esac
13009                 d_gethostent_r=undef
13010                 gethostent_r_proto=0
13011                 ;;
13012         esac
13013         ;;
13014 *)      gethostent_r_proto=0
13015         ;;
13016 esac
13017
13018 : see if prototypes for various gethostxxx netdb.h functions are available
13019 echo " "
13020 set d_gethostprotos gethostent $i_netdb netdb.h
13021 eval $hasproto
13022
13023 : see if getitimer exists
13024 set getitimer d_getitimer
13025 eval $inlibc
13026
13027 : see if getlogin exists
13028 set getlogin d_getlogin
13029 eval $inlibc
13030
13031 : see if getlogin_r exists
13032 set getlogin_r d_getlogin_r
13033 eval $inlibc
13034 case "$d_getlogin_r" in
13035 "$define")
13036         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13037         case "$d_getlogin_r_proto:$usethreads" in
13038         ":define")      d_getlogin_r_proto=define
13039                 set d_getlogin_r_proto getlogin_r $hdrs
13040                 eval $hasproto ;;
13041         *)      ;;
13042         esac
13043         case "$d_getlogin_r_proto" in
13044         define)
13045         case "$getlogin_r_proto" in
13046         ''|0) try='int getlogin_r(char*, size_t);'
13047         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13048         esac
13049         case "$getlogin_r_proto" in
13050         ''|0) try='int getlogin_r(char*, int);'
13051         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13052         esac
13053         case "$getlogin_r_proto" in
13054         ''|0) try='char* getlogin_r(char*, size_t);'
13055         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13056         esac
13057         case "$getlogin_r_proto" in
13058         ''|0) try='char* getlogin_r(char*, int);'
13059         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13060         esac
13061         case "$getlogin_r_proto" in
13062         ''|0)   d_getlogin_r=undef
13063                 getlogin_r_proto=0
13064                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13065         * )     case "$getlogin_r_proto" in
13066                 REENTRANT_PROTO*) ;;
13067                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13068                 esac
13069                 echo "Prototype: $try" ;;
13070         esac
13071         ;;
13072         *)      case "$usethreads" in
13073                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13074                 esac
13075                 d_getlogin_r=undef
13076                 getlogin_r_proto=0
13077                 ;;
13078         esac
13079         ;;
13080 *)      getlogin_r_proto=0
13081         ;;
13082 esac
13083
13084 : see if getmnt exists
13085 set getmnt d_getmnt
13086 eval $inlibc
13087
13088 : see if getmntent exists
13089 set getmntent d_getmntent
13090 eval $inlibc
13091
13092 : see if getnetbyaddr exists
13093 set getnetbyaddr d_getnbyaddr
13094 eval $inlibc
13095
13096 : see if getnetbyname exists
13097 set getnetbyname d_getnbyname
13098 eval $inlibc
13099
13100 : see if getnetent exists
13101 set getnetent d_getnent
13102 eval $inlibc
13103
13104 : see if getnetbyaddr_r exists
13105 set getnetbyaddr_r d_getnetbyaddr_r
13106 eval $inlibc
13107 case "$d_getnetbyaddr_r" in
13108 "$define")
13109         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13110         case "$d_getnetbyaddr_r_proto:$usethreads" in
13111         ":define")      d_getnetbyaddr_r_proto=define
13112                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13113                 eval $hasproto ;;
13114         *)      ;;
13115         esac
13116         case "$d_getnetbyaddr_r_proto" in
13117         define)
13118         case "$getnetbyaddr_r_proto" in
13119         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13120         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13121         esac
13122         case "$getnetbyaddr_r_proto" in
13123         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13124         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13125         esac
13126         case "$getnetbyaddr_r_proto" in
13127         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13128         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13129         esac
13130         case "$getnetbyaddr_r_proto" in
13131         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13132         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13133         esac
13134         case "$getnetbyaddr_r_proto" in
13135         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13136         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13137         esac
13138         case "$getnetbyaddr_r_proto" in
13139         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13140         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13141         esac
13142         case "$getnetbyaddr_r_proto" in
13143         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13144         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13145         esac
13146         case "$getnetbyaddr_r_proto" in
13147         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13148         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13149         esac
13150         case "$getnetbyaddr_r_proto" in
13151         ''|0)   d_getnetbyaddr_r=undef
13152                 getnetbyaddr_r_proto=0
13153                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13154         * )     case "$getnetbyaddr_r_proto" in
13155                 REENTRANT_PROTO*) ;;
13156                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13157                 esac
13158                 echo "Prototype: $try" ;;
13159         esac
13160         ;;
13161         *)      case "$usethreads" in
13162                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13163                 esac
13164                 d_getnetbyaddr_r=undef
13165                 getnetbyaddr_r_proto=0
13166                 ;;
13167         esac
13168         ;;
13169 *)      getnetbyaddr_r_proto=0
13170         ;;
13171 esac
13172
13173 : see if getnetbyname_r exists
13174 set getnetbyname_r d_getnetbyname_r
13175 eval $inlibc
13176 case "$d_getnetbyname_r" in
13177 "$define")
13178         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13179         case "$d_getnetbyname_r_proto:$usethreads" in
13180         ":define")      d_getnetbyname_r_proto=define
13181                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13182                 eval $hasproto ;;
13183         *)      ;;
13184         esac
13185         case "$d_getnetbyname_r_proto" in
13186         define)
13187         case "$getnetbyname_r_proto" in
13188         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13189         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13190         esac
13191         case "$getnetbyname_r_proto" in
13192         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13193         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13194         esac
13195         case "$getnetbyname_r_proto" in
13196         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13197         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13198         esac
13199         case "$getnetbyname_r_proto" in
13200         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13201         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13202         esac
13203         case "$getnetbyname_r_proto" in
13204         ''|0)   d_getnetbyname_r=undef
13205                 getnetbyname_r_proto=0
13206                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13207         * )     case "$getnetbyname_r_proto" in
13208                 REENTRANT_PROTO*) ;;
13209                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13210                 esac
13211                 echo "Prototype: $try" ;;
13212         esac
13213         ;;
13214         *)      case "$usethreads" in
13215                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13216                 esac
13217                 d_getnetbyname_r=undef
13218                 getnetbyname_r_proto=0
13219                 ;;
13220         esac
13221         ;;
13222 *)      getnetbyname_r_proto=0
13223         ;;
13224 esac
13225
13226 : see if getnetent_r exists
13227 set getnetent_r d_getnetent_r
13228 eval $inlibc
13229 case "$d_getnetent_r" in
13230 "$define")
13231         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13232         case "$d_getnetent_r_proto:$usethreads" in
13233         ":define")      d_getnetent_r_proto=define
13234                 set d_getnetent_r_proto getnetent_r $hdrs
13235                 eval $hasproto ;;
13236         *)      ;;
13237         esac
13238         case "$d_getnetent_r_proto" in
13239         define)
13240         case "$getnetent_r_proto" in
13241         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13242         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13243         esac
13244         case "$getnetent_r_proto" in
13245         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13246         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13247         esac
13248         case "$getnetent_r_proto" in
13249         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13250         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13251         esac
13252         case "$getnetent_r_proto" in
13253         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13254         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13255         esac
13256         case "$getnetent_r_proto" in
13257         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13258         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13259         esac
13260         case "$getnetent_r_proto" in
13261         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13262         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13263         esac
13264         case "$getnetent_r_proto" in
13265         ''|0)   d_getnetent_r=undef
13266                 getnetent_r_proto=0
13267                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13268         * )     case "$getnetent_r_proto" in
13269                 REENTRANT_PROTO*) ;;
13270                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13271                 esac
13272                 echo "Prototype: $try" ;;
13273         esac
13274         ;;
13275         *)      case "$usethreads" in
13276                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13277                 esac
13278                 d_getnetent_r=undef
13279                 getnetent_r_proto=0
13280                 ;;
13281         esac
13282         ;;
13283 *)      getnetent_r_proto=0
13284         ;;
13285 esac
13286
13287 : see if prototypes for various getnetxxx netdb.h functions are available
13288 echo " "
13289 set d_getnetprotos getnetent $i_netdb netdb.h
13290 eval $hasproto
13291
13292 : see if getpagesize exists
13293 set getpagesize d_getpagsz
13294 eval $inlibc
13295
13296
13297 : see if getprotobyname exists
13298 set getprotobyname d_getpbyname
13299 eval $inlibc
13300
13301 : see if getprotobynumber exists
13302 set getprotobynumber d_getpbynumber
13303 eval $inlibc
13304
13305 : see if getprotoent exists
13306 set getprotoent d_getpent
13307 eval $inlibc
13308
13309 : see if getpgid exists
13310 set getpgid d_getpgid
13311 eval $inlibc
13312
13313 : see if getpgrp2 exists
13314 set getpgrp2 d_getpgrp2
13315 eval $inlibc
13316
13317 : see if getppid exists
13318 set getppid d_getppid
13319 eval $inlibc
13320
13321 : see if getpriority exists
13322 set getpriority d_getprior
13323 eval $inlibc
13324
13325 : see if getprotobyname_r exists
13326 set getprotobyname_r d_getprotobyname_r
13327 eval $inlibc
13328 case "$d_getprotobyname_r" in
13329 "$define")
13330         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13331         case "$d_getprotobyname_r_proto:$usethreads" in
13332         ":define")      d_getprotobyname_r_proto=define
13333                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13334                 eval $hasproto ;;
13335         *)      ;;
13336         esac
13337         case "$d_getprotobyname_r_proto" in
13338         define)
13339         case "$getprotobyname_r_proto" in
13340         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13341         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13342         esac
13343         case "$getprotobyname_r_proto" in
13344         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13345         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13346         esac
13347         case "$getprotobyname_r_proto" in
13348         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13349         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13350         esac
13351         case "$getprotobyname_r_proto" in
13352         ''|0)   d_getprotobyname_r=undef
13353                 getprotobyname_r_proto=0
13354                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13355         * )     case "$getprotobyname_r_proto" in
13356                 REENTRANT_PROTO*) ;;
13357                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13358                 esac
13359                 echo "Prototype: $try" ;;
13360         esac
13361         ;;
13362         *)      case "$usethreads" in
13363                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13364                 esac
13365                 d_getprotobyname_r=undef
13366                 getprotobyname_r_proto=0
13367                 ;;
13368         esac
13369         ;;
13370 *)      getprotobyname_r_proto=0
13371         ;;
13372 esac
13373
13374 : see if getprotobynumber_r exists
13375 set getprotobynumber_r d_getprotobynumber_r
13376 eval $inlibc
13377 case "$d_getprotobynumber_r" in
13378 "$define")
13379         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13380         case "$d_getprotobynumber_r_proto:$usethreads" in
13381         ":define")      d_getprotobynumber_r_proto=define
13382                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13383                 eval $hasproto ;;
13384         *)      ;;
13385         esac
13386         case "$d_getprotobynumber_r_proto" in
13387         define)
13388         case "$getprotobynumber_r_proto" in
13389         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13390         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13391         esac
13392         case "$getprotobynumber_r_proto" in
13393         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13394         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13395         esac
13396         case "$getprotobynumber_r_proto" in
13397         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13398         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13399         esac
13400         case "$getprotobynumber_r_proto" in
13401         ''|0)   d_getprotobynumber_r=undef
13402                 getprotobynumber_r_proto=0
13403                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
13404         * )     case "$getprotobynumber_r_proto" in
13405                 REENTRANT_PROTO*) ;;
13406                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13407                 esac
13408                 echo "Prototype: $try" ;;
13409         esac
13410         ;;
13411         *)      case "$usethreads" in
13412                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13413                 esac
13414                 d_getprotobynumber_r=undef
13415                 getprotobynumber_r_proto=0
13416                 ;;
13417         esac
13418         ;;
13419 *)      getprotobynumber_r_proto=0
13420         ;;
13421 esac
13422
13423 : see if getprotoent_r exists
13424 set getprotoent_r d_getprotoent_r
13425 eval $inlibc
13426 case "$d_getprotoent_r" in
13427 "$define")
13428         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13429         case "$d_getprotoent_r_proto:$usethreads" in
13430         ":define")      d_getprotoent_r_proto=define
13431                 set d_getprotoent_r_proto getprotoent_r $hdrs
13432                 eval $hasproto ;;
13433         *)      ;;
13434         esac
13435         case "$d_getprotoent_r_proto" in
13436         define)
13437         case "$getprotoent_r_proto" in
13438         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13439         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13440         esac
13441         case "$getprotoent_r_proto" in
13442         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13443         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13444         esac
13445         case "$getprotoent_r_proto" in
13446         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13447         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13448         esac
13449         case "$getprotoent_r_proto" in
13450         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13451         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13452         esac
13453         case "$getprotoent_r_proto" in
13454         ''|0)   d_getprotoent_r=undef
13455                 getprotoent_r_proto=0
13456                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
13457         * )     case "$getprotoent_r_proto" in
13458                 REENTRANT_PROTO*) ;;
13459                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13460                 esac
13461                 echo "Prototype: $try" ;;
13462         esac
13463         ;;
13464         *)      case "$usethreads" in
13465                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13466                 esac
13467                 d_getprotoent_r=undef
13468                 getprotoent_r_proto=0
13469                 ;;
13470         esac
13471         ;;
13472 *)      getprotoent_r_proto=0
13473         ;;
13474 esac
13475
13476 : see if prototypes for various getprotoxxx netdb.h functions are available
13477 echo " "
13478 set d_getprotoprotos getprotoent $i_netdb netdb.h
13479 eval $hasproto
13480
13481 : see if getprpwnam exists
13482 set getprpwnam d_getprpwnam
13483 eval $inlibc
13484
13485 : see if getpwent exists
13486 set getpwent d_getpwent
13487 eval $inlibc
13488
13489 : see if getpwent_r exists
13490 set getpwent_r d_getpwent_r
13491 eval $inlibc
13492 case "$d_getpwent_r" in
13493 "$define")
13494         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13495         case "$d_getpwent_r_proto:$usethreads" in
13496         ":define")      d_getpwent_r_proto=define
13497                 set d_getpwent_r_proto getpwent_r $hdrs
13498                 eval $hasproto ;;
13499         *)      ;;
13500         esac
13501         case "$d_getpwent_r_proto" in
13502         define)
13503         case "$getpwent_r_proto" in
13504         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13505         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13506         esac
13507         case "$getpwent_r_proto" in
13508         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13509         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13510         esac
13511         case "$getpwent_r_proto" in
13512         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13513         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13514         esac
13515         case "$getpwent_r_proto" in
13516         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13517         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13518         esac
13519         case "$getpwent_r_proto" in
13520         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13521         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13522         esac
13523         case "$getpwent_r_proto" in
13524         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13525         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13526         esac
13527         case "$getpwent_r_proto" in
13528         ''|0)   d_getpwent_r=undef
13529                 getpwent_r_proto=0
13530                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
13531         * )     case "$getpwent_r_proto" in
13532                 REENTRANT_PROTO*) ;;
13533                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13534                 esac
13535                 echo "Prototype: $try" ;;
13536         esac
13537         ;;
13538         *)      case "$usethreads" in
13539                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13540                 esac
13541                 d_getpwent_r=undef
13542                 getpwent_r_proto=0
13543                 ;;
13544         esac
13545         ;;
13546 *)      getpwent_r_proto=0
13547         ;;
13548 esac
13549
13550 : see if getpwnam_r exists
13551 set getpwnam_r d_getpwnam_r
13552 eval $inlibc
13553 case "$d_getpwnam_r" in
13554 "$define")
13555         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13556         case "$d_getpwnam_r_proto:$usethreads" in
13557         ":define")      d_getpwnam_r_proto=define
13558                 set d_getpwnam_r_proto getpwnam_r $hdrs
13559                 eval $hasproto ;;
13560         *)      ;;
13561         esac
13562         case "$d_getpwnam_r_proto" in
13563         define)
13564         case "$getpwnam_r_proto" in
13565         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13566         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
13567         esac
13568         case "$getpwnam_r_proto" in
13569         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
13570         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
13571         esac
13572         case "$getpwnam_r_proto" in
13573         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
13574         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
13575         esac
13576         case "$getpwnam_r_proto" in
13577         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
13578         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
13579         esac
13580         case "$getpwnam_r_proto" in
13581         ''|0)   d_getpwnam_r=undef
13582                 getpwnam_r_proto=0
13583                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
13584         * )     case "$getpwnam_r_proto" in
13585                 REENTRANT_PROTO*) ;;
13586                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
13587                 esac
13588                 echo "Prototype: $try" ;;
13589         esac
13590         ;;
13591         *)      case "$usethreads" in
13592                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13593                 esac
13594                 d_getpwnam_r=undef
13595                 getpwnam_r_proto=0
13596                 ;;
13597         esac
13598         ;;
13599 *)      getpwnam_r_proto=0
13600         ;;
13601 esac
13602
13603 : see if getpwuid_r exists
13604 set getpwuid_r d_getpwuid_r
13605 eval $inlibc
13606 case "$d_getpwuid_r" in
13607 "$define")
13608         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13609         case "$d_getpwuid_r_proto:$usethreads" in
13610         ":define")      d_getpwuid_r_proto=define
13611                 set d_getpwuid_r_proto getpwuid_r $hdrs
13612                 eval $hasproto ;;
13613         *)      ;;
13614         esac
13615         case "$d_getpwuid_r_proto" in
13616         define)
13617         case "$getpwuid_r_proto" in
13618         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13619         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13620         esac
13621         case "$getpwuid_r_proto" in
13622         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13623         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13624         esac
13625         case "$getpwuid_r_proto" in
13626         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13627         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13628         esac
13629         case "$getpwuid_r_proto" in
13630         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13631         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13632         esac
13633         case "$getpwuid_r_proto" in
13634         ''|0)   d_getpwuid_r=undef
13635                 getpwuid_r_proto=0
13636                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
13637         * )     case "$getpwuid_r_proto" in
13638                 REENTRANT_PROTO*) ;;
13639                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13640                 esac
13641                 echo "Prototype: $try" ;;
13642         esac
13643         ;;
13644         *)      case "$usethreads" in
13645                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13646                 esac
13647                 d_getpwuid_r=undef
13648                 getpwuid_r_proto=0
13649                 ;;
13650         esac
13651         ;;
13652 *)      getpwuid_r_proto=0
13653         ;;
13654 esac
13655
13656
13657 : see if getservbyname exists
13658 set getservbyname d_getsbyname
13659 eval $inlibc
13660
13661 : see if getservbyport exists
13662 set getservbyport d_getsbyport
13663 eval $inlibc
13664
13665 : see if getservent exists
13666 set getservent d_getsent
13667 eval $inlibc
13668
13669 : see if getservbyname_r exists
13670 set getservbyname_r d_getservbyname_r
13671 eval $inlibc
13672 case "$d_getservbyname_r" in
13673 "$define")
13674         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13675         case "$d_getservbyname_r_proto:$usethreads" in
13676         ":define")      d_getservbyname_r_proto=define
13677                 set d_getservbyname_r_proto getservbyname_r $hdrs
13678                 eval $hasproto ;;
13679         *)      ;;
13680         esac
13681         case "$d_getservbyname_r_proto" in
13682         define)
13683         case "$getservbyname_r_proto" in
13684         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13685         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13686         esac
13687         case "$getservbyname_r_proto" in
13688         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13689         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13690         esac
13691         case "$getservbyname_r_proto" in
13692         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13693         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13694         esac
13695         case "$getservbyname_r_proto" in
13696         ''|0)   d_getservbyname_r=undef
13697                 getservbyname_r_proto=0
13698                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
13699         * )     case "$getservbyname_r_proto" in
13700                 REENTRANT_PROTO*) ;;
13701                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
13702                 esac
13703                 echo "Prototype: $try" ;;
13704         esac
13705         ;;
13706         *)      case "$usethreads" in
13707                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
13708                 esac
13709                 d_getservbyname_r=undef
13710                 getservbyname_r_proto=0
13711                 ;;
13712         esac
13713         ;;
13714 *)      getservbyname_r_proto=0
13715         ;;
13716 esac
13717
13718 : see if getservbyport_r exists
13719 set getservbyport_r d_getservbyport_r
13720 eval $inlibc
13721 case "$d_getservbyport_r" in
13722 "$define")
13723         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13724         case "$d_getservbyport_r_proto:$usethreads" in
13725         ":define")      d_getservbyport_r_proto=define
13726                 set d_getservbyport_r_proto getservbyport_r $hdrs
13727                 eval $hasproto ;;
13728         *)      ;;
13729         esac
13730         case "$d_getservbyport_r_proto" in
13731         define)
13732         case "$getservbyport_r_proto" in
13733         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
13734         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
13735         esac
13736         case "$getservbyport_r_proto" in
13737         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
13738         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
13739         esac
13740         case "$getservbyport_r_proto" in
13741         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
13742         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
13743         esac
13744         case "$getservbyport_r_proto" in
13745         ''|0)   d_getservbyport_r=undef
13746                 getservbyport_r_proto=0
13747                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
13748         * )     case "$getservbyport_r_proto" in
13749                 REENTRANT_PROTO*) ;;
13750                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
13751                 esac
13752                 echo "Prototype: $try" ;;
13753         esac
13754         ;;
13755         *)      case "$usethreads" in
13756                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
13757                 esac
13758                 d_getservbyport_r=undef
13759                 getservbyport_r_proto=0
13760                 ;;
13761         esac
13762         ;;
13763 *)      getservbyport_r_proto=0
13764         ;;
13765 esac
13766
13767 : see if getservent_r exists
13768 set getservent_r d_getservent_r
13769 eval $inlibc
13770 case "$d_getservent_r" in
13771 "$define")
13772         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13773         case "$d_getservent_r_proto:$usethreads" in
13774         ":define")      d_getservent_r_proto=define
13775                 set d_getservent_r_proto getservent_r $hdrs
13776                 eval $hasproto ;;
13777         *)      ;;
13778         esac
13779         case "$d_getservent_r_proto" in
13780         define)
13781         case "$getservent_r_proto" in
13782         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
13783         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
13784         esac
13785         case "$getservent_r_proto" in
13786         ''|0) try='int getservent_r(struct servent*, char*, int);'
13787         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
13788         esac
13789         case "$getservent_r_proto" in
13790         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
13791         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
13792         esac
13793         case "$getservent_r_proto" in
13794         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
13795         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
13796         esac
13797         case "$getservent_r_proto" in
13798         ''|0)   d_getservent_r=undef
13799                 getservent_r_proto=0
13800                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
13801         * )     case "$getservent_r_proto" in
13802                 REENTRANT_PROTO*) ;;
13803                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
13804                 esac
13805                 echo "Prototype: $try" ;;
13806         esac
13807         ;;
13808         *)      case "$usethreads" in
13809                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
13810                 esac
13811                 d_getservent_r=undef
13812                 getservent_r_proto=0
13813                 ;;
13814         esac
13815         ;;
13816 *)      getservent_r_proto=0
13817         ;;
13818 esac
13819
13820 : see if prototypes for various getservxxx netdb.h functions are available
13821 echo " "
13822 set d_getservprotos getservent $i_netdb netdb.h
13823 eval $hasproto
13824
13825 : see if getspnam exists
13826 set getspnam d_getspnam
13827 eval $inlibc
13828
13829 : see if this is a shadow.h system
13830 set shadow.h i_shadow
13831 eval $inhdr
13832
13833 : see if getspnam_r exists
13834 set getspnam_r d_getspnam_r
13835 eval $inlibc
13836 case "$d_getspnam_r" in
13837 "$define")
13838         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
13839         case "$d_getspnam_r_proto:$usethreads" in
13840         ":define")      d_getspnam_r_proto=define
13841                 set d_getspnam_r_proto getspnam_r $hdrs
13842                 eval $hasproto ;;
13843         *)      ;;
13844         esac
13845         case "$d_getspnam_r_proto" in
13846         define)
13847         case "$getspnam_r_proto" in
13848         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
13849         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
13850         esac
13851         case "$getspnam_r_proto" in
13852         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
13853         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
13854         esac
13855         case "$getspnam_r_proto" in
13856         ''|0)   d_getspnam_r=undef
13857                 getspnam_r_proto=0
13858                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
13859         * )     case "$getspnam_r_proto" in
13860                 REENTRANT_PROTO*) ;;
13861                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
13862                 esac
13863                 echo "Prototype: $try" ;;
13864         esac
13865         ;;
13866         *)      case "$usethreads" in
13867                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
13868                 esac
13869                 d_getspnam_r=undef
13870                 getspnam_r_proto=0
13871                 ;;
13872         esac
13873         ;;
13874 *)      getspnam_r_proto=0
13875         ;;
13876 esac
13877
13878 : see if gettimeofday or ftime exists
13879 set gettimeofday d_gettimeod
13880 eval $inlibc
13881 case "$d_gettimeod" in
13882 "$undef")
13883         set ftime d_ftime 
13884         eval $inlibc
13885         ;;
13886 *)
13887         val="$undef"; set d_ftime; eval $setvar
13888         ;;
13889 esac
13890 case "$d_gettimeod$d_ftime" in
13891 "$undef$undef")
13892         echo " "
13893         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
13894         ;;
13895 esac
13896
13897 : see if gmtime_r exists
13898 set gmtime_r d_gmtime_r
13899 eval $inlibc
13900 case "$d_gmtime_r" in
13901 "$define")
13902         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13903         case "$d_gmtime_r_proto:$usethreads" in
13904         ":define")      d_gmtime_r_proto=define
13905                 set d_gmtime_r_proto gmtime_r $hdrs
13906                 eval $hasproto ;;
13907         *)      ;;
13908         esac
13909         case "$d_gmtime_r_proto" in
13910         define)
13911         case "$gmtime_r_proto" in
13912         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
13913         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
13914         esac
13915         case "$gmtime_r_proto" in
13916         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
13917         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
13918         esac
13919         case "$gmtime_r_proto" in
13920         ''|0)   d_gmtime_r=undef
13921                 gmtime_r_proto=0
13922                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
13923         * )     case "$gmtime_r_proto" in
13924                 REENTRANT_PROTO*) ;;
13925                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
13926                 esac
13927                 echo "Prototype: $try" ;;
13928         esac
13929         ;;
13930         *)      case "$usethreads" in
13931                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
13932                 esac
13933                 d_gmtime_r=undef
13934                 gmtime_r_proto=0
13935                 ;;
13936         esac
13937         ;;
13938 *)      gmtime_r_proto=0
13939         ;;
13940 esac
13941
13942 : see if hasmntopt exists
13943 set hasmntopt d_hasmntopt
13944 eval $inlibc
13945
13946 : see if this is a netinet/in.h or sys/in.h system
13947 set netinet/in.h i_niin sys/in.h i_sysin
13948 eval $inhdr
13949
13950 : see if arpa/inet.h has to be included
13951 set arpa/inet.h i_arpainet
13952 eval $inhdr
13953
13954 : see if htonl --and friends-- exists
13955 val=''
13956 set htonl val
13957 eval $inlibc
13958
13959 : Maybe they are macros.
13960 case "$val" in
13961 $undef)
13962         $cat >htonl.c <<EOM
13963 #include <stdio.h>
13964 #include <sys/types.h>
13965 #$i_niin I_NETINET_IN
13966 #$i_sysin I_SYS_IN
13967 #$i_arpainet I_ARPA_INET
13968 #ifdef I_NETINET_IN
13969 #include <netinet/in.h>
13970 #endif
13971 #ifdef I_SYS_IN
13972 #include <sys/in.h>
13973 #endif
13974 #ifdef I_ARPA_INET
13975 #include <arpa/inet.h>
13976 #endif
13977 #ifdef htonl
13978 printf("Defined as a macro.");
13979 #endif
13980 EOM
13981         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
13982         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
13983                 val="$define"
13984                 echo "But it seems to be defined as a macro." >&4
13985         fi
13986         $rm -f htonl.?
13987         ;;
13988 esac
13989 set d_htonl
13990 eval $setvar
13991
13992 : see if ilogbl exists
13993 set ilogbl d_ilogbl
13994 eval $inlibc
13995
13996 : index or strchr
13997 echo " "
13998 if set index val -f; eval $csym; $val; then
13999         if set strchr val -f d_strchr; eval $csym; $val; then
14000                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14001                         val="$define"
14002                         vali="$undef"
14003                         echo "strchr() found." >&4
14004                 else
14005                         val="$undef"
14006                         vali="$define"
14007                         echo "index() found." >&4
14008                 fi
14009         else
14010                 val="$undef"
14011                 vali="$define"
14012                 echo "index() found." >&4
14013         fi
14014 else
14015         if set strchr val -f d_strchr; eval $csym; $val; then
14016                 val="$define"
14017                 vali="$undef"
14018                 echo "strchr() found." >&4
14019         else
14020                 echo "No index() or strchr() found!" >&4
14021                 val="$undef"
14022                 vali="$undef"
14023         fi
14024 fi
14025 set d_strchr; eval $setvar
14026 val="$vali"
14027 set d_index; eval $setvar
14028
14029 : check whether inet_aton exists
14030 set inet_aton d_inetaton
14031 eval $inlibc
14032
14033 : Look for isascii
14034 echo " "
14035 $cat >isascii.c <<EOCP
14036 #include <stdio.h>
14037 #include <ctype.h>
14038 #$i_stdlib I_STDLIB
14039 #ifdef I_STDLIB
14040 #include <stdlib.h>
14041 #endif
14042 int main() {
14043         int c = 'A';
14044         if (isascii(c))
14045                 exit(0);
14046         else
14047                 exit(1);
14048 }
14049 EOCP
14050 set isascii
14051 if eval $compile; then
14052         echo "isascii() found." >&4
14053         val="$define"
14054 else
14055         echo "isascii() NOT found." >&4
14056         val="$undef"
14057 fi
14058 set d_isascii
14059 eval $setvar
14060 $rm -f isascii*
14061
14062 : see if isfinite exists
14063 set isfinite d_isfinite
14064 eval $inlibc
14065
14066 : see if isinf exists
14067 set isinf d_isinf
14068 eval $inlibc
14069
14070 : see if isnan exists
14071 set isnan d_isnan
14072 eval $inlibc
14073
14074 : see if isnanl exists
14075 set isnanl d_isnanl
14076 eval $inlibc
14077
14078 : see if killpg exists
14079 set killpg d_killpg
14080 eval $inlibc
14081
14082 : see if lchown exists
14083 echo " "
14084 $cat > try.c <<'EOCP'
14085 /* System header to define __stub macros and hopefully few prototypes,
14086     which can conflict with char lchown(); below.  */
14087 #include <assert.h>
14088 /* Override any gcc2 internal prototype to avoid an error.  */
14089 /* We use char because int might match the return type of a gcc2
14090    builtin and then its argument prototype would still apply.  */
14091 char lchown();
14092 int main() {
14093     /*  The GNU C library defines this for functions which it implements
14094         to always fail with ENOSYS.  Some functions are actually named
14095         something starting with __ and the normal name is an alias.  */
14096 #if defined (__stub_lchown) || defined (__stub___lchown)
14097 choke me
14098 #else
14099 lchown();
14100 #endif
14101 ; return 0; }
14102 EOCP
14103 set try
14104 if eval $compile; then
14105     $echo "lchown() found." >&4
14106     val="$define"
14107 else
14108     $echo "lchown() NOT found." >&4
14109     val="$undef"
14110 fi
14111 set d_lchown
14112 eval $setvar
14113
14114 : See if number of significant digits in a double precision number is known
14115 echo " "
14116 $cat >ldbl_dig.c <<EOM
14117 #$i_limits I_LIMITS
14118 #$i_float I_FLOAT
14119 #ifdef I_LIMITS
14120 #include <limits.h>
14121 #endif
14122 #ifdef I_FLOAT
14123 #include <float.h>
14124 #endif
14125 #ifdef LDBL_DIG
14126 printf("Contains LDBL_DIG");
14127 #endif
14128 EOM
14129 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14130 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14131         echo "LDBL_DIG found." >&4
14132         val="$define"
14133 else
14134         echo "LDBL_DIG NOT found." >&4
14135         val="$undef"
14136 fi
14137 $rm -f ldbl_dig.?
14138 set d_ldbl_dig
14139 eval $setvar
14140
14141 : see if this is a math.h system
14142 set math.h i_math
14143 eval $inhdr
14144
14145 d_libm_lib_version="$undef"
14146 case $i_math in
14147     $define)
14148         : check to see if math.h defines _LIB_VERSION
14149         echo " "
14150         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14151         $cat >try.c <<EOCP
14152 #include <unistd.h>
14153 #include <math.h>
14154 int main (int argc, char *argv[])
14155 {
14156     printf ("%d\n", _LIB_VERSION);
14157     return (0);
14158     } /* main */
14159 EOCP
14160         set try
14161         if eval $compile; then
14162             foo=`$run ./try`
14163             echo "Yes, it does ($foo)" >&4
14164             d_libm_lib_version="$define"
14165         else
14166             echo "No, it does not (probably harmless)\n" >&4
14167             fi
14168         $rm -f try.* try core core.try.*
14169         ;;
14170
14171     esac
14172
14173 : see if link exists
14174 set link d_link
14175 eval $inlibc
14176
14177 : see if localtime_r exists
14178 set localtime_r d_localtime_r
14179 eval $inlibc
14180 case "$d_localtime_r" in
14181 "$define")
14182         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14183         case "$d_localtime_r_proto:$usethreads" in
14184         ":define")      d_localtime_r_proto=define
14185                 set d_localtime_r_proto localtime_r $hdrs
14186                 eval $hasproto ;;
14187         *)      ;;
14188         esac
14189         case "$d_localtime_r_proto" in
14190         define)
14191         case "$localtime_r_proto" in
14192         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14193         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14194         esac
14195         case "$localtime_r_proto" in
14196         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14197         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14198         esac
14199         case "$localtime_r_proto" in
14200         ''|0)   d_localtime_r=undef
14201                 localtime_r_proto=0
14202                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14203         * )     case "$localtime_r_proto" in
14204                 REENTRANT_PROTO*) ;;
14205                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14206                 esac
14207                 echo "Prototype: $try" ;;
14208         esac
14209         ;;
14210         *)      case "$usethreads" in
14211                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14212                 esac
14213                 d_localtime_r=undef
14214                 localtime_r_proto=0
14215                 ;;
14216         esac
14217         ;;
14218 *)      localtime_r_proto=0
14219         ;;
14220 esac
14221
14222 : see if localeconv exists
14223 set localeconv d_locconv
14224 eval $inlibc
14225
14226 : see if lockf exists
14227 set lockf d_lockf
14228 eval $inlibc
14229
14230 : see if prototype for lseek is available
14231 echo " "
14232 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14233 eval $hasproto
14234
14235 : see if lstat exists
14236 set lstat d_lstat
14237 eval $inlibc
14238
14239 : see if madvise exists
14240 set madvise d_madvise
14241 eval $inlibc
14242
14243 : see if mblen exists
14244 set mblen d_mblen
14245 eval $inlibc
14246
14247 : see if mbstowcs exists
14248 set mbstowcs d_mbstowcs
14249 eval $inlibc
14250
14251 : see if mbtowc exists
14252 set mbtowc d_mbtowc
14253 eval $inlibc
14254
14255 : see if memchr exists
14256 set memchr d_memchr
14257 eval $inlibc
14258
14259 : see if memcmp exists
14260 set memcmp d_memcmp
14261 eval $inlibc
14262
14263 : see if memcpy exists
14264 set memcpy d_memcpy
14265 eval $inlibc
14266
14267 : see if memmove exists
14268 set memmove d_memmove
14269 eval $inlibc
14270
14271 : see if memset exists
14272 set memset d_memset
14273 eval $inlibc
14274
14275 : see if mkdir exists
14276 set mkdir d_mkdir
14277 eval $inlibc
14278
14279 : see if mkdtemp exists
14280 set mkdtemp d_mkdtemp
14281 eval $inlibc
14282
14283 : see if mkfifo exists
14284 set mkfifo d_mkfifo
14285 eval $inlibc
14286
14287 : see if mkstemp exists
14288 set mkstemp d_mkstemp
14289 eval $inlibc
14290
14291 : see if mkstemps exists
14292 set mkstemps d_mkstemps
14293 eval $inlibc
14294
14295 : see if mktime exists
14296 set mktime d_mktime
14297 eval $inlibc
14298
14299 : see if this is a sys/mman.h system
14300 set sys/mman.h i_sysmman
14301 eval $inhdr
14302
14303 : see if mmap exists
14304 set mmap d_mmap
14305 eval $inlibc
14306 : see what shmat returns
14307 : default to something harmless
14308 mmaptype='void *'
14309 case "$i_sysmman$d_mmap" in
14310 "$define$define")
14311         $cat >mmap.c <<'END'
14312 #include <sys/mman.h>
14313 void *mmap();
14314 END
14315         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14316                 mmaptype='void *'
14317         else
14318                 mmaptype='caddr_t'
14319         fi
14320         echo "and it returns ($mmaptype)." >&4
14321         ;;
14322 esac
14323
14324
14325
14326 : see if sqrtl exists
14327 set sqrtl d_sqrtl
14328 eval $inlibc
14329
14330 : see if scalbnl exists
14331 set scalbnl d_scalbnl
14332 eval $inlibc
14333
14334 : see if modfl exists
14335 set modfl d_modfl
14336 eval $inlibc
14337
14338 : see if prototype for modfl is available
14339 echo " "
14340 set d_modflproto modfl $i_math math.h
14341 eval $hasproto
14342
14343 d_modfl_pow32_bug="$undef"
14344
14345 case "$d_longdbl$d_modfl" in
14346 $define$define)
14347         $cat <<EOM
14348 Checking to see whether your modfl() is okay for large values...
14349 EOM
14350 $cat >try.c <<EOCP
14351 #include <math.h> 
14352 #include <stdio.h>
14353 EOCP
14354 if $test "X$d_modflproto" != "X$define"; then
14355         $cat >>try.c <<EOCP
14356 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
14357 long double modfl (long double, long double *);
14358 EOCP
14359 fi
14360 $cat >>try.c <<EOCP
14361 int main() {
14362     long double nv = 4294967303.15;
14363     long double v, w;
14364     v = modfl(nv, &w);         
14365 #ifdef __GLIBC__
14366     printf("glibc");
14367 #endif
14368     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14369     return 0;
14370 }
14371 EOCP
14372         case "$osname:$gccversion" in
14373         aix:)   saveccflags="$ccflags"
14374                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14375         esac
14376         set try
14377         if eval $compile; then
14378                 foo=`$run ./try`
14379                 case "$foo" in
14380                 *" 4294967303.150000 1.150000 4294967302.000000")
14381                         echo >&4 "Your modfl() is broken for large values."
14382                         d_modfl_pow32_bug="$define"
14383                         case "$foo" in
14384                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14385                         ;;
14386                         esac
14387                         ;;
14388                 *" 4294967303.150000 0.150000 4294967303.000000")
14389                         echo >&4 "Your modfl() seems okay for large values."
14390                         ;;
14391                 *)      echo >&4 "I don't understand your modfl() at all."
14392                         d_modfl="$undef"
14393                         ;;
14394                 esac
14395                 $rm -f try.* try core core.try.*
14396         else
14397                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14398                 d_modfl="$undef"
14399         fi
14400         case "$osname:$gccversion" in
14401         aix:)   ccflags="$saveccflags" ;; # restore
14402         esac
14403         ;;
14404 esac
14405
14406 if $test "$uselongdouble" = "$define"; then
14407     message=""
14408     if $test "$d_sqrtl" != "$define"; then
14409         message="$message sqrtl"
14410     fi
14411     if $test "$d_modfl" != "$define"; then
14412         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14413             echo "You have both aintl and copysignl, so I can emulate modfl."
14414         else
14415             message="$message modfl"
14416         fi
14417     fi
14418     if $test "$d_frexpl" != "$define"; then
14419         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14420             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14421         else
14422             message="$message frexpl"
14423         fi
14424     fi
14425
14426     if $test "$message" != ""; then
14427         $cat <<EOM >&4
14428
14429 *** You requested the use of long doubles but you do not seem to have
14430 *** the following mathematical functions needed for long double support:
14431 ***    $message
14432 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14433 *** Cannot continue, aborting.
14434
14435 EOM
14436
14437         exit 1
14438     fi
14439 fi
14440
14441 : see if mprotect exists
14442 set mprotect d_mprotect
14443 eval $inlibc
14444
14445 : see if msgctl exists
14446 set msgctl d_msgctl
14447 eval $inlibc
14448
14449 : see if msgget exists
14450 set msgget d_msgget
14451 eval $inlibc
14452
14453 : see if msgsnd exists
14454 set msgsnd d_msgsnd
14455 eval $inlibc
14456
14457 : see if msgrcv exists
14458 set msgrcv d_msgrcv
14459 eval $inlibc
14460
14461 : see how much of the 'msg*(2)' library is present.
14462 h_msg=true
14463 echo " "
14464 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14465 *"$undef"*) h_msg=false;;
14466 esac
14467 case "$osname" in
14468 freebsd)
14469     case "`ipcs 2>&1`" in
14470     "SVID messages"*"not configured"*)
14471         echo "Your $osname does not have the msg*(2) configured." >&4
14472         h_msg=false
14473         val="$undef"
14474         set msgctl d_msgctl
14475         eval $setvar
14476         set msgget d_msgget
14477         eval $setvar
14478         set msgsnd d_msgsnd
14479         eval $setvar
14480         set msgrcv d_msgrcv
14481         eval $setvar
14482         ;;
14483     esac
14484     ;;
14485 esac
14486 : we could also check for sys/ipc.h ...
14487 if $h_msg && $test `./findhdr sys/msg.h`; then
14488         echo "You have the full msg*(2) library." >&4
14489         val="$define"
14490 else
14491         echo "You don't have the full msg*(2) library." >&4
14492         val="$undef"
14493 fi
14494 set d_msg
14495 eval $setvar
14496
14497
14498 echo " "
14499 echo "Checking to see if your system supports struct msghdr..." >&4
14500 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14501 eval $hasstruct
14502 case "$d_msghdr_s" in
14503 "$define")      echo "Yes, it does."   ;;
14504 *)              echo "No, it doesn't." ;;
14505 esac
14506
14507
14508 : see if msync exists
14509 set msync d_msync
14510 eval $inlibc
14511
14512 : see if munmap exists
14513 set munmap d_munmap
14514 eval $inlibc
14515
14516 : see if nice exists
14517 set nice d_nice
14518 eval $inlibc
14519
14520 : see if this is a langinfo.h system
14521 set langinfo.h i_langinfo
14522 eval $inhdr
14523
14524 : see if nl_langinfo exists
14525 set nl_langinfo d_nl_langinfo
14526 eval $inlibc
14527
14528 : check for length of character
14529 echo " "
14530 case "$charsize" in
14531 '')
14532         echo "Checking to see how big your characters are (hey, you never know)..." >&4
14533         $cat >try.c <<EOCP
14534 #include <stdio.h>
14535 #$i_stdlib I_STDLIB
14536 #ifdef I_STDLIB
14537 #include <stdlib.h>
14538 #endif
14539 int main()
14540 {
14541     printf("%d\n", (int)sizeof(char));
14542     exit(0);
14543 }
14544 EOCP
14545         set try
14546         if eval $compile_ok; then
14547                 dflt=`$run ./try`
14548         else
14549                 dflt='1'
14550                 echo "(I can't seem to compile the test program.  Guessing...)"
14551         fi
14552         ;;
14553 *)
14554         dflt="$charsize"
14555         ;;
14556 esac
14557 rp="What is the size of a character (in bytes)?"
14558 . ./myread
14559 charsize="$ans"
14560 $rm -f try.c try
14561
14562 : check for volatile keyword
14563 echo " "
14564 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
14565 $cat >try.c <<'EOCP'
14566 int main()
14567 {
14568         typedef struct _goo_struct goo_struct;
14569         goo_struct * volatile goo = ((goo_struct *)0);
14570         struct _goo_struct {
14571                 long long_int;
14572                 int reg_int;
14573                 char char_var;
14574         };
14575         typedef unsigned short foo_t;
14576         char *volatile foo;
14577         volatile int bar;
14578         volatile foo_t blech;
14579         foo = foo;
14580 }
14581 EOCP
14582 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
14583         val="$define"
14584         echo "Yup, it does."
14585 else
14586         val="$undef"
14587         echo "Nope, it doesn't."
14588 fi
14589 set d_volatile
14590 eval $setvar
14591 $rm -f try.*
14592
14593
14594 echo " "
14595 $echo "Choosing the C types to be used for Perl's internal types..." >&4
14596
14597 case "$use64bitint:$d_quad:$quadtype" in
14598 define:define:?*)
14599         ivtype="$quadtype"
14600         uvtype="$uquadtype"
14601         ivsize=8
14602         uvsize=8
14603         ;;
14604 *)      ivtype="long"
14605         uvtype="unsigned long"
14606         ivsize=$longsize
14607         uvsize=$longsize
14608         ;;
14609 esac
14610
14611 case "$uselongdouble:$d_longdbl" in
14612 define:define)
14613         nvtype="long double"
14614         nvsize=$longdblsize
14615         ;;
14616 *)      nvtype=double
14617         nvsize=$doublesize
14618         ;;
14619 esac
14620
14621 $echo "(IV will be "$ivtype", $ivsize bytes)"
14622 $echo "(UV will be "$uvtype", $uvsize bytes)"
14623 $echo "(NV will be "$nvtype", $nvsize bytes)"
14624
14625 $cat >try.c <<EOCP
14626 #$i_inttypes I_INTTYPES
14627 #ifdef I_INTTYPES
14628 #include <inttypes.h>
14629 #endif
14630 #include <stdio.h>
14631 int main() {
14632 #ifdef INT8
14633    int8_t i =  INT8_MAX;
14634   uint8_t u = UINT8_MAX;
14635   printf("int8_t\n");
14636 #endif
14637 #ifdef INT16
14638    int16_t i =  INT16_MAX;
14639   uint16_t i = UINT16_MAX;
14640   printf("int16_t\n");
14641 #endif
14642 #ifdef INT32
14643    int32_t i =  INT32_MAX;
14644   uint32_t u = UINT32_MAX;
14645   printf("int32_t\n");
14646 #endif
14647 }
14648 EOCP
14649
14650 case "$i8type" in
14651 '')     case "$charsize" in
14652         1)      i8type=char
14653                 u8type="unsigned char"
14654                 i8size=$charsize
14655                 u8size=$charsize
14656                 ;;
14657         esac
14658         ;;
14659 esac
14660 case "$i8type" in
14661 '')     set try -DINT8
14662         if eval $compile; then
14663                 case "`$run ./try`" in
14664                 int8_t) i8type=int8_t
14665                         u8type=uint8_t
14666                         i8size=1
14667                         u8size=1
14668                         ;;
14669                 esac
14670         fi
14671         ;;
14672 esac
14673 case "$i8type" in
14674 '')     if $test $charsize -ge 1; then
14675                 i8type=char
14676                 u8type="unsigned char"
14677                 i8size=$charsize
14678                 u8size=$charsize
14679         fi
14680         ;;
14681 esac
14682
14683 case "$i16type" in
14684 '')     case "$shortsize" in
14685         2)      i16type=short
14686                 u16type="unsigned short"
14687                 i16size=$shortsize
14688                 u16size=$shortsize
14689                 ;;
14690         esac
14691         ;;
14692 esac
14693 case "$i16type" in
14694 '')     set try -DINT16
14695         if eval $compile; then
14696                 case "`$run ./try`" in
14697                 int16_t)
14698                         i16type=int16_t
14699                         u16type=uint16_t
14700                         i16size=2
14701                         u16size=2
14702                         ;;
14703                 esac
14704         fi
14705         ;;
14706 esac
14707 case "$i16type" in
14708 '')     if $test $shortsize -ge 2; then
14709                 i16type=short
14710                 u16type="unsigned short"
14711                 i16size=$shortsize
14712                 u16size=$shortsize
14713         fi
14714         ;;
14715 esac
14716
14717 case "$i32type" in
14718 '')     case "$longsize" in
14719         4)      i32type=long
14720                 u32type="unsigned long"
14721                 i32size=$longsize
14722                 u32size=$longsize
14723                 ;;
14724         *)      case "$intsize" in
14725                 4)      i32type=int
14726                         u32type="unsigned int"
14727                         i32size=$intsize
14728                         u32size=$intsize
14729                         ;;
14730                 esac
14731                 ;;
14732         esac
14733         ;;
14734 esac
14735 case "$i32type" in
14736 '')     set try -DINT32
14737         if eval $compile; then
14738                 case "`$run ./try`" in
14739                 int32_t)
14740                         i32type=int32_t
14741                         u32type=uint32_t
14742                         i32size=4
14743                         u32size=4
14744                         ;;
14745                 esac
14746         fi
14747         ;;
14748 esac
14749 case "$i32type" in
14750 '')     if $test $intsize -ge 4; then
14751                 i32type=int
14752                 u32type="unsigned int"
14753                 i32size=$intsize
14754                 u32size=$intsize
14755         fi
14756         ;;
14757 esac
14758
14759 case "$i64type" in
14760 '')     case "$d_quad:$quadtype" in
14761         define:?*)
14762                 i64type="$quadtype"
14763                 u64type="$uquadtype"
14764                 i64size=8
14765                 u64size=8
14766                 ;;
14767         esac
14768         ;;
14769 esac
14770
14771 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
14772 : volatile so that the compiler has to store it out to memory.
14773 if test X"$d_volatile" = X"$define"; then
14774         volatile=volatile
14775 fi
14776 $cat <<EOP >try.c
14777 #include <stdio.h>
14778 #$i_stdlib I_STDLIB
14779 #ifdef I_STDLIB
14780 #include <stdlib.h>
14781 #endif
14782 #include <sys/types.h>
14783 #include <signal.h>
14784 #ifdef SIGFPE
14785 $volatile int bletched = 0;
14786 $signal_t blech(s) int s; { bletched = 1; }
14787 #endif
14788 int main() {
14789     $uvtype u = 0;
14790     $nvtype d;
14791     int     n = 8 * $uvsize;
14792     int     i;
14793 #ifdef SIGFPE
14794     signal(SIGFPE, blech);
14795 #endif
14796
14797     for (i = 0; i < n; i++) {
14798       u = u << 1 | ($uvtype)1;
14799       d = ($nvtype)u;
14800       if (($uvtype)d != u)
14801         break;
14802       if (d <= 0)
14803         break;
14804       d = ($nvtype)(u - 1);
14805       if (($uvtype)d != (u - 1))
14806         break;
14807 #ifdef SIGFPE
14808       if (bletched) {
14809         break;
14810 #endif
14811       } 
14812     }
14813     printf("%d\n", ((i == n) ? -n : i));
14814     exit(0);
14815 }
14816 EOP
14817 set try
14818
14819 d_nv_preserves_uv="$undef"
14820 if eval $compile; then
14821         nv_preserves_uv_bits="`$run ./try`"
14822 fi
14823 case "$nv_preserves_uv_bits" in
14824 \-[1-9]*)       
14825         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
14826         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
14827         d_nv_preserves_uv="$define"
14828         ;;
14829 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
14830         d_nv_preserves_uv="$undef" ;;
14831 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
14832         nv_preserves_uv_bits="$undef" ;;
14833 esac
14834
14835 $rm -f try.* try
14836
14837 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
14838 : volatile so that the compiler has to store it out to memory.
14839 if test X"$d_volatile" = X"$define"; then
14840         volatile=volatile
14841 fi
14842 $cat <<EOP >try.c
14843 #include <stdio.h>
14844 #$i_stdlib I_STDLIB
14845 #ifdef I_STDLIB
14846 #include <stdlib.h>
14847 #endif
14848 #$i_string I_STRING
14849 #ifdef I_STRING
14850 #  include <string.h>
14851 #else
14852 #  include <strings.h>
14853 #endif
14854 #include <sys/types.h>
14855 #include <signal.h>
14856 #ifdef SIGFPE
14857 $volatile int bletched = 0;
14858 $signal_t blech(s) int s; { bletched = 1; }
14859 #endif
14860
14861 int checkit($nvtype d, char *where) {
14862     unsigned char *p = (char *)&d;
14863     unsigned char *end = p + sizeof(d);
14864     int fail = 0;
14865
14866     while (p < end)
14867         fail += *p++;
14868
14869     if (!fail)
14870         return 0;
14871
14872     p = (char *)&d;
14873     printf("No - %s: 0x", where);
14874     while (p < end)
14875         printf ("%02X", *p++);
14876     printf("\n");
14877     return 1;
14878 }
14879
14880 int main(int argc, char **argv) {
14881     $nvtype d = 0.0;
14882     int fail = 0;
14883     fail += checkit(d, "0.0");
14884
14885     /* The compiler shouldn't be assuming that bletched is 0  */
14886     d = bletched;
14887
14888     fail += checkit(d, "bleched");
14889
14890 #ifdef SIGFPE
14891     signal(SIGFPE, blech);
14892 #endif
14893
14894     /* Paranoia - the compiler should have no way of knowing that ANSI says
14895        that argv[argc] will always be NULL.  Actually, if it did assume this it
14896        would be buggy, as this is C and main() can be called from elsewhere in
14897        the program.  */
14898     d = argv[argc] ? 1 : 0;
14899
14900     if (d) {
14901         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
14902     }
14903
14904     fail += checkit(d, "ternary");
14905
14906     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
14907
14908     if (d != 0.0) {
14909         printf("No - memset doesn't give 0.0\n");
14910         /* This might just blow up:  */
14911         printf("(gives %g)\n", d);
14912         return 1;
14913     }
14914     
14915 #ifdef SIGFPE
14916     if (bletched) {
14917         printf("No - something bleched\n");
14918         return 1;
14919     }
14920 #endif
14921     if (fail) {
14922       printf("No - %d fail(s)\n", fail);
14923       return 1;
14924     }
14925     printf("Yes\n");
14926     return 0;
14927 }
14928 EOP
14929 set try
14930
14931 d_nv_zero_is_allbits_zero="$undef"
14932 if eval $compile; then
14933     xxx="`$run ./try`"
14934     case "$?" in
14935         0)
14936             case "$xxx" in
14937                 Yes)  cat >&4 <<EOM
14938 0.0 is represented as all bits zero in memory
14939 EOM
14940                     d_nv_zero_is_allbits_zero="$define"
14941                     ;;
14942                 *)  cat >&4 <<EOM
14943 0.0 is not represented as all bits zero in memory
14944 EOM
14945                     d_nv_zero_is_allbits_zero="$undef"
14946                     ;;
14947             esac
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 fi
14956
14957 $rm -f try.* try
14958
14959
14960 : check for off64_t
14961 echo " "
14962 echo "Checking to see if you have off64_t..." >&4
14963 $cat >try.c <<EOCP
14964 #include <sys/types.h>
14965 #include <unistd.h>
14966 int main() { off64_t x = 7; }
14967 EOCP
14968 set try
14969 if eval $compile; then
14970         val="$define"
14971         echo "You have off64_t."
14972 else
14973         val="$undef"
14974         echo "You do not have off64_t."
14975         case "$lseeksize" in
14976         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
14977         esac
14978 fi
14979 $rm -f try.* try
14980 set d_off64_t
14981 eval $setvar
14982
14983 : how to create joinable pthreads
14984 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
14985         echo " "
14986         echo "Checking what constant to use for creating joinable pthreads..." >&4 
14987         $cat >try.c <<'EOCP'
14988 #include <pthread.h>
14989 int main() {
14990     int detachstate = JOINABLE;
14991 }
14992 EOCP
14993         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
14994         if eval $compile; then
14995                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
14996                 val="$undef" # Yes, undef.
14997                 set d_old_pthread_create_joinable
14998                 eval $setvar
14999                 val=""
15000                 set old_pthread_create_joinable
15001                 eval $setvar
15002         else
15003                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15004                 if eval $compile; then
15005                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15006                         val="$define"
15007                         set d_old_pthread_create_joinable
15008                         eval $setvar
15009                         val=PTHREAD_CREATE_UNDETACHED
15010                         set old_pthread_create_joinable
15011                         eval $setvar
15012                 else            
15013                         set try -DJOINABLE=__UNDETACHED
15014                         if eval $compile; then
15015                                 echo "You seem to use __UNDETACHED." >&4
15016                                 val="$define"
15017                                 set d_old_pthread_create_joinable
15018                                 eval $setvar
15019                                 val=__UNDETACHED
15020                                 set old_pthread_create_joinable
15021                                 eval $setvar
15022                         else
15023                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15024                                 val="$define"
15025                                 set d_old_pthread_create_joinable
15026                                 eval $setvar
15027                                 val=0
15028                                 set old_pthread_create_joinable
15029                                 eval $setvar
15030                         fi
15031                 fi
15032         fi
15033         $rm -f try try.*
15034 else
15035     d_old_pthread_create_joinable="$undef"
15036     old_pthread_create_joinable=""
15037 fi
15038
15039 : see if pause exists
15040 set pause d_pause
15041 eval $inlibc
15042
15043 : see if pipe exists
15044 set pipe d_pipe
15045 eval $inlibc
15046
15047 : see if poll exists
15048 set poll d_poll
15049 eval $inlibc
15050
15051 : see if readlink exists
15052 set readlink d_readlink
15053 eval $inlibc
15054
15055 echo " "
15056 procselfexe=''
15057 val="$undef"
15058 case "$d_readlink" in
15059 "$define")
15060         if $issymlink /proc/self/exe ; then
15061                 $ls -l /proc/self/exe > reflect
15062                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15063                         echo "You have Linux-like /proc/self/exe."
15064                         procselfexe='"/proc/self/exe"'
15065                         val="$define"
15066                 fi
15067         fi
15068         if $issymlink /proc/curproc/file ; then
15069                 $ls -l /proc/curproc/file > reflect
15070                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15071                         echo "You have BSD-like /proc/curproc/file."
15072                         procselfexe='"/proc/curproc/file"'
15073                         val="$define"
15074                 fi
15075         fi
15076         ;;
15077 esac
15078 $rm -f reflect
15079 set d_procselfexe
15080 eval $setvar
15081
15082 : see whether the pthread_atfork exists
15083 $cat >try.c <<EOP
15084 #include <pthread.h>
15085 #include <stdio.h>
15086 int main() {
15087 #ifdef  PTHREAD_ATFORK
15088         pthread_atfork(NULL,NULL,NULL);
15089 #endif
15090 }
15091 EOP
15092
15093 : see if pthread_atfork exists
15094 set try -DPTHREAD_ATFORK
15095 if eval $compile; then
15096     val="$define"
15097 else
15098     val="$undef"
15099 fi
15100 case "$usethreads" in
15101 $define)
15102         case "$val" in
15103         $define) echo 'pthread_atfork found.' >&4        ;;
15104         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15105         esac
15106 esac
15107 set d_pthread_atfork
15108 eval $setvar
15109
15110 : see if pthread_attr_setscope exists
15111 set pthread_attr_setscope d_pthread_attr_setscope
15112 eval $inlibc
15113
15114
15115 : see whether the various POSIXish _yields exist
15116 $cat >try.c <<EOP
15117 #include <pthread.h>
15118 #include <stdio.h>
15119 int main() {
15120 #ifdef SCHED_YIELD
15121         sched_yield();
15122 #else
15123 #ifdef PTHREAD_YIELD
15124         pthread_yield();
15125 #else
15126 #ifdef PTHREAD_YIELD_NULL
15127         pthread_yield(NULL);
15128 #endif
15129 #endif
15130 #endif
15131 }
15132 EOP
15133 : see if sched_yield exists
15134 set try -DSCHED_YIELD
15135 if eval $compile; then
15136     val="$define"
15137     sched_yield='sched_yield()'
15138 else
15139     val="$undef"
15140 fi
15141 case "$usethreads" in
15142 $define)
15143         case "$val" in
15144         $define) echo 'sched_yield() found.' >&4        ;;
15145         *)       echo 'sched_yield() NOT found.' >&4    ;;
15146         esac
15147 esac
15148 set d_sched_yield
15149 eval $setvar
15150
15151 : see if pthread_yield exists
15152 set try -DPTHREAD_YIELD
15153 if eval $compile; then
15154     val="$define"
15155     case "$sched_yield" in
15156     '') sched_yield='pthread_yield()' ;;
15157     esac
15158 else
15159     set try -DPTHREAD_YIELD_NULL
15160     if eval $compile; then
15161         val="$define"
15162         case "$sched_yield" in
15163         '') sched_yield='pthread_yield(NULL)' ;;
15164         esac
15165     else
15166         val="$undef"
15167     fi
15168 fi
15169 case "$usethreads" in
15170 $define)
15171         case "$val" in
15172         $define) echo 'pthread_yield() found.' >&4      ;;
15173         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15174         esac
15175         ;;
15176 esac
15177 set d_pthread_yield
15178 eval $setvar
15179
15180 case "$sched_yield" in
15181 '') sched_yield=undef ;;
15182 esac
15183
15184 $rm -f try try.*
15185
15186 : see if random_r exists
15187 set random_r d_random_r
15188 eval $inlibc
15189 case "$d_random_r" in
15190 "$define")
15191         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15192         case "$d_random_r_proto:$usethreads" in
15193         ":define")      d_random_r_proto=define
15194                 set d_random_r_proto random_r $hdrs
15195                 eval $hasproto ;;
15196         *)      ;;
15197         esac
15198         case "$d_random_r_proto" in
15199         define)
15200         case "$random_r_proto" in
15201         ''|0) try='int random_r(int*, struct random_data*);'
15202         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15203         esac
15204         case "$random_r_proto" in
15205         ''|0) try='int random_r(long*, struct random_data*);'
15206         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15207         esac
15208         case "$random_r_proto" in
15209         ''|0) try='int random_r(struct random_data*, int32_t*);'
15210         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15211         esac
15212         case "$random_r_proto" in
15213         ''|0)   d_random_r=undef
15214                 random_r_proto=0
15215                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
15216         * )     case "$random_r_proto" in
15217                 REENTRANT_PROTO*) ;;
15218                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15219                 esac
15220                 echo "Prototype: $try" ;;
15221         esac
15222         ;;
15223         *)      case "$usethreads" in
15224                 define) echo "random_r has no prototype, not using it." >&4 ;;
15225                 esac
15226                 d_random_r=undef
15227                 random_r_proto=0
15228                 ;;
15229         esac
15230         ;;
15231 *)      random_r_proto=0
15232         ;;
15233 esac
15234
15235 : see if readdir and friends exist
15236 set readdir d_readdir
15237 eval $inlibc
15238 set seekdir d_seekdir
15239 eval $inlibc
15240 set telldir d_telldir
15241 eval $inlibc
15242 set rewinddir d_rewinddir
15243 eval $inlibc
15244
15245 : see if readdir64_r exists
15246 set readdir64_r d_readdir64_r
15247 eval $inlibc
15248 case "$d_readdir64_r" in
15249 "$define")
15250         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15251         case "$d_readdir64_r_proto:$usethreads" in
15252         ":define")      d_readdir64_r_proto=define
15253                 set d_readdir64_r_proto readdir64_r $hdrs
15254                 eval $hasproto ;;
15255         *)      ;;
15256         esac
15257         case "$d_readdir64_r_proto" in
15258         define)
15259         case "$readdir64_r_proto" in
15260         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15261         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15262         esac
15263         case "$readdir64_r_proto" in
15264         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15265         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15266         esac
15267         case "$readdir64_r_proto" in
15268         ''|0)   d_readdir64_r=undef
15269                 readdir64_r_proto=0
15270                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
15271         * )     case "$readdir64_r_proto" in
15272                 REENTRANT_PROTO*) ;;
15273                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15274                 esac
15275                 echo "Prototype: $try" ;;
15276         esac
15277         ;;
15278         *)      case "$usethreads" in
15279                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15280                 esac
15281                 d_readdir64_r=undef
15282                 readdir64_r_proto=0
15283                 ;;
15284         esac
15285         ;;
15286 *)      readdir64_r_proto=0
15287         ;;
15288 esac
15289
15290 : see if readdir_r exists
15291 set readdir_r d_readdir_r
15292 eval $inlibc
15293 case "$d_readdir_r" in
15294 "$define")
15295         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15296         case "$d_readdir_r_proto:$usethreads" in
15297         ":define")      d_readdir_r_proto=define
15298                 set d_readdir_r_proto readdir_r $hdrs
15299                 eval $hasproto ;;
15300         *)      ;;
15301         esac
15302         case "$d_readdir_r_proto" in
15303         define)
15304         case "$readdir_r_proto" in
15305         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15306         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15307         esac
15308         case "$readdir_r_proto" in
15309         ''|0) try='int readdir_r(DIR*, struct dirent*);'
15310         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15311         esac
15312         case "$readdir_r_proto" in
15313         ''|0)   d_readdir_r=undef
15314                 readdir_r_proto=0
15315                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
15316         * )     case "$readdir_r_proto" in
15317                 REENTRANT_PROTO*) ;;
15318                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15319                 esac
15320                 echo "Prototype: $try" ;;
15321         esac
15322         ;;
15323         *)      case "$usethreads" in
15324                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15325                 esac
15326                 d_readdir_r=undef
15327                 readdir_r_proto=0
15328                 ;;
15329         esac
15330         ;;
15331 *)      readdir_r_proto=0
15332         ;;
15333 esac
15334
15335 : see if readv exists
15336 set readv d_readv
15337 eval $inlibc
15338
15339 : see if recvmsg exists
15340 set recvmsg d_recvmsg
15341 eval $inlibc
15342
15343 : see if rename exists
15344 set rename d_rename
15345 eval $inlibc
15346
15347 : see if rmdir exists
15348 set rmdir d_rmdir
15349 eval $inlibc
15350
15351 : see if memory.h is available.
15352 val=''
15353 set memory.h val
15354 eval $inhdr
15355
15356 : See if it conflicts with string.h
15357 case "$val" in
15358 $define)
15359         case "$strings" in
15360         '') ;;
15361         *)
15362                 $cppstdin $cppflags $cppminus < $strings > mem.h
15363                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15364                         echo " "
15365                         echo "We won't be including <memory.h>."
15366                         val="$undef"
15367                 fi
15368                 $rm -f mem.h
15369                 ;;
15370         esac
15371 esac
15372 set i_memory
15373 eval $setvar
15374
15375 : can bcopy handle overlapping blocks?
15376 echo " "
15377 val="$undef"
15378 case "$d_memmove" in
15379 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15380 *)      case "$d_bcopy" in
15381         "$define")
15382                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15383                 $cat >try.c <<EOCP
15384 #$i_memory I_MEMORY
15385 #$i_stdlib I_STDLIB
15386 #$i_string I_STRING
15387 #$i_unistd I_UNISTD
15388 EOCP
15389         $cat >>try.c <<'EOCP'
15390 #include <stdio.h>
15391 #ifdef I_MEMORY
15392 #  include <memory.h>
15393 #endif
15394 #ifdef I_STDLIB
15395 #  include <stdlib.h>
15396 #endif
15397 #ifdef I_STRING
15398 #  include <string.h>
15399 #else
15400 #  include <strings.h>
15401 #endif
15402 #ifdef I_UNISTD
15403 #  include <unistd.h>  /* Needed for NetBSD */
15404 #endif
15405 int main()
15406 {
15407 char buf[128], abc[128];
15408 char *b;
15409 int len;
15410 int off;
15411 int align;
15412
15413 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15414    try to store the string in read-only memory. */
15415 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15416
15417 for (align = 7; align >= 0; align--) {
15418         for (len = 36; len; len--) {
15419                 b = buf+align;
15420                 bcopy(abc, b, len);
15421                 for (off = 1; off <= len; off++) {
15422                         bcopy(b, b+off, len);
15423                         bcopy(b+off, b, len);
15424                         if (bcmp(b, abc, len))
15425                                 exit(1);
15426                 }
15427         }
15428 }
15429 exit(0);
15430 }
15431 EOCP
15432                 set try
15433                 if eval $compile_ok; then
15434                         if ./try 2>/dev/null; then
15435                                 echo "Yes, it can."
15436                                 val="$define"
15437                         else
15438                                 echo "It can't, sorry."
15439                         fi
15440                 else
15441                         echo "(I can't compile the test program, so we'll assume not...)"
15442                 fi
15443                 ;;
15444         esac
15445         $rm -f try.* try core
15446         ;;
15447 esac
15448 set d_safebcpy
15449 eval $setvar
15450
15451 : can memcpy handle overlapping blocks?
15452 echo " "
15453 val="$undef"
15454 case "$d_memmove" in
15455 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15456 *)      case "$d_memcpy" in
15457         "$define")
15458                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
15459                 $cat >try.c <<EOCP
15460 #$i_memory I_MEMORY
15461 #$i_stdlib I_STDLIB
15462 #$i_string I_STRING
15463 #$i_unistd I_UNISTD
15464 EOCP
15465         $cat >>try.c <<'EOCP'
15466 #include <stdio.h>
15467 #ifdef I_MEMORY
15468 #  include <memory.h>
15469 #endif
15470 #ifdef I_STDLIB
15471 #  include <stdlib.h>
15472 #endif
15473 #ifdef I_STRING
15474 #  include <string.h>
15475 #else
15476 #  include <strings.h>
15477 #endif
15478 #ifdef I_UNISTD
15479 #  include <unistd.h>  /* Needed for NetBSD */
15480 #endif
15481 int main()
15482 {
15483 char buf[128], abc[128];
15484 char *b;
15485 int len;
15486 int off;
15487 int align;
15488
15489 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15490    try to store the string in read-only memory. */
15491 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
15492
15493 for (align = 7; align >= 0; align--) {
15494         for (len = 36; len; len--) {
15495                 b = buf+align;
15496                 memcpy(b, abc, len);
15497                 for (off = 1; off <= len; off++) {
15498                         memcpy(b+off, b, len);
15499                         memcpy(b, b+off, len);
15500                         if (memcmp(b, abc, len))
15501                                 exit(1);
15502                 }
15503         }
15504 }
15505 exit(0);
15506 }
15507 EOCP
15508                 set try
15509                 if eval $compile_ok; then
15510                         if ./try 2>/dev/null; then
15511                                 echo "Yes, it can."
15512                                 val="$define"
15513                         else
15514                                 echo "It can't, sorry."
15515                         fi
15516                 else
15517                         echo "(I can't compile the test program, so we'll assume not...)"
15518                 fi
15519                 ;;
15520         esac
15521         $rm -f try.* try core
15522         ;;
15523 esac
15524 set d_safemcpy
15525 eval $setvar
15526
15527 : can memcmp be trusted to compare relative magnitude?
15528 val="$undef"
15529 case "$d_memcmp" in
15530 "$define")
15531         echo " "
15532         echo "Checking if your memcmp() can compare relative magnitude..." >&4
15533         $cat >try.c <<EOCP
15534 #$i_memory I_MEMORY
15535 #$i_stdlib I_STDLIB
15536 #$i_string I_STRING
15537 #$i_unistd I_UNISTD
15538 EOCP
15539         $cat >>try.c <<'EOCP'
15540 #include <stdio.h>
15541 #ifdef I_MEMORY
15542 #  include <memory.h>
15543 #endif
15544 #ifdef I_STDLIB
15545 #  include <stdlib.h>
15546 #endif
15547 #ifdef I_STRING
15548 #  include <string.h>
15549 #else
15550 #  include <strings.h>
15551 #endif
15552 #ifdef I_UNISTD
15553 #  include <unistd.h>  /* Needed for NetBSD */
15554 #endif
15555 int main()
15556 {
15557 char a = -1;
15558 char b = 0;
15559 if ((a < b) && memcmp(&a, &b, 1) < 0)
15560         exit(1);
15561 exit(0);
15562 }
15563 EOCP
15564         set try
15565         if eval $compile_ok; then
15566                 if $run ./try 2>/dev/null; then
15567                         echo "Yes, it can."
15568                         val="$define"
15569                 else
15570                         echo "No, it can't (it uses signed chars)."
15571                 fi
15572         else
15573                 echo "(I can't compile the test program, so we'll assume not...)"
15574         fi
15575         ;;
15576 esac
15577 $rm -f try.* try core
15578 set d_sanemcmp
15579 eval $setvar
15580
15581 : see if prototype for sbrk is available
15582 echo " "
15583 set d_sbrkproto sbrk $i_unistd unistd.h
15584 eval $hasproto
15585
15586 : see if select exists
15587 set select d_select
15588 eval $inlibc
15589
15590 : see if semctl exists
15591 set semctl d_semctl
15592 eval $inlibc
15593
15594 : see if semget exists
15595 set semget d_semget
15596 eval $inlibc
15597
15598 : see if semop exists
15599 set semop d_semop
15600 eval $inlibc
15601
15602 : see how much of the 'sem*(2)' library is present.
15603 h_sem=true
15604 echo " "
15605 case "$d_semctl$d_semget$d_semop" in
15606 *"$undef"*) h_sem=false;;
15607 esac
15608 case "$osname" in
15609 freebsd)
15610     case "`ipcs 2>&1`" in
15611     "SVID messages"*"not configured"*)
15612         echo "Your $osname does not have the sem*(2) configured." >&4
15613         h_sem=false
15614         val="$undef"
15615         set semctl d_semctl
15616         eval $setvar
15617         set semget d_semget
15618         eval $setvar
15619         set semop d_semop
15620         eval $setvar
15621         ;;
15622     esac
15623     ;;
15624 esac
15625 : we could also check for sys/ipc.h ...
15626 if $h_sem && $test `./findhdr sys/sem.h`; then
15627         echo "You have the full sem*(2) library." >&4
15628         val="$define"
15629 else
15630         echo "You don't have the full sem*(2) library." >&4
15631         val="$undef"
15632 fi
15633 set d_sem
15634 eval $setvar
15635
15636 : see whether sys/sem.h defines union semun
15637 echo " "
15638 $cat > try.c <<'END'
15639 #include <sys/types.h>
15640 #include <sys/ipc.h>
15641 #include <sys/sem.h>
15642 int main () { union semun semun; semun.buf = 0; }
15643 END
15644 set try
15645 if eval $compile; then
15646     echo "You have union semun in <sys/sem.h>." >&4
15647     val="$define"
15648 else
15649     echo "You do not have union semun in <sys/sem.h>." >&4
15650     val="$undef"
15651 fi
15652 $rm -f try try.c
15653 set d_union_semun
15654 eval $setvar
15655
15656 : see how to do semctl IPC_STAT
15657 case "$d_sem" in
15658 $define)
15659     echo " "
15660     $cat > try.h <<END
15661 #ifndef S_IRUSR
15662 #   ifdef S_IREAD
15663 #       define S_IRUSR S_IREAD
15664 #       define S_IWUSR S_IWRITE
15665 #       define S_IXUSR S_IEXEC
15666 #   else
15667 #       define S_IRUSR 0400
15668 #       define S_IWUSR 0200
15669 #       define S_IXUSR 0100
15670 #   endif
15671 #   define S_IRGRP (S_IRUSR>>3)
15672 #   define S_IWGRP (S_IWUSR>>3)
15673 #   define S_IXGRP (S_IXUSR>>3)
15674 #   define S_IROTH (S_IRUSR>>6)
15675 #   define S_IWOTH (S_IWUSR>>6)
15676 #   define S_IXOTH (S_IXUSR>>6)
15677 #endif
15678 #ifndef S_IRWXU
15679 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
15680 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
15681 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
15682 #endif
15683 END
15684     : see whether semctl IPC_STAT can use union semun
15685     val="$undef"
15686     case "$d_semctl_semun" in
15687     '')
15688       $cat > try.c <<END
15689 #include <sys/types.h>
15690 #include <sys/ipc.h>
15691 #include <sys/sem.h>
15692 #include <sys/stat.h>
15693 #include <stdio.h>
15694 #include <errno.h>
15695 #include "try.h"
15696 #ifndef errno
15697 extern int errno;
15698 #endif
15699 #$d_union_semun HAS_UNION_SEMUN
15700 int main() {
15701     union semun
15702 #ifndef HAS_UNION_SEMUN
15703     {
15704         int val;
15705         struct semid_ds *buf;
15706         unsigned short *array;
15707     }
15708 #endif
15709     arg;
15710     int sem, st;
15711
15712 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
15713     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15714     if (sem > -1) {
15715         struct semid_ds argbuf;
15716         arg.buf = &argbuf;
15717 #       ifdef IPC_STAT
15718         st = semctl(sem, 0, IPC_STAT, arg);
15719         if (st == 0)
15720             printf("semun\n");
15721         else
15722 #       endif /* IPC_STAT */
15723             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15724 #       ifdef IPC_RMID
15725         if (semctl(sem, 0, IPC_RMID, arg) != 0)
15726 #       endif /* IPC_RMID */
15727             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15728     } else
15729 #endif /* IPC_PRIVATE && ... */
15730         printf("semget failed: errno = %d\n", errno);
15731   return 0;
15732 }
15733 END
15734       set try
15735       if eval $compile; then
15736           xxx=`$run ./try`
15737           case "$xxx" in
15738           semun) val="$define" ;;
15739           esac
15740       fi
15741       $rm -f try try.c
15742       ;;
15743     esac
15744     set d_semctl_semun
15745     eval $setvar
15746     case "$d_semctl_semun" in
15747     $define)
15748         echo "You can use union semun for semctl IPC_STAT." >&4
15749         also='also'
15750         ;;
15751     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
15752         also=''
15753         ;;
15754     esac
15755
15756     : see whether semctl IPC_STAT can use struct semid_ds pointer
15757     val="$undef"
15758     case "$d_semctl_semid_ds" in
15759     '')
15760       $cat > try.c <<'END'
15761 #include <sys/types.h>
15762 #include <sys/ipc.h>
15763 #include <sys/sem.h>
15764 #include <sys/stat.h>
15765 #include "try.h"
15766 #include <stdio.h>
15767 #include <errno.h>
15768 #ifndef errno
15769 extern int errno;
15770 #endif
15771 int main() {
15772     struct semid_ds arg;
15773     int sem, st;
15774
15775 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
15776     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15777     if (sem > -1) {
15778 #       ifdef IPC_STAT
15779         st = semctl(sem, 0, IPC_STAT, &arg);
15780         if (st == 0)
15781             printf("semid_ds\n");
15782         else
15783 #       endif /* IPC_STAT */
15784             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15785 #       ifdef IPC_RMID
15786         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
15787 #       endif /* IPC_RMID */
15788             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15789     } else
15790 #endif /* IPC_PRIVATE && ... */
15791         printf("semget failed: errno = %d\n", errno);
15792
15793     return 0;
15794 }
15795 END
15796       set try
15797       if eval $compile; then
15798           xxx=`$run ./try`
15799           case "$xxx" in
15800           semid_ds) val="$define" ;;
15801           esac
15802       fi
15803       $rm -f try try.c
15804       ;;
15805     esac
15806     set d_semctl_semid_ds
15807     eval $setvar
15808     case "$d_semctl_semid_ds" in
15809     $define)
15810         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
15811         ;;
15812     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
15813         ;;
15814     esac
15815     $rm -f try.h
15816     ;;
15817 *)  val="$undef"
15818
15819     # We do not have the full sem*(2) library, so assume we can not
15820     # use either.
15821
15822     set d_semctl_semun
15823     eval $setvar
15824
15825     set d_semctl_semid_ds
15826     eval $setvar
15827     ;;
15828 esac
15829
15830 : see if sendmsg exists
15831 set sendmsg d_sendmsg
15832 eval $inlibc
15833
15834 : see if setegid exists
15835 set setegid d_setegid
15836 eval $inlibc
15837
15838 : see if seteuid exists
15839 set seteuid d_seteuid
15840 eval $inlibc
15841
15842 : see if setgrent exists
15843 set setgrent d_setgrent
15844 eval $inlibc
15845
15846 : see if setgrent_r exists
15847 set setgrent_r d_setgrent_r
15848 eval $inlibc
15849 case "$d_setgrent_r" in
15850 "$define")
15851         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
15852         case "$d_setgrent_r_proto:$usethreads" in
15853         ":define")      d_setgrent_r_proto=define
15854                 set d_setgrent_r_proto setgrent_r $hdrs
15855                 eval $hasproto ;;
15856         *)      ;;
15857         esac
15858         case "$d_setgrent_r_proto" in
15859         define)
15860         case "$setgrent_r_proto" in
15861         ''|0) try='int setgrent_r(FILE**);'
15862         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
15863         esac
15864         case "$setgrent_r_proto" in
15865         ''|0) try='void setgrent_r(FILE**);'
15866         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
15867         esac
15868         case "$setgrent_r_proto" in
15869         ''|0)   d_setgrent_r=undef
15870                 setgrent_r_proto=0
15871                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
15872         * )     case "$setgrent_r_proto" in
15873                 REENTRANT_PROTO*) ;;
15874                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
15875                 esac
15876                 echo "Prototype: $try" ;;
15877         esac
15878         ;;
15879         *)      case "$usethreads" in
15880                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
15881                 esac
15882                 d_setgrent_r=undef
15883                 setgrent_r_proto=0
15884                 ;;
15885         esac
15886         ;;
15887 *)      setgrent_r_proto=0
15888         ;;
15889 esac
15890
15891 : see if sethostent exists
15892 set sethostent d_sethent
15893 eval $inlibc
15894
15895 : see if sethostent_r exists
15896 set sethostent_r d_sethostent_r
15897 eval $inlibc
15898 case "$d_sethostent_r" in
15899 "$define")
15900         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15901         case "$d_sethostent_r_proto:$usethreads" in
15902         ":define")      d_sethostent_r_proto=define
15903                 set d_sethostent_r_proto sethostent_r $hdrs
15904                 eval $hasproto ;;
15905         *)      ;;
15906         esac
15907         case "$d_sethostent_r_proto" in
15908         define)
15909         case "$sethostent_r_proto" in
15910         ''|0) try='int sethostent_r(int, struct hostent_data*);'
15911         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
15912         esac
15913         case "$sethostent_r_proto" in
15914         ''|0) try='void sethostent_r(int, struct hostent_data*);'
15915         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
15916         esac
15917         case "$sethostent_r_proto" in
15918         ''|0)   d_sethostent_r=undef
15919                 sethostent_r_proto=0
15920                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
15921         * )     case "$sethostent_r_proto" in
15922                 REENTRANT_PROTO*) ;;
15923                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
15924                 esac
15925                 echo "Prototype: $try" ;;
15926         esac
15927         ;;
15928         *)      case "$usethreads" in
15929                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
15930                 esac
15931                 d_sethostent_r=undef
15932                 sethostent_r_proto=0
15933                 ;;
15934         esac
15935         ;;
15936 *)      sethostent_r_proto=0
15937         ;;
15938 esac
15939
15940 : see if setitimer exists
15941 set setitimer d_setitimer
15942 eval $inlibc
15943
15944 : see if setlinebuf exists
15945 set setlinebuf d_setlinebuf
15946 eval $inlibc
15947
15948 : see if setlocale exists
15949 set setlocale d_setlocale
15950 eval $inlibc
15951
15952 : see if locale.h is available
15953 set locale.h i_locale
15954 eval $inhdr
15955
15956 : see if setlocale_r exists
15957 set setlocale_r d_setlocale_r
15958 eval $inlibc
15959 case "$d_setlocale_r" in
15960 "$define")
15961         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
15962         case "$d_setlocale_r_proto:$usethreads" in
15963         ":define")      d_setlocale_r_proto=define
15964                 set d_setlocale_r_proto setlocale_r $hdrs
15965                 eval $hasproto ;;
15966         *)      ;;
15967         esac
15968         case "$d_setlocale_r_proto" in
15969         define)
15970         case "$setlocale_r_proto" in
15971         ''|0) try='int setlocale_r(int, const char*, char*, int);'
15972         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
15973         esac
15974         case "$setlocale_r_proto" in
15975         ''|0)   d_setlocale_r=undef
15976                 setlocale_r_proto=0
15977                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
15978         * )     case "$setlocale_r_proto" in
15979                 REENTRANT_PROTO*) ;;
15980                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
15981                 esac
15982                 echo "Prototype: $try" ;;
15983         esac
15984         ;;
15985         *)      case "$usethreads" in
15986                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
15987                 esac
15988                 d_setlocale_r=undef
15989                 setlocale_r_proto=0
15990                 ;;
15991         esac
15992         ;;
15993 *)      setlocale_r_proto=0
15994         ;;
15995 esac
15996
15997 : see if setnetent exists
15998 set setnetent d_setnent
15999 eval $inlibc
16000
16001 : see if setnetent_r exists
16002 set setnetent_r d_setnetent_r
16003 eval $inlibc
16004 case "$d_setnetent_r" in
16005 "$define")
16006         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16007         case "$d_setnetent_r_proto:$usethreads" in
16008         ":define")      d_setnetent_r_proto=define
16009                 set d_setnetent_r_proto setnetent_r $hdrs
16010                 eval $hasproto ;;
16011         *)      ;;
16012         esac
16013         case "$d_setnetent_r_proto" in
16014         define)
16015         case "$setnetent_r_proto" in
16016         ''|0) try='int setnetent_r(int, struct netent_data*);'
16017         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16018         esac
16019         case "$setnetent_r_proto" in
16020         ''|0) try='void setnetent_r(int, struct netent_data*);'
16021         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16022         esac
16023         case "$setnetent_r_proto" in
16024         ''|0)   d_setnetent_r=undef
16025                 setnetent_r_proto=0
16026                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16027         * )     case "$setnetent_r_proto" in
16028                 REENTRANT_PROTO*) ;;
16029                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16030                 esac
16031                 echo "Prototype: $try" ;;
16032         esac
16033         ;;
16034         *)      case "$usethreads" in
16035                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16036                 esac
16037                 d_setnetent_r=undef
16038                 setnetent_r_proto=0
16039                 ;;
16040         esac
16041         ;;
16042 *)      setnetent_r_proto=0
16043         ;;
16044 esac
16045
16046 : see if setprotoent exists
16047 set setprotoent d_setpent
16048 eval $inlibc
16049
16050 : see if setpgid exists
16051 set setpgid d_setpgid
16052 eval $inlibc
16053
16054 : see if setpgrp2 exists
16055 set setpgrp2 d_setpgrp2
16056 eval $inlibc
16057
16058 : see if setpriority exists
16059 set setpriority d_setprior
16060 eval $inlibc
16061
16062 : see if setproctitle exists
16063 set setproctitle d_setproctitle
16064 eval $inlibc
16065
16066 : see if setprotoent_r exists
16067 set setprotoent_r d_setprotoent_r
16068 eval $inlibc
16069 case "$d_setprotoent_r" in
16070 "$define")
16071         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16072         case "$d_setprotoent_r_proto:$usethreads" in
16073         ":define")      d_setprotoent_r_proto=define
16074                 set d_setprotoent_r_proto setprotoent_r $hdrs
16075                 eval $hasproto ;;
16076         *)      ;;
16077         esac
16078         case "$d_setprotoent_r_proto" in
16079         define)
16080         case "$setprotoent_r_proto" in
16081         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16082         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16083         esac
16084         case "$setprotoent_r_proto" in
16085         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16086         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16087         esac
16088         case "$setprotoent_r_proto" in
16089         ''|0)   d_setprotoent_r=undef
16090                 setprotoent_r_proto=0
16091                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16092         * )     case "$setprotoent_r_proto" in
16093                 REENTRANT_PROTO*) ;;
16094                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16095                 esac
16096                 echo "Prototype: $try" ;;
16097         esac
16098         ;;
16099         *)      case "$usethreads" in
16100                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16101                 esac
16102                 d_setprotoent_r=undef
16103                 setprotoent_r_proto=0
16104                 ;;
16105         esac
16106         ;;
16107 *)      setprotoent_r_proto=0
16108         ;;
16109 esac
16110
16111 : see if setpwent exists
16112 set setpwent d_setpwent
16113 eval $inlibc
16114
16115 : see if setpwent_r exists
16116 set setpwent_r d_setpwent_r
16117 eval $inlibc
16118 case "$d_setpwent_r" in
16119 "$define")
16120         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16121         case "$d_setpwent_r_proto:$usethreads" in
16122         ":define")      d_setpwent_r_proto=define
16123                 set d_setpwent_r_proto setpwent_r $hdrs
16124                 eval $hasproto ;;
16125         *)      ;;
16126         esac
16127         case "$d_setpwent_r_proto" in
16128         define)
16129         case "$setpwent_r_proto" in
16130         ''|0) try='int setpwent_r(FILE**);'
16131         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16132         esac
16133         case "$setpwent_r_proto" in
16134         ''|0) try='void setpwent_r(FILE**);'
16135         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16136         esac
16137         case "$setpwent_r_proto" in
16138         ''|0)   d_setpwent_r=undef
16139                 setpwent_r_proto=0
16140                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16141         * )     case "$setpwent_r_proto" in
16142                 REENTRANT_PROTO*) ;;
16143                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16144                 esac
16145                 echo "Prototype: $try" ;;
16146         esac
16147         ;;
16148         *)      case "$usethreads" in
16149                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16150                 esac
16151                 d_setpwent_r=undef
16152                 setpwent_r_proto=0
16153                 ;;
16154         esac
16155         ;;
16156 *)      setpwent_r_proto=0
16157         ;;
16158 esac
16159
16160 : see if setregid exists
16161 set setregid d_setregid
16162 eval $inlibc
16163 set setresgid d_setresgid
16164 eval $inlibc
16165
16166 : see if setreuid exists
16167 set setreuid d_setreuid
16168 eval $inlibc
16169 set setresuid d_setresuid
16170 eval $inlibc
16171
16172 : see if setrgid exists
16173 set setrgid d_setrgid
16174 eval $inlibc
16175
16176 : see if setruid exists
16177 set setruid d_setruid
16178 eval $inlibc
16179
16180 : see if setservent exists
16181 set setservent d_setsent
16182 eval $inlibc
16183
16184 : see if setservent_r exists
16185 set setservent_r d_setservent_r
16186 eval $inlibc
16187 case "$d_setservent_r" in
16188 "$define")
16189         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16190         case "$d_setservent_r_proto:$usethreads" in
16191         ":define")      d_setservent_r_proto=define
16192                 set d_setservent_r_proto setservent_r $hdrs
16193                 eval $hasproto ;;
16194         *)      ;;
16195         esac
16196         case "$d_setservent_r_proto" in
16197         define)
16198         case "$setservent_r_proto" in
16199         ''|0) try='int setservent_r(int, struct servent_data*);'
16200         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16201         esac
16202         case "$setservent_r_proto" in
16203         ''|0) try='void setservent_r(int, struct servent_data*);'
16204         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16205         esac
16206         case "$setservent_r_proto" in
16207         ''|0)   d_setservent_r=undef
16208                 setservent_r_proto=0
16209                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16210         * )     case "$setservent_r_proto" in
16211                 REENTRANT_PROTO*) ;;
16212                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16213                 esac
16214                 echo "Prototype: $try" ;;
16215         esac
16216         ;;
16217         *)      case "$usethreads" in
16218                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16219                 esac
16220                 d_setservent_r=undef
16221                 setservent_r_proto=0
16222                 ;;
16223         esac
16224         ;;
16225 *)      setservent_r_proto=0
16226         ;;
16227 esac
16228
16229 : see if setsid exists
16230 set setsid d_setsid
16231 eval $inlibc
16232
16233 : see if setvbuf exists
16234 set setvbuf d_setvbuf
16235 eval $inlibc
16236
16237 : see if sfio.h is available
16238 set sfio.h i_sfio
16239 eval $inhdr
16240
16241
16242 : see if sfio library is available
16243 case "$i_sfio" in
16244 $define)
16245         val=''
16246         set sfreserve val
16247         eval $inlibc
16248         ;;
16249 *)
16250         val="$undef"
16251         ;;
16252 esac
16253 : Ok, but do we want to use it.
16254 case "$val" in
16255 $define)
16256         case "$usesfio" in
16257         true|$define|[yY]*) dflt='y';;
16258         *) dflt='n';;
16259         esac
16260         echo "$package can use the sfio library, but it is experimental."
16261         case "$useperlio" in
16262         "$undef")
16263             echo "For sfio also the PerlIO abstraction layer is needed."
16264             echo "Earlier you said you wouldn't want that."
16265             ;;
16266         esac
16267         rp="You seem to have sfio available, do you want to try using it?"
16268         . ./myread
16269         case "$ans" in
16270         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
16271                 useperlio="$define"
16272                 val="$define"
16273                 ;;
16274         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
16275                 val="$undef"
16276                 ;;
16277         esac
16278         ;;
16279 *)      case "$usesfio" in
16280         true|$define|[yY]*)
16281                 echo "Sorry, cannot find sfio on this machine." >&4
16282                 echo "Ignoring your setting of usesfio=$usesfio." >&4
16283                 val="$undef"
16284                 ;;
16285         esac
16286         ;;
16287 esac
16288 set d_sfio
16289 eval $setvar
16290 case "$d_sfio" in
16291 $define) usesfio='true';;
16292 *) usesfio='false';;
16293 esac
16294 case "$d_sfio" in
16295 $define) ;;
16296 *)      : Remove sfio from list of libraries to use
16297         case "$libs" in
16298         *-lsfio*)
16299                 echo "Removing unneeded -lsfio from library list" >&4
16300                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16301                 shift
16302                 libs="$*"
16303                 echo "libs = $libs" >&4
16304                 ;;
16305         esac
16306 ;;
16307 esac
16308
16309
16310 : see if shmctl exists
16311 set shmctl d_shmctl
16312 eval $inlibc
16313
16314 : see if shmget exists
16315 set shmget d_shmget
16316 eval $inlibc
16317
16318 : see if shmat exists
16319 set shmat d_shmat
16320 eval $inlibc
16321 : see what shmat returns
16322 case "$d_shmat" in
16323 "$define")
16324         $cat >shmat.c <<'END'
16325 #include <sys/shm.h>
16326 void *shmat();
16327 END
16328         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16329                 shmattype='void *'
16330         else
16331                 shmattype='char *'
16332         fi
16333         echo "and it returns ($shmattype)." >&4
16334         : see if a prototype for shmat is available
16335         xxx=`./findhdr sys/shm.h`
16336         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16337         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16338                 val="$define"
16339         else
16340                 val="$undef"
16341         fi
16342         $rm -f shmat.[co]
16343         ;;
16344 *)
16345         val="$undef"
16346         ;;
16347 esac
16348 set d_shmatprototype
16349 eval $setvar
16350
16351 : see if shmdt exists
16352 set shmdt d_shmdt
16353 eval $inlibc
16354
16355 : see how much of the 'shm*(2)' library is present.
16356 h_shm=true
16357 echo " "
16358 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16359 *"$undef"*) h_shm=false;;
16360 esac
16361 case "$osname" in
16362 freebsd)
16363     case "`ipcs 2>&1`" in
16364     "SVID shared memory"*"not configured"*)
16365         echo "Your $osname does not have the shm*(2) configured." >&4
16366         h_shm=false
16367         val="$undef"
16368         set shmctl d_shmctl
16369         evat $setvar
16370         set shmget d_shmget
16371         evat $setvar
16372         set shmat d_shmat
16373         evat $setvar
16374         set shmdt d_shmdt
16375         evat $setvar
16376         ;;
16377     esac
16378     ;;
16379 esac
16380 : we could also check for sys/ipc.h ...
16381 if $h_shm && $test `./findhdr sys/shm.h`; then
16382         echo "You have the full shm*(2) library." >&4
16383         val="$define"
16384 else
16385         echo "You don't have the full shm*(2) library." >&4
16386         val="$undef"
16387 fi
16388 set d_shm
16389 eval $setvar
16390
16391 echo " "
16392 : see if we have sigaction
16393 if set sigaction val -f d_sigaction; eval $csym; $val; then
16394         echo 'sigaction() found.' >&4
16395         $cat > try.c <<EOP
16396 #include <stdio.h>
16397 #include <sys/types.h>
16398 #include <signal.h>
16399 #$i_stdlib I_STDLIB
16400 #ifdef I_STDLIB
16401 #include <stdlib.h>
16402 #endif
16403 int main()
16404 {
16405     struct sigaction act, oact;
16406     act.sa_flags = 0;
16407     oact.sa_handler = 0;
16408     /* so that act and oact are used */
16409     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
16410 }
16411 EOP
16412         set try
16413         if eval $compile_ok; then
16414                 val="$define"
16415         else
16416                 echo "But you don't seem to have a useable struct sigaction." >&4
16417                 val="$undef"
16418         fi
16419 else
16420         echo 'sigaction NOT found.' >&4
16421         val="$undef"
16422 fi
16423 set d_sigaction; eval $setvar
16424 $rm -f try try$_o try.c
16425
16426 : see if sigprocmask exists
16427 set sigprocmask d_sigprocmask
16428 eval $inlibc
16429
16430 : see if sigsetjmp exists
16431 echo " "
16432 case "$d_sigsetjmp" in
16433 '')
16434         $cat >try.c <<EOP
16435 #include <setjmp.h>
16436 #$i_stdlib I_STDLIB
16437 #ifdef I_STDLIB
16438 #include <stdlib.h>
16439 #endif
16440 sigjmp_buf env;
16441 int set = 1;
16442 int main()
16443 {
16444         if (sigsetjmp(env,1))
16445                 exit(set);
16446         set = 0;
16447         siglongjmp(env, 1);
16448         exit(1);
16449 }
16450 EOP
16451         set try
16452         if eval $compile; then
16453                 if $run ./try >/dev/null 2>&1; then
16454                         echo "POSIX sigsetjmp found." >&4
16455                         val="$define"
16456                 else
16457                         $cat >&4 <<EOM
16458 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
16459 I'll ignore them.
16460 EOM
16461                         val="$undef"
16462                 fi
16463         else
16464                 echo "sigsetjmp not found." >&4
16465                 val="$undef"
16466         fi
16467         ;;
16468 *) val="$d_sigsetjmp"
16469         case "$d_sigsetjmp" in
16470         $define) echo "POSIX sigsetjmp found." >&4;;
16471         $undef) echo "sigsetjmp not found." >&4;;
16472         esac
16473         ;;
16474 esac
16475 set d_sigsetjmp
16476 eval $setvar
16477 $rm -f try.c try
16478
16479 : see if sockatmark exists
16480 set sockatmark d_sockatmark
16481 eval $inlibc
16482
16483 : see if prototype for sockatmark is available
16484 echo " "
16485 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
16486 eval $hasproto
16487
16488 : see if socks5_init exists
16489 set socks5_init d_socks5_init
16490 eval $inlibc
16491
16492 : see if srand48_r exists
16493 set srand48_r d_srand48_r
16494 eval $inlibc
16495 case "$d_srand48_r" in
16496 "$define")
16497         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16498         case "$d_srand48_r_proto:$usethreads" in
16499         ":define")      d_srand48_r_proto=define
16500                 set d_srand48_r_proto srand48_r $hdrs
16501                 eval $hasproto ;;
16502         *)      ;;
16503         esac
16504         case "$d_srand48_r_proto" in
16505         define)
16506         case "$srand48_r_proto" in
16507         ''|0) try='int srand48_r(long, struct drand48_data*);'
16508         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
16509         esac
16510         case "$srand48_r_proto" in
16511         ''|0)   d_srand48_r=undef
16512                 srand48_r_proto=0
16513                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
16514         * )     case "$srand48_r_proto" in
16515                 REENTRANT_PROTO*) ;;
16516                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
16517                 esac
16518                 echo "Prototype: $try" ;;
16519         esac
16520         ;;
16521         *)      case "$usethreads" in
16522                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
16523                 esac
16524                 d_srand48_r=undef
16525                 srand48_r_proto=0
16526                 ;;
16527         esac
16528         ;;
16529 *)      srand48_r_proto=0
16530         ;;
16531 esac
16532
16533 : see if srandom_r exists
16534 set srandom_r d_srandom_r
16535 eval $inlibc
16536 case "$d_srandom_r" in
16537 "$define")
16538         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16539         case "$d_srandom_r_proto:$usethreads" in
16540         ":define")      d_srandom_r_proto=define
16541                 set d_srandom_r_proto srandom_r $hdrs
16542                 eval $hasproto ;;
16543         *)      ;;
16544         esac
16545         case "$d_srandom_r_proto" in
16546         define)
16547         case "$srandom_r_proto" in
16548         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
16549         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
16550         esac
16551         case "$srandom_r_proto" in
16552         ''|0)   d_srandom_r=undef
16553                 srandom_r_proto=0
16554                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
16555         * )     case "$srandom_r_proto" in
16556                 REENTRANT_PROTO*) ;;
16557                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
16558                 esac
16559                 echo "Prototype: $try" ;;
16560         esac
16561         ;;
16562         *)      case "$usethreads" in
16563                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
16564                 esac
16565                 d_srandom_r=undef
16566                 srandom_r_proto=0
16567                 ;;
16568         esac
16569         ;;
16570 *)      srandom_r_proto=0
16571         ;;
16572 esac
16573
16574 : see if prototype for setresgid is available
16575 echo " "
16576 set d_sresgproto setresgid $i_unistd unistd.h
16577 eval $hasproto
16578
16579 : see if prototype for setresuid is available
16580 echo " "
16581 set d_sresuproto setresuid $i_unistd unistd.h
16582 eval $hasproto
16583
16584 : see if sys/stat.h is available
16585 set sys/stat.h i_sysstat
16586 eval $inhdr
16587
16588
16589 : see if stat knows about block sizes
16590 echo " "
16591 echo "Checking to see if your struct stat has st_blocks field..." >&4
16592 set d_statblks stat st_blocks $i_sysstat sys/stat.h
16593 eval $hasfield
16594
16595
16596 : see if this is a sys/vfs.h system
16597 set sys/vfs.h i_sysvfs
16598 eval $inhdr
16599
16600
16601 : see if this is a sys/statfs.h system
16602 set sys/statfs.h i_sysstatfs
16603 eval $inhdr
16604
16605
16606 echo " "
16607 echo "Checking to see if your system supports struct statfs..." >&4
16608 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
16609 eval $hasstruct
16610 case "$d_statfs_s" in
16611 "$define")      echo "Yes, it does."   ;;
16612 *)              echo "No, it doesn't." ;;
16613 esac
16614
16615
16616
16617 : see if struct statfs knows about f_flags
16618 case "$d_statfs_s" in
16619 define) 
16620         echo " "
16621         echo "Checking to see if your struct statfs has f_flags field..." >&4
16622         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
16623         eval $hasfield
16624         ;;
16625 *)      val="$undef"
16626         set d_statfs_f_flags
16627         eval $setvar
16628         ;;
16629 esac
16630 case "$d_statfs_f_flags" in
16631 "$define")      echo "Yes, it does."   ;;
16632 *)              echo "No, it doesn't." ;;
16633 esac
16634
16635 $cat >&4 <<EOM
16636 Checking how to access stdio streams by file descriptor number...
16637 EOM
16638 case "$stdio_stream_array" in
16639 '')     $cat >try.c <<EOCP
16640 #include <stdio.h>
16641 int main() {
16642   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
16643     printf("yes\n");
16644 }
16645 EOCP
16646         for s in _iob __iob __sF
16647         do
16648                 set try -DSTDIO_STREAM_ARRAY=$s
16649                 if eval $compile; then
16650                         case "`$run ./try`" in
16651                         yes)    stdio_stream_array=$s; break ;;
16652                         esac
16653                 fi
16654         done
16655         $rm -f try.* try$exe_ext
16656 esac
16657 case "$stdio_stream_array" in
16658 '')     $cat >&4 <<EOM
16659 I can't figure out how to access stdio streams by file descriptor number.
16660 EOM
16661         d_stdio_stream_array="$undef"
16662         ;;
16663 *)      $cat >&4 <<EOM
16664 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
16665 EOM
16666         d_stdio_stream_array="$define"
16667         ;;
16668 esac
16669
16670 : see if strcoll exists
16671 set strcoll d_strcoll
16672 eval $inlibc
16673
16674 : check for structure copying
16675 echo " "
16676 echo "Checking to see if your C compiler can copy structs..." >&4
16677 $cat >try.c <<'EOCP'
16678 int main()
16679 {
16680         struct blurfl {
16681                 int dyick;
16682         } foo, bar;
16683
16684         foo = bar;
16685 }
16686 EOCP
16687 if $cc -c try.c >/dev/null 2>&1 ; then
16688         val="$define"
16689         echo "Yup, it can."
16690 else
16691         val="$undef"
16692         echo "Nope, it can't."
16693 fi
16694 set d_strctcpy
16695 eval $setvar
16696 $rm -f try.*
16697
16698 : see if strerror and/or sys_errlist[] exist
16699 echo " "
16700 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
16701     if set strerror val -f d_strerror; eval $csym; $val; then
16702                 echo 'strerror() found.' >&4
16703                 d_strerror="$define"
16704                 d_strerrm='strerror(e)'
16705                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16706                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
16707                         d_syserrlst="$define"
16708                 else
16709                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
16710                         d_syserrlst="$undef"
16711                 fi
16712     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
16713                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
16714                 echo 'strerror() found in string header.' >&4
16715                 d_strerror="$define"
16716                 d_strerrm='strerror(e)'
16717                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16718                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
16719                                 d_syserrlst="$define"
16720                 else
16721                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
16722                         d_syserrlst="$undef"
16723                 fi
16724     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16725                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
16726                 d_strerror="$undef"
16727                 d_syserrlst="$define"
16728                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
16729     else
16730                 echo 'strerror() and sys_errlist[] NOT found.' >&4
16731                 d_strerror="$undef"
16732                 d_syserrlst="$undef"
16733                 d_strerrm='"unknown"'
16734     fi
16735 fi
16736
16737 : see if strerror_r exists
16738 set strerror_r d_strerror_r
16739 eval $inlibc
16740 case "$d_strerror_r" in
16741 "$define")
16742         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
16743         case "$d_strerror_r_proto:$usethreads" in
16744         ":define")      d_strerror_r_proto=define
16745                 set d_strerror_r_proto strerror_r $hdrs
16746                 eval $hasproto ;;
16747         *)      ;;
16748         esac
16749         case "$d_strerror_r_proto" in
16750         define)
16751         case "$strerror_r_proto" in
16752         ''|0) try='int strerror_r(int, char*, size_t);'
16753         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
16754         esac
16755         case "$strerror_r_proto" in
16756         ''|0) try='int strerror_r(int, char*, int);'
16757         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
16758         esac
16759         case "$strerror_r_proto" in
16760         ''|0) try='char* strerror_r(int, char*, size_t);'
16761         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
16762         esac
16763         case "$strerror_r_proto" in
16764         ''|0)   d_strerror_r=undef
16765                 strerror_r_proto=0
16766                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
16767         * )     case "$strerror_r_proto" in
16768                 REENTRANT_PROTO*) ;;
16769                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
16770                 esac
16771                 echo "Prototype: $try" ;;
16772         esac
16773         ;;
16774         *)      case "$usethreads" in
16775                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
16776                 esac
16777                 d_strerror_r=undef
16778                 strerror_r_proto=0
16779                 ;;
16780         esac
16781         ;;
16782 *)      strerror_r_proto=0
16783         ;;
16784 esac
16785
16786 : see if strftime exists
16787 set strftime d_strftime
16788 eval $inlibc
16789
16790 : see if strlcat exists
16791 set strlcat d_strlcat
16792 eval $inlibc
16793
16794 : see if strlcpy exists
16795 set strlcpy d_strlcpy
16796 eval $inlibc
16797
16798 : see if strtod exists
16799 set strtod d_strtod
16800 eval $inlibc
16801
16802 : see if strtol exists
16803 set strtol d_strtol
16804 eval $inlibc
16805
16806 : see if strtold exists
16807 set strtold d_strtold
16808 eval $inlibc
16809
16810 : see if strtoll exists
16811 set strtoll d_strtoll
16812 eval $inlibc
16813
16814 case "$d_longlong-$d_strtoll" in
16815 "$define-$define")
16816         $cat <<EOM
16817 Checking whether your strtoll() works okay...
16818 EOM
16819         $cat >try.c <<'EOCP'
16820 #include <errno.h>
16821 #ifdef __hpux
16822 #define strtoll __strtoll
16823 #endif
16824 #ifdef __EMX__
16825 #define strtoll _strtoll
16826 #endif
16827 #include <stdio.h>
16828 extern long long int strtoll(char *s, char **, int); 
16829 static int bad = 0;
16830 int check(char *s, long long ell, int een) {
16831         long long gll;
16832         errno = 0;
16833         gll = strtoll(s, 0, 10);
16834         if (!((gll == ell) && (errno == een)))
16835                 bad++;
16836 }
16837 int main() {
16838         check(" 1",                                      1LL, 0);
16839         check(" 0",                                      0LL, 0);
16840         check("-1",                                     -1LL, 0);
16841         check("-9223372036854775808", -9223372036854775808LL, 0);
16842         check("-9223372036854775808", -9223372036854775808LL, 0);
16843         check(" 9223372036854775807",  9223372036854775807LL, 0);
16844         check("-9223372036854775808", -9223372036854775808LL, 0);
16845         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
16846         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
16847         if (!bad)
16848                 printf("ok\n");
16849 }
16850 EOCP
16851         set try
16852         if eval $compile; then
16853                 yyy=`$run ./try`
16854                 case "$yyy" in
16855                 ok) echo "Your strtoll() seems to be working okay." ;;
16856                 *) cat <<EOM >&4
16857 Your strtoll() doesn't seem to be working okay.
16858 EOM
16859                    d_strtoll="$undef"
16860                    ;;
16861                 esac
16862         else
16863                 echo "(I can't seem to compile the test program--assuming it doesn't)"
16864                 d_strtoll="$undef"
16865         fi
16866         ;;
16867 esac
16868
16869 : see if strtoq exists
16870 set strtoq d_strtoq
16871 eval $inlibc
16872
16873 : see if strtoul exists
16874 set strtoul d_strtoul
16875 eval $inlibc
16876
16877 case "$d_strtoul" in
16878 "$define")
16879         $cat <<EOM
16880 Checking whether your strtoul() works okay...
16881 EOM
16882         $cat >try.c <<'EOCP'
16883 #include <errno.h>
16884 #include <stdio.h>
16885 extern unsigned long int strtoul(char *s, char **, int); 
16886 static int bad = 0;
16887 void check(char *s, unsigned long eul, int een) {
16888         unsigned long gul;
16889         errno = 0;
16890         gul = strtoul(s, 0, 10);
16891         if (!((gul == eul) && (errno == een)))
16892                 bad++;
16893 }
16894 int main() {
16895         check(" 1", 1L, 0);
16896         check(" 0", 0L, 0);
16897 EOCP
16898         case "$longsize" in
16899         8)
16900             $cat >>try.c <<'EOCP'
16901         check("18446744073709551615", 18446744073709551615UL, 0);
16902         check("18446744073709551616", 18446744073709551615UL, ERANGE);
16903 #if 0 /* strtoul() for /^-/ strings is undefined. */
16904         check("-1", 18446744073709551615UL, 0);
16905         check("-18446744073709551614", 2, 0);
16906         check("-18446744073709551615", 1, 0);
16907         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
16908         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
16909 #endif
16910 EOCP
16911                 ;;
16912         4)
16913                     $cat >>try.c <<'EOCP'
16914         check("4294967295", 4294967295UL, 0);
16915         check("4294967296", 4294967295UL, ERANGE);
16916 #if 0 /* strtoul() for /^-/ strings is undefined. */
16917         check("-1", 4294967295UL, 0);
16918         check("-4294967294", 2, 0);
16919         check("-4294967295", 1, 0);
16920         check("-4294967296", 4294967295UL, ERANGE);
16921         check("-4294967297", 4294967295UL, ERANGE);
16922 #endif
16923 EOCP
16924                 ;;
16925         *)
16926 : Should we write these tests to be more portable by sprintf-ing
16927 : ~0 and then manipulating that char string as input for strtol?
16928                 ;;
16929         esac
16930         $cat >>try.c <<'EOCP'
16931         if (!bad)
16932                 printf("ok\n");
16933         return 0;
16934 }
16935 EOCP
16936         set try
16937         if eval $compile; then
16938                 case "`$run ./try`" in
16939                 ok) echo "Your strtoul() seems to be working okay." ;;
16940                 *) cat <<EOM >&4
16941 Your strtoul() doesn't seem to be working okay.
16942 EOM
16943                    d_strtoul="$undef"
16944                    ;;
16945                 esac
16946         fi
16947         ;;
16948 esac
16949
16950 : see if strtoull exists
16951 set strtoull d_strtoull
16952 eval $inlibc
16953
16954 case "$d_longlong-$d_strtoull" in
16955 "$define-$define")
16956         $cat <<EOM
16957 Checking whether your strtoull() works okay...
16958 EOM
16959         $cat >try.c <<'EOCP'
16960 #include <errno.h>
16961 #ifdef __hpux
16962 #define strtoull __strtoull
16963 #endif
16964 #include <stdio.h>
16965 extern unsigned long long int strtoull(char *s, char **, int); 
16966 static int bad = 0;
16967 int check(char *s, long long eull, int een) {
16968         long long gull;
16969         errno = 0;
16970         gull = strtoull(s, 0, 10);
16971         if (!((gull == eull) && (errno == een)))
16972                 bad++;
16973 }
16974 int main() {
16975         check(" 1",                                        1LL, 0);
16976         check(" 0",                                        0LL, 0);
16977         check("18446744073709551615",  18446744073709551615ULL, 0);
16978         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
16979 #if 0 /* strtoull() for /^-/ strings is undefined. */
16980         check("-1",                    18446744073709551615ULL, 0);
16981         check("-18446744073709551614",                     2LL, 0);
16982         check("-18446744073709551615",                     1LL, 0);
16983         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
16984         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
16985 #endif
16986         if (!bad)
16987                 printf("ok\n");
16988 }
16989 EOCP
16990         set try
16991         if eval $compile; then
16992                 case "`$run ./try`" in
16993                 ok) echo "Your strtoull() seems to be working okay." ;;
16994                 *) cat <<EOM >&4
16995 Your strtoull() doesn't seem to be working okay.
16996 EOM
16997                    d_strtoull="$undef"
16998                    ;;
16999                 esac
17000         fi
17001         ;;
17002 esac
17003
17004 : see if strtouq exists
17005 set strtouq d_strtouq
17006 eval $inlibc
17007
17008 case "$d_strtouq" in
17009 "$define")
17010         $cat <<EOM
17011 Checking whether your strtouq() works okay...
17012 EOM
17013         $cat >try.c <<'EOCP'
17014 #include <errno.h>
17015 #include <stdio.h>
17016 extern unsigned long long int strtouq(char *s, char **, int); 
17017 static int bad = 0;
17018 void check(char *s, unsigned long long eull, int een) {
17019         unsigned long long gull;
17020         errno = 0;
17021         gull = strtouq(s, 0, 10);
17022         if (!((gull == eull) && (errno == een)))
17023                 bad++;
17024 }
17025 int main() {
17026         check(" 1",                                        1LL, 0);
17027         check(" 0",                                        0LL, 0);
17028         check("18446744073709551615",  18446744073709551615ULL, 0);
17029         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17030 #if 0 /* strtouq() for /^-/ strings is undefined. */
17031         check("-1",                    18446744073709551615ULL, 0);
17032         check("-18446744073709551614",                     2LL, 0);
17033         check("-18446744073709551615",                     1LL, 0);
17034         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17035         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17036 #endif
17037         if (!bad)
17038                 printf("ok\n");
17039         return 0;
17040 }
17041 EOCP
17042         set try
17043         if eval $compile; then
17044                 case "`$run ./try`" in
17045                 ok) echo "Your strtouq() seems to be working okay." ;;
17046                 *) cat <<EOM >&4
17047 Your strtouq() doesn't seem to be working okay.
17048 EOM
17049                    d_strtouq="$undef"
17050                    ;;
17051                 esac
17052         fi
17053         ;;
17054 esac
17055
17056 : see if strxfrm exists
17057 set strxfrm d_strxfrm
17058 eval $inlibc
17059
17060 : see if symlink exists
17061 set symlink d_symlink
17062 eval $inlibc
17063
17064 : see if syscall exists
17065 set syscall d_syscall
17066 eval $inlibc
17067
17068 : see if prototype for syscall is available
17069 echo " "
17070 set d_syscallproto syscall $i_unistd unistd.h
17071 eval $hasproto
17072
17073 : see if sysconf exists
17074 set sysconf d_sysconf
17075 eval $inlibc
17076
17077 : see if system exists
17078 set system d_system
17079 eval $inlibc
17080
17081 : see if tcgetpgrp exists
17082 set tcgetpgrp d_tcgetpgrp
17083 eval $inlibc
17084
17085 : see if tcsetpgrp exists
17086 set tcsetpgrp d_tcsetpgrp
17087 eval $inlibc
17088
17089 : see if prototype for telldir is available
17090 echo " "
17091 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17092 eval $hasproto
17093
17094 : see if time exists
17095 echo " "
17096 if test "X$d_time" = X -o X"$timetype" = X; then
17097     if set time val -f d_time; eval $csym; $val; then
17098                 echo 'time() found.' >&4
17099                 val="$define"
17100                 rp="What is the type returned by time() on this system?"
17101                 set time_t timetype long stdio.h sys/types.h
17102                 eval $typedef_ask
17103     else
17104                 echo 'time() not found, hope that will do.' >&4
17105                 val="$undef"
17106                 timetype='int';
17107     fi
17108     set d_time
17109     eval $setvar
17110 fi
17111
17112 : see if this is a sys/times.h system
17113 set sys/times.h i_systimes
17114 eval $inhdr
17115
17116 : see if times exists
17117 echo " "
17118 if set times val -f d_times; eval $csym; $val; then
17119         echo 'times() found.' >&4
17120         d_times="$define"
17121         inc=''
17122         case "$i_systimes" in
17123         "$define") inc='sys/times.h';;
17124         esac
17125         rp="What is the type returned by times() on this system?"
17126         set clock_t clocktype long stdio.h sys/types.h $inc
17127         eval $typedef_ask
17128 else
17129         echo 'times() NOT found, hope that will do.' >&4
17130         d_times="$undef"
17131         clocktype='int'
17132 fi
17133
17134 : see if tmpnam_r exists
17135 set tmpnam_r d_tmpnam_r
17136 eval $inlibc
17137 case "$d_tmpnam_r" in
17138 "$define")
17139         hdrs="$i_systypes sys/types.h define stdio.h "
17140         case "$d_tmpnam_r_proto:$usethreads" in
17141         ":define")      d_tmpnam_r_proto=define
17142                 set d_tmpnam_r_proto tmpnam_r $hdrs
17143                 eval $hasproto ;;
17144         *)      ;;
17145         esac
17146         case "$d_tmpnam_r_proto" in
17147         define)
17148         case "$tmpnam_r_proto" in
17149         ''|0) try='char* tmpnam_r(char*);'
17150         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17151         esac
17152         case "$tmpnam_r_proto" in
17153         ''|0)   d_tmpnam_r=undef
17154                 tmpnam_r_proto=0
17155                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
17156         * )     case "$tmpnam_r_proto" in
17157                 REENTRANT_PROTO*) ;;
17158                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17159                 esac
17160                 echo "Prototype: $try" ;;
17161         esac
17162         ;;
17163         *)      case "$usethreads" in
17164                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17165                 esac
17166                 d_tmpnam_r=undef
17167                 tmpnam_r_proto=0
17168                 ;;
17169         esac
17170         ;;
17171 *)      tmpnam_r_proto=0
17172         ;;
17173 esac
17174
17175 : see if truncate exists
17176 set truncate d_truncate
17177 eval $inlibc
17178
17179 : see if ttyname_r exists
17180 set ttyname_r d_ttyname_r
17181 eval $inlibc
17182 case "$d_ttyname_r" in
17183 "$define")
17184         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
17185         case "$d_ttyname_r_proto:$usethreads" in
17186         ":define")      d_ttyname_r_proto=define
17187                 set d_ttyname_r_proto ttyname_r $hdrs
17188                 eval $hasproto ;;
17189         *)      ;;
17190         esac
17191         case "$d_ttyname_r_proto" in
17192         define)
17193         case "$ttyname_r_proto" in
17194         ''|0) try='int ttyname_r(int, char*, size_t);'
17195         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17196         esac
17197         case "$ttyname_r_proto" in
17198         ''|0) try='int ttyname_r(int, char*, int);'
17199         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17200         esac
17201         case "$ttyname_r_proto" in
17202         ''|0) try='char* ttyname_r(int, char*, int);'
17203         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17204         esac
17205         case "$ttyname_r_proto" in
17206         ''|0)   d_ttyname_r=undef
17207                 ttyname_r_proto=0
17208                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
17209         * )     case "$ttyname_r_proto" in
17210                 REENTRANT_PROTO*) ;;
17211                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17212                 esac
17213                 echo "Prototype: $try" ;;
17214         esac
17215         ;;
17216         *)      case "$usethreads" in
17217                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17218                 esac
17219                 d_ttyname_r=undef
17220                 ttyname_r_proto=0
17221                 ;;
17222         esac
17223         ;;
17224 *)      ttyname_r_proto=0
17225         ;;
17226 esac
17227
17228 : see if tzname[] exists
17229 echo " "
17230 if set tzname val -a d_tzname; eval $csym; $val; then
17231         val="$define"
17232         echo 'tzname[] found.' >&4
17233 else
17234         val="$undef"
17235         echo 'tzname[] NOT found.' >&4
17236 fi
17237 set d_tzname
17238 eval $setvar
17239
17240 case "$osname" in
17241 next|rhapsody|darwin) multiarch="$define" ;;
17242 esac
17243 case "$multiarch" in
17244 ''|[nN]*) multiarch="$undef" ;;
17245 esac
17246
17247 : check for ordering of bytes in a UV
17248 echo " "
17249 case "$usecrosscompile$multiarch" in
17250 *$define*)
17251         $cat <<EOM
17252 You seem to be either cross-compiling or doing a multiarchitecture build,
17253 skipping the byteorder check.
17254
17255 EOM
17256         byteorder='ffff'
17257         ;;
17258 *)
17259         case "$byteorder" in
17260         '')
17261                 $cat <<'EOM'
17262 In the following, larger digits indicate more significance.  A big-endian
17263 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17264 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17265 machines may have weird orders like 3412.  A Cray will report 87654321,
17266 an Alpha will report 12345678. If the test program works the default is
17267 probably right.
17268 I'm now running the test program...
17269 EOM
17270                 $cat >try.c <<EOCP
17271 #include <stdio.h>
17272 #$i_stdlib I_STDLIB
17273 #ifdef I_STDLIB
17274 #include <stdlib.h>
17275 #endif
17276 #include <sys/types.h>
17277 typedef $uvtype UV;
17278 int main()
17279 {
17280         int i;
17281         union {
17282                 UV l;
17283                 char c[$uvsize];
17284         } u;
17285
17286         if ($uvsize > 4)
17287                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
17288         else
17289                 u.l = (UV)0x04030201;
17290         for (i = 0; i < $uvsize; i++)
17291                 printf("%c", u.c[i]+'0');
17292         printf("\n");
17293         exit(0);
17294 }
17295 EOCP
17296                 xxx_prompt=y
17297                 set try
17298                 if eval $compile && ./try > /dev/null; then
17299                         dflt=`$run ./try`
17300                         case "$dflt" in
17301                         [1-4][1-4][1-4][1-4]|12345678|87654321)
17302                                 echo "(The test program ran ok.)"
17303                                 echo "byteorder=$dflt"
17304                                 xxx_prompt=n
17305                         ;;
17306                         ????|????????) echo "(The test program ran ok.)" ;;
17307                         *) echo "(The test program didn't run right for some reason.)" ;;
17308                         esac
17309                 else
17310                         dflt='4321'
17311                         cat <<'EOM'
17312 (I can't seem to compile the test program.  Guessing big-endian...)
17313 EOM
17314                 fi
17315                 case "$xxx_prompt" in
17316                 y)
17317                         rp="What is the order of bytes in $uvtype?"
17318                         . ./myread
17319                         byteorder="$ans"
17320                         ;;
17321                 *)      byteorder=$dflt
17322                         ;;
17323                 esac
17324                 ;;
17325         esac
17326         $rm -f try.c try
17327         ;;
17328 esac
17329
17330
17331 $cat <<EOM
17332
17333 Checking to see whether you can access character data unalignedly...
17334 EOM
17335 case "$d_u32align" in
17336 '')   $cat >try.c <<EOCP
17337 #include <stdio.h>
17338 #$i_stdlib I_STDLIB
17339 #ifdef I_STDLIB
17340 #include <stdlib.h>
17341 #endif
17342 #define U32 $u32type
17343 #define BYTEORDER 0x$byteorder
17344 #define U8 $u8type
17345 #include <signal.h>
17346 #ifdef SIGBUS
17347 $signal_t bletch(s) int s; { exit(4); }
17348 #endif
17349 int main() {
17350 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
17351     U8 buf[8];
17352     U32 *up;
17353     int i;
17354
17355     if (sizeof(U32) != 4) {
17356         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
17357         exit(1);
17358     }
17359
17360     fflush(stdout);
17361
17362 #ifdef SIGBUS
17363     signal(SIGBUS, bletch);
17364 #endif
17365
17366     buf[0] = 0;
17367     buf[1] = 0;
17368     buf[2] = 0;
17369     buf[3] = 1;
17370     buf[4] = 0;
17371     buf[5] = 0;
17372     buf[6] = 0;
17373     buf[7] = 1;
17374
17375     for (i = 0; i < 4; i++) {
17376         up = (U32*)(buf + i);
17377         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
17378                (*up == 1 << (8*(3-i)))  /* little-endian */
17379               )
17380            )
17381         {
17382             printf("read failed (%x)\n", *up);
17383             exit(2);
17384         }
17385     }
17386
17387     /* write test */
17388     for (i = 0; i < 4; i++) {
17389         up = (U32*)(buf + i);
17390         *up = 0xBeef;
17391         if (*up != 0xBeef) {
17392             printf("write failed (%x)\n", *up);
17393             exit(3);
17394         }
17395     }
17396
17397     exit(0);
17398 #else
17399     printf("1\n");
17400     exit(1);
17401 #endif
17402     return 0;
17403 }
17404 EOCP
17405 set try
17406 if eval $compile_ok; then
17407         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
17408         $run ./try 2>&1 >/dev/null
17409         case "$?" in
17410         0)      cat >&4 <<EOM
17411 You can access character data pretty unalignedly.
17412 EOM
17413                 d_u32align="$undef"
17414                 ;;
17415         *)      cat >&4 <<EOM
17416 It seems that you must access character data in an aligned manner.
17417 EOM
17418                 d_u32align="$define"
17419                 ;;
17420         esac
17421 else
17422         rp='Can you access character data at unaligned addresses?'
17423         dflt='n'
17424         . ./myread
17425         case "$ans" in
17426         [yY]*)  d_u32align="$undef"  ;;
17427         *)      d_u32align="$define" ;;
17428         esac
17429 fi
17430 $rm -f core core.try.* try.core
17431 ;;
17432 esac
17433
17434 : see if ualarm exists
17435 set ualarm d_ualarm
17436 eval $inlibc
17437
17438 : see if umask exists
17439 set umask d_umask
17440 eval $inlibc
17441
17442 : see if unordered exists
17443 set unordered d_unordered
17444 eval $inlibc
17445
17446 : see if usleep exists
17447 set usleep d_usleep
17448 eval $inlibc
17449
17450 : see if prototype for usleep is available
17451 echo " "
17452 set d_usleepproto usleep $i_unistd unistd.h
17453 eval $hasproto
17454
17455 : see if ustat exists
17456 set ustat d_ustat
17457 eval $inlibc
17458
17459 : backward compatibility for d_hvfork
17460 if test X$d_hvfork != X; then
17461         d_vfork="$d_hvfork"
17462         d_hvfork=''
17463 fi
17464 : see if there is a vfork
17465 val=''
17466 set vfork val
17467 eval $inlibc
17468
17469 : Ok, but do we want to use it. vfork is reportedly unreliable in 
17470 : perl on Solaris 2.x, and probably elsewhere.
17471 case "$val" in
17472 $define)
17473         echo " "
17474         case "$usevfork" in
17475         false) dflt='n';;
17476         *) dflt='y';;
17477         esac
17478         cat <<'EOM'
17479  
17480 Perl can only use a vfork() that doesn't suffer from strict
17481 restrictions on calling functions or modifying global data in
17482 the child.  For example, glibc-2.1 contains such a vfork()
17483 that is unsuitable.  If your system provides a proper fork()
17484 call, chances are that you do NOT want perl to use vfork().
17485
17486 EOM
17487         rp="Do you still want to use vfork()?"
17488         . ./myread
17489         case "$ans" in
17490         y|Y) ;;
17491         *)
17492                 echo "Ok, we won't use vfork()."
17493                 val="$undef"
17494                 ;;
17495         esac
17496         ;;
17497 esac
17498 set d_vfork
17499 eval $setvar
17500 case "$d_vfork" in
17501 $define) usevfork='true';;
17502 *) usevfork='false';;
17503 esac
17504
17505 : see if closedir exists
17506 set closedir d_closedir
17507 eval $inlibc
17508
17509 case "$d_closedir" in
17510 "$define")
17511         echo " "
17512         echo "Checking whether closedir() returns a status..." >&4
17513         cat > try.c <<EOM
17514 #$i_dirent I_DIRENT             /**/
17515 #$i_sysdir I_SYS_DIR            /**/
17516 #$i_sysndir I_SYS_NDIR          /**/
17517 #$i_systypes I_SYS_TYPES        /**/
17518
17519 #if defined(I_SYS_TYPES)
17520 #include <sys/types.h>
17521 #endif
17522 #if defined(I_DIRENT)
17523 #include <dirent.h>
17524 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
17525 #include <sys/dir.h>
17526 #endif
17527 #else
17528 #ifdef I_SYS_NDIR
17529 #include <sys/ndir.h>
17530 #else
17531 #ifdef I_SYS_DIR
17532 #ifdef hp9000s500
17533 #include <ndir.h>       /* may be wrong in the future */
17534 #else
17535 #include <sys/dir.h>
17536 #endif
17537 #endif
17538 #endif
17539 #endif 
17540 int main() { return closedir(opendir(".")); }
17541 EOM
17542         set try
17543         if eval $compile_ok; then
17544                 if $run ./try > /dev/null 2>&1 ; then
17545                         echo "Yes, it does."
17546                         val="$undef"
17547                 else
17548                         echo "No, it doesn't."
17549                         val="$define"
17550                 fi
17551         else
17552                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17553                 val="$define"
17554         fi
17555         ;;
17556 *)
17557         val="$undef";
17558         ;;
17559 esac
17560 set d_void_closedir
17561 eval $setvar
17562 $rm -f try try.*
17563 : see if there is a wait4
17564 set wait4 d_wait4
17565 eval $inlibc
17566
17567 : see if waitpid exists
17568 set waitpid d_waitpid
17569 eval $inlibc
17570
17571 : see if wcstombs exists
17572 set wcstombs d_wcstombs
17573 eval $inlibc
17574
17575 : see if wctomb exists
17576 set wctomb d_wctomb
17577 eval $inlibc
17578
17579 : see if writev exists
17580 set writev d_writev
17581 eval $inlibc
17582
17583 : preserve RCS keywords in files with variable substitution, grrr
17584 Date='$Date'
17585 Id='$Id'
17586 Log='$Log'
17587 RCSfile='$RCSfile'
17588 Revision='$Revision'
17589
17590 : check for alignment requirements
17591 echo " "
17592 case "$usecrosscompile$multiarch" in
17593 *$define*)
17594         $cat <<EOM
17595 You seem to be either cross-compiling or doing a multiarchitecture build,
17596 skipping the memory alignment check.
17597
17598 EOM
17599         case "$alignbytes" in
17600         '') alignbytes=8 ;;
17601         esac
17602         ;;
17603 *)
17604         case "$alignbytes" in
17605         '') echo "Checking alignment constraints..." >&4
17606                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
17607                         $cat >try.c <<'EOCP'
17608 typedef long double NV;
17609 EOCP
17610                 else
17611                         $cat >try.c <<'EOCP'
17612 typedef double NV;
17613 EOCP
17614                 fi
17615                 $cat >>try.c <<'EOCP'
17616 #include <stdio.h>
17617 struct foobar {
17618         char foo;
17619         NV bar;
17620 } try_algn;
17621 int main()
17622 {
17623     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
17624     return(0);
17625 }
17626 EOCP
17627                 set try
17628                 if eval $compile_ok; then
17629                         dflt=`$run ./try`
17630                 else
17631                         dflt='8'
17632                         echo "(I can't seem to compile the test program...)"
17633                 fi
17634                 ;;
17635         *) dflt="$alignbytes"
17636                 ;;
17637         esac
17638         rp="Doubles must be aligned on a how-many-byte boundary?"
17639         . ./myread
17640         alignbytes="$ans"
17641         $rm -f try.c try
17642         ;;
17643 esac
17644
17645
17646 : set the base revision
17647 baserev=5.0
17648
17649 : how do we concatenate cpp tokens here?
17650 echo " "
17651 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
17652 $cat >cpp_stuff.c <<'EOCP'
17653 #define RCAT(a,b)a/**/b
17654 #define ACAT(a,b)a ## b
17655 RCAT(Rei,ser)
17656 ACAT(Cir,cus)
17657 EOCP
17658 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
17659 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
17660         echo "Oh!  Smells like ANSI's been here." >&4
17661         echo "We can catify or stringify, separately or together!"
17662         cpp_stuff=42
17663 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
17664         echo "Ah, yes!  The good old days!" >&4
17665         echo "However, in the good old days we don't know how to stringify and"
17666         echo "catify at the same time."
17667         cpp_stuff=1
17668 else
17669         $cat >&4 <<EOM
17670 Hmm, I don't seem to be able to concatenate tokens with your cpp.
17671 You're going to have to edit the values of CAT[2-5] in config.h...
17672 EOM
17673         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
17674 fi
17675 $rm -f cpp_stuff.*
17676
17677 : see if this is a db.h system
17678 set db.h i_db
17679 eval $inhdr
17680
17681 case "$i_db" in
17682 $define)
17683         : Check db version.
17684         echo " "
17685         echo "Checking Berkeley DB version ..." >&4
17686         $cat >try.c <<EOCP
17687 #$d_const HASCONST
17688 #ifndef HASCONST
17689 #define const
17690 #endif
17691 #include <sys/types.h>
17692 #include <stdio.h>
17693 #$i_stdlib I_STDLIB
17694 #ifdef I_STDLIB
17695 #include <stdlib.h>
17696 #endif
17697 #include <db.h>
17698 int main(int argc, char *argv[])
17699 {
17700 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
17701     int Major, Minor, Patch ;
17702     unsigned long Version ;
17703     (void)db_version(&Major, &Minor, &Patch) ;
17704     if (argc == 2) {
17705         printf("%d %d %d %d %d %d\n",
17706                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
17707                Major, Minor, Patch);
17708         exit(0);
17709     }
17710     printf("You have Berkeley DB Version 2 or greater.\n");
17711
17712     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
17713                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
17714     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
17715                 Major, Minor, Patch) ;
17716
17717     /* check that db.h & libdb are compatible */
17718     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
17719         printf("db.h and libdb are incompatible.\n") ;
17720         exit(3);        
17721     }
17722
17723     printf("db.h and libdb are compatible.\n") ;
17724
17725     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
17726                 + DB_VERSION_PATCH ;
17727
17728     /* needs to be >= 2.3.4 */
17729     if (Version < 2003004) {
17730     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
17731         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
17732         exit(2);        
17733     }
17734
17735     exit(0);
17736 #else
17737 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
17738     if (argc == 2) {
17739         printf("1 0 0\n");
17740         exit(0);
17741     }
17742     printf("You have Berkeley DB Version 1.\n");
17743     exit(0);    /* DB version < 2: the coast is clear. */
17744 #else
17745     exit(1);    /* <db.h> not Berkeley DB? */
17746 #endif
17747 #endif
17748 }
17749 EOCP
17750         set try
17751         if eval $compile_ok && $run ./try; then
17752                 echo 'Looks OK.' >&4
17753                 set `$run ./try 1`
17754                 db_version_major=$1
17755                 db_version_minor=$2
17756                 db_version_patch=$3
17757         else
17758                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
17759                 i_db=$undef
17760                 case " $libs " in
17761                 *"-ldb "*)
17762                         : Remove db from list of libraries to use
17763                         echo "Removing unusable -ldb from library list" >&4
17764                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
17765                         shift
17766                         libs="$*"
17767                         echo "libs = $libs" >&4
17768                         ;;
17769                 esac
17770         fi
17771         $rm -f try.*
17772         ;;
17773 esac
17774
17775 case "$i_db" in
17776 define)
17777         : Check the return type needed for hash 
17778         echo " "
17779         echo "Checking return type needed for hash for Berkeley DB ..." >&4
17780         $cat >try.c <<EOCP
17781 #$d_const HASCONST
17782 #ifndef HASCONST
17783 #define const
17784 #endif
17785 #include <sys/types.h>
17786 #include <db.h>
17787
17788 #ifndef DB_VERSION_MAJOR
17789 u_int32_t hash_cb (ptr, size)
17790 const void *ptr;
17791 size_t size;
17792 {
17793 }
17794 HASHINFO info;
17795 int main()
17796 {
17797         info.hash = hash_cb;
17798 }
17799 #endif
17800 EOCP
17801         if $cc $ccflags -c try.c >try.out 2>&1 ; then
17802                 if $contains warning try.out >>/dev/null 2>&1 ; then
17803                         db_hashtype='int'
17804                 else
17805                         db_hashtype='u_int32_t'
17806                 fi
17807         else
17808                 : XXX Maybe we should just give up here.
17809                 db_hashtype=u_int32_t
17810                 $cat try.out >&4
17811                 echo "Help:  I can't seem to compile the db test program." >&4
17812                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
17813         fi
17814         $rm -f try.*
17815         echo "Your version of Berkeley DB uses $db_hashtype for hash."
17816         ;;
17817 *)      db_hashtype=u_int32_t
17818         ;;
17819 esac
17820 case "$i_db" in
17821 define)
17822         : Check the return type needed for prefix 
17823         echo " "
17824         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
17825         cat >try.c <<EOCP
17826 #$d_const HASCONST
17827 #ifndef HASCONST
17828 #define const
17829 #endif
17830 #include <sys/types.h>
17831 #include <db.h>
17832
17833 #ifndef DB_VERSION_MAJOR
17834 size_t prefix_cb (key1, key2)
17835 const DBT *key1;
17836 const DBT *key2;
17837 {
17838 }
17839 BTREEINFO info;
17840 int main()
17841 {
17842         info.prefix = prefix_cb;
17843 }
17844 #endif
17845 EOCP
17846         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
17847                 if $contains warning try.out >>/dev/null 2>&1 ; then
17848                         db_prefixtype='int'
17849                 else
17850                         db_prefixtype='size_t'
17851                 fi
17852         else
17853                 db_prefixtype='size_t'
17854                 : XXX Maybe we should just give up here.
17855                 $cat try.out >&4
17856                 echo "Help:  I can't seem to compile the db test program." >&4
17857                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
17858         fi
17859         $rm -f try.*
17860         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
17861         ;;
17862 *)      db_prefixtype='size_t'
17863         ;;
17864 esac
17865
17866
17867 : How can we generate normalized random numbers ?
17868 echo " "
17869 echo "Looking for a random number function..." >&4
17870 case "$randfunc" in
17871 '')
17872         if set drand48 val -f; eval $csym; $val; then
17873                 dflt="drand48"
17874                 echo "Good, found drand48()." >&4
17875         elif set random val -f; eval $csym; $val; then
17876                 dflt="random"
17877                 echo "OK, found random()." >&4
17878         else
17879                 dflt="rand"
17880                 echo "Yick, looks like I have to use rand()." >&4
17881         fi
17882         echo " "
17883         ;;
17884 *)
17885         dflt="$randfunc"
17886         ;;
17887 esac
17888 cont=true
17889
17890 case "$ccflags" in
17891 *-Dmy_rand=*|*-Dmy_srand=*)
17892         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
17893         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
17894         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
17895         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
17896         ;;
17897 esac
17898
17899 while $test "$cont"; do
17900         rp="Use which function to generate random numbers?"
17901         . ./myread
17902         if $test "$ans" = "$dflt"; then
17903                 : null
17904         else
17905                 randbits=''
17906         fi
17907         randfunc="$ans"
17908         if set $ans val -f; eval $csym; $val; then
17909                 cont=''
17910         else
17911                 dflt=y
17912                 rp="I cannot find function $ans. Use that name anyway?"
17913                 . ./myread
17914                 dflt=rand
17915                 case "$ans" in
17916                         [yY]*) cont='';;
17917                 esac
17918         fi
17919         case "$cont" in
17920         '')
17921                 case "$randfunc" in
17922                 drand48)
17923                         drand01="drand48()"
17924                         seedfunc="srand48"
17925                         randbits=48
17926                         randseedtype=long
17927                         ;;
17928                 rand|random)
17929                         case "$randbits" in
17930                         '')
17931 echo "Checking to see how many bits your $randfunc() function produces..." >&4
17932                                 $cat >try.c <<EOCP
17933 #$i_unistd I_UNISTD
17934 #$i_stdlib I_STDLIB
17935 #include <stdio.h>
17936 #ifdef I_UNISTD
17937 #  include <unistd.h>
17938 #endif
17939 #ifdef I_STDLIB
17940 #  include <stdlib.h>
17941 #endif
17942 int main()
17943 {
17944         register int i;
17945         register unsigned long tmp;
17946         register unsigned long max = 0L;
17947
17948         for (i = 1000; i; i--) {
17949                 tmp = (unsigned long) $randfunc();
17950                 if (tmp > max) max = tmp;
17951         }
17952         for (i = 0; max; i++)
17953                 max /= 2;
17954         printf("%d\n",i);
17955 }
17956 EOCP
17957                                 set try
17958                                 if eval $compile_ok; then
17959                                         dflt=`try`
17960                                 else
17961                                         dflt='?'
17962                                         echo "(I can't seem to compile the test program...)"
17963                                 fi
17964                                 ;;
17965                         *)
17966                                 dflt="$randbits"
17967                                 ;;
17968                         esac
17969                         rp="How many bits does your $randfunc() function produce?"
17970                         . ./myread
17971                         randbits="$ans"
17972                         $rm -f try.c try
17973                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17974                         seedfunc="s$randfunc"
17975                         randseedtype=unsigned
17976                         ;;
17977                 *)
17978                         dflt="31"
17979                         rp="How many bits does your $randfunc() function produce?"
17980                         . ./myread
17981                         randbits="$ans"
17982                         seedfunc="s$randfunc"
17983                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17984                         if set $seedfunc val -f; eval $csym; $val; then
17985                                 echo "(Using $seedfunc() to seed random generator)"
17986                         else
17987                                 echo "(Warning: no $seedfunc() to seed random generator)"
17988                                 seedfunc=rand
17989                         fi
17990                         randseedtype=unsigned
17991                         ;;
17992                 esac
17993                 ;;
17994         esac
17995 done
17996
17997 echo " "
17998 echo "Determining whether or not we are on an EBCDIC system..." >&4
17999 $cat >try.c <<'EOM'
18000 int main()
18001 {
18002   if ('M'==0xd4) return 0;
18003   return 1;
18004 }
18005 EOM
18006
18007 val=$undef
18008 set try
18009 if eval $compile_ok; then
18010         if $run ./try; then
18011                 echo "You seem to speak EBCDIC." >&4
18012                 val="$define"
18013         else
18014                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18015         fi
18016 else
18017         echo "I'm unable to compile the test program." >&4
18018         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18019 fi
18020 $rm -f try try.*
18021 set ebcdic
18022 eval $setvar
18023
18024 echo " "
18025 $cat >&4 <<EOM
18026 Checking how to flush all pending stdio output...
18027 EOM
18028 # I only know how to find the first 32 possibly open files on SunOS.
18029 # See also hints/sunos_4_1.sh and util.c  --AD
18030 case "$osname" in
18031 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18032 esac
18033 $cat >>try.c <<EOCP
18034 #include <stdio.h>
18035 #$i_stdlib I_STDLIB
18036 #ifdef I_STDLIB
18037 #include <stdlib.h>
18038 #endif
18039 #$i_unistd I_UNISTD
18040 #ifdef I_UNISTD
18041 # include <unistd.h>
18042 #endif
18043 #$d_sysconf HAS_SYSCONF
18044 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18045 #ifdef HAS_STDIO_STREAM_ARRAY
18046 # define STDIO_STREAM_ARRAY $stdio_stream_array
18047 #endif
18048 int main() {
18049   FILE* p;
18050   unlink("try.out");
18051   p = fopen("try.out", "w");
18052 #ifdef TRY_FPUTC
18053   fputc('x', p);
18054 #else
18055 # ifdef TRY_FPRINTF
18056   fprintf(p, "x");
18057 # endif
18058 #endif
18059 #ifdef TRY_FFLUSH_NULL
18060   fflush(NULL);
18061 #endif
18062 #ifdef TRY_FFLUSH_ALL
18063   {
18064     long open_max = -1;
18065 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18066     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18067 # else
18068 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18069     open_max = sysconf(_SC_OPEN_MAX);
18070 #  else
18071 #   ifdef FOPEN_MAX
18072     open_max = FOPEN_MAX;
18073 #   else
18074 #    ifdef OPEN_MAX
18075     open_max = OPEN_MAX;
18076 #    else
18077 #     ifdef _NFILE
18078     open_max = _NFILE;
18079 #     endif
18080 #    endif
18081 #   endif
18082 #  endif
18083 # endif 
18084 # ifdef HAS_STDIO_STREAM_ARRAY
18085     if (open_max > 0) {
18086       long i;
18087       for (i = 0; i < open_max; i++)
18088             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18089                 STDIO_STREAM_ARRAY[i]._file < open_max &&
18090                 STDIO_STREAM_ARRAY[i]._flag)
18091                 fflush(&STDIO_STREAM_ARRAY[i]);
18092     }   
18093   }
18094 # endif
18095 #endif
18096   _exit(42);
18097 }
18098 EOCP
18099 : first we have to find out how _not_ to flush
18100 $to try.c
18101 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18102     output=''
18103     set try -DTRY_FPUTC
18104     if eval $compile; then
18105             $run ./try 2>/dev/null
18106             code="$?"
18107             $from try.out
18108             if $test ! -s try.out -a "X$code" = X42; then
18109                 output=-DTRY_FPUTC
18110             fi
18111     fi
18112     case "$output" in
18113     '')
18114             set try -DTRY_FPRINTF
18115             if eval $compile; then
18116                     $run ./try 2>/dev/null
18117                     code="$?"
18118                     $from try.out
18119                     if $test ! -s try.out -a "X$code" = X42; then
18120                         output=-DTRY_FPRINTF
18121                     fi
18122             fi
18123         ;;
18124     esac
18125 fi
18126 : check for fflush NULL behaviour
18127 case "$fflushNULL" in
18128 '')     set try -DTRY_FFLUSH_NULL $output
18129         if eval $compile; then
18130                 $run ./try 2>/dev/null
18131                 code="$?"
18132                 $from try.out
18133                 if $test -s try.out -a "X$code" = X42; then
18134                         fflushNULL="`$cat try.out`"
18135                 else
18136                         if $test "X$code" != X42; then
18137                                 $cat >&4 <<EOM
18138 (If this test failed, don't worry, we'll try another method shortly.)
18139 EOM
18140                         fi
18141                 fi
18142         fi
18143         $rm -f core try.core core.try.*
18144         case "$fflushNULL" in
18145         x)      $cat >&4 <<EOM
18146 Your fflush(NULL) works okay for output streams.
18147 Let's see if it clobbers input pipes...
18148 EOM
18149 # As of mid-March 2000 all versions of Solaris appear to have a stdio
18150 # bug that improperly flushes the input end of pipes.  So we avoid the
18151 # autoflush on fork/system/exec support for now. :-(
18152 $cat >tryp.c <<EOCP
18153 #include <stdio.h>
18154 int
18155 main(int argc, char **argv)
18156 {
18157     char buf[1024];
18158     int i;
18159     char *bp = buf;
18160     while (1) {
18161         while ((i = getc(stdin)) != -1
18162                && (*bp++ = i) != '\n'
18163                && bp < &buf[1024])
18164         /* DO NOTHING */ ;
18165         *bp = '\0';
18166         fprintf(stdout, "%s", buf);
18167         fflush(NULL);
18168         if (i == -1)
18169             return 0;
18170         bp = buf;
18171     }
18172 }
18173 EOCP
18174                 fflushNULL="$define"
18175                 set tryp
18176                 if eval $compile; then
18177                     $rm -f tryp.out
18178                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18179                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
18180                        $cat >&4 <<EOM
18181 fflush(NULL) seems to behave okay with input streams.
18182 EOM
18183                         fflushNULL="$define"
18184                     else
18185                         $cat >&4 <<EOM
18186 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
18187 EOM
18188                         fflushNULL="$undef"
18189                     fi
18190                 fi
18191                 $rm -f core tryp.c tryp.core core.tryp.*
18192                 ;;
18193         '')     $cat >&4 <<EOM
18194 Your fflush(NULL) isn't working (contrary to ANSI C).
18195 EOM
18196                 fflushNULL="$undef"
18197                 ;;
18198         *)      $cat >&4 <<EOM
18199 Cannot figure out whether your fflush(NULL) works or not.
18200 I'm assuming it doesn't (contrary to ANSI C).
18201 EOM
18202                 fflushNULL="$undef"
18203                 ;;
18204         esac
18205         ;;
18206 $define|true|[yY]*)
18207         fflushNULL="$define"
18208         ;;
18209 *)
18210         fflushNULL="$undef"
18211         ;;
18212 esac
18213 : check explicit looping only if NULL did not work, and if the pipe
18214 : bug does not show up on an explicit flush too
18215 case "$fflushNULL" in
18216 "$undef")
18217         $cat >tryp.c <<EOCP
18218 #include <stdio.h>
18219 int
18220 main(int argc, char **argv)
18221 {
18222     char buf[1024];
18223     int i;
18224     char *bp = buf;
18225     while (1) {
18226         while ((i = getc(stdin)) != -1
18227                && (*bp++ = i) != '\n'
18228                && bp < &buf[1024])
18229         /* DO NOTHING */ ;
18230         *bp = '\0';
18231         fprintf(stdout, "%s", buf);
18232         fflush(stdin);
18233         if (i == -1)
18234             return 0;
18235         bp = buf;
18236     }
18237 }
18238 EOCP
18239         set tryp
18240         if eval $compile; then
18241             $rm -f tryp.out
18242             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18243             if cmp tryp.c tryp.out >/dev/null 2>&1; then
18244                $cat >&4 <<EOM
18245 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18246 EOM
18247                 : now check for fflushall behaviour
18248                 case "$fflushall" in
18249                 '')     set try -DTRY_FFLUSH_ALL $output
18250                         if eval $compile; then
18251                                 $cat >&4 <<EOM
18252 (Now testing the other method--but note that this also may fail.)
18253 EOM
18254                                 $run ./try 2>/dev/null
18255                                 code=$?
18256                                 $from try.out
18257                                 if $test -s try.out -a "X$code" = X42; then
18258                                         fflushall="`$cat try.out`"
18259                                 fi
18260                         fi
18261                         $rm -f core try.core core.try.*
18262                         case "$fflushall" in
18263                         x)      $cat >&4 <<EOM
18264 Whew. Flushing explicitly all the stdio streams works.
18265 EOM
18266                                 fflushall="$define"
18267                                 ;;
18268                         '')     $cat >&4 <<EOM
18269 Sigh. Flushing explicitly all the stdio streams doesn't work.
18270 EOM
18271                                 fflushall="$undef"
18272                                 ;;
18273                         *)      $cat >&4 <<EOM
18274 Cannot figure out whether flushing stdio streams explicitly works or not.
18275 I'm assuming it doesn't.
18276 EOM
18277                                 fflushall="$undef"
18278                                 ;;
18279                         esac
18280                         ;;
18281                 "$define"|true|[yY]*)
18282                         fflushall="$define"
18283                         ;;
18284                 *)
18285                         fflushall="$undef"
18286                         ;;
18287                 esac
18288             else
18289                 $cat >&4 <<EOM
18290 All is futile.  Even fflush(stdin) clobbers input pipes!
18291 EOM
18292                 fflushall="$undef"
18293             fi
18294         else
18295             fflushall="$undef"
18296         fi
18297         $rm -f core tryp.c tryp.core core.tryp.*
18298         ;;
18299 *)      fflushall="$undef"
18300         ;;
18301 esac
18302
18303 case "$fflushNULL$fflushall" in
18304 undefundef)
18305         $cat <<EOM
18306 OK, I give up.  I cannot figure out how to flush pending stdio output.
18307 We won't be flushing handles at all before fork/exec/popen.
18308 EOM
18309         ;;
18310 esac
18311 $rm -f try.* try$exe_ext
18312
18313 : Store the full pathname to the ar program for use in the C program
18314 : Respect a hint or command line value for full_ar.
18315 case "$full_ar" in
18316 '') full_ar=$ar ;;
18317 esac
18318
18319 : Store the full pathname to the sed program for use in the C program
18320 full_sed=$sed
18321
18322 : see what type gids are declared as in the kernel
18323 echo " "
18324 echo "Looking for the type for group ids returned by getgid()."
18325 set gid_t gidtype xxx stdio.h sys/types.h
18326 eval $typedef
18327 case "$gidtype" in
18328 xxx)
18329         xxx=`./findhdr sys/user.h`
18330         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
18331         case $1 in
18332         unsigned) dflt="$1 $2" ;;
18333         *) dflt="$1" ;;
18334         esac
18335         ;;
18336 *) dflt="$gidtype";;
18337 esac
18338 case "$gidtype" in
18339 gid_t) echo "gid_t found." ;;
18340 *)      rp="What is the type for group ids returned by getgid()?"
18341         . ./myread
18342         gidtype="$ans"
18343         ;;
18344 esac
18345
18346 echo " "
18347 case "$gidtype" in
18348 *_t) zzz="$gidtype"     ;;
18349 *)   zzz="gid"          ;;
18350 esac
18351 echo "Checking the size of $zzz..." >&4 
18352 cat > try.c <<EOCP
18353 #include <sys/types.h>
18354 #include <stdio.h>
18355 #$i_stdlib I_STDLIB
18356 #ifdef I_STDLIB
18357 #include <stdlib.h>
18358 #endif
18359 int main() {
18360     printf("%d\n", (int)sizeof($gidtype));
18361     exit(0);
18362 }
18363 EOCP
18364 set try
18365 if eval $compile_ok; then
18366         yyy=`$run ./try`
18367         case "$yyy" in
18368         '')     gidsize=4
18369                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
18370                 ;;
18371         *)      gidsize=$yyy
18372                 echo "Your $zzz is $gidsize bytes long."
18373                 ;;
18374         esac
18375 else
18376         gidsize=4
18377         echo "(I can't compile the test program--guessing $gidsize.)" >&4
18378 fi
18379
18380
18381 echo " "
18382 case "$gidtype" in
18383 *_t) zzz="$gidtype"     ;;
18384 *)   zzz="gid"          ;;
18385 esac
18386 echo "Checking the sign of $zzz..." >&4 
18387 cat > try.c <<EOCP
18388 #include <sys/types.h>
18389 #include <stdio.h>
18390 int main() {
18391         $gidtype foo = -1;
18392         if (foo < 0)
18393                 printf("-1\n");
18394         else
18395                 printf("1\n");
18396 }
18397 EOCP
18398 set try
18399 if eval $compile; then
18400         yyy=`$run ./try`
18401         case "$yyy" in
18402         '')     gidsign=1
18403                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18404                 ;;
18405         *)      gidsign=$yyy
18406                 case "$gidsign" in
18407                  1) echo "Your $zzz is unsigned." ;;
18408                 -1) echo "Your $zzz is signed."   ;;
18409                 esac
18410                 ;;
18411         esac
18412 else
18413         gidsign=1
18414         echo "(I can't compile the test program--guessing unsigned.)" >&4
18415 fi
18416
18417
18418 echo " "
18419
18420 if $test X"$quadtype" != X; then
18421
18422 echo "Checking how to print 64-bit integers..." >&4
18423
18424 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
18425         $cat >try.c <<'EOCP'
18426 #include <sys/types.h>
18427 #include <stdio.h>
18428 int main() {
18429   int q = 12345678901;
18430   printf("%ld\n", q);
18431 }
18432 EOCP
18433         set try
18434         if eval $compile; then
18435                 yyy=`$run ./try`
18436                 case "$yyy" in
18437                 12345678901)
18438                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
18439                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
18440                         echo "We will use %d."
18441                         ;;
18442                 esac
18443         fi
18444 fi
18445
18446 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
18447         $cat >try.c <<'EOCP'
18448 #include <sys/types.h>
18449 #include <stdio.h>
18450 int main() {
18451   long q = 12345678901;
18452   printf("%ld\n", q);
18453 }
18454 EOCP
18455         set try
18456         if eval $compile; then
18457                 yyy=`$run ./try`
18458                 case "$yyy" in
18459                 12345678901)
18460                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
18461                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
18462                         echo "We will use %ld."
18463                         ;;
18464                 esac
18465         fi
18466 fi
18467
18468 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
18469         $cat >try.c <<'EOCP'
18470 #include <sys/types.h>
18471 #include <inttypes.h>
18472 #include <stdio.h>
18473 int main() {
18474   int64_t q = 12345678901;
18475   printf("%" PRId64 "\n", q);
18476 }
18477 EOCP
18478         set try
18479         if eval $compile; then
18480                 yyy=`$run ./try`
18481                 case "$yyy" in
18482                 12345678901)
18483                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
18484                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
18485                         echo "We will use the C9X style."
18486                         ;;
18487                 esac
18488         fi
18489 fi
18490
18491 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18492         $cat >try.c <<EOCP
18493 #include <sys/types.h>
18494 #include <stdio.h>
18495 int main() {
18496   $quadtype q = 12345678901;
18497   printf("%Ld\n", q);
18498 }
18499 EOCP
18500         set try
18501         if eval $compile; then
18502                 yyy=`$run ./try`
18503                 case "$yyy" in
18504                 12345678901)
18505                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
18506                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
18507                         echo "We will use %Ld."
18508                         ;;
18509                 esac
18510         fi
18511 fi
18512
18513 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
18514         $cat >try.c <<'EOCP'
18515 #include <sys/types.h>
18516 #include <stdio.h>
18517 int main() {
18518   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
18519   printf("%lld\n", q);
18520 }
18521 EOCP
18522         set try
18523         if eval $compile; then
18524                 yyy=`$run ./try`
18525                 case "$yyy" in
18526                 12345678901)
18527                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
18528                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
18529                         echo "We will use the %lld style."
18530                         ;;
18531                 esac
18532         fi
18533 fi
18534
18535 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18536         $cat >try.c <<EOCP
18537 #include <sys/types.h>
18538 #include <stdio.h>
18539 int main() {
18540   $quadtype q = 12345678901;
18541   printf("%qd\n", q);
18542 }
18543 EOCP
18544         set try
18545         if eval $compile; then
18546                 yyy=`$run ./try`
18547                 case "$yyy" in
18548                 12345678901)
18549                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
18550                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
18551                         echo "We will use %qd."
18552                         ;;
18553                 esac
18554         fi
18555 fi
18556
18557 if $test X"$sPRId64" = X; then
18558         echo "Cannot figure out how to print 64-bit integers." >&4
18559 fi
18560
18561 $rm -f try try.*
18562
18563 fi
18564
18565 case "$sPRId64" in
18566 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
18567         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
18568         ;;
18569 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
18570         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
18571         ;;
18572 esac
18573
18574
18575 echo " "
18576 $echo "Checking the format strings to be used for Perl's internal types..." >&4
18577
18578 if $test X"$ivsize" = X8; then
18579         ivdformat="$sPRId64"
18580         uvuformat="$sPRIu64"
18581         uvoformat="$sPRIo64"
18582         uvxformat="$sPRIx64"
18583         uvXUformat="$sPRIXU64"
18584 else
18585         if $test X"$ivsize" = X"$longsize"; then
18586                 ivdformat='"ld"'
18587                 uvuformat='"lu"'
18588                 uvoformat='"lo"'
18589                 uvxformat='"lx"'
18590                 uvXUformat='"lX"'
18591         else
18592                 if $test X"$ivsize" = X"$intsize"; then
18593                         ivdformat='"d"'
18594                         uvuformat='"u"'
18595                         uvoformat='"o"'
18596                         uvxformat='"x"'
18597                         uvXUformat='"X"'
18598                 else
18599                         : far out
18600                         if $test X"$ivsize" = X"$shortsize"; then
18601                                 ivdformat='"hd"'
18602                                 uvuformat='"hu"'
18603                                 uvoformat='"ho"'
18604                                 uvxformat='"hx"'
18605                                 uvXUformat='"hX"'
18606                         fi
18607                 fi
18608         fi
18609 fi
18610
18611 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
18612         nveformat="$sPRIeldbl"
18613         nvfformat="$sPRIfldbl"
18614         nvgformat="$sPRIgldbl"
18615         nvEUformat="$sPRIEUldbl"
18616         nvFUformat="$sPRIFUldbl"
18617         nvGUformat="$sPRIGUldbl"
18618 else
18619         nveformat='"e"'
18620         nvfformat='"f"'
18621         nvgformat='"g"'
18622         nvEUformat='"E"'
18623         nvFUformat='"F"'
18624         nvGUformat='"G"'
18625 fi
18626
18627 case "$ivdformat" in
18628 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
18629     exit 1
18630     ;;
18631 esac
18632
18633
18634 echo " "
18635 $echo "Checking the format string to be used for gids..." >&4
18636
18637 case "$gidsign" in
18638 -1)     if $test X"$gidsize" = X"$ivsize"; then
18639                 gidformat="$ivdformat"
18640         else
18641                 if $test X"$gidsize" = X"$longsize"; then
18642                         gidformat='"ld"'
18643                 else
18644                         if $test X"$gidsize" = X"$intsize"; then
18645                                 gidformat='"d"'
18646                         else
18647                                 if $test X"$gidsize" = X"$shortsize"; then
18648                                         gidformat='"hd"'
18649                                 fi
18650                         fi
18651                 fi
18652         fi
18653         ;;
18654 *)      if $test X"$gidsize" = X"$uvsize"; then
18655                 gidformat="$uvuformat"
18656         else
18657                 if $test X"$gidsize" = X"$longsize"; then
18658                         gidformat='"lu"'
18659                 else
18660                         if $test X"$gidsize" = X"$intsize"; then
18661                                 gidformat='"u"'
18662                         else
18663                                 if $test X"$gidsize" = X"$shortsize"; then
18664                                         gidformat='"hu"'
18665                                 fi
18666                         fi
18667                 fi
18668         fi
18669         ;;
18670 esac
18671
18672 : see if getgroups exists
18673 set getgroups d_getgrps
18674 eval $inlibc
18675
18676 : see if setgroups exists
18677 set setgroups d_setgrps
18678 eval $inlibc
18679
18680
18681 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
18682 echo " "
18683 case "$d_getgrps$d_setgrps" in
18684 *define*)
18685         case "$groupstype" in
18686         '') dflt="$gidtype" ;;
18687         *)  dflt="$groupstype" ;;
18688         esac
18689         $cat <<EOM
18690 What type of pointer is the second argument to getgroups() and setgroups()?
18691 Usually this is the same as group ids, $gidtype, but not always.
18692
18693 EOM
18694         rp='What type pointer is the second argument to getgroups() and setgroups()?'
18695         . ./myread
18696         groupstype="$ans"
18697         ;;
18698 *)  groupstype="$gidtype";;
18699 esac
18700
18701 echo " "
18702 echo "Checking if your $make program sets \$(MAKE)..." >&4
18703 case "$make_set_make" in
18704 '')
18705         $sed 's/^X //' > testmake.mak << 'EOF'
18706 Xall:
18707 X       @echo 'maketemp="$(MAKE)"'
18708 EOF
18709         case "`$make -f testmake.mak 2>/dev/null`" in
18710         *maketemp=*) make_set_make='#' ;;
18711         *)      make_set_make="MAKE=$make" ;;
18712         esac
18713         $rm -f testmake.mak
18714         ;;
18715 esac
18716 case "$make_set_make" in
18717 '#') echo "Yup, it does.";;
18718 *) echo "Nope, it doesn't.";;
18719 esac
18720
18721 : see what type is used for mode_t
18722 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
18723 set mode_t modetype int stdio.h sys/types.h
18724 eval $typedef_ask
18725
18726 : see if stdarg is available
18727 echo " "
18728 if $test `./findhdr stdarg.h`; then
18729         echo "<stdarg.h> found." >&4
18730         valstd="$define"
18731 else
18732         echo "<stdarg.h> NOT found." >&4
18733         valstd="$undef"
18734 fi
18735
18736 : see if varags is available
18737 echo " "
18738 if $test `./findhdr varargs.h`; then
18739         echo "<varargs.h> found." >&4
18740 else
18741         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
18742 fi
18743
18744 : set up the varargs testing programs
18745 $cat > varargs.c <<EOP
18746 #ifdef I_STDARG
18747 #include <stdarg.h>
18748 #endif
18749 #ifdef I_VARARGS
18750 #include <varargs.h>
18751 #endif
18752
18753 #ifdef I_STDARG
18754 int f(char *p, ...)
18755 #else
18756 int f(va_alist)
18757 va_dcl
18758 #endif
18759 {
18760         va_list ap;
18761 #ifndef I_STDARG
18762         char *p;
18763 #endif
18764 #ifdef I_STDARG
18765         va_start(ap,p);
18766 #else
18767         va_start(ap);
18768         p = va_arg(ap, char *);
18769 #endif
18770         va_end(ap);
18771 }
18772 EOP
18773 $cat > varargs <<EOP
18774 $startsh
18775 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
18776         echo "true"
18777 else
18778         echo "false"
18779 fi
18780 $rm -f varargs$_o
18781 EOP
18782 chmod +x varargs
18783
18784 : now check which varargs header should be included
18785 echo " "
18786 i_varhdr=''
18787 case "$valstd" in
18788 "$define")
18789         if `./varargs I_STDARG`; then
18790                 val='stdarg.h'
18791         elif `./varargs I_VARARGS`; then
18792                 val='varargs.h'
18793         fi
18794         ;;
18795 *)
18796         if `./varargs I_VARARGS`; then
18797                 val='varargs.h'
18798         fi
18799         ;;
18800 esac
18801 case "$val" in
18802 '')
18803 echo "I could not find the definition for va_dcl... You have problems..." >&4
18804         val="$undef"; set i_stdarg; eval $setvar
18805         val="$undef"; set i_varargs; eval $setvar
18806         ;;
18807 *) 
18808         set i_varhdr
18809         eval $setvar
18810         case "$i_varhdr" in
18811         stdarg.h)
18812                 val="$define"; set i_stdarg; eval $setvar
18813                 val="$undef"; set i_varargs; eval $setvar
18814                 ;;
18815         varargs.h)
18816                 val="$undef"; set i_stdarg; eval $setvar
18817                 val="$define"; set i_varargs; eval $setvar
18818                 ;;
18819         esac
18820         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
18821 esac
18822 $rm -f varargs*
18823
18824 : see if we need va_copy
18825 echo " "
18826 case "$i_stdarg" in
18827 "$define")
18828         $cat >try.c <<EOCP
18829 #include <stdarg.h>
18830 #include <stdio.h>
18831 #$i_stdlib I_STDLIB
18832 #ifdef I_STDLIB
18833 #include <stdlib.h>
18834 #endif
18835 #include <signal.h>
18836
18837 int
18838 ivfprintf(FILE *f, const char *fmt, va_list *valp)
18839 {
18840   return vfprintf(f, fmt, *valp);
18841 }
18842  
18843 int    
18844 myvfprintf(FILE *f, const  char *fmt, va_list val)
18845 {
18846   return ivfprintf(f, fmt, &val);
18847 }
18848       
18849 int
18850 myprintf(char *fmt, ...) 
18851 {
18852   va_list val;
18853   va_start(val, fmt);
18854   return myvfprintf(stdout, fmt, val); 
18855 }         
18856
18857 int
18858 main(int ac, char **av)
18859 {
18860   signal(SIGSEGV, exit);
18861
18862   myprintf("%s%cs all right, then\n", "that", '\'');                            
18863   exit(0);      
18864 }
18865 EOCP
18866         set try
18867         if eval $compile && $run ./try 2>&1 >/dev/null; then
18868                 case "`$run ./try`" in
18869                 "that's all right, then")
18870                         okay=yes
18871                         ;;
18872                 esac
18873         fi
18874         case "$okay" in
18875         yes)    echo "It seems that you don't need va_copy()." >&4
18876                 need_va_copy="$undef"
18877                 ;;
18878         *)      echo "It seems that va_copy() or similar will be needed." >&4
18879                 need_va_copy="$define"
18880                 ;;
18881         esac
18882         $rm -f try.* core core.* *.core *.core.*
18883         ;;
18884 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
18885         ;;
18886 esac
18887
18888 : see what type is used for size_t
18889 rp="What is the type used for the length parameter for string functions?"
18890 set size_t sizetype 'unsigned int' stdio.h sys/types.h
18891 eval $typedef_ask
18892
18893 : check for type of arguments to gethostbyaddr. 
18894 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
18895         case "$d_gethbyaddr" in
18896         $define)
18897                 $cat <<EOM
18898
18899 Checking to see what type of arguments are accepted by gethostbyaddr().
18900 EOM
18901                 hdrs="$define sys/types.h
18902                         $d_socket sys/socket.h 
18903                         $i_niin netinet/in.h 
18904                         $i_netdb netdb.h
18905                         $i_unistd unistd.h"
18906                 : The first arg can 'char *' or 'void *'
18907                 : The second arg is some of integral type
18908                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
18909                         for yyy in size_t long int; do
18910                                 case "$netdb_host_type" in
18911                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
18912                                         if ./protochk "$try" $hdrs; then
18913                                                 echo "Your system accepts $xxx for the first arg."
18914                                                 echo "...and $yyy for the second arg."
18915                                                 netdb_host_type="$xxx"
18916                                                 netdb_hlen_type="$yyy"
18917                                         fi
18918                                         ;;
18919                                 esac
18920                         done
18921                 done
18922                 : In case none of those worked, prompt the user.
18923                 case "$netdb_host_type" in
18924                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
18925                         dflt='char *'
18926                         . ./myread
18927                         netdb_host_type=$ans
18928                         rp='What is the type for the 2nd argument to gethostbyaddr?'
18929                         dflt="$sizetype"
18930                         . ./myread
18931                         netdb_hlen_type=$ans
18932                         ;;
18933                 esac
18934                 ;;
18935         *)      : no gethostbyaddr, so pick harmless defaults
18936                 netdb_host_type='char *'
18937                 netdb_hlen_type="$sizetype"
18938                 ;;
18939         esac
18940         # Remove the "const" if needed. -- but then we'll have a 
18941         # prototype clash!
18942         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
18943 fi
18944
18945 : check for type of argument to gethostbyname. 
18946 if test "X$netdb_name_type" = X ; then
18947         case "$d_gethbyname" in
18948         $define)
18949                 $cat <<EOM
18950
18951 Checking to see what type of argument is accepted by gethostbyname().
18952 EOM
18953                 hdrs="$define sys/types.h
18954                         $d_socket sys/socket.h 
18955                         $i_niin netinet/in.h 
18956                         $i_netdb netdb.h
18957                         $i_unistd unistd.h"
18958                 for xxx in "const char *" "char *"; do
18959                         case "$netdb_name_type" in
18960                         '')     try="extern struct hostent *gethostbyname($xxx);"
18961                                 if ./protochk "$try" $hdrs; then
18962                                         echo "Your system accepts $xxx."
18963                                         netdb_name_type="$xxx"
18964                                 fi
18965                                 ;;
18966                         esac
18967                 done
18968                 : In case none of those worked, prompt the user.
18969                 case "$netdb_name_type" in
18970                 '')     rp='What is the type for the 1st argument to gethostbyname?'
18971                         dflt='char *'
18972                         . ./myread
18973                         netdb_name_type=$ans
18974                         ;;
18975                 esac
18976                 ;;
18977         *)      : no gethostbyname, so pick harmless default
18978                 netdb_name_type='char *'
18979                 ;;
18980         esac
18981 fi
18982
18983 : check for type of 1st argument to getnetbyaddr. 
18984 if test "X$netdb_net_type" = X ; then
18985         case "$d_getnbyaddr" in
18986         $define)
18987                 $cat <<EOM
18988
18989 Checking to see what type of 1st argument is accepted by getnetbyaddr().
18990 EOM
18991                 hdrs="$define sys/types.h
18992                         $d_socket sys/socket.h 
18993                         $i_niin netinet/in.h 
18994                         $i_netdb netdb.h
18995                         $i_unistd unistd.h"
18996                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
18997                         case "$netdb_net_type" in
18998                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
18999                                 if ./protochk "$try" $hdrs; then
19000                                         echo "Your system accepts $xxx."
19001                                         netdb_net_type="$xxx"
19002                                 fi
19003                                 ;;
19004                         esac
19005                 done
19006                 : In case none of those worked, prompt the user.
19007                 case "$netdb_net_type" in
19008                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19009                         dflt='long'
19010                         . ./myread
19011                         netdb_net_type=$ans
19012                         ;;
19013                 esac
19014                 ;;
19015         *)      : no getnetbyaddr, so pick harmless default
19016                 netdb_net_type='long'
19017                 ;;
19018         esac
19019 fi
19020 : locate the preferred pager for this system
19021 fn=f/
19022 case "$pager" in
19023 '')
19024         dflt=''
19025         case "$pg" in
19026         /*) dflt=$pg;;
19027         [a-zA-Z]:/*) dflt=$pg;;
19028         esac
19029         case "$more" in
19030         /*) dflt=$more;;
19031         [a-zA-Z]:/*) dflt=$more;;
19032         esac
19033         case "$less" in
19034         /*) dflt=$less;;
19035         [a-zA-Z]:/*) dflt=$less;;
19036         esac
19037         case "$dflt" in
19038         '') dflt=/usr/ucb/more;;
19039         esac
19040         ;;
19041 *)      dflt="$pager"
19042         : Instruct ./getfile to trust the hinted or previous pager value,
19043         : even if it does not begin with a slash.  For example, on os2,
19044         : pager might be cmd /c more.  See comments in UU/getfile.
19045         fn="f/($pager)"
19046         ;;
19047 esac
19048 echo " "
19049 rp='What pager is used on your system?'
19050 . ./getfile
19051 pager="$ans"
19052
19053 : see what type pids are declared as in the kernel
19054 rp="What is the type of process ids on this system?"
19055 set pid_t pidtype int stdio.h sys/types.h
19056 eval $typedef_ask
19057
19058 : see if ar generates random libraries by itself
19059 echo " "
19060 echo "Checking how to generate random libraries on your machine..." >&4
19061 echo 'int bar1() { return bar2(); }' > bar1.c
19062 echo 'int bar2() { return 2; }' > bar2.c
19063 $cat > foo.c <<EOP
19064 #$i_stdlib I_STDLIB
19065 #ifdef I_STDLIB
19066 #include <stdlib.h>
19067 #endif
19068 int main() { printf("%d\n", bar1()); exit(0); }
19069 EOP
19070 $cc $ccflags -c bar1.c >/dev/null 2>&1
19071 $cc $ccflags -c bar2.c >/dev/null 2>&1
19072 $cc $ccflags -c foo.c >/dev/null 2>&1
19073 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19074 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19075         $run ./foobar >/dev/null 2>&1; then
19076         echo "$ar appears to generate random libraries itself."
19077         orderlib=false
19078         ranlib=":"
19079 elif $ar ts bar$_a >/dev/null 2>&1 &&
19080         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19081         $run ./foobar >/dev/null 2>&1; then
19082                 echo "a table of contents needs to be added with '$ar ts'."
19083                 orderlib=false
19084                 ranlib="$ar ts"
19085 else
19086         case "$ranlib" in
19087         :) ranlib='';;
19088         '')
19089                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19090                 $test -f $ranlib || ranlib=''
19091                 ;;
19092         esac
19093         if $test -n "$ranlib"; then
19094                 echo "your system has '$ranlib'; we'll use that."
19095                 orderlib=false
19096         else
19097                 echo "your system doesn't seem to support random libraries"
19098                 echo "so we'll use lorder and tsort to order the libraries."
19099                 orderlib=true
19100                 ranlib=":"
19101         fi
19102 fi
19103 $rm -f foo* bar* 
19104
19105 : check for type of arguments to select. 
19106 case "$selecttype" in
19107 '') case "$d_select" in
19108         $define)
19109                 echo " "
19110                 $cat <<EOM
19111 Checking to see what type of arguments are accepted by select().
19112 EOM
19113                 hdrs="$define sys/types.h
19114                         $i_systime sys/time.h 
19115                         $i_sysselct sys/select.h
19116                         $d_socket sys/socket.h"
19117                 : The first arg can be int, unsigned, or size_t
19118                 : The last arg may or may not be 'const'
19119                 val=''
19120                 : void pointer has been seen but using that
19121                 : breaks the selectminbits test
19122                 for xxx in 'fd_set *' 'int *'; do
19123                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19124                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
19125                                         case "$val" in
19126                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19127                                                 if ./protochk "$try" $hdrs; then
19128                                                         echo "Your system accepts $xxx."
19129                                                         val="$xxx"
19130                                                 fi
19131                                                 ;;
19132                                         esac
19133                                 done
19134                         done
19135                 done
19136                 case "$val" in
19137                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19138                         case "$d_fd_set" in
19139                                 $define) dflt="fd_set *" ;;
19140                                 *)              dflt="int *" ;;
19141                         esac
19142                         . ./myread
19143                         val=$ans
19144                         ;;
19145                 esac
19146                 selecttype="$val"
19147                 ;;
19148         *)      : no select, so pick a harmless default
19149                 selecttype='int *'
19150                 ;;
19151         esac
19152         ;;
19153 esac
19154
19155 : check for the select 'width'
19156 case "$selectminbits" in
19157 '') safebits=`expr $ptrsize \* 8`
19158     case "$d_select" in
19159         $define)
19160                 $cat <<EOM
19161
19162 Checking to see on how many bits at a time your select() operates...
19163 EOM
19164                 $cat >try.c <<EOCP
19165 #include <sys/types.h>
19166 #$i_time I_TIME
19167 #$i_systime I_SYS_TIME
19168 #$i_systimek I_SYS_TIME_KERNEL
19169 #ifdef I_TIME
19170 #   include <time.h>
19171 #endif
19172 #ifdef I_SYS_TIME
19173 #   ifdef I_SYS_TIME_KERNEL
19174 #       define KERNEL
19175 #   endif
19176 #   include <sys/time.h>
19177 #   ifdef I_SYS_TIME_KERNEL
19178 #       undef KERNEL
19179 #   endif
19180 #endif
19181 #$i_sysselct I_SYS_SELECT
19182 #ifdef I_SYS_SELECT
19183 #include <sys/select.h>
19184 #endif
19185 #$d_socket HAS_SOCKET
19186 #ifdef HAS_SOCKET
19187 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19188 #endif
19189 #include <stdio.h>
19190 #$i_stdlib I_STDLIB
19191 #ifdef I_STDLIB
19192 #include <stdlib.h>
19193 #endif
19194 $selecttype b;
19195 #define S sizeof(*(b))
19196 #define MINBITS 64
19197 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19198 #define NBITS  (NBYTES * 8)
19199 int main() {
19200     char *s = malloc(NBYTES);
19201     struct timeval t;
19202     int i;
19203     FILE* fp;
19204     int fd;
19205
19206     if (!s)
19207         exit(1);
19208     fclose(stdin);
19209     fp = fopen("try.c", "r");
19210     if (fp == 0)
19211       exit(2);
19212     fd = fileno(fp);
19213     if (fd < 0)
19214       exit(3);
19215     b = ($selecttype)s;
19216     for (i = 0; i < NBITS; i++)
19217         FD_SET(i, b);
19218     t.tv_sec  = 0;
19219     t.tv_usec = 0;
19220     select(fd + 1, b, 0, 0, &t);
19221     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
19222     free(s);
19223     printf("%d\n", i + 1);
19224     return 0;
19225 }
19226 EOCP
19227                 set try
19228                 if eval $compile_ok; then
19229                         selectminbits=`$run ./try`
19230                         case "$selectminbits" in
19231                         '')     cat >&4 <<EOM
19232 Cannot figure out on how many bits at a time your select() operates.
19233 I'll play safe and guess it is $safebits bits.
19234 EOM
19235                                 selectminbits=$safebits
19236                                 bits="$safebits bits"
19237                                 ;;
19238                         1)      bits="1 bit" ;;
19239                         *)      bits="$selectminbits bits" ;;
19240                         esac
19241                         echo "Your select() operates on $bits at a time." >&4
19242                 else
19243                         rp='What is the minimum number of bits your select() operates on?'
19244                         case "$byteorder" in
19245                         12345678)       dflt=64 ;;
19246                         1234)           dflt=32 ;;
19247                         *)              dflt=1  ;;
19248                         esac
19249                         . ./myread
19250                         val=$ans
19251                         selectminbits="$val"
19252                 fi
19253                 $rm -f try.* try
19254                 ;;
19255         *)      : no select, so pick a harmless default
19256                 selectminbits=$safebits
19257                 ;;
19258         esac
19259         ;;
19260 esac
19261
19262 : Trace out the files included by signal.h, then look for SIGxxx names.
19263 : Remove SIGARRAYSIZE used by HPUX.
19264 : Remove SIGSTKSIZE used by Linux.
19265 : Remove SIGSTKSZ used by Posix.
19266 : Remove SIGTYP void lines used by OS2.
19267 : Some cpps, like os390, dont give the file name anywhere
19268 if [ "X$fieldn" = X ]; then
19269         : Just make some guesses.  We check them later.
19270         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19271 else
19272         xxx=`echo '#include <signal.h>' |
19273         $cppstdin $cppminus $cppflags 2>/dev/null |
19274         $grep '^[       ]*#.*include' | 
19275         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
19276 fi
19277 : Check this list of files to be sure we have parsed the cpp output ok.
19278 : This will also avoid potentially non-existent files, such 
19279 : as ../foo/bar.h
19280 xxxfiles=''
19281 for xx in $xxx /dev/null ; do
19282         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19283 done
19284 : If we have found no files, at least try signal.h
19285 case "$xxxfiles" in
19286 '')     xxxfiles=`./findhdr signal.h` ;;
19287 esac
19288 xxx=`awk '
19289 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19290         print substr($2, 4, 20)
19291 }
19292 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19293         print substr($3, 4, 20)
19294 }' $xxxfiles`
19295 : Append some common names just in case the awk scan failed.
19296 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19297 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19298 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19299 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19300 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19301
19302 : generate a few handy files for later
19303 $cat > signal.c <<EOCP
19304 #include <sys/types.h>
19305 #include <signal.h>
19306 #$i_stdlib I_STDLIB
19307 #ifdef I_STDLIB
19308 #include <stdlib.h>
19309 #endif
19310 #include <stdio.h>
19311 int main() {
19312
19313 /* Strange style to avoid deeply-nested #if/#else/#endif */
19314 #ifndef NSIG
19315 #  ifdef _NSIG
19316 #    define NSIG (_NSIG)
19317 #  endif
19318 #endif
19319
19320 #ifndef NSIG
19321 #  ifdef SIGMAX
19322 #    define NSIG (SIGMAX+1)
19323 #  endif
19324 #endif
19325
19326 #ifndef NSIG
19327 #  ifdef SIG_MAX
19328 #    define NSIG (SIG_MAX+1)
19329 #  endif
19330 #endif
19331
19332 #ifndef NSIG
19333 #  ifdef MAXSIG
19334 #    define NSIG (MAXSIG+1)
19335 #  endif
19336 #endif
19337
19338 #ifndef NSIG
19339 #  ifdef MAX_SIG
19340 #    define NSIG (MAX_SIG+1)
19341 #  endif
19342 #endif
19343
19344 #ifndef NSIG
19345 #  ifdef SIGARRAYSIZE
19346 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
19347 #  endif
19348 #endif
19349
19350 #ifndef NSIG
19351 #  ifdef _sys_nsig
19352 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
19353 #  endif
19354 #endif
19355
19356 /* Default to some arbitrary number that's big enough to get most
19357    of the common signals.
19358 */
19359 #ifndef NSIG
19360 #    define NSIG 50
19361 #endif
19362
19363 printf("NSIG %d\n", NSIG);
19364
19365 #ifndef JUST_NSIG
19366
19367 EOCP
19368
19369 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19370 {
19371         printf "#ifdef SIG"; printf $1; printf "\n"
19372         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
19373         printf $1; printf ");\n"
19374         printf "#endif\n"
19375 }
19376 END {
19377         printf "#endif /* JUST_NSIG */\n";
19378         printf "exit(0);\n}\n";
19379 }
19380 ' >>signal.c
19381 $cat >signal.awk <<'EOP'
19382 BEGIN { ndups = 0 }
19383 $1 ~ /^NSIG$/ { nsig = $2 }
19384 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
19385     if ($2 > maxsig) { maxsig = $2 }
19386     if (sig_name[$2]) {
19387         dup_name[ndups] = $1
19388         dup_num[ndups] = $2
19389         ndups++ 
19390     }
19391     else {
19392         sig_name[$2] = $1
19393         sig_num[$2] = $2
19394     }
19395 }
19396 END { 
19397     if (nsig == 0) {
19398         nsig = maxsig + 1
19399     }
19400     printf("NSIG %d\n", nsig);
19401     for (n = 1; n < nsig; n++) {
19402         if (sig_name[n]) {
19403             printf("%s %d\n", sig_name[n], sig_num[n])
19404         }
19405         else {
19406             printf("NUM%d %d\n", n, n) 
19407         }
19408     }
19409     for (n = 0; n < ndups; n++) {
19410         printf("%s %d\n", dup_name[n], dup_num[n])
19411     }
19412 }
19413 EOP
19414 $cat >signal_cmd <<EOS
19415 $startsh
19416 if $test -s signal.lst; then
19417     echo "Using your existing signal.lst file"
19418         exit 0
19419 fi
19420 xxx="$xxx"
19421 EOS
19422 $cat >>signal_cmd <<'EOS'
19423
19424 set signal
19425 if eval $compile_ok; then
19426         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
19427 else
19428         echo "(I can't seem be able to compile the whole test program)" >&4
19429         echo "(I'll try it in little pieces.)" >&4
19430         set signal -DJUST_NSIG
19431         if eval $compile_ok; then
19432                 $run ./signal$_exe > signal.nsg
19433                 $cat signal.nsg
19434         else
19435                 echo "I can't seem to figure out how many signals you have." >&4
19436                 echo "Guessing 50." >&4
19437                 echo 'NSIG 50' > signal.nsg
19438         fi
19439         : Now look at all the signal names, one at a time.
19440         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
19441                 $cat > signal.c <<EOCP
19442 #include <sys/types.h>
19443 #include <signal.h>
19444 #include <stdio.h>
19445 int main() {
19446 printf("$xx %d\n", SIG${xx});
19447 return 0;
19448 }
19449 EOCP
19450                 set signal
19451                 if eval $compile; then
19452                         echo "SIG${xx} found."
19453                         $run ./signal$_exe  >> signal.ls1
19454                 else
19455                         echo "SIG${xx} NOT found."
19456                 fi
19457         done
19458         if $test -s signal.ls1; then
19459                 $cat signal.nsg signal.ls1 |
19460                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
19461         fi
19462
19463 fi
19464 if $test -s signal.lst; then
19465         :
19466 else
19467         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
19468         echo 'kill -l' >signal
19469         set X `csh -f <signal`
19470         $rm -f signal
19471         shift
19472         case $# in
19473         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
19474         esac
19475         echo $@ | $tr ' ' $trnl | \
19476             $awk '{ printf "%s %d\n", $1, ++s; }
19477                   END { printf "NSIG %d\n", ++s }' >signal.lst
19478 fi
19479 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
19480 EOS
19481 chmod a+x signal_cmd
19482 $eunicefix signal_cmd
19483
19484 : generate list of signal names
19485 echo " "
19486 case "$sig_name_init" in
19487 '') doinit=yes ;;
19488 *)  case "$sig_num_init" in
19489     ''|*,*) doinit=yes ;;
19490     esac ;;
19491 esac
19492 case "$doinit" in
19493 yes)
19494         echo "Generating a list of signal names and numbers..." >&4
19495         . ./signal_cmd
19496         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
19497         sig_name=`$awk 'BEGIN { printf "ZERO " }
19498                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
19499         sig_num=`$awk  'BEGIN { printf "0 " }
19500                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
19501         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
19502                              !/^NSIG/   { printf "\"%s\", ", $1 }
19503                              END        { printf "0\n" }' signal.lst`
19504         sig_num_init=`$awk  'BEGIN      { printf "0, " }
19505                              !/^NSIG/   { printf "%d, ", $2}
19506                              END        { printf "0\n"}' signal.lst`
19507         ;;
19508 esac
19509 echo "The following $sig_count signals are available:"
19510 echo " "
19511 echo $sig_name | $awk \
19512 'BEGIN { linelen = 0 }
19513 {
19514         for (i = 1; i <= NF; i++) {
19515                 name = "SIG" $i " "
19516                 linelen = linelen + length(name)
19517                 if (linelen > 70) {
19518                         printf "\n"
19519                         linelen = length(name)
19520                 }
19521                 printf "%s", name
19522         }
19523         printf "\n"
19524 }'
19525 sig_size=`echo $sig_name | awk '{print NF}'`
19526 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
19527
19528 echo " "
19529 case "$sizetype" in
19530 *_t) zzz="$sizetype"    ;;
19531 *)   zzz="filesize"     ;;
19532 esac
19533 echo "Checking the size of $zzz..." >&4 
19534 cat > try.c <<EOCP
19535 #include <sys/types.h>
19536 #include <stdio.h>
19537 #$i_stdlib I_STDLIB
19538 #ifdef I_STDLIB
19539 #include <stdlib.h>
19540 #endif
19541 int main() {
19542     printf("%d\n", (int)sizeof($sizetype));
19543     exit(0);
19544 }
19545 EOCP
19546 set try
19547 if eval $compile_ok; then
19548         yyy=`$run ./try`
19549         case "$yyy" in
19550         '')     sizesize=4
19551                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
19552                 ;;
19553         *)      sizesize=$yyy
19554                 echo "Your $zzz size is $sizesize bytes."
19555                 ;;
19556         esac
19557 else
19558         sizesize=4
19559         echo "(I can't compile the test program--guessing $sizesize.)" >&4
19560 fi
19561
19562
19563 : check for socklen_t
19564 echo " "
19565 echo "Checking to see if you have socklen_t..." >&4
19566 $cat >try.c <<EOCP
19567 #include <sys/types.h>
19568 #$d_socket HAS_SOCKET
19569 #ifdef HAS_SOCKET
19570 #include <sys/socket.h>
19571 #endif
19572 int main() { socklen_t x = 16; }
19573 EOCP
19574 set try
19575 if eval $compile; then
19576         val="$define"
19577         echo "You have socklen_t."
19578 else
19579         val="$undef"
19580         echo "You do not have socklen_t."
19581         case "$sizetype" in
19582         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
19583         esac
19584 fi
19585 $rm -f try try.*
19586 set d_socklen_t
19587 eval $setvar
19588
19589 : see if this is a socks.h system
19590 set socks.h i_socks
19591 eval $inhdr
19592
19593 : check for type of the size argument to socket calls
19594 case "$d_socket" in
19595 "$define")
19596         $cat <<EOM
19597
19598 Checking to see what type is the last argument of accept().
19599 EOM
19600         yyy=''
19601         case "$d_socklen_t" in
19602         "$define") yyy="$yyy socklen_t"
19603         esac
19604         yyy="$yyy $sizetype int long unsigned"
19605         for xxx in $yyy; do
19606                 case "$socksizetype" in
19607                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
19608                         case "$usesocks" in
19609                         "$define")
19610                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
19611                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19612                                         socksizetype="$xxx"
19613                                 fi
19614                                 ;;
19615                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
19616                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19617                                         socksizetype="$xxx"
19618                                 fi
19619                                 ;;
19620                         esac
19621                         ;;
19622                 esac
19623         done
19624 : In case none of those worked, prompt the user.
19625         case "$socksizetype" in
19626         '')     rp='What is the type for socket address structure sizes?'
19627                 dflt='int'
19628                 . ./myread
19629                 socksizetype=$ans
19630                 ;;
19631         esac
19632         ;;
19633 *)      : no sockets, so pick relatively harmless default
19634         socksizetype='int'
19635         ;;
19636 esac
19637
19638 : see what type is used for signed size_t
19639 set ssize_t ssizetype int stdio.h sys/types.h
19640 eval $typedef
19641 dflt="$ssizetype"
19642 $cat > try.c <<EOM
19643 #include <stdio.h>
19644 #$i_stdlib I_STDLIB
19645 #ifdef I_STDLIB
19646 #include <stdlib.h>
19647 #endif
19648 #include <sys/types.h>
19649 #define Size_t $sizetype
19650 #define SSize_t $dflt
19651 int main()
19652 {
19653         if (sizeof(Size_t) == sizeof(SSize_t))
19654                 printf("$dflt\n");
19655         else if (sizeof(Size_t) == sizeof(int))
19656                 printf("int\n");
19657         else 
19658                 printf("long\n");
19659         exit(0);
19660 }
19661 EOM
19662 echo " "
19663 set try
19664 if eval $compile_ok && $run ./try > /dev/null; then
19665         ssizetype=`$run ./try`
19666         echo "I'll be using $ssizetype for functions returning a byte count." >&4
19667 else
19668         $cat >&4 <<EOM
19669 Help! I can't compile and run the ssize_t test program: please enlighten me!
19670 (This is probably a misconfiguration in your system or libraries, and
19671 you really ought to fix it.  Still, I'll try anyway.)
19672
19673 I need a type that is the same size as $sizetype, but is guaranteed to
19674 be signed.  Common values are ssize_t, int and long.
19675
19676 EOM
19677         rp="What signed type is the same size as $sizetype?"
19678         . ./myread
19679         ssizetype="$ans"
19680 fi
19681 $rm -f try try.*
19682
19683 : see what type of char stdio uses.
19684 echo " "
19685 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
19686 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
19687         echo "Your stdio uses unsigned chars." >&4
19688         stdchar="unsigned char"
19689 else
19690         echo "Your stdio uses signed chars." >&4
19691         stdchar="char"
19692 fi
19693 $rm -f stdioh
19694
19695
19696
19697 : see what type uids are declared as in the kernel
19698 echo " "
19699 echo "Looking for the type for user ids returned by getuid()."
19700 set uid_t uidtype xxx stdio.h sys/types.h
19701 eval $typedef
19702 case "$uidtype" in
19703 xxx)
19704         xxx=`./findhdr sys/user.h`
19705         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
19706         case $1 in
19707         unsigned) dflt="$1 $2" ;;
19708         *) dflt="$1" ;;
19709         esac
19710         ;;
19711 *) dflt="$uidtype";;
19712 esac
19713 case "$uidtype" in
19714 uid_t)  echo "uid_t found." ;;
19715 *)      rp="What is the type for user ids returned by getuid()?"
19716         . ./myread
19717         uidtype="$ans"
19718         ;;
19719 esac
19720
19721 echo " "
19722 case "$uidtype" in
19723 *_t) zzz="$uidtype"     ;;
19724 *)   zzz="uid"          ;;
19725 esac
19726 echo "Checking the size of $zzz..." >&4 
19727 cat > try.c <<EOCP
19728 #include <sys/types.h>
19729 #include <stdio.h>
19730 #$i_stdlib I_STDLIB
19731 #ifdef I_STDLIB
19732 #include <stdlib.h>
19733 #endif
19734 int main() {
19735     printf("%d\n", (int)sizeof($uidtype));
19736     exit(0);
19737 }
19738 EOCP
19739 set try
19740 if eval $compile_ok; then
19741         yyy=`$run ./try`
19742         case "$yyy" in
19743         '')     uidsize=4
19744                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
19745                 ;;
19746         *)      uidsize=$yyy
19747                 echo "Your $zzz is $uidsize bytes long."
19748                 ;;
19749         esac
19750 else
19751         uidsize=4
19752         echo "(I can't compile the test program--guessing $uidsize.)" >&4
19753 fi
19754
19755 echo " "
19756 case "$uidtype" in
19757 *_t) zzz="$uidtype"     ;;
19758 *)   zzz="uid"          ;;
19759 esac
19760 echo "Checking the sign of $zzz..." >&4
19761 cat > try.c <<EOCP
19762 #include <sys/types.h>
19763 #include <stdio.h>
19764 int main() {
19765         $uidtype foo = -1;
19766         if (foo < 0)
19767                 printf("-1\n");
19768         else
19769                 printf("1\n");
19770 }
19771 EOCP
19772 set try
19773 if eval $compile; then
19774         yyy=`$run ./try`
19775         case "$yyy" in
19776         '')     uidsign=1
19777                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19778                 ;;
19779         *)      uidsign=$yyy
19780                 case "$uidsign" in
19781                  1) echo "Your $zzz is unsigned." ;;
19782                 -1) echo "Your $zzz is signed."   ;;
19783                 esac
19784                 ;;
19785         esac
19786 else
19787         uidsign=1
19788         echo "(I can't compile the test program--guessing unsigned.)" >&4
19789 fi
19790
19791
19792
19793 echo " "
19794 $echo "Checking the format string to be used for uids..." >&4
19795
19796 case "$uidsign" in
19797 -1)     if $test X"$uidsize" = X"$ivsize"; then
19798                 uidformat="$ivdformat"
19799         else
19800                 if $test X"$uidsize" = X"$longsize"; then
19801                         uidformat='"ld"'
19802                 else
19803                         if $test X"$uidsize" = X"$intsize"; then
19804                                 uidformat='"d"'
19805                         else
19806                                 if $test X"$uidsize" = X"$shortsize"; then
19807                                         uidformat='"hd"'
19808                                 fi
19809                         fi
19810                 fi
19811         fi
19812         ;;
19813 *)      if $test X"$uidsize" = X"$uvsize"; then
19814                 uidformat="$uvuformat"
19815         else
19816                 if $test X"$uidsize" = X"$longsize"; then
19817                         uidformat='"lu"'
19818                 else
19819                         if $test X"$uidsize" = X"$intsize"; then
19820                                 uidformat='"u"'
19821                         else
19822                                 if $test X"$uidsize" = X"$shortsize"; then
19823                                         uidformat='"hu"'
19824                                 fi
19825                         fi
19826                 fi
19827         fi
19828         ;;
19829 esac
19830
19831
19832 case "$usesitecustomize" in
19833     $define|true|[Yy]*)
19834         usesitecustomize="$define"
19835         ;;
19836     *)
19837         usesitecustomize="$undef"
19838         ;;
19839     esac
19840
19841 : determine compiler compiler
19842 case "$yacc" in
19843 '')
19844         dflt=yacc;;
19845 *)
19846         dflt="$yacc";;
19847 esac
19848 echo " "
19849 comp='yacc'
19850 if $test -f "$byacc$_exe"; then
19851         dflt="$byacc"
19852         comp="byacc or $comp"
19853 fi
19854 if $test -f "$bison$_exe"; then
19855         comp="$comp or bison -y"
19856 fi
19857 rp="Which compiler compiler ($comp) shall I use?"
19858 . ./myread
19859 yacc="$ans"
19860 case "$yacc" in
19861 *bis*)
19862         case "$yacc" in
19863         *-y*) ;;
19864         *)
19865                 yacc="$yacc -y"
19866                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
19867                 ;;
19868         esac
19869         ;;
19870 esac
19871
19872 : see if this is a fp.h system
19873 set fp.h i_fp
19874 eval $inhdr
19875
19876 : see if this is a fp_class.h system
19877 set fp_class.h i_fp_class
19878 eval $inhdr
19879
19880 : see if this is a ieeefp.h system
19881 case "$i_ieeefp" in
19882 '' ) set ieeefp.h i_ieeefp
19883      eval $inhdr
19884      ;;
19885 esac
19886
19887 : see if this is a libutil.h system
19888 set libutil.h i_libutil
19889 eval $inhdr
19890
19891 : see if mach cthreads are available
19892 if test "X$usethreads" = "X$define"; then
19893         set mach/cthreads.h i_machcthr
19894         eval $inhdr
19895 else
19896         i_machcthr="$undef"
19897 fi
19898
19899
19900
19901 : see if this is a mntent.h system
19902 set mntent.h i_mntent
19903 eval $inhdr
19904
19905 : see if ndbm.h is available
19906 set ndbm.h t_ndbm
19907 eval $inhdr
19908
19909 case "$t_ndbm" in
19910 $undef)
19911     # Some Linux distributions such as RedHat 7.1 put the
19912     # ndbm.h header in /usr/include/gdbm/ndbm.h.
19913     if $test -f /usr/include/gdbm/ndbm.h; then
19914         echo '<gdbm/ndbm.h> found.'
19915         ccflags="$ccflags -I/usr/include/gdbm"
19916         cppflags="$cppflags -I/usr/include/gdbm"
19917         t_ndbm=$define
19918     fi
19919     ;;
19920 esac
19921
19922 case "$t_ndbm" in
19923 $define)
19924         : see if dbm_open exists
19925         set dbm_open d_dbm_open
19926         eval $inlibc
19927         case "$d_dbm_open" in
19928         $undef)
19929                 t_ndbm="$undef"
19930                 echo "We won't be including <ndbm.h>"
19931                 ;;
19932         esac
19933         ;;
19934 esac
19935 val="$t_ndbm"
19936 set i_ndbm
19937 eval $setvar
19938
19939 : see if net/errno.h is available
19940 val=''
19941 set net/errno.h val
19942 eval $inhdr
19943
19944 : Unfortunately, it causes problems on some systems.  Arrgh.
19945 case "$val" in
19946 $define)
19947         cat > try.c <<'EOM'
19948 #include <stdio.h>
19949 #include <errno.h>
19950 #include <net/errno.h>
19951 int func()
19952 {
19953         return ENOTSOCK;
19954 }
19955 EOM
19956         if $cc $ccflags -c try.c >/dev/null 2>&1; then
19957                 echo "We'll be including <net/errno.h>." >&4
19958         else
19959                 echo "We won't be including <net/errno.h>." >&4
19960                 val="$undef"
19961         fi
19962         $rm -f try.* try
19963         ;;
19964 esac
19965 set i_neterrno
19966 eval $setvar
19967
19968 : see if netinet/tcp.h is available
19969 set netinet/tcp.h i_netinettcp
19970 eval $inhdr
19971
19972 : see if this is a poll.h system
19973 set poll.h i_poll
19974 eval $inhdr
19975
19976 : see if this is a prot.h system
19977 set prot.h i_prot
19978 eval $inhdr
19979
19980 echo " "
19981 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
19982 $cat <<'EOSH' > Cppsym.know
19983 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
19984 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
19985 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
19986 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
19987 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
19988 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
19989 bull c cadmus clipper CMU COFF COMPILER_VERSION
19990 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
19991 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
19992 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
19993 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
19994 GLIBC GLIBC_MINOR
19995 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
19996 H3050R H3050RX hbullx20 hcx host_mips
19997 hp200 hp300 hp700 HP700 hp800 hp9000
19998 hp9000s200 hp9000s300 hp9000s400 hp9000s500
19999 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20000 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20001 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20002 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20003 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20004 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20005 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20006 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20007 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20008 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20009 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20010 MATH_HAS_NO_SIDE_EFFECTS
20011 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20012 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20013 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20014 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20015 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20016 NetBSD news1500 news1700 news1800 news1900 news3700
20017 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20018 ns32016 ns32332 ns32k nsc32000
20019 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20020 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20021 pc532 pdp11 PGC PIC plexus PORTAR posix
20022 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20023 POSIX_C_SOURCE POSIX_SOURCE POWER
20024 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
20025 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20026 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20027 sony sony_news sonyrisc sparc sparclite spectrum
20028 stardent stdc STDC_EXT stratos sun sun3 sun386
20029 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20030 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20031 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20032 sysV68 sysV88 Tek4132 Tek4300 titan
20033 TM3200 TM5400 TM5600
20034 tower tower32 tower32_200 tower32_600 tower32_700
20035 tower32_800 tower32_850 tss
20036 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20037 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20038 unix UNIX95 UNIX99 unixpc unos
20039 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20040 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20041 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20042 USGr4 USGr4_2
20043 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
20044 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20045 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20046 z8000
20047 EOSH
20048 # Maybe put other stuff here too.
20049 cat <<EOSH >>Cppsym.know
20050 $osname
20051 EOSH
20052 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20053 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20054 $cat Cppsym.know > Cppsym.c
20055 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20056 $rm -f Cppsym.a Cppsym.b Cppsym.c
20057 cat <<EOSH > Cppsym
20058 $startsh
20059 if $test \$# -gt 0; then
20060     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20061     if $test -s Cppsym.got; then
20062         $rm -f Cppsym.got
20063         exit 0
20064     fi
20065     $rm -f Cppsym.got
20066     exit 1
20067 else
20068     $tr " " "$trnl" | ./Cppsym.try
20069     exit 0
20070 fi
20071 EOSH
20072 chmod +x Cppsym
20073 $eunicefix Cppsym
20074 cat <<EOSH > Cppsym.try
20075 $startsh
20076 cat <<'EOCP' > try.c
20077 #include <stdio.h>
20078 int main() {
20079 EOCP
20080 $awk \\
20081 EOSH
20082 cat <<'EOSH' >> Cppsym.try
20083 'length($1) > 0 {
20084     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
20085     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
20086     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
20087     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
20088 }'       >> try.c
20089 echo 'return 0;}' >> try.c
20090 EOSH
20091 cat <<EOSH >> Cppsym.try
20092 ccflags="$ccflags"
20093 case "$osname-$gccversion" in
20094 irix-) ccflags="\$ccflags -woff 1178" ;;
20095 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20096 esac
20097 $cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
20098 EOSH
20099 chmod +x Cppsym.try
20100 $eunicefix Cppsym.try
20101 ./Cppsym < Cppsym.know > Cppsym.true
20102 : now check the C compiler for additional symbols
20103 postprocess_cc_v=''
20104 case "$osname" in
20105 aix) postprocess_cc_v="|$tr , ' '" ;;
20106 esac
20107 $cat >ccsym <<EOS
20108 $startsh
20109 $cat >tmp.c <<EOF
20110 extern int foo;
20111 EOF
20112 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20113 do
20114         case "\$i" in
20115         -D*) echo "\$i" | $sed 's/^-D//';;
20116         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
20117         esac
20118 done
20119 $rm -f try.c
20120 EOS
20121 postprocess_cc_v=''
20122 chmod +x ccsym
20123 $eunicefix ccsym
20124 ./ccsym > ccsym1.raw
20125 if $test -s ccsym1.raw; then
20126        $sort ccsym1.raw | $uniq >ccsym.raw
20127 else
20128        mv ccsym1.raw ccsym.raw
20129 fi
20130
20131 $awk '/\=/ { print $0; next }
20132         { print $0"=1" }' ccsym.raw >ccsym.list
20133 $awk '/\=/ { print $0; next }
20134         { print $0"=1" }' Cppsym.true >ccsym.true
20135 $comm -13 ccsym.true ccsym.list >ccsym.own
20136 $comm -12 ccsym.true ccsym.list >ccsym.com
20137 $comm -23 ccsym.true ccsym.list >ccsym.cpp
20138 also=''
20139 if $test -z ccsym.raw; then
20140         echo "Your C compiler doesn't seem to define any symbols!" >&4
20141         echo " "
20142         echo "However, your C preprocessor defines the following symbols:"
20143         $cat Cppsym.true
20144         ccsymbols=''
20145         cppsymbols=`$cat Cppsym.true`
20146         cppsymbols=`echo $cppsymbols`
20147         cppccsymbols="$cppsymbols"
20148 else
20149         if $test -s ccsym.com; then
20150                 echo "Your C compiler and pre-processor define these symbols:"
20151                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20152                 also='also '
20153                 symbols='ones'
20154                 cppccsymbols=`$cat ccsym.com`
20155                 cppccsymbols=`echo $cppccsymbols`
20156                 $test "$silent" || sleep 1
20157         fi
20158         if $test -s ccsym.cpp; then
20159                 $test "$also" && echo " "
20160                 echo "Your C pre-processor ${also}defines the following symbols:"
20161                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20162                 also='further '
20163                 cppsymbols=`$cat ccsym.cpp`
20164                 cppsymbols=`echo $cppsymbols`
20165                 $test "$silent" || sleep 1
20166         fi
20167         if $test -s ccsym.own; then
20168                 $test "$also" && echo " "
20169                 echo "Your C compiler ${also}defines the following cpp symbols:"
20170                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20171                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20172                 ccsymbols=`$cat ccsym.own`
20173                 ccsymbols=`echo $ccsymbols`
20174                 $test "$silent" || sleep 1
20175         fi
20176 fi
20177
20178 : see if this is a termio system
20179 val="$undef"
20180 val2="$undef"
20181 val3="$undef"
20182 if $test `./findhdr termios.h`; then
20183         set tcsetattr i_termios
20184         eval $inlibc
20185         val3="$i_termios"
20186 fi
20187 echo " "
20188 case "$val3" in
20189 "$define") echo "You have POSIX termios.h... good!" >&4;;
20190 *) if ./Cppsym pyr; then
20191                 case "`/bin/universe`" in
20192                 ucb) if $test `./findhdr sgtty.h`; then
20193                                 val2="$define"
20194                                 echo "<sgtty.h> found." >&4
20195                         else
20196                                 echo "System is pyramid with BSD universe."
20197                                 echo "<sgtty.h> not found--you could have problems." >&4
20198                         fi;;
20199                 *) if $test `./findhdr termio.h`; then
20200                                 val="$define"
20201                                 echo "<termio.h> found." >&4
20202                         else
20203                                 echo "System is pyramid with USG universe."
20204                                 echo "<termio.h> not found--you could have problems." >&4
20205                         fi;;
20206                 esac
20207         elif ./usg; then
20208                 if $test `./findhdr termio.h`; then
20209                         echo "<termio.h> found." >&4
20210                         val="$define"
20211                 elif $test `./findhdr sgtty.h`; then
20212                         echo "<sgtty.h> found." >&4
20213                         val2="$define"
20214                 else
20215 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20216                 fi
20217         else
20218                 if $test `./findhdr sgtty.h`; then
20219                         echo "<sgtty.h> found." >&4
20220                         val2="$define"
20221                 elif $test `./findhdr termio.h`; then
20222                         echo "<termio.h> found." >&4
20223                         val="$define"
20224                 else
20225 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20226                 fi
20227         fi;;
20228 esac
20229 set i_termio; eval $setvar
20230 val=$val2; set i_sgtty; eval $setvar
20231 val=$val3; set i_termios; eval $setvar
20232
20233 : see if stddef is available
20234 set stddef.h i_stddef
20235 eval $inhdr
20236
20237 : see if this is a sunmath.h system
20238 set sunmath.h i_sunmath
20239 eval $inhdr
20240
20241 : see if sys/access.h is available
20242 set sys/access.h i_sysaccess
20243 eval $inhdr
20244
20245 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20246 set sys/filio.h i_sysfilio
20247 eval $inhdr
20248 echo " "
20249 if $test `./findhdr sys/ioctl.h`; then
20250         val="$define"
20251         echo '<sys/ioctl.h> found.' >&4
20252 else
20253         val="$undef"
20254         if $test $i_sysfilio = "$define"; then
20255             echo '<sys/ioctl.h> NOT found.' >&4
20256         else
20257                 $test $i_sgtty = "$define" && xxx="sgtty.h"
20258                 $test $i_termio = "$define" && xxx="termio.h"
20259                 $test $i_termios = "$define" && xxx="termios.h"
20260 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20261         fi
20262 fi
20263 set i_sysioctl
20264 eval $setvar
20265
20266 : see if socket ioctl defs are in sys/sockio.h
20267 echo " "
20268 xxx=`./findhdr sys/sockio.h`
20269 if $test "$xxx"; then
20270         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20271                 val="$define"
20272                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20273         else
20274                 val="$undef"
20275                 echo "No socket ioctls found in <sys/sockio.h>." >&4
20276         fi
20277 else
20278         val="$undef"
20279         $cat <<EOM
20280 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20281 EOM
20282 fi
20283 set i_syssockio
20284 eval $setvar
20285
20286
20287 : see if this is a syslog.h system
20288 set syslog.h i_syslog
20289 eval $inhdr
20290
20291
20292 : see if this is a sys/mode.h system
20293 set sys/mode.h i_sysmode
20294 eval $inhdr
20295
20296 : see if sys/resource.h has to be included
20297 set sys/resource.h i_sysresrc
20298 eval $inhdr
20299
20300 : see if sys/security.h is available
20301 set sys/security.h i_syssecrt
20302 eval $inhdr
20303
20304 : see if this is a sys/statvfs.h system
20305 set sys/statvfs.h i_sysstatvfs
20306 eval $inhdr
20307
20308 : see if this is a sys/un.h system
20309 set sys/un.h i_sysun
20310 eval $inhdr
20311
20312
20313 : see if this is a sys/utsname.h system
20314 set sys/utsname.h i_sysutsname
20315 eval $inhdr
20316
20317 : see if this is a syswait system
20318 set sys/wait.h i_syswait
20319 eval $inhdr
20320
20321 : see if this is a ustat.h system
20322 set ustat.h i_ustat
20323 eval $inhdr
20324
20325 : see if this is an utime system
20326 set utime.h i_utime
20327 eval $inhdr
20328
20329 : see if this is a values.h system
20330 set values.h i_values
20331 eval $inhdr
20332
20333 : see if this is a vfork system
20334 case "$d_vfork" in
20335 "$define")
20336         set vfork.h i_vfork
20337         eval $inhdr
20338         ;;
20339 *)
20340         i_vfork="$undef"
20341         ;;
20342 esac
20343
20344 : see if gdbm.h is available
20345 set gdbm.h t_gdbm
20346 eval $inhdr
20347 case "$t_gdbm" in
20348 $define)
20349         : see if gdbm_open exists
20350         set gdbm_open d_gdbm_open
20351         eval $inlibc
20352         case "$d_gdbm_open" in
20353         $undef)
20354                 t_gdbm="$undef"
20355                 echo "We won't be including <gdbm.h>"
20356                 ;;
20357         esac
20358         ;;
20359 esac
20360 val="$t_gdbm"
20361 set i_gdbm
20362 eval $setvar
20363
20364 echo " "
20365 echo "Looking for extensions..." >&4
20366 : If we are using the old config.sh, known_extensions may contain
20367 : old or inaccurate or duplicate values.
20368 known_extensions=''
20369 nonxs_extensions=''
20370 : We do not use find because it might not be available.
20371 : We do not just use MANIFEST because the user may have dropped
20372 : some additional extensions into the source tree and expect them
20373 : to be built.
20374
20375 : Function to recursively find available extensions, ignoring DynaLoader
20376 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
20377 find_extensions='
20378     for xxx in *; do
20379        case "$xxx" in
20380            DynaLoader|dynaload) ;;
20381            *)
20382            if $test -f $xxx/$xxx.xs; then
20383                known_extensions="$known_extensions $1$xxx";
20384            elif $test -f $xxx/Makefile.PL; then
20385                nonxs_extensions="$nonxs_extensions $1$xxx";
20386            else
20387                if $test -d $xxx -a $# -lt 10; then
20388                    set $1$xxx/ $*;
20389                    cd "$xxx";
20390                    eval $find_extensions;
20391                    cd ..;
20392                    shift;
20393                fi;
20394            fi
20395            ;;
20396        esac;
20397     done'
20398 tdir=`pwd`
20399 cd "$rsrc/ext"
20400 set X
20401 shift
20402 eval $find_extensions
20403 # Special case:  Add in threads/shared since it is not picked up by the
20404 # recursive find above (and adding in general recursive finding breaks
20405 # SDBM_File/sdbm).  A.D.  10/25/2001.
20406 known_extensions="$known_extensions threads/shared"
20407 set X $nonxs_extensions
20408 shift
20409 nonxs_extensions="$*"
20410 set X $known_extensions
20411 shift
20412 known_extensions="$*"
20413 cd "$tdir"
20414
20415 : Now see which are supported on this system.
20416 avail_ext=''
20417 for xxx in $known_extensions ; do
20418         case "$xxx" in
20419         DB_File|db_file)
20420                 case "$i_db" in
20421                 $define) avail_ext="$avail_ext $xxx" ;;
20422                 esac
20423                 ;;
20424         GDBM_File|gdbm_fil)
20425                 case "$i_gdbm" in 
20426                 $define) avail_ext="$avail_ext $xxx" ;;
20427                 esac
20428                 ;;
20429         I18N/Langinfo|i18n_lan)
20430                 case "$i_langinfo$d_nl_langinfo" in 
20431                 $define$define) avail_ext="$avail_ext $xxx" ;;
20432                 esac
20433                 ;;
20434         NDBM_File|ndbm_fil)
20435                 case "$i_ndbm" in
20436                 $define)
20437                     case "$osname-$use64bitint" in
20438                     hpux-define)
20439                         case "$libs" in
20440                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
20441                         esac
20442                         ;;
20443                     *) avail_ext="$avail_ext $xxx" ;;
20444                     esac
20445                     ;;
20446                 esac
20447                 ;;
20448         ODBM_File|odbm_fil) 
20449                 case "${i_dbm}${i_rpcsvcdbm}" in
20450                 *"${define}"*)
20451                     case "$osname-$use64bitint" in
20452                     hpux-define)
20453                         case "$libs" in
20454                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
20455                         esac
20456                         ;;
20457                     *) avail_ext="$avail_ext $xxx" ;;
20458                     esac
20459                     ;;
20460                 esac
20461                 ;;
20462         POSIX|posix)
20463                 case "$useposix" in
20464                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20465                 esac
20466                 ;;
20467         Opcode|opcode)
20468                 case "$useopcode" in
20469                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20470                 esac
20471                 ;;
20472         Socket|socket)
20473                 case "$d_socket" in 
20474                 true|$define|y)
20475                     case "$osname" in
20476                     beos) ;; # not unless BONE
20477                     *) avail_ext="$avail_ext $xxx" ;;
20478                     esac
20479                     ;;
20480                 esac
20481                 ;;
20482         Sys/Syslog|sys/syslog)
20483                 : XXX syslog requires socket
20484                 case "$d_socket" in 
20485                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
20486                 esac
20487                 ;;
20488         Thread|thread)
20489                 case "$usethreads" in
20490                 true|$define|y)
20491                         case "$useithreads" in
20492                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
20493                         esac
20494                 esac
20495                 ;;
20496         XS/APItest|xs/apitest)
20497                 # This is just for testing.  Skip it unless we have dynamic loading.
20498
20499                 case "$usedl" in
20500                 $define) avail_ext="$avail_ext $xxx" ;;
20501                 esac
20502                 ;;
20503         XS/Typemap|xs/typemap)
20504                 # This is just for testing.  Skip it unless we have dynamic loading.
20505                 case "$usedl" in
20506                 $define) avail_ext="$avail_ext $xxx" ;;
20507                 esac
20508                 ;;
20509         threads|threads/shared)
20510                 # threads and threads::shared are special cases.
20511                 # To stop people from asking "Perl 5.8.0 was supposed
20512                 # to have this new fancy threads implementation but my
20513                 # perl doesn't have it" and from people trying to
20514                 # (re)install the threads module using CPAN.pm and
20515                 # CPAN.pm then offering to reinstall Perl 5.8.0,
20516                 # the threads.pm and threads/shared.pm will always be
20517                 # there, croaking informatively ("you need to rebuild
20518                 # all of Perl with threads, sorry") when threads haven't
20519                 # been compiled in.
20520                 # --jhi
20521                 avail_ext="$avail_ext $xxx"
20522                 ;;
20523         IPC/SysV|ipc/sysv)
20524                 : XXX Do we need a useipcsysv variable here
20525                 case "${d_msg}${d_sem}${d_shm}" in 
20526                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
20527                 esac
20528                 ;;
20529         *)      avail_ext="$avail_ext $xxx"
20530                 ;;
20531         esac
20532 done
20533
20534 set X $avail_ext
20535 shift
20536 avail_ext="$*"
20537
20538 case "$onlyextensions" in
20539 '') ;;
20540 *)  keepextensions=''
20541     echo "You have requested that only certains extensions be included..." >&4
20542     for i in $onlyextensions; do
20543         case " $avail_ext " in
20544         *" $i "*)
20545             echo "Keeping extension $i."
20546             keepextensions="$keepextensions $i"
20547             ;;
20548         *) echo "Ignoring extension $i." ;;
20549         esac
20550     done
20551     avail_ext="$keepextensions"
20552     ;;
20553 esac
20554
20555 case "$noextensions" in
20556 '') ;;
20557 *)  keepextensions=''
20558     echo "You have requested that certain extensions be ignored..." >&4
20559     for i in $avail_ext; do
20560         case " $noextensions " in
20561         *" $i "*) echo "Ignoring extension $i." ;;
20562         *) echo "Keeping extension $i.";
20563            keepextensions="$keepextensions $i"
20564            ;;
20565         esac
20566     done
20567     avail_ext="$keepextensions"
20568     ;;
20569 esac
20570
20571 : Now see which nonxs extensions are supported on this system.
20572 : For now assume all are.
20573 nonxs_ext=''
20574 for xxx in $nonxs_extensions ; do
20575         case "$xxx" in
20576         *)      nonxs_ext="$nonxs_ext $xxx"
20577                 ;;
20578         esac
20579 done
20580
20581 set X $nonxs_ext
20582 shift
20583 nonxs_ext="$*"
20584
20585 case $usedl in
20586 $define)
20587         $cat <<EOM
20588 A number of extensions are supplied with $package.  You may choose to
20589 compile these extensions for dynamic loading (the default), compile
20590 them into the $package executable (static loading), or not include
20591 them at all.  Answer "none" to include no extensions.
20592 Note that DynaLoader is always built and need not be mentioned here.
20593
20594 EOM
20595         case "$dynamic_ext" in
20596         '')
20597                 : Exclude those listed in static_ext
20598                 dflt=''
20599                 for xxx in $avail_ext; do
20600                         case " $static_ext " in
20601                         *" $xxx "*) ;;
20602                         *) dflt="$dflt $xxx" ;;
20603                         esac
20604                 done
20605                 set X $dflt
20606                 shift
20607                 dflt="$*"
20608                 ;;
20609         *)      dflt="$dynamic_ext"
20610                 # Perhaps we are reusing an old out-of-date config.sh.
20611                 case "$hint" in
20612                 previous)
20613                         if test X"$dynamic_ext" != X"$avail_ext"; then
20614                                 $cat <<EOM
20615 NOTICE:  Your previous config.sh list may be incorrect. 
20616 The extensions now available to you are 
20617         ${avail_ext}
20618 but the default list from your previous config.sh is
20619         ${dynamic_ext} 
20620
20621 EOM
20622                         fi
20623                         ;;
20624                 esac
20625                 ;;
20626         esac
20627         case "$dflt" in
20628         '')     dflt=none;;
20629         esac
20630         rp="What extensions do you wish to load dynamically?"
20631         . ./myread
20632         case "$ans" in
20633         none) dynamic_ext=' ' ;;
20634         *) dynamic_ext="$ans" ;;
20635         esac
20636
20637         case "$static_ext" in
20638         '')
20639                 : Exclude those already listed in dynamic linking
20640                 dflt=''
20641                 for xxx in $avail_ext; do
20642                         case " $dynamic_ext " in
20643                         *" $xxx "*) ;;
20644                         *) dflt="$dflt $xxx" ;;
20645                         esac
20646                 done
20647                 set X $dflt
20648                 shift
20649                 dflt="$*"
20650                 ;;
20651         *)  dflt="$static_ext" 
20652                 ;;
20653         esac
20654
20655         case "$dflt" in
20656         '')     dflt=none;;
20657         esac
20658         rp="What extensions do you wish to load statically?"
20659         . ./myread
20660         case "$ans" in
20661         none) static_ext=' ' ;;
20662         *) static_ext="$ans" ;;
20663         esac
20664         ;;
20665 *)
20666         $cat <<EOM
20667 A number of extensions are supplied with $package.  Answer "none" 
20668 to include no extensions. 
20669 Note that DynaLoader is always built and need not be mentioned here.
20670
20671 EOM
20672         case "$static_ext" in
20673         '') dflt="$avail_ext" ;;
20674         *)      dflt="$static_ext"
20675                 # Perhaps we are reusing an old out-of-date config.sh.
20676                 case "$hint" in
20677                 previous)
20678                         if test X"$static_ext" != X"$avail_ext"; then
20679                                 $cat <<EOM
20680 NOTICE:  Your previous config.sh list may be incorrect. 
20681 The extensions now available to you are 
20682         ${avail_ext}
20683 but the default list from your previous config.sh is
20684         ${static_ext} 
20685
20686 EOM
20687                         fi
20688                         ;;
20689                 esac
20690                 ;;
20691         esac
20692         : Exclude those that are not xs extensions
20693         case "$dflt" in
20694         '')     dflt=none;;
20695         esac
20696         rp="What extensions do you wish to include?"
20697         . ./myread
20698         case "$ans" in
20699         none) static_ext=' ' ;;
20700         *) static_ext="$ans" ;;
20701         esac
20702         ;;
20703 esac
20704 #        
20705 # Encode is a special case.  If we are building Encode as a static
20706 # extension, we need to explicitly list its subextensions as well.
20707 # For other nested extensions, this is handled automatically by
20708 # the appropriate Makefile.PL.
20709 case " $static_ext " in
20710         *" Encode "*) # Add the subextensions of Encode
20711         cd "$rsrc/ext"
20712         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
20713                 static_ext="$static_ext Encode/$xxx"
20714         done
20715         cd "$tdir"
20716         ;;
20717 esac
20718
20719 set X $dynamic_ext $static_ext $nonxs_ext
20720 shift
20721 extensions="$*"
20722
20723 # Sanity check:  We require an extension suitable for use with
20724 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
20725 # should show up as failures in the test suite, but it's helpful to
20726 # catch them now.) The 'extensions' list is normally sorted
20727 # alphabetically, so we need to accept either
20728 #    DB_File ... Fcntl ... IO  ....
20729 # or something like
20730 #    Fcntl ... NDBM_File ... IO  ....
20731 case " $extensions"  in
20732 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
20733 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
20734 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
20735 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
20736    echo "WARNING: The Perl you are building will be quite crippled." >& 4
20737    ;;
20738 esac
20739
20740 : Remove libraries needed only for extensions
20741 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
20742 : The exception is SunOS 4.x, which needs them.
20743 case "${osname}X${osvers}" in
20744 sunos*X4*)
20745     perllibs="$libs"
20746     ;;
20747 *) case "$usedl" in
20748     $define|true|[yY]*)
20749             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
20750             shift
20751             perllibs="$*"
20752             ;;
20753     *)  perllibs="$libs"
20754             ;;
20755     esac
20756     ;;
20757 esac
20758
20759 : Remove build directory name from cppstdin so it can be used from
20760 : either the present location or the final installed location.
20761 echo " "
20762 : Get out of the UU directory to get correct path name.
20763 cd ..
20764 case "$cppstdin" in
20765 `pwd`/cppstdin)
20766         echo "Stripping down cppstdin path name"
20767         cppstdin=cppstdin
20768         ;;
20769 esac
20770 cd UU
20771
20772 : end of configuration questions
20773 echo " "
20774 echo "End of configuration questions."
20775 echo " "
20776
20777 : back to where it started
20778 if test -d ../UU; then
20779         cd ..
20780 fi
20781
20782 : configuration may be patched via a 'config.arch' file
20783 if $test -f config.arch; then
20784         echo "I see a config.arch file, loading it."
20785         . ./config.arch
20786 fi
20787
20788 : configuration may be patched via a 'config.over' file
20789 if $test -f config.over; then
20790         echo " "
20791         dflt=y
20792         rp='I see a config.over file.  Do you wish to load it?'
20793         . UU/myread
20794         case "$ans" in
20795         n*) echo "OK, I'll ignore it.";;
20796         *)      . ./config.over
20797                 echo "Configuration override changes have been loaded."
20798                 ;;
20799         esac
20800 fi
20801
20802 : in case they want portability, strip down executable paths
20803 case "$d_portable" in
20804 "$define")
20805         echo " "
20806         echo "Stripping down executable paths..." >&4
20807         for file in $loclist $trylist; do
20808                 eval temp=\$$file
20809                 eval $file=`basename $temp`
20810         done
20811         ;;
20812 esac
20813
20814 : create config.sh file
20815 echo " "
20816 echo "Creating config.sh..." >&4
20817 $spitshell <<EOT >config.sh
20818 $startsh
20819 #
20820 # This file was produced by running the Configure script. It holds all the
20821 # definitions figured out by Configure. Should you modify one of these values,
20822 # do not forget to propagate your changes by running "Configure -der". You may
20823 # instead choose to run each of the .SH files by yourself, or "Configure -S".
20824 #
20825
20826 # Package name      : $package
20827 # Source directory  : $src
20828 # Configuration time: $cf_time
20829 # Configured by     : $cf_by
20830 # Target system     : $myuname
20831
20832 Author='$Author'
20833 Date='$Date'
20834 Header='$Header'
20835 Id='$Id'
20836 Locker='$Locker'
20837 Log='$Log'
20838 Mcc='$Mcc'
20839 RCSfile='$RCSfile'
20840 Revision='$Revision'
20841 Source='$Source'
20842 State='$State'
20843 _a='$_a'
20844 _exe='$_exe'
20845 _o='$_o'
20846 afs='$afs'
20847 afsroot='$afsroot'
20848 alignbytes='$alignbytes'
20849 ansi2knr='$ansi2knr'
20850 aphostname='$aphostname'
20851 api_revision='$api_revision'
20852 api_subversion='$api_subversion'
20853 api_version='$api_version'
20854 api_versionstring='$api_versionstring'
20855 ar='$ar'
20856 archlib='$archlib'
20857 archlibexp='$archlibexp'
20858 archname64='$archname64'
20859 archname='$archname'
20860 archobjs='$archobjs'
20861 asctime_r_proto='$asctime_r_proto'
20862 awk='$awk'
20863 baserev='$baserev'
20864 bash='$bash'
20865 bin='$bin'
20866 binexp='$binexp'
20867 bison='$bison'
20868 byacc='$byacc'
20869 byteorder='$byteorder'
20870 c='$c'
20871 castflags='$castflags'
20872 cat='$cat'
20873 cc='$cc'
20874 cccdlflags='$cccdlflags'
20875 ccdlflags='$ccdlflags'
20876 ccflags='$ccflags'
20877 ccflags_uselargefiles='$ccflags_uselargefiles'
20878 ccname='$ccname'
20879 ccsymbols='$ccsymbols'
20880 ccversion='$ccversion'
20881 cf_by='$cf_by'
20882 cf_email='$cf_email'
20883 cf_time='$cf_time'
20884 charsize='$charsize'
20885 chgrp='$chgrp'
20886 chmod='$chmod'
20887 chown='$chown'
20888 clocktype='$clocktype'
20889 comm='$comm'
20890 compress='$compress'
20891 contains='$contains'
20892 cp='$cp'
20893 cpio='$cpio'
20894 cpp='$cpp'
20895 cpp_stuff='$cpp_stuff'
20896 cppccsymbols='$cppccsymbols'
20897 cppflags='$cppflags'
20898 cpplast='$cpplast'
20899 cppminus='$cppminus'
20900 cpprun='$cpprun'
20901 cppstdin='$cppstdin'
20902 cppsymbols='$cppsymbols'
20903 crypt_r_proto='$crypt_r_proto'
20904 cryptlib='$cryptlib'
20905 csh='$csh'
20906 ctermid_r_proto='$ctermid_r_proto'
20907 ctime_r_proto='$ctime_r_proto'
20908 d_Gconvert='$d_Gconvert'
20909 d_PRIEUldbl='$d_PRIEUldbl'
20910 d_PRIFUldbl='$d_PRIFUldbl'
20911 d_PRIGUldbl='$d_PRIGUldbl'
20912 d_PRIXU64='$d_PRIXU64'
20913 d_PRId64='$d_PRId64'
20914 d_PRIeldbl='$d_PRIeldbl'
20915 d_PRIfldbl='$d_PRIfldbl'
20916 d_PRIgldbl='$d_PRIgldbl'
20917 d_PRIi64='$d_PRIi64'
20918 d_PRIo64='$d_PRIo64'
20919 d_PRIu64='$d_PRIu64'
20920 d_PRIx64='$d_PRIx64'
20921 d_SCNfldbl='$d_SCNfldbl'
20922 d__fwalk='$d__fwalk'
20923 d_access='$d_access'
20924 d_accessx='$d_accessx'
20925 d_aintl='$d_aintl'
20926 d_alarm='$d_alarm'
20927 d_archlib='$d_archlib'
20928 d_asctime_r='$d_asctime_r'
20929 d_atolf='$d_atolf'
20930 d_atoll='$d_atoll'
20931 d_attribute_format='$d_attribute_format'
20932 d_attribute_malloc='$d_attribute_malloc'
20933 d_attribute_nonnull='$d_attribute_nonnull'
20934 d_attribute_noreturn='$d_attribute_noreturn'
20935 d_attribute_pure='$d_attribute_pure'
20936 d_attribute_unused='$d_attribute_unused'
20937 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
20938 d_bcmp='$d_bcmp'
20939 d_bcopy='$d_bcopy'
20940 d_bsd='$d_bsd'
20941 d_bsdgetpgrp='$d_bsdgetpgrp'
20942 d_bsdsetpgrp='$d_bsdsetpgrp'
20943 d_bzero='$d_bzero'
20944 d_casti32='$d_casti32'
20945 d_castneg='$d_castneg'
20946 d_charvspr='$d_charvspr'
20947 d_chown='$d_chown'
20948 d_chroot='$d_chroot'
20949 d_chsize='$d_chsize'
20950 d_class='$d_class'
20951 d_closedir='$d_closedir'
20952 d_cmsghdr_s='$d_cmsghdr_s'
20953 d_const='$d_const'
20954 d_copysignl='$d_copysignl'
20955 d_crypt='$d_crypt'
20956 d_crypt_r='$d_crypt_r'
20957 d_csh='$d_csh'
20958 d_ctermid_r='$d_ctermid_r'
20959 d_ctime_r='$d_ctime_r'
20960 d_cuserid='$d_cuserid'
20961 d_dbl_dig='$d_dbl_dig'
20962 d_dbminitproto='$d_dbminitproto'
20963 d_difftime='$d_difftime'
20964 d_dirfd='$d_dirfd'
20965 d_dirnamlen='$d_dirnamlen'
20966 d_dlerror='$d_dlerror'
20967 d_dlopen='$d_dlopen'
20968 d_dlsymun='$d_dlsymun'
20969 d_dosuid='$d_dosuid'
20970 d_drand48_r='$d_drand48_r'
20971 d_drand48proto='$d_drand48proto'
20972 d_dup2='$d_dup2'
20973 d_eaccess='$d_eaccess'
20974 d_endgrent='$d_endgrent'
20975 d_endgrent_r='$d_endgrent_r'
20976 d_endhent='$d_endhent'
20977 d_endhostent_r='$d_endhostent_r'
20978 d_endnent='$d_endnent'
20979 d_endnetent_r='$d_endnetent_r'
20980 d_endpent='$d_endpent'
20981 d_endprotoent_r='$d_endprotoent_r'
20982 d_endpwent='$d_endpwent'
20983 d_endpwent_r='$d_endpwent_r'
20984 d_endsent='$d_endsent'
20985 d_endservent_r='$d_endservent_r'
20986 d_eofnblk='$d_eofnblk'
20987 d_eunice='$d_eunice'
20988 d_faststdio='$d_faststdio'
20989 d_fchdir='$d_fchdir'
20990 d_fchmod='$d_fchmod'
20991 d_fchown='$d_fchown'
20992 d_fcntl='$d_fcntl'
20993 d_fcntl_can_lock='$d_fcntl_can_lock'
20994 d_fd_macros='$d_fd_macros'
20995 d_fd_set='$d_fd_set'
20996 d_fds_bits='$d_fds_bits'
20997 d_fgetpos='$d_fgetpos'
20998 d_finite='$d_finite'
20999 d_finitel='$d_finitel'
21000 d_flexfnam='$d_flexfnam'
21001 d_flock='$d_flock'
21002 d_flockproto='$d_flockproto'
21003 d_fork='$d_fork'
21004 d_fp_class='$d_fp_class'
21005 d_fpathconf='$d_fpathconf'
21006 d_fpclass='$d_fpclass'
21007 d_fpclassify='$d_fpclassify'
21008 d_fpclassl='$d_fpclassl'
21009 d_fpos64_t='$d_fpos64_t'
21010 d_frexpl='$d_frexpl'
21011 d_fs_data_s='$d_fs_data_s'
21012 d_fseeko='$d_fseeko'
21013 d_fsetpos='$d_fsetpos'
21014 d_fstatfs='$d_fstatfs'
21015 d_fstatvfs='$d_fstatvfs'
21016 d_fsync='$d_fsync'
21017 d_ftello='$d_ftello'
21018 d_ftime='$d_ftime'
21019 d_getcwd='$d_getcwd'
21020 d_getespwnam='$d_getespwnam'
21021 d_getfsstat='$d_getfsstat'
21022 d_getgrent='$d_getgrent'
21023 d_getgrent_r='$d_getgrent_r'
21024 d_getgrgid_r='$d_getgrgid_r'
21025 d_getgrnam_r='$d_getgrnam_r'
21026 d_getgrps='$d_getgrps'
21027 d_gethbyaddr='$d_gethbyaddr'
21028 d_gethbyname='$d_gethbyname'
21029 d_gethent='$d_gethent'
21030 d_gethname='$d_gethname'
21031 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21032 d_gethostbyname_r='$d_gethostbyname_r'
21033 d_gethostent_r='$d_gethostent_r'
21034 d_gethostprotos='$d_gethostprotos'
21035 d_getitimer='$d_getitimer'
21036 d_getlogin='$d_getlogin'
21037 d_getlogin_r='$d_getlogin_r'
21038 d_getmnt='$d_getmnt'
21039 d_getmntent='$d_getmntent'
21040 d_getnbyaddr='$d_getnbyaddr'
21041 d_getnbyname='$d_getnbyname'
21042 d_getnent='$d_getnent'
21043 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21044 d_getnetbyname_r='$d_getnetbyname_r'
21045 d_getnetent_r='$d_getnetent_r'
21046 d_getnetprotos='$d_getnetprotos'
21047 d_getpagsz='$d_getpagsz'
21048 d_getpbyname='$d_getpbyname'
21049 d_getpbynumber='$d_getpbynumber'
21050 d_getpent='$d_getpent'
21051 d_getpgid='$d_getpgid'
21052 d_getpgrp2='$d_getpgrp2'
21053 d_getpgrp='$d_getpgrp'
21054 d_getppid='$d_getppid'
21055 d_getprior='$d_getprior'
21056 d_getprotobyname_r='$d_getprotobyname_r'
21057 d_getprotobynumber_r='$d_getprotobynumber_r'
21058 d_getprotoent_r='$d_getprotoent_r'
21059 d_getprotoprotos='$d_getprotoprotos'
21060 d_getprpwnam='$d_getprpwnam'
21061 d_getpwent='$d_getpwent'
21062 d_getpwent_r='$d_getpwent_r'
21063 d_getpwnam_r='$d_getpwnam_r'
21064 d_getpwuid_r='$d_getpwuid_r'
21065 d_getsbyname='$d_getsbyname'
21066 d_getsbyport='$d_getsbyport'
21067 d_getsent='$d_getsent'
21068 d_getservbyname_r='$d_getservbyname_r'
21069 d_getservbyport_r='$d_getservbyport_r'
21070 d_getservent_r='$d_getservent_r'
21071 d_getservprotos='$d_getservprotos'
21072 d_getspnam='$d_getspnam'
21073 d_getspnam_r='$d_getspnam_r'
21074 d_gettimeod='$d_gettimeod'
21075 d_gmtime_r='$d_gmtime_r'
21076 d_gnulibc='$d_gnulibc'
21077 d_grpasswd='$d_grpasswd'
21078 d_hasmntopt='$d_hasmntopt'
21079 d_htonl='$d_htonl'
21080 d_ilogbl='$d_ilogbl'
21081 d_index='$d_index'
21082 d_inetaton='$d_inetaton'
21083 d_int64_t='$d_int64_t'
21084 d_isascii='$d_isascii'
21085 d_isfinite='$d_isfinite'
21086 d_isinf='$d_isinf'
21087 d_isnan='$d_isnan'
21088 d_isnanl='$d_isnanl'
21089 d_killpg='$d_killpg'
21090 d_lchown='$d_lchown'
21091 d_ldbl_dig='$d_ldbl_dig'
21092 d_libm_lib_version='$d_libm_lib_version'
21093 d_link='$d_link'
21094 d_localtime_r='$d_localtime_r'
21095 d_locconv='$d_locconv'
21096 d_lockf='$d_lockf'
21097 d_longdbl='$d_longdbl'
21098 d_longlong='$d_longlong'
21099 d_lseekproto='$d_lseekproto'
21100 d_lstat='$d_lstat'
21101 d_madvise='$d_madvise'
21102 d_mblen='$d_mblen'
21103 d_mbstowcs='$d_mbstowcs'
21104 d_mbtowc='$d_mbtowc'
21105 d_memchr='$d_memchr'
21106 d_memcmp='$d_memcmp'
21107 d_memcpy='$d_memcpy'
21108 d_memmove='$d_memmove'
21109 d_memset='$d_memset'
21110 d_mkdir='$d_mkdir'
21111 d_mkdtemp='$d_mkdtemp'
21112 d_mkfifo='$d_mkfifo'
21113 d_mkstemp='$d_mkstemp'
21114 d_mkstemps='$d_mkstemps'
21115 d_mktime='$d_mktime'
21116 d_mmap='$d_mmap'
21117 d_modfl='$d_modfl'
21118 d_modfl_pow32_bug='$d_modfl_pow32_bug'
21119 d_modflproto='$d_modflproto'
21120 d_mprotect='$d_mprotect'
21121 d_msg='$d_msg'
21122 d_msg_ctrunc='$d_msg_ctrunc'
21123 d_msg_dontroute='$d_msg_dontroute'
21124 d_msg_oob='$d_msg_oob'
21125 d_msg_peek='$d_msg_peek'
21126 d_msg_proxy='$d_msg_proxy'
21127 d_msgctl='$d_msgctl'
21128 d_msgget='$d_msgget'
21129 d_msghdr_s='$d_msghdr_s'
21130 d_msgrcv='$d_msgrcv'
21131 d_msgsnd='$d_msgsnd'
21132 d_msync='$d_msync'
21133 d_munmap='$d_munmap'
21134 d_mymalloc='$d_mymalloc'
21135 d_nice='$d_nice'
21136 d_nl_langinfo='$d_nl_langinfo'
21137 d_nv_preserves_uv='$d_nv_preserves_uv'
21138 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
21139 d_off64_t='$d_off64_t'
21140 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21141 d_oldpthreads='$d_oldpthreads'
21142 d_oldsock='$d_oldsock'
21143 d_open3='$d_open3'
21144 d_pathconf='$d_pathconf'
21145 d_pause='$d_pause'
21146 d_perl_otherlibdirs='$d_perl_otherlibdirs'
21147 d_phostname='$d_phostname'
21148 d_pipe='$d_pipe'
21149 d_poll='$d_poll'
21150 d_portable='$d_portable'
21151 d_procselfexe='$d_procselfexe'
21152 d_pthread_atfork='$d_pthread_atfork'
21153 d_pthread_attr_setscope='$d_pthread_attr_setscope'
21154 d_pthread_yield='$d_pthread_yield'
21155 d_pwage='$d_pwage'
21156 d_pwchange='$d_pwchange'
21157 d_pwclass='$d_pwclass'
21158 d_pwcomment='$d_pwcomment'
21159 d_pwexpire='$d_pwexpire'
21160 d_pwgecos='$d_pwgecos'
21161 d_pwpasswd='$d_pwpasswd'
21162 d_pwquota='$d_pwquota'
21163 d_qgcvt='$d_qgcvt'
21164 d_quad='$d_quad'
21165 d_random_r='$d_random_r'
21166 d_readdir64_r='$d_readdir64_r'
21167 d_readdir='$d_readdir'
21168 d_readdir_r='$d_readdir_r'
21169 d_readlink='$d_readlink'
21170 d_readv='$d_readv'
21171 d_recvmsg='$d_recvmsg'
21172 d_rename='$d_rename'
21173 d_rewinddir='$d_rewinddir'
21174 d_rmdir='$d_rmdir'
21175 d_safebcpy='$d_safebcpy'
21176 d_safemcpy='$d_safemcpy'
21177 d_sanemcmp='$d_sanemcmp'
21178 d_sbrkproto='$d_sbrkproto'
21179 d_scalbnl='$d_scalbnl'
21180 d_sched_yield='$d_sched_yield'
21181 d_scm_rights='$d_scm_rights'
21182 d_seekdir='$d_seekdir'
21183 d_select='$d_select'
21184 d_sem='$d_sem'
21185 d_semctl='$d_semctl'
21186 d_semctl_semid_ds='$d_semctl_semid_ds'
21187 d_semctl_semun='$d_semctl_semun'
21188 d_semget='$d_semget'
21189 d_semop='$d_semop'
21190 d_sendmsg='$d_sendmsg'
21191 d_setegid='$d_setegid'
21192 d_seteuid='$d_seteuid'
21193 d_setgrent='$d_setgrent'
21194 d_setgrent_r='$d_setgrent_r'
21195 d_setgrps='$d_setgrps'
21196 d_sethent='$d_sethent'
21197 d_sethostent_r='$d_sethostent_r'
21198 d_setitimer='$d_setitimer'
21199 d_setlinebuf='$d_setlinebuf'
21200 d_setlocale='$d_setlocale'
21201 d_setlocale_r='$d_setlocale_r'
21202 d_setnent='$d_setnent'
21203 d_setnetent_r='$d_setnetent_r'
21204 d_setpent='$d_setpent'
21205 d_setpgid='$d_setpgid'
21206 d_setpgrp2='$d_setpgrp2'
21207 d_setpgrp='$d_setpgrp'
21208 d_setprior='$d_setprior'
21209 d_setproctitle='$d_setproctitle'
21210 d_setprotoent_r='$d_setprotoent_r'
21211 d_setpwent='$d_setpwent'
21212 d_setpwent_r='$d_setpwent_r'
21213 d_setregid='$d_setregid'
21214 d_setresgid='$d_setresgid'
21215 d_setresuid='$d_setresuid'
21216 d_setreuid='$d_setreuid'
21217 d_setrgid='$d_setrgid'
21218 d_setruid='$d_setruid'
21219 d_setsent='$d_setsent'
21220 d_setservent_r='$d_setservent_r'
21221 d_setsid='$d_setsid'
21222 d_setvbuf='$d_setvbuf'
21223 d_sfio='$d_sfio'
21224 d_shm='$d_shm'
21225 d_shmat='$d_shmat'
21226 d_shmatprototype='$d_shmatprototype'
21227 d_shmctl='$d_shmctl'
21228 d_shmdt='$d_shmdt'
21229 d_shmget='$d_shmget'
21230 d_sigaction='$d_sigaction'
21231 d_sigprocmask='$d_sigprocmask'
21232 d_sigsetjmp='$d_sigsetjmp'
21233 d_sockatmark='$d_sockatmark'
21234 d_sockatmarkproto='$d_sockatmarkproto'
21235 d_socket='$d_socket'
21236 d_socklen_t='$d_socklen_t'
21237 d_sockpair='$d_sockpair'
21238 d_socks5_init='$d_socks5_init'
21239 d_sqrtl='$d_sqrtl'
21240 d_srand48_r='$d_srand48_r'
21241 d_srandom_r='$d_srandom_r'
21242 d_sresgproto='$d_sresgproto'
21243 d_sresuproto='$d_sresuproto'
21244 d_statblks='$d_statblks'
21245 d_statfs_f_flags='$d_statfs_f_flags'
21246 d_statfs_s='$d_statfs_s'
21247 d_statvfs='$d_statvfs'
21248 d_stdio_cnt_lval='$d_stdio_cnt_lval'
21249 d_stdio_ptr_lval='$d_stdio_ptr_lval'
21250 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21251 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
21252 d_stdio_stream_array='$d_stdio_stream_array'
21253 d_stdiobase='$d_stdiobase'
21254 d_stdstdio='$d_stdstdio'
21255 d_strchr='$d_strchr'
21256 d_strcoll='$d_strcoll'
21257 d_strctcpy='$d_strctcpy'
21258 d_strerrm='$d_strerrm'
21259 d_strerror='$d_strerror'
21260 d_strerror_r='$d_strerror_r'
21261 d_strftime='$d_strftime'
21262 d_strlcat='$d_strlcat'
21263 d_strlcpy='$d_strlcpy'
21264 d_strtod='$d_strtod'
21265 d_strtol='$d_strtol'
21266 d_strtold='$d_strtold'
21267 d_strtoll='$d_strtoll'
21268 d_strtoq='$d_strtoq'
21269 d_strtoul='$d_strtoul'
21270 d_strtoull='$d_strtoull'
21271 d_strtouq='$d_strtouq'
21272 d_strxfrm='$d_strxfrm'
21273 d_suidsafe='$d_suidsafe'
21274 d_symlink='$d_symlink'
21275 d_syscall='$d_syscall'
21276 d_syscallproto='$d_syscallproto'
21277 d_sysconf='$d_sysconf'
21278 d_sysernlst='$d_sysernlst'
21279 d_syserrlst='$d_syserrlst'
21280 d_system='$d_system'
21281 d_tcgetpgrp='$d_tcgetpgrp'
21282 d_tcsetpgrp='$d_tcsetpgrp'
21283 d_telldir='$d_telldir'
21284 d_telldirproto='$d_telldirproto'
21285 d_time='$d_time'
21286 d_times='$d_times'
21287 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21288 d_tm_tm_zone='$d_tm_tm_zone'
21289 d_tmpnam_r='$d_tmpnam_r'
21290 d_truncate='$d_truncate'
21291 d_ttyname_r='$d_ttyname_r'
21292 d_tzname='$d_tzname'
21293 d_u32align='$d_u32align'
21294 d_ualarm='$d_ualarm'
21295 d_umask='$d_umask'
21296 d_uname='$d_uname'
21297 d_union_semun='$d_union_semun'
21298 d_unordered='$d_unordered'
21299 d_usleep='$d_usleep'
21300 d_usleepproto='$d_usleepproto'
21301 d_ustat='$d_ustat'
21302 d_vendorarch='$d_vendorarch'
21303 d_vendorbin='$d_vendorbin'
21304 d_vendorlib='$d_vendorlib'
21305 d_vendorscript='$d_vendorscript'
21306 d_vfork='$d_vfork'
21307 d_void_closedir='$d_void_closedir'
21308 d_voidsig='$d_voidsig'
21309 d_voidtty='$d_voidtty'
21310 d_volatile='$d_volatile'
21311 d_vprintf='$d_vprintf'
21312 d_wait4='$d_wait4'
21313 d_waitpid='$d_waitpid'
21314 d_wcstombs='$d_wcstombs'
21315 d_wctomb='$d_wctomb'
21316 d_writev='$d_writev'
21317 d_xenix='$d_xenix'
21318 date='$date'
21319 db_hashtype='$db_hashtype'
21320 db_prefixtype='$db_prefixtype'
21321 db_version_major='$db_version_major'
21322 db_version_minor='$db_version_minor'
21323 db_version_patch='$db_version_patch'
21324 defvoidused='$defvoidused'
21325 direntrytype='$direntrytype'
21326 dlext='$dlext'
21327 dlsrc='$dlsrc'
21328 doublesize='$doublesize'
21329 drand01='$drand01'
21330 drand48_r_proto='$drand48_r_proto'
21331 dynamic_ext='$dynamic_ext'
21332 eagain='$eagain'
21333 ebcdic='$ebcdic'
21334 echo='$echo'
21335 egrep='$egrep'
21336 emacs='$emacs'
21337 endgrent_r_proto='$endgrent_r_proto'
21338 endhostent_r_proto='$endhostent_r_proto'
21339 endnetent_r_proto='$endnetent_r_proto'
21340 endprotoent_r_proto='$endprotoent_r_proto'
21341 endpwent_r_proto='$endpwent_r_proto'
21342 endservent_r_proto='$endservent_r_proto'
21343 eunicefix='$eunicefix'
21344 exe_ext='$exe_ext'
21345 expr='$expr'
21346 extensions='$extensions'
21347 extras='$extras'
21348 fflushNULL='$fflushNULL'
21349 fflushall='$fflushall'
21350 find='$find'
21351 firstmakefile='$firstmakefile'
21352 flex='$flex'
21353 fpossize='$fpossize'
21354 fpostype='$fpostype'
21355 freetype='$freetype'
21356 from='$from'
21357 full_ar='$full_ar'
21358 full_csh='$full_csh'
21359 full_sed='$full_sed'
21360 gccansipedantic='$gccansipedantic'
21361 gccosandvers='$gccosandvers'
21362 gccversion='$gccversion'
21363 getgrent_r_proto='$getgrent_r_proto'
21364 getgrgid_r_proto='$getgrgid_r_proto'
21365 getgrnam_r_proto='$getgrnam_r_proto'
21366 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
21367 gethostbyname_r_proto='$gethostbyname_r_proto'
21368 gethostent_r_proto='$gethostent_r_proto'
21369 getlogin_r_proto='$getlogin_r_proto'
21370 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
21371 getnetbyname_r_proto='$getnetbyname_r_proto'
21372 getnetent_r_proto='$getnetent_r_proto'
21373 getprotobyname_r_proto='$getprotobyname_r_proto'
21374 getprotobynumber_r_proto='$getprotobynumber_r_proto'
21375 getprotoent_r_proto='$getprotoent_r_proto'
21376 getpwent_r_proto='$getpwent_r_proto'
21377 getpwnam_r_proto='$getpwnam_r_proto'
21378 getpwuid_r_proto='$getpwuid_r_proto'
21379 getservbyname_r_proto='$getservbyname_r_proto'
21380 getservbyport_r_proto='$getservbyport_r_proto'
21381 getservent_r_proto='$getservent_r_proto'
21382 getspnam_r_proto='$getspnam_r_proto'
21383 gidformat='$gidformat'
21384 gidsign='$gidsign'
21385 gidsize='$gidsize'
21386 gidtype='$gidtype'
21387 glibpth='$glibpth'
21388 gmake='$gmake'
21389 gmtime_r_proto='$gmtime_r_proto'
21390 gnulibc_version='$gnulibc_version'
21391 grep='$grep'
21392 groupcat='$groupcat'
21393 groupstype='$groupstype'
21394 gzip='$gzip'
21395 h_fcntl='$h_fcntl'
21396 h_sysfile='$h_sysfile'
21397 hint='$hint'
21398 hostcat='$hostcat'
21399 html1dir='$html1dir'
21400 html1direxp='$html1direxp'
21401 html3dir='$html3dir'
21402 html3direxp='$html3direxp'
21403 i16size='$i16size'
21404 i16type='$i16type'
21405 i32size='$i32size'
21406 i32type='$i32type'
21407 i64size='$i64size'
21408 i64type='$i64type'
21409 i8size='$i8size'
21410 i8type='$i8type'
21411 i_arpainet='$i_arpainet'
21412 i_bsdioctl='$i_bsdioctl'
21413 i_crypt='$i_crypt'
21414 i_db='$i_db'
21415 i_dbm='$i_dbm'
21416 i_dirent='$i_dirent'
21417 i_dld='$i_dld'
21418 i_dlfcn='$i_dlfcn'
21419 i_fcntl='$i_fcntl'
21420 i_float='$i_float'
21421 i_fp='$i_fp'
21422 i_fp_class='$i_fp_class'
21423 i_gdbm='$i_gdbm'
21424 i_grp='$i_grp'
21425 i_ieeefp='$i_ieeefp'
21426 i_inttypes='$i_inttypes'
21427 i_langinfo='$i_langinfo'
21428 i_libutil='$i_libutil'
21429 i_limits='$i_limits'
21430 i_locale='$i_locale'
21431 i_machcthr='$i_machcthr'
21432 i_malloc='$i_malloc'
21433 i_math='$i_math'
21434 i_memory='$i_memory'
21435 i_mntent='$i_mntent'
21436 i_ndbm='$i_ndbm'
21437 i_netdb='$i_netdb'
21438 i_neterrno='$i_neterrno'
21439 i_netinettcp='$i_netinettcp'
21440 i_niin='$i_niin'
21441 i_poll='$i_poll'
21442 i_prot='$i_prot'
21443 i_pthread='$i_pthread'
21444 i_pwd='$i_pwd'
21445 i_rpcsvcdbm='$i_rpcsvcdbm'
21446 i_sfio='$i_sfio'
21447 i_sgtty='$i_sgtty'
21448 i_shadow='$i_shadow'
21449 i_socks='$i_socks'
21450 i_stdarg='$i_stdarg'
21451 i_stddef='$i_stddef'
21452 i_stdlib='$i_stdlib'
21453 i_string='$i_string'
21454 i_sunmath='$i_sunmath'
21455 i_sysaccess='$i_sysaccess'
21456 i_sysdir='$i_sysdir'
21457 i_sysfile='$i_sysfile'
21458 i_sysfilio='$i_sysfilio'
21459 i_sysin='$i_sysin'
21460 i_sysioctl='$i_sysioctl'
21461 i_syslog='$i_syslog'
21462 i_sysmman='$i_sysmman'
21463 i_sysmode='$i_sysmode'
21464 i_sysmount='$i_sysmount'
21465 i_sysndir='$i_sysndir'
21466 i_sysparam='$i_sysparam'
21467 i_sysresrc='$i_sysresrc'
21468 i_syssecrt='$i_syssecrt'
21469 i_sysselct='$i_sysselct'
21470 i_syssockio='$i_syssockio'
21471 i_sysstat='$i_sysstat'
21472 i_sysstatfs='$i_sysstatfs'
21473 i_sysstatvfs='$i_sysstatvfs'
21474 i_systime='$i_systime'
21475 i_systimek='$i_systimek'
21476 i_systimes='$i_systimes'
21477 i_systypes='$i_systypes'
21478 i_sysuio='$i_sysuio'
21479 i_sysun='$i_sysun'
21480 i_sysutsname='$i_sysutsname'
21481 i_sysvfs='$i_sysvfs'
21482 i_syswait='$i_syswait'
21483 i_termio='$i_termio'
21484 i_termios='$i_termios'
21485 i_time='$i_time'
21486 i_unistd='$i_unistd'
21487 i_ustat='$i_ustat'
21488 i_utime='$i_utime'
21489 i_values='$i_values'
21490 i_varargs='$i_varargs'
21491 i_varhdr='$i_varhdr'
21492 i_vfork='$i_vfork'
21493 ignore_versioned_solibs='$ignore_versioned_solibs'
21494 inc_version_list='$inc_version_list'
21495 inc_version_list_init='$inc_version_list_init'
21496 incpath='$incpath'
21497 inews='$inews'
21498 installarchlib='$installarchlib'
21499 installbin='$installbin'
21500 installhtml1dir='$installhtml1dir'
21501 installhtml3dir='$installhtml3dir'
21502 installman1dir='$installman1dir'
21503 installman3dir='$installman3dir'
21504 installprefix='$installprefix'
21505 installprefixexp='$installprefixexp'
21506 installprivlib='$installprivlib'
21507 installscript='$installscript'
21508 installsitearch='$installsitearch'
21509 installsitebin='$installsitebin'
21510 installsitehtml1dir='$installsitehtml1dir'
21511 installsitehtml3dir='$installsitehtml3dir'
21512 installsitelib='$installsitelib'
21513 installsiteman1dir='$installsiteman1dir'
21514 installsiteman3dir='$installsiteman3dir'
21515 installsitescript='$installsitescript'
21516 installstyle='$installstyle'
21517 installusrbinperl='$installusrbinperl'
21518 installvendorarch='$installvendorarch'
21519 installvendorbin='$installvendorbin'
21520 installvendorhtml1dir='$installvendorhtml1dir'
21521 installvendorhtml3dir='$installvendorhtml3dir'
21522 installvendorlib='$installvendorlib'
21523 installvendorman1dir='$installvendorman1dir'
21524 installvendorman3dir='$installvendorman3dir'
21525 installvendorscript='$installvendorscript'
21526 intsize='$intsize'
21527 issymlink='$issymlink'
21528 ivdformat='$ivdformat'
21529 ivsize='$ivsize'
21530 ivtype='$ivtype'
21531 known_extensions='$known_extensions'
21532 ksh='$ksh'
21533 ld='$ld'
21534 lddlflags='$lddlflags'
21535 ldflags='$ldflags'
21536 ldflags_uselargefiles='$ldflags_uselargefiles'
21537 ldlibpthname='$ldlibpthname'
21538 less='$less'
21539 lib_ext='$lib_ext'
21540 libc='$libc'
21541 libperl='$libperl'
21542 libpth='$libpth'
21543 libs='$libs'
21544 libsdirs='$libsdirs'
21545 libsfiles='$libsfiles'
21546 libsfound='$libsfound'
21547 libspath='$libspath'
21548 libswanted='$libswanted'
21549 libswanted_uselargefiles='$libswanted_uselargefiles'
21550 line='$line'
21551 lint='$lint'
21552 lkflags='$lkflags'
21553 ln='$ln'
21554 lns='$lns'
21555 localtime_r_proto='$localtime_r_proto'
21556 locincpth='$locincpth'
21557 loclibpth='$loclibpth'
21558 longdblsize='$longdblsize'
21559 longlongsize='$longlongsize'
21560 longsize='$longsize'
21561 lp='$lp'
21562 lpr='$lpr'
21563 ls='$ls'
21564 lseeksize='$lseeksize'
21565 lseektype='$lseektype'
21566 mail='$mail'
21567 mailx='$mailx'
21568 make='$make'
21569 make_set_make='$make_set_make'
21570 mallocobj='$mallocobj'
21571 mallocsrc='$mallocsrc'
21572 malloctype='$malloctype'
21573 man1dir='$man1dir'
21574 man1direxp='$man1direxp'
21575 man1ext='$man1ext'
21576 man3dir='$man3dir'
21577 man3direxp='$man3direxp'
21578 man3ext='$man3ext'
21579 mips_type='$mips_type'
21580 mistrustnm='$mistrustnm'
21581 mkdir='$mkdir'
21582 mmaptype='$mmaptype'
21583 modetype='$modetype'
21584 more='$more'
21585 multiarch='$multiarch'
21586 mv='$mv'
21587 myarchname='$myarchname'
21588 mydomain='$mydomain'
21589 myhostname='$myhostname'
21590 myuname='$myuname'
21591 n='$n'
21592 need_va_copy='$need_va_copy'
21593 netdb_hlen_type='$netdb_hlen_type'
21594 netdb_host_type='$netdb_host_type'
21595 netdb_name_type='$netdb_name_type'
21596 netdb_net_type='$netdb_net_type'
21597 nm='$nm'
21598 nm_opt='$nm_opt'
21599 nm_so_opt='$nm_so_opt'
21600 nonxs_ext='$nonxs_ext'
21601 nroff='$nroff'
21602 nvEUformat='$nvEUformat'
21603 nvFUformat='$nvFUformat'
21604 nvGUformat='$nvGUformat'
21605 nv_preserves_uv_bits='$nv_preserves_uv_bits'
21606 nveformat='$nveformat'
21607 nvfformat='$nvfformat'
21608 nvgformat='$nvgformat'
21609 nvsize='$nvsize'
21610 nvtype='$nvtype'
21611 o_nonblock='$o_nonblock'
21612 obj_ext='$obj_ext'
21613 old_pthread_create_joinable='$old_pthread_create_joinable'
21614 optimize='$optimize'
21615 orderlib='$orderlib'
21616 osname='$osname'
21617 osvers='$osvers'
21618 otherlibdirs='$otherlibdirs'
21619 package='$package'
21620 pager='$pager'
21621 passcat='$passcat'
21622 patchlevel='$patchlevel'
21623 path_sep='$path_sep'
21624 perl5='$perl5'
21625 perl='$perl'
21626 perl_patchlevel='$perl_patchlevel'
21627 perladmin='$perladmin'
21628 perllibs='$perllibs'
21629 perlpath='$perlpath'
21630 pg='$pg'
21631 phostname='$phostname'
21632 pidtype='$pidtype'
21633 plibpth='$plibpth'
21634 pmake='$pmake'
21635 pr='$pr'
21636 prefix='$prefix'
21637 prefixexp='$prefixexp'
21638 privlib='$privlib'
21639 privlibexp='$privlibexp'
21640 procselfexe='$procselfexe'
21641 prototype='$prototype'
21642 ptrsize='$ptrsize'
21643 quadkind='$quadkind'
21644 quadtype='$quadtype'
21645 randbits='$randbits'
21646 randfunc='$randfunc'
21647 random_r_proto='$random_r_proto'
21648 randseedtype='$randseedtype'
21649 ranlib='$ranlib'
21650 rd_nodata='$rd_nodata'
21651 readdir64_r_proto='$readdir64_r_proto'
21652 readdir_r_proto='$readdir_r_proto'
21653 revision='$revision'
21654 rm='$rm'
21655 rmail='$rmail'
21656 run='$run'
21657 runnm='$runnm'
21658 sPRIEUldbl='$sPRIEUldbl'
21659 sPRIFUldbl='$sPRIFUldbl'
21660 sPRIGUldbl='$sPRIGUldbl'
21661 sPRIXU64='$sPRIXU64'
21662 sPRId64='$sPRId64'
21663 sPRIeldbl='$sPRIeldbl'
21664 sPRIfldbl='$sPRIfldbl'
21665 sPRIgldbl='$sPRIgldbl'
21666 sPRIi64='$sPRIi64'
21667 sPRIo64='$sPRIo64'
21668 sPRIu64='$sPRIu64'
21669 sPRIx64='$sPRIx64'
21670 sSCNfldbl='$sSCNfldbl'
21671 sched_yield='$sched_yield'
21672 scriptdir='$scriptdir'
21673 scriptdirexp='$scriptdirexp'
21674 sed='$sed'
21675 seedfunc='$seedfunc'
21676 selectminbits='$selectminbits'
21677 selecttype='$selecttype'
21678 sendmail='$sendmail'
21679 setgrent_r_proto='$setgrent_r_proto'
21680 sethostent_r_proto='$sethostent_r_proto'
21681 setlocale_r_proto='$setlocale_r_proto'
21682 setnetent_r_proto='$setnetent_r_proto'
21683 setprotoent_r_proto='$setprotoent_r_proto'
21684 setpwent_r_proto='$setpwent_r_proto'
21685 setservent_r_proto='$setservent_r_proto'
21686 sh='$sh'
21687 shar='$shar'
21688 sharpbang='$sharpbang'
21689 shmattype='$shmattype'
21690 shortsize='$shortsize'
21691 shrpenv='$shrpenv'
21692 shsharp='$shsharp'
21693 sig_count='$sig_count'
21694 sig_name='$sig_name'
21695 sig_name_init='$sig_name_init'
21696 sig_num='$sig_num'
21697 sig_num_init='$sig_num_init'
21698 sig_size='$sig_size'
21699 signal_t='$signal_t'
21700 sitearch='$sitearch'
21701 sitearchexp='$sitearchexp'
21702 sitebin='$sitebin'
21703 sitebinexp='$sitebinexp'
21704 sitehtml1dir='$sitehtml1dir'
21705 sitehtml1direxp='$sitehtml1direxp'
21706 sitehtml3dir='$sitehtml3dir'
21707 sitehtml3direxp='$sitehtml3direxp'
21708 sitelib='$sitelib'
21709 sitelib_stem='$sitelib_stem'
21710 sitelibexp='$sitelibexp'
21711 siteman1dir='$siteman1dir'
21712 siteman1direxp='$siteman1direxp'
21713 siteman3dir='$siteman3dir'
21714 siteman3direxp='$siteman3direxp'
21715 siteprefix='$siteprefix'
21716 siteprefixexp='$siteprefixexp'
21717 sitescript='$sitescript'
21718 sitescriptexp='$sitescriptexp'
21719 sizesize='$sizesize'
21720 sizetype='$sizetype'
21721 sleep='$sleep'
21722 smail='$smail'
21723 so='$so'
21724 sockethdr='$sockethdr'
21725 socketlib='$socketlib'
21726 socksizetype='$socksizetype'
21727 sort='$sort'
21728 spackage='$spackage'
21729 spitshell='$spitshell'
21730 srand48_r_proto='$srand48_r_proto'
21731 srandom_r_proto='$srandom_r_proto'
21732 src='$src'
21733 ssizetype='$ssizetype'
21734 startperl='$startperl'
21735 startsh='$startsh'
21736 static_ext='$static_ext'
21737 stdchar='$stdchar'
21738 stdio_base='$stdio_base'
21739 stdio_bufsiz='$stdio_bufsiz'
21740 stdio_cnt='$stdio_cnt'
21741 stdio_filbuf='$stdio_filbuf'
21742 stdio_ptr='$stdio_ptr'
21743 stdio_stream_array='$stdio_stream_array'
21744 strerror_r_proto='$strerror_r_proto'
21745 strings='$strings'
21746 submit='$submit'
21747 subversion='$subversion'
21748 sysman='$sysman'
21749 tail='$tail'
21750 tar='$tar'
21751 targetarch='$targetarch'
21752 tbl='$tbl'
21753 tee='$tee'
21754 test='$test'
21755 timeincl='$timeincl'
21756 timetype='$timetype'
21757 tmpnam_r_proto='$tmpnam_r_proto'
21758 to='$to'
21759 touch='$touch'
21760 tr='$tr'
21761 trnl='$trnl'
21762 troff='$troff'
21763 ttyname_r_proto='$ttyname_r_proto'
21764 u16size='$u16size'
21765 u16type='$u16type'
21766 u32size='$u32size'
21767 u32type='$u32type'
21768 u64size='$u64size'
21769 u64type='$u64type'
21770 u8size='$u8size'
21771 u8type='$u8type'
21772 uidformat='$uidformat'
21773 uidsign='$uidsign'
21774 uidsize='$uidsize'
21775 uidtype='$uidtype'
21776 uname='$uname'
21777 uniq='$uniq'
21778 uquadtype='$uquadtype'
21779 use5005threads='$use5005threads'
21780 use64bitall='$use64bitall'
21781 use64bitint='$use64bitint'
21782 usecrosscompile='$usecrosscompile'
21783 usedl='$usedl'
21784 usefaststdio='$usefaststdio'
21785 useithreads='$useithreads'
21786 uselargefiles='$uselargefiles'
21787 uselongdouble='$uselongdouble'
21788 usemallocwrap='$usemallocwrap'
21789 usemorebits='$usemorebits'
21790 usemultiplicity='$usemultiplicity'
21791 usemymalloc='$usemymalloc'
21792 usenm='$usenm'
21793 useopcode='$useopcode'
21794 useperlio='$useperlio'
21795 useposix='$useposix'
21796 usereentrant='$usereentrant'
21797 userelocatableinc='$userelocatableinc'
21798 usesfio='$usesfio'
21799 useshrplib='$useshrplib'
21800 usesitecustomize='$usesitecustomize'
21801 usesocks='$usesocks'
21802 usethreads='$usethreads'
21803 usevendorprefix='$usevendorprefix'
21804 usevfork='$usevfork'
21805 usrinc='$usrinc'
21806 uuname='$uuname'
21807 uvXUformat='$uvXUformat'
21808 uvoformat='$uvoformat'
21809 uvsize='$uvsize'
21810 uvtype='$uvtype'
21811 uvuformat='$uvuformat'
21812 uvxformat='$uvxformat'
21813 vendorarch='$vendorarch'
21814 vendorarchexp='$vendorarchexp'
21815 vendorbin='$vendorbin'
21816 vendorbinexp='$vendorbinexp'
21817 vendorhtml1dir='$vendorhtml1dir'
21818 vendorhtml1direxp='$vendorhtml1direxp'
21819 vendorhtml3dir='$vendorhtml3dir'
21820 vendorhtml3direxp='$vendorhtml3direxp'
21821 vendorlib='$vendorlib'
21822 vendorlib_stem='$vendorlib_stem'
21823 vendorlibexp='$vendorlibexp'
21824 vendorman1dir='$vendorman1dir'
21825 vendorman1direxp='$vendorman1direxp'
21826 vendorman3dir='$vendorman3dir'
21827 vendorman3direxp='$vendorman3direxp'
21828 vendorprefix='$vendorprefix'
21829 vendorprefixexp='$vendorprefixexp'
21830 vendorscript='$vendorscript'
21831 vendorscriptexp='$vendorscriptexp'
21832 version='$version'
21833 version_patchlevel_string='$version_patchlevel_string'
21834 versiononly='$versiononly'
21835 vi='$vi'
21836 voidflags='$voidflags'
21837 xlibpth='$xlibpth'
21838 yacc='$yacc'
21839 yaccflags='$yaccflags'
21840 zcat='$zcat'
21841 zip='$zip'
21842 EOT
21843
21844 : Add in command line options if available
21845 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
21846
21847 : add special variables
21848 $test -f $src/patchlevel.h && \
21849 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
21850 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
21851 echo "PERL_CONFIG_SH=true" >>config.sh
21852
21853 : propagate old symbols
21854 if $test -f UU/config.sh; then
21855         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
21856         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
21857         $sort | $uniq -u >UU/oldsyms
21858         set X `cat UU/oldsyms`
21859         shift
21860         case $# in
21861         0) ;;
21862         *)
21863                 cat <<EOM
21864 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
21865 EOM
21866                 echo "# Variables propagated from previous config.sh file." >>config.sh
21867                 for sym in `cat UU/oldsyms`; do
21868                         echo "    Propagating $hint variable "'$'"$sym..."
21869                         eval 'tmp="$'"${sym}"'"'
21870                         echo "$tmp" | \
21871                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
21872                 done
21873                 ;;
21874         esac
21875 fi
21876
21877 : Finish up by extracting the .SH files
21878 case "$alldone" in
21879 exit)
21880         $rm -rf UU
21881         echo "Extraction done."
21882         exit 0
21883         ;;
21884 cont)
21885         ;;
21886 '')
21887         dflt=''
21888         nostick=true
21889         $cat <<EOM
21890
21891 If you'd like to make any changes to the config.sh file before I begin
21892 to configure things, do it as a shell escape now (e.g. !vi config.sh).
21893
21894 EOM
21895         rp="Press return or use a shell escape to edit config.sh:"
21896         . UU/myread
21897         nostick=''
21898         case "$ans" in
21899         '') ;;
21900         *) : in case they cannot read
21901                 sh 1>&4 -c "$ans";;
21902         esac
21903         ;;
21904 esac
21905
21906 : if this fails, just run all the .SH files by hand
21907 . ./config.sh
21908
21909 echo " "
21910 exec 1>&4
21911 pwd=`pwd`
21912 . ./UU/extract
21913 cd "$pwd"
21914
21915 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
21916         dflt=y
21917         case "$silent" in
21918         true) ;;
21919         *)
21920                 $cat <<EOM
21921
21922 Now you need to generate make dependencies by running "$make depend".
21923 You might prefer to run it in background: "$make depend > makedepend.out &"
21924 It can take a while, so you might not want to run it right now.
21925
21926 EOM
21927                 ;;
21928         esac
21929         rp="Run $make depend now?"
21930         . UU/myread
21931         case "$ans" in
21932         y*)
21933                 $make depend && echo "Now you must run '$make'."
21934                 ;;
21935         *)
21936                 echo "You must run '$make depend' then '$make'."
21937                 ;;
21938         esac
21939 elif test -f [Mm]akefile; then
21940         echo " "
21941         echo "Now you must run a $make."
21942 else
21943         echo "Configure done."
21944 fi
21945
21946 if $test -f Policy.sh; then
21947     $cat <<EOM
21948
21949 If you compile $package on a different machine or from a different object
21950 directory, copy the Policy.sh file from this object directory to the
21951 new one before you run Configure -- this will help you with most of
21952 the policy defaults.
21953
21954 EOM
21955 fi
21956 if $test -f config.msg; then
21957     echo "Hmm.  I also noted the following information while running:"
21958     echo " "
21959     $cat config.msg >&4
21960     $rm -f config.msg
21961 fi
21962 $rm -f kit*isdone ark*isdone
21963 $rm -rf UU
21964
21965 : End of Configure
21966