Re: [PATCH] Stop DTrace config option looping in non-interactive mode
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist package (which contains metaconfig) is available via SVN:
17 #     svn co https://svn.sourceforge.net/svnroot/dist/trunk/dist
18 #
19 #
20 # Though this script was generated by metaconfig, it is OK to send
21 # patches against it. It's up to the Configure pumpkin to backport
22 # the patch to the metaunits if it is accepted.
23 # See Porting/pumpkin.pod for more information on metaconfig.
24 #
25
26 # $Id: Head.U 6 2006-08-25 22:21:46Z rmanfredi $
27 #
28 # Generated on Wed Jan  9 22:02:14 CET 2008 [metaconfig 3.0 PL70]
29 # (with additional metaconfig patches by perlbug@perl.org)
30
31 cat >c1$$ <<EOF
32 ARGGGHHHH!!!!!
33
34 SCO csh still thinks true is false.  Write to SCO today and tell them that next
35 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
36
37 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
38 we'd have to do is go in and swap the && and || tokens, wherever they are.)
39
40 [End of diatribe. We now return you to your regularly scheduled programming...]
41 EOF
42 cat >c2$$ <<EOF
43
44 OOPS!  You naughty creature!  You didn't run Configure with sh!
45 I will attempt to remedy the situation by running sh for you...
46 EOF
47
48 true || cat c1$$ c2$$
49 true || exec sh $0 $argv:q
50
51 (exit $?0) || cat c2$$
52 (exit $?0) || exec sh $0 $argv:q
53 rm -f c1$$ c2$$
54
55 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
56         cat >&4 <<EOF
57 ***
58 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
59 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
60 *** Please read the README.plan9 for further instructions.
61 *** Cannot continue, aborting.
62 ***
63 EOF
64         exit 1
65 fi
66
67 if test ! -c /dev/null ; then
68         cat >&4 <<EOF
69 ***
70 *** I'm sorry, but /dev/null appears to be a file rather than a device.
71 *** Please consult your operating sytem's notes for making a device
72 *** in /dev.
73 *** Cannot continue, aborting.
74 ***
75 EOF
76         exit 1
77 fi
78
79 : compute my invocation name
80 me=$0
81 case "$0" in
82 */*)
83         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
84         test "$me" || me=$0
85         ;;
86 esac
87
88 : Proper separator for the PATH environment variable
89 p_=:
90 : On OS/2 this directory should exist if this is not floppy only system ":-]"
91 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
92         if test -n "$OS2_SHELL"; then
93                 p_=\;
94                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
95                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
96                 is_os2=yes
97         elif test -n "$DJGPP"; then
98                 case "X${MACHTYPE:-nonesuchmach}" in
99                 *cygwin) ;;
100                 *) p_=\; ;;
101                 esac
102         fi
103 fi
104
105 : Proper PATH setting
106 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
107 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
108 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
109 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
110 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
111 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
112 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
113 paths="$paths /sbin /usr/sbin /usr/libexec"
114 paths="$paths /system/gnu_library/bin"
115
116 for p in $paths
117 do
118         case "$p_$PATH$p_" in
119         *$p_$p$p_*) ;;
120         *) test -d $p && PATH=$PATH$p_$p ;;
121         esac
122 done
123
124 PATH=.$p_$PATH
125 export PATH
126
127 : shall we be using ksh?
128 inksh=''
129 needksh=''
130 avoidksh=''
131 newsh=/bin/ksh
132 changesh=''
133 if (PATH=.; alias -x) >/dev/null 2>&1; then
134                 inksh=true
135 fi
136 if test -f /hp-ux -a -f /bin/ksh; then
137         needksh='to avoid sh bug in "here document" expansion'
138 fi
139 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
140         if test X`/usr/bin/uname -v` = X4; then
141                 avoidksh="to avoid AIX 4's /bin/sh"
142                 newsh=/usr/bin/bsh
143         fi
144 fi
145 if test -f /osf_boot -a -f /usr/sbin/setld; then
146         if test X`/usr/bin/uname -s` = XOSF1; then
147                 avoidksh="to avoid Digital UNIX' ksh"
148                 newsh=/bin/sh
149                 unset BIN_SH
150         fi
151 fi
152 case "$inksh/$needksh" in
153 /[a-z]*)
154                 ENV=''
155                 changesh=true
156                 reason="$needksh"
157         ;;
158 esac
159 case "$inksh/$avoidksh" in
160 true/[a-z]*)
161         changesh=true
162         reason="$avoidksh"
163         ;;
164 esac
165 case "$inksh/$needksh-$avoidksh-" in
166 true/--)
167                 cat <<EOM
168 (I see you are using the Korn shell.  Some ksh's blow up on $me,
169 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
170 EOM
171         ;;
172 esac
173 case "$changesh" in
174 true)
175         export newsh
176         echo "(Feeding myself to $newsh $reason.)"
177         case "$0" in
178         Configure|*/Configure) exec $newsh $0 "$@";;
179         *) exec $newsh Configure "$@";;
180         esac
181         ;;
182 esac
183 test -x "${newsh}" || unset newsh
184
185 : if needed, set CDPATH to a harmless value that is not chatty
186 : avoid bash 2.02 problems with empty CDPATH.
187 case "$CDPATH" in
188 '')     ;;
189 *)      case "$SHELL" in
190         *bash*) CDPATH='.' ;;
191         *) CDPATH='' ;;
192         esac
193         ;;
194 esac
195
196 : Configure runs within the UU subdirectory
197 test -d UU || mkdir UU
198 cd UU && rm -f ./*
199
200 ccname=''
201 ccversion=''
202 ccsymbols=''
203 cppccsymbols=''
204 cppsymbols=''
205 from=''
206 run=''
207 targetarch=''
208 to=''
209 usecrosscompile=''
210 mistrustnm=''
211 perllibs=''
212 dynamic_ext=''
213 extensions=''
214 known_extensions=''
215 nonxs_ext=''
216 static_ext=''
217 useopcode=''
218 useposix=''
219 extras=''
220 d_bsd=''
221 d_eunice=''
222 d_xenix=''
223 eunicefix=''
224 Mcc=''
225 ar=''
226 awk=''
227 bash=''
228 bison=''
229 byacc=''
230 cat=''
231 chgrp=''
232 chmod=''
233 chown=''
234 comm=''
235 compress=''
236 cp=''
237 cpio=''
238 cpp=''
239 csh=''
240 date=''
241 dtrace=''
242 echo=''
243 egrep=''
244 emacs=''
245 expr=''
246 find=''
247 flex=''
248 gmake=''
249 grep=''
250 gzip=''
251 inews=''
252 ksh=''
253 less=''
254 line=''
255 lint=''
256 ln=''
257 lp=''
258 lpr=''
259 ls=''
260 mail=''
261 mailx=''
262 make=''
263 mkdir=''
264 more=''
265 mv=''
266 nm=''
267 nroff=''
268 perl=''
269 pg=''
270 pmake=''
271 pr=''
272 rm=''
273 rmail=''
274 sed=''
275 sendmail=''
276 shar=''
277 sleep=''
278 smail=''
279 sort=''
280 submit=''
281 tail=''
282 tar=''
283 tbl=''
284 tee=''
285 test=''
286 touch=''
287 tr=''
288 troff=''
289 uname=''
290 uniq=''
291 uuname=''
292 vi=''
293 zcat=''
294 zip=''
295 full_ar=''
296 full_sed=''
297 libswanted=''
298 hint=''
299 myuname=''
300 osname=''
301 osvers=''
302 Author=''
303 Date=''
304 Header=''
305 Id=''
306 Locker=''
307 Log=''
308 RCSfile=''
309 Revision=''
310 Source=''
311 State=''
312 _a=''
313 _exe=''
314 _o=''
315 archobjs=''
316 exe_ext=''
317 firstmakefile=''
318 lib_ext=''
319 obj_ext=''
320 path_sep=''
321 rm_try=''
322 afs=''
323 afsroot=''
324 alignbytes=''
325 ansi2knr=''
326 archlib=''
327 archlibexp=''
328 d_archlib=''
329 installarchlib=''
330 archname=''
331 myarchname=''
332 d_atolf=''
333 d_atoll=''
334 baserev=''
335 bin=''
336 binexp=''
337 initialinstalllocation=''
338 installbin=''
339 userelocatableinc=''
340 byteorder=''
341 cc=''
342 ccflags=''
343 cppflags=''
344 ldflags=''
345 lkflags=''
346 locincpth=''
347 optimize=''
348 cf_email=''
349 cf_by=''
350 cf_time=''
351 contains=''
352 cpp_stuff=''
353 cpplast=''
354 cppminus=''
355 cpprun=''
356 cppstdin=''
357 d__fwalk=''
358 d_access=''
359 d_accessx=''
360 d_aintl=''
361 d_alarm=''
362 asctime_r_proto=''
363 d_asctime_r=''
364 d_attribute_format=''
365 d_attribute_malloc=''
366 d_attribute_nonnull=''
367 d_attribute_noreturn=''
368 d_attribute_pure=''
369 d_attribute_unused=''
370 d_attribute_warn_unused_result=''
371 d_printf_format_null=''
372 d_bcmp=''
373 d_bcopy=''
374 d_builtin_choose_expr=''
375 d_builtin_expect=''
376 d_bzero=''
377 d_c99_variadic_macros=''
378 d_casti32=''
379 castflags=''
380 d_castneg=''
381 d_chown=''
382 d_chroot=''
383 d_chsize=''
384 d_class=''
385 d_clearenv=''
386 d_closedir=''
387 d_void_closedir=''
388 d_cmsghdr_s=''
389 d_const=''
390 d_copysignl=''
391 d_cplusplus=''
392 cryptlib=''
393 d_crypt=''
394 crypt_r_proto=''
395 d_crypt_r=''
396 d_csh=''
397 full_csh=''
398 d_ctermid=''
399 ctermid_r_proto=''
400 d_ctermid_r=''
401 ctime_r_proto=''
402 d_ctime_r=''
403 d_cuserid=''
404 d_dbl_dig=''
405 d_dbminitproto=''
406 d_difftime=''
407 d_dir_dd_fd=''
408 d_dirfd=''
409 d_dlerror=''
410 d_dlopen=''
411 d_dlsymun=''
412 d_dosuid=''
413 d_suidsafe=''
414 d_drand48_r=''
415 drand48_r_proto=''
416 d_drand48proto=''
417 d_dup2=''
418 d_eaccess=''
419 d_endgrent=''
420 d_endgrent_r=''
421 endgrent_r_proto=''
422 d_endhent=''
423 d_endhostent_r=''
424 endhostent_r_proto=''
425 d_endnent=''
426 d_endnetent_r=''
427 endnetent_r_proto=''
428 d_endpent=''
429 d_endprotoent_r=''
430 endprotoent_r_proto=''
431 d_endpwent=''
432 d_endpwent_r=''
433 endpwent_r_proto=''
434 d_endsent=''
435 d_endservent_r=''
436 endservent_r_proto=''
437 d_faststdio=''
438 d_fchdir=''
439 d_fchmod=''
440 d_fchown=''
441 d_fcntl=''
442 d_fcntl_can_lock=''
443 d_fd_macros=''
444 d_fd_set=''
445 d_fds_bits=''
446 d_fgetpos=''
447 d_finite=''
448 d_finitel=''
449 d_flexfnam=''
450 d_flock=''
451 d_flockproto=''
452 d_fork=''
453 d_fp_class=''
454 d_fpclass=''
455 d_fpclassify=''
456 d_fpclassl=''
457 d_fpos64_t=''
458 d_frexpl=''
459 d_fs_data_s=''
460 d_fseeko=''
461 d_fsetpos=''
462 d_fstatfs=''
463 d_fsync=''
464 d_ftello=''
465 d_ftime=''
466 d_gettimeod=''
467 d_futimes=''
468 d_Gconvert=''
469 d_getcwd=''
470 d_getespwnam=''
471 d_getfsstat=''
472 d_getgrent=''
473 d_getgrent_r=''
474 getgrent_r_proto=''
475 d_getgrgid_r=''
476 getgrgid_r_proto=''
477 d_getgrnam_r=''
478 getgrnam_r_proto=''
479 d_getgrps=''
480 d_gethbyaddr=''
481 d_gethbyname=''
482 d_gethent=''
483 aphostname=''
484 d_gethname=''
485 d_phostname=''
486 d_uname=''
487 d_gethostbyaddr_r=''
488 gethostbyaddr_r_proto=''
489 d_gethostbyname_r=''
490 gethostbyname_r_proto=''
491 d_gethostent_r=''
492 gethostent_r_proto=''
493 d_gethostprotos=''
494 d_getitimer=''
495 d_getlogin=''
496 d_getlogin_r=''
497 getlogin_r_proto=''
498 d_getmnt=''
499 d_getmntent=''
500 d_getnbyaddr=''
501 d_getnbyname=''
502 d_getnent=''
503 d_getnetbyaddr_r=''
504 getnetbyaddr_r_proto=''
505 d_getnetbyname_r=''
506 getnetbyname_r_proto=''
507 d_getnetent_r=''
508 getnetent_r_proto=''
509 d_getnetprotos=''
510 d_getpagsz=''
511 d_getpent=''
512 d_getpgid=''
513 d_getpgrp2=''
514 d_bsdgetpgrp=''
515 d_getpgrp=''
516 d_getppid=''
517 d_getprior=''
518 d_getpbyname=''
519 d_getpbynumber=''
520 d_getprotobyname_r=''
521 getprotobyname_r_proto=''
522 d_getprotobynumber_r=''
523 getprotobynumber_r_proto=''
524 d_getprotoent_r=''
525 getprotoent_r_proto=''
526 d_getprotoprotos=''
527 d_getprpwnam=''
528 d_getpwent=''
529 d_getpwent_r=''
530 getpwent_r_proto=''
531 d_getpwnam_r=''
532 getpwnam_r_proto=''
533 d_getpwuid_r=''
534 getpwuid_r_proto=''
535 d_getsent=''
536 d_getservbyname_r=''
537 getservbyname_r_proto=''
538 d_getservbyport_r=''
539 getservbyport_r_proto=''
540 d_getservent_r=''
541 getservent_r_proto=''
542 d_getservprotos=''
543 d_getspnam=''
544 d_getspnam_r=''
545 getspnam_r_proto=''
546 d_getsbyname=''
547 d_getsbyport=''
548 d_gmtime_r=''
549 gmtime_r_proto=''
550 d_gnulibc=''
551 gnulibc_version=''
552 d_hasmntopt=''
553 d_htonl=''
554 d_ilogbl=''
555 d_inetaton=''
556 d_int64_t=''
557 d_isascii=''
558 d_isfinite=''
559 d_isinf=''
560 d_isnan=''
561 d_isnanl=''
562 d_killpg=''
563 d_lchown=''
564 d_ldbl_dig=''
565 d_libm_lib_version=''
566 d_link=''
567 d_localtime_r=''
568 d_localtime_r_needs_tzset=''
569 localtime_r_proto=''
570 d_locconv=''
571 d_lockf=''
572 d_longdbl=''
573 longdblsize=''
574 d_longlong=''
575 longlongsize=''
576 d_lseekproto=''
577 d_lstat=''
578 d_madvise=''
579 d_malloc_good_size=''
580 d_malloc_size=''
581 d_mblen=''
582 d_mbstowcs=''
583 d_mbtowc=''
584 d_memchr=''
585 d_memcmp=''
586 d_memcpy=''
587 d_memmove=''
588 d_memset=''
589 d_mkdir=''
590 d_mkdtemp=''
591 d_mkfifo=''
592 d_mkstemp=''
593 d_mkstemps=''
594 d_mktime=''
595 d_mmap=''
596 mmaptype=''
597 d_modfl=''
598 d_modfl_pow32_bug=''
599 d_modflproto=''
600 d_mprotect=''
601 d_msg=''
602 d_msgctl=''
603 d_msgget=''
604 d_msghdr_s=''
605 d_msgrcv=''
606 d_msgsnd=''
607 d_msync=''
608 d_munmap=''
609 d_nice=''
610 d_nl_langinfo=''
611 d_off64_t=''
612 d_open3=''
613 d_fpathconf=''
614 d_pathconf=''
615 d_pause=''
616 d_pipe=''
617 d_poll=''
618 d_portable=''
619 d_procselfexe=''
620 procselfexe=''
621 d_old_pthread_create_joinable=''
622 old_pthread_create_joinable=''
623 d_pthread_atfork=''
624 d_pthread_attr_setscope=''
625 d_pthread_yield=''
626 d_sched_yield=''
627 sched_yield=''
628 d_qgcvt=''
629 d_random_r=''
630 random_r_proto=''
631 d_readdir64_r=''
632 readdir64_r_proto=''
633 d_readdir=''
634 d_rewinddir=''
635 d_seekdir=''
636 d_telldir=''
637 d_readdir_r=''
638 readdir_r_proto=''
639 d_readlink=''
640 d_readv=''
641 d_recvmsg=''
642 d_rename=''
643 d_rmdir=''
644 d_safebcpy=''
645 d_safemcpy=''
646 d_sanemcmp=''
647 d_sbrkproto=''
648 d_scalbnl=''
649 d_select=''
650 d_sem=''
651 d_semctl=''
652 d_semget=''
653 d_semop=''
654 d_sendmsg=''
655 d_setegid=''
656 d_seteuid=''
657 d_setgrent=''
658 d_setgrent_r=''
659 setgrent_r_proto=''
660 d_setgrps=''
661 d_sethent=''
662 d_sethostent_r=''
663 sethostent_r_proto=''
664 d_setitimer=''
665 d_setlinebuf=''
666 d_setlocale=''
667 d_setlocale_r=''
668 setlocale_r_proto=''
669 d_setnent=''
670 d_setnetent_r=''
671 setnetent_r_proto=''
672 d_setpent=''
673 d_setpgid=''
674 d_setpgrp2=''
675 d_bsdsetpgrp=''
676 d_setpgrp=''
677 d_setprior=''
678 d_setproctitle=''
679 d_setprotoent_r=''
680 setprotoent_r_proto=''
681 d_setpwent=''
682 d_setpwent_r=''
683 setpwent_r_proto=''
684 d_setregid=''
685 d_setresgid=''
686 d_setresuid=''
687 d_setreuid=''
688 d_setrgid=''
689 d_setruid=''
690 d_setsent=''
691 d_setservent_r=''
692 setservent_r_proto=''
693 d_setsid=''
694 d_setvbuf=''
695 d_sfio=''
696 usesfio=''
697 d_shm=''
698 d_shmat=''
699 d_shmatprototype=''
700 shmattype=''
701 d_shmctl=''
702 d_shmdt=''
703 d_shmget=''
704 d_sigaction=''
705 d_signbit=''
706 d_sigprocmask=''
707 d_sigsetjmp=''
708 usesitecustomize=''
709 d_snprintf=''
710 d_vsnprintf=''
711 d_sockatmark=''
712 d_sockatmarkproto=''
713 d_msg_ctrunc=''
714 d_msg_dontroute=''
715 d_msg_oob=''
716 d_msg_peek=''
717 d_msg_proxy=''
718 d_oldsock=''
719 d_scm_rights=''
720 d_socket=''
721 d_sockpair=''
722 sockethdr=''
723 socketlib=''
724 d_socklen_t=''
725 d_socks5_init=''
726 d_sprintf_returns_strlen=''
727 d_sqrtl=''
728 d_srand48_r=''
729 srand48_r_proto=''
730 d_srandom_r=''
731 srandom_r_proto=''
732 d_sresgproto=''
733 d_sresuproto=''
734 d_statblks=''
735 d_statfs_f_flags=''
736 d_statfs_s=''
737 d_fstatvfs=''
738 d_statvfs=''
739 d_stdio_cnt_lval=''
740 d_stdio_ptr_lval=''
741 d_stdio_ptr_lval_nochange_cnt=''
742 d_stdio_ptr_lval_sets_cnt=''
743 d_stdiobase=''
744 d_stdstdio=''
745 stdio_base=''
746 stdio_bufsiz=''
747 stdio_cnt=''
748 stdio_filbuf=''
749 stdio_ptr=''
750 d_index=''
751 d_strchr=''
752 d_strcoll=''
753 d_strctcpy=''
754 d_strerrm=''
755 d_strerror=''
756 d_sysernlst=''
757 d_syserrlst=''
758 d_strerror_r=''
759 strerror_r_proto=''
760 d_strftime=''
761 d_strlcat=''
762 d_strlcpy=''
763 d_strtod=''
764 d_strtol=''
765 d_strtold=''
766 d_strtoll=''
767 d_strtoq=''
768 d_strtoul=''
769 d_strtoull=''
770 d_strtouq=''
771 d_strxfrm=''
772 d_symlink=''
773 d_syscall=''
774 d_syscallproto=''
775 d_sysconf=''
776 d_system=''
777 d_tcgetpgrp=''
778 d_tcsetpgrp=''
779 d_telldirproto=''
780 d_time=''
781 timetype=''
782 clocktype=''
783 d_times=''
784 d_tmpnam_r=''
785 tmpnam_r_proto=''
786 d_truncate=''
787 d_ttyname_r=''
788 ttyname_r_proto=''
789 d_tzname=''
790 d_u32align=''
791 d_ualarm=''
792 d_umask=''
793 d_semctl_semid_ds=''
794 d_semctl_semun=''
795 d_union_semun=''
796 d_unordered=''
797 d_unsetenv=''
798 d_usleep=''
799 d_usleepproto=''
800 d_ustat=''
801 d_pseudofork=''
802 d_vfork=''
803 usevfork=''
804 d_voidsig=''
805 signal_t=''
806 d_volatile=''
807 d_charvspr=''
808 d_vprintf=''
809 d_wait4=''
810 d_waitpid=''
811 d_wcstombs=''
812 d_wctomb=''
813 d_writev=''
814 dlext=''
815 cccdlflags=''
816 ccdlflags=''
817 dlsrc=''
818 ld=''
819 lddlflags=''
820 usedl=''
821 doublesize=''
822 ebcdic=''
823 fflushNULL=''
824 fflushall=''
825 fpossize=''
826 fpostype=''
827 gccansipedantic=''
828 gccosandvers=''
829 gccversion=''
830 gidformat=''
831 gidsign=''
832 gidsize=''
833 gidtype=''
834 groupstype=''
835 h_fcntl=''
836 h_sysfile=''
837 html1dir=''
838 html1direxp=''
839 installhtml1dir=''
840 html3dir=''
841 html3direxp=''
842 installhtml3dir=''
843 i_arpainet=''
844 i_assert=''
845 i_crypt=''
846 db_hashtype=''
847 db_prefixtype=''
848 db_version_major=''
849 db_version_minor=''
850 db_version_patch=''
851 i_db=''
852 i_dbm=''
853 i_rpcsvcdbm=''
854 d_dirnamlen=''
855 direntrytype=''
856 i_dirent=''
857 i_dld=''
858 i_dlfcn=''
859 i_fcntl=''
860 i_float=''
861 i_fp=''
862 i_fp_class=''
863 i_gdbm=''
864 d_grpasswd=''
865 i_grp=''
866 i_ieeefp=''
867 i_inttypes=''
868 i_langinfo=''
869 i_libutil=''
870 i_limits=''
871 i_locale=''
872 i_machcthr=''
873 i_malloc=''
874 i_math=''
875 i_memory=''
876 i_mntent=''
877 i_ndbm=''
878 i_netdb=''
879 i_neterrno=''
880 i_netinettcp=''
881 i_niin=''
882 i_sysin=''
883 i_poll=''
884 i_prot=''
885 i_pthread=''
886 d_pwage=''
887 d_pwchange=''
888 d_pwclass=''
889 d_pwcomment=''
890 d_pwexpire=''
891 d_pwgecos=''
892 d_pwpasswd=''
893 d_pwquota=''
894 i_pwd=''
895 i_sfio=''
896 i_shadow=''
897 i_socks=''
898 i_stddef=''
899 i_stdlib=''
900 i_string=''
901 strings=''
902 i_sunmath=''
903 i_sysaccess=''
904 i_sysdir=''
905 i_sysfile=''
906 d_voidtty=''
907 i_bsdioctl=''
908 i_sysfilio=''
909 i_sysioctl=''
910 i_syssockio=''
911 i_syslog=''
912 i_sysmman=''
913 i_sysmode=''
914 i_sysmount=''
915 i_sysndir=''
916 i_sysparam=''
917 i_sysresrc=''
918 i_syssecrt=''
919 i_sysselct=''
920 i_sysstat=''
921 i_sysstatfs=''
922 i_sysstatvfs=''
923 i_systimes=''
924 i_systypes=''
925 i_sysuio=''
926 i_sysun=''
927 i_sysutsname=''
928 i_sysvfs=''
929 i_syswait=''
930 i_sgtty=''
931 i_termio=''
932 i_termios=''
933 d_tm_tm_gmtoff=''
934 d_tm_tm_zone=''
935 i_systime=''
936 i_systimek=''
937 i_time=''
938 timeincl=''
939 i_unistd=''
940 i_ustat=''
941 i_utime=''
942 i_values=''
943 i_stdarg=''
944 i_varargs=''
945 i_varhdr=''
946 i_vfork=''
947 d_inc_version_list=''
948 inc_version_list=''
949 inc_version_list_init=''
950 installprefix=''
951 installprefixexp=''
952 installstyle=''
953 installusrbinperl=''
954 intsize=''
955 longsize=''
956 shortsize=''
957 issymlink=''
958 libc=''
959 ldlibpthname=''
960 libperl=''
961 shrpenv=''
962 useshrplib=''
963 glibpth=''
964 libpth=''
965 loclibpth=''
966 plibpth=''
967 xlibpth=''
968 ignore_versioned_solibs=''
969 libs=''
970 libsdirs=''
971 libsfiles=''
972 libsfound=''
973 libspath=''
974 lns=''
975 d_PRIEUldbl=''
976 d_PRIFUldbl=''
977 d_PRIGUldbl=''
978 d_PRIeldbl=''
979 d_PRIfldbl=''
980 d_PRIgldbl=''
981 d_SCNfldbl=''
982 sPRIEUldbl=''
983 sPRIFUldbl=''
984 sPRIGUldbl=''
985 sPRIeldbl=''
986 sPRIfldbl=''
987 sPRIgldbl=''
988 sSCNfldbl=''
989 lseeksize=''
990 lseektype=''
991 mad=''
992 madlyh=''
993 madlyobj=''
994 madlysrc=''
995 make_set_make=''
996 d_mymalloc=''
997 freetype=''
998 mallocobj=''
999 mallocsrc=''
1000 malloctype=''
1001 usemallocwrap=''
1002 usemymalloc=''
1003 installman1dir=''
1004 man1dir=''
1005 man1direxp=''
1006 man1ext=''
1007 installman3dir=''
1008 man3dir=''
1009 man3direxp=''
1010 man3ext=''
1011 modetype=''
1012 multiarch=''
1013 mydomain=''
1014 myhostname=''
1015 phostname=''
1016 c=''
1017 n=''
1018 d_eofnblk=''
1019 eagain=''
1020 o_nonblock=''
1021 rd_nodata=''
1022 need_va_copy=''
1023 netdb_hlen_type=''
1024 netdb_host_type=''
1025 netdb_name_type=''
1026 netdb_net_type=''
1027 groupcat=''
1028 hostcat=''
1029 passcat=''
1030 orderlib=''
1031 ranlib=''
1032 d_perl_otherlibdirs=''
1033 otherlibdirs=''
1034 package=''
1035 spackage=''
1036 pager=''
1037 api_revision=''
1038 api_subversion=''
1039 api_version=''
1040 api_versionstring=''
1041 patchlevel=''
1042 perl_patchlevel=''
1043 revision=''
1044 subversion=''
1045 version=''
1046 version_patchlevel_string=''
1047 perl5=''
1048 perladmin=''
1049 perlpath=''
1050 d_nv_preserves_uv=''
1051 d_nv_zero_is_allbits_zero=''
1052 i16size=''
1053 i16type=''
1054 i32size=''
1055 i32type=''
1056 i64size=''
1057 i64type=''
1058 i8size=''
1059 i8type=''
1060 ivsize=''
1061 ivtype=''
1062 nv_preserves_uv_bits=''
1063 nvsize=''
1064 nvtype=''
1065 u16size=''
1066 u16type=''
1067 u32size=''
1068 u32type=''
1069 u64size=''
1070 u64type=''
1071 u8size=''
1072 u8type=''
1073 uvsize=''
1074 uvtype=''
1075 ivdformat=''
1076 nvEUformat=''
1077 nvFUformat=''
1078 nvGUformat=''
1079 nveformat=''
1080 nvfformat=''
1081 nvgformat=''
1082 uvXUformat=''
1083 uvoformat=''
1084 uvuformat=''
1085 uvxformat=''
1086 pidtype=''
1087 prefix=''
1088 prefixexp=''
1089 installprivlib=''
1090 privlib=''
1091 privlibexp=''
1092 prototype=''
1093 ptrsize=''
1094 d_PRIXU64=''
1095 d_PRId64=''
1096 d_PRIi64=''
1097 d_PRIo64=''
1098 d_PRIu64=''
1099 d_PRIx64=''
1100 sPRIXU64=''
1101 sPRId64=''
1102 sPRIi64=''
1103 sPRIo64=''
1104 sPRIu64=''
1105 sPRIx64=''
1106 d_quad=''
1107 quadkind=''
1108 quadtype=''
1109 uquadtype=''
1110 drand01=''
1111 randbits=''
1112 randfunc=''
1113 randseedtype=''
1114 seedfunc=''
1115 installscript=''
1116 scriptdir=''
1117 scriptdirexp=''
1118 selectminbits=''
1119 selecttype=''
1120 sh=''
1121 sig_count=''
1122 sig_name=''
1123 sig_name_init=''
1124 sig_num=''
1125 sig_num_init=''
1126 sig_size=''
1127 d_sitearch=''
1128 installsitearch=''
1129 sitearch=''
1130 sitearchexp=''
1131 installsitebin=''
1132 sitebin=''
1133 sitebinexp=''
1134 installsitehtml1dir=''
1135 sitehtml1dir=''
1136 sitehtml1direxp=''
1137 installsitehtml3dir=''
1138 sitehtml3dir=''
1139 sitehtml3direxp=''
1140 installsitelib=''
1141 sitelib=''
1142 sitelib_stem=''
1143 sitelibexp=''
1144 installsiteman1dir=''
1145 siteman1dir=''
1146 siteman1direxp=''
1147 installsiteman3dir=''
1148 siteman3dir=''
1149 siteman3direxp=''
1150 siteprefix=''
1151 siteprefixexp=''
1152 installsitescript=''
1153 sitescript=''
1154 sitescriptexp=''
1155 sizesize=''
1156 sizetype=''
1157 so=''
1158 socksizetype=''
1159 sharpbang=''
1160 shsharp=''
1161 spitshell=''
1162 src=''
1163 ssizetype=''
1164 startperl=''
1165 startsh=''
1166 stdchar=''
1167 d_stdio_stream_array=''
1168 stdio_stream_array=''
1169 sysman=''
1170 trnl=''
1171 uidformat=''
1172 uidsign=''
1173 uidsize=''
1174 uidtype=''
1175 archname64=''
1176 use64bitall=''
1177 use64bitint=''
1178 usefaststdio=''
1179 ccflags_uselargefiles=''
1180 ldflags_uselargefiles=''
1181 libswanted_uselargefiles=''
1182 uselargefiles=''
1183 uselongdouble=''
1184 usemorebits=''
1185 usemultiplicity=''
1186 nm_opt=''
1187 nm_so_opt=''
1188 runnm=''
1189 usenm=''
1190 useperlio=''
1191 usesocks=''
1192 d_oldpthreads=''
1193 use5005threads=''
1194 useithreads=''
1195 usereentrant=''
1196 usethreads=''
1197 usedtrace=''
1198 incpath=''
1199 mips_type=''
1200 usrinc=''
1201 d_vendorarch=''
1202 installvendorarch=''
1203 vendorarch=''
1204 vendorarchexp=''
1205 d_vendorbin=''
1206 installvendorbin=''
1207 vendorbin=''
1208 vendorbinexp=''
1209 installvendorhtml1dir=''
1210 vendorhtml1dir=''
1211 vendorhtml1direxp=''
1212 installvendorhtml3dir=''
1213 vendorhtml3dir=''
1214 vendorhtml3direxp=''
1215 d_vendorlib=''
1216 installvendorlib=''
1217 vendorlib=''
1218 vendorlib_stem=''
1219 vendorlibexp=''
1220 installvendorman1dir=''
1221 vendorman1dir=''
1222 vendorman1direxp=''
1223 installvendorman3dir=''
1224 vendorman3dir=''
1225 vendorman3direxp=''
1226 usevendorprefix=''
1227 vendorprefix=''
1228 vendorprefixexp=''
1229 d_vendorscript=''
1230 installvendorscript=''
1231 vendorscript=''
1232 vendorscriptexp=''
1233 versiononly=''
1234 defvoidused=''
1235 voidflags=''
1236 yacc=''
1237 yaccflags=''
1238 CONFIG=''
1239
1240 define='define'
1241 undef='undef'
1242 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1243 rmlist=''
1244
1245 : We must find out about Eunice early
1246 eunicefix=':'
1247 if test -f /etc/unixtovms; then
1248         eunicefix=/etc/unixtovms
1249 fi
1250 if test -f /etc/unixtovms.exe; then
1251         eunicefix=/etc/unixtovms.exe
1252 fi
1253
1254 : Set executable suffix now -- needed before hints available
1255 if test -f "/libs/version.library"; then
1256 : Amiga OS
1257     _exe=""
1258 elif test -f "/system/gnu_library/bin/ar.pm"; then
1259 : Stratus VOS
1260     _exe=".pm"
1261 elif test -n "$DJGPP"; then
1262 : DOS DJGPP
1263     _exe=".exe"
1264 elif test -d c:/. -o -n "$is_os2" ; then
1265 : OS/2 or cygwin
1266     _exe=".exe"
1267 fi
1268
1269 i_whoami=''
1270 : Trailing extension.  Override this in a hint file, if needed.
1271 : Extra object files, if any, needed on this platform.
1272 archobjs=''
1273 archname=''
1274 groupstype=''
1275 libnames=''
1276 : change the next line if compiling for Xenix/286 on Xenix/386
1277 xlibpth='/usr/lib/386 /lib/386'
1278 : Possible local library directories to search.
1279 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1280 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1281
1282 : general looking path for locating libraries
1283 glibpth="/lib /usr/lib $xlibpth"
1284 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1285 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1286 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1287 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1288
1289 : Private path used by Configure to find libraries.  Its value
1290 : is prepended to libpth. This variable takes care of special
1291 : machines, like the mips.  Usually, it should be empty.
1292 plibpth=''
1293
1294 : default library list
1295 libswanted=''
1296 : some systems want to use only the non-versioned libso:s
1297 ignore_versioned_solibs=''
1298 siteman1dir=''
1299 siteman3dir=''
1300 sitescript=''
1301 : set usethreads on the Configure command line to enable threads.
1302 usereentrant='undef'
1303 : full support for void wanted by default
1304 defvoidused=15
1305
1306 : Possible local include directories to search.
1307 : Set locincpth to "" in a hint file to defeat local include searches.
1308 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1309 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1310 :
1311 : no include file wanted by default
1312 inclwanted=''
1313
1314 : Enable -DEBUGGING and -DDEBUGGING from the command line
1315 EBUGGING=''
1316 DEBUGGING=old
1317
1318 ccname=''
1319 ccversion=''
1320 perllibs=''
1321 : set useposix=false in your hint file to disable the POSIX extension.
1322 useposix=true
1323 : set useopcode=false in your hint file to disable the Opcode extension.
1324 useopcode=true
1325 archname64=''
1326 ccflags_uselargefiles=''
1327 ldflags_uselargefiles=''
1328 libswanted_uselargefiles=''
1329 : set usemultiplicity on the Configure command line to enable multiplicity.
1330 : set usesocks on the Configure command line to enable socks.
1331 : List of libraries we want.
1332 : If anyone needs extra -lxxx, put those in a hint file.
1333 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1334 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1335 : We probably want to search /usr/shlib before most other libraries.
1336 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1337 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1338 glibpth="/usr/shlib $glibpth"
1339 : Do not use vfork unless overridden by a hint file.
1340 usevfork=false
1341
1342 : Find the basic shell for Bourne shell scripts
1343 case "$sh" in
1344 '')
1345         case "$SYSTYPE" in
1346         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1347         *) xxx='/bin/sh';;
1348         esac
1349         if test -f "$xxx"; then
1350                 sh="$xxx"
1351         else
1352                 : Build up a list and do a single loop so we can 'break' out.
1353                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1354                 for xxx in sh bash ksh pdksh ash; do
1355                         for p in $pth; do
1356                                 try="$try ${p}/${xxx}"
1357                         done
1358                 done
1359                 for xxx in $try; do
1360                         if test -f "$xxx"; then
1361                                 sh="$xxx";
1362                                 break
1363                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1364                                 sh="$xxx";
1365                                 break
1366                         elif test -f "$xxx.exe"; then
1367                                 sh="$xxx";
1368                                 break
1369                         fi
1370                 done
1371         fi
1372         ;;
1373 esac
1374
1375 case "$sh" in
1376 '')     cat >&2 <<EOM
1377 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1378
1379 Usually it's in /bin/sh.  How did you even get this far?
1380 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1381 we'll try to straighten this all out.
1382 EOM
1383         exit 1
1384         ;;
1385 esac
1386
1387 : see if sh knows # comments
1388 if `$sh -c '#' >/dev/null 2>&1`; then
1389         shsharp=true
1390         spitshell=cat
1391         xcat=/bin/cat
1392         test -f $xcat$_exe || xcat=/usr/bin/cat
1393         if test ! -f $xcat$_exe; then
1394                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1395                         if test -f $p/cat$_exe; then
1396                                 xcat=$p/cat
1397                                 break
1398                         fi
1399                 done
1400                 if test ! -f $xcat$_exe; then
1401                         echo "Can't find cat anywhere!"
1402                         exit 1
1403                 fi
1404         fi
1405         echo "#!$xcat" >sharp
1406         $eunicefix sharp
1407         chmod +x sharp
1408         ./sharp > today
1409         if test -s today; then
1410                 sharpbang='#!'
1411         else
1412                 echo "#! $xcat" > sharp
1413                 $eunicefix sharp
1414                 chmod +x sharp
1415                 ./sharp > today
1416                 if test -s today; then
1417                         sharpbang='#! '
1418                 else
1419                         sharpbang=': use '
1420                 fi
1421         fi
1422 else
1423         echo " "
1424         echo "Your $sh doesn't grok # comments--I will strip them later on."
1425         shsharp=false
1426         cd ..
1427         echo "exec grep -v '^[  ]*#'" >spitshell
1428         chmod +x spitshell
1429         $eunicefix spitshell
1430         spitshell=`pwd`/spitshell
1431         cd UU
1432         echo "I presume that if # doesn't work, #! won't work either!"
1433         sharpbang=': use '
1434 fi
1435 rm -f sharp today
1436
1437 : figure out how to guarantee sh startup
1438 case "$startsh" in
1439 '') startsh=${sharpbang}${sh} ;;
1440 *)
1441 esac
1442 cat >sharp <<EOSS
1443 $startsh
1444 set abc
1445 test "$?abc" != 1
1446 EOSS
1447
1448 chmod +x sharp
1449 $eunicefix sharp
1450 if ./sharp; then
1451         : echo "Yup, it does."
1452 else
1453         echo "Hmm... '$startsh' does not guarantee sh startup..."
1454         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1455 fi
1456 rm -f sharp
1457
1458 : Save command line options in file UU/cmdline.opt for later use in
1459 : generating config.sh.
1460 cat > cmdline.opt <<EOSH
1461 : Configure command line arguments.
1462 config_arg0='$0'
1463 config_args='$*'
1464 config_argc=$#
1465 EOSH
1466 argn=1
1467 args_exp=''
1468 args_sep=''
1469 for arg in "$@"; do
1470         cat >>cmdline.opt <<EOSH
1471 config_arg$argn='$arg'
1472 EOSH
1473         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1474 $arg
1475 EOC
1476         arg_exp=`cat cmdl.opt`
1477         args_exp="$args_exp$args_sep'$arg_exp'"
1478         argn=`expr $argn + 1`
1479         args_sep=' '
1480 done
1481 rm -f cmdl.opt
1482
1483 : produce awk script to parse command line options
1484 cat >options.awk <<'EOF'
1485 BEGIN {
1486         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1487
1488         len = length(optstr);
1489         for (i = 1; i <= len; i++) {
1490                 c = substr(optstr, i, 1);
1491                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1492                 if (a == ":") {
1493                         arg[c] = 1;
1494                         i++;
1495                 }
1496                 opt[c] = 1;
1497         }
1498 }
1499 {
1500         expect = 0;
1501         str = $0;
1502         if (substr(str, 1, 1) != "-") {
1503                 printf("'%s'\n", str);
1504                 next;
1505         }
1506         len = length($0);
1507         for (i = 2; i <= len; i++) {
1508                 c = substr(str, i, 1);
1509                 if (!opt[c]) {
1510                         printf("-%s\n", substr(str, i));
1511                         next;
1512                 }
1513                 printf("-%s\n", c);
1514                 if (arg[c]) {
1515                         if (i < len)
1516                                 printf("'%s'\n", substr(str, i + 1));
1517                         else
1518                                 expect = 1;
1519                         next;
1520                 }
1521         }
1522 }
1523 END {
1524         if (expect)
1525                 print "?";
1526 }
1527 EOF
1528
1529 : process the command line options
1530 set X `for arg in "$@"; do echo "X$arg"; done |
1531         sed -e s/X// | awk -f options.awk`
1532 eval "set $*"
1533 shift
1534 rm -f options.awk
1535
1536 : set up default values
1537 fastread=''
1538 reuseval=false
1539 config_sh=''
1540 alldone=''
1541 error=''
1542 silent=''
1543 extractsh=''
1544 override=''
1545 knowitall=''
1546 rm -f optdef.sh posthint.sh
1547 cat >optdef.sh <<EOS
1548 $startsh
1549 EOS
1550
1551
1552 : option parsing
1553 while test $# -gt 0; do
1554         case "$1" in
1555         -d) shift; fastread=yes;;
1556         -e) shift; alldone=cont;;
1557         -f)
1558                 shift
1559                 cd ..
1560                 if test -r "$1"; then
1561                         config_sh="$1"
1562                 else
1563                         echo "$me: cannot read config file $1." >&2
1564                         error=true
1565                 fi
1566                 cd UU
1567                 shift;;
1568         --help|\
1569         -h) shift; error=true;;
1570         -r) shift; reuseval=true;;
1571         -s) shift; silent=true; realsilent=true;;
1572         -E) shift; alldone=exit;;
1573         -K) shift; knowitall=true;;
1574         -O) shift; override=true;;
1575         -S) shift; silent=true; extractsh=true;;
1576         -D)
1577                 shift
1578                 case "$1" in
1579                 *=)
1580                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1581                         echo "$me: ignoring -D $1" >&2
1582                         ;;
1583                 *=*) echo "$1" | \
1584                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1585                 *) echo "$1='define'" >> optdef.sh;;
1586                 esac
1587                 shift
1588                 ;;
1589         -U)
1590                 shift
1591                 case "$1" in
1592                 *=) echo "$1" >> optdef.sh;;
1593                 *=*)
1594                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1595                         echo "$me: ignoring -U $1" >&2
1596                         ;;
1597                 *) echo "$1='undef'" >> optdef.sh;;
1598                 esac
1599                 shift
1600                 ;;
1601         -A)
1602             shift
1603             xxx=''
1604             yyy="$1"
1605             zzz=''
1606             uuu=undef
1607             case "$yyy" in
1608             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1609                  case "$zzz" in
1610                  *:*) zzz='' ;;
1611                  *)   xxx=append
1612                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1613                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1614                  esac
1615                  ;;
1616             esac
1617             case "$xxx" in
1618             '')  case "$yyy" in
1619                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1620                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1621                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1622                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1623                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1624                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1625                  esac
1626                  ;;
1627             esac
1628             case "$xxx" in
1629             append)
1630                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1631             clear)
1632                 echo "$yyy=''"                  >> posthint.sh ;;
1633             define)
1634                 case "$zzz" in
1635                 '') zzz=define ;;
1636                 esac
1637                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1638             eval)
1639                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1640             prepend)
1641                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1642             undef)
1643                 case "$zzz" in
1644                 '') zzz="$uuu" ;;
1645                 esac
1646                 echo "$yyy=$zzz"                >> posthint.sh ;;
1647             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1648             esac
1649             shift
1650             ;;
1651         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1652             exit 0;;
1653         --) break;;
1654         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1655         *) break;;
1656         esac
1657 done
1658
1659 case "$error" in
1660 true)
1661         cat >&2 <<EOM
1662 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1663                  [-U symbol] [-U symbol=] [-A command:symbol...]
1664   -d : use defaults for all answers.
1665   -e : go on without questioning past the production of config.sh.
1666   -f : specify an alternate default configuration file.
1667   -h : print this help message and exit (with an error status).
1668   -r : reuse C symbols value if possible (skips costly nm extraction).
1669   -s : silent mode, only echoes questions and essential information.
1670   -D : define symbol to have some value:
1671          -D symbol         symbol gets the value 'define'
1672          -D symbol=value   symbol gets the value 'value'
1673        common used examples (see INSTALL for more info):
1674          -Duse64bitint            use 64bit integers
1675          -Duse64bitall            use 64bit integers and pointers
1676          -Dusethreads             use thread support
1677          -Dinc_version_list=none  do not include older perl trees in @INC
1678          -DEBUGGING=none          DEBUGGING options
1679          -Dcc=gcc                 choose your compiler
1680          -Dprefix=/opt/perl5      choose your destination
1681   -E : stop at the end of questions, after having produced config.sh.
1682   -K : do not use unless you know what you are doing.
1683   -O : let -D and -U override definitions from loaded configuration file.
1684   -S : perform variable substitutions on all .SH files (can mix with -f)
1685   -U : undefine symbol:
1686          -U symbol    symbol gets the value 'undef'
1687          -U symbol=   symbol gets completely empty
1688        e.g.:  -Uversiononly
1689   -A : manipulate symbol after the platform specific hints have been applied:
1690          -A append:symbol=value   append value to symbol
1691          -A symbol=value          like append:, but with a separating space
1692          -A define:symbol=value   define symbol to have value
1693          -A clear:symbol          define symbol to be ''
1694          -A define:symbol         define symbol to be 'define'
1695          -A eval:symbol=value     define symbol to be eval of value
1696          -A prepend:symbol=value  prepend value to symbol
1697          -A undef:symbol          define symbol to be 'undef'
1698          -A undef:symbol=         define symbol to be ''
1699        e.g.:  -A prepend:libswanted='cl pthread '
1700               -A ccflags=-DSOME_MACRO
1701   -V : print version number and exit (with a zero status).
1702 EOM
1703         exit 1
1704         ;;
1705 esac
1706
1707 : Sanity checks
1708 case "$fastread$alldone" in
1709 yescont|yesexit) ;;
1710 *)
1711         case "$extractsh" in
1712         true) ;;
1713         *)
1714                 if test ! -t 0; then
1715                         echo "Say 'sh Configure', not 'sh <Configure'"
1716                         exit 1
1717                 fi
1718                 ;;
1719         esac
1720         ;;
1721 esac
1722
1723 exec 4>&1
1724 case "$silent" in
1725 true) exec 1>/dev/null;;
1726 esac
1727
1728 : run the defines and the undefines, if any, but leave the file out there...
1729 touch optdef.sh
1730 . ./optdef.sh
1731 : create the posthint manipulation script and leave the file out there...
1732 touch posthint.sh
1733
1734 : set package name
1735 package=perl5
1736 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1737 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1738 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1739 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1740 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1741 esac
1742
1743 : Some greps do not return status, grrr.
1744 echo "grimblepritz" >grimble
1745 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1746         contains=contains
1747 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1748         contains=grep
1749 else
1750         contains=contains
1751 fi
1752 rm -f grimble
1753 : the following should work in any shell
1754 case "$contains" in
1755 contains*)
1756         echo " "
1757         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1758         cat >contains <<'EOSS'
1759 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1760 EOSS
1761 chmod +x contains
1762 esac
1763
1764 : Find the path to the source tree
1765 case "$src" in
1766 '') case "$0" in
1767     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1768          case "$src" in
1769          /*)    ;;
1770          .)     ;;
1771          *)     src=`cd ../$src && pwd` ;;
1772          esac
1773          ;;
1774     *)   src='.';;
1775     esac;;
1776 esac
1777 case "$src" in
1778 '')     src=/
1779         rsrc=/
1780         ;;
1781 /*) rsrc="$src";;
1782 *) rsrc="../$src";;
1783 esac
1784 if test -f $rsrc/Configure && \
1785         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1786 then
1787    : found it, so we are ok.
1788 else
1789         rsrc=''
1790         for src in . .. ../.. ../../.. ../../../..; do
1791                 if test -f ../$src/Configure && \
1792                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1793                 then
1794                         rsrc=../$src
1795                         break
1796                 fi
1797         done
1798 fi
1799 case "$rsrc" in
1800 '')
1801         cat <<EOM >&4
1802
1803 Sorry, I can't seem to locate the source dir for $package.  Please start
1804 Configure with an explicit path -- i.e. /some/path/Configure.
1805
1806 EOM
1807         exit 1
1808         ;;
1809 ../.)   rsrc='..';;
1810 *)
1811         echo " "
1812         echo "Sources for $package found in \"$src\"." >&4
1813         ;;
1814 esac
1815
1816 : script used to extract .SH files with variable substitutions
1817 cat >extract <<'EOS'
1818 PERL_CONFIG_SH=true
1819 echo "Doing variable substitutions on .SH files..."
1820 if test -f MANIFEST; then
1821         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1822 else
1823         echo "(Looking for .SH files under the source directory.)"
1824         set x `(cd "$src"; find . -name "*.SH" -print)`
1825 fi
1826 shift
1827 case $# in
1828 0) set x `(cd "$src"; echo *.SH)`; shift;;
1829 esac
1830 if test ! -f "$src/$1"; then
1831         shift
1832 fi
1833 mkdir_p='
1834 name=$1;
1835 create="";
1836 while test $name; do
1837         if test ! -d "$name"; then
1838                 create="$name $create";
1839                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1840                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1841         else
1842                 name="";
1843         fi;
1844 done;
1845 for file in $create; do
1846         mkdir $file;
1847 done
1848 '
1849 for file in $*; do
1850         case "$src" in
1851         ".")
1852                 case "$file" in
1853                 */*)
1854                         dir=`expr X$file : 'X\(.*\)/'`
1855                         file=`expr X$file : 'X.*/\(.*\)'`
1856                         (cd "$dir" && . ./$file)
1857                         ;;
1858                 *)
1859                         . ./$file
1860                         ;;
1861                 esac
1862                 ;;
1863         *)
1864                 case "$file" in
1865                 */*)
1866                         dir=`expr X$file : 'X\(.*\)/'`
1867                         file=`expr X$file : 'X.*/\(.*\)'`
1868                         (set x $dir; shift; eval $mkdir_p)
1869                         sh <"$src/$dir/$file"
1870                         ;;
1871                 *)
1872                         sh <"$src/$file"
1873                         ;;
1874                 esac
1875                 ;;
1876         esac
1877 done
1878 if test -f "$src/config_h.SH"; then
1879         if test ! -f config.h; then
1880         : oops, they left it out of MANIFEST, probably, so do it anyway.
1881         . "$src/config_h.SH"
1882         fi
1883 fi
1884 EOS
1885
1886 : extract files and exit if asked to do so
1887 case "$extractsh" in
1888 true)
1889         case "$realsilent" in
1890         true) ;;
1891         *) exec 1>&4;;
1892         esac
1893         case "$config_sh" in
1894         '') config_sh='config.sh';;
1895         esac
1896         echo " "
1897         echo "Fetching answers from $config_sh..."
1898         cd ..
1899         . $config_sh
1900         test "$override" && . ./optdef.sh
1901         echo " "
1902         . UU/extract
1903         rm -rf UU
1904         echo "Extraction done."
1905         exit 0
1906         ;;
1907 esac
1908
1909 : Eunice requires " " instead of "", can you believe it
1910 echo " "
1911 : Here we go...
1912 echo "Beginning of configuration questions for $package."
1913
1914 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1915
1916 : first determine how to suppress newline on echo command
1917 echo " "
1918 echo "Checking echo to see how to suppress newlines..."
1919 (echo "hi there\c" ; echo " ") >.echotmp
1920 if $contains c .echotmp >/dev/null 2>&1 ; then
1921         echo "...using -n."
1922         n='-n'
1923         c=''
1924 else
1925         cat <<'EOM'
1926 ...using \c
1927 EOM
1928         n=''
1929         c='\c'
1930 fi
1931 echo $n "The star should be here-->$c"
1932 echo '*'
1933 rm -f .echotmp
1934
1935 : Now test for existence of everything in MANIFEST
1936 echo " "
1937 if test -f "$rsrc/MANIFEST"; then
1938         echo "First let's make sure your kit is complete.  Checking..." >&4
1939         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1940         rm -f missing
1941         tmppwd=`pwd`
1942         for filelist in x??; do
1943                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1944         done
1945         if test -s missing; then
1946                 cat missing >&4
1947                 cat >&4 <<'EOM'
1948
1949 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1950
1951 You have the option of continuing the configuration process, despite the
1952 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1953 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1954 and contact the author (perlbug@perl.org).
1955
1956 EOM
1957                 echo $n "Continue? [n] $c" >&4
1958                 read ans
1959                 case "$ans" in
1960                 y*)
1961                         echo "Continuing..." >&4
1962                         rm -f missing
1963                         ;;
1964                 *)
1965                         echo "ABORTING..." >&4
1966                         kill $$
1967                         ;;
1968                 esac
1969         else
1970                 echo "Looks good..."
1971         fi
1972 else
1973         echo "There is no MANIFEST file.  I hope your kit is complete !"
1974 fi
1975 rm -f missing x??
1976
1977 : Find the appropriate value for a newline for tr
1978 echo " "
1979 if test -n "$DJGPP"; then
1980        trnl='\012'
1981 fi
1982 if test X"$trnl" = X; then
1983         case "`echo foo|tr '\n' x 2>/dev/null`" in
1984         foox) trnl='\n' ;;
1985         esac
1986 fi
1987 if test X"$trnl" = X; then
1988         case "`echo foo|tr '\012' x 2>/dev/null`" in
1989         foox) trnl='\012' ;;
1990         esac
1991 fi
1992 if test X"$trnl" = X; then
1993        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1994        fooxy) trnl='\n\r' ;;
1995        esac
1996 fi
1997 if test X"$trnl" = X; then
1998         cat <<EOM >&2
1999
2000 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2001
2002 EOM
2003         exit 1
2004 fi
2005
2006 : compute the number of columns on the terminal for proper question formatting
2007 case "$COLUMNS" in
2008 '') COLUMNS='80';;
2009 esac
2010
2011 : set up the echo used in my read
2012 myecho="case \"\$xxxm\" in
2013 '') echo $n \"\$rp $c\" >&4;;
2014 *) case \"\$rp\" in
2015         '') echo $n \"[\$xxxm] $c\";;
2016         *)
2017                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2018                         echo \"\$rp\" >&4
2019                         echo $n \"[\$xxxm] $c\" >&4
2020                 else
2021                         echo $n \"\$rp [\$xxxm] $c\" >&4
2022                 fi
2023                 ;;
2024         esac;;
2025 esac"
2026
2027 : now set up to do reads with possible shell escape and default assignment
2028 cat <<EOSC >myread
2029 $startsh
2030 xxxm=\$dflt
2031 $myecho
2032 ans='!'
2033 case "\$fastread" in
2034 yes) case "\$dflt" in
2035         '') ;;
2036         *) ans='';
2037                 case "\$silent-\$rp" in
2038                 true-) ;;
2039                 *) echo " " >&4;;
2040                 esac;;
2041         esac;;
2042 *) case "\$silent" in
2043         true) case "\$rp" in
2044                 '') ans='';;
2045                 esac;;
2046         esac;;
2047 esac
2048 while expr "X\$ans" : "X!" >/dev/null; do
2049         read answ
2050         set x \$xxxm
2051         shift
2052         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2053         case  "\$answ" in
2054         "!")
2055                 sh 1>&4
2056                 echo " "
2057                 $myecho
2058                 ;;
2059         !*)
2060                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2061                 shift
2062                 sh 1>&4 -c "\$*"
2063                 echo " "
2064                 $myecho
2065                 ;;
2066         "\$ans")
2067                 case "\$ans" in
2068                 \\&*)
2069                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2070                         shift
2071                         case "\$1" in
2072                         -d)
2073                                 fastread=yes
2074                                 echo "(OK, I'll run with -d after this question.)" >&4
2075                                 ;;
2076                         -*)
2077                                 echo "*** Sorry, \$1 not supported yet." >&4
2078                                 ;;
2079                         esac
2080                         $myecho
2081                         ans=!
2082                         ;;
2083                 esac;;
2084         *)
2085                 case "\$aok" in
2086                 y)
2087                         echo "*** Substitution done -- please confirm."
2088                         xxxm="\$ans"
2089                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2090                         xxxm="\$ans"
2091                         ans=!
2092                         ;;
2093                 *)
2094                         echo "*** Error -- try again."
2095                         ans=!
2096                         ;;
2097                 esac
2098                 $myecho
2099                 ;;
2100         esac
2101         case "\$ans\$xxxm\$nostick" in
2102         '')
2103                 ans=!
2104                 $myecho
2105                 ;;
2106         esac
2107 done
2108 case "\$ans" in
2109 '') ans="\$xxxm";;
2110 esac
2111 EOSC
2112
2113 : create .config dir to save info across Configure sessions
2114 test -d ../.config || mkdir ../.config
2115 cat >../.config/README <<EOF
2116 This directory created by Configure to save information that should
2117 persist across sessions for $package.
2118
2119 You may safely delete it if you wish.
2120 EOF
2121
2122 : See if we are using a devel version and want that
2123 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2124 case "$usedevel" in
2125 $define|true|[yY]*) ;;
2126 *) case "$xversion" in
2127    *[13579])
2128         cat >&4 <<EOH
2129 *** WHOA THERE!!! ***
2130
2131     This is an UNSTABLE DEVELOPMENT release.
2132     The version of this $package distribution is $xversion, that is, odd,
2133     (as opposed to even) and that signifies a development release.
2134     If you want a maintenance release, you want an even-numbered version.
2135
2136     Do ***NOT*** install this into production use.
2137     Data corruption and crashes are possible.
2138
2139     It is most seriously suggested that you do not continue any further
2140     unless you want to help in developing and debugging Perl.
2141
2142     If you *still* want to build perl, you can answer 'y' now,
2143     or pass -Dusedevel to Configure.
2144
2145 EOH
2146         rp='Do you really want to continue?'
2147         dflt='n'
2148         . ./myread
2149         case "$ans" in
2150         [yY]) echo >&4 "Okay, continuing."
2151               usedevel="$define" ;;
2152         *) echo >&4 "Okay, bye."
2153            exit 1
2154            ;;
2155         esac
2156         ;;
2157     esac
2158     ;;
2159 esac
2160 case "$usedevel" in
2161 $define|true|[yY]*)
2162         case "$versiononly" in
2163         '') versiononly="$define" ;;
2164         esac
2165         case "$installusrbinperl" in
2166         '') installusrbinperl="$undef" ;;
2167         esac
2168         ;;
2169 esac
2170
2171 : general instructions
2172 needman=true
2173 firsttime=true
2174 user=`(logname) 2>/dev/null`
2175 case "$user" in
2176 '') user=`whoami 2>&1`;;
2177 esac
2178 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2179         firsttime=false
2180         echo " "
2181         rp='Would you like to see the instructions?'
2182         dflt=n
2183         . ./myread
2184         case "$ans" in
2185         [yY]*) ;;
2186         *) needman=false;;
2187         esac
2188 fi
2189 if $needman; then
2190         cat <<EOH
2191
2192 This installation shell script will examine your system and ask you questions
2193 to determine how the perl5 package should be installed. If you get
2194 stuck on a question, you may use a ! shell escape to start a subshell or
2195 execute a command.  Many of the questions will have default answers in square
2196 brackets; typing carriage return will give you the default.
2197
2198 On some of the questions which ask for file or directory names you are allowed
2199 to use the ~name construct to specify the login directory belonging to "name",
2200 even if you don't have a shell which knows about that.  Questions where this is
2201 allowed will be marked "(~name ok)".
2202
2203 EOH
2204         rp=''
2205         dflt='Type carriage return to continue'
2206         . ./myread
2207         cat <<'EOH'
2208
2209 The prompter used in this script allows you to use shell variables and
2210 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2211 in the default answer, as if the default line was a set of arguments given to a
2212 script shell.  This means you may also use $* to repeat the whole default line,
2213 so you do not have to re-type everything to add something to the default.
2214
2215 Everytime there is a substitution, you will have to confirm.  If there is an
2216 error (e.g. an unmatched backtick), the default answer will remain unchanged
2217 and you will be prompted again.
2218
2219 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2220 the questions and use the computed defaults (or the previous answers if there
2221 was already a config.sh file). Type 'Configure -h' for a list of options.
2222 You may also start interactively and then answer '& -d' at any prompt to turn
2223 on the non-interactive behaviour for the remainder of the execution.
2224
2225 EOH
2226         . ./myread
2227         cat <<EOH
2228
2229 Much effort has been expended to ensure that this shell script will run on any
2230 Unix system.  If despite that it blows up on yours, your best bet is to edit
2231 Configure and run it again.  If you can't run Configure for some reason,
2232 you'll have to generate a config.sh file by hand.  Whatever problems you
2233 have, let me (perlbug@perl.org) know how I blew it.
2234
2235 This installation script affects things in two ways:
2236
2237 1) it may do direct variable substitutions on some of the files included
2238    in this kit.
2239 2) it builds a config.h file for inclusion in C programs.  You may edit
2240    any of these files as the need arises after running this script.
2241
2242 If you make a mistake on a question, there is no easy way to back up to it
2243 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2244 files.  Configure will offer to let you do this before it runs the SH files.
2245
2246 EOH
2247         dflt='Type carriage return to continue'
2248         . ./myread
2249         case "$firsttime" in
2250         true) echo $user >>../.config/instruct;;
2251         esac
2252 fi
2253
2254 : find out where common programs are
2255 echo " "
2256 echo "Locating common programs..." >&4
2257 cat <<EOSC >loc
2258 $startsh
2259 case \$# in
2260 0) exit 1;;
2261 esac
2262 thing=\$1
2263 shift
2264 dflt=\$1
2265 shift
2266 for dir in \$*; do
2267         case "\$thing" in
2268         .)
2269         if test -d \$dir/\$thing; then
2270                 echo \$dir
2271                 exit 0
2272         fi
2273         ;;
2274         *)
2275         for thisthing in \$dir/\$thing; do
2276                 : just loop through to pick last item
2277         done
2278         if test -f \$thisthing; then
2279                 echo \$thisthing
2280                 exit 0
2281         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2282                 echo \$thisthing
2283                 exit 0
2284         elif test -f \$dir/\$thing.exe; then
2285                 if test -n "$DJGPP"; then
2286                         echo \$dir/\$thing.exe
2287                 elif test "$eunicefix" != ":"; then
2288                         : on Eunice apparently
2289                         echo \$dir/\$thing
2290                         exit 0
2291                 fi
2292                 exit 0
2293         fi
2294         ;;
2295         esac
2296 done
2297 echo \$dflt
2298 exit 1
2299 EOSC
2300 chmod +x loc
2301 $eunicefix loc
2302 loclist="
2303 awk
2304 cat
2305 chmod
2306 comm
2307 cp
2308 echo
2309 expr
2310 grep
2311 ls
2312 mkdir
2313 rm
2314 sed
2315 sort
2316 touch
2317 tr
2318 uniq
2319 "
2320 trylist="
2321 Mcc
2322 ar
2323 bison
2324 byacc
2325 cpp
2326 csh
2327 date
2328 egrep
2329 gmake
2330 gzip
2331 less
2332 ln
2333 make
2334 more
2335 nm
2336 nroff
2337 pg
2338 test
2339 uname
2340 zip
2341 "
2342 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2343 pth="$pth /lib /usr/lib"
2344 for file in $loclist; do
2345         eval xxx=\$$file
2346         case "$xxx" in
2347         /*|?:[\\/]*)
2348                 if test -f "$xxx"; then
2349                         : ok
2350                 else
2351                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2352                         xxx=`./loc $file $file $pth`
2353                 fi
2354                 ;;
2355         '') xxx=`./loc $file $file $pth`;;
2356         *) xxx=`./loc $xxx $xxx $pth`;;
2357         esac
2358         eval $file=$xxx$_exe
2359         eval _$file=$xxx
2360         case "$xxx" in
2361         /*)
2362                 echo $file is in $xxx.
2363                 ;;
2364         ?:[\\/]*)
2365                 echo $file is in $xxx.
2366                 ;;
2367         *)
2368                 echo "I don't know where '$file' is, and my life depends on it." >&4
2369                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2370                 exit 1
2371                 ;;
2372         esac
2373 done
2374 echo " "
2375 echo "Don't worry if any of the following aren't found..."
2376 say=offhand
2377 for file in $trylist; do
2378         eval xxx=\$$file
2379         case "$xxx" in
2380         /*|?:[\\/]*)
2381                 if test -f "$xxx"; then
2382                         : ok
2383                 else
2384                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2385                         xxx=`./loc $file $file $pth`
2386                 fi
2387                 ;;
2388         '') xxx=`./loc $file $file $pth`;;
2389         *) xxx=`./loc $xxx $xxx $pth`;;
2390         esac
2391         eval $file=$xxx$_exe
2392         eval _$file=$xxx
2393         case "$xxx" in
2394         /*)
2395                 echo $file is in $xxx.
2396                 ;;
2397         ?:[\\/]*)
2398                 echo $file is in $xxx.
2399                 ;;
2400         *)
2401                 echo "I don't see $file out there, $say."
2402                 say=either
2403                 ;;
2404         esac
2405 done
2406 case "$egrep" in
2407 egrep)
2408         echo "Substituting grep for egrep."
2409         egrep=$grep
2410         _egrep=$grep
2411         ;;
2412 esac
2413 case "$ln" in
2414 ln)
2415         echo "Substituting cp for ln."
2416         ln=$cp
2417         _ln=$cp
2418         ;;
2419 esac
2420 case "$make" in
2421 make)
2422         case "$gmake" in
2423         gmake)
2424         echo "I can't find make or gmake, and my life depends on it." >&4
2425         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2426         exit 1
2427         ;;
2428         esac
2429         ;;
2430 esac
2431 case "$gmake" in
2432 gmake)  ;;
2433 *)      # We can't have osname yet.
2434         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2435                 # Assume that gmake, if found, is definitely GNU make
2436                 # and prefer it over the system make.
2437                 echo "Substituting gmake for make."
2438                 make=$gmake
2439                 _make=$gmake
2440         fi
2441         ;;
2442 esac
2443 case "$test" in
2444 test)
2445         echo "Hopefully test is built into your sh."
2446         ;;
2447 *)
2448         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2449                 echo "Using the test built into your sh."
2450                 test=test
2451                 _test=test
2452         fi
2453         ;;
2454 esac
2455 case "$echo" in
2456 echo)
2457         echo "Hopefully echo is built into your sh."
2458         ;;
2459 '') ;;
2460 *)
2461         echo " "
2462 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2463         $echo $n "hi there$c" >foo1
2464         echo $n "hi there$c" >foo2
2465         if cmp foo1 foo2 >/dev/null 2>&1; then
2466                 echo "They are compatible.  In fact, they may be identical."
2467         else
2468                 case "$n" in
2469                 '-n') n='' c='\c';;
2470                 *) n='-n' c='';;
2471                 esac
2472                 cat <<FOO
2473 They are not compatible!  You are probably running ksh on a non-USG system.
2474 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2475 have echo built in and we may have to run some Bourne shell scripts.  That
2476 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2477
2478 FOO
2479                 $echo $n "The star should be here-->$c"
2480                 $echo "*"
2481         fi
2482         $rm -f foo1 foo2
2483         ;;
2484 esac
2485
2486 # This question was auctioned at YAPC::Europe-2007 in Vienna
2487 # I never promised you could answer it. I only auctioned the question.
2488 cat <<FOO
2489 The following message is sponsored by
2490
2491   Dresden.pm<--The stars should be here.
2492
2493 Dear Perl user, system administrator or package
2494 maintainer, the Perl community sends greetings to
2495 you. Do you (emblematical) greet back [Y/n]? n
2496
2497 FOO
2498
2499 : Check what type of C compiler we use
2500 cat <<EOS >trygcc
2501 $startsh
2502 EOS
2503 cat <<'EOSC' >>trygcc
2504 case "$cc" in
2505 '') ;;
2506 *)  $rm -f try try.*
2507     $cat >try.c <<EOM
2508 int main(int argc, char *argv[]) {
2509   return 0;
2510 }
2511 EOM
2512     if $cc -o try $ccflags $ldflags try.c; then
2513        :
2514     else
2515         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2516         despair=yes
2517         trygcc=yes
2518         case "$cc" in
2519         *gcc*) trygcc=no ;;
2520         esac
2521         # Skip this test because it gives a false match on output like:
2522         #    ./trygcc: line 23: cc: command not found
2523         # case "`$cc -v -c try.c 2>&1`" in
2524         # *gcc*) trygcc=no ;;
2525         # esac
2526         if $test X"$trygcc" = Xyes; then
2527             if gcc -o try -c try.c; then
2528                 echo " "
2529                 echo "You seem to have a working gcc, though." >&4
2530                 # Switching compilers may undo the work of hints files.
2531                 # The most common problem is -D_REENTRANT for threads.
2532                 # This heuristic catches that case, but gets false positives
2533                 # if -Dusethreads was not actually specified.  Better to
2534                 # bail out here with a useful message than fail 
2535                 # mysteriously later. Should we perhaps just try to
2536                 # re-invoke Configure -Dcc=gcc config_args ?
2537                 if $test -f usethreads.cbu; then
2538                         $cat >&4 <<EOM 
2539
2540 *** However, any setting of the C compiler flags (e.g. for thread support)
2541 *** will be lost.  It may be necessary for you to restart Configure and
2542 *** add -Dcc=gcc to your Configure command line.
2543
2544 EOM
2545                         rp="Would you like to go ahead and try gcc anyway?"
2546                         dflt=n
2547                 else
2548                         rp="Would you like to use it?"
2549                         dflt=y
2550                 fi
2551                 if $test -f myread; then
2552                     . ./myread
2553                 else
2554                     if $test -f UU/myread; then
2555                         . ./UU/myread
2556                     else
2557                         echo "Cannot find myread, sorry.  Aborting." >&2
2558                         exit 1
2559                     fi
2560                 fi  
2561                 case "$ans" in
2562                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2563                 esac
2564             fi
2565         fi
2566     fi
2567     $rm -f try try.*
2568     ;;
2569 esac
2570 EOSC
2571
2572 cat <<EOS >checkcc
2573 $startsh
2574 EOS
2575 cat <<'EOSC' >>checkcc
2576 case "$cc" in        
2577 '') ;;
2578 *)  $rm -f try try.*              
2579     $cat >try.c <<EOM
2580 int main(int argc, char *argv[]) {
2581   return 0;
2582 }
2583 EOM
2584     if $cc -o try $ccflags $ldflags try.c; then
2585        :
2586     else
2587         if $test X"$despair" = Xyes; then
2588            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2589         fi
2590         $cat >&4 <<EOM         
2591 You need to find a working C compiler.
2592 Either (purchase and) install the C compiler supplied by your OS vendor,
2593 or for a free C compiler try http://gcc.gnu.org/
2594 I cannot continue any further, aborting.
2595 EOM
2596         exit 1
2597     fi
2598     $rm -f try try.*
2599     ;;
2600 esac
2601 EOSC
2602
2603 : determine whether symbolic links are supported
2604 echo " "
2605 $touch blurfl
2606 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2607         echo "Symbolic links are supported." >&4
2608         lns="$ln -s"
2609 else
2610         echo "Symbolic links are NOT supported." >&4
2611         lns="$ln"
2612 fi
2613 $rm -f blurfl sym
2614
2615 : determine whether symbolic links are supported
2616 echo " "
2617 case "$lns" in
2618 *"ln"*" -s")
2619         echo "Checking how to test for symbolic links..." >&4
2620         $lns blurfl sym
2621         if $test "X$issymlink" = X; then
2622                 case "$newsh" in
2623                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2624                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2625                 esac
2626                 if test $? = 0; then
2627                         issymlink="test -h"
2628                 else
2629                         echo "Your builtin 'test -h' may be broken." >&4
2630                         case "$test" in
2631                         /*)     ;;
2632                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2633                                 for p in $pth
2634                                 do
2635                                         if test -f "$p/$test"; then
2636                                                 test="$p/$test"
2637                                                 break
2638                                         fi
2639                                 done
2640                                 ;;
2641                         esac
2642                         case "$test" in
2643                         /*)
2644                                 echo "Trying external '$test -h'." >&4
2645                                 issymlink="$test -h"
2646                                 if $test ! -h sym >/dev/null 2>&1; then
2647                                         echo "External '$test -h' is broken, too." >&4
2648                                         issymlink=''
2649                                 fi
2650                                 ;;
2651                         *)      issymlink='' ;;
2652                         esac
2653                 fi              
2654         fi
2655         if $test "X$issymlink" = X; then
2656                 if $test -L sym 2>/dev/null; then
2657                         issymlink="$test -L"
2658                         echo "The builtin '$test -L' worked." >&4
2659                 fi
2660         fi
2661         if $test "X$issymlink" != X; then
2662                 echo "You can test for symbolic links with '$issymlink'." >&4
2663         else
2664                 echo "I do not know how you can test for symbolic links." >&4
2665         fi
2666         $rm -f blurfl sym
2667         ;;
2668 *)      echo "No symbolic links, so not testing for their testing..." >&4
2669         ;;
2670 esac
2671 echo " "
2672
2673
2674 case "$mksymlinks" in
2675 $define|true|[yY]*)
2676         case "$src" in
2677         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2678                 exit 1
2679                 ;;
2680         *)      case "$lns:$issymlink" in
2681                 *"ln"*" -s:"*"test -"?)
2682                         echo "Creating the symbolic links..." >&4
2683                         echo "(First creating the subdirectories...)" >&4
2684                         cd ..
2685                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2686                                 read directory
2687                                 test -z "$directory" && break
2688                                 mkdir -p $directory
2689                         done
2690                         # Sanity check 1.
2691                         if test ! -d t/base; then
2692                                 echo "Failed to create the subdirectories.  Aborting." >&4
2693                                 exit 1
2694                         fi
2695                         echo "(Then creating the symlinks...)" >&4
2696                         awk '{print $1}' $src/MANIFEST | while true; do
2697                                 read filename
2698                                 test -z "$filename" && break
2699                                 if test -f $filename; then
2700                                         if $issymlink $filename; then
2701                                                 rm -f $filename
2702                                         fi
2703                                 fi
2704                                 if test -f $filename; then
2705                                         echo "$filename already exists, not symlinking."
2706                                 else
2707                                         ln -s $src/$filename $filename
2708                                 fi
2709                         done
2710                         # Sanity check 2.
2711                         if test ! -f t/base/lex.t; then
2712                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2713                                 exit 1
2714                         fi
2715                         cd UU
2716                         ;;
2717                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2718                         ;;
2719                 esac
2720                 ;;
2721         esac
2722         ;;
2723 esac
2724
2725 : Check for Cross-Compilation
2726 case "$usecrosscompile" in
2727 $define|true|[yY]*)
2728         $echo "Cross-compiling..."
2729         croak=''
2730         case "$cc" in
2731         *-*-gcc) # A cross-compiling gcc, probably.
2732             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2733             ar=$targetarch-ar
2734             # leave out ld, choosing it is more complex
2735             nm=$targetarch-nm
2736             ranlib=$targetarch-ranlib
2737             $echo 'extern int foo;' > try.c
2738             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2739             shift
2740             if $test $# -gt 0; then
2741                 incpth="$incpth $*"
2742                 incpth="`$echo $incpth|$sed 's/^ //'`"
2743                 echo "Guessing incpth '$incpth'." >&4
2744                 for i in $*; do
2745                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2746                     if $test -d $j; then
2747                         libpth="$libpth $j"
2748                     fi
2749                 done   
2750                 libpth="`$echo $libpth|$sed 's/^ //'`"
2751                 echo "Guessing libpth '$libpth'." >&4
2752             fi
2753             $rm -f try.c
2754             ;;
2755         esac
2756         case "$targetarch" in
2757         '') echo "Targetarch not defined." >&4; croak=y ;;
2758         *)  echo "Using targetarch $targetarch." >&4 ;;
2759         esac
2760         case "$incpth" in
2761         '') echo "Incpth not defined." >&4; croak=y ;;
2762         *)  echo "Using incpth '$incpth'." >&4 ;;
2763         esac
2764         case "$libpth" in
2765         '') echo "Libpth not defined." >&4; croak=y ;;
2766         *)  echo "Using libpth '$libpth'." >&4 ;;
2767         esac
2768         case "$usrinc" in
2769         '') for i in $incpth; do
2770                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2771                     usrinc=$i
2772                     echo "Guessing usrinc $usrinc." >&4
2773                     break
2774                 fi
2775             done
2776             case "$usrinc" in
2777             '') echo "Usrinc not defined." >&4; croak=y ;;
2778             esac
2779             ;;
2780         *)  echo "Using usrinc $usrinc." >&4 ;;
2781         esac
2782         case "$targethost" in
2783         '') echo "Targethost not defined." >&4; croak=y ;;
2784         *)  echo "Using targethost $targethost." >&4
2785         esac
2786         locincpth=' '
2787         loclibpth=' '
2788         case "$croak" in
2789         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2790         esac
2791         case "$src" in
2792         /*) run=$src/Cross/run
2793             targetmkdir=$src/Cross/mkdir
2794             to=$src/Cross/to
2795             from=$src/Cross/from
2796             ;;
2797         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2798             run=$pwd/Cross/run
2799             targetmkdir=$pwd/Cross/mkdir
2800             to=$pwd/Cross/to
2801             from=$pwd/Cross/from
2802             ;;
2803         esac
2804         case "$targetrun" in
2805         '') targetrun=ssh ;;
2806         esac
2807         case "$targetto" in
2808         '') targetto=scp ;;
2809         esac
2810         case "$targetfrom" in
2811         '') targetfrom=scp ;;
2812         esac
2813         run=$run-$targetrun
2814         to=$to-$targetto
2815         from=$from-$targetfrom
2816         case "$targetdir" in
2817         '')  targetdir=/tmp
2818              echo "Guessing targetdir $targetdir." >&4
2819              ;;
2820         esac
2821         case "$targetuser" in
2822         '')  targetuser=root
2823              echo "Guessing targetuser $targetuser." >&4
2824              ;;
2825         esac
2826         case "$targetfrom" in
2827         scp)    q=-q ;;
2828         *)      q='' ;;
2829         esac
2830         case "$targetrun" in
2831         ssh|rsh)
2832             cat >$run <<EOF
2833 #!/bin/sh
2834 case "\$1" in
2835 -cwd)
2836   shift
2837   cwd=\$1
2838   shift
2839   ;;
2840 esac
2841 case "\$cwd" in
2842 '') cwd=$targetdir ;;
2843 esac
2844 exe=\$1
2845 shift
2846 if $test ! -f \$exe.xok; then
2847   $to \$exe
2848   $touch \$exe.xok
2849 fi
2850 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2851 EOF
2852             ;;
2853         *)  echo "Unknown targetrun '$targetrun'" >&4
2854             exit 1
2855             ;;
2856         esac
2857         case "$targetmkdir" in
2858         */Cross/mkdir)
2859             cat >$targetmkdir <<EOF
2860 #!/bin/sh
2861 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2862 EOF
2863             $chmod a+rx $targetmkdir
2864             ;;
2865         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2866             exit 1
2867             ;;
2868         esac
2869         case "$targetto" in
2870         scp|rcp)
2871             cat >$to <<EOF
2872 #!/bin/sh
2873 for f in \$@
2874 do
2875   case "\$f" in
2876   /*)
2877     $targetmkdir \`dirname \$f\`
2878     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2879     ;;
2880   *)
2881     $targetmkdir $targetdir/\`dirname \$f\`
2882     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2883     ;;
2884   esac
2885 done
2886 exit 0
2887 EOF
2888             ;;
2889         cp) cat >$to <<EOF
2890 #!/bin/sh
2891 for f in \$@
2892 do
2893   case "\$f" in
2894   /*)
2895     $mkdir -p $targetdir/\`dirname \$f\`
2896     $cp \$f $targetdir/\$f || exit 1
2897     ;;
2898   *)
2899     $targetmkdir $targetdir/\`dirname \$f\`
2900     $cp \$f $targetdir/\$f || exit 1
2901     ;;
2902   esac
2903 done
2904 exit 0
2905 EOF
2906             ;;
2907         *)  echo "Unknown targetto '$targetto'" >&4
2908             exit 1
2909             ;;
2910         esac
2911         case "$targetfrom" in
2912         scp|rcp)
2913           cat >$from <<EOF
2914 #!/bin/sh
2915 for f in \$@
2916 do
2917   $rm -f \$f
2918   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2919 done
2920 exit 0
2921 EOF
2922             ;;
2923         cp) cat >$from <<EOF
2924 #!/bin/sh
2925 for f in \$@
2926 do
2927   $rm -f \$f
2928   cp $targetdir/\$f . || exit 1
2929 done
2930 exit 0
2931 EOF
2932             ;;
2933         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2934             exit 1
2935             ;;
2936         esac
2937         if $test ! -f $run; then
2938             echo "Target 'run' script '$run' not found." >&4
2939         else
2940             $chmod a+rx $run
2941         fi
2942         if $test ! -f $to; then
2943             echo "Target 'to' script '$to' not found." >&4
2944         else
2945             $chmod a+rx $to
2946         fi
2947         if $test ! -f $from; then
2948             echo "Target 'from' script '$from' not found." >&4
2949         else
2950             $chmod a+rx $from
2951         fi
2952         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2953             exit 1
2954         fi
2955         cat >&4 <<EOF
2956 Using '$run' for remote execution,
2957 and '$from' and '$to'
2958 for remote file transfer.
2959 EOF
2960         ;;
2961 *)      run=''
2962         to=:
2963         from=:
2964         usecrosscompile='undef'
2965         targetarch=''
2966         ;;
2967 esac
2968
2969 : see whether [:lower:] and [:upper:] are supported character classes
2970 echo " "
2971 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2972 ABYZ)
2973         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2974         up='[:upper:]'
2975         low='[:lower:]'
2976         ;;
2977 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2978         # (0xd9 and 0xe2), therefore that is a nice testing point.
2979         if test "X$up" = X -o "X$low" = X; then
2980             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2981             rs) up='[A-Z]'
2982                 low='[a-z]'
2983                 ;;
2984             esac
2985         fi
2986         if test "X$up" = X -o "X$low" = X; then
2987             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2988             rs) up='A-Z'
2989                 low='a-z'
2990                 ;;
2991             esac
2992         fi
2993         if test "X$up" = X -o "X$low" = X; then
2994             case "`echo RS | od -x 2>/dev/null`" in
2995             *D9E2*|*d9e2*)
2996                 echo "Hey, this might be EBCDIC." >&4
2997                 if test "X$up" = X -o "X$low" = X; then
2998                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2999                     rs) up='[A-IJ-RS-Z]'
3000                         low='[a-ij-rs-z]'
3001                         ;;
3002                     esac
3003                 fi
3004                 if test "X$up" = X -o "X$low" = X; then
3005                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3006                     rs) up='A-IJ-RS-Z'
3007                         low='a-ij-rs-z'
3008                         ;;
3009                     esac
3010                 fi
3011                 ;;
3012             esac
3013         fi
3014 esac
3015 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3016 rs)
3017     echo "Using $up and $low to convert case." >&4
3018     ;;
3019 *)
3020     echo "I don't know how to translate letters from upper to lower case." >&4
3021     echo "Your tr is not acting any way I know of." >&4
3022     exit 1
3023     ;;
3024 esac
3025 : set up the translation script tr, must be called with ./tr of course
3026 cat >tr <<EOSC
3027 $startsh
3028 case "\$1\$2" in
3029 '[A-Z][a-z]') exec $tr '$up' '$low';;
3030 '[a-z][A-Z]') exec $tr '$low' '$up';;
3031 esac
3032 exec $tr "\$@"
3033 EOSC
3034 chmod +x tr
3035 $eunicefix tr
3036
3037 : Try to determine whether config.sh was made on this system
3038 case "$config_sh" in
3039 '')
3040 myuname=`$uname -a 2>/dev/null`
3041 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3042 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3043 # because the A-Z/a-z are not consecutive.
3044 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3045         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3046 newmyuname="$myuname"
3047 dflt=n
3048 case "$knowitall" in
3049 '')
3050         if test -f ../config.sh; then
3051                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3052                         eval "`grep myuname= ../config.sh`"
3053                 fi
3054                 if test "X$myuname" = "X$newmyuname"; then
3055                         dflt=y
3056                 fi
3057         fi
3058         ;;
3059 *) dflt=y;;
3060 esac
3061
3062 : Get old answers from old config file if Configure was run on the
3063 : same system, otherwise use the hints.
3064 hint=default
3065 cd ..
3066 if test -f config.sh; then
3067         echo " "
3068         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3069         . UU/myread
3070         case "$ans" in
3071         n*|N*) echo "OK, I'll ignore it."
3072                 mv config.sh config.sh.old
3073                 myuname="$newmyuname"
3074                 ;;
3075         *)  echo "Fetching default answers from your old config.sh file..." >&4
3076                 tmp_n="$n"
3077                 tmp_c="$c"
3078                 tmp_sh="$sh"
3079                 . ./config.sh
3080                 cp config.sh UU
3081                 n="$tmp_n"
3082                 c="$tmp_c"
3083                 : Older versions did not always set $sh.  Catch re-use of such
3084                 : an old config.sh.
3085                 case "$sh" in
3086                 '') sh="$tmp_sh" ;;
3087                 esac
3088                 hint=previous
3089                 ;;
3090         esac
3091 fi
3092 . ./UU/checkcc
3093 if test ! -f config.sh; then
3094         $cat <<EOM
3095
3096 First time through, eh?  I have some defaults handy for some systems
3097 that need some extra help getting the Configure answers right:
3098
3099 EOM
3100         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3101         dflt=''
3102         : Half the following guesses are probably wrong... If you have better
3103         : tests or hints, please send them to perlbug@perl.org
3104         : The metaconfig authors would also appreciate a copy...
3105         $test -f /irix && osname=irix
3106         $test -f /xenix && osname=sco_xenix
3107         $test -f /dynix && osname=dynix
3108         $test -f /dnix && osname=dnix
3109         $test -f /lynx.os && osname=lynxos
3110         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3111         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3112         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3113         $test -f /bin/mips && /bin/mips && osname=mips
3114         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3115                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3116         $test -d /usr/apollo/bin && osname=apollo
3117         $test -f /etc/saf/_sactab && osname=svr4
3118         $test -d /usr/include/minix && osname=minix
3119         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3120         if $test -d /MachTen -o -d /MachTen_Folder; then
3121                 osname=machten
3122                 if $test -x /sbin/version; then
3123                         osvers=`/sbin/version | $awk '{print $2}' |
3124                         $sed -e 's/[A-Za-z]$//'`
3125                 elif $test -x /usr/etc/version; then
3126                         osvers=`/usr/etc/version | $awk '{print $2}' |
3127                         $sed -e 's/[A-Za-z]$//'`
3128                 else
3129                         osvers="$2.$3"
3130                 fi
3131         fi
3132
3133         $test -f /sys/posix.dll &&
3134                 $test -f /usr/bin/what &&
3135                 set X `/usr/bin/what /sys/posix.dll` &&
3136                 $test "$3" = UWIN &&
3137                 osname=uwin &&
3138                 osvers="$5"
3139
3140         if $test -f $uname; then
3141                 set X $myuname
3142                 shift
3143
3144                 case "$5" in
3145                 fps*) osname=fps ;;
3146                 mips*)
3147                         case "$4" in
3148                         umips) osname=umips ;;
3149                         *) osname=mips ;;
3150                         esac;;
3151                 [23]100) osname=mips ;;
3152                 next*) osname=next ;;
3153                 i386*)
3154                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3155                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3156                                 osname='sco'
3157                                 osvers=$tmp
3158                         elif $test -f /etc/kconfig; then
3159                                 osname=isc
3160                                 if test "$lns" = "$ln -s"; then
3161                                         osvers=4
3162                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3163                                         osvers=3
3164                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3165                                         osvers=2
3166                                 fi
3167                         fi
3168                         tmp=''
3169                         ;;
3170                 pc*)
3171                         if test -n "$DJGPP"; then
3172                                 osname=dos
3173                                 osvers=djgpp
3174                         fi
3175                         ;;
3176                 esac
3177
3178                 case "$1" in
3179                 aix) osname=aix
3180                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3181                         case "$tmp" in
3182                         # oslevel can fail with:
3183                         # oslevel: Unable to acquire lock.
3184                         *not\ found) osvers="$4"."$3" ;;
3185                         '<3240'|'<>3240') osvers=3.2.0 ;;
3186                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3187                         '=3250'|'>3250') osvers=3.2.5 ;;
3188                         *) osvers=$tmp;;
3189                         esac
3190                         ;;
3191                 bsd386) osname=bsd386
3192                         osvers=`$uname -r`
3193                         ;;
3194                 cygwin*) osname=cygwin
3195                         osvers="$3"
3196                         ;;
3197                 *dc.osx) osname=dcosx
3198                         osvers="$3"
3199                         ;;
3200                 dnix) osname=dnix
3201                         osvers="$3"
3202                         ;;
3203                 domainos) osname=apollo
3204                         osvers="$3"
3205                         ;;
3206                 dgux)   osname=dgux
3207                         osvers="$3"
3208                         ;;
3209                 dragonfly) osname=dragonfly
3210                         osvers="$3"
3211                         ;;
3212                 dynixptx*) osname=dynixptx
3213                         osvers=`echo "$4"|sed 's/^v//'`
3214                         ;;
3215                 freebsd) osname=freebsd
3216                         osvers="$3" ;;
3217                 genix)  osname=genix ;;
3218                 gnu)    osname=gnu
3219                         osvers="$3" ;;
3220                 hp*)    osname=hpux
3221                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3222                         ;;
3223                 irix*)  osname=irix
3224                         case "$3" in
3225                         4*) osvers=4 ;;
3226                         5*) osvers=5 ;;
3227                         *)      osvers="$3" ;;
3228                         esac
3229                         ;;
3230                 linux)  osname=linux
3231                         case "$3" in
3232                         *)      osvers="$3" ;;
3233                         esac
3234                         ;;
3235                 MiNT)   osname=mint
3236                         ;;
3237                 netbsd*) osname=netbsd
3238                         osvers="$3"
3239                         ;;
3240                 news-os) osvers="$3"
3241                         case "$3" in
3242                         4*) osname=newsos4 ;;
3243                         *) osname=newsos ;;
3244                         esac
3245                         ;;
3246                 next*) osname=next ;;
3247                 nonstop-ux) osname=nonstopux ;;
3248                 openbsd) osname=openbsd
3249                         osvers="$3"
3250                         ;;
3251                 os2)    osname=os2
3252                         osvers="$4"
3253                         ;;
3254                 POSIX-BC | posix-bc ) osname=posix-bc
3255                         osvers="$3"
3256                         ;;
3257                 powerux | power_ux | powermax_os | powermaxos | \
3258                 powerunix | power_unix) osname=powerux
3259                         osvers="$3"
3260                         ;;
3261                 qnx) osname=qnx
3262                         osvers="$4"
3263                         ;;
3264                 solaris) osname=solaris
3265                         case "$3" in
3266                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3267                         *)      osvers="$3" ;;
3268                         esac
3269                         ;;
3270                 sunos) osname=sunos
3271                         case "$3" in
3272                         5*) osname=solaris
3273                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3274                         *)      osvers="$3" ;;
3275                         esac
3276                         ;;
3277                 titanos) osname=titanos
3278                         case "$3" in
3279                         1*) osvers=1 ;;
3280                         2*) osvers=2 ;;
3281                         3*) osvers=3 ;;
3282                         4*) osvers=4 ;;
3283                         *)      osvers="$3" ;;
3284                         esac
3285                         ;;
3286                 ultrix) osname=ultrix
3287                         osvers="$3"
3288                         ;;
3289                 osf1|mls+)      case "$5" in
3290                                 alpha)
3291                                         osname=dec_osf
3292                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3293                                         case "$osvers" in
3294                                         [1-9].[0-9]*) ;;
3295                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3296                                         esac
3297                                         ;;
3298                         hp*)    osname=hp_osf1  ;;
3299                         mips)   osname=mips_osf1 ;;
3300                         esac
3301                         ;;
3302                 # UnixWare 7.1.2 is known as Open UNIX 8
3303                 openunix|unixware) osname=svr5
3304                         osvers="$4"
3305                         ;;
3306                 uts)    osname=uts
3307                         osvers="$3"
3308                         ;;
3309                 vos) osvers="$3"
3310                         ;;
3311                 $2) case "$osname" in
3312                         *isc*) ;;
3313                         *freebsd*) ;;
3314                         svr*)
3315                                 : svr4.x or possibly later
3316                                 case "svr$3" in
3317                                 ${osname}*)
3318                                         osname=svr$3
3319                                         osvers=$4
3320                                         ;;
3321                                 esac
3322                                 case "$osname" in
3323                                 svr4.0)
3324                                         : Check for ESIX
3325                                         if test -f /stand/boot ; then
3326                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3327                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3328                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3329                                                         if test -n "$isesix"; then
3330                                                                 osname=esix4
3331                                                         fi
3332                                                 fi
3333                                         fi
3334                                         ;;
3335                                 esac
3336                                 ;;
3337                         *)      if test -f /etc/systemid; then
3338                                         osname=sco
3339                                         set `echo $3 | $sed 's/\./ /g'` $4
3340                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3341                                                 osvers=$1.$2.$3
3342                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3343                                                 osvers=$1.$2
3344                                         elif $test -f $src/hints/sco_$1.sh; then
3345                                                 osvers=$1
3346                                         fi
3347                                 else
3348                                         case "$osname" in
3349                                         '') : Still unknown.  Probably a generic Sys V.
3350                                                 osname="sysv"
3351                                                 osvers="$3"
3352                                                 ;;
3353                                         esac
3354                                 fi
3355                                 ;;
3356                         esac
3357                         ;;
3358                 *)      case "$osname" in
3359                         '') : Still unknown.  Probably a generic BSD.
3360                                 osname="$1"
3361                                 osvers="$3"
3362                                 ;;
3363                         esac
3364                         ;;
3365                 esac
3366         else
3367                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3368                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3369                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3370                                 osname=news_os
3371                         fi
3372                         $rm -f UU/kernel.what
3373                 elif test -d c:/. -o -n "$is_os2" ; then
3374                         set X $myuname
3375                         osname=os2
3376                         osvers="$5"
3377                 fi
3378         fi
3379
3380         case "$targetarch" in
3381         '') ;;
3382         *)  hostarch=$osname
3383             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3384             osvers=''
3385             ;;
3386         esac
3387
3388         : Now look for a hint file osname_osvers, unless one has been
3389         : specified already.
3390         case "$hintfile" in
3391         ''|' ')
3392                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3393                 : Also try without trailing minor version numbers.
3394                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3395                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3396                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3397                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3398                 case "$file" in
3399                 '') dflt=none ;;
3400                 *)  case "$osvers" in
3401                         '') dflt=$file
3402                                 ;;
3403                         *)  if $test -f $src/hints/$file.sh ; then
3404                                         dflt=$file
3405                                 elif $test -f $src/hints/$xfile.sh ; then
3406                                         dflt=$xfile
3407                                 elif $test -f $src/hints/$xxfile.sh ; then
3408                                         dflt=$xxfile
3409                                 elif $test -f $src/hints/$xxxfile.sh ; then
3410                                         dflt=$xxxfile
3411                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3412                                         dflt=$xxxxfile
3413                                 elif $test -f "$src/hints/${osname}.sh" ; then
3414                                         dflt="${osname}"
3415                                 else
3416                                         dflt=none
3417                                 fi
3418                                 ;;
3419                         esac
3420                         ;;
3421                 esac
3422                 if $test -f Policy.sh ; then
3423                         case "$dflt" in
3424                         *Policy*) ;;
3425                         none) dflt="Policy" ;;
3426                         *) dflt="Policy $dflt" ;;
3427                         esac
3428                 fi
3429                 ;;
3430         *)
3431                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3432                 ;;
3433         esac
3434
3435         if $test -f Policy.sh ; then
3436                 $cat <<EOM
3437
3438 There's also a Policy hint file available, which should make the
3439 site-specific (policy) questions easier to answer.
3440 EOM
3441
3442         fi
3443
3444         $cat <<EOM
3445
3446 You may give one or more space-separated answers, or "none" if appropriate.
3447 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3448 previous run of Configure, you may specify it as well as or instead of
3449 OS-specific hints.  If hints are provided for your OS, you should use them:
3450 although Perl can probably be built without hints on many platforms, using
3451 hints often improve performance and may enable features that Configure can't
3452 set up on its own. If there are no hints that match your OS, specify "none";
3453 DO NOT give a wrong version or a wrong OS.
3454
3455 EOM
3456
3457         rp="Which of these apply, if any?"
3458         . UU/myread
3459         tans=$ans
3460         for file in $tans; do
3461                 if $test X$file = XPolicy -a -f Policy.sh; then
3462                         . Policy.sh
3463                         $cat Policy.sh >> UU/config.sh
3464                 elif $test -f $src/hints/$file.sh; then
3465                         . $src/hints/$file.sh
3466                         $cat $src/hints/$file.sh >> UU/config.sh
3467                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3468                         : nothing
3469                 else
3470                         : Give one chance to correct a possible typo.
3471                         echo "$file.sh does not exist"
3472                         dflt=$file
3473                         rp="hint to use instead?"
3474                         . UU/myread
3475                         for file in $ans; do
3476                                 if $test -f "$src/hints/$file.sh"; then
3477                                         . $src/hints/$file.sh
3478                                         $cat $src/hints/$file.sh >> UU/config.sh
3479                                 elif $test X$ans = X -o X$ans = Xnone ; then
3480                                         : nothing
3481                                 else
3482                                         echo "$file.sh does not exist -- ignored."
3483                                 fi
3484                         done
3485                 fi
3486         done
3487
3488         hint=recommended
3489         : Remember our hint file for later.
3490         if $test -f "$src/hints/$file.sh" ; then
3491                 hintfile="$file"
3492         else
3493                 hintfile=''
3494         fi
3495 fi
3496 cd UU
3497 ;;
3498 *)
3499         echo " "
3500         echo "Fetching default answers from $config_sh..." >&4
3501         tmp_n="$n"
3502         tmp_c="$c"
3503         cd ..
3504         cp $config_sh config.sh 2>/dev/null
3505         chmod +w config.sh
3506         . ./config.sh
3507         cd UU
3508         cp ../config.sh .
3509         n="$tmp_n"
3510         c="$tmp_c"
3511         hint=previous
3512         ;;
3513 esac
3514 test "$override" && . ./optdef.sh
3515
3516 : Restore computed paths
3517 for file in $loclist $trylist; do
3518         eval $file="\$_$file"
3519 done
3520
3521 cat << EOM
3522
3523 Configure uses the operating system name and version to set some defaults.
3524 The default value is probably right if the name rings a bell. Otherwise,
3525 since spelling matters for me, either accept the default or answer "none"
3526 to leave it blank.
3527
3528 EOM
3529 case "$osname" in
3530         ''|' ')
3531                 case "$hintfile" in
3532                 ''|' '|none) dflt=none ;;
3533                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3534                 esac
3535                 ;;
3536         *) dflt="$osname" ;;
3537 esac
3538 rp="Operating system name?"
3539 . ./myread
3540 case "$ans" in
3541 none)  osname='' ;;
3542 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3543 esac
3544 echo " "
3545 case "$osvers" in
3546         ''|' ')
3547                 case "$hintfile" in
3548                 ''|' '|none) dflt=none ;;
3549                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3550                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3551                         case "$dflt" in
3552                         ''|' ') dflt=none ;;
3553                         esac
3554                         ;;
3555                 esac
3556                 ;;
3557         *) dflt="$osvers" ;;
3558 esac
3559 rp="Operating system version?"
3560 . ./myread
3561 case "$ans" in
3562 none)  osvers='' ;;
3563 *) osvers="$ans" ;;
3564 esac
3565
3566
3567 . ./posthint.sh
3568
3569 : who configured the system
3570 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3571 case "$cf_by" in
3572 "")
3573         cf_by=`(logname) 2>/dev/null`
3574         case "$cf_by" in
3575         "")
3576                 cf_by=`(whoami) 2>/dev/null`
3577                 case "$cf_by" in
3578                 "") cf_by=unknown ;;
3579                 esac ;;
3580         esac ;;
3581 esac
3582
3583 : decide how portable to be.  Allow command line overrides.
3584 case "$d_portable" in
3585 "$undef") ;;
3586 *)      d_portable="$define" ;;
3587 esac
3588
3589 : set up shell script to do ~ expansion
3590 cat >filexp <<EOSS
3591 $startsh
3592 : expand filename
3593 case "\$1" in
3594  ~/*|~)
3595         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3596         ;;
3597  ~*)
3598         if $test -f /bin/csh; then
3599                 /bin/csh -f -c "glob \$1"
3600                 failed=\$?
3601                 echo ""
3602                 exit \$failed
3603         else
3604                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3605                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3606                 if $test ! -d "\$dir"; then
3607                         me=\`basename \$0\`
3608                         echo "\$me: can't locate home directory for: \$name" >&2
3609                         exit 1
3610                 fi
3611                 case "\$1" in
3612                 */*)
3613                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3614                         ;;
3615                 *)
3616                         echo \$dir
3617                         ;;
3618                 esac
3619         fi
3620         ;;
3621 *)
3622         echo \$1
3623         ;;
3624 esac
3625 EOSS
3626 chmod +x filexp
3627 $eunicefix filexp
3628
3629 : now set up to get a file name
3630 cat <<EOS >getfile
3631 $startsh
3632 EOS
3633 cat <<'EOSC' >>getfile
3634 tilde=''
3635 fullpath=''
3636 already=''
3637 skip=''
3638 none_ok=''
3639 exp_file=''
3640 nopath_ok=''
3641 orig_rp="$rp"
3642 orig_dflt="$dflt"
3643 case "$gfpth" in
3644 '') gfpth='.' ;;
3645 esac
3646
3647 case "$fn" in
3648 *\(*)
3649         : getfile will accept an answer from the comma-separated list
3650         : enclosed in parentheses even if it does not meet other criteria.
3651         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3652         fn=`echo $fn | sed 's/(.*)//'`
3653         ;;
3654 esac
3655
3656 case "$fn" in
3657 *:*)
3658         loc_file=`expr $fn : '.*:\(.*\)'`
3659         fn=`expr $fn : '\(.*\):.*'`
3660         ;;
3661 esac
3662
3663 case "$fn" in
3664 *~*) tilde=true;;
3665 esac
3666 case "$fn" in
3667 */*) fullpath=true;;
3668 esac
3669 case "$fn" in
3670 *+*) skip=true;;
3671 esac
3672 case "$fn" in
3673 *n*) none_ok=true;;
3674 esac
3675 case "$fn" in
3676 *e*) exp_file=true;;
3677 esac
3678 case "$fn" in
3679 *p*) nopath_ok=true;;
3680 esac
3681
3682 case "$fn" in
3683 *f*) type='File';;
3684 *d*) type='Directory';;
3685 *l*) type='Locate';;
3686 esac
3687
3688 what="$type"
3689 case "$what" in
3690 Locate) what='File';;
3691 esac
3692
3693 case "$exp_file" in
3694 '')
3695         case "$d_portable" in
3696         "$define") ;;
3697         *) exp_file=true;;
3698         esac
3699         ;;
3700 esac
3701
3702 cd ..
3703 while test "$type"; do
3704         redo=''
3705         rp="$orig_rp"
3706         dflt="$orig_dflt"
3707         case "$tilde" in
3708         true) rp="$rp (~name ok)";;
3709         esac
3710         . UU/myread
3711         if test -f UU/getfile.ok && \
3712                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3713         then
3714                 value="$ans"
3715                 ansexp="$ans"
3716                 break
3717         fi
3718         case "$ans" in
3719         none)
3720                 value=''
3721                 ansexp=''
3722                 case "$none_ok" in
3723                 true) type='';;
3724                 esac
3725                 ;;
3726         *)
3727                 case "$tilde" in
3728                 '') value="$ans"
3729                         ansexp="$ans";;
3730                 *)
3731                         value=`UU/filexp $ans`
3732                         case $? in
3733                         0)
3734                                 if test "$ans" != "$value"; then
3735                                         echo "(That expands to $value on this system.)"
3736                                 fi
3737                                 ;;
3738                         *) value="$ans";;
3739                         esac
3740                         ansexp="$value"
3741                         case "$exp_file" in
3742                         '') value="$ans";;
3743                         esac
3744                         ;;
3745                 esac
3746                 case "$fullpath" in
3747                 true)
3748                         case "$ansexp" in
3749                         /*) value="$ansexp" ;;
3750                         [a-zA-Z]:/*) value="$ansexp" ;;
3751                         *)
3752                                 redo=true
3753                                 case "$already" in
3754                                 true)
3755                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3756                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3757                                         ;;
3758                                 *)
3759                                 echo "Please give a full path name, starting with slash." >&4
3760                                         case "$tilde" in
3761                                         true)
3762                                 echo "Note that using ~name is ok provided it expands well." >&4
3763                                                 already=true
3764                                                 ;;
3765                                         esac
3766                                 esac
3767                                 ;;
3768                         esac
3769                         ;;
3770                 esac
3771                 case "$redo" in
3772                 '')
3773                         case "$type" in
3774                         File)
3775                                 for fp in $gfpth; do
3776                                         if test "X$fp" = X.; then
3777                                             pf="$ansexp"
3778                                         else    
3779                                             pf="$fp/$ansexp"
3780                                         fi
3781                                         if test -f "$pf"; then
3782                                                 type=''
3783                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3784                                         then
3785                                                 echo "($value is not a plain file, but that's ok.)"
3786                                                 type=''
3787                                         fi
3788                                         if test X"$type" = X; then
3789                                             value="$pf"
3790                                             break
3791                                         fi
3792                                 done
3793                                 ;;
3794                         Directory)
3795                                 for fp in $gfpth; do
3796                                         if test "X$fp" = X.; then
3797                                             dir="$ans"
3798                                             direxp="$ansexp"
3799                                         else    
3800                                             dir="$fp/$ansexp"
3801                                             direxp="$fp/$ansexp"
3802                                         fi
3803                                         if test -d "$direxp"; then
3804                                                 type=''
3805                                                 value="$dir"
3806                                                 break
3807                                         fi
3808                                 done
3809                                 ;;
3810                         Locate)
3811                                 if test -d "$ansexp"; then
3812                                         echo "(Looking for $loc_file in directory $value.)"
3813                                         value="$value/$loc_file"
3814                                         ansexp="$ansexp/$loc_file"
3815                                 fi
3816                                 if test -f "$ansexp"; then
3817                                         type=''
3818                                 fi
3819                                 case "$nopath_ok" in
3820                                 true)   case "$value" in
3821                                         */*) ;;
3822                                         *)      echo "Assuming $value will be in people's path."
3823                                                 type=''
3824                                                 ;;
3825                                         esac
3826                                         ;;
3827                                 esac
3828                                 ;;
3829                         esac
3830
3831                         case "$skip" in
3832                         true) type='';
3833                         esac
3834
3835                         case "$type" in
3836                         '') ;;
3837                         *)
3838                                 if test "$fastread" = yes; then
3839                                         dflt=y
3840                                 else
3841                                         dflt=n
3842                                 fi
3843                                 rp="$what $value doesn't exist.  Use that name anyway?"
3844                                 . UU/myread
3845                                 dflt=''
3846                                 case "$ans" in
3847                                 y*) type='';;
3848                                 *) echo " ";;
3849                                 esac
3850                                 ;;
3851                         esac
3852                         ;;
3853                 esac
3854                 ;;
3855         esac
3856 done
3857 cd UU
3858 ans="$value"
3859 rp="$orig_rp"
3860 dflt="$orig_dflt"
3861 rm -f getfile.ok
3862 test "X$gfpthkeep" != Xy && gfpth=""
3863 EOSC
3864
3865 : determine root of directory hierarchy where package will be installed.
3866 case "$prefix" in
3867 '')
3868         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3869         ;;
3870 *?/)
3871         dflt=`echo "$prefix" | sed 's/.$//'`
3872         ;;
3873 *)
3874         dflt="$prefix"
3875         ;;
3876 esac
3877 $cat <<EOM
3878
3879 By default, $package will be installed in $dflt/bin, manual pages
3880 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3881 installation directories. Typically this is something like /usr/local.
3882 If you wish to have binaries under /usr/bin but other parts of the
3883 installation under /usr/local, that's ok: you will be prompted
3884 separately for each of the installation directories, the prefix being
3885 only used to set the defaults.
3886
3887 EOM
3888 fn=d~
3889 rp='Installation prefix to use?'
3890 . ./getfile
3891 oldprefix=''
3892 case "$prefix" in
3893 '') ;;
3894 *)
3895         case "$ans" in
3896         "$prefix") ;;
3897         *) oldprefix="$prefix";;
3898         esac
3899         ;;
3900 esac
3901 prefix="$ans"
3902 prefixexp="$ansexp"
3903
3904 case "$afsroot" in
3905 '')     afsroot=/afs ;;
3906 *)      afsroot=$afsroot ;;
3907 esac
3908
3909 : is AFS running?
3910 echo " "
3911 case "$afs" in
3912 $define|true)   afs=true ;;
3913 $undef|false)   afs=false ;;
3914 *)      if test -d $afsroot; then
3915                 afs=true
3916         else
3917                 afs=false
3918         fi
3919         ;;
3920 esac
3921 if $afs; then
3922         echo "AFS may be running... I'll be extra cautious then..." >&4
3923 else
3924         echo "AFS does not seem to be running..." >&4
3925 fi
3926
3927 : determine installation prefix for where package is to be installed.
3928 if $afs; then 
3929 $cat <<EOM
3930
3931 Since you are running AFS, I need to distinguish the directory in which
3932 files will reside from the directory in which they are installed (and from
3933 which they are presumably copied to the former directory by occult means).
3934
3935 EOM
3936         case "$installprefix" in
3937         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3938         *) dflt="$installprefix";;
3939         esac
3940 else
3941 $cat <<EOM
3942
3943 In some special cases, particularly when building $package for distribution,
3944 it is convenient to distinguish the directory in which files should be
3945 installed from the directory ($prefix) in which they will
3946 eventually reside.  For most users, these two directories are the same.
3947
3948 EOM
3949         case "$installprefix" in
3950         '') dflt=$prefix ;;
3951         *) dflt=$installprefix;;
3952         esac
3953 fi
3954 fn=d~
3955 rp='What installation prefix should I use for installing files?'
3956 . ./getfile
3957 installprefix="$ans"
3958 installprefixexp="$ansexp"
3959
3960 : Perform the prefixexp/installprefixexp correction if necessary
3961 cat <<EOS >installprefix
3962 $startsh
3963 EOS
3964 cat <<'EOSC' >>installprefix
3965 : Change installation prefix, if necessary.
3966 if $test X"$prefix" != X"$installprefix"; then
3967     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3968 else
3969     eval "install${prefixvar}=\"\$${prefixvar}exp\""
3970 fi
3971 EOSC
3972 chmod +x installprefix
3973 $eunicefix installprefix
3974
3975 : Set variables such as privlib and privlibexp from the output of ./getfile
3976 : performing the prefixexp/installprefixexp correction if necessary.
3977 cat <<EOS >setprefixvar
3978 $startsh
3979 EOS
3980 cat <<'EOSC' >>setprefixvar
3981 eval "${prefixvar}=\"\$ans\""
3982 eval "${prefixvar}exp=\"\$ansexp\""
3983 . ./installprefix
3984 EOSC
3985 chmod +x setprefixvar
3986 $eunicefix setprefixvar
3987
3988 : set up the script used to warn in case of inconsistency
3989 cat <<EOS >whoa
3990 $startsh
3991 EOS
3992 cat <<'EOSC' >>whoa
3993 dflt=y
3994 case "$hint" in
3995     recommended)
3996         case "$hintfile" in
3997         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
3998                 ;;
3999         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4000                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4001                 ;;
4002         esac
4003         ;;
4004     *)  echo " "
4005         echo "*** WHOA THERE!!! ***" >&4
4006         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4007         ;;
4008 esac
4009 rp="    Keep the $hint value?"
4010 . ./myread
4011 case "$ans" in
4012 y) td=$was; tu=$was;;
4013 esac
4014 EOSC
4015
4016 : function used to set $1 to $val
4017 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4018 case "$val$was" in
4019 $define$undef) . ./whoa; eval "$var=\$td";;
4020 $undef$define) . ./whoa; eval "$var=\$tu";;
4021 *) eval "$var=$val";;
4022 esac'
4023
4024 case "$usesocks" in
4025 $define|true|[yY]*)     dflt='y';;
4026 *) dflt='n';;
4027 esac
4028 cat <<EOM
4029
4030 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4031 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4032 to use the PerlIO abstraction layer, this will be implicitly selected.
4033
4034 If this doesn't make any sense to you, just accept the default '$dflt'.
4035 EOM
4036 rp='Build Perl for SOCKS?'
4037 . ./myread
4038 case "$ans" in
4039 y|Y)    val="$define" ;;
4040 *)      val="$undef" ;;
4041 esac
4042 set usesocks
4043 eval $setvar
4044
4045 case "$usesocks" in
4046 $define|true|[yY]*) useperlio="$define";;
4047 esac
4048
4049 case "$useperlio" in
4050 $define|true|[yY]*|'')  dflt='y';;
4051 *) dflt='n';;
4052 esac
4053 cat <<EOM
4054
4055 Previous version of $package used the standard IO mechanisms as
4056 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4057 alternate IO mechanisms via the PerlIO abstraction layer, but the
4058 stdio mechanism is still available if needed.  The abstraction layer
4059 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4060 Using PerlIO with sfio may cause problems with some extension modules.
4061
4062 If this doesn't make any sense to you, just accept the default '$dflt'.
4063 EOM
4064 rp='Use the PerlIO abstraction layer?'
4065 . ./myread
4066 case "$ans" in
4067 y|Y) 
4068         val="$define"
4069         ;;
4070 *)      
4071         echo "Ok, doing things the stdio way."
4072         val="$undef"
4073         ;;
4074 esac
4075 set useperlio
4076 eval $setvar 
4077
4078 case "$usesocks" in
4079 $define|true|[yY]*)
4080         case "$useperlio" in
4081         $define|true|[yY]*) ;;
4082         *)      cat >&4 <<EOM
4083
4084 You are using the SOCKS proxy protocol library which means that you
4085 should also use the PerlIO layer.  You may be headed for trouble.
4086
4087 EOM
4088                 ;;
4089         esac
4090         ;;
4091 esac
4092
4093         
4094 : get the patchlevel
4095 echo " "
4096 echo "Getting the current patchlevel..." >&4
4097 if $test -r $rsrc/patchlevel.h;then
4098         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4099         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4100         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4101         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4102         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4103         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4104         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4105 else
4106         revision=0
4107         patchlevel=0
4108         subversion=0
4109         api_revision=0
4110         api_version=0
4111         api_subversion=0
4112         perl_patchlevel=0
4113         $echo "(You do not have patchlevel.h.  Eek.)"
4114 fi
4115 if $test -r $rsrc/.patch ; then
4116         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4117                 perl_patchlevel=`cat $rsrc/.patch`
4118         fi
4119 fi
4120 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4121 version_patchlevel_string="version $patchlevel subversion $subversion"
4122 case "$perl_patchlevel" in
4123 0|'') ;;
4124 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
4125 esac
4126
4127 $echo "(You have $package $version_patchlevel_string.)"
4128
4129 case "$osname" in
4130 dos|vms)
4131         : XXX Should be a Configure test for double-dots in filenames.
4132         version=`echo $revision $patchlevel $subversion | \
4133                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4134         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4135                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4136         ;;
4137 *)
4138         version=`echo $revision $patchlevel $subversion | \
4139                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4140         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4141                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4142         ;;
4143 esac
4144 : Special case the 5.005_xx maintenance series, which used 5.005
4145 : without any subversion label as a subdirectory in $sitelib
4146 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4147         api_versionstring='5.005'
4148 fi
4149
4150 : Do we want threads support and if so, what type
4151 case "$usethreads" in
4152 $define|true|[yY]*)     dflt='y';;
4153 *)     # Catch case where user specified ithreads or 5005threads but
4154        # forgot -Dusethreads (A.D. 4/2002)
4155        case "$useithreads$use5005threads" in
4156        *$define*)
4157                 case "$useperlio" in
4158                 "$define")      dflt='y' ;;
4159                 *)              dflt='n' ;;
4160                 esac
4161                 ;;
4162        *)       dflt='n';;
4163        esac
4164        ;;
4165 esac
4166 cat <<EOM
4167
4168 Perl can be built to take advantage of threads on some systems.
4169 To do so, Configure can be run with -Dusethreads.
4170
4171 Note that Perl built with threading support runs slightly slower
4172 and uses more memory than plain Perl. The current implementation
4173 is believed to be stable, but it is fairly new, and so should be
4174 treated with caution.
4175
4176 If this doesn't make any sense to you, just accept the default '$dflt'.
4177 EOM
4178 rp='Build a threading Perl?'
4179 . ./myread
4180 case "$ans" in
4181 y|Y)    val="$define" ;;
4182 *)      val="$undef" ;;
4183 esac
4184 set usethreads
4185 eval $setvar
4186
4187 if $test $patchlevel -lt 9; then
4188     case "$usethreads" in
4189     $define)
4190         $cat <<EOM
4191
4192 Since release 5.6, Perl has had two different threading implementations,
4193 the newer interpreter-based version (ithreads) with one interpreter per
4194 thread, and the older 5.005 version (5005threads).
4195 The 5005threads version is effectively unmaintained and will probably be
4196 removed in Perl 5.10, so there should be no need to build a Perl using it
4197 unless needed for backwards compatibility with some existing 5.005threads
4198 code.
4199
4200 EOM
4201         : Default to ithreads unless overridden on command line or with
4202         : old config.sh
4203         dflt='y'
4204         case "$use5005threads" in
4205                 $define|true|[yY]*) dflt='n';;
4206         esac
4207         case "$useithreads" in
4208                 $undef|false|[nN]*) dflt='n';;
4209         esac
4210         rp='Use the newer interpreter-based ithreads?'
4211         . ./myread
4212         case "$ans" in
4213         y|Y)    val="$define" ;;
4214         *)      val="$undef" ;;
4215         esac
4216         set useithreads
4217         eval $setvar
4218         : Now set use5005threads to the opposite value.
4219         case "$useithreads" in
4220         $define) val="$undef" ;;
4221         *) val="$define" ;;
4222         esac
4223         set use5005threads
4224         eval $setvar
4225         ;;
4226     *)
4227         useithreads="$undef"
4228         use5005threads="$undef"
4229         ;;
4230     esac
4231
4232     case "$useithreads$use5005threads" in
4233     "$define$define")
4234         $cat >&4 <<EOM
4235
4236 You cannot have both the ithreads and the 5.005 threads enabled
4237 at the same time.  Disabling the 5.005 threads since they are
4238 much less stable than the ithreads.
4239
4240 EOM
4241         use5005threads="$undef"
4242         ;;
4243     esac
4244
4245 else
4246 : perl-5.9.x and later
4247
4248     if test X"$usethreads" = "X$define"; then
4249         case "$use5005threads" in
4250             $define|true|[yY]*)
4251                 $cat >&4 <<EOM
4252
4253 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4254
4255 EOM
4256             ;;
4257         esac
4258     fi
4259
4260     use5005threads="$undef"
4261     useithreads="$usethreads"
4262 fi
4263
4264 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4265         cat >&4 <<EOF
4266 ***
4267 *** To build with ithreads you must also use the PerlIO layer.
4268 *** Cannot continue, aborting.
4269 ***
4270 EOF
4271         exit 1
4272 fi
4273
4274 case "$d_oldpthreads" in
4275 '')     : Configure tests would be welcome here.  For now, assume undef.
4276         val="$undef" ;;
4277 *)      val="$d_oldpthreads" ;;
4278 esac
4279 set d_oldpthreads
4280 eval $setvar
4281
4282
4283 : Look for a hint-file generated 'call-back-unit'.  If the
4284 : user has specified that a threading perl is to be built,
4285 : we may need to set or change some other defaults.
4286 if $test -f usethreads.cbu; then
4287     echo "Your platform has some specific hints regarding threaded builds, using them..."
4288     . ./usethreads.cbu
4289 else
4290     case "$usethreads" in
4291         "$define"|true|[yY]*)
4292                 $cat <<EOM
4293 (Your platform does not have any specific hints for threaded builds.
4294  Assuming POSIX threads, then.)
4295 EOM
4296         ;;
4297     esac
4298 fi
4299
4300 cat <<EOM
4301
4302 Perl can be built so that multiple Perl interpreters can coexist
4303 within the same Perl executable.
4304 EOM
4305
4306 case "$useithreads" in
4307 $define)
4308         cat <<EOM
4309 This multiple interpreter support is required for interpreter-based threads.
4310 EOM
4311         val="$define"
4312         ;;
4313 *)      case "$usemultiplicity" in
4314         $define|true|[yY]*)     dflt='y';;
4315         *) dflt='n';;
4316         esac
4317         echo " "
4318         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4319         rp='Build Perl for multiplicity?'
4320         . ./myread
4321         case "$ans" in
4322         y|Y)    val="$define" ;;
4323         *)      val="$undef" ;;
4324         esac
4325         ;;
4326 esac
4327 set usemultiplicity
4328 eval $setvar
4329
4330
4331 case "$usemorebits" in
4332 "$define"|true|[yY]*)
4333         use64bitint="$define"
4334         uselongdouble="$define"
4335         usemorebits="$define"
4336         ;;
4337 *)      usemorebits="$undef"
4338         ;;
4339 esac
4340
4341 : make some quick guesses about what we are up against
4342 echo " "
4343 $echo $n "Hmm...  $c"
4344 echo exit 1 >bsd
4345 echo exit 1 >usg
4346 echo exit 1 >v7
4347 echo exit 1 >osf1
4348 echo exit 1 >eunice
4349 echo exit 1 >xenix
4350 echo exit 1 >venix
4351 echo exit 1 >os2
4352 d_bsd="$undef"
4353 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4354 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4355 then
4356         echo "Looks kind of like an OSF/1 system, but we'll see..."
4357         echo exit 0 >osf1
4358 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4359         xxx=`./loc addbib blurfl $pth`
4360         if $test -f $xxx; then
4361         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4362                 echo exit 0 >bsd
4363                 echo exit 0 >usg
4364         else
4365                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4366                         echo "Looks kind of like an extended USG system, but we'll see..."
4367                 else
4368                         echo "Looks kind of like a USG system, but we'll see..."
4369                 fi
4370                 echo exit 0 >usg
4371         fi
4372 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4373         echo "Looks kind of like a BSD system, but we'll see..."
4374         d_bsd="$define"
4375         echo exit 0 >bsd
4376 else
4377         echo "Looks kind of like a Version 7 system, but we'll see..."
4378         echo exit 0 >v7
4379 fi
4380 case "$eunicefix" in
4381 *unixtovms*)
4382         $cat <<'EOI'
4383 There is, however, a strange, musty smell in the air that reminds me of
4384 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4385 EOI
4386         echo exit 0 >eunice
4387         d_eunice="$define"
4388 : it so happens the Eunice I know will not run shell scripts in Unix format
4389         ;;
4390 *)
4391         echo " "
4392         echo "Congratulations.  You aren't running Eunice."
4393         d_eunice="$undef"
4394         ;;
4395 esac
4396 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4397 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4398 : semicolon as a patch separator
4399 case "$p_" in
4400 :) ;;
4401 *)
4402         $cat <<'EOI'
4403 I have the feeling something is not exactly right, however...don't tell me...
4404 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4405 (Or you may be running DOS with DJGPP.)
4406 EOI
4407         echo exit 0 >os2
4408         ;;
4409 esac
4410 if test -f /xenix; then
4411         echo "Actually, this looks more like a XENIX system..."
4412         echo exit 0 >xenix
4413         d_xenix="$define"
4414 else
4415         echo " "
4416         echo "It's not Xenix..."
4417         d_xenix="$undef"
4418 fi
4419 chmod +x xenix
4420 $eunicefix xenix
4421 if test -f /venix; then
4422         echo "Actually, this looks more like a VENIX system..."
4423         echo exit 0 >venix
4424 else
4425         echo " "
4426         if ./xenix; then
4427                 : null
4428         else
4429                 echo "Nor is it Venix..."
4430         fi
4431 fi
4432 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4433 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4434 $rm -f foo
4435
4436 case "$cc" in
4437 '') dflt=cc;;
4438 *) dflt="$cc";;
4439 esac
4440 rp="Use which C compiler?"
4441 . ./myread
4442 cc="$ans"
4443
4444 : See if they have not cc but they do have gcc
4445 . ./trygcc
4446 : Look for a hint-file generated 'call-back-unit'.  Now that the
4447 : user has specified the compiler, we may need to set or change some
4448 : other defaults.
4449 if $test -f cc.cbu; then
4450     . ./cc.cbu
4451 fi
4452 . ./checkcc
4453
4454 : Check if we are using GNU gcc and what its version is
4455 echo " "
4456 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4457 $cat >try.c <<EOM
4458 #include <stdio.h>
4459 int main() {
4460 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4461 #ifdef __VERSION__
4462         printf("%s\n", __VERSION__);
4463 #else
4464         printf("%s\n", "1");
4465 #endif
4466 #endif
4467         return(0);
4468 }
4469 EOM
4470 if $cc -o try $ccflags $ldflags try.c; then
4471         gccversion=`$run ./try`
4472         case "$gccversion" in
4473         '') echo "You are not using GNU cc." ;;
4474         *)  echo "You are using GNU cc $gccversion."
4475             ccname=gcc
4476             ;;
4477         esac
4478 else
4479         echo " "
4480         echo "*** WHOA THERE!!! ***" >&4
4481         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4482         case "$knowitall" in
4483         '')
4484         echo "    You'd better start hunting for one and let me know about it." >&4
4485                 exit 1
4486                 ;;
4487         esac
4488 fi
4489 $rm -f try try.*
4490 case "$gccversion" in
4491 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4492 esac
4493 case "$gccversion" in
4494 '') gccosandvers='' ;;
4495 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4496    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4497    gccshortvers=''
4498    case "$gccosandvers" in
4499    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4500    $osname$osvers) ;; # looking good
4501    $osname*) cat <<EOM >&4
4502
4503 *** WHOA THERE!!! ***
4504
4505     Your gcc has not been compiled for the exact release of
4506     your operating system ($gccosandvers versus $osname$osvers).
4507
4508     In general it is a good idea to keep gcc synchronized with
4509     the operating system because otherwise serious problems
4510     may ensue when trying to compile software, like Perl.
4511
4512     I'm trying to be optimistic here, though, and will continue.
4513     If later during the configuration and build icky compilation
4514     problems appear (headerfile conflicts being the most common
4515     manifestation), I suggest reinstalling the gcc to match
4516     your operating system release.
4517
4518 EOM
4519       ;;
4520    *) gccosandvers='' ;; # failed to parse, better be silent
4521    esac
4522    ;;
4523 esac
4524 case "$ccname" in
4525 '') ccname="$cc" ;;
4526 esac
4527
4528 # gcc 3.* complain about adding -Idirectories that they already know about,
4529 # so we will take those off from locincpth.
4530 case "$gccversion" in
4531 3*)
4532     echo "main(){}">try.c
4533     for incdir in $locincpth; do
4534        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4535              grep '^c[cp]p*[01]: warning: changing search order '`
4536        if test "X$warn" != X; then
4537            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4538        fi
4539     done
4540     $rm -f try try.*
4541 esac
4542
4543 : What should the include directory be ?
4544 echo " "
4545 $echo $n "Hmm...  $c"
4546 dflt='/usr/include'
4547 incpath=''
4548 mips_type=''
4549 if $test -f /bin/mips && /bin/mips; then
4550         echo "Looks like a MIPS system..."
4551         $cat >usr.c <<'EOCP'
4552 #ifdef SYSTYPE_BSD43
4553 /bsd43
4554 #endif
4555 EOCP
4556         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4557                 dflt='/bsd43/usr/include'
4558                 incpath='/bsd43'
4559                 mips_type='BSD 4.3'
4560         else
4561                 mips_type='System V'
4562         fi
4563         $rm -f usr.c usr.out
4564         echo "and you're compiling with the $mips_type compiler and libraries."
4565         xxx_prompt=y
4566         echo "exit 0" >mips
4567 else
4568         echo "Doesn't look like a MIPS system."
4569         xxx_prompt=n
4570         echo "exit 1" >mips
4571 fi
4572 chmod +x mips
4573 $eunicefix mips
4574 case "$usrinc" in
4575 '') ;;
4576 *) dflt="$usrinc";;
4577 esac
4578 case "$xxx_prompt" in
4579 y)      fn=d/
4580         echo " "
4581         rp='Where are the include files you want to use?'
4582         . ./getfile
4583         usrinc="$ans"
4584         ;;
4585 *)      usrinc="$dflt"
4586         ;;
4587 esac
4588
4589 : see how we invoke the C preprocessor
4590 echo " "
4591 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4592 cat <<'EOT' >testcpp.c
4593 #define ABC abc
4594 #define XYZ xyz
4595 ABC.XYZ
4596 EOT
4597 cd ..
4598 if test ! -f cppstdin; then
4599         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4600                 # AIX cc -E doesn't show the absolute headerfile
4601                 # locations but we'll cheat by using the -M flag.
4602                 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
4603         else
4604                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4605         fi
4606 else
4607         echo "Keeping your $hint cppstdin wrapper."
4608 fi
4609 chmod 755 cppstdin
4610 wrapper=`pwd`/cppstdin
4611 ok='false'
4612 cd UU
4613
4614 if $test "X$cppstdin" != "X" && \
4615         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4616         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4617 then
4618         echo "You used to use $cppstdin $cppminus so we'll use that again."
4619         case "$cpprun" in
4620         '') echo "But let's see if we can live without a wrapper..." ;;
4621         *)
4622                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4623                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4624                 then
4625                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4626                         ok='true'
4627                 else
4628                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4629                 fi
4630                 ;;
4631         esac
4632 else
4633         case "$cppstdin" in
4634         '') ;;
4635         *)
4636                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4637                 ;;
4638         esac
4639 fi
4640
4641 if $ok; then
4642         : nothing
4643 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4644         $cc -E <testcpp.c >testcpp.out 2>&1; \
4645         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4646         echo "Yup, it does."
4647         x_cpp="$cc -E"
4648         x_minus='';
4649 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4650         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4651         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4652         echo "Yup, it does."
4653         x_cpp="$cc -E"
4654         x_minus='-';
4655 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4656         $cc -P <testcpp.c >testcpp.out 2>&1; \
4657         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4658         echo "Yipee, that works!"
4659         x_cpp="$cc -P"
4660         x_minus='';
4661 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4662         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4663         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4664         echo "At long last!"
4665         x_cpp="$cc -P"
4666         x_minus='-';
4667 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4668         $cpp <testcpp.c >testcpp.out 2>&1; \
4669         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4670         echo "It works!"
4671         x_cpp="$cpp"
4672         x_minus='';
4673 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4674         $cpp - <testcpp.c >testcpp.out 2>&1; \
4675         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4676         echo "Hooray, it works!  I was beginning to wonder."
4677         x_cpp="$cpp"
4678         x_minus='-';
4679 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4680         $wrapper <testcpp.c >testcpp.out 2>&1; \
4681         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4682         x_cpp="$wrapper"
4683         x_minus=''
4684         echo "Eureka!"
4685 else
4686         dflt=''
4687         rp="No dice.  I can't find a C preprocessor.  Name one:"
4688         . ./myread
4689         x_cpp="$ans"
4690         x_minus=''
4691         $x_cpp <testcpp.c >testcpp.out 2>&1
4692         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4693                 echo "OK, that will do." >&4
4694         else
4695 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4696                 exit 1
4697         fi
4698 fi
4699
4700 case "$ok" in
4701 false)
4702         cppstdin="$x_cpp"
4703         cppminus="$x_minus"
4704         cpprun="$x_cpp"
4705         cpplast="$x_minus"
4706         set X $x_cpp
4707         shift
4708         case "$1" in
4709         "$cpp")
4710                 echo "Perhaps can we force $cc -E using a wrapper..."
4711                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4712                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4713                 then
4714                         echo "Yup, we can."
4715                         cppstdin="$wrapper"
4716                         cppminus='';
4717                 else
4718                         echo "Nope, we'll have to live without it..."
4719                 fi
4720                 ;;
4721         esac
4722         case "$cpprun" in
4723         "$wrapper")
4724                 cpprun=''
4725                 cpplast=''
4726                 ;;
4727         esac
4728         ;;
4729 esac
4730
4731 case "$cppstdin" in
4732 "$wrapper"|'cppstdin') ;;
4733 *) $rm -f $wrapper;;
4734 esac
4735 $rm -f testcpp.c testcpp.out
4736
4737 : Set private lib path
4738 case "$plibpth" in
4739 '') if ./mips; then
4740                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4741         fi;;
4742 esac
4743 case "$libpth" in
4744 ' ') dlist='';;
4745 '') dlist="$loclibpth $plibpth $glibpth";;
4746 *) dlist="$libpth";;
4747 esac
4748
4749 : Now check and see which directories actually exist, avoiding duplicates
4750 libpth=''
4751 for xxx in $dlist
4752 do
4753     if $test -d $xxx; then
4754                 case " $libpth " in
4755                 *" $xxx "*) ;;
4756                 *) libpth="$libpth $xxx";;
4757                 esac
4758     fi
4759 done
4760 $cat <<'EOM'
4761
4762 Some systems have incompatible or broken versions of libraries.  Among
4763 the directories listed in the question below, please remove any you
4764 know not to be holding relevant libraries, and add any that are needed.
4765 Say "none" for none.
4766
4767 EOM
4768 case "$libpth" in
4769 '') dflt='none';;
4770 *)
4771         set X $libpth
4772         shift
4773         dflt=${1+"$@"}
4774         ;;
4775 esac
4776 rp="Directories to use for library searches?"
4777 . ./myread
4778 case "$ans" in
4779 none) libpth=' ';;
4780 *) libpth="$ans";;
4781 esac
4782
4783 : compute shared library extension
4784 case "$so" in
4785 '')
4786         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4787                 dflt='sl'
4788         else
4789                 dflt='so'
4790         fi
4791         ;;
4792 *) dflt="$so";;
4793 esac
4794 $cat <<EOM
4795
4796 On some systems, shared libraries may be available.  Answer 'none' if
4797 you want to suppress searching of shared libraries for the remainder
4798 of this configuration.
4799
4800 EOM
4801 rp='What is the file extension used for shared libraries?'
4802 . ./myread
4803 so="$ans"
4804
4805 : Define several unixisms.
4806 : Hints files or command line option can be used to override them.
4807 : The convoluted testing is in case hints files set either the old
4808 : or the new name.
4809 case "$_exe" in
4810 '')     case "$exe_ext" in
4811         '')     ;;
4812         *)      _exe="$exe_ext" ;;
4813         esac
4814         ;;
4815 esac
4816 case "$_a" in
4817 '')     case "$lib_ext" in
4818     '') _a='.a';;
4819         *)      _a="$lib_ext" ;;
4820         esac
4821         ;;
4822 esac
4823 case "$_o" in
4824 '') case "$obj_ext" in
4825         '')     _o='.o';;
4826         *)      _o="$obj_ext";;
4827         esac
4828         ;;
4829 esac
4830 case "$p_" in
4831 '') case "$path_sep" in
4832         '')     p_=':';;
4833         *)      p_="$path_sep";;
4834         esac
4835         ;;
4836 esac
4837 exe_ext=$_exe
4838 lib_ext=$_a
4839 obj_ext=$_o
4840 path_sep=$p_
4841
4842 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4843
4844 : Which makefile gets called first.  This is used by make depend.
4845 case "$firstmakefile" in
4846 '') firstmakefile='makefile';;
4847 esac
4848
4849 case "$ccflags" in
4850 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4851 esac
4852
4853 case "$uselongdouble" in
4854 $define|true|[yY]*)     dflt='y';;
4855 *) dflt='n';;
4856 esac
4857 cat <<EOM
4858
4859 Perl can be built to take advantage of long doubles which
4860 (if available) may give more accuracy and range for floating point numbers.
4861
4862 If this doesn't make any sense to you, just accept the default '$dflt'.
4863 EOM
4864 rp='Try to use long doubles if available?'
4865 . ./myread
4866 case "$ans" in
4867 y|Y)    val="$define"   ;;
4868 *)      val="$undef"    ;;
4869 esac
4870 set uselongdouble
4871 eval $setvar
4872
4873 case "$uselongdouble" in
4874 true|[yY]*) uselongdouble="$define" ;;
4875 esac
4876
4877 : Look for a hint-file generated 'call-back-unit'.  If the
4878 : user has specified that long doubles should be used,
4879 : we may need to set or change some other defaults.
4880 if $test -f uselongdouble.cbu; then
4881     echo "Your platform has some specific hints regarding long doubles, using them..."
4882     . ./uselongdouble.cbu
4883 else
4884     case "$uselongdouble" in
4885         $define)
4886                 $cat <<EOM
4887 (Your platform does not have any specific hints for long doubles.)
4888 EOM
4889         ;;
4890     esac
4891 fi
4892
4893 : Looking for optional libraries
4894 echo " "
4895 echo "Checking for optional libraries..." >&4
4896 case "$libs" in
4897 ' '|'') dflt='';;
4898 *) dflt="$libs";;
4899 esac
4900 case "$libswanted" in
4901 '') libswanted='c_s';;
4902 esac
4903 case "$usesocks" in
4904 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4905 esac
4906 libsfound=''
4907 libsfiles=''
4908 libsdirs=''
4909 libspath=''
4910 for thisdir in $libpth $xlibpth; do
4911   test -d $thisdir && libspath="$libspath $thisdir"
4912 done
4913 for thislib in $libswanted; do
4914         for thisdir in $libspath; do
4915             xxx=''
4916             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4917                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4918                 $test -f "$xxx" && eval $libscheck
4919                 $test -f "$xxx" && libstyle=shared
4920             fi
4921             if test ! -f "$xxx"; then
4922                 xxx=$thisdir/lib$thislib.$so
4923                 $test -f "$xxx" && eval $libscheck
4924                 $test -f "$xxx" && libstyle=shared
4925             fi
4926             if test ! -f "$xxx"; then
4927                 xxx=$thisdir/lib$thislib$_a
4928                 $test -f "$xxx" && eval $libscheck
4929                 $test -f "$xxx" && libstyle=static
4930             fi
4931             if test ! -f "$xxx"; then
4932                 xxx=$thisdir/$thislib$_a
4933                 $test -f "$xxx" && eval $libscheck
4934                 $test -f "$xxx" && libstyle=static
4935             fi
4936             if test ! -f "$xxx"; then
4937                 xxx=$thisdir/lib${thislib}_s$_a
4938                 $test -f "$xxx" && eval $libscheck
4939                 $test -f "$xxx" && libstyle=static
4940                 $test -f "$xxx" && thislib=${thislib}_s
4941             fi
4942             if test ! -f "$xxx"; then
4943                 xxx=$thisdir/Slib$thislib$_a
4944                 $test -f "$xxx" && eval $libscheck
4945                 $test -f "$xxx" && libstyle=static
4946             fi
4947             if $test -f "$xxx"; then
4948                 case "$libstyle" in
4949                 shared) echo "Found -l$thislib (shared)." ;;
4950                 static) echo "Found -l$thislib." ;;
4951                 *)      echo "Found -l$thislib ($libstyle)." ;;
4952                 esac
4953                 case " $dflt " in
4954                 *"-l$thislib "*);;
4955                 *) dflt="$dflt -l$thislib"
4956                    libsfound="$libsfound $xxx"
4957                    yyy=`basename $xxx`
4958                    libsfiles="$libsfiles $yyy"
4959                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4960                    case " $libsdirs " in
4961                    *" $yyy "*) ;;
4962                    *) libsdirs="$libsdirs $yyy" ;;
4963                    esac
4964                    ;;
4965                 esac
4966                 break
4967             fi
4968         done
4969         if $test ! -f "$xxx"; then
4970             echo "No -l$thislib."
4971         fi
4972 done
4973 set X $dflt
4974 shift
4975 dflt="$*"
4976 case "$libs" in
4977 '') dflt="$dflt";;
4978 *) dflt="$libs";;
4979 esac
4980 case "$dflt" in
4981 ' '|'') dflt='none';;
4982 esac
4983
4984 $cat <<EOM
4985
4986 In order to compile $package on your machine, a number of libraries
4987 are usually needed.  Include any other special libraries here as well.
4988 Say "none" for none.  The default list is almost always right.
4989 EOM
4990
4991 echo " "
4992 rp="What libraries to use?"
4993 . ./myread
4994 case "$ans" in
4995 none) libs=' ';;
4996 *) libs="$ans";;
4997 esac
4998
4999 : determine optimization, if desired, or use for debug flag also
5000 case "$optimize" in
5001 ' '|$undef) dflt='none';;
5002 '') dflt='-O';;
5003 *) dflt="$optimize";;
5004 esac
5005 $cat <<EOH
5006
5007 By default, $package compiles with the -O flag to use the optimizer.
5008 Alternately, you might want to use the symbolic debugger, which uses
5009 the -g flag (on traditional Unix systems).  Either flag can be
5010 specified here.  To use neither flag, specify the word "none".
5011
5012 EOH
5013 rp="What optimizer/debugger flag should be used?"
5014 . ./myread
5015 optimize="$ans"
5016 case "$optimize" in
5017 'none') optimize=" ";;
5018 esac
5019
5020 : Check what DEBUGGING is required from the command line
5021 : -DEBUGGING      or -DDEBUGGING or
5022 : -DEBUGGING=both                       = -g + -DDEBUGGING
5023 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5024 : -DEBUGGING=none or -UDEBUGGING        =
5025 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5026 case "$EBUGGING" in
5027 '')     ;;
5028 *)      DEBUGGING=$EBUGGING ;;
5029 esac
5030
5031 case "$DEBUGGING" in
5032 -g|both|$define)
5033     case "$optimize" in
5034         *-g*) ;;
5035         *)    optimize="$optimize -g" ;;
5036     esac ;;
5037 none|$undef)
5038     case "$optimize" in
5039         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5040                 shift
5041                 optimize="$*"
5042                 ;;
5043     esac ;;
5044 esac
5045
5046 dflt=''
5047 case "$DEBUGGING" in
5048 both|$define) dflt='-DDEBUGGING'
5049 esac
5050
5051 : argument order is deliberate, as the flag will start with - which set could
5052 : think is an option
5053 checkccflag='check=$1; flag=$2; callback=$3;
5054 echo " ";
5055 echo "Checking if your compiler accepts $flag" 2>&1;
5056 echo "int main(void) { return 0; }" > gcctest.c;
5057 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5058     echo "Yes, it does." 2>&1;
5059     if $test -s gcctest.out ; then
5060         echo "But your platform does not like it:";
5061         cat gcctest.out;
5062     else
5063         case "$ccflags" in
5064         *$check*)
5065             echo "Leaving current flags $ccflags alone." 2>&1
5066             ;;
5067         *) dflt="$dflt $flag";
5068             eval $callback
5069             ;;
5070         esac
5071     fi
5072 else
5073     echo "Nope, it does not, but that is ok." 2>&1;
5074 fi
5075 '
5076
5077 : We will not override a previous value, but we might want to
5078 : augment a hint file
5079 case "$hint" in
5080 default|recommended)
5081         case "$gccversion" in
5082         1*) dflt="$dflt -fpcc-struct-return" ;;
5083         esac
5084         case "$optimize:$DEBUGGING" in
5085         *-g*:old) dflt="$dflt -DDEBUGGING";;
5086         esac
5087         case "$gccversion" in
5088         2*) if $test -d /etc/conf/kconfig.d &&
5089                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5090                 then
5091                         # Interactive Systems (ISC) POSIX mode.
5092                         dflt="$dflt -posix"
5093                 fi
5094                 ;;
5095         esac
5096         case "$gccversion" in
5097         1*) ;;
5098         2.[0-8]*) ;;
5099         ?*)     set strict-aliasing -fno-strict-aliasing
5100                 eval $checkccflag
5101                 ;;
5102         esac
5103         # For gcc, adding -pipe speeds up compilations for some, but apparently
5104         # some assemblers can't read from stdin.  (It also slows down compilations
5105         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5106         case "$gccversion" in
5107         ?*)     set pipe -pipe
5108                 eval $checkccflag
5109                 ;;
5110         esac
5111
5112         # on x86_64 (at least) we require an extra library (libssp) in the
5113         # link command line. This library is not named, so I infer that it is
5114         # an implementation detail that may change. Hence the safest approach
5115         # is to add the flag to the flags passed to the compiler at link time,
5116         # as that way the compiler can do the right implementation dependant
5117         # thing. (NWC)
5118         case "$gccversion" in
5119         ?*)     set stack-protector -fstack-protector 'ldflags="$ldflags -fstack-protector"'
5120                 eval $checkccflag
5121                 ;;
5122         esac
5123         ;;
5124 esac
5125
5126 case "$mips_type" in
5127 *BSD*|'') inclwanted="$locincpth $usrinc";;
5128 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5129 esac
5130 for thisincl in $inclwanted; do
5131         if $test -d $thisincl; then
5132                 if $test x$thisincl != x$usrinc; then
5133                         case "$dflt" in
5134                         *" -I$thisincl "*);;
5135                         *) dflt="$dflt -I$thisincl ";;
5136                         esac
5137                 fi
5138         fi
5139 done
5140
5141 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5142         xxx=true;
5143 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5144         xxx=true;
5145 else
5146         xxx=false;
5147 fi;
5148 if $xxx; then
5149         case "$dflt" in
5150         *$2*);;
5151         *) dflt="$dflt -D$2";;
5152         esac;
5153 fi'
5154
5155 set signal.h LANGUAGE_C; eval $inctest
5156
5157 case "$usesocks" in
5158 $define)
5159         ccflags="$ccflags -DSOCKS"
5160         ;;
5161 esac
5162
5163 case "$hint" in
5164 default|recommended) dflt="$ccflags $dflt" ;;
5165 *) dflt="$ccflags";;
5166 esac
5167
5168 case "$dflt" in
5169 ''|' ') dflt=none;;
5170 esac
5171
5172 $cat <<EOH
5173
5174 Your C compiler may want other flags.  For this question you should include
5175 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5176 but you should NOT include libraries or ld flags like -lwhatever.  If you
5177 want $package to honor its debug switch, you should include -DDEBUGGING here.
5178 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5179
5180 To use no flags, specify the word "none".
5181
5182 EOH
5183 set X $dflt
5184 shift
5185 dflt=${1+"$@"}
5186 rp="Any additional cc flags?"
5187 . ./myread
5188 case "$ans" in
5189 none) ccflags='';;
5190 *) ccflags="$ans";;
5191 esac
5192
5193 : the following weeds options from ccflags that are of no interest to cpp
5194 case "$cppflags" in
5195 '') cppflags="$ccflags" ;;
5196 *)  cppflags="$cppflags $ccflags" ;;
5197 esac
5198 case "$gccversion" in
5199 1*) cppflags="$cppflags -D__GNUC__"
5200 esac
5201 case "$mips_type" in
5202 '');;
5203 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5204 esac
5205 case "$cppflags" in
5206 '');;
5207 *)
5208         echo " "
5209         echo "Let me guess what the preprocessor flags are..." >&4
5210         set X $cppflags
5211         shift
5212         cppflags=''
5213         $cat >cpp.c <<'EOM'
5214 #define BLURFL foo
5215
5216 BLURFL xx LFRULB
5217 EOM
5218         previous=''
5219         for flag in $*
5220         do
5221                 case "$flag" in
5222                 -*) ftry="$flag";;
5223                 *) ftry="$previous $flag";;
5224                 esac
5225                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5226                         >cpp1.out 2>/dev/null && \
5227                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5228                         >cpp2.out 2>/dev/null && \
5229                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5230                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5231                 then
5232                         cppflags="$cppflags $ftry"
5233                         previous=''
5234                 else
5235                         previous="$flag"
5236                 fi
5237         done
5238         set X $cppflags
5239         shift
5240         cppflags=${1+"$@"}
5241         case "$cppflags" in
5242         *-*)  echo "They appear to be: $cppflags";;
5243         esac
5244         $rm -f cpp.c cpp?.out
5245         ;;
5246 esac
5247
5248 : flags used in final linking phase
5249 case "$ldflags" in
5250 '') if ./venix; then
5251                 dflt='-i -z'
5252         else
5253                 dflt=''
5254         fi
5255         case "$ccflags" in
5256         *-posix*) dflt="$dflt -posix" ;;
5257         esac
5258         ;;
5259 *) dflt="$ldflags";;
5260 esac
5261
5262 : Try to guess additional flags to pick up local libraries.
5263 for thislibdir in $libpth; do
5264         case " $loclibpth " in
5265         *" $thislibdir "*)
5266                 case "$dflt " in
5267                 *"-L$thislibdir "*) ;;
5268                 *)  dflt="$dflt -L$thislibdir" ;;
5269                 esac
5270                 ;;
5271         esac
5272 done
5273
5274 case "$dflt" in
5275 '') dflt='none' ;;
5276 esac
5277
5278 $cat <<EOH
5279
5280 Your C linker may need flags.  For this question you should
5281 include -L/whatever and any other flags used by the C linker, but you
5282 should NOT include libraries like -lwhatever.
5283
5284 Make sure you include the appropriate -L/path flags if your C linker
5285 does not normally search all of the directories you specified above,
5286 namely
5287         $libpth
5288 To use no flags, specify the word "none".
5289
5290 EOH
5291
5292 rp="Any additional ld flags (NOT including libraries)?"
5293 . ./myread
5294 case "$ans" in
5295 none) ldflags='';;
5296 *) ldflags="$ans";;
5297 esac
5298 rmlist="$rmlist pdp11"
5299
5300 : coherency check
5301 echo " "
5302 echo "Checking your choice of C compiler and flags for coherency..." >&4
5303 $cat > try.c <<'EOF'
5304 #include <stdio.h>
5305 int main() { printf("Ok\n"); return(0); }
5306 EOF
5307 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5308 shift
5309 $cat >try.msg <<'EOM'
5310 I've tried to compile and run the following simple program:
5311
5312 EOM
5313 $cat try.c >> try.msg
5314
5315 $cat >> try.msg <<EOM
5316
5317 I used the command:
5318
5319         $*
5320         $run ./try
5321
5322 and I got the following output:
5323
5324 EOM
5325 dflt=y
5326 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5327         if $sh -c "$run ./try " >>try.msg 2>&1; then
5328                 xxx=`$run ./try`
5329                 case "$xxx" in
5330                 "Ok") dflt=n ;;
5331                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5332                         case " $libs " in
5333                         *" -lsfio "*)
5334                                 cat >> try.msg <<'EOQS'
5335 If $libs contains -lsfio, and sfio is mis-configured, then it
5336 sometimes (apparently) runs and exits with a 0 status, but with no
5337 output!  It may have to do with sfio's use of _exit vs. exit.
5338
5339 EOQS
5340                                 rp="You have a big problem.  Shall I abort Configure"
5341                                 dflt=y
5342                                 ;;
5343                         esac
5344                         ;;
5345                 esac
5346         else
5347                 echo "The program compiled OK, but exited with status $?." >>try.msg
5348                 rp="You have a problem.  Shall I abort Configure"
5349                 dflt=y
5350         fi
5351 else
5352         echo "I can't compile the test program." >>try.msg
5353         rp="You have a BIG problem.  Shall I abort Configure"
5354         dflt=y
5355 fi
5356 case "$dflt" in
5357 y)
5358         $cat try.msg >&4
5359         case "$knowitall" in
5360         '')
5361                 echo "(The supplied flags or libraries might be incorrect.)"
5362                 ;;
5363         *) dflt=n;;
5364         esac
5365         echo " "
5366         . ./myread
5367         case "$ans" in
5368         n*|N*) ;;
5369         *)      echo "Ok.  Stopping Configure." >&4
5370                 exit 1
5371                 ;;
5372         esac
5373         ;;
5374 n) echo "OK, that should do.";;
5375 esac
5376 $rm_try gcctest gcctest.out
5377
5378 : define a shorthand compile call
5379 compile='
5380 mc_file=$1;
5381 shift;
5382 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5383 : define a shorthand compile call for compilations that should be ok.
5384 compile_ok='
5385 mc_file=$1;
5386 shift;
5387 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5388
5389 : determine filename position in cpp output
5390 echo " "
5391 echo "Computing filename position in cpp output for #include directives..." >&4
5392 case "$osname" in
5393 vos) testaccess=-e ;;
5394 *)   testaccess=-r ;;
5395 esac
5396 echo '#include <stdio.h>' > foo.c
5397 $cat >fieldn <<EOF
5398 $startsh
5399 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5400 $grep '^[       ]*#.*stdio\.h' | \
5401 while read cline; do
5402         pos=1
5403         set \$cline
5404         while $test \$# -gt 0; do
5405                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5406                         echo "\$pos"
5407                         exit 0
5408                 fi
5409                 shift
5410                 pos=\`expr \$pos + 1\`
5411         done
5412 done
5413 EOF
5414 chmod +x fieldn
5415 fieldn=`./fieldn`
5416 $rm -f foo.c fieldn
5417 case $fieldn in
5418 '') pos='???';;
5419 1) pos=first;;
5420 2) pos=second;;
5421 3) pos=third;;
5422 *) pos="${fieldn}th";;
5423 esac
5424 echo "Your cpp writes the filename in the $pos field of the line."
5425
5426 case "$osname" in
5427 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5428 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5429 *)   cppfilter='' ;;
5430 esac
5431 : locate header file
5432 $cat >findhdr <<EOF
5433 $startsh
5434 wanted=\$1
5435 name=''
5436 for usrincdir in $usrinc
5437 do
5438         if test -f \$usrincdir/\$wanted; then
5439                 echo "\$usrincdir/\$wanted"
5440                 exit 0
5441         fi
5442 done
5443 awkprg='{ print \$$fieldn }'
5444 echo "#include <\$wanted>" > foo\$\$.c
5445 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5446 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5447 while read cline; do
5448         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5449         case "\$name" in
5450         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5451         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5452         *) exit 2;;
5453         esac;
5454 done;
5455 #
5456 # status = 0: grep returned 0 lines, case statement not executed
5457 # status = 1: headerfile found
5458 # status = 2: while loop executed, no headerfile found
5459 #
5460 status=\$?
5461 $rm -f foo\$\$.c;
5462 if test \$status -eq 1; then
5463         exit 0;
5464 fi
5465 exit 1
5466 EOF
5467 chmod +x findhdr
5468
5469 : define an alternate in-header-list? function
5470 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5471 cont=true; xxf="echo \"<\$1> found.\" >&4";
5472 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5473 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5474 esac;
5475 case $# in 4) instead=instead;; *) instead="at last";; esac;
5476 while $test "$cont"; do
5477         xxx=`./findhdr $1`
5478         var=$2; eval "was=\$$2";
5479         if $test "$xxx" && $test -r "$xxx";
5480         then eval $xxf;
5481         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5482                 cont="";
5483         else eval $xxnf;
5484         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5485         set $yyy; shift; shift; yyy=$@;
5486         case $# in 0) cont="";;
5487         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5488                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5489         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5490                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5491         esac;
5492 done;
5493 while $test "$yyy";
5494 do set $yyy; var=$2; eval "was=\$$2";
5495         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5496         set $yyy; shift; shift; yyy=$@;
5497 done'
5498
5499 : see if stdlib is available
5500 set stdlib.h i_stdlib
5501 eval $inhdr
5502
5503 : check for lengths of integral types
5504 echo " "
5505 case "$intsize" in
5506 '')
5507         echo "Checking to see how big your integers are..." >&4
5508         $cat >try.c <<EOCP
5509 #include <stdio.h>
5510 #$i_stdlib I_STDLIB
5511 #ifdef I_STDLIB
5512 #include <stdlib.h>
5513 #endif
5514 int main()
5515 {
5516         printf("intsize=%d;\n", (int)sizeof(int));
5517         printf("longsize=%d;\n", (int)sizeof(long));
5518         printf("shortsize=%d;\n", (int)sizeof(short));
5519         exit(0);
5520 }
5521 EOCP
5522         set try
5523         if eval $compile_ok && $run ./try > /dev/null; then
5524                 eval `$run ./try`
5525                 echo "Your integers are $intsize bytes long."
5526                 echo "Your long integers are $longsize bytes long."
5527                 echo "Your short integers are $shortsize bytes long."
5528         else
5529                 $cat >&4 <<EOM
5530 !
5531 Help! I can't compile and run the intsize test program: please enlighten me!
5532 (This is probably a misconfiguration in your system or libraries, and
5533 you really ought to fix it.  Still, I'll try anyway.)
5534 !
5535 EOM
5536                 dflt=4
5537                 rp="What is the size of an integer (in bytes)?"
5538                 . ./myread
5539                 intsize="$ans"
5540                 dflt=$intsize
5541                 rp="What is the size of a long integer (in bytes)?"
5542                 . ./myread
5543                 longsize="$ans"
5544                 dflt=2
5545                 rp="What is the size of a short integer (in bytes)?"
5546                 . ./myread
5547                 shortsize="$ans"
5548         fi
5549         ;;
5550 esac
5551 $rm_try
5552
5553 : check for long long
5554 echo " "
5555 echo "Checking to see if you have long long..." >&4
5556 echo 'int main() { long long x = 7; return 0; }' > try.c
5557 set try
5558 if eval $compile; then
5559         val="$define"
5560         echo "You have long long."
5561 else
5562         val="$undef"
5563         echo "You do not have long long."
5564 fi
5565 $rm_try
5566 set d_longlong
5567 eval $setvar
5568
5569 : check for length of long long
5570 case "${d_longlong}${longlongsize}" in
5571 $define)
5572         echo " "
5573         echo "Checking to see how big your long longs are..." >&4
5574         $cat >try.c <<'EOCP'
5575 #include <stdio.h>
5576 int main()
5577 {
5578     printf("%d\n", (int)sizeof(long long));
5579     return(0);
5580 }
5581 EOCP
5582         set try
5583         if eval $compile_ok; then
5584                 longlongsize=`$run ./try`
5585                 echo "Your long longs are $longlongsize bytes long."
5586         else
5587                 dflt='8'
5588                 echo " "
5589                 echo "(I can't seem to compile the test program.  Guessing...)"
5590                 rp="What is the size of a long long (in bytes)?"
5591                 . ./myread
5592                 longlongsize="$ans"
5593         fi
5594         if $test "X$longsize" = "X$longlongsize"; then
5595                 echo "(That isn't any different from an ordinary long.)"
5596         fi
5597         ;;
5598 esac
5599 $rm_try
5600
5601 : see if inttypes.h is available
5602 : we want a real compile instead of Inhdr because some systems
5603 : have an inttypes.h which includes non-existent headers
5604 echo " "
5605 $cat >try.c <<EOCP
5606 #include <inttypes.h>
5607 int main() {
5608         static int32_t foo32 = 0x12345678;
5609 }
5610 EOCP
5611 set try
5612 if eval $compile; then
5613         echo "<inttypes.h> found." >&4
5614         val="$define"
5615 else
5616         echo "<inttypes.h> NOT found." >&4
5617         val="$undef"
5618 fi
5619 $rm_try
5620 set i_inttypes
5621 eval $setvar
5622
5623 : check for int64_t
5624 echo " "
5625 echo "Checking to see if you have int64_t..." >&4
5626 $cat >try.c <<EOCP
5627 #include <sys/types.h>
5628 #$i_inttypes I_INTTYPES
5629 #ifdef I_INTTYPES
5630 #include <inttypes.h>
5631 #endif
5632 int main() { int64_t x = 7; }
5633 EOCP
5634 set try
5635 if eval $compile; then
5636         val="$define"
5637         echo "You have int64_t."
5638 else
5639         val="$undef"
5640         echo "You do not have int64_t."
5641 fi
5642 $rm_try
5643 set d_int64_t
5644 eval $setvar
5645
5646 : Check if 64bit ints have a quad type
5647 echo " "
5648 echo "Checking which 64-bit integer type we could use..." >&4
5649
5650 case "$intsize" in
5651 8) val=int
5652    set quadtype
5653    eval $setvar
5654    val='"unsigned int"'
5655    set uquadtype
5656    eval $setvar
5657    quadkind=1
5658    ;;
5659 *) case "$longsize" in
5660    8) val=long
5661       set quadtype
5662       eval $setvar
5663       val='"unsigned long"'
5664       set uquadtype
5665       eval $setvar
5666       quadkind=2
5667       ;;
5668    *) case "$d_longlong:$longlongsize" in
5669       define:8)
5670         val='"long long"'
5671         set quadtype
5672         eval $setvar
5673         val='"unsigned long long"'
5674         set uquadtype
5675         eval $setvar
5676         quadkind=3
5677         ;;
5678       *) case "$d_int64_t" in
5679          define)
5680            val=int64_t
5681            set quadtype
5682            eval $setvar
5683            val=uint64_t
5684            set uquadtype
5685            eval $setvar
5686            quadkind=4
5687            ;;
5688          esac
5689          ;;
5690       esac
5691       ;;
5692    esac
5693    ;;
5694 esac
5695
5696 case "$quadtype" in
5697 '')     echo "Alas, no 64-bit integer types in sight." >&4
5698         d_quad="$undef"
5699         ;;
5700 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5701         d_quad="$define"
5702         ;;
5703 esac
5704
5705
5706 case "$uselonglong" in
5707 "$define"|true|[yY]*)
5708         cat <<EOM >&4
5709
5710 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5711 EOM
5712         use64bitint="$define"
5713         ;;
5714 esac
5715 case "$use64bits" in
5716 "$define"|true|[yY]*)
5717         cat <<EOM >&4
5718
5719 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5720 EOM
5721         use64bitint="$define"
5722         ;;
5723 esac
5724 case "$use64bitints" in
5725 "$define"|true|[yY]*)
5726         cat <<EOM >&4
5727
5728 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5729 EOM
5730         use64bitint="$define"
5731         ;;
5732 esac
5733 case "$use64bitsint" in
5734 "$define"|true|[yY]*)
5735         cat <<EOM >&4
5736
5737 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5738 EOM
5739         use64bitint="$define"
5740         ;;
5741 esac
5742 case "$uselonglongs" in
5743 "$define"|true|[yY]*)
5744         cat <<EOM >&4
5745
5746 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5747 EOM
5748         use64bitint="$define"
5749         ;;
5750 esac
5751 case "$use64bitsall" in
5752 "$define"|true|[yY]*)
5753         cat <<EOM >&4
5754
5755 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5756 EOM
5757         use64bitall="$define"
5758         ;;
5759 esac
5760
5761 case "$ccflags" in
5762 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5763 esac
5764 case "$use64bitall" in
5765 "$define"|true|[yY]*) use64bitint="$define" ;;
5766 esac
5767
5768 case "$longsize" in
5769 8) cat <<EOM
5770
5771 You have natively 64-bit long integers.
5772 EOM
5773    val="$define"
5774    ;;
5775 *) case "$use64bitint" in
5776    "$define"|true|[yY]*) dflt='y';;
5777    *) dflt='n';;
5778    esac
5779    case "$d_quad" in
5780    "$define") ;;
5781    *) dflt='n' ;;
5782    esac
5783    cat <<EOM
5784
5785 Perl can be built to take advantage of 64-bit integer types
5786 on some systems.  To do so, Configure can be run with -Duse64bitint.
5787 Choosing this option will most probably introduce binary incompatibilities.
5788
5789 If this doesn't make any sense to you, just accept the default '$dflt'.
5790 (The default has been chosen based on your configuration.)
5791 EOM
5792    rp='Try to use 64-bit integers, if available?'
5793    . ./myread
5794    case "$ans" in
5795    [yY]*) val="$define" ;;
5796    *)     val="$undef"  ;;
5797    esac
5798    ;;
5799 esac
5800 set use64bitint
5801 eval $setvar
5802
5803 case "$use64bitall" in
5804 "$define"|true|[yY]*) dflt='y' ;;
5805 *) case "$longsize" in
5806    8) dflt='y' ;;
5807    *) dflt='n' ;;
5808    esac
5809    ;;
5810 esac
5811 cat <<EOM
5812
5813 You may also choose to try maximal 64-bitness.  It means using as much
5814 64-bitness as possible on the platform.  This in turn means even more
5815 binary incompatibilities.  On the other hand, your platform may not
5816 have any more 64-bitness available than what you already have chosen.
5817
5818 If this doesn't make any sense to you, just accept the default '$dflt'.
5819 (The default has been chosen based on your configuration.)
5820 EOM
5821 rp='Try to use maximal 64-bit support, if available?'
5822 . ./myread
5823 case "$ans" in
5824 [yY]*) val="$define" ;;
5825 *)     val="$undef"  ;;
5826 esac
5827 set use64bitall
5828 eval $setvar
5829 case "$use64bitall" in
5830 "$define")
5831         case "$use64bitint" in
5832         "$undef")
5833                 cat <<EOM
5834
5835 Since you have chosen a maximally 64-bit build, I'm also turning on
5836 the use of 64-bit integers.
5837 EOM
5838                 use64bitint="$define" ;;
5839         esac
5840         ;;
5841 esac
5842
5843 : Look for a hint-file generated 'call-back-unit'.  If the
5844 : user has specified that a 64-bit perl is to be built,
5845 : we may need to set or change some other defaults.
5846 if $test -f use64bitint.cbu; then
5847         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5848         . ./use64bitint.cbu
5849 fi
5850 case "$use64bitint" in
5851 "$define"|true|[yY]*)
5852         case "$longsize" in
5853         4) case "$archname64" in
5854            '') archname64=64int ;;
5855            esac
5856            ;;
5857         esac
5858         ;;
5859 esac
5860
5861 : Look for a hint-file generated 'call-back-unit'.  If the
5862 : user has specified that a maximally 64-bit perl is to be built,
5863 : we may need to set or change some other defaults.
5864 if $test -f use64bitall.cbu; then
5865         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5866         . ./use64bitall.cbu
5867 fi
5868 case "$use64bitall" in
5869 "$define"|true|[yY]*)
5870         case "$longsize" in
5871         4) case "$archname64" in
5872            ''|64int) archname64=64all ;;
5873            esac
5874            ;;
5875         esac
5876         ;;
5877 esac
5878
5879 case "$d_quad:$use64bitint" in
5880 $undef:$define)
5881         cat >&4 <<EOF
5882
5883 *** You have chosen to use 64-bit integers,
5884 *** but none can be found.
5885 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5886 *** Cannot continue, aborting.
5887
5888 EOF
5889         exit 1
5890         ;;
5891 esac
5892
5893 : check for length of double
5894 echo " "
5895 case "$doublesize" in
5896 '')
5897         echo "Checking to see how big your double precision numbers are..." >&4
5898         $cat >try.c <<EOCP
5899 #include <stdio.h>
5900 #$i_stdlib I_STDLIB
5901 #ifdef I_STDLIB
5902 #include <stdlib.h>
5903 #endif
5904 int main()
5905 {
5906     printf("%d\n", (int)sizeof(double));
5907     exit(0);
5908 }
5909 EOCP
5910         set try
5911         if eval $compile_ok; then
5912                 doublesize=`$run ./try`
5913                 echo "Your double is $doublesize bytes long."
5914         else
5915                 dflt='8'
5916                 echo "(I can't seem to compile the test program.  Guessing...)"
5917                 rp="What is the size of a double precision number (in bytes)?"
5918                 . ./myread
5919                 doublesize="$ans"
5920         fi
5921         ;;
5922 esac
5923 $rm_try
5924
5925 : check for long doubles
5926 echo " "
5927 echo "Checking to see if you have long double..." >&4
5928 echo 'int main() { long double x = 7.0; }' > try.c
5929 set try
5930 if eval $compile; then
5931         val="$define"
5932         echo "You have long double."
5933 else
5934         val="$undef"
5935         echo "You do not have long double."
5936 fi
5937 $rm_try
5938 set d_longdbl
5939 eval $setvar
5940
5941 : check for length of long double
5942 case "${d_longdbl}${longdblsize}" in
5943 $define)
5944         echo " "
5945         echo "Checking to see how big your long doubles are..." >&4
5946         $cat >try.c <<'EOCP'
5947 #include <stdio.h>
5948 int main()
5949 {
5950         printf("%d\n", sizeof(long double));
5951 }
5952 EOCP
5953         set try
5954         set try
5955         if eval $compile; then
5956                 longdblsize=`$run ./try`
5957                 echo "Your long doubles are $longdblsize bytes long."
5958         else
5959                 dflt='8'
5960                 echo " "
5961                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5962                 rp="What is the size of a long double (in bytes)?"
5963                 . ./myread
5964                 longdblsize="$ans"
5965         fi
5966         if $test "X$doublesize" = "X$longdblsize"; then
5967                 echo "That isn't any different from an ordinary double."
5968                 echo "I'll keep your setting anyway, but you may see some"
5969                 echo "harmless compilation warnings."
5970         fi
5971         ;;
5972 esac
5973 $rm_try
5974
5975 : determine the architecture name
5976 echo " "
5977 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5978         tarch=`arch`"-$osname"
5979 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5980         if uname -m > tmparch 2>&1 ; then
5981                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5982                         -e 's/$/'"-$osname/" tmparch`
5983         else
5984                 tarch="$osname"
5985         fi
5986         $rm -f tmparch
5987 else
5988         tarch="$osname"
5989 fi
5990 case "$myarchname" in
5991 ''|"$tarch") ;;
5992 *)
5993         echo "(Your architecture name used to be $myarchname.)"
5994         archname=''
5995         ;;
5996 esac
5997 case "$targetarch" in
5998 '') ;;
5999 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6000 esac
6001 myarchname="$tarch"
6002 case "$archname" in
6003 '') dflt="$tarch";;
6004 *) dflt="$archname";;
6005 esac
6006 rp='What is your architecture name'
6007 . ./myread
6008 archname="$ans"
6009 case "$usethreads" in
6010 $define)
6011         echo "Threads selected." >&4
6012         case "$archname" in
6013         *-thread*) echo "...and architecture name already has -thread." >&4
6014                 ;;
6015         *)      archname="$archname-thread"
6016                 echo "...setting architecture name to $archname." >&4
6017                 ;;
6018         esac
6019         ;;
6020 esac
6021 case "$usemultiplicity" in
6022 $define)
6023         echo "Multiplicity selected." >&4
6024         case "$archname" in
6025         *-multi*) echo "...and architecture name already has -multi." >&4
6026                 ;;
6027         *)      archname="$archname-multi"
6028                 echo "...setting architecture name to $archname." >&4
6029                 ;;
6030         esac
6031         ;;
6032 esac
6033 case "$use64bitint$use64bitall" in
6034 *"$define"*)
6035         case "$archname64" in
6036         '')
6037                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6038                 ;;
6039         *)
6040                 case "$use64bitint" in
6041                 "$define") echo "64 bit integers selected." >&4 ;;
6042                 esac
6043                 case "$use64bitall" in
6044                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6045                 esac
6046                 case "$archname" in
6047                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6048                         ;;
6049                 *)      archname="$archname-$archname64"
6050                         echo "...setting architecture name to $archname." >&4
6051                         ;;
6052                 esac
6053                 ;;
6054         esac
6055 esac
6056 case "$uselongdouble" in
6057 $define)
6058         echo "Long doubles selected." >&4
6059         case "$longdblsize" in
6060         $doublesize)
6061                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6062                 ;;
6063         *)
6064                 case "$archname" in
6065                 *-ld*) echo "...and architecture name already has -ld." >&4
6066                         ;;
6067                 *)      archname="$archname-ld"
6068                         echo "...setting architecture name to $archname." >&4
6069                         ;;
6070                 esac
6071                 ;;
6072         esac
6073         ;;
6074 esac
6075 case "$useperlio" in
6076 $define)
6077         echo "Perlio selected." >&4
6078         ;;
6079 *)
6080         echo "Perlio not selected, using stdio." >&4
6081         case "$archname" in
6082         *-stdio*) echo "...and architecture name already has -stdio." >&4
6083                 ;;
6084         *)      archname="$archname-stdio"
6085                 echo "...setting architecture name to $archname." >&4
6086                 ;;
6087         esac
6088         ;;
6089 esac
6090 if $test -f archname.cbu; then
6091         echo "Your platform has some specific hints for architecture name, using them..."
6092         . ./archname.cbu
6093 fi
6094
6095 : set the prefixit variable, to compute a suitable default value
6096 prefixit='case "$3" in
6097 ""|none)
6098         case "$oldprefix" in
6099         "") eval "$1=\"\$$2\"";;
6100         *)
6101                 case "$3" in
6102                 "") eval "$1=";;
6103                 none)
6104                         eval "tp=\"\$$2\"";
6105                         case "$tp" in
6106                         ""|" ") eval "$1=\"\$$2\"";;
6107                         *) eval "$1=";;
6108                         esac;;
6109                 esac;;
6110         esac;;
6111 *)
6112         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6113         case "$tp" in
6114         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6115         /*-$oldprefix/*|\~*-$oldprefix/*)
6116                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6117         *) eval "$1=\"\$$2\"";;
6118         esac;;
6119 esac'
6120
6121 : determine installation style
6122 : For now, try to deduce it from prefix unless it is already set.
6123 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6124 case "$installstyle" in
6125 '')     case "$prefix" in
6126                 *perl*) dflt='lib';;
6127                 *) dflt='lib/perl5' ;;
6128         esac
6129         ;;
6130 *)      dflt="$installstyle" ;;
6131 esac
6132 : Probably not worth prompting for this since we prompt for all
6133 : the directories individually, and the prompt would be too long and
6134 : confusing anyway.
6135 installstyle=$dflt
6136
6137 : determine where public executables go
6138 echo " "
6139 set dflt bin bin
6140 eval $prefixit
6141 fn=d~
6142 rp='Pathname where the public executables will reside?'
6143 . ./getfile
6144 if $test "X$ansexp" != "X$binexp"; then
6145         installbin=''
6146 fi
6147 prefixvar=bin
6148 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6149 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6150 :     this via initialinstalllocation
6151 . ./setprefixvar
6152
6153 case "$userelocatableinc" in
6154 $define|true|[yY]*)     dflt='y' ;;
6155 *)                      dflt='n' ;;
6156 esac
6157 cat <<EOM
6158
6159 Would you like to build Perl so that the installation is relocatable, so that
6160 library paths in @INC are determined relative to the path of the perl binary?
6161 This is not advised for system Perl installs, or if you need to run setid
6162 scripts or scripts under taint mode.
6163
6164 If this doesn't make any sense to you, just accept the default '$dflt'.
6165 EOM
6166 rp='Use relocatable @INC?'
6167 . ./myread
6168 case "$ans" in
6169 y|Y)    val="$define" ;;
6170 *)      val="$undef"  ;;
6171 esac
6172 set userelocatableinc
6173 eval $setvar
6174
6175 initialinstalllocation="$binexp"
6176 : Default prefix is now "up one level from where the binaries are"
6177 case "$userelocatableinc" in
6178 $define|true|[yY]*)
6179     bin=".../"
6180     binexp=".../"
6181     prefix=".../.."
6182     prefixexp=".../.."
6183     installprefixexp=".../.."
6184     ;;
6185 esac
6186
6187 : determine where private library files go
6188 : Usual default is /usr/local/lib/perl5/$version.
6189 : Also allow things like /opt/perl/lib/$version, since
6190 : /opt/perl/lib/perl5... would be redundant.
6191 : The default "style" setting is made in installstyle.U
6192 case "$installstyle" in
6193 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6194 *)       set dflt privlib lib/$version ;;
6195 esac
6196 eval $prefixit
6197 $cat <<EOM
6198
6199 There are some auxiliary files for $package that need to be put into a
6200 private library directory that is accessible by everyone.
6201
6202 EOM
6203 fn=$binexp
6204 fn=d~+
6205 rp='Pathname where the private library files will reside?'
6206 . ./getfile
6207 prefixvar=privlib
6208 . ./setprefixvar
6209
6210 : set the prefixup variable, to restore leading tilda escape
6211 prefixup='case "$prefixexp" in
6212 "$prefix") ;;
6213 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6214 esac'
6215
6216 : determine where public architecture dependent libraries go
6217 set archlib archlib
6218 eval $prefixit
6219 : privlib default is /usr/local/lib/$package/$version
6220 : archlib default is /usr/local/lib/$package/$version/$archname
6221 : privlib may have an optional trailing /share.
6222 tdflt=`echo $privlib | $sed 's,/share$,,'`
6223 tdflt=$tdflt/$archname
6224 case "$archlib" in
6225 '')     dflt=$tdflt
6226         ;;
6227 *)      dflt="$archlib"
6228     ;;
6229 esac
6230 $cat <<EOM
6231
6232 $spackage contains architecture-dependent library files.  If you are
6233 sharing libraries in a heterogeneous environment, you might store
6234 these files in a separate location.  Otherwise, you can just include
6235 them with the rest of the public library files.
6236
6237 EOM
6238 fn=$binexp
6239 fn=d+~
6240 rp='Where do you want to put the public architecture-dependent libraries?'
6241 . ./getfile
6242 prefixvar=archlib
6243 . ./setprefixvar
6244 if $test X"$archlib" = X"$privlib"; then
6245         d_archlib="$undef"
6246 else
6247         d_archlib="$define"
6248 fi
6249
6250 : see if setuid scripts can be secure
6251 $cat <<EOM
6252
6253 Some kernels have a bug that prevents setuid #! scripts from being
6254 secure.  Some sites have disabled setuid #! scripts because of this.
6255
6256 First let's decide if your kernel supports secure setuid #! scripts.
6257 (If setuid #! scripts would be secure but have been disabled anyway,
6258 don't say that they are secure if asked.)
6259
6260 EOM
6261
6262 val="$undef"
6263 if $test -d /dev/fd; then
6264         echo "#!$ls" >reflect
6265         chmod +x,u+s reflect
6266         ./reflect >flect 2>&1
6267         if $contains "/dev/fd" flect >/dev/null; then
6268                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6269                 val="$define"
6270         else
6271                 $cat <<EOM
6272 If you are not sure if they are secure, I can check but I'll need a
6273 username and password different from the one you are using right now.
6274 If you don't have such a username or don't want me to test, simply
6275 enter 'none'.
6276
6277 EOM
6278                 rp='Other username to test security of setuid scripts with?'
6279                 dflt='none'
6280                 . ./myread
6281                 case "$ans" in
6282                 n|none)
6283                         case "$d_suidsafe" in
6284                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6285                                 dflt=n;;
6286                         "$undef")
6287                                 echo "Well, the $hint value is *not* secure." >&4
6288                                 dflt=n;;
6289                         *)      echo "Well, the $hint value *is* secure." >&4
6290                                 dflt=y;;
6291                         esac
6292                         ;;
6293                 *)
6294                         $rm -f reflect flect
6295                         echo "#!$ls" >reflect
6296                         chmod +x,u+s reflect
6297                         echo >flect
6298                         chmod a+w flect
6299                         echo '"su" will (probably) prompt you for '"$ans's password."
6300                         su $ans -c './reflect >flect'
6301                         if $contains "/dev/fd" flect >/dev/null; then
6302                                 echo "Okay, it looks like setuid scripts are secure." >&4
6303                                 dflt=y
6304                         else
6305                                 echo "I don't think setuid scripts are secure." >&4
6306                                 dflt=n
6307                         fi
6308                         ;;
6309                 esac
6310                 rp='Does your kernel have *secure* setuid scripts?'
6311                 . ./myread
6312                 case "$ans" in
6313                 [yY]*)  val="$define";;
6314                 *)      val="$undef";;
6315                 esac
6316         fi
6317 else
6318         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6319         echo "(That's for file descriptors, not floppy disks.)"
6320         val="$undef"
6321 fi
6322 set d_suidsafe
6323 eval $setvar
6324
6325 $rm -f reflect flect
6326
6327 : now see if they want to do setuid emulation
6328 echo " "
6329 val="$undef"
6330 case "$d_suidsafe" in
6331 "$define")
6332         val="$undef"
6333         echo "No need to emulate SUID scripts since they are secure here." >&4
6334         ;;
6335 *)
6336         $cat <<EOM
6337 Some systems have disabled setuid scripts, especially systems where
6338 setuid scripts cannot be secure.  On systems where setuid scripts have
6339 been disabled, the setuid/setgid bits on scripts are currently
6340 useless.  It is possible for $package to detect those bits and emulate
6341 setuid/setgid in a secure fashion.  This emulation will only work if
6342 setuid scripts have been disabled in your kernel.
6343
6344 EOM
6345         case "$d_dosuid" in
6346         "$define") dflt=y ;;
6347         *) dflt=n ;;
6348         esac
6349         rp="Do you want to do setuid/setgid emulation?"
6350         . ./myread
6351         case "$ans" in
6352         [yY]*)  val="$define";;
6353         *)      val="$undef";;
6354         esac
6355         ;;
6356 esac
6357 set d_dosuid
6358 eval $setvar
6359
6360 : Find perl5.005 or later.
6361 echo "Looking for a previously installed perl5.005 or later... "
6362 case "$perl5" in
6363 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6364                 : Check if this perl is recent and can load a simple module
6365                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6366                         perl5=$tdir/perl
6367                         break;
6368                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6369                         perl5=$tdir/perl5
6370                         break;
6371                 fi
6372         done
6373         ;;
6374 *)      perl5="$perl5"
6375         ;;
6376 esac
6377 case "$perl5" in
6378 '')     echo "None found.  That's ok.";;
6379 *)      echo "Using $perl5." ;;
6380 esac
6381
6382 : Set the siteprefix variables
6383 $cat <<EOM
6384
6385 After $package is installed, you may wish to install various
6386 add-on modules and utilities.  Typically, these add-ons will
6387 be installed under $prefix with the rest
6388 of this package.  However, you may wish to install such add-ons
6389 elsewhere under a different prefix.
6390
6391 If you do not wish to put everything under a single prefix, that's
6392 ok.  You will be prompted for the individual locations; this siteprefix
6393 is only used to suggest the defaults.
6394
6395 The default should be fine for most people.
6396
6397 EOM
6398 fn=d~+
6399 rp='Installation prefix to use for add-on modules and utilities?'
6400 : XXX Here might be another good place for an installstyle setting.
6401 case "$siteprefix" in
6402 '') dflt=$prefix ;;
6403 *)  dflt=$siteprefix ;;
6404 esac
6405 . ./getfile
6406 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6407 oldsiteprefix=''
6408 case "$siteprefix" in
6409 '') ;;
6410 *)      case "$ans" in
6411         "$prefix") ;;
6412         *) oldsiteprefix="$prefix";;
6413         esac
6414         ;;
6415 esac
6416 siteprefix="$ans"
6417 siteprefixexp="$ansexp"
6418
6419 : determine where site specific libraries go.
6420 : Usual default is /usr/local/lib/perl5/site_perl/$version
6421 : The default "style" setting is made in installstyle.U
6422 : XXX No longer works with Prefixit stuff.
6423 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6424 case "$sitelib" in
6425 '') case "$installstyle" in
6426         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6427         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6428         esac
6429         ;;
6430 *)      dflt="$sitelib"
6431         ;;
6432 esac
6433 $cat <<EOM
6434
6435 The installation process will create a directory for
6436 site-specific extensions and modules.  Most users find it convenient
6437 to place all site-specific files in this directory rather than in the
6438 main distribution directory.
6439
6440 EOM
6441 fn=d~+
6442 rp='Pathname for the site-specific library files?'
6443 . ./getfile
6444 prefixvar=sitelib
6445 . ./setprefixvar
6446 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6447
6448 : Determine list of previous versions to include in @INC
6449 $cat > getverlist <<EOPL
6450 #!$perl5 -w
6451 use File::Basename;
6452 \$api_versionstring = "$api_versionstring";
6453 \$version = "$version";
6454 \$stem = "$sitelib_stem";
6455 \$archname = "$archname";
6456 EOPL
6457         $cat >> getverlist <<'EOPL'
6458 # The list found is store twice for each entry: the original name, and
6459 # the binary broken down version as pack "sss", so sorting is easy and
6460 # unambiguous. This will work for all versions that have a maximum of
6461 # three digit groups, separate by '.'s or '_'s. Names are extended with
6462 # ".0.0" to ensure at least three elements for the pack.
6463 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6464
6465 # Can't have leading @ because metaconfig interprets it as a command!
6466 ;@inc_version_list=();
6467 # XXX Redo to do opendir/readdir?
6468 if (-d $stem) {
6469     chdir($stem);
6470     ;@candidates = map {
6471         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6472 }
6473 else {
6474     ;@candidates = ();
6475 }
6476
6477 ($pversion, $aversion, $vsn5005) = map {
6478     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6479 foreach $d (@candidates) {
6480     if ($d->[1] lt $pversion) {
6481         if ($d->[1] ge $aversion) {
6482             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6483         }
6484         elsif ($d->[1] ge $vsn5005) {
6485             unshift(@inc_version_list, grep { -d } $d->[0]);
6486         }
6487     }
6488     else {
6489         # Skip newer version.  I.e. don't look in
6490         # 5.7.0 if we're installing 5.6.1.
6491     }
6492 }
6493
6494 if (@inc_version_list) {
6495     print join(' ', @inc_version_list);
6496 }
6497 else {
6498     # Blank space to preserve value for next Configure run.
6499     print " ";
6500 }
6501 EOPL
6502 chmod +x getverlist
6503 case "$inc_version_list" in
6504 '')     if test -x "$perl5$exe_ext"; then
6505                 dflt=`$perl5 getverlist`
6506         else
6507                 dflt='none'
6508         fi
6509         ;;
6510 $undef) dflt='none' ;;
6511 *)  eval dflt=\"$inc_version_list\" ;;
6512 esac
6513 case "$dflt" in
6514 ''|' ') dflt=none ;;
6515 esac
6516 case "$dflt" in
6517 5.005) dflt=none ;;
6518 esac
6519 $cat <<EOM
6520
6521 In order to ease the process of upgrading, this version of perl
6522 can be configured to use modules built and installed with earlier
6523 versions of perl that were installed under $prefix.  Specify here
6524 the list of earlier versions that this version of perl should check.
6525 If Configure detected no earlier versions of perl installed under
6526 $prefix, then the list will be empty.  Answer 'none' to tell perl
6527 to not search earlier versions.
6528
6529 The default should almost always be sensible, so if you're not sure,
6530 just accept the default.
6531 EOM
6532
6533 rp='List of earlier versions to include in @INC?'
6534 . ./myread
6535 case "$ans" in
6536 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6537 *) inc_version_list="$ans" ;;
6538 esac
6539 case "$inc_version_list" in
6540 ''|' ')
6541         inc_version_list_init='0'
6542         d_inc_version_list="$undef"
6543         ;;
6544 *)      inc_version_list_init=`echo $inc_version_list |
6545                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6546         d_inc_version_list="$define"
6547         ;;
6548 esac
6549 $rm -f getverlist
6550
6551 : see if this is a malloc.h system
6552 : we want a real compile instead of Inhdr because some systems have a
6553 : malloc.h that just gives a compile error saying to use stdlib.h instead
6554 echo " "
6555 $cat >try.c <<EOCP
6556 #include <stdlib.h>
6557 #include <malloc.h>
6558 int main () { return 0; }
6559 EOCP
6560 set try
6561 if eval $compile; then
6562     echo "<malloc.h> found." >&4
6563     val="$define"
6564 else
6565     echo "<malloc.h> NOT found." >&4
6566     val="$undef"
6567 fi
6568 $rm_try
6569 set i_malloc
6570 eval $setvar
6571
6572 : check for void type
6573 echo " "
6574 echo "Checking to see how well your C compiler groks the void type..." >&4
6575 case "$voidflags" in
6576 '')
6577         $cat >try.c <<EOCP
6578 #$i_stdlib I_STDLIB
6579 #ifdef I_STDLIB
6580 #include <stdlib.h>
6581 #endif
6582 #if TRY & 1
6583 void sub() {
6584 #else
6585 sub() {
6586 #endif
6587         extern void moo();      /* function returning void */
6588         void (*goo)();          /* ptr to func returning void */
6589 #if TRY & 8
6590         void *hue;              /* generic ptr */
6591 #endif
6592 #if TRY & 2
6593         void (*foo[10])();
6594 #endif
6595
6596 #if TRY & 4
6597         if(goo == moo) {
6598                 exit(0);
6599         }
6600 #endif
6601         exit(0);
6602 }
6603 int main() { sub(); }
6604 EOCP
6605         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6606                 voidflags=$defvoidused
6607         echo "Good.  It appears to support void to the level $package wants.">&4
6608                 if $contains warning .out >/dev/null 2>&1; then
6609                         echo "However, you might get some warnings that look like this:"
6610                         $cat .out
6611                 fi
6612         else
6613 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6614                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6615                         echo "It supports 1..."
6616                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6617                                 echo "It also supports 2..."
6618                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6619                                         voidflags=7
6620                                         echo "And it supports 4 but not 8 definitely."
6621                                 else
6622                                         echo "It doesn't support 4..."
6623                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6624                                                 voidflags=11
6625                                                 echo "But it supports 8."
6626                                         else
6627                                                 voidflags=3
6628                                                 echo "Neither does it support 8."
6629                                         fi
6630                                 fi
6631                         else
6632                                 echo "It does not support 2..."
6633                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6634                                         voidflags=13
6635                                         echo "But it supports 4 and 8."
6636                                 else
6637                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6638                                                 voidflags=5
6639                                                 echo "And it supports 4 but has not heard about 8."
6640                                         else
6641                                                 echo "However it supports 8 but not 4."
6642                                         fi
6643                                 fi
6644                         fi
6645                 else
6646                         echo "There is no support at all for void."
6647                         voidflags=0
6648                 fi
6649         fi
6650 esac
6651 case "$voidflags" in
6652 "$defvoidused") ;;
6653 *)      $cat >&4 <<'EOM'
6654   Support flag bits are:
6655     1: basic void declarations.
6656     2: arrays of pointers to functions returning void.
6657     4: operations between pointers to and addresses of void functions.
6658     8: generic void pointers.
6659 EOM
6660         dflt="$voidflags";
6661         rp="Your void support flags add up to what?"
6662         . ./myread
6663         voidflags="$ans"
6664         ;;
6665 esac
6666 $rm_try
6667
6668 : check for length of pointer
6669 echo " "
6670 case "$ptrsize" in
6671 '')
6672         echo "Checking to see how big your pointers are..." >&4
6673         if test "$voidflags" -gt 7; then
6674                 echo '#define VOID_PTR char *' > try.c
6675         else
6676                 echo '#define VOID_PTR void *' > try.c
6677         fi
6678         $cat >>try.c <<EOCP
6679 #include <stdio.h>
6680 #$i_stdlib I_STDLIB
6681 #ifdef I_STDLIB
6682 #include <stdlib.h>
6683 #endif
6684 int main()
6685 {
6686     printf("%d\n", (int)sizeof(VOID_PTR));
6687     exit(0);
6688 }
6689 EOCP
6690         set try
6691         if eval $compile_ok; then
6692                 ptrsize=`$run ./try`
6693                 echo "Your pointers are $ptrsize bytes long."
6694         else
6695                 dflt='4'
6696                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6697                 rp="What is the size of a pointer (in bytes)?"
6698                 . ./myread
6699                 ptrsize="$ans"
6700         fi
6701         ;;
6702 esac
6703 $rm_try
6704 case "$use64bitall" in
6705 "$define"|true|[yY]*)
6706         case "$ptrsize" in
6707         4)      cat <<EOM >&4
6708
6709 *** You have chosen a maximally 64-bit build,
6710 *** but your pointers are only 4 bytes wide.
6711 *** Please rerun Configure without -Duse64bitall.
6712 EOM
6713                 case "$d_quad" in
6714                 define)
6715                         cat <<EOM >&4
6716 *** Since you have quads, you could possibly try with -Duse64bitint.
6717 EOM
6718                         ;;
6719                 esac
6720                 cat <<EOM >&4
6721 *** Cannot continue, aborting.
6722
6723 EOM
6724
6725                 exit 1
6726                 ;;
6727         esac
6728         ;;
6729 esac
6730
6731
6732 : determine whether to use malloc wrapping
6733 echo " "
6734 case "$usemallocwrap" in
6735 [yY]*|true|$define)     dflt='y' ;;
6736 [nN]*|false|$undef)     dflt='n' ;;
6737 *)      case "$usedevel" in
6738         [yY]*|true|$define)     dflt='y' ;;
6739         *) dflt='n' ;;
6740         esac
6741         ;;
6742 esac
6743 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6744 . ./myread
6745 usemallocwrap="$ans"
6746 case "$ans" in
6747 y*|true)
6748         usemallocwrap="$define" ;;
6749 *)
6750         usemallocwrap="$undef" ;;
6751 esac
6752
6753 : determine which malloc to compile in
6754 echo " "
6755 case "$usemymalloc" in
6756 [yY]*|true|$define)     dflt='y' ;;
6757 [nN]*|false|$undef)     dflt='n' ;;
6758 *)      case "$ptrsize" in
6759         4) dflt='y' ;;
6760         *) dflt='n' ;;
6761         esac
6762         ;;
6763 esac
6764 rp="Do you wish to attempt to use the malloc that comes with $package?"
6765 . ./myread
6766 usemymalloc="$ans"
6767 case "$ans" in
6768 y*|true)
6769         usemymalloc='y'
6770         mallocsrc='malloc.c'
6771         mallocobj="malloc$_o"
6772         d_mymalloc="$define"
6773         case "$libs" in
6774         *-lmalloc*)
6775                 : Remove malloc from list of libraries to use
6776                 echo "Removing unneeded -lmalloc from library list" >&4
6777                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6778                 shift
6779                 libs="$*"
6780                 echo "libs = $libs" >&4
6781                 ;;
6782         esac
6783         ;;
6784 *)
6785         usemymalloc='n'
6786         mallocsrc=''
6787         mallocobj=''
6788         d_mymalloc="$undef"
6789         ;;
6790 esac
6791
6792 : compute the return types of malloc and free
6793 echo " "
6794 $cat >malloc.c <<END
6795 #$i_malloc I_MALLOC
6796 #$i_stdlib I_STDLIB
6797 #include <stdio.h>
6798 #include <sys/types.h>
6799 #ifdef I_MALLOC
6800 #include <malloc.h>
6801 #endif
6802 #ifdef I_STDLIB
6803 #include <stdlib.h>
6804 #endif
6805 #ifdef TRY_MALLOC
6806 void *malloc();
6807 #endif
6808 #ifdef TRY_FREE
6809 void free();
6810 #endif
6811 END
6812 case "$malloctype" in
6813 '')
6814         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6815                 malloctype='void *'
6816         else
6817                 malloctype='char *'
6818         fi
6819         ;;
6820 esac
6821 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6822
6823 case "$freetype" in
6824 '')
6825         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6826                 freetype='void'
6827         else
6828                 freetype='int'
6829         fi
6830         ;;
6831 esac
6832 echo "Your system uses $freetype free(), it would seem." >&4
6833 $rm -f malloc.[co]
6834 : determine where site specific architecture-dependent libraries go.
6835 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6836 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6837 : sitelib may have an optional trailing /share.
6838 case "$sitearch" in
6839 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6840         dflt="$dflt/$archname"
6841         ;;
6842 *)      dflt="$sitearch"
6843         ;;
6844 esac
6845 set sitearch sitearch none
6846 eval $prefixit
6847 $cat <<EOM
6848
6849 The installation process will also create a directory for
6850 architecture-dependent site-specific extensions and modules.
6851
6852 EOM
6853 fn=d~+
6854 rp='Pathname for the site-specific architecture-dependent library files?'
6855 . ./getfile
6856 prefixvar=sitearch
6857 . ./setprefixvar
6858 if $test X"$sitearch" = X"$sitelib"; then
6859         d_sitearch="$undef"
6860 else
6861         d_sitearch="$define"
6862 fi
6863
6864 : Set the vendorprefix variables
6865 $cat <<EOM
6866
6867 The installation process will also create a directory for
6868 vendor-supplied add-ons.  Vendors who supply perl with their system
6869 may find it convenient to place all vendor-supplied files in this
6870 directory rather than in the main distribution directory.  This will
6871 ease upgrades between binary-compatible maintenance versions of perl.
6872
6873 Of course you may also use these directories in whatever way you see
6874 fit.  For example, you might use them to access modules shared over a
6875 company-wide network.
6876
6877 The default answer should be fine for most people.
6878 This causes further questions about vendor add-ons to be skipped
6879 and no vendor-specific directories will be configured for perl.
6880
6881 EOM
6882 rp='Do you want to configure vendor-specific add-on directories?'
6883 case "$usevendorprefix" in
6884 define|true|[yY]*) dflt=y ;;
6885 *)      : User may have set vendorprefix directly on Configure command line.
6886         case "$vendorprefix" in
6887         ''|' ') dflt=n ;;
6888         *)      dflt=y ;;
6889         esac
6890         ;;
6891 esac
6892 . ./myread
6893 case "$ans" in
6894 [yY]*)  fn=d~+
6895         rp='Installation prefix to use for vendor-supplied add-ons?'
6896         case "$vendorprefix" in
6897         '') dflt='' ;;
6898         *)  dflt=$vendorprefix ;;
6899         esac
6900         . ./getfile
6901         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6902         oldvendorprefix=''
6903         case "$vendorprefix" in
6904         '') ;;
6905         *)      case "$ans" in
6906                 "$prefix") ;;
6907                 *) oldvendorprefix="$prefix";;
6908                 esac
6909                 ;;
6910         esac
6911         usevendorprefix="$define"
6912         vendorprefix="$ans"
6913         vendorprefixexp="$ansexp"
6914         ;;
6915 *)      usevendorprefix="$undef"
6916         vendorprefix=''
6917         vendorprefixexp=''
6918         ;;
6919 esac
6920
6921 : Set the vendorlib variables
6922 case "$vendorprefix" in
6923 '')     d_vendorlib="$undef"
6924         vendorlib=''
6925         vendorlibexp=''
6926         ;;
6927 *)      d_vendorlib="$define"
6928         : determine where vendor-supplied modules go.
6929         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6930         case "$vendorlib" in
6931         '')
6932                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6933                 case "$installstyle" in
6934                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6935                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6936                 esac
6937                 ;;
6938         *)      dflt="$vendorlib"
6939                 ;;
6940         esac
6941         fn=d~+
6942         rp='Pathname for the vendor-supplied library files?'
6943         . ./getfile
6944         vendorlib="$ans"
6945         vendorlibexp="$ansexp"
6946         ;;
6947 esac
6948 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6949 prefixvar=vendorlib
6950 . ./installprefix
6951
6952 : Set the vendorarch variables
6953 case "$vendorprefix" in
6954 '')     d_vendorarch="$undef"
6955         vendorarch=''
6956         vendorarchexp=''
6957         ;;
6958 *)      d_vendorarch="$define"
6959         : determine where vendor-supplied architecture-dependent libraries go.
6960         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6961         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6962         : vendorlib may have an optional trailing /share.
6963         case "$vendorarch" in
6964         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6965                 dflt="$dflt/$archname"
6966                 ;;
6967         *)      dflt="$vendorarch" ;;
6968         esac
6969         fn=d~+
6970         rp='Pathname for vendor-supplied architecture-dependent files?'
6971         . ./getfile
6972         vendorarch="$ans"
6973         vendorarchexp="$ansexp"
6974         ;;
6975 esac
6976 prefixvar=vendorarch
6977 . ./installprefix
6978
6979 : Final catch-all directories to search
6980 $cat <<EOM
6981
6982 Lastly, you can have perl look in other directories for extensions and
6983 modules in addition to those already specified.
6984 These directories will be searched after 
6985         $sitearch 
6986         $sitelib 
6987 EOM
6988 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6989 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6990 echo ' '
6991 case "$otherlibdirs" in
6992 ''|' ') dflt='none' ;;
6993 *)      dflt="$otherlibdirs" ;;
6994 esac
6995 $cat <<EOM
6996 Enter a colon-separated set of extra paths to include in perl's @INC
6997 search path, or enter 'none' for no extra paths.
6998
6999 EOM
7000
7001 rp='Colon-separated list of additional directories for perl to search?'
7002 . ./myread
7003 case "$ans" in
7004 ' '|''|none)    otherlibdirs=' ' ;;     
7005 *)      otherlibdirs="$ans" ;;
7006 esac
7007 case "$otherlibdirs" in
7008 ' ') val=$undef ;;
7009 *)      val=$define ;;
7010 esac
7011 set d_perl_otherlibdirs
7012 eval $setvar
7013
7014 : Cruising for prototypes
7015 echo " "
7016 echo "Checking out function prototypes..." >&4
7017 $cat >prototype.c <<EOCP
7018 #$i_stdlib I_STDLIB
7019 #ifdef I_STDLIB
7020 #include <stdlib.h>
7021 #endif
7022 int main(int argc, char *argv[]) {
7023         exit(0);}
7024 EOCP
7025 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7026         echo "Your C compiler appears to support function prototypes."
7027         val="$define"
7028 else
7029         echo "Your C compiler doesn't seem to understand function prototypes."
7030         val="$undef"
7031 fi
7032 set prototype
7033 eval $setvar
7034 $rm -f prototype*
7035
7036 : Check if ansi2knr is required
7037 case "$prototype" in
7038 "$define") ;;
7039 *)      ansi2knr='ansi2knr'
7040         echo " "
7041         cat <<EOM >&4
7042
7043 $me:  FATAL ERROR:
7044 This version of $package can only be compiled by a compiler that 
7045 understands function prototypes.  Unfortunately, your C compiler 
7046         $cc $ccflags
7047 doesn't seem to understand them.  Sorry about that.
7048
7049 If GNU cc is available for your system, perhaps you could try that instead.  
7050
7051 Eventually, we hope to support building Perl with pre-ANSI compilers.
7052 If you would like to help in that effort, please contact <perlbug@perl.org>.
7053
7054 Aborting Configure now.
7055 EOM
7056         exit 2
7057         ;;
7058 esac
7059
7060 : See if we want extra modules installed
7061 echo " "
7062 case "$extras" in
7063 '') dflt='n';;
7064 *) dflt='y';;
7065 esac
7066 cat <<EOM
7067 Perl can be built with extra modules or bundles of modules which
7068 will be fetched from the CPAN and installed alongside Perl.
7069
7070 Notice that you will need access to the CPAN; either via the Internet,
7071 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7072 be asked later to configure the CPAN.pm module which will in turn do
7073 the installation of the rest of the extra modules or bundles.)
7074
7075 Notice also that if the modules require any external software such as
7076 libraries and headers (the libz library and the zlib.h header for the
7077 Compress::Zlib module, for example) you MUST have any such software
7078 already installed, this configuration process will NOT install such
7079 things for you.
7080
7081 If this doesn't make any sense to you, just accept the default '$dflt'.
7082 EOM
7083 rp='Install any extra modules (y or n)?'
7084 . ./myread
7085 case "$ans" in
7086 y|Y)
7087         cat <<EOM
7088
7089 Please list any extra modules or bundles to be installed from CPAN,
7090 with spaces between the names.  The names can be in any format the
7091 'install' command of CPAN.pm will understand.  (Answer 'none',
7092 without the quotes, to install no extra modules or bundles.)
7093 EOM
7094         rp='Extras?'
7095         dflt="$extras"
7096         . ./myread
7097         extras="$ans"
7098 esac
7099 case "$extras" in
7100 ''|'none')
7101         val=''
7102         $rm -f ../extras.lst
7103         ;;
7104 *)      echo "(Saving the list of extras for later...)"
7105         echo "$extras" > ../extras.lst
7106         val="'$extras'"
7107         ;;
7108 esac
7109 set extras
7110 eval $setvar
7111 echo " "
7112
7113 : determine where html pages for programs go
7114 set html1dir html1dir none
7115 eval $prefixit
7116 $cat <<EOM
7117
7118 If you wish to install html files for programs in $spackage, indicate
7119 the appropriate directory here.  To skip installing html files,
7120 answer "none".
7121 EOM
7122 case "$html1dir" in
7123 ''|none|$undef|' ') dflt=none ;;
7124 *) dflt=$html1dir ;;
7125 esac
7126 fn=dn+~
7127 rp="Directory for the main $spackage html pages?"
7128 . ./getfile
7129 prefixvar=html1dir
7130 . ./setprefixvar
7131 : Use ' ' for none so value is preserved next time through Configure
7132 $test X"$html1dir" = "X" && html1dir=' '
7133
7134 : determine where html pages for libraries and modules go
7135 set html3dir html3dir none
7136 eval $prefixit
7137 $cat <<EOM
7138
7139 If you wish to install html files for modules associated with $spackage,
7140 indicate the appropriate directory here.  To skip installing html files,
7141 answer "none".
7142 EOM
7143 : There is no obvious default.  If they have specified html1dir, then
7144 : try to key off that, possibly changing .../html1 into .../html3.
7145 case "$html3dir" in
7146 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7147 *) dflt=$html3dir ;;
7148 esac
7149 fn=dn+~
7150 rp="Directory for the $spackage module html pages?"
7151 . ./getfile
7152 prefixvar=html3dir
7153 . ./setprefixvar
7154 : Use ' ' for none so value is preserved next time through Configure
7155 $test X"$html3dir" = "X" && html3dir=' '
7156
7157 : determine whether to install perl also as /usr/bin/perl
7158
7159 echo " "
7160 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7161         $cat <<EOM
7162 Many scripts expect perl to be installed as /usr/bin/perl.
7163
7164 If you want to, I can install the perl you are about to compile
7165 as /usr/bin/perl (in addition to $bin/perl).
7166 EOM
7167         if test -f /usr/bin/perl; then
7168             $cat <<EOM
7169
7170 However, please note that because you already have a /usr/bin/perl,
7171 overwriting that with a new Perl would very probably cause problems.
7172 Therefore I'm assuming you don't want to do that (unless you insist).
7173
7174 EOM
7175             case "$installusrbinperl" in
7176             "$define"|[yY]*)    dflt='y';;
7177             *)                  dflt='n';;
7178             esac
7179         else
7180             $cat <<EOM
7181
7182 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7183
7184 EOM
7185             case "$installusrbinperl" in
7186             "$undef"|[nN]*)     dflt='n';;
7187             *)                  dflt='y';;
7188             esac
7189         fi
7190         rp="Do you want to install perl as /usr/bin/perl?"
7191         . ./myread
7192         case "$ans" in
7193         [yY]*)  val="$define";;
7194         *)      val="$undef" ;;
7195         esac
7196 else
7197         val="$undef"
7198 fi
7199 set installusrbinperl
7200 eval $setvar
7201
7202 : Check if we are using the GNU C library
7203 echo " "
7204 echo "Checking for GNU C Library..." >&4
7205 cat >try.c <<'EOCP'
7206 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7207    alone are insufficient to distinguish different versions, such as
7208    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7209    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7210 */
7211 #include <stdio.h>
7212 int main(void)
7213 {
7214 #ifdef __GLIBC__
7215 #   ifdef __GLIBC_MINOR__
7216 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7217 #           include <gnu/libc-version.h>
7218             printf("%s\n",  gnu_get_libc_version());
7219 #       else
7220             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7221 #       endif
7222 #   else
7223         printf("%d\n",  __GLIBC__);
7224 #   endif
7225     return 0;
7226 #else
7227     return 1;
7228 #endif
7229 }
7230 EOCP
7231 set try
7232 if eval $compile_ok && $run ./try > glibc.ver; then
7233         val="$define"
7234         gnulibc_version=`$cat glibc.ver`
7235         echo "You are using the GNU C Library version $gnulibc_version"
7236 else
7237         val="$undef"
7238         gnulibc_version=''
7239         echo "You are not using the GNU C Library"
7240 fi
7241 $rm_try glibc.ver
7242 set d_gnulibc
7243 eval $setvar
7244
7245 : see if nm is to be used to determine whether a symbol is defined or not
7246 case "$usenm" in
7247 '')
7248         dflt=''
7249         case "$d_gnulibc" in
7250         "$define")
7251                 echo " "
7252                 echo "nm probably won't work on the GNU C Library." >&4
7253                 dflt=n
7254                 ;;
7255         esac
7256         case "$dflt" in
7257         '') 
7258                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7259                         echo " "
7260                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7261                         echo "'nm' won't be sufficient on this sytem." >&4
7262                         dflt=n
7263                 fi
7264                 ;;
7265         esac
7266         case "$dflt" in
7267         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7268                 if $test $dflt -gt 20; then
7269                         dflt=y
7270                 else
7271                         dflt=n
7272                 fi
7273                 ;;
7274         esac
7275         ;;
7276 *)
7277         case "$usenm" in
7278         true|$define) dflt=y;;
7279         *) dflt=n;;
7280         esac
7281         ;;
7282 esac
7283 $cat <<EOM
7284
7285 I can use $nm to extract the symbols from your C libraries. This
7286 is a time consuming task which may generate huge output on the disk (up
7287 to 3 megabytes) but that should make the symbols extraction faster. The
7288 alternative is to skip the 'nm' extraction part and to compile a small
7289 test program instead to determine whether each symbol is present. If
7290 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7291 this may be the best solution.
7292
7293 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7294
7295 EOM
7296 rp="Shall I use $nm to extract C symbols from the libraries?"
7297 . ./myread
7298 case "$ans" in
7299 [Nn]*) usenm=false;;
7300 *) usenm=true;;
7301 esac
7302
7303 runnm=$usenm
7304 case "$reuseval" in
7305 true) runnm=false;;
7306 esac
7307
7308 : nm options which may be necessary
7309 case "$nm_opt" in
7310 '') if $test -f /mach_boot; then
7311                 nm_opt=''       # Mach
7312         elif $test -d /usr/ccs/lib; then
7313                 nm_opt='-p'     # Solaris (and SunOS?)
7314         elif $test -f /dgux; then
7315                 nm_opt='-p'     # DG-UX
7316         elif $test -f /lib64/rld; then
7317                 nm_opt='-p'     # 64-bit Irix
7318         else
7319                 nm_opt=''
7320         fi;;
7321 esac
7322
7323 : nm options which may be necessary for shared libraries but illegal
7324 : for archive libraries.  Thank you, Linux.
7325 case "$nm_so_opt" in
7326 '')     case "$myuname" in
7327         *linux*|gnu*)
7328                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7329                         nm_so_opt='--dynamic'
7330                 fi
7331                 ;;
7332         esac
7333         ;;
7334 esac
7335
7336 case "$runnm" in
7337 true)
7338 : get list of predefined functions in a handy place
7339 echo " "
7340 case "$libc" in
7341 '') libc=unknown
7342         case "$libs" in
7343         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7344         esac
7345         ;;
7346 esac
7347 case "$libs" in
7348 '') ;;
7349 *)  for thislib in $libs; do
7350         case "$thislib" in
7351         -lc|-lc_s)
7352                 : Handle C library specially below.
7353                 ;;
7354         -l*)
7355                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7356                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7357                         :
7358                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7359                         :
7360                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7361                         :
7362                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7363                         :
7364                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7365                         :
7366                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7367                         :
7368                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7369                         :
7370                 else
7371                         try=''
7372                 fi
7373                 libnames="$libnames $try"
7374                 ;;
7375         *) libnames="$libnames $thislib" ;;
7376         esac
7377         done
7378         ;;
7379 esac
7380 xxx=normal
7381 case "$libc" in
7382 unknown)
7383         set /lib/libc.$so
7384         for xxx in $libpth; do
7385                 $test -r $1 || set $xxx/libc.$so
7386                 : The messy sed command sorts on library version numbers.
7387                 $test -r $1 || \
7388                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7389                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7390                                 h
7391                                 s/[0-9][0-9]*/0000&/g
7392                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7393                                 G
7394                                 s/\n/ /' | \
7395                          $sort | $sed -e 's/^.* //'`
7396                 eval set \$$#
7397         done
7398         $test -r $1 || set /usr/ccs/lib/libc.$so
7399         $test -r $1 || set /lib/libsys_s$_a
7400         ;;
7401 *)
7402         set blurfl
7403         ;;
7404 esac
7405 if $test -r "$1"; then
7406         echo "Your (shared) C library seems to be in $1."
7407         libc="$1"
7408 elif $test -r /lib/libc && $test -r /lib/clib; then
7409         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7410         xxx=apollo
7411         libc='/lib/clib /lib/libc'
7412         if $test -r /lib/syslib; then
7413                 echo "(Your math library is in /lib/syslib.)"
7414                 libc="$libc /lib/syslib"
7415         fi
7416 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7417         echo "Your C library seems to be in $libc, as you said before."
7418 elif $test -r $incpath/usr/lib/libc$_a; then
7419         libc=$incpath/usr/lib/libc$_a;
7420         echo "Your C library seems to be in $libc.  That's fine."
7421 elif $test -r /lib/libc$_a; then
7422         libc=/lib/libc$_a;
7423         echo "Your C library seems to be in $libc.  You're normal."
7424 else
7425         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7426                 :
7427         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7428                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7429         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7430                 :
7431         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7432                 :
7433         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7434                 :
7435         else
7436                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7437         fi
7438         if $test -r "$tans"; then
7439                 echo "Your C library seems to be in $tans, of all places."
7440                 libc=$tans
7441         else
7442                 libc='blurfl'
7443         fi
7444 fi
7445 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7446         dflt="$libc"
7447         cat <<EOM
7448
7449 If the guess above is wrong (which it might be if you're using a strange
7450 compiler, or your machine supports multiple models), you can override it here.
7451
7452 EOM
7453 else
7454         dflt=''
7455         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7456         cat >&4 <<EOM
7457 I can't seem to find your C library.  I've looked in the following places:
7458
7459 EOM
7460         $sed 's/^/      /' libpath
7461         cat <<EOM
7462
7463 None of these seems to contain your C library. I need to get its name...
7464
7465 EOM
7466 fi
7467 fn=f
7468 rp='Where is your C library?'
7469 . ./getfile
7470 libc="$ans"
7471
7472 echo " "
7473 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7474 set X `cat libnames`
7475 shift
7476 xxx=files
7477 case $# in 1) xxx=file; esac
7478 echo "Extracting names from the following $xxx for later perusal:" >&4
7479 echo " "
7480 $sed 's/^/      /' libnames >&4
7481 echo " "
7482 $echo $n "This may take a while...$c" >&4
7483
7484 for file in $*; do
7485         case $file in
7486         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7487         *) $nm $nm_opt $file 2>/dev/null;;
7488         esac
7489 done >libc.tmp
7490
7491 $echo $n ".$c"
7492 $grep fprintf libc.tmp > libc.ptf
7493 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7494 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7495 xxx='[ADTSIW]'
7496 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7497         eval $xscan;\
7498         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7499                 eval $xrun
7500 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7501         eval $xscan;\
7502         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7503                 eval $xrun
7504 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7505         eval $xscan;\
7506         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7507                 eval $xrun
7508 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7509         eval $xscan;\
7510         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7511                 eval $xrun
7512 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7513         eval $xscan;\
7514         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7515                 eval $xrun
7516 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7517         eval $xscan;\
7518         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7519                 eval $xrun
7520 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7521                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7522         eval $xscan;\
7523         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7524                 eval $xrun
7525 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7526         eval $xscan;\
7527         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7528                 eval $xrun
7529 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7530         eval $xscan;\
7531         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7532                 eval $xrun
7533 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7534         eval $xscan;\
7535         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7536                 eval $xrun
7537 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7538         eval $xscan;\
7539         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7540                 eval $xrun
7541 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7542         eval $xscan;\
7543         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7544                 eval $xrun
7545 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7546         eval $xscan;\
7547         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7548                 eval $xrun
7549 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7550         eval $xscan;\
7551         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7552                 eval $xrun
7553 else
7554         $nm -p $* 2>/dev/null >libc.tmp
7555         $grep fprintf libc.tmp > libc.ptf
7556         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7557                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7558         then
7559                 nm_opt='-p'
7560                 eval $xrun
7561         else
7562                 echo " "
7563                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7564                 com=''
7565                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7566                         for thisname in $libnames $libc; do
7567                                 $ar t $thisname >>libc.tmp
7568                         done
7569                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7570                         echo "Ok." >&4
7571                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7572                         # Repeat libc to extract forwarders to DLL entries too
7573                         for thisname in $libnames $libc; do
7574                                 $ar tv $thisname >>libc.tmp
7575                                 # Revision 50 of EMX has bug in $ar.
7576                                 # it will not extract forwarders to DLL entries
7577                                 # Use emximp which will extract exactly them.
7578                                 emximp -o tmp.imp $thisname \
7579                                     2>/dev/null && \
7580                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7581                                     < tmp.imp >>libc.tmp
7582                                 $rm tmp.imp
7583                         done
7584                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7585                         echo "Ok." >&4
7586                 else
7587                         echo "$ar didn't seem to work right." >&4
7588                         echo "Maybe this is a Cray...trying bld instead..." >&4
7589                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7590                         then
7591                                 for thisname in $libnames; do
7592                                         bld t $libnames | \
7593                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7594                                         $ar t $thisname >>libc.tmp
7595                                 done
7596                                 echo "Ok." >&4
7597                         else
7598                                 echo "That didn't work either.  Giving up." >&4
7599                                 exit 1
7600                         fi
7601                 fi
7602         fi
7603 fi
7604 nm_extract="$com"
7605 case "$PASE" in
7606 define)
7607     echo " "
7608     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7609     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7610     ;;
7611 *)  if $test -f /lib/syscalls.exp; then
7612         echo " "
7613         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7614         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7615     fi
7616     ;;
7617 esac
7618 ;;
7619 esac
7620 $rm -f libnames libpath
7621
7622 : see if dld is available
7623 set dld.h i_dld
7624 eval $inhdr
7625
7626 : Check if we are using C++
7627 echo " "
7628 echo "Checking for C++..." >&4
7629 $cat >try.c <<'EOCP'
7630 #include <stdio.h>
7631 int main(void)
7632 {
7633 #ifdef __cplusplus
7634     return 0;
7635 #else
7636     return 1;
7637 #endif
7638 }
7639 EOCP
7640 set try
7641 if eval $compile_ok && $run ./try; then
7642         val="$define"
7643         echo "You are using a C++ compiler."
7644 else
7645         val="$undef"
7646         echo "You are not using a C++ compiler."
7647 fi
7648 $rm_try cplusplus$$
7649 set d_cplusplus
7650 eval $setvar
7651
7652 : is a C symbol defined?
7653 csym='tlook=$1;
7654 case "$3" in
7655 -v) tf=libc.tmp; tdc="";;
7656 -a) tf=libc.tmp; tdc="[]";;
7657 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7658 esac;
7659 tx=yes;
7660 case "$reuseval-$4" in
7661 true-) ;;
7662 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7663 esac;
7664 case "$tx" in
7665 yes)
7666         tval=false;
7667         case "$d_cplusplus" in
7668                 $define) extern_C=\"C\";;
7669         esac;
7670         if $test "$runnm" = true; then
7671                 if $contains $tlook $tf >/dev/null 2>&1; then
7672                         tval=true;
7673                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7674                         echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7675                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7676                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7677                         $rm_try;
7678                 fi;
7679         else
7680                 echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7681                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7682                 $rm_try;
7683         fi;
7684         ;;
7685 *)
7686         case "$tval" in
7687         $define) tval=true;;
7688         *) tval=false;;
7689         esac;
7690         ;;
7691 esac;
7692 eval "$2=$tval"'
7693
7694 : define an is-in-libc? function
7695 inlibc='echo " "; td=$define; tu=$undef;
7696 sym=$1; var=$2; eval "was=\$$2";
7697 tx=yes;
7698 case "$reuseval$was" in
7699 true) ;;
7700 true*) tx=no;;
7701 esac;
7702 case "$tx" in
7703 yes)
7704         set $sym tres -f;
7705         eval $csym;
7706         case "$tres" in
7707         true)
7708                 echo "$sym() found." >&4;
7709                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7710         *)
7711                 echo "$sym() NOT found." >&4;
7712                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7713         esac;;
7714 *)
7715         case "$was" in
7716         $define) echo "$sym() found." >&4;;
7717         *) echo "$sym() NOT found." >&4;;
7718         esac;;
7719 esac'
7720
7721 : see if dlopen exists
7722 xxx_runnm="$runnm"
7723 xxx_ccflags="$ccflags"
7724 runnm=false
7725 : with g++ one needs -shared to get is-in-libc to work for dlopen
7726 case "$gccversion" in
7727 '')     ;;
7728 *)      case "$d_cplusplus" in
7729         "$define") ccflags="$ccflags -shared" ;;
7730         esac
7731         ;;
7732 esac
7733 set dlopen d_dlopen
7734 eval $inlibc
7735 runnm="$xxx_runnm"
7736 ccflags="$xxx_ccflags"
7737
7738 : see if this is a unistd.h system
7739 set unistd.h i_unistd
7740 eval $inhdr
7741
7742 : determine which dynamic loading, if any, to compile in
7743 echo " "
7744 dldir="ext/DynaLoader"
7745 case "$usedl" in
7746 $define|y|true)
7747         dflt='y'
7748         usedl="$define"
7749         ;;
7750 $undef|n|false)
7751         dflt='n'
7752         usedl="$undef"
7753         ;;
7754 *)
7755         dflt='n'
7756         case "$d_dlopen" in
7757             $define) dflt='y' ;;
7758         esac
7759         case "$i_dld" in
7760             $define) dflt='y' ;;
7761         esac
7762         : Does a dl_xxx.xs file exist for this operating system
7763         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7764         ;;
7765 esac
7766 rp="Do you wish to use dynamic loading?"
7767 . ./myread
7768 usedl="$ans"
7769 case "$ans" in
7770 y*) usedl="$define"
7771         case "$dlsrc" in
7772         '')
7773                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7774                         dflt="$dldir/dl_${osname}.xs"
7775                 elif $test "$d_dlopen" = "$define" ; then
7776                         dflt="$dldir/dl_dlopen.xs"
7777                 elif $test "$i_dld" = "$define" ; then
7778                         dflt="$dldir/dl_dld.xs"
7779                 else
7780                         dflt=''
7781                 fi
7782                 ;;
7783         *)      dflt="$dldir/$dlsrc"
7784                 ;;
7785         esac
7786     echo "The following dynamic loading files are available:"
7787         : Can not go over to $dldir because getfile has path hard-coded in.
7788         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7789         rp="Source file to use for dynamic loading"
7790         fn="fne"
7791         gfpth="$src"
7792         . ./getfile
7793         usedl="$define"
7794         : emulate basename
7795         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7796
7797         $cat << EOM
7798
7799 Some systems may require passing special flags to $cc -c to
7800 compile modules that will be used to create a shared library.
7801 To use no flags, say "none".
7802
7803 EOM
7804     case "$cccdlflags" in
7805     '') case "$gccversion" in
7806                 '') case "$osname" in
7807                         hpux)   dflt='+z' ;;
7808                         next)   dflt='none' ;;
7809                         irix*)  dflt='-KPIC' ;;
7810                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7811                         sunos)  dflt='-pic' ;;
7812                         *)      dflt='none' ;;
7813                     esac
7814                         ;;
7815                 *)  case "$osname" in
7816                         darwin) dflt='none' ;;
7817                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7818                         *)      dflt='-fpic' ;;
7819                     esac ;;
7820             esac ;;
7821         ' ') dflt='none' ;;
7822     *)  dflt="$cccdlflags" ;;
7823     esac
7824     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7825     . ./myread
7826     case "$ans" in
7827     none) cccdlflags=' ' ;;
7828     *) cccdlflags="$ans" ;;
7829     esac
7830
7831     cat << EOM
7832
7833 Some systems use ld to create libraries that can be dynamically loaded,
7834 while other systems (such as those using ELF) use $cc.
7835
7836 EOM
7837         case "$ld" in
7838         '')     $cat >try.c <<EOM
7839 /* Test for whether ELF binaries are produced */
7840 #include <fcntl.h>
7841 #$i_stdlib I_STDLIB
7842 #ifdef I_STDLIB
7843 #include <stdlib.h>
7844 #endif
7845 #$i_unistd I_UNISTD
7846 #ifdef I_UNISTD
7847 #include <unistd.h>
7848 #endif
7849 int main() {
7850         char b[4];
7851         int i = open("a.out",O_RDONLY);
7852         if(i == -1)
7853                 exit(1); /* fail */
7854         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7855                 exit(0); /* succeed (yes, it's ELF) */
7856         else
7857                 exit(1); /* fail */
7858 }
7859 EOM
7860                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7861                         cat <<EOM
7862 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7863 EOM
7864                         dflt="$cc"
7865                 else
7866                         echo "I'll use ld to build dynamic libraries."
7867                         dflt='ld'
7868                 fi
7869                 $rm_try
7870                 ;;
7871         *)      dflt="$ld"
7872                 ;;
7873         esac
7874
7875     rp="What command should be used to create dynamic libraries?"
7876     . ./myread
7877         ld="$ans"
7878
7879     cat << EOM
7880
7881 Some systems may require passing special flags to $ld to create a
7882 library that can be dynamically loaded.  If your ld flags include
7883 -L/other/path options to locate libraries outside your loader's normal
7884 search path, you may need to specify those -L options here as well.  To
7885 use no flags, say "none".
7886
7887 EOM
7888     case "$lddlflags" in
7889     '') case "$osname" in
7890                         beos) dflt='-nostart' ;;
7891                         hpux) dflt='-b';
7892                               case "$gccversion" in
7893                               '') dflt="$dflt +vnocompatwarnings" ;;
7894                               esac
7895                               ;;
7896                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
7897                         next)  dflt='none' ;;
7898                         solaris) dflt='-G' ;;
7899                         sunos) dflt='-assert nodefinitions' ;;
7900                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7901                 *)     dflt='none' ;;
7902                         esac
7903                         ;;
7904     *) dflt="$lddlflags" ;;
7905     esac
7906
7907         : Try to guess additional flags to pick up local libraries.
7908         : Be careful not to append to a plain 'none'
7909         case "$dflt" in
7910         none) dflt='' ;;
7911         esac
7912         for thisflag in $ldflags; do
7913                 case "$thisflag" in
7914                 -L*|-R*|-Wl,-R*)
7915                         case " $dflt " in
7916                         *" $thisflag "*) ;;
7917                         *) dflt="$dflt $thisflag" ;;
7918                         esac
7919                         ;;
7920                 esac
7921         done
7922
7923         case "$dflt" in
7924         ''|' ') dflt='none' ;;
7925         esac
7926
7927     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7928     . ./myread
7929     case "$ans" in
7930     none) lddlflags=' ' ;;
7931     *) lddlflags="$ans" ;;
7932     esac
7933
7934         cat <<EOM
7935
7936 Some systems may require passing special flags to $cc to indicate that
7937 the resulting executable will use dynamic linking.  To use no flags,
7938 say "none".
7939
7940 EOM
7941     case "$ccdlflags" in
7942     '') case "$osname" in
7943             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
7944             next|sunos) dflt='none' ;;
7945             *)          dflt='none' ;;
7946             esac ;;
7947     ' ')  dflt='none' ;;
7948     *)  dflt="$ccdlflags" ;;
7949     esac
7950     rp="Any special flags to pass to $cc to use dynamic linking?"
7951     . ./myread
7952     case "$ans" in
7953     none) ccdlflags=' ' ;;
7954     *) ccdlflags="$ans" ;;
7955     esac
7956     ;;
7957 *)  usedl="$undef"
7958         ld='ld'
7959     dlsrc='dl_none.xs'
7960     lddlflags=''
7961     ccdlflags=''
7962     ;;
7963 esac
7964
7965 also=''
7966 case "$usedl" in
7967 $undef)
7968         # No dynamic loading being used, so don't bother even to prompt.
7969         useshrplib='false'
7970         ;;
7971 *)      case "$useshrplib" in
7972         '')     case "$osname" in
7973                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7974                         dflt=y
7975                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7976                         ;;
7977                 next*)
7978                         case "$osvers" in
7979                         4*)     dflt=y
7980                                 also='Building a shared libperl is needed for MAB support.'
7981                                 ;;
7982                         *)      dflt=n
7983                                 ;;
7984                         esac
7985                         ;;
7986                 *)      dflt=n
7987                         ;;
7988                 esac
7989                 ;;
7990         $define|true|[Yy]*)
7991                 dflt=y
7992                 ;;
7993         *)      dflt=n
7994                 ;;
7995         esac
7996         $cat << EOM
7997
7998 The perl executable is normally obtained by linking perlmain.c with
7999 libperl${_a}, any static extensions (usually just DynaLoader), and
8000 any other libraries needed on this system (such as -lm, etc.).  Since
8001 your system supports dynamic loading, it is probably possible to build
8002 a shared libperl.$so.  If you will have more than one executable linked
8003 to libperl.$so, this will significantly reduce the size of each
8004 executable, but it may have a noticeable effect on performance.  The
8005 default is probably sensible for your system.
8006 $also
8007
8008 EOM
8009         rp="Build a shared libperl.$so (y/n)"
8010         . ./myread
8011         case "$ans" in
8012         true|$define|[Yy]*)
8013                 useshrplib='true'  ;;
8014         *)      useshrplib='false' ;;
8015         esac
8016         ;;
8017 esac
8018
8019 case "$useshrplib" in
8020 true)
8021         case "$libperl" in
8022         '')
8023                 # Figure out a good name for libperl.so.  Since it gets stored in
8024                 # a version-specific architecture-dependent library, the version
8025                 # number isn't really that important, except for making cc/ld happy.
8026                 #
8027                 # A name such as libperl.so.3.1
8028                 majmin="libperl.$so.$patchlevel.$subversion"
8029                 # A name such as libperl.so.301
8030                 majonly=`echo $patchlevel $subversion |
8031                         $awk '{printf "%d%02d", $1, $2}'`
8032                 majonly=libperl.$so.$majonly
8033                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8034                 # rely on figuring it out from the naming of libc.
8035                 case "${osname}${osvers}" in
8036                 next4*)
8037                         dflt=libperl.5.$so
8038                         # XXX How handle the --version stuff for MAB?
8039                         ;;
8040                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8041                         dflt=libperl.$so
8042                         ;;
8043                 cygwin*) # ld links against an importlib
8044                         dflt=libperl$lib_ext
8045                         ;;
8046                 *)      # Try to guess based on whether libc has major.minor.
8047                         case "$libc" in
8048                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8049                         *libc.$so.[0-9]*) dflt=$majonly ;;
8050                         *)      dflt=libperl.$so ;;
8051                         esac
8052                         ;;
8053                 esac
8054                 ;;
8055         *)      dflt=$libperl
8056                 ;;
8057         esac
8058         cat << EOM
8059
8060 I need to select a good name for the shared libperl.  If your system uses
8061 library names with major and minor numbers, then you might want something
8062 like $majmin.  Alternatively, if your system uses a single version
8063 number for shared libraries, then you might want to use $majonly.
8064 Or, your system might be quite happy with a simple libperl.$so.
8065
8066 Since the shared libperl will get installed into a version-specific
8067 architecture-dependent directory, the version number of the shared perl
8068 library probably isn't important, so the default should be o.k.
8069
8070 EOM
8071         rp='What name do you want to give to the shared libperl?'
8072         . ./myread
8073         libperl=$ans
8074         echo "Ok, I'll use $libperl"
8075         ;;
8076 *)
8077         libperl="libperl${_a}"
8078         ;;
8079 esac
8080
8081 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8082 case "$shrpdir" in
8083 '') ;;
8084 *)      $cat >&4 <<EOM
8085 WARNING:  Use of the shrpdir variable for the installation location of
8086 the shared $libperl is not supported.  It was never documented and
8087 will not work in this version.  Let me (perlbug@perl.org)
8088 know of any problems this may cause.
8089
8090 EOM
8091         case "$shrpdir" in
8092         "$archlibexp/CORE")
8093                 $cat >&4 <<EOM
8094 But your current setting of $shrpdir is
8095 the default anyway, so it's harmless.
8096 EOM
8097                 ;;
8098         *)
8099                 $cat >&4 <<EOM
8100 Further, your current attempted setting of $shrpdir
8101 conflicts with the value of $archlibexp/CORE
8102 that installperl will use.
8103 EOM
8104                 ;;
8105         esac
8106         ;;
8107 esac
8108
8109 # How will the perl executable find the installed shared $libperl?
8110 # Add $xxx to ccdlflags.
8111 # If we can't figure out a command-line option, use $shrpenv to
8112 # set env LD_RUN_PATH.  The main perl makefile uses this.
8113 shrpdir=$archlibexp/CORE
8114 xxx=''
8115 tmp_shrpenv=''
8116 if "$useshrplib"; then
8117     case "$osname" in 
8118         aix)
8119                 # We'll set it in Makefile.SH...
8120                 ;;
8121         solaris)
8122                 xxx="-R $shrpdir"
8123                 ;;
8124         freebsd|netbsd|openbsd|interix|dragonfly)
8125                 xxx="-Wl,-R$shrpdir"
8126                 ;;
8127         bsdos|linux|irix*|dec_osf|gnu*)
8128                 xxx="-Wl,-rpath,$shrpdir"
8129                 ;;
8130         next)
8131                 # next doesn't like the default...
8132                 ;;
8133         beos)
8134                 # beos doesn't like the default, either.
8135                 ;;
8136         hpux*)
8137                 # hpux doesn't like the default, either.
8138                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8139                 ;;
8140         *)
8141                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8142                 ;;
8143         esac
8144         case "$xxx" in
8145         '') ;;
8146         *)      
8147                 # Only add $xxx if it isn't already in ccdlflags.
8148                 case " $ccdlflags " in
8149                 *" $xxx "*)     ;;
8150                 *)      ccdlflags="$ccdlflags $xxx"
8151                         cat <<EOM >&4
8152
8153 Adding $xxx to the flags
8154 passed to $ld so that the perl executable will find the 
8155 installed shared $libperl.
8156
8157 EOM
8158                         ;;
8159                 esac
8160                 ;;
8161         esac
8162 fi
8163 # Fix ccdlflags in AIX for building external extensions.
8164 # (For building Perl itself bare -bE:perl.exp is needed,
8165 #  Makefile.SH takes care of this.)
8166 case "$osname" in
8167 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8168 esac
8169 # Respect a hint or command-line value.
8170 case "$shrpenv" in
8171 '') shrpenv="$tmp_shrpenv" ;;
8172 esac
8173 case "$ldlibpthname" in
8174 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8175 none)   ldlibpthname='' ;;
8176 esac
8177
8178 : determine where manual pages are on this system
8179 echo " "
8180 case "$sysman" in
8181 '') 
8182         syspath='/usr/share/man/man1 /usr/man/man1'
8183         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8184         syspath="$syspath /usr/man/u_man/man1"
8185         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8186         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8187         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8188         sysman=`./loc . /usr/man/man1 $syspath`
8189         ;;
8190 esac
8191 if $test -d "$sysman"; then
8192         echo "System manual is in $sysman." >&4
8193 else
8194         echo "Could not find manual pages in source form." >&4
8195 fi
8196
8197 : determine where manual pages go
8198 set man1dir man1dir none
8199 eval $prefixit
8200 $cat <<EOM
8201
8202 $spackage has manual pages available in source form.
8203 EOM
8204 case "$nroff" in
8205 nroff)
8206         echo "However, you don't have nroff, so they're probably useless to you."
8207         case "$man1dir" in
8208         '') man1dir="none";;
8209         esac;;
8210 esac
8211 echo "If you don't want the manual sources installed, answer 'none'."
8212 case "$man1dir" in
8213 ' ') dflt=none
8214         ;;
8215 '')
8216         lookpath="$prefixexp/share/man/man1"
8217         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8218         lookpath="$lookpath $prefixexp/man/p_man/man1"
8219         lookpath="$lookpath $prefixexp/man/u_man/man1"
8220         lookpath="$lookpath $prefixexp/man/man.1"
8221         case "$sysman" in
8222         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8223         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8224         esac
8225         set dflt
8226         eval $prefixup
8227         ;;
8228 *)  dflt="$man1dir"
8229         ;;
8230 esac
8231 echo " "
8232 fn=dn+~
8233 rp="Where do the main $spackage manual pages (source) go?"
8234 . ./getfile
8235 if $test "X$man1direxp" != "X$ansexp"; then
8236         installman1dir=''
8237 fi
8238 prefixvar=man1dir
8239 . ./setprefixvar
8240
8241 case "$man1dir" in
8242 '')     man1dir=' '
8243         installman1dir='';;
8244 esac
8245
8246 : What suffix to use on installed man pages
8247
8248 case "$man1dir" in
8249 ' ')
8250         man1ext='0'
8251         ;;
8252 *)
8253         rp="What suffix should be used for the main $spackage man pages?"
8254         case "$man1ext" in
8255         '')     case "$man1dir" in
8256                 *1)  dflt=1 ;;
8257                 *1p) dflt=1p ;;
8258                 *1pm) dflt=1pm ;;
8259                 *l) dflt=l;;
8260                 *n) dflt=n;;
8261                 *o) dflt=o;;
8262                 *p) dflt=p;;
8263                 *C) dflt=C;;
8264                 *L) dflt=L;;
8265                 *L1) dflt=L1;;
8266                 *) dflt=1;;
8267                 esac
8268                 ;;
8269         *)      dflt="$man1ext";;
8270         esac
8271         . ./myread
8272         man1ext="$ans"
8273         ;;
8274 esac
8275
8276 : see if we can have long filenames
8277 echo " "
8278 first=123456789abcdef
8279 $rm -f $first
8280 if (echo hi >$first) 2>/dev/null; then
8281         if $test -f 123456789abcde; then
8282                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8283                 val="$undef"
8284         else
8285                 echo 'You can have filenames longer than 14 characters.'>&4
8286                 val="$define"
8287         fi
8288 else
8289         $cat <<'EOM'
8290 You can't have filenames longer than 14 chars.
8291 You can't even think about them!
8292 EOM
8293         val="$undef"
8294 fi 
8295 set d_flexfnam
8296 eval $setvar
8297 $rm -rf 123456789abcde*
8298
8299 : determine where library module manual pages go
8300 set man3dir man3dir none
8301 eval $prefixit
8302 $cat <<EOM
8303
8304 $spackage has manual pages for many of the library modules.
8305 EOM
8306
8307 case "$nroff" in
8308 nroff)
8309         $cat <<'EOM'
8310 However, you don't have nroff, so they're probably useless to you.
8311 EOM
8312         case "$man3dir" in
8313         '') man3dir="none";;
8314         esac;;
8315 esac
8316
8317 case "$d_flexfnam" in
8318 undef)
8319         $cat <<'EOM'
8320 However, your system can't handle the long file names like File::Basename.3.
8321 EOM
8322         case "$man3dir" in
8323         '') man3dir="none";;
8324         esac;;
8325 esac
8326
8327 echo "If you don't want the manual sources installed, answer 'none'."
8328 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8329 case "$man3dir" in
8330 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8331         if $test -d "$privlib/man/man3"; then
8332                 cat <<EOM >&4
8333
8334 WARNING:  Previous versions of perl installed man3 pages into
8335 $privlib/man/man3.  This version will suggest a
8336 new default of $dflt.
8337 EOM
8338                 tdflt=$dflt
8339                 dflt='n'
8340                 rp='Do you wish to preserve the old behavior?(y/n)'
8341                 . ./myread
8342                 case "$ans" in
8343                 y*) dflt="$privlib/man/man3" ;;
8344                 *)  dflt=$tdflt ;;
8345                 esac
8346     fi
8347         ;;
8348 *)      dflt="$man3dir" ;;
8349 esac
8350 case "$dflt" in
8351 ' ') dflt=none ;;
8352 esac
8353 echo " "
8354 fn=dn+~
8355 rp="Where do the $package library man pages (source) go?"
8356 . ./getfile
8357 prefixvar=man3dir
8358 . ./setprefixvar
8359
8360 case "$man3dir" in
8361 '')     man3dir=' '
8362         installman3dir='';;
8363 esac
8364
8365 : What suffix to use on installed man pages
8366 case "$man3dir" in
8367 ' ')
8368         man3ext='0'
8369         ;;
8370 *)
8371         rp="What suffix should be used for the $package library man pages?"
8372         case "$man3ext" in
8373         '')     case "$man3dir" in
8374                 *3)  dflt=3 ;;
8375                 *3p) dflt=3p ;;
8376                 *3pm) dflt=3pm ;;
8377                 *l) dflt=l;;
8378                 *n) dflt=n;;
8379                 *o) dflt=o;;
8380                 *p) dflt=p;;
8381                 *C) dflt=C;;
8382                 *L) dflt=L;;
8383                 *L3) dflt=L3;;
8384                 *) dflt=3;;
8385                 esac
8386                 ;;
8387         *)      dflt="$man3ext";;
8388         esac
8389         . ./myread
8390         man3ext="$ans"
8391         ;;
8392 esac
8393
8394 : see if we have to deal with yellow pages, now NIS.
8395 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8396         if $test -f /usr/etc/nibindd; then
8397                 echo " "
8398                 echo "I'm fairly confident you're on a NeXT."
8399                 echo " "
8400                 rp='Do you get the hosts file via NetInfo?'
8401                 dflt=y
8402                 case "$hostcat" in
8403                 nidump*) ;;
8404                 '') ;;
8405                 *) dflt=n;;
8406                 esac
8407                 . ./myread
8408                 case "$ans" in
8409                 y*) hostcat='nidump hosts .';;
8410                 *)      case "$hostcat" in
8411                         nidump*) hostcat='';;
8412                         esac
8413                         ;;
8414                 esac
8415         fi
8416         case "$hostcat" in
8417         nidump*) ;;
8418         *)
8419                 case "$hostcat" in
8420                 *ypcat*) dflt=y;;
8421                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8422                                 dflt=y
8423                         else
8424                                 dflt=n
8425                         fi;;
8426                 *) dflt=n;;
8427                 esac
8428                 echo " "
8429                 rp='Are you getting the hosts file via yellow pages?'
8430                 . ./myread
8431                 case "$ans" in
8432                 y*) hostcat='ypcat hosts';;
8433                 *) hostcat='cat /etc/hosts';;
8434                 esac
8435                 ;;
8436         esac
8437 fi
8438 case "$hostcat" in
8439 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8440 esac
8441 case "$groupcat" in
8442 '') test -f /etc/group && groupcat='cat /etc/group';;
8443 esac
8444 case "$passcat" in
8445 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8446 esac
8447
8448 : now get the host name
8449 echo " "
8450 echo "Figuring out host name..." >&4
8451 case "$myhostname" in
8452 '') cont=true
8453         echo 'Maybe "hostname" will work...'
8454         if tans=`sh -c hostname 2>&1` ; then
8455                 myhostname=$tans
8456                 phostname=hostname
8457                 cont=''
8458         fi
8459         ;;
8460 *) cont='';;
8461 esac
8462 if $test "$cont"; then
8463         if ./xenix; then
8464                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8465                 if tans=`cat /etc/systemid 2>&1` ; then
8466                         myhostname=$tans
8467                         phostname='cat /etc/systemid'
8468                         echo "Whadyaknow.  Xenix always was a bit strange..."
8469                         cont=''
8470                 fi
8471         elif $test -r /etc/systemid; then
8472                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8473         fi
8474 fi
8475 if $test "$cont"; then
8476         echo 'No, maybe "uuname -l" will work...'
8477         if tans=`sh -c 'uuname -l' 2>&1` ; then
8478                 myhostname=$tans
8479                 phostname='uuname -l'
8480         else
8481                 echo 'Strange.  Maybe "uname -n" will work...'
8482                 if tans=`sh -c 'uname -n' 2>&1` ; then
8483                         myhostname=$tans
8484                         phostname='uname -n'
8485                 else
8486                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8487                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8488                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8489                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8490                         else
8491                                 case "$myhostname" in
8492                                 '') echo "Does this machine have an identity crisis or something?"
8493                                         phostname='';;
8494                                 *)
8495                                         echo "Well, you said $myhostname before..."
8496                                         phostname='echo $myhostname';;
8497                                 esac
8498                         fi
8499                 fi
8500         fi
8501 fi
8502 case "$myhostname" in
8503 '') myhostname=noname ;;
8504 esac
8505 : you do not want to know about this
8506 set $myhostname
8507 myhostname=$1
8508
8509 : verify guess
8510 if $test "$myhostname" ; then
8511         dflt=y
8512         rp='Your host name appears to be "'$myhostname'".'" Right?"
8513         . ./myread
8514         case "$ans" in
8515         y*) ;;
8516         *) myhostname='';;
8517         esac
8518 fi
8519
8520 : bad guess or no guess
8521 while $test "X$myhostname" = X ; do
8522         dflt=''
8523         rp="Please type the (one word) name of your host:"
8524         . ./myread
8525         myhostname="$ans"
8526 done
8527
8528 : translate upper to lower if necessary
8529 case "$myhostname" in
8530 *[A-Z]*)
8531         echo "(Normalizing case in your host name)"
8532         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8533         ;;
8534 esac
8535
8536 case "$myhostname" in
8537 *.*)
8538         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8539         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8540         echo "(Trimming domain name from host name--host name is now $myhostname)"
8541         ;;
8542 *) case "$mydomain" in
8543         '')
8544                 {
8545                         test "X$hostcat" = "Xypcat hosts" &&
8546                         ypmatch "$myhostname" hosts 2>/dev/null |\
8547                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8548                         $test -s hosts
8549                 } || {
8550                         test "X$hostcat" != "X" &&
8551                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8552                                         /[       ]$myhostname[  . ]/p" > hosts
8553                 }
8554                 tmp_re="[       . ]"
8555                 if $test -f hosts; then
8556                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8557                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8558                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8559                                 hosts | $sort | $uniq | \
8560                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8561                         case `$echo X$dflt` in
8562                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8563                                 dflt=.
8564                                 ;;
8565                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8566                                 ;;
8567                         esac
8568                 else
8569                         echo "(I cannot locate a hosts database anywhere)"
8570                         dflt=.
8571                 fi
8572                 case "$dflt" in
8573                 .)
8574                         tans=`./loc resolv.conf X /etc /usr/etc`
8575                         if $test -f "$tans"; then
8576                                 echo "(Attempting domain name extraction from $tans)"
8577                                 dflt=.`$sed -n -e 's/   / /g' \
8578                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8579                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8580                                 case "$dflt" in
8581                                 .) dflt=.`$sed -n -e 's/        / /g' \
8582                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8583                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8584                                         ;;
8585                                 esac
8586                         fi
8587                         ;;
8588                 esac
8589                 case "$dflt" in
8590                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8591                         dflt=.`sh -c domainname 2>/dev/null`
8592                         case "$dflt" in
8593                         '') dflt='.';;
8594                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8595                         esac
8596                         ;;
8597                 esac
8598                 case "$dflt$osname" in
8599                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8600                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8601                         ;;
8602                 esac
8603                 case "$dflt" in
8604                 .) echo "(Lost all hope -- silly guess then)"
8605                         dflt='.nonet'
8606                         ;;
8607                 esac
8608                 $rm -f hosts
8609                 ;;
8610         *) dflt="$mydomain";;
8611         esac;;
8612 esac
8613 echo " "
8614 rp="What is your domain name?"
8615 . ./myread
8616 tans="$ans"
8617 case "$ans" in
8618 '') ;;
8619 .*) ;;
8620 *) tans=".$tans";;
8621 esac
8622 mydomain="$tans"
8623
8624 : translate upper to lower if necessary
8625 case "$mydomain" in
8626 *[A-Z]*)
8627         echo "(Normalizing case in your domain name)"
8628         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8629         ;;
8630 esac
8631
8632 : a little sanity check here
8633 case "$phostname" in
8634 '') ;;
8635 *)
8636         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8637         $myhostname$mydomain|$myhostname) ;;
8638         *)
8639                 case "$phostname" in
8640                 sed*)
8641                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8642                         ;;
8643                 *)
8644                         echo "(That doesn't agree with your $phostname command, by the way.)"
8645                         ;;
8646                 esac
8647         ;;
8648         esac
8649         ;;
8650 esac
8651
8652 $cat <<EOM
8653
8654 I need to get your e-mail address in Internet format if possible, i.e.
8655 something like user@host.domain. Please answer accurately since I have
8656 no easy means to double check it. The default value provided below
8657 is most probably close to reality but may not be valid from outside
8658 your organization...
8659
8660 EOM
8661 cont=x
8662 while test "$cont"; do
8663         case "$cf_email" in
8664         '') dflt="$cf_by@$myhostname$mydomain";;
8665         *) dflt="$cf_email";;
8666         esac
8667         rp='What is your e-mail address?'
8668         . ./myread
8669         cf_email="$ans"
8670         case "$cf_email" in
8671         *@*.*) cont='' ;;
8672         *)
8673                 rp='Address does not look like an Internet one.  Use it anyway?'
8674                 case "$fastread" in
8675                 yes) dflt=y ;;
8676                 *) dflt=n ;;
8677                 esac
8678                 . ./myread
8679                 case "$ans" in
8680                 y*) cont='' ;;
8681                 *) echo " " ;;
8682                 esac
8683                 ;;
8684         esac
8685 done
8686
8687 $cat <<EOM
8688
8689 If you or somebody else will be maintaining perl at your site, please
8690 fill in the correct e-mail address here so that they may be contacted
8691 if necessary. Currently, the "perlbug" program included with perl
8692 will send mail to this address in addition to perlbug@perl.org. You may
8693 enter "none" for no administrator.
8694
8695 EOM
8696 case "$perladmin" in
8697 '') dflt="$cf_email";;
8698 *) dflt="$perladmin";;
8699 esac
8700 rp='Perl administrator e-mail address'
8701 . ./myread
8702 perladmin="$ans"
8703
8704 : determine whether to only install version-specific parts.
8705 echo " "
8706 $cat <<EOM
8707 Do you want to install only the version-specific parts of the perl
8708 distribution?  Usually you do *not* want to do this.
8709 EOM
8710 case "$versiononly" in
8711 "$define"|[Yy]*|true) dflt='y' ;;
8712 *) dflt='n';
8713 esac
8714 rp="Do you want to install only the version-specific parts of perl?"
8715 . ./myread
8716 case "$ans" in
8717 [yY]*)  val="$define";;
8718 *)      val="$undef" ;;
8719 esac
8720 set versiononly
8721 eval $setvar
8722
8723 case "$versiononly" in
8724 "$define") inc_version_list=''
8725            inc_version_list_init=0
8726            ;;
8727 esac
8728
8729 : figure out how to guarantee perl startup
8730 : XXX Note that this currently takes advantage of the bug that binexp ignores
8731 :     the Configure -Dinstallprefix setting, which in turn means that under
8732 :     relocatable @INC, initialinstalllocation is what binexp started as.
8733 case "$startperl" in
8734 '')
8735         case "$sharpbang" in
8736         *!)
8737                 $cat <<EOH
8738
8739 I can use the #! construct to start perl on your system. This will
8740 make startup of perl scripts faster, but may cause problems if you
8741 want to share those scripts and perl is not in a standard place
8742 ($initialinstalllocation/perl) on all your platforms. The alternative
8743 is to force a shell by starting the script with a single ':' character.
8744
8745 EOH
8746                 case "$versiononly" in
8747                 "$define")      dflt="$initialinstalllocation/perl$version";;
8748                 *)              dflt="$initialinstalllocation/perl";;
8749                 esac
8750                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8751                 . ./myread
8752                 case "$ans" in
8753                 none)   startperl=": # use perl";;
8754                 *)      startperl="#!$ans"
8755                         if $test 30 -lt `echo "$ans" | wc -c`; then
8756                                 $cat >&4 <<EOM
8757
8758 WARNING:  Some systems limit the #! command to 32 characters.
8759 If you experience difficulty running Perl scripts with #!, try
8760 installing Perl in a directory with a shorter pathname.
8761
8762 EOM
8763                         fi ;;
8764                 esac
8765                 ;;
8766         *) startperl=": # use perl"
8767                 ;;
8768         esac
8769         ;;
8770 esac
8771 echo "I'll use $startperl to start perl scripts."
8772
8773 : figure best path for perl in scripts
8774 case "$perlpath" in
8775 '')
8776         case "$versiononly" in
8777         "$define")      perlpath="$initialinstalllocation/perl$version";;
8778         *)              perlpath="$initialinstalllocation/perl";;
8779         esac
8780         case "$startperl" in
8781         *!*) ;;
8782         *)
8783                 $cat <<EOH
8784
8785 I will use the "eval 'exec'" idiom to start Perl on your system.
8786 I can use the full path of your Perl binary for this purpose, but
8787 doing so may cause problems if you want to share those scripts and
8788 Perl is not always in a standard place ($initialinstalllocation/perl).
8789
8790 EOH
8791                 dflt="$initialinstalllocation/perl"
8792                 rp="What path shall I use in \"eval 'exec'\"?"
8793                 . ./myread
8794                 perlpath="$ans"
8795                 ;;
8796         esac
8797         ;;
8798 esac
8799 case "$startperl" in
8800 *!*)    ;;
8801 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8802 esac
8803
8804 : determine where public executable scripts go
8805 set scriptdir scriptdir
8806 eval $prefixit
8807 case "$scriptdir" in
8808 '')
8809         dflt="$bin"
8810         : guess some guesses
8811         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8812         $test -d /usr/share/bin     && dflt=/usr/share/bin
8813         $test -d /usr/local/script  && dflt=/usr/local/script
8814         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8815         $test -d $prefixexp/script  && dflt=$prefixexp/script
8816         set dflt
8817         eval $prefixup
8818         ;;
8819 *)  dflt="$scriptdir"
8820         ;;
8821 esac
8822 $cat <<EOM
8823
8824 Some installations have a separate directory just for executable scripts so
8825 that they can mount it across multiple architectures but keep the scripts in
8826 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8827 Or you might just lump your scripts in with all your other executables.
8828
8829 EOM
8830 fn=d~
8831 rp='Where do you keep publicly executable scripts?'
8832 . ./getfile
8833 if $test "X$ansexp" != "X$scriptdirexp"; then
8834         installscript=''
8835 fi
8836 installscriptdir=''
8837 prefixvar=scriptdir
8838 . ./setprefixvar
8839 : A little fix up for an irregularly named variable.
8840 installscript="$installscriptdir"
8841
8842 : determine where add-on public executables go
8843 case "$sitebin" in
8844 '')     dflt=$siteprefix/bin ;;
8845 *)      dflt=$sitebin ;;
8846 esac
8847 fn=d~
8848 rp='Pathname where the add-on public executables should be installed?'
8849 . ./getfile
8850 prefixvar=sitebin
8851 . ./setprefixvar
8852
8853 : determine where add-on html pages go
8854 : There is no standard location, so try to copy the previously-selected
8855 : directory structure for the core html pages.
8856 case "$sitehtml1dir" in
8857 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8858 *)     dflt=$sitehtml1dir ;;
8859 esac
8860 case "$dflt" in
8861 ''|' ') dflt=none ;;
8862 esac
8863 fn=dn+~
8864 rp='Pathname where the site-specific html pages should be installed?'
8865 . ./getfile
8866 prefixvar=sitehtml1dir
8867 . ./setprefixvar
8868
8869 : determine where add-on library html pages go
8870 : There is no standard location, so try to copy the previously-selected
8871 : directory structure for the core html pages.
8872 case "$sitehtml3dir" in
8873 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8874 *)     dflt=$sitehtml3dir ;;
8875 esac
8876 case "$dflt" in
8877 ''|' ') dflt=none ;;
8878 esac
8879 fn=dn+~
8880 rp='Pathname where the site-specific library html pages should be installed?'
8881 . ./getfile
8882 prefixvar=sitehtml3dir
8883 . ./setprefixvar
8884
8885 : determine where add-on manual pages go
8886 case "$siteman1dir" in
8887 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8888 *)      dflt=$siteman1dir ;;
8889 esac
8890 case "$dflt" in
8891 ''|' ') dflt=none ;;
8892 esac
8893 fn=dn+~
8894 rp='Pathname where the site-specific manual pages should be installed?'
8895 . ./getfile
8896 prefixvar=siteman1dir
8897 . ./setprefixvar
8898
8899 : determine where add-on library man pages go
8900 case "$siteman3dir" in
8901 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8902 *)      dflt=$siteman3dir ;;
8903 esac
8904 case "$dflt" in
8905 ''|' ') dflt=none ;;
8906 esac
8907 fn=dn+~
8908 rp='Pathname where the site-specific library manual pages should be installed?'
8909 . ./getfile
8910 prefixvar=siteman3dir
8911 . ./setprefixvar
8912
8913 : determine where add-on public executable scripts go
8914 case "$sitescript" in
8915 '')     dflt=$siteprefix/script
8916         $test -d $dflt || dflt=$sitebin ;;
8917 *)  dflt="$sitescript" ;;
8918 esac
8919 fn=d~+
8920 rp='Pathname where add-on public executable scripts should be installed?'
8921 . ./getfile
8922 prefixvar=sitescript
8923 . ./setprefixvar
8924
8925 case "$usefaststdio" in
8926 $define|true|[yY]*|'')
8927         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8928         case "$xversion" in
8929         [68])   dflt='y' ;;
8930         *)      dflt='n' ;;
8931         esac
8932         ;;
8933 *) dflt='n';;
8934 esac
8935 cat <<EOM
8936
8937 Perl can be built to use 'fast stdio', which means using the stdio
8938 library but also directly manipulating the stdio buffers to enable
8939 faster I/O.  Using stdio is better for backward compatibility (especially
8940 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8941 interface has been preferred instead of stdio.
8942
8943 If this doesn't make any sense to you, just accept the default '$dflt'.
8944 EOM
8945 rp='Use the "fast stdio" if available?'
8946 . ./myread
8947 case "$ans" in
8948 y|Y)    val="$define" ;;     
8949 *)      val="$undef" ;;
8950 esac
8951 set usefaststdio
8952 eval $setvar
8953
8954 : DTrace support
8955 dflt_dtrace='/usr/sbin/dtrace'
8956 cat <<EOM
8957
8958 Perl can be built to support DTrace on platforms that support it.
8959 DTrace is a diagnosis and performance analysis tool from Sun.
8960
8961 If this doesn't make any sense to you, just accept the default '$dflt'.
8962 EOM
8963
8964 while $test 1 ; do
8965         case "$usedtrace" in
8966         $define|true|[yY]*) 
8967                 dflt='y' 
8968                 ;;
8969         ?*)
8970                 dflt='y' 
8971                 dflt_dtrace=$usedtrace
8972                 ;;
8973         *) 
8974                 dflt='n' 
8975                 ;;
8976         esac
8977
8978         rp='Support DTrace if available?'
8979         . ./myread
8980         case "$ans" in
8981         y|Y)    val="$define" ;;
8982         *)      val="$undef" ;;
8983         esac
8984         set usedtrace
8985         eval $setvar
8986
8987         test "X$usedtrace" != "X$define" && break
8988
8989         echo " "
8990         rp='Where is the dtrace executable?'
8991         dflt=$dflt_dtrace
8992         . ./getfile
8993         val="$ans"
8994         set dtrace
8995         eval $setvar
8996         
8997         if $test -f $dtrace
8998         then
8999                 if $dtrace -h -s ../perldtrace.d \
9000                         -o perldtrace.tmp >/dev/null 2>&1 \
9001                         && rm -f perldtrace.tmp
9002                 then
9003                         echo " "
9004                         echo "Good: your $dtrace knows about the -h flag."
9005                 else
9006                         cat >&2 <<EOM
9007
9008 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
9009 ***
9010 *** Your installed dtrace doesn't support the -h switch to compile a D
9011 *** program into a C header. Can't continue.
9012
9013 EOM
9014                         exit 1
9015                 fi
9016                 break;
9017         fi
9018
9019         case "$fastread" in
9020         yes)
9021                 cat >&2 <<EOM
9022
9023 *** $me:  Fatal Error:  $dtrace not found.
9024 *** Can't continue.
9025
9026 EOM
9027                 exit 1
9028                 ;;
9029         *)
9030                 echo "*** $dtrace was not found."
9031                 echo " "
9032                 ;;
9033         esac
9034 done
9035
9036 : define an is-a-typedef? function
9037 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9038 case "$inclist" in
9039 "") inclist="sys/types.h";;
9040 esac;
9041 eval "varval=\$$var";
9042 case "$varval" in
9043 "")
9044         $rm -f temp.c;
9045         for inc in $inclist; do
9046                 echo "#include <$inc>" >>temp.c;
9047         done;
9048         echo "#ifdef $type" >> temp.c;
9049         echo "printf(\"We have $type\");" >> temp.c;
9050         echo "#endif" >> temp.c;
9051         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9052         if $contains $type temp.E >/dev/null 2>&1; then
9053                 eval "$var=\$type";
9054         else
9055                 eval "$var=\$def";
9056         fi;
9057         $rm -f temp.?;;
9058 *) eval "$var=\$varval";;
9059 esac'
9060
9061 : define an is-a-typedef? function that prompts if the type is not available.
9062 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9063 case "$inclist" in
9064 "") inclist="sys/types.h";;
9065 esac;
9066 eval "varval=\$$var";
9067 case "$varval" in
9068 "")
9069         $rm -f temp.c;
9070         for inc in $inclist; do
9071                 echo "#include <$inc>" >>temp.c;
9072         done;
9073         echo "#ifdef $type" >> temp.c;
9074         echo "printf(\"We have $type\");" >> temp.c;
9075         echo "#endif" >> temp.c;
9076         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9077         echo " " ;
9078         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9079         if $contains $type temp.E >/dev/null 2>&1; then
9080                 echo "$type found." >&4;
9081                 eval "$var=\$type";
9082         else
9083                 echo "$type NOT found." >&4;
9084                 dflt="$def";
9085                 . ./myread ;
9086                 eval "$var=\$ans";
9087         fi;
9088         $rm -f temp.?;;
9089 *) eval "$var=\$varval";;
9090 esac'
9091
9092 : see what type lseek is declared as in the kernel
9093 rp="What is the type used for lseek's offset on this system?"
9094 set off_t lseektype long stdio.h sys/types.h
9095 eval $typedef_ask
9096
9097 echo " "
9098 echo "Checking to see how big your file offsets are..." >&4
9099 $cat >try.c <<EOCP
9100 #include <sys/types.h>
9101 #include <stdio.h>
9102 int main()
9103 {
9104     printf("%d\n", (int)sizeof($lseektype));
9105     return(0);
9106 }
9107 EOCP
9108 set try
9109 if eval $compile_ok; then
9110         lseeksize=`$run ./try`
9111         echo "Your file offsets are $lseeksize bytes long."
9112 else
9113         dflt=$longsize
9114         echo " "
9115         echo "(I can't seem to compile the test program.  Guessing...)"
9116         rp="What is the size of your file offsets (in bytes)?"
9117         . ./myread
9118         lseeksize="$ans"
9119 fi
9120 $rm_try
9121
9122 : see what type file positions are declared as in the library
9123 rp="What is the type for file position used by fsetpos()?"
9124 set fpos_t fpostype long stdio.h sys/types.h
9125 eval $typedef_ask
9126
9127 : Check size for Fpos_t
9128 echo " "
9129 case "$fpostype" in
9130 *_t) zzz="$fpostype"    ;;
9131 *)   zzz="fpos_t"       ;;
9132 esac
9133 echo "Checking the size of $zzz..." >&4
9134 cat > try.c <<EOCP
9135 #include <sys/types.h>
9136 #include <stdio.h>
9137 #$i_stdlib I_STDLIB
9138 #ifdef I_STDLIB
9139 #include <stdlib.h>
9140 #endif
9141 int main() {
9142     printf("%d\n", (int)sizeof($fpostype));
9143     exit(0);
9144 }
9145 EOCP
9146 set try
9147 if eval $compile_ok; then
9148         yyy=`$run ./try`
9149         case "$yyy" in
9150         '')     fpossize=4
9151                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9152                 ;;
9153         *)      fpossize=$yyy
9154                 echo "Your $zzz is $fpossize bytes long."
9155                 ;;
9156         esac
9157 else
9158         dflt="$longsize"
9159         echo " " >&4
9160         echo "(I can't compile the test program.  Guessing...)" >&4
9161         rp="What is the size of your file positions (in bytes)?"
9162         . ./myread
9163         fpossize="$ans"
9164 fi
9165
9166 : Check for large file support
9167 # Backward compatibility (uselfs is deprecated).
9168 case "$uselfs" in
9169 "$define"|true|[yY]*)
9170         cat <<EOM >&4
9171
9172 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9173 EOM
9174         uselargefiles="$define"
9175         ;;
9176 esac
9177
9178 case "$lseeksize:$fpossize" in
9179 8:8) cat <<EOM
9180
9181 You can have files larger than 2 gigabytes.
9182 EOM
9183    val="$define" ;;
9184 *)    case "$uselargefiles" in
9185    "$undef"|false|[nN]*) dflt='n' ;;
9186    *)   dflt='y' ;;
9187    esac
9188    cat <<EOM
9189
9190 Perl can be built to understand large files (files larger than 2 gigabytes)
9191 on some systems.  To do so, Configure can be run with -Duselargefiles.
9192
9193 If this doesn't make any sense to you, just accept the default '$dflt'.
9194 EOM
9195    rp='Try to understand large files, if available?'
9196    . ./myread
9197    case "$ans" in
9198    y|Y)         val="$define" ;;
9199    *)           val="$undef"  ;;
9200    esac
9201    ;;
9202 esac
9203 set uselargefiles
9204 eval $setvar
9205 : Look for a hint-file generated 'call-back-unit'.  If the
9206 : user has specified that a large files perl is to be built,
9207 : we may need to set or change some other defaults.
9208 if $test -f uselargefiles.cbu; then
9209         echo "Your platform has some specific hints regarding large file builds, using them..."
9210         . ./uselargefiles.cbu
9211 fi
9212 case "$uselargefiles" in
9213 "$define")
9214         if $test -f uselargefiles.cbu; then
9215                 echo " "
9216                 echo "Rechecking to see how big your file offsets are..." >&4
9217                 $cat >try.c <<EOCP
9218 #include <sys/types.h>
9219 #include <stdio.h>
9220 int main()
9221 {
9222     printf("%d\n", (int)sizeof($lseektype));
9223     return(0);
9224 }
9225 EOCP
9226                 set try
9227                 if eval $compile_ok; then
9228                         lseeksize=`$run ./try`
9229                         $echo "Your file offsets are now $lseeksize bytes long."
9230                 else
9231                         dflt="$lseeksize"
9232                         echo " "
9233                         echo "(I can't seem to compile the test program.  Guessing...)"
9234                         rp="What is the size of your file offsets (in bytes)?"
9235                         . ./myread
9236                         lseeksize="$ans"
9237                 fi
9238                 case "$fpostype" in
9239                 *_t) zzz="$fpostype"    ;;
9240                 *)   zzz="fpos_t"       ;;
9241                 esac
9242                 $echo $n "Rechecking the size of $zzz...$c" >&4
9243                 $cat > try.c <<EOCP
9244 #include <sys/types.h>
9245 #include <stdio.h>
9246 #$i_stdlib I_STDLIB
9247 #ifdef I_STDLIB
9248 #include <stdlib.h>
9249 #endif
9250 int main() {
9251     printf("%d\n", (int)sizeof($fpostype));
9252     return(0);
9253 }
9254 EOCP
9255                 set try
9256                 if eval $compile_ok; then
9257                         yyy=`$run ./try`
9258                         dflt="$lseeksize"
9259                         case "$yyy" in
9260                         '')     echo " "
9261                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9262                                 ;;
9263                         *)      fpossize=$yyy
9264                                 echo " $fpossize bytes." >&4
9265                                 ;;
9266                         esac
9267                 else
9268                         dflt="$fpossize"
9269                         echo " "
9270                         echo "(I can't compile the test program.  Guessing...)" >&4
9271                         rp="What is the size of your file positions (in bytes)?"
9272                         . ./myread
9273                         fpossize="$ans"
9274                 fi
9275                 $rm_try
9276         fi
9277         ;;
9278 esac
9279
9280 : Set the vendorbin variables
9281 case "$vendorprefix" in
9282 '')     d_vendorbin="$undef"
9283         vendorbin=''
9284         vendorbinexp=''
9285         ;;
9286 *)      d_vendorbin="$define"
9287         : determine where vendor-supplied executables go.
9288         case "$vendorbin" in
9289         '') dflt=$vendorprefix/bin ;;
9290         *)      dflt="$vendorbin" ;;
9291         esac
9292         fn=d~+
9293         rp='Pathname for the vendor-supplied executables directory?'
9294         . ./getfile
9295         vendorbin="$ans"
9296         vendorbinexp="$ansexp"
9297         ;;
9298 esac
9299 prefixvar=vendorbin
9300 . ./installprefix
9301
9302 : Set the vendorhtml1dir variables
9303 case "$vendorprefix" in
9304 '')     vendorhtml1dir=''
9305         vendorhtml1direxp=''
9306         ;;
9307 *)      : determine where vendor-supplied html pages go.
9308         : There is no standard location, so try to copy the previously-selected
9309         : directory structure for the core html pages.
9310         : XXX Better default suggestions would be welcome.
9311         case "$vendorhtml1dir" in
9312         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9313         *)      dflt=$vendorhtml1dir ;;
9314         esac
9315         case "$dflt" in
9316         ''|' ') dflt=none ;;
9317         esac
9318         fn=dn+~
9319         rp='Pathname for the vendor-supplied html pages?'
9320         . ./getfile
9321         vendorhtml1dir="$ans"
9322         vendorhtml1direxp="$ansexp"
9323         ;;
9324 esac
9325 : Use ' ' for none so value is preserved next time through Configure
9326 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9327 prefixvar=vendorhtml1dir
9328 . ./installprefix
9329
9330 : Set the vendorhtml3dir variables
9331 case "$vendorprefix" in
9332 '')     vendorhtml3dir=''
9333         vendorhtml3direxp=''
9334         ;;
9335 *)      : determine where vendor-supplied module html pages go.
9336         : There is no standard location, so try to copy the previously-selected
9337         : directory structure for the core html pages.
9338         : XXX Better default suggestions would be welcome.
9339         case "$vendorhtml3dir" in
9340         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9341         *)      dflt=$vendorhtml3dir ;;
9342         esac
9343         case "$dflt" in
9344         ''|' ') dflt=none ;;
9345         esac
9346         fn=dn+~
9347         rp='Pathname for the vendor-supplied html pages?'
9348         . ./getfile
9349         vendorhtml3dir="$ans"
9350         vendorhtml3direxp="$ansexp"
9351         ;;
9352 esac
9353 : Use ' ' for none so value is preserved next time through Configure
9354 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9355 prefixvar=vendorhtml3dir
9356 . ./installprefix
9357
9358 : Set the vendorman1dir variables
9359 case "$vendorprefix" in
9360 '')     vendorman1dir=''
9361         vendorman1direxp=''
9362         ;;
9363 *)      : determine where vendor-supplied manual pages go.
9364         case "$vendorman1dir" in
9365         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9366         *)      dflt=$vendorman1dir ;;
9367         esac
9368         case "$dflt" in
9369         ''|' ') dflt=none ;;
9370         esac
9371         fn=nd~+
9372         rp='Pathname for the vendor-supplied manual section 1 pages?'
9373         . ./getfile
9374         vendorman1dir="$ans"
9375         vendorman1direxp="$ansexp"
9376         ;;
9377 esac
9378 : Use ' ' for none so value is preserved next time through Configure
9379 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9380 prefixvar=vendorman1dir
9381 . ./installprefix
9382
9383 : Set the vendorman3dir variables
9384 case "$vendorprefix" in
9385 '')     vendorman3dir=''
9386         vendorman3direxp=''
9387         ;;
9388 *)      : determine where vendor-supplied module manual pages go.
9389         case "$vendorman3dir" in
9390         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9391         *)      dflt=$vendorman3dir ;;
9392         esac
9393         case "$dflt" in
9394         ''|' ') dflt=none ;;
9395         esac
9396         fn=nd~+
9397         rp='Pathname for the vendor-supplied manual section 3 pages?'
9398         . ./getfile
9399         vendorman3dir="$ans"
9400         vendorman3direxp="$ansexp"
9401         ;;
9402 esac
9403 : Use ' ' for none so value is preserved next time through Configure
9404 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9405 prefixvar=vendorman3dir
9406 . ./installprefix
9407
9408 : Set the vendorscript variables
9409 case "$vendorprefix" in
9410 '')     d_vendorscript="$undef"
9411         vendorscript=''
9412         vendorscriptexp=''
9413         ;;
9414 *)      d_vendorscript="$define"
9415         : determine where vendor-supplied scripts go.
9416         case "$vendorscript" in
9417         '')     dflt=$vendorprefix/script
9418                 $test -d $dflt || dflt=$vendorbin ;;
9419         *)  dflt="$vendorscript" ;;
9420         esac
9421         $cat <<EOM
9422
9423 The installation process will create a directory for
9424 vendor-supplied scripts.
9425
9426 EOM
9427         fn=d~+
9428         rp='Pathname for the vendor-supplied scripts directory?'
9429         . ./getfile
9430         vendorscript="$ans"
9431         vendorscriptexp="$ansexp"
9432         ;;
9433 esac
9434 prefixvar=vendorscript
9435 . ./installprefix
9436
9437 : see if qgcvt exists
9438 set qgcvt d_qgcvt
9439 eval $inlibc
9440
9441 : Check print/scan long double stuff
9442 echo " "
9443
9444 if $test X"$d_longdbl" = X"$define"; then
9445
9446 echo "Checking how to print long doubles..." >&4
9447
9448 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9449         $cat >try.c <<'EOCP'
9450 #include <sys/types.h>
9451 #include <stdio.h>
9452 int main() {
9453   double d = 123.456;
9454   printf("%.3f\n", d);
9455 }
9456 EOCP
9457         set try
9458         if eval $compile; then
9459                 yyy=`$run ./try`
9460                 case "$yyy" in
9461                 123.456)
9462                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9463                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9464                         echo "We will use %f."
9465                         ;;
9466                 esac
9467         fi
9468 fi
9469
9470 if $test X"$sPRIfldbl" = X; then
9471         $cat >try.c <<'EOCP'
9472 #include <sys/types.h>
9473 #include <stdio.h>
9474 int main() {
9475   long double d = 123.456;
9476   printf("%.3Lf\n", d);
9477 }
9478 EOCP
9479         set try
9480         if eval $compile; then
9481                 yyy=`$run ./try`
9482                 case "$yyy" in
9483                 123.456)
9484                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9485                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9486                         echo "We will use %Lf."
9487                         ;;
9488                 esac
9489         fi
9490 fi
9491
9492 if $test X"$sPRIfldbl" = X; then
9493         $cat >try.c <<'EOCP'
9494 #include <sys/types.h>
9495 #include <stdio.h>
9496 int main() {
9497   long double d = 123.456;
9498   printf("%.3llf\n", d);
9499 }
9500 EOCP
9501         set try
9502         if eval $compile; then
9503                 yyy=`$run ./try`
9504                 case "$yyy" in
9505                 123.456)
9506                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9507                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9508                         echo "We will use %llf."
9509                         ;;
9510                 esac
9511         fi
9512 fi
9513
9514 if $test X"$sPRIfldbl" = X; then
9515         $cat >try.c <<'EOCP'
9516 #include <sys/types.h>
9517 #include <stdio.h>
9518 int main() {
9519   long double d = 123.456;
9520   printf("%.3lf\n", d);
9521 }
9522 EOCP
9523         set try
9524         if eval $compile; then
9525                 yyy=`$run ./try`
9526                 case "$yyy" in
9527                 123.456)
9528                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9529                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9530                         echo "We will use %lf."
9531                         ;;
9532                 esac
9533         fi
9534 fi
9535
9536 if $test X"$sPRIfldbl" = X; then
9537         echo "Cannot figure out how to print long doubles." >&4
9538 else
9539         sSCNfldbl=$sPRIfldbl    # expect consistency
9540 fi
9541
9542 $rm_try
9543
9544 fi # d_longdbl
9545
9546 case "$sPRIfldbl" in
9547 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9548         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9549         d_SCNfldbl="$undef";
9550         ;;
9551 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9552         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9553         d_SCNfldbl="$define";
9554         ;;
9555 esac
9556
9557 : Check how to convert floats to strings.
9558
9559 if test "X$d_Gconvert" = X; then
9560
9561 echo " "
9562 echo "Checking for an efficient way to convert floats to strings."
9563 echo " " > try.c
9564 case "$uselongdouble" in
9565 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9566 esac
9567 case "$d_longdbl" in
9568 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9569 esac
9570 case "$d_PRIgldbl" in
9571 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9572 esac
9573 $cat >>try.c <<EOP
9574 #ifdef TRY_gconvert
9575 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9576 char *myname = "gconvert";
9577 #endif
9578 #ifdef TRY_gcvt
9579 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9580 char *myname = "gcvt";
9581 #endif
9582 #ifdef TRY_qgcvt
9583 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9584 char *myname = "qgcvt";
9585 #define DOUBLETYPE long double
9586 #endif
9587 #ifdef TRY_sprintf
9588 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9589 #ifdef HAS_PRIgldbl
9590 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9591 #else
9592 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9593 #endif
9594 #else
9595 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9596 #endif
9597 char *myname = "sprintf";
9598 #endif
9599
9600 #ifndef DOUBLETYPE
9601 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9602 #define DOUBLETYPE long double
9603 #else
9604 #define DOUBLETYPE double
9605 #endif
9606 #endif
9607
9608 #include <stdio.h>
9609
9610 #define I_STDLIB $i_stdlib
9611 #ifdef I_STDLIB
9612 #include <stdlib.h>
9613 #endif
9614
9615 int
9616 checkit(expect, got)
9617 char *expect;
9618 char *got;
9619 {
9620     if (strcmp(expect, got)) {
9621                 printf("%s oddity:  Expected %s, got %s\n",
9622                         myname, expect, got);
9623                 exit(1);
9624         }
9625 }
9626
9627 int main()
9628 {
9629         char buf[64];
9630         buf[63] = '\0';
9631
9632         /* This must be 1st test on (which?) platform */
9633         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9634         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9635         checkit("0.1", buf);
9636
9637         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9638         checkit("0.01", buf);
9639
9640         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9641         checkit("0.001", buf);
9642
9643         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9644         checkit("0.0001", buf);
9645
9646         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9647         if (strlen(buf) > 5)
9648             checkit("9e-005", buf); /* for Microsoft ?? */
9649         else
9650             checkit("9e-05", buf);
9651
9652         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9653         checkit("1", buf);
9654
9655         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9656         checkit("1.1", buf);
9657
9658         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9659         checkit("1.01", buf);
9660
9661         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9662         checkit("1.001", buf);
9663
9664         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9665         checkit("1.0001", buf);
9666
9667         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9668         checkit("1.00001", buf);
9669
9670         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9671         checkit("1.000001", buf);
9672
9673         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9674         checkit("0", buf);
9675
9676         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9677         checkit("-1", buf);
9678
9679         /* Some Linux gcvt's give 1.e+5 here. */
9680         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9681         checkit("100000", buf);
9682
9683         /* Some Linux gcvt's give -1.e+5 here. */
9684         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9685         checkit("-100000", buf);
9686
9687         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9688         checkit("123.456", buf);
9689
9690         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9691         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9692         /* 34 should be enough to scare even long double
9693          * places into using the e notation. */
9694         if (strlen(buf) > 5)
9695             checkit("1e+034", buf); /* for Microsoft */
9696         else
9697             checkit("1e+34", buf);
9698
9699         /* For Perl, if you add additional tests here, also add them to
9700          * t/base/num.t for benefit of platforms not using Configure or
9701          * overriding d_Gconvert */
9702
9703         exit(0);
9704 }
9705 EOP
9706 : first add preferred functions to our list
9707 xxx_list=""
9708 for xxx_convert in $gconvert_preference; do
9709     case $xxx_convert in
9710     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9711     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9712     esac
9713 done
9714 : then add any others
9715 for xxx_convert in gconvert gcvt sprintf; do
9716     case "$xxx_list" in
9717     *$xxx_convert*) ;;
9718     *) xxx_list="$xxx_list $xxx_convert" ;;
9719     esac
9720 done
9721
9722 case "$d_longdbl$uselongdouble" in
9723 "$define$define")
9724     : again, add prefered functions to our list first
9725     xxx_ld_list=""
9726     for xxx_convert in $gconvert_ld_preference; do
9727         case $xxx_convert in
9728         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9729         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9730         esac
9731     done
9732     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9733     for xxx_convert in qgcvt sprintf $xxx_list; do
9734         case "$xxx_ld_list" in
9735         $xxx_convert*|*" $xxx_convert"*) ;;
9736         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9737         esac
9738     done
9739     : if sprintf cannot do long doubles, move it to the end
9740     if test "$d_PRIgldbl" != "$define"; then
9741         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9742     fi
9743     : if no qgcvt, remove it
9744     if test "$d_qgcvt" != "$define"; then
9745         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9746     fi
9747     : use the ld_list
9748     xxx_list="$xxx_ld_list"
9749     ;;
9750 esac
9751
9752 for xxx_convert in $xxx_list; do
9753         echo "Trying $xxx_convert..."
9754         $rm -f try try$_o core
9755         set try -DTRY_$xxx_convert
9756         if eval $compile; then
9757                 echo "$xxx_convert() found." >&4
9758                 if $run ./try; then
9759                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9760                         break;
9761                 else
9762                         echo "...But $xxx_convert didn't work as I expected."
9763                         xxx_convert=''
9764                 fi
9765         else
9766                 echo "$xxx_convert NOT found." >&4
9767         fi
9768 done
9769
9770 if test X$xxx_convert = X; then
9771     echo "*** WHOA THERE!!! ***" >&4
9772     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9773     xxx_convert=sprintf
9774 fi
9775
9776 case "$xxx_convert" in
9777 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9778 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9779 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9780 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9781    "$define$define$define")
9782       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9783    "$define$define$undef")
9784       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9785    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9786    esac
9787    ;;
9788 esac
9789
9790 fi
9791 $rm_try
9792
9793 : see if _fwalk exists
9794 set fwalk d__fwalk
9795 eval $inlibc
9796
9797 : Initialize h_fcntl
9798 h_fcntl=false
9799
9800 : Initialize h_sysfile
9801 h_sysfile=false
9802
9803 : access call always available on UNIX
9804 set access d_access
9805 eval $inlibc
9806
9807 : locate the flags for 'access()'
9808 case "$d_access" in
9809 "$define")
9810         echo " "
9811         $cat >access.c <<EOCP
9812 #include <sys/types.h>
9813 #ifdef I_FCNTL
9814 #include <fcntl.h>
9815 #endif
9816 #ifdef I_SYS_FILE
9817 #include <sys/file.h>
9818 #endif
9819 #ifdef I_UNISTD
9820 #include <unistd.h>
9821 #endif
9822 #$i_stdlib I_STDLIB
9823 #ifdef I_STDLIB
9824 #include <stdlib.h>
9825 #endif
9826 int main() {
9827         exit(R_OK);
9828 }
9829 EOCP
9830         : check sys/file.h first, no particular reason here
9831         if $test `./findhdr sys/file.h` && \
9832                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9833                 h_sysfile=true;
9834                 echo "<sys/file.h> defines the *_OK access constants." >&4
9835         elif $test `./findhdr fcntl.h` && \
9836                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9837                 h_fcntl=true;
9838                 echo "<fcntl.h> defines the *_OK access constants." >&4
9839         elif $test `./findhdr unistd.h` && \
9840                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9841                 echo "<unistd.h> defines the *_OK access constants." >&4
9842         else
9843                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9844         fi
9845         ;;
9846 esac
9847 $rm -f access*
9848
9849 : see if accessx exists
9850 set accessx d_accessx
9851 eval $inlibc
9852
9853 : see if aintl exists
9854 set aintl d_aintl
9855 eval $inlibc
9856
9857 : see if alarm exists
9858 set alarm d_alarm
9859 eval $inlibc
9860
9861 : see if POSIX threads are available
9862 set pthread.h i_pthread
9863 eval $inhdr
9864
9865 : define a fucntion to check prototypes
9866 $cat > protochk <<EOSH
9867 $startsh
9868 cc="$cc"
9869 optimize="$optimize"
9870 ccflags="$ccflags"
9871 prototype="$prototype"
9872 define="$define"
9873 rm_try="$rm_try"
9874 usethreads=$usethreads
9875 i_pthread=$i_pthread
9876 pthread_h_first=$pthread_h_first
9877 EOSH
9878
9879 $cat >> protochk <<'EOSH'
9880
9881 $rm_try
9882 foo="$1"
9883 shift
9884 while test $# -ge 2; do
9885         case "$1" in
9886                 $define) echo "#include <$2>" >> try.c ;;
9887                 literal) echo "$2" >> try.c ;;
9888         esac
9889     # Extra magic for the benefit of systems that need pthread.h
9890     # to be included early to correctly detect threadsafe functions.
9891     # Such functions must guarantee themselves, though, that the usethreads
9892     # and i_pthread have been defined, before calling protochk.
9893     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9894         echo "#include <pthread.h>" >> try.c
9895         pthread_h_done=yes
9896     fi
9897     shift 2
9898 done
9899 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9900 cat >> try.c <<'EOCP'
9901 #ifdef CAN_PROTOTYPE
9902 #define _(args) args
9903 #else
9904 #define _(args) ()
9905 #endif
9906 EOCP
9907 echo "$foo" >> try.c
9908 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9909 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9910 status=$?
9911 $rm_try
9912 exit $status
9913 EOSH
9914 chmod +x protochk
9915 $eunicefix protochk
9916
9917 hasproto='varname=$1; func=$2; shift; shift;
9918 while $test $# -ge 2; do
9919         case "$1" in
9920         $define) echo "#include <$2>";;
9921         esac ;
9922     shift 2;
9923 done > try.c;
9924 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9925 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9926         echo "$func() prototype found.";
9927         val="$define";
9928 else
9929         echo "$func() prototype NOT found.";
9930         val="$undef";
9931 fi;
9932 set $varname;
9933 eval $setvar;
9934 $rm_try tryout.c'
9935
9936 : see if sys/types.h has to be included
9937 set sys/types.h i_systypes
9938 eval $inhdr
9939
9940 : see if sys/select.h has to be included
9941 set sys/select.h i_sysselct
9942 eval $inhdr
9943
9944 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9945 while $test $# -ge 2; do
9946         case "$1" in
9947         $define) echo "#include <$2>";;
9948         esac ;
9949     shift 2;
9950 done > try.c;
9951 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9952 set try;
9953 if eval $compile; then
9954         val="$define";
9955 else
9956         val="$undef";
9957 fi;
9958 set $varname;
9959 eval $setvar;
9960 $rm_try'
9961
9962 : see if we should include time.h, sys/time.h, or both
9963 echo " "
9964 if test "X$timeincl" = X; then
9965         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9966         $echo $n "I'm now running the test program...$c"
9967         $cat >try.c <<EOCP
9968 #include <sys/types.h>
9969 #ifdef I_TIME
9970 #include <time.h>
9971 #endif
9972 #ifdef I_SYSTIME
9973 #ifdef SYSTIMEKERNEL
9974 #define KERNEL
9975 #endif
9976 #include <sys/time.h>
9977 #endif
9978 #ifdef I_SYSSELECT
9979 #include <sys/select.h>
9980 #endif
9981 #$i_stdlib I_STDLIB
9982 #ifdef I_STDLIB
9983 #include <stdlib.h>
9984 #endif
9985 int main()
9986 {
9987         struct tm foo;
9988 #ifdef S_TIMEVAL
9989         struct timeval bar;
9990 #endif
9991 #ifdef S_TIMEZONE
9992         struct timezone tzp;
9993 #endif
9994         if (foo.tm_sec == foo.tm_sec)
9995                 exit(0);
9996 #ifdef S_TIMEVAL
9997         if (bar.tv_sec == bar.tv_sec)
9998                 exit(0);
9999 #endif
10000         exit(1);
10001 }
10002 EOCP
10003         flags=''
10004         for s_timezone in '-DS_TIMEZONE' ''; do
10005         sysselect=''
10006         for s_timeval in '-DS_TIMEVAL' ''; do
10007         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10008         for i_time in '' '-DI_TIME'; do
10009         for i_systime in '-DI_SYSTIME' ''; do
10010                 case "$flags" in
10011                 '') $echo $n ".$c"
10012                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10013                         if eval $compile; then
10014                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10015                                 shift
10016                                 flags="$*"
10017                                 echo " "
10018                                 $echo $n "Succeeded with $flags$c"
10019                         fi
10020                         ;;
10021                 esac
10022         done
10023         done
10024         done
10025         done
10026         done
10027         timeincl=''
10028         echo " "
10029         case "$flags" in
10030         *SYSTIMEKERNEL*) i_systimek="$define"
10031                 timeincl=`./findhdr sys/time.h`
10032                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10033         *) i_systimek="$undef";;
10034         esac
10035         case "$flags" in
10036         *I_TIME*) i_time="$define"
10037                 timeincl=`./findhdr time.h`" $timeincl"
10038                 echo "We'll include <time.h>." >&4;;
10039         *) i_time="$undef";;
10040         esac
10041         case "$flags" in
10042         *I_SYSTIME*) i_systime="$define"
10043                 timeincl=`./findhdr sys/time.h`" $timeincl"
10044                 echo "We'll include <sys/time.h>." >&4;;
10045         *) i_systime="$undef";;
10046         esac
10047         $rm_try
10048 fi
10049 : see if struct tm knows about tm_zone
10050 case "$i_systime$i_time" in
10051 *$define*)
10052         echo " "
10053         echo "Checking to see if your struct tm has tm_zone field..." >&4
10054         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10055         eval $hasfield
10056         ;;
10057 *)      val="$undef"
10058         set d_tm_tm_zone
10059         eval $setvar
10060         ;;
10061 esac
10062 case "$d_tm_tm_zone" in
10063 "$define")      echo "Yes, it does."   ;;
10064 *)              echo "No, it doesn't." ;;
10065 esac
10066 : see if struct tm knows about tm_gmtoff
10067 case "$i_systime$i_time" in
10068 *$define*)
10069         echo " "
10070         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10071         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10072         eval $hasfield
10073         ;;
10074 *)      val="$undef"
10075         set d_tm_tm_gmtoff
10076         eval $setvar
10077         ;;
10078 esac
10079 case "$d_tm_tm_gmtoff" in
10080 "$define")      echo "Yes, it does."   ;;
10081 *)              echo "No, it doesn't." ;;
10082 esac
10083
10084 : see if asctime_r exists
10085 set asctime_r d_asctime_r
10086 eval $inlibc
10087 case "$d_asctime_r" in
10088 "$define")
10089         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10090         case "$d_asctime_r_proto:$usethreads" in
10091         ":define")      d_asctime_r_proto=define
10092                 set d_asctime_r_proto asctime_r $hdrs
10093                 eval $hasproto ;;
10094         *)      ;;
10095         esac
10096         case "$d_asctime_r_proto" in
10097         define)
10098         case "$asctime_r_proto" in
10099         ''|0) try='char* asctime_r(const struct tm*, char*);'
10100         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
10101         esac
10102         case "$asctime_r_proto" in
10103         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10104         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
10105         esac
10106         case "$asctime_r_proto" in
10107         ''|0) try='int asctime_r(const struct tm*, char*);'
10108         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
10109         esac
10110         case "$asctime_r_proto" in
10111         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10112         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
10113         esac
10114         case "$asctime_r_proto" in
10115         ''|0)   d_asctime_r=undef
10116                 asctime_r_proto=0
10117                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10118         * )     case "$asctime_r_proto" in
10119                 REENTRANT_PROTO*) ;;
10120                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10121                 esac
10122                 echo "Prototype: $try" ;;
10123         esac
10124         ;;
10125         *)      case "$usethreads" in
10126                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10127                 esac
10128                 d_asctime_r=undef
10129                 asctime_r_proto=0
10130                 ;;
10131         esac
10132         ;;
10133 *)      asctime_r_proto=0
10134         ;;
10135 esac
10136
10137 : see if atolf exists
10138 set atolf d_atolf
10139 eval $inlibc
10140
10141 : see if atoll exists
10142 set atoll d_atoll
10143 eval $inlibc
10144
10145 : Look for GCC-style attribute format
10146 case "$d_attribute_format" in
10147 '')
10148 echo " "
10149 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10150 $cat >attrib.c <<'EOCP'
10151 #include <stdio.h>
10152 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10153 EOCP
10154 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10155         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10156                 echo "Your C compiler doesn't support __attribute__((format))."
10157                 val="$undef"
10158         else
10159                 echo "Your C compiler supports __attribute__((format))."
10160                 val="$define"
10161         fi
10162 else
10163         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10164         val="$undef"
10165 fi
10166 ;;
10167 *) val="$d_attribute_format" ;;
10168 esac
10169 set d_attribute_format
10170 eval $setvar
10171 $rm -f attrib*
10172
10173 : Look for GCC-style attribute format with null format allowed
10174 case "$d_printf_format_null" in
10175 '') case "$d_attribute_format" in
10176     $define)
10177         echo " "
10178         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10179 $cat >attrib.c <<EOCP
10180 #include <stdio.h>
10181 #$i_stdlib I_STDLIB
10182 #ifdef I_STDLIB
10183 #include <stdlib.h>
10184 #endif
10185 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10186 int null_printf (char* pat,...) { return (int)pat; }
10187 int main () { exit(null_printf(NULL)); }
10188 EOCP
10189         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10190             : run the executable in case it produces a run-time warning
10191             if $run ./attrib >>attrib.out 2>&1; then
10192                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10193                     echo "Your C compiler doesn't allow __printf__ format to be null."
10194                     val="$undef"
10195                 else
10196                     echo "Your C compiler allows __printf__ format to be null."
10197                     val="$define"
10198                 fi
10199             else
10200             echo "Your C compiler executable failed with __printf__ format null."
10201             val="$undef"
10202         fi
10203     else
10204         echo "Your C compiler fails with __printf__ format null."
10205         val="$undef"
10206     fi
10207     ;;
10208     *)  val="$undef" ;;
10209     esac
10210 ;;
10211 *)  val="$d_printf_format_null" ;;
10212 esac
10213 set d_printf_format_null
10214 eval $setvar
10215 $rm -f attrib*
10216
10217 : Look for GCC-style attribute malloc
10218 case "$d_attribute_malloc" in
10219 '')
10220 echo " "
10221 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10222 $cat >attrib.c <<'EOCP'
10223 #include <stdio.h>
10224 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10225 EOCP
10226 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10227         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10228                 echo "Your C compiler doesn't support __attribute__((malloc))."
10229                 val="$undef"
10230         else
10231                 echo "Your C compiler supports __attribute__((malloc))."
10232                 val="$define"
10233         fi
10234 else
10235         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10236         val="$undef"
10237 fi
10238 ;;
10239 *) val="$d_attribute_malloc" ;;
10240 esac
10241 set d_attribute_malloc
10242 eval $setvar
10243 $rm -f attrib*
10244
10245 : Look for GCC-style attribute nonnull
10246 case "$d_attribute_nonnull" in
10247 '')
10248 echo " "
10249 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10250 $cat >attrib.c <<'EOCP'
10251 #include <stdio.h>
10252 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10253 EOCP
10254 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10255         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10256                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10257                 val="$undef"
10258         else
10259                 echo "Your C compiler supports __attribute__((nonnull))."
10260                 val="$define"
10261         fi
10262 else
10263         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10264         val="$undef"
10265 fi
10266 ;;
10267 *) val="$d_attribute_nonnull" ;;
10268 esac
10269 set d_attribute_nonnull
10270 eval $setvar
10271 $rm -f attrib*
10272
10273 : Look for GCC-style attribute noreturn
10274 case "$d_attribute_noreturn" in
10275 '')
10276 echo " "
10277 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10278 $cat >attrib.c <<'EOCP'
10279 #include <stdio.h>
10280 void fall_over_dead( void ) __attribute__((noreturn));
10281 EOCP
10282 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10283         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10284                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10285                 val="$undef"
10286         else
10287                 echo "Your C compiler supports __attribute__((noreturn))."
10288                 val="$define"
10289         fi
10290 else
10291         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10292         val="$undef"
10293 fi
10294 ;;
10295 *) val="$d_attribute_noreturn" ;;
10296 esac
10297 set d_attribute_noreturn
10298 eval $setvar
10299 $rm -f attrib*
10300
10301 : Look for GCC-style attribute pure
10302 case "$d_attribute_pure" in
10303 '')
10304 echo " "
10305 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10306 $cat >attrib.c <<'EOCP'
10307 #include <stdio.h>
10308 int square( int n ) __attribute__((pure));
10309 EOCP
10310 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10311         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10312                 echo "Your C compiler doesn't support __attribute__((pure))."
10313                 val="$undef"
10314         else
10315                 echo "Your C compiler supports __attribute__((pure))."
10316                 val="$define"
10317         fi
10318 else
10319         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10320         val="$undef"
10321 fi
10322 ;;
10323 *) val="$d_attribute_pure" ;;
10324 esac
10325 set d_attribute_pure
10326 eval $setvar
10327 $rm -f attrib*
10328
10329 : Look for GCC-style attribute unused
10330 case "$d_attribute_unused" in
10331 '')
10332 echo " "
10333 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10334 $cat >attrib.c <<'EOCP'
10335 #include <stdio.h>
10336 int do_something( int dummy __attribute__((unused)), int n );
10337 EOCP
10338 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10339         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10340                 echo "Your C compiler doesn't support __attribute__((unused))."
10341                 val="$undef"
10342         else
10343                 echo "Your C compiler supports __attribute__((unused))."
10344                 val="$define"
10345         fi
10346 else
10347         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10348         val="$undef"
10349 fi
10350 ;;
10351 *) val="$d_attribute_unused" ;;
10352 esac
10353 set d_attribute_unused
10354 eval $setvar
10355 $rm -f attrib*
10356
10357 : Look for GCC-style attribute warn_unused_result
10358 case "$d_attribute_warn_unused_result" in
10359 '')
10360 echo " "
10361 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10362 $cat >attrib.c <<'EOCP'
10363 #include <stdio.h>
10364 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10365 EOCP
10366 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10367         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10368                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10369                 val="$undef"
10370         else
10371                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10372                 val="$define"
10373         fi
10374 else
10375         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10376         val="$undef"
10377 fi
10378 ;;
10379 *) val="$d_attribute_warn_unused_result" ;;
10380 esac
10381 set d_attribute_warn_unused_result
10382 eval $setvar
10383 $rm -f attrib*
10384
10385 : see if bcmp exists
10386 set bcmp d_bcmp
10387 eval $inlibc
10388
10389 : see if bcopy exists
10390 set bcopy d_bcopy
10391 eval $inlibc
10392
10393 : see if getpgrp exists
10394 set getpgrp d_getpgrp
10395 eval $inlibc
10396
10397 case "$d_getpgrp" in
10398 "$define")
10399         echo " "
10400         echo "Checking to see which flavor of getpgrp is in use..."
10401         $cat >try.c <<EOP
10402 #$i_unistd I_UNISTD
10403 #include <sys/types.h>
10404 #ifdef I_UNISTD
10405 #  include <unistd.h>
10406 #endif
10407 #$i_stdlib I_STDLIB
10408 #ifdef I_STDLIB
10409 #include <stdlib.h>
10410 #endif
10411 int main()
10412 {
10413         if (getuid() == 0) {
10414                 printf("(I see you are running Configure as super-user...)\n");
10415                 setuid(1);
10416         }
10417 #ifdef TRY_BSD_PGRP
10418         if (getpgrp(1) == 0)
10419                 exit(0);
10420 #else
10421         if (getpgrp() > 0)
10422                 exit(0);
10423 #endif
10424         exit(1);
10425 }
10426 EOP
10427         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10428                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10429                 val="$define"
10430         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10431                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10432                 val="$undef"
10433         else
10434                 echo "I can't seem to compile and run the test program."
10435                 if ./usg; then
10436                         xxx="a USG one, i.e. you use getpgrp()."
10437                 else
10438                         # SVR4 systems can appear rather BSD-ish.
10439                         case "$i_unistd" in
10440                         $undef)
10441                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10442                                 val="$define"
10443                                 ;;
10444                         $define)
10445                                 xxx="probably a USG one, i.e. you use getpgrp()."
10446                                 val="$undef"
10447                                 ;;
10448                         esac
10449                 fi
10450                 echo "Assuming your getpgrp is $xxx" >&4
10451         fi
10452         ;;
10453 *) val="$undef";;
10454 esac
10455 set d_bsdgetpgrp
10456 eval $setvar
10457 $rm_try
10458
10459 : see if setpgrp exists
10460 set setpgrp d_setpgrp
10461 eval $inlibc
10462
10463 case "$d_setpgrp" in
10464 "$define")
10465         echo " "
10466         echo "Checking to see which flavor of setpgrp is in use..."
10467         $cat >try.c <<EOP
10468 #$i_unistd I_UNISTD
10469 #include <sys/types.h>
10470 #ifdef I_UNISTD
10471 #  include <unistd.h>
10472 #endif
10473 #$i_stdlib I_STDLIB
10474 #ifdef I_STDLIB
10475 #include <stdlib.h>
10476 #endif
10477 int main()
10478 {
10479         if (getuid() == 0) {
10480                 printf("(I see you are running Configure as super-user...)\n");
10481                 setuid(1);
10482         }
10483 #ifdef TRY_BSD_PGRP
10484         if (-1 == setpgrp(1, 1))
10485                 exit(0);
10486 #else
10487         if (setpgrp() != -1)
10488                 exit(0);
10489 #endif
10490         exit(1);
10491 }
10492 EOP
10493         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10494                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10495                 val="$define"
10496         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10497                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10498                 val="$undef"
10499         else
10500                 echo "(I can't seem to compile and run the test program.)"
10501                 if ./usg; then
10502                         xxx="a USG one, i.e. you use setpgrp()."
10503                 else
10504                         # SVR4 systems can appear rather BSD-ish.
10505                         case "$i_unistd" in
10506                         $undef)
10507                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10508                                 val="$define"
10509                                 ;;
10510                         $define)
10511                                 xxx="probably a USG one, i.e. you use setpgrp()."
10512                                 val="$undef"
10513                                 ;;
10514                         esac
10515                 fi
10516                 echo "Assuming your setpgrp is $xxx" >&4
10517         fi
10518         ;;
10519 *) val="$undef";;
10520 esac
10521 set d_bsdsetpgrp
10522 eval $setvar
10523 $rm_try
10524
10525 : Look for GCC-style __builtin_choose_expr
10526 case "$d_builtin_choose_expr" in
10527 '')
10528     echo " "
10529     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10530     $cat >try.c <<'EOCP'
10531 #include <assert.h>
10532 #include <stdlib.h>
10533 #include <stdio.h>
10534
10535 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10536
10537 int main(void) {
10538     assert( SYRINX(1) == 2112 );
10539     assert( SYRINX(1) != 5150 );
10540     assert( SYRINX(0) == 5150 );
10541     assert( SYRINX(0) != 2112 );
10542     puts( "All good!" );
10543     exit(0);
10544 }
10545
10546 EOCP
10547     set try
10548     if eval $compile; then
10549         echo "Your C compiler supports __builtin_choose_expr."
10550         val="$define"
10551     else
10552         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10553         val="$undef"
10554     fi
10555 ;;
10556 *) val="$d_builtin_choose_expr" ;;
10557 esac
10558
10559 set d_builtin_choose_expr
10560 eval $setvar
10561 $rm_try
10562
10563 : Look for GCC-style __builtin_expect
10564 case "$d_builtin_expect" in
10565 '')
10566     echo " "
10567     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10568     $cat >builtin.c <<'EOCP'
10569 int main(void) {
10570     int n = 50;
10571     if ( __builtin_expect(n, 0) ) n = 1;
10572 }
10573 EOCP
10574     set try
10575     if eval $compile; then
10576         echo "Your C compiler supports __builtin_choose_expr."
10577         val="$define"
10578     else
10579         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10580         val="$undef"
10581     fi
10582     ;;
10583 *) val="$d_builtin_expect" ;;
10584 esac
10585
10586 set d_builtin_expect
10587 eval $setvar
10588 $rm_try
10589
10590 : see if bzero exists
10591 set bzero d_bzero
10592 eval $inlibc
10593
10594 : see if stdarg is available
10595 echo " "
10596 if $test `./findhdr stdarg.h`; then
10597         echo "<stdarg.h> found." >&4
10598         valstd="$define"
10599 else
10600         echo "<stdarg.h> NOT found." >&4
10601         valstd="$undef"
10602 fi
10603
10604 : see if varags is available
10605 echo " "
10606 if $test `./findhdr varargs.h`; then
10607         echo "<varargs.h> found." >&4
10608 else
10609         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10610 fi
10611
10612 : set up the varargs testing programs
10613 $cat > varargs.c <<EOP
10614 #ifdef I_STDARG
10615 #include <stdarg.h>
10616 #endif
10617 #ifdef I_VARARGS
10618 #include <varargs.h>
10619 #endif
10620
10621 #ifdef I_STDARG
10622 int f(char *p, ...)
10623 #else
10624 int f(va_alist)
10625 va_dcl
10626 #endif
10627 {
10628         va_list ap;
10629 #ifndef I_STDARG
10630         char *p;
10631 #endif
10632 #ifdef I_STDARG
10633         va_start(ap,p);
10634 #else
10635         va_start(ap);
10636         p = va_arg(ap, char *);
10637 #endif
10638         va_end(ap);
10639         return 0;
10640 }
10641 EOP
10642 $cat > varargs <<EOP
10643 $startsh
10644 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10645         echo "true"
10646 else
10647         echo "false"
10648 fi
10649 $rm -f varargs$_o
10650 EOP
10651 chmod +x varargs
10652
10653 : now check which varargs header should be included
10654 echo " "
10655 i_varhdr=''
10656 case "$valstd" in
10657 "$define")
10658         if `./varargs I_STDARG`; then
10659                 val='stdarg.h'
10660         elif `./varargs I_VARARGS`; then
10661                 val='varargs.h'
10662         fi
10663         ;;
10664 *)
10665         if `./varargs I_VARARGS`; then
10666                 val='varargs.h'
10667         fi
10668         ;;
10669 esac
10670 case "$val" in
10671 '')
10672 echo "I could not find the definition for va_dcl... You have problems..." >&4
10673         val="$undef"; set i_stdarg; eval $setvar
10674         val="$undef"; set i_varargs; eval $setvar
10675         ;;
10676 *)
10677         set i_varhdr
10678         eval $setvar
10679         case "$i_varhdr" in
10680         stdarg.h)
10681                 val="$define"; set i_stdarg; eval $setvar
10682                 val="$undef"; set i_varargs; eval $setvar
10683                 ;;
10684         varargs.h)
10685                 val="$undef"; set i_stdarg; eval $setvar
10686                 val="$define"; set i_varargs; eval $setvar
10687                 ;;
10688         esac
10689         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10690 esac
10691 $rm -f varargs*
10692
10693 : see if the Compiler supports C99 variadic macros
10694 case "$i_stdarg$i_stdlib" in
10695     "$define$define")
10696     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10697     $cat >try.c <<EOCP
10698 #include <stdio.h>
10699 #include <stdarg.h>
10700
10701 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10702
10703 int main() {
10704   char buf[20];
10705   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10706   puts(buf);
10707   return 0;
10708 }
10709 EOCP
10710     set try
10711     if eval $compile && $run ./try 2>&1 >/dev/null; then
10712         case "`$run ./try`" in
10713             "123 456 789")
10714             echo "You have C99 variadic macros." >&4
10715             d_c99_variadic_macros="$define"
10716             ;;
10717             *)
10718             echo "You don't have functional C99 variadic macros." >&4
10719             d_c99_variadic_macros="$undef"
10720             ;;
10721         esac
10722     else
10723         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10724         d_c99_variadic_macros="$undef"
10725     fi
10726     $rm_try
10727     ;;
10728     *)
10729     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10730     d_c99_variadic_macros="$undef"
10731     ;;
10732 esac
10733
10734 : see if signal is declared as pointer to function returning int or void
10735 echo " "
10736 xxx=`./findhdr signal.h`
10737 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10738 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10739         echo "You have int (*signal())() instead of void." >&4
10740         val="$undef"
10741 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10742         echo "You have void (*signal())()." >&4
10743         val="$define"
10744 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10745         echo "You have int (*signal())() instead of void." >&4
10746         val="$undef"
10747 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10748         echo "You have void (*signal())()." >&4
10749         val="$define"
10750 else
10751         case "$d_voidsig" in
10752         '')
10753         echo "I can't determine whether signal handler returns void or int..." >&4
10754                 dflt=void
10755                 rp="What type does your signal handler return?"
10756                 . ./myread
10757                 case "$ans" in
10758                 v*) val="$define";;
10759                 *) val="$undef";;
10760                 esac;;
10761         "$define")
10762                 echo "As you already told me, signal handler returns void." >&4
10763                 val="$define"
10764                 ;;
10765         *)      echo "As you already told me, signal handler returns int." >&4
10766                 val="$undef"
10767                 ;;
10768         esac
10769 fi
10770 set d_voidsig
10771 eval $setvar
10772 case "$d_voidsig" in
10773 "$define") signal_t="void";;
10774 *) signal_t="int";;
10775 esac
10776 $rm -f $$.tmp
10777
10778 : check for ability to cast large floats to 32-bit ints.
10779 echo " "
10780 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10781 if $test "$intsize" -ge 4; then
10782         xxx=int
10783 else
10784         xxx=long
10785 fi
10786 $cat >try.c <<EOCP
10787 #include <stdio.h>
10788 #$i_stdlib I_STDLIB
10789 #ifdef I_STDLIB
10790 #include <stdlib.h>
10791 #endif
10792 #include <sys/types.h>
10793 #include <signal.h>
10794 $signal_t blech(int s) { exit(3); }
10795 int main()
10796 {
10797         $xxx i32;
10798         double f, g;
10799         int result = 0;
10800         char str[16];
10801         signal(SIGFPE, blech);
10802
10803         /* Don't let compiler optimize the test away.  Store the number
10804            in a writable string for gcc to pass to sscanf under HP/UX.
10805         */
10806         sprintf(str, "2147483647");
10807         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10808         g = 10 * f;
10809         i32  = ($xxx) g;
10810
10811         /* x86 processors will probably give 0x8000 0000, which is a
10812            sign change.  We don't want that.  We want to mimic SPARC
10813            behavior here, which is to preserve the sign and give
10814            back 0x7fff ffff.
10815         */
10816         if (i32 != ($xxx) f)
10817                 result |= 1;
10818         exit(result);
10819 }
10820 EOCP
10821 set try
10822 if eval $compile_ok; then
10823         $run ./try
10824         yyy=$?
10825 else
10826         echo "(I can't seem to compile the test program--assuming it can't)"
10827         yyy=1
10828 fi
10829 case "$yyy" in
10830 0)      val="$define"
10831         echo "Yup, it can."
10832         ;;
10833 *)      val="$undef"
10834         echo "Nope, it can't."
10835         ;;
10836 esac
10837 set d_casti32
10838 eval $setvar
10839 $rm_try
10840
10841 : check for ability to cast negative floats to unsigned
10842 echo " "
10843 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10844 $cat >try.c <<EOCP
10845 #include <stdio.h>
10846 #$i_stdlib I_STDLIB
10847 #ifdef I_STDLIB
10848 #include <stdlib.h>
10849 #endif
10850 #include <sys/types.h>
10851 #include <signal.h>
10852 $signal_t blech(int s) { exit(7); }
10853 $signal_t blech_in_list(int s) { exit(4); }
10854 unsigned long dummy_long(unsigned long p) { return p; }
10855 unsigned int dummy_int(unsigned int p) { return p; }
10856 unsigned short dummy_short(unsigned short p) { return p; }
10857 int main()
10858 {
10859         double f;
10860         unsigned long along;
10861         unsigned int aint;
10862         unsigned short ashort;
10863         int result = 0;
10864         char str[16];
10865
10866         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10867            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10868            optimized the whole file away
10869         */
10870         /* Store the number in a writable string for gcc to pass to
10871            sscanf under HP/UX.
10872         */
10873         sprintf(str, "-123");
10874         sscanf(str, "%lf", &f);  /* f = -123.; */
10875
10876         signal(SIGFPE, blech);
10877         along = (unsigned long)f;
10878         aint = (unsigned int)f;
10879         ashort = (unsigned short)f;
10880         if (along != (unsigned long)-123)
10881                 result |= 1;
10882         if (aint != (unsigned int)-123)
10883                 result |= 1;
10884         if (ashort != (unsigned short)-123)
10885                 result |= 1;
10886         sprintf(str, "1073741824.");
10887         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10888         f = f + f;
10889         along = 0;
10890         along = (unsigned long)f;
10891         if (along != 0x80000000)
10892                 result |= 2;
10893         f -= 1.;
10894         along = 0;
10895         along = (unsigned long)f;
10896         if (along != 0x7fffffff)
10897                 result |= 1;
10898         f += 2.;
10899         along = 0;
10900         along = (unsigned long)f;
10901         if (along != 0x80000001)
10902                 result |= 2;
10903         if (result)
10904                 exit(result);
10905         signal(SIGFPE, blech_in_list);
10906         sprintf(str, "123.");
10907         sscanf(str, "%lf", &f);  /* f = 123.; */
10908         along = dummy_long((unsigned long)f);
10909         aint = dummy_int((unsigned int)f);
10910         ashort = dummy_short((unsigned short)f);
10911         if (along != (unsigned long)123)
10912                 result |= 4;
10913         if (aint != (unsigned int)123)
10914                 result |= 4;
10915         if (ashort != (unsigned short)123)
10916                 result |= 4;
10917         exit(result);
10918
10919 }
10920 EOCP
10921 set try
10922 if eval $compile_ok; then
10923         $run ./try
10924         castflags=$?
10925 else
10926         echo "(I can't seem to compile the test program--assuming it can't)"
10927         castflags=7
10928 fi
10929 case "$castflags" in
10930 0)      val="$define"
10931         echo "Yup, it can."
10932         ;;
10933 *)      val="$undef"
10934         echo "Nope, it can't."
10935         ;;
10936 esac
10937 set d_castneg
10938 eval $setvar
10939 $rm_try
10940
10941 : see if vprintf exists
10942 echo " "
10943 if set vprintf val -f d_vprintf; eval $csym; $val; then
10944         echo 'vprintf() found.' >&4
10945         val="$define"
10946         $cat >try.c <<EOF
10947 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
10948 #$i_varargs I_VARARGS
10949
10950 #$i_stdlib I_STDLIB
10951 #$i_unistd I_UNISTD
10952
10953 #ifdef I_STDARG
10954 #  include <stdarg.h>
10955 #else /* I_VARARGS */
10956 #  include <varargs.h>
10957 #endif
10958
10959 #ifdef I_UNISTD
10960 #  include <unistd.h>
10961 #endif
10962
10963 #ifdef I_STDLIB
10964 #  include <stdlib.h>
10965 #endif
10966
10967 #include <stdio.h> /* vsprintf prototype */
10968
10969 #ifdef I_STDARG
10970 void xxx(int n, ...)
10971 {
10972     va_list args;
10973     char buf[10];
10974     va_start(args, n);
10975     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10976 }
10977 int main() { xxx(1, "foo"); }
10978
10979 #else /* I_VARARGS */
10980
10981 xxx(va_alist)
10982 va_dcl
10983 {
10984     va_list args;
10985     char buf[10];
10986     va_start(args);
10987     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10988 }
10989 int main() { xxx("foo"); }
10990
10991 #endif
10992
10993 EOF
10994         set try
10995         if eval $compile_ok; then
10996                 if $run ./try; then
10997                         echo "Your vsprintf() returns (int)." >&4
10998                         val2="$undef"
10999                 else
11000                         echo "Your vsprintf() returns (char*)." >&4
11001                         val2="$define"
11002                 fi
11003         else
11004                 echo 'I am unable to compile the vsprintf() test program.' >&4
11005                 # We shouldn't get here.  If we do, assume the standard signature,
11006                 # not the old BSD one.
11007                 echo 'Guessing that vsprintf() returns (int).' >&4
11008                 val2="$undef"
11009         fi
11010 else
11011         echo 'vprintf() NOT found.' >&4
11012         val="$undef"
11013         val2="$undef"
11014 fi
11015 $rm_try
11016 set d_vprintf
11017 eval $setvar
11018 val=$val2
11019 set d_charvspr
11020 eval $setvar
11021
11022 : see if chown exists
11023 set chown d_chown
11024 eval $inlibc
11025
11026 : see if chroot exists
11027 set chroot d_chroot
11028 eval $inlibc
11029
11030 : see if chsize exists
11031 set chsize d_chsize
11032 eval $inlibc
11033
11034 : see if class exists
11035 set class d_class
11036 eval $inlibc
11037
11038 : see if clearenv exists
11039 set clearenv d_clearenv
11040 eval $inlibc
11041
11042 hasstruct='varname=$1; struct=$2; shift; shift;
11043 while $test $# -ge 2; do
11044         case "$1" in
11045         $define) echo "#include <$2>";;
11046         esac ;
11047     shift 2;
11048 done > try.c;
11049 echo "int main () { struct $struct foo; }" >> try.c;
11050 set try;
11051 if eval $compile; then
11052         val="$define";
11053 else
11054         val="$undef";
11055 fi;
11056 set $varname;
11057 eval $setvar;
11058 $rm_try'
11059
11060 socketlib=''
11061 sockethdr=''
11062 : see whether socket exists
11063 echo " "
11064 $echo $n "Hmm... $c" >&4
11065 if set socket val -f d_socket; eval $csym; $val; then
11066         echo "Looks like you have Berkeley networking support." >&4
11067         d_socket="$define"
11068         if set setsockopt val -f; eval $csym; $val; then
11069                 d_oldsock="$undef"
11070         else
11071                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11072                 d_oldsock="$define"
11073         fi
11074 else
11075         if $contains socklib libc.list >/dev/null 2>&1; then
11076                 echo "Looks like you have Berkeley networking support." >&4
11077                 d_socket="$define"
11078                 : we will have to assume that it supports the 4.2 BSD interface
11079                 d_oldsock="$undef"
11080         else
11081                 echo "You don't have Berkeley networking in libc$_a..." >&4
11082                 if test "X$d_socket" = "X$define"; then
11083                    echo "...but you seem to believe that you have sockets." >&4
11084                 else
11085                         for net in net socket
11086                         do
11087                                 if test -f /usr/lib/lib$net$_a; then
11088                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11089                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11090                                         if $contains socket libc.list >/dev/null 2>&1; then
11091                                                 d_socket="$define"
11092                                                 socketlib="-l$net"
11093                                                 case "$net" in
11094                                                 net)
11095                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11096                                                         sockethdr="-I/usr/netinclude"
11097                                                         ;;
11098                                                 esac
11099                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11100                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11101                                                         d_oldsock="$undef"
11102                                                 else
11103                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11104                                                         d_oldsock="$define"
11105                                                 fi
11106                                                 break
11107                                         fi
11108                                 fi
11109                         done
11110                         if test "X$d_socket" != "X$define"; then
11111                            echo "or anywhere else I see." >&4
11112                            d_socket="$undef"
11113                            d_oldsock="$undef"
11114                         fi
11115                 fi
11116         fi
11117 fi
11118
11119 : see if socketpair exists
11120 set socketpair d_sockpair
11121 eval $inlibc
11122
11123
11124 echo " "
11125 echo "Checking the availability of certain socket constants..." >&4
11126 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11127         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11128         $cat >try.c <<EOF
11129 #include <sys/types.h>
11130 #include <sys/socket.h>
11131 int main() {
11132     int i = $ENUM;
11133 }
11134 EOF
11135         val="$undef"
11136         set try; if eval $compile; then
11137                 val="$define"
11138         fi
11139         set d_${enum}; eval $setvar
11140         $rm_try
11141 done
11142
11143 : see if this is a sys/uio.h system
11144 set sys/uio.h i_sysuio
11145 eval $inhdr
11146
11147
11148 echo " "
11149 echo "Checking to see if your system supports struct cmsghdr..." >&4
11150 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11151 eval $hasstruct
11152 case "$d_cmsghdr_s" in
11153 "$define")      echo "Yes, it does."   ;;
11154 *)              echo "No, it doesn't." ;;
11155 esac
11156
11157
11158 : check for const keyword
11159 echo " "
11160 echo 'Checking to see if your C compiler knows about "const"...' >&4
11161 $cat >const.c <<'EOCP'
11162 typedef struct spug { int drokk; } spug;
11163 int main()
11164 {
11165         const char *foo;
11166         const spug y = { 0 };
11167 }
11168 EOCP
11169 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11170         val="$define"
11171         echo "Yup, it does."
11172 else
11173         val="$undef"
11174         echo "Nope, it doesn't."
11175 fi
11176 set d_const
11177 eval $setvar
11178
11179 : see if copysignl exists
11180 set copysignl d_copysignl
11181 eval $inlibc
11182
11183 : see if crypt exists
11184 echo " "
11185 set crypt d_crypt
11186 eval $inlibc
11187 case "$d_crypt" in
11188 $define) cryptlib='' ;;
11189 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11190                 echo 'crypt() found.' >&4
11191                 val="$define"
11192                 cryptlib=''
11193         else
11194                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11195                 if $test -z "$cryptlib"; then
11196                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11197                 else
11198                         cryptlib=-lcrypt
11199                 fi
11200                 if $test -z "$cryptlib"; then
11201                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11202                 else
11203                         cryptlib=-lcrypt
11204                 fi
11205                 if $test -z "$cryptlib"; then
11206                         cryptlib=`./loc libcrypt$_a "" $libpth`
11207                 else
11208                         cryptlib=-lcrypt
11209                 fi
11210                 if $test -z "$cryptlib"; then
11211                         echo 'crypt() NOT found.' >&4
11212                         val="$undef"
11213                 else
11214                         val="$define"
11215                 fi
11216         fi
11217         set d_crypt
11218         eval $setvar
11219         ;;
11220 esac
11221
11222 : see if this is a crypt.h system
11223 set crypt.h i_crypt
11224 eval $inhdr
11225
11226 : see if crypt_r exists
11227 set crypt_r d_crypt_r
11228 eval $inlibc
11229 case "$d_crypt_r" in
11230 "$define")
11231         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11232         case "$d_crypt_r_proto:$usethreads" in
11233         ":define")      d_crypt_r_proto=define
11234                 set d_crypt_r_proto crypt_r $hdrs
11235                 eval $hasproto ;;
11236         *)      ;;
11237         esac
11238         case "$d_crypt_r_proto" in
11239         define)
11240         case "$crypt_r_proto" in
11241         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11242         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
11243         esac
11244         case "$crypt_r_proto" in
11245         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11246         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
11247         esac
11248         case "$crypt_r_proto" in
11249         ''|0)   d_crypt_r=undef
11250                 crypt_r_proto=0
11251                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11252         * )     case "$crypt_r_proto" in
11253                 REENTRANT_PROTO*) ;;
11254                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11255                 esac
11256                 echo "Prototype: $try" ;;
11257         esac
11258         ;;
11259         *)      case "$usethreads" in
11260                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11261                 esac
11262                 d_crypt_r=undef
11263                 crypt_r_proto=0
11264                 ;;
11265         esac
11266         ;;
11267 *)      crypt_r_proto=0
11268         ;;
11269 esac
11270
11271 : get csh whereabouts
11272 case "$csh" in
11273 'csh') val="$undef" ;;
11274 *) val="$define" ;;
11275 esac
11276 set d_csh
11277 eval $setvar
11278 : Respect a hint or command line value for full_csh.
11279 case "$full_csh" in
11280 '') full_csh=$csh ;;
11281 esac
11282
11283 : see if ctermid exists
11284 set ctermid d_ctermid
11285 eval $inlibc
11286
11287 : see if ctermid_r exists
11288 set ctermid_r d_ctermid_r
11289 eval $inlibc
11290 case "$d_ctermid_r" in
11291 "$define")
11292         hdrs="$i_systypes sys/types.h define stdio.h "
11293         case "$d_ctermid_r_proto:$usethreads" in
11294         ":define")      d_ctermid_r_proto=define
11295                 set d_ctermid_r_proto ctermid_r $hdrs
11296                 eval $hasproto ;;
11297         *)      ;;
11298         esac
11299         case "$d_ctermid_r_proto" in
11300         define)
11301         case "$ctermid_r_proto" in
11302         ''|0) try='char* ctermid_r(char*);'
11303         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
11304         esac
11305         case "$ctermid_r_proto" in
11306         ''|0)   d_ctermid_r=undef
11307                 ctermid_r_proto=0
11308                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11309         * )     case "$ctermid_r_proto" in
11310                 REENTRANT_PROTO*) ;;
11311                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11312                 esac
11313                 echo "Prototype: $try" ;;
11314         esac
11315         ;;
11316         *)      case "$usethreads" in
11317                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11318                 esac
11319                 d_ctermid_r=undef
11320                 ctermid_r_proto=0
11321                 ;;
11322         esac
11323         ;;
11324 *)      ctermid_r_proto=0
11325         ;;
11326 esac
11327
11328 : see if ctime_r exists
11329 set ctime_r d_ctime_r
11330 eval $inlibc
11331 case "$d_ctime_r" in
11332 "$define")
11333         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11334         case "$d_ctime_r_proto:$usethreads" in
11335         ":define")      d_ctime_r_proto=define
11336                 set d_ctime_r_proto ctime_r $hdrs
11337                 eval $hasproto ;;
11338         *)      ;;
11339         esac
11340         case "$d_ctime_r_proto" in
11341         define)
11342         case "$ctime_r_proto" in
11343         ''|0) try='char* ctime_r(const time_t*, char*);'
11344         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
11345         esac
11346         case "$ctime_r_proto" in
11347         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11348         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
11349         esac
11350         case "$ctime_r_proto" in
11351         ''|0) try='int ctime_r(const time_t*, char*);'
11352         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
11353         esac
11354         case "$ctime_r_proto" in
11355         ''|0) try='int ctime_r(const time_t*, char*, int);'
11356         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
11357         esac
11358         case "$ctime_r_proto" in
11359         ''|0)   d_ctime_r=undef
11360                 ctime_r_proto=0
11361                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11362         * )     case "$ctime_r_proto" in
11363                 REENTRANT_PROTO*) ;;
11364                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11365                 esac
11366                 echo "Prototype: $try" ;;
11367         esac
11368         ;;
11369         *)      case "$usethreads" in
11370                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11371                 esac
11372                 d_ctime_r=undef
11373                 ctime_r_proto=0
11374                 ;;
11375         esac
11376         ;;
11377 *)      ctime_r_proto=0
11378         ;;
11379 esac
11380
11381 : see if cuserid exists
11382 set cuserid d_cuserid
11383 eval $inlibc
11384
11385 : see if this is a limits.h system
11386 set limits.h i_limits
11387 eval $inhdr
11388
11389 : see if this is a float.h system
11390 set float.h i_float
11391 eval $inhdr
11392
11393 : See if number of significant digits in a double precision number is known
11394 echo " "
11395 $cat >dbl_dig.c <<EOM
11396 #$i_limits I_LIMITS
11397 #$i_float I_FLOAT
11398 #ifdef I_LIMITS
11399 #include <limits.h>
11400 #endif
11401 #ifdef I_FLOAT
11402 #include <float.h>
11403 #endif
11404 #ifdef DBL_DIG
11405 printf("Contains DBL_DIG");
11406 #endif
11407 EOM
11408 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11409 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11410         echo "DBL_DIG found." >&4
11411         val="$define"
11412 else
11413         echo "DBL_DIG NOT found." >&4
11414         val="$undef"
11415 fi
11416 $rm -f dbl_dig.?
11417 set d_dbl_dig
11418 eval $setvar
11419
11420 : see if dbm.h is available
11421 : see if dbmclose exists
11422 set dbmclose d_dbmclose
11423 eval $inlibc
11424
11425 case "$d_dbmclose" in
11426 $define)
11427         set dbm.h i_dbm
11428         eval $inhdr
11429         case "$i_dbm" in
11430         $define)
11431                 val="$undef"
11432                 set i_rpcsvcdbm
11433                 eval $setvar
11434                 ;;
11435         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11436                 eval $inhdr
11437                 ;;
11438         esac
11439         ;;
11440 *)      echo "We won't be including <dbm.h>"
11441         val="$undef"
11442         set i_dbm
11443         eval $setvar
11444         val="$undef"
11445         set i_rpcsvcdbm
11446         eval $setvar
11447         ;;
11448 esac
11449
11450 : see if prototype for dbminit is available
11451 echo " "
11452 set d_dbminitproto dbminit $i_dbm dbm.h
11453 eval $hasproto
11454
11455 : see if difftime exists
11456 set difftime d_difftime
11457 eval $inlibc
11458
11459 : see if this is a dirent system
11460 echo " "
11461 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11462         val="$define"
11463         echo "<dirent.h> found." >&4
11464 else
11465         val="$undef"
11466         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11467                 echo "<sys/dir.h> found." >&4
11468                 echo " "
11469         else
11470                 xinc=`./findhdr sys/ndir.h`
11471         fi
11472         echo "<dirent.h> NOT found." >&4
11473 fi
11474 set i_dirent
11475 eval $setvar
11476
11477 : Look for type of directory structure.
11478 echo " "
11479 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11480
11481 case "$direntrytype" in
11482 ''|' ')
11483         case "$i_dirent" in
11484         $define) guess1='struct dirent' ;;
11485         *) guess1='struct direct'  ;;
11486         esac
11487         ;;
11488 *)      guess1="$direntrytype"
11489         ;;
11490 esac
11491
11492 case "$guess1" in
11493 'struct dirent') guess2='struct direct' ;;
11494 *) guess2='struct dirent' ;;
11495 esac
11496
11497 if $contains "$guess1" try.c >/dev/null 2>&1; then
11498         direntrytype="$guess1"
11499         echo "Your directory entries are $direntrytype." >&4
11500 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11501         direntrytype="$guess2"
11502         echo "Your directory entries seem to be $direntrytype." >&4
11503 else
11504         echo "I don't recognize your system's directory entries." >&4
11505         rp="What type is used for directory entries on this system?"
11506         dflt="$guess1"
11507         . ./myread
11508         direntrytype="$ans"
11509 fi
11510 $rm_try
11511
11512 : see if the directory entry stores field length
11513 echo " "
11514 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11515 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11516         echo "Good, your directory entry keeps length information in d_namlen." >&4
11517         val="$define"
11518 else
11519         echo "Your directory entry does not know about the d_namlen field." >&4
11520         val="$undef"
11521 fi
11522 set d_dirnamlen
11523 eval $setvar
11524 $rm_try
11525
11526 : Look for DIR.dd_fd
11527 case "$i_dirent" in
11528 "$define")
11529     echo "Checking to see if DIR has a dd_fd member variable" >&4
11530     $cat >try.c <<EOCP
11531 #$i_stdlib I_STDLIB
11532 #ifdef I_STDLIB
11533 #include <stdlib.h>
11534 #endif
11535 #include <dirent.h>
11536
11537 int main() {
11538     DIR dir;
11539     dir.dd_fd = 1;
11540     return 0;
11541 }
11542 EOCP
11543     val=$undef
11544     set try
11545     if eval $compile; then
11546         echo "Yes, it does."
11547         val="$define"
11548     else
11549         echo "No, it does not."
11550         val="$undef"
11551     fi
11552     ;;
11553 *)
11554     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11555     val="$undef"
11556     ;;
11557 esac
11558 set d_dir_dd_fd
11559 eval $setvar
11560 $rm_try
11561
11562 : see if this is an sysdir system
11563 set sys/dir.h i_sysdir
11564 eval $inhdr
11565
11566 : see if this is an sysndir system
11567 set sys/ndir.h i_sysndir
11568 eval $inhdr
11569
11570 : Look for dirfd
11571 echo " "
11572 $cat >dirfd.c <<EOM
11573 #include <stdio.h>
11574 #$i_stdlib I_STDLIB
11575 #ifdef I_STDLIB
11576 #include <stdlib.h>
11577 #endif
11578 #$i_dirent I_DIRENT             /**/
11579 #$i_sysdir I_SYS_DIR            /**/
11580 #$i_sysndir I_SYS_NDIR          /**/
11581 #$i_systypes I_SYS_TYPES        /**/
11582 #if defined(I_SYS_TYPES)
11583 #include <sys/types.h>
11584 #endif
11585 #if defined(I_DIRENT)
11586 #include <dirent.h>
11587 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11588 #include <sys/dir.h>
11589 #endif
11590 #else
11591 #ifdef I_SYS_NDIR
11592 #include <sys/ndir.h>
11593 #else
11594 #ifdef I_SYS_DIR
11595 #ifdef hp9000s500
11596 #include <ndir.h>       /* may be wrong in the future */
11597 #else
11598 #include <sys/dir.h>
11599 #endif
11600 #endif
11601 #endif
11602 #endif 
11603 int main() {
11604         DIR *dirp = opendir(".");
11605         if (dirfd(dirp) >= 0)
11606                 exit(0);
11607         else
11608                 exit(1);
11609 }
11610 EOM
11611 val=$undef
11612 set dirfd
11613 if eval $compile; then
11614         val="$define"
11615 fi
11616 case "$val" in
11617 $define)        echo "dirfd() found." >&4       ;;
11618 *)              echo "dirfd() NOT found." >&4   ;;
11619 esac
11620 set d_dirfd
11621 eval $setvar
11622 $rm -f dirfd*
11623
11624 : see if dlerror exists
11625 xxx_runnm="$runnm"
11626 runnm=false
11627 set dlerror d_dlerror
11628 eval $inlibc
11629 runnm="$xxx_runnm"
11630
11631 : see if dlfcn is available
11632 set dlfcn.h i_dlfcn
11633 eval $inhdr
11634
11635 case "$usedl" in
11636 $define|y|true)
11637         $cat << EOM
11638
11639 On a few systems, the dynamically loaded modules that perl generates and uses
11640 will need a different extension than shared libs. The default will probably
11641 be appropriate.
11642
11643 EOM
11644         case "$dlext" in
11645         '')     dflt="$so" ;;
11646         *)      dflt="$dlext" ;;
11647         esac
11648         rp='What is the extension of dynamically loaded modules'
11649         . ./myread
11650         dlext="$ans"
11651         ;;
11652 *)
11653         dlext="none"
11654         ;;
11655 esac
11656
11657 : Check if dlsym need a leading underscore
11658 echo " "
11659 val="$undef"
11660
11661 case "$dlsrc" in
11662 dl_dlopen.xs)
11663         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11664         $cat >dyna.c <<'EOM'
11665 fred () { }
11666 EOM
11667
11668 $cat >fred.c<<EOM
11669
11670 #include <stdio.h>
11671 #$i_stdlib I_STDLIB
11672 #ifdef I_STDLIB
11673 #include <stdlib.h>
11674 #endif
11675 #$i_dlfcn I_DLFCN
11676 #ifdef I_DLFCN
11677 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11678 #else
11679 #include <sys/types.h>
11680 #include <nlist.h>
11681 #include <link.h>
11682 #endif
11683
11684 extern int fred() ;
11685
11686 int main()
11687 {
11688     void * handle ;
11689     void * symbol ;
11690 #ifndef RTLD_LAZY
11691     int mode = 1 ;
11692 #else
11693     int mode = RTLD_LAZY ;
11694 #endif
11695     handle = dlopen("./dyna.$dlext", mode) ;
11696     if (handle == NULL) {
11697         printf ("1\n") ;
11698         fflush (stdout) ;
11699         exit(0);
11700     }
11701     symbol = dlsym(handle, "fred") ;
11702     if (symbol == NULL) {
11703         /* try putting a leading underscore */
11704         symbol = dlsym(handle, "_fred") ;
11705         if (symbol == NULL) {
11706             printf ("2\n") ;
11707             fflush (stdout) ;
11708             exit(0);
11709         }
11710         printf ("3\n") ;
11711     }
11712     else
11713         printf ("4\n") ;
11714     fflush (stdout) ;
11715     exit(0);
11716 }
11717 EOM
11718         : Call the object file tmp-dyna.o in case dlext=o.
11719         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11720                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11721                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
11722                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11723                 xxx=`$run ./fred`
11724                 case $xxx in
11725                 1)      echo "Test program failed using dlopen." >&4
11726                         echo "Perhaps you should not use dynamic loading." >&4;;
11727                 2)      echo "Test program failed using dlsym." >&4
11728                         echo "Perhaps you should not use dynamic loading." >&4;;
11729                 3)      echo "dlsym needs a leading underscore" >&4
11730                         val="$define" ;;
11731                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11732                 esac
11733         else
11734                 echo "I can't compile and run the test program." >&4
11735                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11736         fi
11737         ;;
11738 esac
11739
11740 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11741
11742 set d_dlsymun
11743 eval $setvar
11744
11745 : see if drand48_r exists
11746 set drand48_r d_drand48_r
11747 eval $inlibc
11748 case "$d_drand48_r" in
11749 "$define")
11750         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11751         case "$d_drand48_r_proto:$usethreads" in
11752         ":define")      d_drand48_r_proto=define
11753                 set d_drand48_r_proto drand48_r $hdrs
11754                 eval $hasproto ;;
11755         *)      ;;
11756         esac
11757         case "$d_drand48_r_proto" in
11758         define)
11759         case "$drand48_r_proto" in
11760         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11761         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11762         esac
11763         case "$drand48_r_proto" in
11764         ''|0)   d_drand48_r=undef
11765                 drand48_r_proto=0
11766                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11767         * )     case "$drand48_r_proto" in
11768                 REENTRANT_PROTO*) ;;
11769                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11770                 esac
11771                 echo "Prototype: $try" ;;
11772         esac
11773         ;;
11774         *)      case "$usethreads" in
11775                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11776                 esac
11777                 d_drand48_r=undef
11778                 drand48_r_proto=0
11779                 ;;
11780         esac
11781         ;;
11782 *)      drand48_r_proto=0
11783         ;;
11784 esac
11785
11786 : see if prototype for drand48 is available
11787 echo " "
11788 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11789 eval $hasproto
11790
11791 : see if dup2 exists
11792 set dup2 d_dup2
11793 eval $inlibc
11794
11795 : see if eaccess exists
11796 set eaccess d_eaccess
11797 eval $inlibc
11798
11799 : see if endgrent exists
11800 set endgrent d_endgrent
11801 eval $inlibc
11802
11803 : see if this is an grp system
11804 set grp.h i_grp
11805 eval $inhdr
11806
11807 case "$i_grp" in
11808 $define)
11809         xxx=`./findhdr grp.h`
11810         $cppstdin $cppflags $cppminus < $xxx >$$.h
11811
11812         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11813                 val="$define"
11814         else
11815                 val="$undef"
11816         fi
11817         set d_grpasswd
11818         eval $setvar
11819
11820         $rm -f $$.h
11821         ;;
11822 *)
11823         val="$undef";
11824         set d_grpasswd; eval $setvar
11825         ;;
11826 esac
11827
11828 : see if endgrent_r exists
11829 set endgrent_r d_endgrent_r
11830 eval $inlibc
11831 case "$d_endgrent_r" in
11832 "$define")
11833         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11834         case "$d_endgrent_r_proto:$usethreads" in
11835         ":define")      d_endgrent_r_proto=define
11836                 set d_endgrent_r_proto endgrent_r $hdrs
11837                 eval $hasproto ;;
11838         *)      ;;
11839         esac
11840         case "$d_endgrent_r_proto" in
11841         define)
11842         case "$endgrent_r_proto" in
11843         ''|0) try='int endgrent_r(FILE**);'
11844         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11845         esac
11846         case "$endgrent_r_proto" in
11847         ''|0) try='void endgrent_r(FILE**);'
11848         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11849         esac
11850         case "$endgrent_r_proto" in
11851         ''|0)   d_endgrent_r=undef
11852                 endgrent_r_proto=0
11853                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11854         * )     case "$endgrent_r_proto" in
11855                 REENTRANT_PROTO*) ;;
11856                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11857                 esac
11858                 echo "Prototype: $try" ;;
11859         esac
11860         ;;
11861         *)      case "$usethreads" in
11862                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11863                 esac
11864                 d_endgrent_r=undef
11865                 endgrent_r_proto=0
11866                 ;;
11867         esac
11868         ;;
11869 *)      endgrent_r_proto=0
11870         ;;
11871 esac
11872
11873 : see if endhostent exists
11874 set endhostent d_endhent
11875 eval $inlibc
11876
11877 : see if this is a netdb.h system
11878 set netdb.h i_netdb
11879 eval $inhdr
11880
11881 : see if endhostent_r exists
11882 set endhostent_r d_endhostent_r
11883 eval $inlibc
11884 case "$d_endhostent_r" in
11885 "$define")
11886         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11887         case "$d_endhostent_r_proto:$usethreads" in
11888         ":define")      d_endhostent_r_proto=define
11889                 set d_endhostent_r_proto endhostent_r $hdrs
11890                 eval $hasproto ;;
11891         *)      ;;
11892         esac
11893         case "$d_endhostent_r_proto" in
11894         define)
11895         case "$endhostent_r_proto" in
11896         ''|0) try='int endhostent_r(struct hostent_data*);'
11897         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11898         esac
11899         case "$endhostent_r_proto" in
11900         ''|0) try='void endhostent_r(struct hostent_data*);'
11901         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11902         esac
11903         case "$endhostent_r_proto" in
11904         ''|0)   d_endhostent_r=undef
11905                 endhostent_r_proto=0
11906                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11907         * )     case "$endhostent_r_proto" in
11908                 REENTRANT_PROTO*) ;;
11909                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11910                 esac
11911                 echo "Prototype: $try" ;;
11912         esac
11913         ;;
11914         *)      case "$usethreads" in
11915                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11916                 esac
11917                 d_endhostent_r=undef
11918                 endhostent_r_proto=0
11919                 ;;
11920         esac
11921         ;;
11922 *)      endhostent_r_proto=0
11923         ;;
11924 esac
11925
11926 : see if endnetent exists
11927 set endnetent d_endnent
11928 eval $inlibc
11929
11930 : see if endnetent_r exists
11931 set endnetent_r d_endnetent_r
11932 eval $inlibc
11933 case "$d_endnetent_r" in
11934 "$define")
11935         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11936         case "$d_endnetent_r_proto:$usethreads" in
11937         ":define")      d_endnetent_r_proto=define
11938                 set d_endnetent_r_proto endnetent_r $hdrs
11939                 eval $hasproto ;;
11940         *)      ;;
11941         esac
11942         case "$d_endnetent_r_proto" in
11943         define)
11944         case "$endnetent_r_proto" in
11945         ''|0) try='int endnetent_r(struct netent_data*);'
11946         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11947         esac
11948         case "$endnetent_r_proto" in
11949         ''|0) try='void endnetent_r(struct netent_data*);'
11950         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11951         esac
11952         case "$endnetent_r_proto" in
11953         ''|0)   d_endnetent_r=undef
11954                 endnetent_r_proto=0
11955                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11956         * )     case "$endnetent_r_proto" in
11957                 REENTRANT_PROTO*) ;;
11958                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11959                 esac
11960                 echo "Prototype: $try" ;;
11961         esac
11962         ;;
11963         *)      case "$usethreads" in
11964                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11965                 esac
11966                 d_endnetent_r=undef
11967                 endnetent_r_proto=0
11968                 ;;
11969         esac
11970         ;;
11971 *)      endnetent_r_proto=0
11972         ;;
11973 esac
11974
11975 : see if endprotoent exists
11976 set endprotoent d_endpent
11977 eval $inlibc
11978
11979 : see if endprotoent_r exists
11980 set endprotoent_r d_endprotoent_r
11981 eval $inlibc
11982 case "$d_endprotoent_r" in
11983 "$define")
11984         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11985         case "$d_endprotoent_r_proto:$usethreads" in
11986         ":define")      d_endprotoent_r_proto=define
11987                 set d_endprotoent_r_proto endprotoent_r $hdrs
11988                 eval $hasproto ;;
11989         *)      ;;
11990         esac
11991         case "$d_endprotoent_r_proto" in
11992         define)
11993         case "$endprotoent_r_proto" in
11994         ''|0) try='int endprotoent_r(struct protoent_data*);'
11995         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11996         esac
11997         case "$endprotoent_r_proto" in
11998         ''|0) try='void endprotoent_r(struct protoent_data*);'
11999         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
12000         esac
12001         case "$endprotoent_r_proto" in
12002         ''|0)   d_endprotoent_r=undef
12003                 endprotoent_r_proto=0
12004                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12005         * )     case "$endprotoent_r_proto" in
12006                 REENTRANT_PROTO*) ;;
12007                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12008                 esac
12009                 echo "Prototype: $try" ;;
12010         esac
12011         ;;
12012         *)      case "$usethreads" in
12013                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12014                 esac
12015                 d_endprotoent_r=undef
12016                 endprotoent_r_proto=0
12017                 ;;
12018         esac
12019         ;;
12020 *)      endprotoent_r_proto=0
12021         ;;
12022 esac
12023
12024 : see if endpwent exists
12025 set endpwent d_endpwent
12026 eval $inlibc
12027
12028 : see if this is a pwd.h system
12029 set pwd.h i_pwd
12030 eval $inhdr
12031
12032 case "$i_pwd" in
12033 $define)
12034         xxx=`./findhdr pwd.h`
12035         $cppstdin $cppflags $cppminus < $xxx >$$.h
12036
12037         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12038                 val="$define"
12039         else
12040                 val="$undef"
12041         fi
12042         set d_pwquota
12043         eval $setvar
12044
12045         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12046                 val="$define"
12047         else
12048                 val="$undef"
12049         fi
12050         set d_pwage
12051         eval $setvar
12052
12053         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12054                 val="$define"
12055         else
12056                 val="$undef"
12057         fi
12058         set d_pwchange
12059         eval $setvar
12060
12061         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12062                 val="$define"
12063         else
12064                 val="$undef"
12065         fi
12066         set d_pwclass
12067         eval $setvar
12068
12069         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12070                 val="$define"
12071         else
12072                 val="$undef"
12073         fi
12074         set d_pwexpire
12075         eval $setvar
12076
12077         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12078                 val="$define"
12079         else
12080                 val="$undef"
12081         fi
12082         set d_pwcomment
12083         eval $setvar
12084
12085         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12086                 val="$define"
12087         else
12088                 val="$undef"
12089         fi
12090         set d_pwgecos
12091         eval $setvar
12092
12093         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12094                 val="$define"
12095         else
12096                 val="$undef"
12097         fi
12098         set d_pwpasswd
12099         eval $setvar
12100
12101         $rm -f $$.h
12102         ;;
12103 *)
12104         val="$undef"; 
12105         set d_pwquota; eval $setvar
12106         set d_pwage; eval $setvar
12107         set d_pwchange; eval $setvar
12108         set d_pwclass; eval $setvar
12109         set d_pwexpire; eval $setvar
12110         set d_pwcomment; eval $setvar
12111         set d_pwgecos; eval $setvar
12112         set d_pwpasswd; eval $setvar
12113         ;;
12114 esac
12115
12116 : see if endpwent_r exists
12117 set endpwent_r d_endpwent_r
12118 eval $inlibc
12119 case "$d_endpwent_r" in
12120 "$define")
12121         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12122         case "$d_endpwent_r_proto:$usethreads" in
12123         ":define")      d_endpwent_r_proto=define
12124                 set d_endpwent_r_proto endpwent_r $hdrs
12125                 eval $hasproto ;;
12126         *)      ;;
12127         esac
12128         case "$d_endpwent_r_proto" in
12129         define)
12130         case "$endpwent_r_proto" in
12131         ''|0) try='int endpwent_r(FILE**);'
12132         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
12133         esac
12134         case "$endpwent_r_proto" in
12135         ''|0) try='void endpwent_r(FILE**);'
12136         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
12137         esac
12138         case "$endpwent_r_proto" in
12139         ''|0)   d_endpwent_r=undef
12140                 endpwent_r_proto=0
12141                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12142         * )     case "$endpwent_r_proto" in
12143                 REENTRANT_PROTO*) ;;
12144                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12145                 esac
12146                 echo "Prototype: $try" ;;
12147         esac
12148         ;;
12149         *)      case "$usethreads" in
12150                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12151                 esac
12152                 d_endpwent_r=undef
12153                 endpwent_r_proto=0
12154                 ;;
12155         esac
12156         ;;
12157 *)      endpwent_r_proto=0
12158         ;;
12159 esac
12160
12161 : see if endservent exists
12162 set endservent d_endsent
12163 eval $inlibc
12164
12165 : see if endservent_r exists
12166 set endservent_r d_endservent_r
12167 eval $inlibc
12168 case "$d_endservent_r" in
12169 "$define")
12170         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12171         case "$d_endservent_r_proto:$usethreads" in
12172         ":define")      d_endservent_r_proto=define
12173                 set d_endservent_r_proto endservent_r $hdrs
12174                 eval $hasproto ;;
12175         *)      ;;
12176         esac
12177         case "$d_endservent_r_proto" in
12178         define)
12179         case "$endservent_r_proto" in
12180         ''|0) try='int endservent_r(struct servent_data*);'
12181         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
12182         esac
12183         case "$endservent_r_proto" in
12184         ''|0) try='void endservent_r(struct servent_data*);'
12185         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
12186         esac
12187         case "$endservent_r_proto" in
12188         ''|0)   d_endservent_r=undef
12189                 endservent_r_proto=0
12190                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12191         * )     case "$endservent_r_proto" in
12192                 REENTRANT_PROTO*) ;;
12193                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12194                 esac
12195                 echo "Prototype: $try" ;;
12196         esac
12197         ;;
12198         *)      case "$usethreads" in
12199                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12200                 esac
12201                 d_endservent_r=undef
12202                 endservent_r_proto=0
12203                 ;;
12204         esac
12205         ;;
12206 *)      endservent_r_proto=0
12207         ;;
12208 esac
12209
12210 : Locate the flags for 'open()'
12211 echo " "
12212 $cat >try.c <<EOCP
12213 #include <sys/types.h>
12214 #ifdef I_FCNTL
12215 #include <fcntl.h>
12216 #endif
12217 #ifdef I_SYS_FILE
12218 #include <sys/file.h>
12219 #endif
12220 #$i_stdlib I_STDLIB
12221 #ifdef I_STDLIB
12222 #include <stdlib.h>
12223 #endif
12224 int main() {
12225         if(O_RDONLY);
12226 #ifdef O_TRUNC
12227         exit(0);
12228 #else
12229         exit(1);
12230 #endif
12231 }
12232 EOCP
12233 : check sys/file.h first to get FREAD on Sun
12234 if $test `./findhdr sys/file.h` && \
12235                 set try -DI_SYS_FILE && eval $compile; then
12236         h_sysfile=true;
12237         echo "<sys/file.h> defines the O_* constants..." >&4
12238         if $run ./try; then
12239                 echo "and you have the 3 argument form of open()." >&4
12240                 val="$define"
12241         else
12242                 echo "but not the 3 argument form of open().  Oh, well." >&4
12243                 val="$undef"
12244         fi
12245 elif $test `./findhdr fcntl.h` && \
12246                 set try -DI_FCNTL && eval $compile; then
12247         h_fcntl=true;
12248         echo "<fcntl.h> defines the O_* constants..." >&4
12249         if $run ./try; then
12250                 echo "and you have the 3 argument form of open()." >&4
12251                 val="$define"
12252         else
12253                 echo "but not the 3 argument form of open().  Oh, well." >&4
12254                 val="$undef"
12255         fi
12256 else
12257         val="$undef"
12258         echo "I can't find the O_* constant definitions!  You got problems." >&4
12259 fi
12260 set d_open3
12261 eval $setvar
12262 $rm_try
12263
12264 : see which of string.h or strings.h is needed
12265 echo " "
12266 strings=`./findhdr string.h`
12267 if $test "$strings" && $test -r "$strings"; then
12268         echo "Using <string.h> instead of <strings.h>." >&4
12269         val="$define"
12270 else
12271         val="$undef"
12272         strings=`./findhdr strings.h`
12273         if $test "$strings" && $test -r "$strings"; then
12274                 echo "Using <strings.h> instead of <string.h>." >&4
12275         else
12276                 echo "No string header found -- You'll surely have problems." >&4
12277         fi
12278 fi
12279 set i_string
12280 eval $setvar
12281 case "$i_string" in
12282 "$undef") strings=`./findhdr strings.h`;;
12283 *)        strings=`./findhdr string.h`;;
12284 esac
12285
12286 : see if this is a sys/file.h system
12287 val=''
12288 set sys/file.h val
12289 eval $inhdr
12290
12291 : do we need to include sys/file.h ?
12292 case "$val" in
12293 "$define")
12294         echo " "
12295         if $h_sysfile; then
12296                 val="$define"
12297                 echo "We'll be including <sys/file.h>." >&4
12298         else
12299                 val="$undef"
12300                 echo "We won't be including <sys/file.h>." >&4
12301         fi
12302         ;;
12303 *)
12304         h_sysfile=false
12305         ;;
12306 esac
12307 set i_sysfile
12308 eval $setvar
12309
12310 : see if fcntl.h is there
12311 val=''
12312 set fcntl.h val
12313 eval $inhdr
12314
12315 : see if we can include fcntl.h
12316 case "$val" in
12317 "$define")
12318         echo " "
12319         if $h_fcntl; then
12320                 val="$define"
12321                 echo "We'll be including <fcntl.h>." >&4
12322         else
12323                 val="$undef"
12324                 if $h_sysfile; then
12325         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12326                 else
12327                         echo "We won't be including <fcntl.h>." >&4
12328                 fi
12329         fi
12330         ;;
12331 *)
12332         h_fcntl=false
12333         val="$undef"
12334         ;;
12335 esac
12336 set i_fcntl
12337 eval $setvar
12338
12339 : see if fork exists
12340 set fork d_fork
12341 eval $inlibc
12342
12343 : see if pipe exists
12344 set pipe d_pipe
12345 eval $inlibc
12346
12347 : check for non-blocking I/O stuff
12348 case "$h_sysfile" in
12349 true) echo "#include <sys/file.h>" > head.c;;
12350 *)
12351        case "$h_fcntl" in
12352        true) echo "#include <fcntl.h>" > head.c;;
12353        *) echo "#include <sys/fcntl.h>" > head.c;;
12354        esac
12355        ;;
12356 esac
12357 echo " "
12358 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12359 case "$o_nonblock" in
12360 '')
12361         $cat head.c > try.c
12362         $cat >>try.c <<EOCP
12363 #include <stdio.h>
12364 #$i_stdlib I_STDLIB
12365 #ifdef I_STDLIB
12366 #include <stdlib.h>
12367 #endif
12368 #$i_fcntl I_FCNTL
12369 #ifdef I_FCNTL
12370 #include <fcntl.h>
12371 #endif
12372 int main() {
12373 #ifdef O_NONBLOCK
12374         printf("O_NONBLOCK\n");
12375         exit(0);
12376 #endif
12377 #ifdef O_NDELAY
12378         printf("O_NDELAY\n");
12379         exit(0);
12380 #endif
12381 #ifdef FNDELAY
12382         printf("FNDELAY\n");
12383         exit(0);
12384 #endif
12385         exit(0);
12386 }
12387 EOCP
12388         set try
12389         if eval $compile_ok; then
12390                 o_nonblock=`$run ./try`
12391                 case "$o_nonblock" in
12392                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12393                 *) echo "Seems like we can use $o_nonblock.";;
12394                 esac
12395         else
12396                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12397         fi
12398         ;;
12399 *) echo "Using $hint value $o_nonblock.";;
12400 esac
12401 $rm_try
12402
12403 echo " "
12404 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12405 case "$eagain" in
12406 '')
12407         case "$d_fork:$d_pipe" in
12408         define:define)
12409         $cat head.c > try.c
12410         $cat >>try.c <<EOCP
12411 #include <errno.h>
12412 #include <sys/types.h>
12413 #include <signal.h>
12414 #include <stdio.h>
12415 #$i_stdlib I_STDLIB
12416 #ifdef I_STDLIB
12417 #include <stdlib.h>
12418 #endif
12419 #$i_fcntl I_FCNTL
12420 #ifdef I_FCNTL
12421 #include <fcntl.h>
12422 #endif
12423 #define MY_O_NONBLOCK $o_nonblock
12424 #ifndef errno  /* XXX need better Configure test */
12425 extern int errno;
12426 #endif
12427 #$i_unistd I_UNISTD
12428 #ifdef I_UNISTD
12429 #include <unistd.h>
12430 #endif
12431 #$i_string I_STRING
12432 #ifdef I_STRING
12433 #include <string.h>
12434 #else
12435 #include <strings.h>
12436 #endif
12437 $signal_t blech(int x) { exit(3); }
12438 EOCP
12439         $cat >> try.c <<'EOCP'
12440 int main()
12441 {
12442         int pd[2];
12443         int pu[2];
12444         char buf[1];
12445         char string[100];
12446
12447         pipe(pd);       /* Down: child -> parent */
12448         pipe(pu);       /* Up: parent -> child */
12449         if (0 != fork()) {
12450                 int ret;
12451                 close(pd[1]);   /* Parent reads from pd[0] */
12452                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12453 #ifdef F_SETFL
12454                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12455                         exit(1);
12456 #else
12457                 exit(4);
12458 #endif
12459                 signal(SIGALRM, blech);
12460                 alarm(5);
12461                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12462                         exit(2);
12463                 sprintf(string, "%d\n", ret);
12464                 write(2, string, strlen(string));
12465                 alarm(0);
12466 #ifdef EAGAIN
12467                 if (errno == EAGAIN) {
12468                         printf("EAGAIN\n");
12469                         goto ok;
12470                 }
12471 #endif
12472 #ifdef EWOULDBLOCK
12473                 if (errno == EWOULDBLOCK)
12474                         printf("EWOULDBLOCK\n");
12475 #endif
12476         ok:
12477                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12478                 sleep(2);                               /* Give it time to close our pipe */
12479                 alarm(5);
12480                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12481                 alarm(0);
12482                 sprintf(string, "%d\n", ret);
12483                 write(4, string, strlen(string));
12484                 exit(0);
12485         }
12486
12487         close(pd[0]);                   /* We write to pd[1] */
12488         close(pu[1]);                   /* We read from pu[0] */
12489         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12490         close(pd[1]);                   /* Pipe pd is now fully closed! */
12491         exit(0);                                /* Bye bye, thank you for playing! */
12492 }
12493 EOCP
12494         set try
12495         if eval $compile_ok; then
12496                 echo "$startsh" >mtry
12497                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12498                 chmod +x mtry
12499                 ./mtry >/dev/null 2>&1
12500                 case $? in
12501                 0) eagain=`$cat try.out`;;
12502                 1) echo "Could not perform non-blocking setting!";;
12503                 2) echo "I did a successful read() for something that was not there!";;
12504                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12505                 4) echo "Could not find F_SETFL!";;
12506                 *) echo "Something terribly wrong happened during testing.";;
12507                 esac
12508                 rd_nodata=`$cat try.ret`
12509                 echo "A read() system call with no data present returns $rd_nodata."
12510                 case "$rd_nodata" in
12511                 0|-1) ;;
12512                 *)
12513                         echo "(That's peculiar, fixing that to be -1.)"
12514                         rd_nodata=-1
12515                         ;;
12516                 esac
12517                 case "$eagain" in
12518                 '')
12519                         echo "Forcing errno EAGAIN on read() with no data available."
12520                         eagain=EAGAIN
12521                         ;;
12522                 *)
12523                         echo "Your read() sets errno to $eagain when no data is available."
12524                         ;;
12525                 esac
12526                 status=`$cat try.err`
12527                 case "$status" in
12528                 0) echo "And it correctly returns 0 to signal EOF.";;
12529                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12530                 *) echo "However, your read() returns '$status' on EOF??";;
12531                 esac
12532                 val="$define"
12533                 if test "$status" = "$rd_nodata"; then
12534                         echo "WARNING: you can't distinguish between EOF and no data!"
12535                         val="$undef"
12536                 fi
12537         else
12538                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12539                 eagain=EAGAIN
12540         fi
12541         ;;
12542         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12543                 eagain=EAGAIN
12544                 val="$define"
12545                 ;;
12546         esac
12547         set d_eofnblk
12548         eval $setvar
12549         ;;
12550 *)
12551         echo "Using $hint value $eagain."
12552         echo "Your read() returns $rd_nodata when no data is present."
12553         case "$d_eofnblk" in
12554         "$define") echo "And you can see EOF because read() returns 0.";;
12555         "$undef") echo "But you can't see EOF status from read() returned value.";;
12556         *)
12557                 echo "(Assuming you can't see EOF status from read anyway.)"
12558                 d_eofnblk=$undef
12559                 ;;
12560         esac
12561         ;;
12562 esac
12563 $rm_try head.c mtry
12564
12565 : see if _ptr and _cnt from stdio act std
12566 echo " "
12567
12568 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12569         echo "(Looks like you have stdio.h from BSD.)"
12570         case "$stdio_ptr" in
12571         '') stdio_ptr='((fp)->_p)'
12572                 ptr_lval=$define
12573                 ;;
12574         *)      ptr_lval=$d_stdio_ptr_lval;;
12575         esac
12576         case "$stdio_cnt" in
12577         '') stdio_cnt='((fp)->_r)'
12578                 cnt_lval=$define
12579                 ;;
12580         *)      cnt_lval=$d_stdio_cnt_lval;;
12581         esac
12582         case "$stdio_base" in
12583         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12584         esac
12585         case "$stdio_bufsiz" in
12586         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12587         esac
12588 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12589         echo "(Looks like you have stdio.h from Linux.)"
12590         case "$stdio_ptr" in
12591         '') stdio_ptr='((fp)->_IO_read_ptr)'
12592                 ptr_lval=$define
12593                 ;;
12594         *)      ptr_lval=$d_stdio_ptr_lval;;
12595         esac
12596         case "$stdio_cnt" in
12597         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12598                 cnt_lval=$undef
12599                 ;;
12600         *)      cnt_lval=$d_stdio_cnt_lval;;
12601         esac
12602         case "$stdio_base" in
12603         '') stdio_base='((fp)->_IO_read_base)';;
12604         esac
12605         case "$stdio_bufsiz" in
12606         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12607         esac
12608 else
12609         case "$stdio_ptr" in
12610         '') stdio_ptr='((fp)->_ptr)'
12611                 ptr_lval=$define
12612                 ;;
12613         *)      ptr_lval=$d_stdio_ptr_lval;;
12614         esac
12615         case "$stdio_cnt" in
12616         '') stdio_cnt='((fp)->_cnt)'
12617                 cnt_lval=$define
12618                 ;;
12619         *)      cnt_lval=$d_stdio_cnt_lval;;
12620         esac
12621         case "$stdio_base" in
12622         '') stdio_base='((fp)->_base)';;
12623         esac
12624         case "$stdio_bufsiz" in
12625         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12626         esac
12627 fi
12628
12629 : test whether _ptr and _cnt really work
12630 echo "Checking how std your stdio is..." >&4
12631 $cat >try.c <<EOP
12632 #include <stdio.h>
12633 #$i_stdlib I_STDLIB
12634 #ifdef I_STDLIB
12635 #include <stdlib.h>
12636 #endif
12637 #define FILE_ptr(fp)    $stdio_ptr
12638 #define FILE_cnt(fp)    $stdio_cnt
12639 int main() {
12640         FILE *fp = fopen("try.c", "r");
12641         char c = getc(fp);
12642         if (
12643                 18 <= FILE_cnt(fp) &&
12644                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12645         )
12646                 exit(0);
12647         exit(1);
12648 }
12649 EOP
12650 val="$undef"
12651 set try
12652 if eval $compile && $to try.c; then
12653         if $run ./try; then
12654                 echo "Your stdio acts pretty std."
12655                 val="$define"
12656         else
12657                 echo "Your stdio isn't very std."
12658         fi
12659 else
12660         echo "Your stdio doesn't appear very std."
12661 fi
12662 $rm_try
12663
12664 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12665 # direct buffer manipulation no longer works.  The Configure tests
12666 # should be changed to correctly detect this, but until then,
12667 # the following check should at least let perl compile and run.
12668 # (This quick fix should be updated before 5.8.1.)
12669 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12670 # A. Dougherty, June 3, 2002.
12671 case "$d_gnulibc" in
12672 $define)
12673         case "$gnulibc_version" in
12674         2.[01]*)  ;;
12675         2.2) ;;
12676         2.2.[0-9]) ;;
12677         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12678                 val="$undef"
12679                 ;;
12680         esac
12681         ;;
12682 esac
12683 set d_stdstdio
12684 eval $setvar
12685
12686 : Can _ptr be used as an lvalue?
12687 case "$d_stdstdio$ptr_lval" in
12688 $define$define) val=$define ;;
12689 *) val=$undef ;;
12690 esac
12691 set d_stdio_ptr_lval
12692 eval $setvar
12693
12694 : Can _cnt be used as an lvalue?
12695 case "$d_stdstdio$cnt_lval" in
12696 $define$define) val=$define ;;
12697 *) val=$undef ;;
12698 esac
12699 set d_stdio_cnt_lval
12700 eval $setvar
12701
12702
12703 : test whether setting _ptr sets _cnt as a side effect
12704 d_stdio_ptr_lval_sets_cnt="$undef"
12705 d_stdio_ptr_lval_nochange_cnt="$undef"
12706 case "$d_stdio_ptr_lval$d_stdstdio" in
12707 $define$define)
12708         echo "Checking to see what happens if we set the stdio ptr..." >&4
12709 $cat >try.c <<EOP
12710 #include <stdio.h>
12711 /* Can we scream? */
12712 /* Eat dust sed :-) */
12713 /* In the buffer space, no one can hear you scream. */
12714 #$i_stdlib I_STDLIB
12715 #ifdef I_STDLIB
12716 #include <stdlib.h>
12717 #endif
12718 #define FILE_ptr(fp)    $stdio_ptr
12719 #define FILE_cnt(fp)    $stdio_cnt
12720 #include <sys/types.h>
12721 int main() {
12722         FILE *fp = fopen("try.c", "r");
12723         int c;
12724         char *ptr;
12725         size_t cnt;
12726         if (!fp) {
12727             puts("Fail even to read");
12728             exit(1);
12729         }
12730         c = getc(fp); /* Read away the first # */
12731         if (c == EOF) {
12732             puts("Fail even to read");
12733             exit(1);
12734         }
12735         if (!(
12736                 18 <= FILE_cnt(fp) &&
12737                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12738         )) {
12739                 puts("Fail even to read");
12740                 exit (1);
12741         }
12742         ptr = (char*) FILE_ptr(fp);
12743         cnt = (size_t)FILE_cnt(fp);
12744
12745         FILE_ptr(fp) += 42;
12746
12747         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12748                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12749                 exit (1);
12750         }
12751         if (FILE_cnt(fp) <= 20) {
12752                 printf ("Fail (<20 chars to test)");
12753                 exit (1);
12754         }
12755         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12756                 puts("Fail compare");
12757                 exit (1);
12758         }
12759         if (cnt == FILE_cnt(fp)) {
12760                 puts("Pass_unchanged");
12761                 exit (0);
12762         }
12763         if (FILE_cnt(fp) == (cnt - 42)) {
12764                 puts("Pass_changed");
12765                 exit (0);
12766         }
12767         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12768         return 1;
12769
12770 }
12771 EOP
12772         set try
12773         if eval $compile && $to try.c; then
12774                 case `$run ./try` in
12775                 Pass_changed)
12776                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12777                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12778                 Pass_unchanged)
12779                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12780                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12781                 Fail*)
12782                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12783                 *)
12784                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12785         esac
12786         else
12787                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12788         fi
12789         $rm_try
12790         ;;
12791 esac
12792
12793 : see if _base is also standard
12794 val="$undef"
12795 case "$d_stdstdio" in
12796 $define)
12797         $cat >try.c <<EOP
12798 #include <stdio.h>
12799 #$i_stdlib I_STDLIB
12800 #ifdef I_STDLIB
12801 #include <stdlib.h>
12802 #endif
12803 #define FILE_base(fp)   $stdio_base
12804 #define FILE_bufsiz(fp) $stdio_bufsiz
12805 int main() {
12806         FILE *fp = fopen("try.c", "r");
12807         char c = getc(fp);
12808         if (
12809                 19 <= FILE_bufsiz(fp) &&
12810                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12811         )
12812                 exit(0);
12813         exit(1);
12814 }
12815 EOP
12816         set try
12817         if eval $compile && $to try.c; then
12818                 if $run ./try; then
12819                         echo "And its _base field acts std."
12820                         val="$define"
12821                 else
12822                         echo "But its _base field isn't std."
12823                 fi
12824         else
12825                 echo "However, it seems to be lacking the _base field."
12826         fi
12827         $rm_try
12828         ;;
12829 esac
12830 set d_stdiobase
12831 eval $setvar
12832
12833 : see if fast_stdio exists
12834 val="$undef"
12835 case "$d_stdstdio:$d_stdio_ptr_lval" in
12836 "$define:$define")
12837         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12838         *$define*)
12839                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12840                 val="$define"
12841                 ;;
12842         esac
12843         ;;
12844 esac
12845 set d_faststdio
12846 eval $setvar
12847
12848
12849
12850 : see if fchdir exists
12851 set fchdir d_fchdir
12852 eval $inlibc
12853
12854 : see if fchmod exists
12855 set fchmod d_fchmod
12856 eval $inlibc
12857
12858 : see if fchown exists
12859 set fchown d_fchown
12860 eval $inlibc
12861
12862 : see if this is an fcntl system
12863 set fcntl d_fcntl
12864 eval $inlibc
12865
12866 : See if fcntl-based locking works.
12867 echo " "
12868 $cat >try.c <<EOCP
12869 #$i_stdlib I_STDLIB
12870 #ifdef I_STDLIB
12871 #include <stdlib.h>
12872 #endif
12873 #include <unistd.h>
12874 #include <fcntl.h>
12875 #include <signal.h>
12876 $signal_t blech(int x) { exit(3); }
12877 int main() {
12878 #if defined(F_SETLK) && defined(F_SETLKW)
12879      struct flock flock;
12880      int retval, fd;
12881      fd = open("try.c", O_RDONLY);
12882      flock.l_type = F_RDLCK;
12883      flock.l_whence = SEEK_SET;
12884      flock.l_start = flock.l_len = 0;
12885      signal(SIGALRM, blech);
12886      alarm(10);
12887      retval = fcntl(fd, F_SETLK, &flock);
12888      close(fd);
12889      (retval < 0 ? exit(2) : exit(0));
12890 #else
12891      exit(2);
12892 #endif
12893 }
12894 EOCP
12895 echo "Checking if fcntl-based file locking works... "
12896 case "$d_fcntl" in
12897 "$define")
12898         set try
12899         if eval $compile_ok; then
12900                 if $run ./try; then
12901                         echo "Yes, it seems to work."
12902                         val="$define"
12903                 else
12904                         echo "Nope, it didn't work."
12905                         val="$undef"
12906                         case "$?" in
12907                         3) $cat >&4 <<EOM
12908 ***
12909 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12910 *** This is (almost) impossible.
12911 *** If your NFS lock daemons are not feeling well, something like
12912 *** this may happen, please investigate.  Cannot continue, aborting.
12913 ***
12914 EOM
12915                                 exit 1
12916                                 ;;
12917                         esac
12918                 fi
12919         else
12920                 echo "I'm unable to compile the test program, so I'll assume not."
12921                 val="$undef"
12922         fi
12923         ;;
12924 *) val="$undef";
12925         echo "Nope, since you don't even have fcntl()."
12926         ;;
12927 esac
12928 set d_fcntl_can_lock
12929 eval $setvar
12930 $rm_try
12931
12932 : check for fd_set items
12933 $cat <<EOM
12934
12935 Checking to see how well your C compiler handles fd_set and friends ...
12936 EOM
12937 $cat >try.c <<EOCP
12938 #$i_stdlib I_STDLIB
12939 #ifdef I_STDLIB
12940 #include <stdlib.h>
12941 #endif
12942 #$i_systime I_SYS_TIME
12943 #$i_sysselct I_SYS_SELECT
12944 #$d_socket HAS_SOCKET
12945 #include <sys/types.h>
12946 #ifdef HAS_SOCKET
12947 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12948 #endif
12949 #ifdef I_SYS_TIME
12950 #include <sys/time.h>
12951 #endif
12952 #ifdef I_SYS_SELECT
12953 #include <sys/select.h>
12954 #endif
12955 int main() {
12956         fd_set fds;
12957
12958 #ifdef TRYBITS
12959         if(fds.fds_bits);
12960 #endif
12961
12962 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12963         exit(0);
12964 #else
12965         exit(1);
12966 #endif
12967 }
12968 EOCP
12969 set try -DTRYBITS
12970 if eval $compile; then
12971         d_fds_bits="$define"
12972         d_fd_set="$define"
12973         echo "Well, your system knows about the normal fd_set typedef..." >&4
12974         if $run ./try; then
12975                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12976                 d_fd_macros="$define"
12977         else
12978                 $cat >&4 <<'EOM'
12979 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12980 EOM
12981                 d_fd_macros="$undef"
12982         fi
12983 else
12984         $cat <<'EOM'
12985 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12986 EOM
12987         set try
12988         if eval $compile; then
12989                 d_fds_bits="$undef"
12990                 d_fd_set="$define"
12991                 echo "Well, your system has some sort of fd_set available..." >&4
12992                 if $run ./try; then
12993                         echo "and you have the normal fd_set macros." >&4
12994                         d_fd_macros="$define"
12995                 else
12996                         $cat <<'EOM'
12997 but not the normal fd_set macros!  Gross!  More work for me...
12998 EOM
12999                         d_fd_macros="$undef"
13000                 fi
13001         else
13002         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13003                 d_fd_set="$undef"
13004                 d_fds_bits="$undef"
13005                 d_fd_macros="$undef"
13006         fi
13007 fi
13008 $rm_try
13009
13010 : see if fgetpos exists
13011 set fgetpos d_fgetpos
13012 eval $inlibc
13013
13014 : see if finite exists
13015 set finite d_finite
13016 eval $inlibc
13017
13018 : see if finitel exists
13019 set finitel d_finitel
13020 eval $inlibc
13021
13022 : see if flock exists
13023 set flock d_flock
13024 eval $inlibc
13025
13026 : see if prototype for flock is available
13027 echo " "
13028 set d_flockproto flock $i_sysfile sys/file.h
13029 eval $hasproto
13030
13031 : see if fp_class exists
13032 set fp_class d_fp_class
13033 eval $inlibc
13034
13035 : see if pathconf exists
13036 set pathconf d_pathconf
13037 eval $inlibc
13038
13039 : see if fpathconf exists
13040 set fpathconf d_fpathconf
13041 eval $inlibc
13042
13043 : see if fpclass exists
13044 set fpclass d_fpclass
13045 eval $inlibc
13046
13047 : see if fpclassify exists
13048 set fpclassify d_fpclassify
13049 eval $inlibc
13050
13051 : see if fpclassl exists
13052 set fpclassl d_fpclassl
13053 eval $inlibc
13054
13055
13056 : check for fpos64_t
13057 echo " "
13058 echo "Checking to see if you have fpos64_t..." >&4
13059 $cat >try.c <<EOCP
13060 #include <stdio.h>
13061 int main() { fpos64_t x = 7; }
13062 EOCP
13063 set try
13064 if eval $compile; then
13065         val="$define"
13066         echo "You have fpos64_t."
13067 else
13068         val="$undef"
13069         echo "You do not have fpos64_t."
13070         case "$fpossize" in
13071         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13072         esac
13073 fi
13074 $rm_try
13075 set d_fpos64_t
13076 eval $setvar
13077
13078 : see if frexpl exists
13079 set frexpl d_frexpl
13080 eval $inlibc
13081
13082 : see if this is a sys/param system
13083 set sys/param.h i_sysparam
13084 eval $inhdr
13085
13086 : see if this is a sys/mount.h system
13087 set sys/mount.h i_sysmount
13088 eval $inhdr
13089
13090
13091 echo " "
13092 echo "Checking to see if your system supports struct fs_data..." >&4
13093 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13094 eval $hasstruct
13095 case "$d_fs_data_s" in
13096 "$define")      echo "Yes, it does."   ;;
13097 *)              echo "No, it doesn't." ;;
13098 esac
13099
13100 : see if fseeko exists
13101 set fseeko d_fseeko
13102 eval $inlibc
13103 case "$longsize" in
13104 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13105 esac
13106
13107 : see if fsetpos exists
13108 set fsetpos d_fsetpos
13109 eval $inlibc
13110
13111
13112 : see if fstatfs exists
13113 set fstatfs d_fstatfs
13114 eval $inlibc
13115
13116
13117 : see if statvfs exists
13118 set statvfs d_statvfs
13119 eval $inlibc
13120
13121 : see if fstatvfs exists
13122 set fstatvfs d_fstatvfs
13123 eval $inlibc
13124
13125
13126 : see if fsync exists
13127 set fsync d_fsync
13128 eval $inlibc
13129
13130 : see if ftello exists
13131 set ftello d_ftello
13132 eval $inlibc
13133 case "$longsize" in
13134 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13135 esac
13136
13137 : check for a working futimes
13138 d_futimes="$undef"
13139 echo " "
13140 echo "Checking if you have a working futimes()" >&4
13141 $cat >try.c <<EOCP
13142 #include <stdio.h>
13143 #include <sys/time.h>
13144 #include <errno.h>
13145 #include <fcntl.h>
13146
13147 int main ()
13148 {
13149     int fd, rv;
13150     fd = open ("try.c", O_RDWR);
13151     if (-1 == fd) exit (1);
13152     rv = futimes (fd, NULL);
13153     exit (rv == -1 ? errno : 0);
13154 }
13155 EOCP
13156 set try
13157 if eval $compile; then
13158     `$run ./try`
13159     rc=$?
13160     case "$rc" in
13161         0)  echo "Yes, you have" >&4
13162             d_futimes="$define"
13163             ;;
13164         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13165             ;;
13166     esac
13167 else
13168     echo "No, it does not (probably harmless)" >&4
13169 fi
13170 $rm_try
13171
13172 : see if getcwd exists
13173 set getcwd d_getcwd
13174 eval $inlibc
13175
13176 : see if getespwnam exists
13177 set getespwnam d_getespwnam
13178 eval $inlibc
13179
13180
13181 : see if getfsstat exists
13182 set getfsstat d_getfsstat
13183 eval $inlibc
13184
13185 : see if getgrent exists
13186 set getgrent d_getgrent
13187 eval $inlibc
13188
13189 : see if getgrent_r exists
13190 set getgrent_r d_getgrent_r
13191 eval $inlibc
13192 case "$d_getgrent_r" in
13193 "$define")
13194         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13195         case "$d_getgrent_r_proto:$usethreads" in
13196         ":define")      d_getgrent_r_proto=define
13197                 set d_getgrent_r_proto getgrent_r $hdrs
13198                 eval $hasproto ;;
13199         *)      ;;
13200         esac
13201         case "$d_getgrent_r_proto" in
13202         define)
13203         case "$getgrent_r_proto" in
13204         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13205         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13206         esac
13207         case "$getgrent_r_proto" in
13208         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13209         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13210         esac
13211         case "$getgrent_r_proto" in
13212         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13213         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
13214         esac
13215         case "$getgrent_r_proto" in
13216         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13217         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
13218         esac
13219         case "$getgrent_r_proto" in
13220         ''|0) try='int getgrent_r(struct group*, char*, int);'
13221         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
13222         esac
13223         case "$getgrent_r_proto" in
13224         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13225         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13226         esac
13227         case "$getgrent_r_proto" in
13228         ''|0)   d_getgrent_r=undef
13229                 getgrent_r_proto=0
13230                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13231         * )     case "$getgrent_r_proto" in
13232                 REENTRANT_PROTO*) ;;
13233                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13234                 esac
13235                 echo "Prototype: $try" ;;
13236         esac
13237         ;;
13238         *)      case "$usethreads" in
13239                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13240                 esac
13241                 d_getgrent_r=undef
13242                 getgrent_r_proto=0
13243                 ;;
13244         esac
13245         ;;
13246 *)      getgrent_r_proto=0
13247         ;;
13248 esac
13249
13250 : see if getgrgid_r exists
13251 set getgrgid_r d_getgrgid_r
13252 eval $inlibc
13253 case "$d_getgrgid_r" in
13254 "$define")
13255         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13256         case "$d_getgrgid_r_proto:$usethreads" in
13257         ":define")      d_getgrgid_r_proto=define
13258                 set d_getgrgid_r_proto getgrgid_r $hdrs
13259                 eval $hasproto ;;
13260         *)      ;;
13261         esac
13262         case "$d_getgrgid_r_proto" in
13263         define)
13264         case "$getgrgid_r_proto" in
13265         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13266         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13267         esac
13268         case "$getgrgid_r_proto" in
13269         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13270         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13271         esac
13272         case "$getgrgid_r_proto" in
13273         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13274         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13275         esac
13276         case "$getgrgid_r_proto" in
13277         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13278         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13279         esac
13280         case "$getgrgid_r_proto" in
13281         ''|0)   d_getgrgid_r=undef
13282                 getgrgid_r_proto=0
13283                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13284         * )     case "$getgrgid_r_proto" in
13285                 REENTRANT_PROTO*) ;;
13286                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13287                 esac
13288                 echo "Prototype: $try" ;;
13289         esac
13290         ;;
13291         *)      case "$usethreads" in
13292                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13293                 esac
13294                 d_getgrgid_r=undef
13295                 getgrgid_r_proto=0
13296                 ;;
13297         esac
13298         ;;
13299 *)      getgrgid_r_proto=0
13300         ;;
13301 esac
13302
13303 : see if getgrnam_r exists
13304 set getgrnam_r d_getgrnam_r
13305 eval $inlibc
13306 case "$d_getgrnam_r" in
13307 "$define")
13308         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13309         case "$d_getgrnam_r_proto:$usethreads" in
13310         ":define")      d_getgrnam_r_proto=define
13311                 set d_getgrnam_r_proto getgrnam_r $hdrs
13312                 eval $hasproto ;;
13313         *)      ;;
13314         esac
13315         case "$d_getgrnam_r_proto" in
13316         define)
13317         case "$getgrnam_r_proto" in
13318         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13319         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13320         esac
13321         case "$getgrnam_r_proto" in
13322         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13323         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13324         esac
13325         case "$getgrnam_r_proto" in
13326         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13327         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13328         esac
13329         case "$getgrnam_r_proto" in
13330         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13331         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13332         esac
13333         case "$getgrnam_r_proto" in
13334         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13335         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13336         esac
13337         case "$getgrnam_r_proto" in
13338         ''|0)   d_getgrnam_r=undef
13339                 getgrnam_r_proto=0
13340                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13341         * )     case "$getgrnam_r_proto" in
13342                 REENTRANT_PROTO*) ;;
13343                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13344                 esac
13345                 echo "Prototype: $try" ;;
13346         esac
13347         ;;
13348         *)      case "$usethreads" in
13349                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13350                 esac
13351                 d_getgrnam_r=undef
13352                 getgrnam_r_proto=0
13353                 ;;
13354         esac
13355         ;;
13356 *)      getgrnam_r_proto=0
13357         ;;
13358 esac
13359
13360 : see if gethostbyaddr exists
13361 set gethostbyaddr d_gethbyaddr
13362 eval $inlibc
13363
13364 : see if gethostbyname exists
13365 set gethostbyname d_gethbyname
13366 eval $inlibc
13367
13368 : see if gethostent exists
13369 set gethostent d_gethent
13370 eval $inlibc
13371
13372 : see how we will look up host name
13373 echo " "
13374 call=''
13375 if set gethostname val -f d_gethname; eval $csym; $val; then
13376         echo 'gethostname() found.' >&4
13377         d_gethname="$define"
13378         call=gethostname
13379 fi
13380 if set uname val -f d_uname; eval $csym; $val; then
13381         if ./xenix; then
13382                 $cat <<'EOM'
13383 uname() was found, but you're running xenix, and older versions of xenix
13384 have a broken uname(). If you don't really know whether your xenix is old
13385 enough to have a broken system call, use the default answer.
13386
13387 EOM
13388                 dflt=y
13389                 case "$d_uname" in
13390                 "$define") dflt=n;;
13391                 esac
13392                 rp='Is your uname() broken?'
13393                 . ./myread
13394                 case "$ans" in
13395                 n*) d_uname="$define"; call=uname;;
13396                 esac
13397         else
13398                 echo 'uname() found.' >&4
13399                 d_uname="$define"
13400                 case "$call" in
13401                 '') call=uname ;;
13402                 esac
13403         fi
13404 fi
13405 case "$d_gethname" in
13406 '') d_gethname="$undef";;
13407 esac
13408 case "$d_uname" in
13409 '') d_uname="$undef";;
13410 esac
13411 case "$d_uname$d_gethname" in
13412 *define*)
13413         dflt=n
13414         cat <<EOM
13415
13416 Every now and then someone has a $call() that lies about the hostname
13417 but can't be fixed for political or economic reasons.  If you wish, I can
13418 pretend $call() isn't there and maybe compute hostname at run-time
13419 thanks to the '$phostname' command.
13420
13421 EOM
13422         rp="Shall I ignore $call() from now on?"
13423         . ./myread
13424         case "$ans" in
13425         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13426         esac;;
13427 esac
13428 case "$phostname" in
13429 '') aphostname='';;
13430 *) case "$aphostname" in
13431         /*) ;;
13432         *) set X $phostname
13433                 shift
13434                 file=$1
13435                 shift
13436                 file=`./loc $file $file $pth`
13437                 aphostname=`echo $file $*`
13438                 ;;
13439         esac
13440         ;;
13441 esac
13442 case "$d_uname$d_gethname" in
13443 *define*) ;;
13444 *)
13445         case "$phostname" in
13446         '')
13447                 echo "There will be no way for $package to get your hostname." >&4;;
13448         *)
13449         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13450                 ;;
13451         esac;;
13452 esac
13453 case "$d_phostname" in
13454 '') d_phostname="$undef";;
13455 esac
13456
13457 : see if gethostbyaddr_r exists
13458 set gethostbyaddr_r d_gethostbyaddr_r
13459 eval $inlibc
13460 case "$d_gethostbyaddr_r" in
13461 "$define")
13462         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13463         case "$d_gethostbyaddr_r_proto:$usethreads" in
13464         ":define")      d_gethostbyaddr_r_proto=define
13465                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13466                 eval $hasproto ;;
13467         *)      ;;
13468         esac
13469         case "$d_gethostbyaddr_r_proto" in
13470         define)
13471         case "$gethostbyaddr_r_proto" in
13472         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13473         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13474         esac
13475         case "$gethostbyaddr_r_proto" in
13476         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13477         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13478         esac
13479         case "$gethostbyaddr_r_proto" in
13480         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13481         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13482         esac
13483         case "$gethostbyaddr_r_proto" in
13484         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13485         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13486         esac
13487         case "$gethostbyaddr_r_proto" in
13488         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13489         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13490         esac
13491         case "$gethostbyaddr_r_proto" in
13492         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13493         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13494         esac
13495         case "$gethostbyaddr_r_proto" in
13496         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13497         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13498         esac
13499         case "$gethostbyaddr_r_proto" in
13500         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13501         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13502         esac
13503         case "$gethostbyaddr_r_proto" in
13504         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13505         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13506         esac
13507         case "$gethostbyaddr_r_proto" in
13508         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13509         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13510         esac
13511         case "$gethostbyaddr_r_proto" in
13512         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13513         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13514         esac
13515         case "$gethostbyaddr_r_proto" in
13516         ''|0)   d_gethostbyaddr_r=undef
13517                 gethostbyaddr_r_proto=0
13518                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13519         * )     case "$gethostbyaddr_r_proto" in
13520                 REENTRANT_PROTO*) ;;
13521                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13522                 esac
13523                 echo "Prototype: $try" ;;
13524         esac
13525         ;;
13526         *)      case "$usethreads" in
13527                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13528                 esac
13529                 d_gethostbyaddr_r=undef
13530                 gethostbyaddr_r_proto=0
13531                 ;;
13532         esac
13533         ;;
13534 *)      gethostbyaddr_r_proto=0
13535         ;;
13536 esac
13537
13538 : see if gethostbyname_r exists
13539 set gethostbyname_r d_gethostbyname_r
13540 eval $inlibc
13541 case "$d_gethostbyname_r" in
13542 "$define")
13543         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13544         case "$d_gethostbyname_r_proto:$usethreads" in
13545         ":define")      d_gethostbyname_r_proto=define
13546                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13547                 eval $hasproto ;;
13548         *)      ;;
13549         esac
13550         case "$d_gethostbyname_r_proto" in
13551         define)
13552         case "$gethostbyname_r_proto" in
13553         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13554         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13555         esac
13556         case "$gethostbyname_r_proto" in
13557         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13558         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13559         esac
13560         case "$gethostbyname_r_proto" in
13561         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13562         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13563         esac
13564         case "$gethostbyname_r_proto" in
13565         ''|0)   d_gethostbyname_r=undef
13566                 gethostbyname_r_proto=0
13567                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13568         * )     case "$gethostbyname_r_proto" in
13569                 REENTRANT_PROTO*) ;;
13570                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13571                 esac
13572                 echo "Prototype: $try" ;;
13573         esac
13574         ;;
13575         *)      case "$usethreads" in
13576                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13577                 esac
13578                 d_gethostbyname_r=undef
13579                 gethostbyname_r_proto=0
13580                 ;;
13581         esac
13582         ;;
13583 *)      gethostbyname_r_proto=0
13584         ;;
13585 esac
13586
13587 : see if gethostent_r exists
13588 set gethostent_r d_gethostent_r
13589 eval $inlibc
13590 case "$d_gethostent_r" in
13591 "$define")
13592         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13593         case "$d_gethostent_r_proto:$usethreads" in
13594         ":define")      d_gethostent_r_proto=define
13595                 set d_gethostent_r_proto gethostent_r $hdrs
13596                 eval $hasproto ;;
13597         *)      ;;
13598         esac
13599         case "$d_gethostent_r_proto" in
13600         define)
13601         case "$gethostent_r_proto" in
13602         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13603         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13604         esac
13605         case "$gethostent_r_proto" in
13606         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13607         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13608         esac
13609         case "$gethostent_r_proto" in
13610         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13611         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13612         esac
13613         case "$gethostent_r_proto" in
13614         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13615         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13616         esac
13617         case "$gethostent_r_proto" in
13618         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13619         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13620         esac
13621         case "$gethostent_r_proto" in
13622         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13623         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13624         esac
13625         case "$gethostent_r_proto" in
13626         ''|0)   d_gethostent_r=undef
13627                 gethostent_r_proto=0
13628                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13629         * )     case "$gethostent_r_proto" in
13630                 REENTRANT_PROTO*) ;;
13631                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13632                 esac
13633                 echo "Prototype: $try" ;;
13634         esac
13635         ;;
13636         *)      case "$usethreads" in
13637                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13638                 esac
13639                 d_gethostent_r=undef
13640                 gethostent_r_proto=0
13641                 ;;
13642         esac
13643         ;;
13644 *)      gethostent_r_proto=0
13645         ;;
13646 esac
13647
13648 : see if prototypes for various gethostxxx netdb.h functions are available
13649 echo " "
13650 set d_gethostprotos gethostent $i_netdb netdb.h
13651 eval $hasproto
13652
13653 : see if getitimer exists
13654 set getitimer d_getitimer
13655 eval $inlibc
13656
13657 : see if getlogin exists
13658 set getlogin d_getlogin
13659 eval $inlibc
13660
13661 : see if getlogin_r exists
13662 set getlogin_r d_getlogin_r
13663 eval $inlibc
13664 case "$d_getlogin_r" in
13665 "$define")
13666         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13667         case "$d_getlogin_r_proto:$usethreads" in
13668         ":define")      d_getlogin_r_proto=define
13669                 set d_getlogin_r_proto getlogin_r $hdrs
13670                 eval $hasproto ;;
13671         *)      ;;
13672         esac
13673         case "$d_getlogin_r_proto" in
13674         define)
13675         case "$getlogin_r_proto" in
13676         ''|0) try='int getlogin_r(char*, size_t);'
13677         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13678         esac
13679         case "$getlogin_r_proto" in
13680         ''|0) try='int getlogin_r(char*, int);'
13681         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13682         esac
13683         case "$getlogin_r_proto" in
13684         ''|0) try='char* getlogin_r(char*, size_t);'
13685         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13686         esac
13687         case "$getlogin_r_proto" in
13688         ''|0) try='char* getlogin_r(char*, int);'
13689         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13690         esac
13691         case "$getlogin_r_proto" in
13692         ''|0)   d_getlogin_r=undef
13693                 getlogin_r_proto=0
13694                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13695         * )     case "$getlogin_r_proto" in
13696                 REENTRANT_PROTO*) ;;
13697                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13698                 esac
13699                 echo "Prototype: $try" ;;
13700         esac
13701         ;;
13702         *)      case "$usethreads" in
13703                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13704                 esac
13705                 d_getlogin_r=undef
13706                 getlogin_r_proto=0
13707                 ;;
13708         esac
13709         ;;
13710 *)      getlogin_r_proto=0
13711         ;;
13712 esac
13713
13714 : see if getmnt exists
13715 set getmnt d_getmnt
13716 eval $inlibc
13717
13718 : see if getmntent exists
13719 set getmntent d_getmntent
13720 eval $inlibc
13721
13722 : see if getnetbyaddr exists
13723 set getnetbyaddr d_getnbyaddr
13724 eval $inlibc
13725
13726 : see if getnetbyname exists
13727 set getnetbyname d_getnbyname
13728 eval $inlibc
13729
13730 : see if getnetent exists
13731 set getnetent d_getnent
13732 eval $inlibc
13733
13734 : see if getnetbyaddr_r exists
13735 set getnetbyaddr_r d_getnetbyaddr_r
13736 eval $inlibc
13737 case "$d_getnetbyaddr_r" in
13738 "$define")
13739         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13740         case "$d_getnetbyaddr_r_proto:$usethreads" in
13741         ":define")      d_getnetbyaddr_r_proto=define
13742                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13743                 eval $hasproto ;;
13744         *)      ;;
13745         esac
13746         case "$d_getnetbyaddr_r_proto" in
13747         define)
13748         case "$getnetbyaddr_r_proto" in
13749         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13750         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13751         esac
13752         case "$getnetbyaddr_r_proto" in
13753         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13754         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13755         esac
13756         case "$getnetbyaddr_r_proto" in
13757         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13758         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13759         esac
13760         case "$getnetbyaddr_r_proto" in
13761         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13762         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13763         esac
13764         case "$getnetbyaddr_r_proto" in
13765         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13766         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13767         esac
13768         case "$getnetbyaddr_r_proto" in
13769         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13770         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13771         esac
13772         case "$getnetbyaddr_r_proto" in
13773         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13774         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13775         esac
13776         case "$getnetbyaddr_r_proto" in
13777         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13778         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13779         esac
13780         case "$getnetbyaddr_r_proto" in
13781         ''|0)   d_getnetbyaddr_r=undef
13782                 getnetbyaddr_r_proto=0
13783                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13784         * )     case "$getnetbyaddr_r_proto" in
13785                 REENTRANT_PROTO*) ;;
13786                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13787                 esac
13788                 echo "Prototype: $try" ;;
13789         esac
13790         ;;
13791         *)      case "$usethreads" in
13792                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13793                 esac
13794                 d_getnetbyaddr_r=undef
13795                 getnetbyaddr_r_proto=0
13796                 ;;
13797         esac
13798         ;;
13799 *)      getnetbyaddr_r_proto=0
13800         ;;
13801 esac
13802
13803 : see if getnetbyname_r exists
13804 set getnetbyname_r d_getnetbyname_r
13805 eval $inlibc
13806 case "$d_getnetbyname_r" in
13807 "$define")
13808         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13809         case "$d_getnetbyname_r_proto:$usethreads" in
13810         ":define")      d_getnetbyname_r_proto=define
13811                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13812                 eval $hasproto ;;
13813         *)      ;;
13814         esac
13815         case "$d_getnetbyname_r_proto" in
13816         define)
13817         case "$getnetbyname_r_proto" in
13818         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13819         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13820         esac
13821         case "$getnetbyname_r_proto" in
13822         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13823         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13824         esac
13825         case "$getnetbyname_r_proto" in
13826         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13827         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13828         esac
13829         case "$getnetbyname_r_proto" in
13830         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13831         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13832         esac
13833         case "$getnetbyname_r_proto" in
13834         ''|0)   d_getnetbyname_r=undef
13835                 getnetbyname_r_proto=0
13836                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13837         * )     case "$getnetbyname_r_proto" in
13838                 REENTRANT_PROTO*) ;;
13839                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13840                 esac
13841                 echo "Prototype: $try" ;;
13842         esac
13843         ;;
13844         *)      case "$usethreads" in
13845                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13846                 esac
13847                 d_getnetbyname_r=undef
13848                 getnetbyname_r_proto=0
13849                 ;;
13850         esac
13851         ;;
13852 *)      getnetbyname_r_proto=0
13853         ;;
13854 esac
13855
13856 : see if getnetent_r exists
13857 set getnetent_r d_getnetent_r
13858 eval $inlibc
13859 case "$d_getnetent_r" in
13860 "$define")
13861         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13862         case "$d_getnetent_r_proto:$usethreads" in
13863         ":define")      d_getnetent_r_proto=define
13864                 set d_getnetent_r_proto getnetent_r $hdrs
13865                 eval $hasproto ;;
13866         *)      ;;
13867         esac
13868         case "$d_getnetent_r_proto" in
13869         define)
13870         case "$getnetent_r_proto" in
13871         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13872         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13873         esac
13874         case "$getnetent_r_proto" in
13875         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13876         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13877         esac
13878         case "$getnetent_r_proto" in
13879         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13880         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13881         esac
13882         case "$getnetent_r_proto" in
13883         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13884         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13885         esac
13886         case "$getnetent_r_proto" in
13887         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13888         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13889         esac
13890         case "$getnetent_r_proto" in
13891         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13892         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13893         esac
13894         case "$getnetent_r_proto" in
13895         ''|0)   d_getnetent_r=undef
13896                 getnetent_r_proto=0
13897                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13898         * )     case "$getnetent_r_proto" in
13899                 REENTRANT_PROTO*) ;;
13900                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13901                 esac
13902                 echo "Prototype: $try" ;;
13903         esac
13904         ;;
13905         *)      case "$usethreads" in
13906                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13907                 esac
13908                 d_getnetent_r=undef
13909                 getnetent_r_proto=0
13910                 ;;
13911         esac
13912         ;;
13913 *)      getnetent_r_proto=0
13914         ;;
13915 esac
13916
13917 : see if prototypes for various getnetxxx netdb.h functions are available
13918 echo " "
13919 set d_getnetprotos getnetent $i_netdb netdb.h
13920 eval $hasproto
13921
13922 : see if getpagesize exists
13923 set getpagesize d_getpagsz
13924 eval $inlibc
13925
13926
13927 : see if getprotobyname exists
13928 set getprotobyname d_getpbyname
13929 eval $inlibc
13930
13931 : see if getprotobynumber exists
13932 set getprotobynumber d_getpbynumber
13933 eval $inlibc
13934
13935 : see if getprotoent exists
13936 set getprotoent d_getpent
13937 eval $inlibc
13938
13939 : see if getpgid exists
13940 set getpgid d_getpgid
13941 eval $inlibc
13942
13943 : see if getpgrp2 exists
13944 set getpgrp2 d_getpgrp2
13945 eval $inlibc
13946
13947 : see if getppid exists
13948 set getppid d_getppid
13949 eval $inlibc
13950
13951 : see if getpriority exists
13952 set getpriority d_getprior
13953 eval $inlibc
13954
13955 : see if getprotobyname_r exists
13956 set getprotobyname_r d_getprotobyname_r
13957 eval $inlibc
13958 case "$d_getprotobyname_r" in
13959 "$define")
13960         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13961         case "$d_getprotobyname_r_proto:$usethreads" in
13962         ":define")      d_getprotobyname_r_proto=define
13963                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13964                 eval $hasproto ;;
13965         *)      ;;
13966         esac
13967         case "$d_getprotobyname_r_proto" in
13968         define)
13969         case "$getprotobyname_r_proto" in
13970         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13971         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13972         esac
13973         case "$getprotobyname_r_proto" in
13974         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13975         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13976         esac
13977         case "$getprotobyname_r_proto" in
13978         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13979         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13980         esac
13981         case "$getprotobyname_r_proto" in
13982         ''|0)   d_getprotobyname_r=undef
13983                 getprotobyname_r_proto=0
13984                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13985         * )     case "$getprotobyname_r_proto" in
13986                 REENTRANT_PROTO*) ;;
13987                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13988                 esac
13989                 echo "Prototype: $try" ;;
13990         esac
13991         ;;
13992         *)      case "$usethreads" in
13993                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13994                 esac
13995                 d_getprotobyname_r=undef
13996                 getprotobyname_r_proto=0
13997                 ;;
13998         esac
13999         ;;
14000 *)      getprotobyname_r_proto=0
14001         ;;
14002 esac
14003
14004 : see if getprotobynumber_r exists
14005 set getprotobynumber_r d_getprotobynumber_r
14006 eval $inlibc
14007 case "$d_getprotobynumber_r" in
14008 "$define")
14009         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14010         case "$d_getprotobynumber_r_proto:$usethreads" in
14011         ":define")      d_getprotobynumber_r_proto=define
14012                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14013                 eval $hasproto ;;
14014         *)      ;;
14015         esac
14016         case "$d_getprotobynumber_r_proto" in
14017         define)
14018         case "$getprotobynumber_r_proto" in
14019         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14020         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14021         esac
14022         case "$getprotobynumber_r_proto" in
14023         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14024         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14025         esac
14026         case "$getprotobynumber_r_proto" in
14027         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14028         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14029         esac
14030         case "$getprotobynumber_r_proto" in
14031         ''|0)   d_getprotobynumber_r=undef
14032                 getprotobynumber_r_proto=0
14033                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14034         * )     case "$getprotobynumber_r_proto" in
14035                 REENTRANT_PROTO*) ;;
14036                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14037                 esac
14038                 echo "Prototype: $try" ;;
14039         esac
14040         ;;
14041         *)      case "$usethreads" in
14042                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14043                 esac
14044                 d_getprotobynumber_r=undef
14045                 getprotobynumber_r_proto=0
14046                 ;;
14047         esac
14048         ;;
14049 *)      getprotobynumber_r_proto=0
14050         ;;
14051 esac
14052
14053 : see if getprotoent_r exists
14054 set getprotoent_r d_getprotoent_r
14055 eval $inlibc
14056 case "$d_getprotoent_r" in
14057 "$define")
14058         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14059         case "$d_getprotoent_r_proto:$usethreads" in
14060         ":define")      d_getprotoent_r_proto=define
14061                 set d_getprotoent_r_proto getprotoent_r $hdrs
14062                 eval $hasproto ;;
14063         *)      ;;
14064         esac
14065         case "$d_getprotoent_r_proto" in
14066         define)
14067         case "$getprotoent_r_proto" in
14068         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14069         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14070         esac
14071         case "$getprotoent_r_proto" in
14072         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14073         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14074         esac
14075         case "$getprotoent_r_proto" in
14076         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14077         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14078         esac
14079         case "$getprotoent_r_proto" in
14080         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14081         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
14082         esac
14083         case "$getprotoent_r_proto" in
14084         ''|0)   d_getprotoent_r=undef
14085                 getprotoent_r_proto=0
14086                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14087         * )     case "$getprotoent_r_proto" in
14088                 REENTRANT_PROTO*) ;;
14089                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14090                 esac
14091                 echo "Prototype: $try" ;;
14092         esac
14093         ;;
14094         *)      case "$usethreads" in
14095                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14096                 esac
14097                 d_getprotoent_r=undef
14098                 getprotoent_r_proto=0
14099                 ;;
14100         esac
14101         ;;
14102 *)      getprotoent_r_proto=0
14103         ;;
14104 esac
14105
14106 : see if prototypes for various getprotoxxx netdb.h functions are available
14107 echo " "
14108 set d_getprotoprotos getprotoent $i_netdb netdb.h
14109 eval $hasproto
14110
14111 : see if getprpwnam exists
14112 set getprpwnam d_getprpwnam
14113 eval $inlibc
14114
14115 : see if getpwent exists
14116 set getpwent d_getpwent
14117 eval $inlibc
14118
14119 : see if getpwent_r exists
14120 set getpwent_r d_getpwent_r
14121 eval $inlibc
14122 case "$d_getpwent_r" in
14123 "$define")
14124         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14125         case "$d_getpwent_r_proto:$usethreads" in
14126         ":define")      d_getpwent_r_proto=define
14127                 set d_getpwent_r_proto getpwent_r $hdrs
14128                 eval $hasproto ;;
14129         *)      ;;
14130         esac
14131         case "$d_getpwent_r_proto" in
14132         define)
14133         case "$getpwent_r_proto" in
14134         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14135         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14136         esac
14137         case "$getpwent_r_proto" in
14138         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14139         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14140         esac
14141         case "$getpwent_r_proto" in
14142         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14143         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
14144         esac
14145         case "$getpwent_r_proto" in
14146         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14147         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
14148         esac
14149         case "$getpwent_r_proto" in
14150         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14151         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
14152         esac
14153         case "$getpwent_r_proto" in
14154         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14155         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14156         esac
14157         case "$getpwent_r_proto" in
14158         ''|0)   d_getpwent_r=undef
14159                 getpwent_r_proto=0
14160                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14161         * )     case "$getpwent_r_proto" in
14162                 REENTRANT_PROTO*) ;;
14163                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14164                 esac
14165                 echo "Prototype: $try" ;;
14166         esac
14167         ;;
14168         *)      case "$usethreads" in
14169                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14170                 esac
14171                 d_getpwent_r=undef
14172                 getpwent_r_proto=0
14173                 ;;
14174         esac
14175         ;;
14176 *)      getpwent_r_proto=0
14177         ;;
14178 esac
14179
14180 : see if getpwnam_r exists
14181 set getpwnam_r d_getpwnam_r
14182 eval $inlibc
14183 case "$d_getpwnam_r" in
14184 "$define")
14185         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14186         case "$d_getpwnam_r_proto:$usethreads" in
14187         ":define")      d_getpwnam_r_proto=define
14188                 set d_getpwnam_r_proto getpwnam_r $hdrs
14189                 eval $hasproto ;;
14190         *)      ;;
14191         esac
14192         case "$d_getpwnam_r_proto" in
14193         define)
14194         case "$getpwnam_r_proto" in
14195         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14196         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14197         esac
14198         case "$getpwnam_r_proto" in
14199         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14200         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14201         esac
14202         case "$getpwnam_r_proto" in
14203         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14204         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14205         esac
14206         case "$getpwnam_r_proto" in
14207         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14208         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14209         esac
14210         case "$getpwnam_r_proto" in
14211         ''|0)   d_getpwnam_r=undef
14212                 getpwnam_r_proto=0
14213                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14214         * )     case "$getpwnam_r_proto" in
14215                 REENTRANT_PROTO*) ;;
14216                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14217                 esac
14218                 echo "Prototype: $try" ;;
14219         esac
14220         ;;
14221         *)      case "$usethreads" in
14222                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14223                 esac
14224                 d_getpwnam_r=undef
14225                 getpwnam_r_proto=0
14226                 ;;
14227         esac
14228         ;;
14229 *)      getpwnam_r_proto=0
14230         ;;
14231 esac
14232
14233 : see if getpwuid_r exists
14234 set getpwuid_r d_getpwuid_r
14235 eval $inlibc
14236 case "$d_getpwuid_r" in
14237 "$define")
14238         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14239         case "$d_getpwuid_r_proto:$usethreads" in
14240         ":define")      d_getpwuid_r_proto=define
14241                 set d_getpwuid_r_proto getpwuid_r $hdrs
14242                 eval $hasproto ;;
14243         *)      ;;
14244         esac
14245         case "$d_getpwuid_r_proto" in
14246         define)
14247         case "$getpwuid_r_proto" in
14248         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14249         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14250         esac
14251         case "$getpwuid_r_proto" in
14252         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14253         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14254         esac
14255         case "$getpwuid_r_proto" in
14256         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14257         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14258         esac
14259         case "$getpwuid_r_proto" in
14260         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14261         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14262         esac
14263         case "$getpwuid_r_proto" in
14264         ''|0)   d_getpwuid_r=undef
14265                 getpwuid_r_proto=0
14266                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14267         * )     case "$getpwuid_r_proto" in
14268                 REENTRANT_PROTO*) ;;
14269                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14270                 esac
14271                 echo "Prototype: $try" ;;
14272         esac
14273         ;;
14274         *)      case "$usethreads" in
14275                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14276                 esac
14277                 d_getpwuid_r=undef
14278                 getpwuid_r_proto=0
14279                 ;;
14280         esac
14281         ;;
14282 *)      getpwuid_r_proto=0
14283         ;;
14284 esac
14285
14286
14287 : see if getservbyname exists
14288 set getservbyname d_getsbyname
14289 eval $inlibc
14290
14291 : see if getservbyport exists
14292 set getservbyport d_getsbyport
14293 eval $inlibc
14294
14295 : see if getservent exists
14296 set getservent d_getsent
14297 eval $inlibc
14298
14299 : see if getservbyname_r exists
14300 set getservbyname_r d_getservbyname_r
14301 eval $inlibc
14302 case "$d_getservbyname_r" in
14303 "$define")
14304         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14305         case "$d_getservbyname_r_proto:$usethreads" in
14306         ":define")      d_getservbyname_r_proto=define
14307                 set d_getservbyname_r_proto getservbyname_r $hdrs
14308                 eval $hasproto ;;
14309         *)      ;;
14310         esac
14311         case "$d_getservbyname_r_proto" in
14312         define)
14313         case "$getservbyname_r_proto" in
14314         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14315         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14316         esac
14317         case "$getservbyname_r_proto" in
14318         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14319         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14320         esac
14321         case "$getservbyname_r_proto" in
14322         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14323         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14324         esac
14325         case "$getservbyname_r_proto" in
14326         ''|0)   d_getservbyname_r=undef
14327                 getservbyname_r_proto=0
14328                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14329         * )     case "$getservbyname_r_proto" in
14330                 REENTRANT_PROTO*) ;;
14331                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14332                 esac
14333                 echo "Prototype: $try" ;;
14334         esac
14335         ;;
14336         *)      case "$usethreads" in
14337                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14338                 esac
14339                 d_getservbyname_r=undef
14340                 getservbyname_r_proto=0
14341                 ;;
14342         esac
14343         ;;
14344 *)      getservbyname_r_proto=0
14345         ;;
14346 esac
14347
14348 : see if getservbyport_r exists
14349 set getservbyport_r d_getservbyport_r
14350 eval $inlibc
14351 case "$d_getservbyport_r" in
14352 "$define")
14353         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14354         case "$d_getservbyport_r_proto:$usethreads" in
14355         ":define")      d_getservbyport_r_proto=define
14356                 set d_getservbyport_r_proto getservbyport_r $hdrs
14357                 eval $hasproto ;;
14358         *)      ;;
14359         esac
14360         case "$d_getservbyport_r_proto" in
14361         define)
14362         case "$getservbyport_r_proto" in
14363         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14364         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14365         esac
14366         case "$getservbyport_r_proto" in
14367         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14368         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14369         esac
14370         case "$getservbyport_r_proto" in
14371         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14372         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14373         esac
14374         case "$getservbyport_r_proto" in
14375         ''|0)   d_getservbyport_r=undef
14376                 getservbyport_r_proto=0
14377                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14378         * )     case "$getservbyport_r_proto" in
14379                 REENTRANT_PROTO*) ;;
14380                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14381                 esac
14382                 echo "Prototype: $try" ;;
14383         esac
14384         ;;
14385         *)      case "$usethreads" in
14386                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14387                 esac
14388                 d_getservbyport_r=undef
14389                 getservbyport_r_proto=0
14390                 ;;
14391         esac
14392         ;;
14393 *)      getservbyport_r_proto=0
14394         ;;
14395 esac
14396
14397 : see if getservent_r exists
14398 set getservent_r d_getservent_r
14399 eval $inlibc
14400 case "$d_getservent_r" in
14401 "$define")
14402         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14403         case "$d_getservent_r_proto:$usethreads" in
14404         ":define")      d_getservent_r_proto=define
14405                 set d_getservent_r_proto getservent_r $hdrs
14406                 eval $hasproto ;;
14407         *)      ;;
14408         esac
14409         case "$d_getservent_r_proto" in
14410         define)
14411         case "$getservent_r_proto" in
14412         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14413         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
14414         esac
14415         case "$getservent_r_proto" in
14416         ''|0) try='int getservent_r(struct servent*, char*, int);'
14417         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
14418         esac
14419         case "$getservent_r_proto" in
14420         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14421         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
14422         esac
14423         case "$getservent_r_proto" in
14424         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14425         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
14426         esac
14427         case "$getservent_r_proto" in
14428         ''|0)   d_getservent_r=undef
14429                 getservent_r_proto=0
14430                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14431         * )     case "$getservent_r_proto" in
14432                 REENTRANT_PROTO*) ;;
14433                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14434                 esac
14435                 echo "Prototype: $try" ;;
14436         esac
14437         ;;
14438         *)      case "$usethreads" in
14439                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14440                 esac
14441                 d_getservent_r=undef
14442                 getservent_r_proto=0
14443                 ;;
14444         esac
14445         ;;
14446 *)      getservent_r_proto=0
14447         ;;
14448 esac
14449
14450 : see if prototypes for various getservxxx netdb.h functions are available
14451 echo " "
14452 set d_getservprotos getservent $i_netdb netdb.h
14453 eval $hasproto
14454
14455 : see if getspnam exists
14456 set getspnam d_getspnam
14457 eval $inlibc
14458
14459 : see if this is a shadow.h system
14460 set shadow.h i_shadow
14461 eval $inhdr
14462
14463 : see if getspnam_r exists
14464 set getspnam_r d_getspnam_r
14465 eval $inlibc
14466 case "$d_getspnam_r" in
14467 "$define")
14468         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14469         case "$d_getspnam_r_proto:$usethreads" in
14470         ":define")      d_getspnam_r_proto=define
14471                 set d_getspnam_r_proto getspnam_r $hdrs
14472                 eval $hasproto ;;
14473         *)      ;;
14474         esac
14475         case "$d_getspnam_r_proto" in
14476         define)
14477         case "$getspnam_r_proto" in
14478         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14479         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14480         esac
14481         case "$getspnam_r_proto" in
14482         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14483         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14484         esac
14485         case "$getspnam_r_proto" in
14486         ''|0)   d_getspnam_r=undef
14487                 getspnam_r_proto=0
14488                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14489         * )     case "$getspnam_r_proto" in
14490                 REENTRANT_PROTO*) ;;
14491                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14492                 esac
14493                 echo "Prototype: $try" ;;
14494         esac
14495         ;;
14496         *)      case "$usethreads" in
14497                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14498                 esac
14499                 d_getspnam_r=undef
14500                 getspnam_r_proto=0
14501                 ;;
14502         esac
14503         ;;
14504 *)      getspnam_r_proto=0
14505         ;;
14506 esac
14507
14508 : see if gettimeofday or ftime exists
14509 set gettimeofday d_gettimeod
14510 eval $inlibc
14511 case "$d_gettimeod" in
14512 "$undef")
14513         set ftime d_ftime 
14514         eval $inlibc
14515         ;;
14516 *)
14517         val="$undef"; set d_ftime; eval $setvar
14518         ;;
14519 esac
14520 case "$d_gettimeod$d_ftime" in
14521 "$undef$undef")
14522         echo " "
14523         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14524         ;;
14525 esac
14526
14527 : see if gmtime_r exists
14528 set gmtime_r d_gmtime_r
14529 eval $inlibc
14530 case "$d_gmtime_r" in
14531 "$define")
14532         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14533         case "$d_gmtime_r_proto:$usethreads" in
14534         ":define")      d_gmtime_r_proto=define
14535                 set d_gmtime_r_proto gmtime_r $hdrs
14536                 eval $hasproto ;;
14537         *)      ;;
14538         esac
14539         case "$d_gmtime_r_proto" in
14540         define)
14541         case "$gmtime_r_proto" in
14542         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14543         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14544         esac
14545         case "$gmtime_r_proto" in
14546         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14547         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14548         esac
14549         case "$gmtime_r_proto" in
14550         ''|0)   d_gmtime_r=undef
14551                 gmtime_r_proto=0
14552                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14553         * )     case "$gmtime_r_proto" in
14554                 REENTRANT_PROTO*) ;;
14555                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14556                 esac
14557                 echo "Prototype: $try" ;;
14558         esac
14559         ;;
14560         *)      case "$usethreads" in
14561                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14562                 esac
14563                 d_gmtime_r=undef
14564                 gmtime_r_proto=0
14565                 ;;
14566         esac
14567         ;;
14568 *)      gmtime_r_proto=0
14569         ;;
14570 esac
14571
14572 : see if hasmntopt exists
14573 set hasmntopt d_hasmntopt
14574 eval $inlibc
14575
14576 : see if this is a netinet/in.h or sys/in.h system
14577 set netinet/in.h i_niin sys/in.h i_sysin
14578 eval $inhdr
14579
14580 : see if arpa/inet.h has to be included
14581 set arpa/inet.h i_arpainet
14582 eval $inhdr
14583
14584 : see if htonl --and friends-- exists
14585 val=''
14586 set htonl val
14587 eval $inlibc
14588
14589 : Maybe they are macros.
14590 case "$val" in
14591 $undef)
14592         $cat >htonl.c <<EOM
14593 #include <stdio.h>
14594 #include <sys/types.h>
14595 #$i_niin I_NETINET_IN
14596 #$i_sysin I_SYS_IN
14597 #$i_arpainet I_ARPA_INET
14598 #ifdef I_NETINET_IN
14599 #include <netinet/in.h>
14600 #endif
14601 #ifdef I_SYS_IN
14602 #include <sys/in.h>
14603 #endif
14604 #ifdef I_ARPA_INET
14605 #include <arpa/inet.h>
14606 #endif
14607 #ifdef htonl
14608 printf("Defined as a macro.");
14609 #endif
14610 EOM
14611         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14612         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14613                 val="$define"
14614                 echo "But it seems to be defined as a macro." >&4
14615         fi
14616         $rm -f htonl.?
14617         ;;
14618 esac
14619 set d_htonl
14620 eval $setvar
14621
14622 : see if ilogbl exists
14623 set ilogbl d_ilogbl
14624 eval $inlibc
14625
14626 : index or strchr
14627 echo " "
14628 if set index val -f; eval $csym; $val; then
14629         if set strchr val -f d_strchr; eval $csym; $val; then
14630                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14631                         val="$define"
14632                         vali="$undef"
14633                         echo "strchr() found." >&4
14634                 else
14635                         val="$undef"
14636                         vali="$define"
14637                         echo "index() found." >&4
14638                 fi
14639         else
14640                 val="$undef"
14641                 vali="$define"
14642                 echo "index() found." >&4
14643         fi
14644 else
14645         if set strchr val -f d_strchr; eval $csym; $val; then
14646                 val="$define"
14647                 vali="$undef"
14648                 echo "strchr() found." >&4
14649         else
14650                 echo "No index() or strchr() found!" >&4
14651                 val="$undef"
14652                 vali="$undef"
14653         fi
14654 fi
14655 set d_strchr; eval $setvar
14656 val="$vali"
14657 set d_index; eval $setvar
14658
14659 : check whether inet_aton exists
14660 set inet_aton d_inetaton
14661 eval $inlibc
14662
14663 : Look for isascii
14664 echo " "
14665 $cat >isascii.c <<EOCP
14666 #include <stdio.h>
14667 #include <ctype.h>
14668 #$i_stdlib I_STDLIB
14669 #ifdef I_STDLIB
14670 #include <stdlib.h>
14671 #endif
14672 int main() {
14673         int c = 'A';
14674         if (isascii(c))
14675                 exit(0);
14676         else
14677                 exit(1);
14678 }
14679 EOCP
14680 set isascii
14681 if eval $compile; then
14682         echo "isascii() found." >&4
14683         val="$define"
14684 else
14685         echo "isascii() NOT found." >&4
14686         val="$undef"
14687 fi
14688 set d_isascii
14689 eval $setvar
14690 $rm -f isascii*
14691
14692 : see if isfinite exists
14693 set isfinite d_isfinite
14694 eval $inlibc
14695
14696 : see if isinf exists
14697 set isinf d_isinf
14698 eval $inlibc
14699
14700 : see if isnan exists
14701 set isnan d_isnan
14702 eval $inlibc
14703
14704 : see if isnanl exists
14705 set isnanl d_isnanl
14706 eval $inlibc
14707
14708 : see if killpg exists
14709 set killpg d_killpg
14710 eval $inlibc
14711
14712 : see if lchown exists
14713 echo " "
14714 $cat > try.c <<'EOCP'
14715 /* System header to define __stub macros and hopefully few prototypes,
14716     which can conflict with char lchown(); below.  */
14717 #include <assert.h>
14718 /* Override any gcc2 internal prototype to avoid an error.  */
14719 /* We use char because int might match the return type of a gcc2
14720    builtin and then its argument prototype would still apply.  */
14721 char lchown();
14722 int main() {
14723     /*  The GNU C library defines this for functions which it implements
14724         to always fail with ENOSYS.  Some functions are actually named
14725         something starting with __ and the normal name is an alias.  */
14726 #if defined (__stub_lchown) || defined (__stub___lchown)
14727 choke me
14728 #else
14729 lchown();
14730 #endif
14731 ; return 0; }
14732 EOCP
14733 set try
14734 if eval $compile; then
14735     $echo "lchown() found." >&4
14736     val="$define"
14737 else
14738     $echo "lchown() NOT found." >&4
14739     val="$undef"
14740 fi
14741 set d_lchown
14742 eval $setvar
14743
14744 : See if number of significant digits in a double precision number is known
14745 echo " "
14746 $cat >ldbl_dig.c <<EOM
14747 #$i_limits I_LIMITS
14748 #$i_float I_FLOAT
14749 #ifdef I_LIMITS
14750 #include <limits.h>
14751 #endif
14752 #ifdef I_FLOAT
14753 #include <float.h>
14754 #endif
14755 #ifdef LDBL_DIG
14756 printf("Contains LDBL_DIG");
14757 #endif
14758 EOM
14759 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14760 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14761         echo "LDBL_DIG found." >&4
14762         val="$define"
14763 else
14764         echo "LDBL_DIG NOT found." >&4
14765         val="$undef"
14766 fi
14767 $rm -f ldbl_dig.?
14768 set d_ldbl_dig
14769 eval $setvar
14770
14771 : see if this is a math.h system
14772 set math.h i_math
14773 eval $inhdr
14774
14775 : check to see if math.h defines _LIB_VERSION
14776 d_libm_lib_version="$undef"
14777 case $i_math in
14778     $define)
14779         echo " "
14780         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14781         $cat >try.c <<EOCP
14782 #include <unistd.h>
14783 #include <math.h>
14784 int main (int argc, char *argv[])
14785 {
14786     printf ("%d\n", _LIB_VERSION);
14787     return (0);
14788     } /* main */
14789 EOCP
14790         set try
14791         if eval $compile; then
14792             foo=`$run ./try`
14793             echo "Yes, it does ($foo)" >&4
14794             d_libm_lib_version="$define"
14795         else
14796             echo "No, it does not (probably harmless)" >&4
14797             fi
14798         $rm_try
14799         ;;
14800
14801     esac
14802
14803 : see if link exists
14804 set link d_link
14805 eval $inlibc
14806
14807 : see if localtime_r exists
14808 set localtime_r d_localtime_r
14809 eval $inlibc
14810 case "$d_localtime_r" in
14811 "$define")
14812         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14813         case "$d_localtime_r_proto:$usethreads" in
14814         ":define")      d_localtime_r_proto=define
14815                 set d_localtime_r_proto localtime_r $hdrs
14816                 eval $hasproto ;;
14817         *)      ;;
14818         esac
14819         case "$d_localtime_r_proto" in
14820         define)
14821         case "$localtime_r_proto" in
14822         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14823         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14824         esac
14825         case "$localtime_r_proto" in
14826         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14827         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14828         esac
14829         case "$localtime_r_proto" in
14830         ''|0)   d_localtime_r=undef
14831                 localtime_r_proto=0
14832                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14833         * )     case "$localtime_r_proto" in
14834                 REENTRANT_PROTO*) ;;
14835                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14836                 esac
14837                 echo "Prototype: $try" ;;
14838         esac
14839         ;;
14840         *)      case "$usethreads" in
14841                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14842                 esac
14843                 d_localtime_r=undef
14844                 localtime_r_proto=0
14845                 ;;
14846         esac
14847         ;;
14848 *)      localtime_r_proto=0
14849         ;;
14850 esac
14851
14852 : see if localtime_r calls tzset
14853 case "$localtime_r_proto" in
14854 REENTRANT_PROTO*)
14855         $cat >try.c <<EOCP
14856 /*  Does our libc's localtime_r call tzset ?
14857  *  return 0 if so, 1 otherwise.
14858  */
14859 #include <sys/types.h>
14860 #include <unistd.h>
14861 #include <time.h>
14862 #include <string.h>
14863 #include <malloc.h>
14864 int main()
14865 {
14866     time_t t = time(0L);
14867     char w_tz[]="TZ" "=GMT+5",
14868          e_tz[]="TZ" "=GMT-5",
14869         *tz_e = (char*)malloc(16),
14870         *tz_w = (char*)malloc(16);
14871     struct tm tm_e, tm_w;
14872     memset(&tm_e,'\0',sizeof(struct tm));
14873     memset(&tm_w,'\0',sizeof(struct tm));
14874     strcpy(tz_e,e_tz);
14875     strcpy(tz_w,w_tz);
14876
14877     putenv(tz_e);
14878     localtime_r(&t, &tm_e);
14879
14880     putenv(tz_w);
14881     localtime_r(&t, &tm_w);
14882
14883     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
14884         return 1;
14885     return 0;
14886 }
14887 EOCP
14888         set try
14889         if eval $compile; then
14890             if $run ./try; then
14891                 d_localtime_r_needs_tzset=undef;
14892             else
14893                 d_localtime_r_needs_tzset=define;
14894             fi;
14895         else
14896             d_localtime_r_needs_tzset=undef;
14897         fi;
14898      ;;
14899   *)
14900      d_localtime_r_needs_tzset=undef;
14901      ;;
14902 esac
14903 $rm_try
14904
14905 : see if localeconv exists
14906 set localeconv d_locconv
14907 eval $inlibc
14908
14909 : see if lockf exists
14910 set lockf d_lockf
14911 eval $inlibc
14912
14913 : see if prototype for lseek is available
14914 echo " "
14915 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14916 eval $hasproto
14917
14918 : see if lstat exists
14919 set lstat d_lstat
14920 eval $inlibc
14921
14922 : see if madvise exists
14923 set madvise d_madvise
14924 eval $inlibc
14925
14926 : see if malloc_size exists
14927 set malloc_size d_malloc_size
14928 eval $inlibc
14929
14930 : see if malloc_size_good exists
14931 set malloc_good_size d_malloc_good_size
14932 eval $inlibc
14933
14934 : see if mblen exists
14935 set mblen d_mblen
14936 eval $inlibc
14937
14938 : see if mbstowcs exists
14939 set mbstowcs d_mbstowcs
14940 eval $inlibc
14941
14942 : see if mbtowc exists
14943 set mbtowc d_mbtowc
14944 eval $inlibc
14945
14946 : see if memchr exists
14947 set memchr d_memchr
14948 eval $inlibc
14949
14950 : see if memcmp exists
14951 set memcmp d_memcmp
14952 eval $inlibc
14953
14954 : see if memcpy exists
14955 set memcpy d_memcpy
14956 eval $inlibc
14957
14958 : see if memmove exists
14959 set memmove d_memmove
14960 eval $inlibc
14961
14962 : see if memset exists
14963 set memset d_memset
14964 eval $inlibc
14965
14966 : see if mkdir exists
14967 set mkdir d_mkdir
14968 eval $inlibc
14969
14970 : see if mkdtemp exists
14971 set mkdtemp d_mkdtemp
14972 eval $inlibc
14973
14974 : see if mkfifo exists
14975 set mkfifo d_mkfifo
14976 eval $inlibc
14977
14978 : see if mkstemp exists
14979 set mkstemp d_mkstemp
14980 eval $inlibc
14981
14982 : see if mkstemps exists
14983 set mkstemps d_mkstemps
14984 eval $inlibc
14985
14986 : see if mktime exists
14987 set mktime d_mktime
14988 eval $inlibc
14989
14990 : see if this is a sys/mman.h system
14991 set sys/mman.h i_sysmman
14992 eval $inhdr
14993
14994 : see if mmap exists
14995 set mmap d_mmap
14996 eval $inlibc
14997 : see what shmat returns
14998 : default to something harmless
14999 mmaptype='void *'
15000 case "$i_sysmman$d_mmap" in
15001 "$define$define")
15002         $cat >mmap.c <<'END'
15003 #include <sys/mman.h>
15004 void *mmap();
15005 END
15006         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15007                 mmaptype='void *'
15008         else
15009                 mmaptype='caddr_t'
15010         fi
15011         echo "and it returns ($mmaptype)." >&4
15012         ;;
15013 esac
15014
15015
15016
15017 : see if sqrtl exists
15018 set sqrtl d_sqrtl
15019 eval $inlibc
15020
15021 : see if scalbnl exists
15022 set scalbnl d_scalbnl
15023 eval $inlibc
15024
15025 : see if modfl exists
15026 set modfl d_modfl
15027 eval $inlibc
15028
15029 : see if prototype for modfl is available
15030 echo " "
15031 set d_modflproto modfl $i_math math.h
15032 eval $hasproto
15033
15034 d_modfl_pow32_bug="$undef"
15035
15036 case "$d_longdbl$d_modfl" in
15037 $define$define)
15038         $cat <<EOM
15039 Checking to see whether your modfl() is okay for large values...
15040 EOM
15041 $cat >try.c <<EOCP
15042 #include <math.h>
15043 #include <stdio.h>
15044 EOCP
15045 if $test "X$d_modflproto" != "X$define"; then
15046         $cat >>try.c <<EOCP
15047 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15048 long double modfl (long double, long double *);
15049 EOCP
15050 fi
15051 $cat >>try.c <<EOCP
15052 int main() {
15053     long double nv = 4294967303.15;
15054     long double v, w;
15055     v = modfl(nv, &w);
15056 #ifdef __GLIBC__
15057     printf("glibc");
15058 #endif
15059     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15060     return 0;
15061 }
15062 EOCP
15063         case "$osname:$gccversion" in
15064         aix:)   saveccflags="$ccflags"
15065                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15066         esac
15067         set try
15068         if eval $compile; then
15069                 foo=`$run ./try`
15070                 case "$foo" in
15071                 *" 4294967303.150000 1.150000 4294967302.000000")
15072                         echo >&4 "Your modfl() is broken for large values."
15073                         d_modfl_pow32_bug="$define"
15074                         case "$foo" in
15075                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15076                         ;;
15077                         esac
15078                         ;;
15079                 *" 4294967303.150000 0.150000 4294967303.000000")
15080                         echo >&4 "Your modfl() seems okay for large values."
15081                         ;;
15082                 *)      echo >&4 "I don't understand your modfl() at all."
15083                         d_modfl="$undef"
15084                         ;;
15085                 esac
15086                 $rm_try
15087         else
15088                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15089                 d_modfl="$undef"
15090         fi
15091         case "$osname:$gccversion" in
15092         aix:)   ccflags="$saveccflags" ;; # restore
15093         esac
15094         ;;
15095 esac
15096
15097 if $test "$uselongdouble" = "$define"; then
15098     message=""
15099     if $test "$d_sqrtl" != "$define"; then
15100         message="$message sqrtl"
15101     fi
15102     if $test "$d_modfl" != "$define"; then
15103         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15104             echo "You have both aintl and copysignl, so I can emulate modfl."
15105         else
15106             message="$message modfl"
15107         fi
15108     fi
15109     if $test "$d_frexpl" != "$define"; then
15110         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15111             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15112         else
15113             message="$message frexpl"
15114         fi
15115     fi
15116
15117     if $test "$message" != ""; then
15118         $cat <<EOM >&4
15119
15120 *** You requested the use of long doubles but you do not seem to have
15121 *** the following mathematical functions needed for long double support:
15122 ***    $message
15123 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15124 *** Cannot continue, aborting.
15125
15126 EOM
15127
15128         exit 1
15129     fi
15130 fi
15131
15132 : see if mprotect exists
15133 set mprotect d_mprotect
15134 eval $inlibc
15135
15136 : see if msgctl exists
15137 set msgctl d_msgctl
15138 eval $inlibc
15139
15140 : see if msgget exists
15141 set msgget d_msgget
15142 eval $inlibc
15143
15144 : see if msgsnd exists
15145 set msgsnd d_msgsnd
15146 eval $inlibc
15147
15148 : see if msgrcv exists
15149 set msgrcv d_msgrcv
15150 eval $inlibc
15151
15152 : see how much of the 'msg*(2)' library is present.
15153 h_msg=true
15154 echo " "
15155 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15156 *"$undef"*) h_msg=false;;
15157 esac
15158 case "$osname" in
15159 freebsd)
15160     case "`ipcs 2>&1`" in
15161     "SVID messages"*"not configured"*)
15162         echo "Your $osname does not have the msg*(2) configured." >&4
15163         h_msg=false
15164         val="$undef"
15165         set msgctl d_msgctl
15166         eval $setvar
15167         set msgget d_msgget
15168         eval $setvar
15169         set msgsnd d_msgsnd
15170         eval $setvar
15171         set msgrcv d_msgrcv
15172         eval $setvar
15173         ;;
15174     esac
15175     ;;
15176 esac
15177 : we could also check for sys/ipc.h ...
15178 if $h_msg && $test `./findhdr sys/msg.h`; then
15179         echo "You have the full msg*(2) library." >&4
15180         val="$define"
15181 else
15182         echo "You don't have the full msg*(2) library." >&4
15183         val="$undef"
15184 fi
15185 set d_msg
15186 eval $setvar
15187
15188
15189 echo " "
15190 echo "Checking to see if your system supports struct msghdr..." >&4
15191 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15192 eval $hasstruct
15193 case "$d_msghdr_s" in
15194 "$define")      echo "Yes, it does."   ;;
15195 *)              echo "No, it doesn't." ;;
15196 esac
15197
15198
15199 : see if msync exists
15200 set msync d_msync
15201 eval $inlibc
15202
15203 : see if munmap exists
15204 set munmap d_munmap
15205 eval $inlibc
15206
15207 : see if nice exists
15208 set nice d_nice
15209 eval $inlibc
15210
15211 : see if this is a langinfo.h system
15212 set langinfo.h i_langinfo
15213 eval $inhdr
15214
15215 : see if nl_langinfo exists
15216 set nl_langinfo d_nl_langinfo
15217 eval $inlibc
15218
15219 : check for volatile keyword
15220 echo " "
15221 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15222 $cat >try.c <<'EOCP'
15223 int main()
15224 {
15225         typedef struct _goo_struct goo_struct;
15226         goo_struct * volatile goo = ((goo_struct *)0);
15227         struct _goo_struct {
15228                 long long_int;
15229                 int reg_int;
15230                 char char_var;
15231         };
15232         typedef unsigned short foo_t;
15233         char *volatile foo;
15234         volatile int bar;
15235         volatile foo_t blech;
15236         foo = foo;
15237 }
15238 EOCP
15239 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15240         val="$define"
15241         echo "Yup, it does."
15242 else
15243         val="$undef"
15244         echo "Nope, it doesn't."
15245 fi
15246 set d_volatile
15247 eval $setvar
15248 $rm_try
15249
15250 : Check basic sizes
15251 echo " "
15252 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15253
15254 case "$use64bitint:$d_quad:$quadtype" in
15255 define:define:?*)
15256         ivtype="$quadtype"
15257         uvtype="$uquadtype"
15258         ivsize=8
15259         uvsize=8
15260         ;;
15261 *)      ivtype="long"
15262         uvtype="unsigned long"
15263         ivsize=$longsize
15264         uvsize=$longsize
15265         ;;
15266 esac
15267
15268 case "$uselongdouble:$d_longdbl" in
15269 define:define)
15270         nvtype="long double"
15271         nvsize=$longdblsize
15272         ;;
15273 *)      nvtype=double
15274         nvsize=$doublesize
15275         ;;
15276 esac
15277
15278 $echo "(IV will be "$ivtype", $ivsize bytes)"
15279 $echo "(UV will be "$uvtype", $uvsize bytes)"
15280 $echo "(NV will be "$nvtype", $nvsize bytes)"
15281
15282 $cat >try.c <<EOCP
15283 #$i_inttypes I_INTTYPES
15284 #ifdef I_INTTYPES
15285 #include <inttypes.h>
15286 #endif
15287 #include <stdio.h>
15288 int main() {
15289 #ifdef INT8
15290    int8_t i =  INT8_MAX;
15291   uint8_t u = UINT8_MAX;
15292   printf("int8_t\n");
15293 #endif
15294 #ifdef INT16
15295    int16_t i =  INT16_MAX;
15296   uint16_t i = UINT16_MAX;
15297   printf("int16_t\n");
15298 #endif
15299 #ifdef INT32
15300    int32_t i =  INT32_MAX;
15301   uint32_t u = UINT32_MAX;
15302   printf("int32_t\n");
15303 #endif
15304 }
15305 EOCP
15306
15307 i8type="signed char"
15308 u8type="unsigned char"
15309 i8size=1
15310 u8size=1
15311
15312 case "$i16type" in
15313 '')     case "$shortsize" in
15314         2)      i16type=short
15315                 u16type="unsigned short"
15316                 i16size=$shortsize
15317                 u16size=$shortsize
15318                 ;;
15319         esac
15320         ;;
15321 esac
15322 case "$i16type" in
15323 '')     set try -DINT16
15324         if eval $compile; then
15325                 case "`$run ./try`" in
15326                 int16_t)
15327                         i16type=int16_t
15328                         u16type=uint16_t
15329                         i16size=2
15330                         u16size=2
15331                         ;;
15332                 esac
15333         fi
15334         ;;
15335 esac
15336 case "$i16type" in
15337 '')     if $test $shortsize -ge 2; then
15338                 i16type=short
15339                 u16type="unsigned short"
15340                 i16size=$shortsize
15341                 u16size=$shortsize
15342         fi
15343         ;;
15344 esac
15345
15346 case "$i32type" in
15347 '')     case "$longsize" in
15348         4)      i32type=long
15349                 u32type="unsigned long"
15350                 i32size=$longsize
15351                 u32size=$longsize
15352                 ;;
15353         *)      case "$intsize" in
15354                 4)      i32type=int
15355                         u32type="unsigned int"
15356                         i32size=$intsize
15357                         u32size=$intsize
15358                         ;;
15359                 esac
15360                 ;;
15361         esac
15362         ;;
15363 esac
15364 case "$i32type" in
15365 '')     set try -DINT32
15366         if eval $compile; then
15367                 case "`$run ./try`" in
15368                 int32_t)
15369                         i32type=int32_t
15370                         u32type=uint32_t
15371                         i32size=4
15372                         u32size=4
15373                         ;;
15374                 esac
15375         fi
15376         ;;
15377 esac
15378 case "$i32type" in
15379 '')     if $test $intsize -ge 4; then
15380                 i32type=int
15381                 u32type="unsigned int"
15382                 i32size=$intsize
15383                 u32size=$intsize
15384         fi
15385         ;;
15386 esac
15387
15388 case "$i64type" in
15389 '')     case "$d_quad:$quadtype" in
15390         define:?*)
15391                 i64type="$quadtype"
15392                 u64type="$uquadtype"
15393                 i64size=8
15394                 u64size=8
15395                 ;;
15396         esac
15397         ;;
15398 esac
15399
15400 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15401 : volatile so that the compiler has to store it out to memory.
15402 if test X"$d_volatile" = X"$define"; then
15403         volatile=volatile
15404 fi
15405 $cat <<EOP >try.c
15406 #include <stdio.h>
15407 #$i_stdlib I_STDLIB
15408 #ifdef I_STDLIB
15409 #include <stdlib.h>
15410 #endif
15411 #include <sys/types.h>
15412 #include <signal.h>
15413 #ifdef SIGFPE
15414 $volatile int bletched = 0;
15415 $signal_t blech(int s) { bletched = 1; }
15416 #endif
15417 int main() {
15418     $uvtype u = 0;
15419     $nvtype d;
15420     int     n = 8 * $uvsize;
15421     int     i;
15422 #ifdef SIGFPE
15423     signal(SIGFPE, blech);
15424 #endif
15425
15426     for (i = 0; i < n; i++) {
15427       u = u << 1 | ($uvtype)1;
15428       d = ($nvtype)u;
15429       if (($uvtype)d != u)
15430         break;
15431       if (d <= 0)
15432         break;
15433       d = ($nvtype)(u - 1);
15434       if (($uvtype)d != (u - 1))
15435         break;
15436 #ifdef SIGFPE
15437       if (bletched)
15438         break;
15439 #endif
15440     }
15441     printf("%d\n", ((i == n) ? -n : i));
15442     exit(0);
15443 }
15444 EOP
15445 set try
15446
15447 d_nv_preserves_uv="$undef"
15448 if eval $compile; then
15449         nv_preserves_uv_bits="`$run ./try`"
15450 fi
15451 case "$nv_preserves_uv_bits" in
15452 \-[1-9]*)
15453         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15454         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15455         d_nv_preserves_uv="$define"
15456         ;;
15457 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15458         d_nv_preserves_uv="$undef" ;;
15459 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15460         nv_preserves_uv_bits="0" ;;
15461 esac
15462 $rm_try
15463
15464 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15465 : volatile so that the compiler has to store it out to memory.
15466 if test X"$d_volatile" = X"$define"; then
15467         volatile=volatile
15468 fi
15469 $cat <<EOP >try.c
15470 #include <stdio.h>
15471 #$i_stdlib I_STDLIB
15472 #ifdef I_STDLIB
15473 #include <stdlib.h>
15474 #endif
15475 #$i_string I_STRING
15476 #ifdef I_STRING
15477 #  include <string.h>
15478 #else
15479 #  include <strings.h>
15480 #endif
15481 #include <sys/types.h>
15482 #include <signal.h>
15483 #ifdef SIGFPE
15484 $volatile int bletched = 0;
15485 $signal_t blech(int s) { bletched = 1; }
15486 #endif
15487
15488 int checkit($nvtype d, char *where) {
15489     unsigned char *p = (char *)&d;
15490     unsigned char *end = p + sizeof(d);
15491     int fail = 0;
15492
15493     while (p < end)
15494         fail += *p++;
15495
15496     if (!fail)
15497         return 0;
15498
15499     p = (char *)&d;
15500     printf("No - %s: 0x", where);
15501     while (p < end)
15502         printf ("%02X", *p++);
15503     printf("\n");
15504     return 1;
15505 }
15506
15507 int main(int argc, char **argv) {
15508     $nvtype d = 0.0;
15509     int fail = 0;
15510     fail += checkit(d, "0.0");
15511
15512     /* The compiler shouldn't be assuming that bletched is 0  */
15513     d = bletched;
15514
15515     fail += checkit(d, "bleched");
15516
15517 #ifdef SIGFPE
15518     signal(SIGFPE, blech);
15519 #endif
15520
15521     /* Paranoia - the compiler should have no way of knowing that ANSI says
15522        that argv[argc] will always be NULL.  Actually, if it did assume this it
15523        would be buggy, as this is C and main() can be called from elsewhere in
15524        the program.  */
15525     d = argv[argc] ? 1 : 0;
15526
15527     if (d) {
15528         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15529     }
15530
15531     fail += checkit(d, "ternary");
15532
15533     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15534
15535     if (d != 0.0) {
15536         printf("No - memset doesn't give 0.0\n");
15537         /* This might just blow up:  */
15538         printf("(gives %g)\n", d);
15539         return 1;
15540     }
15541
15542 #ifdef SIGFPE
15543     if (bletched) {
15544         printf("No - something bleched\n");
15545         return 1;
15546     }
15547 #endif
15548     if (fail) {
15549       printf("No - %d fail(s)\n", fail);
15550       return 1;
15551     }
15552     printf("Yes\n");
15553     return 0;
15554 }
15555 EOP
15556 set try
15557
15558 d_nv_zero_is_allbits_zero="$undef"
15559 if eval $compile; then
15560     xxx="`$run ./try`"
15561     case "$?" in
15562         0)
15563             case "$xxx" in
15564                 Yes)  cat >&4 <<EOM
15565 0.0 is represented as all bits zero in memory
15566 EOM
15567                     d_nv_zero_is_allbits_zero="$define"
15568                     ;;
15569                 *)  cat >&4 <<EOM
15570 0.0 is not represented as all bits zero in memory
15571 EOM
15572                     d_nv_zero_is_allbits_zero="$undef"
15573                     ;;
15574             esac
15575             ;;
15576         *)  cat >&4 <<EOM
15577 0.0 is not represented as all bits zero in memory
15578 EOM
15579             d_nv_zero_is_allbits_zero="$undef"
15580             ;;
15581     esac
15582 fi
15583 $rm_try
15584
15585 : check for off64_t
15586 echo " "
15587 echo "Checking to see if you have off64_t..." >&4
15588 $cat >try.c <<EOCP
15589 #include <sys/types.h>
15590 #include <unistd.h>
15591 int main() { off64_t x = 7; }
15592 EOCP
15593 set try
15594 if eval $compile; then
15595         val="$define"
15596         echo "You have off64_t."
15597 else
15598         val="$undef"
15599         echo "You do not have off64_t."
15600         case "$lseeksize" in
15601         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15602         esac
15603 fi
15604 $rm_try
15605 set d_off64_t
15606 eval $setvar
15607
15608 : how to create joinable pthreads
15609 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15610         echo " "
15611         echo "Checking what constant to use for creating joinable pthreads..." >&4
15612         $cat >try.c <<'EOCP'
15613 #include <pthread.h>
15614 int main() {
15615     int detachstate = JOINABLE;
15616 }
15617 EOCP
15618         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15619         if eval $compile; then
15620                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15621                 val="$undef" # Yes, undef.
15622                 set d_old_pthread_create_joinable
15623                 eval $setvar
15624                 val=""
15625                 set old_pthread_create_joinable
15626                 eval $setvar
15627         else
15628                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15629                 if eval $compile; then
15630                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15631                         val="$define"
15632                         set d_old_pthread_create_joinable
15633                         eval $setvar
15634                         val=PTHREAD_CREATE_UNDETACHED
15635                         set old_pthread_create_joinable
15636                         eval $setvar
15637                 else
15638                         set try -DJOINABLE=__UNDETACHED
15639                         if eval $compile; then
15640                                 echo "You seem to use __UNDETACHED." >&4
15641                                 val="$define"
15642                                 set d_old_pthread_create_joinable
15643                                 eval $setvar
15644                                 val=__UNDETACHED
15645                                 set old_pthread_create_joinable
15646                                 eval $setvar
15647                         else
15648                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15649                                 val="$define"
15650                                 set d_old_pthread_create_joinable
15651                                 eval $setvar
15652                                 val=0
15653                                 set old_pthread_create_joinable
15654                                 eval $setvar
15655                         fi
15656                 fi
15657         fi
15658         $rm_try
15659 else
15660     d_old_pthread_create_joinable="$undef"
15661     old_pthread_create_joinable=""
15662 fi
15663
15664 : see if pause exists
15665 set pause d_pause
15666 eval $inlibc
15667
15668 : see if poll exists
15669 set poll d_poll
15670 eval $inlibc
15671
15672 : see if readlink exists
15673 set readlink d_readlink
15674 eval $inlibc
15675
15676 : Check if exe is symlink to abs path of executing program
15677 echo " "
15678 procselfexe=''
15679 val="$undef"
15680 case "$d_readlink" in
15681 "$define")
15682         if $issymlink /proc/self/exe ; then
15683                 $ls -l /proc/self/exe > reflect
15684                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15685                         echo "You have Linux-like /proc/self/exe."
15686                         procselfexe='"/proc/self/exe"'
15687                         val="$define"
15688                 fi
15689         fi
15690         if $issymlink /proc/curproc/file ; then
15691                 $ls -l /proc/curproc/file > reflect
15692                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15693                         echo "You have BSD-like /proc/curproc/file."
15694                         procselfexe='"/proc/curproc/file"'
15695                         val="$define"
15696                 fi
15697         fi
15698         ;;
15699 esac
15700 $rm -f reflect
15701 set d_procselfexe
15702 eval $setvar
15703
15704 : backward compatibility for d_hvfork
15705 if test X$d_hvfork != X; then
15706         d_vfork="$d_hvfork"
15707         d_hvfork=''
15708 fi
15709 : see if there is a vfork
15710 val=''
15711 set vfork val
15712 eval $inlibc
15713
15714 d_pseudofork=$undef
15715
15716 : Ok, but do we want to use it. vfork is reportedly unreliable in
15717 : perl on Solaris 2.x, and probably elsewhere.
15718 case "$val" in
15719 $define)
15720         echo " "
15721         case "$usevfork" in
15722         false) dflt='n';;
15723         *) dflt='y';;
15724         esac
15725         cat <<'EOM'
15726
15727 Perl can only use a vfork() that doesn't suffer from strict
15728 restrictions on calling functions or modifying global data in
15729 the child.  For example, glibc-2.1 contains such a vfork()
15730 that is unsuitable.  If your system provides a proper fork()
15731 call, chances are that you do NOT want perl to use vfork().
15732
15733 EOM
15734         rp="Do you still want to use vfork()?"
15735         . ./myread
15736         case "$ans" in
15737         y|Y) ;;
15738         *)
15739                 echo "Ok, we won't use vfork()."
15740                 val="$undef"
15741                 ;;
15742         esac
15743         ;;
15744 esac
15745 set d_vfork
15746 eval $setvar
15747 case "$d_vfork" in
15748 $define) usevfork='true';;
15749 *) usevfork='false';;
15750 esac
15751
15752 : see whether the pthread_atfork exists
15753 $cat >try.c <<EOP
15754 #include <pthread.h>
15755 #include <stdio.h>
15756 int main() {
15757 #ifdef  PTHREAD_ATFORK
15758         pthread_atfork(NULL,NULL,NULL);
15759 #endif
15760 }
15761 EOP
15762
15763 : see if pthread_atfork exists
15764 set try -DPTHREAD_ATFORK
15765 if eval $compile; then
15766     val="$define"
15767 else
15768     val="$undef"
15769 fi
15770 case "$usethreads" in
15771 $define)
15772         case "$val" in
15773         $define) echo 'pthread_atfork found.' >&4        ;;
15774         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15775         esac
15776 esac
15777 set d_pthread_atfork
15778 eval $setvar
15779
15780 : see if pthread_attr_setscope exists
15781 set pthread_attr_setscope d_pthread_attr_setscope
15782 eval $inlibc
15783
15784
15785 : see whether the various POSIXish _yields exist
15786 $cat >try.c <<EOP
15787 #include <pthread.h>
15788 #include <stdio.h>
15789 int main() {
15790 #ifdef SCHED_YIELD
15791         sched_yield();
15792 #else
15793 #ifdef PTHREAD_YIELD
15794         pthread_yield();
15795 #else
15796 #ifdef PTHREAD_YIELD_NULL
15797         pthread_yield(NULL);
15798 #endif
15799 #endif
15800 #endif
15801 }
15802 EOP
15803 : see if sched_yield exists
15804 set try -DSCHED_YIELD
15805 if eval $compile; then
15806     val="$define"
15807     sched_yield='sched_yield()'
15808 else
15809     val="$undef"
15810 fi
15811 case "$usethreads" in
15812 $define)
15813         case "$val" in
15814         $define) echo 'sched_yield() found.' >&4        ;;
15815         *)       echo 'sched_yield() NOT found.' >&4    ;;
15816         esac
15817 esac
15818 set d_sched_yield
15819 eval $setvar
15820
15821 : see if pthread_yield exists
15822 set try -DPTHREAD_YIELD
15823 if eval $compile; then
15824     val="$define"
15825     case "$sched_yield" in
15826     '') sched_yield='pthread_yield()' ;;
15827     esac
15828 else
15829     set try -DPTHREAD_YIELD_NULL
15830     if eval $compile; then
15831         val="$define"
15832         case "$sched_yield" in
15833         '') sched_yield='pthread_yield(NULL)' ;;
15834         esac
15835     else
15836         val="$undef"
15837     fi
15838 fi
15839 case "$usethreads" in
15840 $define)
15841         case "$val" in
15842         $define) echo 'pthread_yield() found.' >&4      ;;
15843         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15844         esac
15845         ;;
15846 esac
15847 set d_pthread_yield
15848 eval $setvar
15849 case "$sched_yield" in
15850 '') sched_yield=undef ;;
15851 esac
15852 $rm_try
15853
15854 : see if random_r exists
15855 set random_r d_random_r
15856 eval $inlibc
15857 case "$d_random_r" in
15858 "$define")
15859         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15860         case "$d_random_r_proto:$usethreads" in
15861         ":define")      d_random_r_proto=define
15862                 set d_random_r_proto random_r $hdrs
15863                 eval $hasproto ;;
15864         *)      ;;
15865         esac
15866         case "$d_random_r_proto" in
15867         define)
15868         case "$random_r_proto" in
15869         ''|0) try='int random_r(int*, struct random_data*);'
15870         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15871         esac
15872         case "$random_r_proto" in
15873         ''|0) try='int random_r(long*, struct random_data*);'
15874         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15875         esac
15876         case "$random_r_proto" in
15877         ''|0) try='int random_r(struct random_data*, int32_t*);'
15878         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15879         esac
15880         case "$random_r_proto" in
15881         ''|0)   d_random_r=undef
15882                 random_r_proto=0
15883                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
15884         * )     case "$random_r_proto" in
15885                 REENTRANT_PROTO*) ;;
15886                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15887                 esac
15888                 echo "Prototype: $try" ;;
15889         esac
15890         ;;
15891         *)      case "$usethreads" in
15892                 define) echo "random_r has no prototype, not using it." >&4 ;;
15893                 esac
15894                 d_random_r=undef
15895                 random_r_proto=0
15896                 ;;
15897         esac
15898         ;;
15899 *)      random_r_proto=0
15900         ;;
15901 esac
15902
15903 : see if readdir and friends exist
15904 set readdir d_readdir
15905 eval $inlibc
15906 set seekdir d_seekdir
15907 eval $inlibc
15908 set telldir d_telldir
15909 eval $inlibc
15910 set rewinddir d_rewinddir
15911 eval $inlibc
15912
15913 : see if readdir64_r exists
15914 set readdir64_r d_readdir64_r
15915 eval $inlibc
15916 case "$d_readdir64_r" in
15917 "$define")
15918         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15919         case "$d_readdir64_r_proto:$usethreads" in
15920         ":define")      d_readdir64_r_proto=define
15921                 set d_readdir64_r_proto readdir64_r $hdrs
15922                 eval $hasproto ;;
15923         *)      ;;
15924         esac
15925         case "$d_readdir64_r_proto" in
15926         define)
15927         case "$readdir64_r_proto" in
15928         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15929         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15930         esac
15931         case "$readdir64_r_proto" in
15932         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15933         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15934         esac
15935         case "$readdir64_r_proto" in
15936         ''|0)   d_readdir64_r=undef
15937                 readdir64_r_proto=0
15938                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
15939         * )     case "$readdir64_r_proto" in
15940                 REENTRANT_PROTO*) ;;
15941                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15942                 esac
15943                 echo "Prototype: $try" ;;
15944         esac
15945         ;;
15946         *)      case "$usethreads" in
15947                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15948                 esac
15949                 d_readdir64_r=undef
15950                 readdir64_r_proto=0
15951                 ;;
15952         esac
15953         ;;
15954 *)      readdir64_r_proto=0
15955         ;;
15956 esac
15957
15958 : see if readdir_r exists
15959 set readdir_r d_readdir_r
15960 eval $inlibc
15961 case "$d_readdir_r" in
15962 "$define")
15963         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15964         case "$d_readdir_r_proto:$usethreads" in
15965         ":define")      d_readdir_r_proto=define
15966                 set d_readdir_r_proto readdir_r $hdrs
15967                 eval $hasproto ;;
15968         *)      ;;
15969         esac
15970         case "$d_readdir_r_proto" in
15971         define)
15972         case "$readdir_r_proto" in
15973         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15974         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15975         esac
15976         case "$readdir_r_proto" in
15977         ''|0) try='int readdir_r(DIR*, struct dirent*);'
15978         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15979         esac
15980         case "$readdir_r_proto" in
15981         ''|0)   d_readdir_r=undef
15982                 readdir_r_proto=0
15983                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
15984         * )     case "$readdir_r_proto" in
15985                 REENTRANT_PROTO*) ;;
15986                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15987                 esac
15988                 echo "Prototype: $try" ;;
15989         esac
15990         ;;
15991         *)      case "$usethreads" in
15992                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15993                 esac
15994                 d_readdir_r=undef
15995                 readdir_r_proto=0
15996                 ;;
15997         esac
15998         ;;
15999 *)      readdir_r_proto=0
16000         ;;
16001 esac
16002
16003 : see if readv exists
16004 set readv d_readv
16005 eval $inlibc
16006
16007 : see if recvmsg exists
16008 set recvmsg d_recvmsg
16009 eval $inlibc
16010
16011 : see if rename exists
16012 set rename d_rename
16013 eval $inlibc
16014
16015 : see if rmdir exists
16016 set rmdir d_rmdir
16017 eval $inlibc
16018
16019 : see if memory.h is available.
16020 val=''
16021 set memory.h val
16022 eval $inhdr
16023
16024 : See if it conflicts with string.h
16025 case "$val" in
16026 $define)
16027         case "$strings" in
16028         '') ;;
16029         *)
16030                 $cppstdin $cppflags $cppminus < $strings > mem.h
16031                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16032                         echo " "
16033                         echo "We won't be including <memory.h>."
16034                         val="$undef"
16035                 fi
16036                 $rm -f mem.h
16037                 ;;
16038         esac
16039 esac
16040 set i_memory
16041 eval $setvar
16042
16043 : can bcopy handle overlapping blocks?
16044 echo " "
16045 val="$undef"
16046 case "$d_memmove" in
16047 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16048 *)      case "$d_bcopy" in
16049         "$define")
16050                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16051                 $cat >try.c <<EOCP
16052 #$i_memory I_MEMORY
16053 #$i_stdlib I_STDLIB
16054 #$i_string I_STRING
16055 #$i_unistd I_UNISTD
16056 EOCP
16057         $cat >>try.c <<'EOCP'
16058 #include <stdio.h>
16059 #ifdef I_MEMORY
16060 #  include <memory.h>
16061 #endif
16062 #ifdef I_STDLIB
16063 #  include <stdlib.h>
16064 #endif
16065 #ifdef I_STRING
16066 #  include <string.h>
16067 #else
16068 #  include <strings.h>
16069 #endif
16070 #ifdef I_UNISTD
16071 #  include <unistd.h>  /* Needed for NetBSD */
16072 #endif
16073 int main()
16074 {
16075 char buf[128], abc[128];
16076 char *b;
16077 int len;
16078 int off;
16079 int align;
16080
16081 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16082    try to store the string in read-only memory. */
16083 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16084
16085 for (align = 7; align >= 0; align--) {
16086         for (len = 36; len; len--) {
16087                 b = buf+align;
16088                 bcopy(abc, b, len);
16089                 for (off = 1; off <= len; off++) {
16090                         bcopy(b, b+off, len);
16091                         bcopy(b+off, b, len);
16092                         if (bcmp(b, abc, len))
16093                                 exit(1);
16094                 }
16095         }
16096 }
16097 exit(0);
16098 }
16099 EOCP
16100                 set try
16101                 if eval $compile_ok; then
16102                         if $run ./try 2>/dev/null; then
16103                                 echo "Yes, it can."
16104                                 val="$define"
16105                         else
16106                                 echo "It can't, sorry."
16107                         fi
16108                 else
16109                         echo "(I can't compile the test program, so we'll assume not...)"
16110                 fi
16111                 ;;
16112         esac
16113         $rm_try
16114         ;;
16115 esac
16116 set d_safebcpy
16117 eval $setvar
16118
16119 : can memcpy handle overlapping blocks?
16120 echo " "
16121 val="$undef"
16122 case "$d_memmove" in
16123 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16124 *)      case "$d_memcpy" in
16125         "$define")
16126                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16127                 $cat >try.c <<EOCP
16128 #$i_memory I_MEMORY
16129 #$i_stdlib I_STDLIB
16130 #$i_string I_STRING
16131 #$i_unistd I_UNISTD
16132 EOCP
16133         $cat >>try.c <<'EOCP'
16134 #include <stdio.h>
16135 #ifdef I_MEMORY
16136 #  include <memory.h>
16137 #endif
16138 #ifdef I_STDLIB
16139 #  include <stdlib.h>
16140 #endif
16141 #ifdef I_STRING
16142 #  include <string.h>
16143 #else
16144 #  include <strings.h>
16145 #endif
16146 #ifdef I_UNISTD
16147 #  include <unistd.h>  /* Needed for NetBSD */
16148 #endif
16149 int main()
16150 {
16151 char buf[128], abc[128];
16152 char *b;
16153 int len;
16154 int off;
16155 int align;
16156
16157 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16158    try to store the string in read-only memory. */
16159 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16160
16161 for (align = 7; align >= 0; align--) {
16162         for (len = 36; len; len--) {
16163                 b = buf+align;
16164                 memcpy(b, abc, len);
16165                 for (off = 1; off <= len; off++) {
16166                         memcpy(b+off, b, len);
16167                         memcpy(b, b+off, len);
16168                         if (memcmp(b, abc, len))
16169                                 exit(1);
16170                 }
16171         }
16172 }
16173 exit(0);
16174 }
16175 EOCP
16176                 set try
16177                 if eval $compile_ok; then
16178                         if $run ./try 2>/dev/null; then
16179                                 echo "Yes, it can."
16180                                 val="$define"
16181                         else
16182                                 echo "It can't, sorry."
16183                         fi
16184                 else
16185                         echo "(I can't compile the test program, so we'll assume not...)"
16186                 fi
16187                 ;;
16188         esac
16189         $rm_try
16190         ;;
16191 esac
16192 set d_safemcpy
16193 eval $setvar
16194
16195 : can memcmp be trusted to compare relative magnitude?
16196 val="$undef"
16197 case "$d_memcmp" in
16198 "$define")
16199         echo " "
16200         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16201         $cat >try.c <<EOCP
16202 #$i_memory I_MEMORY
16203 #$i_stdlib I_STDLIB
16204 #$i_string I_STRING
16205 #$i_unistd I_UNISTD
16206 EOCP
16207         $cat >>try.c <<'EOCP'
16208 #include <stdio.h>
16209 #ifdef I_MEMORY
16210 #  include <memory.h>
16211 #endif
16212 #ifdef I_STDLIB
16213 #  include <stdlib.h>
16214 #endif
16215 #ifdef I_STRING
16216 #  include <string.h>
16217 #else
16218 #  include <strings.h>
16219 #endif
16220 #ifdef I_UNISTD
16221 #  include <unistd.h>  /* Needed for NetBSD */
16222 #endif
16223 int main()
16224 {
16225 char a = -1;
16226 char b = 0;
16227 if ((a < b) && memcmp(&a, &b, 1) < 0)
16228         exit(1);
16229 exit(0);
16230 }
16231 EOCP
16232         set try
16233         if eval $compile_ok; then
16234                 if $run ./try 2>/dev/null; then
16235                         echo "Yes, it can."
16236                         val="$define"
16237                 else
16238                         echo "No, it can't (it uses signed chars)."
16239                 fi
16240         else
16241                 echo "(I can't compile the test program, so we'll assume not...)"
16242         fi
16243         ;;
16244 esac
16245 $rm_try
16246 set d_sanemcmp
16247 eval $setvar
16248
16249 : see if prototype for sbrk is available
16250 echo " "
16251 set d_sbrkproto sbrk $i_unistd unistd.h
16252 eval $hasproto
16253
16254 : see if select exists
16255 set select d_select
16256 eval $inlibc
16257
16258 : see if semctl exists
16259 set semctl d_semctl
16260 eval $inlibc
16261
16262 : see if semget exists
16263 set semget d_semget
16264 eval $inlibc
16265
16266 : see if semop exists
16267 set semop d_semop
16268 eval $inlibc
16269
16270 : see how much of the 'sem*(2)' library is present.
16271 h_sem=true
16272 echo " "
16273 case "$d_semctl$d_semget$d_semop" in
16274 *"$undef"*) h_sem=false;;
16275 esac
16276 case "$osname" in
16277 freebsd)
16278     case "`ipcs 2>&1`" in
16279     "SVID messages"*"not configured"*)
16280         echo "Your $osname does not have the sem*(2) configured." >&4
16281         h_sem=false
16282         val="$undef"
16283         set semctl d_semctl
16284         eval $setvar
16285         set semget d_semget
16286         eval $setvar
16287         set semop d_semop
16288         eval $setvar
16289         ;;
16290     esac
16291     ;;
16292 esac
16293 : we could also check for sys/ipc.h ...
16294 if $h_sem && $test `./findhdr sys/sem.h`; then
16295         echo "You have the full sem*(2) library." >&4
16296         val="$define"
16297 else
16298         echo "You don't have the full sem*(2) library." >&4
16299         val="$undef"
16300 fi
16301 set d_sem
16302 eval $setvar
16303
16304 : see whether sys/sem.h defines union semun
16305 echo " "
16306 $cat > try.c <<'END'
16307 #include <sys/types.h>
16308 #include <sys/ipc.h>
16309 #include <sys/sem.h>
16310 int main () { union semun semun; semun.buf = 0; }
16311 END
16312 set try
16313 if eval $compile; then
16314     echo "You have union semun in <sys/sem.h>." >&4
16315     val="$define"
16316 else
16317     echo "You do not have union semun in <sys/sem.h>." >&4
16318     val="$undef"
16319 fi
16320 $rm_try
16321 set d_union_semun
16322 eval $setvar
16323
16324 : see how to do semctl IPC_STAT
16325 case "$d_sem" in
16326 $define)
16327     echo " "
16328     $cat > tryh.h <<END
16329 #ifndef S_IRUSR
16330 #   ifdef S_IREAD
16331 #       define S_IRUSR S_IREAD
16332 #       define S_IWUSR S_IWRITE
16333 #       define S_IXUSR S_IEXEC
16334 #   else
16335 #       define S_IRUSR 0400
16336 #       define S_IWUSR 0200
16337 #       define S_IXUSR 0100
16338 #   endif
16339 #   define S_IRGRP (S_IRUSR>>3)
16340 #   define S_IWGRP (S_IWUSR>>3)
16341 #   define S_IXGRP (S_IXUSR>>3)
16342 #   define S_IROTH (S_IRUSR>>6)
16343 #   define S_IWOTH (S_IWUSR>>6)
16344 #   define S_IXOTH (S_IXUSR>>6)
16345 #endif
16346 #ifndef S_IRWXU
16347 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16348 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16349 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16350 #endif
16351 END
16352     : see whether semctl IPC_STAT can use union semun
16353     case "$d_semctl_semun" in
16354     '')
16355       val="$undef"
16356       $cat > try.c <<END
16357 #include <sys/types.h>
16358 #include <sys/ipc.h>
16359 #include <sys/sem.h>
16360 #include <sys/stat.h>
16361 #include <stdio.h>
16362 #include <errno.h>
16363 #include "tryh.h"
16364 #ifndef errno
16365 extern int errno;
16366 #endif
16367 #$d_union_semun HAS_UNION_SEMUN
16368 int main() {
16369     union semun
16370 #ifndef HAS_UNION_SEMUN
16371     {
16372         int val;
16373         struct semid_ds *buf;
16374         unsigned short *array;
16375     }
16376 #endif
16377     arg;
16378     int sem, st;
16379
16380 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16381     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16382     if (sem > -1) {
16383         struct semid_ds argbuf;
16384         arg.buf = &argbuf;
16385 #       ifdef IPC_STAT
16386         st = semctl(sem, 0, IPC_STAT, arg);
16387         if (st == 0)
16388             printf("semun\n");
16389         else
16390 #       endif /* IPC_STAT */
16391             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16392 #       ifdef IPC_RMID
16393         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16394 #       endif /* IPC_RMID */
16395             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16396     } else
16397 #endif /* IPC_PRIVATE && ... */
16398         printf("semget failed: errno = %d\n", errno);
16399   return 0;
16400 }
16401 END
16402       set try
16403       if eval $compile; then
16404           xxx=`$run ./try`
16405           case "$xxx" in
16406           semun) val="$define" ;;
16407           esac
16408       fi
16409       $rm_try
16410       set d_semctl_semun
16411       eval $setvar
16412       ;;
16413     esac
16414     case "$d_semctl_semun" in
16415     $define)
16416         echo "You can use union semun for semctl IPC_STAT." >&4
16417         also='also'
16418         ;;
16419     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16420         also=''
16421         ;;
16422     esac
16423
16424     : see whether semctl IPC_STAT can use struct semid_ds pointer
16425     case "$d_semctl_semid_ds" in
16426     '')
16427       val="$undef"
16428       $cat > try.c <<'END'
16429 #include <sys/types.h>
16430 #include <sys/ipc.h>
16431 #include <sys/sem.h>
16432 #include <sys/stat.h>
16433 #include "tryh.h"
16434 #include <stdio.h>
16435 #include <errno.h>
16436 #ifndef errno
16437 extern int errno;
16438 #endif
16439 int main() {
16440     struct semid_ds arg;
16441     int sem, st;
16442
16443 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16444     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16445     if (sem > -1) {
16446 #       ifdef IPC_STAT
16447         st = semctl(sem, 0, IPC_STAT, &arg);
16448         if (st == 0)
16449             printf("semid_ds\n");
16450         else
16451 #       endif /* IPC_STAT */
16452             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16453 #       ifdef IPC_RMID
16454         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16455 #       endif /* IPC_RMID */
16456             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16457     } else
16458 #endif /* IPC_PRIVATE && ... */
16459         printf("semget failed: errno = %d\n", errno);
16460
16461     return 0;
16462 }
16463 END
16464       set try
16465       if eval $compile; then
16466           xxx=`$run ./try`
16467           case "$xxx" in
16468           semid_ds) val="$define" ;;
16469           esac
16470       fi
16471       $rm_try
16472       set d_semctl_semid_ds
16473       eval $setvar
16474       ;;
16475     esac
16476     case "$d_semctl_semid_ds" in
16477     $define)
16478         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16479         ;;
16480     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16481         ;;
16482     esac
16483     ;;
16484 *)  val="$undef"
16485
16486     # We do not have the full sem*(2) library, so assume we can not
16487     # use either.
16488
16489     set d_semctl_semun
16490     eval $setvar
16491
16492     set d_semctl_semid_ds
16493     eval $setvar
16494     ;;
16495 esac
16496 $rm_try tryh.h
16497
16498 : see if sendmsg exists
16499 set sendmsg d_sendmsg
16500 eval $inlibc
16501
16502 : see if setegid exists
16503 set setegid d_setegid
16504 eval $inlibc
16505
16506 : see if seteuid exists
16507 set seteuid d_seteuid
16508 eval $inlibc
16509
16510 : see if setgrent exists
16511 set setgrent d_setgrent
16512 eval $inlibc
16513
16514 : see if setgrent_r exists
16515 set setgrent_r d_setgrent_r
16516 eval $inlibc
16517 case "$d_setgrent_r" in
16518 "$define")
16519         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16520         case "$d_setgrent_r_proto:$usethreads" in
16521         ":define")      d_setgrent_r_proto=define
16522                 set d_setgrent_r_proto setgrent_r $hdrs
16523                 eval $hasproto ;;
16524         *)      ;;
16525         esac
16526         case "$d_setgrent_r_proto" in
16527         define)
16528         case "$setgrent_r_proto" in
16529         ''|0) try='int setgrent_r(FILE**);'
16530         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
16531         esac
16532         case "$setgrent_r_proto" in
16533         ''|0) try='void setgrent_r(FILE**);'
16534         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
16535         esac
16536         case "$setgrent_r_proto" in
16537         ''|0)   d_setgrent_r=undef
16538                 setgrent_r_proto=0
16539                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16540         * )     case "$setgrent_r_proto" in
16541                 REENTRANT_PROTO*) ;;
16542                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16543                 esac
16544                 echo "Prototype: $try" ;;
16545         esac
16546         ;;
16547         *)      case "$usethreads" in
16548                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16549                 esac
16550                 d_setgrent_r=undef
16551                 setgrent_r_proto=0
16552                 ;;
16553         esac
16554         ;;
16555 *)      setgrent_r_proto=0
16556         ;;
16557 esac
16558
16559 : see if sethostent exists
16560 set sethostent d_sethent
16561 eval $inlibc
16562
16563 : see if sethostent_r exists
16564 set sethostent_r d_sethostent_r
16565 eval $inlibc
16566 case "$d_sethostent_r" in
16567 "$define")
16568         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16569         case "$d_sethostent_r_proto:$usethreads" in
16570         ":define")      d_sethostent_r_proto=define
16571                 set d_sethostent_r_proto sethostent_r $hdrs
16572                 eval $hasproto ;;
16573         *)      ;;
16574         esac
16575         case "$d_sethostent_r_proto" in
16576         define)
16577         case "$sethostent_r_proto" in
16578         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16579         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16580         esac
16581         case "$sethostent_r_proto" in
16582         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16583         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16584         esac
16585         case "$sethostent_r_proto" in
16586         ''|0)   d_sethostent_r=undef
16587                 sethostent_r_proto=0
16588                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16589         * )     case "$sethostent_r_proto" in
16590                 REENTRANT_PROTO*) ;;
16591                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16592                 esac
16593                 echo "Prototype: $try" ;;
16594         esac
16595         ;;
16596         *)      case "$usethreads" in
16597                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16598                 esac
16599                 d_sethostent_r=undef
16600                 sethostent_r_proto=0
16601                 ;;
16602         esac
16603         ;;
16604 *)      sethostent_r_proto=0
16605         ;;
16606 esac
16607
16608 : see if setitimer exists
16609 set setitimer d_setitimer
16610 eval $inlibc
16611
16612 : see if setlinebuf exists
16613 set setlinebuf d_setlinebuf
16614 eval $inlibc
16615
16616 : see if setlocale exists
16617 set setlocale d_setlocale
16618 eval $inlibc
16619
16620 : see if locale.h is available
16621 set locale.h i_locale
16622 eval $inhdr
16623
16624 : see if setlocale_r exists
16625 set setlocale_r d_setlocale_r
16626 eval $inlibc
16627 case "$d_setlocale_r" in
16628 "$define")
16629         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16630         case "$d_setlocale_r_proto:$usethreads" in
16631         ":define")      d_setlocale_r_proto=define
16632                 set d_setlocale_r_proto setlocale_r $hdrs
16633                 eval $hasproto ;;
16634         *)      ;;
16635         esac
16636         case "$d_setlocale_r_proto" in
16637         define)
16638         case "$setlocale_r_proto" in
16639         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16640         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16641         esac
16642         case "$setlocale_r_proto" in
16643         ''|0)   d_setlocale_r=undef
16644                 setlocale_r_proto=0
16645                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16646         * )     case "$setlocale_r_proto" in
16647                 REENTRANT_PROTO*) ;;
16648                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16649                 esac
16650                 echo "Prototype: $try" ;;
16651         esac
16652         ;;
16653         *)      case "$usethreads" in
16654                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16655                 esac
16656                 d_setlocale_r=undef
16657                 setlocale_r_proto=0
16658                 ;;
16659         esac
16660         ;;
16661 *)      setlocale_r_proto=0
16662         ;;
16663 esac
16664
16665 : see if setnetent exists
16666 set setnetent d_setnent
16667 eval $inlibc
16668
16669 : see if setnetent_r exists
16670 set setnetent_r d_setnetent_r
16671 eval $inlibc
16672 case "$d_setnetent_r" in
16673 "$define")
16674         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16675         case "$d_setnetent_r_proto:$usethreads" in
16676         ":define")      d_setnetent_r_proto=define
16677                 set d_setnetent_r_proto setnetent_r $hdrs
16678                 eval $hasproto ;;
16679         *)      ;;
16680         esac
16681         case "$d_setnetent_r_proto" in
16682         define)
16683         case "$setnetent_r_proto" in
16684         ''|0) try='int setnetent_r(int, struct netent_data*);'
16685         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16686         esac
16687         case "$setnetent_r_proto" in
16688         ''|0) try='void setnetent_r(int, struct netent_data*);'
16689         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16690         esac
16691         case "$setnetent_r_proto" in
16692         ''|0)   d_setnetent_r=undef
16693                 setnetent_r_proto=0
16694                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16695         * )     case "$setnetent_r_proto" in
16696                 REENTRANT_PROTO*) ;;
16697                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16698                 esac
16699                 echo "Prototype: $try" ;;
16700         esac
16701         ;;
16702         *)      case "$usethreads" in
16703                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16704                 esac
16705                 d_setnetent_r=undef
16706                 setnetent_r_proto=0
16707                 ;;
16708         esac
16709         ;;
16710 *)      setnetent_r_proto=0
16711         ;;
16712 esac
16713
16714 : see if setprotoent exists
16715 set setprotoent d_setpent
16716 eval $inlibc
16717
16718 : see if setpgid exists
16719 set setpgid d_setpgid
16720 eval $inlibc
16721
16722 : see if setpgrp2 exists
16723 set setpgrp2 d_setpgrp2
16724 eval $inlibc
16725
16726 : see if setpriority exists
16727 set setpriority d_setprior
16728 eval $inlibc
16729
16730 : see if setproctitle exists
16731 set setproctitle d_setproctitle
16732 eval $inlibc
16733
16734 : see if setprotoent_r exists
16735 set setprotoent_r d_setprotoent_r
16736 eval $inlibc
16737 case "$d_setprotoent_r" in
16738 "$define")
16739         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16740         case "$d_setprotoent_r_proto:$usethreads" in
16741         ":define")      d_setprotoent_r_proto=define
16742                 set d_setprotoent_r_proto setprotoent_r $hdrs
16743                 eval $hasproto ;;
16744         *)      ;;
16745         esac
16746         case "$d_setprotoent_r_proto" in
16747         define)
16748         case "$setprotoent_r_proto" in
16749         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16750         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16751         esac
16752         case "$setprotoent_r_proto" in
16753         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16754         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16755         esac
16756         case "$setprotoent_r_proto" in
16757         ''|0)   d_setprotoent_r=undef
16758                 setprotoent_r_proto=0
16759                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16760         * )     case "$setprotoent_r_proto" in
16761                 REENTRANT_PROTO*) ;;
16762                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16763                 esac
16764                 echo "Prototype: $try" ;;
16765         esac
16766         ;;
16767         *)      case "$usethreads" in
16768                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16769                 esac
16770                 d_setprotoent_r=undef
16771                 setprotoent_r_proto=0
16772                 ;;
16773         esac
16774         ;;
16775 *)      setprotoent_r_proto=0
16776         ;;
16777 esac
16778
16779 : see if setpwent exists
16780 set setpwent d_setpwent
16781 eval $inlibc
16782
16783 : see if setpwent_r exists
16784 set setpwent_r d_setpwent_r
16785 eval $inlibc
16786 case "$d_setpwent_r" in
16787 "$define")
16788         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16789         case "$d_setpwent_r_proto:$usethreads" in
16790         ":define")      d_setpwent_r_proto=define
16791                 set d_setpwent_r_proto setpwent_r $hdrs
16792                 eval $hasproto ;;
16793         *)      ;;
16794         esac
16795         case "$d_setpwent_r_proto" in
16796         define)
16797         case "$setpwent_r_proto" in
16798         ''|0) try='int setpwent_r(FILE**);'
16799         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16800         esac
16801         case "$setpwent_r_proto" in
16802         ''|0) try='void setpwent_r(FILE**);'
16803         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16804         esac
16805         case "$setpwent_r_proto" in
16806         ''|0)   d_setpwent_r=undef
16807                 setpwent_r_proto=0
16808                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16809         * )     case "$setpwent_r_proto" in
16810                 REENTRANT_PROTO*) ;;
16811                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16812                 esac
16813                 echo "Prototype: $try" ;;
16814         esac
16815         ;;
16816         *)      case "$usethreads" in
16817                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16818                 esac
16819                 d_setpwent_r=undef
16820                 setpwent_r_proto=0
16821                 ;;
16822         esac
16823         ;;
16824 *)      setpwent_r_proto=0
16825         ;;
16826 esac
16827
16828 : see if setregid exists
16829 set setregid d_setregid
16830 eval $inlibc
16831 set setresgid d_setresgid
16832 eval $inlibc
16833
16834 : see if setreuid exists
16835 set setreuid d_setreuid
16836 eval $inlibc
16837 set setresuid d_setresuid
16838 eval $inlibc
16839
16840 : see if setrgid exists
16841 set setrgid d_setrgid
16842 eval $inlibc
16843
16844 : see if setruid exists
16845 set setruid d_setruid
16846 eval $inlibc
16847
16848 : see if setservent exists
16849 set setservent d_setsent
16850 eval $inlibc
16851
16852 : see if setservent_r exists
16853 set setservent_r d_setservent_r
16854 eval $inlibc
16855 case "$d_setservent_r" in
16856 "$define")
16857         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16858         case "$d_setservent_r_proto:$usethreads" in
16859         ":define")      d_setservent_r_proto=define
16860                 set d_setservent_r_proto setservent_r $hdrs
16861                 eval $hasproto ;;
16862         *)      ;;
16863         esac
16864         case "$d_setservent_r_proto" in
16865         define)
16866         case "$setservent_r_proto" in
16867         ''|0) try='int setservent_r(int, struct servent_data*);'
16868         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16869         esac
16870         case "$setservent_r_proto" in
16871         ''|0) try='void setservent_r(int, struct servent_data*);'
16872         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16873         esac
16874         case "$setservent_r_proto" in
16875         ''|0)   d_setservent_r=undef
16876                 setservent_r_proto=0
16877                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16878         * )     case "$setservent_r_proto" in
16879                 REENTRANT_PROTO*) ;;
16880                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16881                 esac
16882                 echo "Prototype: $try" ;;
16883         esac
16884         ;;
16885         *)      case "$usethreads" in
16886                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16887                 esac
16888                 d_setservent_r=undef
16889                 setservent_r_proto=0
16890                 ;;
16891         esac
16892         ;;
16893 *)      setservent_r_proto=0
16894         ;;
16895 esac
16896
16897 : see if setsid exists
16898 set setsid d_setsid
16899 eval $inlibc
16900
16901 : see if setvbuf exists
16902 set setvbuf d_setvbuf
16903 eval $inlibc
16904
16905 : see if sfio.h is available
16906 set sfio.h i_sfio
16907 eval $inhdr
16908
16909
16910 : see if sfio library is available
16911 case "$i_sfio" in
16912 $define)
16913         val=''
16914         set sfreserve val
16915         eval $inlibc
16916         ;;
16917 *)
16918         val="$undef"
16919         ;;
16920 esac
16921 : Ok, but do we want to use it.
16922 case "$val" in
16923 $define)
16924         case "$usesfio" in
16925         true|$define|[yY]*) dflt='y';;
16926         *) dflt='n';;
16927         esac
16928         echo "$package can use the sfio library, but it is experimental."
16929         case "$useperlio" in
16930         "$undef")
16931             echo "For sfio also the PerlIO abstraction layer is needed."
16932             echo "Earlier you said you wouldn't want that."
16933             ;;
16934         esac
16935         rp="You seem to have sfio available, do you want to try using it?"
16936         . ./myread
16937         case "$ans" in
16938         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
16939                 useperlio="$define"
16940                 val="$define"
16941                 ;;
16942         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
16943                 val="$undef"
16944                 ;;
16945         esac
16946         ;;
16947 *)      case "$usesfio" in
16948         true|$define|[yY]*)
16949                 echo "Sorry, cannot find sfio on this machine." >&4
16950                 echo "Ignoring your setting of usesfio=$usesfio." >&4
16951                 val="$undef"
16952                 ;;
16953         esac
16954         ;;
16955 esac
16956 set d_sfio
16957 eval $setvar
16958 case "$d_sfio" in
16959 $define) usesfio='true';;
16960 *) usesfio='false';;
16961 esac
16962 case "$d_sfio" in
16963 $define) ;;
16964 *)      : Remove sfio from list of libraries to use
16965         case "$libs" in
16966         *-lsfio*)
16967                 echo "Removing unneeded -lsfio from library list" >&4
16968                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16969                 shift
16970                 libs="$*"
16971                 echo "libs = $libs" >&4
16972                 ;;
16973         esac
16974 ;;
16975 esac
16976
16977
16978 : see if shmctl exists
16979 set shmctl d_shmctl
16980 eval $inlibc
16981
16982 : see if shmget exists
16983 set shmget d_shmget
16984 eval $inlibc
16985
16986 : see if shmat exists
16987 set shmat d_shmat
16988 eval $inlibc
16989 : see what shmat returns
16990 case "$d_shmat" in
16991 "$define")
16992         $cat >shmat.c <<'END'
16993 #include <sys/shm.h>
16994 void *shmat();
16995 END
16996         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16997                 shmattype='void *'
16998         else
16999                 shmattype='char *'
17000         fi
17001         echo "and it returns ($shmattype)." >&4
17002         : see if a prototype for shmat is available
17003         xxx=`./findhdr sys/shm.h`
17004         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17005         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17006                 val="$define"
17007         else
17008                 val="$undef"
17009         fi
17010         $rm -f shmat.[co]
17011         ;;
17012 *)
17013         val="$undef"
17014         ;;
17015 esac
17016 set d_shmatprototype
17017 eval $setvar
17018
17019 : see if shmdt exists
17020 set shmdt d_shmdt
17021 eval $inlibc
17022
17023 : see how much of the 'shm*(2)' library is present.
17024 h_shm=true
17025 echo " "
17026 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17027 *"$undef"*) h_shm=false;;
17028 esac
17029 case "$osname" in
17030 freebsd)
17031     case "`ipcs 2>&1`" in
17032     "SVID shared memory"*"not configured"*)
17033         echo "Your $osname does not have the shm*(2) configured." >&4
17034         h_shm=false
17035         val="$undef"
17036         set shmctl d_shmctl
17037         evat $setvar
17038         set shmget d_shmget
17039         evat $setvar
17040         set shmat d_shmat
17041         evat $setvar
17042         set shmdt d_shmdt
17043         evat $setvar
17044         ;;
17045     esac
17046     ;;
17047 esac
17048 : we could also check for sys/ipc.h ...
17049 if $h_shm && $test `./findhdr sys/shm.h`; then
17050         echo "You have the full shm*(2) library." >&4
17051         val="$define"
17052 else
17053         echo "You don't have the full shm*(2) library." >&4
17054         val="$undef"
17055 fi
17056 set d_shm
17057 eval $setvar
17058
17059 : see if we have sigaction
17060 echo " "
17061 if set sigaction val -f d_sigaction; eval $csym; $val; then
17062         echo 'sigaction() found.' >&4
17063         $cat > try.c <<EOP
17064 #include <stdio.h>
17065 #include <sys/types.h>
17066 #include <signal.h>
17067 #$i_stdlib I_STDLIB
17068 #ifdef I_STDLIB
17069 #include <stdlib.h>
17070 #endif
17071 int main()
17072 {
17073     struct sigaction act, oact;
17074     act.sa_flags = 0;
17075     oact.sa_handler = 0;
17076     /* so that act and oact are used */
17077     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17078 }
17079 EOP
17080         set try
17081         if eval $compile_ok; then
17082                 val="$define"
17083         else
17084                 echo "But you don't seem to have a useable struct sigaction." >&4
17085                 val="$undef"
17086         fi
17087 else
17088         echo 'sigaction NOT found.' >&4
17089         val="$undef"
17090 fi
17091 set d_sigaction; eval $setvar
17092 $rm_try
17093
17094 : see if this is a sunmath.h system
17095 set sunmath.h i_sunmath
17096 eval $inhdr
17097
17098 : see if signbit exists
17099 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17100 $cat >try.c <<EOCP
17101 #$i_math I_MATH
17102 #$i_sunmath I_SUNMATH
17103 #ifdef I_MATH
17104 #  include <math.h>
17105 #endif
17106 #ifdef I_SUNMATH  /* Solaris special math library */
17107 #  include <sunmath.h>
17108 #endif
17109 #define NV $nvtype
17110 int main(int argc, char **argv)
17111 {
17112     NV x = 0.0;
17113     NV y = -0.0;
17114     if ((signbit(x) == 0) && (signbit(y) != 0))
17115         return 0;
17116     else
17117         return 1;
17118 }
17119 EOCP
17120 val="$undef"
17121 set try
17122 if eval $compile; then
17123     if $run ./try; then
17124         $echo "Yes." >&4
17125         val="$define"
17126     else
17127         $echo "Signbit seems to be available, but doesn't work as I expected."
17128         $echo "I won't use it." >&4
17129         val="$undef"
17130     fi
17131 else
17132     $echo "Nope." >&4
17133     dflt="$undef"
17134 fi
17135 set d_signbit
17136 eval $setvar
17137 $rm_try
17138
17139 : see if sigprocmask exists
17140 set sigprocmask d_sigprocmask
17141 eval $inlibc
17142
17143 : see if sigsetjmp exists
17144 echo " "
17145 case "$d_sigsetjmp" in
17146 '')
17147         $cat >try.c <<EOP
17148 #include <setjmp.h>
17149 #$i_stdlib I_STDLIB
17150 #ifdef I_STDLIB
17151 #include <stdlib.h>
17152 #endif
17153 sigjmp_buf env;
17154 int set = 1;
17155 int main()
17156 {
17157         if (sigsetjmp(env,1))
17158                 exit(set);
17159         set = 0;
17160         siglongjmp(env, 1);
17161         exit(1);
17162 }
17163 EOP
17164         set try
17165         if eval $compile; then
17166                 if $run ./try >/dev/null 2>&1; then
17167                         echo "POSIX sigsetjmp found." >&4
17168                         val="$define"
17169                 else
17170                         $cat >&4 <<EOM
17171 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17172 I'll ignore them.
17173 EOM
17174                         val="$undef"
17175                 fi
17176         else
17177                 echo "sigsetjmp not found." >&4
17178                 val="$undef"
17179         fi
17180         ;;
17181 *) val="$d_sigsetjmp"
17182         case "$d_sigsetjmp" in
17183         $define) echo "POSIX sigsetjmp found." >&4;;
17184         $undef) echo "sigsetjmp not found." >&4;;
17185         esac
17186         ;;
17187 esac
17188 set d_sigsetjmp
17189 eval $setvar
17190 $rm_try
17191
17192 : see if snprintf exists
17193 set snprintf d_snprintf
17194 eval $inlibc
17195
17196 : see if vsnprintf exists
17197 set vsnprintf d_vsnprintf
17198 eval $inlibc
17199
17200 case "$d_snprintf-$d_vsnprintf" in
17201 "$define-$define")
17202     $cat <<EOM
17203 Checking whether your snprintf() and vsnprintf() work okay...
17204 EOM
17205     $cat >try.c <<'EOCP'
17206 /* v?snprintf testing logic courtesy of Russ Allbery.
17207  * According to C99:
17208  * - if the buffer is too short it still must be \0-terminated
17209  * - if the buffer is too short the potentially required length
17210  *   must be returned and not -1
17211  * - if the buffer is NULL the potentially required length
17212  *   must be returned and not -1 or core dump
17213  */
17214 #include <stdio.h>
17215 #include <stdarg.h>
17216
17217 char buf[2];
17218
17219 int test (char *format, ...)
17220 {
17221     va_list args;
17222     int count;
17223
17224     va_start (args, format);
17225     count = vsnprintf (buf, sizeof buf, format, args);
17226     va_end (args);
17227     return count;
17228 }
17229
17230 int main ()
17231 {
17232     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17233              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17234 }
17235 EOCP
17236     set try
17237     if eval $compile; then
17238         `$run ./try`
17239         case "$?" in
17240         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17241         *) cat <<EOM >&4
17242 Your snprintf() and snprintf() don't seem to be working okay.
17243 EOM
17244            d_snprintf="$undef"
17245            d_vsnprintf="$undef"
17246            ;;
17247         esac
17248     else
17249         echo "(I can't seem to compile the test program--assuming they don't)"
17250         d_snprintf="$undef"
17251         d_vsnprintf="$undef"
17252     fi
17253     $rm_try
17254     ;;
17255 esac
17256
17257 : see if sockatmark exists
17258 set sockatmark d_sockatmark
17259 eval $inlibc
17260
17261 : see if prototype for sockatmark is available
17262 echo " "
17263 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17264 eval $hasproto
17265
17266 : see if socks5_init exists
17267 set socks5_init d_socks5_init
17268 eval $inlibc
17269
17270 : see if sprintf returns the length of the string in the buffer as per ANSI
17271 $echo "Checking whether sprintf returns the length of the string..." >&4
17272 $cat <<EOP >try.c
17273 #include <stdio.h>
17274 #$i_stdlib I_STDLIB
17275 #ifdef I_STDLIB
17276 #include <stdlib.h>
17277 #endif
17278 #$i_string I_STRING
17279 #ifdef I_STRING
17280 #  include <string.h>
17281 #else
17282 #  include <strings.h>
17283 #endif
17284 #$i_math I_MATH
17285 #ifdef I_MATH
17286 #include <math.h>
17287 #endif
17288
17289 char buffer[256];
17290
17291 int check (size_t expect, int test) {
17292   size_t got = strlen(buffer);
17293   if (expect == got)
17294     return 0;
17295
17296   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17297        test, buffer);
17298   exit (test);
17299 }
17300
17301 int main(int argc, char **argv) {
17302   int test = 0;
17303
17304   check(sprintf(buffer, ""), ++test);
17305   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17306   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17307
17308   return 0;
17309 }
17310 EOP
17311 set try
17312
17313 d_sprintf_returns_strlen="$undef"
17314 if eval $compile; then
17315     xxx="`$run ./try`"
17316     case "$?" in
17317         0) cat >&4 <<EOM
17318 sprintf returns the length of the string (as ANSI says it should)
17319 EOM
17320         d_sprintf_returns_strlen="$define"
17321         ;;
17322         *) cat >&4 <<EOM
17323 sprintf does not return the length of the string (how old is this system?)
17324 EOM
17325         d_sprintf_returns_strlen="$undef"
17326         ;;
17327     esac
17328 fi
17329 $rm_try
17330
17331 : see if srand48_r exists
17332 set srand48_r d_srand48_r
17333 eval $inlibc
17334 case "$d_srand48_r" in
17335 "$define")
17336         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17337         case "$d_srand48_r_proto:$usethreads" in
17338         ":define")      d_srand48_r_proto=define
17339                 set d_srand48_r_proto srand48_r $hdrs
17340                 eval $hasproto ;;
17341         *)      ;;
17342         esac
17343         case "$d_srand48_r_proto" in
17344         define)
17345         case "$srand48_r_proto" in
17346         ''|0) try='int srand48_r(long, struct drand48_data*);'
17347         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
17348         esac
17349         case "$srand48_r_proto" in
17350         ''|0)   d_srand48_r=undef
17351                 srand48_r_proto=0
17352                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17353         * )     case "$srand48_r_proto" in
17354                 REENTRANT_PROTO*) ;;
17355                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17356                 esac
17357                 echo "Prototype: $try" ;;
17358         esac
17359         ;;
17360         *)      case "$usethreads" in
17361                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17362                 esac
17363                 d_srand48_r=undef
17364                 srand48_r_proto=0
17365                 ;;
17366         esac
17367         ;;
17368 *)      srand48_r_proto=0
17369         ;;
17370 esac
17371
17372 : see if srandom_r exists
17373 set srandom_r d_srandom_r
17374 eval $inlibc
17375 case "$d_srandom_r" in
17376 "$define")
17377         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17378         case "$d_srandom_r_proto:$usethreads" in
17379         ":define")      d_srandom_r_proto=define
17380                 set d_srandom_r_proto srandom_r $hdrs
17381                 eval $hasproto ;;
17382         *)      ;;
17383         esac
17384         case "$d_srandom_r_proto" in
17385         define)
17386         case "$srandom_r_proto" in
17387         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17388         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
17389         esac
17390         case "$srandom_r_proto" in
17391         ''|0)   d_srandom_r=undef
17392                 srandom_r_proto=0
17393                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17394         * )     case "$srandom_r_proto" in
17395                 REENTRANT_PROTO*) ;;
17396                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17397                 esac
17398                 echo "Prototype: $try" ;;
17399         esac
17400         ;;
17401         *)      case "$usethreads" in
17402                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17403                 esac
17404                 d_srandom_r=undef
17405                 srandom_r_proto=0
17406                 ;;
17407         esac
17408         ;;
17409 *)      srandom_r_proto=0
17410         ;;
17411 esac
17412
17413 : see if prototype for setresgid is available
17414 echo " "
17415 set d_sresgproto setresgid $i_unistd unistd.h
17416 eval $hasproto
17417
17418 : see if prototype for setresuid is available
17419 echo " "
17420 set d_sresuproto setresuid $i_unistd unistd.h
17421 eval $hasproto
17422
17423 : see if sys/stat.h is available
17424 set sys/stat.h i_sysstat
17425 eval $inhdr
17426
17427
17428 : see if stat knows about block sizes
17429 echo " "
17430 echo "Checking to see if your struct stat has st_blocks field..." >&4
17431 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17432 eval $hasfield
17433
17434
17435 : see if this is a sys/vfs.h system
17436 set sys/vfs.h i_sysvfs
17437 eval $inhdr
17438
17439
17440 : see if this is a sys/statfs.h system
17441 set sys/statfs.h i_sysstatfs
17442 eval $inhdr
17443
17444
17445 echo " "
17446 echo "Checking to see if your system supports struct statfs..." >&4
17447 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
17448 eval $hasstruct
17449 case "$d_statfs_s" in
17450 "$define")      echo "Yes, it does."   ;;
17451 *)              echo "No, it doesn't." ;;
17452 esac
17453
17454
17455
17456 : see if struct statfs knows about f_flags
17457 case "$d_statfs_s" in
17458 define) 
17459         echo " "
17460         echo "Checking to see if your struct statfs has f_flags field..." >&4
17461         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
17462         eval $hasfield
17463         ;;
17464 *)      val="$undef"
17465         set d_statfs_f_flags
17466         eval $setvar
17467         ;;
17468 esac
17469 case "$d_statfs_f_flags" in
17470 "$define")      echo "Yes, it does."   ;;
17471 *)              echo "No, it doesn't." ;;
17472 esac
17473
17474 : Check stream access
17475 $cat >&4 <<EOM
17476 Checking how to access stdio streams by file descriptor number...
17477 EOM
17478 case "$stdio_stream_array" in
17479 '')     $cat >try.c <<EOCP
17480 #include <stdio.h>
17481 int main() {
17482   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17483     printf("yes\n");
17484 }
17485 EOCP
17486         for s in _iob __iob __sF
17487         do
17488                 set try -DSTDIO_STREAM_ARRAY=$s
17489                 if eval $compile; then
17490                         case "`$run ./try`" in
17491                         yes)    stdio_stream_array=$s; break ;;
17492                         esac
17493                 fi
17494         done
17495         $rm_try
17496 esac
17497 case "$stdio_stream_array" in
17498 '')     $cat >&4 <<EOM
17499 I can't figure out how to access stdio streams by file descriptor number.
17500 EOM
17501         d_stdio_stream_array="$undef"
17502         ;;
17503 *)      $cat >&4 <<EOM
17504 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17505 EOM
17506         d_stdio_stream_array="$define"
17507         ;;
17508 esac
17509
17510 : see if strcoll exists
17511 set strcoll d_strcoll
17512 eval $inlibc
17513
17514 : check for structure copying
17515 echo " "
17516 echo "Checking to see if your C compiler can copy structs..." >&4
17517 $cat >try.c <<'EOCP'
17518 int main()
17519 {
17520         struct blurfl {
17521                 int dyick;
17522         } foo, bar;
17523
17524         foo = bar;
17525 }
17526 EOCP
17527 if $cc -c try.c >/dev/null 2>&1 ; then
17528         val="$define"
17529         echo "Yup, it can."
17530 else
17531         val="$undef"
17532         echo "Nope, it can't."
17533 fi
17534 set d_strctcpy
17535 eval $setvar
17536 $rm_try
17537
17538 : see if strerror and/or sys_errlist[] exist
17539 echo " "
17540 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17541     if set strerror val -f d_strerror; eval $csym; $val; then
17542                 echo 'strerror() found.' >&4
17543                 d_strerror="$define"
17544                 d_strerrm='strerror(e)'
17545                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17546                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17547                         d_syserrlst="$define"
17548                 else
17549                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17550                         d_syserrlst="$undef"
17551                 fi
17552     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17553                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17554                 echo 'strerror() found in string header.' >&4
17555                 d_strerror="$define"
17556                 d_strerrm='strerror(e)'
17557                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17558                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17559                                 d_syserrlst="$define"
17560                 else
17561                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17562                         d_syserrlst="$undef"
17563                 fi
17564     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17565                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17566                 d_strerror="$undef"
17567                 d_syserrlst="$define"
17568                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17569     else
17570                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17571                 d_strerror="$undef"
17572                 d_syserrlst="$undef"
17573                 d_strerrm='"unknown"'
17574     fi
17575 fi
17576
17577 : see if strerror_r exists
17578 set strerror_r d_strerror_r
17579 eval $inlibc
17580 case "$d_strerror_r" in
17581 "$define")
17582         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17583         case "$d_strerror_r_proto:$usethreads" in
17584         ":define")      d_strerror_r_proto=define
17585                 set d_strerror_r_proto strerror_r $hdrs
17586                 eval $hasproto ;;
17587         *)      ;;
17588         esac
17589         case "$d_strerror_r_proto" in
17590         define)
17591         case "$strerror_r_proto" in
17592         ''|0) try='int strerror_r(int, char*, size_t);'
17593         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17594         esac
17595         case "$strerror_r_proto" in
17596         ''|0) try='int strerror_r(int, char*, int);'
17597         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17598         esac
17599         case "$strerror_r_proto" in
17600         ''|0) try='char* strerror_r(int, char*, size_t);'
17601         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17602         esac
17603         case "$strerror_r_proto" in
17604         ''|0)   d_strerror_r=undef
17605                 strerror_r_proto=0
17606                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17607         * )     case "$strerror_r_proto" in
17608                 REENTRANT_PROTO*) ;;
17609                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17610                 esac
17611                 echo "Prototype: $try" ;;
17612         esac
17613         ;;
17614         *)      case "$usethreads" in
17615                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17616                 esac
17617                 d_strerror_r=undef
17618                 strerror_r_proto=0
17619                 ;;
17620         esac
17621         ;;
17622 *)      strerror_r_proto=0
17623         ;;
17624 esac
17625
17626 : see if strftime exists
17627 set strftime d_strftime
17628 eval $inlibc
17629
17630 : see if strlcat exists
17631 set strlcat d_strlcat
17632 eval $inlibc
17633
17634 : see if strlcpy exists
17635 set strlcpy d_strlcpy
17636 eval $inlibc
17637
17638 : see if strtod exists
17639 set strtod d_strtod
17640 eval $inlibc
17641
17642 : see if strtol exists
17643 set strtol d_strtol
17644 eval $inlibc
17645
17646 : see if strtold exists
17647 set strtold d_strtold
17648 eval $inlibc
17649
17650 : see if strtoll exists
17651 set strtoll d_strtoll
17652 eval $inlibc
17653
17654 case "$d_longlong-$d_strtoll" in
17655 "$define-$define")
17656         $cat <<EOM
17657 Checking whether your strtoll() works okay...
17658 EOM
17659         $cat >try.c <<'EOCP'
17660 #include <errno.h>
17661 #ifdef __hpux
17662 #define strtoll __strtoll
17663 #endif
17664 #ifdef __EMX__
17665 #define strtoll _strtoll
17666 #endif
17667 #include <stdio.h>
17668 extern long long int strtoll(char *s, char **, int);
17669 static int bad = 0;
17670 int check(char *s, long long ell, int een) {
17671         long long gll;
17672         errno = 0;
17673         gll = strtoll(s, 0, 10);
17674         if (!((gll == ell) && (errno == een)))
17675                 bad++;
17676 }
17677 int main() {
17678         check(" 1",                                      1LL, 0);
17679         check(" 0",                                      0LL, 0);
17680         check("-1",                                     -1LL, 0);
17681         check("-9223372036854775808", -9223372036854775808LL, 0);
17682         check("-9223372036854775808", -9223372036854775808LL, 0);
17683         check(" 9223372036854775807",  9223372036854775807LL, 0);
17684         check("-9223372036854775808", -9223372036854775808LL, 0);
17685         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17686         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17687         if (!bad)
17688                 printf("ok\n");
17689 }
17690 EOCP
17691         set try
17692         if eval $compile; then
17693                 yyy=`$run ./try`
17694                 case "$yyy" in
17695                 ok) echo "Your strtoll() seems to be working okay." ;;
17696                 *) cat <<EOM >&4
17697 Your strtoll() doesn't seem to be working okay.
17698 EOM
17699                    d_strtoll="$undef"
17700                    ;;
17701                 esac
17702         else
17703                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17704                 d_strtoll="$undef"
17705         fi
17706         ;;
17707 esac
17708
17709 : see if strtoq exists
17710 set strtoq d_strtoq
17711 eval $inlibc
17712
17713 : see if strtoul exists
17714 set strtoul d_strtoul
17715 eval $inlibc
17716
17717 case "$d_strtoul" in
17718 "$define")
17719         $cat <<EOM
17720 Checking whether your strtoul() works okay...
17721 EOM
17722         $cat >try.c <<'EOCP'
17723 #include <errno.h>
17724 #include <stdio.h>
17725 extern unsigned long int strtoul(char *s, char **, int);
17726 static int bad = 0;
17727 void check(char *s, unsigned long eul, int een) {
17728         unsigned long gul;
17729         errno = 0;
17730         gul = strtoul(s, 0, 10);
17731         if (!((gul == eul) && (errno == een)))
17732                 bad++;
17733 }
17734 int main() {
17735         check(" 1", 1L, 0);
17736         check(" 0", 0L, 0);
17737 EOCP
17738         case "$longsize" in
17739         8)
17740             $cat >>try.c <<'EOCP'
17741         check("18446744073709551615", 18446744073709551615UL, 0);
17742         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17743 #if 0 /* strtoul() for /^-/ strings is undefined. */
17744         check("-1", 18446744073709551615UL, 0);
17745         check("-18446744073709551614", 2, 0);
17746         check("-18446744073709551615", 1, 0);
17747         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17748         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17749 #endif
17750 EOCP
17751                 ;;
17752         4)
17753                     $cat >>try.c <<'EOCP'
17754         check("4294967295", 4294967295UL, 0);
17755         check("4294967296", 4294967295UL, ERANGE);
17756 #if 0 /* strtoul() for /^-/ strings is undefined. */
17757         check("-1", 4294967295UL, 0);
17758         check("-4294967294", 2, 0);
17759         check("-4294967295", 1, 0);
17760         check("-4294967296", 4294967295UL, ERANGE);
17761         check("-4294967297", 4294967295UL, ERANGE);
17762 #endif
17763 EOCP
17764                 ;;
17765         *)
17766 : Should we write these tests to be more portable by sprintf-ing
17767 : ~0 and then manipulating that char string as input for strtol?
17768                 ;;
17769         esac
17770         $cat >>try.c <<'EOCP'
17771         if (!bad)
17772                 printf("ok\n");
17773         return 0;
17774 }
17775 EOCP
17776         set try
17777         if eval $compile; then
17778                 case "`$run ./try`" in
17779                 ok) echo "Your strtoul() seems to be working okay." ;;
17780                 *) cat <<EOM >&4
17781 Your strtoul() doesn't seem to be working okay.
17782 EOM
17783                    d_strtoul="$undef"
17784                    ;;
17785                 esac
17786         else
17787                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17788                 d_strtoul="$undef"
17789         fi
17790         ;;
17791 esac
17792
17793 : see if strtoull exists
17794 set strtoull d_strtoull
17795 eval $inlibc
17796
17797 case "$d_longlong-$d_strtoull" in
17798 "$define-$define")
17799         $cat <<EOM
17800 Checking whether your strtoull() works okay...
17801 EOM
17802         $cat >try.c <<'EOCP'
17803 #include <errno.h>
17804 #ifdef __hpux
17805 #define strtoull __strtoull
17806 #endif
17807 #include <stdio.h>
17808 extern unsigned long long int strtoull(char *s, char **, int);
17809 static int bad = 0;
17810 int check(char *s, long long eull, int een) {
17811         long long gull;
17812         errno = 0;
17813         gull = strtoull(s, 0, 10);
17814         if (!((gull == eull) && (errno == een)))
17815                 bad++;
17816 }
17817 int main() {
17818         check(" 1",                                        1LL, 0);
17819         check(" 0",                                        0LL, 0);
17820         check("18446744073709551615",  18446744073709551615ULL, 0);
17821         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17822 #if 0 /* strtoull() for /^-/ strings is undefined. */
17823         check("-1",                    18446744073709551615ULL, 0);
17824         check("-18446744073709551614",                     2LL, 0);
17825         check("-18446744073709551615",                     1LL, 0);
17826         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17827         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17828 #endif
17829         if (!bad)
17830                 printf("ok\n");
17831 }
17832 EOCP
17833         set try
17834         if eval $compile; then
17835                 case "`$run ./try`" in
17836                 ok) echo "Your strtoull() seems to be working okay." ;;
17837                 *) cat <<EOM >&4
17838 Your strtoull() doesn't seem to be working okay.
17839 EOM
17840                    d_strtoull="$undef"
17841                    ;;
17842                 esac
17843         else
17844                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17845                 d_strtoull="$undef"
17846         fi
17847         ;;
17848 esac
17849
17850 : see if strtouq exists
17851 set strtouq d_strtouq
17852 eval $inlibc
17853
17854 case "$d_strtouq" in
17855 "$define")
17856         $cat <<EOM
17857 Checking whether your strtouq() works okay...
17858 EOM
17859         $cat >try.c <<'EOCP'
17860 #include <errno.h>
17861 #include <stdio.h>
17862 extern unsigned long long int strtouq(char *s, char **, int);
17863 static int bad = 0;
17864 void check(char *s, unsigned long long eull, int een) {
17865         unsigned long long gull;
17866         errno = 0;
17867         gull = strtouq(s, 0, 10);
17868         if (!((gull == eull) && (errno == een)))
17869                 bad++;
17870 }
17871 int main() {
17872         check(" 1",                                        1LL, 0);
17873         check(" 0",                                        0LL, 0);
17874         check("18446744073709551615",  18446744073709551615ULL, 0);
17875         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17876 #if 0 /* strtouq() for /^-/ strings is undefined. */
17877         check("-1",                    18446744073709551615ULL, 0);
17878         check("-18446744073709551614",                     2LL, 0);
17879         check("-18446744073709551615",                     1LL, 0);
17880         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17881         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17882 #endif
17883         if (!bad)
17884                 printf("ok\n");
17885         return 0;
17886 }
17887 EOCP
17888         set try
17889         if eval $compile; then
17890                 case "`$run ./try`" in
17891                 ok) echo "Your strtouq() seems to be working okay." ;;
17892                 *) cat <<EOM >&4
17893 Your strtouq() doesn't seem to be working okay.
17894 EOM
17895                    d_strtouq="$undef"
17896                    ;;
17897                 esac
17898         else
17899                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17900                 d_strtouq="$undef"
17901         fi
17902         ;;
17903 esac
17904
17905 : see if strxfrm exists
17906 set strxfrm d_strxfrm
17907 eval $inlibc
17908
17909 : see if symlink exists
17910 set symlink d_symlink
17911 eval $inlibc
17912
17913 : see if syscall exists
17914 set syscall d_syscall
17915 eval $inlibc
17916
17917 : see if prototype for syscall is available
17918 echo " "
17919 set d_syscallproto syscall $i_unistd unistd.h
17920 eval $hasproto
17921
17922 : see if sysconf exists
17923 set sysconf d_sysconf
17924 eval $inlibc
17925
17926 : see if system exists
17927 set system d_system
17928 eval $inlibc
17929
17930 : see if tcgetpgrp exists
17931 set tcgetpgrp d_tcgetpgrp
17932 eval $inlibc
17933
17934 : see if tcsetpgrp exists
17935 set tcsetpgrp d_tcsetpgrp
17936 eval $inlibc
17937
17938 : see if prototype for telldir is available
17939 echo " "
17940 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17941 eval $hasproto
17942
17943 : see if time exists
17944 echo " "
17945 if test "X$d_time" = X -o X"$timetype" = X; then
17946     if set time val -f d_time; eval $csym; $val; then
17947                 echo 'time() found.' >&4
17948                 val="$define"
17949                 rp="What is the type returned by time() on this system?"
17950                 set time_t timetype long stdio.h sys/types.h
17951                 eval $typedef_ask
17952     else
17953                 echo 'time() not found, hope that will do.' >&4
17954                 val="$undef"
17955                 timetype='int';
17956     fi
17957     set d_time
17958     eval $setvar
17959 fi
17960
17961 : see if this is a sys/times.h system
17962 set sys/times.h i_systimes
17963 eval $inhdr
17964
17965 : see if times exists
17966 echo " "
17967 if set times val -f d_times; eval $csym; $val; then
17968         echo 'times() found.' >&4
17969         d_times="$define"
17970         inc=''
17971         case "$i_systimes" in
17972         "$define") inc='sys/times.h';;
17973         esac
17974         rp="What is the type returned by times() on this system?"
17975         set clock_t clocktype long stdio.h sys/types.h $inc
17976         eval $typedef_ask
17977 else
17978         echo 'times() NOT found, hope that will do.' >&4
17979         d_times="$undef"
17980         clocktype='int'
17981 fi
17982
17983 : see if tmpnam_r exists
17984 set tmpnam_r d_tmpnam_r
17985 eval $inlibc
17986 case "$d_tmpnam_r" in
17987 "$define")
17988         hdrs="$i_systypes sys/types.h define stdio.h "
17989         case "$d_tmpnam_r_proto:$usethreads" in
17990         ":define")      d_tmpnam_r_proto=define
17991                 set d_tmpnam_r_proto tmpnam_r $hdrs
17992                 eval $hasproto ;;
17993         *)      ;;
17994         esac
17995         case "$d_tmpnam_r_proto" in
17996         define)
17997         case "$tmpnam_r_proto" in
17998         ''|0) try='char* tmpnam_r(char*);'
17999         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
18000         esac
18001         case "$tmpnam_r_proto" in
18002         ''|0)   d_tmpnam_r=undef
18003                 tmpnam_r_proto=0
18004                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18005         * )     case "$tmpnam_r_proto" in
18006                 REENTRANT_PROTO*) ;;
18007                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18008                 esac
18009                 echo "Prototype: $try" ;;
18010         esac
18011         ;;
18012         *)      case "$usethreads" in
18013                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18014                 esac
18015                 d_tmpnam_r=undef
18016                 tmpnam_r_proto=0
18017                 ;;
18018         esac
18019         ;;
18020 *)      tmpnam_r_proto=0
18021         ;;
18022 esac
18023
18024 : see if truncate exists
18025 set truncate d_truncate
18026 eval $inlibc
18027
18028 : see if ttyname_r exists
18029 set ttyname_r d_ttyname_r
18030 eval $inlibc
18031 case "$d_ttyname_r" in
18032 "$define")
18033         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18034         case "$d_ttyname_r_proto:$usethreads" in
18035         ":define")      d_ttyname_r_proto=define
18036                 set d_ttyname_r_proto ttyname_r $hdrs
18037                 eval $hasproto ;;
18038         *)      ;;
18039         esac
18040         case "$d_ttyname_r_proto" in
18041         define)
18042         case "$ttyname_r_proto" in
18043         ''|0) try='int ttyname_r(int, char*, size_t);'
18044         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
18045         esac
18046         case "$ttyname_r_proto" in
18047         ''|0) try='int ttyname_r(int, char*, int);'
18048         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
18049         esac
18050         case "$ttyname_r_proto" in
18051         ''|0) try='char* ttyname_r(int, char*, int);'
18052         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
18053         esac
18054         case "$ttyname_r_proto" in
18055         ''|0)   d_ttyname_r=undef
18056                 ttyname_r_proto=0
18057                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18058         * )     case "$ttyname_r_proto" in
18059                 REENTRANT_PROTO*) ;;
18060                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18061                 esac
18062                 echo "Prototype: $try" ;;
18063         esac
18064         ;;
18065         *)      case "$usethreads" in
18066                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18067                 esac
18068                 d_ttyname_r=undef
18069                 ttyname_r_proto=0
18070                 ;;
18071         esac
18072         ;;
18073 *)      ttyname_r_proto=0
18074         ;;
18075 esac
18076
18077 : see if tzname[] exists
18078 echo " "
18079 if set tzname val -a d_tzname; eval $csym; $val; then
18080         val="$define"
18081         echo 'tzname[] found.' >&4
18082 else
18083         val="$undef"
18084         echo 'tzname[] NOT found.' >&4
18085 fi
18086 set d_tzname
18087 eval $setvar
18088
18089 : Check if is a multiplatform env
18090 case "$osname" in
18091 next|rhapsody|darwin) multiarch="$define" ;;
18092 esac
18093 case "$multiarch" in
18094 ''|[nN]*) multiarch="$undef" ;;
18095 esac
18096
18097 : check for ordering of bytes in a UV
18098 echo " "
18099 case "$usecrosscompile$multiarch" in
18100 *$define*)
18101         $cat <<EOM
18102 You seem to be either cross-compiling or doing a multiarchitecture build,
18103 skipping the byteorder check.
18104
18105 EOM
18106         byteorder='ffff'
18107         ;;
18108 *)
18109         case "$byteorder" in
18110         '')
18111                 $cat <<'EOM'
18112 In the following, larger digits indicate more significance.  A big-endian
18113 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18114 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18115 machines may have weird orders like 3412.  A Cray will report 87654321,
18116 an Alpha will report 12345678. If the test program works the default is
18117 probably right.
18118 I'm now running the test program...
18119 EOM
18120                 $cat >try.c <<EOCP
18121 #include <stdio.h>
18122 #$i_stdlib I_STDLIB
18123 #ifdef I_STDLIB
18124 #include <stdlib.h>
18125 #endif
18126 #include <sys/types.h>
18127 typedef $uvtype UV;
18128 int main()
18129 {
18130         int i;
18131         union {
18132                 UV l;
18133                 char c[$uvsize];
18134         } u;
18135
18136         if ($uvsize > 4)
18137                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18138         else
18139                 u.l = (UV)0x04030201;
18140         for (i = 0; i < $uvsize; i++)
18141                 printf("%c", u.c[i]+'0');
18142         printf("\n");
18143         exit(0);
18144 }
18145 EOCP
18146                 xxx_prompt=y
18147                 set try
18148                 if eval $compile && $run ./try > /dev/null; then
18149                         dflt=`$run ./try`
18150                         case "$dflt" in
18151                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18152                                 echo "(The test program ran ok.)"
18153                                 echo "byteorder=$dflt"
18154                                 xxx_prompt=n
18155                         ;;
18156                         ????|????????) echo "(The test program ran ok.)" ;;
18157                         *) echo "(The test program didn't run right for some reason.)" ;;
18158                         esac
18159                 else
18160                         dflt='4321'
18161                         cat <<'EOM'
18162 (I can't seem to compile the test program.  Guessing big-endian...)
18163 EOM
18164                 fi
18165                 case "$xxx_prompt" in
18166                 y)
18167                         rp="What is the order of bytes in $uvtype?"
18168                         . ./myread
18169                         byteorder="$ans"
18170                         ;;
18171                 *)      byteorder=$dflt
18172                         ;;
18173                 esac
18174                 ;;
18175         esac
18176         $rm_try
18177         ;;
18178 esac
18179
18180 : Checking 32bit aligndness
18181 $cat <<EOM
18182
18183 Checking to see whether you can access character data unalignedly...
18184 EOM
18185 case "$d_u32align" in
18186 '')   $cat >try.c <<EOCP
18187 #include <stdio.h>
18188 #$i_stdlib I_STDLIB
18189 #ifdef I_STDLIB
18190 #include <stdlib.h>
18191 #endif
18192 #define U32 $u32type
18193 #define BYTEORDER 0x$byteorder
18194 #define U8 $u8type
18195 #include <signal.h>
18196 #ifdef SIGBUS
18197 $signal_t bletch(int s) { exit(4); }
18198 #endif
18199 int main() {
18200 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18201     U8 buf[8];
18202     U32 *up;
18203     int i;
18204
18205     if (sizeof(U32) != 4) {
18206         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18207         exit(1);
18208     }
18209
18210     fflush(stdout);
18211
18212 #ifdef SIGBUS
18213     signal(SIGBUS, bletch);
18214 #endif
18215
18216     buf[0] = 0;
18217     buf[1] = 0;
18218     buf[2] = 0;
18219     buf[3] = 1;
18220     buf[4] = 0;
18221     buf[5] = 0;
18222     buf[6] = 0;
18223     buf[7] = 1;
18224
18225     for (i = 0; i < 4; i++) {
18226         up = (U32*)(buf + i);
18227         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18228                (*up == 1 << (8*(3-i)))  /* little-endian */
18229               )
18230            )
18231         {
18232             printf("read failed (%x)\n", *up);
18233             exit(2);
18234         }
18235     }
18236
18237     /* write test */
18238     for (i = 0; i < 4; i++) {
18239         up = (U32*)(buf + i);
18240         *up = 0xBeef;
18241         if (*up != 0xBeef) {
18242             printf("write failed (%x)\n", *up);
18243             exit(3);
18244         }
18245     }
18246
18247     exit(0);
18248 #else
18249     printf("1\n");
18250     exit(1);
18251 #endif
18252     return 0;
18253 }
18254 EOCP
18255 set try
18256 if eval $compile_ok; then
18257         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18258         $run ./try 2>&1 >/dev/null
18259         case "$?" in
18260         0)      cat >&4 <<EOM
18261 You can access character data pretty unalignedly.
18262 EOM
18263                 d_u32align="$undef"
18264                 ;;
18265         *)      cat >&4 <<EOM
18266 It seems that you must access character data in an aligned manner.
18267 EOM
18268                 d_u32align="$define"
18269                 ;;
18270         esac
18271 else
18272         rp='Can you access character data at unaligned addresses?'
18273         dflt='n'
18274         . ./myread
18275         case "$ans" in
18276         [yY]*)  d_u32align="$undef"  ;;
18277         *)      d_u32align="$define" ;;
18278         esac
18279 fi
18280 $rm_try
18281 ;;
18282 esac
18283
18284 : see if ualarm exists
18285 set ualarm d_ualarm
18286 eval $inlibc
18287
18288 : see if umask exists
18289 set umask d_umask
18290 eval $inlibc
18291
18292 : see if unordered exists
18293 set unordered d_unordered
18294 eval $inlibc
18295
18296 : see if unsetenv exists
18297 set unsetenv d_unsetenv
18298 eval $inlibc
18299
18300 : see if usleep exists
18301 set usleep d_usleep
18302 eval $inlibc
18303
18304 : see if prototype for usleep is available
18305 echo " "
18306 set d_usleepproto usleep $i_unistd unistd.h
18307 eval $hasproto
18308
18309 : see if ustat exists
18310 set ustat d_ustat
18311 eval $inlibc
18312
18313 : see if closedir exists
18314 set closedir d_closedir
18315 eval $inlibc
18316
18317 case "$d_closedir" in
18318 "$define")
18319         echo " "
18320         echo "Checking whether closedir() returns a status..." >&4
18321         cat > try.c <<EOM
18322 #$i_dirent I_DIRENT             /**/
18323 #$i_sysdir I_SYS_DIR            /**/
18324 #$i_sysndir I_SYS_NDIR          /**/
18325 #$i_systypes I_SYS_TYPES        /**/
18326
18327 #if defined(I_SYS_TYPES)
18328 #include <sys/types.h>
18329 #endif
18330 #if defined(I_DIRENT)
18331 #include <dirent.h>
18332 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18333 #include <sys/dir.h>
18334 #endif
18335 #else
18336 #ifdef I_SYS_NDIR
18337 #include <sys/ndir.h>
18338 #else
18339 #ifdef I_SYS_DIR
18340 #ifdef hp9000s500
18341 #include <ndir.h>       /* may be wrong in the future */
18342 #else
18343 #include <sys/dir.h>
18344 #endif
18345 #endif
18346 #endif
18347 #endif
18348 int main() { return closedir(opendir(".")); }
18349 EOM
18350         set try
18351         if eval $compile_ok; then
18352                 if $run ./try > /dev/null 2>&1 ; then
18353                         echo "Yes, it does."
18354                         val="$undef"
18355                 else
18356                         echo "No, it doesn't."
18357                         val="$define"
18358                 fi
18359         else
18360                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18361                 val="$define"
18362         fi
18363         ;;
18364 *)
18365         val="$undef";
18366         ;;
18367 esac
18368 set d_void_closedir
18369 eval $setvar
18370 $rm_try
18371
18372 : see if there is a wait4
18373 set wait4 d_wait4
18374 eval $inlibc
18375
18376 : see if waitpid exists
18377 set waitpid d_waitpid
18378 eval $inlibc
18379
18380 : see if wcstombs exists
18381 set wcstombs d_wcstombs
18382 eval $inlibc
18383
18384 : see if wctomb exists
18385 set wctomb d_wctomb
18386 eval $inlibc
18387
18388 : see if writev exists
18389 set writev d_writev
18390 eval $inlibc
18391
18392 : preserve RCS keywords in files with variable substitution, grrr
18393 Date='$Date'
18394 Id='$Id'
18395 Log='$Log'
18396 RCSfile='$RCSfile'
18397 Revision='$Revision'
18398
18399 : check for alignment requirements
18400 echo " "
18401 case "$usecrosscompile$multiarch" in
18402 *$define*)
18403         $cat <<EOM
18404 You seem to be either cross-compiling or doing a multiarchitecture build,
18405 skipping the memory alignment check.
18406
18407 EOM
18408         case "$alignbytes" in
18409         '') alignbytes=8 ;;
18410         esac
18411         ;;
18412 *)
18413         case "$alignbytes" in
18414         '') echo "Checking alignment constraints..." >&4
18415                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18416                         $cat >try.c <<'EOCP'
18417 typedef long double NV;
18418 EOCP
18419                 else
18420                         $cat >try.c <<'EOCP'
18421 typedef double NV;
18422 EOCP
18423                 fi
18424                 $cat >>try.c <<'EOCP'
18425 #include <stdio.h>
18426 struct foobar {
18427         char foo;
18428         NV bar;
18429 } try_algn;
18430 int main()
18431 {
18432     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18433     return(0);
18434 }
18435 EOCP
18436                 set try
18437                 if eval $compile_ok; then
18438                         dflt=`$run ./try`
18439                 else
18440                         dflt='8'
18441                         echo "(I can't seem to compile the test program...)"
18442                 fi
18443                 ;;
18444         *) dflt="$alignbytes"
18445                 ;;
18446         esac
18447         rp="Doubles must be aligned on a how-many-byte boundary?"
18448         . ./myread
18449         alignbytes="$ans"
18450         $rm_try
18451         ;;
18452 esac
18453
18454
18455 : set the base revision
18456 baserev=5.0
18457
18458 : how do we concatenate cpp tokens here?
18459 echo " "
18460 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18461 $cat >cpp_stuff.c <<'EOCP'
18462 #define RCAT(a,b)a/**/b
18463 #define ACAT(a,b)a ## b
18464 RCAT(Rei,ser)
18465 ACAT(Cir,cus)
18466 EOCP
18467 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18468 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18469         echo "Oh!  Smells like ANSI's been here." >&4
18470         echo "We can catify or stringify, separately or together!"
18471         cpp_stuff=42
18472 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18473         echo "Ah, yes!  The good old days!" >&4
18474         echo "However, in the good old days we don't know how to stringify and"
18475         echo "catify at the same time."
18476         cpp_stuff=1
18477 else
18478         $cat >&4 <<EOM
18479 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18480 You're going to have to edit the values of CAT[2-5] in config.h...
18481 EOM
18482         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18483 fi
18484 $rm -f cpp_stuff.*
18485
18486 : see if this is a db.h system
18487 set db.h i_db
18488 eval $inhdr
18489
18490 case "$i_db" in
18491 $define)
18492         : Check db version.
18493         echo " "
18494         echo "Checking Berkeley DB version ..." >&4
18495         $cat >try.c <<EOCP
18496 #$d_const HASCONST
18497 #ifndef HASCONST
18498 #define const
18499 #endif
18500 #include <sys/types.h>
18501 #include <stdio.h>
18502 #$i_stdlib I_STDLIB
18503 #ifdef I_STDLIB
18504 #include <stdlib.h>
18505 #endif
18506 #include <db.h>
18507 int main(int argc, char *argv[])
18508 {
18509 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18510     int Major, Minor, Patch ;
18511     unsigned long Version ;
18512     (void)db_version(&Major, &Minor, &Patch) ;
18513     if (argc == 2) {
18514         printf("%d %d %d %d %d %d\n",
18515                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18516                Major, Minor, Patch);
18517         exit(0);
18518     }
18519     printf("You have Berkeley DB Version 2 or greater.\n");
18520
18521     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18522                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18523     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18524                 Major, Minor, Patch) ;
18525
18526     /* check that db.h & libdb are compatible */
18527     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18528         printf("db.h and libdb are incompatible.\n") ;
18529         exit(3);
18530     }
18531
18532     printf("db.h and libdb are compatible.\n") ;
18533
18534     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18535                 + DB_VERSION_PATCH ;
18536
18537     /* needs to be >= 2.3.4 */
18538     if (Version < 2003004) {
18539     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18540         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18541         exit(2);
18542     }
18543
18544     exit(0);
18545 #else
18546 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18547     if (argc == 2) {
18548         printf("1 0 0\n");
18549         exit(0);
18550     }
18551     printf("You have Berkeley DB Version 1.\n");
18552     exit(0);    /* DB version < 2: the coast is clear. */
18553 #else
18554     exit(1);    /* <db.h> not Berkeley DB? */
18555 #endif
18556 #endif
18557 }
18558 EOCP
18559         set try
18560         if eval $compile_ok && $run ./try; then
18561                 echo 'Looks OK.' >&4
18562                 set `$run ./try 1`
18563                 db_version_major=$1
18564                 db_version_minor=$2
18565                 db_version_patch=$3
18566         else
18567                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18568                 i_db=$undef
18569                 case " $libs " in
18570                 *"-ldb "*)
18571                         : Remove db from list of libraries to use
18572                         echo "Removing unusable -ldb from library list" >&4
18573                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18574                         shift
18575                         libs="$*"
18576                         echo "libs = $libs" >&4
18577                         ;;
18578                 esac
18579         fi
18580         $rm_try
18581         ;;
18582 esac
18583
18584 case "$i_db" in
18585 define)
18586         : Check the return type needed for hash
18587         echo " "
18588         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18589         $cat >try.c <<EOCP
18590 #$d_const HASCONST
18591 #ifndef HASCONST
18592 #define const
18593 #endif
18594 #include <sys/types.h>
18595 #include <db.h>
18596
18597 #ifndef DB_VERSION_MAJOR
18598 u_int32_t hash_cb (ptr, size)
18599 const void *ptr;
18600 size_t size;
18601 {
18602 }
18603 HASHINFO info;
18604 int main()
18605 {
18606         info.hash = hash_cb;
18607 }
18608 #endif
18609 EOCP
18610         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18611                 if $contains warning try.out >>/dev/null 2>&1 ; then
18612                         db_hashtype='int'
18613                 else
18614                         db_hashtype='u_int32_t'
18615                 fi
18616         else
18617                 : XXX Maybe we should just give up here.
18618                 db_hashtype=u_int32_t
18619                 $cat try.out >&4
18620                 echo "Help:  I can't seem to compile the db test program." >&4
18621                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18622         fi
18623         $rm_try
18624         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18625         ;;
18626 *)      db_hashtype=u_int32_t
18627         ;;
18628 esac
18629 case "$i_db" in
18630 define)
18631         : Check the return type needed for prefix
18632         echo " "
18633         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18634         cat >try.c <<EOCP
18635 #$d_const HASCONST
18636 #ifndef HASCONST
18637 #define const
18638 #endif
18639 #include <sys/types.h>
18640 #include <db.h>
18641
18642 #ifndef DB_VERSION_MAJOR
18643 size_t prefix_cb (key1, key2)
18644 const DBT *key1;
18645 const DBT *key2;
18646 {
18647 }
18648 BTREEINFO info;
18649 int main()
18650 {
18651         info.prefix = prefix_cb;
18652 }
18653 #endif
18654 EOCP
18655         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18656                 if $contains warning try.out >>/dev/null 2>&1 ; then
18657                         db_prefixtype='int'
18658                 else
18659                         db_prefixtype='size_t'
18660                 fi
18661         else
18662                 db_prefixtype='size_t'
18663                 : XXX Maybe we should just give up here.
18664                 $cat try.out >&4
18665                 echo "Help:  I can't seem to compile the db test program." >&4
18666                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18667         fi
18668         $rm_try
18669         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18670         ;;
18671 *)      db_prefixtype='size_t'
18672         ;;
18673 esac
18674
18675 : How can we generate normalized random numbers ?
18676 echo " "
18677 echo "Looking for a random number function..." >&4
18678 case "$randfunc" in
18679 '')
18680         if set drand48 val -f; eval $csym; $val; then
18681                 dflt="drand48"
18682                 echo "Good, found drand48()." >&4
18683         elif set random val -f; eval $csym; $val; then
18684                 dflt="random"
18685                 echo "OK, found random()." >&4
18686         else
18687                 dflt="rand"
18688                 echo "Yick, looks like I have to use rand()." >&4
18689         fi
18690         echo " "
18691         ;;
18692 *)
18693         dflt="$randfunc"
18694         ;;
18695 esac
18696 cont=true
18697
18698 case "$ccflags" in
18699 *-Dmy_rand=*|*-Dmy_srand=*)
18700         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18701         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18702         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18703         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18704         ;;
18705 esac
18706
18707 while $test "$cont"; do
18708         rp="Use which function to generate random numbers?"
18709         . ./myread
18710         if $test "$ans" = "$dflt"; then
18711                 : null
18712         else
18713                 randbits=''
18714         fi
18715         randfunc="$ans"
18716         if set $ans val -f; eval $csym; $val; then
18717                 cont=''
18718         else
18719                 dflt=y
18720                 rp="I cannot find function $ans. Use that name anyway?"
18721                 . ./myread
18722                 dflt=rand
18723                 case "$ans" in
18724                         [yY]*) cont='';;
18725                 esac
18726         fi
18727         case "$cont" in
18728         '')
18729                 case "$randfunc" in
18730                 drand48)
18731                         drand01="drand48()"
18732                         seedfunc="srand48"
18733                         randbits=48
18734                         randseedtype=long
18735                         ;;
18736                 rand|random)
18737                         case "$randbits" in
18738                         '')
18739 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18740                                 $cat >try.c <<EOCP
18741 #$i_unistd I_UNISTD
18742 #$i_stdlib I_STDLIB
18743 #include <stdio.h>
18744 #ifdef I_UNISTD
18745 #  include <unistd.h>
18746 #endif
18747 #ifdef I_STDLIB
18748 #  include <stdlib.h>
18749 #endif
18750 int main()
18751 {
18752         register int i;
18753         register unsigned long tmp;
18754         register unsigned long max = 0L;
18755
18756         for (i = 1000; i; i--) {
18757                 tmp = (unsigned long) $randfunc();
18758                 if (tmp > max) max = tmp;
18759         }
18760         for (i = 0; max; i++)
18761                 max /= 2;
18762         printf("%d\n",i);
18763 }
18764 EOCP
18765                                 set try
18766                                 if eval $compile_ok; then
18767                                         dflt=`try`
18768                                 else
18769                                         dflt='?'
18770                                         echo "(I can't seem to compile the test program...)"
18771                                 fi
18772                                 ;;
18773                         *)
18774                                 dflt="$randbits"
18775                                 ;;
18776                         esac
18777                         rp="How many bits does your $randfunc() function produce?"
18778                         . ./myread
18779                         randbits="$ans"
18780                         $rm_try
18781                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18782                         seedfunc="s$randfunc"
18783                         randseedtype=unsigned
18784                         ;;
18785                 *)
18786                         dflt="31"
18787                         rp="How many bits does your $randfunc() function produce?"
18788                         . ./myread
18789                         randbits="$ans"
18790                         seedfunc="s$randfunc"
18791                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18792                         if set $seedfunc val -f; eval $csym; $val; then
18793                                 echo "(Using $seedfunc() to seed random generator)"
18794                         else
18795                                 echo "(Warning: no $seedfunc() to seed random generator)"
18796                                 seedfunc=rand
18797                         fi
18798                         randseedtype=unsigned
18799                         ;;
18800                 esac
18801                 ;;
18802         esac
18803 done
18804
18805 : Determine if this is an EBCDIC system
18806 echo " "
18807 echo "Determining whether or not we are on an EBCDIC system..." >&4
18808 $cat >try.c <<'EOM'
18809 int main()
18810 {
18811   if ('M'==0xd4) return 0;
18812   return 1;
18813 }
18814 EOM
18815
18816 val=$undef
18817 set try
18818 if eval $compile_ok; then
18819         if $run ./try; then
18820                 echo "You seem to speak EBCDIC." >&4
18821                 val="$define"
18822         else
18823                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18824         fi
18825 else
18826         echo "I'm unable to compile the test program." >&4
18827         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18828 fi
18829 $rm_try
18830 set ebcdic
18831 eval $setvar
18832
18833 : Check how to flush
18834 echo " "
18835 $cat >&4 <<EOM
18836 Checking how to flush all pending stdio output...
18837 EOM
18838 # I only know how to find the first 32 possibly open files on SunOS.
18839 # See also hints/sunos_4_1.sh and util.c  --AD
18840 case "$osname" in
18841 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18842 esac
18843 $cat >>try.c <<EOCP
18844 #include <stdio.h>
18845 #$i_stdlib I_STDLIB
18846 #ifdef I_STDLIB
18847 #include <stdlib.h>
18848 #endif
18849 #$i_unistd I_UNISTD
18850 #ifdef I_UNISTD
18851 # include <unistd.h>
18852 #endif
18853 #$d_sysconf HAS_SYSCONF
18854 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18855 #ifdef HAS_STDIO_STREAM_ARRAY
18856 # define STDIO_STREAM_ARRAY $stdio_stream_array
18857 #endif
18858 int main() {
18859   FILE* p;
18860   unlink("try.out");
18861   p = fopen("try.out", "w");
18862 #ifdef TRY_FPUTC
18863   fputc('x', p);
18864 #else
18865 # ifdef TRY_FPRINTF
18866   fprintf(p, "x");
18867 # endif
18868 #endif
18869 #ifdef TRY_FFLUSH_NULL
18870   fflush(NULL);
18871 #endif
18872 #ifdef TRY_FFLUSH_ALL
18873   {
18874     long open_max = -1;
18875 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18876     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18877 # else
18878 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18879     open_max = sysconf(_SC_OPEN_MAX);
18880 #  else
18881 #   ifdef FOPEN_MAX
18882     open_max = FOPEN_MAX;
18883 #   else
18884 #    ifdef OPEN_MAX
18885     open_max = OPEN_MAX;
18886 #    else
18887 #     ifdef _NFILE
18888     open_max = _NFILE;
18889 #     endif
18890 #    endif
18891 #   endif
18892 #  endif
18893 # endif
18894 # ifdef HAS_STDIO_STREAM_ARRAY
18895     if (open_max > 0) {
18896       long i;
18897       for (i = 0; i < open_max; i++)
18898             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18899                 STDIO_STREAM_ARRAY[i]._file < open_max &&
18900                 STDIO_STREAM_ARRAY[i]._flag)
18901                 fflush(&STDIO_STREAM_ARRAY[i]);
18902     }
18903   }
18904 # endif
18905 #endif
18906   _exit(42);
18907 }
18908 EOCP
18909 : first we have to find out how _not_ to flush
18910 $to try.c
18911 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18912     output=''
18913     set try -DTRY_FPUTC
18914     if eval $compile; then
18915             $run ./try 2>/dev/null
18916             code="$?"
18917             $from try.out
18918             if $test ! -s try.out -a "X$code" = X42; then
18919                 output=-DTRY_FPUTC
18920             fi
18921     fi
18922     case "$output" in
18923     '')
18924             set try -DTRY_FPRINTF
18925             if eval $compile; then
18926                     $run ./try 2>/dev/null
18927                     code="$?"
18928                     $from try.out
18929                     if $test ! -s try.out -a "X$code" = X42; then
18930                         output=-DTRY_FPRINTF
18931                     fi
18932             fi
18933         ;;
18934     esac
18935 fi
18936 : check for fflush NULL behaviour
18937 case "$fflushNULL" in
18938 '')     set try -DTRY_FFLUSH_NULL $output
18939         if eval $compile; then
18940                 $run ./try 2>/dev/null
18941                 code="$?"
18942                 $from try.out
18943                 if $test -s try.out -a "X$code" = X42; then
18944                         fflushNULL="`$cat try.out`"
18945                 else
18946                         if $test "X$code" != X42; then
18947                                 $cat >&4 <<EOM
18948 (If this test failed, don't worry, we'll try another method shortly.)
18949 EOM
18950                         fi
18951                 fi
18952         fi
18953         $rm_try
18954         case "$fflushNULL" in
18955         x)      $cat >&4 <<EOM
18956 Your fflush(NULL) works okay for output streams.
18957 Let's see if it clobbers input pipes...
18958 EOM
18959 # As of mid-March 2000 all versions of Solaris appear to have a stdio
18960 # bug that improperly flushes the input end of pipes.  So we avoid the
18961 # autoflush on fork/system/exec support for now. :-(
18962 $cat >tryp.c <<EOCP
18963 #include <stdio.h>
18964 int
18965 main(int argc, char **argv)
18966 {
18967     char buf[1024];
18968     int i;
18969     char *bp = buf;
18970     while (1) {
18971         while ((i = getc(stdin)) != -1
18972                && (*bp++ = i) != '\n'
18973                && bp < &buf[1024])
18974         /* DO NOTHING */ ;
18975         *bp = '\0';
18976         fprintf(stdout, "%s", buf);
18977         fflush(NULL);
18978         if (i == -1)
18979             return 0;
18980         bp = buf;
18981     }
18982 }
18983 EOCP
18984                 fflushNULL="$define"
18985                 set tryp
18986                 if eval $compile; then
18987                     $rm -f tryp.out
18988                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18989                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
18990                        $cat >&4 <<EOM
18991 fflush(NULL) seems to behave okay with input streams.
18992 EOM
18993                         fflushNULL="$define"
18994                     else
18995                         $cat >&4 <<EOM
18996 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
18997 EOM
18998                         fflushNULL="$undef"
18999                     fi
19000                 fi
19001                 $rm -f core tryp.c tryp.core core.tryp.*
19002                 ;;
19003         '')     $cat >&4 <<EOM
19004 Your fflush(NULL) isn't working (contrary to ANSI C).
19005 EOM
19006                 fflushNULL="$undef"
19007                 ;;
19008         *)      $cat >&4 <<EOM
19009 Cannot figure out whether your fflush(NULL) works or not.
19010 I'm assuming it doesn't (contrary to ANSI C).
19011 EOM
19012                 fflushNULL="$undef"
19013                 ;;
19014         esac
19015         ;;
19016 $define|true|[yY]*)
19017         fflushNULL="$define"
19018         ;;
19019 *)
19020         fflushNULL="$undef"
19021         ;;
19022 esac
19023 : check explicit looping only if NULL did not work, and if the pipe
19024 : bug does not show up on an explicit flush too
19025 case "$fflushNULL" in
19026 "$undef")
19027         $cat >tryp.c <<EOCP
19028 #include <stdio.h>
19029 int
19030 main(int argc, char **argv)
19031 {
19032     char buf[1024];
19033     int i;
19034     char *bp = buf;
19035     while (1) {
19036         while ((i = getc(stdin)) != -1
19037                && (*bp++ = i) != '\n'
19038                && bp < &buf[1024])
19039         /* DO NOTHING */ ;
19040         *bp = '\0';
19041         fprintf(stdout, "%s", buf);
19042         fflush(stdin);
19043         if (i == -1)
19044             return 0;
19045         bp = buf;
19046     }
19047 }
19048 EOCP
19049         set tryp
19050         if eval $compile; then
19051             $rm -f tryp.out
19052             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19053             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19054                $cat >&4 <<EOM
19055 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19056 EOM
19057                 : now check for fflushall behaviour
19058                 case "$fflushall" in
19059                 '')     set try -DTRY_FFLUSH_ALL $output
19060                         if eval $compile; then
19061                                 $cat >&4 <<EOM
19062 (Now testing the other method--but note that this also may fail.)
19063 EOM
19064                                 $run ./try 2>/dev/null
19065                                 code=$?
19066                                 $from try.out
19067                                 if $test -s try.out -a "X$code" = X42; then
19068                                         fflushall="`$cat try.out`"
19069                                 fi
19070                         fi
19071                         $rm_try
19072                         case "$fflushall" in
19073                         x)      $cat >&4 <<EOM
19074 Whew. Flushing explicitly all the stdio streams works.
19075 EOM
19076                                 fflushall="$define"
19077                                 ;;
19078                         '')     $cat >&4 <<EOM
19079 Sigh. Flushing explicitly all the stdio streams doesn't work.
19080 EOM
19081                                 fflushall="$undef"
19082                                 ;;
19083                         *)      $cat >&4 <<EOM
19084 Cannot figure out whether flushing stdio streams explicitly works or not.
19085 I'm assuming it doesn't.
19086 EOM
19087                                 fflushall="$undef"
19088                                 ;;
19089                         esac
19090                         ;;
19091                 "$define"|true|[yY]*)
19092                         fflushall="$define"
19093                         ;;
19094                 *)
19095                         fflushall="$undef"
19096                         ;;
19097                 esac
19098             else
19099                 $cat >&4 <<EOM
19100 All is futile.  Even fflush(stdin) clobbers input pipes!
19101 EOM
19102                 fflushall="$undef"
19103             fi
19104         else
19105             fflushall="$undef"
19106         fi
19107         $rm -f core tryp.c tryp.core core.tryp.*
19108         ;;
19109 *)      fflushall="$undef"
19110         ;;
19111 esac
19112
19113 case "$fflushNULL$fflushall" in
19114 undefundef)
19115         $cat <<EOM
19116 OK, I give up.  I cannot figure out how to flush pending stdio output.
19117 We won't be flushing handles at all before fork/exec/popen.
19118 EOM
19119         ;;
19120 esac
19121 $rm_try
19122
19123 : Store the full pathname to the ar program for use in the C program
19124 : Respect a hint or command line value for full_ar.
19125 case "$full_ar" in
19126 '') full_ar=$ar ;;
19127 esac
19128
19129 : Store the full pathname to the sed program for use in the C program
19130 full_sed=$sed
19131
19132 : see what type gids are declared as in the kernel
19133 echo " "
19134 echo "Looking for the type for group ids returned by getgid()."
19135 set gid_t gidtype xxx stdio.h sys/types.h
19136 eval $typedef
19137 case "$gidtype" in
19138 xxx)
19139         xxx=`./findhdr sys/user.h`
19140         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19141         case $1 in
19142         unsigned) dflt="$1 $2" ;;
19143         *) dflt="$1" ;;
19144         esac
19145         ;;
19146 *) dflt="$gidtype";;
19147 esac
19148 case "$gidtype" in
19149 gid_t) echo "gid_t found." ;;
19150 *)      rp="What is the type for group ids returned by getgid()?"
19151         . ./myread
19152         gidtype="$ans"
19153         ;;
19154 esac
19155
19156 : Check the size of GID
19157 echo " "
19158 case "$gidtype" in
19159 *_t) zzz="$gidtype"     ;;
19160 *)   zzz="gid"          ;;
19161 esac
19162 echo "Checking the size of $zzz..." >&4
19163 cat > try.c <<EOCP
19164 #include <sys/types.h>
19165 #include <stdio.h>
19166 #$i_stdlib I_STDLIB
19167 #ifdef I_STDLIB
19168 #include <stdlib.h>
19169 #endif
19170 int main() {
19171     printf("%d\n", (int)sizeof($gidtype));
19172     exit(0);
19173 }
19174 EOCP
19175 set try
19176 if eval $compile_ok; then
19177         yyy=`$run ./try`
19178         case "$yyy" in
19179         '')     gidsize=4
19180                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19181                 ;;
19182         *)      gidsize=$yyy
19183                 echo "Your $zzz is $gidsize bytes long."
19184                 ;;
19185         esac
19186 else
19187         gidsize=4
19188         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19189 fi
19190
19191
19192 : Check if GID is signed
19193 echo " "
19194 case "$gidtype" in
19195 *_t) zzz="$gidtype"     ;;
19196 *)   zzz="gid"          ;;
19197 esac
19198 echo "Checking the sign of $zzz..." >&4
19199 cat > try.c <<EOCP
19200 #include <sys/types.h>
19201 #include <stdio.h>
19202 int main() {
19203         $gidtype foo = -1;
19204         if (foo < 0)
19205                 printf("-1\n");
19206         else
19207                 printf("1\n");
19208 }
19209 EOCP
19210 set try
19211 if eval $compile; then
19212         yyy=`$run ./try`
19213         case "$yyy" in
19214         '')     gidsign=1
19215                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19216                 ;;
19217         *)      gidsign=$yyy
19218                 case "$gidsign" in
19219                  1) echo "Your $zzz is unsigned." ;;
19220                 -1) echo "Your $zzz is signed."   ;;
19221                 esac
19222                 ;;
19223         esac
19224 else
19225         gidsign=1
19226         echo "(I can't compile the test program--guessing unsigned.)" >&4
19227 fi
19228
19229
19230 : Check 64bit sizes
19231 echo " "
19232
19233 if $test X"$quadtype" != X; then
19234
19235 echo "Checking how to print 64-bit integers..." >&4
19236
19237 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19238         $cat >try.c <<'EOCP'
19239 #include <sys/types.h>
19240 #include <stdio.h>
19241 int main() {
19242   int q = 12345678901;
19243   printf("%ld\n", q);
19244 }
19245 EOCP
19246         set try
19247         if eval $compile; then
19248                 yyy=`$run ./try`
19249                 case "$yyy" in
19250                 12345678901)
19251                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19252                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19253                         echo "We will use %d."
19254                         ;;
19255                 esac
19256         fi
19257 fi
19258
19259 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19260         $cat >try.c <<'EOCP'
19261 #include <sys/types.h>
19262 #include <stdio.h>
19263 int main() {
19264   long q = 12345678901;
19265   printf("%ld\n", q);
19266 }
19267 EOCP
19268         set try
19269         if eval $compile; then
19270                 yyy=`$run ./try`
19271                 case "$yyy" in
19272                 12345678901)
19273                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19274                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19275                         echo "We will use %ld."
19276                         ;;
19277                 esac
19278         fi
19279 fi
19280
19281 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19282         $cat >try.c <<'EOCP'
19283 #include <sys/types.h>
19284 #include <inttypes.h>
19285 #include <stdio.h>
19286 int main() {
19287   int64_t q = 12345678901;
19288   printf("%" PRId64 "\n", q);
19289 }
19290 EOCP
19291         set try
19292         if eval $compile; then
19293                 yyy=`$run ./try`
19294                 case "$yyy" in
19295                 12345678901)
19296                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19297                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19298                         echo "We will use the C9X style."
19299                         ;;
19300                 esac
19301         fi
19302 fi
19303
19304 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19305         $cat >try.c <<EOCP
19306 #include <sys/types.h>
19307 #include <stdio.h>
19308 int main() {
19309   $quadtype q = 12345678901;
19310   printf("%Ld\n", q);
19311 }
19312 EOCP
19313         set try
19314         if eval $compile; then
19315                 yyy=`$run ./try`
19316                 case "$yyy" in
19317                 12345678901)
19318                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19319                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19320                         echo "We will use %Ld."
19321                         ;;
19322                 esac
19323         fi
19324 fi
19325
19326 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19327         $cat >try.c <<'EOCP'
19328 #include <sys/types.h>
19329 #include <stdio.h>
19330 int main() {
19331   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19332   printf("%lld\n", q);
19333 }
19334 EOCP
19335         set try
19336         if eval $compile; then
19337                 yyy=`$run ./try`
19338                 case "$yyy" in
19339                 12345678901)
19340                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19341                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19342                         echo "We will use the %lld style."
19343                         ;;
19344                 esac
19345         fi
19346 fi
19347
19348 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19349         $cat >try.c <<EOCP
19350 #include <sys/types.h>
19351 #include <stdio.h>
19352 int main() {
19353   $quadtype q = 12345678901;
19354   printf("%qd\n", q);
19355 }
19356 EOCP
19357         set try
19358         if eval $compile; then
19359                 yyy=`$run ./try`
19360                 case "$yyy" in
19361                 12345678901)
19362                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19363                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19364                         echo "We will use %qd."
19365                         ;;
19366                 esac
19367         fi
19368 fi
19369
19370 if $test X"$sPRId64" = X; then
19371         echo "Cannot figure out how to print 64-bit integers." >&4
19372 fi
19373 $rm_try
19374
19375 fi
19376
19377 case "$sPRId64" in
19378 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19379         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19380         ;;
19381 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19382         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19383         ;;
19384 esac
19385
19386
19387 echo " "
19388 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19389
19390 if $test X"$ivsize" = X8; then
19391         ivdformat="$sPRId64"
19392         uvuformat="$sPRIu64"
19393         uvoformat="$sPRIo64"
19394         uvxformat="$sPRIx64"
19395         uvXUformat="$sPRIXU64"
19396 else
19397         if $test X"$ivsize" = X"$longsize"; then
19398                 ivdformat='"ld"'
19399                 uvuformat='"lu"'
19400                 uvoformat='"lo"'
19401                 uvxformat='"lx"'
19402                 uvXUformat='"lX"'
19403         else
19404                 if $test X"$ivsize" = X"$intsize"; then
19405                         ivdformat='"d"'
19406                         uvuformat='"u"'
19407                         uvoformat='"o"'
19408                         uvxformat='"x"'
19409                         uvXUformat='"X"'
19410                 else
19411                         : far out
19412                         if $test X"$ivsize" = X"$shortsize"; then
19413                                 ivdformat='"hd"'
19414                                 uvuformat='"hu"'
19415                                 uvoformat='"ho"'
19416                                 uvxformat='"hx"'
19417                                 uvXUformat='"hX"'
19418                         fi
19419                 fi
19420         fi
19421 fi
19422
19423 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19424         nveformat="$sPRIeldbl"
19425         nvfformat="$sPRIfldbl"
19426         nvgformat="$sPRIgldbl"
19427         nvEUformat="$sPRIEUldbl"
19428         nvFUformat="$sPRIFUldbl"
19429         nvGUformat="$sPRIGUldbl"
19430 else
19431         nveformat='"e"'
19432         nvfformat='"f"'
19433         nvgformat='"g"'
19434         nvEUformat='"E"'
19435         nvFUformat='"F"'
19436         nvGUformat='"G"'
19437 fi
19438
19439 case "$ivdformat" in
19440 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19441     exit 1
19442     ;;
19443 esac
19444
19445
19446 echo " "
19447 $echo "Checking the format string to be used for gids..." >&4
19448
19449 case "$gidsign" in
19450 -1)     if $test X"$gidsize" = X"$ivsize"; then
19451                 gidformat="$ivdformat"
19452         else
19453                 if $test X"$gidsize" = X"$longsize"; then
19454                         gidformat='"ld"'
19455                 else
19456                         if $test X"$gidsize" = X"$intsize"; then
19457                                 gidformat='"d"'
19458                         else
19459                                 if $test X"$gidsize" = X"$shortsize"; then
19460                                         gidformat='"hd"'
19461                                 fi
19462                         fi
19463                 fi
19464         fi
19465         ;;
19466 *)      if $test X"$gidsize" = X"$uvsize"; then
19467                 gidformat="$uvuformat"
19468         else
19469                 if $test X"$gidsize" = X"$longsize"; then
19470                         gidformat='"lu"'
19471                 else
19472                         if $test X"$gidsize" = X"$intsize"; then
19473                                 gidformat='"u"'
19474                         else
19475                                 if $test X"$gidsize" = X"$shortsize"; then
19476                                         gidformat='"hu"'
19477                                 fi
19478                         fi
19479                 fi
19480         fi
19481         ;;
19482 esac
19483
19484 : see if getgroups exists
19485 set getgroups d_getgrps
19486 eval $inlibc
19487
19488 : see if setgroups exists
19489 set setgroups d_setgrps
19490 eval $inlibc
19491
19492
19493 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19494 echo " "
19495 case "$d_getgrps$d_setgrps" in
19496 *define*)
19497         case "$groupstype" in
19498         '') dflt="$gidtype" ;;
19499         *)  dflt="$groupstype" ;;
19500         esac
19501         $cat <<EOM
19502 What type of pointer is the second argument to getgroups() and setgroups()?
19503 Usually this is the same as group ids, $gidtype, but not always.
19504
19505 EOM
19506         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19507         . ./myread
19508         groupstype="$ans"
19509         ;;
19510 *)  groupstype="$gidtype";;
19511 esac
19512
19513 : MAD = Misc Attribute Definition
19514
19515 if $test $patchlevel -lt 9; then
19516 : MAD is not available in 5.8.x or earlier.
19517     ans=n;
19518 else
19519     case "$mad" in
19520     $define|true|[yY]*) dflt='y' ;;
19521     *)                  dflt='n' ;;
19522     esac
19523     cat <<EOM
19524
19525 Would you like to build with Misc Attribute Decoration? This is development
19526 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19527 overhead on the interpreter.
19528
19529 If this doesn't make any sense to you, just accept the default '$dflt'.
19530 EOM
19531     rp='Build Perl with MAD?'
19532     . ./myread
19533 fi
19534 case "$ans" in
19535 y|Y)    val="$define"
19536         madlyh='madly.h madly.act madly.tab'
19537         madlysrc='madly.c'
19538         madlyobj="madly$_o" ;;
19539 *)      val="$undef"
19540         madlyh=''
19541         madlysrc=''
19542         madlyobj='' ;;
19543 esac
19544 set mad
19545 eval $setvar
19546
19547 echo " "
19548 echo "Checking if your $make program sets \$(MAKE)..." >&4
19549 case "$make_set_make" in
19550 '')
19551         $sed 's/^X //' > testmake.mak << 'EOF'
19552 Xall:
19553 X       @echo 'maketemp="$(MAKE)"'
19554 EOF
19555         case "`$make -f testmake.mak 2>/dev/null`" in
19556         *maketemp=*) make_set_make='#' ;;
19557         *)      make_set_make="MAKE=$make" ;;
19558         esac
19559         $rm -f testmake.mak
19560         ;;
19561 esac
19562 case "$make_set_make" in
19563 '#') echo "Yup, it does.";;
19564 *) echo "Nope, it doesn't.";;
19565 esac
19566
19567 : see what type is used for mode_t
19568 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19569 set mode_t modetype int stdio.h sys/types.h
19570 eval $typedef_ask
19571
19572 : see if we need va_copy
19573 echo " "
19574 case "$i_stdarg" in
19575 "$define")
19576         $cat >try.c <<EOCP
19577 #include <stdarg.h>
19578 #include <stdio.h>
19579 #$i_stdlib I_STDLIB
19580 #ifdef I_STDLIB
19581 #include <stdlib.h>
19582 #endif
19583 #include <signal.h>
19584
19585 int
19586 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19587 {
19588   return vfprintf(f, fmt, *valp);
19589 }
19590
19591 int
19592 myvfprintf(FILE *f, const  char *fmt, va_list val)
19593 {
19594   return ivfprintf(f, fmt, &val);
19595 }
19596
19597 int
19598 myprintf(char *fmt, ...)
19599 {
19600   va_list val;
19601   va_start(val, fmt);
19602   return myvfprintf(stdout, fmt, val);
19603 }
19604
19605 int
19606 main(int ac, char **av)
19607 {
19608   signal(SIGSEGV, exit);
19609
19610   myprintf("%s%cs all right, then\n", "that", '\'');
19611   exit(0);
19612 }
19613 EOCP
19614         set try
19615         if eval $compile && $run ./try 2>&1 >/dev/null; then
19616                 case "`$run ./try`" in
19617                 "that's all right, then")
19618                         okay=yes
19619                         ;;
19620                 esac
19621         fi
19622         case "$okay" in
19623         yes)    echo "It seems that you don't need va_copy()." >&4
19624                 need_va_copy="$undef"
19625                 ;;
19626         *)      echo "It seems that va_copy() or similar will be needed." >&4
19627                 need_va_copy="$define"
19628                 ;;
19629         esac
19630         $rm_try
19631         ;;
19632 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19633         ;;
19634 esac
19635
19636 : see what type is used for size_t
19637 rp="What is the type used for the length parameter for string functions?"
19638 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19639 eval $typedef_ask
19640
19641 : check for type of arguments to gethostbyaddr. 
19642 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19643         case "$d_gethbyaddr" in
19644         $define)
19645                 $cat <<EOM
19646
19647 Checking to see what type of arguments are accepted by gethostbyaddr().
19648 EOM
19649                 hdrs="$define sys/types.h
19650                         $d_socket sys/socket.h 
19651                         $i_niin netinet/in.h 
19652                         $i_netdb netdb.h
19653                         $i_unistd unistd.h"
19654                 : The first arg can 'char *' or 'void *'
19655                 : The second arg is some of integral type
19656                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19657                         for yyy in size_t long int; do
19658                                 case "$netdb_host_type" in
19659                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19660                                         if ./protochk "$try" $hdrs; then
19661                                                 echo "Your system accepts $xxx for the first arg."
19662                                                 echo "...and $yyy for the second arg."
19663                                                 netdb_host_type="$xxx"
19664                                                 netdb_hlen_type="$yyy"
19665                                         fi
19666                                         ;;
19667                                 esac
19668                         done
19669                 done
19670                 : In case none of those worked, prompt the user.
19671                 case "$netdb_host_type" in
19672                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19673                         dflt='char *'
19674                         . ./myread
19675                         netdb_host_type=$ans
19676                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19677                         dflt="$sizetype"
19678                         . ./myread
19679                         netdb_hlen_type=$ans
19680                         ;;
19681                 esac
19682                 ;;
19683         *)      : no gethostbyaddr, so pick harmless defaults
19684                 netdb_host_type='char *'
19685                 netdb_hlen_type="$sizetype"
19686                 ;;
19687         esac
19688         # Remove the "const" if needed. -- but then we'll have a 
19689         # prototype clash!
19690         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19691 fi
19692
19693 : check for type of argument to gethostbyname. 
19694 if test "X$netdb_name_type" = X ; then
19695         case "$d_gethbyname" in
19696         $define)
19697                 $cat <<EOM
19698
19699 Checking to see what type of argument is accepted by gethostbyname().
19700 EOM
19701                 hdrs="$define sys/types.h
19702                         $d_socket sys/socket.h 
19703                         $i_niin netinet/in.h 
19704                         $i_netdb netdb.h
19705                         $i_unistd unistd.h"
19706                 for xxx in "const char *" "char *"; do
19707                         case "$netdb_name_type" in
19708                         '')     try="extern struct hostent *gethostbyname($xxx);"
19709                                 if ./protochk "$try" $hdrs; then
19710                                         echo "Your system accepts $xxx."
19711                                         netdb_name_type="$xxx"
19712                                 fi
19713                                 ;;
19714                         esac
19715                 done
19716                 : In case none of those worked, prompt the user.
19717                 case "$netdb_name_type" in
19718                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19719                         dflt='char *'
19720                         . ./myread
19721                         netdb_name_type=$ans
19722                         ;;
19723                 esac
19724                 ;;
19725         *)      : no gethostbyname, so pick harmless default
19726                 netdb_name_type='char *'
19727                 ;;
19728         esac
19729 fi
19730
19731 : check for type of 1st argument to getnetbyaddr. 
19732 if test "X$netdb_net_type" = X ; then
19733         case "$d_getnbyaddr" in
19734         $define)
19735                 $cat <<EOM
19736
19737 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19738 EOM
19739                 hdrs="$define sys/types.h
19740                         $d_socket sys/socket.h 
19741                         $i_niin netinet/in.h 
19742                         $i_netdb netdb.h
19743                         $i_unistd unistd.h"
19744                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19745                         case "$netdb_net_type" in
19746                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19747                                 if ./protochk "$try" $hdrs; then
19748                                         echo "Your system accepts $xxx."
19749                                         netdb_net_type="$xxx"
19750                                 fi
19751                                 ;;
19752                         esac
19753                 done
19754                 : In case none of those worked, prompt the user.
19755                 case "$netdb_net_type" in
19756                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19757                         dflt='long'
19758                         . ./myread
19759                         netdb_net_type=$ans
19760                         ;;
19761                 esac
19762                 ;;
19763         *)      : no getnetbyaddr, so pick harmless default
19764                 netdb_net_type='long'
19765                 ;;
19766         esac
19767 fi
19768 : locate the preferred pager for this system
19769 fn=f/
19770 case "$pager" in
19771 '')
19772         dflt=''
19773         case "$pg" in
19774         /*) dflt=$pg;;
19775         [a-zA-Z]:/*) dflt=$pg;;
19776         esac
19777         case "$more" in
19778         /*) dflt=$more;;
19779         [a-zA-Z]:/*) dflt=$more;;
19780         esac
19781         case "$less" in
19782         /*) dflt=$less;;
19783         [a-zA-Z]:/*) dflt=$less;;
19784         esac
19785         case "$dflt" in
19786         '') dflt=/usr/ucb/more;;
19787         esac
19788         ;;
19789 *)      dflt="$pager"
19790         : Instruct ./getfile to trust the hinted or previous pager value,
19791         : even if it does not begin with a slash.  For example, on os2,
19792         : pager might be cmd /c more.  See comments in UU/getfile.
19793         fn="f/($pager)"
19794         ;;
19795 esac
19796 echo " "
19797 rp='What pager is used on your system?'
19798 . ./getfile
19799 pager="$ans"
19800
19801 : see what type pids are declared as in the kernel
19802 rp="What is the type of process ids on this system?"
19803 set pid_t pidtype int stdio.h sys/types.h
19804 eval $typedef_ask
19805
19806 : see if ar generates random libraries by itself
19807 echo " "
19808 echo "Checking how to generate random libraries on your machine..." >&4
19809 echo 'int bar1() { return bar2(); }' > bar1.c
19810 echo 'int bar2() { return 2; }' > bar2.c
19811 $cat > foo.c <<EOP
19812 #$i_stdlib I_STDLIB
19813 #ifdef I_STDLIB
19814 #include <stdlib.h>
19815 #endif
19816 int main() { printf("%d\n", bar1()); exit(0); }
19817 EOP
19818 $cc $ccflags -c bar1.c >/dev/null 2>&1
19819 $cc $ccflags -c bar2.c >/dev/null 2>&1
19820 $cc $ccflags -c foo.c >/dev/null 2>&1
19821 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19822 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19823         $run ./foobar >/dev/null 2>&1; then
19824         echo "$ar appears to generate random libraries itself."
19825         orderlib=false
19826         if [ "X$ranlib" = "X" ]; then
19827             ranlib=":"
19828         fi
19829 elif $ar s bar$_a >/dev/null 2>&1 &&
19830         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19831         $run ./foobar >/dev/null 2>&1; then
19832                 echo "a table of contents needs to be added with '$ar s'."
19833                 orderlib=false
19834                 ranlib="$ar s"
19835 elif $ar ts bar$_a >/dev/null 2>&1 &&
19836         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19837         $run ./foobar >/dev/null 2>&1; then
19838                 echo "a table of contents needs to be added with '$ar ts'."
19839                 orderlib=false
19840                 ranlib="$ar ts"
19841 else
19842         case "$ranlib" in
19843         :) ranlib='';;
19844         '')
19845                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19846                 $test -f $ranlib || ranlib=''
19847                 ;;
19848         esac
19849         if $test -n "$ranlib"; then
19850                 echo "your system has '$ranlib'; we'll use that."
19851                 orderlib=false
19852         else
19853                 echo "your system doesn't seem to support random libraries"
19854                 echo "so we'll use lorder and tsort to order the libraries."
19855                 orderlib=true
19856                 ranlib=":"
19857         fi
19858 fi
19859 $rm -f foo* bar*
19860
19861 : check for type of arguments to select.
19862 case "$selecttype" in
19863 '') case "$d_select" in
19864         $define)
19865                 echo " "
19866                 $cat <<EOM
19867 Checking to see what type of arguments are accepted by select().
19868 EOM
19869                 hdrs="$define sys/types.h
19870                         $i_systime sys/time.h
19871                         $i_sysselct sys/select.h
19872                         $d_socket sys/socket.h"
19873                 : The first arg can be int, unsigned, or size_t
19874                 : The last arg may or may not be 'const'
19875                 val=''
19876                 : void pointer has been seen but using that
19877                 : breaks the selectminbits test
19878                 for xxx in 'fd_set *' 'int *'; do
19879                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19880                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
19881                                         case "$val" in
19882                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19883                                                 if ./protochk "$try" $hdrs; then
19884                                                         echo "Your system accepts $xxx."
19885                                                         val="$xxx"
19886                                                 fi
19887                                                 ;;
19888                                         esac
19889                                 done
19890                         done
19891                 done
19892                 case "$val" in
19893                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19894                         case "$d_fd_set" in
19895                                 $define) dflt="fd_set *" ;;
19896                                 *)              dflt="int *" ;;
19897                         esac
19898                         . ./myread
19899                         val=$ans
19900                         ;;
19901                 esac
19902                 selecttype="$val"
19903                 ;;
19904         *)      : no select, so pick a harmless default
19905                 selecttype='int *'
19906                 ;;
19907         esac
19908         ;;
19909 esac
19910
19911 : check for the select 'width'
19912 case "$selectminbits" in
19913 '') safebits=`expr $ptrsize \* 8`
19914     case "$d_select" in
19915         $define)
19916                 $cat <<EOM
19917
19918 Checking to see on how many bits at a time your select() operates...
19919 EOM
19920                 $cat >try.c <<EOCP
19921 #include <sys/types.h>
19922 #$i_time I_TIME
19923 #$i_systime I_SYS_TIME
19924 #$i_systimek I_SYS_TIME_KERNEL
19925 #ifdef I_TIME
19926 #   include <time.h>
19927 #endif
19928 #ifdef I_SYS_TIME
19929 #   ifdef I_SYS_TIME_KERNEL
19930 #       define KERNEL
19931 #   endif
19932 #   include <sys/time.h>
19933 #   ifdef I_SYS_TIME_KERNEL
19934 #       undef KERNEL
19935 #   endif
19936 #endif
19937 #$i_sysselct I_SYS_SELECT
19938 #ifdef I_SYS_SELECT
19939 #include <sys/select.h>
19940 #endif
19941 #$d_socket HAS_SOCKET
19942 #ifdef HAS_SOCKET
19943 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19944 #endif
19945 #include <stdio.h>
19946 #$i_stdlib I_STDLIB
19947 #ifdef I_STDLIB
19948 #include <stdlib.h>
19949 #endif
19950 $selecttype b;
19951 #define S sizeof(*(b))
19952 #define MINBITS 64
19953 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19954 #define NBITS  (NBYTES * 8)
19955 int main() {
19956     char *s = (char *)malloc(NBYTES);
19957     struct timeval t;
19958     int i;
19959     FILE* fp;
19960     int fd;
19961
19962     if (!s)
19963         exit(1);
19964     fclose(stdin);
19965     fp = fopen("try.c", "r");
19966     if (fp == 0)
19967       exit(2);
19968     fd = fileno(fp);
19969     if (fd < 0)
19970       exit(3);
19971     b = ($selecttype)s;
19972     for (i = 0; i < NBITS; i++)
19973         FD_SET(i, b);
19974     t.tv_sec  = 0;
19975     t.tv_usec = 0;
19976     select(fd + 1, b, 0, 0, &t);
19977     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
19978     free(s);
19979     printf("%d\n", i + 1);
19980     return 0;
19981 }
19982 EOCP
19983                 set try
19984                 if eval $compile_ok; then
19985                         selectminbits=`$run ./try`
19986                         case "$selectminbits" in
19987                         '')     cat >&4 <<EOM
19988 Cannot figure out on how many bits at a time your select() operates.
19989 I'll play safe and guess it is $safebits bits.
19990 EOM
19991                                 selectminbits=$safebits
19992                                 bits="$safebits bits"
19993                                 ;;
19994                         1)      bits="1 bit" ;;
19995                         *)      bits="$selectminbits bits" ;;
19996                         esac
19997                         echo "Your select() operates on $bits at a time." >&4
19998                 else
19999                         rp='What is the minimum number of bits your select() operates on?'
20000                         case "$byteorder" in
20001                         12345678)       dflt=64 ;;
20002                         1234)           dflt=32 ;;
20003                         *)              dflt=1  ;;
20004                         esac
20005                         . ./myread
20006                         val=$ans
20007                         selectminbits="$val"
20008                 fi
20009                 $rm_try
20010                 ;;
20011         *)      : no select, so pick a harmless default
20012                 selectminbits=$safebits
20013                 ;;
20014         esac
20015         ;;
20016 esac
20017
20018 : Trace out the files included by signal.h, then look for SIGxxx names.
20019 : Remove SIGARRAYSIZE used by HPUX.
20020 : Remove SIGSTKSIZE used by Linux.
20021 : Remove SIGSTKSZ used by Posix.
20022 : Remove SIGTYP void lines used by OS2.
20023 : Some cpps, like os390, dont give the file name anywhere
20024 if [ "X$fieldn" = X ]; then
20025         : Just make some guesses.  We check them later.
20026         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20027 else
20028         xxx=`echo '#include <signal.h>' |
20029         $cppstdin $cppminus $cppflags 2>/dev/null |
20030         $grep '^[       ]*#.*include' |
20031         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20032 fi
20033 : Check this list of files to be sure we have parsed the cpp output ok.
20034 : This will also avoid potentially non-existent files, such
20035 : as ../foo/bar.h
20036 xxxfiles=''
20037 for xx in $xxx /dev/null ; do
20038         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20039 done
20040 : If we have found no files, at least try signal.h
20041 case "$xxxfiles" in
20042 '')     xxxfiles=`./findhdr signal.h` ;;
20043 esac
20044 xxx=`awk '
20045 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20046         print substr($2, 4, 20)
20047 }
20048 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20049         print substr($3, 4, 20)
20050 }' $xxxfiles`
20051 : Append some common names just in case the awk scan failed.
20052 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20053 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20054 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20055 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20056 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20057
20058 : generate a few handy files for later
20059 $cat > signal.c <<EOCP
20060 #include <sys/types.h>
20061 #include <signal.h>
20062 #$i_stdlib I_STDLIB
20063 #ifdef I_STDLIB
20064 #include <stdlib.h>
20065 #endif
20066 #include <stdio.h>
20067 int main() {
20068
20069 /* Strange style to avoid deeply-nested #if/#else/#endif */
20070 #ifndef NSIG
20071 #  ifdef _NSIG
20072 #    define NSIG (_NSIG)
20073 #  endif
20074 #endif
20075
20076 #ifndef NSIG
20077 #  ifdef SIGMAX
20078 #    define NSIG (SIGMAX+1)
20079 #  endif
20080 #endif
20081
20082 #ifndef NSIG
20083 #  ifdef SIG_MAX
20084 #    define NSIG (SIG_MAX+1)
20085 #  endif
20086 #endif
20087
20088 #ifndef NSIG
20089 #  ifdef _SIG_MAX
20090 #    define NSIG (_SIG_MAX+1)
20091 #  endif
20092 #endif
20093
20094 #ifndef NSIG
20095 #  ifdef MAXSIG
20096 #    define NSIG (MAXSIG+1)
20097 #  endif
20098 #endif
20099
20100 #ifndef NSIG
20101 #  ifdef MAX_SIG
20102 #    define NSIG (MAX_SIG+1)
20103 #  endif
20104 #endif
20105
20106 #ifndef NSIG
20107 #  ifdef SIGARRAYSIZE
20108 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20109 #  endif
20110 #endif
20111
20112 #ifndef NSIG
20113 #  ifdef _sys_nsig
20114 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20115 #  endif
20116 #endif
20117
20118 /* Default to some arbitrary number that's big enough to get most
20119    of the common signals.
20120 */
20121 #ifndef NSIG
20122 #    define NSIG 50
20123 #endif
20124
20125 printf("NSIG %d\n", NSIG);
20126
20127 #ifndef JUST_NSIG
20128
20129 EOCP
20130
20131 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20132 {
20133         printf "#ifdef SIG"; printf $1; printf "\n"
20134         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20135         printf $1; printf ");\n"
20136         printf "#endif\n"
20137 }
20138 END {
20139         printf "#endif /* JUST_NSIG */\n";
20140         printf "exit(0);\n}\n";
20141 }
20142 ' >>signal.c
20143 $cat >signal.awk <<'EOP'
20144 BEGIN { ndups = 0 }
20145 $1 ~ /^NSIG$/ { nsig = $2 }
20146 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20147     if ($2 > maxsig) { maxsig = $2 }
20148     if (sig_name[$2]) {
20149         dup_name[ndups] = $1
20150         dup_num[ndups] = $2
20151         ndups++
20152     }
20153     else {
20154         sig_name[$2] = $1
20155         sig_num[$2] = $2
20156     }
20157 }
20158 END {
20159     if (nsig == 0) {
20160         nsig = maxsig + 1
20161     }
20162     printf("NSIG %d\n", nsig);
20163     for (n = 1; n < nsig; n++) {
20164         if (sig_name[n]) {
20165             printf("%s %d\n", sig_name[n], sig_num[n])
20166         }
20167         else {
20168             printf("NUM%d %d\n", n, n)
20169         }
20170     }
20171     for (n = 0; n < ndups; n++) {
20172         printf("%s %d\n", dup_name[n], dup_num[n])
20173     }
20174 }
20175 EOP
20176 $cat >signal_cmd <<EOS
20177 $startsh
20178 if $test -s signal.lst; then
20179     echo "Using your existing signal.lst file"
20180         exit 0
20181 fi
20182 xxx="$xxx"
20183 EOS
20184 $cat >>signal_cmd <<'EOS'
20185
20186 set signal
20187 if eval $compile_ok; then
20188         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
20189 else
20190         echo "(I can't seem be able to compile the whole test program)" >&4
20191         echo "(I'll try it in little pieces.)" >&4
20192         set signal -DJUST_NSIG
20193         if eval $compile_ok; then
20194                 $run ./signal$_exe > signal.nsg
20195                 $cat signal.nsg
20196         else
20197                 echo "I can't seem to figure out how many signals you have." >&4
20198                 echo "Guessing 50." >&4
20199                 echo 'NSIG 50' > signal.nsg
20200         fi
20201         : Now look at all the signal names, one at a time.
20202         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20203                 $cat > signal.c <<EOCP
20204 #include <sys/types.h>
20205 #include <signal.h>
20206 #include <stdio.h>
20207 int main() {
20208 printf("$xx %d\n", SIG${xx});
20209 return 0;
20210 }
20211 EOCP
20212                 set signal
20213                 if eval $compile; then
20214                         echo "SIG${xx} found."
20215                         $run ./signal$_exe  >> signal.ls1
20216                 else
20217                         echo "SIG${xx} NOT found."
20218                 fi
20219         done
20220         if $test -s signal.ls1; then
20221                 $cat signal.nsg signal.ls1 |
20222                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20223         fi
20224
20225 fi
20226 if $test -s signal.lst; then
20227         :
20228 else
20229         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20230         echo 'kill -l' >signal
20231         set X `csh -f <signal`
20232         $rm -f signal
20233         shift
20234         case $# in
20235         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20236         esac
20237         echo $@ | $tr ' ' $trnl | \
20238             $awk '{ printf "%s %d\n", $1, ++s; }
20239                   END { printf "NSIG %d\n", ++s }' >signal.lst
20240 fi
20241 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20242 EOS
20243 chmod a+x signal_cmd
20244 $eunicefix signal_cmd
20245
20246 : generate list of signal names
20247 echo " "
20248 case "$sig_name_init" in
20249 '') doinit=yes ;;
20250 *)  case "$sig_num_init" in
20251     ''|*,*) doinit=yes ;;
20252     esac ;;
20253 esac
20254 case "$doinit" in
20255 yes)
20256         echo "Generating a list of signal names and numbers..." >&4
20257         . ./signal_cmd
20258         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20259         sig_name=`$awk 'BEGIN { printf "ZERO " }
20260                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20261         sig_num=`$awk  'BEGIN { printf "0 " }
20262                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20263         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20264                              !/^NSIG/   { printf "\"%s\", ", $1 }
20265                              END        { printf "0\n" }' signal.lst`
20266         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20267                              !/^NSIG/   { printf "%d, ", $2}
20268                              END        { printf "0\n"}' signal.lst`
20269         ;;
20270 esac
20271 echo "The following $sig_count signals are available:"
20272 echo " "
20273 echo $sig_name | $awk \
20274 'BEGIN { linelen = 0 }
20275 {
20276         for (i = 1; i <= NF; i++) {
20277                 name = "SIG" $i " "
20278                 linelen = linelen + length(name)
20279                 if (linelen > 70) {
20280                         printf "\n"
20281                         linelen = length(name)
20282                 }
20283                 printf "%s", name
20284         }
20285         printf "\n"
20286 }'
20287 sig_size=`echo $sig_name | awk '{print NF}'`
20288 $rm -f signal signal.c signal.awk signal.lst signal_cmd
20289
20290 : Check size of size
20291 echo " "
20292 case "$sizetype" in
20293 *_t) zzz="$sizetype"    ;;
20294 *)   zzz="filesize"     ;;
20295 esac
20296 echo "Checking the size of $zzz..." >&4
20297 cat > try.c <<EOCP
20298 #include <sys/types.h>
20299 #include <stdio.h>
20300 #$i_stdlib I_STDLIB
20301 #ifdef I_STDLIB
20302 #include <stdlib.h>
20303 #endif
20304 int main() {
20305     printf("%d\n", (int)sizeof($sizetype));
20306     exit(0);
20307 }
20308 EOCP
20309 set try
20310 if eval $compile_ok; then
20311         yyy=`$run ./try`
20312         case "$yyy" in
20313         '')     sizesize=4
20314                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20315                 ;;
20316         *)      sizesize=$yyy
20317                 echo "Your $zzz size is $sizesize bytes."
20318                 ;;
20319         esac
20320 else
20321         sizesize=4
20322         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20323 fi
20324
20325
20326 : check for socklen_t
20327 echo " "
20328 echo "Checking to see if you have socklen_t..." >&4
20329 $cat >try.c <<EOCP
20330 #include <sys/types.h>
20331 #$d_socket HAS_SOCKET
20332 #ifdef HAS_SOCKET
20333 #include <sys/socket.h>
20334 #endif
20335 int main() { socklen_t x = 16; }
20336 EOCP
20337 set try
20338 if eval $compile; then
20339         val="$define"
20340         echo "You have socklen_t."
20341 else
20342         val="$undef"
20343         echo "You do not have socklen_t."
20344         case "$sizetype" in
20345         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20346         esac
20347 fi
20348 $rm_try
20349 set d_socklen_t
20350 eval $setvar
20351
20352 : see if this is a socks.h system
20353 set socks.h i_socks
20354 eval $inhdr
20355
20356 : check for type of the size argument to socket calls
20357 case "$d_socket" in
20358 "$define")
20359         $cat <<EOM
20360
20361 Checking to see what type is the last argument of accept().
20362 EOM
20363         yyy=''
20364         case "$d_socklen_t" in
20365         "$define") yyy="$yyy socklen_t"
20366         esac
20367         yyy="$yyy $sizetype int long unsigned"
20368         for xxx in $yyy; do
20369                 case "$socksizetype" in
20370                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
20371                         case "$usesocks" in
20372                         "$define")
20373                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20374                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20375                                         socksizetype="$xxx"
20376                                 fi
20377                                 ;;
20378                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20379                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20380                                         socksizetype="$xxx"
20381                                 fi
20382                                 ;;
20383                         esac
20384                         ;;
20385                 esac
20386         done
20387 : In case none of those worked, prompt the user.
20388         case "$socksizetype" in
20389         '')     rp='What is the type for socket address structure sizes?'
20390                 dflt='int'
20391                 . ./myread
20392                 socksizetype=$ans
20393                 ;;
20394         esac
20395         ;;
20396 *)      : no sockets, so pick relatively harmless default
20397         socksizetype='int'
20398         ;;
20399 esac
20400
20401 : see what type is used for signed size_t
20402 set ssize_t ssizetype int stdio.h sys/types.h
20403 eval $typedef
20404 dflt="$ssizetype"
20405 $cat > try.c <<EOM
20406 #include <stdio.h>
20407 #$i_stdlib I_STDLIB
20408 #ifdef I_STDLIB
20409 #include <stdlib.h>
20410 #endif
20411 #include <sys/types.h>
20412 #define Size_t $sizetype
20413 #define SSize_t $dflt
20414 int main()
20415 {
20416         if (sizeof(Size_t) == sizeof(SSize_t))
20417                 printf("$dflt\n");
20418         else if (sizeof(Size_t) == sizeof(int))
20419                 printf("int\n");
20420         else
20421                 printf("long\n");
20422         exit(0);
20423 }
20424 EOM
20425 echo " "
20426 set try
20427 if eval $compile_ok && $run ./try > /dev/null; then
20428         ssizetype=`$run ./try`
20429         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20430 else
20431         $cat >&4 <<EOM
20432 Help! I can't compile and run the ssize_t test program: please enlighten me!
20433 (This is probably a misconfiguration in your system or libraries, and
20434 you really ought to fix it.  Still, I'll try anyway.)
20435
20436 I need a type that is the same size as $sizetype, but is guaranteed to
20437 be signed.  Common values are ssize_t, int and long.
20438
20439 EOM
20440         rp="What signed type is the same size as $sizetype?"
20441         . ./myread
20442         ssizetype="$ans"
20443 fi
20444 $rm_try
20445
20446 : see what type of char stdio uses.
20447 echo " "
20448 echo '#include <stdio.h>' > stdio.c
20449 $cppstdin $cppminus < stdio.c > stdioh
20450 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20451         echo "Your stdio uses unsigned chars." >&4
20452         stdchar="unsigned char"
20453 else
20454         echo "Your stdio uses signed chars." >&4
20455         stdchar="char"
20456 fi
20457 $rm -f stdio.* stdioh
20458
20459 : see what type uids are declared as in the kernel
20460 echo " "
20461 echo "Looking for the type for user ids returned by getuid()."
20462 set uid_t uidtype xxx stdio.h sys/types.h
20463 eval $typedef
20464 case "$uidtype" in
20465 xxx)
20466         xxx=`./findhdr sys/user.h`
20467         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20468         case $1 in
20469         unsigned) dflt="$1 $2" ;;
20470         *) dflt="$1" ;;
20471         esac
20472         ;;
20473 *) dflt="$uidtype";;
20474 esac
20475 case "$uidtype" in
20476 uid_t)  echo "uid_t found." ;;
20477 *)      rp="What is the type for user ids returned by getuid()?"
20478         . ./myread
20479         uidtype="$ans"
20480         ;;
20481 esac
20482
20483 : Check size of UID
20484 echo " "
20485 case "$uidtype" in
20486 *_t) zzz="$uidtype"     ;;
20487 *)   zzz="uid"          ;;
20488 esac
20489 echo "Checking the size of $zzz..." >&4
20490 cat > try.c <<EOCP
20491 #include <sys/types.h>
20492 #include <stdio.h>
20493 #$i_stdlib I_STDLIB
20494 #ifdef I_STDLIB
20495 #include <stdlib.h>
20496 #endif
20497 int main() {
20498     printf("%d\n", (int)sizeof($uidtype));
20499     exit(0);
20500 }
20501 EOCP
20502 set try
20503 if eval $compile_ok; then
20504         yyy=`$run ./try`
20505         case "$yyy" in
20506         '')     uidsize=4
20507                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20508                 ;;
20509         *)      uidsize=$yyy
20510                 echo "Your $zzz is $uidsize bytes long."
20511                 ;;
20512         esac
20513 else
20514         uidsize=4
20515         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20516 fi
20517
20518 : Check if UID is signed
20519 echo " "
20520 case "$uidtype" in
20521 *_t) zzz="$uidtype"     ;;
20522 *)   zzz="uid"          ;;
20523 esac
20524 echo "Checking the sign of $zzz..." >&4
20525 cat > try.c <<EOCP
20526 #include <sys/types.h>
20527 #include <stdio.h>
20528 int main() {
20529         $uidtype foo = -1;
20530         if (foo < 0)
20531                 printf("-1\n");
20532         else
20533                 printf("1\n");
20534 }
20535 EOCP
20536 set try
20537 if eval $compile; then
20538         yyy=`$run ./try`
20539         case "$yyy" in
20540         '')     uidsign=1
20541                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20542                 ;;
20543         *)      uidsign=$yyy
20544                 case "$uidsign" in
20545                  1) echo "Your $zzz is unsigned." ;;
20546                 -1) echo "Your $zzz is signed."   ;;
20547                 esac
20548                 ;;
20549         esac
20550 else
20551         uidsign=1
20552         echo "(I can't compile the test program--guessing unsigned.)" >&4
20553 fi
20554
20555
20556
20557 echo " "
20558 $echo "Checking the format string to be used for uids..." >&4
20559
20560 case "$uidsign" in
20561 -1)     if $test X"$uidsize" = X"$ivsize"; then
20562                 uidformat="$ivdformat"
20563         else
20564                 if $test X"$uidsize" = X"$longsize"; then
20565                         uidformat='"ld"'
20566                 else
20567                         if $test X"$uidsize" = X"$intsize"; then
20568                                 uidformat='"d"'
20569                         else
20570                                 if $test X"$uidsize" = X"$shortsize"; then
20571                                         uidformat='"hd"'
20572                                 fi
20573                         fi
20574                 fi
20575         fi
20576         ;;
20577 *)      if $test X"$uidsize" = X"$uvsize"; then
20578                 uidformat="$uvuformat"
20579         else
20580                 if $test X"$uidsize" = X"$longsize"; then
20581                         uidformat='"lu"'
20582                 else
20583                         if $test X"$uidsize" = X"$intsize"; then
20584                                 uidformat='"u"'
20585                         else
20586                                 if $test X"$uidsize" = X"$shortsize"; then
20587                                         uidformat='"hu"'
20588                                 fi
20589                         fi
20590                 fi
20591         fi
20592         ;;
20593 esac
20594
20595
20596 case "$usesitecustomize" in
20597     $define|true|[Yy]*)
20598         usesitecustomize="$define"
20599         ;;
20600     *)
20601         usesitecustomize="$undef"
20602         ;;
20603     esac
20604
20605 : determine compiler compiler
20606 case "$yacc" in
20607 '')
20608         dflt=yacc;;
20609 *)
20610         dflt="$yacc";;
20611 esac
20612 echo " "
20613 comp='yacc'
20614 if $test -f "$byacc$_exe"; then
20615         dflt="$byacc"
20616         comp="byacc or $comp"
20617 fi
20618 if $test -f "$bison$_exe"; then
20619         comp="$comp or bison -y"
20620 fi
20621 rp="Which compiler compiler ($comp) shall I use?"
20622 . ./myread
20623 yacc="$ans"
20624 case "$yacc" in
20625 *bis*)
20626         case "$yacc" in
20627         *-y*) ;;
20628         *)
20629                 yacc="$yacc -y"
20630                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20631                 ;;
20632         esac
20633         ;;
20634 esac
20635
20636
20637 : see if this is a assert.h system
20638 set assert.h i_assert
20639 eval $inhdr
20640
20641 : see if this is a fp.h system
20642 set fp.h i_fp
20643 eval $inhdr
20644
20645 : see if this is a fp_class.h system
20646 set fp_class.h i_fp_class
20647 eval $inhdr
20648
20649 : see if gdbm.h is available
20650 set gdbm.h t_gdbm
20651 eval $inhdr
20652 case "$t_gdbm" in
20653 $define)
20654         : see if gdbm_open exists
20655         set gdbm_open d_gdbm_open
20656         eval $inlibc
20657         case "$d_gdbm_open" in
20658         $undef)
20659                 t_gdbm="$undef"
20660                 echo "We won't be including <gdbm.h>"
20661                 ;;
20662         esac
20663         ;;
20664 esac
20665 val="$t_gdbm"
20666 set i_gdbm
20667 eval $setvar
20668
20669 : see if this is a ieeefp.h system
20670 case "$i_ieeefp" in
20671 '' ) set ieeefp.h i_ieeefp
20672      eval $inhdr
20673      ;;
20674 esac
20675
20676 : see if this is a libutil.h system
20677 set libutil.h i_libutil
20678 eval $inhdr
20679
20680 : see if mach cthreads are available
20681 if test "X$usethreads" = "X$define"; then
20682         set mach/cthreads.h i_machcthr
20683         eval $inhdr
20684 else
20685         i_machcthr="$undef"
20686 fi
20687
20688 : see if this is a mntent.h system
20689 set mntent.h i_mntent
20690 eval $inhdr
20691
20692 : see if ndbm.h is available
20693 set ndbm.h t_ndbm
20694 eval $inhdr
20695
20696 case "$t_ndbm" in
20697 $undef)
20698     # Some Linux distributions such as RedHat 7.1 put the
20699     # ndbm.h header in /usr/include/gdbm/ndbm.h.
20700     if $test -f /usr/include/gdbm/ndbm.h; then
20701         echo '<gdbm/ndbm.h> found.'
20702         ccflags="$ccflags -I/usr/include/gdbm"
20703         cppflags="$cppflags -I/usr/include/gdbm"
20704         t_ndbm=$define
20705     fi
20706     ;;
20707 esac
20708
20709 case "$t_ndbm" in
20710 $define)
20711         : see if dbm_open exists
20712         set dbm_open d_dbm_open
20713         eval $inlibc
20714         case "$d_dbm_open" in
20715         $undef)
20716                 t_ndbm="$undef"
20717                 echo "We won't be including <ndbm.h>"
20718                 ;;
20719         esac
20720         ;;
20721 esac
20722 val="$t_ndbm"
20723 set i_ndbm
20724 eval $setvar
20725
20726 : see if net/errno.h is available
20727 val=''
20728 set net/errno.h val
20729 eval $inhdr
20730
20731 : Unfortunately, it causes problems on some systems.  Arrgh.
20732 case "$val" in
20733 $define)
20734         cat > try.c <<'EOM'
20735 #include <stdio.h>
20736 #include <errno.h>
20737 #include <net/errno.h>
20738 int func()
20739 {
20740         return ENOTSOCK;
20741 }
20742 EOM
20743         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20744                 echo "We'll be including <net/errno.h>." >&4
20745         else
20746                 echo "We won't be including <net/errno.h>." >&4
20747                 val="$undef"
20748         fi
20749         $rm_try
20750         ;;
20751 esac
20752 set i_neterrno
20753 eval $setvar
20754
20755 : see if netinet/tcp.h is available
20756 set netinet/tcp.h i_netinettcp
20757 eval $inhdr
20758
20759 : see if this is a poll.h system
20760 set poll.h i_poll
20761 eval $inhdr
20762
20763 : see if this is a prot.h system
20764 set prot.h i_prot
20765 eval $inhdr
20766
20767 : Preprocessor symbols
20768 echo " "
20769 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20770 $cat <<'EOSH' > Cppsym.know
20771 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20772 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20773 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20774 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20775 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20776 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20777 bull c cadmus clipper CMU COFF COMPILER_VERSION
20778 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20779 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20780 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20781 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20782 GLIBC GLIBC_MINOR
20783 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20784 H3050R H3050RX hbullx20 hcx host_mips
20785 hp200 hp300 hp700 HP700 hp800 hp9000
20786 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20787 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20788 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20789 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20790 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20791 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20792 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20793 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20794 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20795 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20796 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20797 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20798 MATH_HAS_NO_SIDE_EFFECTS
20799 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20800 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20801 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20802 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20803 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20804 NetBSD news1500 news1700 news1800 news1900 news3700
20805 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20806 ns32016 ns32332 ns32k nsc32000
20807 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20808 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20809 pc532 pdp11 PGC PIC plexus PORTAR posix
20810 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20811 POSIX_C_SOURCE POSIX_SOURCE POWER
20812 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
20813 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20814 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20815 sony sony_news sonyrisc sparc sparclite spectrum
20816 stardent stdc STDC_EXT stratos sun sun3 sun386
20817 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20818 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20819 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20820 sysV68 sysV88 Tek4132 Tek4300 titan
20821 TM3200 TM5400 TM5600
20822 tower tower32 tower32_200 tower32_600 tower32_700
20823 tower32_800 tower32_850 tss
20824 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20825 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20826 unix UNIX95 UNIX99 unixpc unos
20827 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20828 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20829 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20830 USGr4 USGr4_2
20831 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20832 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20833 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20834 z8000
20835 EOSH
20836 # Maybe put other stuff here too.
20837 cat <<EOSH >>Cppsym.know
20838 $osname
20839 EOSH
20840 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20841 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20842 $cat Cppsym.know > Cppsym.c
20843 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20844 $rm -f Cppsym.a Cppsym.b Cppsym.c
20845 cat <<EOSH > Cppsym
20846 $startsh
20847 if $test \$# -gt 0; then
20848     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20849     if $test -s Cppsym.got; then
20850         $rm -f Cppsym.got
20851         exit 0
20852     fi
20853     $rm -f Cppsym.got
20854     exit 1
20855 else
20856     $tr " " "$trnl" | ./Cppsym.try
20857     exit 0
20858 fi
20859 EOSH
20860 chmod +x Cppsym
20861 $eunicefix Cppsym
20862 cat <<EOSH > Cppsym.try
20863 $startsh
20864 cat <<'EOCP' > try.c
20865 #include <stdio.h>
20866 #if cpp_stuff == 1
20867 #define STRINGIFY(a)    "a"
20868 #endif
20869 #if cpp_stuff == 42
20870 #define StGiFy(a)  #a
20871 #define STRINGIFY(a)    StGiFy(a)
20872 #endif
20873 #if $cpp_stuff != 1 && $cpp_stuff != 42
20874 #   include "Bletch: How does this C preprocessor stringify macros?"
20875 #endif
20876 int main() {
20877 EOCP
20878 $awk \\
20879 EOSH
20880 cat <<'EOSH' >> Cppsym.try
20881 'length($1) > 0 {
20882     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20883     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20884     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20885     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
20886 }'       >> try.c
20887 echo 'return 0;}' >> try.c
20888 EOSH
20889 cat <<EOSH >> Cppsym.try
20890 ccflags="$ccflags"
20891 case "$osname-$gccversion" in
20892 irix-) ccflags="\$ccflags -woff 1178" ;;
20893 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20894 esac
20895 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
20896 EOSH
20897 chmod +x Cppsym.try
20898 $eunicefix Cppsym.try
20899 ./Cppsym < Cppsym.know > Cppsym.true
20900 : Add in any linux cpp "predefined macros":
20901 case "$osname::$gccversion" in
20902   *linux*::*.*)
20903     tHdrH=_tmpHdr
20904     rm -f $tHdrH'.h' $tHdrH
20905     touch $tHdrH'.h'
20906     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
20907        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
20908        if [ -s $tHdrH'_cppsym.real' ]; then
20909           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
20910        fi
20911     fi
20912     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
20913   ;;
20914 esac
20915 : now check the C compiler for additional symbols
20916 postprocess_cc_v=''
20917 case "$osname" in
20918 aix) postprocess_cc_v="|$tr , ' '" ;;
20919 esac
20920 $cat >ccsym <<EOS
20921 $startsh
20922 $cat >tmp.c <<EOF
20923 extern int foo;
20924 EOF
20925 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20926 do
20927         case "\$i" in
20928         -D*) echo "\$i" | $sed 's/^-D//';;
20929         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
20930         esac
20931 done
20932 $rm_try
20933 EOS
20934 postprocess_cc_v=''
20935 chmod +x ccsym
20936 $eunicefix ccsym
20937 ./ccsym > ccsym1.raw
20938 if $test -s ccsym1.raw; then
20939        $sort ccsym1.raw | $uniq >ccsym.raw
20940 else
20941        mv ccsym1.raw ccsym.raw
20942 fi
20943
20944 $awk '/\=/ { print $0; next }
20945         { print $0"=1" }' ccsym.raw >ccsym.list
20946 $comm -13 Cppsym.true ccsym.list >ccsym.own
20947 $comm -12 Cppsym.true ccsym.list >ccsym.com
20948 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
20949 also=''
20950 if $test -z ccsym.raw; then
20951         echo "Your C compiler doesn't seem to define any symbols!" >&4
20952         echo " "
20953         echo "However, your C preprocessor defines the following symbols:"
20954         $cat Cppsym.true
20955         ccsymbols=''
20956         cppsymbols=`$cat Cppsym.true`
20957         cppsymbols=`echo $cppsymbols`
20958         cppccsymbols="$cppsymbols"
20959 else
20960         if $test -s ccsym.com; then
20961                 echo "Your C compiler and pre-processor define these symbols:"
20962                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20963                 also='also '
20964                 symbols='ones'
20965                 cppccsymbols=`$cat ccsym.com`
20966                 cppccsymbols=`echo $cppccsymbols`
20967                 $test "$silent" || sleep 1
20968         fi
20969         if $test -s ccsym.cpp; then
20970                 $test "$also" && echo " "
20971                 echo "Your C pre-processor ${also}defines the following symbols:"
20972                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20973                 also='further '
20974                 cppsymbols=`$cat ccsym.cpp`
20975                 cppsymbols=`echo $cppsymbols`
20976                 $test "$silent" || sleep 1
20977         fi
20978         if $test -s ccsym.own; then
20979                 $test "$also" && echo " "
20980                 echo "Your C compiler ${also}defines the following cpp symbols:"
20981                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20982                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20983                 ccsymbols=`$cat ccsym.own`
20984                 ccsymbols=`echo $ccsymbols`
20985                 $test "$silent" || sleep 1
20986         fi
20987 fi
20988
20989 : see if this is a termio system
20990 val="$undef"
20991 val2="$undef"
20992 val3="$undef"
20993 if $test `./findhdr termios.h`; then
20994         set tcsetattr i_termios
20995         eval $inlibc
20996         val3="$i_termios"
20997 fi
20998 echo " "
20999 case "$val3" in
21000 "$define") echo "You have POSIX termios.h... good!" >&4;;
21001 *) if ./Cppsym pyr; then
21002                 case "`/bin/universe`" in
21003                 ucb) if $test `./findhdr sgtty.h`; then
21004                                 val2="$define"
21005                                 echo "<sgtty.h> found." >&4
21006                         else
21007                                 echo "System is pyramid with BSD universe."
21008                                 echo "<sgtty.h> not found--you could have problems." >&4
21009                         fi;;
21010                 *) if $test `./findhdr termio.h`; then
21011                                 val="$define"
21012                                 echo "<termio.h> found." >&4
21013                         else
21014                                 echo "System is pyramid with USG universe."
21015                                 echo "<termio.h> not found--you could have problems." >&4
21016                         fi;;
21017                 esac
21018         elif ./usg; then
21019                 if $test `./findhdr termio.h`; then
21020                         echo "<termio.h> found." >&4
21021                         val="$define"
21022                 elif $test `./findhdr sgtty.h`; then
21023                         echo "<sgtty.h> found." >&4
21024                         val2="$define"
21025                 else
21026 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
21027                 fi
21028         else
21029                 if $test `./findhdr sgtty.h`; then
21030                         echo "<sgtty.h> found." >&4
21031                         val2="$define"
21032                 elif $test `./findhdr termio.h`; then
21033                         echo "<termio.h> found." >&4
21034                         val="$define"
21035                 else
21036 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
21037                 fi
21038         fi;;
21039 esac
21040 set i_termio; eval $setvar
21041 val=$val2; set i_sgtty; eval $setvar
21042 val=$val3; set i_termios; eval $setvar
21043
21044 : see if stddef is available
21045 set stddef.h i_stddef
21046 eval $inhdr
21047
21048 : see if sys/access.h is available
21049 set sys/access.h i_sysaccess
21050 eval $inhdr
21051
21052 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
21053 set sys/filio.h i_sysfilio
21054 eval $inhdr
21055 echo " "
21056 if $test `./findhdr sys/ioctl.h`; then
21057         val="$define"
21058         echo '<sys/ioctl.h> found.' >&4
21059 else
21060         val="$undef"
21061         if $test $i_sysfilio = "$define"; then
21062             echo '<sys/ioctl.h> NOT found.' >&4
21063         else
21064                 $test $i_sgtty = "$define" && xxx="sgtty.h"
21065                 $test $i_termio = "$define" && xxx="termio.h"
21066                 $test $i_termios = "$define" && xxx="termios.h"
21067 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
21068         fi
21069 fi
21070 set i_sysioctl
21071 eval $setvar
21072
21073 : see if socket ioctl defs are in sys/sockio.h
21074 echo " "
21075 xxx=`./findhdr sys/sockio.h`
21076 if $test "$xxx"; then
21077         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
21078                 val="$define"
21079                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
21080         else
21081                 val="$undef"
21082                 echo "No socket ioctls found in <sys/sockio.h>." >&4
21083         fi
21084 else
21085         val="$undef"
21086         $cat <<EOM
21087 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
21088 EOM
21089 fi
21090 set i_syssockio
21091 eval $setvar
21092
21093
21094 : see if this is a syslog.h system
21095 set syslog.h i_syslog
21096 eval $inhdr
21097
21098
21099 : see if this is a sys/mode.h system
21100 set sys/mode.h i_sysmode
21101 eval $inhdr
21102
21103 : see if sys/resource.h has to be included
21104 set sys/resource.h i_sysresrc
21105 eval $inhdr
21106
21107 : see if sys/security.h is available
21108 set sys/security.h i_syssecrt
21109 eval $inhdr
21110
21111 : see if this is a sys/statvfs.h system
21112 set sys/statvfs.h i_sysstatvfs
21113 eval $inhdr
21114
21115 : see if this is a sys/un.h system
21116 set sys/un.h i_sysun
21117 eval $inhdr
21118
21119
21120 : see if this is a sys/utsname.h system
21121 set sys/utsname.h i_sysutsname
21122 eval $inhdr
21123
21124 : see if this is a syswait system
21125 set sys/wait.h i_syswait
21126 eval $inhdr
21127
21128 : see if this is a ustat.h system
21129 set ustat.h i_ustat
21130 eval $inhdr
21131
21132 : see if this is an utime system
21133 set utime.h i_utime
21134 eval $inhdr
21135
21136 : see if this is a values.h system
21137 set values.h i_values
21138 eval $inhdr
21139
21140 : see if this is a vfork system
21141 case "$d_vfork" in
21142 "$define")
21143         set vfork.h i_vfork
21144         eval $inhdr
21145         ;;
21146 *)
21147         i_vfork="$undef"
21148         ;;
21149 esac
21150
21151 : Check extensions
21152 echo " "
21153 echo "Looking for extensions..." >&4
21154 : If we are using the old config.sh, known_extensions may contain
21155 : old or inaccurate or duplicate values.
21156 known_extensions=''
21157 nonxs_extensions=''
21158 : We do not use find because it might not be available.
21159 : We do not just use MANIFEST because the user may have dropped
21160 : some additional extensions into the source tree and expect them
21161 : to be built.
21162
21163 : Function to recursively find available extensions, ignoring DynaLoader
21164 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21165 find_extensions='
21166     for xxx in *; do
21167         case "$xxx" in
21168             DynaLoader|dynaload) ;;
21169             *)
21170             if $test -f $xxx/$xxx.xs -o -f $xxx/$xxx.c; then
21171                 known_extensions="$known_extensions $1$xxx";
21172             elif $test -f $xxx/Makefile.PL; then
21173                 nonxs_extensions="$nonxs_extensions $1$xxx";
21174             else
21175                 if $test -d $xxx -a $# -lt 10; then
21176                     set $1$xxx/ $*;
21177                     cd "$xxx";
21178                     eval $find_extensions;
21179                     cd ..;
21180                     shift;
21181                 fi;
21182             fi
21183             ;;
21184         esac;
21185     done'
21186 tdir=`pwd`
21187 cd "$rsrc/ext"
21188 set X
21189 shift
21190 eval $find_extensions
21191 # Special case:  Add in modules that nest beyond the first level.
21192 # Currently threads/shared and Hash/Util/FieldHash, since they are
21193 # not picked up by the recursive find above (and adding in general
21194 # recursive finding breaks SDBM_File/sdbm).
21195 # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21196 known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
21197 set X $known_extensions
21198 shift
21199 known_extensions="$*"
21200 set X $nonxs_extensions
21201 shift
21202 nonxs_extensions="$*"
21203 cd "$tdir"
21204
21205 : Now see which are supported on this system.
21206 avail_ext=''
21207 for xxx in $known_extensions ; do
21208         case "$xxx" in
21209         DB_File|db_file)
21210                 case "$i_db" in
21211                 $define) avail_ext="$avail_ext $xxx" ;;
21212                 esac
21213                 ;;
21214         GDBM_File|gdbm_fil)
21215                 case "$i_gdbm" in
21216                 $define) avail_ext="$avail_ext $xxx" ;;
21217                 esac
21218                 ;;
21219         I18N/Langinfo|i18n_lan)
21220                 case "$i_langinfo$d_nl_langinfo" in
21221                 $define$define) avail_ext="$avail_ext $xxx" ;;
21222                 esac
21223                 ;;
21224         IPC/SysV|ipc/sysv)
21225                 : XXX Do we need a useipcsysv variable here
21226                 case "${d_msg}${d_sem}${d_shm}" in
21227                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21228                 esac
21229                 ;;
21230         NDBM_File|ndbm_fil)
21231                 case "$i_ndbm" in
21232                 $define)
21233                     case "$osname-$use64bitint" in
21234                     hpux-define)
21235                         case "$libs" in
21236                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21237                         esac
21238                         ;;
21239                     *) avail_ext="$avail_ext $xxx" ;;
21240                     esac
21241                     ;;
21242                 esac
21243                 ;;
21244         ODBM_File|odbm_fil)
21245                 case "${i_dbm}${i_rpcsvcdbm}" in
21246                 *"${define}"*)
21247                     case "$d_cplusplus" in
21248                     define) ;; # delete as a function name will not work
21249                     *)  case "$osname-$use64bitint" in
21250                         hpux-define)
21251                             case "$libs" in
21252                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21253                             esac
21254                             ;;
21255                         *) avail_ext="$avail_ext $xxx" ;;
21256                         esac
21257                         ;;
21258                     esac
21259                     ;;
21260                 esac
21261                 ;;
21262         Opcode|opcode)
21263                 case "$useopcode" in
21264                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21265                 esac
21266                 ;;
21267         POSIX|posix)
21268                 case "$useposix" in
21269                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21270                 esac
21271                 ;;
21272         Socket|socket)
21273                 case "$d_socket" in
21274                 true|$define|y)
21275                     case "$osname" in
21276                     beos) ;; # not unless BONE
21277                     *) avail_ext="$avail_ext $xxx" ;;
21278                     esac
21279                     ;;
21280                 esac
21281                 ;;
21282         Sys/Syslog|sys/syslog)
21283                 : XXX syslog requires socket
21284                 case "$d_socket" in
21285                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21286                 esac
21287                 ;;
21288         Thread|thread)
21289                 case "$usethreads" in
21290                 true|$define|y)
21291                         case "$use5005threads" in
21292                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
21293                         esac
21294                 esac
21295                 ;;
21296         threads|threads/shared)
21297                 # threads and threads::shared are special cases.
21298                 # To stop people from asking "Perl 5.8.0 was supposed
21299                 # to have this new fancy threads implementation but my
21300                 # perl doesn't have it" and from people trying to
21301                 # (re)install the threads module using CPAN.pm and
21302                 # CPAN.pm then offering to reinstall Perl 5.8.0,
21303                 # the threads.pm and threads/shared.pm will always be
21304                 # there, croaking informatively ("you need to rebuild
21305                 # all of Perl with threads, sorry") when threads haven't
21306                 # been compiled in.
21307                 # --jhi
21308                 avail_ext="$avail_ext $xxx"
21309                 ;;
21310         Win32*)
21311                 case "$osname" in
21312                 cygwin) avail_ext="$avail_ext $xxx" ;;
21313                 esac
21314                 ;;
21315         XS/APItest|xs/apitest)
21316                 # This is just for testing.  Skip it unless we have dynamic loading.
21317
21318                 case "$usedl" in
21319                 $define) avail_ext="$avail_ext $xxx" ;;
21320                 esac
21321                 ;;
21322         XS/Typemap|xs/typemap)
21323                 # This is just for testing.  Skip it unless we have dynamic loading.
21324                 case "$usedl" in
21325                 $define) avail_ext="$avail_ext $xxx" ;;
21326                 esac
21327                 ;;
21328         *)      avail_ext="$avail_ext $xxx"
21329                 ;;
21330         esac
21331 done
21332
21333 set X $avail_ext
21334 shift
21335 avail_ext="$*"
21336
21337 case "$onlyextensions" in
21338 '') ;;
21339 *)  keepextensions=''
21340     echo "You have requested that only certains extensions be included..." >&4
21341     for i in $onlyextensions; do
21342         case " $avail_ext " in
21343         *" $i "*)
21344             echo "Keeping extension $i."
21345             keepextensions="$keepextensions $i"
21346             ;;
21347         *) echo "Ignoring extension $i." ;;
21348         esac
21349     done
21350     avail_ext="$keepextensions"
21351     ;;
21352 esac
21353
21354 case "$noextensions" in
21355 '') ;;
21356 *)  keepextensions=''
21357     echo "You have requested that certain extensions be ignored..." >&4
21358     for i in $avail_ext; do
21359         case " $noextensions " in
21360         *" $i "*) echo "Ignoring extension $i." ;;
21361         *) echo "Keeping extension $i.";
21362            keepextensions="$keepextensions $i"
21363            ;;
21364         esac
21365     done
21366     avail_ext="$keepextensions"
21367     ;;
21368 esac
21369
21370 : Now see which nonxs extensions are supported on this system.
21371 : For now assume all are.
21372 nonxs_ext=''
21373 for xxx in $nonxs_extensions ; do
21374         case "$xxx" in
21375         *)      nonxs_ext="$nonxs_ext $xxx"
21376                 ;;
21377         esac
21378 done
21379
21380 set X $nonxs_ext
21381 shift
21382 nonxs_ext="$*"
21383
21384 case $usedl in
21385 $define)
21386         $cat <<EOM
21387 A number of extensions are supplied with $package.  You may choose to
21388 compile these extensions for dynamic loading (the default), compile
21389 them into the $package executable (static loading), or not include
21390 them at all.  Answer "none" to include no extensions.
21391 Note that DynaLoader is always built and need not be mentioned here.
21392
21393 EOM
21394         case "$dynamic_ext" in
21395         '')
21396                 : Exclude those listed in static_ext
21397                 dflt=''
21398                 for xxx in $avail_ext; do
21399                         case " $static_ext " in
21400                         *" $xxx "*) ;;
21401                         *) dflt="$dflt $xxx" ;;
21402                         esac
21403                 done
21404                 set X $dflt
21405                 shift
21406                 dflt="$*"
21407                 ;;
21408         *)      dflt="$dynamic_ext"
21409                 # Perhaps we are reusing an old out-of-date config.sh.
21410                 case "$hint" in
21411                 previous)
21412                         if test X"$dynamic_ext" != X"$avail_ext"; then
21413                                 $cat <<EOM
21414 NOTICE:  Your previous config.sh list may be incorrect.
21415 The extensions now available to you are
21416         ${avail_ext}
21417 but the default list from your previous config.sh is
21418         ${dynamic_ext}
21419
21420 EOM
21421                         fi
21422                         ;;
21423                 esac
21424                 ;;
21425         esac
21426         case "$dflt" in
21427         '')     dflt=none;;
21428         esac
21429         rp="What extensions do you wish to load dynamically?"
21430         . ./myread
21431         case "$ans" in
21432         none) dynamic_ext=' ' ;;
21433         *) dynamic_ext="$ans" ;;
21434         esac
21435
21436         case "$static_ext" in
21437         '')
21438                 : Exclude those already listed in dynamic linking
21439                 dflt=''
21440                 for xxx in $avail_ext; do
21441                         case " $dynamic_ext " in
21442                         *" $xxx "*) ;;
21443                         *) dflt="$dflt $xxx" ;;
21444                         esac
21445                 done
21446                 set X $dflt
21447                 shift
21448                 dflt="$*"
21449                 ;;
21450         *)  dflt="$static_ext"
21451                 ;;
21452         esac
21453
21454         case "$dflt" in
21455         '')     dflt=none;;
21456         esac
21457         rp="What extensions do you wish to load statically?"
21458         . ./myread
21459         case "$ans" in
21460         none) static_ext=' ' ;;
21461         *) static_ext="$ans" ;;
21462         esac
21463         ;;
21464 *)
21465         $cat <<EOM
21466 A number of extensions are supplied with $package.  Answer "none"
21467 to include no extensions.
21468 Note that DynaLoader is always built and need not be mentioned here.
21469
21470 EOM
21471         case "$static_ext" in
21472         '') dflt="$avail_ext" ;;
21473         *)      dflt="$static_ext"
21474                 # Perhaps we are reusing an old out-of-date config.sh.
21475                 case "$hint" in
21476                 previous)
21477                         if test X"$static_ext" != X"$avail_ext"; then
21478                                 $cat <<EOM
21479 NOTICE:  Your previous config.sh list may be incorrect.
21480 The extensions now available to you are
21481         ${avail_ext}
21482 but the default list from your previous config.sh is
21483         ${static_ext}
21484
21485 EOM
21486                         fi
21487                         ;;
21488                 esac
21489                 ;;
21490         esac
21491         : Exclude those that are not xs extensions
21492         case "$dflt" in
21493         '')     dflt=none;;
21494         esac
21495         rp="What extensions do you wish to include?"
21496         . ./myread
21497         case "$ans" in
21498         none) static_ext=' ' ;;
21499         *) static_ext="$ans" ;;
21500         esac
21501         ;;
21502 esac
21503 #
21504 # Encode is a special case.  If we are building Encode as a static
21505 # extension, we need to explicitly list its subextensions as well.
21506 # For other nested extensions, this is handled automatically by
21507 # the appropriate Makefile.PL.
21508 case " $static_ext " in
21509         *" Encode "*) # Add the subextensions of Encode
21510         cd "$rsrc/ext"
21511         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21512                 static_ext="$static_ext Encode/$xxx"
21513         done
21514         cd "$tdir"
21515         ;;
21516 esac
21517
21518 set X $dynamic_ext $static_ext $nonxs_ext
21519 shift
21520 extensions="$*"
21521
21522 # Sanity check:  We require an extension suitable for use with
21523 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21524 # should show up as failures in the test suite, but it's helpful to
21525 # catch them now.) The 'extensions' list is normally sorted
21526 # alphabetically, so we need to accept either
21527 #    DB_File ... Fcntl ... IO  ....
21528 # or something like
21529 #    Fcntl ... NDBM_File ... IO  ....
21530 case " $extensions"  in
21531 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21532 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21533 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21534 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21535    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21536    ;;
21537 esac
21538
21539 : Remove libraries needed only for extensions
21540 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21541 : The exception is SunOS 4.x, which needs them.
21542 case "${osname}X${osvers}" in
21543 sunos*X4*)
21544     perllibs="$libs"
21545     ;;
21546 *) case "$usedl" in
21547     $define|true|[yY]*)
21548             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21549             shift
21550             perllibs="$*"
21551             ;;
21552     *)  perllibs="$libs"
21553             ;;
21554     esac
21555     ;;
21556 esac
21557
21558 : Remove build directory name from cppstdin so it can be used from
21559 : either the present location or the final installed location.
21560 echo " "
21561 : Get out of the UU directory to get correct path name.
21562 cd ..
21563 case "$cppstdin" in
21564 `pwd`/cppstdin)
21565         echo "Stripping down cppstdin path name"
21566         cppstdin=cppstdin
21567         ;;
21568 esac
21569 cd UU
21570
21571 : end of configuration questions
21572 echo " "
21573 echo "End of configuration questions."
21574 echo " "
21575
21576 : back to where it started
21577 if test -d ../UU; then
21578         cd ..
21579 fi
21580
21581 : configuration may be patched via a 'config.arch' file
21582 if $test -f config.arch; then
21583         echo "I see a config.arch file, loading it."
21584         . ./config.arch
21585 fi
21586
21587 : configuration may be patched via a 'config.over' file
21588 if $test -f config.over; then
21589         echo " "
21590         dflt=y
21591         rp='I see a config.over file.  Do you wish to load it?'
21592         . UU/myread
21593         case "$ans" in
21594         n*) echo "OK, I'll ignore it.";;
21595         *)      . ./config.over
21596                 echo "Configuration override changes have been loaded."
21597                 ;;
21598         esac
21599 fi
21600
21601 : in case they want portability, strip down executable paths
21602 case "$d_portable" in
21603 "$define")
21604         echo " "
21605         echo "Stripping down executable paths..." >&4
21606         for file in $loclist $trylist; do
21607                 eval temp=\$$file
21608                 eval $file=`basename $temp`
21609         done
21610         ;;
21611 esac
21612
21613 : create config.sh file
21614 echo " "
21615 echo "Creating config.sh..." >&4
21616 $spitshell <<EOT >config.sh
21617 $startsh
21618 #
21619 # This file was produced by running the Configure script. It holds all the
21620 # definitions figured out by Configure. Should you modify one of these values,
21621 # do not forget to propagate your changes by running "Configure -der". You may
21622 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21623 #
21624
21625 # Package name      : $package
21626 # Source directory  : $src
21627 # Configuration time: $cf_time
21628 # Configured by     : $cf_by
21629 # Target system     : $myuname
21630
21631 Author='$Author'
21632 Date='$Date'
21633 Header='$Header'
21634 Id='$Id'
21635 Locker='$Locker'
21636 Log='$Log'
21637 Mcc='$Mcc'
21638 RCSfile='$RCSfile'
21639 Revision='$Revision'
21640 Source='$Source'
21641 State='$State'
21642 _a='$_a'
21643 _exe='$_exe'
21644 _o='$_o'
21645 afs='$afs'
21646 afsroot='$afsroot'
21647 alignbytes='$alignbytes'
21648 ansi2knr='$ansi2knr'
21649 aphostname='$aphostname'
21650 api_revision='$api_revision'
21651 api_subversion='$api_subversion'
21652 api_version='$api_version'
21653 api_versionstring='$api_versionstring'
21654 ar='$ar'
21655 archlib='$archlib'
21656 archlibexp='$archlibexp'
21657 archname64='$archname64'
21658 archname='$archname'
21659 archobjs='$archobjs'
21660 asctime_r_proto='$asctime_r_proto'
21661 awk='$awk'
21662 baserev='$baserev'
21663 bash='$bash'
21664 bin='$bin'
21665 binexp='$binexp'
21666 bison='$bison'
21667 byacc='$byacc'
21668 byteorder='$byteorder'
21669 c='$c'
21670 castflags='$castflags'
21671 cat='$cat'
21672 cc='$cc'
21673 cccdlflags='$cccdlflags'
21674 ccdlflags='$ccdlflags'
21675 ccflags='$ccflags'
21676 ccflags_uselargefiles='$ccflags_uselargefiles'
21677 ccname='$ccname'
21678 ccsymbols='$ccsymbols'
21679 ccversion='$ccversion'
21680 cf_by='$cf_by'
21681 cf_email='$cf_email'
21682 cf_time='$cf_time'
21683 chgrp='$chgrp'
21684 chmod='$chmod'
21685 chown='$chown'
21686 clocktype='$clocktype'
21687 comm='$comm'
21688 compress='$compress'
21689 contains='$contains'
21690 cp='$cp'
21691 cpio='$cpio'
21692 cpp='$cpp'
21693 cpp_stuff='$cpp_stuff'
21694 cppccsymbols='$cppccsymbols'
21695 cppflags='$cppflags'
21696 cpplast='$cpplast'
21697 cppminus='$cppminus'
21698 cpprun='$cpprun'
21699 cppstdin='$cppstdin'
21700 cppsymbols='$cppsymbols'
21701 crypt_r_proto='$crypt_r_proto'
21702 cryptlib='$cryptlib'
21703 csh='$csh'
21704 ctermid_r_proto='$ctermid_r_proto'
21705 ctime_r_proto='$ctime_r_proto'
21706 d_Gconvert='$d_Gconvert'
21707 d_PRIEUldbl='$d_PRIEUldbl'
21708 d_PRIFUldbl='$d_PRIFUldbl'
21709 d_PRIGUldbl='$d_PRIGUldbl'
21710 d_PRIXU64='$d_PRIXU64'
21711 d_PRId64='$d_PRId64'
21712 d_PRIeldbl='$d_PRIeldbl'
21713 d_PRIfldbl='$d_PRIfldbl'
21714 d_PRIgldbl='$d_PRIgldbl'
21715 d_PRIi64='$d_PRIi64'
21716 d_PRIo64='$d_PRIo64'
21717 d_PRIu64='$d_PRIu64'
21718 d_PRIx64='$d_PRIx64'
21719 d_SCNfldbl='$d_SCNfldbl'
21720 d__fwalk='$d__fwalk'
21721 d_access='$d_access'
21722 d_accessx='$d_accessx'
21723 d_aintl='$d_aintl'
21724 d_alarm='$d_alarm'
21725 d_archlib='$d_archlib'
21726 d_asctime_r='$d_asctime_r'
21727 d_atolf='$d_atolf'
21728 d_atoll='$d_atoll'
21729 d_attribute_format='$d_attribute_format'
21730 d_attribute_malloc='$d_attribute_malloc'
21731 d_attribute_nonnull='$d_attribute_nonnull'
21732 d_attribute_noreturn='$d_attribute_noreturn'
21733 d_attribute_pure='$d_attribute_pure'
21734 d_attribute_unused='$d_attribute_unused'
21735 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21736 d_bcmp='$d_bcmp'
21737 d_bcopy='$d_bcopy'
21738 d_bsd='$d_bsd'
21739 d_bsdgetpgrp='$d_bsdgetpgrp'
21740 d_bsdsetpgrp='$d_bsdsetpgrp'
21741 d_builtin_choose_expr='$d_builtin_choose_expr'
21742 d_builtin_expect='$d_builtin_expect'
21743 d_bzero='$d_bzero'
21744 d_c99_variadic_macros='$d_c99_variadic_macros'
21745 d_casti32='$d_casti32'
21746 d_castneg='$d_castneg'
21747 d_charvspr='$d_charvspr'
21748 d_chown='$d_chown'
21749 d_chroot='$d_chroot'
21750 d_chsize='$d_chsize'
21751 d_class='$d_class'
21752 d_clearenv='$d_clearenv'
21753 d_closedir='$d_closedir'
21754 d_cmsghdr_s='$d_cmsghdr_s'
21755 d_const='$d_const'
21756 d_copysignl='$d_copysignl'
21757 d_cplusplus='$d_cplusplus'
21758 d_crypt='$d_crypt'
21759 d_crypt_r='$d_crypt_r'
21760 d_csh='$d_csh'
21761 d_ctermid='$d_ctermid'
21762 d_ctermid_r='$d_ctermid_r'
21763 d_ctime_r='$d_ctime_r'
21764 d_cuserid='$d_cuserid'
21765 d_dbl_dig='$d_dbl_dig'
21766 d_dbminitproto='$d_dbminitproto'
21767 d_difftime='$d_difftime'
21768 d_dir_dd_fd='$d_dir_dd_fd'
21769 d_dirfd='$d_dirfd'
21770 d_dirnamlen='$d_dirnamlen'
21771 d_dlerror='$d_dlerror'
21772 d_dlopen='$d_dlopen'
21773 d_dlsymun='$d_dlsymun'
21774 d_dosuid='$d_dosuid'
21775 d_drand48_r='$d_drand48_r'
21776 d_drand48proto='$d_drand48proto'
21777 d_dup2='$d_dup2'
21778 d_eaccess='$d_eaccess'
21779 d_endgrent='$d_endgrent'
21780 d_endgrent_r='$d_endgrent_r'
21781 d_endhent='$d_endhent'
21782 d_endhostent_r='$d_endhostent_r'
21783 d_endnent='$d_endnent'
21784 d_endnetent_r='$d_endnetent_r'
21785 d_endpent='$d_endpent'
21786 d_endprotoent_r='$d_endprotoent_r'
21787 d_endpwent='$d_endpwent'
21788 d_endpwent_r='$d_endpwent_r'
21789 d_endsent='$d_endsent'
21790 d_endservent_r='$d_endservent_r'
21791 d_eofnblk='$d_eofnblk'
21792 d_eunice='$d_eunice'
21793 d_faststdio='$d_faststdio'
21794 d_fchdir='$d_fchdir'
21795 d_fchmod='$d_fchmod'
21796 d_fchown='$d_fchown'
21797 d_fcntl='$d_fcntl'
21798 d_fcntl_can_lock='$d_fcntl_can_lock'
21799 d_fd_macros='$d_fd_macros'
21800 d_fd_set='$d_fd_set'
21801 d_fds_bits='$d_fds_bits'
21802 d_fgetpos='$d_fgetpos'
21803 d_finite='$d_finite'
21804 d_finitel='$d_finitel'
21805 d_flexfnam='$d_flexfnam'
21806 d_flock='$d_flock'
21807 d_flockproto='$d_flockproto'
21808 d_fork='$d_fork'
21809 d_fp_class='$d_fp_class'
21810 d_fpathconf='$d_fpathconf'
21811 d_fpclass='$d_fpclass'
21812 d_fpclassify='$d_fpclassify'
21813 d_fpclassl='$d_fpclassl'
21814 d_fpos64_t='$d_fpos64_t'
21815 d_frexpl='$d_frexpl'
21816 d_fs_data_s='$d_fs_data_s'
21817 d_fseeko='$d_fseeko'
21818 d_fsetpos='$d_fsetpos'
21819 d_fstatfs='$d_fstatfs'
21820 d_fstatvfs='$d_fstatvfs'
21821 d_fsync='$d_fsync'
21822 d_ftello='$d_ftello'
21823 d_ftime='$d_ftime'
21824 d_futimes='$d_futimes'
21825 d_getcwd='$d_getcwd'
21826 d_getespwnam='$d_getespwnam'
21827 d_getfsstat='$d_getfsstat'
21828 d_getgrent='$d_getgrent'
21829 d_getgrent_r='$d_getgrent_r'
21830 d_getgrgid_r='$d_getgrgid_r'
21831 d_getgrnam_r='$d_getgrnam_r'
21832 d_getgrps='$d_getgrps'
21833 d_gethbyaddr='$d_gethbyaddr'
21834 d_gethbyname='$d_gethbyname'
21835 d_gethent='$d_gethent'
21836 d_gethname='$d_gethname'
21837 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21838 d_gethostbyname_r='$d_gethostbyname_r'
21839 d_gethostent_r='$d_gethostent_r'
21840 d_gethostprotos='$d_gethostprotos'
21841 d_getitimer='$d_getitimer'
21842 d_getlogin='$d_getlogin'
21843 d_getlogin_r='$d_getlogin_r'
21844 d_getmnt='$d_getmnt'
21845 d_getmntent='$d_getmntent'
21846 d_getnbyaddr='$d_getnbyaddr'
21847 d_getnbyname='$d_getnbyname'
21848 d_getnent='$d_getnent'
21849 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21850 d_getnetbyname_r='$d_getnetbyname_r'
21851 d_getnetent_r='$d_getnetent_r'
21852 d_getnetprotos='$d_getnetprotos'
21853 d_getpagsz='$d_getpagsz'
21854 d_getpbyname='$d_getpbyname'
21855 d_getpbynumber='$d_getpbynumber'
21856 d_getpent='$d_getpent'
21857 d_getpgid='$d_getpgid'
21858 d_getpgrp2='$d_getpgrp2'
21859 d_getpgrp='$d_getpgrp'
21860 d_getppid='$d_getppid'
21861 d_getprior='$d_getprior'
21862 d_getprotobyname_r='$d_getprotobyname_r'
21863 d_getprotobynumber_r='$d_getprotobynumber_r'
21864 d_getprotoent_r='$d_getprotoent_r'
21865 d_getprotoprotos='$d_getprotoprotos'
21866 d_getprpwnam='$d_getprpwnam'
21867 d_getpwent='$d_getpwent'
21868 d_getpwent_r='$d_getpwent_r'
21869 d_getpwnam_r='$d_getpwnam_r'
21870 d_getpwuid_r='$d_getpwuid_r'
21871 d_getsbyname='$d_getsbyname'
21872 d_getsbyport='$d_getsbyport'
21873 d_getsent='$d_getsent'
21874 d_getservbyname_r='$d_getservbyname_r'
21875 d_getservbyport_r='$d_getservbyport_r'
21876 d_getservent_r='$d_getservent_r'
21877 d_getservprotos='$d_getservprotos'
21878 d_getspnam='$d_getspnam'
21879 d_getspnam_r='$d_getspnam_r'
21880 d_gettimeod='$d_gettimeod'
21881 d_gmtime_r='$d_gmtime_r'
21882 d_gnulibc='$d_gnulibc'
21883 d_grpasswd='$d_grpasswd'
21884 d_hasmntopt='$d_hasmntopt'
21885 d_htonl='$d_htonl'
21886 d_ilogbl='$d_ilogbl'
21887 d_inc_version_list='$d_inc_version_list'
21888 d_index='$d_index'
21889 d_inetaton='$d_inetaton'
21890 d_int64_t='$d_int64_t'
21891 d_isascii='$d_isascii'
21892 d_isfinite='$d_isfinite'
21893 d_isinf='$d_isinf'
21894 d_isnan='$d_isnan'
21895 d_isnanl='$d_isnanl'
21896 d_killpg='$d_killpg'
21897 d_lchown='$d_lchown'
21898 d_ldbl_dig='$d_ldbl_dig'
21899 d_libm_lib_version='$d_libm_lib_version'
21900 d_link='$d_link'
21901 d_localtime_r='$d_localtime_r'
21902 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
21903 d_locconv='$d_locconv'
21904 d_lockf='$d_lockf'
21905 d_longdbl='$d_longdbl'
21906 d_longlong='$d_longlong'
21907 d_lseekproto='$d_lseekproto'
21908 d_lstat='$d_lstat'
21909 d_madvise='$d_madvise'
21910 d_malloc_good_size='$d_malloc_good_size'
21911 d_malloc_size='$d_malloc_size'
21912 d_mblen='$d_mblen'
21913 d_mbstowcs='$d_mbstowcs'
21914 d_mbtowc='$d_mbtowc'
21915 d_memchr='$d_memchr'
21916 d_memcmp='$d_memcmp'
21917 d_memcpy='$d_memcpy'
21918 d_memmove='$d_memmove'
21919 d_memset='$d_memset'
21920 d_mkdir='$d_mkdir'
21921 d_mkdtemp='$d_mkdtemp'
21922 d_mkfifo='$d_mkfifo'
21923 d_mkstemp='$d_mkstemp'
21924 d_mkstemps='$d_mkstemps'
21925 d_mktime='$d_mktime'
21926 d_mmap='$d_mmap'
21927 d_modfl='$d_modfl'
21928 d_modfl_pow32_bug='$d_modfl_pow32_bug'
21929 d_modflproto='$d_modflproto'
21930 d_mprotect='$d_mprotect'
21931 d_msg='$d_msg'
21932 d_msg_ctrunc='$d_msg_ctrunc'
21933 d_msg_dontroute='$d_msg_dontroute'
21934 d_msg_oob='$d_msg_oob'
21935 d_msg_peek='$d_msg_peek'
21936 d_msg_proxy='$d_msg_proxy'
21937 d_msgctl='$d_msgctl'
21938 d_msgget='$d_msgget'
21939 d_msghdr_s='$d_msghdr_s'
21940 d_msgrcv='$d_msgrcv'
21941 d_msgsnd='$d_msgsnd'
21942 d_msync='$d_msync'
21943 d_munmap='$d_munmap'
21944 d_mymalloc='$d_mymalloc'
21945 d_nice='$d_nice'
21946 d_nl_langinfo='$d_nl_langinfo'
21947 d_nv_preserves_uv='$d_nv_preserves_uv'
21948 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
21949 d_off64_t='$d_off64_t'
21950 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21951 d_oldpthreads='$d_oldpthreads'
21952 d_oldsock='$d_oldsock'
21953 d_open3='$d_open3'
21954 d_pathconf='$d_pathconf'
21955 d_pause='$d_pause'
21956 d_perl_otherlibdirs='$d_perl_otherlibdirs'
21957 d_phostname='$d_phostname'
21958 d_pipe='$d_pipe'
21959 d_poll='$d_poll'
21960 d_portable='$d_portable'
21961 d_printf_format_null='$d_printf_format_null'
21962 d_procselfexe='$d_procselfexe'
21963 d_pseudofork='$d_pseudofork'
21964 d_pthread_atfork='$d_pthread_atfork'
21965 d_pthread_attr_setscope='$d_pthread_attr_setscope'
21966 d_pthread_yield='$d_pthread_yield'
21967 d_pwage='$d_pwage'
21968 d_pwchange='$d_pwchange'
21969 d_pwclass='$d_pwclass'
21970 d_pwcomment='$d_pwcomment'
21971 d_pwexpire='$d_pwexpire'
21972 d_pwgecos='$d_pwgecos'
21973 d_pwpasswd='$d_pwpasswd'
21974 d_pwquota='$d_pwquota'
21975 d_qgcvt='$d_qgcvt'
21976 d_quad='$d_quad'
21977 d_random_r='$d_random_r'
21978 d_readdir64_r='$d_readdir64_r'
21979 d_readdir='$d_readdir'
21980 d_readdir_r='$d_readdir_r'
21981 d_readlink='$d_readlink'
21982 d_readv='$d_readv'
21983 d_recvmsg='$d_recvmsg'
21984 d_rename='$d_rename'
21985 d_rewinddir='$d_rewinddir'
21986 d_rmdir='$d_rmdir'
21987 d_safebcpy='$d_safebcpy'
21988 d_safemcpy='$d_safemcpy'
21989 d_sanemcmp='$d_sanemcmp'
21990 d_sbrkproto='$d_sbrkproto'
21991 d_scalbnl='$d_scalbnl'
21992 d_sched_yield='$d_sched_yield'
21993 d_scm_rights='$d_scm_rights'
21994 d_seekdir='$d_seekdir'
21995 d_select='$d_select'
21996 d_sem='$d_sem'
21997 d_semctl='$d_semctl'
21998 d_semctl_semid_ds='$d_semctl_semid_ds'
21999 d_semctl_semun='$d_semctl_semun'
22000 d_semget='$d_semget'
22001 d_semop='$d_semop'
22002 d_sendmsg='$d_sendmsg'
22003 d_setegid='$d_setegid'
22004 d_seteuid='$d_seteuid'
22005 d_setgrent='$d_setgrent'
22006 d_setgrent_r='$d_setgrent_r'
22007 d_setgrps='$d_setgrps'
22008 d_sethent='$d_sethent'
22009 d_sethostent_r='$d_sethostent_r'
22010 d_setitimer='$d_setitimer'
22011 d_setlinebuf='$d_setlinebuf'
22012 d_setlocale='$d_setlocale'
22013 d_setlocale_r='$d_setlocale_r'
22014 d_setnent='$d_setnent'
22015 d_setnetent_r='$d_setnetent_r'
22016 d_setpent='$d_setpent'
22017 d_setpgid='$d_setpgid'
22018 d_setpgrp2='$d_setpgrp2'
22019 d_setpgrp='$d_setpgrp'
22020 d_setprior='$d_setprior'
22021 d_setproctitle='$d_setproctitle'
22022 d_setprotoent_r='$d_setprotoent_r'
22023 d_setpwent='$d_setpwent'
22024 d_setpwent_r='$d_setpwent_r'
22025 d_setregid='$d_setregid'
22026 d_setresgid='$d_setresgid'
22027 d_setresuid='$d_setresuid'
22028 d_setreuid='$d_setreuid'
22029 d_setrgid='$d_setrgid'
22030 d_setruid='$d_setruid'
22031 d_setsent='$d_setsent'
22032 d_setservent_r='$d_setservent_r'
22033 d_setsid='$d_setsid'
22034 d_setvbuf='$d_setvbuf'
22035 d_sfio='$d_sfio'
22036 d_shm='$d_shm'
22037 d_shmat='$d_shmat'
22038 d_shmatprototype='$d_shmatprototype'
22039 d_shmctl='$d_shmctl'
22040 d_shmdt='$d_shmdt'
22041 d_shmget='$d_shmget'
22042 d_sigaction='$d_sigaction'
22043 d_signbit='$d_signbit'
22044 d_sigprocmask='$d_sigprocmask'
22045 d_sigsetjmp='$d_sigsetjmp'
22046 d_sitearch='$d_sitearch'
22047 d_snprintf='$d_snprintf'
22048 d_sockatmark='$d_sockatmark'
22049 d_sockatmarkproto='$d_sockatmarkproto'
22050 d_socket='$d_socket'
22051 d_socklen_t='$d_socklen_t'
22052 d_sockpair='$d_sockpair'
22053 d_socks5_init='$d_socks5_init'
22054 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
22055 d_sqrtl='$d_sqrtl'
22056 d_srand48_r='$d_srand48_r'
22057 d_srandom_r='$d_srandom_r'
22058 d_sresgproto='$d_sresgproto'
22059 d_sresuproto='$d_sresuproto'
22060 d_statblks='$d_statblks'
22061 d_statfs_f_flags='$d_statfs_f_flags'
22062 d_statfs_s='$d_statfs_s'
22063 d_statvfs='$d_statvfs'
22064 d_stdio_cnt_lval='$d_stdio_cnt_lval'
22065 d_stdio_ptr_lval='$d_stdio_ptr_lval'
22066 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
22067 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
22068 d_stdio_stream_array='$d_stdio_stream_array'
22069 d_stdiobase='$d_stdiobase'
22070 d_stdstdio='$d_stdstdio'
22071 d_strchr='$d_strchr'
22072 d_strcoll='$d_strcoll'
22073 d_strctcpy='$d_strctcpy'
22074 d_strerrm='$d_strerrm'
22075 d_strerror='$d_strerror'
22076 d_strerror_r='$d_strerror_r'
22077 d_strftime='$d_strftime'
22078 d_strlcat='$d_strlcat'
22079 d_strlcpy='$d_strlcpy'
22080 d_strtod='$d_strtod'
22081 d_strtol='$d_strtol'
22082 d_strtold='$d_strtold'
22083 d_strtoll='$d_strtoll'
22084 d_strtoq='$d_strtoq'
22085 d_strtoul='$d_strtoul'
22086 d_strtoull='$d_strtoull'
22087 d_strtouq='$d_strtouq'
22088 d_strxfrm='$d_strxfrm'
22089 d_suidsafe='$d_suidsafe'
22090 d_symlink='$d_symlink'
22091 d_syscall='$d_syscall'
22092 d_syscallproto='$d_syscallproto'
22093 d_sysconf='$d_sysconf'
22094 d_sysernlst='$d_sysernlst'
22095 d_syserrlst='$d_syserrlst'
22096 d_system='$d_system'
22097 d_tcgetpgrp='$d_tcgetpgrp'
22098 d_tcsetpgrp='$d_tcsetpgrp'
22099 d_telldir='$d_telldir'
22100 d_telldirproto='$d_telldirproto'
22101 d_time='$d_time'
22102 d_times='$d_times'
22103 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
22104 d_tm_tm_zone='$d_tm_tm_zone'
22105 d_tmpnam_r='$d_tmpnam_r'
22106 d_truncate='$d_truncate'
22107 d_ttyname_r='$d_ttyname_r'
22108 d_tzname='$d_tzname'
22109 d_u32align='$d_u32align'
22110 d_ualarm='$d_ualarm'
22111 d_umask='$d_umask'
22112 d_uname='$d_uname'
22113 d_union_semun='$d_union_semun'
22114 d_unordered='$d_unordered'
22115 d_unsetenv='$d_unsetenv'
22116 d_usleep='$d_usleep'
22117 d_usleepproto='$d_usleepproto'
22118 d_ustat='$d_ustat'
22119 d_vendorarch='$d_vendorarch'
22120 d_vendorbin='$d_vendorbin'
22121 d_vendorlib='$d_vendorlib'
22122 d_vendorscript='$d_vendorscript'
22123 d_vfork='$d_vfork'
22124 d_void_closedir='$d_void_closedir'
22125 d_voidsig='$d_voidsig'
22126 d_voidtty='$d_voidtty'
22127 d_volatile='$d_volatile'
22128 d_vprintf='$d_vprintf'
22129 d_vsnprintf='$d_vsnprintf'
22130 d_wait4='$d_wait4'
22131 d_waitpid='$d_waitpid'
22132 d_wcstombs='$d_wcstombs'
22133 d_wctomb='$d_wctomb'
22134 d_writev='$d_writev'
22135 d_xenix='$d_xenix'
22136 date='$date'
22137 db_hashtype='$db_hashtype'
22138 db_prefixtype='$db_prefixtype'
22139 db_version_major='$db_version_major'
22140 db_version_minor='$db_version_minor'
22141 db_version_patch='$db_version_patch'
22142 defvoidused='$defvoidused'
22143 direntrytype='$direntrytype'
22144 dlext='$dlext'
22145 dlsrc='$dlsrc'
22146 doublesize='$doublesize'
22147 drand01='$drand01'
22148 drand48_r_proto='$drand48_r_proto'
22149 dtrace='$dtrace'
22150 dynamic_ext='$dynamic_ext'
22151 eagain='$eagain'
22152 ebcdic='$ebcdic'
22153 echo='$echo'
22154 egrep='$egrep'
22155 emacs='$emacs'
22156 endgrent_r_proto='$endgrent_r_proto'
22157 endhostent_r_proto='$endhostent_r_proto'
22158 endnetent_r_proto='$endnetent_r_proto'
22159 endprotoent_r_proto='$endprotoent_r_proto'
22160 endpwent_r_proto='$endpwent_r_proto'
22161 endservent_r_proto='$endservent_r_proto'
22162 eunicefix='$eunicefix'
22163 exe_ext='$exe_ext'
22164 expr='$expr'
22165 extensions='$extensions'
22166 extras='$extras'
22167 fflushNULL='$fflushNULL'
22168 fflushall='$fflushall'
22169 find='$find'
22170 firstmakefile='$firstmakefile'
22171 flex='$flex'
22172 fpossize='$fpossize'
22173 fpostype='$fpostype'
22174 freetype='$freetype'
22175 from='$from'
22176 full_ar='$full_ar'
22177 full_csh='$full_csh'
22178 full_sed='$full_sed'
22179 gccansipedantic='$gccansipedantic'
22180 gccosandvers='$gccosandvers'
22181 gccversion='$gccversion'
22182 getgrent_r_proto='$getgrent_r_proto'
22183 getgrgid_r_proto='$getgrgid_r_proto'
22184 getgrnam_r_proto='$getgrnam_r_proto'
22185 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22186 gethostbyname_r_proto='$gethostbyname_r_proto'
22187 gethostent_r_proto='$gethostent_r_proto'
22188 getlogin_r_proto='$getlogin_r_proto'
22189 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22190 getnetbyname_r_proto='$getnetbyname_r_proto'
22191 getnetent_r_proto='$getnetent_r_proto'
22192 getprotobyname_r_proto='$getprotobyname_r_proto'
22193 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22194 getprotoent_r_proto='$getprotoent_r_proto'
22195 getpwent_r_proto='$getpwent_r_proto'
22196 getpwnam_r_proto='$getpwnam_r_proto'
22197 getpwuid_r_proto='$getpwuid_r_proto'
22198 getservbyname_r_proto='$getservbyname_r_proto'
22199 getservbyport_r_proto='$getservbyport_r_proto'
22200 getservent_r_proto='$getservent_r_proto'
22201 getspnam_r_proto='$getspnam_r_proto'
22202 gidformat='$gidformat'
22203 gidsign='$gidsign'
22204 gidsize='$gidsize'
22205 gidtype='$gidtype'
22206 glibpth='$glibpth'
22207 gmake='$gmake'
22208 gmtime_r_proto='$gmtime_r_proto'
22209 gnulibc_version='$gnulibc_version'
22210 grep='$grep'
22211 groupcat='$groupcat'
22212 groupstype='$groupstype'
22213 gzip='$gzip'
22214 h_fcntl='$h_fcntl'
22215 h_sysfile='$h_sysfile'
22216 hint='$hint'
22217 hostcat='$hostcat'
22218 html1dir='$html1dir'
22219 html1direxp='$html1direxp'
22220 html3dir='$html3dir'
22221 html3direxp='$html3direxp'
22222 i16size='$i16size'
22223 i16type='$i16type'
22224 i32size='$i32size'
22225 i32type='$i32type'
22226 i64size='$i64size'
22227 i64type='$i64type'
22228 i8size='$i8size'
22229 i8type='$i8type'
22230 i_arpainet='$i_arpainet'
22231 i_assert='$i_assert'
22232 i_bsdioctl='$i_bsdioctl'
22233 i_crypt='$i_crypt'
22234 i_db='$i_db'
22235 i_dbm='$i_dbm'
22236 i_dirent='$i_dirent'
22237 i_dld='$i_dld'
22238 i_dlfcn='$i_dlfcn'
22239 i_fcntl='$i_fcntl'
22240 i_float='$i_float'
22241 i_fp='$i_fp'
22242 i_fp_class='$i_fp_class'
22243 i_gdbm='$i_gdbm'
22244 i_grp='$i_grp'
22245 i_ieeefp='$i_ieeefp'
22246 i_inttypes='$i_inttypes'
22247 i_langinfo='$i_langinfo'
22248 i_libutil='$i_libutil'
22249 i_limits='$i_limits'
22250 i_locale='$i_locale'
22251 i_machcthr='$i_machcthr'
22252 i_malloc='$i_malloc'
22253 i_math='$i_math'
22254 i_memory='$i_memory'
22255 i_mntent='$i_mntent'
22256 i_ndbm='$i_ndbm'
22257 i_netdb='$i_netdb'
22258 i_neterrno='$i_neterrno'
22259 i_netinettcp='$i_netinettcp'
22260 i_niin='$i_niin'
22261 i_poll='$i_poll'
22262 i_prot='$i_prot'
22263 i_pthread='$i_pthread'
22264 i_pwd='$i_pwd'
22265 i_rpcsvcdbm='$i_rpcsvcdbm'
22266 i_sfio='$i_sfio'
22267 i_sgtty='$i_sgtty'
22268 i_shadow='$i_shadow'
22269 i_socks='$i_socks'
22270 i_stdarg='$i_stdarg'
22271 i_stddef='$i_stddef'
22272 i_stdlib='$i_stdlib'
22273 i_string='$i_string'
22274 i_sunmath='$i_sunmath'
22275 i_sysaccess='$i_sysaccess'
22276 i_sysdir='$i_sysdir'
22277 i_sysfile='$i_sysfile'
22278 i_sysfilio='$i_sysfilio'
22279 i_sysin='$i_sysin'
22280 i_sysioctl='$i_sysioctl'
22281 i_syslog='$i_syslog'
22282 i_sysmman='$i_sysmman'
22283 i_sysmode='$i_sysmode'
22284 i_sysmount='$i_sysmount'
22285 i_sysndir='$i_sysndir'
22286 i_sysparam='$i_sysparam'
22287 i_sysresrc='$i_sysresrc'
22288 i_syssecrt='$i_syssecrt'
22289 i_sysselct='$i_sysselct'
22290 i_syssockio='$i_syssockio'
22291 i_sysstat='$i_sysstat'
22292 i_sysstatfs='$i_sysstatfs'
22293 i_sysstatvfs='$i_sysstatvfs'
22294 i_systime='$i_systime'
22295 i_systimek='$i_systimek'
22296 i_systimes='$i_systimes'
22297 i_systypes='$i_systypes'
22298 i_sysuio='$i_sysuio'
22299 i_sysun='$i_sysun'
22300 i_sysutsname='$i_sysutsname'
22301 i_sysvfs='$i_sysvfs'
22302 i_syswait='$i_syswait'
22303 i_termio='$i_termio'
22304 i_termios='$i_termios'
22305 i_time='$i_time'
22306 i_unistd='$i_unistd'
22307 i_ustat='$i_ustat'
22308 i_utime='$i_utime'
22309 i_values='$i_values'
22310 i_varargs='$i_varargs'
22311 i_varhdr='$i_varhdr'
22312 i_vfork='$i_vfork'
22313 ignore_versioned_solibs='$ignore_versioned_solibs'
22314 inc_version_list='$inc_version_list'
22315 inc_version_list_init='$inc_version_list_init'
22316 incpath='$incpath'
22317 inews='$inews'
22318 initialinstalllocation='$initialinstalllocation'
22319 installarchlib='$installarchlib'
22320 installbin='$installbin'
22321 installhtml1dir='$installhtml1dir'
22322 installhtml3dir='$installhtml3dir'
22323 installman1dir='$installman1dir'
22324 installman3dir='$installman3dir'
22325 installprefix='$installprefix'
22326 installprefixexp='$installprefixexp'
22327 installprivlib='$installprivlib'
22328 installscript='$installscript'
22329 installsitearch='$installsitearch'
22330 installsitebin='$installsitebin'
22331 installsitehtml1dir='$installsitehtml1dir'
22332 installsitehtml3dir='$installsitehtml3dir'
22333 installsitelib='$installsitelib'
22334 installsiteman1dir='$installsiteman1dir'
22335 installsiteman3dir='$installsiteman3dir'
22336 installsitescript='$installsitescript'
22337 installstyle='$installstyle'
22338 installusrbinperl='$installusrbinperl'
22339 installvendorarch='$installvendorarch'
22340 installvendorbin='$installvendorbin'
22341 installvendorhtml1dir='$installvendorhtml1dir'
22342 installvendorhtml3dir='$installvendorhtml3dir'
22343 installvendorlib='$installvendorlib'
22344 installvendorman1dir='$installvendorman1dir'
22345 installvendorman3dir='$installvendorman3dir'
22346 installvendorscript='$installvendorscript'
22347 intsize='$intsize'
22348 issymlink='$issymlink'
22349 ivdformat='$ivdformat'
22350 ivsize='$ivsize'
22351 ivtype='$ivtype'
22352 known_extensions='$known_extensions'
22353 ksh='$ksh'
22354 ld='$ld'
22355 lddlflags='$lddlflags'
22356 ldflags='$ldflags'
22357 ldflags_uselargefiles='$ldflags_uselargefiles'
22358 ldlibpthname='$ldlibpthname'
22359 less='$less'
22360 lib_ext='$lib_ext'
22361 libc='$libc'
22362 libperl='$libperl'
22363 libpth='$libpth'
22364 libs='$libs'
22365 libsdirs='$libsdirs'
22366 libsfiles='$libsfiles'
22367 libsfound='$libsfound'
22368 libspath='$libspath'
22369 libswanted='$libswanted'
22370 libswanted_uselargefiles='$libswanted_uselargefiles'
22371 line='$line'
22372 lint='$lint'
22373 lkflags='$lkflags'
22374 ln='$ln'
22375 lns='$lns'
22376 localtime_r_proto='$localtime_r_proto'
22377 locincpth='$locincpth'
22378 loclibpth='$loclibpth'
22379 longdblsize='$longdblsize'
22380 longlongsize='$longlongsize'
22381 longsize='$longsize'
22382 lp='$lp'
22383 lpr='$lpr'
22384 ls='$ls'
22385 lseeksize='$lseeksize'
22386 lseektype='$lseektype'
22387 mad='$mad'
22388 madlyh='$madlyh'
22389 madlyobj='$madlyobj'
22390 madlysrc='$madlysrc'
22391 mail='$mail'
22392 mailx='$mailx'
22393 make='$make'
22394 make_set_make='$make_set_make'
22395 mallocobj='$mallocobj'
22396 mallocsrc='$mallocsrc'
22397 malloctype='$malloctype'
22398 man1dir='$man1dir'
22399 man1direxp='$man1direxp'
22400 man1ext='$man1ext'
22401 man3dir='$man3dir'
22402 man3direxp='$man3direxp'
22403 man3ext='$man3ext'
22404 mips_type='$mips_type'
22405 mistrustnm='$mistrustnm'
22406 mkdir='$mkdir'
22407 mmaptype='$mmaptype'
22408 modetype='$modetype'
22409 more='$more'
22410 multiarch='$multiarch'
22411 mv='$mv'
22412 myarchname='$myarchname'
22413 mydomain='$mydomain'
22414 myhostname='$myhostname'
22415 myuname='$myuname'
22416 n='$n'
22417 need_va_copy='$need_va_copy'
22418 netdb_hlen_type='$netdb_hlen_type'
22419 netdb_host_type='$netdb_host_type'
22420 netdb_name_type='$netdb_name_type'
22421 netdb_net_type='$netdb_net_type'
22422 nm='$nm'
22423 nm_opt='$nm_opt'
22424 nm_so_opt='$nm_so_opt'
22425 nonxs_ext='$nonxs_ext'
22426 nroff='$nroff'
22427 nvEUformat='$nvEUformat'
22428 nvFUformat='$nvFUformat'
22429 nvGUformat='$nvGUformat'
22430 nv_preserves_uv_bits='$nv_preserves_uv_bits'
22431 nveformat='$nveformat'
22432 nvfformat='$nvfformat'
22433 nvgformat='$nvgformat'
22434 nvsize='$nvsize'
22435 nvtype='$nvtype'
22436 o_nonblock='$o_nonblock'
22437 obj_ext='$obj_ext'
22438 old_pthread_create_joinable='$old_pthread_create_joinable'
22439 optimize='$optimize'
22440 orderlib='$orderlib'
22441 osname='$osname'
22442 osvers='$osvers'
22443 otherlibdirs='$otherlibdirs'
22444 package='$package'
22445 pager='$pager'
22446 passcat='$passcat'
22447 patchlevel='$patchlevel'
22448 path_sep='$path_sep'
22449 perl5='$perl5'
22450 perl='$perl'
22451 perl_patchlevel='$perl_patchlevel'
22452 perladmin='$perladmin'
22453 perllibs='$perllibs'
22454 perlpath='$perlpath'
22455 pg='$pg'
22456 phostname='$phostname'
22457 pidtype='$pidtype'
22458 plibpth='$plibpth'
22459 pmake='$pmake'
22460 pr='$pr'
22461 prefix='$prefix'
22462 prefixexp='$prefixexp'
22463 privlib='$privlib'
22464 privlibexp='$privlibexp'
22465 procselfexe='$procselfexe'
22466 prototype='$prototype'
22467 ptrsize='$ptrsize'
22468 quadkind='$quadkind'
22469 quadtype='$quadtype'
22470 randbits='$randbits'
22471 randfunc='$randfunc'
22472 random_r_proto='$random_r_proto'
22473 randseedtype='$randseedtype'
22474 ranlib='$ranlib'
22475 rd_nodata='$rd_nodata'
22476 readdir64_r_proto='$readdir64_r_proto'
22477 readdir_r_proto='$readdir_r_proto'
22478 revision='$revision'
22479 rm='$rm'
22480 rm_try='$rm_try'
22481 rmail='$rmail'
22482 run='$run'
22483 runnm='$runnm'
22484 sPRIEUldbl='$sPRIEUldbl'
22485 sPRIFUldbl='$sPRIFUldbl'
22486 sPRIGUldbl='$sPRIGUldbl'
22487 sPRIXU64='$sPRIXU64'
22488 sPRId64='$sPRId64'
22489 sPRIeldbl='$sPRIeldbl'
22490 sPRIfldbl='$sPRIfldbl'
22491 sPRIgldbl='$sPRIgldbl'
22492 sPRIi64='$sPRIi64'
22493 sPRIo64='$sPRIo64'
22494 sPRIu64='$sPRIu64'
22495 sPRIx64='$sPRIx64'
22496 sSCNfldbl='$sSCNfldbl'
22497 sched_yield='$sched_yield'
22498 scriptdir='$scriptdir'
22499 scriptdirexp='$scriptdirexp'
22500 sed='$sed'
22501 seedfunc='$seedfunc'
22502 selectminbits='$selectminbits'
22503 selecttype='$selecttype'
22504 sendmail='$sendmail'
22505 setgrent_r_proto='$setgrent_r_proto'
22506 sethostent_r_proto='$sethostent_r_proto'
22507 setlocale_r_proto='$setlocale_r_proto'
22508 setnetent_r_proto='$setnetent_r_proto'
22509 setprotoent_r_proto='$setprotoent_r_proto'
22510 setpwent_r_proto='$setpwent_r_proto'
22511 setservent_r_proto='$setservent_r_proto'
22512 sh='$sh'
22513 shar='$shar'
22514 sharpbang='$sharpbang'
22515 shmattype='$shmattype'
22516 shortsize='$shortsize'
22517 shrpenv='$shrpenv'
22518 shsharp='$shsharp'
22519 sig_count='$sig_count'
22520 sig_name='$sig_name'
22521 sig_name_init='$sig_name_init'
22522 sig_num='$sig_num'
22523 sig_num_init='$sig_num_init'
22524 sig_size='$sig_size'
22525 signal_t='$signal_t'
22526 sitearch='$sitearch'
22527 sitearchexp='$sitearchexp'
22528 sitebin='$sitebin'
22529 sitebinexp='$sitebinexp'
22530 sitehtml1dir='$sitehtml1dir'
22531 sitehtml1direxp='$sitehtml1direxp'
22532 sitehtml3dir='$sitehtml3dir'
22533 sitehtml3direxp='$sitehtml3direxp'
22534 sitelib='$sitelib'
22535 sitelib_stem='$sitelib_stem'
22536 sitelibexp='$sitelibexp'
22537 siteman1dir='$siteman1dir'
22538 siteman1direxp='$siteman1direxp'
22539 siteman3dir='$siteman3dir'
22540 siteman3direxp='$siteman3direxp'
22541 siteprefix='$siteprefix'
22542 siteprefixexp='$siteprefixexp'
22543 sitescript='$sitescript'
22544 sitescriptexp='$sitescriptexp'
22545 sizesize='$sizesize'
22546 sizetype='$sizetype'
22547 sleep='$sleep'
22548 smail='$smail'
22549 so='$so'
22550 sockethdr='$sockethdr'
22551 socketlib='$socketlib'
22552 socksizetype='$socksizetype'
22553 sort='$sort'
22554 spackage='$spackage'
22555 spitshell='$spitshell'
22556 srand48_r_proto='$srand48_r_proto'
22557 srandom_r_proto='$srandom_r_proto'
22558 src='$src'
22559 ssizetype='$ssizetype'
22560 startperl='$startperl'
22561 startsh='$startsh'
22562 static_ext='$static_ext'
22563 stdchar='$stdchar'
22564 stdio_base='$stdio_base'
22565 stdio_bufsiz='$stdio_bufsiz'
22566 stdio_cnt='$stdio_cnt'
22567 stdio_filbuf='$stdio_filbuf'
22568 stdio_ptr='$stdio_ptr'
22569 stdio_stream_array='$stdio_stream_array'
22570 strerror_r_proto='$strerror_r_proto'
22571 strings='$strings'
22572 submit='$submit'
22573 subversion='$subversion'
22574 sysman='$sysman'
22575 tail='$tail'
22576 tar='$tar'
22577 targetarch='$targetarch'
22578 tbl='$tbl'
22579 tee='$tee'
22580 test='$test'
22581 timeincl='$timeincl'
22582 timetype='$timetype'
22583 tmpnam_r_proto='$tmpnam_r_proto'
22584 to='$to'
22585 touch='$touch'
22586 tr='$tr'
22587 trnl='$trnl'
22588 troff='$troff'
22589 ttyname_r_proto='$ttyname_r_proto'
22590 u16size='$u16size'
22591 u16type='$u16type'
22592 u32size='$u32size'
22593 u32type='$u32type'
22594 u64size='$u64size'
22595 u64type='$u64type'
22596 u8size='$u8size'
22597 u8type='$u8type'
22598 uidformat='$uidformat'
22599 uidsign='$uidsign'
22600 uidsize='$uidsize'
22601 uidtype='$uidtype'
22602 uname='$uname'
22603 uniq='$uniq'
22604 uquadtype='$uquadtype'
22605 use5005threads='$use5005threads'
22606 use64bitall='$use64bitall'
22607 use64bitint='$use64bitint'
22608 usecrosscompile='$usecrosscompile'
22609 usedl='$usedl'
22610 usedtrace='$usedtrace'
22611 usefaststdio='$usefaststdio'
22612 useithreads='$useithreads'
22613 uselargefiles='$uselargefiles'
22614 uselongdouble='$uselongdouble'
22615 usemallocwrap='$usemallocwrap'
22616 usemorebits='$usemorebits'
22617 usemultiplicity='$usemultiplicity'
22618 usemymalloc='$usemymalloc'
22619 usenm='$usenm'
22620 useopcode='$useopcode'
22621 useperlio='$useperlio'
22622 useposix='$useposix'
22623 usereentrant='$usereentrant'
22624 userelocatableinc='$userelocatableinc'
22625 usesfio='$usesfio'
22626 useshrplib='$useshrplib'
22627 usesitecustomize='$usesitecustomize'
22628 usesocks='$usesocks'
22629 usethreads='$usethreads'
22630 usevendorprefix='$usevendorprefix'
22631 usevfork='$usevfork'
22632 usrinc='$usrinc'
22633 uuname='$uuname'
22634 uvXUformat='$uvXUformat'
22635 uvoformat='$uvoformat'
22636 uvsize='$uvsize'
22637 uvtype='$uvtype'
22638 uvuformat='$uvuformat'
22639 uvxformat='$uvxformat'
22640 vendorarch='$vendorarch'
22641 vendorarchexp='$vendorarchexp'
22642 vendorbin='$vendorbin'
22643 vendorbinexp='$vendorbinexp'
22644 vendorhtml1dir='$vendorhtml1dir'
22645 vendorhtml1direxp='$vendorhtml1direxp'
22646 vendorhtml3dir='$vendorhtml3dir'
22647 vendorhtml3direxp='$vendorhtml3direxp'
22648 vendorlib='$vendorlib'
22649 vendorlib_stem='$vendorlib_stem'
22650 vendorlibexp='$vendorlibexp'
22651 vendorman1dir='$vendorman1dir'
22652 vendorman1direxp='$vendorman1direxp'
22653 vendorman3dir='$vendorman3dir'
22654 vendorman3direxp='$vendorman3direxp'
22655 vendorprefix='$vendorprefix'
22656 vendorprefixexp='$vendorprefixexp'
22657 vendorscript='$vendorscript'
22658 vendorscriptexp='$vendorscriptexp'
22659 version='$version'
22660 version_patchlevel_string='$version_patchlevel_string'
22661 versiononly='$versiononly'
22662 vi='$vi'
22663 voidflags='$voidflags'
22664 xlibpth='$xlibpth'
22665 yacc='$yacc'
22666 yaccflags='$yaccflags'
22667 zcat='$zcat'
22668 zip='$zip'
22669 EOT
22670
22671 : Add in command line options if available
22672 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22673
22674 : add special variables
22675 $test -f $src/patchlevel.h && \
22676 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22677 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22678 echo "PERL_CONFIG_SH=true" >>config.sh
22679
22680 : propagate old symbols
22681 if $test -f UU/config.sh; then
22682         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22683         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
22684         $sort | $uniq -u >UU/oldsyms
22685         set X `cat UU/oldsyms`
22686         shift
22687         case $# in
22688         0) ;;
22689         *)
22690                 cat <<EOM
22691 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22692 EOM
22693                 echo "# Variables propagated from previous config.sh file." >>config.sh
22694                 for sym in `cat UU/oldsyms`; do
22695                         echo "    Propagating $hint variable "'$'"$sym..."
22696                         eval 'tmp="$'"${sym}"'"'
22697                         echo "$tmp" | \
22698                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22699                 done
22700                 ;;
22701         esac
22702 fi
22703
22704 : Finish up by extracting the .SH files
22705 case "$alldone" in
22706 exit)
22707         $rm -rf UU
22708         echo "Extraction done."
22709         exit 0
22710         ;;
22711 cont)
22712         ;;
22713 '')
22714         dflt=''
22715         nostick=true
22716         $cat <<EOM
22717
22718 If you'd like to make any changes to the config.sh file before I begin
22719 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22720
22721 EOM
22722         rp="Press return or use a shell escape to edit config.sh:"
22723         . UU/myread
22724         nostick=''
22725         case "$ans" in
22726         '') ;;
22727         *) : in case they cannot read
22728                 sh 1>&4 -c "$ans";;
22729         esac
22730         ;;
22731 esac
22732
22733 : if this fails, just run all the .SH files by hand
22734 . ./config.sh
22735
22736 echo " "
22737 exec 1>&4
22738 pwd=`pwd`
22739 . ./UU/extract
22740 cd "$pwd"
22741
22742 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22743         dflt=y
22744         case "$silent" in
22745         true) ;;
22746         *)
22747                 $cat <<EOM
22748
22749 Now you need to generate make dependencies by running "$make depend".
22750 You might prefer to run it in background: "$make depend > makedepend.out &"
22751 It can take a while, so you might not want to run it right now.
22752
22753 EOM
22754                 ;;
22755         esac
22756         rp="Run $make depend now?"
22757         . UU/myread
22758         case "$ans" in
22759         y*)
22760                 $make depend && echo "Now you must run '$make'."
22761                 ;;
22762         *)
22763                 echo "You must run '$make depend' then '$make'."
22764                 ;;
22765         esac
22766 elif test -f [Mm]akefile; then
22767         echo " "
22768         echo "Now you must run a $make."
22769 else
22770         echo "Configure done."
22771 fi
22772
22773 if $test -f Policy.sh; then
22774     $cat <<EOM
22775
22776 If you compile $package on a different machine or from a different object
22777 directory, copy the Policy.sh file from this object directory to the
22778 new one before you run Configure -- this will help you with most of
22779 the policy defaults.
22780
22781 EOM
22782 fi
22783 if $test -f config.msg; then
22784     echo "Hmm.  I also noted the following information while running:"
22785     echo " "
22786     $cat config.msg >&4
22787     $rm -f config.msg
22788 fi
22789 $rm -f kit*isdone ark*isdone
22790 $rm -rf UU
22791
22792 : End of Configure
22793