More places that could be using G_WANT, not picked up by change 33021.
[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 Mon Jan 14 17:33:05 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 echo=''
242 egrep=''
243 emacs=''
244 expr=''
245 find=''
246 flex=''
247 gmake=''
248 grep=''
249 gzip=''
250 inews=''
251 ksh=''
252 less=''
253 line=''
254 lint=''
255 ln=''
256 lp=''
257 lpr=''
258 ls=''
259 mail=''
260 mailx=''
261 make=''
262 mkdir=''
263 more=''
264 mv=''
265 nm=''
266 nroff=''
267 perl=''
268 pg=''
269 pmake=''
270 pr=''
271 rm=''
272 rmail=''
273 sed=''
274 sendmail=''
275 shar=''
276 sleep=''
277 smail=''
278 sort=''
279 submit=''
280 tail=''
281 tar=''
282 tbl=''
283 tee=''
284 test=''
285 touch=''
286 tr=''
287 troff=''
288 uname=''
289 uniq=''
290 uuname=''
291 vi=''
292 zcat=''
293 zip=''
294 full_ar=''
295 full_sed=''
296 libswanted=''
297 hint=''
298 myuname=''
299 osname=''
300 osvers=''
301 Author=''
302 Date=''
303 Header=''
304 Id=''
305 Locker=''
306 Log=''
307 RCSfile=''
308 Revision=''
309 Source=''
310 State=''
311 _a=''
312 _exe=''
313 _o=''
314 archobjs=''
315 exe_ext=''
316 firstmakefile=''
317 lib_ext=''
318 obj_ext=''
319 path_sep=''
320 rm_try=''
321 afs=''
322 afsroot=''
323 alignbytes=''
324 ansi2knr=''
325 archlib=''
326 archlibexp=''
327 d_archlib=''
328 installarchlib=''
329 archname=''
330 myarchname=''
331 d_atolf=''
332 d_atoll=''
333 baserev=''
334 bin=''
335 binexp=''
336 initialinstalllocation=''
337 installbin=''
338 userelocatableinc=''
339 byteorder=''
340 cc=''
341 ccflags=''
342 cppflags=''
343 ldflags=''
344 lkflags=''
345 locincpth=''
346 optimize=''
347 cf_email=''
348 cf_by=''
349 cf_time=''
350 contains=''
351 cpp_stuff=''
352 cpplast=''
353 cppminus=''
354 cpprun=''
355 cppstdin=''
356 d__fwalk=''
357 d_access=''
358 d_accessx=''
359 d_aintl=''
360 d_alarm=''
361 asctime_r_proto=''
362 d_asctime_r=''
363 d_attribute_format=''
364 d_attribute_malloc=''
365 d_attribute_nonnull=''
366 d_attribute_noreturn=''
367 d_attribute_pure=''
368 d_attribute_unused=''
369 d_attribute_warn_unused_result=''
370 d_printf_format_null=''
371 d_bcmp=''
372 d_bcopy=''
373 d_builtin_choose_expr=''
374 d_builtin_expect=''
375 d_bzero=''
376 d_c99_variadic_macros=''
377 d_casti32=''
378 castflags=''
379 d_castneg=''
380 d_chown=''
381 d_chroot=''
382 d_chsize=''
383 d_class=''
384 d_clearenv=''
385 d_closedir=''
386 d_void_closedir=''
387 d_cmsghdr_s=''
388 d_const=''
389 d_copysignl=''
390 d_cplusplus=''
391 cryptlib=''
392 d_crypt=''
393 crypt_r_proto=''
394 d_crypt_r=''
395 d_csh=''
396 full_csh=''
397 d_ctermid=''
398 ctermid_r_proto=''
399 d_ctermid_r=''
400 ctime_r_proto=''
401 d_ctime_r=''
402 d_cuserid=''
403 d_dbl_dig=''
404 d_dbminitproto=''
405 d_difftime=''
406 d_dir_dd_fd=''
407 d_dirfd=''
408 d_dlerror=''
409 d_dlopen=''
410 d_dlsymun=''
411 d_dosuid=''
412 d_suidsafe=''
413 d_drand48_r=''
414 drand48_r_proto=''
415 d_drand48proto=''
416 d_dup2=''
417 d_eaccess=''
418 d_endgrent=''
419 d_endgrent_r=''
420 endgrent_r_proto=''
421 d_endhent=''
422 d_endhostent_r=''
423 endhostent_r_proto=''
424 d_endnent=''
425 d_endnetent_r=''
426 endnetent_r_proto=''
427 d_endpent=''
428 d_endprotoent_r=''
429 endprotoent_r_proto=''
430 d_endpwent=''
431 d_endpwent_r=''
432 endpwent_r_proto=''
433 d_endsent=''
434 d_endservent_r=''
435 endservent_r_proto=''
436 d_faststdio=''
437 d_fchdir=''
438 d_fchmod=''
439 d_fchown=''
440 d_fcntl=''
441 d_fcntl_can_lock=''
442 d_fd_macros=''
443 d_fd_set=''
444 d_fds_bits=''
445 d_fgetpos=''
446 d_finite=''
447 d_finitel=''
448 d_flexfnam=''
449 d_flock=''
450 d_flockproto=''
451 d_fork=''
452 d_fp_class=''
453 d_fpclass=''
454 d_fpclassify=''
455 d_fpclassl=''
456 d_fpos64_t=''
457 d_frexpl=''
458 d_fs_data_s=''
459 d_fseeko=''
460 d_fsetpos=''
461 d_fstatfs=''
462 d_fsync=''
463 d_ftello=''
464 d_ftime=''
465 d_gettimeod=''
466 d_futimes=''
467 d_Gconvert=''
468 d_getcwd=''
469 d_getespwnam=''
470 d_getfsstat=''
471 d_getgrent=''
472 d_getgrent_r=''
473 getgrent_r_proto=''
474 d_getgrgid_r=''
475 getgrgid_r_proto=''
476 d_getgrnam_r=''
477 getgrnam_r_proto=''
478 d_getgrps=''
479 d_gethbyaddr=''
480 d_gethbyname=''
481 d_gethent=''
482 aphostname=''
483 d_gethname=''
484 d_phostname=''
485 d_uname=''
486 d_gethostbyaddr_r=''
487 gethostbyaddr_r_proto=''
488 d_gethostbyname_r=''
489 gethostbyname_r_proto=''
490 d_gethostent_r=''
491 gethostent_r_proto=''
492 d_gethostprotos=''
493 d_getitimer=''
494 d_getlogin=''
495 d_getlogin_r=''
496 getlogin_r_proto=''
497 d_getmnt=''
498 d_getmntent=''
499 d_getnbyaddr=''
500 d_getnbyname=''
501 d_getnent=''
502 d_getnetbyaddr_r=''
503 getnetbyaddr_r_proto=''
504 d_getnetbyname_r=''
505 getnetbyname_r_proto=''
506 d_getnetent_r=''
507 getnetent_r_proto=''
508 d_getnetprotos=''
509 d_getpagsz=''
510 d_getpent=''
511 d_getpgid=''
512 d_getpgrp2=''
513 d_bsdgetpgrp=''
514 d_getpgrp=''
515 d_getppid=''
516 d_getprior=''
517 d_getpbyname=''
518 d_getpbynumber=''
519 d_getprotobyname_r=''
520 getprotobyname_r_proto=''
521 d_getprotobynumber_r=''
522 getprotobynumber_r_proto=''
523 d_getprotoent_r=''
524 getprotoent_r_proto=''
525 d_getprotoprotos=''
526 d_getprpwnam=''
527 d_getpwent=''
528 d_getpwent_r=''
529 getpwent_r_proto=''
530 d_getpwnam_r=''
531 getpwnam_r_proto=''
532 d_getpwuid_r=''
533 getpwuid_r_proto=''
534 d_getsent=''
535 d_getservbyname_r=''
536 getservbyname_r_proto=''
537 d_getservbyport_r=''
538 getservbyport_r_proto=''
539 d_getservent_r=''
540 getservent_r_proto=''
541 d_getservprotos=''
542 d_getspnam=''
543 d_getspnam_r=''
544 getspnam_r_proto=''
545 d_getsbyname=''
546 d_getsbyport=''
547 d_gmtime_r=''
548 gmtime_r_proto=''
549 d_gnulibc=''
550 gnulibc_version=''
551 d_hasmntopt=''
552 d_htonl=''
553 d_ilogbl=''
554 d_inetaton=''
555 d_int64_t=''
556 d_isascii=''
557 d_isfinite=''
558 d_isinf=''
559 d_isnan=''
560 d_isnanl=''
561 d_killpg=''
562 d_lchown=''
563 d_ldbl_dig=''
564 d_libm_lib_version=''
565 d_link=''
566 d_localtime_r=''
567 d_localtime_r_needs_tzset=''
568 localtime_r_proto=''
569 d_locconv=''
570 d_lockf=''
571 d_longdbl=''
572 longdblsize=''
573 d_longlong=''
574 longlongsize=''
575 d_lseekproto=''
576 d_lstat=''
577 d_madvise=''
578 d_malloc_good_size=''
579 d_malloc_size=''
580 d_mblen=''
581 d_mbstowcs=''
582 d_mbtowc=''
583 d_memchr=''
584 d_memcmp=''
585 d_memcpy=''
586 d_memmove=''
587 d_memset=''
588 d_mkdir=''
589 d_mkdtemp=''
590 d_mkfifo=''
591 d_mkstemp=''
592 d_mkstemps=''
593 d_mktime=''
594 d_mmap=''
595 mmaptype=''
596 d_modfl=''
597 d_modfl_pow32_bug=''
598 d_modflproto=''
599 d_mprotect=''
600 d_msg=''
601 d_msgctl=''
602 d_msgget=''
603 d_msghdr_s=''
604 d_msgrcv=''
605 d_msgsnd=''
606 d_msync=''
607 d_munmap=''
608 d_nice=''
609 d_nl_langinfo=''
610 d_off64_t=''
611 d_open3=''
612 d_fpathconf=''
613 d_pathconf=''
614 d_pause=''
615 d_pipe=''
616 d_poll=''
617 d_portable=''
618 d_procselfexe=''
619 procselfexe=''
620 d_old_pthread_create_joinable=''
621 old_pthread_create_joinable=''
622 d_pthread_atfork=''
623 d_pthread_attr_setscope=''
624 d_pthread_yield=''
625 d_sched_yield=''
626 sched_yield=''
627 d_qgcvt=''
628 d_random_r=''
629 random_r_proto=''
630 d_readdir64_r=''
631 readdir64_r_proto=''
632 d_readdir=''
633 d_rewinddir=''
634 d_seekdir=''
635 d_telldir=''
636 d_readdir_r=''
637 readdir_r_proto=''
638 d_readlink=''
639 d_readv=''
640 d_recvmsg=''
641 d_rename=''
642 d_rmdir=''
643 d_safebcpy=''
644 d_safemcpy=''
645 d_sanemcmp=''
646 d_sbrkproto=''
647 d_scalbnl=''
648 d_select=''
649 d_sem=''
650 d_semctl=''
651 d_semget=''
652 d_semop=''
653 d_sendmsg=''
654 d_setegid=''
655 d_seteuid=''
656 d_setgrent=''
657 d_setgrent_r=''
658 setgrent_r_proto=''
659 d_setgrps=''
660 d_sethent=''
661 d_sethostent_r=''
662 sethostent_r_proto=''
663 d_setitimer=''
664 d_setlinebuf=''
665 d_setlocale=''
666 d_setlocale_r=''
667 setlocale_r_proto=''
668 d_setnent=''
669 d_setnetent_r=''
670 setnetent_r_proto=''
671 d_setpent=''
672 d_setpgid=''
673 d_setpgrp2=''
674 d_bsdsetpgrp=''
675 d_setpgrp=''
676 d_setprior=''
677 d_setproctitle=''
678 d_setprotoent_r=''
679 setprotoent_r_proto=''
680 d_setpwent=''
681 d_setpwent_r=''
682 setpwent_r_proto=''
683 d_setregid=''
684 d_setresgid=''
685 d_setresuid=''
686 d_setreuid=''
687 d_setrgid=''
688 d_setruid=''
689 d_setsent=''
690 d_setservent_r=''
691 setservent_r_proto=''
692 d_setsid=''
693 d_setvbuf=''
694 d_sfio=''
695 usesfio=''
696 d_shm=''
697 d_shmat=''
698 d_shmatprototype=''
699 shmattype=''
700 d_shmctl=''
701 d_shmdt=''
702 d_shmget=''
703 d_sigaction=''
704 d_signbit=''
705 d_sigprocmask=''
706 d_sigsetjmp=''
707 usesitecustomize=''
708 d_snprintf=''
709 d_vsnprintf=''
710 d_sockatmark=''
711 d_sockatmarkproto=''
712 d_msg_ctrunc=''
713 d_msg_dontroute=''
714 d_msg_oob=''
715 d_msg_peek=''
716 d_msg_proxy=''
717 d_oldsock=''
718 d_scm_rights=''
719 d_socket=''
720 d_sockpair=''
721 sockethdr=''
722 socketlib=''
723 d_socklen_t=''
724 d_socks5_init=''
725 d_sprintf_returns_strlen=''
726 d_sqrtl=''
727 d_srand48_r=''
728 srand48_r_proto=''
729 d_srandom_r=''
730 srandom_r_proto=''
731 d_sresgproto=''
732 d_sresuproto=''
733 d_statblks=''
734 d_statfs_f_flags=''
735 d_statfs_s=''
736 d_fstatvfs=''
737 d_statvfs=''
738 d_stdio_cnt_lval=''
739 d_stdio_ptr_lval=''
740 d_stdio_ptr_lval_nochange_cnt=''
741 d_stdio_ptr_lval_sets_cnt=''
742 d_stdiobase=''
743 d_stdstdio=''
744 stdio_base=''
745 stdio_bufsiz=''
746 stdio_cnt=''
747 stdio_filbuf=''
748 stdio_ptr=''
749 d_index=''
750 d_strchr=''
751 d_strcoll=''
752 d_strctcpy=''
753 d_strerrm=''
754 d_strerror=''
755 d_sysernlst=''
756 d_syserrlst=''
757 d_strerror_r=''
758 strerror_r_proto=''
759 d_strftime=''
760 d_strlcat=''
761 d_strlcpy=''
762 d_strtod=''
763 d_strtol=''
764 d_strtold=''
765 d_strtoll=''
766 d_strtoq=''
767 d_strtoul=''
768 d_strtoull=''
769 d_strtouq=''
770 d_strxfrm=''
771 d_symlink=''
772 d_syscall=''
773 d_syscallproto=''
774 d_sysconf=''
775 d_system=''
776 d_tcgetpgrp=''
777 d_tcsetpgrp=''
778 d_telldirproto=''
779 d_time=''
780 timetype=''
781 clocktype=''
782 d_times=''
783 d_tmpnam_r=''
784 tmpnam_r_proto=''
785 d_truncate=''
786 d_ttyname_r=''
787 ttyname_r_proto=''
788 d_tzname=''
789 d_u32align=''
790 d_ualarm=''
791 d_umask=''
792 d_semctl_semid_ds=''
793 d_semctl_semun=''
794 d_union_semun=''
795 d_unordered=''
796 d_unsetenv=''
797 d_usleep=''
798 d_usleepproto=''
799 d_ustat=''
800 d_pseudofork=''
801 d_vfork=''
802 usevfork=''
803 d_voidsig=''
804 signal_t=''
805 d_volatile=''
806 d_charvspr=''
807 d_vprintf=''
808 d_wait4=''
809 d_waitpid=''
810 d_wcstombs=''
811 d_wctomb=''
812 d_writev=''
813 dlext=''
814 cccdlflags=''
815 ccdlflags=''
816 dlsrc=''
817 ld=''
818 lddlflags=''
819 usedl=''
820 doublesize=''
821 ebcdic=''
822 fflushNULL=''
823 fflushall=''
824 fpossize=''
825 fpostype=''
826 gccansipedantic=''
827 gccosandvers=''
828 gccversion=''
829 gidformat=''
830 gidsign=''
831 gidsize=''
832 gidtype=''
833 groupstype=''
834 h_fcntl=''
835 h_sysfile=''
836 html1dir=''
837 html1direxp=''
838 installhtml1dir=''
839 html3dir=''
840 html3direxp=''
841 installhtml3dir=''
842 i_arpainet=''
843 i_assert=''
844 i_crypt=''
845 db_hashtype=''
846 db_prefixtype=''
847 db_version_major=''
848 db_version_minor=''
849 db_version_patch=''
850 i_db=''
851 i_dbm=''
852 i_rpcsvcdbm=''
853 d_dirnamlen=''
854 direntrytype=''
855 i_dirent=''
856 i_dld=''
857 i_dlfcn=''
858 i_fcntl=''
859 i_float=''
860 i_fp=''
861 i_fp_class=''
862 i_gdbm=''
863 d_grpasswd=''
864 i_grp=''
865 i_ieeefp=''
866 i_inttypes=''
867 i_langinfo=''
868 i_libutil=''
869 i_limits=''
870 i_locale=''
871 i_machcthr=''
872 i_malloc=''
873 i_math=''
874 i_memory=''
875 i_mntent=''
876 i_ndbm=''
877 i_netdb=''
878 i_neterrno=''
879 i_netinettcp=''
880 i_niin=''
881 i_sysin=''
882 i_poll=''
883 i_prot=''
884 i_pthread=''
885 d_pwage=''
886 d_pwchange=''
887 d_pwclass=''
888 d_pwcomment=''
889 d_pwexpire=''
890 d_pwgecos=''
891 d_pwpasswd=''
892 d_pwquota=''
893 i_pwd=''
894 i_sfio=''
895 i_shadow=''
896 i_socks=''
897 i_stddef=''
898 i_stdlib=''
899 i_string=''
900 strings=''
901 i_sunmath=''
902 i_sysaccess=''
903 i_sysdir=''
904 i_sysfile=''
905 d_voidtty=''
906 i_bsdioctl=''
907 i_sysfilio=''
908 i_sysioctl=''
909 i_syssockio=''
910 i_syslog=''
911 i_sysmman=''
912 i_sysmode=''
913 i_sysmount=''
914 i_sysndir=''
915 i_sysparam=''
916 i_sysresrc=''
917 i_syssecrt=''
918 i_sysselct=''
919 i_sysstat=''
920 i_sysstatfs=''
921 i_sysstatvfs=''
922 i_systimes=''
923 i_systypes=''
924 i_sysuio=''
925 i_sysun=''
926 i_sysutsname=''
927 i_sysvfs=''
928 i_syswait=''
929 i_sgtty=''
930 i_termio=''
931 i_termios=''
932 d_tm_tm_gmtoff=''
933 d_tm_tm_zone=''
934 i_systime=''
935 i_systimek=''
936 i_time=''
937 timeincl=''
938 i_unistd=''
939 i_ustat=''
940 i_utime=''
941 i_values=''
942 i_stdarg=''
943 i_varargs=''
944 i_varhdr=''
945 i_vfork=''
946 d_inc_version_list=''
947 inc_version_list=''
948 inc_version_list_init=''
949 installprefix=''
950 installprefixexp=''
951 installstyle=''
952 installusrbinperl=''
953 intsize=''
954 longsize=''
955 shortsize=''
956 issymlink=''
957 libc=''
958 ldlibpthname=''
959 libperl=''
960 shrpenv=''
961 useshrplib=''
962 glibpth=''
963 libpth=''
964 loclibpth=''
965 plibpth=''
966 xlibpth=''
967 ignore_versioned_solibs=''
968 libs=''
969 libsdirs=''
970 libsfiles=''
971 libsfound=''
972 libspath=''
973 lns=''
974 d_PRIEUldbl=''
975 d_PRIFUldbl=''
976 d_PRIGUldbl=''
977 d_PRIeldbl=''
978 d_PRIfldbl=''
979 d_PRIgldbl=''
980 d_SCNfldbl=''
981 sPRIEUldbl=''
982 sPRIFUldbl=''
983 sPRIGUldbl=''
984 sPRIeldbl=''
985 sPRIfldbl=''
986 sPRIgldbl=''
987 sSCNfldbl=''
988 lseeksize=''
989 lseektype=''
990 mad=''
991 madlyh=''
992 madlyobj=''
993 madlysrc=''
994 make_set_make=''
995 d_mymalloc=''
996 freetype=''
997 mallocobj=''
998 mallocsrc=''
999 malloctype=''
1000 usemallocwrap=''
1001 usemymalloc=''
1002 installman1dir=''
1003 man1dir=''
1004 man1direxp=''
1005 man1ext=''
1006 installman3dir=''
1007 man3dir=''
1008 man3direxp=''
1009 man3ext=''
1010 modetype=''
1011 multiarch=''
1012 mydomain=''
1013 myhostname=''
1014 phostname=''
1015 c=''
1016 n=''
1017 d_eofnblk=''
1018 eagain=''
1019 o_nonblock=''
1020 rd_nodata=''
1021 need_va_copy=''
1022 netdb_hlen_type=''
1023 netdb_host_type=''
1024 netdb_name_type=''
1025 netdb_net_type=''
1026 groupcat=''
1027 hostcat=''
1028 passcat=''
1029 orderlib=''
1030 ranlib=''
1031 d_perl_otherlibdirs=''
1032 otherlibdirs=''
1033 package=''
1034 spackage=''
1035 pager=''
1036 api_revision=''
1037 api_subversion=''
1038 api_version=''
1039 api_versionstring=''
1040 patchlevel=''
1041 perl_patchlevel=''
1042 revision=''
1043 subversion=''
1044 version=''
1045 version_patchlevel_string=''
1046 perl5=''
1047 perladmin=''
1048 perlpath=''
1049 d_nv_preserves_uv=''
1050 d_nv_zero_is_allbits_zero=''
1051 i16size=''
1052 i16type=''
1053 i32size=''
1054 i32type=''
1055 i64size=''
1056 i64type=''
1057 i8size=''
1058 i8type=''
1059 ivsize=''
1060 ivtype=''
1061 nv_preserves_uv_bits=''
1062 nvsize=''
1063 nvtype=''
1064 u16size=''
1065 u16type=''
1066 u32size=''
1067 u32type=''
1068 u64size=''
1069 u64type=''
1070 u8size=''
1071 u8type=''
1072 uvsize=''
1073 uvtype=''
1074 ivdformat=''
1075 nvEUformat=''
1076 nvFUformat=''
1077 nvGUformat=''
1078 nveformat=''
1079 nvfformat=''
1080 nvgformat=''
1081 uvXUformat=''
1082 uvoformat=''
1083 uvuformat=''
1084 uvxformat=''
1085 pidtype=''
1086 prefix=''
1087 prefixexp=''
1088 installprivlib=''
1089 privlib=''
1090 privlibexp=''
1091 prototype=''
1092 ptrsize=''
1093 d_PRIXU64=''
1094 d_PRId64=''
1095 d_PRIi64=''
1096 d_PRIo64=''
1097 d_PRIu64=''
1098 d_PRIx64=''
1099 sPRIXU64=''
1100 sPRId64=''
1101 sPRIi64=''
1102 sPRIo64=''
1103 sPRIu64=''
1104 sPRIx64=''
1105 d_quad=''
1106 quadkind=''
1107 quadtype=''
1108 uquadtype=''
1109 drand01=''
1110 randbits=''
1111 randfunc=''
1112 randseedtype=''
1113 seedfunc=''
1114 installscript=''
1115 scriptdir=''
1116 scriptdirexp=''
1117 selectminbits=''
1118 selecttype=''
1119 sh=''
1120 sig_count=''
1121 sig_name=''
1122 sig_name_init=''
1123 sig_num=''
1124 sig_num_init=''
1125 sig_size=''
1126 d_sitearch=''
1127 installsitearch=''
1128 sitearch=''
1129 sitearchexp=''
1130 installsitebin=''
1131 sitebin=''
1132 sitebinexp=''
1133 installsitehtml1dir=''
1134 sitehtml1dir=''
1135 sitehtml1direxp=''
1136 installsitehtml3dir=''
1137 sitehtml3dir=''
1138 sitehtml3direxp=''
1139 installsitelib=''
1140 sitelib=''
1141 sitelib_stem=''
1142 sitelibexp=''
1143 installsiteman1dir=''
1144 siteman1dir=''
1145 siteman1direxp=''
1146 installsiteman3dir=''
1147 siteman3dir=''
1148 siteman3direxp=''
1149 siteprefix=''
1150 siteprefixexp=''
1151 installsitescript=''
1152 sitescript=''
1153 sitescriptexp=''
1154 sizesize=''
1155 sizetype=''
1156 so=''
1157 socksizetype=''
1158 sharpbang=''
1159 shsharp=''
1160 spitshell=''
1161 src=''
1162 ssizetype=''
1163 startperl=''
1164 startsh=''
1165 stdchar=''
1166 d_stdio_stream_array=''
1167 stdio_stream_array=''
1168 sysman=''
1169 trnl=''
1170 uidformat=''
1171 uidsign=''
1172 uidsize=''
1173 uidtype=''
1174 archname64=''
1175 use64bitall=''
1176 use64bitint=''
1177 dtrace=''
1178 usedtrace=''
1179 usefaststdio=''
1180 ccflags_uselargefiles=''
1181 ldflags_uselargefiles=''
1182 libswanted_uselargefiles=''
1183 uselargefiles=''
1184 uselongdouble=''
1185 usemorebits=''
1186 usemultiplicity=''
1187 nm_opt=''
1188 nm_so_opt=''
1189 runnm=''
1190 usenm=''
1191 useperlio=''
1192 usesocks=''
1193 d_oldpthreads=''
1194 use5005threads=''
1195 useithreads=''
1196 usereentrant=''
1197 usethreads=''
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 : Detect odd OSs
1241 define='define'
1242 undef='undef'
1243 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1244 rmlist=''
1245
1246 : We must find out about Eunice early
1247 eunicefix=':'
1248 if test -f /etc/unixtovms; then
1249         eunicefix=/etc/unixtovms
1250 fi
1251 if test -f /etc/unixtovms.exe; then
1252         eunicefix=/etc/unixtovms.exe
1253 fi
1254
1255 : Set executable suffix now -- needed before hints available
1256 if test -f "/libs/version.library"; then
1257 : Amiga OS
1258     _exe=""
1259 elif test -f "/system/gnu_library/bin/ar.pm"; then
1260 : Stratus VOS
1261     _exe=".pm"
1262 elif test -n "$DJGPP"; then
1263 : DOS DJGPP
1264     _exe=".exe"
1265 elif test -d c:/. -o -n "$is_os2" ; then
1266 : OS/2 or cygwin
1267     _exe=".exe"
1268 fi
1269
1270 i_whoami=''
1271 : Trailing extension.  Override this in a hint file, if needed.
1272 : Extra object files, if any, needed on this platform.
1273 archobjs=''
1274 archname=''
1275 groupstype=''
1276 libnames=''
1277 : change the next line if compiling for Xenix/286 on Xenix/386
1278 xlibpth='/usr/lib/386 /lib/386'
1279 : Possible local library directories to search.
1280 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1281 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1282
1283 : general looking path for locating libraries
1284 glibpth="/lib /usr/lib $xlibpth"
1285 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1286 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1287 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1288 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1289
1290 : Private path used by Configure to find libraries.  Its value
1291 : is prepended to libpth. This variable takes care of special
1292 : machines, like the mips.  Usually, it should be empty.
1293 plibpth=''
1294
1295 : default library list
1296 libswanted=''
1297 : some systems want to use only the non-versioned libso:s
1298 ignore_versioned_solibs=''
1299 siteman1dir=''
1300 siteman3dir=''
1301 sitescript=''
1302 : set usethreads on the Configure command line to enable threads.
1303 usereentrant='undef'
1304 : full support for void wanted by default
1305 defvoidused=15
1306
1307 : Possible local include directories to search.
1308 : Set locincpth to "" in a hint file to defeat local include searches.
1309 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1310 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1311 :
1312 : no include file wanted by default
1313 inclwanted=''
1314
1315 : Enable -DEBUGGING and -DDEBUGGING from the command line
1316 EBUGGING=''
1317 DEBUGGING=old
1318
1319 ccname=''
1320 ccversion=''
1321 perllibs=''
1322 : set useposix=false in your hint file to disable the POSIX extension.
1323 useposix=true
1324 : set useopcode=false in your hint file to disable the Opcode extension.
1325 useopcode=true
1326 archname64=''
1327 ccflags_uselargefiles=''
1328 ldflags_uselargefiles=''
1329 libswanted_uselargefiles=''
1330 : set usemultiplicity on the Configure command line to enable multiplicity.
1331 : set usesocks on the Configure command line to enable socks.
1332 : List of libraries we want.
1333 : If anyone needs extra -lxxx, put those in a hint file.
1334 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1335 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1336 : We probably want to search /usr/shlib before most other libraries.
1337 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1338 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1339 glibpth="/usr/shlib $glibpth"
1340 : Do not use vfork unless overridden by a hint file.
1341 usevfork=false
1342
1343 : Find the basic shell for Bourne shell scripts
1344 case "$sh" in
1345 '')
1346         case "$SYSTYPE" in
1347         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1348         *) xxx='/bin/sh';;
1349         esac
1350         if test -f "$xxx"; then
1351                 sh="$xxx"
1352         else
1353                 : Build up a list and do a single loop so we can 'break' out.
1354                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1355                 for xxx in sh bash ksh pdksh ash; do
1356                         for p in $pth; do
1357                                 try="$try ${p}/${xxx}"
1358                         done
1359                 done
1360                 for xxx in $try; do
1361                         if test -f "$xxx"; then
1362                                 sh="$xxx";
1363                                 break
1364                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1365                                 sh="$xxx";
1366                                 break
1367                         elif test -f "$xxx.exe"; then
1368                                 sh="$xxx";
1369                                 break
1370                         fi
1371                 done
1372         fi
1373         ;;
1374 esac
1375
1376 case "$sh" in
1377 '')     cat >&2 <<EOM
1378 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1379
1380 Usually it's in /bin/sh.  How did you even get this far?
1381 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1382 we'll try to straighten this all out.
1383 EOM
1384         exit 1
1385         ;;
1386 esac
1387
1388 : see if sh knows # comments
1389 if `$sh -c '#' >/dev/null 2>&1`; then
1390         shsharp=true
1391         spitshell=cat
1392         xcat=/bin/cat
1393         test -f $xcat$_exe || xcat=/usr/bin/cat
1394         if test ! -f $xcat$_exe; then
1395                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1396                         if test -f $p/cat$_exe; then
1397                                 xcat=$p/cat
1398                                 break
1399                         fi
1400                 done
1401                 if test ! -f $xcat$_exe; then
1402                         echo "Can't find cat anywhere!"
1403                         exit 1
1404                 fi
1405         fi
1406         echo "#!$xcat" >sharp
1407         $eunicefix sharp
1408         chmod +x sharp
1409         ./sharp > today
1410         if test -s today; then
1411                 sharpbang='#!'
1412         else
1413                 echo "#! $xcat" > sharp
1414                 $eunicefix sharp
1415                 chmod +x sharp
1416                 ./sharp > today
1417                 if test -s today; then
1418                         sharpbang='#! '
1419                 else
1420                         sharpbang=': use '
1421                 fi
1422         fi
1423 else
1424         echo " "
1425         echo "Your $sh doesn't grok # comments--I will strip them later on."
1426         shsharp=false
1427         cd ..
1428         echo "exec grep -v '^[  ]*#'" >spitshell
1429         chmod +x spitshell
1430         $eunicefix spitshell
1431         spitshell=`pwd`/spitshell
1432         cd UU
1433         echo "I presume that if # doesn't work, #! won't work either!"
1434         sharpbang=': use '
1435 fi
1436 rm -f sharp today
1437
1438 : figure out how to guarantee sh startup
1439 case "$startsh" in
1440 '') startsh=${sharpbang}${sh} ;;
1441 *)
1442 esac
1443 cat >sharp <<EOSS
1444 $startsh
1445 set abc
1446 test "$?abc" != 1
1447 EOSS
1448
1449 chmod +x sharp
1450 $eunicefix sharp
1451 if ./sharp; then
1452         : echo "Yup, it does."
1453 else
1454         echo "Hmm... '$startsh' does not guarantee sh startup..."
1455         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1456 fi
1457 rm -f sharp
1458
1459 : Save command line options in file UU/cmdline.opt for later use in
1460 : generating config.sh.
1461 cat > cmdline.opt <<EOSH
1462 : Configure command line arguments.
1463 config_arg0='$0'
1464 config_args='$*'
1465 config_argc=$#
1466 EOSH
1467 argn=1
1468 args_exp=''
1469 args_sep=''
1470 for arg in "$@"; do
1471         cat >>cmdline.opt <<EOSH
1472 config_arg$argn='$arg'
1473 EOSH
1474         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1475 $arg
1476 EOC
1477         arg_exp=`cat cmdl.opt`
1478         args_exp="$args_exp$args_sep'$arg_exp'"
1479         argn=`expr $argn + 1`
1480         args_sep=' '
1481 done
1482 rm -f cmdl.opt
1483
1484 : produce awk script to parse command line options
1485 cat >options.awk <<'EOF'
1486 BEGIN {
1487         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1488
1489         len = length(optstr);
1490         for (i = 1; i <= len; i++) {
1491                 c = substr(optstr, i, 1);
1492                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1493                 if (a == ":") {
1494                         arg[c] = 1;
1495                         i++;
1496                 }
1497                 opt[c] = 1;
1498         }
1499 }
1500 {
1501         expect = 0;
1502         str = $0;
1503         if (substr(str, 1, 1) != "-") {
1504                 printf("'%s'\n", str);
1505                 next;
1506         }
1507         len = length($0);
1508         for (i = 2; i <= len; i++) {
1509                 c = substr(str, i, 1);
1510                 if (!opt[c]) {
1511                         printf("-%s\n", substr(str, i));
1512                         next;
1513                 }
1514                 printf("-%s\n", c);
1515                 if (arg[c]) {
1516                         if (i < len)
1517                                 printf("'%s'\n", substr(str, i + 1));
1518                         else
1519                                 expect = 1;
1520                         next;
1521                 }
1522         }
1523 }
1524 END {
1525         if (expect)
1526                 print "?";
1527 }
1528 EOF
1529
1530 : process the command line options
1531 set X `for arg in "$@"; do echo "X$arg"; done |
1532         sed -e s/X// | awk -f options.awk`
1533 eval "set $*"
1534 shift
1535 rm -f options.awk
1536
1537 : set up default values
1538 fastread=''
1539 reuseval=false
1540 config_sh=''
1541 alldone=''
1542 error=''
1543 silent=''
1544 extractsh=''
1545 override=''
1546 knowitall=''
1547 rm -f optdef.sh posthint.sh
1548 cat >optdef.sh <<EOS
1549 $startsh
1550 EOS
1551
1552
1553 : option parsing
1554 while test $# -gt 0; do
1555         case "$1" in
1556         -d) shift; fastread=yes;;
1557         -e) shift; alldone=cont;;
1558         -f)
1559                 shift
1560                 cd ..
1561                 if test -r "$1"; then
1562                         config_sh="$1"
1563                 else
1564                         echo "$me: cannot read config file $1." >&2
1565                         error=true
1566                 fi
1567                 cd UU
1568                 shift;;
1569         --help|\
1570         -h) shift; error=true;;
1571         -r) shift; reuseval=true;;
1572         -s) shift; silent=true; realsilent=true;;
1573         -E) shift; alldone=exit;;
1574         -K) shift; knowitall=true;;
1575         -O) shift; override=true;;
1576         -S) shift; silent=true; extractsh=true;;
1577         -D)
1578                 shift
1579                 case "$1" in
1580                 *=)
1581                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1582                         echo "$me: ignoring -D $1" >&2
1583                         ;;
1584                 *=*) echo "$1" | \
1585                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1586                 *) echo "$1='define'" >> optdef.sh;;
1587                 esac
1588                 shift
1589                 ;;
1590         -U)
1591                 shift
1592                 case "$1" in
1593                 *=) echo "$1" >> optdef.sh;;
1594                 *=*)
1595                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1596                         echo "$me: ignoring -U $1" >&2
1597                         ;;
1598                 *) echo "$1='undef'" >> optdef.sh;;
1599                 esac
1600                 shift
1601                 ;;
1602         -A)
1603             shift
1604             xxx=''
1605             yyy="$1"
1606             zzz=''
1607             uuu=undef
1608             case "$yyy" in
1609             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1610                  case "$zzz" in
1611                  *:*) zzz='' ;;
1612                  *)   xxx=append
1613                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1614                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1615                  esac
1616                  ;;
1617             esac
1618             case "$xxx" in
1619             '')  case "$yyy" in
1620                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1621                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1622                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1623                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1624                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1625                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1626                  esac
1627                  ;;
1628             esac
1629             case "$xxx" in
1630             append)
1631                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1632             clear)
1633                 echo "$yyy=''"                  >> posthint.sh ;;
1634             define)
1635                 case "$zzz" in
1636                 '') zzz=define ;;
1637                 esac
1638                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1639             eval)
1640                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1641             prepend)
1642                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1643             undef)
1644                 case "$zzz" in
1645                 '') zzz="$uuu" ;;
1646                 esac
1647                 echo "$yyy=$zzz"                >> posthint.sh ;;
1648             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1649             esac
1650             shift
1651             ;;
1652         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1653             exit 0;;
1654         --) break;;
1655         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1656         *) break;;
1657         esac
1658 done
1659
1660 case "$error" in
1661 true)
1662         cat >&2 <<EOM
1663 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1664                  [-U symbol] [-U symbol=] [-A command:symbol...]
1665   -d : use defaults for all answers.
1666   -e : go on without questioning past the production of config.sh.
1667   -f : specify an alternate default configuration file.
1668   -h : print this help message and exit (with an error status).
1669   -r : reuse C symbols value if possible (skips costly nm extraction).
1670   -s : silent mode, only echoes questions and essential information.
1671   -D : define symbol to have some value:
1672          -D symbol         symbol gets the value 'define'
1673          -D symbol=value   symbol gets the value 'value'
1674        common used examples (see INSTALL for more info):
1675          -Duse64bitint            use 64bit integers
1676          -Duse64bitall            use 64bit integers and pointers
1677          -Dusethreads             use thread support
1678          -Dinc_version_list=none  do not include older perl trees in @INC
1679          -DEBUGGING=none          DEBUGGING options
1680          -Dcc=gcc                 choose your compiler
1681          -Dprefix=/opt/perl5      choose your destination
1682   -E : stop at the end of questions, after having produced config.sh.
1683   -K : do not use unless you know what you are doing.
1684   -O : let -D and -U override definitions from loaded configuration file.
1685   -S : perform variable substitutions on all .SH files (can mix with -f)
1686   -U : undefine symbol:
1687          -U symbol    symbol gets the value 'undef'
1688          -U symbol=   symbol gets completely empty
1689        e.g.:  -Uversiononly
1690   -A : manipulate symbol after the platform specific hints have been applied:
1691          -A append:symbol=value   append value to symbol
1692          -A symbol=value          like append:, but with a separating space
1693          -A define:symbol=value   define symbol to have value
1694          -A clear:symbol          define symbol to be ''
1695          -A define:symbol         define symbol to be 'define'
1696          -A eval:symbol=value     define symbol to be eval of value
1697          -A prepend:symbol=value  prepend value to symbol
1698          -A undef:symbol          define symbol to be 'undef'
1699          -A undef:symbol=         define symbol to be ''
1700        e.g.:  -A prepend:libswanted='cl pthread '
1701               -A ccflags=-DSOME_MACRO
1702   -V : print version number and exit (with a zero status).
1703 EOM
1704         exit 1
1705         ;;
1706 esac
1707
1708 : Sanity checks
1709 case "$fastread$alldone" in
1710 yescont|yesexit) ;;
1711 *)
1712         case "$extractsh" in
1713         true) ;;
1714         *)
1715                 if test ! -t 0; then
1716                         echo "Say 'sh Configure', not 'sh <Configure'"
1717                         exit 1
1718                 fi
1719                 ;;
1720         esac
1721         ;;
1722 esac
1723
1724 exec 4>&1
1725 case "$silent" in
1726 true) exec 1>/dev/null;;
1727 esac
1728
1729 : run the defines and the undefines, if any, but leave the file out there...
1730 touch optdef.sh
1731 . ./optdef.sh
1732 : create the posthint manipulation script and leave the file out there...
1733 touch posthint.sh
1734
1735 : set package name
1736 package='perl5'
1737 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1738 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1739 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1740 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1741 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1742 esac
1743
1744 : Some greps do not return status, grrr.
1745 echo "grimblepritz" >grimble
1746 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1747         contains=contains
1748 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1749         contains=grep
1750 else
1751         contains=contains
1752 fi
1753 rm -f grimble
1754 : the following should work in any shell
1755 case "$contains" in
1756 contains*)
1757         echo " "
1758         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1759         cat >contains <<'EOSS'
1760 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1761 EOSS
1762 chmod +x contains
1763 esac
1764
1765 : Find the path to the source tree
1766 case "$src" in
1767 '') case "$0" in
1768     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1769          case "$src" in
1770          /*)    ;;
1771          .)     ;;
1772          *)     src=`cd ../$src && pwd` ;;
1773          esac
1774          ;;
1775     *)   src='.';;
1776     esac;;
1777 esac
1778 case "$src" in
1779 '')     src=/
1780         rsrc=/
1781         ;;
1782 /*)     rsrc="$src";;
1783 *)      rsrc="../$src";;
1784 esac
1785 if test -f $rsrc/Configure && \
1786         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1787 then
1788    : found it, so we are ok.
1789 else
1790         rsrc=''
1791         for src in . .. ../.. ../../.. ../../../..; do
1792                 if test -f ../$src/Configure && \
1793                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1794                 then
1795                         rsrc=../$src
1796                         break
1797                 fi
1798         done
1799 fi
1800 case "$rsrc" in
1801 '')
1802         cat <<EOM >&4
1803
1804 Sorry, I can't seem to locate the source dir for $package.  Please start
1805 Configure with an explicit path -- i.e. /some/path/Configure.
1806
1807 EOM
1808         exit 1
1809         ;;
1810 ../.)   rsrc='..';;
1811 *)
1812         echo " "
1813         echo "Sources for $package found in \"$src\"." >&4
1814         ;;
1815 esac
1816
1817 : script used to extract .SH files with variable substitutions
1818 cat >extract <<'EOS'
1819 PERL_CONFIG_SH=true
1820 echo "Doing variable substitutions on .SH files..."
1821 if test -f MANIFEST; then
1822         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1823 else
1824         echo "(Looking for .SH files under the source directory.)"
1825         set x `(cd "$src"; find . -name "*.SH" -print)`
1826 fi
1827 shift
1828 case $# in
1829 0) set x `(cd "$src"; echo *.SH)`; shift;;
1830 esac
1831 if test ! -f "$src/$1"; then
1832         shift
1833 fi
1834 mkdir_p='
1835 name=$1;
1836 create="";
1837 while test $name; do
1838         if test ! -d "$name"; then
1839                 create="$name $create";
1840                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1841                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1842         else
1843                 name="";
1844         fi;
1845 done;
1846 for file in $create; do
1847         mkdir $file;
1848 done
1849 '
1850 for file in $*; do
1851         case "$src" in
1852         ".")
1853                 case "$file" in
1854                 */*)
1855                         dir=`expr X$file : 'X\(.*\)/'`
1856                         file=`expr X$file : 'X.*/\(.*\)'`
1857                         (cd "$dir" && . ./$file)
1858                         ;;
1859                 *)
1860                         . ./$file
1861                         ;;
1862                 esac
1863                 ;;
1864         *)
1865                 case "$file" in
1866                 */*)
1867                         dir=`expr X$file : 'X\(.*\)/'`
1868                         file=`expr X$file : 'X.*/\(.*\)'`
1869                         (set x $dir; shift; eval $mkdir_p)
1870                         sh <"$src/$dir/$file"
1871                         ;;
1872                 *)
1873                         sh <"$src/$file"
1874                         ;;
1875                 esac
1876                 ;;
1877         esac
1878 done
1879 if test -f "$src/config_h.SH"; then
1880         if test ! -f config.h; then
1881         : oops, they left it out of MANIFEST, probably, so do it anyway.
1882         . "$src/config_h.SH"
1883         fi
1884 fi
1885 EOS
1886
1887 : extract files and exit if asked to do so
1888 case "$extractsh" in
1889 true)
1890         case "$realsilent" in
1891         true) ;;
1892         *) exec 1>&4;;
1893         esac
1894         case "$config_sh" in
1895         '') config_sh='config.sh';;
1896         esac
1897         echo " "
1898         echo "Fetching answers from $config_sh..."
1899         cd ..
1900         . $config_sh
1901         test "$override" && . ./optdef.sh
1902         echo " "
1903         . UU/extract
1904         rm -rf UU
1905         echo "Extraction done."
1906         exit 0
1907         ;;
1908 esac
1909
1910 : Eunice requires " " instead of "", can you believe it
1911 echo " "
1912 : Here we go...
1913 echo "Beginning of configuration questions for $package."
1914
1915 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1916
1917 : first determine how to suppress newline on echo command
1918 echo " "
1919 echo "Checking echo to see how to suppress newlines..."
1920 (echo "hi there\c" ; echo " ") >.echotmp
1921 if $contains c .echotmp >/dev/null 2>&1 ; then
1922         echo "...using -n."
1923         n='-n'
1924         c=''
1925 else
1926         cat <<'EOM'
1927 ...using \c
1928 EOM
1929         n=''
1930         c='\c'
1931 fi
1932 echo $n "The star should be here-->$c"
1933 echo '*'
1934 rm -f .echotmp
1935
1936 : Now test for existence of everything in MANIFEST
1937 echo " "
1938 if test -f "$rsrc/MANIFEST"; then
1939         echo "First let's make sure your kit is complete.  Checking..." >&4
1940         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1941         rm -f missing
1942         tmppwd=`pwd`
1943         for filelist in x??; do
1944                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1945         done
1946         if test -s missing; then
1947                 cat missing >&4
1948                 cat >&4 <<'EOM'
1949
1950 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1951
1952 You have the option of continuing the configuration process, despite the
1953 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1954 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1955 and contact the author (perlbug@perl.org).
1956
1957 EOM
1958                 echo $n "Continue? [n] $c" >&4
1959                 read ans
1960                 case "$ans" in
1961                 y*)
1962                         echo "Continuing..." >&4
1963                         rm -f missing
1964                         ;;
1965                 *)
1966                         echo "ABORTING..." >&4
1967                         kill $$
1968                         ;;
1969                 esac
1970         else
1971                 echo "Looks good..."
1972         fi
1973 else
1974         echo "There is no MANIFEST file.  I hope your kit is complete !"
1975 fi
1976 rm -f missing x??
1977
1978 : Find the appropriate value for a newline for tr
1979 echo " "
1980 if test -n "$DJGPP"; then
1981        trnl='\012'
1982 fi
1983 if test X"$trnl" = X; then
1984         case "`echo foo|tr '\n' x 2>/dev/null`" in
1985         foox) trnl='\n' ;;
1986         esac
1987 fi
1988 if test X"$trnl" = X; then
1989         case "`echo foo|tr '\012' x 2>/dev/null`" in
1990         foox) trnl='\012' ;;
1991         esac
1992 fi
1993 if test X"$trnl" = X; then
1994        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1995        fooxy) trnl='\n\r' ;;
1996        esac
1997 fi
1998 if test X"$trnl" = X; then
1999         cat <<EOM >&2
2000
2001 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2002
2003 EOM
2004         exit 1
2005 fi
2006
2007 : compute the number of columns on the terminal for proper question formatting
2008 case "$COLUMNS" in
2009 '') COLUMNS='80';;
2010 esac
2011
2012 : set up the echo used in my read
2013 myecho="case \"\$xxxm\" in
2014 '') echo $n \"\$rp $c\" >&4;;
2015 *) case \"\$rp\" in
2016         '') echo $n \"[\$xxxm] $c\";;
2017         *)
2018                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2019                         echo \"\$rp\" >&4
2020                         echo $n \"[\$xxxm] $c\" >&4
2021                 else
2022                         echo $n \"\$rp [\$xxxm] $c\" >&4
2023                 fi
2024                 ;;
2025         esac;;
2026 esac"
2027
2028 : now set up to do reads with possible shell escape and default assignment
2029 cat <<EOSC >myread
2030 $startsh
2031 xxxm=\$dflt
2032 $myecho
2033 ans='!'
2034 case "\$fastread" in
2035 yes) case "\$dflt" in
2036         '') ;;
2037         *) ans='';
2038                 case "\$silent-\$rp" in
2039                 true-) ;;
2040                 *) echo " " >&4;;
2041                 esac;;
2042         esac;;
2043 *) case "\$silent" in
2044         true) case "\$rp" in
2045                 '') ans='';;
2046                 esac;;
2047         esac;;
2048 esac
2049 while expr "X\$ans" : "X!" >/dev/null; do
2050         read answ
2051         set x \$xxxm
2052         shift
2053         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2054         case  "\$answ" in
2055         "!")
2056                 sh 1>&4
2057                 echo " "
2058                 $myecho
2059                 ;;
2060         !*)
2061                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2062                 shift
2063                 sh 1>&4 -c "\$*"
2064                 echo " "
2065                 $myecho
2066                 ;;
2067         "\$ans")
2068                 case "\$ans" in
2069                 \\&*)
2070                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2071                         shift
2072                         case "\$1" in
2073                         -d)
2074                                 fastread=yes
2075                                 echo "(OK, I'll run with -d after this question.)" >&4
2076                                 ;;
2077                         -*)
2078                                 echo "*** Sorry, \$1 not supported yet." >&4
2079                                 ;;
2080                         esac
2081                         $myecho
2082                         ans=!
2083                         ;;
2084                 esac;;
2085         *)
2086                 case "\$aok" in
2087                 y)
2088                         echo "*** Substitution done -- please confirm."
2089                         xxxm="\$ans"
2090                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2091                         xxxm="\$ans"
2092                         ans=!
2093                         ;;
2094                 *)
2095                         echo "*** Error -- try again."
2096                         ans=!
2097                         ;;
2098                 esac
2099                 $myecho
2100                 ;;
2101         esac
2102         case "\$ans\$xxxm\$nostick" in
2103         '')
2104                 ans=!
2105                 $myecho
2106                 ;;
2107         esac
2108 done
2109 case "\$ans" in
2110 '') ans="\$xxxm";;
2111 esac
2112 EOSC
2113
2114 : create .config dir to save info across Configure sessions
2115 test -d ../.config || mkdir ../.config
2116 cat >../.config/README <<EOF
2117 This directory created by Configure to save information that should
2118 persist across sessions for $package.
2119
2120 You may safely delete it if you wish.
2121 EOF
2122
2123 : See if we are using a devel version and want that
2124 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2125 case "$usedevel" in
2126 $define|true|[yY]*) ;;
2127 *) case "$xversion" in
2128    *[13579])
2129         cat >&4 <<EOH
2130 *** WHOA THERE!!! ***
2131
2132     This is an UNSTABLE DEVELOPMENT release.
2133     The version of this $package distribution is $xversion, that is, odd,
2134     (as opposed to even) and that signifies a development release.
2135     If you want a maintenance release, you want an even-numbered version.
2136
2137     Do ***NOT*** install this into production use.
2138     Data corruption and crashes are possible.
2139
2140     It is most seriously suggested that you do not continue any further
2141     unless you want to help in developing and debugging Perl.
2142
2143     If you *still* want to build perl, you can answer 'y' now,
2144     or pass -Dusedevel to Configure.
2145
2146 EOH
2147         rp='Do you really want to continue?'
2148         dflt='n'
2149         . ./myread
2150         case "$ans" in
2151         [yY]) echo >&4 "Okay, continuing."
2152               usedevel="$define" ;;
2153         *) echo >&4 "Okay, bye."
2154            exit 1
2155            ;;
2156         esac
2157         ;;
2158     esac
2159     ;;
2160 esac
2161 case "$usedevel" in
2162 $define|true|[yY]*)
2163         case "$versiononly" in
2164         '') versiononly="$define" ;;
2165         esac
2166         case "$installusrbinperl" in
2167         '') installusrbinperl="$undef" ;;
2168         esac
2169         ;;
2170 esac
2171
2172 : general instructions
2173 needman=true
2174 firsttime=true
2175 user=`(logname) 2>/dev/null`
2176 case "$user" in
2177 '') user=`whoami 2>&1`;;
2178 esac
2179 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2180         firsttime=false
2181         echo " "
2182         rp='Would you like to see the instructions?'
2183         dflt=n
2184         . ./myread
2185         case "$ans" in
2186         [yY]*) ;;
2187         *) needman=false;;
2188         esac
2189 fi
2190 if $needman; then
2191         cat <<EOH
2192
2193 This installation shell script will examine your system and ask you questions
2194 to determine how the perl5 package should be installed. If you get
2195 stuck on a question, you may use a ! shell escape to start a subshell or
2196 execute a command.  Many of the questions will have default answers in square
2197 brackets; typing carriage return will give you the default.
2198
2199 On some of the questions which ask for file or directory names you are allowed
2200 to use the ~name construct to specify the login directory belonging to "name",
2201 even if you don't have a shell which knows about that.  Questions where this is
2202 allowed will be marked "(~name ok)".
2203
2204 EOH
2205         rp=''
2206         dflt='Type carriage return to continue'
2207         . ./myread
2208         cat <<'EOH'
2209
2210 The prompter used in this script allows you to use shell variables and
2211 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2212 in the default answer, as if the default line was a set of arguments given to a
2213 script shell.  This means you may also use $* to repeat the whole default line,
2214 so you do not have to re-type everything to add something to the default.
2215
2216 Everytime there is a substitution, you will have to confirm.  If there is an
2217 error (e.g. an unmatched backtick), the default answer will remain unchanged
2218 and you will be prompted again.
2219
2220 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2221 the questions and use the computed defaults (or the previous answers if there
2222 was already a config.sh file). Type 'Configure -h' for a list of options.
2223 You may also start interactively and then answer '& -d' at any prompt to turn
2224 on the non-interactive behaviour for the remainder of the execution.
2225
2226 EOH
2227         . ./myread
2228         cat <<EOH
2229
2230 Much effort has been expended to ensure that this shell script will run on any
2231 Unix system.  If despite that it blows up on yours, your best bet is to edit
2232 Configure and run it again.  If you can't run Configure for some reason,
2233 you'll have to generate a config.sh file by hand.  Whatever problems you
2234 have, let me (perlbug@perl.org) know how I blew it.
2235
2236 This installation script affects things in two ways:
2237
2238 1) it may do direct variable substitutions on some of the files included
2239    in this kit.
2240 2) it builds a config.h file for inclusion in C programs.  You may edit
2241    any of these files as the need arises after running this script.
2242
2243 If you make a mistake on a question, there is no easy way to back up to it
2244 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2245 files.  Configure will offer to let you do this before it runs the SH files.
2246
2247 EOH
2248         dflt='Type carriage return to continue'
2249         . ./myread
2250         case "$firsttime" in
2251         true) echo $user >>../.config/instruct;;
2252         esac
2253 fi
2254
2255 : find out where common programs are
2256 echo " "
2257 echo "Locating common programs..." >&4
2258 cat <<EOSC >loc
2259 $startsh
2260 case \$# in
2261 0) exit 1;;
2262 esac
2263 thing=\$1
2264 shift
2265 dflt=\$1
2266 shift
2267 for dir in \$*; do
2268         case "\$thing" in
2269         .)
2270         if test -d \$dir/\$thing; then
2271                 echo \$dir
2272                 exit 0
2273         fi
2274         ;;
2275         *)
2276         for thisthing in \$dir/\$thing; do
2277                 : just loop through to pick last item
2278         done
2279         if test -f \$thisthing; then
2280                 echo \$thisthing
2281                 exit 0
2282         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2283                 echo \$thisthing
2284                 exit 0
2285         elif test -f \$dir/\$thing.exe; then
2286                 if test -n "$DJGPP"; then
2287                         echo \$dir/\$thing.exe
2288                 elif test "$eunicefix" != ":"; then
2289                         : on Eunice apparently
2290                         echo \$dir/\$thing
2291                         exit 0
2292                 fi
2293                 exit 0
2294         fi
2295         ;;
2296         esac
2297 done
2298 echo \$dflt
2299 exit 1
2300 EOSC
2301 chmod +x loc
2302 $eunicefix loc
2303 loclist="
2304 awk
2305 cat
2306 chmod
2307 comm
2308 cp
2309 echo
2310 expr
2311 grep
2312 ls
2313 mkdir
2314 rm
2315 sed
2316 sort
2317 touch
2318 tr
2319 uniq
2320 "
2321 trylist="
2322 Mcc
2323 ar
2324 bison
2325 byacc
2326 cpp
2327 csh
2328 date
2329 egrep
2330 gmake
2331 gzip
2332 less
2333 ln
2334 make
2335 more
2336 nm
2337 nroff
2338 pg
2339 test
2340 uname
2341 zip
2342 "
2343 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2344 pth="$pth /lib /usr/lib"
2345 for file in $loclist; do
2346         eval xxx=\$$file
2347         case "$xxx" in
2348         /*|?:[\\/]*)
2349                 if test -f "$xxx"; then
2350                         : ok
2351                 else
2352                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2353                         xxx=`./loc $file $file $pth`
2354                 fi
2355                 ;;
2356         '') xxx=`./loc $file $file $pth`;;
2357         *) xxx=`./loc $xxx $xxx $pth`;;
2358         esac
2359         eval $file=$xxx$_exe
2360         eval _$file=$xxx
2361         case "$xxx" in
2362         /*)
2363                 echo $file is in $xxx.
2364                 ;;
2365         ?:[\\/]*)
2366                 echo $file is in $xxx.
2367                 ;;
2368         *)
2369                 echo "I don't know where '$file' is, and my life depends on it." >&4
2370                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2371                 exit 1
2372                 ;;
2373         esac
2374 done
2375 echo " "
2376 echo "Don't worry if any of the following aren't found..."
2377 say=offhand
2378 for file in $trylist; do
2379         eval xxx=\$$file
2380         case "$xxx" in
2381         /*|?:[\\/]*)
2382                 if test -f "$xxx"; then
2383                         : ok
2384                 else
2385                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2386                         xxx=`./loc $file $file $pth`
2387                 fi
2388                 ;;
2389         '') xxx=`./loc $file $file $pth`;;
2390         *) xxx=`./loc $xxx $xxx $pth`;;
2391         esac
2392         eval $file=$xxx$_exe
2393         eval _$file=$xxx
2394         case "$xxx" in
2395         /*)
2396                 echo $file is in $xxx.
2397                 ;;
2398         ?:[\\/]*)
2399                 echo $file is in $xxx.
2400                 ;;
2401         *)
2402                 echo "I don't see $file out there, $say."
2403                 say=either
2404                 ;;
2405         esac
2406 done
2407 case "$egrep" in
2408 egrep)
2409         echo "Substituting grep for egrep."
2410         egrep=$grep
2411         _egrep=$grep
2412         ;;
2413 esac
2414 case "$ln" in
2415 ln)
2416         echo "Substituting cp for ln."
2417         ln=$cp
2418         _ln=$cp
2419         ;;
2420 esac
2421 case "$make" in
2422 make)
2423         case "$gmake" in
2424         gmake)
2425         echo "I can't find make or gmake, and my life depends on it." >&4
2426         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2427         exit 1
2428         ;;
2429         esac
2430         ;;
2431 esac
2432 case "$gmake" in
2433 gmake)  ;;
2434 *)      # We can't have osname yet.
2435         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2436                 # Assume that gmake, if found, is definitely GNU make
2437                 # and prefer it over the system make.
2438                 echo "Substituting gmake for make."
2439                 make=$gmake
2440                 _make=$gmake
2441         fi
2442         ;;
2443 esac
2444 case "$test" in
2445 test)
2446         echo "Hopefully test is built into your sh."
2447         ;;
2448 *)
2449         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2450                 echo "Using the test built into your sh."
2451                 test=test
2452                 _test=test
2453         fi
2454         ;;
2455 esac
2456 case "$echo" in
2457 echo)
2458         echo "Hopefully echo is built into your sh."
2459         ;;
2460 '') ;;
2461 *)
2462         echo " "
2463 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2464         $echo $n "hi there$c" >foo1
2465         echo $n "hi there$c" >foo2
2466         if cmp foo1 foo2 >/dev/null 2>&1; then
2467                 echo "They are compatible.  In fact, they may be identical."
2468         else
2469                 case "$n" in
2470                 '-n') n='' c='\c';;
2471                 *) n='-n' c='';;
2472                 esac
2473                 cat <<FOO
2474 They are not compatible!  You are probably running ksh on a non-USG system.
2475 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2476 have echo built in and we may have to run some Bourne shell scripts.  That
2477 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2478
2479 FOO
2480                 $echo $n "The star should be here-->$c"
2481                 $echo "*"
2482         fi
2483         $rm -f foo1 foo2
2484         ;;
2485 esac
2486
2487 # This question was auctioned at YAPC::Europe-2007 in Vienna
2488 # I never promised you could answer it. I only auctioned the question.
2489 cat <<FOO
2490 The following message is sponsored by
2491
2492   Dresden.pm<--The stars should be here.
2493
2494 Dear Perl user, system administrator or package
2495 maintainer, the Perl community sends greetings to
2496 you. Do you (emblematical) greet back [Y/n]? n
2497
2498 FOO
2499
2500 : Check what type of C compiler we use
2501 cat <<EOS >trygcc
2502 $startsh
2503 EOS
2504 cat <<'EOSC' >>trygcc
2505 case "$cc" in
2506 '') ;;
2507 *)  $rm -f try try.*
2508     $cat >try.c <<EOM
2509 int main(int argc, char *argv[]) {
2510   return 0;
2511 }
2512 EOM
2513     if $cc -o try $ccflags $ldflags try.c; then
2514        :
2515     else
2516         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2517         despair=yes
2518         trygcc=yes
2519         case "$cc" in
2520         *gcc*) trygcc=no ;;
2521         esac
2522         # Skip this test because it gives a false match on output like:
2523         #    ./trygcc: line 23: cc: command not found
2524         # case "`$cc -v -c try.c 2>&1`" in
2525         # *gcc*) trygcc=no ;;
2526         # esac
2527         if $test X"$trygcc" = Xyes; then
2528             if gcc -o try -c try.c; then
2529                 echo " "
2530                 echo "You seem to have a working gcc, though." >&4
2531                 # Switching compilers may undo the work of hints files.
2532                 # The most common problem is -D_REENTRANT for threads.
2533                 # This heuristic catches that case, but gets false positives
2534                 # if -Dusethreads was not actually specified.  Better to
2535                 # bail out here with a useful message than fail 
2536                 # mysteriously later. Should we perhaps just try to
2537                 # re-invoke Configure -Dcc=gcc config_args ?
2538                 if $test -f usethreads.cbu; then
2539                         $cat >&4 <<EOM 
2540
2541 *** However, any setting of the C compiler flags (e.g. for thread support)
2542 *** will be lost.  It may be necessary for you to restart Configure and
2543 *** add -Dcc=gcc to your Configure command line.
2544
2545 EOM
2546                         rp="Would you like to go ahead and try gcc anyway?"
2547                         dflt=n
2548                 else
2549                         rp="Would you like to use it?"
2550                         dflt=y
2551                 fi
2552                 if $test -f myread; then
2553                     . ./myread
2554                 else
2555                     if $test -f UU/myread; then
2556                         . ./UU/myread
2557                     else
2558                         echo "Cannot find myread, sorry.  Aborting." >&2
2559                         exit 1
2560                     fi
2561                 fi  
2562                 case "$ans" in
2563                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2564                 esac
2565             fi
2566         fi
2567     fi
2568     $rm -f try try.*
2569     ;;
2570 esac
2571 EOSC
2572
2573 cat <<EOS >checkcc
2574 $startsh
2575 EOS
2576 cat <<'EOSC' >>checkcc
2577 case "$cc" in        
2578 '') ;;
2579 *)  $rm -f try try.*              
2580     $cat >try.c <<EOM
2581 int main(int argc, char *argv[]) {
2582   return 0;
2583 }
2584 EOM
2585     if $cc -o try $ccflags $ldflags try.c; then
2586        :
2587     else
2588         if $test X"$despair" = Xyes; then
2589            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2590         fi
2591         $cat >&4 <<EOM         
2592 You need to find a working C compiler.
2593 Either (purchase and) install the C compiler supplied by your OS vendor,
2594 or for a free C compiler try http://gcc.gnu.org/
2595 I cannot continue any further, aborting.
2596 EOM
2597         exit 1
2598     fi
2599     $rm -f try try.*
2600     ;;
2601 esac
2602 EOSC
2603
2604 : determine whether symbolic links are supported
2605 echo " "
2606 $touch blurfl
2607 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2608         echo "Symbolic links are supported." >&4
2609         lns="$ln -s"
2610 else
2611         echo "Symbolic links are NOT supported." >&4
2612         lns="$ln"
2613 fi
2614 $rm -f blurfl sym
2615
2616 : determine whether symbolic links are supported
2617 echo " "
2618 case "$lns" in
2619 *"ln"*" -s")
2620         echo "Checking how to test for symbolic links..." >&4
2621         $lns blurfl sym
2622         if $test "X$issymlink" = X; then
2623                 case "$newsh" in
2624                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2625                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2626                 esac
2627                 if test $? = 0; then
2628                         issymlink="test -h"
2629                 else
2630                         echo "Your builtin 'test -h' may be broken." >&4
2631                         case "$test" in
2632                         /*)     ;;
2633                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2634                                 for p in $pth
2635                                 do
2636                                         if test -f "$p/$test"; then
2637                                                 test="$p/$test"
2638                                                 break
2639                                         fi
2640                                 done
2641                                 ;;
2642                         esac
2643                         case "$test" in
2644                         /*)
2645                                 echo "Trying external '$test -h'." >&4
2646                                 issymlink="$test -h"
2647                                 if $test ! -h sym >/dev/null 2>&1; then
2648                                         echo "External '$test -h' is broken, too." >&4
2649                                         issymlink=''
2650                                 fi
2651                                 ;;
2652                         *)      issymlink='' ;;
2653                         esac
2654                 fi              
2655         fi
2656         if $test "X$issymlink" = X; then
2657                 if $test -L sym 2>/dev/null; then
2658                         issymlink="$test -L"
2659                         echo "The builtin '$test -L' worked." >&4
2660                 fi
2661         fi
2662         if $test "X$issymlink" != X; then
2663                 echo "You can test for symbolic links with '$issymlink'." >&4
2664         else
2665                 echo "I do not know how you can test for symbolic links." >&4
2666         fi
2667         $rm -f blurfl sym
2668         ;;
2669 *)      echo "No symbolic links, so not testing for their testing..." >&4
2670         ;;
2671 esac
2672 echo " "
2673
2674 : Make symlinks util
2675 case "$mksymlinks" in
2676 $define|true|[yY]*)
2677         case "$src" in
2678         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2679                 exit 1
2680                 ;;
2681         *)      case "$lns:$issymlink" in
2682                 *"ln"*" -s:"*"test -"?)
2683                         echo "Creating the symbolic links..." >&4
2684                         echo "(First creating the subdirectories...)" >&4
2685                         cd ..
2686                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2687                                 read directory
2688                                 test -z "$directory" && break
2689                                 mkdir -p $directory
2690                         done
2691                         # Sanity check 1.
2692                         if test ! -d t/base; then
2693                                 echo "Failed to create the subdirectories.  Aborting." >&4
2694                                 exit 1
2695                         fi
2696                         echo "(Then creating the symlinks...)" >&4
2697                         awk '{print $1}' $src/MANIFEST | while true; do
2698                                 read filename
2699                                 test -z "$filename" && break
2700                                 if test -f $filename; then
2701                                         if $issymlink $filename; then
2702                                                 rm -f $filename
2703                                         fi
2704                                 fi
2705                                 if test -f $filename; then
2706                                         echo "$filename already exists, not symlinking."
2707                                 else
2708                                         ln -s $src/$filename $filename
2709                                 fi
2710                         done
2711                         # Sanity check 2.
2712                         if test ! -f t/base/lex.t; then
2713                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2714                                 exit 1
2715                         fi
2716                         cd UU
2717                         ;;
2718                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2719                         ;;
2720                 esac
2721                 ;;
2722         esac
2723         ;;
2724 esac
2725
2726 : Check for Cross-Compilation
2727 case "$usecrosscompile" in
2728 $define|true|[yY]*)
2729         $echo "Cross-compiling..."
2730         croak=''
2731         case "$cc" in
2732         *-*-gcc) # A cross-compiling gcc, probably.
2733             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2734             ar=$targetarch-ar
2735             # leave out ld, choosing it is more complex
2736             nm=$targetarch-nm
2737             ranlib=$targetarch-ranlib
2738             $echo 'extern int foo;' > try.c
2739             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2740             shift
2741             if $test $# -gt 0; then
2742                 incpth="$incpth $*"
2743                 incpth="`$echo $incpth|$sed 's/^ //'`"
2744                 echo "Guessing incpth '$incpth'." >&4
2745                 for i in $*; do
2746                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2747                     if $test -d $j; then
2748                         libpth="$libpth $j"
2749                     fi
2750                 done   
2751                 libpth="`$echo $libpth|$sed 's/^ //'`"
2752                 echo "Guessing libpth '$libpth'." >&4
2753             fi
2754             $rm -f try.c
2755             ;;
2756         esac
2757         case "$targetarch" in
2758         '') echo "Targetarch not defined." >&4; croak=y ;;
2759         *)  echo "Using targetarch $targetarch." >&4 ;;
2760         esac
2761         case "$incpth" in
2762         '') echo "Incpth not defined." >&4; croak=y ;;
2763         *)  echo "Using incpth '$incpth'." >&4 ;;
2764         esac
2765         case "$libpth" in
2766         '') echo "Libpth not defined." >&4; croak=y ;;
2767         *)  echo "Using libpth '$libpth'." >&4 ;;
2768         esac
2769         case "$usrinc" in
2770         '') for i in $incpth; do
2771                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2772                     usrinc=$i
2773                     echo "Guessing usrinc $usrinc." >&4
2774                     break
2775                 fi
2776             done
2777             case "$usrinc" in
2778             '') echo "Usrinc not defined." >&4; croak=y ;;
2779             esac
2780             ;;
2781         *)  echo "Using usrinc $usrinc." >&4 ;;
2782         esac
2783         case "$targethost" in
2784         '') echo "Targethost not defined." >&4; croak=y ;;
2785         *)  echo "Using targethost $targethost." >&4
2786         esac
2787         locincpth=' '
2788         loclibpth=' '
2789         case "$croak" in
2790         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2791         esac
2792         case "$src" in
2793         /*) run=$src/Cross/run
2794             targetmkdir=$src/Cross/mkdir
2795             to=$src/Cross/to
2796             from=$src/Cross/from
2797             ;;
2798         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2799             run=$pwd/Cross/run
2800             targetmkdir=$pwd/Cross/mkdir
2801             to=$pwd/Cross/to
2802             from=$pwd/Cross/from
2803             ;;
2804         esac
2805         case "$targetrun" in
2806         '') targetrun=ssh ;;
2807         esac
2808         case "$targetto" in
2809         '') targetto=scp ;;
2810         esac
2811         case "$targetfrom" in
2812         '') targetfrom=scp ;;
2813         esac
2814         run=$run-$targetrun
2815         to=$to-$targetto
2816         from=$from-$targetfrom
2817         case "$targetdir" in
2818         '')  targetdir=/tmp
2819              echo "Guessing targetdir $targetdir." >&4
2820              ;;
2821         esac
2822         case "$targetuser" in
2823         '')  targetuser=root
2824              echo "Guessing targetuser $targetuser." >&4
2825              ;;
2826         esac
2827         case "$targetfrom" in
2828         scp)    q=-q ;;
2829         *)      q='' ;;
2830         esac
2831         case "$targetrun" in
2832         ssh|rsh)
2833             cat >$run <<EOF
2834 #!/bin/sh
2835 case "\$1" in
2836 -cwd)
2837   shift
2838   cwd=\$1
2839   shift
2840   ;;
2841 esac
2842 case "\$cwd" in
2843 '') cwd=$targetdir ;;
2844 esac
2845 exe=\$1
2846 shift
2847 if $test ! -f \$exe.xok; then
2848   $to \$exe
2849   $touch \$exe.xok
2850 fi
2851 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2852 EOF
2853             ;;
2854         *)  echo "Unknown targetrun '$targetrun'" >&4
2855             exit 1
2856             ;;
2857         esac
2858         case "$targetmkdir" in
2859         */Cross/mkdir)
2860             cat >$targetmkdir <<EOF
2861 #!/bin/sh
2862 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2863 EOF
2864             $chmod a+rx $targetmkdir
2865             ;;
2866         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2867             exit 1
2868             ;;
2869         esac
2870         case "$targetto" in
2871         scp|rcp)
2872             cat >$to <<EOF
2873 #!/bin/sh
2874 for f in \$@
2875 do
2876   case "\$f" in
2877   /*)
2878     $targetmkdir \`dirname \$f\`
2879     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2880     ;;
2881   *)
2882     $targetmkdir $targetdir/\`dirname \$f\`
2883     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2884     ;;
2885   esac
2886 done
2887 exit 0
2888 EOF
2889             ;;
2890         cp) cat >$to <<EOF
2891 #!/bin/sh
2892 for f in \$@
2893 do
2894   case "\$f" in
2895   /*)
2896     $mkdir -p $targetdir/\`dirname \$f\`
2897     $cp \$f $targetdir/\$f || exit 1
2898     ;;
2899   *)
2900     $targetmkdir $targetdir/\`dirname \$f\`
2901     $cp \$f $targetdir/\$f || exit 1
2902     ;;
2903   esac
2904 done
2905 exit 0
2906 EOF
2907             ;;
2908         *)  echo "Unknown targetto '$targetto'" >&4
2909             exit 1
2910             ;;
2911         esac
2912         case "$targetfrom" in
2913         scp|rcp)
2914           cat >$from <<EOF
2915 #!/bin/sh
2916 for f in \$@
2917 do
2918   $rm -f \$f
2919   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2920 done
2921 exit 0
2922 EOF
2923             ;;
2924         cp) cat >$from <<EOF
2925 #!/bin/sh
2926 for f in \$@
2927 do
2928   $rm -f \$f
2929   cp $targetdir/\$f . || exit 1
2930 done
2931 exit 0
2932 EOF
2933             ;;
2934         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2935             exit 1
2936             ;;
2937         esac
2938         if $test ! -f $run; then
2939             echo "Target 'run' script '$run' not found." >&4
2940         else
2941             $chmod a+rx $run
2942         fi
2943         if $test ! -f $to; then
2944             echo "Target 'to' script '$to' not found." >&4
2945         else
2946             $chmod a+rx $to
2947         fi
2948         if $test ! -f $from; then
2949             echo "Target 'from' script '$from' not found." >&4
2950         else
2951             $chmod a+rx $from
2952         fi
2953         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2954             exit 1
2955         fi
2956         cat >&4 <<EOF
2957 Using '$run' for remote execution,
2958 and '$from' and '$to'
2959 for remote file transfer.
2960 EOF
2961         ;;
2962 *)      run=''
2963         to=:
2964         from=:
2965         usecrosscompile='undef'
2966         targetarch=''
2967         ;;
2968 esac
2969
2970 : see whether [:lower:] and [:upper:] are supported character classes
2971 echo " "
2972 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2973 ABYZ)
2974         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2975         up='[:upper:]'
2976         low='[:lower:]'
2977         ;;
2978 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2979         # (0xd9 and 0xe2), therefore that is a nice testing point.
2980         if test "X$up" = X -o "X$low" = X; then
2981             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2982             rs) up='[A-Z]'
2983                 low='[a-z]'
2984                 ;;
2985             esac
2986         fi
2987         if test "X$up" = X -o "X$low" = X; then
2988             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2989             rs) up='A-Z'
2990                 low='a-z'
2991                 ;;
2992             esac
2993         fi
2994         if test "X$up" = X -o "X$low" = X; then
2995             case "`echo RS | od -x 2>/dev/null`" in
2996             *D9E2*|*d9e2*)
2997                 echo "Hey, this might be EBCDIC." >&4
2998                 if test "X$up" = X -o "X$low" = X; then
2999                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3000                     rs) up='[A-IJ-RS-Z]'
3001                         low='[a-ij-rs-z]'
3002                         ;;
3003                     esac
3004                 fi
3005                 if test "X$up" = X -o "X$low" = X; then
3006                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3007                     rs) up='A-IJ-RS-Z'
3008                         low='a-ij-rs-z'
3009                         ;;
3010                     esac
3011                 fi
3012                 ;;
3013             esac
3014         fi
3015 esac
3016 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3017 rs)
3018     echo "Using $up and $low to convert case." >&4
3019     ;;
3020 *)
3021     echo "I don't know how to translate letters from upper to lower case." >&4
3022     echo "Your tr is not acting any way I know of." >&4
3023     exit 1
3024     ;;
3025 esac
3026 : set up the translation script tr, must be called with ./tr of course
3027 cat >tr <<EOSC
3028 $startsh
3029 case "\$1\$2" in
3030 '[A-Z][a-z]') exec $tr '$up' '$low';;
3031 '[a-z][A-Z]') exec $tr '$low' '$up';;
3032 esac
3033 exec $tr "\$@"
3034 EOSC
3035 chmod +x tr
3036 $eunicefix tr
3037
3038 : Try to determine whether config.sh was made on this system
3039 case "$config_sh" in
3040 '')
3041 myuname=`$uname -a 2>/dev/null`
3042 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3043 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3044 # because the A-Z/a-z are not consecutive.
3045 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3046         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3047 newmyuname="$myuname"
3048 dflt=n
3049 case "$knowitall" in
3050 '')
3051         if test -f ../config.sh; then
3052                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3053                         eval "`grep myuname= ../config.sh`"
3054                 fi
3055                 if test "X$myuname" = "X$newmyuname"; then
3056                         dflt=y
3057                 fi
3058         fi
3059         ;;
3060 *) dflt=y;;
3061 esac
3062
3063 : Get old answers from old config file if Configure was run on the
3064 : same system, otherwise use the hints.
3065 hint=default
3066 cd ..
3067 if test -f config.sh; then
3068         echo " "
3069         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3070         . UU/myread
3071         case "$ans" in
3072         n*|N*) echo "OK, I'll ignore it."
3073                 mv config.sh config.sh.old
3074                 myuname="$newmyuname"
3075                 ;;
3076         *)  echo "Fetching default answers from your old config.sh file..." >&4
3077                 tmp_n="$n"
3078                 tmp_c="$c"
3079                 tmp_sh="$sh"
3080                 . ./config.sh
3081                 cp config.sh UU
3082                 n="$tmp_n"
3083                 c="$tmp_c"
3084                 : Older versions did not always set $sh.  Catch re-use of such
3085                 : an old config.sh.
3086                 case "$sh" in
3087                 '') sh="$tmp_sh" ;;
3088                 esac
3089                 hint=previous
3090                 ;;
3091         esac
3092 fi
3093 . ./UU/checkcc
3094 if test ! -f config.sh; then
3095         $cat <<EOM
3096
3097 First time through, eh?  I have some defaults handy for some systems
3098 that need some extra help getting the Configure answers right:
3099
3100 EOM
3101         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3102         dflt=''
3103         : Half the following guesses are probably wrong... If you have better
3104         : tests or hints, please send them to perlbug@perl.org
3105         : The metaconfig authors would also appreciate a copy...
3106         $test -f /irix && osname=irix
3107         $test -f /xenix && osname=sco_xenix
3108         $test -f /dynix && osname=dynix
3109         $test -f /dnix && osname=dnix
3110         $test -f /lynx.os && osname=lynxos
3111         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3112         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3113         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3114         $test -f /bin/mips && /bin/mips && osname=mips
3115         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3116                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3117         $test -d /usr/apollo/bin && osname=apollo
3118         $test -f /etc/saf/_sactab && osname=svr4
3119         $test -d /usr/include/minix && osname=minix
3120         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3121         if $test -d /MachTen -o -d /MachTen_Folder; then
3122                 osname=machten
3123                 if $test -x /sbin/version; then
3124                         osvers=`/sbin/version | $awk '{print $2}' |
3125                         $sed -e 's/[A-Za-z]$//'`
3126                 elif $test -x /usr/etc/version; then
3127                         osvers=`/usr/etc/version | $awk '{print $2}' |
3128                         $sed -e 's/[A-Za-z]$//'`
3129                 else
3130                         osvers="$2.$3"
3131                 fi
3132         fi
3133
3134         $test -f /sys/posix.dll &&
3135                 $test -f /usr/bin/what &&
3136                 set X `/usr/bin/what /sys/posix.dll` &&
3137                 $test "$3" = UWIN &&
3138                 osname=uwin &&
3139                 osvers="$5"
3140
3141         if $test -f $uname; then
3142                 set X $myuname
3143                 shift
3144
3145                 case "$5" in
3146                 fps*) osname=fps ;;
3147                 mips*)
3148                         case "$4" in
3149                         umips) osname=umips ;;
3150                         *) osname=mips ;;
3151                         esac;;
3152                 [23]100) osname=mips ;;
3153                 next*) osname=next ;;
3154                 i386*)
3155                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3156                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3157                                 osname='sco'
3158                                 osvers=$tmp
3159                         elif $test -f /etc/kconfig; then
3160                                 osname=isc
3161                                 if test "$lns" = "$ln -s"; then
3162                                         osvers=4
3163                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3164                                         osvers=3
3165                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3166                                         osvers=2
3167                                 fi
3168                         fi
3169                         tmp=''
3170                         ;;
3171                 pc*)
3172                         if test -n "$DJGPP"; then
3173                                 osname=dos
3174                                 osvers=djgpp
3175                         fi
3176                         ;;
3177                 esac
3178
3179                 case "$1" in
3180                 aix) osname=aix
3181                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3182                         case "$tmp" in
3183                         # oslevel can fail with:
3184                         # oslevel: Unable to acquire lock.
3185                         *not\ found) osvers="$4"."$3" ;;
3186                         '<3240'|'<>3240') osvers=3.2.0 ;;
3187                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3188                         '=3250'|'>3250') osvers=3.2.5 ;;
3189                         *) osvers=$tmp;;
3190                         esac
3191                         ;;
3192                 bsd386) osname=bsd386
3193                         osvers=`$uname -r`
3194                         ;;
3195                 cygwin*) osname=cygwin
3196                         osvers="$3"
3197                         ;;
3198                 *dc.osx) osname=dcosx
3199                         osvers="$3"
3200                         ;;
3201                 dnix) osname=dnix
3202                         osvers="$3"
3203                         ;;
3204                 domainos) osname=apollo
3205                         osvers="$3"
3206                         ;;
3207                 dgux)   osname=dgux
3208                         osvers="$3"
3209                         ;;
3210                 dragonfly) osname=dragonfly
3211                         osvers="$3"
3212                         ;;
3213                 dynixptx*) osname=dynixptx
3214                         osvers=`echo "$4"|sed 's/^v//'`
3215                         ;;
3216                 freebsd) osname=freebsd
3217                         osvers="$3" ;;
3218                 genix)  osname=genix ;;
3219                 gnu)    osname=gnu
3220                         osvers="$3" ;;
3221                 hp*)    osname=hpux
3222                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3223                         ;;
3224                 irix*)  osname=irix
3225                         case "$3" in
3226                         4*) osvers=4 ;;
3227                         5*) osvers=5 ;;
3228                         *)      osvers="$3" ;;
3229                         esac
3230                         ;;
3231                 linux)  osname=linux
3232                         case "$3" in
3233                         *)      osvers="$3" ;;
3234                         esac
3235                         ;;
3236                 MiNT)   osname=mint
3237                         ;;
3238                 netbsd*) osname=netbsd
3239                         osvers="$3"
3240                         ;;
3241                 news-os) osvers="$3"
3242                         case "$3" in
3243                         4*) osname=newsos4 ;;
3244                         *) osname=newsos ;;
3245                         esac
3246                         ;;
3247                 next*) osname=next ;;
3248                 nonstop-ux) osname=nonstopux ;;
3249                 openbsd) osname=openbsd
3250                         osvers="$3"
3251                         ;;
3252                 os2)    osname=os2
3253                         osvers="$4"
3254                         ;;
3255                 POSIX-BC | posix-bc ) osname=posix-bc
3256                         osvers="$3"
3257                         ;;
3258                 powerux | power_ux | powermax_os | powermaxos | \
3259                 powerunix | power_unix) osname=powerux
3260                         osvers="$3"
3261                         ;;
3262                 qnx) osname=qnx
3263                         osvers="$4"
3264                         ;;
3265                 solaris) osname=solaris
3266                         case "$3" in
3267                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3268                         *)      osvers="$3" ;;
3269                         esac
3270                         ;;
3271                 sunos) osname=sunos
3272                         case "$3" in
3273                         5*) osname=solaris
3274                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3275                         *)      osvers="$3" ;;
3276                         esac
3277                         ;;
3278                 titanos) osname=titanos
3279                         case "$3" in
3280                         1*) osvers=1 ;;
3281                         2*) osvers=2 ;;
3282                         3*) osvers=3 ;;
3283                         4*) osvers=4 ;;
3284                         *)      osvers="$3" ;;
3285                         esac
3286                         ;;
3287                 ultrix) osname=ultrix
3288                         osvers="$3"
3289                         ;;
3290                 osf1|mls+)      case "$5" in
3291                                 alpha)
3292                                         osname=dec_osf
3293                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3294                                         case "$osvers" in
3295                                         [1-9].[0-9]*) ;;
3296                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3297                                         esac
3298                                         ;;
3299                         hp*)    osname=hp_osf1  ;;
3300                         mips)   osname=mips_osf1 ;;
3301                         esac
3302                         ;;
3303                 # UnixWare 7.1.2 is known as Open UNIX 8
3304                 openunix|unixware) osname=svr5
3305                         osvers="$4"
3306                         ;;
3307                 uts)    osname=uts
3308                         osvers="$3"
3309                         ;;
3310                 vos) osvers="$3"
3311                         ;;
3312                 $2) case "$osname" in
3313                         *isc*) ;;
3314                         *freebsd*) ;;
3315                         svr*)
3316                                 : svr4.x or possibly later
3317                                 case "svr$3" in
3318                                 ${osname}*)
3319                                         osname=svr$3
3320                                         osvers=$4
3321                                         ;;
3322                                 esac
3323                                 case "$osname" in
3324                                 svr4.0)
3325                                         : Check for ESIX
3326                                         if test -f /stand/boot ; then
3327                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3328                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3329                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3330                                                         if test -n "$isesix"; then
3331                                                                 osname=esix4
3332                                                         fi
3333                                                 fi
3334                                         fi
3335                                         ;;
3336                                 esac
3337                                 ;;
3338                         *)      if test -f /etc/systemid; then
3339                                         osname=sco
3340                                         set `echo $3 | $sed 's/\./ /g'` $4
3341                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3342                                                 osvers=$1.$2.$3
3343                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3344                                                 osvers=$1.$2
3345                                         elif $test -f $src/hints/sco_$1.sh; then
3346                                                 osvers=$1
3347                                         fi
3348                                 else
3349                                         case "$osname" in
3350                                         '') : Still unknown.  Probably a generic Sys V.
3351                                                 osname="sysv"
3352                                                 osvers="$3"
3353                                                 ;;
3354                                         esac
3355                                 fi
3356                                 ;;
3357                         esac
3358                         ;;
3359                 *)      case "$osname" in
3360                         '') : Still unknown.  Probably a generic BSD.
3361                                 osname="$1"
3362                                 osvers="$3"
3363                                 ;;
3364                         esac
3365                         ;;
3366                 esac
3367         else
3368                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3369                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3370                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3371                                 osname=news_os
3372                         fi
3373                         $rm -f UU/kernel.what
3374                 elif test -d c:/. -o -n "$is_os2" ; then
3375                         set X $myuname
3376                         osname=os2
3377                         osvers="$5"
3378                 fi
3379         fi
3380
3381         case "$targetarch" in
3382         '') ;;
3383         *)  hostarch=$osname
3384             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3385             osvers=''
3386             ;;
3387         esac
3388
3389         : Now look for a hint file osname_osvers, unless one has been
3390         : specified already.
3391         case "$hintfile" in
3392         ''|' ')
3393                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3394                 : Also try without trailing minor version numbers.
3395                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3396                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3397                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3398                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3399                 case "$file" in
3400                 '') dflt=none ;;
3401                 *)  case "$osvers" in
3402                         '') dflt=$file
3403                                 ;;
3404                         *)  if $test -f $src/hints/$file.sh ; then
3405                                         dflt=$file
3406                                 elif $test -f $src/hints/$xfile.sh ; then
3407                                         dflt=$xfile
3408                                 elif $test -f $src/hints/$xxfile.sh ; then
3409                                         dflt=$xxfile
3410                                 elif $test -f $src/hints/$xxxfile.sh ; then
3411                                         dflt=$xxxfile
3412                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3413                                         dflt=$xxxxfile
3414                                 elif $test -f "$src/hints/${osname}.sh" ; then
3415                                         dflt="${osname}"
3416                                 else
3417                                         dflt=none
3418                                 fi
3419                                 ;;
3420                         esac
3421                         ;;
3422                 esac
3423                 if $test -f Policy.sh ; then
3424                         case "$dflt" in
3425                         *Policy*) ;;
3426                         none) dflt="Policy" ;;
3427                         *) dflt="Policy $dflt" ;;
3428                         esac
3429                 fi
3430                 ;;
3431         *)
3432                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3433                 ;;
3434         esac
3435
3436         if $test -f Policy.sh ; then
3437                 $cat <<EOM
3438
3439 There's also a Policy hint file available, which should make the
3440 site-specific (policy) questions easier to answer.
3441 EOM
3442
3443         fi
3444
3445         $cat <<EOM
3446
3447 You may give one or more space-separated answers, or "none" if appropriate.
3448 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3449 previous run of Configure, you may specify it as well as or instead of
3450 OS-specific hints.  If hints are provided for your OS, you should use them:
3451 although Perl can probably be built without hints on many platforms, using
3452 hints often improve performance and may enable features that Configure can't
3453 set up on its own. If there are no hints that match your OS, specify "none";
3454 DO NOT give a wrong version or a wrong OS.
3455
3456 EOM
3457
3458         rp="Which of these apply, if any?"
3459         . UU/myread
3460         tans=$ans
3461         for file in $tans; do
3462                 if $test X$file = XPolicy -a -f Policy.sh; then
3463                         . Policy.sh
3464                         $cat Policy.sh >> UU/config.sh
3465                 elif $test -f $src/hints/$file.sh; then
3466                         . $src/hints/$file.sh
3467                         $cat $src/hints/$file.sh >> UU/config.sh
3468                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3469                         : nothing
3470                 else
3471                         : Give one chance to correct a possible typo.
3472                         echo "$file.sh does not exist"
3473                         dflt=$file
3474                         rp="hint to use instead?"
3475                         . UU/myread
3476                         for file in $ans; do
3477                                 if $test -f "$src/hints/$file.sh"; then
3478                                         . $src/hints/$file.sh
3479                                         $cat $src/hints/$file.sh >> UU/config.sh
3480                                 elif $test X$ans = X -o X$ans = Xnone ; then
3481                                         : nothing
3482                                 else
3483                                         echo "$file.sh does not exist -- ignored."
3484                                 fi
3485                         done
3486                 fi
3487         done
3488
3489         hint=recommended
3490         : Remember our hint file for later.
3491         if $test -f "$src/hints/$file.sh" ; then
3492                 hintfile="$file"
3493         else
3494                 hintfile=''
3495         fi
3496 fi
3497 cd UU
3498 ;;
3499 *)
3500         echo " "
3501         echo "Fetching default answers from $config_sh..." >&4
3502         tmp_n="$n"
3503         tmp_c="$c"
3504         cd ..
3505         cp $config_sh config.sh 2>/dev/null
3506         chmod +w config.sh
3507         . ./config.sh
3508         cd UU
3509         cp ../config.sh .
3510         n="$tmp_n"
3511         c="$tmp_c"
3512         hint=previous
3513         ;;
3514 esac
3515 test "$override" && . ./optdef.sh
3516
3517 : Restore computed paths
3518 for file in $loclist $trylist; do
3519         eval $file="\$_$file"
3520 done
3521
3522 cat << EOM
3523
3524 Configure uses the operating system name and version to set some defaults.
3525 The default value is probably right if the name rings a bell. Otherwise,
3526 since spelling matters for me, either accept the default or answer "none"
3527 to leave it blank.
3528
3529 EOM
3530 case "$osname" in
3531         ''|' ')
3532                 case "$hintfile" in
3533                 ''|' '|none) dflt=none ;;
3534                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3535                 esac
3536                 ;;
3537         *) dflt="$osname" ;;
3538 esac
3539 rp="Operating system name?"
3540 . ./myread
3541 case "$ans" in
3542 none)  osname='' ;;
3543 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3544 esac
3545 echo " "
3546 case "$osvers" in
3547         ''|' ')
3548                 case "$hintfile" in
3549                 ''|' '|none) dflt=none ;;
3550                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3551                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3552                         case "$dflt" in
3553                         ''|' ') dflt=none ;;
3554                         esac
3555                         ;;
3556                 esac
3557                 ;;
3558         *) dflt="$osvers" ;;
3559 esac
3560 rp="Operating system version?"
3561 . ./myread
3562 case "$ans" in
3563 none)  osvers='' ;;
3564 *) osvers="$ans" ;;
3565 esac
3566
3567
3568 . ./posthint.sh
3569
3570 : who configured the system
3571 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3572 case "$cf_by" in
3573 "")
3574         cf_by=`(logname) 2>/dev/null`
3575         case "$cf_by" in
3576         "")
3577                 cf_by=`(whoami) 2>/dev/null`
3578                 case "$cf_by" in
3579                 "") cf_by=unknown ;;
3580                 esac ;;
3581         esac ;;
3582 esac
3583
3584 : decide how portable to be.  Allow command line overrides.
3585 case "$d_portable" in
3586 "$undef") ;;
3587 *)      d_portable="$define" ;;
3588 esac
3589
3590 : set up shell script to do ~ expansion
3591 cat >filexp <<EOSS
3592 $startsh
3593 : expand filename
3594 case "\$1" in
3595  ~/*|~)
3596         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3597         ;;
3598  ~*)
3599         if $test -f /bin/csh; then
3600                 /bin/csh -f -c "glob \$1"
3601                 failed=\$?
3602                 echo ""
3603                 exit \$failed
3604         else
3605                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3606                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3607                 if $test ! -d "\$dir"; then
3608                         me=\`basename \$0\`
3609                         echo "\$me: can't locate home directory for: \$name" >&2
3610                         exit 1
3611                 fi
3612                 case "\$1" in
3613                 */*)
3614                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3615                         ;;
3616                 *)
3617                         echo \$dir
3618                         ;;
3619                 esac
3620         fi
3621         ;;
3622 *)
3623         echo \$1
3624         ;;
3625 esac
3626 EOSS
3627 chmod +x filexp
3628 $eunicefix filexp
3629
3630 : now set up to get a file name
3631 cat <<EOS >getfile
3632 $startsh
3633 EOS
3634 cat <<'EOSC' >>getfile
3635 tilde=''
3636 fullpath=''
3637 already=''
3638 skip=''
3639 none_ok=''
3640 exp_file=''
3641 nopath_ok=''
3642 orig_rp="$rp"
3643 orig_dflt="$dflt"
3644 case "$gfpth" in
3645 '') gfpth='.' ;;
3646 esac
3647
3648 case "$fn" in
3649 *\(*)
3650         : getfile will accept an answer from the comma-separated list
3651         : enclosed in parentheses even if it does not meet other criteria.
3652         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3653         fn=`echo $fn | sed 's/(.*)//'`
3654         ;;
3655 esac
3656
3657 case "$fn" in
3658 *:*)
3659         loc_file=`expr $fn : '.*:\(.*\)'`
3660         fn=`expr $fn : '\(.*\):.*'`
3661         ;;
3662 esac
3663
3664 case "$fn" in
3665 *~*) tilde=true;;
3666 esac
3667 case "$fn" in
3668 */*) fullpath=true;;
3669 esac
3670 case "$fn" in
3671 *+*) skip=true;;
3672 esac
3673 case "$fn" in
3674 *n*) none_ok=true;;
3675 esac
3676 case "$fn" in
3677 *e*) exp_file=true;;
3678 esac
3679 case "$fn" in
3680 *p*) nopath_ok=true;;
3681 esac
3682
3683 case "$fn" in
3684 *f*) type='File';;
3685 *d*) type='Directory';;
3686 *l*) type='Locate';;
3687 esac
3688
3689 what="$type"
3690 case "$what" in
3691 Locate) what='File';;
3692 esac
3693
3694 case "$exp_file" in
3695 '')
3696         case "$d_portable" in
3697         "$define") ;;
3698         *) exp_file=true;;
3699         esac
3700         ;;
3701 esac
3702
3703 cd ..
3704 while test "$type"; do
3705         redo=''
3706         rp="$orig_rp"
3707         dflt="$orig_dflt"
3708         case "$tilde" in
3709         true) rp="$rp (~name ok)";;
3710         esac
3711         . UU/myread
3712         if test -f UU/getfile.ok && \
3713                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3714         then
3715                 value="$ans"
3716                 ansexp="$ans"
3717                 break
3718         fi
3719         case "$ans" in
3720         none)
3721                 value=''
3722                 ansexp=''
3723                 case "$none_ok" in
3724                 true) type='';;
3725                 esac
3726                 ;;
3727         *)
3728                 case "$tilde" in
3729                 '') value="$ans"
3730                         ansexp="$ans";;
3731                 *)
3732                         value=`UU/filexp $ans`
3733                         case $? in
3734                         0)
3735                                 if test "$ans" != "$value"; then
3736                                         echo "(That expands to $value on this system.)"
3737                                 fi
3738                                 ;;
3739                         *) value="$ans";;
3740                         esac
3741                         ansexp="$value"
3742                         case "$exp_file" in
3743                         '') value="$ans";;
3744                         esac
3745                         ;;
3746                 esac
3747                 case "$fullpath" in
3748                 true)
3749                         case "$ansexp" in
3750                         /*) value="$ansexp" ;;
3751                         [a-zA-Z]:/*) value="$ansexp" ;;
3752                         *)
3753                                 redo=true
3754                                 case "$already" in
3755                                 true)
3756                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3757                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3758                                         ;;
3759                                 *)
3760                                 echo "Please give a full path name, starting with slash." >&4
3761                                         case "$tilde" in
3762                                         true)
3763                                 echo "Note that using ~name is ok provided it expands well." >&4
3764                                                 already=true
3765                                                 ;;
3766                                         esac
3767                                 esac
3768                                 ;;
3769                         esac
3770                         ;;
3771                 esac
3772                 case "$redo" in
3773                 '')
3774                         case "$type" in
3775                         File)
3776                                 for fp in $gfpth; do
3777                                         if test "X$fp" = X.; then
3778                                             pf="$ansexp"
3779                                         else    
3780                                             pf="$fp/$ansexp"
3781                                         fi
3782                                         if test -f "$pf"; then
3783                                                 type=''
3784                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3785                                         then
3786                                                 echo "($value is not a plain file, but that's ok.)"
3787                                                 type=''
3788                                         fi
3789                                         if test X"$type" = X; then
3790                                             value="$pf"
3791                                             break
3792                                         fi
3793                                 done
3794                                 ;;
3795                         Directory)
3796                                 for fp in $gfpth; do
3797                                         if test "X$fp" = X.; then
3798                                             dir="$ans"
3799                                             direxp="$ansexp"
3800                                         else    
3801                                             dir="$fp/$ansexp"
3802                                             direxp="$fp/$ansexp"
3803                                         fi
3804                                         if test -d "$direxp"; then
3805                                                 type=''
3806                                                 value="$dir"
3807                                                 break
3808                                         fi
3809                                 done
3810                                 ;;
3811                         Locate)
3812                                 if test -d "$ansexp"; then
3813                                         echo "(Looking for $loc_file in directory $value.)"
3814                                         value="$value/$loc_file"
3815                                         ansexp="$ansexp/$loc_file"
3816                                 fi
3817                                 if test -f "$ansexp"; then
3818                                         type=''
3819                                 fi
3820                                 case "$nopath_ok" in
3821                                 true)   case "$value" in
3822                                         */*) ;;
3823                                         *)      echo "Assuming $value will be in people's path."
3824                                                 type=''
3825                                                 ;;
3826                                         esac
3827                                         ;;
3828                                 esac
3829                                 ;;
3830                         esac
3831
3832                         case "$skip" in
3833                         true) type='';
3834                         esac
3835
3836                         case "$type" in
3837                         '') ;;
3838                         *)
3839                                 if test "$fastread" = yes; then
3840                                         dflt=y
3841                                 else
3842                                         dflt=n
3843                                 fi
3844                                 rp="$what $value doesn't exist.  Use that name anyway?"
3845                                 . UU/myread
3846                                 dflt=''
3847                                 case "$ans" in
3848                                 y*) type='';;
3849                                 *) echo " ";;
3850                                 esac
3851                                 ;;
3852                         esac
3853                         ;;
3854                 esac
3855                 ;;
3856         esac
3857 done
3858 cd UU
3859 ans="$value"
3860 rp="$orig_rp"
3861 dflt="$orig_dflt"
3862 rm -f getfile.ok
3863 test "X$gfpthkeep" != Xy && gfpth=""
3864 EOSC
3865
3866 : determine root of directory hierarchy where package will be installed.
3867 case "$prefix" in
3868 '')
3869         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3870         ;;
3871 *?/)
3872         dflt=`echo "$prefix" | sed 's/.$//'`
3873         ;;
3874 *)
3875         dflt="$prefix"
3876         ;;
3877 esac
3878 $cat <<EOM
3879
3880 By default, $package will be installed in $dflt/bin, manual pages
3881 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3882 installation directories. Typically this is something like /usr/local.
3883 If you wish to have binaries under /usr/bin but other parts of the
3884 installation under /usr/local, that's ok: you will be prompted
3885 separately for each of the installation directories, the prefix being
3886 only used to set the defaults.
3887
3888 EOM
3889 fn=d~
3890 rp='Installation prefix to use?'
3891 . ./getfile
3892 oldprefix=''
3893 case "$prefix" in
3894 '') ;;
3895 *)
3896         case "$ans" in
3897         "$prefix") ;;
3898         *) oldprefix="$prefix";;
3899         esac
3900         ;;
3901 esac
3902 prefix="$ans"
3903 prefixexp="$ansexp"
3904
3905 : is AFS running?
3906 case "$afsroot" in
3907 '')     afsroot=/afs ;;
3908 *)      afsroot=$afsroot ;;
3909 esac
3910
3911 echo " "
3912 case "$afs" in
3913 $define|true)   afs=true ;;
3914 $undef|false)   afs=false ;;
3915 *)      if test -d $afsroot; then
3916                 afs=true
3917         else
3918                 afs=false
3919         fi
3920         ;;
3921 esac
3922 if $afs; then
3923         echo "AFS may be running... I'll be extra cautious then..." >&4
3924 else
3925         echo "AFS does not seem to be running..." >&4
3926 fi
3927
3928 : determine installation prefix for where package is to be installed.
3929 if $afs; then 
3930 $cat <<EOM
3931
3932 Since you are running AFS, I need to distinguish the directory in which
3933 files will reside from the directory in which they are installed (and from
3934 which they are presumably copied to the former directory by occult means).
3935
3936 EOM
3937         case "$installprefix" in
3938         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3939         *) dflt="$installprefix";;
3940         esac
3941 else
3942 $cat <<EOM
3943
3944 In some special cases, particularly when building $package for distribution,
3945 it is convenient to distinguish the directory in which files should be
3946 installed from the directory ($prefix) in which they will
3947 eventually reside.  For most users, these two directories are the same.
3948
3949 EOM
3950         case "$installprefix" in
3951         '') dflt=$prefix ;;
3952         *) dflt=$installprefix;;
3953         esac
3954 fi
3955 fn=d~
3956 rp='What installation prefix should I use for installing files?'
3957 . ./getfile
3958 installprefix="$ans"
3959 installprefixexp="$ansexp"
3960
3961 : Perform the prefixexp/installprefixexp correction if necessary
3962 cat <<EOS >installprefix
3963 $startsh
3964 EOS
3965 cat <<'EOSC' >>installprefix
3966 : Change installation prefix, if necessary.
3967 if $test X"$prefix" != X"$installprefix"; then
3968     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3969 else
3970     eval "install${prefixvar}=\"\$${prefixvar}exp\""
3971 fi
3972 EOSC
3973 chmod +x installprefix
3974 $eunicefix installprefix
3975
3976 : Set variables such as privlib and privlibexp from the output of ./getfile
3977 : performing the prefixexp/installprefixexp correction if necessary.
3978 cat <<EOS >setprefixvar
3979 $startsh
3980 EOS
3981 cat <<'EOSC' >>setprefixvar
3982 eval "${prefixvar}=\"\$ans\""
3983 eval "${prefixvar}exp=\"\$ansexp\""
3984 . ./installprefix
3985 EOSC
3986 chmod +x setprefixvar
3987 $eunicefix setprefixvar
3988
3989 : set up the script used to warn in case of inconsistency
3990 cat <<EOS >whoa
3991 $startsh
3992 EOS
3993 cat <<'EOSC' >>whoa
3994 dflt=y
3995 case "$hint" in
3996     recommended)
3997         case "$hintfile" in
3998         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
3999                 ;;
4000         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4001                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4002                 ;;
4003         esac
4004         ;;
4005     *)  echo " "
4006         echo "*** WHOA THERE!!! ***" >&4
4007         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4008         ;;
4009 esac
4010 rp="    Keep the $hint value?"
4011 . ./myread
4012 case "$ans" in
4013 y) td=$was; tu=$was;;
4014 esac
4015 EOSC
4016
4017 : function used to set $1 to $val
4018 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4019 case "$val$was" in
4020 $define$undef) . ./whoa; eval "$var=\$td";;
4021 $undef$define) . ./whoa; eval "$var=\$tu";;
4022 *) eval "$var=$val";;
4023 esac'
4024
4025 : Check is we will use socks
4026 case "$usesocks" in
4027 $define|true|[yY]*)     dflt='y';;
4028 *) dflt='n';;
4029 esac
4030 cat <<EOM
4031
4032 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4033 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4034 to use the PerlIO abstraction layer, this will be implicitly selected.
4035
4036 If this doesn't make any sense to you, just accept the default '$dflt'.
4037 EOM
4038 rp='Build Perl for SOCKS?'
4039 . ./myread
4040 case "$ans" in
4041 y|Y)    val="$define" ;;
4042 *)      val="$undef" ;;
4043 esac
4044 set usesocks
4045 eval $setvar
4046
4047 case "$usesocks" in
4048 $define|true|[yY]*) useperlio="$define";;
4049 esac
4050
4051 : Check if we want perlio
4052 case "$useperlio" in
4053 $define|true|[yY]*|'')  dflt='y';;
4054 *) dflt='n';;
4055 esac
4056 cat <<EOM
4057
4058 Previous version of $package used the standard IO mechanisms as
4059 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4060 alternate IO mechanisms via the PerlIO abstraction layer, but the
4061 stdio mechanism is still available if needed.  The abstraction layer
4062 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4063 Using PerlIO with sfio may cause problems with some extension modules.
4064
4065 If this doesn't make any sense to you, just accept the default '$dflt'.
4066 EOM
4067 rp='Use the PerlIO abstraction layer?'
4068 . ./myread
4069 case "$ans" in
4070 y|Y)
4071         val="$define"
4072         ;;
4073 *)
4074         echo "Ok, doing things the stdio way."
4075         val="$undef"
4076         ;;
4077 esac
4078 set useperlio
4079 eval $setvar
4080
4081 case "$usesocks" in
4082 $define|true|[yY]*)
4083         case "$useperlio" in
4084         $define|true|[yY]*) ;;
4085         *)      cat >&4 <<EOM
4086
4087 You are using the SOCKS proxy protocol library which means that you
4088 should also use the PerlIO layer.  You may be headed for trouble.
4089
4090 EOM
4091                 ;;
4092         esac
4093         ;;
4094 esac
4095
4096 : get the patchlevel
4097 echo " "
4098 echo "Getting the current patchlevel..." >&4
4099 if $test -r $rsrc/patchlevel.h;then
4100         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4101         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4102         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4103         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4104         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4105         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4106         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4107 else
4108         revision=0
4109         patchlevel=0
4110         subversion=0
4111         api_revision=0
4112         api_version=0
4113         api_subversion=0
4114         perl_patchlevel=0
4115         $echo "(You do not have patchlevel.h.  Eek.)"
4116 fi
4117 if $test -r $rsrc/.patch ; then
4118         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4119                 perl_patchlevel=`cat $rsrc/.patch`
4120         fi
4121 fi
4122 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4123 version_patchlevel_string="version $patchlevel subversion $subversion"
4124 case "$perl_patchlevel" in
4125 0|'') ;;
4126 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
4127 esac
4128
4129 $echo "(You have $package $version_patchlevel_string.)"
4130
4131 case "$osname" in
4132 dos|vms)
4133         : XXX Should be a Configure test for double-dots in filenames.
4134         version=`echo $revision $patchlevel $subversion | \
4135                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4136         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4137                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4138         ;;
4139 *)
4140         version=`echo $revision $patchlevel $subversion | \
4141                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4142         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4143                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4144         ;;
4145 esac
4146 : Special case the 5.005_xx maintenance series, which used 5.005
4147 : without any subversion label as a subdirectory in $sitelib
4148 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4149         api_versionstring='5.005'
4150 fi
4151
4152 : Do we want threads support and if so, what type
4153 case "$usethreads" in
4154 $define|true|[yY]*)     dflt='y';;
4155 *)     # Catch case where user specified ithreads or 5005threads but
4156        # forgot -Dusethreads (A.D. 4/2002)
4157        case "$useithreads$use5005threads" in
4158        *$define*)
4159                 case "$useperlio" in
4160                 "$define")      dflt='y' ;;
4161                 *)              dflt='n' ;;
4162                 esac
4163                 ;;
4164        *)       dflt='n';;
4165        esac
4166        ;;
4167 esac
4168 cat <<EOM
4169
4170 Perl can be built to take advantage of threads on some systems.
4171 To do so, Configure can be run with -Dusethreads.
4172
4173 Note that Perl built with threading support runs slightly slower
4174 and uses more memory than plain Perl. The current implementation
4175 is believed to be stable, but it is fairly new, and so should be
4176 treated with caution.
4177
4178 If this doesn't make any sense to you, just accept the default '$dflt'.
4179 EOM
4180 rp='Build a threading Perl?'
4181 . ./myread
4182 case "$ans" in
4183 y|Y)    val="$define" ;;
4184 *)      val="$undef" ;;
4185 esac
4186 set usethreads
4187 eval $setvar
4188
4189 if $test $patchlevel -lt 9; then
4190     case "$usethreads" in
4191     $define)
4192         $cat <<EOM
4193
4194 Since release 5.6, Perl has had two different threading implementations,
4195 the newer interpreter-based version (ithreads) with one interpreter per
4196 thread, and the older 5.005 version (5005threads).
4197 The 5005threads version is effectively unmaintained and will probably be
4198 removed in Perl 5.10, so there should be no need to build a Perl using it
4199 unless needed for backwards compatibility with some existing 5.005threads
4200 code.
4201
4202 EOM
4203         : Default to ithreads unless overridden on command line or with
4204         : old config.sh
4205         dflt='y'
4206         case "$use5005threads" in
4207                 $define|true|[yY]*) dflt='n';;
4208         esac
4209         case "$useithreads" in
4210                 $undef|false|[nN]*) dflt='n';;
4211         esac
4212         rp='Use the newer interpreter-based ithreads?'
4213         . ./myread
4214         case "$ans" in
4215         y|Y)    val="$define" ;;
4216         *)      val="$undef" ;;
4217         esac
4218         set useithreads
4219         eval $setvar
4220         : Now set use5005threads to the opposite value.
4221         case "$useithreads" in
4222         $define) val="$undef" ;;
4223         *) val="$define" ;;
4224         esac
4225         set use5005threads
4226         eval $setvar
4227         ;;
4228     *)
4229         useithreads="$undef"
4230         use5005threads="$undef"
4231         ;;
4232     esac
4233
4234     case "$useithreads$use5005threads" in
4235     "$define$define")
4236         $cat >&4 <<EOM
4237
4238 You cannot have both the ithreads and the 5.005 threads enabled
4239 at the same time.  Disabling the 5.005 threads since they are
4240 much less stable than the ithreads.
4241
4242 EOM
4243         use5005threads="$undef"
4244         ;;
4245     esac
4246
4247 else
4248 : perl-5.9.x and later
4249
4250     if test X"$usethreads" = "X$define"; then
4251         case "$use5005threads" in
4252             $define|true|[yY]*)
4253                 $cat >&4 <<EOM
4254
4255 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4256
4257 EOM
4258             ;;
4259         esac
4260     fi
4261
4262     use5005threads="$undef"
4263     useithreads="$usethreads"
4264 fi
4265
4266 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4267         cat >&4 <<EOF
4268 ***
4269 *** To build with ithreads you must also use the PerlIO layer.
4270 *** Cannot continue, aborting.
4271 ***
4272 EOF
4273         exit 1
4274 fi
4275
4276 case "$d_oldpthreads" in
4277 '')     : Configure tests would be welcome here.  For now, assume undef.
4278         val="$undef" ;;
4279 *)      val="$d_oldpthreads" ;;
4280 esac
4281 set d_oldpthreads
4282 eval $setvar
4283
4284
4285 : Look for a hint-file generated 'call-back-unit'.  If the
4286 : user has specified that a threading perl is to be built,
4287 : we may need to set or change some other defaults.
4288 if $test -f usethreads.cbu; then
4289     echo "Your platform has some specific hints regarding threaded builds, using them..."
4290     . ./usethreads.cbu
4291 else
4292     case "$usethreads" in
4293         "$define"|true|[yY]*)
4294                 $cat <<EOM
4295 (Your platform does not have any specific hints for threaded builds.
4296  Assuming POSIX threads, then.)
4297 EOM
4298         ;;
4299     esac
4300 fi
4301
4302 : Check if multiplicity is required
4303 cat <<EOM
4304
4305 Perl can be built so that multiple Perl interpreters can coexist
4306 within the same Perl executable.
4307 EOM
4308
4309 case "$useithreads" in
4310 $define)
4311         cat <<EOM
4312 This multiple interpreter support is required for interpreter-based threads.
4313 EOM
4314         val="$define"
4315         ;;
4316 *)      case "$usemultiplicity" in
4317         $define|true|[yY]*)     dflt='y';;
4318         *) dflt='n';;
4319         esac
4320         echo " "
4321         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4322         rp='Build Perl for multiplicity?'
4323         . ./myread
4324         case "$ans" in
4325         y|Y)    val="$define" ;;
4326         *)      val="$undef" ;;
4327         esac
4328         ;;
4329 esac
4330 set usemultiplicity
4331 eval $setvar
4332
4333 : Check if morebits is requested
4334 case "$usemorebits" in
4335 "$define"|true|[yY]*)
4336         use64bitint="$define"
4337         uselongdouble="$define"
4338         usemorebits="$define"
4339         ;;
4340 *)      usemorebits="$undef"
4341         ;;
4342 esac
4343
4344 : make some quick guesses about what we are up against
4345 echo " "
4346 $echo $n "Hmm...  $c"
4347 echo exit 1 >bsd
4348 echo exit 1 >usg
4349 echo exit 1 >v7
4350 echo exit 1 >osf1
4351 echo exit 1 >eunice
4352 echo exit 1 >xenix
4353 echo exit 1 >venix
4354 echo exit 1 >os2
4355 d_bsd="$undef"
4356 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4357 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4358 then
4359         echo "Looks kind of like an OSF/1 system, but we'll see..."
4360         echo exit 0 >osf1
4361 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4362         xxx=`./loc addbib blurfl $pth`
4363         if $test -f $xxx; then
4364         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4365                 echo exit 0 >bsd
4366                 echo exit 0 >usg
4367         else
4368                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4369                         echo "Looks kind of like an extended USG system, but we'll see..."
4370                 else
4371                         echo "Looks kind of like a USG system, but we'll see..."
4372                 fi
4373                 echo exit 0 >usg
4374         fi
4375 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4376         echo "Looks kind of like a BSD system, but we'll see..."
4377         d_bsd="$define"
4378         echo exit 0 >bsd
4379 else
4380         echo "Looks kind of like a Version 7 system, but we'll see..."
4381         echo exit 0 >v7
4382 fi
4383 case "$eunicefix" in
4384 *unixtovms*)
4385         $cat <<'EOI'
4386 There is, however, a strange, musty smell in the air that reminds me of
4387 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4388 EOI
4389         echo exit 0 >eunice
4390         d_eunice="$define"
4391 : it so happens the Eunice I know will not run shell scripts in Unix format
4392         ;;
4393 *)
4394         echo " "
4395         echo "Congratulations.  You aren't running Eunice."
4396         d_eunice="$undef"
4397         ;;
4398 esac
4399 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4400 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4401 : semicolon as a patch separator
4402 case "$p_" in
4403 :) ;;
4404 *)
4405         $cat <<'EOI'
4406 I have the feeling something is not exactly right, however...don't tell me...
4407 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4408 (Or you may be running DOS with DJGPP.)
4409 EOI
4410         echo exit 0 >os2
4411         ;;
4412 esac
4413 if test -f /xenix; then
4414         echo "Actually, this looks more like a XENIX system..."
4415         echo exit 0 >xenix
4416         d_xenix="$define"
4417 else
4418         echo " "
4419         echo "It's not Xenix..."
4420         d_xenix="$undef"
4421 fi
4422 chmod +x xenix
4423 $eunicefix xenix
4424 if test -f /venix; then
4425         echo "Actually, this looks more like a VENIX system..."
4426         echo exit 0 >venix
4427 else
4428         echo " "
4429         if ./xenix; then
4430                 : null
4431         else
4432                 echo "Nor is it Venix..."
4433         fi
4434 fi
4435 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4436 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4437 $rm -f foo
4438
4439 : Checking the C compiler
4440 case "$cc" in
4441 '') dflt=cc;;
4442 *) dflt="$cc";;
4443 esac
4444 rp="Use which C compiler?"
4445 . ./myread
4446 cc="$ans"
4447
4448 : See if they have not cc but they do have gcc
4449 . ./trygcc
4450 : Look for a hint-file generated 'call-back-unit'.  Now that the
4451 : user has specified the compiler, we may need to set or change some
4452 : other defaults.
4453 if $test -f cc.cbu; then
4454     . ./cc.cbu
4455 fi
4456 . ./checkcc
4457
4458 : Check if we are using GNU gcc and what its version is
4459 echo " "
4460 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4461 $cat >try.c <<EOM
4462 #include <stdio.h>
4463 int main() {
4464 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4465 #ifdef __VERSION__
4466         printf("%s\n", __VERSION__);
4467 #else
4468         printf("%s\n", "1");
4469 #endif
4470 #endif
4471         return(0);
4472 }
4473 EOM
4474 if $cc -o try $ccflags $ldflags try.c; then
4475         gccversion=`$run ./try`
4476         case "$gccversion" in
4477         '') echo "You are not using GNU cc." ;;
4478         *)  echo "You are using GNU cc $gccversion."
4479             ccname=gcc
4480             ;;
4481         esac
4482 else
4483         echo " "
4484         echo "*** WHOA THERE!!! ***" >&4
4485         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4486         case "$knowitall" in
4487         '')
4488         echo "    You'd better start hunting for one and let me know about it." >&4
4489                 exit 1
4490                 ;;
4491         esac
4492 fi
4493 $rm -f try try.*
4494 case "$gccversion" in
4495 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4496 esac
4497 case "$gccversion" in
4498 '') gccosandvers='' ;;
4499 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4500    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4501    gccshortvers=''
4502    case "$gccosandvers" in
4503    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4504    $osname$osvers) ;; # looking good
4505    $osname*) cat <<EOM >&4
4506
4507 *** WHOA THERE!!! ***
4508
4509     Your gcc has not been compiled for the exact release of
4510     your operating system ($gccosandvers versus $osname$osvers).
4511
4512     In general it is a good idea to keep gcc synchronized with
4513     the operating system because otherwise serious problems
4514     may ensue when trying to compile software, like Perl.
4515
4516     I'm trying to be optimistic here, though, and will continue.
4517     If later during the configuration and build icky compilation
4518     problems appear (headerfile conflicts being the most common
4519     manifestation), I suggest reinstalling the gcc to match
4520     your operating system release.
4521
4522 EOM
4523       ;;
4524    *) gccosandvers='' ;; # failed to parse, better be silent
4525    esac
4526    ;;
4527 esac
4528 case "$ccname" in
4529 '') ccname="$cc" ;;
4530 esac
4531
4532 # gcc 3.* complain about adding -Idirectories that they already know about,
4533 # so we will take those off from locincpth.
4534 case "$gccversion" in
4535 3*)
4536     echo "main(){}">try.c
4537     for incdir in $locincpth; do
4538        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4539              grep '^c[cp]p*[01]: warning: changing search order '`
4540        if test "X$warn" != X; then
4541            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4542        fi
4543     done
4544     $rm -f try try.*
4545 esac
4546
4547 : What should the include directory be ?
4548 echo " "
4549 $echo $n "Hmm...  $c"
4550 dflt='/usr/include'
4551 incpath=''
4552 mips_type=''
4553 if $test -f /bin/mips && /bin/mips; then
4554         echo "Looks like a MIPS system..."
4555         $cat >usr.c <<'EOCP'
4556 #ifdef SYSTYPE_BSD43
4557 /bsd43
4558 #endif
4559 EOCP
4560         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4561                 dflt='/bsd43/usr/include'
4562                 incpath='/bsd43'
4563                 mips_type='BSD 4.3'
4564         else
4565                 mips_type='System V'
4566         fi
4567         $rm -f usr.c usr.out
4568         echo "and you're compiling with the $mips_type compiler and libraries."
4569         xxx_prompt=y
4570         echo "exit 0" >mips
4571 else
4572         echo "Doesn't look like a MIPS system."
4573         xxx_prompt=n
4574         echo "exit 1" >mips
4575 fi
4576 chmod +x mips
4577 $eunicefix mips
4578 case "$usrinc" in
4579 '') ;;
4580 *) dflt="$usrinc";;
4581 esac
4582 case "$xxx_prompt" in
4583 y)      fn=d/
4584         echo " "
4585         rp='Where are the include files you want to use?'
4586         . ./getfile
4587         usrinc="$ans"
4588         ;;
4589 *)      usrinc="$dflt"
4590         ;;
4591 esac
4592
4593 : see how we invoke the C preprocessor
4594 echo " "
4595 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4596 cat <<'EOT' >testcpp.c
4597 #define ABC abc
4598 #define XYZ xyz
4599 ABC.XYZ
4600 EOT
4601 cd ..
4602 if test ! -f cppstdin; then
4603         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4604                 # AIX cc -E doesn't show the absolute headerfile
4605                 # locations but we'll cheat by using the -M flag.
4606                 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
4607         else
4608                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4609         fi
4610 else
4611         echo "Keeping your $hint cppstdin wrapper."
4612 fi
4613 chmod 755 cppstdin
4614 wrapper=`pwd`/cppstdin
4615 ok='false'
4616 cd UU
4617
4618 if $test "X$cppstdin" != "X" && \
4619         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4620         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4621 then
4622         echo "You used to use $cppstdin $cppminus so we'll use that again."
4623         case "$cpprun" in
4624         '') echo "But let's see if we can live without a wrapper..." ;;
4625         *)
4626                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4627                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4628                 then
4629                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4630                         ok='true'
4631                 else
4632                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4633                 fi
4634                 ;;
4635         esac
4636 else
4637         case "$cppstdin" in
4638         '') ;;
4639         *)
4640                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4641                 ;;
4642         esac
4643 fi
4644
4645 if $ok; then
4646         : nothing
4647 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4648         $cc -E <testcpp.c >testcpp.out 2>&1; \
4649         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4650         echo "Yup, it does."
4651         x_cpp="$cc -E"
4652         x_minus='';
4653 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4654         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4655         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4656         echo "Yup, it does."
4657         x_cpp="$cc -E"
4658         x_minus='-';
4659 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4660         $cc -P <testcpp.c >testcpp.out 2>&1; \
4661         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4662         echo "Yipee, that works!"
4663         x_cpp="$cc -P"
4664         x_minus='';
4665 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4666         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4667         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4668         echo "At long last!"
4669         x_cpp="$cc -P"
4670         x_minus='-';
4671 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4672         $cpp <testcpp.c >testcpp.out 2>&1; \
4673         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4674         echo "It works!"
4675         x_cpp="$cpp"
4676         x_minus='';
4677 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4678         $cpp - <testcpp.c >testcpp.out 2>&1; \
4679         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4680         echo "Hooray, it works!  I was beginning to wonder."
4681         x_cpp="$cpp"
4682         x_minus='-';
4683 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4684         $wrapper <testcpp.c >testcpp.out 2>&1; \
4685         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4686         x_cpp="$wrapper"
4687         x_minus=''
4688         echo "Eureka!"
4689 else
4690         dflt=''
4691         rp="No dice.  I can't find a C preprocessor.  Name one:"
4692         . ./myread
4693         x_cpp="$ans"
4694         x_minus=''
4695         $x_cpp <testcpp.c >testcpp.out 2>&1
4696         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4697                 echo "OK, that will do." >&4
4698         else
4699 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4700                 exit 1
4701         fi
4702 fi
4703
4704 case "$ok" in
4705 false)
4706         cppstdin="$x_cpp"
4707         cppminus="$x_minus"
4708         cpprun="$x_cpp"
4709         cpplast="$x_minus"
4710         set X $x_cpp
4711         shift
4712         case "$1" in
4713         "$cpp")
4714                 echo "Perhaps can we force $cc -E using a wrapper..."
4715                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4716                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4717                 then
4718                         echo "Yup, we can."
4719                         cppstdin="$wrapper"
4720                         cppminus='';
4721                 else
4722                         echo "Nope, we'll have to live without it..."
4723                 fi
4724                 ;;
4725         esac
4726         case "$cpprun" in
4727         "$wrapper")
4728                 cpprun=''
4729                 cpplast=''
4730                 ;;
4731         esac
4732         ;;
4733 esac
4734
4735 case "$cppstdin" in
4736 "$wrapper"|'cppstdin') ;;
4737 *) $rm -f $wrapper;;
4738 esac
4739 $rm -f testcpp.c testcpp.out
4740
4741 : Set private lib path
4742 case "$plibpth" in
4743 '') if ./mips; then
4744                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4745         fi;;
4746 esac
4747 case "$libpth" in
4748 ' ') dlist='';;
4749 '') dlist="$loclibpth $plibpth $glibpth";;
4750 *) dlist="$libpth";;
4751 esac
4752
4753 : Now check and see which directories actually exist, avoiding duplicates
4754 libpth=''
4755 for xxx in $dlist
4756 do
4757     if $test -d $xxx; then
4758                 case " $libpth " in
4759                 *" $xxx "*) ;;
4760                 *) libpth="$libpth $xxx";;
4761                 esac
4762     fi
4763 done
4764 $cat <<'EOM'
4765
4766 Some systems have incompatible or broken versions of libraries.  Among
4767 the directories listed in the question below, please remove any you
4768 know not to be holding relevant libraries, and add any that are needed.
4769 Say "none" for none.
4770
4771 EOM
4772 case "$libpth" in
4773 '') dflt='none';;
4774 *)
4775         set X $libpth
4776         shift
4777         dflt=${1+"$@"}
4778         ;;
4779 esac
4780 rp="Directories to use for library searches?"
4781 . ./myread
4782 case "$ans" in
4783 none) libpth=' ';;
4784 *) libpth="$ans";;
4785 esac
4786
4787 : compute shared library extension
4788 case "$so" in
4789 '')
4790         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4791                 dflt='sl'
4792         else
4793                 dflt='so'
4794         fi
4795         ;;
4796 *) dflt="$so";;
4797 esac
4798 $cat <<EOM
4799
4800 On some systems, shared libraries may be available.  Answer 'none' if
4801 you want to suppress searching of shared libraries for the remainder
4802 of this configuration.
4803
4804 EOM
4805 rp='What is the file extension used for shared libraries?'
4806 . ./myread
4807 so="$ans"
4808
4809 : Define several unixisms.
4810 : Hints files or command line option can be used to override them.
4811 : The convoluted testing is in case hints files set either the old
4812 : or the new name.
4813 case "$_exe" in
4814 '')     case "$exe_ext" in
4815         '')     ;;
4816         *)      _exe="$exe_ext" ;;
4817         esac
4818         ;;
4819 esac
4820 case "$_a" in
4821 '')     case "$lib_ext" in
4822     '') _a='.a';;
4823         *)      _a="$lib_ext" ;;
4824         esac
4825         ;;
4826 esac
4827 case "$_o" in
4828 '') case "$obj_ext" in
4829         '')     _o='.o';;
4830         *)      _o="$obj_ext";;
4831         esac
4832         ;;
4833 esac
4834 case "$p_" in
4835 '') case "$path_sep" in
4836         '')     p_=':';;
4837         *)      p_="$path_sep";;
4838         esac
4839         ;;
4840 esac
4841 exe_ext=$_exe
4842 lib_ext=$_a
4843 obj_ext=$_o
4844 path_sep=$p_
4845
4846 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4847
4848 : Which makefile gets called first.  This is used by make depend.
4849 case "$firstmakefile" in
4850 '') firstmakefile='makefile';;
4851 esac
4852
4853 : Check for uselongdouble support
4854 case "$ccflags" in
4855 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4856 esac
4857
4858 case "$uselongdouble" in
4859 $define|true|[yY]*)     dflt='y';;
4860 *) dflt='n';;
4861 esac
4862 cat <<EOM
4863
4864 Perl can be built to take advantage of long doubles which
4865 (if available) may give more accuracy and range for floating point numbers.
4866
4867 If this doesn't make any sense to you, just accept the default '$dflt'.
4868 EOM
4869 rp='Try to use long doubles if available?'
4870 . ./myread
4871 case "$ans" in
4872 y|Y)    val="$define"   ;;
4873 *)      val="$undef"    ;;
4874 esac
4875 set uselongdouble
4876 eval $setvar
4877
4878 case "$uselongdouble" in
4879 true|[yY]*) uselongdouble="$define" ;;
4880 esac
4881
4882 : Look for a hint-file generated 'call-back-unit'.  If the
4883 : user has specified that long doubles should be used,
4884 : we may need to set or change some other defaults.
4885 if $test -f uselongdouble.cbu; then
4886     echo "Your platform has some specific hints regarding long doubles, using them..."
4887     . ./uselongdouble.cbu
4888 else
4889     case "$uselongdouble" in
4890         $define)
4891                 $cat <<EOM
4892 (Your platform does not have any specific hints for long doubles.)
4893 EOM
4894         ;;
4895     esac
4896 fi
4897
4898 : Looking for optional libraries
4899 echo " "
4900 echo "Checking for optional libraries..." >&4
4901 case "$libs" in
4902 ' '|'') dflt='';;
4903 *) dflt="$libs";;
4904 esac
4905 case "$libswanted" in
4906 '') libswanted='c_s';;
4907 esac
4908 case "$usesocks" in
4909 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4910 esac
4911 libsfound=''
4912 libsfiles=''
4913 libsdirs=''
4914 libspath=''
4915 for thisdir in $libpth $xlibpth; do
4916   test -d $thisdir && libspath="$libspath $thisdir"
4917 done
4918 for thislib in $libswanted; do
4919         for thisdir in $libspath; do
4920             xxx=''
4921             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4922                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
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.$so
4928                 $test -f "$xxx" && eval $libscheck
4929                 $test -f "$xxx" && libstyle=shared
4930             fi
4931             if test ! -f "$xxx"; then
4932                 xxx=$thisdir/lib$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/$thislib$_a
4938                 $test -f "$xxx" && eval $libscheck
4939                 $test -f "$xxx" && libstyle=static
4940             fi
4941             if test ! -f "$xxx"; then
4942                 xxx=$thisdir/lib${thislib}_s$_a
4943                 $test -f "$xxx" && eval $libscheck
4944                 $test -f "$xxx" && libstyle=static
4945                 $test -f "$xxx" && thislib=${thislib}_s
4946             fi
4947             if test ! -f "$xxx"; then
4948                 xxx=$thisdir/Slib$thislib$_a
4949                 $test -f "$xxx" && eval $libscheck
4950                 $test -f "$xxx" && libstyle=static
4951             fi
4952             if $test -f "$xxx"; then
4953                 case "$libstyle" in
4954                 shared) echo "Found -l$thislib (shared)." ;;
4955                 static) echo "Found -l$thislib." ;;
4956                 *)      echo "Found -l$thislib ($libstyle)." ;;
4957                 esac
4958                 case " $dflt " in
4959                 *"-l$thislib "*);;
4960                 *) dflt="$dflt -l$thislib"
4961                    libsfound="$libsfound $xxx"
4962                    yyy=`basename $xxx`
4963                    libsfiles="$libsfiles $yyy"
4964                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4965                    case " $libsdirs " in
4966                    *" $yyy "*) ;;
4967                    *) libsdirs="$libsdirs $yyy" ;;
4968                    esac
4969                    ;;
4970                 esac
4971                 break
4972             fi
4973         done
4974         if $test ! -f "$xxx"; then
4975             echo "No -l$thislib."
4976         fi
4977 done
4978 set X $dflt
4979 shift
4980 dflt="$*"
4981 case "$libs" in
4982 '') dflt="$dflt";;
4983 *) dflt="$libs";;
4984 esac
4985 case "$dflt" in
4986 ' '|'') dflt='none';;
4987 esac
4988
4989 $cat <<EOM
4990
4991 In order to compile $package on your machine, a number of libraries
4992 are usually needed.  Include any other special libraries here as well.
4993 Say "none" for none.  The default list is almost always right.
4994 EOM
4995
4996 echo " "
4997 rp="What libraries to use?"
4998 . ./myread
4999 case "$ans" in
5000 none) libs=' ';;
5001 *) libs="$ans";;
5002 esac
5003
5004 : determine optimization, if desired, or use for debug flag also
5005 case "$optimize" in
5006 ' '|$undef) dflt='none';;
5007 '') dflt='-O';;
5008 *) dflt="$optimize";;
5009 esac
5010 $cat <<EOH
5011
5012 By default, $package compiles with the -O flag to use the optimizer.
5013 Alternately, you might want to use the symbolic debugger, which uses
5014 the -g flag (on traditional Unix systems).  Either flag can be
5015 specified here.  To use neither flag, specify the word "none".
5016
5017 EOH
5018 rp="What optimizer/debugger flag should be used?"
5019 . ./myread
5020 optimize="$ans"
5021 case "$optimize" in
5022 'none') optimize=" ";;
5023 esac
5024
5025 : Check what DEBUGGING is required from the command line
5026 : -DEBUGGING      or -DDEBUGGING or
5027 : -DEBUGGING=both                       = -g + -DDEBUGGING
5028 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5029 : -DEBUGGING=none or -UDEBUGGING        =
5030 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5031 case "$EBUGGING" in
5032 '')     ;;
5033 *)      DEBUGGING=$EBUGGING ;;
5034 esac
5035
5036 case "$DEBUGGING" in
5037 -g|both|$define)
5038     case "$optimize" in
5039         *-g*) ;;
5040         *)    optimize="$optimize -g" ;;
5041     esac ;;
5042 none|$undef)
5043     case "$optimize" in
5044         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5045                 shift
5046                 optimize="$*"
5047                 ;;
5048     esac ;;
5049 esac
5050
5051 dflt=''
5052 case "$DEBUGGING" in
5053 both|$define) dflt='-DDEBUGGING'
5054 esac
5055
5056 : argument order is deliberate, as the flag will start with - which set could
5057 : think is an option
5058 checkccflag='check=$1; flag=$2; callback=$3;
5059 echo " ";
5060 echo "Checking if your compiler accepts $flag" 2>&1;
5061 echo "int main(void) { return 0; }" > gcctest.c;
5062 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5063     echo "Yes, it does." 2>&1;
5064     if $test -s gcctest.out ; then
5065         echo "But your platform does not like it:";
5066         cat gcctest.out;
5067     else
5068         case "$ccflags" in
5069         *$check*)
5070             echo "Leaving current flags $ccflags alone." 2>&1
5071             ;;
5072         *) dflt="$dflt $flag";
5073             eval $callback
5074             ;;
5075         esac
5076     fi
5077 else
5078     echo "Nope, it does not, but that is ok." 2>&1;
5079 fi
5080 '
5081
5082 : We will not override a previous value, but we might want to
5083 : augment a hint file
5084 case "$hint" in
5085 default|recommended)
5086         case "$gccversion" in
5087         1*) dflt="$dflt -fpcc-struct-return" ;;
5088         esac
5089         case "$optimize:$DEBUGGING" in
5090         *-g*:old) dflt="$dflt -DDEBUGGING";;
5091         esac
5092         case "$gccversion" in
5093         2*) if $test -d /etc/conf/kconfig.d &&
5094                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5095                 then
5096                         # Interactive Systems (ISC) POSIX mode.
5097                         dflt="$dflt -posix"
5098                 fi
5099                 ;;
5100         esac
5101         case "$gccversion" in
5102         1*) ;;
5103         2.[0-8]*) ;;
5104         ?*)     set strict-aliasing -fno-strict-aliasing
5105                 eval $checkccflag
5106                 ;;
5107         esac
5108         # For gcc, adding -pipe speeds up compilations for some, but apparently
5109         # some assemblers can't read from stdin.  (It also slows down compilations
5110         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5111         case "$gccversion" in
5112         ?*)     set pipe -pipe
5113                 eval $checkccflag
5114                 ;;
5115         esac
5116
5117         # on x86_64 (at least) we require an extra library (libssp) in the
5118         # link command line. This library is not named, so I infer that it is
5119         # an implementation detail that may change. Hence the safest approach
5120         # is to add the flag to the flags passed to the compiler at link time,
5121         # as that way the compiler can do the right implementation dependant
5122         # thing. (NWC)
5123         case "$gccversion" in
5124         ?*)     set stack-protector -fstack-protector 'ldflags="$ldflags -fstack-protector"'
5125                 eval $checkccflag
5126                 ;;
5127         esac
5128         ;;
5129 esac
5130
5131 case "$mips_type" in
5132 *BSD*|'') inclwanted="$locincpth $usrinc";;
5133 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5134 esac
5135 for thisincl in $inclwanted; do
5136         if $test -d $thisincl; then
5137                 if $test x$thisincl != x$usrinc; then
5138                         case "$dflt" in
5139                         *" -I$thisincl "*);;
5140                         *) dflt="$dflt -I$thisincl ";;
5141                         esac
5142                 fi
5143         fi
5144 done
5145
5146 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5147         xxx=true;
5148 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5149         xxx=true;
5150 else
5151         xxx=false;
5152 fi;
5153 if $xxx; then
5154         case "$dflt" in
5155         *$2*);;
5156         *) dflt="$dflt -D$2";;
5157         esac;
5158 fi'
5159
5160 set signal.h LANGUAGE_C; eval $inctest
5161
5162 case "$usesocks" in
5163 $define)
5164         ccflags="$ccflags -DSOCKS"
5165         ;;
5166 esac
5167
5168 case "$hint" in
5169 default|recommended) dflt="$ccflags $dflt" ;;
5170 *) dflt="$ccflags";;
5171 esac
5172
5173 case "$dflt" in
5174 ''|' ') dflt=none;;
5175 esac
5176
5177 $cat <<EOH
5178
5179 Your C compiler may want other flags.  For this question you should include
5180 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5181 but you should NOT include libraries or ld flags like -lwhatever.  If you
5182 want $package to honor its debug switch, you should include -DDEBUGGING here.
5183 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5184
5185 To use no flags, specify the word "none".
5186
5187 EOH
5188 set X $dflt
5189 shift
5190 dflt=${1+"$@"}
5191 rp="Any additional cc flags?"
5192 . ./myread
5193 case "$ans" in
5194 none) ccflags='';;
5195 *) ccflags="$ans";;
5196 esac
5197
5198 : the following weeds options from ccflags that are of no interest to cpp
5199 case "$cppflags" in
5200 '') cppflags="$ccflags" ;;
5201 *)  cppflags="$cppflags $ccflags" ;;
5202 esac
5203 case "$gccversion" in
5204 1*) cppflags="$cppflags -D__GNUC__"
5205 esac
5206 case "$mips_type" in
5207 '');;
5208 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5209 esac
5210 case "$cppflags" in
5211 '');;
5212 *)
5213         echo " "
5214         echo "Let me guess what the preprocessor flags are..." >&4
5215         set X $cppflags
5216         shift
5217         cppflags=''
5218         $cat >cpp.c <<'EOM'
5219 #define BLURFL foo
5220
5221 BLURFL xx LFRULB
5222 EOM
5223         previous=''
5224         for flag in $*
5225         do
5226                 case "$flag" in
5227                 -*) ftry="$flag";;
5228                 *) ftry="$previous $flag";;
5229                 esac
5230                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5231                         >cpp1.out 2>/dev/null && \
5232                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5233                         >cpp2.out 2>/dev/null && \
5234                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5235                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5236                 then
5237                         cppflags="$cppflags $ftry"
5238                         previous=''
5239                 else
5240                         previous="$flag"
5241                 fi
5242         done
5243         set X $cppflags
5244         shift
5245         cppflags=${1+"$@"}
5246         case "$cppflags" in
5247         *-*)  echo "They appear to be: $cppflags";;
5248         esac
5249         $rm -f cpp.c cpp?.out
5250         ;;
5251 esac
5252
5253 : flags used in final linking phase
5254 case "$ldflags" in
5255 '') if ./venix; then
5256                 dflt='-i -z'
5257         else
5258                 dflt=''
5259         fi
5260         case "$ccflags" in
5261         *-posix*) dflt="$dflt -posix" ;;
5262         esac
5263         ;;
5264 *) dflt="$ldflags";;
5265 esac
5266
5267 : Try to guess additional flags to pick up local libraries.
5268 for thislibdir in $libpth; do
5269         case " $loclibpth " in
5270         *" $thislibdir "*)
5271                 case "$dflt " in
5272                 *"-L$thislibdir "*) ;;
5273                 *)  dflt="$dflt -L$thislibdir" ;;
5274                 esac
5275                 ;;
5276         esac
5277 done
5278
5279 case "$dflt" in
5280 '') dflt='none' ;;
5281 esac
5282
5283 $cat <<EOH
5284
5285 Your C linker may need flags.  For this question you should
5286 include -L/whatever and any other flags used by the C linker, but you
5287 should NOT include libraries like -lwhatever.
5288
5289 Make sure you include the appropriate -L/path flags if your C linker
5290 does not normally search all of the directories you specified above,
5291 namely
5292         $libpth
5293 To use no flags, specify the word "none".
5294
5295 EOH
5296
5297 rp="Any additional ld flags (NOT including libraries)?"
5298 . ./myread
5299 case "$ans" in
5300 none) ldflags='';;
5301 *) ldflags="$ans";;
5302 esac
5303 rmlist="$rmlist pdp11"
5304
5305 : coherency check
5306 echo " "
5307 echo "Checking your choice of C compiler and flags for coherency..." >&4
5308 $cat > try.c <<'EOF'
5309 #include <stdio.h>
5310 int main() { printf("Ok\n"); return(0); }
5311 EOF
5312 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5313 shift
5314 $cat >try.msg <<'EOM'
5315 I've tried to compile and run the following simple program:
5316
5317 EOM
5318 $cat try.c >> try.msg
5319
5320 $cat >> try.msg <<EOM
5321
5322 I used the command:
5323
5324         $*
5325         $run ./try
5326
5327 and I got the following output:
5328
5329 EOM
5330 dflt=y
5331 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5332         if $sh -c "$run ./try " >>try.msg 2>&1; then
5333                 xxx=`$run ./try`
5334                 case "$xxx" in
5335                 "Ok") dflt=n ;;
5336                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5337                         case " $libs " in
5338                         *" -lsfio "*)
5339                                 cat >> try.msg <<'EOQS'
5340 If $libs contains -lsfio, and sfio is mis-configured, then it
5341 sometimes (apparently) runs and exits with a 0 status, but with no
5342 output!  It may have to do with sfio's use of _exit vs. exit.
5343
5344 EOQS
5345                                 rp="You have a big problem.  Shall I abort Configure"
5346                                 dflt=y
5347                                 ;;
5348                         esac
5349                         ;;
5350                 esac
5351         else
5352                 echo "The program compiled OK, but exited with status $?." >>try.msg
5353                 rp="You have a problem.  Shall I abort Configure"
5354                 dflt=y
5355         fi
5356 else
5357         echo "I can't compile the test program." >>try.msg
5358         rp="You have a BIG problem.  Shall I abort Configure"
5359         dflt=y
5360 fi
5361 case "$dflt" in
5362 y)
5363         $cat try.msg >&4
5364         case "$knowitall" in
5365         '')
5366                 echo "(The supplied flags or libraries might be incorrect.)"
5367                 ;;
5368         *) dflt=n;;
5369         esac
5370         echo " "
5371         . ./myread
5372         case "$ans" in
5373         n*|N*) ;;
5374         *)      echo "Ok.  Stopping Configure." >&4
5375                 exit 1
5376                 ;;
5377         esac
5378         ;;
5379 n) echo "OK, that should do.";;
5380 esac
5381 $rm_try gcctest gcctest.out
5382
5383 : define a shorthand compile call
5384 compile='
5385 mc_file=$1;
5386 shift;
5387 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5388 : define a shorthand compile call for compilations that should be ok.
5389 compile_ok='
5390 mc_file=$1;
5391 shift;
5392 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5393
5394 : determine filename position in cpp output
5395 echo " "
5396 echo "Computing filename position in cpp output for #include directives..." >&4
5397 case "$osname" in
5398 vos) testaccess=-e ;;
5399 *)   testaccess=-r ;;
5400 esac
5401 echo '#include <stdio.h>' > foo.c
5402 $cat >fieldn <<EOF
5403 $startsh
5404 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5405 $grep '^[       ]*#.*stdio\.h' | \
5406 while read cline; do
5407         pos=1
5408         set \$cline
5409         while $test \$# -gt 0; do
5410                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5411                         echo "\$pos"
5412                         exit 0
5413                 fi
5414                 shift
5415                 pos=\`expr \$pos + 1\`
5416         done
5417 done
5418 EOF
5419 chmod +x fieldn
5420 fieldn=`./fieldn`
5421 $rm -f foo.c fieldn
5422 case $fieldn in
5423 '') pos='???';;
5424 1) pos=first;;
5425 2) pos=second;;
5426 3) pos=third;;
5427 *) pos="${fieldn}th";;
5428 esac
5429 echo "Your cpp writes the filename in the $pos field of the line."
5430
5431 case "$osname" in
5432 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5433 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5434 *)   cppfilter='' ;;
5435 esac
5436 : locate header file
5437 $cat >findhdr <<EOF
5438 $startsh
5439 wanted=\$1
5440 name=''
5441 for usrincdir in $usrinc
5442 do
5443         if test -f \$usrincdir/\$wanted; then
5444                 echo "\$usrincdir/\$wanted"
5445                 exit 0
5446         fi
5447 done
5448 awkprg='{ print \$$fieldn }'
5449 echo "#include <\$wanted>" > foo\$\$.c
5450 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5451 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5452 while read cline; do
5453         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5454         case "\$name" in
5455         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5456         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5457         *) exit 2;;
5458         esac;
5459 done;
5460 #
5461 # status = 0: grep returned 0 lines, case statement not executed
5462 # status = 1: headerfile found
5463 # status = 2: while loop executed, no headerfile found
5464 #
5465 status=\$?
5466 $rm -f foo\$\$.c;
5467 if test \$status -eq 1; then
5468         exit 0;
5469 fi
5470 exit 1
5471 EOF
5472 chmod +x findhdr
5473
5474 : define an alternate in-header-list? function
5475 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5476 cont=true; xxf="echo \"<\$1> found.\" >&4";
5477 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5478 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5479 esac;
5480 case $# in 4) instead=instead;; *) instead="at last";; esac;
5481 while $test "$cont"; do
5482         xxx=`./findhdr $1`
5483         var=$2; eval "was=\$$2";
5484         if $test "$xxx" && $test -r "$xxx";
5485         then eval $xxf;
5486         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5487                 cont="";
5488         else eval $xxnf;
5489         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5490         set $yyy; shift; shift; yyy=$@;
5491         case $# in 0) cont="";;
5492         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5493                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5494         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5495                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5496         esac;
5497 done;
5498 while $test "$yyy";
5499 do set $yyy; var=$2; eval "was=\$$2";
5500         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5501         set $yyy; shift; shift; yyy=$@;
5502 done'
5503
5504 : see if stdlib is available
5505 set stdlib.h i_stdlib
5506 eval $inhdr
5507
5508 : check for lengths of integral types
5509 echo " "
5510 case "$intsize" in
5511 '')
5512         echo "Checking to see how big your integers are..." >&4
5513         $cat >try.c <<EOCP
5514 #include <stdio.h>
5515 #$i_stdlib I_STDLIB
5516 #ifdef I_STDLIB
5517 #include <stdlib.h>
5518 #endif
5519 int main()
5520 {
5521         printf("intsize=%d;\n", (int)sizeof(int));
5522         printf("longsize=%d;\n", (int)sizeof(long));
5523         printf("shortsize=%d;\n", (int)sizeof(short));
5524         exit(0);
5525 }
5526 EOCP
5527         set try
5528         if eval $compile_ok && $run ./try > /dev/null; then
5529                 eval `$run ./try`
5530                 echo "Your integers are $intsize bytes long."
5531                 echo "Your long integers are $longsize bytes long."
5532                 echo "Your short integers are $shortsize bytes long."
5533         else
5534                 $cat >&4 <<EOM
5535 !
5536 Help! I can't compile and run the intsize test program: please enlighten me!
5537 (This is probably a misconfiguration in your system or libraries, and
5538 you really ought to fix it.  Still, I'll try anyway.)
5539 !
5540 EOM
5541                 dflt=4
5542                 rp="What is the size of an integer (in bytes)?"
5543                 . ./myread
5544                 intsize="$ans"
5545                 dflt=$intsize
5546                 rp="What is the size of a long integer (in bytes)?"
5547                 . ./myread
5548                 longsize="$ans"
5549                 dflt=2
5550                 rp="What is the size of a short integer (in bytes)?"
5551                 . ./myread
5552                 shortsize="$ans"
5553         fi
5554         ;;
5555 esac
5556 $rm_try
5557
5558 : check for long long
5559 echo " "
5560 echo "Checking to see if you have long long..." >&4
5561 echo 'int main() { long long x = 7; return 0; }' > try.c
5562 set try
5563 if eval $compile; then
5564         val="$define"
5565         echo "You have long long."
5566 else
5567         val="$undef"
5568         echo "You do not have long long."
5569 fi
5570 $rm_try
5571 set d_longlong
5572 eval $setvar
5573
5574 : check for length of long long
5575 case "${d_longlong}${longlongsize}" in
5576 $define)
5577         echo " "
5578         echo "Checking to see how big your long longs are..." >&4
5579         $cat >try.c <<'EOCP'
5580 #include <stdio.h>
5581 int main()
5582 {
5583     printf("%d\n", (int)sizeof(long long));
5584     return(0);
5585 }
5586 EOCP
5587         set try
5588         if eval $compile_ok; then
5589                 longlongsize=`$run ./try`
5590                 echo "Your long longs are $longlongsize bytes long."
5591         else
5592                 dflt='8'
5593                 echo " "
5594                 echo "(I can't seem to compile the test program.  Guessing...)"
5595                 rp="What is the size of a long long (in bytes)?"
5596                 . ./myread
5597                 longlongsize="$ans"
5598         fi
5599         if $test "X$longsize" = "X$longlongsize"; then
5600                 echo "(That isn't any different from an ordinary long.)"
5601         fi
5602         ;;
5603 esac
5604 $rm_try
5605
5606 : see if inttypes.h is available
5607 : we want a real compile instead of Inhdr because some systems
5608 : have an inttypes.h which includes non-existent headers
5609 echo " "
5610 $cat >try.c <<EOCP
5611 #include <inttypes.h>
5612 int main() {
5613         static int32_t foo32 = 0x12345678;
5614 }
5615 EOCP
5616 set try
5617 if eval $compile; then
5618         echo "<inttypes.h> found." >&4
5619         val="$define"
5620 else
5621         echo "<inttypes.h> NOT found." >&4
5622         val="$undef"
5623 fi
5624 $rm_try
5625 set i_inttypes
5626 eval $setvar
5627
5628 : check for int64_t
5629 echo " "
5630 echo "Checking to see if you have int64_t..." >&4
5631 $cat >try.c <<EOCP
5632 #include <sys/types.h>
5633 #$i_inttypes I_INTTYPES
5634 #ifdef I_INTTYPES
5635 #include <inttypes.h>
5636 #endif
5637 int main() { int64_t x = 7; }
5638 EOCP
5639 set try
5640 if eval $compile; then
5641         val="$define"
5642         echo "You have int64_t."
5643 else
5644         val="$undef"
5645         echo "You do not have int64_t."
5646 fi
5647 $rm_try
5648 set d_int64_t
5649 eval $setvar
5650
5651 : Check if 64bit ints have a quad type
5652 echo " "
5653 echo "Checking which 64-bit integer type we could use..." >&4
5654
5655 case "$intsize" in
5656 8) val=int
5657    set quadtype
5658    eval $setvar
5659    val='"unsigned int"'
5660    set uquadtype
5661    eval $setvar
5662    quadkind=1
5663    ;;
5664 *) case "$longsize" in
5665    8) val=long
5666       set quadtype
5667       eval $setvar
5668       val='"unsigned long"'
5669       set uquadtype
5670       eval $setvar
5671       quadkind=2
5672       ;;
5673    *) case "$d_longlong:$longlongsize" in
5674       define:8)
5675         val='"long long"'
5676         set quadtype
5677         eval $setvar
5678         val='"unsigned long long"'
5679         set uquadtype
5680         eval $setvar
5681         quadkind=3
5682         ;;
5683       *) case "$d_int64_t" in
5684          define)
5685            val=int64_t
5686            set quadtype
5687            eval $setvar
5688            val=uint64_t
5689            set uquadtype
5690            eval $setvar
5691            quadkind=4
5692            ;;
5693          esac
5694          ;;
5695       esac
5696       ;;
5697    esac
5698    ;;
5699 esac
5700
5701 case "$quadtype" in
5702 '')     echo "Alas, no 64-bit integer types in sight." >&4
5703         d_quad="$undef"
5704         ;;
5705 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5706         d_quad="$define"
5707         ;;
5708 esac
5709
5710 : Do we want 64bit support
5711 case "$uselonglong" in
5712 "$define"|true|[yY]*)
5713         cat <<EOM >&4
5714
5715 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5716 EOM
5717         use64bitint="$define"
5718         ;;
5719 esac
5720 case "$use64bits" in
5721 "$define"|true|[yY]*)
5722         cat <<EOM >&4
5723
5724 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5725 EOM
5726         use64bitint="$define"
5727         ;;
5728 esac
5729 case "$use64bitints" in
5730 "$define"|true|[yY]*)
5731         cat <<EOM >&4
5732
5733 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5734 EOM
5735         use64bitint="$define"
5736         ;;
5737 esac
5738 case "$use64bitsint" in
5739 "$define"|true|[yY]*)
5740         cat <<EOM >&4
5741
5742 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5743 EOM
5744         use64bitint="$define"
5745         ;;
5746 esac
5747 case "$uselonglongs" in
5748 "$define"|true|[yY]*)
5749         cat <<EOM >&4
5750
5751 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5752 EOM
5753         use64bitint="$define"
5754         ;;
5755 esac
5756 case "$use64bitsall" in
5757 "$define"|true|[yY]*)
5758         cat <<EOM >&4
5759
5760 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5761 EOM
5762         use64bitall="$define"
5763         ;;
5764 esac
5765
5766 case "$ccflags" in
5767 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5768 esac
5769 case "$use64bitall" in
5770 "$define"|true|[yY]*) use64bitint="$define" ;;
5771 esac
5772
5773 case "$longsize" in
5774 8) cat <<EOM
5775
5776 You have natively 64-bit long integers.
5777 EOM
5778    val="$define"
5779    ;;
5780 *) case "$use64bitint" in
5781    "$define"|true|[yY]*) dflt='y';;
5782    *) dflt='n';;
5783    esac
5784    case "$d_quad" in
5785    "$define") ;;
5786    *) dflt='n' ;;
5787    esac
5788    cat <<EOM
5789
5790 Perl can be built to take advantage of 64-bit integer types
5791 on some systems.  To do so, Configure can be run with -Duse64bitint.
5792 Choosing this option will most probably introduce binary incompatibilities.
5793
5794 If this doesn't make any sense to you, just accept the default '$dflt'.
5795 (The default has been chosen based on your configuration.)
5796 EOM
5797    rp='Try to use 64-bit integers, if available?'
5798    . ./myread
5799    case "$ans" in
5800    [yY]*) val="$define" ;;
5801    *)     val="$undef"  ;;
5802    esac
5803    ;;
5804 esac
5805 set use64bitint
5806 eval $setvar
5807
5808 case "$use64bitall" in
5809 "$define"|true|[yY]*) dflt='y' ;;
5810 *) case "$longsize" in
5811    8) dflt='y' ;;
5812    *) dflt='n' ;;
5813    esac
5814    ;;
5815 esac
5816 cat <<EOM
5817
5818 You may also choose to try maximal 64-bitness.  It means using as much
5819 64-bitness as possible on the platform.  This in turn means even more
5820 binary incompatibilities.  On the other hand, your platform may not
5821 have any more 64-bitness available than what you already have chosen.
5822
5823 If this doesn't make any sense to you, just accept the default '$dflt'.
5824 (The default has been chosen based on your configuration.)
5825 EOM
5826 rp='Try to use maximal 64-bit support, if available?'
5827 . ./myread
5828 case "$ans" in
5829 [yY]*) val="$define" ;;
5830 *)     val="$undef"  ;;
5831 esac
5832 set use64bitall
5833 eval $setvar
5834 case "$use64bitall" in
5835 "$define")
5836         case "$use64bitint" in
5837         "$undef")
5838                 cat <<EOM
5839
5840 Since you have chosen a maximally 64-bit build, I'm also turning on
5841 the use of 64-bit integers.
5842 EOM
5843                 use64bitint="$define" ;;
5844         esac
5845         ;;
5846 esac
5847
5848 : Look for a hint-file generated 'call-back-unit'.  If the
5849 : user has specified that a 64-bit perl is to be built,
5850 : we may need to set or change some other defaults.
5851 if $test -f use64bitint.cbu; then
5852         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5853         . ./use64bitint.cbu
5854 fi
5855 case "$use64bitint" in
5856 "$define"|true|[yY]*)
5857         case "$longsize" in
5858         4) case "$archname64" in
5859            '') archname64=64int ;;
5860            esac
5861            ;;
5862         esac
5863         ;;
5864 esac
5865
5866 : Look for a hint-file generated 'call-back-unit'.  If the
5867 : user has specified that a maximally 64-bit perl is to be built,
5868 : we may need to set or change some other defaults.
5869 if $test -f use64bitall.cbu; then
5870         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5871         . ./use64bitall.cbu
5872 fi
5873 case "$use64bitall" in
5874 "$define"|true|[yY]*)
5875         case "$longsize" in
5876         4) case "$archname64" in
5877            ''|64int) archname64=64all ;;
5878            esac
5879            ;;
5880         esac
5881         ;;
5882 esac
5883
5884 case "$d_quad:$use64bitint" in
5885 $undef:$define)
5886         cat >&4 <<EOF
5887
5888 *** You have chosen to use 64-bit integers,
5889 *** but none can be found.
5890 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5891 *** Cannot continue, aborting.
5892
5893 EOF
5894         exit 1
5895         ;;
5896 esac
5897
5898 : check for length of double
5899 echo " "
5900 case "$doublesize" in
5901 '')
5902         echo "Checking to see how big your double precision numbers are..." >&4
5903         $cat >try.c <<EOCP
5904 #include <stdio.h>
5905 #$i_stdlib I_STDLIB
5906 #ifdef I_STDLIB
5907 #include <stdlib.h>
5908 #endif
5909 int main()
5910 {
5911     printf("%d\n", (int)sizeof(double));
5912     exit(0);
5913 }
5914 EOCP
5915         set try
5916         if eval $compile_ok; then
5917                 doublesize=`$run ./try`
5918                 echo "Your double is $doublesize bytes long."
5919         else
5920                 dflt='8'
5921                 echo "(I can't seem to compile the test program.  Guessing...)"
5922                 rp="What is the size of a double precision number (in bytes)?"
5923                 . ./myread
5924                 doublesize="$ans"
5925         fi
5926         ;;
5927 esac
5928 $rm_try
5929
5930 : check for long doubles
5931 echo " "
5932 echo "Checking to see if you have long double..." >&4
5933 echo 'int main() { long double x = 7.0; }' > try.c
5934 set try
5935 if eval $compile; then
5936         val="$define"
5937         echo "You have long double."
5938 else
5939         val="$undef"
5940         echo "You do not have long double."
5941 fi
5942 $rm_try
5943 set d_longdbl
5944 eval $setvar
5945
5946 : check for length of long double
5947 case "${d_longdbl}${longdblsize}" in
5948 $define)
5949         echo " "
5950         echo "Checking to see how big your long doubles are..." >&4
5951         $cat >try.c <<'EOCP'
5952 #include <stdio.h>
5953 int main()
5954 {
5955         printf("%d\n", sizeof(long double));
5956 }
5957 EOCP
5958         set try
5959         set try
5960         if eval $compile; then
5961                 longdblsize=`$run ./try`
5962                 echo "Your long doubles are $longdblsize bytes long."
5963         else
5964                 dflt='8'
5965                 echo " "
5966                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5967                 rp="What is the size of a long double (in bytes)?"
5968                 . ./myread
5969                 longdblsize="$ans"
5970         fi
5971         if $test "X$doublesize" = "X$longdblsize"; then
5972                 echo "That isn't any different from an ordinary double."
5973                 echo "I'll keep your setting anyway, but you may see some"
5974                 echo "harmless compilation warnings."
5975         fi
5976         ;;
5977 esac
5978 $rm_try
5979
5980 : determine the architecture name
5981 echo " "
5982 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5983         tarch=`arch`"-$osname"
5984 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5985         if uname -m > tmparch 2>&1 ; then
5986                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5987                         -e 's/$/'"-$osname/" tmparch`
5988         else
5989                 tarch="$osname"
5990         fi
5991         $rm -f tmparch
5992 else
5993         tarch="$osname"
5994 fi
5995 case "$myarchname" in
5996 ''|"$tarch") ;;
5997 *)
5998         echo "(Your architecture name used to be $myarchname.)"
5999         archname=''
6000         ;;
6001 esac
6002 case "$targetarch" in
6003 '') ;;
6004 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6005 esac
6006 myarchname="$tarch"
6007 case "$archname" in
6008 '') dflt="$tarch";;
6009 *) dflt="$archname";;
6010 esac
6011 rp='What is your architecture name'
6012 . ./myread
6013 archname="$ans"
6014 case "$usethreads" in
6015 $define)
6016         echo "Threads selected." >&4
6017         case "$archname" in
6018         *-thread*) echo "...and architecture name already has -thread." >&4
6019                 ;;
6020         *)      archname="$archname-thread"
6021                 echo "...setting architecture name to $archname." >&4
6022                 ;;
6023         esac
6024         ;;
6025 esac
6026 case "$usemultiplicity" in
6027 $define)
6028         echo "Multiplicity selected." >&4
6029         case "$archname" in
6030         *-multi*) echo "...and architecture name already has -multi." >&4
6031                 ;;
6032         *)      archname="$archname-multi"
6033                 echo "...setting architecture name to $archname." >&4
6034                 ;;
6035         esac
6036         ;;
6037 esac
6038 case "$use64bitint$use64bitall" in
6039 *"$define"*)
6040         case "$archname64" in
6041         '')
6042                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6043                 ;;
6044         *)
6045                 case "$use64bitint" in
6046                 "$define") echo "64 bit integers selected." >&4 ;;
6047                 esac
6048                 case "$use64bitall" in
6049                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6050                 esac
6051                 case "$archname" in
6052                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6053                         ;;
6054                 *)      archname="$archname-$archname64"
6055                         echo "...setting architecture name to $archname." >&4
6056                         ;;
6057                 esac
6058                 ;;
6059         esac
6060 esac
6061 case "$uselongdouble" in
6062 $define)
6063         echo "Long doubles selected." >&4
6064         case "$longdblsize" in
6065         $doublesize)
6066                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6067                 ;;
6068         *)
6069                 case "$archname" in
6070                 *-ld*) echo "...and architecture name already has -ld." >&4
6071                         ;;
6072                 *)      archname="$archname-ld"
6073                         echo "...setting architecture name to $archname." >&4
6074                         ;;
6075                 esac
6076                 ;;
6077         esac
6078         ;;
6079 esac
6080 case "$useperlio" in
6081 $define)
6082         echo "Perlio selected." >&4
6083         ;;
6084 *)
6085         echo "Perlio not selected, using stdio." >&4
6086         case "$archname" in
6087         *-stdio*) echo "...and architecture name already has -stdio." >&4
6088                 ;;
6089         *)      archname="$archname-stdio"
6090                 echo "...setting architecture name to $archname." >&4
6091                 ;;
6092         esac
6093         ;;
6094 esac
6095 if $test -f archname.cbu; then
6096         echo "Your platform has some specific hints for architecture name, using them..."
6097         . ./archname.cbu
6098 fi
6099
6100 : set the prefixit variable, to compute a suitable default value
6101 prefixit='case "$3" in
6102 ""|none)
6103         case "$oldprefix" in
6104         "") eval "$1=\"\$$2\"";;
6105         *)
6106                 case "$3" in
6107                 "") eval "$1=";;
6108                 none)
6109                         eval "tp=\"\$$2\"";
6110                         case "$tp" in
6111                         ""|" ") eval "$1=\"\$$2\"";;
6112                         *) eval "$1=";;
6113                         esac;;
6114                 esac;;
6115         esac;;
6116 *)
6117         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6118         case "$tp" in
6119         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6120         /*-$oldprefix/*|\~*-$oldprefix/*)
6121                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6122         *) eval "$1=\"\$$2\"";;
6123         esac;;
6124 esac'
6125
6126 : determine installation style
6127 : For now, try to deduce it from prefix unless it is already set.
6128 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6129 case "$installstyle" in
6130 '')     case "$prefix" in
6131                 *perl*) dflt='lib';;
6132                 *) dflt='lib/perl5' ;;
6133         esac
6134         ;;
6135 *)      dflt="$installstyle" ;;
6136 esac
6137 : Probably not worth prompting for this since we prompt for all
6138 : the directories individually, and the prompt would be too long and
6139 : confusing anyway.
6140 installstyle=$dflt
6141
6142 : determine where public executables go
6143 echo " "
6144 set dflt bin bin
6145 eval $prefixit
6146 fn=d~
6147 rp='Pathname where the public executables will reside?'
6148 . ./getfile
6149 if $test "X$ansexp" != "X$binexp"; then
6150         installbin=''
6151 fi
6152 prefixvar=bin
6153 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6154 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6155 :     this via initialinstalllocation
6156 . ./setprefixvar
6157
6158 case "$userelocatableinc" in
6159 $define|true|[yY]*)     dflt='y' ;;
6160 *)                      dflt='n' ;;
6161 esac
6162 cat <<EOM
6163
6164 Would you like to build Perl so that the installation is relocatable, so that
6165 library paths in @INC are determined relative to the path of the perl binary?
6166 This is not advised for system Perl installs, or if you need to run setid
6167 scripts or scripts under taint mode.
6168
6169 If this doesn't make any sense to you, just accept the default '$dflt'.
6170 EOM
6171 rp='Use relocatable @INC?'
6172 . ./myread
6173 case "$ans" in
6174 y|Y)    val="$define" ;;
6175 *)      val="$undef"  ;;
6176 esac
6177 set userelocatableinc
6178 eval $setvar
6179
6180 initialinstalllocation="$binexp"
6181 : Default prefix is now "up one level from where the binaries are"
6182 case "$userelocatableinc" in
6183 $define|true|[yY]*)
6184     bin=".../"
6185     binexp=".../"
6186     prefix=".../.."
6187     prefixexp=".../.."
6188     installprefixexp=".../.."
6189     ;;
6190 esac
6191
6192 : determine where private library files go
6193 : Usual default is /usr/local/lib/perl5/$version.
6194 : Also allow things like /opt/perl/lib/$version, since
6195 : /opt/perl/lib/perl5... would be redundant.
6196 : The default "style" setting is made in installstyle.U
6197 case "$installstyle" in
6198 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6199 *)       set dflt privlib lib/$version ;;
6200 esac
6201 eval $prefixit
6202 $cat <<EOM
6203
6204 There are some auxiliary files for $package that need to be put into a
6205 private library directory that is accessible by everyone.
6206
6207 EOM
6208 fn=$binexp
6209 fn=d~+
6210 rp='Pathname where the private library files will reside?'
6211 . ./getfile
6212 prefixvar=privlib
6213 . ./setprefixvar
6214
6215 : set the prefixup variable, to restore leading tilda escape
6216 prefixup='case "$prefixexp" in
6217 "$prefix") ;;
6218 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6219 esac'
6220
6221 : determine where public architecture dependent libraries go
6222 set archlib archlib
6223 eval $prefixit
6224 : privlib default is /usr/local/lib/$package/$version
6225 : archlib default is /usr/local/lib/$package/$version/$archname
6226 : privlib may have an optional trailing /share.
6227 tdflt=`echo $privlib | $sed 's,/share$,,'`
6228 tdflt=$tdflt/$archname
6229 case "$archlib" in
6230 '')     dflt=$tdflt
6231         ;;
6232 *)      dflt="$archlib"
6233     ;;
6234 esac
6235 $cat <<EOM
6236
6237 $spackage contains architecture-dependent library files.  If you are
6238 sharing libraries in a heterogeneous environment, you might store
6239 these files in a separate location.  Otherwise, you can just include
6240 them with the rest of the public library files.
6241
6242 EOM
6243 fn=$binexp
6244 fn=d+~
6245 rp='Where do you want to put the public architecture-dependent libraries?'
6246 . ./getfile
6247 prefixvar=archlib
6248 . ./setprefixvar
6249 if $test X"$archlib" = X"$privlib"; then
6250         d_archlib="$undef"
6251 else
6252         d_archlib="$define"
6253 fi
6254
6255 : see if setuid scripts can be secure
6256 $cat <<EOM
6257
6258 Some kernels have a bug that prevents setuid #! scripts from being
6259 secure.  Some sites have disabled setuid #! scripts because of this.
6260
6261 First let's decide if your kernel supports secure setuid #! scripts.
6262 (If setuid #! scripts would be secure but have been disabled anyway,
6263 don't say that they are secure if asked.)
6264
6265 EOM
6266
6267 val="$undef"
6268 if $test -d /dev/fd; then
6269         echo "#!$ls" >reflect
6270         chmod +x,u+s reflect
6271         ./reflect >flect 2>&1
6272         if $contains "/dev/fd" flect >/dev/null; then
6273                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6274                 val="$define"
6275         else
6276                 $cat <<EOM
6277 If you are not sure if they are secure, I can check but I'll need a
6278 username and password different from the one you are using right now.
6279 If you don't have such a username or don't want me to test, simply
6280 enter 'none'.
6281
6282 EOM
6283                 rp='Other username to test security of setuid scripts with?'
6284                 dflt='none'
6285                 . ./myread
6286                 case "$ans" in
6287                 n|none)
6288                         case "$d_suidsafe" in
6289                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6290                                 dflt=n;;
6291                         "$undef")
6292                                 echo "Well, the $hint value is *not* secure." >&4
6293                                 dflt=n;;
6294                         *)      echo "Well, the $hint value *is* secure." >&4
6295                                 dflt=y;;
6296                         esac
6297                         ;;
6298                 *)
6299                         $rm -f reflect flect
6300                         echo "#!$ls" >reflect
6301                         chmod +x,u+s reflect
6302                         echo >flect
6303                         chmod a+w flect
6304                         echo '"su" will (probably) prompt you for '"$ans's password."
6305                         su $ans -c './reflect >flect'
6306                         if $contains "/dev/fd" flect >/dev/null; then
6307                                 echo "Okay, it looks like setuid scripts are secure." >&4
6308                                 dflt=y
6309                         else
6310                                 echo "I don't think setuid scripts are secure." >&4
6311                                 dflt=n
6312                         fi
6313                         ;;
6314                 esac
6315                 rp='Does your kernel have *secure* setuid scripts?'
6316                 . ./myread
6317                 case "$ans" in
6318                 [yY]*)  val="$define";;
6319                 *)      val="$undef";;
6320                 esac
6321         fi
6322 else
6323         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6324         echo "(That's for file descriptors, not floppy disks.)"
6325         val="$undef"
6326 fi
6327 set d_suidsafe
6328 eval $setvar
6329
6330 $rm -f reflect flect
6331
6332 : now see if they want to do setuid emulation
6333 echo " "
6334 val="$undef"
6335 case "$d_suidsafe" in
6336 "$define")
6337         val="$undef"
6338         echo "No need to emulate SUID scripts since they are secure here." >&4
6339         ;;
6340 *)
6341         $cat <<EOM
6342 Some systems have disabled setuid scripts, especially systems where
6343 setuid scripts cannot be secure.  On systems where setuid scripts have
6344 been disabled, the setuid/setgid bits on scripts are currently
6345 useless.  It is possible for $package to detect those bits and emulate
6346 setuid/setgid in a secure fashion.  This emulation will only work if
6347 setuid scripts have been disabled in your kernel.
6348
6349 EOM
6350         case "$d_dosuid" in
6351         "$define") dflt=y ;;
6352         *) dflt=n ;;
6353         esac
6354         rp="Do you want to do setuid/setgid emulation?"
6355         . ./myread
6356         case "$ans" in
6357         [yY]*)  val="$define";;
6358         *)      val="$undef";;
6359         esac
6360         ;;
6361 esac
6362 set d_dosuid
6363 eval $setvar
6364
6365 : Find perl5.005 or later.
6366 echo "Looking for a previously installed perl5.005 or later... "
6367 case "$perl5" in
6368 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6369                 : Check if this perl is recent and can load a simple module
6370                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6371                         perl5=$tdir/perl
6372                         break;
6373                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6374                         perl5=$tdir/perl5
6375                         break;
6376                 fi
6377         done
6378         ;;
6379 *)      perl5="$perl5"
6380         ;;
6381 esac
6382 case "$perl5" in
6383 '')     echo "None found.  That's ok.";;
6384 *)      echo "Using $perl5." ;;
6385 esac
6386
6387 : Set the siteprefix variables
6388 $cat <<EOM
6389
6390 After $package is installed, you may wish to install various
6391 add-on modules and utilities.  Typically, these add-ons will
6392 be installed under $prefix with the rest
6393 of this package.  However, you may wish to install such add-ons
6394 elsewhere under a different prefix.
6395
6396 If you do not wish to put everything under a single prefix, that's
6397 ok.  You will be prompted for the individual locations; this siteprefix
6398 is only used to suggest the defaults.
6399
6400 The default should be fine for most people.
6401
6402 EOM
6403 fn=d~+
6404 rp='Installation prefix to use for add-on modules and utilities?'
6405 : XXX Here might be another good place for an installstyle setting.
6406 case "$siteprefix" in
6407 '') dflt=$prefix ;;
6408 *)  dflt=$siteprefix ;;
6409 esac
6410 . ./getfile
6411 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6412 oldsiteprefix=''
6413 case "$siteprefix" in
6414 '') ;;
6415 *)      case "$ans" in
6416         "$prefix") ;;
6417         *) oldsiteprefix="$prefix";;
6418         esac
6419         ;;
6420 esac
6421 siteprefix="$ans"
6422 siteprefixexp="$ansexp"
6423
6424 : determine where site specific libraries go.
6425 : Usual default is /usr/local/lib/perl5/site_perl/$version
6426 : The default "style" setting is made in installstyle.U
6427 : XXX No longer works with Prefixit stuff.
6428 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6429 case "$sitelib" in
6430 '') case "$installstyle" in
6431         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6432         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6433         esac
6434         ;;
6435 *)      dflt="$sitelib"
6436         ;;
6437 esac
6438 $cat <<EOM
6439
6440 The installation process will create a directory for
6441 site-specific extensions and modules.  Most users find it convenient
6442 to place all site-specific files in this directory rather than in the
6443 main distribution directory.
6444
6445 EOM
6446 fn=d~+
6447 rp='Pathname for the site-specific library files?'
6448 . ./getfile
6449 prefixvar=sitelib
6450 . ./setprefixvar
6451 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6452
6453 : Determine list of previous versions to include in @INC
6454 $cat > getverlist <<EOPL
6455 #!$perl5 -w
6456 use File::Basename;
6457 \$api_versionstring = "$api_versionstring";
6458 \$version = "$version";
6459 \$stem = "$sitelib_stem";
6460 \$archname = "$archname";
6461 EOPL
6462         $cat >> getverlist <<'EOPL'
6463 # The list found is store twice for each entry: the original name, and
6464 # the binary broken down version as pack "sss", so sorting is easy and
6465 # unambiguous. This will work for all versions that have a maximum of
6466 # three digit groups, separate by '.'s or '_'s. Names are extended with
6467 # ".0.0" to ensure at least three elements for the pack.
6468 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6469
6470 # Can't have leading @ because metaconfig interprets it as a command!
6471 ;@inc_version_list=();
6472 # XXX Redo to do opendir/readdir?
6473 if (-d $stem) {
6474     chdir($stem);
6475     ;@candidates = map {
6476         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6477 }
6478 else {
6479     ;@candidates = ();
6480 }
6481
6482 ($pversion, $aversion, $vsn5005) = map {
6483     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6484 foreach $d (@candidates) {
6485     if ($d->[1] lt $pversion) {
6486         if ($d->[1] ge $aversion) {
6487             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6488         }
6489         elsif ($d->[1] ge $vsn5005) {
6490             unshift(@inc_version_list, grep { -d } $d->[0]);
6491         }
6492     }
6493     else {
6494         # Skip newer version.  I.e. don't look in
6495         # 5.7.0 if we're installing 5.6.1.
6496     }
6497 }
6498
6499 if (@inc_version_list) {
6500     print join(' ', @inc_version_list);
6501 }
6502 else {
6503     # Blank space to preserve value for next Configure run.
6504     print " ";
6505 }
6506 EOPL
6507 chmod +x getverlist
6508 case "$inc_version_list" in
6509 '')     if test -x "$perl5$exe_ext"; then
6510                 dflt=`$perl5 getverlist`
6511         else
6512                 dflt='none'
6513         fi
6514         ;;
6515 $undef) dflt='none' ;;
6516 *)  eval dflt=\"$inc_version_list\" ;;
6517 esac
6518 case "$dflt" in
6519 ''|' ') dflt=none ;;
6520 esac
6521 case "$dflt" in
6522 5.005) dflt=none ;;
6523 esac
6524 $cat <<EOM
6525
6526 In order to ease the process of upgrading, this version of perl
6527 can be configured to use modules built and installed with earlier
6528 versions of perl that were installed under $prefix.  Specify here
6529 the list of earlier versions that this version of perl should check.
6530 If Configure detected no earlier versions of perl installed under
6531 $prefix, then the list will be empty.  Answer 'none' to tell perl
6532 to not search earlier versions.
6533
6534 The default should almost always be sensible, so if you're not sure,
6535 just accept the default.
6536 EOM
6537
6538 rp='List of earlier versions to include in @INC?'
6539 . ./myread
6540 case "$ans" in
6541 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6542 *) inc_version_list="$ans" ;;
6543 esac
6544 case "$inc_version_list" in
6545 ''|' ')
6546         inc_version_list_init='0'
6547         d_inc_version_list="$undef"
6548         ;;
6549 *)      inc_version_list_init=`echo $inc_version_list |
6550                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6551         d_inc_version_list="$define"
6552         ;;
6553 esac
6554 $rm -f getverlist
6555
6556 : see if this is a malloc.h system
6557 : we want a real compile instead of Inhdr because some systems have a
6558 : malloc.h that just gives a compile error saying to use stdlib.h instead
6559 echo " "
6560 $cat >try.c <<EOCP
6561 #include <stdlib.h>
6562 #include <malloc.h>
6563 int main () { return 0; }
6564 EOCP
6565 set try
6566 if eval $compile; then
6567     echo "<malloc.h> found." >&4
6568     val="$define"
6569 else
6570     echo "<malloc.h> NOT found." >&4
6571     val="$undef"
6572 fi
6573 $rm_try
6574 set i_malloc
6575 eval $setvar
6576
6577 : check for void type
6578 echo " "
6579 echo "Checking to see how well your C compiler groks the void type..." >&4
6580 case "$voidflags" in
6581 '')
6582         $cat >try.c <<EOCP
6583 #$i_stdlib I_STDLIB
6584 #ifdef I_STDLIB
6585 #include <stdlib.h>
6586 #endif
6587 #if TRY & 1
6588 void sub() {
6589 #else
6590 sub() {
6591 #endif
6592         extern void moo();      /* function returning void */
6593         void (*goo)();          /* ptr to func returning void */
6594 #if TRY & 8
6595         void *hue;              /* generic ptr */
6596 #endif
6597 #if TRY & 2
6598         void (*foo[10])();
6599 #endif
6600
6601 #if TRY & 4
6602         if(goo == moo) {
6603                 exit(0);
6604         }
6605 #endif
6606         exit(0);
6607 }
6608 int main() { sub(); }
6609 EOCP
6610         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6611                 voidflags=$defvoidused
6612         echo "Good.  It appears to support void to the level $package wants.">&4
6613                 if $contains warning .out >/dev/null 2>&1; then
6614                         echo "However, you might get some warnings that look like this:"
6615                         $cat .out
6616                 fi
6617         else
6618 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6619                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6620                         echo "It supports 1..."
6621                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6622                                 echo "It also supports 2..."
6623                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6624                                         voidflags=7
6625                                         echo "And it supports 4 but not 8 definitely."
6626                                 else
6627                                         echo "It doesn't support 4..."
6628                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6629                                                 voidflags=11
6630                                                 echo "But it supports 8."
6631                                         else
6632                                                 voidflags=3
6633                                                 echo "Neither does it support 8."
6634                                         fi
6635                                 fi
6636                         else
6637                                 echo "It does not support 2..."
6638                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6639                                         voidflags=13
6640                                         echo "But it supports 4 and 8."
6641                                 else
6642                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6643                                                 voidflags=5
6644                                                 echo "And it supports 4 but has not heard about 8."
6645                                         else
6646                                                 echo "However it supports 8 but not 4."
6647                                         fi
6648                                 fi
6649                         fi
6650                 else
6651                         echo "There is no support at all for void."
6652                         voidflags=0
6653                 fi
6654         fi
6655 esac
6656 case "$voidflags" in
6657 "$defvoidused") ;;
6658 *)      $cat >&4 <<'EOM'
6659   Support flag bits are:
6660     1: basic void declarations.
6661     2: arrays of pointers to functions returning void.
6662     4: operations between pointers to and addresses of void functions.
6663     8: generic void pointers.
6664 EOM
6665         dflt="$voidflags";
6666         rp="Your void support flags add up to what?"
6667         . ./myread
6668         voidflags="$ans"
6669         ;;
6670 esac
6671 $rm_try
6672
6673 : check for length of pointer
6674 echo " "
6675 case "$ptrsize" in
6676 '')
6677         echo "Checking to see how big your pointers are..." >&4
6678         if test "$voidflags" -gt 7; then
6679                 echo '#define VOID_PTR char *' > try.c
6680         else
6681                 echo '#define VOID_PTR void *' > try.c
6682         fi
6683         $cat >>try.c <<EOCP
6684 #include <stdio.h>
6685 #$i_stdlib I_STDLIB
6686 #ifdef I_STDLIB
6687 #include <stdlib.h>
6688 #endif
6689 int main()
6690 {
6691     printf("%d\n", (int)sizeof(VOID_PTR));
6692     exit(0);
6693 }
6694 EOCP
6695         set try
6696         if eval $compile_ok; then
6697                 ptrsize=`$run ./try`
6698                 echo "Your pointers are $ptrsize bytes long."
6699         else
6700                 dflt='4'
6701                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6702                 rp="What is the size of a pointer (in bytes)?"
6703                 . ./myread
6704                 ptrsize="$ans"
6705         fi
6706         ;;
6707 esac
6708 $rm_try
6709 case "$use64bitall" in
6710 "$define"|true|[yY]*)
6711         case "$ptrsize" in
6712         4)      cat <<EOM >&4
6713
6714 *** You have chosen a maximally 64-bit build,
6715 *** but your pointers are only 4 bytes wide.
6716 *** Please rerun Configure without -Duse64bitall.
6717 EOM
6718                 case "$d_quad" in
6719                 define)
6720                         cat <<EOM >&4
6721 *** Since you have quads, you could possibly try with -Duse64bitint.
6722 EOM
6723                         ;;
6724                 esac
6725                 cat <<EOM >&4
6726 *** Cannot continue, aborting.
6727
6728 EOM
6729
6730                 exit 1
6731                 ;;
6732         esac
6733         ;;
6734 esac
6735
6736
6737 : determine whether to use malloc wrapping
6738 echo " "
6739 case "$usemallocwrap" in
6740 [yY]*|true|$define)     dflt='y' ;;
6741 [nN]*|false|$undef)     dflt='n' ;;
6742 *)      case "$usedevel" in
6743         [yY]*|true|$define)     dflt='y' ;;
6744         *) dflt='n' ;;
6745         esac
6746         ;;
6747 esac
6748 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6749 . ./myread
6750 usemallocwrap="$ans"
6751 case "$ans" in
6752 y*|true)
6753         usemallocwrap="$define" ;;
6754 *)
6755         usemallocwrap="$undef" ;;
6756 esac
6757
6758 : determine which malloc to compile in
6759 echo " "
6760 case "$usemymalloc" in
6761 [yY]*|true|$define)     dflt='y' ;;
6762 [nN]*|false|$undef)     dflt='n' ;;
6763 *)      case "$ptrsize" in
6764         4) dflt='y' ;;
6765         *) dflt='n' ;;
6766         esac
6767         ;;
6768 esac
6769 rp="Do you wish to attempt to use the malloc that comes with $package?"
6770 . ./myread
6771 usemymalloc="$ans"
6772 case "$ans" in
6773 y*|true)
6774         usemymalloc='y'
6775         mallocsrc='malloc.c'
6776         mallocobj="malloc$_o"
6777         d_mymalloc="$define"
6778         case "$libs" in
6779         *-lmalloc*)
6780                 : Remove malloc from list of libraries to use
6781                 echo "Removing unneeded -lmalloc from library list" >&4
6782                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6783                 shift
6784                 libs="$*"
6785                 echo "libs = $libs" >&4
6786                 ;;
6787         esac
6788         ;;
6789 *)
6790         usemymalloc='n'
6791         mallocsrc=''
6792         mallocobj=''
6793         d_mymalloc="$undef"
6794         ;;
6795 esac
6796
6797 : compute the return types of malloc and free
6798 echo " "
6799 $cat >malloc.c <<END
6800 #$i_malloc I_MALLOC
6801 #$i_stdlib I_STDLIB
6802 #include <stdio.h>
6803 #include <sys/types.h>
6804 #ifdef I_MALLOC
6805 #include <malloc.h>
6806 #endif
6807 #ifdef I_STDLIB
6808 #include <stdlib.h>
6809 #endif
6810 #ifdef TRY_MALLOC
6811 void *malloc();
6812 #endif
6813 #ifdef TRY_FREE
6814 void free();
6815 #endif
6816 END
6817 case "$malloctype" in
6818 '')
6819         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6820                 malloctype='void *'
6821         else
6822                 malloctype='char *'
6823         fi
6824         ;;
6825 esac
6826 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6827
6828 case "$freetype" in
6829 '')
6830         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6831                 freetype='void'
6832         else
6833                 freetype='int'
6834         fi
6835         ;;
6836 esac
6837 echo "Your system uses $freetype free(), it would seem." >&4
6838 $rm -f malloc.[co]
6839 : determine where site specific architecture-dependent libraries go.
6840 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6841 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6842 : sitelib may have an optional trailing /share.
6843 case "$sitearch" in
6844 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6845         dflt="$dflt/$archname"
6846         ;;
6847 *)      dflt="$sitearch"
6848         ;;
6849 esac
6850 set sitearch sitearch none
6851 eval $prefixit
6852 $cat <<EOM
6853
6854 The installation process will also create a directory for
6855 architecture-dependent site-specific extensions and modules.
6856
6857 EOM
6858 fn=d~+
6859 rp='Pathname for the site-specific architecture-dependent library files?'
6860 . ./getfile
6861 prefixvar=sitearch
6862 . ./setprefixvar
6863 if $test X"$sitearch" = X"$sitelib"; then
6864         d_sitearch="$undef"
6865 else
6866         d_sitearch="$define"
6867 fi
6868
6869 : Set the vendorprefix variables
6870 $cat <<EOM
6871
6872 The installation process will also create a directory for
6873 vendor-supplied add-ons.  Vendors who supply perl with their system
6874 may find it convenient to place all vendor-supplied files in this
6875 directory rather than in the main distribution directory.  This will
6876 ease upgrades between binary-compatible maintenance versions of perl.
6877
6878 Of course you may also use these directories in whatever way you see
6879 fit.  For example, you might use them to access modules shared over a
6880 company-wide network.
6881
6882 The default answer should be fine for most people.
6883 This causes further questions about vendor add-ons to be skipped
6884 and no vendor-specific directories will be configured for perl.
6885
6886 EOM
6887 rp='Do you want to configure vendor-specific add-on directories?'
6888 case "$usevendorprefix" in
6889 define|true|[yY]*) dflt=y ;;
6890 *)      : User may have set vendorprefix directly on Configure command line.
6891         case "$vendorprefix" in
6892         ''|' ') dflt=n ;;
6893         *)      dflt=y ;;
6894         esac
6895         ;;
6896 esac
6897 . ./myread
6898 case "$ans" in
6899 [yY]*)  fn=d~+
6900         rp='Installation prefix to use for vendor-supplied add-ons?'
6901         case "$vendorprefix" in
6902         '') dflt='' ;;
6903         *)  dflt=$vendorprefix ;;
6904         esac
6905         . ./getfile
6906         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6907         oldvendorprefix=''
6908         case "$vendorprefix" in
6909         '') ;;
6910         *)      case "$ans" in
6911                 "$prefix") ;;
6912                 *) oldvendorprefix="$prefix";;
6913                 esac
6914                 ;;
6915         esac
6916         usevendorprefix="$define"
6917         vendorprefix="$ans"
6918         vendorprefixexp="$ansexp"
6919         ;;
6920 *)      usevendorprefix="$undef"
6921         vendorprefix=''
6922         vendorprefixexp=''
6923         ;;
6924 esac
6925
6926 : Set the vendorlib variables
6927 case "$vendorprefix" in
6928 '')     d_vendorlib="$undef"
6929         vendorlib=''
6930         vendorlibexp=''
6931         ;;
6932 *)      d_vendorlib="$define"
6933         : determine where vendor-supplied modules go.
6934         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6935         case "$vendorlib" in
6936         '')
6937                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6938                 case "$installstyle" in
6939                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6940                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6941                 esac
6942                 ;;
6943         *)      dflt="$vendorlib"
6944                 ;;
6945         esac
6946         fn=d~+
6947         rp='Pathname for the vendor-supplied library files?'
6948         . ./getfile
6949         vendorlib="$ans"
6950         vendorlibexp="$ansexp"
6951         ;;
6952 esac
6953 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6954 prefixvar=vendorlib
6955 . ./installprefix
6956
6957 : Set the vendorarch variables
6958 case "$vendorprefix" in
6959 '')     d_vendorarch="$undef"
6960         vendorarch=''
6961         vendorarchexp=''
6962         ;;
6963 *)      d_vendorarch="$define"
6964         : determine where vendor-supplied architecture-dependent libraries go.
6965         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6966         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6967         : vendorlib may have an optional trailing /share.
6968         case "$vendorarch" in
6969         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6970                 dflt="$dflt/$archname"
6971                 ;;
6972         *)      dflt="$vendorarch" ;;
6973         esac
6974         fn=d~+
6975         rp='Pathname for vendor-supplied architecture-dependent files?'
6976         . ./getfile
6977         vendorarch="$ans"
6978         vendorarchexp="$ansexp"
6979         ;;
6980 esac
6981 prefixvar=vendorarch
6982 . ./installprefix
6983
6984 : Final catch-all directories to search
6985 $cat <<EOM
6986
6987 Lastly, you can have perl look in other directories for extensions and
6988 modules in addition to those already specified.
6989 These directories will be searched after 
6990         $sitearch 
6991         $sitelib 
6992 EOM
6993 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6994 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6995 echo ' '
6996 case "$otherlibdirs" in
6997 ''|' ') dflt='none' ;;
6998 *)      dflt="$otherlibdirs" ;;
6999 esac
7000 $cat <<EOM
7001 Enter a colon-separated set of extra paths to include in perl's @INC
7002 search path, or enter 'none' for no extra paths.
7003
7004 EOM
7005
7006 rp='Colon-separated list of additional directories for perl to search?'
7007 . ./myread
7008 case "$ans" in
7009 ' '|''|none)    otherlibdirs=' ' ;;     
7010 *)      otherlibdirs="$ans" ;;
7011 esac
7012 case "$otherlibdirs" in
7013 ' ') val=$undef ;;
7014 *)      val=$define ;;
7015 esac
7016 set d_perl_otherlibdirs
7017 eval $setvar
7018
7019 : Cruising for prototypes
7020 echo " "
7021 echo "Checking out function prototypes..." >&4
7022 $cat >prototype.c <<EOCP
7023 #$i_stdlib I_STDLIB
7024 #ifdef I_STDLIB
7025 #include <stdlib.h>
7026 #endif
7027 int main(int argc, char *argv[]) {
7028         exit(0);}
7029 EOCP
7030 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7031         echo "Your C compiler appears to support function prototypes."
7032         val="$define"
7033 else
7034         echo "Your C compiler doesn't seem to understand function prototypes."
7035         val="$undef"
7036 fi
7037 set prototype
7038 eval $setvar
7039 $rm -f prototype*
7040
7041 : Check if ansi2knr is required
7042 case "$prototype" in
7043 "$define") ;;
7044 *)      ansi2knr='ansi2knr'
7045         echo " "
7046         cat <<EOM >&4
7047
7048 $me:  FATAL ERROR:
7049 This version of $package can only be compiled by a compiler that 
7050 understands function prototypes.  Unfortunately, your C compiler 
7051         $cc $ccflags
7052 doesn't seem to understand them.  Sorry about that.
7053
7054 If GNU cc is available for your system, perhaps you could try that instead.  
7055
7056 Eventually, we hope to support building Perl with pre-ANSI compilers.
7057 If you would like to help in that effort, please contact <perlbug@perl.org>.
7058
7059 Aborting Configure now.
7060 EOM
7061         exit 2
7062         ;;
7063 esac
7064
7065 : DTrace support
7066 dflt_dtrace='/usr/sbin/dtrace'
7067 cat <<EOM
7068
7069 Perl can be built to support DTrace on platforms that support it.
7070 DTrace is a diagnosis and performance analysis tool from Sun.
7071
7072 If this doesn't make any sense to you, just accept the default '$dflt'.
7073 EOM
7074
7075 while $test 1 ; do
7076         case "$usedtrace" in
7077         $define|true|[yY]*)
7078                 dflt='y'
7079                 ;;
7080         ?*)
7081                 dflt='y'
7082                 dflt_dtrace=$usedtrace
7083                 ;;
7084         *)
7085                 dflt='n'
7086                 ;;
7087         esac
7088
7089         rp='Support DTrace if available?'
7090         . ./myread
7091         case "$ans" in
7092         y|Y)    val="$define" ;;
7093         *)      val="$undef" ;;
7094         esac
7095         set usedtrace
7096         eval $setvar
7097
7098         test "X$usedtrace" != "X$define" && break
7099
7100         echo " "
7101         rp='Where is the dtrace executable?'
7102         dflt=$dflt_dtrace
7103         . ./getfile
7104         val="$ans"
7105         set dtrace
7106         eval $setvar
7107
7108         if $test -f $dtrace
7109         then
7110                 if $dtrace -h -s ../perldtrace.d \
7111                         -o perldtrace.tmp >/dev/null 2>&1 \
7112                         && rm -f perldtrace.tmp
7113                 then
7114                         echo " "
7115                         echo "Good: your $dtrace knows about the -h flag."
7116                 else
7117                         cat >&2 <<EOM
7118
7119 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7120 ***
7121 *** Your installed dtrace doesn't support the -h switch to compile a D
7122 *** program into a C header. Can't continue.
7123
7124 EOM
7125                         exit 1
7126                 fi
7127                 break;
7128         fi
7129
7130         case "$fastread" in
7131         yes)
7132                 cat >&2 <<EOM
7133
7134 *** $me:  Fatal Error:  $dtrace not found.
7135 *** Can't continue.
7136
7137 EOM
7138                 exit 1
7139                 ;;
7140         *)
7141                 echo "*** $dtrace was not found."
7142                 echo " "
7143                 ;;
7144         esac
7145 done
7146
7147 : See if we want extra modules installed
7148 echo " "
7149 case "$extras" in
7150 '') dflt='n';;
7151 *) dflt='y';;
7152 esac
7153 cat <<EOM
7154 Perl can be built with extra modules or bundles of modules which
7155 will be fetched from the CPAN and installed alongside Perl.
7156
7157 Notice that you will need access to the CPAN; either via the Internet,
7158 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7159 be asked later to configure the CPAN.pm module which will in turn do
7160 the installation of the rest of the extra modules or bundles.)
7161
7162 Notice also that if the modules require any external software such as
7163 libraries and headers (the libz library and the zlib.h header for the
7164 Compress::Zlib module, for example) you MUST have any such software
7165 already installed, this configuration process will NOT install such
7166 things for you.
7167
7168 If this doesn't make any sense to you, just accept the default '$dflt'.
7169 EOM
7170 rp='Install any extra modules (y or n)?'
7171 . ./myread
7172 case "$ans" in
7173 y|Y)
7174         cat <<EOM
7175
7176 Please list any extra modules or bundles to be installed from CPAN,
7177 with spaces between the names.  The names can be in any format the
7178 'install' command of CPAN.pm will understand.  (Answer 'none',
7179 without the quotes, to install no extra modules or bundles.)
7180 EOM
7181         rp='Extras?'
7182         dflt="$extras"
7183         . ./myread
7184         extras="$ans"
7185 esac
7186 case "$extras" in
7187 ''|'none')
7188         val=''
7189         $rm -f ../extras.lst
7190         ;;
7191 *)      echo "(Saving the list of extras for later...)"
7192         echo "$extras" > ../extras.lst
7193         val="'$extras'"
7194         ;;
7195 esac
7196 set extras
7197 eval $setvar
7198 echo " "
7199
7200 : determine where html pages for programs go
7201 set html1dir html1dir none
7202 eval $prefixit
7203 $cat <<EOM
7204
7205 If you wish to install html files for programs in $spackage, indicate
7206 the appropriate directory here.  To skip installing html files,
7207 answer "none".
7208 EOM
7209 case "$html1dir" in
7210 ''|none|$undef|' ') dflt=none ;;
7211 *) dflt=$html1dir ;;
7212 esac
7213 fn=dn+~
7214 rp="Directory for the main $spackage html pages?"
7215 . ./getfile
7216 prefixvar=html1dir
7217 . ./setprefixvar
7218 : Use ' ' for none so value is preserved next time through Configure
7219 $test X"$html1dir" = "X" && html1dir=' '
7220
7221 : determine where html pages for libraries and modules go
7222 set html3dir html3dir none
7223 eval $prefixit
7224 $cat <<EOM
7225
7226 If you wish to install html files for modules associated with $spackage,
7227 indicate the appropriate directory here.  To skip installing html files,
7228 answer "none".
7229 EOM
7230 : There is no obvious default.  If they have specified html1dir, then
7231 : try to key off that, possibly changing .../html1 into .../html3.
7232 case "$html3dir" in
7233 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7234 *) dflt=$html3dir ;;
7235 esac
7236 fn=dn+~
7237 rp="Directory for the $spackage module html pages?"
7238 . ./getfile
7239 prefixvar=html3dir
7240 . ./setprefixvar
7241 : Use ' ' for none so value is preserved next time through Configure
7242 $test X"$html3dir" = "X" && html3dir=' '
7243
7244 : determine whether to install perl also as /usr/bin/perl
7245
7246 echo " "
7247 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7248         $cat <<EOM
7249 Many scripts expect perl to be installed as /usr/bin/perl.
7250
7251 If you want to, I can install the perl you are about to compile
7252 as /usr/bin/perl (in addition to $bin/perl).
7253 EOM
7254         if test -f /usr/bin/perl; then
7255             $cat <<EOM
7256
7257 However, please note that because you already have a /usr/bin/perl,
7258 overwriting that with a new Perl would very probably cause problems.
7259 Therefore I'm assuming you don't want to do that (unless you insist).
7260
7261 EOM
7262             case "$installusrbinperl" in
7263             "$define"|[yY]*)    dflt='y';;
7264             *)                  dflt='n';;
7265             esac
7266         else
7267             $cat <<EOM
7268
7269 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7270
7271 EOM
7272             case "$installusrbinperl" in
7273             "$undef"|[nN]*)     dflt='n';;
7274             *)                  dflt='y';;
7275             esac
7276         fi
7277         rp="Do you want to install perl as /usr/bin/perl?"
7278         . ./myread
7279         case "$ans" in
7280         [yY]*)  val="$define";;
7281         *)      val="$undef" ;;
7282         esac
7283 else
7284         val="$undef"
7285 fi
7286 set installusrbinperl
7287 eval $setvar
7288
7289 : Check if we are using the GNU C library
7290 echo " "
7291 echo "Checking for GNU C Library..." >&4
7292 cat >try.c <<'EOCP'
7293 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7294    alone are insufficient to distinguish different versions, such as
7295    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7296    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7297 */
7298 #include <stdio.h>
7299 int main(void)
7300 {
7301 #ifdef __GLIBC__
7302 #   ifdef __GLIBC_MINOR__
7303 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7304 #           include <gnu/libc-version.h>
7305             printf("%s\n",  gnu_get_libc_version());
7306 #       else
7307             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7308 #       endif
7309 #   else
7310         printf("%d\n",  __GLIBC__);
7311 #   endif
7312     return 0;
7313 #else
7314     return 1;
7315 #endif
7316 }
7317 EOCP
7318 set try
7319 if eval $compile_ok && $run ./try > glibc.ver; then
7320         val="$define"
7321         gnulibc_version=`$cat glibc.ver`
7322         echo "You are using the GNU C Library version $gnulibc_version"
7323 else
7324         val="$undef"
7325         gnulibc_version=''
7326         echo "You are not using the GNU C Library"
7327 fi
7328 $rm_try glibc.ver
7329 set d_gnulibc
7330 eval $setvar
7331
7332 : see if nm is to be used to determine whether a symbol is defined or not
7333 case "$usenm" in
7334 '')
7335         dflt=''
7336         case "$d_gnulibc" in
7337         "$define")
7338                 echo " "
7339                 echo "nm probably won't work on the GNU C Library." >&4
7340                 dflt=n
7341                 ;;
7342         esac
7343         case "$dflt" in
7344         '') 
7345                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7346                         echo " "
7347                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7348                         echo "'nm' won't be sufficient on this sytem." >&4
7349                         dflt=n
7350                 fi
7351                 ;;
7352         esac
7353         case "$dflt" in
7354         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7355                 if $test $dflt -gt 20; then
7356                         dflt=y
7357                 else
7358                         dflt=n
7359                 fi
7360                 ;;
7361         esac
7362         ;;
7363 *)
7364         case "$usenm" in
7365         true|$define) dflt=y;;
7366         *) dflt=n;;
7367         esac
7368         ;;
7369 esac
7370 $cat <<EOM
7371
7372 I can use $nm to extract the symbols from your C libraries. This
7373 is a time consuming task which may generate huge output on the disk (up
7374 to 3 megabytes) but that should make the symbols extraction faster. The
7375 alternative is to skip the 'nm' extraction part and to compile a small
7376 test program instead to determine whether each symbol is present. If
7377 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7378 this may be the best solution.
7379
7380 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7381
7382 EOM
7383 rp="Shall I use $nm to extract C symbols from the libraries?"
7384 . ./myread
7385 case "$ans" in
7386 [Nn]*) usenm=false;;
7387 *) usenm=true;;
7388 esac
7389
7390 runnm=$usenm
7391 case "$reuseval" in
7392 true) runnm=false;;
7393 esac
7394
7395 : nm options which may be necessary
7396 case "$nm_opt" in
7397 '') if $test -f /mach_boot; then
7398                 nm_opt=''       # Mach
7399         elif $test -d /usr/ccs/lib; then
7400                 nm_opt='-p'     # Solaris (and SunOS?)
7401         elif $test -f /dgux; then
7402                 nm_opt='-p'     # DG-UX
7403         elif $test -f /lib64/rld; then
7404                 nm_opt='-p'     # 64-bit Irix
7405         else
7406                 nm_opt=''
7407         fi;;
7408 esac
7409
7410 : nm options which may be necessary for shared libraries but illegal
7411 : for archive libraries.  Thank you, Linux.
7412 case "$nm_so_opt" in
7413 '')     case "$myuname" in
7414         *linux*|gnu*)
7415                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7416                         nm_so_opt='--dynamic'
7417                 fi
7418                 ;;
7419         esac
7420         ;;
7421 esac
7422
7423 : get list of predefined functions in a handy place
7424 case "$runnm" in
7425 true)
7426 echo " "
7427 case "$libc" in
7428 '') libc=unknown
7429         case "$libs" in
7430         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7431         esac
7432         ;;
7433 esac
7434 case "$libs" in
7435 '') ;;
7436 *)  for thislib in $libs; do
7437         case "$thislib" in
7438         -lc|-lc_s)
7439                 : Handle C library specially below.
7440                 ;;
7441         -l*)
7442                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7443                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7444                         :
7445                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7446                         :
7447                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7448                         :
7449                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7450                         :
7451                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7452                         :
7453                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7454                         :
7455                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7456                         :
7457                 else
7458                         try=''
7459                 fi
7460                 libnames="$libnames $try"
7461                 ;;
7462         *) libnames="$libnames $thislib" ;;
7463         esac
7464         done
7465         ;;
7466 esac
7467 xxx=normal
7468 case "$libc" in
7469 unknown)
7470         set /lib/libc.$so
7471         for xxx in $libpth; do
7472                 $test -r $1 || set $xxx/libc.$so
7473                 : The messy sed command sorts on library version numbers.
7474                 $test -r $1 || \
7475                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7476                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7477                                 h
7478                                 s/[0-9][0-9]*/0000&/g
7479                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7480                                 G
7481                                 s/\n/ /' | \
7482                          $sort | $sed -e 's/^.* //'`
7483                 eval set \$$#
7484         done
7485         $test -r $1 || set /usr/ccs/lib/libc.$so
7486         $test -r $1 || set /lib/libsys_s$_a
7487         ;;
7488 *)
7489         set blurfl
7490         ;;
7491 esac
7492 if $test -r "$1"; then
7493         echo "Your (shared) C library seems to be in $1."
7494         libc="$1"
7495 elif $test -r /lib/libc && $test -r /lib/clib; then
7496         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7497         xxx=apollo
7498         libc='/lib/clib /lib/libc'
7499         if $test -r /lib/syslib; then
7500                 echo "(Your math library is in /lib/syslib.)"
7501                 libc="$libc /lib/syslib"
7502         fi
7503 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7504         echo "Your C library seems to be in $libc, as you said before."
7505 elif $test -r $incpath/usr/lib/libc$_a; then
7506         libc=$incpath/usr/lib/libc$_a;
7507         echo "Your C library seems to be in $libc.  That's fine."
7508 elif $test -r /lib/libc$_a; then
7509         libc=/lib/libc$_a;
7510         echo "Your C library seems to be in $libc.  You're normal."
7511 else
7512         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7513                 :
7514         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7515                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7516         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7517                 :
7518         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7519                 :
7520         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7521                 :
7522         else
7523                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7524         fi
7525         if $test -r "$tans"; then
7526                 echo "Your C library seems to be in $tans, of all places."
7527                 libc=$tans
7528         else
7529                 libc='blurfl'
7530         fi
7531 fi
7532 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7533         dflt="$libc"
7534         cat <<EOM
7535
7536 If the guess above is wrong (which it might be if you're using a strange
7537 compiler, or your machine supports multiple models), you can override it here.
7538
7539 EOM
7540 else
7541         dflt=''
7542         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7543         cat >&4 <<EOM
7544 I can't seem to find your C library.  I've looked in the following places:
7545
7546 EOM
7547         $sed 's/^/      /' libpath
7548         cat <<EOM
7549
7550 None of these seems to contain your C library. I need to get its name...
7551
7552 EOM
7553 fi
7554 fn=f
7555 rp='Where is your C library?'
7556 . ./getfile
7557 libc="$ans"
7558
7559 echo " "
7560 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7561 set X `cat libnames`
7562 shift
7563 xxx=files
7564 case $# in 1) xxx=file; esac
7565 echo "Extracting names from the following $xxx for later perusal:" >&4
7566 echo " "
7567 $sed 's/^/      /' libnames >&4
7568 echo " "
7569 $echo $n "This may take a while...$c" >&4
7570
7571 for file in $*; do
7572         case $file in
7573         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7574         *) $nm $nm_opt $file 2>/dev/null;;
7575         esac
7576 done >libc.tmp
7577
7578 $echo $n ".$c"
7579 $grep fprintf libc.tmp > libc.ptf
7580 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7581 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7582 xxx='[ADTSIW]'
7583 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7584         eval $xscan;\
7585         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7586                 eval $xrun
7587 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7588         eval $xscan;\
7589         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7590                 eval $xrun
7591 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7592         eval $xscan;\
7593         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7594                 eval $xrun
7595 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7596         eval $xscan;\
7597         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7598                 eval $xrun
7599 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7600         eval $xscan;\
7601         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7602                 eval $xrun
7603 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7604         eval $xscan;\
7605         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7606                 eval $xrun
7607 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7608                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7609         eval $xscan;\
7610         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7611                 eval $xrun
7612 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7613         eval $xscan;\
7614         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7615                 eval $xrun
7616 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7617         eval $xscan;\
7618         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7619                 eval $xrun
7620 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7621         eval $xscan;\
7622         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7623                 eval $xrun
7624 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7625         eval $xscan;\
7626         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7627                 eval $xrun
7628 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7629         eval $xscan;\
7630         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7631                 eval $xrun
7632 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7633         eval $xscan;\
7634         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7635                 eval $xrun
7636 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7637         eval $xscan;\
7638         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7639                 eval $xrun
7640 else
7641         $nm -p $* 2>/dev/null >libc.tmp
7642         $grep fprintf libc.tmp > libc.ptf
7643         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7644                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7645         then
7646                 nm_opt='-p'
7647                 eval $xrun
7648         else
7649                 echo " "
7650                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7651                 com=''
7652                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7653                         for thisname in $libnames $libc; do
7654                                 $ar t $thisname >>libc.tmp
7655                         done
7656                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7657                         echo "Ok." >&4
7658                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7659                         # Repeat libc to extract forwarders to DLL entries too
7660                         for thisname in $libnames $libc; do
7661                                 $ar tv $thisname >>libc.tmp
7662                                 # Revision 50 of EMX has bug in $ar.
7663                                 # it will not extract forwarders to DLL entries
7664                                 # Use emximp which will extract exactly them.
7665                                 emximp -o tmp.imp $thisname \
7666                                     2>/dev/null && \
7667                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7668                                     < tmp.imp >>libc.tmp
7669                                 $rm tmp.imp
7670                         done
7671                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7672                         echo "Ok." >&4
7673                 else
7674                         echo "$ar didn't seem to work right." >&4
7675                         echo "Maybe this is a Cray...trying bld instead..." >&4
7676                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7677                         then
7678                                 for thisname in $libnames; do
7679                                         bld t $libnames | \
7680                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7681                                         $ar t $thisname >>libc.tmp
7682                                 done
7683                                 echo "Ok." >&4
7684                         else
7685                                 echo "That didn't work either.  Giving up." >&4
7686                                 exit 1
7687                         fi
7688                 fi
7689         fi
7690 fi
7691 nm_extract="$com"
7692 case "$PASE" in
7693 define)
7694     echo " "
7695     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7696     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7697     ;;
7698 *)  if $test -f /lib/syscalls.exp; then
7699         echo " "
7700         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7701         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7702     fi
7703     ;;
7704 esac
7705 ;;
7706 esac
7707 $rm -f libnames libpath
7708
7709 : see if dld is available
7710 set dld.h i_dld
7711 eval $inhdr
7712
7713 : Check if we are using C++
7714 echo " "
7715 echo "Checking for C++..." >&4
7716 $cat >try.c <<'EOCP'
7717 #include <stdio.h>
7718 int main(void)
7719 {
7720 #ifdef __cplusplus
7721     return 0;
7722 #else
7723     return 1;
7724 #endif
7725 }
7726 EOCP
7727 set try
7728 if eval $compile_ok && $run ./try; then
7729         val="$define"
7730         echo "You are using a C++ compiler."
7731 else
7732         val="$undef"
7733         echo "You are not using a C++ compiler."
7734 fi
7735 $rm_try cplusplus$$
7736 set d_cplusplus
7737 eval $setvar
7738
7739 : is a C symbol defined?
7740 csym='tlook=$1;
7741 case "$3" in
7742 -v) tf=libc.tmp; tdc="";;
7743 -a) tf=libc.tmp; tdc="[]";;
7744 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7745 esac;
7746 tx=yes;
7747 case "$reuseval-$4" in
7748 true-) ;;
7749 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7750 esac;
7751 case "$tx" in
7752 yes)
7753         tval=false;
7754         case "$d_cplusplus" in
7755                 $define) extern_C=\"C\";;
7756         esac;
7757         if $test "$runnm" = true; then
7758                 if $contains $tlook $tf >/dev/null 2>&1; then
7759                         tval=true;
7760                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7761                         echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7762                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7763                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7764                         $rm_try;
7765                 fi;
7766         else
7767                 echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7768                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7769                 $rm_try;
7770         fi;
7771         ;;
7772 *)
7773         case "$tval" in
7774         $define) tval=true;;
7775         *) tval=false;;
7776         esac;
7777         ;;
7778 esac;
7779 eval "$2=$tval"'
7780
7781 : define an is-in-libc? function
7782 inlibc='echo " "; td=$define; tu=$undef;
7783 sym=$1; var=$2; eval "was=\$$2";
7784 tx=yes;
7785 case "$reuseval$was" in
7786 true) ;;
7787 true*) tx=no;;
7788 esac;
7789 case "$tx" in
7790 yes)
7791         set $sym tres -f;
7792         eval $csym;
7793         case "$tres" in
7794         true)
7795                 echo "$sym() found." >&4;
7796                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7797         *)
7798                 echo "$sym() NOT found." >&4;
7799                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7800         esac;;
7801 *)
7802         case "$was" in
7803         $define) echo "$sym() found." >&4;;
7804         *) echo "$sym() NOT found." >&4;;
7805         esac;;
7806 esac'
7807
7808 : see if dlopen exists
7809 xxx_runnm="$runnm"
7810 xxx_ccflags="$ccflags"
7811 runnm=false
7812 : with g++ one needs -shared to get is-in-libc to work for dlopen
7813 case "$gccversion" in
7814 '')     ;;
7815 *)      case "$d_cplusplus" in
7816         "$define") ccflags="$ccflags -shared" ;;
7817         esac
7818         ;;
7819 esac
7820 set dlopen d_dlopen
7821 eval $inlibc
7822 runnm="$xxx_runnm"
7823 ccflags="$xxx_ccflags"
7824
7825 : see if this is a unistd.h system
7826 set unistd.h i_unistd
7827 eval $inhdr
7828
7829 : determine which dynamic loading, if any, to compile in
7830 echo " "
7831 dldir="ext/DynaLoader"
7832 case "$usedl" in
7833 $define|y|true)
7834         dflt='y'
7835         usedl="$define"
7836         ;;
7837 $undef|n|false)
7838         dflt='n'
7839         usedl="$undef"
7840         ;;
7841 *)
7842         dflt='n'
7843         case "$d_dlopen" in
7844             $define) dflt='y' ;;
7845         esac
7846         case "$i_dld" in
7847             $define) dflt='y' ;;
7848         esac
7849         : Does a dl_xxx.xs file exist for this operating system
7850         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7851         ;;
7852 esac
7853 rp="Do you wish to use dynamic loading?"
7854 . ./myread
7855 usedl="$ans"
7856 case "$ans" in
7857 y*) usedl="$define"
7858         case "$dlsrc" in
7859         '')
7860                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7861                         dflt="$dldir/dl_${osname}.xs"
7862                 elif $test "$d_dlopen" = "$define" ; then
7863                         dflt="$dldir/dl_dlopen.xs"
7864                 elif $test "$i_dld" = "$define" ; then
7865                         dflt="$dldir/dl_dld.xs"
7866                 else
7867                         dflt=''
7868                 fi
7869                 ;;
7870         *)      dflt="$dldir/$dlsrc"
7871                 ;;
7872         esac
7873     echo "The following dynamic loading files are available:"
7874         : Can not go over to $dldir because getfile has path hard-coded in.
7875         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7876         rp="Source file to use for dynamic loading"
7877         fn="fne"
7878         gfpth="$src"
7879         . ./getfile
7880         usedl="$define"
7881         : emulate basename
7882         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7883
7884         $cat << EOM
7885
7886 Some systems may require passing special flags to $cc -c to
7887 compile modules that will be used to create a shared library.
7888 To use no flags, say "none".
7889
7890 EOM
7891     case "$cccdlflags" in
7892     '') case "$gccversion" in
7893                 '') case "$osname" in
7894                         hpux)   dflt='+z' ;;
7895                         next)   dflt='none' ;;
7896                         irix*)  dflt='-KPIC' ;;
7897                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7898                         sunos)  dflt='-pic' ;;
7899                         *)      dflt='none' ;;
7900                     esac
7901                         ;;
7902                 *)  case "$osname" in
7903                         darwin) dflt='none' ;;
7904                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7905                         *)      dflt='-fpic' ;;
7906                     esac ;;
7907             esac ;;
7908         ' ') dflt='none' ;;
7909     *)  dflt="$cccdlflags" ;;
7910     esac
7911     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7912     . ./myread
7913     case "$ans" in
7914     none) cccdlflags=' ' ;;
7915     *) cccdlflags="$ans" ;;
7916     esac
7917
7918     cat << EOM
7919
7920 Some systems use ld to create libraries that can be dynamically loaded,
7921 while other systems (such as those using ELF) use $cc.
7922
7923 EOM
7924         case "$ld" in
7925         '')     $cat >try.c <<EOM
7926 /* Test for whether ELF binaries are produced */
7927 #include <fcntl.h>
7928 #$i_stdlib I_STDLIB
7929 #ifdef I_STDLIB
7930 #include <stdlib.h>
7931 #endif
7932 #$i_unistd I_UNISTD
7933 #ifdef I_UNISTD
7934 #include <unistd.h>
7935 #endif
7936 int main() {
7937         char b[4];
7938         int i = open("a.out",O_RDONLY);
7939         if(i == -1)
7940                 exit(1); /* fail */
7941         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7942                 exit(0); /* succeed (yes, it's ELF) */
7943         else
7944                 exit(1); /* fail */
7945 }
7946 EOM
7947                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7948                         cat <<EOM
7949 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7950 EOM
7951                         dflt="$cc"
7952                 else
7953                         echo "I'll use ld to build dynamic libraries."
7954                         dflt='ld'
7955                 fi
7956                 $rm_try
7957                 ;;
7958         *)      dflt="$ld"
7959                 ;;
7960         esac
7961
7962     rp="What command should be used to create dynamic libraries?"
7963     . ./myread
7964         ld="$ans"
7965
7966     cat << EOM
7967
7968 Some systems may require passing special flags to $ld to create a
7969 library that can be dynamically loaded.  If your ld flags include
7970 -L/other/path options to locate libraries outside your loader's normal
7971 search path, you may need to specify those -L options here as well.  To
7972 use no flags, say "none".
7973
7974 EOM
7975     case "$lddlflags" in
7976     '') case "$osname" in
7977                         beos) dflt='-nostart' ;;
7978                         hpux) dflt='-b';
7979                               case "$gccversion" in
7980                               '') dflt="$dflt +vnocompatwarnings" ;;
7981                               esac
7982                               ;;
7983                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
7984                         next)  dflt='none' ;;
7985                         solaris) dflt='-G' ;;
7986                         sunos) dflt='-assert nodefinitions' ;;
7987                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7988                 *)     dflt='none' ;;
7989                         esac
7990                         ;;
7991     *) dflt="$lddlflags" ;;
7992     esac
7993
7994         : Try to guess additional flags to pick up local libraries.
7995         : Be careful not to append to a plain 'none'
7996         case "$dflt" in
7997         none) dflt='' ;;
7998         esac
7999         for thisflag in $ldflags; do
8000                 case "$thisflag" in
8001                 -L*|-R*|-Wl,-R*)
8002                         case " $dflt " in
8003                         *" $thisflag "*) ;;
8004                         *) dflt="$dflt $thisflag" ;;
8005                         esac
8006                         ;;
8007                 esac
8008         done
8009
8010         case "$dflt" in
8011         ''|' ') dflt='none' ;;
8012         esac
8013
8014     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8015     . ./myread
8016     case "$ans" in
8017     none) lddlflags=' ' ;;
8018     *) lddlflags="$ans" ;;
8019     esac
8020
8021         cat <<EOM
8022
8023 Some systems may require passing special flags to $cc to indicate that
8024 the resulting executable will use dynamic linking.  To use no flags,
8025 say "none".
8026
8027 EOM
8028     case "$ccdlflags" in
8029     '') case "$osname" in
8030             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8031             next|sunos) dflt='none' ;;
8032             *)          dflt='none' ;;
8033             esac ;;
8034     ' ')  dflt='none' ;;
8035     *)  dflt="$ccdlflags" ;;
8036     esac
8037     rp="Any special flags to pass to $cc to use dynamic linking?"
8038     . ./myread
8039     case "$ans" in
8040     none) ccdlflags=' ' ;;
8041     *) ccdlflags="$ans" ;;
8042     esac
8043     ;;
8044 *)  usedl="$undef"
8045         ld='ld'
8046     dlsrc='dl_none.xs'
8047     lddlflags=''
8048     ccdlflags=''
8049     ;;
8050 esac
8051
8052 : Do we want a shared libperl?
8053 also=''
8054 case "$usedl" in
8055 $undef)
8056         # No dynamic loading being used, so don't bother even to prompt.
8057         useshrplib='false'
8058         ;;
8059 *)      case "$useshrplib" in
8060         '')     case "$osname" in
8061                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
8062                         dflt=y
8063                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8064                         ;;
8065                 next*)
8066                         case "$osvers" in
8067                         4*)     dflt=y
8068                                 also='Building a shared libperl is needed for MAB support.'
8069                                 ;;
8070                         *)      dflt=n
8071                                 ;;
8072                         esac
8073                         ;;
8074                 *)      dflt=n
8075                         ;;
8076                 esac
8077                 ;;
8078         $define|true|[Yy]*)
8079                 dflt=y
8080                 ;;
8081         *)      dflt=n
8082                 ;;
8083         esac
8084         $cat << EOM
8085
8086 The perl executable is normally obtained by linking perlmain.c with
8087 libperl${_a}, any static extensions (usually just DynaLoader), and
8088 any other libraries needed on this system (such as -lm, etc.).  Since
8089 your system supports dynamic loading, it is probably possible to build
8090 a shared libperl.$so.  If you will have more than one executable linked
8091 to libperl.$so, this will significantly reduce the size of each
8092 executable, but it may have a noticeable effect on performance.  The
8093 default is probably sensible for your system.
8094 $also
8095
8096 EOM
8097         rp="Build a shared libperl.$so (y/n)"
8098         . ./myread
8099         case "$ans" in
8100         true|$define|[Yy]*)
8101                 useshrplib='true'  ;;
8102         *)      useshrplib='false' ;;
8103         esac
8104         ;;
8105 esac
8106
8107 case "$useshrplib" in
8108 true)
8109         case "$libperl" in
8110         '')
8111                 # Figure out a good name for libperl.so.  Since it gets stored in
8112                 # a version-specific architecture-dependent library, the version
8113                 # number isn't really that important, except for making cc/ld happy.
8114                 #
8115                 # A name such as libperl.so.3.1
8116                 majmin="libperl.$so.$patchlevel.$subversion"
8117                 # A name such as libperl.so.301
8118                 majonly=`echo $patchlevel $subversion |
8119                         $awk '{printf "%d%02d", $1, $2}'`
8120                 majonly=libperl.$so.$majonly
8121                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8122                 # rely on figuring it out from the naming of libc.
8123                 case "${osname}${osvers}" in
8124                 next4*)
8125                         dflt=libperl.5.$so
8126                         # XXX How handle the --version stuff for MAB?
8127                         ;;
8128                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8129                         dflt=libperl.$so
8130                         ;;
8131                 cygwin*) # ld links against an importlib
8132                         dflt=libperl$lib_ext
8133                         ;;
8134                 *)      # Try to guess based on whether libc has major.minor.
8135                         case "$libc" in
8136                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8137                         *libc.$so.[0-9]*) dflt=$majonly ;;
8138                         *)      dflt=libperl.$so ;;
8139                         esac
8140                         ;;
8141                 esac
8142                 ;;
8143         *)      dflt=$libperl
8144                 ;;
8145         esac
8146         cat << EOM
8147
8148 I need to select a good name for the shared libperl.  If your system uses
8149 library names with major and minor numbers, then you might want something
8150 like $majmin.  Alternatively, if your system uses a single version
8151 number for shared libraries, then you might want to use $majonly.
8152 Or, your system might be quite happy with a simple libperl.$so.
8153
8154 Since the shared libperl will get installed into a version-specific
8155 architecture-dependent directory, the version number of the shared perl
8156 library probably isn't important, so the default should be o.k.
8157
8158 EOM
8159         rp='What name do you want to give to the shared libperl?'
8160         . ./myread
8161         libperl=$ans
8162         echo "Ok, I'll use $libperl"
8163         ;;
8164 *)
8165         libperl="libperl${_a}"
8166         ;;
8167 esac
8168
8169 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8170 case "$shrpdir" in
8171 '') ;;
8172 *)      $cat >&4 <<EOM
8173 WARNING:  Use of the shrpdir variable for the installation location of
8174 the shared $libperl is not supported.  It was never documented and
8175 will not work in this version.  Let me (perlbug@perl.org)
8176 know of any problems this may cause.
8177
8178 EOM
8179         case "$shrpdir" in
8180         "$archlibexp/CORE")
8181                 $cat >&4 <<EOM
8182 But your current setting of $shrpdir is
8183 the default anyway, so it's harmless.
8184 EOM
8185                 ;;
8186         *)
8187                 $cat >&4 <<EOM
8188 Further, your current attempted setting of $shrpdir
8189 conflicts with the value of $archlibexp/CORE
8190 that installperl will use.
8191 EOM
8192                 ;;
8193         esac
8194         ;;
8195 esac
8196
8197 # How will the perl executable find the installed shared $libperl?
8198 # Add $xxx to ccdlflags.
8199 # If we can't figure out a command-line option, use $shrpenv to
8200 # set env LD_RUN_PATH.  The main perl makefile uses this.
8201 shrpdir=$archlibexp/CORE
8202 xxx=''
8203 tmp_shrpenv=''
8204 if "$useshrplib"; then
8205     case "$osname" in
8206         aix)
8207                 # We'll set it in Makefile.SH...
8208                 ;;
8209         solaris)
8210                 xxx="-R $shrpdir"
8211                 ;;
8212         freebsd|netbsd|openbsd|interix|dragonfly)
8213                 xxx="-Wl,-R$shrpdir"
8214                 ;;
8215         bsdos|linux|irix*|dec_osf|gnu*)
8216                 xxx="-Wl,-rpath,$shrpdir"
8217                 ;;
8218         next)
8219                 # next doesn't like the default...
8220                 ;;
8221         beos)
8222                 # beos doesn't like the default, either.
8223                 ;;
8224         hpux*)
8225                 # hpux doesn't like the default, either.
8226                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8227                 ;;
8228         *)
8229                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8230                 ;;
8231         esac
8232         case "$xxx" in
8233         '') ;;
8234         *)
8235                 # Only add $xxx if it isn't already in ccdlflags.
8236                 case " $ccdlflags " in
8237                 *" $xxx "*)     ;;
8238                 *)      ccdlflags="$ccdlflags $xxx"
8239                         cat <<EOM >&4
8240
8241 Adding $xxx to the flags
8242 passed to $ld so that the perl executable will find the
8243 installed shared $libperl.
8244
8245 EOM
8246                         ;;
8247                 esac
8248                 ;;
8249         esac
8250 fi
8251 # Fix ccdlflags in AIX for building external extensions.
8252 # (For building Perl itself bare -bE:perl.exp is needed,
8253 #  Makefile.SH takes care of this.)
8254 case "$osname" in
8255 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8256 esac
8257 # Respect a hint or command-line value.
8258 case "$shrpenv" in
8259 '') shrpenv="$tmp_shrpenv" ;;
8260 esac
8261 case "$ldlibpthname" in
8262 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8263 none)   ldlibpthname='' ;;
8264 esac
8265
8266 : determine where manual pages are on this system
8267 echo " "
8268 case "$sysman" in
8269 '') 
8270         syspath='/usr/share/man/man1 /usr/man/man1'
8271         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8272         syspath="$syspath /usr/man/u_man/man1"
8273         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8274         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8275         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8276         sysman=`./loc . /usr/man/man1 $syspath`
8277         ;;
8278 esac
8279 if $test -d "$sysman"; then
8280         echo "System manual is in $sysman." >&4
8281 else
8282         echo "Could not find manual pages in source form." >&4
8283 fi
8284
8285 : determine where manual pages go
8286 set man1dir man1dir none
8287 eval $prefixit
8288 $cat <<EOM
8289
8290 $spackage has manual pages available in source form.
8291 EOM
8292 case "$nroff" in
8293 nroff)
8294         echo "However, you don't have nroff, so they're probably useless to you."
8295         case "$man1dir" in
8296         '') man1dir="none";;
8297         esac;;
8298 esac
8299 echo "If you don't want the manual sources installed, answer 'none'."
8300 case "$man1dir" in
8301 ' ') dflt=none
8302         ;;
8303 '')
8304         lookpath="$prefixexp/share/man/man1"
8305         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8306         lookpath="$lookpath $prefixexp/man/p_man/man1"
8307         lookpath="$lookpath $prefixexp/man/u_man/man1"
8308         lookpath="$lookpath $prefixexp/man/man.1"
8309         case "$sysman" in
8310         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8311         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8312         esac
8313         set dflt
8314         eval $prefixup
8315         ;;
8316 *)  dflt="$man1dir"
8317         ;;
8318 esac
8319 echo " "
8320 fn=dn+~
8321 rp="Where do the main $spackage manual pages (source) go?"
8322 . ./getfile
8323 if $test "X$man1direxp" != "X$ansexp"; then
8324         installman1dir=''
8325 fi
8326 prefixvar=man1dir
8327 . ./setprefixvar
8328
8329 case "$man1dir" in
8330 '')     man1dir=' '
8331         installman1dir='';;
8332 esac
8333
8334 : What suffix to use on installed man pages
8335
8336 case "$man1dir" in
8337 ' ')
8338         man1ext='0'
8339         ;;
8340 *)
8341         rp="What suffix should be used for the main $spackage man pages?"
8342         case "$man1ext" in
8343         '')     case "$man1dir" in
8344                 *1)  dflt=1 ;;
8345                 *1p) dflt=1p ;;
8346                 *1pm) dflt=1pm ;;
8347                 *l) dflt=l;;
8348                 *n) dflt=n;;
8349                 *o) dflt=o;;
8350                 *p) dflt=p;;
8351                 *C) dflt=C;;
8352                 *L) dflt=L;;
8353                 *L1) dflt=L1;;
8354                 *) dflt=1;;
8355                 esac
8356                 ;;
8357         *)      dflt="$man1ext";;
8358         esac
8359         . ./myread
8360         man1ext="$ans"
8361         ;;
8362 esac
8363
8364 : see if we can have long filenames
8365 echo " "
8366 first=123456789abcdef
8367 $rm -f $first
8368 if (echo hi >$first) 2>/dev/null; then
8369         if $test -f 123456789abcde; then
8370                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8371                 val="$undef"
8372         else
8373                 echo 'You can have filenames longer than 14 characters.'>&4
8374                 val="$define"
8375         fi
8376 else
8377         $cat <<'EOM'
8378 You can't have filenames longer than 14 chars.
8379 You can't even think about them!
8380 EOM
8381         val="$undef"
8382 fi 
8383 set d_flexfnam
8384 eval $setvar
8385 $rm -rf 123456789abcde*
8386
8387 : determine where library module manual pages go
8388 set man3dir man3dir none
8389 eval $prefixit
8390 $cat <<EOM
8391
8392 $spackage has manual pages for many of the library modules.
8393 EOM
8394
8395 case "$nroff" in
8396 nroff)
8397         $cat <<'EOM'
8398 However, you don't have nroff, so they're probably useless to you.
8399 EOM
8400         case "$man3dir" in
8401         '') man3dir="none";;
8402         esac;;
8403 esac
8404
8405 case "$d_flexfnam" in
8406 undef)
8407         $cat <<'EOM'
8408 However, your system can't handle the long file names like File::Basename.3.
8409 EOM
8410         case "$man3dir" in
8411         '') man3dir="none";;
8412         esac;;
8413 esac
8414
8415 echo "If you don't want the manual sources installed, answer 'none'."
8416 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8417 case "$man3dir" in
8418 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8419         if $test -d "$privlib/man/man3"; then
8420                 cat <<EOM >&4
8421
8422 WARNING:  Previous versions of perl installed man3 pages into
8423 $privlib/man/man3.  This version will suggest a
8424 new default of $dflt.
8425 EOM
8426                 tdflt=$dflt
8427                 dflt='n'
8428                 rp='Do you wish to preserve the old behavior?(y/n)'
8429                 . ./myread
8430                 case "$ans" in
8431                 y*) dflt="$privlib/man/man3" ;;
8432                 *)  dflt=$tdflt ;;
8433                 esac
8434     fi
8435         ;;
8436 *)      dflt="$man3dir" ;;
8437 esac
8438 case "$dflt" in
8439 ' ') dflt=none ;;
8440 esac
8441 echo " "
8442 fn=dn+~
8443 rp="Where do the $package library man pages (source) go?"
8444 . ./getfile
8445 prefixvar=man3dir
8446 . ./setprefixvar
8447
8448 case "$man3dir" in
8449 '')     man3dir=' '
8450         installman3dir='';;
8451 esac
8452
8453 : What suffix to use on installed man pages
8454 case "$man3dir" in
8455 ' ')
8456         man3ext='0'
8457         ;;
8458 *)
8459         rp="What suffix should be used for the $package library man pages?"
8460         case "$man3ext" in
8461         '')     case "$man3dir" in
8462                 *3)  dflt=3 ;;
8463                 *3p) dflt=3p ;;
8464                 *3pm) dflt=3pm ;;
8465                 *l) dflt=l;;
8466                 *n) dflt=n;;
8467                 *o) dflt=o;;
8468                 *p) dflt=p;;
8469                 *C) dflt=C;;
8470                 *L) dflt=L;;
8471                 *L3) dflt=L3;;
8472                 *) dflt=3;;
8473                 esac
8474                 ;;
8475         *)      dflt="$man3ext";;
8476         esac
8477         . ./myread
8478         man3ext="$ans"
8479         ;;
8480 esac
8481
8482 : see if we have to deal with yellow pages, now NIS.
8483 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8484         if $test -f /usr/etc/nibindd; then
8485                 echo " "
8486                 echo "I'm fairly confident you're on a NeXT."
8487                 echo " "
8488                 rp='Do you get the hosts file via NetInfo?'
8489                 dflt=y
8490                 case "$hostcat" in
8491                 nidump*) ;;
8492                 '') ;;
8493                 *) dflt=n;;
8494                 esac
8495                 . ./myread
8496                 case "$ans" in
8497                 y*) hostcat='nidump hosts .';;
8498                 *)      case "$hostcat" in
8499                         nidump*) hostcat='';;
8500                         esac
8501                         ;;
8502                 esac
8503         fi
8504         case "$hostcat" in
8505         nidump*) ;;
8506         *)
8507                 case "$hostcat" in
8508                 *ypcat*) dflt=y;;
8509                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8510                                 dflt=y
8511                         else
8512                                 dflt=n
8513                         fi;;
8514                 *) dflt=n;;
8515                 esac
8516                 echo " "
8517                 rp='Are you getting the hosts file via yellow pages?'
8518                 . ./myread
8519                 case "$ans" in
8520                 y*) hostcat='ypcat hosts';;
8521                 *) hostcat='cat /etc/hosts';;
8522                 esac
8523                 ;;
8524         esac
8525 fi
8526 case "$hostcat" in
8527 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8528 esac
8529 case "$groupcat" in
8530 '') test -f /etc/group && groupcat='cat /etc/group';;
8531 esac
8532 case "$passcat" in
8533 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8534 esac
8535
8536 : now get the host name
8537 echo " "
8538 echo "Figuring out host name..." >&4
8539 case "$myhostname" in
8540 '') cont=true
8541         echo 'Maybe "hostname" will work...'
8542         if tans=`sh -c hostname 2>&1` ; then
8543                 myhostname=$tans
8544                 phostname=hostname
8545                 cont=''
8546         fi
8547         ;;
8548 *) cont='';;
8549 esac
8550 if $test "$cont"; then
8551         if ./xenix; then
8552                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8553                 if tans=`cat /etc/systemid 2>&1` ; then
8554                         myhostname=$tans
8555                         phostname='cat /etc/systemid'
8556                         echo "Whadyaknow.  Xenix always was a bit strange..."
8557                         cont=''
8558                 fi
8559         elif $test -r /etc/systemid; then
8560                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8561         fi
8562 fi
8563 if $test "$cont"; then
8564         echo 'No, maybe "uuname -l" will work...'
8565         if tans=`sh -c 'uuname -l' 2>&1` ; then
8566                 myhostname=$tans
8567                 phostname='uuname -l'
8568         else
8569                 echo 'Strange.  Maybe "uname -n" will work...'
8570                 if tans=`sh -c 'uname -n' 2>&1` ; then
8571                         myhostname=$tans
8572                         phostname='uname -n'
8573                 else
8574                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8575                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8576                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8577                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8578                         else
8579                                 case "$myhostname" in
8580                                 '') echo "Does this machine have an identity crisis or something?"
8581                                         phostname='';;
8582                                 *)
8583                                         echo "Well, you said $myhostname before..."
8584                                         phostname='echo $myhostname';;
8585                                 esac
8586                         fi
8587                 fi
8588         fi
8589 fi
8590 case "$myhostname" in
8591 '') myhostname=noname ;;
8592 esac
8593 : you do not want to know about this
8594 set $myhostname
8595 myhostname=$1
8596
8597 : verify guess
8598 if $test "$myhostname" ; then
8599         dflt=y
8600         rp='Your host name appears to be "'$myhostname'".'" Right?"
8601         . ./myread
8602         case "$ans" in
8603         y*) ;;
8604         *) myhostname='';;
8605         esac
8606 fi
8607
8608 : bad guess or no guess
8609 while $test "X$myhostname" = X ; do
8610         dflt=''
8611         rp="Please type the (one word) name of your host:"
8612         . ./myread
8613         myhostname="$ans"
8614 done
8615
8616 : translate upper to lower if necessary
8617 case "$myhostname" in
8618 *[A-Z]*)
8619         echo "(Normalizing case in your host name)"
8620         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8621         ;;
8622 esac
8623
8624 case "$myhostname" in
8625 *.*)
8626         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8627         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8628         echo "(Trimming domain name from host name--host name is now $myhostname)"
8629         ;;
8630 *) case "$mydomain" in
8631         '')
8632                 {
8633                         test "X$hostcat" = "Xypcat hosts" &&
8634                         ypmatch "$myhostname" hosts 2>/dev/null |\
8635                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8636                         $test -s hosts
8637                 } || {
8638                         test "X$hostcat" != "X" &&
8639                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8640                                         /[       ]$myhostname[  . ]/p" > hosts
8641                 }
8642                 tmp_re="[       . ]"
8643                 if $test -f hosts; then
8644                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8645                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8646                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8647                                 hosts | $sort | $uniq | \
8648                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8649                         case `$echo X$dflt` in
8650                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8651                                 dflt=.
8652                                 ;;
8653                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8654                                 ;;
8655                         esac
8656                 else
8657                         echo "(I cannot locate a hosts database anywhere)"
8658                         dflt=.
8659                 fi
8660                 case "$dflt" in
8661                 .)
8662                         tans=`./loc resolv.conf X /etc /usr/etc`
8663                         if $test -f "$tans"; then
8664                                 echo "(Attempting domain name extraction from $tans)"
8665                                 dflt=.`$sed -n -e 's/   / /g' \
8666                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8667                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8668                                 case "$dflt" in
8669                                 .) dflt=.`$sed -n -e 's/        / /g' \
8670                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8671                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8672                                         ;;
8673                                 esac
8674                         fi
8675                         ;;
8676                 esac
8677                 case "$dflt" in
8678                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8679                         dflt=.`sh -c domainname 2>/dev/null`
8680                         case "$dflt" in
8681                         '') dflt='.';;
8682                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8683                         esac
8684                         ;;
8685                 esac
8686                 case "$dflt$osname" in
8687                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8688                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8689                         ;;
8690                 esac
8691                 case "$dflt" in
8692                 .) echo "(Lost all hope -- silly guess then)"
8693                         dflt='.nonet'
8694                         ;;
8695                 esac
8696                 $rm -f hosts
8697                 ;;
8698         *) dflt="$mydomain";;
8699         esac;;
8700 esac
8701 echo " "
8702 rp="What is your domain name?"
8703 . ./myread
8704 tans="$ans"
8705 case "$ans" in
8706 '') ;;
8707 .*) ;;
8708 *) tans=".$tans";;
8709 esac
8710 mydomain="$tans"
8711
8712 : translate upper to lower if necessary
8713 case "$mydomain" in
8714 *[A-Z]*)
8715         echo "(Normalizing case in your domain name)"
8716         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8717         ;;
8718 esac
8719
8720 : a little sanity check here
8721 case "$phostname" in
8722 '') ;;
8723 *)
8724         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8725         $myhostname$mydomain|$myhostname) ;;
8726         *)
8727                 case "$phostname" in
8728                 sed*)
8729                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8730                         ;;
8731                 *)
8732                         echo "(That doesn't agree with your $phostname command, by the way.)"
8733                         ;;
8734                 esac
8735         ;;
8736         esac
8737         ;;
8738 esac
8739
8740 : Ask for e-mail
8741 $cat <<EOM
8742
8743 I need to get your e-mail address in Internet format if possible, i.e.
8744 something like user@host.domain. Please answer accurately since I have
8745 no easy means to double check it. The default value provided below
8746 is most probably close to reality but may not be valid from outside
8747 your organization...
8748
8749 EOM
8750 cont=x
8751 while test "$cont"; do
8752         case "$cf_email" in
8753         '') dflt="$cf_by@$myhostname$mydomain";;
8754         *) dflt="$cf_email";;
8755         esac
8756         rp='What is your e-mail address?'
8757         . ./myread
8758         cf_email="$ans"
8759         case "$cf_email" in
8760         *@*.*) cont='' ;;
8761         *)
8762                 rp='Address does not look like an Internet one.  Use it anyway?'
8763                 case "$fastread" in
8764                 yes) dflt=y ;;
8765                 *) dflt=n ;;
8766                 esac
8767                 . ./myread
8768                 case "$ans" in
8769                 y*) cont='' ;;
8770                 *) echo " " ;;
8771                 esac
8772                 ;;
8773         esac
8774 done
8775
8776 : Ask e-mail of administrator
8777 $cat <<EOM
8778
8779 If you or somebody else will be maintaining perl at your site, please
8780 fill in the correct e-mail address here so that they may be contacted
8781 if necessary. Currently, the "perlbug" program included with perl
8782 will send mail to this address in addition to perlbug@perl.org. You may
8783 enter "none" for no administrator.
8784
8785 EOM
8786 case "$perladmin" in
8787 '') dflt="$cf_email";;
8788 *) dflt="$perladmin";;
8789 esac
8790 rp='Perl administrator e-mail address'
8791 . ./myread
8792 perladmin="$ans"
8793
8794 : determine whether to only install version-specific parts.
8795 echo " "
8796 $cat <<EOM
8797 Do you want to install only the version-specific parts of the perl
8798 distribution?  Usually you do *not* want to do this.
8799 EOM
8800 case "$versiononly" in
8801 "$define"|[Yy]*|true) dflt='y' ;;
8802 *) dflt='n';
8803 esac
8804 rp="Do you want to install only the version-specific parts of perl?"
8805 . ./myread
8806 case "$ans" in
8807 [yY]*)  val="$define";;
8808 *)      val="$undef" ;;
8809 esac
8810 set versiononly
8811 eval $setvar
8812
8813 case "$versiononly" in
8814 "$define") inc_version_list=''
8815            inc_version_list_init=0
8816            ;;
8817 esac
8818
8819 : figure out how to guarantee perl startup
8820 : XXX Note that this currently takes advantage of the bug that binexp ignores
8821 :     the Configure -Dinstallprefix setting, which in turn means that under
8822 :     relocatable @INC, initialinstalllocation is what binexp started as.
8823 case "$startperl" in
8824 '')
8825         case "$sharpbang" in
8826         *!)
8827                 $cat <<EOH
8828
8829 I can use the #! construct to start perl on your system. This will
8830 make startup of perl scripts faster, but may cause problems if you
8831 want to share those scripts and perl is not in a standard place
8832 ($initialinstalllocation/perl) on all your platforms. The alternative
8833 is to force a shell by starting the script with a single ':' character.
8834
8835 EOH
8836                 case "$versiononly" in
8837                 "$define")      dflt="$initialinstalllocation/perl$version";;
8838                 *)              dflt="$initialinstalllocation/perl";;
8839                 esac
8840                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8841                 . ./myread
8842                 case "$ans" in
8843                 none)   startperl=": # use perl";;
8844                 *)      startperl="#!$ans"
8845                         if $test 30 -lt `echo "$ans" | wc -c`; then
8846                                 $cat >&4 <<EOM
8847
8848 WARNING:  Some systems limit the #! command to 32 characters.
8849 If you experience difficulty running Perl scripts with #!, try
8850 installing Perl in a directory with a shorter pathname.
8851
8852 EOM
8853                         fi ;;
8854                 esac
8855                 ;;
8856         *) startperl=": # use perl"
8857                 ;;
8858         esac
8859         ;;
8860 esac
8861 echo "I'll use $startperl to start perl scripts."
8862
8863 : figure best path for perl in scripts
8864 case "$perlpath" in
8865 '')
8866         case "$versiononly" in
8867         "$define")      perlpath="$initialinstalllocation/perl$version";;
8868         *)              perlpath="$initialinstalllocation/perl";;
8869         esac
8870         case "$startperl" in
8871         *!*) ;;
8872         *)
8873                 $cat <<EOH
8874
8875 I will use the "eval 'exec'" idiom to start Perl on your system.
8876 I can use the full path of your Perl binary for this purpose, but
8877 doing so may cause problems if you want to share those scripts and
8878 Perl is not always in a standard place ($initialinstalllocation/perl).
8879
8880 EOH
8881                 dflt="$initialinstalllocation/perl"
8882                 rp="What path shall I use in \"eval 'exec'\"?"
8883                 . ./myread
8884                 perlpath="$ans"
8885                 ;;
8886         esac
8887         ;;
8888 esac
8889 case "$startperl" in
8890 *!*)    ;;
8891 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8892 esac
8893
8894 : determine where public executable scripts go
8895 set scriptdir scriptdir
8896 eval $prefixit
8897 case "$scriptdir" in
8898 '')
8899         dflt="$bin"
8900         : guess some guesses
8901         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8902         $test -d /usr/share/bin     && dflt=/usr/share/bin
8903         $test -d /usr/local/script  && dflt=/usr/local/script
8904         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8905         $test -d $prefixexp/script  && dflt=$prefixexp/script
8906         set dflt
8907         eval $prefixup
8908         ;;
8909 *)  dflt="$scriptdir"
8910         ;;
8911 esac
8912 $cat <<EOM
8913
8914 Some installations have a separate directory just for executable scripts so
8915 that they can mount it across multiple architectures but keep the scripts in
8916 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8917 Or you might just lump your scripts in with all your other executables.
8918
8919 EOM
8920 fn=d~
8921 rp='Where do you keep publicly executable scripts?'
8922 . ./getfile
8923 if $test "X$ansexp" != "X$scriptdirexp"; then
8924         installscript=''
8925 fi
8926 installscriptdir=''
8927 prefixvar=scriptdir
8928 . ./setprefixvar
8929 : A little fix up for an irregularly named variable.
8930 installscript="$installscriptdir"
8931
8932 : determine where add-on public executables go
8933 case "$sitebin" in
8934 '')     dflt=$siteprefix/bin ;;
8935 *)      dflt=$sitebin ;;
8936 esac
8937 fn=d~
8938 rp='Pathname where the add-on public executables should be installed?'
8939 . ./getfile
8940 prefixvar=sitebin
8941 . ./setprefixvar
8942
8943 : determine where add-on html pages go
8944 : There is no standard location, so try to copy the previously-selected
8945 : directory structure for the core html pages.
8946 case "$sitehtml1dir" in
8947 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8948 *)     dflt=$sitehtml1dir ;;
8949 esac
8950 case "$dflt" in
8951 ''|' ') dflt=none ;;
8952 esac
8953 fn=dn+~
8954 rp='Pathname where the site-specific html pages should be installed?'
8955 . ./getfile
8956 prefixvar=sitehtml1dir
8957 . ./setprefixvar
8958
8959 : determine where add-on library html pages go
8960 : There is no standard location, so try to copy the previously-selected
8961 : directory structure for the core html pages.
8962 case "$sitehtml3dir" in
8963 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8964 *)     dflt=$sitehtml3dir ;;
8965 esac
8966 case "$dflt" in
8967 ''|' ') dflt=none ;;
8968 esac
8969 fn=dn+~
8970 rp='Pathname where the site-specific library html pages should be installed?'
8971 . ./getfile
8972 prefixvar=sitehtml3dir
8973 . ./setprefixvar
8974
8975 : determine where add-on manual pages go
8976 case "$siteman1dir" in
8977 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8978 *)      dflt=$siteman1dir ;;
8979 esac
8980 case "$dflt" in
8981 ''|' ') dflt=none ;;
8982 esac
8983 fn=dn+~
8984 rp='Pathname where the site-specific manual pages should be installed?'
8985 . ./getfile
8986 prefixvar=siteman1dir
8987 . ./setprefixvar
8988
8989 : determine where add-on library man pages go
8990 case "$siteman3dir" in
8991 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8992 *)      dflt=$siteman3dir ;;
8993 esac
8994 case "$dflt" in
8995 ''|' ') dflt=none ;;
8996 esac
8997 fn=dn+~
8998 rp='Pathname where the site-specific library manual pages should be installed?'
8999 . ./getfile
9000 prefixvar=siteman3dir
9001 . ./setprefixvar
9002
9003 : determine where add-on public executable scripts go
9004 case "$sitescript" in
9005 '')     dflt=$siteprefix/script
9006         $test -d $dflt || dflt=$sitebin ;;
9007 *)  dflt="$sitescript" ;;
9008 esac
9009 fn=d~+
9010 rp='Pathname where add-on public executable scripts should be installed?'
9011 . ./getfile
9012 prefixvar=sitescript
9013 . ./setprefixvar
9014
9015 : Check if faststdio is requested and available
9016 case "$usefaststdio" in
9017 $define|true|[yY]*|'')
9018         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9019         case "$xversion" in
9020         [68])   dflt='y' ;;
9021         *)      dflt='n' ;;
9022         esac
9023         ;;
9024 *) dflt='n';;
9025 esac
9026 cat <<EOM
9027
9028 Perl can be built to use 'fast stdio', which means using the stdio
9029 library but also directly manipulating the stdio buffers to enable
9030 faster I/O.  Using stdio is better for backward compatibility (especially
9031 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9032 interface has been preferred instead of stdio.
9033
9034 If this doesn't make any sense to you, just accept the default '$dflt'.
9035 EOM
9036 rp='Use the "fast stdio" if available?'
9037 . ./myread
9038 case "$ans" in
9039 y|Y)    val="$define" ;;
9040 *)      val="$undef" ;;
9041 esac
9042 set usefaststdio
9043 eval $setvar
9044
9045
9046 : define an is-a-typedef? function
9047 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9048 case "$inclist" in
9049 "") inclist="sys/types.h";;
9050 esac;
9051 eval "varval=\$$var";
9052 case "$varval" in
9053 "")
9054         $rm -f temp.c;
9055         for inc in $inclist; do
9056                 echo "#include <$inc>" >>temp.c;
9057         done;
9058         echo "#ifdef $type" >> temp.c;
9059         echo "printf(\"We have $type\");" >> temp.c;
9060         echo "#endif" >> temp.c;
9061         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9062         if $contains $type temp.E >/dev/null 2>&1; then
9063                 eval "$var=\$type";
9064         else
9065                 eval "$var=\$def";
9066         fi;
9067         $rm -f temp.?;;
9068 *) eval "$var=\$varval";;
9069 esac'
9070
9071 : define an is-a-typedef? function that prompts if the type is not available.
9072 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9073 case "$inclist" in
9074 "") inclist="sys/types.h";;
9075 esac;
9076 eval "varval=\$$var";
9077 case "$varval" in
9078 "")
9079         $rm -f temp.c;
9080         for inc in $inclist; do
9081                 echo "#include <$inc>" >>temp.c;
9082         done;
9083         echo "#ifdef $type" >> temp.c;
9084         echo "printf(\"We have $type\");" >> temp.c;
9085         echo "#endif" >> temp.c;
9086         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9087         echo " " ;
9088         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9089         if $contains $type temp.E >/dev/null 2>&1; then
9090                 echo "$type found." >&4;
9091                 eval "$var=\$type";
9092         else
9093                 echo "$type NOT found." >&4;
9094                 dflt="$def";
9095                 . ./myread ;
9096                 eval "$var=\$ans";
9097         fi;
9098         $rm -f temp.?;;
9099 *) eval "$var=\$varval";;
9100 esac'
9101
9102 : see what type lseek is declared as in the kernel
9103 rp="What is the type used for lseek's offset on this system?"
9104 set off_t lseektype long stdio.h sys/types.h
9105 eval $typedef_ask
9106
9107 echo " "
9108 echo "Checking to see how big your file offsets are..." >&4
9109 $cat >try.c <<EOCP
9110 #include <sys/types.h>
9111 #include <stdio.h>
9112 int main()
9113 {
9114     printf("%d\n", (int)sizeof($lseektype));
9115     return(0);
9116 }
9117 EOCP
9118 set try
9119 if eval $compile_ok; then
9120         lseeksize=`$run ./try`
9121         echo "Your file offsets are $lseeksize bytes long."
9122 else
9123         dflt=$longsize
9124         echo " "
9125         echo "(I can't seem to compile the test program.  Guessing...)"
9126         rp="What is the size of your file offsets (in bytes)?"
9127         . ./myread
9128         lseeksize="$ans"
9129 fi
9130 $rm_try
9131
9132 : see what type file positions are declared as in the library
9133 rp="What is the type for file position used by fsetpos()?"
9134 set fpos_t fpostype long stdio.h sys/types.h
9135 eval $typedef_ask
9136
9137 : Check size for Fpos_t
9138 echo " "
9139 case "$fpostype" in
9140 *_t) zzz="$fpostype"    ;;
9141 *)   zzz="fpos_t"       ;;
9142 esac
9143 echo "Checking the size of $zzz..." >&4
9144 cat > try.c <<EOCP
9145 #include <sys/types.h>
9146 #include <stdio.h>
9147 #$i_stdlib I_STDLIB
9148 #ifdef I_STDLIB
9149 #include <stdlib.h>
9150 #endif
9151 int main() {
9152     printf("%d\n", (int)sizeof($fpostype));
9153     exit(0);
9154 }
9155 EOCP
9156 set try
9157 if eval $compile_ok; then
9158         yyy=`$run ./try`
9159         case "$yyy" in
9160         '')     fpossize=4
9161                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9162                 ;;
9163         *)      fpossize=$yyy
9164                 echo "Your $zzz is $fpossize bytes long."
9165                 ;;
9166         esac
9167 else
9168         dflt="$longsize"
9169         echo " " >&4
9170         echo "(I can't compile the test program.  Guessing...)" >&4
9171         rp="What is the size of your file positions (in bytes)?"
9172         . ./myread
9173         fpossize="$ans"
9174 fi
9175
9176 : Check for large file support
9177 # Backward compatibility (uselfs is deprecated).
9178 case "$uselfs" in
9179 "$define"|true|[yY]*)
9180         cat <<EOM >&4
9181
9182 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9183 EOM
9184         uselargefiles="$define"
9185         ;;
9186 esac
9187
9188 case "$lseeksize:$fpossize" in
9189 8:8) cat <<EOM
9190
9191 You can have files larger than 2 gigabytes.
9192 EOM
9193    val="$define" ;;
9194 *)    case "$uselargefiles" in
9195    "$undef"|false|[nN]*) dflt='n' ;;
9196    *)   dflt='y' ;;
9197    esac
9198    cat <<EOM
9199
9200 Perl can be built to understand large files (files larger than 2 gigabytes)
9201 on some systems.  To do so, Configure can be run with -Duselargefiles.
9202
9203 If this doesn't make any sense to you, just accept the default '$dflt'.
9204 EOM
9205    rp='Try to understand large files, if available?'
9206    . ./myread
9207    case "$ans" in
9208    y|Y)         val="$define" ;;
9209    *)           val="$undef"  ;;
9210    esac
9211    ;;
9212 esac
9213 set uselargefiles
9214 eval $setvar
9215 : Look for a hint-file generated 'call-back-unit'.  If the
9216 : user has specified that a large files perl is to be built,
9217 : we may need to set or change some other defaults.
9218 if $test -f uselargefiles.cbu; then
9219         echo "Your platform has some specific hints regarding large file builds, using them..."
9220         . ./uselargefiles.cbu
9221 fi
9222 case "$uselargefiles" in
9223 "$define")
9224         if $test -f uselargefiles.cbu; then
9225                 echo " "
9226                 echo "Rechecking to see how big your file offsets are..." >&4
9227                 $cat >try.c <<EOCP
9228 #include <sys/types.h>
9229 #include <stdio.h>
9230 int main()
9231 {
9232     printf("%d\n", (int)sizeof($lseektype));
9233     return(0);
9234 }
9235 EOCP
9236                 set try
9237                 if eval $compile_ok; then
9238                         lseeksize=`$run ./try`
9239                         $echo "Your file offsets are now $lseeksize bytes long."
9240                 else
9241                         dflt="$lseeksize"
9242                         echo " "
9243                         echo "(I can't seem to compile the test program.  Guessing...)"
9244                         rp="What is the size of your file offsets (in bytes)?"
9245                         . ./myread
9246                         lseeksize="$ans"
9247                 fi
9248                 case "$fpostype" in
9249                 *_t) zzz="$fpostype"    ;;
9250                 *)   zzz="fpos_t"       ;;
9251                 esac
9252                 $echo $n "Rechecking the size of $zzz...$c" >&4
9253                 $cat > try.c <<EOCP
9254 #include <sys/types.h>
9255 #include <stdio.h>
9256 #$i_stdlib I_STDLIB
9257 #ifdef I_STDLIB
9258 #include <stdlib.h>
9259 #endif
9260 int main() {
9261     printf("%d\n", (int)sizeof($fpostype));
9262     return(0);
9263 }
9264 EOCP
9265                 set try
9266                 if eval $compile_ok; then
9267                         yyy=`$run ./try`
9268                         dflt="$lseeksize"
9269                         case "$yyy" in
9270                         '')     echo " "
9271                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9272                                 ;;
9273                         *)      fpossize=$yyy
9274                                 echo " $fpossize bytes." >&4
9275                                 ;;
9276                         esac
9277                 else
9278                         dflt="$fpossize"
9279                         echo " "
9280                         echo "(I can't compile the test program.  Guessing...)" >&4
9281                         rp="What is the size of your file positions (in bytes)?"
9282                         . ./myread
9283                         fpossize="$ans"
9284                 fi
9285                 $rm_try
9286         fi
9287         ;;
9288 esac
9289
9290 : Set the vendorbin variables
9291 case "$vendorprefix" in
9292 '')     d_vendorbin="$undef"
9293         vendorbin=''
9294         vendorbinexp=''
9295         ;;
9296 *)      d_vendorbin="$define"
9297         : determine where vendor-supplied executables go.
9298         case "$vendorbin" in
9299         '') dflt=$vendorprefix/bin ;;
9300         *)      dflt="$vendorbin" ;;
9301         esac
9302         fn=d~+
9303         rp='Pathname for the vendor-supplied executables directory?'
9304         . ./getfile
9305         vendorbin="$ans"
9306         vendorbinexp="$ansexp"
9307         ;;
9308 esac
9309 prefixvar=vendorbin
9310 . ./installprefix
9311
9312 : Set the vendorhtml1dir variables
9313 case "$vendorprefix" in
9314 '')     vendorhtml1dir=''
9315         vendorhtml1direxp=''
9316         ;;
9317 *)      : determine where vendor-supplied html pages go.
9318         : There is no standard location, so try to copy the previously-selected
9319         : directory structure for the core html pages.
9320         : XXX Better default suggestions would be welcome.
9321         case "$vendorhtml1dir" in
9322         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9323         *)      dflt=$vendorhtml1dir ;;
9324         esac
9325         case "$dflt" in
9326         ''|' ') dflt=none ;;
9327         esac
9328         fn=dn+~
9329         rp='Pathname for the vendor-supplied html pages?'
9330         . ./getfile
9331         vendorhtml1dir="$ans"
9332         vendorhtml1direxp="$ansexp"
9333         ;;
9334 esac
9335 : Use ' ' for none so value is preserved next time through Configure
9336 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9337 prefixvar=vendorhtml1dir
9338 . ./installprefix
9339
9340 : Set the vendorhtml3dir variables
9341 case "$vendorprefix" in
9342 '')     vendorhtml3dir=''
9343         vendorhtml3direxp=''
9344         ;;
9345 *)      : determine where vendor-supplied module html pages go.
9346         : There is no standard location, so try to copy the previously-selected
9347         : directory structure for the core html pages.
9348         : XXX Better default suggestions would be welcome.
9349         case "$vendorhtml3dir" in
9350         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9351         *)      dflt=$vendorhtml3dir ;;
9352         esac
9353         case "$dflt" in
9354         ''|' ') dflt=none ;;
9355         esac
9356         fn=dn+~
9357         rp='Pathname for the vendor-supplied html pages?'
9358         . ./getfile
9359         vendorhtml3dir="$ans"
9360         vendorhtml3direxp="$ansexp"
9361         ;;
9362 esac
9363 : Use ' ' for none so value is preserved next time through Configure
9364 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9365 prefixvar=vendorhtml3dir
9366 . ./installprefix
9367
9368 : Set the vendorman1dir variables
9369 case "$vendorprefix" in
9370 '')     vendorman1dir=''
9371         vendorman1direxp=''
9372         ;;
9373 *)      : determine where vendor-supplied manual pages go.
9374         case "$vendorman1dir" in
9375         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9376         *)      dflt=$vendorman1dir ;;
9377         esac
9378         case "$dflt" in
9379         ''|' ') dflt=none ;;
9380         esac
9381         fn=nd~+
9382         rp='Pathname for the vendor-supplied manual section 1 pages?'
9383         . ./getfile
9384         vendorman1dir="$ans"
9385         vendorman1direxp="$ansexp"
9386         ;;
9387 esac
9388 : Use ' ' for none so value is preserved next time through Configure
9389 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9390 prefixvar=vendorman1dir
9391 . ./installprefix
9392
9393 : Set the vendorman3dir variables
9394 case "$vendorprefix" in
9395 '')     vendorman3dir=''
9396         vendorman3direxp=''
9397         ;;
9398 *)      : determine where vendor-supplied module manual pages go.
9399         case "$vendorman3dir" in
9400         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9401         *)      dflt=$vendorman3dir ;;
9402         esac
9403         case "$dflt" in
9404         ''|' ') dflt=none ;;
9405         esac
9406         fn=nd~+
9407         rp='Pathname for the vendor-supplied manual section 3 pages?'
9408         . ./getfile
9409         vendorman3dir="$ans"
9410         vendorman3direxp="$ansexp"
9411         ;;
9412 esac
9413 : Use ' ' for none so value is preserved next time through Configure
9414 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9415 prefixvar=vendorman3dir
9416 . ./installprefix
9417
9418 : Set the vendorscript variables
9419 case "$vendorprefix" in
9420 '')     d_vendorscript="$undef"
9421         vendorscript=''
9422         vendorscriptexp=''
9423         ;;
9424 *)      d_vendorscript="$define"
9425         : determine where vendor-supplied scripts go.
9426         case "$vendorscript" in
9427         '')     dflt=$vendorprefix/script
9428                 $test -d $dflt || dflt=$vendorbin ;;
9429         *)  dflt="$vendorscript" ;;
9430         esac
9431         $cat <<EOM
9432
9433 The installation process will create a directory for
9434 vendor-supplied scripts.
9435
9436 EOM
9437         fn=d~+
9438         rp='Pathname for the vendor-supplied scripts directory?'
9439         . ./getfile
9440         vendorscript="$ans"
9441         vendorscriptexp="$ansexp"
9442         ;;
9443 esac
9444 prefixvar=vendorscript
9445 . ./installprefix
9446
9447 : see if qgcvt exists
9448 set qgcvt d_qgcvt
9449 eval $inlibc
9450
9451 : Check print/scan long double stuff
9452 echo " "
9453
9454 if $test X"$d_longdbl" = X"$define"; then
9455
9456 echo "Checking how to print long doubles..." >&4
9457
9458 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9459         $cat >try.c <<'EOCP'
9460 #include <sys/types.h>
9461 #include <stdio.h>
9462 int main() {
9463   double d = 123.456;
9464   printf("%.3f\n", d);
9465 }
9466 EOCP
9467         set try
9468         if eval $compile; then
9469                 yyy=`$run ./try`
9470                 case "$yyy" in
9471                 123.456)
9472                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9473                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9474                         echo "We will use %f."
9475                         ;;
9476                 esac
9477         fi
9478 fi
9479
9480 if $test X"$sPRIfldbl" = X; then
9481         $cat >try.c <<'EOCP'
9482 #include <sys/types.h>
9483 #include <stdio.h>
9484 int main() {
9485   long double d = 123.456;
9486   printf("%.3Lf\n", d);
9487 }
9488 EOCP
9489         set try
9490         if eval $compile; then
9491                 yyy=`$run ./try`
9492                 case "$yyy" in
9493                 123.456)
9494                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9495                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9496                         echo "We will use %Lf."
9497                         ;;
9498                 esac
9499         fi
9500 fi
9501
9502 if $test X"$sPRIfldbl" = X; then
9503         $cat >try.c <<'EOCP'
9504 #include <sys/types.h>
9505 #include <stdio.h>
9506 int main() {
9507   long double d = 123.456;
9508   printf("%.3llf\n", d);
9509 }
9510 EOCP
9511         set try
9512         if eval $compile; then
9513                 yyy=`$run ./try`
9514                 case "$yyy" in
9515                 123.456)
9516                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9517                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9518                         echo "We will use %llf."
9519                         ;;
9520                 esac
9521         fi
9522 fi
9523
9524 if $test X"$sPRIfldbl" = X; then
9525         $cat >try.c <<'EOCP'
9526 #include <sys/types.h>
9527 #include <stdio.h>
9528 int main() {
9529   long double d = 123.456;
9530   printf("%.3lf\n", d);
9531 }
9532 EOCP
9533         set try
9534         if eval $compile; then
9535                 yyy=`$run ./try`
9536                 case "$yyy" in
9537                 123.456)
9538                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9539                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9540                         echo "We will use %lf."
9541                         ;;
9542                 esac
9543         fi
9544 fi
9545
9546 if $test X"$sPRIfldbl" = X; then
9547         echo "Cannot figure out how to print long doubles." >&4
9548 else
9549         sSCNfldbl=$sPRIfldbl    # expect consistency
9550 fi
9551
9552 $rm_try
9553
9554 fi # d_longdbl
9555
9556 case "$sPRIfldbl" in
9557 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9558         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9559         d_SCNfldbl="$undef";
9560         ;;
9561 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9562         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9563         d_SCNfldbl="$define";
9564         ;;
9565 esac
9566
9567 : Check how to convert floats to strings.
9568
9569 if test "X$d_Gconvert" = X; then
9570
9571 echo " "
9572 echo "Checking for an efficient way to convert floats to strings."
9573 echo " " > try.c
9574 case "$uselongdouble" in
9575 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9576 esac
9577 case "$d_longdbl" in
9578 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9579 esac
9580 case "$d_PRIgldbl" in
9581 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9582 esac
9583 $cat >>try.c <<EOP
9584 #ifdef TRY_gconvert
9585 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9586 char *myname = "gconvert";
9587 #endif
9588 #ifdef TRY_gcvt
9589 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9590 char *myname = "gcvt";
9591 #endif
9592 #ifdef TRY_qgcvt
9593 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9594 char *myname = "qgcvt";
9595 #define DOUBLETYPE long double
9596 #endif
9597 #ifdef TRY_sprintf
9598 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9599 #ifdef HAS_PRIgldbl
9600 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9601 #else
9602 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9603 #endif
9604 #else
9605 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9606 #endif
9607 char *myname = "sprintf";
9608 #endif
9609
9610 #ifndef DOUBLETYPE
9611 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9612 #define DOUBLETYPE long double
9613 #else
9614 #define DOUBLETYPE double
9615 #endif
9616 #endif
9617
9618 #include <stdio.h>
9619
9620 #define I_STDLIB $i_stdlib
9621 #ifdef I_STDLIB
9622 #include <stdlib.h>
9623 #endif
9624
9625 int
9626 checkit(expect, got)
9627 char *expect;
9628 char *got;
9629 {
9630     if (strcmp(expect, got)) {
9631                 printf("%s oddity:  Expected %s, got %s\n",
9632                         myname, expect, got);
9633                 exit(1);
9634         }
9635 }
9636
9637 int main()
9638 {
9639         char buf[64];
9640         buf[63] = '\0';
9641
9642         /* This must be 1st test on (which?) platform */
9643         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9644         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9645         checkit("0.1", buf);
9646
9647         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9648         checkit("0.01", buf);
9649
9650         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9651         checkit("0.001", buf);
9652
9653         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9654         checkit("0.0001", buf);
9655
9656         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9657         if (strlen(buf) > 5)
9658             checkit("9e-005", buf); /* for Microsoft ?? */
9659         else
9660             checkit("9e-05", buf);
9661
9662         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9663         checkit("1", buf);
9664
9665         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9666         checkit("1.1", buf);
9667
9668         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9669         checkit("1.01", buf);
9670
9671         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9672         checkit("1.001", buf);
9673
9674         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9675         checkit("1.0001", buf);
9676
9677         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9678         checkit("1.00001", buf);
9679
9680         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9681         checkit("1.000001", buf);
9682
9683         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9684         checkit("0", buf);
9685
9686         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9687         checkit("-1", buf);
9688
9689         /* Some Linux gcvt's give 1.e+5 here. */
9690         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9691         checkit("100000", buf);
9692
9693         /* Some Linux gcvt's give -1.e+5 here. */
9694         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9695         checkit("-100000", buf);
9696
9697         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9698         checkit("123.456", buf);
9699
9700         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9701         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9702         /* 34 should be enough to scare even long double
9703          * places into using the e notation. */
9704         if (strlen(buf) > 5)
9705             checkit("1e+034", buf); /* for Microsoft */
9706         else
9707             checkit("1e+34", buf);
9708
9709         /* For Perl, if you add additional tests here, also add them to
9710          * t/base/num.t for benefit of platforms not using Configure or
9711          * overriding d_Gconvert */
9712
9713         exit(0);
9714 }
9715 EOP
9716 : first add preferred functions to our list
9717 xxx_list=""
9718 for xxx_convert in $gconvert_preference; do
9719     case $xxx_convert in
9720     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9721     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9722     esac
9723 done
9724 : then add any others
9725 for xxx_convert in gconvert gcvt sprintf; do
9726     case "$xxx_list" in
9727     *$xxx_convert*) ;;
9728     *) xxx_list="$xxx_list $xxx_convert" ;;
9729     esac
9730 done
9731
9732 case "$d_longdbl$uselongdouble" in
9733 "$define$define")
9734     : again, add prefered functions to our list first
9735     xxx_ld_list=""
9736     for xxx_convert in $gconvert_ld_preference; do
9737         case $xxx_convert in
9738         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9739         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9740         esac
9741     done
9742     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9743     for xxx_convert in qgcvt sprintf $xxx_list; do
9744         case "$xxx_ld_list" in
9745         $xxx_convert*|*" $xxx_convert"*) ;;
9746         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9747         esac
9748     done
9749     : if sprintf cannot do long doubles, move it to the end
9750     if test "$d_PRIgldbl" != "$define"; then
9751         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9752     fi
9753     : if no qgcvt, remove it
9754     if test "$d_qgcvt" != "$define"; then
9755         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9756     fi
9757     : use the ld_list
9758     xxx_list="$xxx_ld_list"
9759     ;;
9760 esac
9761
9762 for xxx_convert in $xxx_list; do
9763         echo "Trying $xxx_convert..."
9764         $rm -f try try$_o core
9765         set try -DTRY_$xxx_convert
9766         if eval $compile; then
9767                 echo "$xxx_convert() found." >&4
9768                 if $run ./try; then
9769                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9770                         break;
9771                 else
9772                         echo "...But $xxx_convert didn't work as I expected."
9773                         xxx_convert=''
9774                 fi
9775         else
9776                 echo "$xxx_convert NOT found." >&4
9777         fi
9778 done
9779
9780 if test X$xxx_convert = X; then
9781     echo "*** WHOA THERE!!! ***" >&4
9782     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9783     xxx_convert=sprintf
9784 fi
9785
9786 case "$xxx_convert" in
9787 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9788 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9789 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9790 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9791    "$define$define$define")
9792       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9793    "$define$define$undef")
9794       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9795    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9796    esac
9797    ;;
9798 esac
9799
9800 fi
9801 $rm_try
9802
9803 : see if _fwalk exists
9804 set fwalk d__fwalk
9805 eval $inlibc
9806
9807 : Initialize h_fcntl
9808 h_fcntl=false
9809
9810 : Initialize h_sysfile
9811 h_sysfile=false
9812
9813 : access call always available on UNIX
9814 set access d_access
9815 eval $inlibc
9816
9817 : locate the flags for 'access()'
9818 case "$d_access" in
9819 "$define")
9820         echo " "
9821         $cat >access.c <<EOCP
9822 #include <sys/types.h>
9823 #ifdef I_FCNTL
9824 #include <fcntl.h>
9825 #endif
9826 #ifdef I_SYS_FILE
9827 #include <sys/file.h>
9828 #endif
9829 #ifdef I_UNISTD
9830 #include <unistd.h>
9831 #endif
9832 #$i_stdlib I_STDLIB
9833 #ifdef I_STDLIB
9834 #include <stdlib.h>
9835 #endif
9836 int main() {
9837         exit(R_OK);
9838 }
9839 EOCP
9840         : check sys/file.h first, no particular reason here
9841         if $test `./findhdr sys/file.h` && \
9842                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9843                 h_sysfile=true;
9844                 echo "<sys/file.h> defines the *_OK access constants." >&4
9845         elif $test `./findhdr fcntl.h` && \
9846                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9847                 h_fcntl=true;
9848                 echo "<fcntl.h> defines the *_OK access constants." >&4
9849         elif $test `./findhdr unistd.h` && \
9850                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9851                 echo "<unistd.h> defines the *_OK access constants." >&4
9852         else
9853                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9854         fi
9855         ;;
9856 esac
9857 $rm -f access*
9858
9859 : see if accessx exists
9860 set accessx d_accessx
9861 eval $inlibc
9862
9863 : see if aintl exists
9864 set aintl d_aintl
9865 eval $inlibc
9866
9867 : see if alarm exists
9868 set alarm d_alarm
9869 eval $inlibc
9870
9871 : see if POSIX threads are available
9872 set pthread.h i_pthread
9873 eval $inhdr
9874
9875 : define a fucntion to check prototypes
9876 $cat > protochk <<EOSH
9877 $startsh
9878 cc="$cc"
9879 optimize="$optimize"
9880 ccflags="$ccflags"
9881 prototype="$prototype"
9882 define="$define"
9883 rm_try="$rm_try"
9884 usethreads=$usethreads
9885 i_pthread=$i_pthread
9886 pthread_h_first=$pthread_h_first
9887 EOSH
9888
9889 $cat >> protochk <<'EOSH'
9890
9891 $rm_try
9892 foo="$1"
9893 shift
9894 while test $# -ge 2; do
9895         case "$1" in
9896                 $define) echo "#include <$2>" >> try.c ;;
9897                 literal) echo "$2" >> try.c ;;
9898         esac
9899     # Extra magic for the benefit of systems that need pthread.h
9900     # to be included early to correctly detect threadsafe functions.
9901     # Such functions must guarantee themselves, though, that the usethreads
9902     # and i_pthread have been defined, before calling protochk.
9903     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9904         echo "#include <pthread.h>" >> try.c
9905         pthread_h_done=yes
9906     fi
9907     shift 2
9908 done
9909 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9910 cat >> try.c <<'EOCP'
9911 #ifdef CAN_PROTOTYPE
9912 #define _(args) args
9913 #else
9914 #define _(args) ()
9915 #endif
9916 EOCP
9917 echo "$foo" >> try.c
9918 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9919 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9920 status=$?
9921 $rm_try
9922 exit $status
9923 EOSH
9924 chmod +x protochk
9925 $eunicefix protochk
9926
9927 : Define hasproto macro for Configure internal use
9928 hasproto='varname=$1; func=$2; shift; shift;
9929 while $test $# -ge 2; do
9930         case "$1" in
9931         $define) echo "#include <$2>";;
9932         esac ;
9933     shift 2;
9934 done > try.c;
9935 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9936 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9937         echo "$func() prototype found.";
9938         val="$define";
9939 else
9940         echo "$func() prototype NOT found.";
9941         val="$undef";
9942 fi;
9943 set $varname;
9944 eval $setvar;
9945 $rm_try tryout.c'
9946
9947 : see if sys/types.h has to be included
9948 set sys/types.h i_systypes
9949 eval $inhdr
9950
9951 : see if sys/select.h has to be included
9952 set sys/select.h i_sysselct
9953 eval $inhdr
9954
9955 : Define hasfield macro for Configure internal use
9956 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9957 while $test $# -ge 2; do
9958         case "$1" in
9959         $define) echo "#include <$2>";;
9960         esac ;
9961     shift 2;
9962 done > try.c;
9963 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9964 set try;
9965 if eval $compile; then
9966         val="$define";
9967 else
9968         val="$undef";
9969 fi;
9970 set $varname;
9971 eval $setvar;
9972 $rm_try'
9973
9974 : see if we should include time.h, sys/time.h, or both
9975 echo " "
9976 if test "X$timeincl" = X; then
9977         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9978         $echo $n "I'm now running the test program...$c"
9979         $cat >try.c <<EOCP
9980 #include <sys/types.h>
9981 #ifdef I_TIME
9982 #include <time.h>
9983 #endif
9984 #ifdef I_SYSTIME
9985 #ifdef SYSTIMEKERNEL
9986 #define KERNEL
9987 #endif
9988 #include <sys/time.h>
9989 #endif
9990 #ifdef I_SYSSELECT
9991 #include <sys/select.h>
9992 #endif
9993 #$i_stdlib I_STDLIB
9994 #ifdef I_STDLIB
9995 #include <stdlib.h>
9996 #endif
9997 int main()
9998 {
9999         struct tm foo;
10000 #ifdef S_TIMEVAL
10001         struct timeval bar;
10002 #endif
10003 #ifdef S_TIMEZONE
10004         struct timezone tzp;
10005 #endif
10006         if (foo.tm_sec == foo.tm_sec)
10007                 exit(0);
10008 #ifdef S_TIMEVAL
10009         if (bar.tv_sec == bar.tv_sec)
10010                 exit(0);
10011 #endif
10012         exit(1);
10013 }
10014 EOCP
10015         flags=''
10016         for s_timezone in '-DS_TIMEZONE' ''; do
10017         sysselect=''
10018         for s_timeval in '-DS_TIMEVAL' ''; do
10019         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10020         for i_time in '' '-DI_TIME'; do
10021         for i_systime in '-DI_SYSTIME' ''; do
10022                 case "$flags" in
10023                 '') $echo $n ".$c"
10024                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10025                         if eval $compile; then
10026                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10027                                 shift
10028                                 flags="$*"
10029                                 echo " "
10030                                 $echo $n "Succeeded with $flags$c"
10031                         fi
10032                         ;;
10033                 esac
10034         done
10035         done
10036         done
10037         done
10038         done
10039         timeincl=''
10040         echo " "
10041         case "$flags" in
10042         *SYSTIMEKERNEL*) i_systimek="$define"
10043                 timeincl=`./findhdr sys/time.h`
10044                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10045         *) i_systimek="$undef";;
10046         esac
10047         case "$flags" in
10048         *I_TIME*) i_time="$define"
10049                 timeincl=`./findhdr time.h`" $timeincl"
10050                 echo "We'll include <time.h>." >&4;;
10051         *) i_time="$undef";;
10052         esac
10053         case "$flags" in
10054         *I_SYSTIME*) i_systime="$define"
10055                 timeincl=`./findhdr sys/time.h`" $timeincl"
10056                 echo "We'll include <sys/time.h>." >&4;;
10057         *) i_systime="$undef";;
10058         esac
10059         $rm_try
10060 fi
10061 : see if struct tm knows about tm_zone
10062 case "$i_systime$i_time" in
10063 *$define*)
10064         echo " "
10065         echo "Checking to see if your struct tm has tm_zone field..." >&4
10066         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10067         eval $hasfield
10068         ;;
10069 *)      val="$undef"
10070         set d_tm_tm_zone
10071         eval $setvar
10072         ;;
10073 esac
10074 case "$d_tm_tm_zone" in
10075 "$define")      echo "Yes, it does."   ;;
10076 *)              echo "No, it doesn't." ;;
10077 esac
10078 : see if struct tm knows about tm_gmtoff
10079 case "$i_systime$i_time" in
10080 *$define*)
10081         echo " "
10082         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10083         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10084         eval $hasfield
10085         ;;
10086 *)      val="$undef"
10087         set d_tm_tm_gmtoff
10088         eval $setvar
10089         ;;
10090 esac
10091 case "$d_tm_tm_gmtoff" in
10092 "$define")      echo "Yes, it does."   ;;
10093 *)              echo "No, it doesn't." ;;
10094 esac
10095
10096 : see if asctime_r exists
10097 set asctime_r d_asctime_r
10098 eval $inlibc
10099 case "$d_asctime_r" in
10100 "$define")
10101         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10102         case "$d_asctime_r_proto:$usethreads" in
10103         ":define")      d_asctime_r_proto=define
10104                 set d_asctime_r_proto asctime_r $hdrs
10105                 eval $hasproto ;;
10106         *)      ;;
10107         esac
10108         case "$d_asctime_r_proto" in
10109         define)
10110         case "$asctime_r_proto" in
10111         ''|0) try='char* asctime_r(const struct tm*, char*);'
10112         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
10113         esac
10114         case "$asctime_r_proto" in
10115         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10116         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
10117         esac
10118         case "$asctime_r_proto" in
10119         ''|0) try='int asctime_r(const struct tm*, char*);'
10120         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
10121         esac
10122         case "$asctime_r_proto" in
10123         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10124         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
10125         esac
10126         case "$asctime_r_proto" in
10127         ''|0)   d_asctime_r=undef
10128                 asctime_r_proto=0
10129                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10130         * )     case "$asctime_r_proto" in
10131                 REENTRANT_PROTO*) ;;
10132                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10133                 esac
10134                 echo "Prototype: $try" ;;
10135         esac
10136         ;;
10137         *)      case "$usethreads" in
10138                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10139                 esac
10140                 d_asctime_r=undef
10141                 asctime_r_proto=0
10142                 ;;
10143         esac
10144         ;;
10145 *)      asctime_r_proto=0
10146         ;;
10147 esac
10148
10149 : see if atolf exists
10150 set atolf d_atolf
10151 eval $inlibc
10152
10153 : see if atoll exists
10154 set atoll d_atoll
10155 eval $inlibc
10156
10157 : Look for GCC-style attribute format
10158 case "$d_attribute_format" in
10159 '')
10160 echo " "
10161 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10162 $cat >attrib.c <<'EOCP'
10163 #include <stdio.h>
10164 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10165 EOCP
10166 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10167         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10168                 echo "Your C compiler doesn't support __attribute__((format))."
10169                 val="$undef"
10170         else
10171                 echo "Your C compiler supports __attribute__((format))."
10172                 val="$define"
10173         fi
10174 else
10175         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10176         val="$undef"
10177 fi
10178 ;;
10179 *) val="$d_attribute_format" ;;
10180 esac
10181 set d_attribute_format
10182 eval $setvar
10183 $rm -f attrib*
10184
10185 : Look for GCC-style attribute format with null format allowed
10186 case "$d_printf_format_null" in
10187 '') case "$d_attribute_format" in
10188     $define)
10189         echo " "
10190         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10191 $cat >attrib.c <<EOCP
10192 #include <stdio.h>
10193 #$i_stdlib I_STDLIB
10194 #ifdef I_STDLIB
10195 #include <stdlib.h>
10196 #endif
10197 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10198 int null_printf (char* pat,...) { return (int)pat; }
10199 int main () { exit(null_printf(NULL)); }
10200 EOCP
10201         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10202             : run the executable in case it produces a run-time warning
10203             if $run ./attrib >>attrib.out 2>&1; then
10204                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10205                     echo "Your C compiler doesn't allow __printf__ format to be null."
10206                     val="$undef"
10207                 else
10208                     echo "Your C compiler allows __printf__ format to be null."
10209                     val="$define"
10210                 fi
10211             else
10212             echo "Your C compiler executable failed with __printf__ format null."
10213             val="$undef"
10214         fi
10215     else
10216         echo "Your C compiler fails with __printf__ format null."
10217         val="$undef"
10218     fi
10219     ;;
10220     *)  val="$undef" ;;
10221     esac
10222 ;;
10223 *)  val="$d_printf_format_null" ;;
10224 esac
10225 set d_printf_format_null
10226 eval $setvar
10227 $rm -f attrib*
10228
10229 : Look for GCC-style attribute malloc
10230 case "$d_attribute_malloc" in
10231 '')
10232 echo " "
10233 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10234 $cat >attrib.c <<'EOCP'
10235 #include <stdio.h>
10236 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10237 EOCP
10238 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10239         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10240                 echo "Your C compiler doesn't support __attribute__((malloc))."
10241                 val="$undef"
10242         else
10243                 echo "Your C compiler supports __attribute__((malloc))."
10244                 val="$define"
10245         fi
10246 else
10247         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10248         val="$undef"
10249 fi
10250 ;;
10251 *) val="$d_attribute_malloc" ;;
10252 esac
10253 set d_attribute_malloc
10254 eval $setvar
10255 $rm -f attrib*
10256
10257 : Look for GCC-style attribute nonnull
10258 case "$d_attribute_nonnull" in
10259 '')
10260 echo " "
10261 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10262 $cat >attrib.c <<'EOCP'
10263 #include <stdio.h>
10264 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10265 EOCP
10266 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10267         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10268                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10269                 val="$undef"
10270         else
10271                 echo "Your C compiler supports __attribute__((nonnull))."
10272                 val="$define"
10273         fi
10274 else
10275         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10276         val="$undef"
10277 fi
10278 ;;
10279 *) val="$d_attribute_nonnull" ;;
10280 esac
10281 set d_attribute_nonnull
10282 eval $setvar
10283 $rm -f attrib*
10284
10285 : Look for GCC-style attribute noreturn
10286 case "$d_attribute_noreturn" in
10287 '')
10288 echo " "
10289 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10290 $cat >attrib.c <<'EOCP'
10291 #include <stdio.h>
10292 void fall_over_dead( void ) __attribute__((noreturn));
10293 EOCP
10294 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10295         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10296                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10297                 val="$undef"
10298         else
10299                 echo "Your C compiler supports __attribute__((noreturn))."
10300                 val="$define"
10301         fi
10302 else
10303         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10304         val="$undef"
10305 fi
10306 ;;
10307 *) val="$d_attribute_noreturn" ;;
10308 esac
10309 set d_attribute_noreturn
10310 eval $setvar
10311 $rm -f attrib*
10312
10313 : Look for GCC-style attribute pure
10314 case "$d_attribute_pure" in
10315 '')
10316 echo " "
10317 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10318 $cat >attrib.c <<'EOCP'
10319 #include <stdio.h>
10320 int square( int n ) __attribute__((pure));
10321 EOCP
10322 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10323         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10324                 echo "Your C compiler doesn't support __attribute__((pure))."
10325                 val="$undef"
10326         else
10327                 echo "Your C compiler supports __attribute__((pure))."
10328                 val="$define"
10329         fi
10330 else
10331         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10332         val="$undef"
10333 fi
10334 ;;
10335 *) val="$d_attribute_pure" ;;
10336 esac
10337 set d_attribute_pure
10338 eval $setvar
10339 $rm -f attrib*
10340
10341 : Look for GCC-style attribute unused
10342 case "$d_attribute_unused" in
10343 '')
10344 echo " "
10345 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10346 $cat >attrib.c <<'EOCP'
10347 #include <stdio.h>
10348 int do_something( int dummy __attribute__((unused)), int n );
10349 EOCP
10350 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10351         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10352                 echo "Your C compiler doesn't support __attribute__((unused))."
10353                 val="$undef"
10354         else
10355                 echo "Your C compiler supports __attribute__((unused))."
10356                 val="$define"
10357         fi
10358 else
10359         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10360         val="$undef"
10361 fi
10362 ;;
10363 *) val="$d_attribute_unused" ;;
10364 esac
10365 set d_attribute_unused
10366 eval $setvar
10367 $rm -f attrib*
10368
10369 : Look for GCC-style attribute warn_unused_result
10370 case "$d_attribute_warn_unused_result" in
10371 '')
10372 echo " "
10373 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10374 $cat >attrib.c <<'EOCP'
10375 #include <stdio.h>
10376 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10377 EOCP
10378 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10379         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10380                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10381                 val="$undef"
10382         else
10383                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10384                 val="$define"
10385         fi
10386 else
10387         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10388         val="$undef"
10389 fi
10390 ;;
10391 *) val="$d_attribute_warn_unused_result" ;;
10392 esac
10393 set d_attribute_warn_unused_result
10394 eval $setvar
10395 $rm -f attrib*
10396
10397 : see if bcmp exists
10398 set bcmp d_bcmp
10399 eval $inlibc
10400
10401 : see if bcopy exists
10402 set bcopy d_bcopy
10403 eval $inlibc
10404
10405 : see if getpgrp exists
10406 set getpgrp d_getpgrp
10407 eval $inlibc
10408
10409 case "$d_getpgrp" in
10410 "$define")
10411         echo " "
10412         echo "Checking to see which flavor of getpgrp is in use..."
10413         $cat >try.c <<EOP
10414 #$i_unistd I_UNISTD
10415 #include <sys/types.h>
10416 #ifdef I_UNISTD
10417 #  include <unistd.h>
10418 #endif
10419 #$i_stdlib I_STDLIB
10420 #ifdef I_STDLIB
10421 #include <stdlib.h>
10422 #endif
10423 int main()
10424 {
10425         if (getuid() == 0) {
10426                 printf("(I see you are running Configure as super-user...)\n");
10427                 setuid(1);
10428         }
10429 #ifdef TRY_BSD_PGRP
10430         if (getpgrp(1) == 0)
10431                 exit(0);
10432 #else
10433         if (getpgrp() > 0)
10434                 exit(0);
10435 #endif
10436         exit(1);
10437 }
10438 EOP
10439         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10440                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10441                 val="$define"
10442         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10443                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10444                 val="$undef"
10445         else
10446                 echo "I can't seem to compile and run the test program."
10447                 if ./usg; then
10448                         xxx="a USG one, i.e. you use getpgrp()."
10449                 else
10450                         # SVR4 systems can appear rather BSD-ish.
10451                         case "$i_unistd" in
10452                         $undef)
10453                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10454                                 val="$define"
10455                                 ;;
10456                         $define)
10457                                 xxx="probably a USG one, i.e. you use getpgrp()."
10458                                 val="$undef"
10459                                 ;;
10460                         esac
10461                 fi
10462                 echo "Assuming your getpgrp is $xxx" >&4
10463         fi
10464         ;;
10465 *) val="$undef";;
10466 esac
10467 set d_bsdgetpgrp
10468 eval $setvar
10469 $rm_try
10470
10471 : see if setpgrp exists
10472 set setpgrp d_setpgrp
10473 eval $inlibc
10474
10475 case "$d_setpgrp" in
10476 "$define")
10477         echo " "
10478         echo "Checking to see which flavor of setpgrp is in use..."
10479         $cat >try.c <<EOP
10480 #$i_unistd I_UNISTD
10481 #include <sys/types.h>
10482 #ifdef I_UNISTD
10483 #  include <unistd.h>
10484 #endif
10485 #$i_stdlib I_STDLIB
10486 #ifdef I_STDLIB
10487 #include <stdlib.h>
10488 #endif
10489 int main()
10490 {
10491         if (getuid() == 0) {
10492                 printf("(I see you are running Configure as super-user...)\n");
10493                 setuid(1);
10494         }
10495 #ifdef TRY_BSD_PGRP
10496         if (-1 == setpgrp(1, 1))
10497                 exit(0);
10498 #else
10499         if (setpgrp() != -1)
10500                 exit(0);
10501 #endif
10502         exit(1);
10503 }
10504 EOP
10505         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10506                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10507                 val="$define"
10508         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10509                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10510                 val="$undef"
10511         else
10512                 echo "(I can't seem to compile and run the test program.)"
10513                 if ./usg; then
10514                         xxx="a USG one, i.e. you use setpgrp()."
10515                 else
10516                         # SVR4 systems can appear rather BSD-ish.
10517                         case "$i_unistd" in
10518                         $undef)
10519                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10520                                 val="$define"
10521                                 ;;
10522                         $define)
10523                                 xxx="probably a USG one, i.e. you use setpgrp()."
10524                                 val="$undef"
10525                                 ;;
10526                         esac
10527                 fi
10528                 echo "Assuming your setpgrp is $xxx" >&4
10529         fi
10530         ;;
10531 *) val="$undef";;
10532 esac
10533 set d_bsdsetpgrp
10534 eval $setvar
10535 $rm_try
10536
10537 : Look for GCC-style __builtin_choose_expr
10538 case "$d_builtin_choose_expr" in
10539 '')
10540     echo " "
10541     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10542     $cat >try.c <<'EOCP'
10543 #include <assert.h>
10544 #include <stdlib.h>
10545 #include <stdio.h>
10546
10547 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10548
10549 int main(void) {
10550     assert( SYRINX(1) == 2112 );
10551     assert( SYRINX(1) != 5150 );
10552     assert( SYRINX(0) == 5150 );
10553     assert( SYRINX(0) != 2112 );
10554     puts( "All good!" );
10555     exit(0);
10556 }
10557
10558 EOCP
10559     set try
10560     if eval $compile; then
10561         echo "Your C compiler supports __builtin_choose_expr."
10562         val="$define"
10563     else
10564         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10565         val="$undef"
10566     fi
10567 ;;
10568 *) val="$d_builtin_choose_expr" ;;
10569 esac
10570
10571 set d_builtin_choose_expr
10572 eval $setvar
10573 $rm_try
10574
10575 : Look for GCC-style __builtin_expect
10576 case "$d_builtin_expect" in
10577 '')
10578     echo " "
10579     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10580     $cat >builtin.c <<'EOCP'
10581 int main(void) {
10582     int n = 50;
10583     if ( __builtin_expect(n, 0) ) n = 1;
10584 }
10585 EOCP
10586     set try
10587     if eval $compile; then
10588         echo "Your C compiler supports __builtin_choose_expr."
10589         val="$define"
10590     else
10591         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10592         val="$undef"
10593     fi
10594     ;;
10595 *) val="$d_builtin_expect" ;;
10596 esac
10597
10598 set d_builtin_expect
10599 eval $setvar
10600 $rm_try
10601
10602 : see if bzero exists
10603 set bzero d_bzero
10604 eval $inlibc
10605
10606 : see if stdarg is available
10607 echo " "
10608 if $test `./findhdr stdarg.h`; then
10609         echo "<stdarg.h> found." >&4
10610         valstd="$define"
10611 else
10612         echo "<stdarg.h> NOT found." >&4
10613         valstd="$undef"
10614 fi
10615
10616 : see if varags is available
10617 echo " "
10618 if $test `./findhdr varargs.h`; then
10619         echo "<varargs.h> found." >&4
10620 else
10621         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10622 fi
10623
10624 : set up the varargs testing programs
10625 $cat > varargs.c <<EOP
10626 #ifdef I_STDARG
10627 #include <stdarg.h>
10628 #endif
10629 #ifdef I_VARARGS
10630 #include <varargs.h>
10631 #endif
10632
10633 #ifdef I_STDARG
10634 int f(char *p, ...)
10635 #else
10636 int f(va_alist)
10637 va_dcl
10638 #endif
10639 {
10640         va_list ap;
10641 #ifndef I_STDARG
10642         char *p;
10643 #endif
10644 #ifdef I_STDARG
10645         va_start(ap,p);
10646 #else
10647         va_start(ap);
10648         p = va_arg(ap, char *);
10649 #endif
10650         va_end(ap);
10651         return 0;
10652 }
10653 EOP
10654 $cat > varargs <<EOP
10655 $startsh
10656 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10657         echo "true"
10658 else
10659         echo "false"
10660 fi
10661 $rm -f varargs$_o
10662 EOP
10663 chmod +x varargs
10664
10665 : now check which varargs header should be included
10666 echo " "
10667 i_varhdr=''
10668 case "$valstd" in
10669 "$define")
10670         if `./varargs I_STDARG`; then
10671                 val='stdarg.h'
10672         elif `./varargs I_VARARGS`; then
10673                 val='varargs.h'
10674         fi
10675         ;;
10676 *)
10677         if `./varargs I_VARARGS`; then
10678                 val='varargs.h'
10679         fi
10680         ;;
10681 esac
10682 case "$val" in
10683 '')
10684 echo "I could not find the definition for va_dcl... You have problems..." >&4
10685         val="$undef"; set i_stdarg; eval $setvar
10686         val="$undef"; set i_varargs; eval $setvar
10687         ;;
10688 *)
10689         set i_varhdr
10690         eval $setvar
10691         case "$i_varhdr" in
10692         stdarg.h)
10693                 val="$define"; set i_stdarg; eval $setvar
10694                 val="$undef"; set i_varargs; eval $setvar
10695                 ;;
10696         varargs.h)
10697                 val="$undef"; set i_stdarg; eval $setvar
10698                 val="$define"; set i_varargs; eval $setvar
10699                 ;;
10700         esac
10701         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10702 esac
10703 $rm -f varargs*
10704
10705 : see if the Compiler supports C99 variadic macros
10706 case "$i_stdarg$i_stdlib" in
10707     "$define$define")
10708     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10709     $cat >try.c <<EOCP
10710 #include <stdio.h>
10711 #include <stdarg.h>
10712
10713 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10714
10715 int main() {
10716   char buf[20];
10717   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10718   puts(buf);
10719   return 0;
10720 }
10721 EOCP
10722     set try
10723     if eval $compile && $run ./try 2>&1 >/dev/null; then
10724         case "`$run ./try`" in
10725             "123 456 789")
10726             echo "You have C99 variadic macros." >&4
10727             d_c99_variadic_macros="$define"
10728             ;;
10729             *)
10730             echo "You don't have functional C99 variadic macros." >&4
10731             d_c99_variadic_macros="$undef"
10732             ;;
10733         esac
10734     else
10735         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10736         d_c99_variadic_macros="$undef"
10737     fi
10738     $rm_try
10739     ;;
10740     *)
10741     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10742     d_c99_variadic_macros="$undef"
10743     ;;
10744 esac
10745
10746 : see if signal is declared as pointer to function returning int or void
10747 echo " "
10748 xxx=`./findhdr signal.h`
10749 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10750 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10751         echo "You have int (*signal())() instead of void." >&4
10752         val="$undef"
10753 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10754         echo "You have void (*signal())()." >&4
10755         val="$define"
10756 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10757         echo "You have int (*signal())() instead of void." >&4
10758         val="$undef"
10759 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10760         echo "You have void (*signal())()." >&4
10761         val="$define"
10762 else
10763         case "$d_voidsig" in
10764         '')
10765         echo "I can't determine whether signal handler returns void or int..." >&4
10766                 dflt=void
10767                 rp="What type does your signal handler return?"
10768                 . ./myread
10769                 case "$ans" in
10770                 v*) val="$define";;
10771                 *) val="$undef";;
10772                 esac;;
10773         "$define")
10774                 echo "As you already told me, signal handler returns void." >&4
10775                 val="$define"
10776                 ;;
10777         *)      echo "As you already told me, signal handler returns int." >&4
10778                 val="$undef"
10779                 ;;
10780         esac
10781 fi
10782 set d_voidsig
10783 eval $setvar
10784 case "$d_voidsig" in
10785 "$define") signal_t="void";;
10786 *) signal_t="int";;
10787 esac
10788 $rm -f $$.tmp
10789
10790 : check for ability to cast large floats to 32-bit ints.
10791 echo " "
10792 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10793 if $test "$intsize" -ge 4; then
10794         xxx=int
10795 else
10796         xxx=long
10797 fi
10798 $cat >try.c <<EOCP
10799 #include <stdio.h>
10800 #$i_stdlib I_STDLIB
10801 #ifdef I_STDLIB
10802 #include <stdlib.h>
10803 #endif
10804 #include <sys/types.h>
10805 #include <signal.h>
10806 $signal_t blech(int s) { exit(3); }
10807 int main()
10808 {
10809         $xxx i32;
10810         double f, g;
10811         int result = 0;
10812         char str[16];
10813         signal(SIGFPE, blech);
10814
10815         /* Don't let compiler optimize the test away.  Store the number
10816            in a writable string for gcc to pass to sscanf under HP/UX.
10817         */
10818         sprintf(str, "2147483647");
10819         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10820         g = 10 * f;
10821         i32  = ($xxx) g;
10822
10823         /* x86 processors will probably give 0x8000 0000, which is a
10824            sign change.  We don't want that.  We want to mimic SPARC
10825            behavior here, which is to preserve the sign and give
10826            back 0x7fff ffff.
10827         */
10828         if (i32 != ($xxx) f)
10829                 result |= 1;
10830         exit(result);
10831 }
10832 EOCP
10833 set try
10834 if eval $compile_ok; then
10835         $run ./try
10836         yyy=$?
10837 else
10838         echo "(I can't seem to compile the test program--assuming it can't)"
10839         yyy=1
10840 fi
10841 case "$yyy" in
10842 0)      val="$define"
10843         echo "Yup, it can."
10844         ;;
10845 *)      val="$undef"
10846         echo "Nope, it can't."
10847         ;;
10848 esac
10849 set d_casti32
10850 eval $setvar
10851 $rm_try
10852
10853 : check for ability to cast negative floats to unsigned
10854 echo " "
10855 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10856 $cat >try.c <<EOCP
10857 #include <stdio.h>
10858 #$i_stdlib I_STDLIB
10859 #ifdef I_STDLIB
10860 #include <stdlib.h>
10861 #endif
10862 #include <sys/types.h>
10863 #include <signal.h>
10864 $signal_t blech(int s) { exit(7); }
10865 $signal_t blech_in_list(int s) { exit(4); }
10866 unsigned long dummy_long(unsigned long p) { return p; }
10867 unsigned int dummy_int(unsigned int p) { return p; }
10868 unsigned short dummy_short(unsigned short p) { return p; }
10869 int main()
10870 {
10871         double f;
10872         unsigned long along;
10873         unsigned int aint;
10874         unsigned short ashort;
10875         int result = 0;
10876         char str[16];
10877
10878         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10879            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10880            optimized the whole file away
10881         */
10882         /* Store the number in a writable string for gcc to pass to
10883            sscanf under HP/UX.
10884         */
10885         sprintf(str, "-123");
10886         sscanf(str, "%lf", &f);  /* f = -123.; */
10887
10888         signal(SIGFPE, blech);
10889         along = (unsigned long)f;
10890         aint = (unsigned int)f;
10891         ashort = (unsigned short)f;
10892         if (along != (unsigned long)-123)
10893                 result |= 1;
10894         if (aint != (unsigned int)-123)
10895                 result |= 1;
10896         if (ashort != (unsigned short)-123)
10897                 result |= 1;
10898         sprintf(str, "1073741824.");
10899         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10900         f = f + f;
10901         along = 0;
10902         along = (unsigned long)f;
10903         if (along != 0x80000000)
10904                 result |= 2;
10905         f -= 1.;
10906         along = 0;
10907         along = (unsigned long)f;
10908         if (along != 0x7fffffff)
10909                 result |= 1;
10910         f += 2.;
10911         along = 0;
10912         along = (unsigned long)f;
10913         if (along != 0x80000001)
10914                 result |= 2;
10915         if (result)
10916                 exit(result);
10917         signal(SIGFPE, blech_in_list);
10918         sprintf(str, "123.");
10919         sscanf(str, "%lf", &f);  /* f = 123.; */
10920         along = dummy_long((unsigned long)f);
10921         aint = dummy_int((unsigned int)f);
10922         ashort = dummy_short((unsigned short)f);
10923         if (along != (unsigned long)123)
10924                 result |= 4;
10925         if (aint != (unsigned int)123)
10926                 result |= 4;
10927         if (ashort != (unsigned short)123)
10928                 result |= 4;
10929         exit(result);
10930
10931 }
10932 EOCP
10933 set try
10934 if eval $compile_ok; then
10935         $run ./try
10936         castflags=$?
10937 else
10938         echo "(I can't seem to compile the test program--assuming it can't)"
10939         castflags=7
10940 fi
10941 case "$castflags" in
10942 0)      val="$define"
10943         echo "Yup, it can."
10944         ;;
10945 *)      val="$undef"
10946         echo "Nope, it can't."
10947         ;;
10948 esac
10949 set d_castneg
10950 eval $setvar
10951 $rm_try
10952
10953 : see if vprintf exists
10954 echo " "
10955 if set vprintf val -f d_vprintf; eval $csym; $val; then
10956         echo 'vprintf() found.' >&4
10957         val="$define"
10958         $cat >try.c <<EOF
10959 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
10960 #$i_varargs I_VARARGS
10961
10962 #$i_stdlib I_STDLIB
10963 #$i_unistd I_UNISTD
10964
10965 #ifdef I_STDARG
10966 #  include <stdarg.h>
10967 #else /* I_VARARGS */
10968 #  include <varargs.h>
10969 #endif
10970
10971 #ifdef I_UNISTD
10972 #  include <unistd.h>
10973 #endif
10974
10975 #ifdef I_STDLIB
10976 #  include <stdlib.h>
10977 #endif
10978
10979 #include <stdio.h> /* vsprintf prototype */
10980
10981 #ifdef I_STDARG
10982 void xxx(int n, ...)
10983 {
10984     va_list args;
10985     char buf[10];
10986     va_start(args, n);
10987     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10988 }
10989 int main() { xxx(1, "foo"); }
10990
10991 #else /* I_VARARGS */
10992
10993 xxx(va_alist)
10994 va_dcl
10995 {
10996     va_list args;
10997     char buf[10];
10998     va_start(args);
10999     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11000 }
11001 int main() { xxx("foo"); }
11002
11003 #endif
11004
11005 EOF
11006         set try
11007         if eval $compile_ok; then
11008                 if $run ./try; then
11009                         echo "Your vsprintf() returns (int)." >&4
11010                         val2="$undef"
11011                 else
11012                         echo "Your vsprintf() returns (char*)." >&4
11013                         val2="$define"
11014                 fi
11015         else
11016                 echo 'I am unable to compile the vsprintf() test program.' >&4
11017                 # We shouldn't get here.  If we do, assume the standard signature,
11018                 # not the old BSD one.
11019                 echo 'Guessing that vsprintf() returns (int).' >&4
11020                 val2="$undef"
11021         fi
11022 else
11023         echo 'vprintf() NOT found.' >&4
11024         val="$undef"
11025         val2="$undef"
11026 fi
11027 $rm_try
11028 set d_vprintf
11029 eval $setvar
11030 val=$val2
11031 set d_charvspr
11032 eval $setvar
11033
11034 : see if chown exists
11035 set chown d_chown
11036 eval $inlibc
11037
11038 : see if chroot exists
11039 set chroot d_chroot
11040 eval $inlibc
11041
11042 : see if chsize exists
11043 set chsize d_chsize
11044 eval $inlibc
11045
11046 : see if class exists
11047 set class d_class
11048 eval $inlibc
11049
11050 : see if clearenv exists
11051 set clearenv d_clearenv
11052 eval $inlibc
11053
11054 : Define hasstruct macro for Configure internal use
11055 hasstruct='varname=$1; struct=$2; shift; shift;
11056 while $test $# -ge 2; do
11057         case "$1" in
11058         $define) echo "#include <$2>";;
11059         esac ;
11060     shift 2;
11061 done > try.c;
11062 echo "int main () { struct $struct foo; }" >> try.c;
11063 set try;
11064 if eval $compile; then
11065         val="$define";
11066 else
11067         val="$undef";
11068 fi;
11069 set $varname;
11070 eval $setvar;
11071 $rm_try'
11072
11073 : see whether socket exists
11074 socketlib=''
11075 sockethdr=''
11076 echo " "
11077 $echo $n "Hmm... $c" >&4
11078 if set socket val -f d_socket; eval $csym; $val; then
11079         echo "Looks like you have Berkeley networking support." >&4
11080         d_socket="$define"
11081         if set setsockopt val -f; eval $csym; $val; then
11082                 d_oldsock="$undef"
11083         else
11084                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11085                 d_oldsock="$define"
11086         fi
11087 else
11088         if $contains socklib libc.list >/dev/null 2>&1; then
11089                 echo "Looks like you have Berkeley networking support." >&4
11090                 d_socket="$define"
11091                 : we will have to assume that it supports the 4.2 BSD interface
11092                 d_oldsock="$undef"
11093         else
11094                 echo "You don't have Berkeley networking in libc$_a..." >&4
11095                 if test "X$d_socket" = "X$define"; then
11096                    echo "...but you seem to believe that you have sockets." >&4
11097                 else
11098                         for net in net socket
11099                         do
11100                                 if test -f /usr/lib/lib$net$_a; then
11101                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11102                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11103                                         if $contains socket libc.list >/dev/null 2>&1; then
11104                                                 d_socket="$define"
11105                                                 socketlib="-l$net"
11106                                                 case "$net" in
11107                                                 net)
11108                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11109                                                         sockethdr="-I/usr/netinclude"
11110                                                         ;;
11111                                                 esac
11112                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11113                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11114                                                         d_oldsock="$undef"
11115                                                 else
11116                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11117                                                         d_oldsock="$define"
11118                                                 fi
11119                                                 break
11120                                         fi
11121                                 fi
11122                         done
11123                         if test "X$d_socket" != "X$define"; then
11124                            echo "or anywhere else I see." >&4
11125                            d_socket="$undef"
11126                            d_oldsock="$undef"
11127                         fi
11128                 fi
11129         fi
11130 fi
11131
11132 : see if socketpair exists
11133 set socketpair d_sockpair
11134 eval $inlibc
11135
11136
11137 echo " "
11138 echo "Checking the availability of certain socket constants..." >&4
11139 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11140         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11141         $cat >try.c <<EOF
11142 #include <sys/types.h>
11143 #include <sys/socket.h>
11144 int main() {
11145     int i = $ENUM;
11146 }
11147 EOF
11148         val="$undef"
11149         set try; if eval $compile; then
11150                 val="$define"
11151         fi
11152         set d_${enum}; eval $setvar
11153         $rm_try
11154 done
11155
11156 : see if this is a sys/uio.h system
11157 set sys/uio.h i_sysuio
11158 eval $inhdr
11159
11160 : Check for cmsghdr support
11161 echo " "
11162 echo "Checking to see if your system supports struct cmsghdr..." >&4
11163 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11164 eval $hasstruct
11165 case "$d_cmsghdr_s" in
11166 "$define")      echo "Yes, it does."   ;;
11167 *)              echo "No, it doesn't." ;;
11168 esac
11169
11170
11171 : check for const keyword
11172 echo " "
11173 echo 'Checking to see if your C compiler knows about "const"...' >&4
11174 $cat >const.c <<'EOCP'
11175 typedef struct spug { int drokk; } spug;
11176 int main()
11177 {
11178         const char *foo;
11179         const spug y = { 0 };
11180 }
11181 EOCP
11182 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11183         val="$define"
11184         echo "Yup, it does."
11185 else
11186         val="$undef"
11187         echo "Nope, it doesn't."
11188 fi
11189 set d_const
11190 eval $setvar
11191
11192 : see if copysignl exists
11193 set copysignl d_copysignl
11194 eval $inlibc
11195
11196 : see if crypt exists
11197 echo " "
11198 set crypt d_crypt
11199 eval $inlibc
11200 case "$d_crypt" in
11201 $define) cryptlib='' ;;
11202 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11203                 echo 'crypt() found.' >&4
11204                 val="$define"
11205                 cryptlib=''
11206         else
11207                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11208                 if $test -z "$cryptlib"; then
11209                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11210                 else
11211                         cryptlib=-lcrypt
11212                 fi
11213                 if $test -z "$cryptlib"; then
11214                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11215                 else
11216                         cryptlib=-lcrypt
11217                 fi
11218                 if $test -z "$cryptlib"; then
11219                         cryptlib=`./loc libcrypt$_a "" $libpth`
11220                 else
11221                         cryptlib=-lcrypt
11222                 fi
11223                 if $test -z "$cryptlib"; then
11224                         echo 'crypt() NOT found.' >&4
11225                         val="$undef"
11226                 else
11227                         val="$define"
11228                 fi
11229         fi
11230         set d_crypt
11231         eval $setvar
11232         ;;
11233 esac
11234
11235 : see if this is a crypt.h system
11236 set crypt.h i_crypt
11237 eval $inhdr
11238
11239 : see if crypt_r exists
11240 set crypt_r d_crypt_r
11241 eval $inlibc
11242 case "$d_crypt_r" in
11243 "$define")
11244         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11245         case "$d_crypt_r_proto:$usethreads" in
11246         ":define")      d_crypt_r_proto=define
11247                 set d_crypt_r_proto crypt_r $hdrs
11248                 eval $hasproto ;;
11249         *)      ;;
11250         esac
11251         case "$d_crypt_r_proto" in
11252         define)
11253         case "$crypt_r_proto" in
11254         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11255         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
11256         esac
11257         case "$crypt_r_proto" in
11258         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11259         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
11260         esac
11261         case "$crypt_r_proto" in
11262         ''|0)   d_crypt_r=undef
11263                 crypt_r_proto=0
11264                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11265         * )     case "$crypt_r_proto" in
11266                 REENTRANT_PROTO*) ;;
11267                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11268                 esac
11269                 echo "Prototype: $try" ;;
11270         esac
11271         ;;
11272         *)      case "$usethreads" in
11273                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11274                 esac
11275                 d_crypt_r=undef
11276                 crypt_r_proto=0
11277                 ;;
11278         esac
11279         ;;
11280 *)      crypt_r_proto=0
11281         ;;
11282 esac
11283
11284 : get csh whereabouts
11285 case "$csh" in
11286 'csh') val="$undef" ;;
11287 *) val="$define" ;;
11288 esac
11289 set d_csh
11290 eval $setvar
11291 : Respect a hint or command line value for full_csh.
11292 case "$full_csh" in
11293 '') full_csh=$csh ;;
11294 esac
11295
11296 : see if ctermid exists
11297 set ctermid d_ctermid
11298 eval $inlibc
11299
11300 : see if ctermid_r exists
11301 set ctermid_r d_ctermid_r
11302 eval $inlibc
11303 case "$d_ctermid_r" in
11304 "$define")
11305         hdrs="$i_systypes sys/types.h define stdio.h "
11306         case "$d_ctermid_r_proto:$usethreads" in
11307         ":define")      d_ctermid_r_proto=define
11308                 set d_ctermid_r_proto ctermid_r $hdrs
11309                 eval $hasproto ;;
11310         *)      ;;
11311         esac
11312         case "$d_ctermid_r_proto" in
11313         define)
11314         case "$ctermid_r_proto" in
11315         ''|0) try='char* ctermid_r(char*);'
11316         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
11317         esac
11318         case "$ctermid_r_proto" in
11319         ''|0)   d_ctermid_r=undef
11320                 ctermid_r_proto=0
11321                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11322         * )     case "$ctermid_r_proto" in
11323                 REENTRANT_PROTO*) ;;
11324                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11325                 esac
11326                 echo "Prototype: $try" ;;
11327         esac
11328         ;;
11329         *)      case "$usethreads" in
11330                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11331                 esac
11332                 d_ctermid_r=undef
11333                 ctermid_r_proto=0
11334                 ;;
11335         esac
11336         ;;
11337 *)      ctermid_r_proto=0
11338         ;;
11339 esac
11340
11341 : see if ctime_r exists
11342 set ctime_r d_ctime_r
11343 eval $inlibc
11344 case "$d_ctime_r" in
11345 "$define")
11346         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11347         case "$d_ctime_r_proto:$usethreads" in
11348         ":define")      d_ctime_r_proto=define
11349                 set d_ctime_r_proto ctime_r $hdrs
11350                 eval $hasproto ;;
11351         *)      ;;
11352         esac
11353         case "$d_ctime_r_proto" in
11354         define)
11355         case "$ctime_r_proto" in
11356         ''|0) try='char* ctime_r(const time_t*, char*);'
11357         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
11358         esac
11359         case "$ctime_r_proto" in
11360         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11361         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
11362         esac
11363         case "$ctime_r_proto" in
11364         ''|0) try='int ctime_r(const time_t*, char*);'
11365         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
11366         esac
11367         case "$ctime_r_proto" in
11368         ''|0) try='int ctime_r(const time_t*, char*, int);'
11369         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
11370         esac
11371         case "$ctime_r_proto" in
11372         ''|0)   d_ctime_r=undef
11373                 ctime_r_proto=0
11374                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11375         * )     case "$ctime_r_proto" in
11376                 REENTRANT_PROTO*) ;;
11377                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11378                 esac
11379                 echo "Prototype: $try" ;;
11380         esac
11381         ;;
11382         *)      case "$usethreads" in
11383                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11384                 esac
11385                 d_ctime_r=undef
11386                 ctime_r_proto=0
11387                 ;;
11388         esac
11389         ;;
11390 *)      ctime_r_proto=0
11391         ;;
11392 esac
11393
11394 : see if cuserid exists
11395 set cuserid d_cuserid
11396 eval $inlibc
11397
11398 : see if this is a limits.h system
11399 set limits.h i_limits
11400 eval $inhdr
11401
11402 : see if this is a float.h system
11403 set float.h i_float
11404 eval $inhdr
11405
11406 : See if number of significant digits in a double precision number is known
11407 echo " "
11408 $cat >dbl_dig.c <<EOM
11409 #$i_limits I_LIMITS
11410 #$i_float I_FLOAT
11411 #ifdef I_LIMITS
11412 #include <limits.h>
11413 #endif
11414 #ifdef I_FLOAT
11415 #include <float.h>
11416 #endif
11417 #ifdef DBL_DIG
11418 printf("Contains DBL_DIG");
11419 #endif
11420 EOM
11421 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11422 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11423         echo "DBL_DIG found." >&4
11424         val="$define"
11425 else
11426         echo "DBL_DIG NOT found." >&4
11427         val="$undef"
11428 fi
11429 $rm -f dbl_dig.?
11430 set d_dbl_dig
11431 eval $setvar
11432
11433 : see if dbm.h is available
11434 : see if dbmclose exists
11435 set dbmclose d_dbmclose
11436 eval $inlibc
11437
11438 case "$d_dbmclose" in
11439 $define)
11440         set dbm.h i_dbm
11441         eval $inhdr
11442         case "$i_dbm" in
11443         $define)
11444                 val="$undef"
11445                 set i_rpcsvcdbm
11446                 eval $setvar
11447                 ;;
11448         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11449                 eval $inhdr
11450                 ;;
11451         esac
11452         ;;
11453 *)      echo "We won't be including <dbm.h>"
11454         val="$undef"
11455         set i_dbm
11456         eval $setvar
11457         val="$undef"
11458         set i_rpcsvcdbm
11459         eval $setvar
11460         ;;
11461 esac
11462
11463 : see if prototype for dbminit is available
11464 echo " "
11465 set d_dbminitproto dbminit $i_dbm dbm.h
11466 eval $hasproto
11467
11468 : see if difftime exists
11469 set difftime d_difftime
11470 eval $inlibc
11471
11472 : see if this is a dirent system
11473 echo " "
11474 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11475         val="$define"
11476         echo "<dirent.h> found." >&4
11477 else
11478         val="$undef"
11479         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11480                 echo "<sys/dir.h> found." >&4
11481                 echo " "
11482         else
11483                 xinc=`./findhdr sys/ndir.h`
11484         fi
11485         echo "<dirent.h> NOT found." >&4
11486 fi
11487 set i_dirent
11488 eval $setvar
11489
11490 : Look for type of directory structure.
11491 echo " "
11492 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11493
11494 case "$direntrytype" in
11495 ''|' ')
11496         case "$i_dirent" in
11497         $define) guess1='struct dirent' ;;
11498         *) guess1='struct direct'  ;;
11499         esac
11500         ;;
11501 *)      guess1="$direntrytype"
11502         ;;
11503 esac
11504
11505 case "$guess1" in
11506 'struct dirent') guess2='struct direct' ;;
11507 *) guess2='struct dirent' ;;
11508 esac
11509
11510 if $contains "$guess1" try.c >/dev/null 2>&1; then
11511         direntrytype="$guess1"
11512         echo "Your directory entries are $direntrytype." >&4
11513 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11514         direntrytype="$guess2"
11515         echo "Your directory entries seem to be $direntrytype." >&4
11516 else
11517         echo "I don't recognize your system's directory entries." >&4
11518         rp="What type is used for directory entries on this system?"
11519         dflt="$guess1"
11520         . ./myread
11521         direntrytype="$ans"
11522 fi
11523 $rm_try
11524
11525 : see if the directory entry stores field length
11526 echo " "
11527 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11528 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11529         echo "Good, your directory entry keeps length information in d_namlen." >&4
11530         val="$define"
11531 else
11532         echo "Your directory entry does not know about the d_namlen field." >&4
11533         val="$undef"
11534 fi
11535 set d_dirnamlen
11536 eval $setvar
11537 $rm_try
11538
11539 : Look for DIR.dd_fd
11540 case "$i_dirent" in
11541 "$define")
11542     echo "Checking to see if DIR has a dd_fd member variable" >&4
11543     $cat >try.c <<EOCP
11544 #$i_stdlib I_STDLIB
11545 #ifdef I_STDLIB
11546 #include <stdlib.h>
11547 #endif
11548 #include <dirent.h>
11549
11550 int main() {
11551     DIR dir;
11552     dir.dd_fd = 1;
11553     return 0;
11554 }
11555 EOCP
11556     val=$undef
11557     set try
11558     if eval $compile; then
11559         echo "Yes, it does."
11560         val="$define"
11561     else
11562         echo "No, it does not."
11563         val="$undef"
11564     fi
11565     ;;
11566 *)
11567     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11568     val="$undef"
11569     ;;
11570 esac
11571 set d_dir_dd_fd
11572 eval $setvar
11573 $rm_try
11574
11575 : see if this is an sysdir system
11576 set sys/dir.h i_sysdir
11577 eval $inhdr
11578
11579 : see if this is an sysndir system
11580 set sys/ndir.h i_sysndir
11581 eval $inhdr
11582
11583 : Look for dirfd
11584 echo " "
11585 $cat >dirfd.c <<EOM
11586 #include <stdio.h>
11587 #$i_stdlib I_STDLIB
11588 #ifdef I_STDLIB
11589 #include <stdlib.h>
11590 #endif
11591 #$i_dirent I_DIRENT             /**/
11592 #$i_sysdir I_SYS_DIR            /**/
11593 #$i_sysndir I_SYS_NDIR          /**/
11594 #$i_systypes I_SYS_TYPES        /**/
11595 #if defined(I_SYS_TYPES)
11596 #include <sys/types.h>
11597 #endif
11598 #if defined(I_DIRENT)
11599 #include <dirent.h>
11600 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11601 #include <sys/dir.h>
11602 #endif
11603 #else
11604 #ifdef I_SYS_NDIR
11605 #include <sys/ndir.h>
11606 #else
11607 #ifdef I_SYS_DIR
11608 #ifdef hp9000s500
11609 #include <ndir.h>       /* may be wrong in the future */
11610 #else
11611 #include <sys/dir.h>
11612 #endif
11613 #endif
11614 #endif
11615 #endif 
11616 int main() {
11617         DIR *dirp = opendir(".");
11618         if (dirfd(dirp) >= 0)
11619                 exit(0);
11620         else
11621                 exit(1);
11622 }
11623 EOM
11624 val=$undef
11625 set dirfd
11626 if eval $compile; then
11627         val="$define"
11628 fi
11629 case "$val" in
11630 $define)        echo "dirfd() found." >&4       ;;
11631 *)              echo "dirfd() NOT found." >&4   ;;
11632 esac
11633 set d_dirfd
11634 eval $setvar
11635 $rm -f dirfd*
11636
11637 : see if dlerror exists
11638 xxx_runnm="$runnm"
11639 runnm=false
11640 set dlerror d_dlerror
11641 eval $inlibc
11642 runnm="$xxx_runnm"
11643
11644 : see if dlfcn is available
11645 set dlfcn.h i_dlfcn
11646 eval $inhdr
11647
11648 : Check what extension to use for shared libs
11649 case "$usedl" in
11650 $define|y|true)
11651         $cat << EOM
11652
11653 On a few systems, the dynamically loaded modules that perl generates and uses
11654 will need a different extension than shared libs. The default will probably
11655 be appropriate.
11656
11657 EOM
11658         case "$dlext" in
11659         '')     dflt="$so" ;;
11660         *)      dflt="$dlext" ;;
11661         esac
11662         rp='What is the extension of dynamically loaded modules'
11663         . ./myread
11664         dlext="$ans"
11665         ;;
11666 *)
11667         dlext="none"
11668         ;;
11669 esac
11670
11671 : Check if dlsym need a leading underscore
11672 echo " "
11673 val="$undef"
11674
11675 case "$dlsrc" in
11676 dl_dlopen.xs)
11677         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11678         $cat >dyna.c <<'EOM'
11679 fred () { }
11680 EOM
11681
11682 $cat >fred.c<<EOM
11683
11684 #include <stdio.h>
11685 #$i_stdlib I_STDLIB
11686 #ifdef I_STDLIB
11687 #include <stdlib.h>
11688 #endif
11689 #$i_dlfcn I_DLFCN
11690 #ifdef I_DLFCN
11691 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11692 #else
11693 #include <sys/types.h>
11694 #include <nlist.h>
11695 #include <link.h>
11696 #endif
11697
11698 extern int fred() ;
11699
11700 int main()
11701 {
11702     void * handle ;
11703     void * symbol ;
11704 #ifndef RTLD_LAZY
11705     int mode = 1 ;
11706 #else
11707     int mode = RTLD_LAZY ;
11708 #endif
11709     handle = dlopen("./dyna.$dlext", mode) ;
11710     if (handle == NULL) {
11711         printf ("1\n") ;
11712         fflush (stdout) ;
11713         exit(0);
11714     }
11715     symbol = dlsym(handle, "fred") ;
11716     if (symbol == NULL) {
11717         /* try putting a leading underscore */
11718         symbol = dlsym(handle, "_fred") ;
11719         if (symbol == NULL) {
11720             printf ("2\n") ;
11721             fflush (stdout) ;
11722             exit(0);
11723         }
11724         printf ("3\n") ;
11725     }
11726     else
11727         printf ("4\n") ;
11728     fflush (stdout) ;
11729     exit(0);
11730 }
11731 EOM
11732         : Call the object file tmp-dyna.o in case dlext=o.
11733         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11734                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11735                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
11736                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11737                 xxx=`$run ./fred`
11738                 case $xxx in
11739                 1)      echo "Test program failed using dlopen." >&4
11740                         echo "Perhaps you should not use dynamic loading." >&4;;
11741                 2)      echo "Test program failed using dlsym." >&4
11742                         echo "Perhaps you should not use dynamic loading." >&4;;
11743                 3)      echo "dlsym needs a leading underscore" >&4
11744                         val="$define" ;;
11745                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11746                 esac
11747         else
11748                 echo "I can't compile and run the test program." >&4
11749                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11750         fi
11751         ;;
11752 esac
11753
11754 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11755
11756 set d_dlsymun
11757 eval $setvar
11758
11759 : see if drand48_r exists
11760 set drand48_r d_drand48_r
11761 eval $inlibc
11762 case "$d_drand48_r" in
11763 "$define")
11764         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11765         case "$d_drand48_r_proto:$usethreads" in
11766         ":define")      d_drand48_r_proto=define
11767                 set d_drand48_r_proto drand48_r $hdrs
11768                 eval $hasproto ;;
11769         *)      ;;
11770         esac
11771         case "$d_drand48_r_proto" in
11772         define)
11773         case "$drand48_r_proto" in
11774         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11775         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11776         esac
11777         case "$drand48_r_proto" in
11778         ''|0)   d_drand48_r=undef
11779                 drand48_r_proto=0
11780                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11781         * )     case "$drand48_r_proto" in
11782                 REENTRANT_PROTO*) ;;
11783                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11784                 esac
11785                 echo "Prototype: $try" ;;
11786         esac
11787         ;;
11788         *)      case "$usethreads" in
11789                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11790                 esac
11791                 d_drand48_r=undef
11792                 drand48_r_proto=0
11793                 ;;
11794         esac
11795         ;;
11796 *)      drand48_r_proto=0
11797         ;;
11798 esac
11799
11800 : see if prototype for drand48 is available
11801 echo " "
11802 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11803 eval $hasproto
11804
11805 : see if dup2 exists
11806 set dup2 d_dup2
11807 eval $inlibc
11808
11809 : see if eaccess exists
11810 set eaccess d_eaccess
11811 eval $inlibc
11812
11813 : see if endgrent exists
11814 set endgrent d_endgrent
11815 eval $inlibc
11816
11817 : see if this is an grp system
11818 set grp.h i_grp
11819 eval $inhdr
11820
11821 case "$i_grp" in
11822 $define)
11823         xxx=`./findhdr grp.h`
11824         $cppstdin $cppflags $cppminus < $xxx >$$.h
11825
11826         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11827                 val="$define"
11828         else
11829                 val="$undef"
11830         fi
11831         set d_grpasswd
11832         eval $setvar
11833
11834         $rm -f $$.h
11835         ;;
11836 *)
11837         val="$undef";
11838         set d_grpasswd; eval $setvar
11839         ;;
11840 esac
11841
11842 : see if endgrent_r exists
11843 set endgrent_r d_endgrent_r
11844 eval $inlibc
11845 case "$d_endgrent_r" in
11846 "$define")
11847         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11848         case "$d_endgrent_r_proto:$usethreads" in
11849         ":define")      d_endgrent_r_proto=define
11850                 set d_endgrent_r_proto endgrent_r $hdrs
11851                 eval $hasproto ;;
11852         *)      ;;
11853         esac
11854         case "$d_endgrent_r_proto" in
11855         define)
11856         case "$endgrent_r_proto" in
11857         ''|0) try='int endgrent_r(FILE**);'
11858         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11859         esac
11860         case "$endgrent_r_proto" in
11861         ''|0) try='void endgrent_r(FILE**);'
11862         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11863         esac
11864         case "$endgrent_r_proto" in
11865         ''|0)   d_endgrent_r=undef
11866                 endgrent_r_proto=0
11867                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11868         * )     case "$endgrent_r_proto" in
11869                 REENTRANT_PROTO*) ;;
11870                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11871                 esac
11872                 echo "Prototype: $try" ;;
11873         esac
11874         ;;
11875         *)      case "$usethreads" in
11876                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11877                 esac
11878                 d_endgrent_r=undef
11879                 endgrent_r_proto=0
11880                 ;;
11881         esac
11882         ;;
11883 *)      endgrent_r_proto=0
11884         ;;
11885 esac
11886
11887 : see if endhostent exists
11888 set endhostent d_endhent
11889 eval $inlibc
11890
11891 : see if this is a netdb.h system
11892 set netdb.h i_netdb
11893 eval $inhdr
11894
11895 : see if endhostent_r exists
11896 set endhostent_r d_endhostent_r
11897 eval $inlibc
11898 case "$d_endhostent_r" in
11899 "$define")
11900         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11901         case "$d_endhostent_r_proto:$usethreads" in
11902         ":define")      d_endhostent_r_proto=define
11903                 set d_endhostent_r_proto endhostent_r $hdrs
11904                 eval $hasproto ;;
11905         *)      ;;
11906         esac
11907         case "$d_endhostent_r_proto" in
11908         define)
11909         case "$endhostent_r_proto" in
11910         ''|0) try='int endhostent_r(struct hostent_data*);'
11911         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11912         esac
11913         case "$endhostent_r_proto" in
11914         ''|0) try='void endhostent_r(struct hostent_data*);'
11915         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11916         esac
11917         case "$endhostent_r_proto" in
11918         ''|0)   d_endhostent_r=undef
11919                 endhostent_r_proto=0
11920                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11921         * )     case "$endhostent_r_proto" in
11922                 REENTRANT_PROTO*) ;;
11923                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11924                 esac
11925                 echo "Prototype: $try" ;;
11926         esac
11927         ;;
11928         *)      case "$usethreads" in
11929                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11930                 esac
11931                 d_endhostent_r=undef
11932                 endhostent_r_proto=0
11933                 ;;
11934         esac
11935         ;;
11936 *)      endhostent_r_proto=0
11937         ;;
11938 esac
11939
11940 : see if endnetent exists
11941 set endnetent d_endnent
11942 eval $inlibc
11943
11944 : see if endnetent_r exists
11945 set endnetent_r d_endnetent_r
11946 eval $inlibc
11947 case "$d_endnetent_r" in
11948 "$define")
11949         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11950         case "$d_endnetent_r_proto:$usethreads" in
11951         ":define")      d_endnetent_r_proto=define
11952                 set d_endnetent_r_proto endnetent_r $hdrs
11953                 eval $hasproto ;;
11954         *)      ;;
11955         esac
11956         case "$d_endnetent_r_proto" in
11957         define)
11958         case "$endnetent_r_proto" in
11959         ''|0) try='int endnetent_r(struct netent_data*);'
11960         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11961         esac
11962         case "$endnetent_r_proto" in
11963         ''|0) try='void endnetent_r(struct netent_data*);'
11964         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11965         esac
11966         case "$endnetent_r_proto" in
11967         ''|0)   d_endnetent_r=undef
11968                 endnetent_r_proto=0
11969                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11970         * )     case "$endnetent_r_proto" in
11971                 REENTRANT_PROTO*) ;;
11972                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11973                 esac
11974                 echo "Prototype: $try" ;;
11975         esac
11976         ;;
11977         *)      case "$usethreads" in
11978                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11979                 esac
11980                 d_endnetent_r=undef
11981                 endnetent_r_proto=0
11982                 ;;
11983         esac
11984         ;;
11985 *)      endnetent_r_proto=0
11986         ;;
11987 esac
11988
11989 : see if endprotoent exists
11990 set endprotoent d_endpent
11991 eval $inlibc
11992
11993 : see if endprotoent_r exists
11994 set endprotoent_r d_endprotoent_r
11995 eval $inlibc
11996 case "$d_endprotoent_r" in
11997 "$define")
11998         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11999         case "$d_endprotoent_r_proto:$usethreads" in
12000         ":define")      d_endprotoent_r_proto=define
12001                 set d_endprotoent_r_proto endprotoent_r $hdrs
12002                 eval $hasproto ;;
12003         *)      ;;
12004         esac
12005         case "$d_endprotoent_r_proto" in
12006         define)
12007         case "$endprotoent_r_proto" in
12008         ''|0) try='int endprotoent_r(struct protoent_data*);'
12009         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
12010         esac
12011         case "$endprotoent_r_proto" in
12012         ''|0) try='void endprotoent_r(struct protoent_data*);'
12013         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
12014         esac
12015         case "$endprotoent_r_proto" in
12016         ''|0)   d_endprotoent_r=undef
12017                 endprotoent_r_proto=0
12018                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12019         * )     case "$endprotoent_r_proto" in
12020                 REENTRANT_PROTO*) ;;
12021                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12022                 esac
12023                 echo "Prototype: $try" ;;
12024         esac
12025         ;;
12026         *)      case "$usethreads" in
12027                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12028                 esac
12029                 d_endprotoent_r=undef
12030                 endprotoent_r_proto=0
12031                 ;;
12032         esac
12033         ;;
12034 *)      endprotoent_r_proto=0
12035         ;;
12036 esac
12037
12038 : see if endpwent exists
12039 set endpwent d_endpwent
12040 eval $inlibc
12041
12042 : see if this is a pwd.h system
12043 set pwd.h i_pwd
12044 eval $inhdr
12045
12046 case "$i_pwd" in
12047 $define)
12048         xxx=`./findhdr pwd.h`
12049         $cppstdin $cppflags $cppminus < $xxx >$$.h
12050
12051         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12052                 val="$define"
12053         else
12054                 val="$undef"
12055         fi
12056         set d_pwquota
12057         eval $setvar
12058
12059         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12060                 val="$define"
12061         else
12062                 val="$undef"
12063         fi
12064         set d_pwage
12065         eval $setvar
12066
12067         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12068                 val="$define"
12069         else
12070                 val="$undef"
12071         fi
12072         set d_pwchange
12073         eval $setvar
12074
12075         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12076                 val="$define"
12077         else
12078                 val="$undef"
12079         fi
12080         set d_pwclass
12081         eval $setvar
12082
12083         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12084                 val="$define"
12085         else
12086                 val="$undef"
12087         fi
12088         set d_pwexpire
12089         eval $setvar
12090
12091         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12092                 val="$define"
12093         else
12094                 val="$undef"
12095         fi
12096         set d_pwcomment
12097         eval $setvar
12098
12099         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12100                 val="$define"
12101         else
12102                 val="$undef"
12103         fi
12104         set d_pwgecos
12105         eval $setvar
12106
12107         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12108                 val="$define"
12109         else
12110                 val="$undef"
12111         fi
12112         set d_pwpasswd
12113         eval $setvar
12114
12115         $rm -f $$.h
12116         ;;
12117 *)
12118         val="$undef"; 
12119         set d_pwquota; eval $setvar
12120         set d_pwage; eval $setvar
12121         set d_pwchange; eval $setvar
12122         set d_pwclass; eval $setvar
12123         set d_pwexpire; eval $setvar
12124         set d_pwcomment; eval $setvar
12125         set d_pwgecos; eval $setvar
12126         set d_pwpasswd; eval $setvar
12127         ;;
12128 esac
12129
12130 : see if endpwent_r exists
12131 set endpwent_r d_endpwent_r
12132 eval $inlibc
12133 case "$d_endpwent_r" in
12134 "$define")
12135         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12136         case "$d_endpwent_r_proto:$usethreads" in
12137         ":define")      d_endpwent_r_proto=define
12138                 set d_endpwent_r_proto endpwent_r $hdrs
12139                 eval $hasproto ;;
12140         *)      ;;
12141         esac
12142         case "$d_endpwent_r_proto" in
12143         define)
12144         case "$endpwent_r_proto" in
12145         ''|0) try='int endpwent_r(FILE**);'
12146         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
12147         esac
12148         case "$endpwent_r_proto" in
12149         ''|0) try='void endpwent_r(FILE**);'
12150         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
12151         esac
12152         case "$endpwent_r_proto" in
12153         ''|0)   d_endpwent_r=undef
12154                 endpwent_r_proto=0
12155                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12156         * )     case "$endpwent_r_proto" in
12157                 REENTRANT_PROTO*) ;;
12158                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12159                 esac
12160                 echo "Prototype: $try" ;;
12161         esac
12162         ;;
12163         *)      case "$usethreads" in
12164                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12165                 esac
12166                 d_endpwent_r=undef
12167                 endpwent_r_proto=0
12168                 ;;
12169         esac
12170         ;;
12171 *)      endpwent_r_proto=0
12172         ;;
12173 esac
12174
12175 : see if endservent exists
12176 set endservent d_endsent
12177 eval $inlibc
12178
12179 : see if endservent_r exists
12180 set endservent_r d_endservent_r
12181 eval $inlibc
12182 case "$d_endservent_r" in
12183 "$define")
12184         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12185         case "$d_endservent_r_proto:$usethreads" in
12186         ":define")      d_endservent_r_proto=define
12187                 set d_endservent_r_proto endservent_r $hdrs
12188                 eval $hasproto ;;
12189         *)      ;;
12190         esac
12191         case "$d_endservent_r_proto" in
12192         define)
12193         case "$endservent_r_proto" in
12194         ''|0) try='int endservent_r(struct servent_data*);'
12195         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
12196         esac
12197         case "$endservent_r_proto" in
12198         ''|0) try='void endservent_r(struct servent_data*);'
12199         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
12200         esac
12201         case "$endservent_r_proto" in
12202         ''|0)   d_endservent_r=undef
12203                 endservent_r_proto=0
12204                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12205         * )     case "$endservent_r_proto" in
12206                 REENTRANT_PROTO*) ;;
12207                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12208                 esac
12209                 echo "Prototype: $try" ;;
12210         esac
12211         ;;
12212         *)      case "$usethreads" in
12213                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12214                 esac
12215                 d_endservent_r=undef
12216                 endservent_r_proto=0
12217                 ;;
12218         esac
12219         ;;
12220 *)      endservent_r_proto=0
12221         ;;
12222 esac
12223
12224 : Locate the flags for 'open()'
12225 echo " "
12226 $cat >try.c <<EOCP
12227 #include <sys/types.h>
12228 #ifdef I_FCNTL
12229 #include <fcntl.h>
12230 #endif
12231 #ifdef I_SYS_FILE
12232 #include <sys/file.h>
12233 #endif
12234 #$i_stdlib I_STDLIB
12235 #ifdef I_STDLIB
12236 #include <stdlib.h>
12237 #endif
12238 int main() {
12239         if(O_RDONLY);
12240 #ifdef O_TRUNC
12241         exit(0);
12242 #else
12243         exit(1);
12244 #endif
12245 }
12246 EOCP
12247 : check sys/file.h first to get FREAD on Sun
12248 if $test `./findhdr sys/file.h` && \
12249                 set try -DI_SYS_FILE && eval $compile; then
12250         h_sysfile=true;
12251         echo "<sys/file.h> defines the O_* constants..." >&4
12252         if $run ./try; then
12253                 echo "and you have the 3 argument form of open()." >&4
12254                 val="$define"
12255         else
12256                 echo "but not the 3 argument form of open().  Oh, well." >&4
12257                 val="$undef"
12258         fi
12259 elif $test `./findhdr fcntl.h` && \
12260                 set try -DI_FCNTL && eval $compile; then
12261         h_fcntl=true;
12262         echo "<fcntl.h> defines the O_* constants..." >&4
12263         if $run ./try; then
12264                 echo "and you have the 3 argument form of open()." >&4
12265                 val="$define"
12266         else
12267                 echo "but not the 3 argument form of open().  Oh, well." >&4
12268                 val="$undef"
12269         fi
12270 else
12271         val="$undef"
12272         echo "I can't find the O_* constant definitions!  You got problems." >&4
12273 fi
12274 set d_open3
12275 eval $setvar
12276 $rm_try
12277
12278 : see which of string.h or strings.h is needed
12279 echo " "
12280 strings=`./findhdr string.h`
12281 if $test "$strings" && $test -r "$strings"; then
12282         echo "Using <string.h> instead of <strings.h>." >&4
12283         val="$define"
12284 else
12285         val="$undef"
12286         strings=`./findhdr strings.h`
12287         if $test "$strings" && $test -r "$strings"; then
12288                 echo "Using <strings.h> instead of <string.h>." >&4
12289         else
12290                 echo "No string header found -- You'll surely have problems." >&4
12291         fi
12292 fi
12293 set i_string
12294 eval $setvar
12295 case "$i_string" in
12296 "$undef") strings=`./findhdr strings.h`;;
12297 *)        strings=`./findhdr string.h`;;
12298 esac
12299
12300 : see if this is a sys/file.h system
12301 val=''
12302 set sys/file.h val
12303 eval $inhdr
12304
12305 : do we need to include sys/file.h ?
12306 case "$val" in
12307 "$define")
12308         echo " "
12309         if $h_sysfile; then
12310                 val="$define"
12311                 echo "We'll be including <sys/file.h>." >&4
12312         else
12313                 val="$undef"
12314                 echo "We won't be including <sys/file.h>." >&4
12315         fi
12316         ;;
12317 *)
12318         h_sysfile=false
12319         ;;
12320 esac
12321 set i_sysfile
12322 eval $setvar
12323
12324 : see if fcntl.h is there
12325 val=''
12326 set fcntl.h val
12327 eval $inhdr
12328
12329 : see if we can include fcntl.h
12330 case "$val" in
12331 "$define")
12332         echo " "
12333         if $h_fcntl; then
12334                 val="$define"
12335                 echo "We'll be including <fcntl.h>." >&4
12336         else
12337                 val="$undef"
12338                 if $h_sysfile; then
12339         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12340                 else
12341                         echo "We won't be including <fcntl.h>." >&4
12342                 fi
12343         fi
12344         ;;
12345 *)
12346         h_fcntl=false
12347         val="$undef"
12348         ;;
12349 esac
12350 set i_fcntl
12351 eval $setvar
12352
12353 : see if fork exists
12354 set fork d_fork
12355 eval $inlibc
12356
12357 : see if pipe exists
12358 set pipe d_pipe
12359 eval $inlibc
12360
12361 : check for non-blocking I/O stuff
12362 case "$h_sysfile" in
12363 true) echo "#include <sys/file.h>" > head.c;;
12364 *)
12365        case "$h_fcntl" in
12366        true) echo "#include <fcntl.h>" > head.c;;
12367        *) echo "#include <sys/fcntl.h>" > head.c;;
12368        esac
12369        ;;
12370 esac
12371 echo " "
12372 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12373 case "$o_nonblock" in
12374 '')
12375         $cat head.c > try.c
12376         $cat >>try.c <<EOCP
12377 #include <stdio.h>
12378 #$i_stdlib I_STDLIB
12379 #ifdef I_STDLIB
12380 #include <stdlib.h>
12381 #endif
12382 #$i_fcntl I_FCNTL
12383 #ifdef I_FCNTL
12384 #include <fcntl.h>
12385 #endif
12386 int main() {
12387 #ifdef O_NONBLOCK
12388         printf("O_NONBLOCK\n");
12389         exit(0);
12390 #endif
12391 #ifdef O_NDELAY
12392         printf("O_NDELAY\n");
12393         exit(0);
12394 #endif
12395 #ifdef FNDELAY
12396         printf("FNDELAY\n");
12397         exit(0);
12398 #endif
12399         exit(0);
12400 }
12401 EOCP
12402         set try
12403         if eval $compile_ok; then
12404                 o_nonblock=`$run ./try`
12405                 case "$o_nonblock" in
12406                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12407                 *) echo "Seems like we can use $o_nonblock.";;
12408                 esac
12409         else
12410                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12411         fi
12412         ;;
12413 *) echo "Using $hint value $o_nonblock.";;
12414 esac
12415 $rm_try
12416
12417 echo " "
12418 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12419 case "$eagain" in
12420 '')
12421         case "$d_fork:$d_pipe" in
12422         define:define)
12423         $cat head.c > try.c
12424         $cat >>try.c <<EOCP
12425 #include <errno.h>
12426 #include <sys/types.h>
12427 #include <signal.h>
12428 #include <stdio.h>
12429 #$i_stdlib I_STDLIB
12430 #ifdef I_STDLIB
12431 #include <stdlib.h>
12432 #endif
12433 #$i_fcntl I_FCNTL
12434 #ifdef I_FCNTL
12435 #include <fcntl.h>
12436 #endif
12437 #define MY_O_NONBLOCK $o_nonblock
12438 #ifndef errno  /* XXX need better Configure test */
12439 extern int errno;
12440 #endif
12441 #$i_unistd I_UNISTD
12442 #ifdef I_UNISTD
12443 #include <unistd.h>
12444 #endif
12445 #$i_string I_STRING
12446 #ifdef I_STRING
12447 #include <string.h>
12448 #else
12449 #include <strings.h>
12450 #endif
12451 $signal_t blech(int x) { exit(3); }
12452 EOCP
12453         $cat >> try.c <<'EOCP'
12454 int main()
12455 {
12456         int pd[2];
12457         int pu[2];
12458         char buf[1];
12459         char string[100];
12460
12461         pipe(pd);       /* Down: child -> parent */
12462         pipe(pu);       /* Up: parent -> child */
12463         if (0 != fork()) {
12464                 int ret;
12465                 close(pd[1]);   /* Parent reads from pd[0] */
12466                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12467 #ifdef F_SETFL
12468                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12469                         exit(1);
12470 #else
12471                 exit(4);
12472 #endif
12473                 signal(SIGALRM, blech);
12474                 alarm(5);
12475                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12476                         exit(2);
12477                 sprintf(string, "%d\n", ret);
12478                 write(2, string, strlen(string));
12479                 alarm(0);
12480 #ifdef EAGAIN
12481                 if (errno == EAGAIN) {
12482                         printf("EAGAIN\n");
12483                         goto ok;
12484                 }
12485 #endif
12486 #ifdef EWOULDBLOCK
12487                 if (errno == EWOULDBLOCK)
12488                         printf("EWOULDBLOCK\n");
12489 #endif
12490         ok:
12491                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12492                 sleep(2);                               /* Give it time to close our pipe */
12493                 alarm(5);
12494                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12495                 alarm(0);
12496                 sprintf(string, "%d\n", ret);
12497                 write(4, string, strlen(string));
12498                 exit(0);
12499         }
12500
12501         close(pd[0]);                   /* We write to pd[1] */
12502         close(pu[1]);                   /* We read from pu[0] */
12503         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12504         close(pd[1]);                   /* Pipe pd is now fully closed! */
12505         exit(0);                                /* Bye bye, thank you for playing! */
12506 }
12507 EOCP
12508         set try
12509         if eval $compile_ok; then
12510                 echo "$startsh" >mtry
12511                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12512                 chmod +x mtry
12513                 ./mtry >/dev/null 2>&1
12514                 case $? in
12515                 0) eagain=`$cat try.out`;;
12516                 1) echo "Could not perform non-blocking setting!";;
12517                 2) echo "I did a successful read() for something that was not there!";;
12518                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12519                 4) echo "Could not find F_SETFL!";;
12520                 *) echo "Something terribly wrong happened during testing.";;
12521                 esac
12522                 rd_nodata=`$cat try.ret`
12523                 echo "A read() system call with no data present returns $rd_nodata."
12524                 case "$rd_nodata" in
12525                 0|-1) ;;
12526                 *)
12527                         echo "(That's peculiar, fixing that to be -1.)"
12528                         rd_nodata=-1
12529                         ;;
12530                 esac
12531                 case "$eagain" in
12532                 '')
12533                         echo "Forcing errno EAGAIN on read() with no data available."
12534                         eagain=EAGAIN
12535                         ;;
12536                 *)
12537                         echo "Your read() sets errno to $eagain when no data is available."
12538                         ;;
12539                 esac
12540                 status=`$cat try.err`
12541                 case "$status" in
12542                 0) echo "And it correctly returns 0 to signal EOF.";;
12543                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12544                 *) echo "However, your read() returns '$status' on EOF??";;
12545                 esac
12546                 val="$define"
12547                 if test "$status" = "$rd_nodata"; then
12548                         echo "WARNING: you can't distinguish between EOF and no data!"
12549                         val="$undef"
12550                 fi
12551         else
12552                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12553                 eagain=EAGAIN
12554         fi
12555         ;;
12556         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12557                 eagain=EAGAIN
12558                 val="$define"
12559                 ;;
12560         esac
12561         set d_eofnblk
12562         eval $setvar
12563         ;;
12564 *)
12565         echo "Using $hint value $eagain."
12566         echo "Your read() returns $rd_nodata when no data is present."
12567         case "$d_eofnblk" in
12568         "$define") echo "And you can see EOF because read() returns 0.";;
12569         "$undef") echo "But you can't see EOF status from read() returned value.";;
12570         *)
12571                 echo "(Assuming you can't see EOF status from read anyway.)"
12572                 d_eofnblk=$undef
12573                 ;;
12574         esac
12575         ;;
12576 esac
12577 $rm_try head.c mtry
12578
12579 : see if _ptr and _cnt from stdio act std
12580 echo " "
12581
12582 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12583         echo "(Looks like you have stdio.h from BSD.)"
12584         case "$stdio_ptr" in
12585         '') stdio_ptr='((fp)->_p)'
12586                 ptr_lval=$define
12587                 ;;
12588         *)      ptr_lval=$d_stdio_ptr_lval;;
12589         esac
12590         case "$stdio_cnt" in
12591         '') stdio_cnt='((fp)->_r)'
12592                 cnt_lval=$define
12593                 ;;
12594         *)      cnt_lval=$d_stdio_cnt_lval;;
12595         esac
12596         case "$stdio_base" in
12597         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12598         esac
12599         case "$stdio_bufsiz" in
12600         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12601         esac
12602 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12603         echo "(Looks like you have stdio.h from Linux.)"
12604         case "$stdio_ptr" in
12605         '') stdio_ptr='((fp)->_IO_read_ptr)'
12606                 ptr_lval=$define
12607                 ;;
12608         *)      ptr_lval=$d_stdio_ptr_lval;;
12609         esac
12610         case "$stdio_cnt" in
12611         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12612                 cnt_lval=$undef
12613                 ;;
12614         *)      cnt_lval=$d_stdio_cnt_lval;;
12615         esac
12616         case "$stdio_base" in
12617         '') stdio_base='((fp)->_IO_read_base)';;
12618         esac
12619         case "$stdio_bufsiz" in
12620         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12621         esac
12622 else
12623         case "$stdio_ptr" in
12624         '') stdio_ptr='((fp)->_ptr)'
12625                 ptr_lval=$define
12626                 ;;
12627         *)      ptr_lval=$d_stdio_ptr_lval;;
12628         esac
12629         case "$stdio_cnt" in
12630         '') stdio_cnt='((fp)->_cnt)'
12631                 cnt_lval=$define
12632                 ;;
12633         *)      cnt_lval=$d_stdio_cnt_lval;;
12634         esac
12635         case "$stdio_base" in
12636         '') stdio_base='((fp)->_base)';;
12637         esac
12638         case "$stdio_bufsiz" in
12639         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12640         esac
12641 fi
12642
12643 : test whether _ptr and _cnt really work
12644 echo "Checking how std your stdio is..." >&4
12645 $cat >try.c <<EOP
12646 #include <stdio.h>
12647 #$i_stdlib I_STDLIB
12648 #ifdef I_STDLIB
12649 #include <stdlib.h>
12650 #endif
12651 #define FILE_ptr(fp)    $stdio_ptr
12652 #define FILE_cnt(fp)    $stdio_cnt
12653 int main() {
12654         FILE *fp = fopen("try.c", "r");
12655         char c = getc(fp);
12656         if (
12657                 18 <= FILE_cnt(fp) &&
12658                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12659         )
12660                 exit(0);
12661         exit(1);
12662 }
12663 EOP
12664 val="$undef"
12665 set try
12666 if eval $compile && $to try.c; then
12667         if $run ./try; then
12668                 echo "Your stdio acts pretty std."
12669                 val="$define"
12670         else
12671                 echo "Your stdio isn't very std."
12672         fi
12673 else
12674         echo "Your stdio doesn't appear very std."
12675 fi
12676 $rm_try
12677
12678 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12679 # direct buffer manipulation no longer works.  The Configure tests
12680 # should be changed to correctly detect this, but until then,
12681 # the following check should at least let perl compile and run.
12682 # (This quick fix should be updated before 5.8.1.)
12683 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12684 # A. Dougherty, June 3, 2002.
12685 case "$d_gnulibc" in
12686 $define)
12687         case "$gnulibc_version" in
12688         2.[01]*)  ;;
12689         2.2) ;;
12690         2.2.[0-9]) ;;
12691         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12692                 val="$undef"
12693                 ;;
12694         esac
12695         ;;
12696 esac
12697 set d_stdstdio
12698 eval $setvar
12699
12700 : Can _ptr be used as an lvalue?
12701 case "$d_stdstdio$ptr_lval" in
12702 $define$define) val=$define ;;
12703 *) val=$undef ;;
12704 esac
12705 set d_stdio_ptr_lval
12706 eval $setvar
12707
12708 : Can _cnt be used as an lvalue?
12709 case "$d_stdstdio$cnt_lval" in
12710 $define$define) val=$define ;;
12711 *) val=$undef ;;
12712 esac
12713 set d_stdio_cnt_lval
12714 eval $setvar
12715
12716
12717 : test whether setting _ptr sets _cnt as a side effect
12718 d_stdio_ptr_lval_sets_cnt="$undef"
12719 d_stdio_ptr_lval_nochange_cnt="$undef"
12720 case "$d_stdio_ptr_lval$d_stdstdio" in
12721 $define$define)
12722         echo "Checking to see what happens if we set the stdio ptr..." >&4
12723 $cat >try.c <<EOP
12724 #include <stdio.h>
12725 /* Can we scream? */
12726 /* Eat dust sed :-) */
12727 /* In the buffer space, no one can hear you scream. */
12728 #$i_stdlib I_STDLIB
12729 #ifdef I_STDLIB
12730 #include <stdlib.h>
12731 #endif
12732 #define FILE_ptr(fp)    $stdio_ptr
12733 #define FILE_cnt(fp)    $stdio_cnt
12734 #include <sys/types.h>
12735 int main() {
12736         FILE *fp = fopen("try.c", "r");
12737         int c;
12738         char *ptr;
12739         size_t cnt;
12740         if (!fp) {
12741             puts("Fail even to read");
12742             exit(1);
12743         }
12744         c = getc(fp); /* Read away the first # */
12745         if (c == EOF) {
12746             puts("Fail even to read");
12747             exit(1);
12748         }
12749         if (!(
12750                 18 <= FILE_cnt(fp) &&
12751                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12752         )) {
12753                 puts("Fail even to read");
12754                 exit (1);
12755         }
12756         ptr = (char*) FILE_ptr(fp);
12757         cnt = (size_t)FILE_cnt(fp);
12758
12759         FILE_ptr(fp) += 42;
12760
12761         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12762                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12763                 exit (1);
12764         }
12765         if (FILE_cnt(fp) <= 20) {
12766                 printf ("Fail (<20 chars to test)");
12767                 exit (1);
12768         }
12769         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12770                 puts("Fail compare");
12771                 exit (1);
12772         }
12773         if (cnt == FILE_cnt(fp)) {
12774                 puts("Pass_unchanged");
12775                 exit (0);
12776         }
12777         if (FILE_cnt(fp) == (cnt - 42)) {
12778                 puts("Pass_changed");
12779                 exit (0);
12780         }
12781         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12782         return 1;
12783
12784 }
12785 EOP
12786         set try
12787         if eval $compile && $to try.c; then
12788                 case `$run ./try` in
12789                 Pass_changed)
12790                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12791                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12792                 Pass_unchanged)
12793                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12794                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12795                 Fail*)
12796                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12797                 *)
12798                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12799         esac
12800         else
12801                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12802         fi
12803         $rm_try
12804         ;;
12805 esac
12806
12807 : see if _base is also standard
12808 val="$undef"
12809 case "$d_stdstdio" in
12810 $define)
12811         $cat >try.c <<EOP
12812 #include <stdio.h>
12813 #$i_stdlib I_STDLIB
12814 #ifdef I_STDLIB
12815 #include <stdlib.h>
12816 #endif
12817 #define FILE_base(fp)   $stdio_base
12818 #define FILE_bufsiz(fp) $stdio_bufsiz
12819 int main() {
12820         FILE *fp = fopen("try.c", "r");
12821         char c = getc(fp);
12822         if (
12823                 19 <= FILE_bufsiz(fp) &&
12824                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12825         )
12826                 exit(0);
12827         exit(1);
12828 }
12829 EOP
12830         set try
12831         if eval $compile && $to try.c; then
12832                 if $run ./try; then
12833                         echo "And its _base field acts std."
12834                         val="$define"
12835                 else
12836                         echo "But its _base field isn't std."
12837                 fi
12838         else
12839                 echo "However, it seems to be lacking the _base field."
12840         fi
12841         $rm_try
12842         ;;
12843 esac
12844 set d_stdiobase
12845 eval $setvar
12846
12847 : see if fast_stdio exists
12848 val="$undef"
12849 case "$d_stdstdio:$d_stdio_ptr_lval" in
12850 "$define:$define")
12851         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12852         *$define*)
12853                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12854                 val="$define"
12855                 ;;
12856         esac
12857         ;;
12858 esac
12859 set d_faststdio
12860 eval $setvar
12861
12862
12863
12864 : see if fchdir exists
12865 set fchdir d_fchdir
12866 eval $inlibc
12867
12868 : see if fchmod exists
12869 set fchmod d_fchmod
12870 eval $inlibc
12871
12872 : see if fchown exists
12873 set fchown d_fchown
12874 eval $inlibc
12875
12876 : see if this is an fcntl system
12877 set fcntl d_fcntl
12878 eval $inlibc
12879
12880 : See if fcntl-based locking works.
12881 echo " "
12882 $cat >try.c <<EOCP
12883 #$i_stdlib I_STDLIB
12884 #ifdef I_STDLIB
12885 #include <stdlib.h>
12886 #endif
12887 #include <unistd.h>
12888 #include <fcntl.h>
12889 #include <signal.h>
12890 $signal_t blech(int x) { exit(3); }
12891 int main() {
12892 #if defined(F_SETLK) && defined(F_SETLKW)
12893      struct flock flock;
12894      int retval, fd;
12895      fd = open("try.c", O_RDONLY);
12896      flock.l_type = F_RDLCK;
12897      flock.l_whence = SEEK_SET;
12898      flock.l_start = flock.l_len = 0;
12899      signal(SIGALRM, blech);
12900      alarm(10);
12901      retval = fcntl(fd, F_SETLK, &flock);
12902      close(fd);
12903      (retval < 0 ? exit(2) : exit(0));
12904 #else
12905      exit(2);
12906 #endif
12907 }
12908 EOCP
12909 echo "Checking if fcntl-based file locking works... "
12910 case "$d_fcntl" in
12911 "$define")
12912         set try
12913         if eval $compile_ok; then
12914                 if $run ./try; then
12915                         echo "Yes, it seems to work."
12916                         val="$define"
12917                 else
12918                         echo "Nope, it didn't work."
12919                         val="$undef"
12920                         case "$?" in
12921                         3) $cat >&4 <<EOM
12922 ***
12923 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12924 *** This is (almost) impossible.
12925 *** If your NFS lock daemons are not feeling well, something like
12926 *** this may happen, please investigate.  Cannot continue, aborting.
12927 ***
12928 EOM
12929                                 exit 1
12930                                 ;;
12931                         esac
12932                 fi
12933         else
12934                 echo "I'm unable to compile the test program, so I'll assume not."
12935                 val="$undef"
12936         fi
12937         ;;
12938 *) val="$undef";
12939         echo "Nope, since you don't even have fcntl()."
12940         ;;
12941 esac
12942 set d_fcntl_can_lock
12943 eval $setvar
12944 $rm_try
12945
12946 : check for fd_set items
12947 $cat <<EOM
12948
12949 Checking to see how well your C compiler handles fd_set and friends ...
12950 EOM
12951 $cat >try.c <<EOCP
12952 #$i_stdlib I_STDLIB
12953 #ifdef I_STDLIB
12954 #include <stdlib.h>
12955 #endif
12956 #$i_systime I_SYS_TIME
12957 #$i_sysselct I_SYS_SELECT
12958 #$d_socket HAS_SOCKET
12959 #include <sys/types.h>
12960 #ifdef HAS_SOCKET
12961 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12962 #endif
12963 #ifdef I_SYS_TIME
12964 #include <sys/time.h>
12965 #endif
12966 #ifdef I_SYS_SELECT
12967 #include <sys/select.h>
12968 #endif
12969 int main() {
12970         fd_set fds;
12971
12972 #ifdef TRYBITS
12973         if(fds.fds_bits);
12974 #endif
12975
12976 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12977         exit(0);
12978 #else
12979         exit(1);
12980 #endif
12981 }
12982 EOCP
12983 set try -DTRYBITS
12984 if eval $compile; then
12985         d_fds_bits="$define"
12986         d_fd_set="$define"
12987         echo "Well, your system knows about the normal fd_set typedef..." >&4
12988         if $run ./try; then
12989                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12990                 d_fd_macros="$define"
12991         else
12992                 $cat >&4 <<'EOM'
12993 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12994 EOM
12995                 d_fd_macros="$undef"
12996         fi
12997 else
12998         $cat <<'EOM'
12999 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13000 EOM
13001         set try
13002         if eval $compile; then
13003                 d_fds_bits="$undef"
13004                 d_fd_set="$define"
13005                 echo "Well, your system has some sort of fd_set available..." >&4
13006                 if $run ./try; then
13007                         echo "and you have the normal fd_set macros." >&4
13008                         d_fd_macros="$define"
13009                 else
13010                         $cat <<'EOM'
13011 but not the normal fd_set macros!  Gross!  More work for me...
13012 EOM
13013                         d_fd_macros="$undef"
13014                 fi
13015         else
13016         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13017                 d_fd_set="$undef"
13018                 d_fds_bits="$undef"
13019                 d_fd_macros="$undef"
13020         fi
13021 fi
13022 $rm_try
13023
13024 : see if fgetpos exists
13025 set fgetpos d_fgetpos
13026 eval $inlibc
13027
13028 : see if finite exists
13029 set finite d_finite
13030 eval $inlibc
13031
13032 : see if finitel exists
13033 set finitel d_finitel
13034 eval $inlibc
13035
13036 : see if flock exists
13037 set flock d_flock
13038 eval $inlibc
13039
13040 : see if prototype for flock is available
13041 echo " "
13042 set d_flockproto flock $i_sysfile sys/file.h
13043 eval $hasproto
13044
13045 : see if fp_class exists
13046 set fp_class d_fp_class
13047 eval $inlibc
13048
13049 : see if pathconf exists
13050 set pathconf d_pathconf
13051 eval $inlibc
13052
13053 : see if fpathconf exists
13054 set fpathconf d_fpathconf
13055 eval $inlibc
13056
13057 : see if fpclass exists
13058 set fpclass d_fpclass
13059 eval $inlibc
13060
13061 : see if fpclassify exists
13062 set fpclassify d_fpclassify
13063 eval $inlibc
13064
13065 : see if fpclassl exists
13066 set fpclassl d_fpclassl
13067 eval $inlibc
13068
13069 : check for fpos64_t
13070 echo " "
13071 echo "Checking to see if you have fpos64_t..." >&4
13072 $cat >try.c <<EOCP
13073 #include <stdio.h>
13074 int main() { fpos64_t x = 7; }
13075 EOCP
13076 set try
13077 if eval $compile; then
13078         val="$define"
13079         echo "You have fpos64_t."
13080 else
13081         val="$undef"
13082         echo "You do not have fpos64_t."
13083         case "$fpossize" in
13084         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13085         esac
13086 fi
13087 $rm_try
13088 set d_fpos64_t
13089 eval $setvar
13090
13091 : see if frexpl exists
13092 set frexpl d_frexpl
13093 eval $inlibc
13094
13095 : see if this is a sys/param system
13096 set sys/param.h i_sysparam
13097 eval $inhdr
13098
13099 : see if this is a sys/mount.h system
13100 set sys/mount.h i_sysmount
13101 eval $inhdr
13102
13103 : Check for fs_data_s
13104 echo " "
13105 echo "Checking to see if your system supports struct fs_data..." >&4
13106 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13107 eval $hasstruct
13108 case "$d_fs_data_s" in
13109 "$define")      echo "Yes, it does."   ;;
13110 *)              echo "No, it doesn't." ;;
13111 esac
13112
13113 : see if fseeko exists
13114 set fseeko d_fseeko
13115 eval $inlibc
13116 case "$longsize" in
13117 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13118 esac
13119
13120 : see if fsetpos exists
13121 set fsetpos d_fsetpos
13122 eval $inlibc
13123
13124 : see if fstatfs exists
13125 set fstatfs d_fstatfs
13126 eval $inlibc
13127
13128 : see if statvfs exists
13129 set statvfs d_statvfs
13130 eval $inlibc
13131
13132 : see if fstatvfs exists
13133 set fstatvfs d_fstatvfs
13134 eval $inlibc
13135
13136
13137 : see if fsync exists
13138 set fsync d_fsync
13139 eval $inlibc
13140
13141 : see if ftello exists
13142 set ftello d_ftello
13143 eval $inlibc
13144 case "$longsize" in
13145 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13146 esac
13147
13148 : check for a working futimes
13149 d_futimes="$undef"
13150 echo " "
13151 echo "Checking if you have a working futimes()" >&4
13152 $cat >try.c <<EOCP
13153 #include <stdio.h>
13154 #include <sys/time.h>
13155 #include <errno.h>
13156 #include <fcntl.h>
13157
13158 int main ()
13159 {
13160     int fd, rv;
13161     fd = open ("try.c", O_RDWR);
13162     if (-1 == fd) exit (1);
13163     rv = futimes (fd, NULL);
13164     exit (rv == -1 ? errno : 0);
13165 }
13166 EOCP
13167 set try
13168 if eval $compile; then
13169     `$run ./try`
13170     rc=$?
13171     case "$rc" in
13172         0)  echo "Yes, you have" >&4
13173             d_futimes="$define"
13174             ;;
13175         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13176             ;;
13177     esac
13178 else
13179     echo "No, it does not (probably harmless)" >&4
13180 fi
13181 $rm_try
13182
13183 : see if getcwd exists
13184 set getcwd d_getcwd
13185 eval $inlibc
13186
13187 : see if getespwnam exists
13188 set getespwnam d_getespwnam
13189 eval $inlibc
13190
13191 : see if getfsstat exists
13192 set getfsstat d_getfsstat
13193 eval $inlibc
13194
13195 : see if getgrent exists
13196 set getgrent d_getgrent
13197 eval $inlibc
13198
13199 : see if getgrent_r exists
13200 set getgrent_r d_getgrent_r
13201 eval $inlibc
13202 case "$d_getgrent_r" in
13203 "$define")
13204         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13205         case "$d_getgrent_r_proto:$usethreads" in
13206         ":define")      d_getgrent_r_proto=define
13207                 set d_getgrent_r_proto getgrent_r $hdrs
13208                 eval $hasproto ;;
13209         *)      ;;
13210         esac
13211         case "$d_getgrent_r_proto" in
13212         define)
13213         case "$getgrent_r_proto" in
13214         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13215         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13216         esac
13217         case "$getgrent_r_proto" in
13218         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13219         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13220         esac
13221         case "$getgrent_r_proto" in
13222         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13223         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
13224         esac
13225         case "$getgrent_r_proto" in
13226         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13227         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
13228         esac
13229         case "$getgrent_r_proto" in
13230         ''|0) try='int getgrent_r(struct group*, char*, int);'
13231         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
13232         esac
13233         case "$getgrent_r_proto" in
13234         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13235         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13236         esac
13237         case "$getgrent_r_proto" in
13238         ''|0)   d_getgrent_r=undef
13239                 getgrent_r_proto=0
13240                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13241         * )     case "$getgrent_r_proto" in
13242                 REENTRANT_PROTO*) ;;
13243                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13244                 esac
13245                 echo "Prototype: $try" ;;
13246         esac
13247         ;;
13248         *)      case "$usethreads" in
13249                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13250                 esac
13251                 d_getgrent_r=undef
13252                 getgrent_r_proto=0
13253                 ;;
13254         esac
13255         ;;
13256 *)      getgrent_r_proto=0
13257         ;;
13258 esac
13259
13260 : see if getgrgid_r exists
13261 set getgrgid_r d_getgrgid_r
13262 eval $inlibc
13263 case "$d_getgrgid_r" in
13264 "$define")
13265         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13266         case "$d_getgrgid_r_proto:$usethreads" in
13267         ":define")      d_getgrgid_r_proto=define
13268                 set d_getgrgid_r_proto getgrgid_r $hdrs
13269                 eval $hasproto ;;
13270         *)      ;;
13271         esac
13272         case "$d_getgrgid_r_proto" in
13273         define)
13274         case "$getgrgid_r_proto" in
13275         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13276         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13277         esac
13278         case "$getgrgid_r_proto" in
13279         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13280         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13281         esac
13282         case "$getgrgid_r_proto" in
13283         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13284         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13285         esac
13286         case "$getgrgid_r_proto" in
13287         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13288         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13289         esac
13290         case "$getgrgid_r_proto" in
13291         ''|0)   d_getgrgid_r=undef
13292                 getgrgid_r_proto=0
13293                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13294         * )     case "$getgrgid_r_proto" in
13295                 REENTRANT_PROTO*) ;;
13296                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13297                 esac
13298                 echo "Prototype: $try" ;;
13299         esac
13300         ;;
13301         *)      case "$usethreads" in
13302                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13303                 esac
13304                 d_getgrgid_r=undef
13305                 getgrgid_r_proto=0
13306                 ;;
13307         esac
13308         ;;
13309 *)      getgrgid_r_proto=0
13310         ;;
13311 esac
13312
13313 : see if getgrnam_r exists
13314 set getgrnam_r d_getgrnam_r
13315 eval $inlibc
13316 case "$d_getgrnam_r" in
13317 "$define")
13318         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13319         case "$d_getgrnam_r_proto:$usethreads" in
13320         ":define")      d_getgrnam_r_proto=define
13321                 set d_getgrnam_r_proto getgrnam_r $hdrs
13322                 eval $hasproto ;;
13323         *)      ;;
13324         esac
13325         case "$d_getgrnam_r_proto" in
13326         define)
13327         case "$getgrnam_r_proto" in
13328         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13329         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13330         esac
13331         case "$getgrnam_r_proto" in
13332         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13333         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13334         esac
13335         case "$getgrnam_r_proto" in
13336         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13337         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13338         esac
13339         case "$getgrnam_r_proto" in
13340         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13341         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13342         esac
13343         case "$getgrnam_r_proto" in
13344         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13345         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13346         esac
13347         case "$getgrnam_r_proto" in
13348         ''|0)   d_getgrnam_r=undef
13349                 getgrnam_r_proto=0
13350                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13351         * )     case "$getgrnam_r_proto" in
13352                 REENTRANT_PROTO*) ;;
13353                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13354                 esac
13355                 echo "Prototype: $try" ;;
13356         esac
13357         ;;
13358         *)      case "$usethreads" in
13359                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13360                 esac
13361                 d_getgrnam_r=undef
13362                 getgrnam_r_proto=0
13363                 ;;
13364         esac
13365         ;;
13366 *)      getgrnam_r_proto=0
13367         ;;
13368 esac
13369
13370 : see if gethostbyaddr exists
13371 set gethostbyaddr d_gethbyaddr
13372 eval $inlibc
13373
13374 : see if gethostbyname exists
13375 set gethostbyname d_gethbyname
13376 eval $inlibc
13377
13378 : see if gethostent exists
13379 set gethostent d_gethent
13380 eval $inlibc
13381
13382 : see how we will look up host name
13383 echo " "
13384 call=''
13385 if set gethostname val -f d_gethname; eval $csym; $val; then
13386         echo 'gethostname() found.' >&4
13387         d_gethname="$define"
13388         call=gethostname
13389 fi
13390 if set uname val -f d_uname; eval $csym; $val; then
13391         if ./xenix; then
13392                 $cat <<'EOM'
13393 uname() was found, but you're running xenix, and older versions of xenix
13394 have a broken uname(). If you don't really know whether your xenix is old
13395 enough to have a broken system call, use the default answer.
13396
13397 EOM
13398                 dflt=y
13399                 case "$d_uname" in
13400                 "$define") dflt=n;;
13401                 esac
13402                 rp='Is your uname() broken?'
13403                 . ./myread
13404                 case "$ans" in
13405                 n*) d_uname="$define"; call=uname;;
13406                 esac
13407         else
13408                 echo 'uname() found.' >&4
13409                 d_uname="$define"
13410                 case "$call" in
13411                 '') call=uname ;;
13412                 esac
13413         fi
13414 fi
13415 case "$d_gethname" in
13416 '') d_gethname="$undef";;
13417 esac
13418 case "$d_uname" in
13419 '') d_uname="$undef";;
13420 esac
13421 case "$d_uname$d_gethname" in
13422 *define*)
13423         dflt=n
13424         cat <<EOM
13425
13426 Every now and then someone has a $call() that lies about the hostname
13427 but can't be fixed for political or economic reasons.  If you wish, I can
13428 pretend $call() isn't there and maybe compute hostname at run-time
13429 thanks to the '$phostname' command.
13430
13431 EOM
13432         rp="Shall I ignore $call() from now on?"
13433         . ./myread
13434         case "$ans" in
13435         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13436         esac;;
13437 esac
13438 case "$phostname" in
13439 '') aphostname='';;
13440 *) case "$aphostname" in
13441         /*) ;;
13442         *) set X $phostname
13443                 shift
13444                 file=$1
13445                 shift
13446                 file=`./loc $file $file $pth`
13447                 aphostname=`echo $file $*`
13448                 ;;
13449         esac
13450         ;;
13451 esac
13452 case "$d_uname$d_gethname" in
13453 *define*) ;;
13454 *)
13455         case "$phostname" in
13456         '')
13457                 echo "There will be no way for $package to get your hostname." >&4;;
13458         *)
13459         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13460                 ;;
13461         esac;;
13462 esac
13463 case "$d_phostname" in
13464 '') d_phostname="$undef";;
13465 esac
13466
13467 : see if gethostbyaddr_r exists
13468 set gethostbyaddr_r d_gethostbyaddr_r
13469 eval $inlibc
13470 case "$d_gethostbyaddr_r" in
13471 "$define")
13472         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13473         case "$d_gethostbyaddr_r_proto:$usethreads" in
13474         ":define")      d_gethostbyaddr_r_proto=define
13475                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13476                 eval $hasproto ;;
13477         *)      ;;
13478         esac
13479         case "$d_gethostbyaddr_r_proto" in
13480         define)
13481         case "$gethostbyaddr_r_proto" in
13482         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13483         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13484         esac
13485         case "$gethostbyaddr_r_proto" in
13486         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13487         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13488         esac
13489         case "$gethostbyaddr_r_proto" in
13490         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13491         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13492         esac
13493         case "$gethostbyaddr_r_proto" in
13494         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13495         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13496         esac
13497         case "$gethostbyaddr_r_proto" in
13498         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13499         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13500         esac
13501         case "$gethostbyaddr_r_proto" in
13502         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13503         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13504         esac
13505         case "$gethostbyaddr_r_proto" in
13506         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13507         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13508         esac
13509         case "$gethostbyaddr_r_proto" in
13510         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13511         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13512         esac
13513         case "$gethostbyaddr_r_proto" in
13514         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13515         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13516         esac
13517         case "$gethostbyaddr_r_proto" in
13518         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13519         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13520         esac
13521         case "$gethostbyaddr_r_proto" in
13522         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13523         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13524         esac
13525         case "$gethostbyaddr_r_proto" in
13526         ''|0)   d_gethostbyaddr_r=undef
13527                 gethostbyaddr_r_proto=0
13528                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13529         * )     case "$gethostbyaddr_r_proto" in
13530                 REENTRANT_PROTO*) ;;
13531                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13532                 esac
13533                 echo "Prototype: $try" ;;
13534         esac
13535         ;;
13536         *)      case "$usethreads" in
13537                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13538                 esac
13539                 d_gethostbyaddr_r=undef
13540                 gethostbyaddr_r_proto=0
13541                 ;;
13542         esac
13543         ;;
13544 *)      gethostbyaddr_r_proto=0
13545         ;;
13546 esac
13547
13548 : see if gethostbyname_r exists
13549 set gethostbyname_r d_gethostbyname_r
13550 eval $inlibc
13551 case "$d_gethostbyname_r" in
13552 "$define")
13553         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13554         case "$d_gethostbyname_r_proto:$usethreads" in
13555         ":define")      d_gethostbyname_r_proto=define
13556                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13557                 eval $hasproto ;;
13558         *)      ;;
13559         esac
13560         case "$d_gethostbyname_r_proto" in
13561         define)
13562         case "$gethostbyname_r_proto" in
13563         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13564         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13565         esac
13566         case "$gethostbyname_r_proto" in
13567         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13568         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13569         esac
13570         case "$gethostbyname_r_proto" in
13571         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13572         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13573         esac
13574         case "$gethostbyname_r_proto" in
13575         ''|0)   d_gethostbyname_r=undef
13576                 gethostbyname_r_proto=0
13577                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13578         * )     case "$gethostbyname_r_proto" in
13579                 REENTRANT_PROTO*) ;;
13580                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13581                 esac
13582                 echo "Prototype: $try" ;;
13583         esac
13584         ;;
13585         *)      case "$usethreads" in
13586                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13587                 esac
13588                 d_gethostbyname_r=undef
13589                 gethostbyname_r_proto=0
13590                 ;;
13591         esac
13592         ;;
13593 *)      gethostbyname_r_proto=0
13594         ;;
13595 esac
13596
13597 : see if gethostent_r exists
13598 set gethostent_r d_gethostent_r
13599 eval $inlibc
13600 case "$d_gethostent_r" in
13601 "$define")
13602         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13603         case "$d_gethostent_r_proto:$usethreads" in
13604         ":define")      d_gethostent_r_proto=define
13605                 set d_gethostent_r_proto gethostent_r $hdrs
13606                 eval $hasproto ;;
13607         *)      ;;
13608         esac
13609         case "$d_gethostent_r_proto" in
13610         define)
13611         case "$gethostent_r_proto" in
13612         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13613         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13614         esac
13615         case "$gethostent_r_proto" in
13616         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13617         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13618         esac
13619         case "$gethostent_r_proto" in
13620         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13621         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13622         esac
13623         case "$gethostent_r_proto" in
13624         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13625         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13626         esac
13627         case "$gethostent_r_proto" in
13628         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13629         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13630         esac
13631         case "$gethostent_r_proto" in
13632         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13633         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13634         esac
13635         case "$gethostent_r_proto" in
13636         ''|0)   d_gethostent_r=undef
13637                 gethostent_r_proto=0
13638                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13639         * )     case "$gethostent_r_proto" in
13640                 REENTRANT_PROTO*) ;;
13641                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13642                 esac
13643                 echo "Prototype: $try" ;;
13644         esac
13645         ;;
13646         *)      case "$usethreads" in
13647                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13648                 esac
13649                 d_gethostent_r=undef
13650                 gethostent_r_proto=0
13651                 ;;
13652         esac
13653         ;;
13654 *)      gethostent_r_proto=0
13655         ;;
13656 esac
13657
13658 : see if prototypes for various gethostxxx netdb.h functions are available
13659 echo " "
13660 set d_gethostprotos gethostent $i_netdb netdb.h
13661 eval $hasproto
13662
13663 : see if getitimer exists
13664 set getitimer d_getitimer
13665 eval $inlibc
13666
13667 : see if getlogin exists
13668 set getlogin d_getlogin
13669 eval $inlibc
13670
13671 : see if getlogin_r exists
13672 set getlogin_r d_getlogin_r
13673 eval $inlibc
13674 case "$d_getlogin_r" in
13675 "$define")
13676         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13677         case "$d_getlogin_r_proto:$usethreads" in
13678         ":define")      d_getlogin_r_proto=define
13679                 set d_getlogin_r_proto getlogin_r $hdrs
13680                 eval $hasproto ;;
13681         *)      ;;
13682         esac
13683         case "$d_getlogin_r_proto" in
13684         define)
13685         case "$getlogin_r_proto" in
13686         ''|0) try='int getlogin_r(char*, size_t);'
13687         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13688         esac
13689         case "$getlogin_r_proto" in
13690         ''|0) try='int getlogin_r(char*, int);'
13691         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13692         esac
13693         case "$getlogin_r_proto" in
13694         ''|0) try='char* getlogin_r(char*, size_t);'
13695         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13696         esac
13697         case "$getlogin_r_proto" in
13698         ''|0) try='char* getlogin_r(char*, int);'
13699         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13700         esac
13701         case "$getlogin_r_proto" in
13702         ''|0)   d_getlogin_r=undef
13703                 getlogin_r_proto=0
13704                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13705         * )     case "$getlogin_r_proto" in
13706                 REENTRANT_PROTO*) ;;
13707                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13708                 esac
13709                 echo "Prototype: $try" ;;
13710         esac
13711         ;;
13712         *)      case "$usethreads" in
13713                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13714                 esac
13715                 d_getlogin_r=undef
13716                 getlogin_r_proto=0
13717                 ;;
13718         esac
13719         ;;
13720 *)      getlogin_r_proto=0
13721         ;;
13722 esac
13723
13724 : see if getmnt exists
13725 set getmnt d_getmnt
13726 eval $inlibc
13727
13728 : see if getmntent exists
13729 set getmntent d_getmntent
13730 eval $inlibc
13731
13732 : see if getnetbyaddr exists
13733 set getnetbyaddr d_getnbyaddr
13734 eval $inlibc
13735
13736 : see if getnetbyname exists
13737 set getnetbyname d_getnbyname
13738 eval $inlibc
13739
13740 : see if getnetent exists
13741 set getnetent d_getnent
13742 eval $inlibc
13743
13744 : see if getnetbyaddr_r exists
13745 set getnetbyaddr_r d_getnetbyaddr_r
13746 eval $inlibc
13747 case "$d_getnetbyaddr_r" in
13748 "$define")
13749         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13750         case "$d_getnetbyaddr_r_proto:$usethreads" in
13751         ":define")      d_getnetbyaddr_r_proto=define
13752                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13753                 eval $hasproto ;;
13754         *)      ;;
13755         esac
13756         case "$d_getnetbyaddr_r_proto" in
13757         define)
13758         case "$getnetbyaddr_r_proto" in
13759         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13760         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13761         esac
13762         case "$getnetbyaddr_r_proto" in
13763         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13764         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13765         esac
13766         case "$getnetbyaddr_r_proto" in
13767         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13768         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13769         esac
13770         case "$getnetbyaddr_r_proto" in
13771         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13772         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13773         esac
13774         case "$getnetbyaddr_r_proto" in
13775         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13776         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13777         esac
13778         case "$getnetbyaddr_r_proto" in
13779         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13780         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13781         esac
13782         case "$getnetbyaddr_r_proto" in
13783         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13784         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13785         esac
13786         case "$getnetbyaddr_r_proto" in
13787         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13788         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13789         esac
13790         case "$getnetbyaddr_r_proto" in
13791         ''|0)   d_getnetbyaddr_r=undef
13792                 getnetbyaddr_r_proto=0
13793                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13794         * )     case "$getnetbyaddr_r_proto" in
13795                 REENTRANT_PROTO*) ;;
13796                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13797                 esac
13798                 echo "Prototype: $try" ;;
13799         esac
13800         ;;
13801         *)      case "$usethreads" in
13802                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13803                 esac
13804                 d_getnetbyaddr_r=undef
13805                 getnetbyaddr_r_proto=0
13806                 ;;
13807         esac
13808         ;;
13809 *)      getnetbyaddr_r_proto=0
13810         ;;
13811 esac
13812
13813 : see if getnetbyname_r exists
13814 set getnetbyname_r d_getnetbyname_r
13815 eval $inlibc
13816 case "$d_getnetbyname_r" in
13817 "$define")
13818         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13819         case "$d_getnetbyname_r_proto:$usethreads" in
13820         ":define")      d_getnetbyname_r_proto=define
13821                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13822                 eval $hasproto ;;
13823         *)      ;;
13824         esac
13825         case "$d_getnetbyname_r_proto" in
13826         define)
13827         case "$getnetbyname_r_proto" in
13828         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13829         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13830         esac
13831         case "$getnetbyname_r_proto" in
13832         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13833         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13834         esac
13835         case "$getnetbyname_r_proto" in
13836         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13837         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13838         esac
13839         case "$getnetbyname_r_proto" in
13840         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13841         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13842         esac
13843         case "$getnetbyname_r_proto" in
13844         ''|0)   d_getnetbyname_r=undef
13845                 getnetbyname_r_proto=0
13846                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13847         * )     case "$getnetbyname_r_proto" in
13848                 REENTRANT_PROTO*) ;;
13849                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13850                 esac
13851                 echo "Prototype: $try" ;;
13852         esac
13853         ;;
13854         *)      case "$usethreads" in
13855                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13856                 esac
13857                 d_getnetbyname_r=undef
13858                 getnetbyname_r_proto=0
13859                 ;;
13860         esac
13861         ;;
13862 *)      getnetbyname_r_proto=0
13863         ;;
13864 esac
13865
13866 : see if getnetent_r exists
13867 set getnetent_r d_getnetent_r
13868 eval $inlibc
13869 case "$d_getnetent_r" in
13870 "$define")
13871         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13872         case "$d_getnetent_r_proto:$usethreads" in
13873         ":define")      d_getnetent_r_proto=define
13874                 set d_getnetent_r_proto getnetent_r $hdrs
13875                 eval $hasproto ;;
13876         *)      ;;
13877         esac
13878         case "$d_getnetent_r_proto" in
13879         define)
13880         case "$getnetent_r_proto" in
13881         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13882         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13883         esac
13884         case "$getnetent_r_proto" in
13885         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13886         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13887         esac
13888         case "$getnetent_r_proto" in
13889         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13890         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13891         esac
13892         case "$getnetent_r_proto" in
13893         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13894         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13895         esac
13896         case "$getnetent_r_proto" in
13897         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13898         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13899         esac
13900         case "$getnetent_r_proto" in
13901         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13902         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13903         esac
13904         case "$getnetent_r_proto" in
13905         ''|0)   d_getnetent_r=undef
13906                 getnetent_r_proto=0
13907                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13908         * )     case "$getnetent_r_proto" in
13909                 REENTRANT_PROTO*) ;;
13910                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13911                 esac
13912                 echo "Prototype: $try" ;;
13913         esac
13914         ;;
13915         *)      case "$usethreads" in
13916                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13917                 esac
13918                 d_getnetent_r=undef
13919                 getnetent_r_proto=0
13920                 ;;
13921         esac
13922         ;;
13923 *)      getnetent_r_proto=0
13924         ;;
13925 esac
13926
13927 : see if prototypes for various getnetxxx netdb.h functions are available
13928 echo " "
13929 set d_getnetprotos getnetent $i_netdb netdb.h
13930 eval $hasproto
13931
13932 : see if getpagesize exists
13933 set getpagesize d_getpagsz
13934 eval $inlibc
13935
13936 : Optional checks for getprotobyname and getprotobynumber
13937
13938 : see if getprotobyname exists
13939 set getprotobyname d_getpbyname
13940 eval $inlibc
13941
13942 : see if getprotobynumber exists
13943 set getprotobynumber d_getpbynumber
13944 eval $inlibc
13945
13946 : see if getprotoent exists
13947 set getprotoent d_getpent
13948 eval $inlibc
13949
13950 : see if getpgid exists
13951 set getpgid d_getpgid
13952 eval $inlibc
13953
13954 : see if getpgrp2 exists
13955 set getpgrp2 d_getpgrp2
13956 eval $inlibc
13957
13958 : see if getppid exists
13959 set getppid d_getppid
13960 eval $inlibc
13961
13962 : see if getpriority exists
13963 set getpriority d_getprior
13964 eval $inlibc
13965
13966 : see if getprotobyname_r exists
13967 set getprotobyname_r d_getprotobyname_r
13968 eval $inlibc
13969 case "$d_getprotobyname_r" in
13970 "$define")
13971         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13972         case "$d_getprotobyname_r_proto:$usethreads" in
13973         ":define")      d_getprotobyname_r_proto=define
13974                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13975                 eval $hasproto ;;
13976         *)      ;;
13977         esac
13978         case "$d_getprotobyname_r_proto" in
13979         define)
13980         case "$getprotobyname_r_proto" in
13981         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13982         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13983         esac
13984         case "$getprotobyname_r_proto" in
13985         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13986         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13987         esac
13988         case "$getprotobyname_r_proto" in
13989         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13990         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13991         esac
13992         case "$getprotobyname_r_proto" in
13993         ''|0)   d_getprotobyname_r=undef
13994                 getprotobyname_r_proto=0
13995                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13996         * )     case "$getprotobyname_r_proto" in
13997                 REENTRANT_PROTO*) ;;
13998                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13999                 esac
14000                 echo "Prototype: $try" ;;
14001         esac
14002         ;;
14003         *)      case "$usethreads" in
14004                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14005                 esac
14006                 d_getprotobyname_r=undef
14007                 getprotobyname_r_proto=0
14008                 ;;
14009         esac
14010         ;;
14011 *)      getprotobyname_r_proto=0
14012         ;;
14013 esac
14014
14015 : see if getprotobynumber_r exists
14016 set getprotobynumber_r d_getprotobynumber_r
14017 eval $inlibc
14018 case "$d_getprotobynumber_r" in
14019 "$define")
14020         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14021         case "$d_getprotobynumber_r_proto:$usethreads" in
14022         ":define")      d_getprotobynumber_r_proto=define
14023                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14024                 eval $hasproto ;;
14025         *)      ;;
14026         esac
14027         case "$d_getprotobynumber_r_proto" in
14028         define)
14029         case "$getprotobynumber_r_proto" in
14030         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14031         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14032         esac
14033         case "$getprotobynumber_r_proto" in
14034         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14035         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14036         esac
14037         case "$getprotobynumber_r_proto" in
14038         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14039         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14040         esac
14041         case "$getprotobynumber_r_proto" in
14042         ''|0)   d_getprotobynumber_r=undef
14043                 getprotobynumber_r_proto=0
14044                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14045         * )     case "$getprotobynumber_r_proto" in
14046                 REENTRANT_PROTO*) ;;
14047                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14048                 esac
14049                 echo "Prototype: $try" ;;
14050         esac
14051         ;;
14052         *)      case "$usethreads" in
14053                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14054                 esac
14055                 d_getprotobynumber_r=undef
14056                 getprotobynumber_r_proto=0
14057                 ;;
14058         esac
14059         ;;
14060 *)      getprotobynumber_r_proto=0
14061         ;;
14062 esac
14063
14064 : see if getprotoent_r exists
14065 set getprotoent_r d_getprotoent_r
14066 eval $inlibc
14067 case "$d_getprotoent_r" in
14068 "$define")
14069         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14070         case "$d_getprotoent_r_proto:$usethreads" in
14071         ":define")      d_getprotoent_r_proto=define
14072                 set d_getprotoent_r_proto getprotoent_r $hdrs
14073                 eval $hasproto ;;
14074         *)      ;;
14075         esac
14076         case "$d_getprotoent_r_proto" in
14077         define)
14078         case "$getprotoent_r_proto" in
14079         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14080         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14081         esac
14082         case "$getprotoent_r_proto" in
14083         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14084         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14085         esac
14086         case "$getprotoent_r_proto" in
14087         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14088         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14089         esac
14090         case "$getprotoent_r_proto" in
14091         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14092         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
14093         esac
14094         case "$getprotoent_r_proto" in
14095         ''|0)   d_getprotoent_r=undef
14096                 getprotoent_r_proto=0
14097                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14098         * )     case "$getprotoent_r_proto" in
14099                 REENTRANT_PROTO*) ;;
14100                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14101                 esac
14102                 echo "Prototype: $try" ;;
14103         esac
14104         ;;
14105         *)      case "$usethreads" in
14106                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14107                 esac
14108                 d_getprotoent_r=undef
14109                 getprotoent_r_proto=0
14110                 ;;
14111         esac
14112         ;;
14113 *)      getprotoent_r_proto=0
14114         ;;
14115 esac
14116
14117 : see if prototypes for various getprotoxxx netdb.h functions are available
14118 echo " "
14119 set d_getprotoprotos getprotoent $i_netdb netdb.h
14120 eval $hasproto
14121
14122 : see if getprpwnam exists
14123 set getprpwnam d_getprpwnam
14124 eval $inlibc
14125
14126 : see if getpwent exists
14127 set getpwent d_getpwent
14128 eval $inlibc
14129
14130 : see if getpwent_r exists
14131 set getpwent_r d_getpwent_r
14132 eval $inlibc
14133 case "$d_getpwent_r" in
14134 "$define")
14135         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14136         case "$d_getpwent_r_proto:$usethreads" in
14137         ":define")      d_getpwent_r_proto=define
14138                 set d_getpwent_r_proto getpwent_r $hdrs
14139                 eval $hasproto ;;
14140         *)      ;;
14141         esac
14142         case "$d_getpwent_r_proto" in
14143         define)
14144         case "$getpwent_r_proto" in
14145         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14146         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14147         esac
14148         case "$getpwent_r_proto" in
14149         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14150         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14151         esac
14152         case "$getpwent_r_proto" in
14153         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14154         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
14155         esac
14156         case "$getpwent_r_proto" in
14157         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14158         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
14159         esac
14160         case "$getpwent_r_proto" in
14161         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14162         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
14163         esac
14164         case "$getpwent_r_proto" in
14165         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14166         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14167         esac
14168         case "$getpwent_r_proto" in
14169         ''|0)   d_getpwent_r=undef
14170                 getpwent_r_proto=0
14171                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14172         * )     case "$getpwent_r_proto" in
14173                 REENTRANT_PROTO*) ;;
14174                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14175                 esac
14176                 echo "Prototype: $try" ;;
14177         esac
14178         ;;
14179         *)      case "$usethreads" in
14180                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14181                 esac
14182                 d_getpwent_r=undef
14183                 getpwent_r_proto=0
14184                 ;;
14185         esac
14186         ;;
14187 *)      getpwent_r_proto=0
14188         ;;
14189 esac
14190
14191 : see if getpwnam_r exists
14192 set getpwnam_r d_getpwnam_r
14193 eval $inlibc
14194 case "$d_getpwnam_r" in
14195 "$define")
14196         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14197         case "$d_getpwnam_r_proto:$usethreads" in
14198         ":define")      d_getpwnam_r_proto=define
14199                 set d_getpwnam_r_proto getpwnam_r $hdrs
14200                 eval $hasproto ;;
14201         *)      ;;
14202         esac
14203         case "$d_getpwnam_r_proto" in
14204         define)
14205         case "$getpwnam_r_proto" in
14206         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14207         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14208         esac
14209         case "$getpwnam_r_proto" in
14210         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14211         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14212         esac
14213         case "$getpwnam_r_proto" in
14214         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14215         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14216         esac
14217         case "$getpwnam_r_proto" in
14218         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14219         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14220         esac
14221         case "$getpwnam_r_proto" in
14222         ''|0)   d_getpwnam_r=undef
14223                 getpwnam_r_proto=0
14224                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14225         * )     case "$getpwnam_r_proto" in
14226                 REENTRANT_PROTO*) ;;
14227                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14228                 esac
14229                 echo "Prototype: $try" ;;
14230         esac
14231         ;;
14232         *)      case "$usethreads" in
14233                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14234                 esac
14235                 d_getpwnam_r=undef
14236                 getpwnam_r_proto=0
14237                 ;;
14238         esac
14239         ;;
14240 *)      getpwnam_r_proto=0
14241         ;;
14242 esac
14243
14244 : see if getpwuid_r exists
14245 set getpwuid_r d_getpwuid_r
14246 eval $inlibc
14247 case "$d_getpwuid_r" in
14248 "$define")
14249         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14250         case "$d_getpwuid_r_proto:$usethreads" in
14251         ":define")      d_getpwuid_r_proto=define
14252                 set d_getpwuid_r_proto getpwuid_r $hdrs
14253                 eval $hasproto ;;
14254         *)      ;;
14255         esac
14256         case "$d_getpwuid_r_proto" in
14257         define)
14258         case "$getpwuid_r_proto" in
14259         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14260         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14261         esac
14262         case "$getpwuid_r_proto" in
14263         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14264         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14265         esac
14266         case "$getpwuid_r_proto" in
14267         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14268         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14269         esac
14270         case "$getpwuid_r_proto" in
14271         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14272         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14273         esac
14274         case "$getpwuid_r_proto" in
14275         ''|0)   d_getpwuid_r=undef
14276                 getpwuid_r_proto=0
14277                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14278         * )     case "$getpwuid_r_proto" in
14279                 REENTRANT_PROTO*) ;;
14280                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14281                 esac
14282                 echo "Prototype: $try" ;;
14283         esac
14284         ;;
14285         *)      case "$usethreads" in
14286                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14287                 esac
14288                 d_getpwuid_r=undef
14289                 getpwuid_r_proto=0
14290                 ;;
14291         esac
14292         ;;
14293 *)      getpwuid_r_proto=0
14294         ;;
14295 esac
14296
14297 : Optional checks for getsbyname and getsbyport
14298
14299 : see if getservbyname exists
14300 set getservbyname d_getsbyname
14301 eval $inlibc
14302
14303 : see if getservbyport exists
14304 set getservbyport d_getsbyport
14305 eval $inlibc
14306
14307 : see if getservent exists
14308 set getservent d_getsent
14309 eval $inlibc
14310
14311 : see if getservbyname_r exists
14312 set getservbyname_r d_getservbyname_r
14313 eval $inlibc
14314 case "$d_getservbyname_r" in
14315 "$define")
14316         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14317         case "$d_getservbyname_r_proto:$usethreads" in
14318         ":define")      d_getservbyname_r_proto=define
14319                 set d_getservbyname_r_proto getservbyname_r $hdrs
14320                 eval $hasproto ;;
14321         *)      ;;
14322         esac
14323         case "$d_getservbyname_r_proto" in
14324         define)
14325         case "$getservbyname_r_proto" in
14326         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14327         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14328         esac
14329         case "$getservbyname_r_proto" in
14330         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14331         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14332         esac
14333         case "$getservbyname_r_proto" in
14334         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14335         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14336         esac
14337         case "$getservbyname_r_proto" in
14338         ''|0)   d_getservbyname_r=undef
14339                 getservbyname_r_proto=0
14340                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14341         * )     case "$getservbyname_r_proto" in
14342                 REENTRANT_PROTO*) ;;
14343                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14344                 esac
14345                 echo "Prototype: $try" ;;
14346         esac
14347         ;;
14348         *)      case "$usethreads" in
14349                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14350                 esac
14351                 d_getservbyname_r=undef
14352                 getservbyname_r_proto=0
14353                 ;;
14354         esac
14355         ;;
14356 *)      getservbyname_r_proto=0
14357         ;;
14358 esac
14359
14360 : see if getservbyport_r exists
14361 set getservbyport_r d_getservbyport_r
14362 eval $inlibc
14363 case "$d_getservbyport_r" in
14364 "$define")
14365         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14366         case "$d_getservbyport_r_proto:$usethreads" in
14367         ":define")      d_getservbyport_r_proto=define
14368                 set d_getservbyport_r_proto getservbyport_r $hdrs
14369                 eval $hasproto ;;
14370         *)      ;;
14371         esac
14372         case "$d_getservbyport_r_proto" in
14373         define)
14374         case "$getservbyport_r_proto" in
14375         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14376         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14377         esac
14378         case "$getservbyport_r_proto" in
14379         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14380         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14381         esac
14382         case "$getservbyport_r_proto" in
14383         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14384         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14385         esac
14386         case "$getservbyport_r_proto" in
14387         ''|0)   d_getservbyport_r=undef
14388                 getservbyport_r_proto=0
14389                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14390         * )     case "$getservbyport_r_proto" in
14391                 REENTRANT_PROTO*) ;;
14392                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14393                 esac
14394                 echo "Prototype: $try" ;;
14395         esac
14396         ;;
14397         *)      case "$usethreads" in
14398                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14399                 esac
14400                 d_getservbyport_r=undef
14401                 getservbyport_r_proto=0
14402                 ;;
14403         esac
14404         ;;
14405 *)      getservbyport_r_proto=0
14406         ;;
14407 esac
14408
14409 : see if getservent_r exists
14410 set getservent_r d_getservent_r
14411 eval $inlibc
14412 case "$d_getservent_r" in
14413 "$define")
14414         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14415         case "$d_getservent_r_proto:$usethreads" in
14416         ":define")      d_getservent_r_proto=define
14417                 set d_getservent_r_proto getservent_r $hdrs
14418                 eval $hasproto ;;
14419         *)      ;;
14420         esac
14421         case "$d_getservent_r_proto" in
14422         define)
14423         case "$getservent_r_proto" in
14424         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14425         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
14426         esac
14427         case "$getservent_r_proto" in
14428         ''|0) try='int getservent_r(struct servent*, char*, int);'
14429         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
14430         esac
14431         case "$getservent_r_proto" in
14432         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14433         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
14434         esac
14435         case "$getservent_r_proto" in
14436         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14437         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
14438         esac
14439         case "$getservent_r_proto" in
14440         ''|0)   d_getservent_r=undef
14441                 getservent_r_proto=0
14442                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14443         * )     case "$getservent_r_proto" in
14444                 REENTRANT_PROTO*) ;;
14445                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14446                 esac
14447                 echo "Prototype: $try" ;;
14448         esac
14449         ;;
14450         *)      case "$usethreads" in
14451                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14452                 esac
14453                 d_getservent_r=undef
14454                 getservent_r_proto=0
14455                 ;;
14456         esac
14457         ;;
14458 *)      getservent_r_proto=0
14459         ;;
14460 esac
14461
14462 : see if prototypes for various getservxxx netdb.h functions are available
14463 echo " "
14464 set d_getservprotos getservent $i_netdb netdb.h
14465 eval $hasproto
14466
14467 : see if getspnam exists
14468 set getspnam d_getspnam
14469 eval $inlibc
14470
14471 : see if this is a shadow.h system
14472 set shadow.h i_shadow
14473 eval $inhdr
14474
14475 : see if getspnam_r exists
14476 set getspnam_r d_getspnam_r
14477 eval $inlibc
14478 case "$d_getspnam_r" in
14479 "$define")
14480         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14481         case "$d_getspnam_r_proto:$usethreads" in
14482         ":define")      d_getspnam_r_proto=define
14483                 set d_getspnam_r_proto getspnam_r $hdrs
14484                 eval $hasproto ;;
14485         *)      ;;
14486         esac
14487         case "$d_getspnam_r_proto" in
14488         define)
14489         case "$getspnam_r_proto" in
14490         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14491         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14492         esac
14493         case "$getspnam_r_proto" in
14494         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14495         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14496         esac
14497         case "$getspnam_r_proto" in
14498         ''|0)   d_getspnam_r=undef
14499                 getspnam_r_proto=0
14500                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14501         * )     case "$getspnam_r_proto" in
14502                 REENTRANT_PROTO*) ;;
14503                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14504                 esac
14505                 echo "Prototype: $try" ;;
14506         esac
14507         ;;
14508         *)      case "$usethreads" in
14509                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14510                 esac
14511                 d_getspnam_r=undef
14512                 getspnam_r_proto=0
14513                 ;;
14514         esac
14515         ;;
14516 *)      getspnam_r_proto=0
14517         ;;
14518 esac
14519
14520 : see if gettimeofday or ftime exists
14521 set gettimeofday d_gettimeod
14522 eval $inlibc
14523 case "$d_gettimeod" in
14524 "$undef")
14525         set ftime d_ftime 
14526         eval $inlibc
14527         ;;
14528 *)
14529         val="$undef"; set d_ftime; eval $setvar
14530         ;;
14531 esac
14532 case "$d_gettimeod$d_ftime" in
14533 "$undef$undef")
14534         echo " "
14535         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14536         ;;
14537 esac
14538
14539 : see if gmtime_r exists
14540 set gmtime_r d_gmtime_r
14541 eval $inlibc
14542 case "$d_gmtime_r" in
14543 "$define")
14544         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14545         case "$d_gmtime_r_proto:$usethreads" in
14546         ":define")      d_gmtime_r_proto=define
14547                 set d_gmtime_r_proto gmtime_r $hdrs
14548                 eval $hasproto ;;
14549         *)      ;;
14550         esac
14551         case "$d_gmtime_r_proto" in
14552         define)
14553         case "$gmtime_r_proto" in
14554         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14555         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14556         esac
14557         case "$gmtime_r_proto" in
14558         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14559         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14560         esac
14561         case "$gmtime_r_proto" in
14562         ''|0)   d_gmtime_r=undef
14563                 gmtime_r_proto=0
14564                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14565         * )     case "$gmtime_r_proto" in
14566                 REENTRANT_PROTO*) ;;
14567                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14568                 esac
14569                 echo "Prototype: $try" ;;
14570         esac
14571         ;;
14572         *)      case "$usethreads" in
14573                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14574                 esac
14575                 d_gmtime_r=undef
14576                 gmtime_r_proto=0
14577                 ;;
14578         esac
14579         ;;
14580 *)      gmtime_r_proto=0
14581         ;;
14582 esac
14583
14584 : see if hasmntopt exists
14585 set hasmntopt d_hasmntopt
14586 eval $inlibc
14587
14588 : see if this is a netinet/in.h or sys/in.h system
14589 set netinet/in.h i_niin sys/in.h i_sysin
14590 eval $inhdr
14591
14592 : see if arpa/inet.h has to be included
14593 set arpa/inet.h i_arpainet
14594 eval $inhdr
14595
14596 : see if htonl --and friends-- exists
14597 val=''
14598 set htonl val
14599 eval $inlibc
14600
14601 : Maybe they are macros.
14602 case "$val" in
14603 $undef)
14604         $cat >htonl.c <<EOM
14605 #include <stdio.h>
14606 #include <sys/types.h>
14607 #$i_niin I_NETINET_IN
14608 #$i_sysin I_SYS_IN
14609 #$i_arpainet I_ARPA_INET
14610 #ifdef I_NETINET_IN
14611 #include <netinet/in.h>
14612 #endif
14613 #ifdef I_SYS_IN
14614 #include <sys/in.h>
14615 #endif
14616 #ifdef I_ARPA_INET
14617 #include <arpa/inet.h>
14618 #endif
14619 #ifdef htonl
14620 printf("Defined as a macro.");
14621 #endif
14622 EOM
14623         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14624         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14625                 val="$define"
14626                 echo "But it seems to be defined as a macro." >&4
14627         fi
14628         $rm -f htonl.?
14629         ;;
14630 esac
14631 set d_htonl
14632 eval $setvar
14633
14634 : see if ilogbl exists
14635 set ilogbl d_ilogbl
14636 eval $inlibc
14637
14638 : index or strchr
14639 echo " "
14640 if set index val -f; eval $csym; $val; then
14641         if set strchr val -f d_strchr; eval $csym; $val; then
14642                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14643                         val="$define"
14644                         vali="$undef"
14645                         echo "strchr() found." >&4
14646                 else
14647                         val="$undef"
14648                         vali="$define"
14649                         echo "index() found." >&4
14650                 fi
14651         else
14652                 val="$undef"
14653                 vali="$define"
14654                 echo "index() found." >&4
14655         fi
14656 else
14657         if set strchr val -f d_strchr; eval $csym; $val; then
14658                 val="$define"
14659                 vali="$undef"
14660                 echo "strchr() found." >&4
14661         else
14662                 echo "No index() or strchr() found!" >&4
14663                 val="$undef"
14664                 vali="$undef"
14665         fi
14666 fi
14667 set d_strchr; eval $setvar
14668 val="$vali"
14669 set d_index; eval $setvar
14670
14671 : check whether inet_aton exists
14672 set inet_aton d_inetaton
14673 eval $inlibc
14674
14675 : Look for isascii
14676 echo " "
14677 $cat >isascii.c <<EOCP
14678 #include <stdio.h>
14679 #include <ctype.h>
14680 #$i_stdlib I_STDLIB
14681 #ifdef I_STDLIB
14682 #include <stdlib.h>
14683 #endif
14684 int main() {
14685         int c = 'A';
14686         if (isascii(c))
14687                 exit(0);
14688         else
14689                 exit(1);
14690 }
14691 EOCP
14692 set isascii
14693 if eval $compile; then
14694         echo "isascii() found." >&4
14695         val="$define"
14696 else
14697         echo "isascii() NOT found." >&4
14698         val="$undef"
14699 fi
14700 set d_isascii
14701 eval $setvar
14702 $rm -f isascii*
14703
14704 : see if isfinite exists
14705 set isfinite d_isfinite
14706 eval $inlibc
14707
14708 : see if isinf exists
14709 set isinf d_isinf
14710 eval $inlibc
14711
14712 : see if isnan exists
14713 set isnan d_isnan
14714 eval $inlibc
14715
14716 : see if isnanl exists
14717 set isnanl d_isnanl
14718 eval $inlibc
14719
14720 : see if killpg exists
14721 set killpg d_killpg
14722 eval $inlibc
14723
14724 : see if lchown exists
14725 echo " "
14726 $cat > try.c <<'EOCP'
14727 /* System header to define __stub macros and hopefully few prototypes,
14728     which can conflict with char lchown(); below.  */
14729 #include <assert.h>
14730 /* Override any gcc2 internal prototype to avoid an error.  */
14731 /* We use char because int might match the return type of a gcc2
14732    builtin and then its argument prototype would still apply.  */
14733 char lchown();
14734 int main() {
14735     /*  The GNU C library defines this for functions which it implements
14736         to always fail with ENOSYS.  Some functions are actually named
14737         something starting with __ and the normal name is an alias.  */
14738 #if defined (__stub_lchown) || defined (__stub___lchown)
14739 choke me
14740 #else
14741 lchown();
14742 #endif
14743 ; return 0; }
14744 EOCP
14745 set try
14746 if eval $compile; then
14747     $echo "lchown() found." >&4
14748     val="$define"
14749 else
14750     $echo "lchown() NOT found." >&4
14751     val="$undef"
14752 fi
14753 set d_lchown
14754 eval $setvar
14755
14756 : See if number of significant digits in a double precision number is known
14757 echo " "
14758 $cat >ldbl_dig.c <<EOM
14759 #$i_limits I_LIMITS
14760 #$i_float I_FLOAT
14761 #ifdef I_LIMITS
14762 #include <limits.h>
14763 #endif
14764 #ifdef I_FLOAT
14765 #include <float.h>
14766 #endif
14767 #ifdef LDBL_DIG
14768 printf("Contains LDBL_DIG");
14769 #endif
14770 EOM
14771 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14772 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14773         echo "LDBL_DIG found." >&4
14774         val="$define"
14775 else
14776         echo "LDBL_DIG NOT found." >&4
14777         val="$undef"
14778 fi
14779 $rm -f ldbl_dig.?
14780 set d_ldbl_dig
14781 eval $setvar
14782
14783 : see if this is a math.h system
14784 set math.h i_math
14785 eval $inhdr
14786
14787 : check to see if math.h defines _LIB_VERSION
14788 d_libm_lib_version="$undef"
14789 case $i_math in
14790     $define)
14791         echo " "
14792         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14793         $cat >try.c <<EOCP
14794 #include <unistd.h>
14795 #include <math.h>
14796 int main (int argc, char *argv[])
14797 {
14798     printf ("%d\n", _LIB_VERSION);
14799     return (0);
14800     } /* main */
14801 EOCP
14802         set try
14803         if eval $compile; then
14804             foo=`$run ./try`
14805             echo "Yes, it does ($foo)" >&4
14806             d_libm_lib_version="$define"
14807         else
14808             echo "No, it does not (probably harmless)" >&4
14809             fi
14810         $rm_try
14811         ;;
14812
14813     esac
14814
14815 : see if link exists
14816 set link d_link
14817 eval $inlibc
14818
14819 : see if localtime_r exists
14820 set localtime_r d_localtime_r
14821 eval $inlibc
14822 case "$d_localtime_r" in
14823 "$define")
14824         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14825         case "$d_localtime_r_proto:$usethreads" in
14826         ":define")      d_localtime_r_proto=define
14827                 set d_localtime_r_proto localtime_r $hdrs
14828                 eval $hasproto ;;
14829         *)      ;;
14830         esac
14831         case "$d_localtime_r_proto" in
14832         define)
14833         case "$localtime_r_proto" in
14834         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14835         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14836         esac
14837         case "$localtime_r_proto" in
14838         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14839         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14840         esac
14841         case "$localtime_r_proto" in
14842         ''|0)   d_localtime_r=undef
14843                 localtime_r_proto=0
14844                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14845         * )     case "$localtime_r_proto" in
14846                 REENTRANT_PROTO*) ;;
14847                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14848                 esac
14849                 echo "Prototype: $try" ;;
14850         esac
14851         ;;
14852         *)      case "$usethreads" in
14853                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14854                 esac
14855                 d_localtime_r=undef
14856                 localtime_r_proto=0
14857                 ;;
14858         esac
14859         ;;
14860 *)      localtime_r_proto=0
14861         ;;
14862 esac
14863
14864 : see if localtime_r calls tzset
14865 case "$localtime_r_proto" in
14866 REENTRANT_PROTO*)
14867         $cat >try.c <<EOCP
14868 /*  Does our libc's localtime_r call tzset ?
14869  *  return 0 if so, 1 otherwise.
14870  */
14871 #include <sys/types.h>
14872 #include <unistd.h>
14873 #include <time.h>
14874 #include <string.h>
14875 #include <malloc.h>
14876 int main()
14877 {
14878     time_t t = time(0L);
14879     char w_tz[]="TZ" "=GMT+5",
14880          e_tz[]="TZ" "=GMT-5",
14881         *tz_e = (char*)malloc(16),
14882         *tz_w = (char*)malloc(16);
14883     struct tm tm_e, tm_w;
14884     memset(&tm_e,'\0',sizeof(struct tm));
14885     memset(&tm_w,'\0',sizeof(struct tm));
14886     strcpy(tz_e,e_tz);
14887     strcpy(tz_w,w_tz);
14888
14889     putenv(tz_e);
14890     localtime_r(&t, &tm_e);
14891
14892     putenv(tz_w);
14893     localtime_r(&t, &tm_w);
14894
14895     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
14896         return 1;
14897     return 0;
14898 }
14899 EOCP
14900         set try
14901         if eval $compile; then
14902             if $run ./try; then
14903                 d_localtime_r_needs_tzset=undef;
14904             else
14905                 d_localtime_r_needs_tzset=define;
14906             fi;
14907         else
14908             d_localtime_r_needs_tzset=undef;
14909         fi;
14910      ;;
14911   *)
14912      d_localtime_r_needs_tzset=undef;
14913      ;;
14914 esac
14915 $rm_try
14916
14917 : see if localeconv exists
14918 set localeconv d_locconv
14919 eval $inlibc
14920
14921 : see if lockf exists
14922 set lockf d_lockf
14923 eval $inlibc
14924
14925 : see if prototype for lseek is available
14926 echo " "
14927 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14928 eval $hasproto
14929
14930 : see if lstat exists
14931 set lstat d_lstat
14932 eval $inlibc
14933
14934 : see if madvise exists
14935 set madvise d_madvise
14936 eval $inlibc
14937
14938 : see if malloc_size exists
14939 set malloc_size d_malloc_size
14940 eval $inlibc
14941
14942 : see if malloc_size_good exists
14943 set malloc_good_size d_malloc_good_size
14944 eval $inlibc
14945
14946 : see if mblen exists
14947 set mblen d_mblen
14948 eval $inlibc
14949
14950 : see if mbstowcs exists
14951 set mbstowcs d_mbstowcs
14952 eval $inlibc
14953
14954 : see if mbtowc exists
14955 set mbtowc d_mbtowc
14956 eval $inlibc
14957
14958 : see if memchr exists
14959 set memchr d_memchr
14960 eval $inlibc
14961
14962 : see if memcmp exists
14963 set memcmp d_memcmp
14964 eval $inlibc
14965
14966 : see if memcpy exists
14967 set memcpy d_memcpy
14968 eval $inlibc
14969
14970 : see if memmove exists
14971 set memmove d_memmove
14972 eval $inlibc
14973
14974 : see if memset exists
14975 set memset d_memset
14976 eval $inlibc
14977
14978 : see if mkdir exists
14979 set mkdir d_mkdir
14980 eval $inlibc
14981
14982 : see if mkdtemp exists
14983 set mkdtemp d_mkdtemp
14984 eval $inlibc
14985
14986 : see if mkfifo exists
14987 set mkfifo d_mkfifo
14988 eval $inlibc
14989
14990 : see if mkstemp exists
14991 set mkstemp d_mkstemp
14992 eval $inlibc
14993
14994 : see if mkstemps exists
14995 set mkstemps d_mkstemps
14996 eval $inlibc
14997
14998 : see if mktime exists
14999 set mktime d_mktime
15000 eval $inlibc
15001
15002 : see if this is a sys/mman.h system
15003 set sys/mman.h i_sysmman
15004 eval $inhdr
15005
15006 : see if mmap exists
15007 set mmap d_mmap
15008 eval $inlibc
15009 : see what shmat returns
15010 : default to something harmless
15011 mmaptype='void *'
15012 case "$i_sysmman$d_mmap" in
15013 "$define$define")
15014         $cat >mmap.c <<'END'
15015 #include <sys/mman.h>
15016 void *mmap();
15017 END
15018         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15019                 mmaptype='void *'
15020         else
15021                 mmaptype='caddr_t'
15022         fi
15023         echo "and it returns ($mmaptype)." >&4
15024         ;;
15025 esac
15026
15027
15028
15029 : see if sqrtl exists
15030 set sqrtl d_sqrtl
15031 eval $inlibc
15032
15033 : see if scalbnl exists
15034 set scalbnl d_scalbnl
15035 eval $inlibc
15036
15037 : see if modfl exists
15038 set modfl d_modfl
15039 eval $inlibc
15040
15041 : see if prototype for modfl is available
15042 echo " "
15043 set d_modflproto modfl $i_math math.h
15044 eval $hasproto
15045
15046 d_modfl_pow32_bug="$undef"
15047
15048 case "$d_longdbl$d_modfl" in
15049 $define$define)
15050         $cat <<EOM
15051 Checking to see whether your modfl() is okay for large values...
15052 EOM
15053 $cat >try.c <<EOCP
15054 #include <math.h>
15055 #include <stdio.h>
15056 EOCP
15057 if $test "X$d_modflproto" != "X$define"; then
15058         $cat >>try.c <<EOCP
15059 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15060 long double modfl (long double, long double *);
15061 EOCP
15062 fi
15063 $cat >>try.c <<EOCP
15064 int main() {
15065     long double nv = 4294967303.15;
15066     long double v, w;
15067     v = modfl(nv, &w);
15068 #ifdef __GLIBC__
15069     printf("glibc");
15070 #endif
15071     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15072     return 0;
15073 }
15074 EOCP
15075         case "$osname:$gccversion" in
15076         aix:)   saveccflags="$ccflags"
15077                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15078         esac
15079         set try
15080         if eval $compile; then
15081                 foo=`$run ./try`
15082                 case "$foo" in
15083                 *" 4294967303.150000 1.150000 4294967302.000000")
15084                         echo >&4 "Your modfl() is broken for large values."
15085                         d_modfl_pow32_bug="$define"
15086                         case "$foo" in
15087                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15088                         ;;
15089                         esac
15090                         ;;
15091                 *" 4294967303.150000 0.150000 4294967303.000000")
15092                         echo >&4 "Your modfl() seems okay for large values."
15093                         ;;
15094                 *)      echo >&4 "I don't understand your modfl() at all."
15095                         d_modfl="$undef"
15096                         ;;
15097                 esac
15098                 $rm_try
15099         else
15100                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15101                 d_modfl="$undef"
15102         fi
15103         case "$osname:$gccversion" in
15104         aix:)   ccflags="$saveccflags" ;; # restore
15105         esac
15106         ;;
15107 esac
15108
15109 if $test "$uselongdouble" = "$define"; then
15110     message=""
15111     if $test "$d_sqrtl" != "$define"; then
15112         message="$message sqrtl"
15113     fi
15114     if $test "$d_modfl" != "$define"; then
15115         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15116             echo "You have both aintl and copysignl, so I can emulate modfl."
15117         else
15118             message="$message modfl"
15119         fi
15120     fi
15121     if $test "$d_frexpl" != "$define"; then
15122         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15123             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15124         else
15125             message="$message frexpl"
15126         fi
15127     fi
15128
15129     if $test "$message" != ""; then
15130         $cat <<EOM >&4
15131
15132 *** You requested the use of long doubles but you do not seem to have
15133 *** the following mathematical functions needed for long double support:
15134 ***    $message
15135 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15136 *** Cannot continue, aborting.
15137
15138 EOM
15139
15140         exit 1
15141     fi
15142 fi
15143
15144 : see if mprotect exists
15145 set mprotect d_mprotect
15146 eval $inlibc
15147
15148 : see if msgctl exists
15149 set msgctl d_msgctl
15150 eval $inlibc
15151
15152 : see if msgget exists
15153 set msgget d_msgget
15154 eval $inlibc
15155
15156 : see if msgsnd exists
15157 set msgsnd d_msgsnd
15158 eval $inlibc
15159
15160 : see if msgrcv exists
15161 set msgrcv d_msgrcv
15162 eval $inlibc
15163
15164 : see how much of the 'msg*(2)' library is present.
15165 h_msg=true
15166 echo " "
15167 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15168 *"$undef"*) h_msg=false;;
15169 esac
15170 case "$osname" in
15171 freebsd)
15172     case "`ipcs 2>&1`" in
15173     "SVID messages"*"not configured"*)
15174         echo "Your $osname does not have the msg*(2) configured." >&4
15175         h_msg=false
15176         val="$undef"
15177         set msgctl d_msgctl
15178         eval $setvar
15179         set msgget d_msgget
15180         eval $setvar
15181         set msgsnd d_msgsnd
15182         eval $setvar
15183         set msgrcv d_msgrcv
15184         eval $setvar
15185         ;;
15186     esac
15187     ;;
15188 esac
15189 : we could also check for sys/ipc.h ...
15190 if $h_msg && $test `./findhdr sys/msg.h`; then
15191         echo "You have the full msg*(2) library." >&4
15192         val="$define"
15193 else
15194         echo "You don't have the full msg*(2) library." >&4
15195         val="$undef"
15196 fi
15197 set d_msg
15198 eval $setvar
15199
15200 : Check for msghdr_s
15201 echo " "
15202 echo "Checking to see if your system supports struct msghdr..." >&4
15203 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15204 eval $hasstruct
15205 case "$d_msghdr_s" in
15206 "$define")      echo "Yes, it does."   ;;
15207 *)              echo "No, it doesn't." ;;
15208 esac
15209
15210
15211 : see if msync exists
15212 set msync d_msync
15213 eval $inlibc
15214
15215 : see if munmap exists
15216 set munmap d_munmap
15217 eval $inlibc
15218
15219 : see if nice exists
15220 set nice d_nice
15221 eval $inlibc
15222
15223 : see if this is a langinfo.h system
15224 set langinfo.h i_langinfo
15225 eval $inhdr
15226
15227 : see if nl_langinfo exists
15228 set nl_langinfo d_nl_langinfo
15229 eval $inlibc
15230
15231 : check for volatile keyword
15232 echo " "
15233 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15234 $cat >try.c <<'EOCP'
15235 int main()
15236 {
15237         typedef struct _goo_struct goo_struct;
15238         goo_struct * volatile goo = ((goo_struct *)0);
15239         struct _goo_struct {
15240                 long long_int;
15241                 int reg_int;
15242                 char char_var;
15243         };
15244         typedef unsigned short foo_t;
15245         char *volatile foo;
15246         volatile int bar;
15247         volatile foo_t blech;
15248         foo = foo;
15249 }
15250 EOCP
15251 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15252         val="$define"
15253         echo "Yup, it does."
15254 else
15255         val="$undef"
15256         echo "Nope, it doesn't."
15257 fi
15258 set d_volatile
15259 eval $setvar
15260 $rm_try
15261
15262 : Check basic sizes
15263 echo " "
15264 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15265
15266 case "$use64bitint:$d_quad:$quadtype" in
15267 define:define:?*)
15268         ivtype="$quadtype"
15269         uvtype="$uquadtype"
15270         ivsize=8
15271         uvsize=8
15272         ;;
15273 *)      ivtype="long"
15274         uvtype="unsigned long"
15275         ivsize=$longsize
15276         uvsize=$longsize
15277         ;;
15278 esac
15279
15280 case "$uselongdouble:$d_longdbl" in
15281 define:define)
15282         nvtype="long double"
15283         nvsize=$longdblsize
15284         ;;
15285 *)      nvtype=double
15286         nvsize=$doublesize
15287         ;;
15288 esac
15289
15290 $echo "(IV will be "$ivtype", $ivsize bytes)"
15291 $echo "(UV will be "$uvtype", $uvsize bytes)"
15292 $echo "(NV will be "$nvtype", $nvsize bytes)"
15293
15294 $cat >try.c <<EOCP
15295 #$i_inttypes I_INTTYPES
15296 #ifdef I_INTTYPES
15297 #include <inttypes.h>
15298 #endif
15299 #include <stdio.h>
15300 int main() {
15301 #ifdef INT8
15302    int8_t i =  INT8_MAX;
15303   uint8_t u = UINT8_MAX;
15304   printf("int8_t\n");
15305 #endif
15306 #ifdef INT16
15307    int16_t i =  INT16_MAX;
15308   uint16_t i = UINT16_MAX;
15309   printf("int16_t\n");
15310 #endif
15311 #ifdef INT32
15312    int32_t i =  INT32_MAX;
15313   uint32_t u = UINT32_MAX;
15314   printf("int32_t\n");
15315 #endif
15316 }
15317 EOCP
15318
15319 i8type="signed char"
15320 u8type="unsigned char"
15321 i8size=1
15322 u8size=1
15323
15324 case "$i16type" in
15325 '')     case "$shortsize" in
15326         2)      i16type=short
15327                 u16type="unsigned short"
15328                 i16size=$shortsize
15329                 u16size=$shortsize
15330                 ;;
15331         esac
15332         ;;
15333 esac
15334 case "$i16type" in
15335 '')     set try -DINT16
15336         if eval $compile; then
15337                 case "`$run ./try`" in
15338                 int16_t)
15339                         i16type=int16_t
15340                         u16type=uint16_t
15341                         i16size=2
15342                         u16size=2
15343                         ;;
15344                 esac
15345         fi
15346         ;;
15347 esac
15348 case "$i16type" in
15349 '')     if $test $shortsize -ge 2; then
15350                 i16type=short
15351                 u16type="unsigned short"
15352                 i16size=$shortsize
15353                 u16size=$shortsize
15354         fi
15355         ;;
15356 esac
15357
15358 case "$i32type" in
15359 '')     case "$longsize" in
15360         4)      i32type=long
15361                 u32type="unsigned long"
15362                 i32size=$longsize
15363                 u32size=$longsize
15364                 ;;
15365         *)      case "$intsize" in
15366                 4)      i32type=int
15367                         u32type="unsigned int"
15368                         i32size=$intsize
15369                         u32size=$intsize
15370                         ;;
15371                 esac
15372                 ;;
15373         esac
15374         ;;
15375 esac
15376 case "$i32type" in
15377 '')     set try -DINT32
15378         if eval $compile; then
15379                 case "`$run ./try`" in
15380                 int32_t)
15381                         i32type=int32_t
15382                         u32type=uint32_t
15383                         i32size=4
15384                         u32size=4
15385                         ;;
15386                 esac
15387         fi
15388         ;;
15389 esac
15390 case "$i32type" in
15391 '')     if $test $intsize -ge 4; then
15392                 i32type=int
15393                 u32type="unsigned int"
15394                 i32size=$intsize
15395                 u32size=$intsize
15396         fi
15397         ;;
15398 esac
15399
15400 case "$i64type" in
15401 '')     case "$d_quad:$quadtype" in
15402         define:?*)
15403                 i64type="$quadtype"
15404                 u64type="$uquadtype"
15405                 i64size=8
15406                 u64size=8
15407                 ;;
15408         esac
15409         ;;
15410 esac
15411
15412 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15413 : volatile so that the compiler has to store it out to memory.
15414 if test X"$d_volatile" = X"$define"; then
15415         volatile=volatile
15416 fi
15417 $cat <<EOP >try.c
15418 #include <stdio.h>
15419 #$i_stdlib I_STDLIB
15420 #ifdef I_STDLIB
15421 #include <stdlib.h>
15422 #endif
15423 #include <sys/types.h>
15424 #include <signal.h>
15425 #ifdef SIGFPE
15426 $volatile int bletched = 0;
15427 $signal_t blech(int s) { bletched = 1; }
15428 #endif
15429 int main() {
15430     $uvtype u = 0;
15431     $nvtype d;
15432     int     n = 8 * $uvsize;
15433     int     i;
15434 #ifdef SIGFPE
15435     signal(SIGFPE, blech);
15436 #endif
15437
15438     for (i = 0; i < n; i++) {
15439       u = u << 1 | ($uvtype)1;
15440       d = ($nvtype)u;
15441       if (($uvtype)d != u)
15442         break;
15443       if (d <= 0)
15444         break;
15445       d = ($nvtype)(u - 1);
15446       if (($uvtype)d != (u - 1))
15447         break;
15448 #ifdef SIGFPE
15449       if (bletched)
15450         break;
15451 #endif
15452     }
15453     printf("%d\n", ((i == n) ? -n : i));
15454     exit(0);
15455 }
15456 EOP
15457 set try
15458
15459 d_nv_preserves_uv="$undef"
15460 if eval $compile; then
15461         nv_preserves_uv_bits="`$run ./try`"
15462 fi
15463 case "$nv_preserves_uv_bits" in
15464 \-[1-9]*)
15465         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15466         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15467         d_nv_preserves_uv="$define"
15468         ;;
15469 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15470         d_nv_preserves_uv="$undef" ;;
15471 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15472         nv_preserves_uv_bits="0" ;;
15473 esac
15474 $rm_try
15475
15476 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15477 : volatile so that the compiler has to store it out to memory.
15478 if test X"$d_volatile" = X"$define"; then
15479         volatile=volatile
15480 fi
15481 $cat <<EOP >try.c
15482 #include <stdio.h>
15483 #$i_stdlib I_STDLIB
15484 #ifdef I_STDLIB
15485 #include <stdlib.h>
15486 #endif
15487 #$i_string I_STRING
15488 #ifdef I_STRING
15489 #  include <string.h>
15490 #else
15491 #  include <strings.h>
15492 #endif
15493 #include <sys/types.h>
15494 #include <signal.h>
15495 #ifdef SIGFPE
15496 $volatile int bletched = 0;
15497 $signal_t blech(int s) { bletched = 1; }
15498 #endif
15499
15500 int checkit($nvtype d, char *where) {
15501     unsigned char *p = (char *)&d;
15502     unsigned char *end = p + sizeof(d);
15503     int fail = 0;
15504
15505     while (p < end)
15506         fail += *p++;
15507
15508     if (!fail)
15509         return 0;
15510
15511     p = (char *)&d;
15512     printf("No - %s: 0x", where);
15513     while (p < end)
15514         printf ("%02X", *p++);
15515     printf("\n");
15516     return 1;
15517 }
15518
15519 int main(int argc, char **argv) {
15520     $nvtype d = 0.0;
15521     int fail = 0;
15522     fail += checkit(d, "0.0");
15523
15524     /* The compiler shouldn't be assuming that bletched is 0  */
15525     d = bletched;
15526
15527     fail += checkit(d, "bleched");
15528
15529 #ifdef SIGFPE
15530     signal(SIGFPE, blech);
15531 #endif
15532
15533     /* Paranoia - the compiler should have no way of knowing that ANSI says
15534        that argv[argc] will always be NULL.  Actually, if it did assume this it
15535        would be buggy, as this is C and main() can be called from elsewhere in
15536        the program.  */
15537     d = argv[argc] ? 1 : 0;
15538
15539     if (d) {
15540         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15541     }
15542
15543     fail += checkit(d, "ternary");
15544
15545     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15546
15547     if (d != 0.0) {
15548         printf("No - memset doesn't give 0.0\n");
15549         /* This might just blow up:  */
15550         printf("(gives %g)\n", d);
15551         return 1;
15552     }
15553
15554 #ifdef SIGFPE
15555     if (bletched) {
15556         printf("No - something bleched\n");
15557         return 1;
15558     }
15559 #endif
15560     if (fail) {
15561       printf("No - %d fail(s)\n", fail);
15562       return 1;
15563     }
15564     printf("Yes\n");
15565     return 0;
15566 }
15567 EOP
15568 set try
15569
15570 d_nv_zero_is_allbits_zero="$undef"
15571 if eval $compile; then
15572     xxx="`$run ./try`"
15573     case "$?" in
15574         0)
15575             case "$xxx" in
15576                 Yes)  cat >&4 <<EOM
15577 0.0 is represented as all bits zero in memory
15578 EOM
15579                     d_nv_zero_is_allbits_zero="$define"
15580                     ;;
15581                 *)  cat >&4 <<EOM
15582 0.0 is not represented as all bits zero in memory
15583 EOM
15584                     d_nv_zero_is_allbits_zero="$undef"
15585                     ;;
15586             esac
15587             ;;
15588         *)  cat >&4 <<EOM
15589 0.0 is not represented as all bits zero in memory
15590 EOM
15591             d_nv_zero_is_allbits_zero="$undef"
15592             ;;
15593     esac
15594 fi
15595 $rm_try
15596
15597 : check for off64_t
15598 echo " "
15599 echo "Checking to see if you have off64_t..." >&4
15600 $cat >try.c <<EOCP
15601 #include <sys/types.h>
15602 #include <unistd.h>
15603 int main() { off64_t x = 7; }
15604 EOCP
15605 set try
15606 if eval $compile; then
15607         val="$define"
15608         echo "You have off64_t."
15609 else
15610         val="$undef"
15611         echo "You do not have off64_t."
15612         case "$lseeksize" in
15613         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15614         esac
15615 fi
15616 $rm_try
15617 set d_off64_t
15618 eval $setvar
15619
15620 : how to create joinable pthreads
15621 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15622         echo " "
15623         echo "Checking what constant to use for creating joinable pthreads..." >&4
15624         $cat >try.c <<'EOCP'
15625 #include <pthread.h>
15626 int main() {
15627     int detachstate = JOINABLE;
15628 }
15629 EOCP
15630         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15631         if eval $compile; then
15632                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15633                 val="$undef" # Yes, undef.
15634                 set d_old_pthread_create_joinable
15635                 eval $setvar
15636                 val=""
15637                 set old_pthread_create_joinable
15638                 eval $setvar
15639         else
15640                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15641                 if eval $compile; then
15642                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15643                         val="$define"
15644                         set d_old_pthread_create_joinable
15645                         eval $setvar
15646                         val=PTHREAD_CREATE_UNDETACHED
15647                         set old_pthread_create_joinable
15648                         eval $setvar
15649                 else
15650                         set try -DJOINABLE=__UNDETACHED
15651                         if eval $compile; then
15652                                 echo "You seem to use __UNDETACHED." >&4
15653                                 val="$define"
15654                                 set d_old_pthread_create_joinable
15655                                 eval $setvar
15656                                 val=__UNDETACHED
15657                                 set old_pthread_create_joinable
15658                                 eval $setvar
15659                         else
15660                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15661                                 val="$define"
15662                                 set d_old_pthread_create_joinable
15663                                 eval $setvar
15664                                 val=0
15665                                 set old_pthread_create_joinable
15666                                 eval $setvar
15667                         fi
15668                 fi
15669         fi
15670         $rm_try
15671 else
15672     d_old_pthread_create_joinable="$undef"
15673     old_pthread_create_joinable=""
15674 fi
15675
15676 : see if pause exists
15677 set pause d_pause
15678 eval $inlibc
15679
15680 : see if poll exists
15681 set poll d_poll
15682 eval $inlibc
15683
15684 : see if readlink exists
15685 set readlink d_readlink
15686 eval $inlibc
15687
15688 : Check if exe is symlink to abs path of executing program
15689 echo " "
15690 procselfexe=''
15691 val="$undef"
15692 case "$d_readlink" in
15693 "$define")
15694         if $issymlink /proc/self/exe ; then
15695                 $ls -l /proc/self/exe > reflect
15696                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15697                         echo "You have Linux-like /proc/self/exe."
15698                         procselfexe='"/proc/self/exe"'
15699                         val="$define"
15700                 fi
15701         fi
15702         if $issymlink /proc/curproc/file ; then
15703                 $ls -l /proc/curproc/file > reflect
15704                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15705                         echo "You have BSD-like /proc/curproc/file."
15706                         procselfexe='"/proc/curproc/file"'
15707                         val="$define"
15708                 fi
15709         fi
15710         ;;
15711 esac
15712 $rm -f reflect
15713 set d_procselfexe
15714 eval $setvar
15715
15716 : backward compatibility for d_hvfork
15717 if test X$d_hvfork != X; then
15718         d_vfork="$d_hvfork"
15719         d_hvfork=''
15720 fi
15721 : see if there is a vfork
15722 val=''
15723 set vfork val
15724 eval $inlibc
15725
15726 d_pseudofork=$undef
15727
15728 : Ok, but do we want to use it. vfork is reportedly unreliable in
15729 : perl on Solaris 2.x, and probably elsewhere.
15730 case "$val" in
15731 $define)
15732         echo " "
15733         case "$usevfork" in
15734         false) dflt='n';;
15735         *) dflt='y';;
15736         esac
15737         cat <<'EOM'
15738
15739 Perl can only use a vfork() that doesn't suffer from strict
15740 restrictions on calling functions or modifying global data in
15741 the child.  For example, glibc-2.1 contains such a vfork()
15742 that is unsuitable.  If your system provides a proper fork()
15743 call, chances are that you do NOT want perl to use vfork().
15744
15745 EOM
15746         rp="Do you still want to use vfork()?"
15747         . ./myread
15748         case "$ans" in
15749         y|Y) ;;
15750         *)
15751                 echo "Ok, we won't use vfork()."
15752                 val="$undef"
15753                 ;;
15754         esac
15755         ;;
15756 esac
15757 set d_vfork
15758 eval $setvar
15759 case "$d_vfork" in
15760 $define) usevfork='true';;
15761 *) usevfork='false';;
15762 esac
15763
15764 : see whether the pthread_atfork exists
15765 $cat >try.c <<EOP
15766 #include <pthread.h>
15767 #include <stdio.h>
15768 int main() {
15769 #ifdef  PTHREAD_ATFORK
15770         pthread_atfork(NULL,NULL,NULL);
15771 #endif
15772 }
15773 EOP
15774
15775 : see if pthread_atfork exists
15776 set try -DPTHREAD_ATFORK
15777 if eval $compile; then
15778     val="$define"
15779 else
15780     val="$undef"
15781 fi
15782 case "$usethreads" in
15783 $define)
15784         case "$val" in
15785         $define) echo 'pthread_atfork found.' >&4        ;;
15786         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15787         esac
15788 esac
15789 set d_pthread_atfork
15790 eval $setvar
15791
15792 : see if pthread_attr_setscope exists
15793 set pthread_attr_setscope d_pthread_attr_setscope
15794 eval $inlibc
15795
15796 : see whether the various POSIXish _yields exist
15797 $cat >try.c <<EOP
15798 #include <pthread.h>
15799 #include <stdio.h>
15800 int main() {
15801 #ifdef SCHED_YIELD
15802         sched_yield();
15803 #else
15804 #ifdef PTHREAD_YIELD
15805         pthread_yield();
15806 #else
15807 #ifdef PTHREAD_YIELD_NULL
15808         pthread_yield(NULL);
15809 #endif
15810 #endif
15811 #endif
15812 }
15813 EOP
15814 : see if sched_yield exists
15815 set try -DSCHED_YIELD
15816 if eval $compile; then
15817     val="$define"
15818     sched_yield='sched_yield()'
15819 else
15820     val="$undef"
15821 fi
15822 case "$usethreads" in
15823 $define)
15824         case "$val" in
15825         $define) echo 'sched_yield() found.' >&4        ;;
15826         *)       echo 'sched_yield() NOT found.' >&4    ;;
15827         esac
15828 esac
15829 set d_sched_yield
15830 eval $setvar
15831
15832 : see if pthread_yield exists
15833 set try -DPTHREAD_YIELD
15834 if eval $compile; then
15835     val="$define"
15836     case "$sched_yield" in
15837     '') sched_yield='pthread_yield()' ;;
15838     esac
15839 else
15840     set try -DPTHREAD_YIELD_NULL
15841     if eval $compile; then
15842         val="$define"
15843         case "$sched_yield" in
15844         '') sched_yield='pthread_yield(NULL)' ;;
15845         esac
15846     else
15847         val="$undef"
15848     fi
15849 fi
15850 case "$usethreads" in
15851 $define)
15852         case "$val" in
15853         $define) echo 'pthread_yield() found.' >&4      ;;
15854         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15855         esac
15856         ;;
15857 esac
15858 set d_pthread_yield
15859 eval $setvar
15860 case "$sched_yield" in
15861 '') sched_yield=undef ;;
15862 esac
15863 $rm_try
15864
15865 : see if random_r exists
15866 set random_r d_random_r
15867 eval $inlibc
15868 case "$d_random_r" in
15869 "$define")
15870         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15871         case "$d_random_r_proto:$usethreads" in
15872         ":define")      d_random_r_proto=define
15873                 set d_random_r_proto random_r $hdrs
15874                 eval $hasproto ;;
15875         *)      ;;
15876         esac
15877         case "$d_random_r_proto" in
15878         define)
15879         case "$random_r_proto" in
15880         ''|0) try='int random_r(int*, struct random_data*);'
15881         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15882         esac
15883         case "$random_r_proto" in
15884         ''|0) try='int random_r(long*, struct random_data*);'
15885         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15886         esac
15887         case "$random_r_proto" in
15888         ''|0) try='int random_r(struct random_data*, int32_t*);'
15889         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15890         esac
15891         case "$random_r_proto" in
15892         ''|0)   d_random_r=undef
15893                 random_r_proto=0
15894                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
15895         * )     case "$random_r_proto" in
15896                 REENTRANT_PROTO*) ;;
15897                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15898                 esac
15899                 echo "Prototype: $try" ;;
15900         esac
15901         ;;
15902         *)      case "$usethreads" in
15903                 define) echo "random_r has no prototype, not using it." >&4 ;;
15904                 esac
15905                 d_random_r=undef
15906                 random_r_proto=0
15907                 ;;
15908         esac
15909         ;;
15910 *)      random_r_proto=0
15911         ;;
15912 esac
15913
15914 : see if readdir and friends exist
15915 set readdir d_readdir
15916 eval $inlibc
15917 set seekdir d_seekdir
15918 eval $inlibc
15919 set telldir d_telldir
15920 eval $inlibc
15921 set rewinddir d_rewinddir
15922 eval $inlibc
15923
15924 : see if readdir64_r exists
15925 set readdir64_r d_readdir64_r
15926 eval $inlibc
15927 case "$d_readdir64_r" in
15928 "$define")
15929         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15930         case "$d_readdir64_r_proto:$usethreads" in
15931         ":define")      d_readdir64_r_proto=define
15932                 set d_readdir64_r_proto readdir64_r $hdrs
15933                 eval $hasproto ;;
15934         *)      ;;
15935         esac
15936         case "$d_readdir64_r_proto" in
15937         define)
15938         case "$readdir64_r_proto" in
15939         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15940         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15941         esac
15942         case "$readdir64_r_proto" in
15943         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15944         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15945         esac
15946         case "$readdir64_r_proto" in
15947         ''|0)   d_readdir64_r=undef
15948                 readdir64_r_proto=0
15949                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
15950         * )     case "$readdir64_r_proto" in
15951                 REENTRANT_PROTO*) ;;
15952                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15953                 esac
15954                 echo "Prototype: $try" ;;
15955         esac
15956         ;;
15957         *)      case "$usethreads" in
15958                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15959                 esac
15960                 d_readdir64_r=undef
15961                 readdir64_r_proto=0
15962                 ;;
15963         esac
15964         ;;
15965 *)      readdir64_r_proto=0
15966         ;;
15967 esac
15968
15969 : see if readdir_r exists
15970 set readdir_r d_readdir_r
15971 eval $inlibc
15972 case "$d_readdir_r" in
15973 "$define")
15974         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15975         case "$d_readdir_r_proto:$usethreads" in
15976         ":define")      d_readdir_r_proto=define
15977                 set d_readdir_r_proto readdir_r $hdrs
15978                 eval $hasproto ;;
15979         *)      ;;
15980         esac
15981         case "$d_readdir_r_proto" in
15982         define)
15983         case "$readdir_r_proto" in
15984         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15985         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15986         esac
15987         case "$readdir_r_proto" in
15988         ''|0) try='int readdir_r(DIR*, struct dirent*);'
15989         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15990         esac
15991         case "$readdir_r_proto" in
15992         ''|0)   d_readdir_r=undef
15993                 readdir_r_proto=0
15994                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
15995         * )     case "$readdir_r_proto" in
15996                 REENTRANT_PROTO*) ;;
15997                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15998                 esac
15999                 echo "Prototype: $try" ;;
16000         esac
16001         ;;
16002         *)      case "$usethreads" in
16003                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16004                 esac
16005                 d_readdir_r=undef
16006                 readdir_r_proto=0
16007                 ;;
16008         esac
16009         ;;
16010 *)      readdir_r_proto=0
16011         ;;
16012 esac
16013
16014 : see if readv exists
16015 set readv d_readv
16016 eval $inlibc
16017
16018 : see if recvmsg exists
16019 set recvmsg d_recvmsg
16020 eval $inlibc
16021
16022 : see if rename exists
16023 set rename d_rename
16024 eval $inlibc
16025
16026 : see if rmdir exists
16027 set rmdir d_rmdir
16028 eval $inlibc
16029
16030 : see if memory.h is available.
16031 val=''
16032 set memory.h val
16033 eval $inhdr
16034
16035 : See if it conflicts with string.h
16036 case "$val" in
16037 $define)
16038         case "$strings" in
16039         '') ;;
16040         *)
16041                 $cppstdin $cppflags $cppminus < $strings > mem.h
16042                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16043                         echo " "
16044                         echo "We won't be including <memory.h>."
16045                         val="$undef"
16046                 fi
16047                 $rm -f mem.h
16048                 ;;
16049         esac
16050 esac
16051 set i_memory
16052 eval $setvar
16053
16054 : can bcopy handle overlapping blocks?
16055 echo " "
16056 val="$undef"
16057 case "$d_memmove" in
16058 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16059 *)      case "$d_bcopy" in
16060         "$define")
16061                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16062                 $cat >try.c <<EOCP
16063 #$i_memory I_MEMORY
16064 #$i_stdlib I_STDLIB
16065 #$i_string I_STRING
16066 #$i_unistd I_UNISTD
16067 EOCP
16068         $cat >>try.c <<'EOCP'
16069 #include <stdio.h>
16070 #ifdef I_MEMORY
16071 #  include <memory.h>
16072 #endif
16073 #ifdef I_STDLIB
16074 #  include <stdlib.h>
16075 #endif
16076 #ifdef I_STRING
16077 #  include <string.h>
16078 #else
16079 #  include <strings.h>
16080 #endif
16081 #ifdef I_UNISTD
16082 #  include <unistd.h>  /* Needed for NetBSD */
16083 #endif
16084 int main()
16085 {
16086 char buf[128], abc[128];
16087 char *b;
16088 int len;
16089 int off;
16090 int align;
16091
16092 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16093    try to store the string in read-only memory. */
16094 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16095
16096 for (align = 7; align >= 0; align--) {
16097         for (len = 36; len; len--) {
16098                 b = buf+align;
16099                 bcopy(abc, b, len);
16100                 for (off = 1; off <= len; off++) {
16101                         bcopy(b, b+off, len);
16102                         bcopy(b+off, b, len);
16103                         if (bcmp(b, abc, len))
16104                                 exit(1);
16105                 }
16106         }
16107 }
16108 exit(0);
16109 }
16110 EOCP
16111                 set try
16112                 if eval $compile_ok; then
16113                         if $run ./try 2>/dev/null; then
16114                                 echo "Yes, it can."
16115                                 val="$define"
16116                         else
16117                                 echo "It can't, sorry."
16118                         fi
16119                 else
16120                         echo "(I can't compile the test program, so we'll assume not...)"
16121                 fi
16122                 ;;
16123         esac
16124         $rm_try
16125         ;;
16126 esac
16127 set d_safebcpy
16128 eval $setvar
16129
16130 : can memcpy handle overlapping blocks?
16131 echo " "
16132 val="$undef"
16133 case "$d_memmove" in
16134 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16135 *)      case "$d_memcpy" in
16136         "$define")
16137                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16138                 $cat >try.c <<EOCP
16139 #$i_memory I_MEMORY
16140 #$i_stdlib I_STDLIB
16141 #$i_string I_STRING
16142 #$i_unistd I_UNISTD
16143 EOCP
16144         $cat >>try.c <<'EOCP'
16145 #include <stdio.h>
16146 #ifdef I_MEMORY
16147 #  include <memory.h>
16148 #endif
16149 #ifdef I_STDLIB
16150 #  include <stdlib.h>
16151 #endif
16152 #ifdef I_STRING
16153 #  include <string.h>
16154 #else
16155 #  include <strings.h>
16156 #endif
16157 #ifdef I_UNISTD
16158 #  include <unistd.h>  /* Needed for NetBSD */
16159 #endif
16160 int main()
16161 {
16162 char buf[128], abc[128];
16163 char *b;
16164 int len;
16165 int off;
16166 int align;
16167
16168 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16169    try to store the string in read-only memory. */
16170 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16171
16172 for (align = 7; align >= 0; align--) {
16173         for (len = 36; len; len--) {
16174                 b = buf+align;
16175                 memcpy(b, abc, len);
16176                 for (off = 1; off <= len; off++) {
16177                         memcpy(b+off, b, len);
16178                         memcpy(b, b+off, len);
16179                         if (memcmp(b, abc, len))
16180                                 exit(1);
16181                 }
16182         }
16183 }
16184 exit(0);
16185 }
16186 EOCP
16187                 set try
16188                 if eval $compile_ok; then
16189                         if $run ./try 2>/dev/null; then
16190                                 echo "Yes, it can."
16191                                 val="$define"
16192                         else
16193                                 echo "It can't, sorry."
16194                         fi
16195                 else
16196                         echo "(I can't compile the test program, so we'll assume not...)"
16197                 fi
16198                 ;;
16199         esac
16200         $rm_try
16201         ;;
16202 esac
16203 set d_safemcpy
16204 eval $setvar
16205
16206 : can memcmp be trusted to compare relative magnitude?
16207 val="$undef"
16208 case "$d_memcmp" in
16209 "$define")
16210         echo " "
16211         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16212         $cat >try.c <<EOCP
16213 #$i_memory I_MEMORY
16214 #$i_stdlib I_STDLIB
16215 #$i_string I_STRING
16216 #$i_unistd I_UNISTD
16217 EOCP
16218         $cat >>try.c <<'EOCP'
16219 #include <stdio.h>
16220 #ifdef I_MEMORY
16221 #  include <memory.h>
16222 #endif
16223 #ifdef I_STDLIB
16224 #  include <stdlib.h>
16225 #endif
16226 #ifdef I_STRING
16227 #  include <string.h>
16228 #else
16229 #  include <strings.h>
16230 #endif
16231 #ifdef I_UNISTD
16232 #  include <unistd.h>  /* Needed for NetBSD */
16233 #endif
16234 int main()
16235 {
16236 char a = -1;
16237 char b = 0;
16238 if ((a < b) && memcmp(&a, &b, 1) < 0)
16239         exit(1);
16240 exit(0);
16241 }
16242 EOCP
16243         set try
16244         if eval $compile_ok; then
16245                 if $run ./try 2>/dev/null; then
16246                         echo "Yes, it can."
16247                         val="$define"
16248                 else
16249                         echo "No, it can't (it uses signed chars)."
16250                 fi
16251         else
16252                 echo "(I can't compile the test program, so we'll assume not...)"
16253         fi
16254         ;;
16255 esac
16256 $rm_try
16257 set d_sanemcmp
16258 eval $setvar
16259
16260 : see if prototype for sbrk is available
16261 echo " "
16262 set d_sbrkproto sbrk $i_unistd unistd.h
16263 eval $hasproto
16264
16265 : see if select exists
16266 set select d_select
16267 eval $inlibc
16268
16269 : see if semctl exists
16270 set semctl d_semctl
16271 eval $inlibc
16272
16273 : see if semget exists
16274 set semget d_semget
16275 eval $inlibc
16276
16277 : see if semop exists
16278 set semop d_semop
16279 eval $inlibc
16280
16281 : see how much of the 'sem*(2)' library is present.
16282 h_sem=true
16283 echo " "
16284 case "$d_semctl$d_semget$d_semop" in
16285 *"$undef"*) h_sem=false;;
16286 esac
16287 case "$osname" in
16288 freebsd)
16289     case "`ipcs 2>&1`" in
16290     "SVID messages"*"not configured"*)
16291         echo "Your $osname does not have the sem*(2) configured." >&4
16292         h_sem=false
16293         val="$undef"
16294         set semctl d_semctl
16295         eval $setvar
16296         set semget d_semget
16297         eval $setvar
16298         set semop d_semop
16299         eval $setvar
16300         ;;
16301     esac
16302     ;;
16303 esac
16304 : we could also check for sys/ipc.h ...
16305 if $h_sem && $test `./findhdr sys/sem.h`; then
16306         echo "You have the full sem*(2) library." >&4
16307         val="$define"
16308 else
16309         echo "You don't have the full sem*(2) library." >&4
16310         val="$undef"
16311 fi
16312 set d_sem
16313 eval $setvar
16314
16315 : see whether sys/sem.h defines union semun
16316 echo " "
16317 $cat > try.c <<'END'
16318 #include <sys/types.h>
16319 #include <sys/ipc.h>
16320 #include <sys/sem.h>
16321 int main () { union semun semun; semun.buf = 0; }
16322 END
16323 set try
16324 if eval $compile; then
16325     echo "You have union semun in <sys/sem.h>." >&4
16326     val="$define"
16327 else
16328     echo "You do not have union semun in <sys/sem.h>." >&4
16329     val="$undef"
16330 fi
16331 $rm_try
16332 set d_union_semun
16333 eval $setvar
16334
16335 : see how to do semctl IPC_STAT
16336 case "$d_sem" in
16337 $define)
16338     echo " "
16339     $cat > tryh.h <<END
16340 #ifndef S_IRUSR
16341 #   ifdef S_IREAD
16342 #       define S_IRUSR S_IREAD
16343 #       define S_IWUSR S_IWRITE
16344 #       define S_IXUSR S_IEXEC
16345 #   else
16346 #       define S_IRUSR 0400
16347 #       define S_IWUSR 0200
16348 #       define S_IXUSR 0100
16349 #   endif
16350 #   define S_IRGRP (S_IRUSR>>3)
16351 #   define S_IWGRP (S_IWUSR>>3)
16352 #   define S_IXGRP (S_IXUSR>>3)
16353 #   define S_IROTH (S_IRUSR>>6)
16354 #   define S_IWOTH (S_IWUSR>>6)
16355 #   define S_IXOTH (S_IXUSR>>6)
16356 #endif
16357 #ifndef S_IRWXU
16358 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16359 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16360 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16361 #endif
16362 END
16363     : see whether semctl IPC_STAT can use union semun
16364     case "$d_semctl_semun" in
16365     '')
16366       val="$undef"
16367       $cat > try.c <<END
16368 #include <sys/types.h>
16369 #include <sys/ipc.h>
16370 #include <sys/sem.h>
16371 #include <sys/stat.h>
16372 #include <stdio.h>
16373 #include <errno.h>
16374 #include "tryh.h"
16375 #ifndef errno
16376 extern int errno;
16377 #endif
16378 #$d_union_semun HAS_UNION_SEMUN
16379 int main() {
16380     union semun
16381 #ifndef HAS_UNION_SEMUN
16382     {
16383         int val;
16384         struct semid_ds *buf;
16385         unsigned short *array;
16386     }
16387 #endif
16388     arg;
16389     int sem, st;
16390
16391 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16392     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16393     if (sem > -1) {
16394         struct semid_ds argbuf;
16395         arg.buf = &argbuf;
16396 #       ifdef IPC_STAT
16397         st = semctl(sem, 0, IPC_STAT, arg);
16398         if (st == 0)
16399             printf("semun\n");
16400         else
16401 #       endif /* IPC_STAT */
16402             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16403 #       ifdef IPC_RMID
16404         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16405 #       endif /* IPC_RMID */
16406             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16407     } else
16408 #endif /* IPC_PRIVATE && ... */
16409         printf("semget failed: errno = %d\n", errno);
16410   return 0;
16411 }
16412 END
16413       set try
16414       if eval $compile; then
16415           xxx=`$run ./try`
16416           case "$xxx" in
16417           semun) val="$define" ;;
16418           esac
16419       fi
16420       $rm_try
16421       set d_semctl_semun
16422       eval $setvar
16423       ;;
16424     esac
16425     case "$d_semctl_semun" in
16426     $define)
16427         echo "You can use union semun for semctl IPC_STAT." >&4
16428         also='also'
16429         ;;
16430     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16431         also=''
16432         ;;
16433     esac
16434
16435     : see whether semctl IPC_STAT can use struct semid_ds pointer
16436     case "$d_semctl_semid_ds" in
16437     '')
16438       val="$undef"
16439       $cat > try.c <<'END'
16440 #include <sys/types.h>
16441 #include <sys/ipc.h>
16442 #include <sys/sem.h>
16443 #include <sys/stat.h>
16444 #include "tryh.h"
16445 #include <stdio.h>
16446 #include <errno.h>
16447 #ifndef errno
16448 extern int errno;
16449 #endif
16450 int main() {
16451     struct semid_ds arg;
16452     int sem, st;
16453
16454 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16455     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16456     if (sem > -1) {
16457 #       ifdef IPC_STAT
16458         st = semctl(sem, 0, IPC_STAT, &arg);
16459         if (st == 0)
16460             printf("semid_ds\n");
16461         else
16462 #       endif /* IPC_STAT */
16463             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16464 #       ifdef IPC_RMID
16465         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16466 #       endif /* IPC_RMID */
16467             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16468     } else
16469 #endif /* IPC_PRIVATE && ... */
16470         printf("semget failed: errno = %d\n", errno);
16471
16472     return 0;
16473 }
16474 END
16475       set try
16476       if eval $compile; then
16477           xxx=`$run ./try`
16478           case "$xxx" in
16479           semid_ds) val="$define" ;;
16480           esac
16481       fi
16482       $rm_try
16483       set d_semctl_semid_ds
16484       eval $setvar
16485       ;;
16486     esac
16487     case "$d_semctl_semid_ds" in
16488     $define)
16489         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16490         ;;
16491     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16492         ;;
16493     esac
16494     ;;
16495 *)  val="$undef"
16496
16497     # We do not have the full sem*(2) library, so assume we can not
16498     # use either.
16499
16500     set d_semctl_semun
16501     eval $setvar
16502
16503     set d_semctl_semid_ds
16504     eval $setvar
16505     ;;
16506 esac
16507 $rm_try tryh.h
16508
16509 : see if sendmsg exists
16510 set sendmsg d_sendmsg
16511 eval $inlibc
16512
16513 : see if setegid exists
16514 set setegid d_setegid
16515 eval $inlibc
16516
16517 : see if seteuid exists
16518 set seteuid d_seteuid
16519 eval $inlibc
16520
16521 : see if setgrent exists
16522 set setgrent d_setgrent
16523 eval $inlibc
16524
16525 : see if setgrent_r exists
16526 set setgrent_r d_setgrent_r
16527 eval $inlibc
16528 case "$d_setgrent_r" in
16529 "$define")
16530         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16531         case "$d_setgrent_r_proto:$usethreads" in
16532         ":define")      d_setgrent_r_proto=define
16533                 set d_setgrent_r_proto setgrent_r $hdrs
16534                 eval $hasproto ;;
16535         *)      ;;
16536         esac
16537         case "$d_setgrent_r_proto" in
16538         define)
16539         case "$setgrent_r_proto" in
16540         ''|0) try='int setgrent_r(FILE**);'
16541         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
16542         esac
16543         case "$setgrent_r_proto" in
16544         ''|0) try='void setgrent_r(FILE**);'
16545         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
16546         esac
16547         case "$setgrent_r_proto" in
16548         ''|0)   d_setgrent_r=undef
16549                 setgrent_r_proto=0
16550                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16551         * )     case "$setgrent_r_proto" in
16552                 REENTRANT_PROTO*) ;;
16553                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16554                 esac
16555                 echo "Prototype: $try" ;;
16556         esac
16557         ;;
16558         *)      case "$usethreads" in
16559                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16560                 esac
16561                 d_setgrent_r=undef
16562                 setgrent_r_proto=0
16563                 ;;
16564         esac
16565         ;;
16566 *)      setgrent_r_proto=0
16567         ;;
16568 esac
16569
16570 : see if sethostent exists
16571 set sethostent d_sethent
16572 eval $inlibc
16573
16574 : see if sethostent_r exists
16575 set sethostent_r d_sethostent_r
16576 eval $inlibc
16577 case "$d_sethostent_r" in
16578 "$define")
16579         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16580         case "$d_sethostent_r_proto:$usethreads" in
16581         ":define")      d_sethostent_r_proto=define
16582                 set d_sethostent_r_proto sethostent_r $hdrs
16583                 eval $hasproto ;;
16584         *)      ;;
16585         esac
16586         case "$d_sethostent_r_proto" in
16587         define)
16588         case "$sethostent_r_proto" in
16589         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16590         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16591         esac
16592         case "$sethostent_r_proto" in
16593         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16594         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16595         esac
16596         case "$sethostent_r_proto" in
16597         ''|0)   d_sethostent_r=undef
16598                 sethostent_r_proto=0
16599                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16600         * )     case "$sethostent_r_proto" in
16601                 REENTRANT_PROTO*) ;;
16602                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16603                 esac
16604                 echo "Prototype: $try" ;;
16605         esac
16606         ;;
16607         *)      case "$usethreads" in
16608                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16609                 esac
16610                 d_sethostent_r=undef
16611                 sethostent_r_proto=0
16612                 ;;
16613         esac
16614         ;;
16615 *)      sethostent_r_proto=0
16616         ;;
16617 esac
16618
16619 : see if setitimer exists
16620 set setitimer d_setitimer
16621 eval $inlibc
16622
16623 : see if setlinebuf exists
16624 set setlinebuf d_setlinebuf
16625 eval $inlibc
16626
16627 : see if setlocale exists
16628 set setlocale d_setlocale
16629 eval $inlibc
16630
16631 : see if locale.h is available
16632 set locale.h i_locale
16633 eval $inhdr
16634
16635 : see if setlocale_r exists
16636 set setlocale_r d_setlocale_r
16637 eval $inlibc
16638 case "$d_setlocale_r" in
16639 "$define")
16640         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16641         case "$d_setlocale_r_proto:$usethreads" in
16642         ":define")      d_setlocale_r_proto=define
16643                 set d_setlocale_r_proto setlocale_r $hdrs
16644                 eval $hasproto ;;
16645         *)      ;;
16646         esac
16647         case "$d_setlocale_r_proto" in
16648         define)
16649         case "$setlocale_r_proto" in
16650         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16651         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16652         esac
16653         case "$setlocale_r_proto" in
16654         ''|0)   d_setlocale_r=undef
16655                 setlocale_r_proto=0
16656                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16657         * )     case "$setlocale_r_proto" in
16658                 REENTRANT_PROTO*) ;;
16659                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16660                 esac
16661                 echo "Prototype: $try" ;;
16662         esac
16663         ;;
16664         *)      case "$usethreads" in
16665                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16666                 esac
16667                 d_setlocale_r=undef
16668                 setlocale_r_proto=0
16669                 ;;
16670         esac
16671         ;;
16672 *)      setlocale_r_proto=0
16673         ;;
16674 esac
16675
16676 : see if setnetent exists
16677 set setnetent d_setnent
16678 eval $inlibc
16679
16680 : see if setnetent_r exists
16681 set setnetent_r d_setnetent_r
16682 eval $inlibc
16683 case "$d_setnetent_r" in
16684 "$define")
16685         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16686         case "$d_setnetent_r_proto:$usethreads" in
16687         ":define")      d_setnetent_r_proto=define
16688                 set d_setnetent_r_proto setnetent_r $hdrs
16689                 eval $hasproto ;;
16690         *)      ;;
16691         esac
16692         case "$d_setnetent_r_proto" in
16693         define)
16694         case "$setnetent_r_proto" in
16695         ''|0) try='int setnetent_r(int, struct netent_data*);'
16696         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16697         esac
16698         case "$setnetent_r_proto" in
16699         ''|0) try='void setnetent_r(int, struct netent_data*);'
16700         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16701         esac
16702         case "$setnetent_r_proto" in
16703         ''|0)   d_setnetent_r=undef
16704                 setnetent_r_proto=0
16705                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16706         * )     case "$setnetent_r_proto" in
16707                 REENTRANT_PROTO*) ;;
16708                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16709                 esac
16710                 echo "Prototype: $try" ;;
16711         esac
16712         ;;
16713         *)      case "$usethreads" in
16714                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16715                 esac
16716                 d_setnetent_r=undef
16717                 setnetent_r_proto=0
16718                 ;;
16719         esac
16720         ;;
16721 *)      setnetent_r_proto=0
16722         ;;
16723 esac
16724
16725 : see if setprotoent exists
16726 set setprotoent d_setpent
16727 eval $inlibc
16728
16729 : see if setpgid exists
16730 set setpgid d_setpgid
16731 eval $inlibc
16732
16733 : see if setpgrp2 exists
16734 set setpgrp2 d_setpgrp2
16735 eval $inlibc
16736
16737 : see if setpriority exists
16738 set setpriority d_setprior
16739 eval $inlibc
16740
16741 : see if setproctitle exists
16742 set setproctitle d_setproctitle
16743 eval $inlibc
16744
16745 : see if setprotoent_r exists
16746 set setprotoent_r d_setprotoent_r
16747 eval $inlibc
16748 case "$d_setprotoent_r" in
16749 "$define")
16750         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16751         case "$d_setprotoent_r_proto:$usethreads" in
16752         ":define")      d_setprotoent_r_proto=define
16753                 set d_setprotoent_r_proto setprotoent_r $hdrs
16754                 eval $hasproto ;;
16755         *)      ;;
16756         esac
16757         case "$d_setprotoent_r_proto" in
16758         define)
16759         case "$setprotoent_r_proto" in
16760         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16761         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16762         esac
16763         case "$setprotoent_r_proto" in
16764         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16765         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16766         esac
16767         case "$setprotoent_r_proto" in
16768         ''|0)   d_setprotoent_r=undef
16769                 setprotoent_r_proto=0
16770                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16771         * )     case "$setprotoent_r_proto" in
16772                 REENTRANT_PROTO*) ;;
16773                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16774                 esac
16775                 echo "Prototype: $try" ;;
16776         esac
16777         ;;
16778         *)      case "$usethreads" in
16779                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16780                 esac
16781                 d_setprotoent_r=undef
16782                 setprotoent_r_proto=0
16783                 ;;
16784         esac
16785         ;;
16786 *)      setprotoent_r_proto=0
16787         ;;
16788 esac
16789
16790 : see if setpwent exists
16791 set setpwent d_setpwent
16792 eval $inlibc
16793
16794 : see if setpwent_r exists
16795 set setpwent_r d_setpwent_r
16796 eval $inlibc
16797 case "$d_setpwent_r" in
16798 "$define")
16799         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16800         case "$d_setpwent_r_proto:$usethreads" in
16801         ":define")      d_setpwent_r_proto=define
16802                 set d_setpwent_r_proto setpwent_r $hdrs
16803                 eval $hasproto ;;
16804         *)      ;;
16805         esac
16806         case "$d_setpwent_r_proto" in
16807         define)
16808         case "$setpwent_r_proto" in
16809         ''|0) try='int setpwent_r(FILE**);'
16810         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16811         esac
16812         case "$setpwent_r_proto" in
16813         ''|0) try='void setpwent_r(FILE**);'
16814         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16815         esac
16816         case "$setpwent_r_proto" in
16817         ''|0)   d_setpwent_r=undef
16818                 setpwent_r_proto=0
16819                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16820         * )     case "$setpwent_r_proto" in
16821                 REENTRANT_PROTO*) ;;
16822                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16823                 esac
16824                 echo "Prototype: $try" ;;
16825         esac
16826         ;;
16827         *)      case "$usethreads" in
16828                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16829                 esac
16830                 d_setpwent_r=undef
16831                 setpwent_r_proto=0
16832                 ;;
16833         esac
16834         ;;
16835 *)      setpwent_r_proto=0
16836         ;;
16837 esac
16838
16839 : see if setregid exists
16840 set setregid d_setregid
16841 eval $inlibc
16842 set setresgid d_setresgid
16843 eval $inlibc
16844
16845 : see if setreuid exists
16846 set setreuid d_setreuid
16847 eval $inlibc
16848 set setresuid d_setresuid
16849 eval $inlibc
16850
16851 : see if setrgid exists
16852 set setrgid d_setrgid
16853 eval $inlibc
16854
16855 : see if setruid exists
16856 set setruid d_setruid
16857 eval $inlibc
16858
16859 : see if setservent exists
16860 set setservent d_setsent
16861 eval $inlibc
16862
16863 : see if setservent_r exists
16864 set setservent_r d_setservent_r
16865 eval $inlibc
16866 case "$d_setservent_r" in
16867 "$define")
16868         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16869         case "$d_setservent_r_proto:$usethreads" in
16870         ":define")      d_setservent_r_proto=define
16871                 set d_setservent_r_proto setservent_r $hdrs
16872                 eval $hasproto ;;
16873         *)      ;;
16874         esac
16875         case "$d_setservent_r_proto" in
16876         define)
16877         case "$setservent_r_proto" in
16878         ''|0) try='int setservent_r(int, struct servent_data*);'
16879         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16880         esac
16881         case "$setservent_r_proto" in
16882         ''|0) try='void setservent_r(int, struct servent_data*);'
16883         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16884         esac
16885         case "$setservent_r_proto" in
16886         ''|0)   d_setservent_r=undef
16887                 setservent_r_proto=0
16888                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16889         * )     case "$setservent_r_proto" in
16890                 REENTRANT_PROTO*) ;;
16891                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16892                 esac
16893                 echo "Prototype: $try" ;;
16894         esac
16895         ;;
16896         *)      case "$usethreads" in
16897                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16898                 esac
16899                 d_setservent_r=undef
16900                 setservent_r_proto=0
16901                 ;;
16902         esac
16903         ;;
16904 *)      setservent_r_proto=0
16905         ;;
16906 esac
16907
16908 : see if setsid exists
16909 set setsid d_setsid
16910 eval $inlibc
16911
16912 : see if setvbuf exists
16913 set setvbuf d_setvbuf
16914 eval $inlibc
16915
16916 : see if sfio.h is available
16917 set sfio.h i_sfio
16918 eval $inhdr
16919
16920 : see if sfio library is available
16921 case "$i_sfio" in
16922 $define)
16923         val=''
16924         set sfreserve val
16925         eval $inlibc
16926         ;;
16927 *)
16928         val="$undef"
16929         ;;
16930 esac
16931 : Ok, but do we want to use it.
16932 case "$val" in
16933 $define)
16934         case "$usesfio" in
16935         true|$define|[yY]*) dflt='y';;
16936         *) dflt='n';;
16937         esac
16938         echo "$package can use the sfio library, but it is experimental."
16939         case "$useperlio" in
16940         "$undef")
16941             echo "For sfio also the PerlIO abstraction layer is needed."
16942             echo "Earlier you said you wouldn't want that."
16943             ;;
16944         esac
16945         rp="You seem to have sfio available, do you want to try using it?"
16946         . ./myread
16947         case "$ans" in
16948         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
16949                 useperlio="$define"
16950                 val="$define"
16951                 ;;
16952         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
16953                 val="$undef"
16954                 ;;
16955         esac
16956         ;;
16957 *)      case "$usesfio" in
16958         true|$define|[yY]*)
16959                 echo "Sorry, cannot find sfio on this machine." >&4
16960                 echo "Ignoring your setting of usesfio=$usesfio." >&4
16961                 val="$undef"
16962                 ;;
16963         esac
16964         ;;
16965 esac
16966 set d_sfio
16967 eval $setvar
16968 case "$d_sfio" in
16969 $define) usesfio='true';;
16970 *) usesfio='false';;
16971 esac
16972 case "$d_sfio" in
16973 $define) ;;
16974 *)      : Remove sfio from list of libraries to use
16975         case "$libs" in
16976         *-lsfio*)
16977                 echo "Removing unneeded -lsfio from library list" >&4
16978                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16979                 shift
16980                 libs="$*"
16981                 echo "libs = $libs" >&4
16982                 ;;
16983         esac
16984 ;;
16985 esac
16986
16987
16988 : see if shmctl exists
16989 set shmctl d_shmctl
16990 eval $inlibc
16991
16992 : see if shmget exists
16993 set shmget d_shmget
16994 eval $inlibc
16995
16996 : see if shmat exists
16997 set shmat d_shmat
16998 eval $inlibc
16999 : see what shmat returns
17000 case "$d_shmat" in
17001 "$define")
17002         $cat >shmat.c <<'END'
17003 #include <sys/shm.h>
17004 void *shmat();
17005 END
17006         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17007                 shmattype='void *'
17008         else
17009                 shmattype='char *'
17010         fi
17011         echo "and it returns ($shmattype)." >&4
17012         : see if a prototype for shmat is available
17013         xxx=`./findhdr sys/shm.h`
17014         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17015         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17016                 val="$define"
17017         else
17018                 val="$undef"
17019         fi
17020         $rm -f shmat.[co]
17021         ;;
17022 *)
17023         val="$undef"
17024         ;;
17025 esac
17026 set d_shmatprototype
17027 eval $setvar
17028
17029 : see if shmdt exists
17030 set shmdt d_shmdt
17031 eval $inlibc
17032
17033 : see how much of the 'shm*(2)' library is present.
17034 h_shm=true
17035 echo " "
17036 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17037 *"$undef"*) h_shm=false;;
17038 esac
17039 case "$osname" in
17040 freebsd)
17041     case "`ipcs 2>&1`" in
17042     "SVID shared memory"*"not configured"*)
17043         echo "Your $osname does not have the shm*(2) configured." >&4
17044         h_shm=false
17045         val="$undef"
17046         set shmctl d_shmctl
17047         evat $setvar
17048         set shmget d_shmget
17049         evat $setvar
17050         set shmat d_shmat
17051         evat $setvar
17052         set shmdt d_shmdt
17053         evat $setvar
17054         ;;
17055     esac
17056     ;;
17057 esac
17058 : we could also check for sys/ipc.h ...
17059 if $h_shm && $test `./findhdr sys/shm.h`; then
17060         echo "You have the full shm*(2) library." >&4
17061         val="$define"
17062 else
17063         echo "You don't have the full shm*(2) library." >&4
17064         val="$undef"
17065 fi
17066 set d_shm
17067 eval $setvar
17068
17069 : see if we have sigaction
17070 echo " "
17071 if set sigaction val -f d_sigaction; eval $csym; $val; then
17072         echo 'sigaction() found.' >&4
17073         $cat > try.c <<EOP
17074 #include <stdio.h>
17075 #include <sys/types.h>
17076 #include <signal.h>
17077 #$i_stdlib I_STDLIB
17078 #ifdef I_STDLIB
17079 #include <stdlib.h>
17080 #endif
17081 int main()
17082 {
17083     struct sigaction act, oact;
17084     act.sa_flags = 0;
17085     oact.sa_handler = 0;
17086     /* so that act and oact are used */
17087     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17088 }
17089 EOP
17090         set try
17091         if eval $compile_ok; then
17092                 val="$define"
17093         else
17094                 echo "But you don't seem to have a useable struct sigaction." >&4
17095                 val="$undef"
17096         fi
17097 else
17098         echo 'sigaction NOT found.' >&4
17099         val="$undef"
17100 fi
17101 set d_sigaction; eval $setvar
17102 $rm_try
17103
17104 : see if this is a sunmath.h system
17105 set sunmath.h i_sunmath
17106 eval $inhdr
17107
17108 : see if signbit exists
17109 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17110 $cat >try.c <<EOCP
17111 #$i_math I_MATH
17112 #$i_sunmath I_SUNMATH
17113 #ifdef I_MATH
17114 #  include <math.h>
17115 #endif
17116 #ifdef I_SUNMATH  /* Solaris special math library */
17117 #  include <sunmath.h>
17118 #endif
17119 #define NV $nvtype
17120 int main(int argc, char **argv)
17121 {
17122     NV x = 0.0;
17123     NV y = -0.0;
17124     if ((signbit(x) == 0) && (signbit(y) != 0))
17125         return 0;
17126     else
17127         return 1;
17128 }
17129 EOCP
17130 val="$undef"
17131 set try
17132 if eval $compile; then
17133     if $run ./try; then
17134         $echo "Yes." >&4
17135         val="$define"
17136     else
17137         $echo "Signbit seems to be available, but doesn't work as I expected."
17138         $echo "I won't use it." >&4
17139         val="$undef"
17140     fi
17141 else
17142     $echo "Nope." >&4
17143     dflt="$undef"
17144 fi
17145 set d_signbit
17146 eval $setvar
17147 $rm_try
17148
17149 : see if sigprocmask exists
17150 set sigprocmask d_sigprocmask
17151 eval $inlibc
17152
17153 : see if sigsetjmp exists
17154 echo " "
17155 case "$d_sigsetjmp" in
17156 '')
17157         $cat >try.c <<EOP
17158 #include <setjmp.h>
17159 #$i_stdlib I_STDLIB
17160 #ifdef I_STDLIB
17161 #include <stdlib.h>
17162 #endif
17163 sigjmp_buf env;
17164 int set = 1;
17165 int main()
17166 {
17167         if (sigsetjmp(env,1))
17168                 exit(set);
17169         set = 0;
17170         siglongjmp(env, 1);
17171         exit(1);
17172 }
17173 EOP
17174         set try
17175         if eval $compile; then
17176                 if $run ./try >/dev/null 2>&1; then
17177                         echo "POSIX sigsetjmp found." >&4
17178                         val="$define"
17179                 else
17180                         $cat >&4 <<EOM
17181 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17182 I'll ignore them.
17183 EOM
17184                         val="$undef"
17185                 fi
17186         else
17187                 echo "sigsetjmp not found." >&4
17188                 val="$undef"
17189         fi
17190         ;;
17191 *) val="$d_sigsetjmp"
17192         case "$d_sigsetjmp" in
17193         $define) echo "POSIX sigsetjmp found." >&4;;
17194         $undef) echo "sigsetjmp not found." >&4;;
17195         esac
17196         ;;
17197 esac
17198 set d_sigsetjmp
17199 eval $setvar
17200 $rm_try
17201
17202 : see if snprintf exists
17203 set snprintf d_snprintf
17204 eval $inlibc
17205
17206 : see if vsnprintf exists
17207 set vsnprintf d_vsnprintf
17208 eval $inlibc
17209
17210 case "$d_snprintf-$d_vsnprintf" in
17211 "$define-$define")
17212     $cat <<EOM
17213 Checking whether your snprintf() and vsnprintf() work okay...
17214 EOM
17215     $cat >try.c <<'EOCP'
17216 /* v?snprintf testing logic courtesy of Russ Allbery.
17217  * According to C99:
17218  * - if the buffer is too short it still must be \0-terminated
17219  * - if the buffer is too short the potentially required length
17220  *   must be returned and not -1
17221  * - if the buffer is NULL the potentially required length
17222  *   must be returned and not -1 or core dump
17223  */
17224 #include <stdio.h>
17225 #include <stdarg.h>
17226
17227 char buf[2];
17228
17229 int test (char *format, ...)
17230 {
17231     va_list args;
17232     int count;
17233
17234     va_start (args, format);
17235     count = vsnprintf (buf, sizeof buf, format, args);
17236     va_end (args);
17237     return count;
17238 }
17239
17240 int main ()
17241 {
17242     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17243              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17244 }
17245 EOCP
17246     set try
17247     if eval $compile; then
17248         `$run ./try`
17249         case "$?" in
17250         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17251         *) cat <<EOM >&4
17252 Your snprintf() and snprintf() don't seem to be working okay.
17253 EOM
17254            d_snprintf="$undef"
17255            d_vsnprintf="$undef"
17256            ;;
17257         esac
17258     else
17259         echo "(I can't seem to compile the test program--assuming they don't)"
17260         d_snprintf="$undef"
17261         d_vsnprintf="$undef"
17262     fi
17263     $rm_try
17264     ;;
17265 esac
17266
17267 : see if sockatmark exists
17268 set sockatmark d_sockatmark
17269 eval $inlibc
17270
17271 : see if prototype for sockatmark is available
17272 echo " "
17273 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17274 eval $hasproto
17275
17276 : see if socks5_init exists
17277 set socks5_init d_socks5_init
17278 eval $inlibc
17279
17280 : see if sprintf returns the length of the string in the buffer as per ANSI
17281 $echo "Checking whether sprintf returns the length of the string..." >&4
17282 $cat <<EOP >try.c
17283 #include <stdio.h>
17284 #$i_stdlib I_STDLIB
17285 #ifdef I_STDLIB
17286 #include <stdlib.h>
17287 #endif
17288 #$i_string I_STRING
17289 #ifdef I_STRING
17290 #  include <string.h>
17291 #else
17292 #  include <strings.h>
17293 #endif
17294 #$i_math I_MATH
17295 #ifdef I_MATH
17296 #include <math.h>
17297 #endif
17298
17299 char buffer[256];
17300
17301 int check (size_t expect, int test) {
17302   size_t got = strlen(buffer);
17303   if (expect == got)
17304     return 0;
17305
17306   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17307        test, buffer);
17308   exit (test);
17309 }
17310
17311 int main(int argc, char **argv) {
17312   int test = 0;
17313
17314   check(sprintf(buffer, ""), ++test);
17315   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17316   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17317
17318   return 0;
17319 }
17320 EOP
17321 set try
17322
17323 d_sprintf_returns_strlen="$undef"
17324 if eval $compile; then
17325     xxx="`$run ./try`"
17326     case "$?" in
17327         0) cat >&4 <<EOM
17328 sprintf returns the length of the string (as ANSI says it should)
17329 EOM
17330         d_sprintf_returns_strlen="$define"
17331         ;;
17332         *) cat >&4 <<EOM
17333 sprintf does not return the length of the string (how old is this system?)
17334 EOM
17335         d_sprintf_returns_strlen="$undef"
17336         ;;
17337     esac
17338 fi
17339 $rm_try
17340
17341 : see if srand48_r exists
17342 set srand48_r d_srand48_r
17343 eval $inlibc
17344 case "$d_srand48_r" in
17345 "$define")
17346         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17347         case "$d_srand48_r_proto:$usethreads" in
17348         ":define")      d_srand48_r_proto=define
17349                 set d_srand48_r_proto srand48_r $hdrs
17350                 eval $hasproto ;;
17351         *)      ;;
17352         esac
17353         case "$d_srand48_r_proto" in
17354         define)
17355         case "$srand48_r_proto" in
17356         ''|0) try='int srand48_r(long, struct drand48_data*);'
17357         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
17358         esac
17359         case "$srand48_r_proto" in
17360         ''|0)   d_srand48_r=undef
17361                 srand48_r_proto=0
17362                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17363         * )     case "$srand48_r_proto" in
17364                 REENTRANT_PROTO*) ;;
17365                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17366                 esac
17367                 echo "Prototype: $try" ;;
17368         esac
17369         ;;
17370         *)      case "$usethreads" in
17371                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17372                 esac
17373                 d_srand48_r=undef
17374                 srand48_r_proto=0
17375                 ;;
17376         esac
17377         ;;
17378 *)      srand48_r_proto=0
17379         ;;
17380 esac
17381
17382 : see if srandom_r exists
17383 set srandom_r d_srandom_r
17384 eval $inlibc
17385 case "$d_srandom_r" in
17386 "$define")
17387         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17388         case "$d_srandom_r_proto:$usethreads" in
17389         ":define")      d_srandom_r_proto=define
17390                 set d_srandom_r_proto srandom_r $hdrs
17391                 eval $hasproto ;;
17392         *)      ;;
17393         esac
17394         case "$d_srandom_r_proto" in
17395         define)
17396         case "$srandom_r_proto" in
17397         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17398         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
17399         esac
17400         case "$srandom_r_proto" in
17401         ''|0)   d_srandom_r=undef
17402                 srandom_r_proto=0
17403                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17404         * )     case "$srandom_r_proto" in
17405                 REENTRANT_PROTO*) ;;
17406                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17407                 esac
17408                 echo "Prototype: $try" ;;
17409         esac
17410         ;;
17411         *)      case "$usethreads" in
17412                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17413                 esac
17414                 d_srandom_r=undef
17415                 srandom_r_proto=0
17416                 ;;
17417         esac
17418         ;;
17419 *)      srandom_r_proto=0
17420         ;;
17421 esac
17422
17423 : see if prototype for setresgid is available
17424 echo " "
17425 set d_sresgproto setresgid $i_unistd unistd.h
17426 eval $hasproto
17427
17428 : see if prototype for setresuid is available
17429 echo " "
17430 set d_sresuproto setresuid $i_unistd unistd.h
17431 eval $hasproto
17432
17433 : see if sys/stat.h is available
17434 set sys/stat.h i_sysstat
17435 eval $inhdr
17436
17437 : see if stat knows about block sizes
17438 echo " "
17439 echo "Checking to see if your struct stat has st_blocks field..." >&4
17440 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17441 eval $hasfield
17442
17443 : see if this is a sys/vfs.h system
17444 set sys/vfs.h i_sysvfs
17445 eval $inhdr
17446
17447 : see if this is a sys/statfs.h system
17448 set sys/statfs.h i_sysstatfs
17449 eval $inhdr
17450
17451 : Check for statfs_s
17452 echo " "
17453 echo "Checking to see if your system supports struct statfs..." >&4
17454 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
17455 eval $hasstruct
17456 case "$d_statfs_s" in
17457 "$define")      echo "Yes, it does."   ;;
17458 *)              echo "No, it doesn't." ;;
17459 esac
17460
17461
17462 : see if struct statfs knows about f_flags
17463 case "$d_statfs_s" in
17464 define)
17465         echo " "
17466         echo "Checking to see if your struct statfs has f_flags field..." >&4
17467         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
17468         eval $hasfield
17469         ;;
17470 *)      val="$undef"
17471         set d_statfs_f_flags
17472         eval $setvar
17473         ;;
17474 esac
17475 case "$d_statfs_f_flags" in
17476 "$define")      echo "Yes, it does."   ;;
17477 *)              echo "No, it doesn't." ;;
17478 esac
17479
17480 : Check stream access
17481 $cat >&4 <<EOM
17482 Checking how to access stdio streams by file descriptor number...
17483 EOM
17484 case "$stdio_stream_array" in
17485 '')     $cat >try.c <<EOCP
17486 #include <stdio.h>
17487 int main() {
17488   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17489     printf("yes\n");
17490 }
17491 EOCP
17492         for s in _iob __iob __sF
17493         do
17494                 set try -DSTDIO_STREAM_ARRAY=$s
17495                 if eval $compile; then
17496                         case "`$run ./try`" in
17497                         yes)    stdio_stream_array=$s; break ;;
17498                         esac
17499                 fi
17500         done
17501         $rm_try
17502 esac
17503 case "$stdio_stream_array" in
17504 '')     $cat >&4 <<EOM
17505 I can't figure out how to access stdio streams by file descriptor number.
17506 EOM
17507         d_stdio_stream_array="$undef"
17508         ;;
17509 *)      $cat >&4 <<EOM
17510 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17511 EOM
17512         d_stdio_stream_array="$define"
17513         ;;
17514 esac
17515
17516 : see if strcoll exists
17517 set strcoll d_strcoll
17518 eval $inlibc
17519
17520 : check for structure copying
17521 echo " "
17522 echo "Checking to see if your C compiler can copy structs..." >&4
17523 $cat >try.c <<'EOCP'
17524 int main()
17525 {
17526         struct blurfl {
17527                 int dyick;
17528         } foo, bar;
17529
17530         foo = bar;
17531 }
17532 EOCP
17533 if $cc -c try.c >/dev/null 2>&1 ; then
17534         val="$define"
17535         echo "Yup, it can."
17536 else
17537         val="$undef"
17538         echo "Nope, it can't."
17539 fi
17540 set d_strctcpy
17541 eval $setvar
17542 $rm_try
17543
17544 : see if strerror and/or sys_errlist[] exist
17545 echo " "
17546 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17547     if set strerror val -f d_strerror; eval $csym; $val; then
17548                 echo 'strerror() found.' >&4
17549                 d_strerror="$define"
17550                 d_strerrm='strerror(e)'
17551                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17552                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17553                         d_syserrlst="$define"
17554                 else
17555                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17556                         d_syserrlst="$undef"
17557                 fi
17558     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17559                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17560                 echo 'strerror() found in string header.' >&4
17561                 d_strerror="$define"
17562                 d_strerrm='strerror(e)'
17563                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17564                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17565                                 d_syserrlst="$define"
17566                 else
17567                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17568                         d_syserrlst="$undef"
17569                 fi
17570     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17571                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17572                 d_strerror="$undef"
17573                 d_syserrlst="$define"
17574                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17575     else
17576                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17577                 d_strerror="$undef"
17578                 d_syserrlst="$undef"
17579                 d_strerrm='"unknown"'
17580     fi
17581 fi
17582
17583 : see if strerror_r exists
17584 set strerror_r d_strerror_r
17585 eval $inlibc
17586 case "$d_strerror_r" in
17587 "$define")
17588         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17589         case "$d_strerror_r_proto:$usethreads" in
17590         ":define")      d_strerror_r_proto=define
17591                 set d_strerror_r_proto strerror_r $hdrs
17592                 eval $hasproto ;;
17593         *)      ;;
17594         esac
17595         case "$d_strerror_r_proto" in
17596         define)
17597         case "$strerror_r_proto" in
17598         ''|0) try='int strerror_r(int, char*, size_t);'
17599         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17600         esac
17601         case "$strerror_r_proto" in
17602         ''|0) try='int strerror_r(int, char*, int);'
17603         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17604         esac
17605         case "$strerror_r_proto" in
17606         ''|0) try='char* strerror_r(int, char*, size_t);'
17607         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17608         esac
17609         case "$strerror_r_proto" in
17610         ''|0)   d_strerror_r=undef
17611                 strerror_r_proto=0
17612                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17613         * )     case "$strerror_r_proto" in
17614                 REENTRANT_PROTO*) ;;
17615                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17616                 esac
17617                 echo "Prototype: $try" ;;
17618         esac
17619         ;;
17620         *)      case "$usethreads" in
17621                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17622                 esac
17623                 d_strerror_r=undef
17624                 strerror_r_proto=0
17625                 ;;
17626         esac
17627         ;;
17628 *)      strerror_r_proto=0
17629         ;;
17630 esac
17631
17632 : see if strftime exists
17633 set strftime d_strftime
17634 eval $inlibc
17635
17636 : see if strlcat exists
17637 set strlcat d_strlcat
17638 eval $inlibc
17639
17640 : see if strlcpy exists
17641 set strlcpy d_strlcpy
17642 eval $inlibc
17643
17644 : see if strtod exists
17645 set strtod d_strtod
17646 eval $inlibc
17647
17648 : see if strtol exists
17649 set strtol d_strtol
17650 eval $inlibc
17651
17652 : see if strtold exists
17653 set strtold d_strtold
17654 eval $inlibc
17655
17656 : see if strtoll exists
17657 set strtoll d_strtoll
17658 eval $inlibc
17659
17660 case "$d_longlong-$d_strtoll" in
17661 "$define-$define")
17662         $cat <<EOM
17663 Checking whether your strtoll() works okay...
17664 EOM
17665         $cat >try.c <<'EOCP'
17666 #include <errno.h>
17667 #ifdef __hpux
17668 #define strtoll __strtoll
17669 #endif
17670 #ifdef __EMX__
17671 #define strtoll _strtoll
17672 #endif
17673 #include <stdio.h>
17674 extern long long int strtoll(char *s, char **, int);
17675 static int bad = 0;
17676 int check(char *s, long long ell, int een) {
17677         long long gll;
17678         errno = 0;
17679         gll = strtoll(s, 0, 10);
17680         if (!((gll == ell) && (errno == een)))
17681                 bad++;
17682 }
17683 int main() {
17684         check(" 1",                                      1LL, 0);
17685         check(" 0",                                      0LL, 0);
17686         check("-1",                                     -1LL, 0);
17687         check("-9223372036854775808", -9223372036854775808LL, 0);
17688         check("-9223372036854775808", -9223372036854775808LL, 0);
17689         check(" 9223372036854775807",  9223372036854775807LL, 0);
17690         check("-9223372036854775808", -9223372036854775808LL, 0);
17691         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17692         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17693         if (!bad)
17694                 printf("ok\n");
17695 }
17696 EOCP
17697         set try
17698         if eval $compile; then
17699                 yyy=`$run ./try`
17700                 case "$yyy" in
17701                 ok) echo "Your strtoll() seems to be working okay." ;;
17702                 *) cat <<EOM >&4
17703 Your strtoll() doesn't seem to be working okay.
17704 EOM
17705                    d_strtoll="$undef"
17706                    ;;
17707                 esac
17708         else
17709                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17710                 d_strtoll="$undef"
17711         fi
17712         ;;
17713 esac
17714
17715 : see if strtoq exists
17716 set strtoq d_strtoq
17717 eval $inlibc
17718
17719 : see if strtoul exists
17720 set strtoul d_strtoul
17721 eval $inlibc
17722
17723 case "$d_strtoul" in
17724 "$define")
17725         $cat <<EOM
17726 Checking whether your strtoul() works okay...
17727 EOM
17728         $cat >try.c <<'EOCP'
17729 #include <errno.h>
17730 #include <stdio.h>
17731 extern unsigned long int strtoul(char *s, char **, int);
17732 static int bad = 0;
17733 void check(char *s, unsigned long eul, int een) {
17734         unsigned long gul;
17735         errno = 0;
17736         gul = strtoul(s, 0, 10);
17737         if (!((gul == eul) && (errno == een)))
17738                 bad++;
17739 }
17740 int main() {
17741         check(" 1", 1L, 0);
17742         check(" 0", 0L, 0);
17743 EOCP
17744         case "$longsize" in
17745         8)
17746             $cat >>try.c <<'EOCP'
17747         check("18446744073709551615", 18446744073709551615UL, 0);
17748         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17749 #if 0 /* strtoul() for /^-/ strings is undefined. */
17750         check("-1", 18446744073709551615UL, 0);
17751         check("-18446744073709551614", 2, 0);
17752         check("-18446744073709551615", 1, 0);
17753         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17754         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17755 #endif
17756 EOCP
17757                 ;;
17758         4)
17759                     $cat >>try.c <<'EOCP'
17760         check("4294967295", 4294967295UL, 0);
17761         check("4294967296", 4294967295UL, ERANGE);
17762 #if 0 /* strtoul() for /^-/ strings is undefined. */
17763         check("-1", 4294967295UL, 0);
17764         check("-4294967294", 2, 0);
17765         check("-4294967295", 1, 0);
17766         check("-4294967296", 4294967295UL, ERANGE);
17767         check("-4294967297", 4294967295UL, ERANGE);
17768 #endif
17769 EOCP
17770                 ;;
17771         *)
17772 : Should we write these tests to be more portable by sprintf-ing
17773 : ~0 and then manipulating that char string as input for strtol?
17774                 ;;
17775         esac
17776         $cat >>try.c <<'EOCP'
17777         if (!bad)
17778                 printf("ok\n");
17779         return 0;
17780 }
17781 EOCP
17782         set try
17783         if eval $compile; then
17784                 case "`$run ./try`" in
17785                 ok) echo "Your strtoul() seems to be working okay." ;;
17786                 *) cat <<EOM >&4
17787 Your strtoul() doesn't seem to be working okay.
17788 EOM
17789                    d_strtoul="$undef"
17790                    ;;
17791                 esac
17792         else
17793                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17794                 d_strtoul="$undef"
17795         fi
17796         ;;
17797 esac
17798
17799 : see if strtoull exists
17800 set strtoull d_strtoull
17801 eval $inlibc
17802
17803 case "$d_longlong-$d_strtoull" in
17804 "$define-$define")
17805         $cat <<EOM
17806 Checking whether your strtoull() works okay...
17807 EOM
17808         $cat >try.c <<'EOCP'
17809 #include <errno.h>
17810 #ifdef __hpux
17811 #define strtoull __strtoull
17812 #endif
17813 #include <stdio.h>
17814 extern unsigned long long int strtoull(char *s, char **, int);
17815 static int bad = 0;
17816 int check(char *s, long long eull, int een) {
17817         long long gull;
17818         errno = 0;
17819         gull = strtoull(s, 0, 10);
17820         if (!((gull == eull) && (errno == een)))
17821                 bad++;
17822 }
17823 int main() {
17824         check(" 1",                                        1LL, 0);
17825         check(" 0",                                        0LL, 0);
17826         check("18446744073709551615",  18446744073709551615ULL, 0);
17827         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17828 #if 0 /* strtoull() for /^-/ strings is undefined. */
17829         check("-1",                    18446744073709551615ULL, 0);
17830         check("-18446744073709551614",                     2LL, 0);
17831         check("-18446744073709551615",                     1LL, 0);
17832         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17833         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17834 #endif
17835         if (!bad)
17836                 printf("ok\n");
17837 }
17838 EOCP
17839         set try
17840         if eval $compile; then
17841                 case "`$run ./try`" in
17842                 ok) echo "Your strtoull() seems to be working okay." ;;
17843                 *) cat <<EOM >&4
17844 Your strtoull() doesn't seem to be working okay.
17845 EOM
17846                    d_strtoull="$undef"
17847                    ;;
17848                 esac
17849         else
17850                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17851                 d_strtoull="$undef"
17852         fi
17853         ;;
17854 esac
17855
17856 : see if strtouq exists
17857 set strtouq d_strtouq
17858 eval $inlibc
17859
17860 case "$d_strtouq" in
17861 "$define")
17862         $cat <<EOM
17863 Checking whether your strtouq() works okay...
17864 EOM
17865         $cat >try.c <<'EOCP'
17866 #include <errno.h>
17867 #include <stdio.h>
17868 extern unsigned long long int strtouq(char *s, char **, int);
17869 static int bad = 0;
17870 void check(char *s, unsigned long long eull, int een) {
17871         unsigned long long gull;
17872         errno = 0;
17873         gull = strtouq(s, 0, 10);
17874         if (!((gull == eull) && (errno == een)))
17875                 bad++;
17876 }
17877 int main() {
17878         check(" 1",                                        1LL, 0);
17879         check(" 0",                                        0LL, 0);
17880         check("18446744073709551615",  18446744073709551615ULL, 0);
17881         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17882 #if 0 /* strtouq() for /^-/ strings is undefined. */
17883         check("-1",                    18446744073709551615ULL, 0);
17884         check("-18446744073709551614",                     2LL, 0);
17885         check("-18446744073709551615",                     1LL, 0);
17886         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17887         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17888 #endif
17889         if (!bad)
17890                 printf("ok\n");
17891         return 0;
17892 }
17893 EOCP
17894         set try
17895         if eval $compile; then
17896                 case "`$run ./try`" in
17897                 ok) echo "Your strtouq() seems to be working okay." ;;
17898                 *) cat <<EOM >&4
17899 Your strtouq() doesn't seem to be working okay.
17900 EOM
17901                    d_strtouq="$undef"
17902                    ;;
17903                 esac
17904         else
17905                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17906                 d_strtouq="$undef"
17907         fi
17908         ;;
17909 esac
17910
17911 : see if strxfrm exists
17912 set strxfrm d_strxfrm
17913 eval $inlibc
17914
17915 : see if symlink exists
17916 set symlink d_symlink
17917 eval $inlibc
17918
17919 : see if syscall exists
17920 set syscall d_syscall
17921 eval $inlibc
17922
17923 : see if prototype for syscall is available
17924 echo " "
17925 set d_syscallproto syscall $i_unistd unistd.h
17926 eval $hasproto
17927
17928 : see if sysconf exists
17929 set sysconf d_sysconf
17930 eval $inlibc
17931
17932 : see if system exists
17933 set system d_system
17934 eval $inlibc
17935
17936 : see if tcgetpgrp exists
17937 set tcgetpgrp d_tcgetpgrp
17938 eval $inlibc
17939
17940 : see if tcsetpgrp exists
17941 set tcsetpgrp d_tcsetpgrp
17942 eval $inlibc
17943
17944 : see if prototype for telldir is available
17945 echo " "
17946 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17947 eval $hasproto
17948
17949 : see if time exists
17950 echo " "
17951 if test "X$d_time" = X -o X"$timetype" = X; then
17952     if set time val -f d_time; eval $csym; $val; then
17953                 echo 'time() found.' >&4
17954                 val="$define"
17955                 rp="What is the type returned by time() on this system?"
17956                 set time_t timetype long stdio.h sys/types.h
17957                 eval $typedef_ask
17958     else
17959                 echo 'time() not found, hope that will do.' >&4
17960                 val="$undef"
17961                 timetype='int';
17962     fi
17963     set d_time
17964     eval $setvar
17965 fi
17966
17967 : see if this is a sys/times.h system
17968 set sys/times.h i_systimes
17969 eval $inhdr
17970
17971 : see if times exists
17972 echo " "
17973 if set times val -f d_times; eval $csym; $val; then
17974         echo 'times() found.' >&4
17975         d_times="$define"
17976         inc=''
17977         case "$i_systimes" in
17978         "$define") inc='sys/times.h';;
17979         esac
17980         rp="What is the type returned by times() on this system?"
17981         set clock_t clocktype long stdio.h sys/types.h $inc
17982         eval $typedef_ask
17983 else
17984         echo 'times() NOT found, hope that will do.' >&4
17985         d_times="$undef"
17986         clocktype='int'
17987 fi
17988
17989 : see if tmpnam_r exists
17990 set tmpnam_r d_tmpnam_r
17991 eval $inlibc
17992 case "$d_tmpnam_r" in
17993 "$define")
17994         hdrs="$i_systypes sys/types.h define stdio.h "
17995         case "$d_tmpnam_r_proto:$usethreads" in
17996         ":define")      d_tmpnam_r_proto=define
17997                 set d_tmpnam_r_proto tmpnam_r $hdrs
17998                 eval $hasproto ;;
17999         *)      ;;
18000         esac
18001         case "$d_tmpnam_r_proto" in
18002         define)
18003         case "$tmpnam_r_proto" in
18004         ''|0) try='char* tmpnam_r(char*);'
18005         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
18006         esac
18007         case "$tmpnam_r_proto" in
18008         ''|0)   d_tmpnam_r=undef
18009                 tmpnam_r_proto=0
18010                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18011         * )     case "$tmpnam_r_proto" in
18012                 REENTRANT_PROTO*) ;;
18013                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18014                 esac
18015                 echo "Prototype: $try" ;;
18016         esac
18017         ;;
18018         *)      case "$usethreads" in
18019                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18020                 esac
18021                 d_tmpnam_r=undef
18022                 tmpnam_r_proto=0
18023                 ;;
18024         esac
18025         ;;
18026 *)      tmpnam_r_proto=0
18027         ;;
18028 esac
18029
18030 : see if truncate exists
18031 set truncate d_truncate
18032 eval $inlibc
18033
18034 : see if ttyname_r exists
18035 set ttyname_r d_ttyname_r
18036 eval $inlibc
18037 case "$d_ttyname_r" in
18038 "$define")
18039         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18040         case "$d_ttyname_r_proto:$usethreads" in
18041         ":define")      d_ttyname_r_proto=define
18042                 set d_ttyname_r_proto ttyname_r $hdrs
18043                 eval $hasproto ;;
18044         *)      ;;
18045         esac
18046         case "$d_ttyname_r_proto" in
18047         define)
18048         case "$ttyname_r_proto" in
18049         ''|0) try='int ttyname_r(int, char*, size_t);'
18050         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
18051         esac
18052         case "$ttyname_r_proto" in
18053         ''|0) try='int ttyname_r(int, char*, int);'
18054         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
18055         esac
18056         case "$ttyname_r_proto" in
18057         ''|0) try='char* ttyname_r(int, char*, int);'
18058         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
18059         esac
18060         case "$ttyname_r_proto" in
18061         ''|0)   d_ttyname_r=undef
18062                 ttyname_r_proto=0
18063                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18064         * )     case "$ttyname_r_proto" in
18065                 REENTRANT_PROTO*) ;;
18066                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18067                 esac
18068                 echo "Prototype: $try" ;;
18069         esac
18070         ;;
18071         *)      case "$usethreads" in
18072                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18073                 esac
18074                 d_ttyname_r=undef
18075                 ttyname_r_proto=0
18076                 ;;
18077         esac
18078         ;;
18079 *)      ttyname_r_proto=0
18080         ;;
18081 esac
18082
18083 : see if tzname[] exists
18084 echo " "
18085 if set tzname val -a d_tzname; eval $csym; $val; then
18086         val="$define"
18087         echo 'tzname[] found.' >&4
18088 else
18089         val="$undef"
18090         echo 'tzname[] NOT found.' >&4
18091 fi
18092 set d_tzname
18093 eval $setvar
18094
18095 : Check if is a multiplatform env
18096 case "$osname" in
18097 next|rhapsody|darwin) multiarch="$define" ;;
18098 esac
18099 case "$multiarch" in
18100 ''|[nN]*) multiarch="$undef" ;;
18101 esac
18102
18103 : check for ordering of bytes in a UV
18104 echo " "
18105 case "$usecrosscompile$multiarch" in
18106 *$define*)
18107         $cat <<EOM
18108 You seem to be either cross-compiling or doing a multiarchitecture build,
18109 skipping the byteorder check.
18110
18111 EOM
18112         byteorder='ffff'
18113         ;;
18114 *)
18115         case "$byteorder" in
18116         '')
18117                 $cat <<'EOM'
18118 In the following, larger digits indicate more significance.  A big-endian
18119 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18120 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18121 machines may have weird orders like 3412.  A Cray will report 87654321,
18122 an Alpha will report 12345678. If the test program works the default is
18123 probably right.
18124 I'm now running the test program...
18125 EOM
18126                 $cat >try.c <<EOCP
18127 #include <stdio.h>
18128 #$i_stdlib I_STDLIB
18129 #ifdef I_STDLIB
18130 #include <stdlib.h>
18131 #endif
18132 #include <sys/types.h>
18133 typedef $uvtype UV;
18134 int main()
18135 {
18136         int i;
18137         union {
18138                 UV l;
18139                 char c[$uvsize];
18140         } u;
18141
18142         if ($uvsize > 4)
18143                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18144         else
18145                 u.l = (UV)0x04030201;
18146         for (i = 0; i < $uvsize; i++)
18147                 printf("%c", u.c[i]+'0');
18148         printf("\n");
18149         exit(0);
18150 }
18151 EOCP
18152                 xxx_prompt=y
18153                 set try
18154                 if eval $compile && $run ./try > /dev/null; then
18155                         dflt=`$run ./try`
18156                         case "$dflt" in
18157                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18158                                 echo "(The test program ran ok.)"
18159                                 echo "byteorder=$dflt"
18160                                 xxx_prompt=n
18161                         ;;
18162                         ????|????????) echo "(The test program ran ok.)" ;;
18163                         *) echo "(The test program didn't run right for some reason.)" ;;
18164                         esac
18165                 else
18166                         dflt='4321'
18167                         cat <<'EOM'
18168 (I can't seem to compile the test program.  Guessing big-endian...)
18169 EOM
18170                 fi
18171                 case "$xxx_prompt" in
18172                 y)
18173                         rp="What is the order of bytes in $uvtype?"
18174                         . ./myread
18175                         byteorder="$ans"
18176                         ;;
18177                 *)      byteorder=$dflt
18178                         ;;
18179                 esac
18180                 ;;
18181         esac
18182         $rm_try
18183         ;;
18184 esac
18185
18186 : Checking 32bit aligndness
18187 $cat <<EOM
18188
18189 Checking to see whether you can access character data unalignedly...
18190 EOM
18191 case "$d_u32align" in
18192 '')   $cat >try.c <<EOCP
18193 #include <stdio.h>
18194 #$i_stdlib I_STDLIB
18195 #ifdef I_STDLIB
18196 #include <stdlib.h>
18197 #endif
18198 #define U32 $u32type
18199 #define BYTEORDER 0x$byteorder
18200 #define U8 $u8type
18201 #include <signal.h>
18202 #ifdef SIGBUS
18203 $signal_t bletch(int s) { exit(4); }
18204 #endif
18205 int main() {
18206 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18207     U8 buf[8];
18208     U32 *up;
18209     int i;
18210
18211     if (sizeof(U32) != 4) {
18212         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18213         exit(1);
18214     }
18215
18216     fflush(stdout);
18217
18218 #ifdef SIGBUS
18219     signal(SIGBUS, bletch);
18220 #endif
18221
18222     buf[0] = 0;
18223     buf[1] = 0;
18224     buf[2] = 0;
18225     buf[3] = 1;
18226     buf[4] = 0;
18227     buf[5] = 0;
18228     buf[6] = 0;
18229     buf[7] = 1;
18230
18231     for (i = 0; i < 4; i++) {
18232         up = (U32*)(buf + i);
18233         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18234                (*up == 1 << (8*(3-i)))  /* little-endian */
18235               )
18236            )
18237         {
18238             printf("read failed (%x)\n", *up);
18239             exit(2);
18240         }
18241     }
18242
18243     /* write test */
18244     for (i = 0; i < 4; i++) {
18245         up = (U32*)(buf + i);
18246         *up = 0xBeef;
18247         if (*up != 0xBeef) {
18248             printf("write failed (%x)\n", *up);
18249             exit(3);
18250         }
18251     }
18252
18253     exit(0);
18254 #else
18255     printf("1\n");
18256     exit(1);
18257 #endif
18258     return 0;
18259 }
18260 EOCP
18261 set try
18262 if eval $compile_ok; then
18263         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18264         $run ./try 2>&1 >/dev/null
18265         case "$?" in
18266         0)      cat >&4 <<EOM
18267 You can access character data pretty unalignedly.
18268 EOM
18269                 d_u32align="$undef"
18270                 ;;
18271         *)      cat >&4 <<EOM
18272 It seems that you must access character data in an aligned manner.
18273 EOM
18274                 d_u32align="$define"
18275                 ;;
18276         esac
18277 else
18278         rp='Can you access character data at unaligned addresses?'
18279         dflt='n'
18280         . ./myread
18281         case "$ans" in
18282         [yY]*)  d_u32align="$undef"  ;;
18283         *)      d_u32align="$define" ;;
18284         esac
18285 fi
18286 $rm_try
18287 ;;
18288 esac
18289
18290 : see if ualarm exists
18291 set ualarm d_ualarm
18292 eval $inlibc
18293
18294 : see if umask exists
18295 set umask d_umask
18296 eval $inlibc
18297
18298 : see if unordered exists
18299 set unordered d_unordered
18300 eval $inlibc
18301
18302 : see if unsetenv exists
18303 set unsetenv d_unsetenv
18304 eval $inlibc
18305
18306 : see if usleep exists
18307 set usleep d_usleep
18308 eval $inlibc
18309
18310 : see if prototype for usleep is available
18311 echo " "
18312 set d_usleepproto usleep $i_unistd unistd.h
18313 eval $hasproto
18314
18315 : see if ustat exists
18316 set ustat d_ustat
18317 eval $inlibc
18318
18319 : see if closedir exists
18320 set closedir d_closedir
18321 eval $inlibc
18322
18323 case "$d_closedir" in
18324 "$define")
18325         echo " "
18326         echo "Checking whether closedir() returns a status..." >&4
18327         cat > try.c <<EOM
18328 #$i_dirent I_DIRENT             /**/
18329 #$i_sysdir I_SYS_DIR            /**/
18330 #$i_sysndir I_SYS_NDIR          /**/
18331 #$i_systypes I_SYS_TYPES        /**/
18332
18333 #if defined(I_SYS_TYPES)
18334 #include <sys/types.h>
18335 #endif
18336 #if defined(I_DIRENT)
18337 #include <dirent.h>
18338 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18339 #include <sys/dir.h>
18340 #endif
18341 #else
18342 #ifdef I_SYS_NDIR
18343 #include <sys/ndir.h>
18344 #else
18345 #ifdef I_SYS_DIR
18346 #ifdef hp9000s500
18347 #include <ndir.h>       /* may be wrong in the future */
18348 #else
18349 #include <sys/dir.h>
18350 #endif
18351 #endif
18352 #endif
18353 #endif
18354 int main() { return closedir(opendir(".")); }
18355 EOM
18356         set try
18357         if eval $compile_ok; then
18358                 if $run ./try > /dev/null 2>&1 ; then
18359                         echo "Yes, it does."
18360                         val="$undef"
18361                 else
18362                         echo "No, it doesn't."
18363                         val="$define"
18364                 fi
18365         else
18366                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18367                 val="$define"
18368         fi
18369         ;;
18370 *)
18371         val="$undef";
18372         ;;
18373 esac
18374 set d_void_closedir
18375 eval $setvar
18376 $rm_try
18377
18378 : see if there is a wait4
18379 set wait4 d_wait4
18380 eval $inlibc
18381
18382 : see if waitpid exists
18383 set waitpid d_waitpid
18384 eval $inlibc
18385
18386 : see if wcstombs exists
18387 set wcstombs d_wcstombs
18388 eval $inlibc
18389
18390 : see if wctomb exists
18391 set wctomb d_wctomb
18392 eval $inlibc
18393
18394 : see if writev exists
18395 set writev d_writev
18396 eval $inlibc
18397
18398 : preserve RCS keywords in files with variable substitution, grrr
18399 Date='$Date'
18400 Id='$Id'
18401 Log='$Log'
18402 RCSfile='$RCSfile'
18403 Revision='$Revision'
18404
18405 : check for alignment requirements
18406 echo " "
18407 case "$usecrosscompile$multiarch" in
18408 *$define*)
18409         $cat <<EOM
18410 You seem to be either cross-compiling or doing a multiarchitecture build,
18411 skipping the memory alignment check.
18412
18413 EOM
18414         case "$alignbytes" in
18415         '') alignbytes=8 ;;
18416         esac
18417         ;;
18418 *)
18419         case "$alignbytes" in
18420         '') echo "Checking alignment constraints..." >&4
18421                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18422                         $cat >try.c <<'EOCP'
18423 typedef long double NV;
18424 EOCP
18425                 else
18426                         $cat >try.c <<'EOCP'
18427 typedef double NV;
18428 EOCP
18429                 fi
18430                 $cat >>try.c <<'EOCP'
18431 #include <stdio.h>
18432 struct foobar {
18433         char foo;
18434         NV bar;
18435 } try_algn;
18436 int main()
18437 {
18438     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18439     return(0);
18440 }
18441 EOCP
18442                 set try
18443                 if eval $compile_ok; then
18444                         dflt=`$run ./try`
18445                 else
18446                         dflt='8'
18447                         echo "(I can't seem to compile the test program...)"
18448                 fi
18449                 ;;
18450         *) dflt="$alignbytes"
18451                 ;;
18452         esac
18453         rp="Doubles must be aligned on a how-many-byte boundary?"
18454         . ./myread
18455         alignbytes="$ans"
18456         $rm_try
18457         ;;
18458 esac
18459
18460
18461 : set the base revision
18462 baserev=5.0
18463
18464 : how do we concatenate cpp tokens here?
18465 echo " "
18466 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18467 $cat >cpp_stuff.c <<'EOCP'
18468 #define RCAT(a,b)a/**/b
18469 #define ACAT(a,b)a ## b
18470 RCAT(Rei,ser)
18471 ACAT(Cir,cus)
18472 EOCP
18473 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18474 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18475         echo "Oh!  Smells like ANSI's been here." >&4
18476         echo "We can catify or stringify, separately or together!"
18477         cpp_stuff=42
18478 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18479         echo "Ah, yes!  The good old days!" >&4
18480         echo "However, in the good old days we don't know how to stringify and"
18481         echo "catify at the same time."
18482         cpp_stuff=1
18483 else
18484         $cat >&4 <<EOM
18485 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18486 You're going to have to edit the values of CAT[2-5] in config.h...
18487 EOM
18488         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18489 fi
18490 $rm -f cpp_stuff.*
18491
18492 : see if this is a db.h system
18493 set db.h i_db
18494 eval $inhdr
18495
18496 case "$i_db" in
18497 $define)
18498         : Check db version.
18499         echo " "
18500         echo "Checking Berkeley DB version ..." >&4
18501         $cat >try.c <<EOCP
18502 #$d_const HASCONST
18503 #ifndef HASCONST
18504 #define const
18505 #endif
18506 #include <sys/types.h>
18507 #include <stdio.h>
18508 #$i_stdlib I_STDLIB
18509 #ifdef I_STDLIB
18510 #include <stdlib.h>
18511 #endif
18512 #include <db.h>
18513 int main(int argc, char *argv[])
18514 {
18515 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18516     int Major, Minor, Patch ;
18517     unsigned long Version ;
18518     (void)db_version(&Major, &Minor, &Patch) ;
18519     if (argc == 2) {
18520         printf("%d %d %d %d %d %d\n",
18521                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18522                Major, Minor, Patch);
18523         exit(0);
18524     }
18525     printf("You have Berkeley DB Version 2 or greater.\n");
18526
18527     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18528                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18529     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18530                 Major, Minor, Patch) ;
18531
18532     /* check that db.h & libdb are compatible */
18533     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18534         printf("db.h and libdb are incompatible.\n") ;
18535         exit(3);
18536     }
18537
18538     printf("db.h and libdb are compatible.\n") ;
18539
18540     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18541                 + DB_VERSION_PATCH ;
18542
18543     /* needs to be >= 2.3.4 */
18544     if (Version < 2003004) {
18545     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18546         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18547         exit(2);
18548     }
18549
18550     exit(0);
18551 #else
18552 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18553     if (argc == 2) {
18554         printf("1 0 0\n");
18555         exit(0);
18556     }
18557     printf("You have Berkeley DB Version 1.\n");
18558     exit(0);    /* DB version < 2: the coast is clear. */
18559 #else
18560     exit(1);    /* <db.h> not Berkeley DB? */
18561 #endif
18562 #endif
18563 }
18564 EOCP
18565         set try
18566         if eval $compile_ok && $run ./try; then
18567                 echo 'Looks OK.' >&4
18568                 set `$run ./try 1`
18569                 db_version_major=$1
18570                 db_version_minor=$2
18571                 db_version_patch=$3
18572         else
18573                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18574                 i_db=$undef
18575                 case " $libs " in
18576                 *"-ldb "*)
18577                         : Remove db from list of libraries to use
18578                         echo "Removing unusable -ldb from library list" >&4
18579                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18580                         shift
18581                         libs="$*"
18582                         echo "libs = $libs" >&4
18583                         ;;
18584                 esac
18585         fi
18586         $rm_try
18587         ;;
18588 esac
18589
18590 case "$i_db" in
18591 define)
18592         : Check the return type needed for hash
18593         echo " "
18594         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18595         $cat >try.c <<EOCP
18596 #$d_const HASCONST
18597 #ifndef HASCONST
18598 #define const
18599 #endif
18600 #include <sys/types.h>
18601 #include <db.h>
18602
18603 #ifndef DB_VERSION_MAJOR
18604 u_int32_t hash_cb (ptr, size)
18605 const void *ptr;
18606 size_t size;
18607 {
18608 }
18609 HASHINFO info;
18610 int main()
18611 {
18612         info.hash = hash_cb;
18613 }
18614 #endif
18615 EOCP
18616         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18617                 if $contains warning try.out >>/dev/null 2>&1 ; then
18618                         db_hashtype='int'
18619                 else
18620                         db_hashtype='u_int32_t'
18621                 fi
18622         else
18623                 : XXX Maybe we should just give up here.
18624                 db_hashtype=u_int32_t
18625                 $cat try.out >&4
18626                 echo "Help:  I can't seem to compile the db test program." >&4
18627                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18628         fi
18629         $rm_try
18630         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18631         ;;
18632 *)      db_hashtype=u_int32_t
18633         ;;
18634 esac
18635 case "$i_db" in
18636 define)
18637         : Check the return type needed for prefix
18638         echo " "
18639         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18640         cat >try.c <<EOCP
18641 #$d_const HASCONST
18642 #ifndef HASCONST
18643 #define const
18644 #endif
18645 #include <sys/types.h>
18646 #include <db.h>
18647
18648 #ifndef DB_VERSION_MAJOR
18649 size_t prefix_cb (key1, key2)
18650 const DBT *key1;
18651 const DBT *key2;
18652 {
18653 }
18654 BTREEINFO info;
18655 int main()
18656 {
18657         info.prefix = prefix_cb;
18658 }
18659 #endif
18660 EOCP
18661         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18662                 if $contains warning try.out >>/dev/null 2>&1 ; then
18663                         db_prefixtype='int'
18664                 else
18665                         db_prefixtype='size_t'
18666                 fi
18667         else
18668                 db_prefixtype='size_t'
18669                 : XXX Maybe we should just give up here.
18670                 $cat try.out >&4
18671                 echo "Help:  I can't seem to compile the db test program." >&4
18672                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18673         fi
18674         $rm_try
18675         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18676         ;;
18677 *)      db_prefixtype='size_t'
18678         ;;
18679 esac
18680
18681 : How can we generate normalized random numbers ?
18682 echo " "
18683 echo "Looking for a random number function..." >&4
18684 case "$randfunc" in
18685 '')
18686         if set drand48 val -f; eval $csym; $val; then
18687                 dflt="drand48"
18688                 echo "Good, found drand48()." >&4
18689         elif set random val -f; eval $csym; $val; then
18690                 dflt="random"
18691                 echo "OK, found random()." >&4
18692         else
18693                 dflt="rand"
18694                 echo "Yick, looks like I have to use rand()." >&4
18695         fi
18696         echo " "
18697         ;;
18698 *)
18699         dflt="$randfunc"
18700         ;;
18701 esac
18702 cont=true
18703
18704 case "$ccflags" in
18705 *-Dmy_rand=*|*-Dmy_srand=*)
18706         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18707         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18708         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18709         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18710         ;;
18711 esac
18712
18713 while $test "$cont"; do
18714         rp="Use which function to generate random numbers?"
18715         . ./myread
18716         if $test "$ans" = "$dflt"; then
18717                 : null
18718         else
18719                 randbits=''
18720         fi
18721         randfunc="$ans"
18722         if set $ans val -f; eval $csym; $val; then
18723                 cont=''
18724         else
18725                 dflt=y
18726                 rp="I cannot find function $ans. Use that name anyway?"
18727                 . ./myread
18728                 dflt=rand
18729                 case "$ans" in
18730                         [yY]*) cont='';;
18731                 esac
18732         fi
18733         case "$cont" in
18734         '')
18735                 case "$randfunc" in
18736                 drand48)
18737                         drand01="drand48()"
18738                         seedfunc="srand48"
18739                         randbits=48
18740                         randseedtype=long
18741                         ;;
18742                 rand|random)
18743                         case "$randbits" in
18744                         '')
18745 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18746                                 $cat >try.c <<EOCP
18747 #$i_unistd I_UNISTD
18748 #$i_stdlib I_STDLIB
18749 #include <stdio.h>
18750 #ifdef I_UNISTD
18751 #  include <unistd.h>
18752 #endif
18753 #ifdef I_STDLIB
18754 #  include <stdlib.h>
18755 #endif
18756 int main()
18757 {
18758         register int i;
18759         register unsigned long tmp;
18760         register unsigned long max = 0L;
18761
18762         for (i = 1000; i; i--) {
18763                 tmp = (unsigned long) $randfunc();
18764                 if (tmp > max) max = tmp;
18765         }
18766         for (i = 0; max; i++)
18767                 max /= 2;
18768         printf("%d\n",i);
18769 }
18770 EOCP
18771                                 set try
18772                                 if eval $compile_ok; then
18773                                         dflt=`try`
18774                                 else
18775                                         dflt='?'
18776                                         echo "(I can't seem to compile the test program...)"
18777                                 fi
18778                                 ;;
18779                         *)
18780                                 dflt="$randbits"
18781                                 ;;
18782                         esac
18783                         rp="How many bits does your $randfunc() function produce?"
18784                         . ./myread
18785                         randbits="$ans"
18786                         $rm_try
18787                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18788                         seedfunc="s$randfunc"
18789                         randseedtype=unsigned
18790                         ;;
18791                 *)
18792                         dflt="31"
18793                         rp="How many bits does your $randfunc() function produce?"
18794                         . ./myread
18795                         randbits="$ans"
18796                         seedfunc="s$randfunc"
18797                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18798                         if set $seedfunc val -f; eval $csym; $val; then
18799                                 echo "(Using $seedfunc() to seed random generator)"
18800                         else
18801                                 echo "(Warning: no $seedfunc() to seed random generator)"
18802                                 seedfunc=rand
18803                         fi
18804                         randseedtype=unsigned
18805                         ;;
18806                 esac
18807                 ;;
18808         esac
18809 done
18810
18811 : Determine if this is an EBCDIC system
18812 echo " "
18813 echo "Determining whether or not we are on an EBCDIC system..." >&4
18814 $cat >try.c <<'EOM'
18815 int main()
18816 {
18817   if ('M'==0xd4) return 0;
18818   return 1;
18819 }
18820 EOM
18821
18822 val=$undef
18823 set try
18824 if eval $compile_ok; then
18825         if $run ./try; then
18826                 echo "You seem to speak EBCDIC." >&4
18827                 val="$define"
18828         else
18829                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18830         fi
18831 else
18832         echo "I'm unable to compile the test program." >&4
18833         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18834 fi
18835 $rm_try
18836 set ebcdic
18837 eval $setvar
18838
18839 : Check how to flush
18840 echo " "
18841 $cat >&4 <<EOM
18842 Checking how to flush all pending stdio output...
18843 EOM
18844 # I only know how to find the first 32 possibly open files on SunOS.
18845 # See also hints/sunos_4_1.sh and util.c  --AD
18846 case "$osname" in
18847 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18848 esac
18849 $cat >>try.c <<EOCP
18850 #include <stdio.h>
18851 #$i_stdlib I_STDLIB
18852 #ifdef I_STDLIB
18853 #include <stdlib.h>
18854 #endif
18855 #$i_unistd I_UNISTD
18856 #ifdef I_UNISTD
18857 # include <unistd.h>
18858 #endif
18859 #$d_sysconf HAS_SYSCONF
18860 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18861 #ifdef HAS_STDIO_STREAM_ARRAY
18862 # define STDIO_STREAM_ARRAY $stdio_stream_array
18863 #endif
18864 int main() {
18865   FILE* p;
18866   unlink("try.out");
18867   p = fopen("try.out", "w");
18868 #ifdef TRY_FPUTC
18869   fputc('x', p);
18870 #else
18871 # ifdef TRY_FPRINTF
18872   fprintf(p, "x");
18873 # endif
18874 #endif
18875 #ifdef TRY_FFLUSH_NULL
18876   fflush(NULL);
18877 #endif
18878 #ifdef TRY_FFLUSH_ALL
18879   {
18880     long open_max = -1;
18881 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18882     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18883 # else
18884 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18885     open_max = sysconf(_SC_OPEN_MAX);
18886 #  else
18887 #   ifdef FOPEN_MAX
18888     open_max = FOPEN_MAX;
18889 #   else
18890 #    ifdef OPEN_MAX
18891     open_max = OPEN_MAX;
18892 #    else
18893 #     ifdef _NFILE
18894     open_max = _NFILE;
18895 #     endif
18896 #    endif
18897 #   endif
18898 #  endif
18899 # endif
18900 # ifdef HAS_STDIO_STREAM_ARRAY
18901     if (open_max > 0) {
18902       long i;
18903       for (i = 0; i < open_max; i++)
18904             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18905                 STDIO_STREAM_ARRAY[i]._file < open_max &&
18906                 STDIO_STREAM_ARRAY[i]._flag)
18907                 fflush(&STDIO_STREAM_ARRAY[i]);
18908     }
18909   }
18910 # endif
18911 #endif
18912   _exit(42);
18913 }
18914 EOCP
18915 : first we have to find out how _not_ to flush
18916 $to try.c
18917 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18918     output=''
18919     set try -DTRY_FPUTC
18920     if eval $compile; then
18921             $run ./try 2>/dev/null
18922             code="$?"
18923             $from try.out
18924             if $test ! -s try.out -a "X$code" = X42; then
18925                 output=-DTRY_FPUTC
18926             fi
18927     fi
18928     case "$output" in
18929     '')
18930             set try -DTRY_FPRINTF
18931             if eval $compile; then
18932                     $run ./try 2>/dev/null
18933                     code="$?"
18934                     $from try.out
18935                     if $test ! -s try.out -a "X$code" = X42; then
18936                         output=-DTRY_FPRINTF
18937                     fi
18938             fi
18939         ;;
18940     esac
18941 fi
18942 : check for fflush NULL behaviour
18943 case "$fflushNULL" in
18944 '')     set try -DTRY_FFLUSH_NULL $output
18945         if eval $compile; then
18946                 $run ./try 2>/dev/null
18947                 code="$?"
18948                 $from try.out
18949                 if $test -s try.out -a "X$code" = X42; then
18950                         fflushNULL="`$cat try.out`"
18951                 else
18952                         if $test "X$code" != X42; then
18953                                 $cat >&4 <<EOM
18954 (If this test failed, don't worry, we'll try another method shortly.)
18955 EOM
18956                         fi
18957                 fi
18958         fi
18959         $rm_try
18960         case "$fflushNULL" in
18961         x)      $cat >&4 <<EOM
18962 Your fflush(NULL) works okay for output streams.
18963 Let's see if it clobbers input pipes...
18964 EOM
18965 # As of mid-March 2000 all versions of Solaris appear to have a stdio
18966 # bug that improperly flushes the input end of pipes.  So we avoid the
18967 # autoflush on fork/system/exec support for now. :-(
18968 $cat >tryp.c <<EOCP
18969 #include <stdio.h>
18970 int
18971 main(int argc, char **argv)
18972 {
18973     char buf[1024];
18974     int i;
18975     char *bp = buf;
18976     while (1) {
18977         while ((i = getc(stdin)) != -1
18978                && (*bp++ = i) != '\n'
18979                && bp < &buf[1024])
18980         /* DO NOTHING */ ;
18981         *bp = '\0';
18982         fprintf(stdout, "%s", buf);
18983         fflush(NULL);
18984         if (i == -1)
18985             return 0;
18986         bp = buf;
18987     }
18988 }
18989 EOCP
18990                 fflushNULL="$define"
18991                 set tryp
18992                 if eval $compile; then
18993                     $rm -f tryp.out
18994                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18995                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
18996                        $cat >&4 <<EOM
18997 fflush(NULL) seems to behave okay with input streams.
18998 EOM
18999                         fflushNULL="$define"
19000                     else
19001                         $cat >&4 <<EOM
19002 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19003 EOM
19004                         fflushNULL="$undef"
19005                     fi
19006                 fi
19007                 $rm -f core tryp.c tryp.core core.tryp.*
19008                 ;;
19009         '')     $cat >&4 <<EOM
19010 Your fflush(NULL) isn't working (contrary to ANSI C).
19011 EOM
19012                 fflushNULL="$undef"
19013                 ;;
19014         *)      $cat >&4 <<EOM
19015 Cannot figure out whether your fflush(NULL) works or not.
19016 I'm assuming it doesn't (contrary to ANSI C).
19017 EOM
19018                 fflushNULL="$undef"
19019                 ;;
19020         esac
19021         ;;
19022 $define|true|[yY]*)
19023         fflushNULL="$define"
19024         ;;
19025 *)
19026         fflushNULL="$undef"
19027         ;;
19028 esac
19029 : check explicit looping only if NULL did not work, and if the pipe
19030 : bug does not show up on an explicit flush too
19031 case "$fflushNULL" in
19032 "$undef")
19033         $cat >tryp.c <<EOCP
19034 #include <stdio.h>
19035 int
19036 main(int argc, char **argv)
19037 {
19038     char buf[1024];
19039     int i;
19040     char *bp = buf;
19041     while (1) {
19042         while ((i = getc(stdin)) != -1
19043                && (*bp++ = i) != '\n'
19044                && bp < &buf[1024])
19045         /* DO NOTHING */ ;
19046         *bp = '\0';
19047         fprintf(stdout, "%s", buf);
19048         fflush(stdin);
19049         if (i == -1)
19050             return 0;
19051         bp = buf;
19052     }
19053 }
19054 EOCP
19055         set tryp
19056         if eval $compile; then
19057             $rm -f tryp.out
19058             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19059             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19060                $cat >&4 <<EOM
19061 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19062 EOM
19063                 : now check for fflushall behaviour
19064                 case "$fflushall" in
19065                 '')     set try -DTRY_FFLUSH_ALL $output
19066                         if eval $compile; then
19067                                 $cat >&4 <<EOM
19068 (Now testing the other method--but note that this also may fail.)
19069 EOM
19070                                 $run ./try 2>/dev/null
19071                                 code=$?
19072                                 $from try.out
19073                                 if $test -s try.out -a "X$code" = X42; then
19074                                         fflushall="`$cat try.out`"
19075                                 fi
19076                         fi
19077                         $rm_try
19078                         case "$fflushall" in
19079                         x)      $cat >&4 <<EOM
19080 Whew. Flushing explicitly all the stdio streams works.
19081 EOM
19082                                 fflushall="$define"
19083                                 ;;
19084                         '')     $cat >&4 <<EOM
19085 Sigh. Flushing explicitly all the stdio streams doesn't work.
19086 EOM
19087                                 fflushall="$undef"
19088                                 ;;
19089                         *)      $cat >&4 <<EOM
19090 Cannot figure out whether flushing stdio streams explicitly works or not.
19091 I'm assuming it doesn't.
19092 EOM
19093                                 fflushall="$undef"
19094                                 ;;
19095                         esac
19096                         ;;
19097                 "$define"|true|[yY]*)
19098                         fflushall="$define"
19099                         ;;
19100                 *)
19101                         fflushall="$undef"
19102                         ;;
19103                 esac
19104             else
19105                 $cat >&4 <<EOM
19106 All is futile.  Even fflush(stdin) clobbers input pipes!
19107 EOM
19108                 fflushall="$undef"
19109             fi
19110         else
19111             fflushall="$undef"
19112         fi
19113         $rm -f core tryp.c tryp.core core.tryp.*
19114         ;;
19115 *)      fflushall="$undef"
19116         ;;
19117 esac
19118
19119 case "$fflushNULL$fflushall" in
19120 undefundef)
19121         $cat <<EOM
19122 OK, I give up.  I cannot figure out how to flush pending stdio output.
19123 We won't be flushing handles at all before fork/exec/popen.
19124 EOM
19125         ;;
19126 esac
19127 $rm_try tryp
19128
19129 : Store the full pathname to the ar program for use in the C program
19130 : Respect a hint or command line value for full_ar.
19131 case "$full_ar" in
19132 '') full_ar=$ar ;;
19133 esac
19134
19135 : Store the full pathname to the sed program for use in the C program
19136 full_sed=$sed
19137
19138 : see what type gids are declared as in the kernel
19139 echo " "
19140 echo "Looking for the type for group ids returned by getgid()."
19141 set gid_t gidtype xxx stdio.h sys/types.h
19142 eval $typedef
19143 case "$gidtype" in
19144 xxx)
19145         xxx=`./findhdr sys/user.h`
19146         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19147         case $1 in
19148         unsigned) dflt="$1 $2" ;;
19149         *) dflt="$1" ;;
19150         esac
19151         ;;
19152 *) dflt="$gidtype";;
19153 esac
19154 case "$gidtype" in
19155 gid_t) echo "gid_t found." ;;
19156 *)      rp="What is the type for group ids returned by getgid()?"
19157         . ./myread
19158         gidtype="$ans"
19159         ;;
19160 esac
19161
19162 : Check the size of GID
19163 echo " "
19164 case "$gidtype" in
19165 *_t) zzz="$gidtype"     ;;
19166 *)   zzz="gid"          ;;
19167 esac
19168 echo "Checking the size of $zzz..." >&4
19169 cat > try.c <<EOCP
19170 #include <sys/types.h>
19171 #include <stdio.h>
19172 #$i_stdlib I_STDLIB
19173 #ifdef I_STDLIB
19174 #include <stdlib.h>
19175 #endif
19176 int main() {
19177     printf("%d\n", (int)sizeof($gidtype));
19178     exit(0);
19179 }
19180 EOCP
19181 set try
19182 if eval $compile_ok; then
19183         yyy=`$run ./try`
19184         case "$yyy" in
19185         '')     gidsize=4
19186                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19187                 ;;
19188         *)      gidsize=$yyy
19189                 echo "Your $zzz is $gidsize bytes long."
19190                 ;;
19191         esac
19192 else
19193         gidsize=4
19194         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19195 fi
19196
19197
19198 : Check if GID is signed
19199 echo " "
19200 case "$gidtype" in
19201 *_t) zzz="$gidtype"     ;;
19202 *)   zzz="gid"          ;;
19203 esac
19204 echo "Checking the sign of $zzz..." >&4
19205 cat > try.c <<EOCP
19206 #include <sys/types.h>
19207 #include <stdio.h>
19208 int main() {
19209         $gidtype foo = -1;
19210         if (foo < 0)
19211                 printf("-1\n");
19212         else
19213                 printf("1\n");
19214 }
19215 EOCP
19216 set try
19217 if eval $compile; then
19218         yyy=`$run ./try`
19219         case "$yyy" in
19220         '')     gidsign=1
19221                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19222                 ;;
19223         *)      gidsign=$yyy
19224                 case "$gidsign" in
19225                  1) echo "Your $zzz is unsigned." ;;
19226                 -1) echo "Your $zzz is signed."   ;;
19227                 esac
19228                 ;;
19229         esac
19230 else
19231         gidsign=1
19232         echo "(I can't compile the test program--guessing unsigned.)" >&4
19233 fi
19234
19235
19236 : Check 64bit sizes
19237 echo " "
19238
19239 if $test X"$quadtype" != X; then
19240
19241 echo "Checking how to print 64-bit integers..." >&4
19242
19243 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19244         $cat >try.c <<'EOCP'
19245 #include <sys/types.h>
19246 #include <stdio.h>
19247 int main() {
19248   int q = 12345678901;
19249   printf("%ld\n", q);
19250 }
19251 EOCP
19252         set try
19253         if eval $compile; then
19254                 yyy=`$run ./try`
19255                 case "$yyy" in
19256                 12345678901)
19257                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19258                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19259                         echo "We will use %d."
19260                         ;;
19261                 esac
19262         fi
19263 fi
19264
19265 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19266         $cat >try.c <<'EOCP'
19267 #include <sys/types.h>
19268 #include <stdio.h>
19269 int main() {
19270   long q = 12345678901;
19271   printf("%ld\n", q);
19272 }
19273 EOCP
19274         set try
19275         if eval $compile; then
19276                 yyy=`$run ./try`
19277                 case "$yyy" in
19278                 12345678901)
19279                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19280                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19281                         echo "We will use %ld."
19282                         ;;
19283                 esac
19284         fi
19285 fi
19286
19287 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19288         $cat >try.c <<'EOCP'
19289 #include <sys/types.h>
19290 #include <inttypes.h>
19291 #include <stdio.h>
19292 int main() {
19293   int64_t q = 12345678901;
19294   printf("%" PRId64 "\n", q);
19295 }
19296 EOCP
19297         set try
19298         if eval $compile; then
19299                 yyy=`$run ./try`
19300                 case "$yyy" in
19301                 12345678901)
19302                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19303                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19304                         echo "We will use the C9X style."
19305                         ;;
19306                 esac
19307         fi
19308 fi
19309
19310 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19311         $cat >try.c <<EOCP
19312 #include <sys/types.h>
19313 #include <stdio.h>
19314 int main() {
19315   $quadtype q = 12345678901;
19316   printf("%Ld\n", q);
19317 }
19318 EOCP
19319         set try
19320         if eval $compile; then
19321                 yyy=`$run ./try`
19322                 case "$yyy" in
19323                 12345678901)
19324                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19325                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19326                         echo "We will use %Ld."
19327                         ;;
19328                 esac
19329         fi
19330 fi
19331
19332 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19333         $cat >try.c <<'EOCP'
19334 #include <sys/types.h>
19335 #include <stdio.h>
19336 int main() {
19337   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19338   printf("%lld\n", q);
19339 }
19340 EOCP
19341         set try
19342         if eval $compile; then
19343                 yyy=`$run ./try`
19344                 case "$yyy" in
19345                 12345678901)
19346                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19347                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19348                         echo "We will use the %lld style."
19349                         ;;
19350                 esac
19351         fi
19352 fi
19353
19354 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19355         $cat >try.c <<EOCP
19356 #include <sys/types.h>
19357 #include <stdio.h>
19358 int main() {
19359   $quadtype q = 12345678901;
19360   printf("%qd\n", q);
19361 }
19362 EOCP
19363         set try
19364         if eval $compile; then
19365                 yyy=`$run ./try`
19366                 case "$yyy" in
19367                 12345678901)
19368                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19369                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19370                         echo "We will use %qd."
19371                         ;;
19372                 esac
19373         fi
19374 fi
19375
19376 if $test X"$sPRId64" = X; then
19377         echo "Cannot figure out how to print 64-bit integers." >&4
19378 fi
19379 $rm_try
19380
19381 fi
19382
19383 case "$sPRId64" in
19384 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19385         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19386         ;;
19387 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19388         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19389         ;;
19390 esac
19391
19392 : Check format strings for internal types
19393 echo " "
19394 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19395
19396 if $test X"$ivsize" = X8; then
19397         ivdformat="$sPRId64"
19398         uvuformat="$sPRIu64"
19399         uvoformat="$sPRIo64"
19400         uvxformat="$sPRIx64"
19401         uvXUformat="$sPRIXU64"
19402 else
19403         if $test X"$ivsize" = X"$longsize"; then
19404                 ivdformat='"ld"'
19405                 uvuformat='"lu"'
19406                 uvoformat='"lo"'
19407                 uvxformat='"lx"'
19408                 uvXUformat='"lX"'
19409         else
19410                 if $test X"$ivsize" = X"$intsize"; then
19411                         ivdformat='"d"'
19412                         uvuformat='"u"'
19413                         uvoformat='"o"'
19414                         uvxformat='"x"'
19415                         uvXUformat='"X"'
19416                 else
19417                         : far out
19418                         if $test X"$ivsize" = X"$shortsize"; then
19419                                 ivdformat='"hd"'
19420                                 uvuformat='"hu"'
19421                                 uvoformat='"ho"'
19422                                 uvxformat='"hx"'
19423                                 uvXUformat='"hX"'
19424                         fi
19425                 fi
19426         fi
19427 fi
19428
19429 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19430         nveformat="$sPRIeldbl"
19431         nvfformat="$sPRIfldbl"
19432         nvgformat="$sPRIgldbl"
19433         nvEUformat="$sPRIEUldbl"
19434         nvFUformat="$sPRIFUldbl"
19435         nvGUformat="$sPRIGUldbl"
19436 else
19437         nveformat='"e"'
19438         nvfformat='"f"'
19439         nvgformat='"g"'
19440         nvEUformat='"E"'
19441         nvFUformat='"F"'
19442         nvGUformat='"G"'
19443 fi
19444
19445 case "$ivdformat" in
19446 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19447     exit 1
19448     ;;
19449 esac
19450
19451 : Check format string for GID
19452
19453 echo " "
19454 $echo "Checking the format string to be used for gids..." >&4
19455
19456 case "$gidsign" in
19457 -1)     if $test X"$gidsize" = X"$ivsize"; then
19458                 gidformat="$ivdformat"
19459         else
19460                 if $test X"$gidsize" = X"$longsize"; then
19461                         gidformat='"ld"'
19462                 else
19463                         if $test X"$gidsize" = X"$intsize"; then
19464                                 gidformat='"d"'
19465                         else
19466                                 if $test X"$gidsize" = X"$shortsize"; then
19467                                         gidformat='"hd"'
19468                                 fi
19469                         fi
19470                 fi
19471         fi
19472         ;;
19473 *)      if $test X"$gidsize" = X"$uvsize"; then
19474                 gidformat="$uvuformat"
19475         else
19476                 if $test X"$gidsize" = X"$longsize"; then
19477                         gidformat='"lu"'
19478                 else
19479                         if $test X"$gidsize" = X"$intsize"; then
19480                                 gidformat='"u"'
19481                         else
19482                                 if $test X"$gidsize" = X"$shortsize"; then
19483                                         gidformat='"hu"'
19484                                 fi
19485                         fi
19486                 fi
19487         fi
19488         ;;
19489 esac
19490
19491 : see if getgroups exists
19492 set getgroups d_getgrps
19493 eval $inlibc
19494
19495 : see if setgroups exists
19496 set setgroups d_setgrps
19497 eval $inlibc
19498
19499 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19500 echo " "
19501 case "$d_getgrps$d_setgrps" in
19502 *define*)
19503         case "$groupstype" in
19504         '') dflt="$gidtype" ;;
19505         *)  dflt="$groupstype" ;;
19506         esac
19507         $cat <<EOM
19508 What type of pointer is the second argument to getgroups() and setgroups()?
19509 Usually this is the same as group ids, $gidtype, but not always.
19510
19511 EOM
19512         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19513         . ./myread
19514         groupstype="$ans"
19515         ;;
19516 *)  groupstype="$gidtype";;
19517 esac
19518
19519 : MAD = Misc Attribute Definition
19520
19521 if $test $patchlevel -lt 9; then
19522 : MAD is not available in 5.8.x or earlier.
19523     ans=n;
19524 else
19525     case "$mad" in
19526     $define|true|[yY]*) dflt='y' ;;
19527     *)                  dflt='n' ;;
19528     esac
19529     cat <<EOM
19530
19531 Would you like to build with Misc Attribute Decoration? This is development
19532 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19533 overhead on the interpreter.
19534
19535 If this doesn't make any sense to you, just accept the default '$dflt'.
19536 EOM
19537     rp='Build Perl with MAD?'
19538     . ./myread
19539 fi
19540 case "$ans" in
19541 y|Y)    val="$define"
19542         madlyh='madly.h madly.act madly.tab'
19543         madlysrc='madly.c'
19544         madlyobj="madly$_o" ;;
19545 *)      val="$undef"
19546         madlyh=''
19547         madlysrc=''
19548         madlyobj='' ;;
19549 esac
19550 set mad
19551 eval $setvar
19552
19553 echo " "
19554 echo "Checking if your $make program sets \$(MAKE)..." >&4
19555 case "$make_set_make" in
19556 '')
19557         $sed 's/^X //' > testmake.mak << 'EOF'
19558 Xall:
19559 X       @echo 'maketemp="$(MAKE)"'
19560 EOF
19561         case "`$make -f testmake.mak 2>/dev/null`" in
19562         *maketemp=*) make_set_make='#' ;;
19563         *)      make_set_make="MAKE=$make" ;;
19564         esac
19565         $rm -f testmake.mak
19566         ;;
19567 esac
19568 case "$make_set_make" in
19569 '#') echo "Yup, it does.";;
19570 *) echo "Nope, it doesn't.";;
19571 esac
19572
19573 : see what type is used for mode_t
19574 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19575 set mode_t modetype int stdio.h sys/types.h
19576 eval $typedef_ask
19577
19578 : see if we need va_copy
19579 echo " "
19580 case "$i_stdarg" in
19581 "$define")
19582         $cat >try.c <<EOCP
19583 #include <stdarg.h>
19584 #include <stdio.h>
19585 #$i_stdlib I_STDLIB
19586 #ifdef I_STDLIB
19587 #include <stdlib.h>
19588 #endif
19589 #include <signal.h>
19590
19591 int
19592 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19593 {
19594   return vfprintf(f, fmt, *valp);
19595 }
19596
19597 int
19598 myvfprintf(FILE *f, const  char *fmt, va_list val)
19599 {
19600   return ivfprintf(f, fmt, &val);
19601 }
19602
19603 int
19604 myprintf(char *fmt, ...)
19605 {
19606   va_list val;
19607   va_start(val, fmt);
19608   return myvfprintf(stdout, fmt, val);
19609 }
19610
19611 int
19612 main(int ac, char **av)
19613 {
19614   signal(SIGSEGV, exit);
19615
19616   myprintf("%s%cs all right, then\n", "that", '\'');
19617   exit(0);
19618 }
19619 EOCP
19620         set try
19621         if eval $compile && $run ./try 2>&1 >/dev/null; then
19622                 case "`$run ./try`" in
19623                 "that's all right, then")
19624                         okay=yes
19625                         ;;
19626                 esac
19627         fi
19628         case "$okay" in
19629         yes)    echo "It seems that you don't need va_copy()." >&4
19630                 need_va_copy="$undef"
19631                 ;;
19632         *)      echo "It seems that va_copy() or similar will be needed." >&4
19633                 need_va_copy="$define"
19634                 ;;
19635         esac
19636         $rm_try
19637         ;;
19638 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19639         ;;
19640 esac
19641
19642 : see what type is used for size_t
19643 rp="What is the type used for the length parameter for string functions?"
19644 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19645 eval $typedef_ask
19646
19647 : check for type of arguments to gethostbyaddr. 
19648 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19649         case "$d_gethbyaddr" in
19650         $define)
19651                 $cat <<EOM
19652
19653 Checking to see what type of arguments are accepted by gethostbyaddr().
19654 EOM
19655                 hdrs="$define sys/types.h
19656                         $d_socket sys/socket.h 
19657                         $i_niin netinet/in.h 
19658                         $i_netdb netdb.h
19659                         $i_unistd unistd.h"
19660                 : The first arg can 'char *' or 'void *'
19661                 : The second arg is some of integral type
19662                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19663                         for yyy in size_t long int; do
19664                                 case "$netdb_host_type" in
19665                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19666                                         if ./protochk "$try" $hdrs; then
19667                                                 echo "Your system accepts $xxx for the first arg."
19668                                                 echo "...and $yyy for the second arg."
19669                                                 netdb_host_type="$xxx"
19670                                                 netdb_hlen_type="$yyy"
19671                                         fi
19672                                         ;;
19673                                 esac
19674                         done
19675                 done
19676                 : In case none of those worked, prompt the user.
19677                 case "$netdb_host_type" in
19678                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19679                         dflt='char *'
19680                         . ./myread
19681                         netdb_host_type=$ans
19682                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19683                         dflt="$sizetype"
19684                         . ./myread
19685                         netdb_hlen_type=$ans
19686                         ;;
19687                 esac
19688                 ;;
19689         *)      : no gethostbyaddr, so pick harmless defaults
19690                 netdb_host_type='char *'
19691                 netdb_hlen_type="$sizetype"
19692                 ;;
19693         esac
19694         # Remove the "const" if needed. -- but then we'll have a 
19695         # prototype clash!
19696         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19697 fi
19698
19699 : check for type of argument to gethostbyname. 
19700 if test "X$netdb_name_type" = X ; then
19701         case "$d_gethbyname" in
19702         $define)
19703                 $cat <<EOM
19704
19705 Checking to see what type of argument is accepted by gethostbyname().
19706 EOM
19707                 hdrs="$define sys/types.h
19708                         $d_socket sys/socket.h 
19709                         $i_niin netinet/in.h 
19710                         $i_netdb netdb.h
19711                         $i_unistd unistd.h"
19712                 for xxx in "const char *" "char *"; do
19713                         case "$netdb_name_type" in
19714                         '')     try="extern struct hostent *gethostbyname($xxx);"
19715                                 if ./protochk "$try" $hdrs; then
19716                                         echo "Your system accepts $xxx."
19717                                         netdb_name_type="$xxx"
19718                                 fi
19719                                 ;;
19720                         esac
19721                 done
19722                 : In case none of those worked, prompt the user.
19723                 case "$netdb_name_type" in
19724                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19725                         dflt='char *'
19726                         . ./myread
19727                         netdb_name_type=$ans
19728                         ;;
19729                 esac
19730                 ;;
19731         *)      : no gethostbyname, so pick harmless default
19732                 netdb_name_type='char *'
19733                 ;;
19734         esac
19735 fi
19736
19737 : check for type of 1st argument to getnetbyaddr. 
19738 if test "X$netdb_net_type" = X ; then
19739         case "$d_getnbyaddr" in
19740         $define)
19741                 $cat <<EOM
19742
19743 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19744 EOM
19745                 hdrs="$define sys/types.h
19746                         $d_socket sys/socket.h 
19747                         $i_niin netinet/in.h 
19748                         $i_netdb netdb.h
19749                         $i_unistd unistd.h"
19750                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19751                         case "$netdb_net_type" in
19752                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19753                                 if ./protochk "$try" $hdrs; then
19754                                         echo "Your system accepts $xxx."
19755                                         netdb_net_type="$xxx"
19756                                 fi
19757                                 ;;
19758                         esac
19759                 done
19760                 : In case none of those worked, prompt the user.
19761                 case "$netdb_net_type" in
19762                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19763                         dflt='long'
19764                         . ./myread
19765                         netdb_net_type=$ans
19766                         ;;
19767                 esac
19768                 ;;
19769         *)      : no getnetbyaddr, so pick harmless default
19770                 netdb_net_type='long'
19771                 ;;
19772         esac
19773 fi
19774 : locate the preferred pager for this system
19775 fn=f/
19776 case "$pager" in
19777 '')
19778         dflt=''
19779         case "$pg" in
19780         /*) dflt=$pg;;
19781         [a-zA-Z]:/*) dflt=$pg;;
19782         esac
19783         case "$more" in
19784         /*) dflt=$more;;
19785         [a-zA-Z]:/*) dflt=$more;;
19786         esac
19787         case "$less" in
19788         /*) dflt=$less;;
19789         [a-zA-Z]:/*) dflt=$less;;
19790         esac
19791         case "$dflt" in
19792         '') dflt=/usr/ucb/more;;
19793         esac
19794         ;;
19795 *)      dflt="$pager"
19796         : Instruct ./getfile to trust the hinted or previous pager value,
19797         : even if it does not begin with a slash.  For example, on os2,
19798         : pager might be cmd /c more.  See comments in UU/getfile.
19799         fn="f/($pager)"
19800         ;;
19801 esac
19802 echo " "
19803 rp='What pager is used on your system?'
19804 . ./getfile
19805 pager="$ans"
19806
19807 : see what type pids are declared as in the kernel
19808 rp="What is the type of process ids on this system?"
19809 set pid_t pidtype int stdio.h sys/types.h
19810 eval $typedef_ask
19811
19812 : see if ar generates random libraries by itself
19813 echo " "
19814 echo "Checking how to generate random libraries on your machine..." >&4
19815 echo 'int bar1() { return bar2(); }' > bar1.c
19816 echo 'int bar2() { return 2; }' > bar2.c
19817 $cat > foo.c <<EOP
19818 #$i_stdlib I_STDLIB
19819 #ifdef I_STDLIB
19820 #include <stdlib.h>
19821 #endif
19822 int main() { printf("%d\n", bar1()); exit(0); }
19823 EOP
19824 $cc $ccflags -c bar1.c >/dev/null 2>&1
19825 $cc $ccflags -c bar2.c >/dev/null 2>&1
19826 $cc $ccflags -c foo.c >/dev/null 2>&1
19827 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19828 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19829         $run ./foobar >/dev/null 2>&1; then
19830         echo "$ar appears to generate random libraries itself."
19831         orderlib=false
19832         if [ "X$ranlib" = "X" ]; then
19833             ranlib=":"
19834         fi
19835 elif $ar s 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 s'."
19839                 orderlib=false
19840                 ranlib="$ar s"
19841 elif $ar ts bar$_a >/dev/null 2>&1 &&
19842         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19843         $run ./foobar >/dev/null 2>&1; then
19844                 echo "a table of contents needs to be added with '$ar ts'."
19845                 orderlib=false
19846                 ranlib="$ar ts"
19847 else
19848         case "$ranlib" in
19849         :) ranlib='';;
19850         '')
19851                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19852                 $test -f $ranlib || ranlib=''
19853                 ;;
19854         esac
19855         if $test -n "$ranlib"; then
19856                 echo "your system has '$ranlib'; we'll use that."
19857                 orderlib=false
19858         else
19859                 echo "your system doesn't seem to support random libraries"
19860                 echo "so we'll use lorder and tsort to order the libraries."
19861                 orderlib=true
19862                 ranlib=":"
19863         fi
19864 fi
19865 $rm -f foo* bar*
19866
19867 : check for type of arguments to select.
19868 case "$selecttype" in
19869 '') case "$d_select" in
19870         $define)
19871                 echo " "
19872                 $cat <<EOM
19873 Checking to see what type of arguments are accepted by select().
19874 EOM
19875                 hdrs="$define sys/types.h
19876                         $i_systime sys/time.h
19877                         $i_sysselct sys/select.h
19878                         $d_socket sys/socket.h"
19879                 : The first arg can be int, unsigned, or size_t
19880                 : The last arg may or may not be 'const'
19881                 val=''
19882                 : void pointer has been seen but using that
19883                 : breaks the selectminbits test
19884                 for xxx in 'fd_set *' 'int *'; do
19885                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19886                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
19887                                         case "$val" in
19888                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19889                                                 if ./protochk "$try" $hdrs; then
19890                                                         echo "Your system accepts $xxx."
19891                                                         val="$xxx"
19892                                                 fi
19893                                                 ;;
19894                                         esac
19895                                 done
19896                         done
19897                 done
19898                 case "$val" in
19899                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19900                         case "$d_fd_set" in
19901                                 $define) dflt="fd_set *" ;;
19902                                 *)              dflt="int *" ;;
19903                         esac
19904                         . ./myread
19905                         val=$ans
19906                         ;;
19907                 esac
19908                 selecttype="$val"
19909                 ;;
19910         *)      : no select, so pick a harmless default
19911                 selecttype='int *'
19912                 ;;
19913         esac
19914         ;;
19915 esac
19916
19917 : check for the select 'width'
19918 case "$selectminbits" in
19919 '') safebits=`expr $ptrsize \* 8`
19920     case "$d_select" in
19921         $define)
19922                 $cat <<EOM
19923
19924 Checking to see on how many bits at a time your select() operates...
19925 EOM
19926                 $cat >try.c <<EOCP
19927 #include <sys/types.h>
19928 #$i_time I_TIME
19929 #$i_systime I_SYS_TIME
19930 #$i_systimek I_SYS_TIME_KERNEL
19931 #ifdef I_TIME
19932 #   include <time.h>
19933 #endif
19934 #ifdef I_SYS_TIME
19935 #   ifdef I_SYS_TIME_KERNEL
19936 #       define KERNEL
19937 #   endif
19938 #   include <sys/time.h>
19939 #   ifdef I_SYS_TIME_KERNEL
19940 #       undef KERNEL
19941 #   endif
19942 #endif
19943 #$i_sysselct I_SYS_SELECT
19944 #ifdef I_SYS_SELECT
19945 #include <sys/select.h>
19946 #endif
19947 #$d_socket HAS_SOCKET
19948 #ifdef HAS_SOCKET
19949 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19950 #endif
19951 #include <stdio.h>
19952 #$i_stdlib I_STDLIB
19953 #ifdef I_STDLIB
19954 #include <stdlib.h>
19955 #endif
19956 $selecttype b;
19957 #define S sizeof(*(b))
19958 #define MINBITS 64
19959 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19960 #define NBITS  (NBYTES * 8)
19961 int main() {
19962     char *s = (char *)malloc(NBYTES);
19963     struct timeval t;
19964     int i;
19965     FILE* fp;
19966     int fd;
19967
19968     if (!s)
19969         exit(1);
19970     fclose(stdin);
19971     fp = fopen("try.c", "r");
19972     if (fp == 0)
19973       exit(2);
19974     fd = fileno(fp);
19975     if (fd < 0)
19976       exit(3);
19977     b = ($selecttype)s;
19978     for (i = 0; i < NBITS; i++)
19979         FD_SET(i, b);
19980     t.tv_sec  = 0;
19981     t.tv_usec = 0;
19982     select(fd + 1, b, 0, 0, &t);
19983     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
19984     free(s);
19985     printf("%d\n", i + 1);
19986     return 0;
19987 }
19988 EOCP
19989                 set try
19990                 if eval $compile_ok; then
19991                         selectminbits=`$run ./try`
19992                         case "$selectminbits" in
19993                         '')     cat >&4 <<EOM
19994 Cannot figure out on how many bits at a time your select() operates.
19995 I'll play safe and guess it is $safebits bits.
19996 EOM
19997                                 selectminbits=$safebits
19998                                 bits="$safebits bits"
19999                                 ;;
20000                         1)      bits="1 bit" ;;
20001                         *)      bits="$selectminbits bits" ;;
20002                         esac
20003                         echo "Your select() operates on $bits at a time." >&4
20004                 else
20005                         rp='What is the minimum number of bits your select() operates on?'
20006                         case "$byteorder" in
20007                         12345678)       dflt=64 ;;
20008                         1234)           dflt=32 ;;
20009                         *)              dflt=1  ;;
20010                         esac
20011                         . ./myread
20012                         val=$ans
20013                         selectminbits="$val"
20014                 fi
20015                 $rm_try
20016                 ;;
20017         *)      : no select, so pick a harmless default
20018                 selectminbits=$safebits
20019                 ;;
20020         esac
20021         ;;
20022 esac
20023
20024 : Trace out the files included by signal.h, then look for SIGxxx names.
20025 : Remove SIGARRAYSIZE used by HPUX.
20026 : Remove SIGSTKSIZE used by Linux.
20027 : Remove SIGSTKSZ used by Posix.
20028 : Remove SIGTYP void lines used by OS2.
20029 : Some cpps, like os390, dont give the file name anywhere
20030 if [ "X$fieldn" = X ]; then
20031         : Just make some guesses.  We check them later.
20032         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20033 else
20034         xxx=`echo '#include <signal.h>' |
20035         $cppstdin $cppminus $cppflags 2>/dev/null |
20036         $grep '^[       ]*#.*include' |
20037         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20038 fi
20039 : Check this list of files to be sure we have parsed the cpp output ok.
20040 : This will also avoid potentially non-existent files, such
20041 : as ../foo/bar.h
20042 xxxfiles=''
20043 for xx in $xxx /dev/null ; do
20044         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20045 done
20046 : If we have found no files, at least try signal.h
20047 case "$xxxfiles" in
20048 '')     xxxfiles=`./findhdr signal.h` ;;
20049 esac
20050 xxx=`awk '
20051 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20052         print substr($2, 4, 20)
20053 }
20054 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20055         print substr($3, 4, 20)
20056 }' $xxxfiles`
20057 : Append some common names just in case the awk scan failed.
20058 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20059 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20060 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20061 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20062 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20063
20064 : generate a few handy files for later
20065 $cat > signal.c <<EOCP
20066 #include <sys/types.h>
20067 #include <signal.h>
20068 #$i_stdlib I_STDLIB
20069 #ifdef I_STDLIB
20070 #include <stdlib.h>
20071 #endif
20072 #include <stdio.h>
20073 int main() {
20074
20075 /* Strange style to avoid deeply-nested #if/#else/#endif */
20076 #ifndef NSIG
20077 #  ifdef _NSIG
20078 #    define NSIG (_NSIG)
20079 #  endif
20080 #endif
20081
20082 #ifndef NSIG
20083 #  ifdef SIGMAX
20084 #    define NSIG (SIGMAX+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 _SIG_MAX
20096 #    define NSIG (_SIG_MAX+1)
20097 #  endif
20098 #endif
20099
20100 #ifndef NSIG
20101 #  ifdef MAXSIG
20102 #    define NSIG (MAXSIG+1)
20103 #  endif
20104 #endif
20105
20106 #ifndef NSIG
20107 #  ifdef MAX_SIG
20108 #    define NSIG (MAX_SIG+1)
20109 #  endif
20110 #endif
20111
20112 #ifndef NSIG
20113 #  ifdef SIGARRAYSIZE
20114 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20115 #  endif
20116 #endif
20117
20118 #ifndef NSIG
20119 #  ifdef _sys_nsig
20120 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20121 #  endif
20122 #endif
20123
20124 /* Default to some arbitrary number that's big enough to get most
20125    of the common signals.
20126 */
20127 #ifndef NSIG
20128 #    define NSIG 50
20129 #endif
20130
20131 printf("NSIG %d\n", NSIG);
20132
20133 #ifndef JUST_NSIG
20134
20135 EOCP
20136
20137 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20138 {
20139         printf "#ifdef SIG"; printf $1; printf "\n"
20140         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20141         printf $1; printf ");\n"
20142         printf "#endif\n"
20143 }
20144 END {
20145         printf "#endif /* JUST_NSIG */\n";
20146         printf "exit(0);\n}\n";
20147 }
20148 ' >>signal.c
20149 $cat >signal.awk <<'EOP'
20150 BEGIN { ndups = 0 }
20151 $1 ~ /^NSIG$/ { nsig = $2 }
20152 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20153     if ($2 > maxsig) { maxsig = $2 }
20154     if (sig_name[$2]) {
20155         dup_name[ndups] = $1
20156         dup_num[ndups] = $2
20157         ndups++
20158     }
20159     else {
20160         sig_name[$2] = $1
20161         sig_num[$2] = $2
20162     }
20163 }
20164 END {
20165     if (nsig == 0) {
20166         nsig = maxsig + 1
20167     }
20168     printf("NSIG %d\n", nsig);
20169     for (n = 1; n < nsig; n++) {
20170         if (sig_name[n]) {
20171             printf("%s %d\n", sig_name[n], sig_num[n])
20172         }
20173         else {
20174             printf("NUM%d %d\n", n, n)
20175         }
20176     }
20177     for (n = 0; n < ndups; n++) {
20178         printf("%s %d\n", dup_name[n], dup_num[n])
20179     }
20180 }
20181 EOP
20182 $cat >signal_cmd <<EOS
20183 $startsh
20184 if $test -s signal.lst; then
20185     echo "Using your existing signal.lst file"
20186         exit 0
20187 fi
20188 xxx="$xxx"
20189 EOS
20190 $cat >>signal_cmd <<'EOS'
20191
20192 set signal
20193 if eval $compile_ok; then
20194         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
20195 else
20196         echo "(I can't seem be able to compile the whole test program)" >&4
20197         echo "(I'll try it in little pieces.)" >&4
20198         set signal -DJUST_NSIG
20199         if eval $compile_ok; then
20200                 $run ./signal$_exe > signal.nsg
20201                 $cat signal.nsg
20202         else
20203                 echo "I can't seem to figure out how many signals you have." >&4
20204                 echo "Guessing 50." >&4
20205                 echo 'NSIG 50' > signal.nsg
20206         fi
20207         : Now look at all the signal names, one at a time.
20208         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20209                 $cat > signal.c <<EOCP
20210 #include <sys/types.h>
20211 #include <signal.h>
20212 #include <stdio.h>
20213 int main() {
20214 printf("$xx %d\n", SIG${xx});
20215 return 0;
20216 }
20217 EOCP
20218                 set signal
20219                 if eval $compile; then
20220                         echo "SIG${xx} found."
20221                         $run ./signal$_exe  >> signal.ls1
20222                 else
20223                         echo "SIG${xx} NOT found."
20224                 fi
20225         done
20226         if $test -s signal.ls1; then
20227                 $cat signal.nsg signal.ls1 |
20228                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20229         fi
20230
20231 fi
20232 if $test -s signal.lst; then
20233         :
20234 else
20235         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20236         echo 'kill -l' >signal
20237         set X `csh -f <signal`
20238         $rm -f signal
20239         shift
20240         case $# in
20241         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20242         esac
20243         echo $@ | $tr ' ' $trnl | \
20244             $awk '{ printf "%s %d\n", $1, ++s; }
20245                   END { printf "NSIG %d\n", ++s }' >signal.lst
20246 fi
20247 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20248 EOS
20249 chmod a+x signal_cmd
20250 $eunicefix signal_cmd
20251
20252 : generate list of signal names
20253 echo " "
20254 case "$sig_name_init" in
20255 '') doinit=yes ;;
20256 *)  case "$sig_num_init" in
20257     ''|*,*) doinit=yes ;;
20258     esac ;;
20259 esac
20260 case "$doinit" in
20261 yes)
20262         echo "Generating a list of signal names and numbers..." >&4
20263         . ./signal_cmd
20264         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20265         sig_name=`$awk 'BEGIN { printf "ZERO " }
20266                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20267         sig_num=`$awk  'BEGIN { printf "0 " }
20268                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20269         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20270                              !/^NSIG/   { printf "\"%s\", ", $1 }
20271                              END        { printf "0\n" }' signal.lst`
20272         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20273                              !/^NSIG/   { printf "%d, ", $2}
20274                              END        { printf "0\n"}' signal.lst`
20275         ;;
20276 esac
20277 echo "The following $sig_count signals are available:"
20278 echo " "
20279 echo $sig_name | $awk \
20280 'BEGIN { linelen = 0 }
20281 {
20282         for (i = 1; i <= NF; i++) {
20283                 name = "SIG" $i " "
20284                 linelen = linelen + length(name)
20285                 if (linelen > 70) {
20286                         printf "\n"
20287                         linelen = length(name)
20288                 }
20289                 printf "%s", name
20290         }
20291         printf "\n"
20292 }'
20293 sig_size=`echo $sig_name | awk '{print NF}'`
20294 $rm -f signal signal.c signal.awk signal.lst signal_cmd
20295
20296 : Check size of size
20297 echo " "
20298 case "$sizetype" in
20299 *_t) zzz="$sizetype"    ;;
20300 *)   zzz="filesize"     ;;
20301 esac
20302 echo "Checking the size of $zzz..." >&4
20303 cat > try.c <<EOCP
20304 #include <sys/types.h>
20305 #include <stdio.h>
20306 #$i_stdlib I_STDLIB
20307 #ifdef I_STDLIB
20308 #include <stdlib.h>
20309 #endif
20310 int main() {
20311     printf("%d\n", (int)sizeof($sizetype));
20312     exit(0);
20313 }
20314 EOCP
20315 set try
20316 if eval $compile_ok; then
20317         yyy=`$run ./try`
20318         case "$yyy" in
20319         '')     sizesize=4
20320                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20321                 ;;
20322         *)      sizesize=$yyy
20323                 echo "Your $zzz size is $sizesize bytes."
20324                 ;;
20325         esac
20326 else
20327         sizesize=4
20328         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20329 fi
20330
20331
20332 : check for socklen_t
20333 echo " "
20334 echo "Checking to see if you have socklen_t..." >&4
20335 $cat >try.c <<EOCP
20336 #include <sys/types.h>
20337 #$d_socket HAS_SOCKET
20338 #ifdef HAS_SOCKET
20339 #include <sys/socket.h>
20340 #endif
20341 int main() { socklen_t x = 16; }
20342 EOCP
20343 set try
20344 if eval $compile; then
20345         val="$define"
20346         echo "You have socklen_t."
20347 else
20348         val="$undef"
20349         echo "You do not have socklen_t."
20350         case "$sizetype" in
20351         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20352         esac
20353 fi
20354 $rm_try
20355 set d_socklen_t
20356 eval $setvar
20357
20358 : see if this is a socks.h system
20359 set socks.h i_socks
20360 eval $inhdr
20361
20362 : check for type of the size argument to socket calls
20363 case "$d_socket" in
20364 "$define")
20365         $cat <<EOM
20366
20367 Checking to see what type is the last argument of accept().
20368 EOM
20369         yyy=''
20370         case "$d_socklen_t" in
20371         "$define") yyy="$yyy socklen_t"
20372         esac
20373         yyy="$yyy $sizetype int long unsigned"
20374         for xxx in $yyy; do
20375                 case "$socksizetype" in
20376                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
20377                         case "$usesocks" in
20378                         "$define")
20379                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20380                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20381                                         socksizetype="$xxx"
20382                                 fi
20383                                 ;;
20384                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20385                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20386                                         socksizetype="$xxx"
20387                                 fi
20388                                 ;;
20389                         esac
20390                         ;;
20391                 esac
20392         done
20393 : In case none of those worked, prompt the user.
20394         case "$socksizetype" in
20395         '')     rp='What is the type for socket address structure sizes?'
20396                 dflt='int'
20397                 . ./myread
20398                 socksizetype=$ans
20399                 ;;
20400         esac
20401         ;;
20402 *)      : no sockets, so pick relatively harmless default
20403         socksizetype='int'
20404         ;;
20405 esac
20406
20407 : see what type is used for signed size_t
20408 set ssize_t ssizetype int stdio.h sys/types.h
20409 eval $typedef
20410 dflt="$ssizetype"
20411 $cat > try.c <<EOM
20412 #include <stdio.h>
20413 #$i_stdlib I_STDLIB
20414 #ifdef I_STDLIB
20415 #include <stdlib.h>
20416 #endif
20417 #include <sys/types.h>
20418 #define Size_t $sizetype
20419 #define SSize_t $dflt
20420 int main()
20421 {
20422         if (sizeof(Size_t) == sizeof(SSize_t))
20423                 printf("$dflt\n");
20424         else if (sizeof(Size_t) == sizeof(int))
20425                 printf("int\n");
20426         else
20427                 printf("long\n");
20428         exit(0);
20429 }
20430 EOM
20431 echo " "
20432 set try
20433 if eval $compile_ok && $run ./try > /dev/null; then
20434         ssizetype=`$run ./try`
20435         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20436 else
20437         $cat >&4 <<EOM
20438 Help! I can't compile and run the ssize_t test program: please enlighten me!
20439 (This is probably a misconfiguration in your system or libraries, and
20440 you really ought to fix it.  Still, I'll try anyway.)
20441
20442 I need a type that is the same size as $sizetype, but is guaranteed to
20443 be signed.  Common values are ssize_t, int and long.
20444
20445 EOM
20446         rp="What signed type is the same size as $sizetype?"
20447         . ./myread
20448         ssizetype="$ans"
20449 fi
20450 $rm_try
20451
20452 : see what type of char stdio uses.
20453 echo " "
20454 echo '#include <stdio.h>' > stdio.c
20455 $cppstdin $cppminus < stdio.c > stdioh
20456 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20457         echo "Your stdio uses unsigned chars." >&4
20458         stdchar="unsigned char"
20459 else
20460         echo "Your stdio uses signed chars." >&4
20461         stdchar="char"
20462 fi
20463 $rm -f stdio.* stdioh
20464
20465 : see what type uids are declared as in the kernel
20466 echo " "
20467 echo "Looking for the type for user ids returned by getuid()."
20468 set uid_t uidtype xxx stdio.h sys/types.h
20469 eval $typedef
20470 case "$uidtype" in
20471 xxx)
20472         xxx=`./findhdr sys/user.h`
20473         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20474         case $1 in
20475         unsigned) dflt="$1 $2" ;;
20476         *) dflt="$1" ;;
20477         esac
20478         ;;
20479 *) dflt="$uidtype";;
20480 esac
20481 case "$uidtype" in
20482 uid_t)  echo "uid_t found." ;;
20483 *)      rp="What is the type for user ids returned by getuid()?"
20484         . ./myread
20485         uidtype="$ans"
20486         ;;
20487 esac
20488
20489 : Check size of UID
20490 echo " "
20491 case "$uidtype" in
20492 *_t) zzz="$uidtype"     ;;
20493 *)   zzz="uid"          ;;
20494 esac
20495 echo "Checking the size of $zzz..." >&4
20496 cat > try.c <<EOCP
20497 #include <sys/types.h>
20498 #include <stdio.h>
20499 #$i_stdlib I_STDLIB
20500 #ifdef I_STDLIB
20501 #include <stdlib.h>
20502 #endif
20503 int main() {
20504     printf("%d\n", (int)sizeof($uidtype));
20505     exit(0);
20506 }
20507 EOCP
20508 set try
20509 if eval $compile_ok; then
20510         yyy=`$run ./try`
20511         case "$yyy" in
20512         '')     uidsize=4
20513                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20514                 ;;
20515         *)      uidsize=$yyy
20516                 echo "Your $zzz is $uidsize bytes long."
20517                 ;;
20518         esac
20519 else
20520         uidsize=4
20521         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20522 fi
20523
20524 : Check if UID is signed
20525 echo " "
20526 case "$uidtype" in
20527 *_t) zzz="$uidtype"     ;;
20528 *)   zzz="uid"          ;;
20529 esac
20530 echo "Checking the sign of $zzz..." >&4
20531 cat > try.c <<EOCP
20532 #include <sys/types.h>
20533 #include <stdio.h>
20534 int main() {
20535         $uidtype foo = -1;
20536         if (foo < 0)
20537                 printf("-1\n");
20538         else
20539                 printf("1\n");
20540 }
20541 EOCP
20542 set try
20543 if eval $compile; then
20544         yyy=`$run ./try`
20545         case "$yyy" in
20546         '')     uidsign=1
20547                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20548                 ;;
20549         *)      uidsign=$yyy
20550                 case "$uidsign" in
20551                  1) echo "Your $zzz is unsigned." ;;
20552                 -1) echo "Your $zzz is signed."   ;;
20553                 esac
20554                 ;;
20555         esac
20556 else
20557         uidsign=1
20558         echo "(I can't compile the test program--guessing unsigned.)" >&4
20559 fi
20560
20561
20562 : Check format string for UID
20563 echo " "
20564 $echo "Checking the format string to be used for uids..." >&4
20565
20566 case "$uidsign" in
20567 -1)     if $test X"$uidsize" = X"$ivsize"; then
20568                 uidformat="$ivdformat"
20569         else
20570                 if $test X"$uidsize" = X"$longsize"; then
20571                         uidformat='"ld"'
20572                 else
20573                         if $test X"$uidsize" = X"$intsize"; then
20574                                 uidformat='"d"'
20575                         else
20576                                 if $test X"$uidsize" = X"$shortsize"; then
20577                                         uidformat='"hd"'
20578                                 fi
20579                         fi
20580                 fi
20581         fi
20582         ;;
20583 *)      if $test X"$uidsize" = X"$uvsize"; then
20584                 uidformat="$uvuformat"
20585         else
20586                 if $test X"$uidsize" = X"$longsize"; then
20587                         uidformat='"lu"'
20588                 else
20589                         if $test X"$uidsize" = X"$intsize"; then
20590                                 uidformat='"u"'
20591                         else
20592                                 if $test X"$uidsize" = X"$shortsize"; then
20593                                         uidformat='"hu"'
20594                                 fi
20595                         fi
20596                 fi
20597         fi
20598         ;;
20599 esac
20600
20601 : Check if site customization support was requested
20602 case "$usesitecustomize" in
20603     $define|true|[Yy]*)
20604         usesitecustomize="$define"
20605         ;;
20606     *)
20607         usesitecustomize="$undef"
20608         ;;
20609     esac
20610
20611 : determine compiler compiler
20612 case "$yacc" in
20613 '')
20614         dflt=yacc;;
20615 *)
20616         dflt="$yacc";;
20617 esac
20618 echo " "
20619 comp='yacc'
20620 if $test -f "$byacc$_exe"; then
20621         dflt="$byacc"
20622         comp="byacc or $comp"
20623 fi
20624 if $test -f "$bison$_exe"; then
20625         comp="$comp or bison -y"
20626 fi
20627 rp="Which compiler compiler ($comp) shall I use?"
20628 . ./myread
20629 yacc="$ans"
20630 case "$yacc" in
20631 *bis*)
20632         case "$yacc" in
20633         *-y*) ;;
20634         *)
20635                 yacc="$yacc -y"
20636                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20637                 ;;
20638         esac
20639         ;;
20640 esac
20641
20642 : see if this is a assert.h system
20643 set assert.h i_assert
20644 eval $inhdr
20645
20646 : see if this is a fp.h system
20647 set fp.h i_fp
20648 eval $inhdr
20649
20650 : see if this is a fp_class.h system
20651 set fp_class.h i_fp_class
20652 eval $inhdr
20653
20654 : see if gdbm.h is available
20655 set gdbm.h t_gdbm
20656 eval $inhdr
20657 case "$t_gdbm" in
20658 $define)
20659         : see if gdbm_open exists
20660         set gdbm_open d_gdbm_open
20661         eval $inlibc
20662         case "$d_gdbm_open" in
20663         $undef)
20664                 t_gdbm="$undef"
20665                 echo "We won't be including <gdbm.h>"
20666                 ;;
20667         esac
20668         ;;
20669 esac
20670 val="$t_gdbm"
20671 set i_gdbm
20672 eval $setvar
20673
20674 : see if this is a ieeefp.h system
20675 case "$i_ieeefp" in
20676 '' ) set ieeefp.h i_ieeefp
20677      eval $inhdr
20678      ;;
20679 esac
20680
20681 : see if this is a libutil.h system
20682 set libutil.h i_libutil
20683 eval $inhdr
20684
20685 : see if mach cthreads are available
20686 if test "X$usethreads" = "X$define"; then
20687         set mach/cthreads.h i_machcthr
20688         eval $inhdr
20689 else
20690         i_machcthr="$undef"
20691 fi
20692
20693 : see if this is a mntent.h system
20694 set mntent.h i_mntent
20695 eval $inhdr
20696
20697 : see if ndbm.h is available
20698 set ndbm.h t_ndbm
20699 eval $inhdr
20700
20701 case "$t_ndbm" in
20702 $undef)
20703     # Some Linux distributions such as RedHat 7.1 put the
20704     # ndbm.h header in /usr/include/gdbm/ndbm.h.
20705     if $test -f /usr/include/gdbm/ndbm.h; then
20706         echo '<gdbm/ndbm.h> found.'
20707         ccflags="$ccflags -I/usr/include/gdbm"
20708         cppflags="$cppflags -I/usr/include/gdbm"
20709         t_ndbm=$define
20710     fi
20711     ;;
20712 esac
20713
20714 case "$t_ndbm" in
20715 $define)
20716         : see if dbm_open exists
20717         set dbm_open d_dbm_open
20718         eval $inlibc
20719         case "$d_dbm_open" in
20720         $undef)
20721                 t_ndbm="$undef"
20722                 echo "We won't be including <ndbm.h>"
20723                 ;;
20724         esac
20725         ;;
20726 esac
20727 val="$t_ndbm"
20728 set i_ndbm
20729 eval $setvar
20730
20731 : see if net/errno.h is available
20732 val=''
20733 set net/errno.h val
20734 eval $inhdr
20735
20736 : Unfortunately, it causes problems on some systems.  Arrgh.
20737 case "$val" in
20738 $define)
20739         cat > try.c <<'EOM'
20740 #include <stdio.h>
20741 #include <errno.h>
20742 #include <net/errno.h>
20743 int func()
20744 {
20745         return ENOTSOCK;
20746 }
20747 EOM
20748         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20749                 echo "We'll be including <net/errno.h>." >&4
20750         else
20751                 echo "We won't be including <net/errno.h>." >&4
20752                 val="$undef"
20753         fi
20754         $rm_try
20755         ;;
20756 esac
20757 set i_neterrno
20758 eval $setvar
20759
20760 : see if netinet/tcp.h is available
20761 set netinet/tcp.h i_netinettcp
20762 eval $inhdr
20763
20764 : see if this is a poll.h system
20765 set poll.h i_poll
20766 eval $inhdr
20767
20768 : see if this is a prot.h system
20769 set prot.h i_prot
20770 eval $inhdr
20771
20772 : Preprocessor symbols
20773 echo " "
20774 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20775 $cat <<'EOSH' > Cppsym.know
20776 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20777 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20778 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20779 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20780 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20781 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20782 bull c cadmus clipper CMU COFF COMPILER_VERSION
20783 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20784 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20785 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20786 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20787 GLIBC GLIBC_MINOR
20788 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20789 H3050R H3050RX hbullx20 hcx host_mips
20790 hp200 hp300 hp700 HP700 hp800 hp9000
20791 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20792 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20793 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20794 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20795 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20796 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20797 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20798 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20799 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20800 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20801 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20802 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20803 MATH_HAS_NO_SIDE_EFFECTS
20804 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20805 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20806 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20807 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20808 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20809 NetBSD news1500 news1700 news1800 news1900 news3700
20810 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20811 ns32016 ns32332 ns32k nsc32000
20812 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20813 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20814 pc532 pdp11 PGC PIC plexus PORTAR posix
20815 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20816 POSIX_C_SOURCE POSIX_SOURCE POWER
20817 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
20818 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20819 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20820 sony sony_news sonyrisc sparc sparclite spectrum
20821 stardent stdc STDC_EXT stratos sun sun3 sun386
20822 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20823 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20824 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20825 sysV68 sysV88 Tek4132 Tek4300 titan
20826 TM3200 TM5400 TM5600
20827 tower tower32 tower32_200 tower32_600 tower32_700
20828 tower32_800 tower32_850 tss
20829 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20830 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20831 unix UNIX95 UNIX99 unixpc unos
20832 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20833 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20834 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20835 USGr4 USGr4_2
20836 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20837 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20838 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20839 z8000
20840 EOSH
20841 # Maybe put other stuff here too.
20842 cat <<EOSH >>Cppsym.know
20843 $osname
20844 EOSH
20845 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20846 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20847 $cat Cppsym.know > Cppsym.c
20848 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20849 $rm -f Cppsym.a Cppsym.b Cppsym.c
20850 cat <<EOSH > Cppsym
20851 $startsh
20852 if $test \$# -gt 0; then
20853     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20854     if $test -s Cppsym.got; then
20855         $rm -f Cppsym.got
20856         exit 0
20857     fi
20858     $rm -f Cppsym.got
20859     exit 1
20860 else
20861     $tr " " "$trnl" | ./Cppsym.try
20862     exit 0
20863 fi
20864 EOSH
20865 chmod +x Cppsym
20866 $eunicefix Cppsym
20867 cat <<EOSH > Cppsym.try
20868 $startsh
20869 cat <<'EOCP' > try.c
20870 #include <stdio.h>
20871 #if cpp_stuff == 1
20872 #define STRINGIFY(a)    "a"
20873 #endif
20874 #if cpp_stuff == 42
20875 #define StGiFy(a)  #a
20876 #define STRINGIFY(a)    StGiFy(a)
20877 #endif
20878 #if $cpp_stuff != 1 && $cpp_stuff != 42
20879 #   include "Bletch: How does this C preprocessor stringify macros?"
20880 #endif
20881 int main() {
20882 EOCP
20883 $awk \\
20884 EOSH
20885 cat <<'EOSH' >> Cppsym.try
20886 'length($1) > 0 {
20887     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20888     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20889     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20890     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
20891 }'       >> try.c
20892 echo 'return 0;}' >> try.c
20893 EOSH
20894 cat <<EOSH >> Cppsym.try
20895 ccflags="$ccflags"
20896 case "$osname-$gccversion" in
20897 irix-) ccflags="\$ccflags -woff 1178" ;;
20898 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20899 esac
20900 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
20901 EOSH
20902 chmod +x Cppsym.try
20903 $eunicefix Cppsym.try
20904 ./Cppsym < Cppsym.know > Cppsym.true
20905 : Add in any linux cpp "predefined macros":
20906 case "$osname::$gccversion" in
20907   *linux*::*.*)
20908     tHdrH=_tmpHdr
20909     rm -f $tHdrH'.h' $tHdrH
20910     touch $tHdrH'.h'
20911     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
20912        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
20913        if [ -s $tHdrH'_cppsym.real' ]; then
20914           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
20915        fi
20916     fi
20917     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
20918   ;;
20919 esac
20920 : now check the C compiler for additional symbols
20921 postprocess_cc_v=''
20922 case "$osname" in
20923 aix) postprocess_cc_v="|$tr , ' '" ;;
20924 esac
20925 $cat >ccsym <<EOS
20926 $startsh
20927 $cat >tmp.c <<EOF
20928 extern int foo;
20929 EOF
20930 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20931 do
20932         case "\$i" in
20933         -D*) echo "\$i" | $sed 's/^-D//';;
20934         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
20935         esac
20936 done
20937 $rm_try
20938 EOS
20939 postprocess_cc_v=''
20940 chmod +x ccsym
20941 $eunicefix ccsym
20942 ./ccsym > ccsym1.raw
20943 if $test -s ccsym1.raw; then
20944        $sort ccsym1.raw | $uniq >ccsym.raw
20945 else
20946        mv ccsym1.raw ccsym.raw
20947 fi
20948
20949 $awk '/\=/ { print $0; next }
20950         { print $0"=1" }' ccsym.raw >ccsym.list
20951 $comm -13 Cppsym.true ccsym.list >ccsym.own
20952 $comm -12 Cppsym.true ccsym.list >ccsym.com
20953 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
20954 also=''
20955 if $test -z ccsym.raw; then
20956         echo "Your C compiler doesn't seem to define any symbols!" >&4
20957         echo " "
20958         echo "However, your C preprocessor defines the following symbols:"
20959         $cat Cppsym.true
20960         ccsymbols=''
20961         cppsymbols=`$cat Cppsym.true`
20962         cppsymbols=`echo $cppsymbols`
20963         cppccsymbols="$cppsymbols"
20964 else
20965         if $test -s ccsym.com; then
20966                 echo "Your C compiler and pre-processor define these symbols:"
20967                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20968                 also='also '
20969                 symbols='ones'
20970                 cppccsymbols=`$cat ccsym.com`
20971                 cppccsymbols=`echo $cppccsymbols`
20972                 $test "$silent" || sleep 1
20973         fi
20974         if $test -s ccsym.cpp; then
20975                 $test "$also" && echo " "
20976                 echo "Your C pre-processor ${also}defines the following symbols:"
20977                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20978                 also='further '
20979                 cppsymbols=`$cat ccsym.cpp`
20980                 cppsymbols=`echo $cppsymbols`
20981                 $test "$silent" || sleep 1
20982         fi
20983         if $test -s ccsym.own; then
20984                 $test "$also" && echo " "
20985                 echo "Your C compiler ${also}defines the following cpp symbols:"
20986                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20987                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20988                 ccsymbols=`$cat ccsym.own`
20989                 ccsymbols=`echo $ccsymbols`
20990                 $test "$silent" || sleep 1
20991         fi
20992 fi
20993
20994 : see if this is a termio system
20995 val="$undef"
20996 val2="$undef"
20997 val3="$undef"
20998 if $test `./findhdr termios.h`; then
20999         set tcsetattr i_termios
21000         eval $inlibc
21001         val3="$i_termios"
21002 fi
21003 echo " "
21004 case "$val3" in
21005 "$define") echo "You have POSIX termios.h... good!" >&4;;
21006 *) if ./Cppsym pyr; then
21007                 case "`/bin/universe`" in
21008                 ucb) if $test `./findhdr sgtty.h`; then
21009                                 val2="$define"
21010                                 echo "<sgtty.h> found." >&4
21011                         else
21012                                 echo "System is pyramid with BSD universe."
21013                                 echo "<sgtty.h> not found--you could have problems." >&4
21014                         fi;;
21015                 *) if $test `./findhdr termio.h`; then
21016                                 val="$define"
21017                                 echo "<termio.h> found." >&4
21018                         else
21019                                 echo "System is pyramid with USG universe."
21020                                 echo "<termio.h> not found--you could have problems." >&4
21021                         fi;;
21022                 esac
21023         elif ./usg; then
21024                 if $test `./findhdr termio.h`; then
21025                         echo "<termio.h> found." >&4
21026                         val="$define"
21027                 elif $test `./findhdr sgtty.h`; then
21028                         echo "<sgtty.h> found." >&4
21029                         val2="$define"
21030                 else
21031 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
21032                 fi
21033         else
21034                 if $test `./findhdr sgtty.h`; then
21035                         echo "<sgtty.h> found." >&4
21036                         val2="$define"
21037                 elif $test `./findhdr termio.h`; then
21038                         echo "<termio.h> found." >&4
21039                         val="$define"
21040                 else
21041 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
21042                 fi
21043         fi;;
21044 esac
21045 set i_termio; eval $setvar
21046 val=$val2; set i_sgtty; eval $setvar
21047 val=$val3; set i_termios; eval $setvar
21048
21049 : see if stddef is available
21050 set stddef.h i_stddef
21051 eval $inhdr
21052
21053 : see if sys/access.h is available
21054 set sys/access.h i_sysaccess
21055 eval $inhdr
21056
21057 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
21058 set sys/filio.h i_sysfilio
21059 eval $inhdr
21060 echo " "
21061 if $test `./findhdr sys/ioctl.h`; then
21062         val="$define"
21063         echo '<sys/ioctl.h> found.' >&4
21064 else
21065         val="$undef"
21066         if $test $i_sysfilio = "$define"; then
21067             echo '<sys/ioctl.h> NOT found.' >&4
21068         else
21069                 $test $i_sgtty = "$define" && xxx="sgtty.h"
21070                 $test $i_termio = "$define" && xxx="termio.h"
21071                 $test $i_termios = "$define" && xxx="termios.h"
21072 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
21073         fi
21074 fi
21075 set i_sysioctl
21076 eval $setvar
21077
21078 : see if socket ioctl defs are in sys/sockio.h
21079 echo " "
21080 xxx=`./findhdr sys/sockio.h`
21081 if $test "$xxx"; then
21082         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
21083                 val="$define"
21084                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
21085         else
21086                 val="$undef"
21087                 echo "No socket ioctls found in <sys/sockio.h>." >&4
21088         fi
21089 else
21090         val="$undef"
21091         $cat <<EOM
21092 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
21093 EOM
21094 fi
21095 set i_syssockio
21096 eval $setvar
21097
21098 : see if this is a syslog.h system
21099 set syslog.h i_syslog
21100 eval $inhdr
21101
21102 : see if this is a sys/mode.h system
21103 set sys/mode.h i_sysmode
21104 eval $inhdr
21105
21106 : see if sys/resource.h has to be included
21107 set sys/resource.h i_sysresrc
21108 eval $inhdr
21109
21110 : see if sys/security.h is available
21111 set sys/security.h i_syssecrt
21112 eval $inhdr
21113
21114 : see if this is a sys/statvfs.h system
21115 set sys/statvfs.h i_sysstatvfs
21116 eval $inhdr
21117
21118 : see if this is a sys/un.h system
21119 set sys/un.h i_sysun
21120 eval $inhdr
21121
21122 : see if this is a sys/utsname.h system
21123 set sys/utsname.h i_sysutsname
21124 eval $inhdr
21125
21126 : see if this is a syswait system
21127 set sys/wait.h i_syswait
21128 eval $inhdr
21129
21130 : see if this is a ustat.h system
21131 set ustat.h i_ustat
21132 eval $inhdr
21133
21134 : see if this is an utime system
21135 set utime.h i_utime
21136 eval $inhdr
21137
21138 : see if this is a values.h system
21139 set values.h i_values
21140 eval $inhdr
21141
21142 : see if this is a vfork system
21143 case "$d_vfork" in
21144 "$define")
21145         set vfork.h i_vfork
21146         eval $inhdr
21147         ;;
21148 *)
21149         i_vfork="$undef"
21150         ;;
21151 esac
21152
21153 : Check extensions
21154 echo " "
21155 echo "Looking for extensions..." >&4
21156 : If we are using the old config.sh, known_extensions may contain
21157 : old or inaccurate or duplicate values.
21158 known_extensions=''
21159 nonxs_extensions=''
21160 : We do not use find because it might not be available.
21161 : We do not just use MANIFEST because the user may have dropped
21162 : some additional extensions into the source tree and expect them
21163 : to be built.
21164
21165 : Function to recursively find available extensions, ignoring DynaLoader
21166 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21167 find_extensions='
21168     for xxx in *; do
21169         case "$xxx" in
21170             DynaLoader|dynaload) ;;
21171             *)
21172             if $test -f $xxx/$xxx.xs -o -f $xxx/$xxx.c; then
21173                 known_extensions="$known_extensions $1$xxx";
21174             elif $test -f $xxx/Makefile.PL; then
21175                 nonxs_extensions="$nonxs_extensions $1$xxx";
21176             else
21177                 if $test -d $xxx -a $# -lt 10; then
21178                     set $1$xxx/ $*;
21179                     cd "$xxx";
21180                     eval $find_extensions;
21181                     cd ..;
21182                     shift;
21183                 fi;
21184             fi
21185             ;;
21186         esac;
21187     done'
21188 tdir=`pwd`
21189 cd "$rsrc/ext"
21190 set X
21191 shift
21192 eval $find_extensions
21193 # Special case:  Add in modules that nest beyond the first level.
21194 # Currently threads/shared and Hash/Util/FieldHash, since they are
21195 # not picked up by the recursive find above (and adding in general
21196 # recursive finding breaks SDBM_File/sdbm).
21197 # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21198 known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
21199 set X $known_extensions
21200 shift
21201 known_extensions="$*"
21202 set X $nonxs_extensions
21203 shift
21204 nonxs_extensions="$*"
21205 cd "$tdir"
21206
21207 : Now see which are supported on this system.
21208 avail_ext=''
21209 for xxx in $known_extensions ; do
21210         case "$xxx" in
21211         DB_File|db_file)
21212                 case "$i_db" in
21213                 $define) avail_ext="$avail_ext $xxx" ;;
21214                 esac
21215                 ;;
21216         GDBM_File|gdbm_fil)
21217                 case "$i_gdbm" in
21218                 $define) avail_ext="$avail_ext $xxx" ;;
21219                 esac
21220                 ;;
21221         I18N/Langinfo|i18n_lan)
21222                 case "$i_langinfo$d_nl_langinfo" in
21223                 $define$define) avail_ext="$avail_ext $xxx" ;;
21224                 esac
21225                 ;;
21226         IPC/SysV|ipc/sysv)
21227                 : XXX Do we need a useipcsysv variable here
21228                 case "${d_msg}${d_sem}${d_shm}" in
21229                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21230                 esac
21231                 ;;
21232         NDBM_File|ndbm_fil)
21233                 case "$i_ndbm" in
21234                 $define)
21235                     case "$osname-$use64bitint" in
21236                     hpux-define)
21237                         case "$libs" in
21238                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21239                         esac
21240                         ;;
21241                     *) avail_ext="$avail_ext $xxx" ;;
21242                     esac
21243                     ;;
21244                 esac
21245                 ;;
21246         ODBM_File|odbm_fil)
21247                 case "${i_dbm}${i_rpcsvcdbm}" in
21248                 *"${define}"*)
21249                     case "$d_cplusplus" in
21250                     define) ;; # delete as a function name will not work
21251                     *)  case "$osname-$use64bitint" in
21252                         hpux-define)
21253                             case "$libs" in
21254                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21255                             esac
21256                             ;;
21257                         *) avail_ext="$avail_ext $xxx" ;;
21258                         esac
21259                         ;;
21260                     esac
21261                     ;;
21262                 esac
21263                 ;;
21264         Opcode|opcode)
21265                 case "$useopcode" in
21266                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21267                 esac
21268                 ;;
21269         POSIX|posix)
21270                 case "$useposix" in
21271                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21272                 esac
21273                 ;;
21274         Socket|socket)
21275                 case "$d_socket" in
21276                 true|$define|y)
21277                     case "$osname" in
21278                     beos) ;; # not unless BONE
21279                     *) avail_ext="$avail_ext $xxx" ;;
21280                     esac
21281                     ;;
21282                 esac
21283                 ;;
21284         Sys/Syslog|sys/syslog)
21285                 : XXX syslog requires socket
21286                 case "$d_socket" in
21287                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21288                 esac
21289                 ;;
21290         Thread|thread)
21291                 case "$usethreads" in
21292                 true|$define|y)
21293                         case "$use5005threads" in
21294                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
21295                         esac
21296                 esac
21297                 ;;
21298         threads|threads/shared)
21299                 # threads and threads::shared are special cases.
21300                 # To stop people from asking "Perl 5.8.0 was supposed
21301                 # to have this new fancy threads implementation but my
21302                 # perl doesn't have it" and from people trying to
21303                 # (re)install the threads module using CPAN.pm and
21304                 # CPAN.pm then offering to reinstall Perl 5.8.0,
21305                 # the threads.pm and threads/shared.pm will always be
21306                 # there, croaking informatively ("you need to rebuild
21307                 # all of Perl with threads, sorry") when threads haven't
21308                 # been compiled in.
21309                 # --jhi
21310                 avail_ext="$avail_ext $xxx"
21311                 ;;
21312         Win32*)
21313                 case "$osname" in
21314                 cygwin) avail_ext="$avail_ext $xxx" ;;
21315                 esac
21316                 ;;
21317         XS/APItest|xs/apitest)
21318                 # This is just for testing.  Skip it unless we have dynamic loading.
21319
21320                 case "$usedl" in
21321                 $define) avail_ext="$avail_ext $xxx" ;;
21322                 esac
21323                 ;;
21324         XS/Typemap|xs/typemap)
21325                 # This is just for testing.  Skip it unless we have dynamic loading.
21326                 case "$usedl" in
21327                 $define) avail_ext="$avail_ext $xxx" ;;
21328                 esac
21329                 ;;
21330         *)      avail_ext="$avail_ext $xxx"
21331                 ;;
21332         esac
21333 done
21334
21335 set X $avail_ext
21336 shift
21337 avail_ext="$*"
21338
21339 case "$onlyextensions" in
21340 '') ;;
21341 *)  keepextensions=''
21342     echo "You have requested that only certains extensions be included..." >&4
21343     for i in $onlyextensions; do
21344         case " $avail_ext " in
21345         *" $i "*)
21346             echo "Keeping extension $i."
21347             keepextensions="$keepextensions $i"
21348             ;;
21349         *) echo "Ignoring extension $i." ;;
21350         esac
21351     done
21352     avail_ext="$keepextensions"
21353     ;;
21354 esac
21355
21356 case "$noextensions" in
21357 '') ;;
21358 *)  keepextensions=''
21359     echo "You have requested that certain extensions be ignored..." >&4
21360     for i in $avail_ext; do
21361         case " $noextensions " in
21362         *" $i "*) echo "Ignoring extension $i." ;;
21363         *) echo "Keeping extension $i.";
21364            keepextensions="$keepextensions $i"
21365            ;;
21366         esac
21367     done
21368     avail_ext="$keepextensions"
21369     ;;
21370 esac
21371
21372 : Now see which nonxs extensions are supported on this system.
21373 : For now assume all are.
21374 nonxs_ext=''
21375 for xxx in $nonxs_extensions ; do
21376         case "$xxx" in
21377         *)      nonxs_ext="$nonxs_ext $xxx"
21378                 ;;
21379         esac
21380 done
21381
21382 set X $nonxs_ext
21383 shift
21384 nonxs_ext="$*"
21385
21386 case $usedl in
21387 $define)
21388         $cat <<EOM
21389 A number of extensions are supplied with $package.  You may choose to
21390 compile these extensions for dynamic loading (the default), compile
21391 them into the $package executable (static loading), or not include
21392 them at all.  Answer "none" to include no extensions.
21393 Note that DynaLoader is always built and need not be mentioned here.
21394
21395 EOM
21396         case "$dynamic_ext" in
21397         '')
21398                 : Exclude those listed in static_ext
21399                 dflt=''
21400                 for xxx in $avail_ext; do
21401                         case " $static_ext " in
21402                         *" $xxx "*) ;;
21403                         *) dflt="$dflt $xxx" ;;
21404                         esac
21405                 done
21406                 set X $dflt
21407                 shift
21408                 dflt="$*"
21409                 ;;
21410         *)      dflt="$dynamic_ext"
21411                 # Perhaps we are reusing an old out-of-date config.sh.
21412                 case "$hint" in
21413                 previous)
21414                         if test X"$dynamic_ext" != X"$avail_ext"; then
21415                                 $cat <<EOM
21416 NOTICE:  Your previous config.sh list may be incorrect.
21417 The extensions now available to you are
21418         ${avail_ext}
21419 but the default list from your previous config.sh is
21420         ${dynamic_ext}
21421
21422 EOM
21423                         fi
21424                         ;;
21425                 esac
21426                 ;;
21427         esac
21428         case "$dflt" in
21429         '')     dflt=none;;
21430         esac
21431         rp="What extensions do you wish to load dynamically?"
21432         . ./myread
21433         case "$ans" in
21434         none) dynamic_ext=' ' ;;
21435         *) dynamic_ext="$ans" ;;
21436         esac
21437
21438         case "$static_ext" in
21439         '')
21440                 : Exclude those already listed in dynamic linking
21441                 dflt=''
21442                 for xxx in $avail_ext; do
21443                         case " $dynamic_ext " in
21444                         *" $xxx "*) ;;
21445                         *) dflt="$dflt $xxx" ;;
21446                         esac
21447                 done
21448                 set X $dflt
21449                 shift
21450                 dflt="$*"
21451                 ;;
21452         *)  dflt="$static_ext"
21453                 ;;
21454         esac
21455
21456         case "$dflt" in
21457         '')     dflt=none;;
21458         esac
21459         rp="What extensions do you wish to load statically?"
21460         . ./myread
21461         case "$ans" in
21462         none) static_ext=' ' ;;
21463         *) static_ext="$ans" ;;
21464         esac
21465         ;;
21466 *)
21467         $cat <<EOM
21468 A number of extensions are supplied with $package.  Answer "none"
21469 to include no extensions.
21470 Note that DynaLoader is always built and need not be mentioned here.
21471
21472 EOM
21473         case "$static_ext" in
21474         '') dflt="$avail_ext" ;;
21475         *)      dflt="$static_ext"
21476                 # Perhaps we are reusing an old out-of-date config.sh.
21477                 case "$hint" in
21478                 previous)
21479                         if test X"$static_ext" != X"$avail_ext"; then
21480                                 $cat <<EOM
21481 NOTICE:  Your previous config.sh list may be incorrect.
21482 The extensions now available to you are
21483         ${avail_ext}
21484 but the default list from your previous config.sh is
21485         ${static_ext}
21486
21487 EOM
21488                         fi
21489                         ;;
21490                 esac
21491                 ;;
21492         esac
21493         : Exclude those that are not xs extensions
21494         case "$dflt" in
21495         '')     dflt=none;;
21496         esac
21497         rp="What extensions do you wish to include?"
21498         . ./myread
21499         case "$ans" in
21500         none) static_ext=' ' ;;
21501         *) static_ext="$ans" ;;
21502         esac
21503         ;;
21504 esac
21505 #
21506 # Encode is a special case.  If we are building Encode as a static
21507 # extension, we need to explicitly list its subextensions as well.
21508 # For other nested extensions, this is handled automatically by
21509 # the appropriate Makefile.PL.
21510 case " $static_ext " in
21511         *" Encode "*) # Add the subextensions of Encode
21512         cd "$rsrc/ext"
21513         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21514                 static_ext="$static_ext Encode/$xxx"
21515         done
21516         cd "$tdir"
21517         ;;
21518 esac
21519
21520 set X $dynamic_ext $static_ext $nonxs_ext
21521 shift
21522 extensions="$*"
21523
21524 # Sanity check:  We require an extension suitable for use with
21525 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21526 # should show up as failures in the test suite, but it's helpful to
21527 # catch them now.) The 'extensions' list is normally sorted
21528 # alphabetically, so we need to accept either
21529 #    DB_File ... Fcntl ... IO  ....
21530 # or something like
21531 #    Fcntl ... NDBM_File ... IO  ....
21532 case " $extensions"  in
21533 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21534 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21535 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21536 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21537    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21538    ;;
21539 esac
21540
21541 : Remove libraries needed only for extensions
21542 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21543 : The exception is SunOS 4.x, which needs them.
21544 case "${osname}X${osvers}" in
21545 sunos*X4*)
21546     perllibs="$libs"
21547     ;;
21548 *) case "$usedl" in
21549     $define|true|[yY]*)
21550             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21551             shift
21552             perllibs="$*"
21553             ;;
21554     *)  perllibs="$libs"
21555             ;;
21556     esac
21557     ;;
21558 esac
21559
21560 : Remove build directory name from cppstdin so it can be used from
21561 : either the present location or the final installed location.
21562 echo " "
21563 : Get out of the UU directory to get correct path name.
21564 cd ..
21565 case "$cppstdin" in
21566 `pwd`/cppstdin)
21567         echo "Stripping down cppstdin path name"
21568         cppstdin=cppstdin
21569         ;;
21570 esac
21571 cd UU
21572
21573 : end of configuration questions
21574 echo " "
21575 echo "End of configuration questions."
21576 echo " "
21577
21578 : back to where it started
21579 if test -d ../UU; then
21580         cd ..
21581 fi
21582
21583 : configuration may be patched via a 'config.arch' file
21584 if $test -f config.arch; then
21585         echo "I see a config.arch file, loading it."
21586         . ./config.arch
21587 fi
21588
21589 : configuration may be patched via a 'config.over' file
21590 if $test -f config.over; then
21591         echo " "
21592         dflt=y
21593         rp='I see a config.over file.  Do you wish to load it?'
21594         . UU/myread
21595         case "$ans" in
21596         n*) echo "OK, I'll ignore it.";;
21597         *)      . ./config.over
21598                 echo "Configuration override changes have been loaded."
21599                 ;;
21600         esac
21601 fi
21602
21603 : in case they want portability, strip down executable paths
21604 case "$d_portable" in
21605 "$define")
21606         echo " "
21607         echo "Stripping down executable paths..." >&4
21608         for file in $loclist $trylist; do
21609                 eval temp=\$$file
21610                 eval $file=`basename $temp`
21611         done
21612         ;;
21613 esac
21614
21615 : create config.sh file
21616 echo " "
21617 echo "Creating config.sh..." >&4
21618 $spitshell <<EOT >config.sh
21619 $startsh
21620 #
21621 # This file was produced by running the Configure script. It holds all the
21622 # definitions figured out by Configure. Should you modify one of these values,
21623 # do not forget to propagate your changes by running "Configure -der". You may
21624 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21625 #
21626
21627 # Package name      : $package
21628 # Source directory  : $src
21629 # Configuration time: $cf_time
21630 # Configured by     : $cf_by
21631 # Target system     : $myuname
21632
21633 Author='$Author'
21634 Date='$Date'
21635 Header='$Header'
21636 Id='$Id'
21637 Locker='$Locker'
21638 Log='$Log'
21639 Mcc='$Mcc'
21640 RCSfile='$RCSfile'
21641 Revision='$Revision'
21642 Source='$Source'
21643 State='$State'
21644 _a='$_a'
21645 _exe='$_exe'
21646 _o='$_o'
21647 afs='$afs'
21648 afsroot='$afsroot'
21649 alignbytes='$alignbytes'
21650 ansi2knr='$ansi2knr'
21651 aphostname='$aphostname'
21652 api_revision='$api_revision'
21653 api_subversion='$api_subversion'
21654 api_version='$api_version'
21655 api_versionstring='$api_versionstring'
21656 ar='$ar'
21657 archlib='$archlib'
21658 archlibexp='$archlibexp'
21659 archname64='$archname64'
21660 archname='$archname'
21661 archobjs='$archobjs'
21662 asctime_r_proto='$asctime_r_proto'
21663 awk='$awk'
21664 baserev='$baserev'
21665 bash='$bash'
21666 bin='$bin'
21667 binexp='$binexp'
21668 bison='$bison'
21669 byacc='$byacc'
21670 byteorder='$byteorder'
21671 c='$c'
21672 castflags='$castflags'
21673 cat='$cat'
21674 cc='$cc'
21675 cccdlflags='$cccdlflags'
21676 ccdlflags='$ccdlflags'
21677 ccflags='$ccflags'
21678 ccflags_uselargefiles='$ccflags_uselargefiles'
21679 ccname='$ccname'
21680 ccsymbols='$ccsymbols'
21681 ccversion='$ccversion'
21682 cf_by='$cf_by'
21683 cf_email='$cf_email'
21684 cf_time='$cf_time'
21685 chgrp='$chgrp'
21686 chmod='$chmod'
21687 chown='$chown'
21688 clocktype='$clocktype'
21689 comm='$comm'
21690 compress='$compress'
21691 contains='$contains'
21692 cp='$cp'
21693 cpio='$cpio'
21694 cpp='$cpp'
21695 cpp_stuff='$cpp_stuff'
21696 cppccsymbols='$cppccsymbols'
21697 cppflags='$cppflags'
21698 cpplast='$cpplast'
21699 cppminus='$cppminus'
21700 cpprun='$cpprun'
21701 cppstdin='$cppstdin'
21702 cppsymbols='$cppsymbols'
21703 crypt_r_proto='$crypt_r_proto'
21704 cryptlib='$cryptlib'
21705 csh='$csh'
21706 ctermid_r_proto='$ctermid_r_proto'
21707 ctime_r_proto='$ctime_r_proto'
21708 d_Gconvert='$d_Gconvert'
21709 d_PRIEUldbl='$d_PRIEUldbl'
21710 d_PRIFUldbl='$d_PRIFUldbl'
21711 d_PRIGUldbl='$d_PRIGUldbl'
21712 d_PRIXU64='$d_PRIXU64'
21713 d_PRId64='$d_PRId64'
21714 d_PRIeldbl='$d_PRIeldbl'
21715 d_PRIfldbl='$d_PRIfldbl'
21716 d_PRIgldbl='$d_PRIgldbl'
21717 d_PRIi64='$d_PRIi64'
21718 d_PRIo64='$d_PRIo64'
21719 d_PRIu64='$d_PRIu64'
21720 d_PRIx64='$d_PRIx64'
21721 d_SCNfldbl='$d_SCNfldbl'
21722 d__fwalk='$d__fwalk'
21723 d_access='$d_access'
21724 d_accessx='$d_accessx'
21725 d_aintl='$d_aintl'
21726 d_alarm='$d_alarm'
21727 d_archlib='$d_archlib'
21728 d_asctime_r='$d_asctime_r'
21729 d_atolf='$d_atolf'
21730 d_atoll='$d_atoll'
21731 d_attribute_format='$d_attribute_format'
21732 d_attribute_malloc='$d_attribute_malloc'
21733 d_attribute_nonnull='$d_attribute_nonnull'
21734 d_attribute_noreturn='$d_attribute_noreturn'
21735 d_attribute_pure='$d_attribute_pure'
21736 d_attribute_unused='$d_attribute_unused'
21737 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21738 d_bcmp='$d_bcmp'
21739 d_bcopy='$d_bcopy'
21740 d_bsd='$d_bsd'
21741 d_bsdgetpgrp='$d_bsdgetpgrp'
21742 d_bsdsetpgrp='$d_bsdsetpgrp'
21743 d_builtin_choose_expr='$d_builtin_choose_expr'
21744 d_builtin_expect='$d_builtin_expect'
21745 d_bzero='$d_bzero'
21746 d_c99_variadic_macros='$d_c99_variadic_macros'
21747 d_casti32='$d_casti32'
21748 d_castneg='$d_castneg'
21749 d_charvspr='$d_charvspr'
21750 d_chown='$d_chown'
21751 d_chroot='$d_chroot'
21752 d_chsize='$d_chsize'
21753 d_class='$d_class'
21754 d_clearenv='$d_clearenv'
21755 d_closedir='$d_closedir'
21756 d_cmsghdr_s='$d_cmsghdr_s'
21757 d_const='$d_const'
21758 d_copysignl='$d_copysignl'
21759 d_cplusplus='$d_cplusplus'
21760 d_crypt='$d_crypt'
21761 d_crypt_r='$d_crypt_r'
21762 d_csh='$d_csh'
21763 d_ctermid='$d_ctermid'
21764 d_ctermid_r='$d_ctermid_r'
21765 d_ctime_r='$d_ctime_r'
21766 d_cuserid='$d_cuserid'
21767 d_dbl_dig='$d_dbl_dig'
21768 d_dbminitproto='$d_dbminitproto'
21769 d_difftime='$d_difftime'
21770 d_dir_dd_fd='$d_dir_dd_fd'
21771 d_dirfd='$d_dirfd'
21772 d_dirnamlen='$d_dirnamlen'
21773 d_dlerror='$d_dlerror'
21774 d_dlopen='$d_dlopen'
21775 d_dlsymun='$d_dlsymun'
21776 d_dosuid='$d_dosuid'
21777 d_drand48_r='$d_drand48_r'
21778 d_drand48proto='$d_drand48proto'
21779 d_dup2='$d_dup2'
21780 d_eaccess='$d_eaccess'
21781 d_endgrent='$d_endgrent'
21782 d_endgrent_r='$d_endgrent_r'
21783 d_endhent='$d_endhent'
21784 d_endhostent_r='$d_endhostent_r'
21785 d_endnent='$d_endnent'
21786 d_endnetent_r='$d_endnetent_r'
21787 d_endpent='$d_endpent'
21788 d_endprotoent_r='$d_endprotoent_r'
21789 d_endpwent='$d_endpwent'
21790 d_endpwent_r='$d_endpwent_r'
21791 d_endsent='$d_endsent'
21792 d_endservent_r='$d_endservent_r'
21793 d_eofnblk='$d_eofnblk'
21794 d_eunice='$d_eunice'
21795 d_faststdio='$d_faststdio'
21796 d_fchdir='$d_fchdir'
21797 d_fchmod='$d_fchmod'
21798 d_fchown='$d_fchown'
21799 d_fcntl='$d_fcntl'
21800 d_fcntl_can_lock='$d_fcntl_can_lock'
21801 d_fd_macros='$d_fd_macros'
21802 d_fd_set='$d_fd_set'
21803 d_fds_bits='$d_fds_bits'
21804 d_fgetpos='$d_fgetpos'
21805 d_finite='$d_finite'
21806 d_finitel='$d_finitel'
21807 d_flexfnam='$d_flexfnam'
21808 d_flock='$d_flock'
21809 d_flockproto='$d_flockproto'
21810 d_fork='$d_fork'
21811 d_fp_class='$d_fp_class'
21812 d_fpathconf='$d_fpathconf'
21813 d_fpclass='$d_fpclass'
21814 d_fpclassify='$d_fpclassify'
21815 d_fpclassl='$d_fpclassl'
21816 d_fpos64_t='$d_fpos64_t'
21817 d_frexpl='$d_frexpl'
21818 d_fs_data_s='$d_fs_data_s'
21819 d_fseeko='$d_fseeko'
21820 d_fsetpos='$d_fsetpos'
21821 d_fstatfs='$d_fstatfs'
21822 d_fstatvfs='$d_fstatvfs'
21823 d_fsync='$d_fsync'
21824 d_ftello='$d_ftello'
21825 d_ftime='$d_ftime'
21826 d_futimes='$d_futimes'
21827 d_getcwd='$d_getcwd'
21828 d_getespwnam='$d_getespwnam'
21829 d_getfsstat='$d_getfsstat'
21830 d_getgrent='$d_getgrent'
21831 d_getgrent_r='$d_getgrent_r'
21832 d_getgrgid_r='$d_getgrgid_r'
21833 d_getgrnam_r='$d_getgrnam_r'
21834 d_getgrps='$d_getgrps'
21835 d_gethbyaddr='$d_gethbyaddr'
21836 d_gethbyname='$d_gethbyname'
21837 d_gethent='$d_gethent'
21838 d_gethname='$d_gethname'
21839 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21840 d_gethostbyname_r='$d_gethostbyname_r'
21841 d_gethostent_r='$d_gethostent_r'
21842 d_gethostprotos='$d_gethostprotos'
21843 d_getitimer='$d_getitimer'
21844 d_getlogin='$d_getlogin'
21845 d_getlogin_r='$d_getlogin_r'
21846 d_getmnt='$d_getmnt'
21847 d_getmntent='$d_getmntent'
21848 d_getnbyaddr='$d_getnbyaddr'
21849 d_getnbyname='$d_getnbyname'
21850 d_getnent='$d_getnent'
21851 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21852 d_getnetbyname_r='$d_getnetbyname_r'
21853 d_getnetent_r='$d_getnetent_r'
21854 d_getnetprotos='$d_getnetprotos'
21855 d_getpagsz='$d_getpagsz'
21856 d_getpbyname='$d_getpbyname'
21857 d_getpbynumber='$d_getpbynumber'
21858 d_getpent='$d_getpent'
21859 d_getpgid='$d_getpgid'
21860 d_getpgrp2='$d_getpgrp2'
21861 d_getpgrp='$d_getpgrp'
21862 d_getppid='$d_getppid'
21863 d_getprior='$d_getprior'
21864 d_getprotobyname_r='$d_getprotobyname_r'
21865 d_getprotobynumber_r='$d_getprotobynumber_r'
21866 d_getprotoent_r='$d_getprotoent_r'
21867 d_getprotoprotos='$d_getprotoprotos'
21868 d_getprpwnam='$d_getprpwnam'
21869 d_getpwent='$d_getpwent'
21870 d_getpwent_r='$d_getpwent_r'
21871 d_getpwnam_r='$d_getpwnam_r'
21872 d_getpwuid_r='$d_getpwuid_r'
21873 d_getsbyname='$d_getsbyname'
21874 d_getsbyport='$d_getsbyport'
21875 d_getsent='$d_getsent'
21876 d_getservbyname_r='$d_getservbyname_r'
21877 d_getservbyport_r='$d_getservbyport_r'
21878 d_getservent_r='$d_getservent_r'
21879 d_getservprotos='$d_getservprotos'
21880 d_getspnam='$d_getspnam'
21881 d_getspnam_r='$d_getspnam_r'
21882 d_gettimeod='$d_gettimeod'
21883 d_gmtime_r='$d_gmtime_r'
21884 d_gnulibc='$d_gnulibc'
21885 d_grpasswd='$d_grpasswd'
21886 d_hasmntopt='$d_hasmntopt'
21887 d_htonl='$d_htonl'
21888 d_ilogbl='$d_ilogbl'
21889 d_inc_version_list='$d_inc_version_list'
21890 d_index='$d_index'
21891 d_inetaton='$d_inetaton'
21892 d_int64_t='$d_int64_t'
21893 d_isascii='$d_isascii'
21894 d_isfinite='$d_isfinite'
21895 d_isinf='$d_isinf'
21896 d_isnan='$d_isnan'
21897 d_isnanl='$d_isnanl'
21898 d_killpg='$d_killpg'
21899 d_lchown='$d_lchown'
21900 d_ldbl_dig='$d_ldbl_dig'
21901 d_libm_lib_version='$d_libm_lib_version'
21902 d_link='$d_link'
21903 d_localtime_r='$d_localtime_r'
21904 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
21905 d_locconv='$d_locconv'
21906 d_lockf='$d_lockf'
21907 d_longdbl='$d_longdbl'
21908 d_longlong='$d_longlong'
21909 d_lseekproto='$d_lseekproto'
21910 d_lstat='$d_lstat'
21911 d_madvise='$d_madvise'
21912 d_malloc_good_size='$d_malloc_good_size'
21913 d_malloc_size='$d_malloc_size'
21914 d_mblen='$d_mblen'
21915 d_mbstowcs='$d_mbstowcs'
21916 d_mbtowc='$d_mbtowc'
21917 d_memchr='$d_memchr'
21918 d_memcmp='$d_memcmp'
21919 d_memcpy='$d_memcpy'
21920 d_memmove='$d_memmove'
21921 d_memset='$d_memset'
21922 d_mkdir='$d_mkdir'
21923 d_mkdtemp='$d_mkdtemp'
21924 d_mkfifo='$d_mkfifo'
21925 d_mkstemp='$d_mkstemp'
21926 d_mkstemps='$d_mkstemps'
21927 d_mktime='$d_mktime'
21928 d_mmap='$d_mmap'
21929 d_modfl='$d_modfl'
21930 d_modfl_pow32_bug='$d_modfl_pow32_bug'
21931 d_modflproto='$d_modflproto'
21932 d_mprotect='$d_mprotect'
21933 d_msg='$d_msg'
21934 d_msg_ctrunc='$d_msg_ctrunc'
21935 d_msg_dontroute='$d_msg_dontroute'
21936 d_msg_oob='$d_msg_oob'
21937 d_msg_peek='$d_msg_peek'
21938 d_msg_proxy='$d_msg_proxy'
21939 d_msgctl='$d_msgctl'
21940 d_msgget='$d_msgget'
21941 d_msghdr_s='$d_msghdr_s'
21942 d_msgrcv='$d_msgrcv'
21943 d_msgsnd='$d_msgsnd'
21944 d_msync='$d_msync'
21945 d_munmap='$d_munmap'
21946 d_mymalloc='$d_mymalloc'
21947 d_nice='$d_nice'
21948 d_nl_langinfo='$d_nl_langinfo'
21949 d_nv_preserves_uv='$d_nv_preserves_uv'
21950 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
21951 d_off64_t='$d_off64_t'
21952 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21953 d_oldpthreads='$d_oldpthreads'
21954 d_oldsock='$d_oldsock'
21955 d_open3='$d_open3'
21956 d_pathconf='$d_pathconf'
21957 d_pause='$d_pause'
21958 d_perl_otherlibdirs='$d_perl_otherlibdirs'
21959 d_phostname='$d_phostname'
21960 d_pipe='$d_pipe'
21961 d_poll='$d_poll'
21962 d_portable='$d_portable'
21963 d_printf_format_null='$d_printf_format_null'
21964 d_procselfexe='$d_procselfexe'
21965 d_pseudofork='$d_pseudofork'
21966 d_pthread_atfork='$d_pthread_atfork'
21967 d_pthread_attr_setscope='$d_pthread_attr_setscope'
21968 d_pthread_yield='$d_pthread_yield'
21969 d_pwage='$d_pwage'
21970 d_pwchange='$d_pwchange'
21971 d_pwclass='$d_pwclass'
21972 d_pwcomment='$d_pwcomment'
21973 d_pwexpire='$d_pwexpire'
21974 d_pwgecos='$d_pwgecos'
21975 d_pwpasswd='$d_pwpasswd'
21976 d_pwquota='$d_pwquota'
21977 d_qgcvt='$d_qgcvt'
21978 d_quad='$d_quad'
21979 d_random_r='$d_random_r'
21980 d_readdir64_r='$d_readdir64_r'
21981 d_readdir='$d_readdir'
21982 d_readdir_r='$d_readdir_r'
21983 d_readlink='$d_readlink'
21984 d_readv='$d_readv'
21985 d_recvmsg='$d_recvmsg'
21986 d_rename='$d_rename'
21987 d_rewinddir='$d_rewinddir'
21988 d_rmdir='$d_rmdir'
21989 d_safebcpy='$d_safebcpy'
21990 d_safemcpy='$d_safemcpy'
21991 d_sanemcmp='$d_sanemcmp'
21992 d_sbrkproto='$d_sbrkproto'
21993 d_scalbnl='$d_scalbnl'
21994 d_sched_yield='$d_sched_yield'
21995 d_scm_rights='$d_scm_rights'
21996 d_seekdir='$d_seekdir'
21997 d_select='$d_select'
21998 d_sem='$d_sem'
21999 d_semctl='$d_semctl'
22000 d_semctl_semid_ds='$d_semctl_semid_ds'
22001 d_semctl_semun='$d_semctl_semun'
22002 d_semget='$d_semget'
22003 d_semop='$d_semop'
22004 d_sendmsg='$d_sendmsg'
22005 d_setegid='$d_setegid'
22006 d_seteuid='$d_seteuid'
22007 d_setgrent='$d_setgrent'
22008 d_setgrent_r='$d_setgrent_r'
22009 d_setgrps='$d_setgrps'
22010 d_sethent='$d_sethent'
22011 d_sethostent_r='$d_sethostent_r'
22012 d_setitimer='$d_setitimer'
22013 d_setlinebuf='$d_setlinebuf'
22014 d_setlocale='$d_setlocale'
22015 d_setlocale_r='$d_setlocale_r'
22016 d_setnent='$d_setnent'
22017 d_setnetent_r='$d_setnetent_r'
22018 d_setpent='$d_setpent'
22019 d_setpgid='$d_setpgid'
22020 d_setpgrp2='$d_setpgrp2'
22021 d_setpgrp='$d_setpgrp'
22022 d_setprior='$d_setprior'
22023 d_setproctitle='$d_setproctitle'
22024 d_setprotoent_r='$d_setprotoent_r'
22025 d_setpwent='$d_setpwent'
22026 d_setpwent_r='$d_setpwent_r'
22027 d_setregid='$d_setregid'
22028 d_setresgid='$d_setresgid'
22029 d_setresuid='$d_setresuid'
22030 d_setreuid='$d_setreuid'
22031 d_setrgid='$d_setrgid'
22032 d_setruid='$d_setruid'
22033 d_setsent='$d_setsent'
22034 d_setservent_r='$d_setservent_r'
22035 d_setsid='$d_setsid'
22036 d_setvbuf='$d_setvbuf'
22037 d_sfio='$d_sfio'
22038 d_shm='$d_shm'
22039 d_shmat='$d_shmat'
22040 d_shmatprototype='$d_shmatprototype'
22041 d_shmctl='$d_shmctl'
22042 d_shmdt='$d_shmdt'
22043 d_shmget='$d_shmget'
22044 d_sigaction='$d_sigaction'
22045 d_signbit='$d_signbit'
22046 d_sigprocmask='$d_sigprocmask'
22047 d_sigsetjmp='$d_sigsetjmp'
22048 d_sitearch='$d_sitearch'
22049 d_snprintf='$d_snprintf'
22050 d_sockatmark='$d_sockatmark'
22051 d_sockatmarkproto='$d_sockatmarkproto'
22052 d_socket='$d_socket'
22053 d_socklen_t='$d_socklen_t'
22054 d_sockpair='$d_sockpair'
22055 d_socks5_init='$d_socks5_init'
22056 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
22057 d_sqrtl='$d_sqrtl'
22058 d_srand48_r='$d_srand48_r'
22059 d_srandom_r='$d_srandom_r'
22060 d_sresgproto='$d_sresgproto'
22061 d_sresuproto='$d_sresuproto'
22062 d_statblks='$d_statblks'
22063 d_statfs_f_flags='$d_statfs_f_flags'
22064 d_statfs_s='$d_statfs_s'
22065 d_statvfs='$d_statvfs'
22066 d_stdio_cnt_lval='$d_stdio_cnt_lval'
22067 d_stdio_ptr_lval='$d_stdio_ptr_lval'
22068 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
22069 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
22070 d_stdio_stream_array='$d_stdio_stream_array'
22071 d_stdiobase='$d_stdiobase'
22072 d_stdstdio='$d_stdstdio'
22073 d_strchr='$d_strchr'
22074 d_strcoll='$d_strcoll'
22075 d_strctcpy='$d_strctcpy'
22076 d_strerrm='$d_strerrm'
22077 d_strerror='$d_strerror'
22078 d_strerror_r='$d_strerror_r'
22079 d_strftime='$d_strftime'
22080 d_strlcat='$d_strlcat'
22081 d_strlcpy='$d_strlcpy'
22082 d_strtod='$d_strtod'
22083 d_strtol='$d_strtol'
22084 d_strtold='$d_strtold'
22085 d_strtoll='$d_strtoll'
22086 d_strtoq='$d_strtoq'
22087 d_strtoul='$d_strtoul'
22088 d_strtoull='$d_strtoull'
22089 d_strtouq='$d_strtouq'
22090 d_strxfrm='$d_strxfrm'
22091 d_suidsafe='$d_suidsafe'
22092 d_symlink='$d_symlink'
22093 d_syscall='$d_syscall'
22094 d_syscallproto='$d_syscallproto'
22095 d_sysconf='$d_sysconf'
22096 d_sysernlst='$d_sysernlst'
22097 d_syserrlst='$d_syserrlst'
22098 d_system='$d_system'
22099 d_tcgetpgrp='$d_tcgetpgrp'
22100 d_tcsetpgrp='$d_tcsetpgrp'
22101 d_telldir='$d_telldir'
22102 d_telldirproto='$d_telldirproto'
22103 d_time='$d_time'
22104 d_times='$d_times'
22105 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
22106 d_tm_tm_zone='$d_tm_tm_zone'
22107 d_tmpnam_r='$d_tmpnam_r'
22108 d_truncate='$d_truncate'
22109 d_ttyname_r='$d_ttyname_r'
22110 d_tzname='$d_tzname'
22111 d_u32align='$d_u32align'
22112 d_ualarm='$d_ualarm'
22113 d_umask='$d_umask'
22114 d_uname='$d_uname'
22115 d_union_semun='$d_union_semun'
22116 d_unordered='$d_unordered'
22117 d_unsetenv='$d_unsetenv'
22118 d_usleep='$d_usleep'
22119 d_usleepproto='$d_usleepproto'
22120 d_ustat='$d_ustat'
22121 d_vendorarch='$d_vendorarch'
22122 d_vendorbin='$d_vendorbin'
22123 d_vendorlib='$d_vendorlib'
22124 d_vendorscript='$d_vendorscript'
22125 d_vfork='$d_vfork'
22126 d_void_closedir='$d_void_closedir'
22127 d_voidsig='$d_voidsig'
22128 d_voidtty='$d_voidtty'
22129 d_volatile='$d_volatile'
22130 d_vprintf='$d_vprintf'
22131 d_vsnprintf='$d_vsnprintf'
22132 d_wait4='$d_wait4'
22133 d_waitpid='$d_waitpid'
22134 d_wcstombs='$d_wcstombs'
22135 d_wctomb='$d_wctomb'
22136 d_writev='$d_writev'
22137 d_xenix='$d_xenix'
22138 date='$date'
22139 db_hashtype='$db_hashtype'
22140 db_prefixtype='$db_prefixtype'
22141 db_version_major='$db_version_major'
22142 db_version_minor='$db_version_minor'
22143 db_version_patch='$db_version_patch'
22144 defvoidused='$defvoidused'
22145 direntrytype='$direntrytype'
22146 dlext='$dlext'
22147 dlsrc='$dlsrc'
22148 doublesize='$doublesize'
22149 drand01='$drand01'
22150 drand48_r_proto='$drand48_r_proto'
22151 dtrace='$dtrace'
22152 dynamic_ext='$dynamic_ext'
22153 eagain='$eagain'
22154 ebcdic='$ebcdic'
22155 echo='$echo'
22156 egrep='$egrep'
22157 emacs='$emacs'
22158 endgrent_r_proto='$endgrent_r_proto'
22159 endhostent_r_proto='$endhostent_r_proto'
22160 endnetent_r_proto='$endnetent_r_proto'
22161 endprotoent_r_proto='$endprotoent_r_proto'
22162 endpwent_r_proto='$endpwent_r_proto'
22163 endservent_r_proto='$endservent_r_proto'
22164 eunicefix='$eunicefix'
22165 exe_ext='$exe_ext'
22166 expr='$expr'
22167 extensions='$extensions'
22168 extras='$extras'
22169 fflushNULL='$fflushNULL'
22170 fflushall='$fflushall'
22171 find='$find'
22172 firstmakefile='$firstmakefile'
22173 flex='$flex'
22174 fpossize='$fpossize'
22175 fpostype='$fpostype'
22176 freetype='$freetype'
22177 from='$from'
22178 full_ar='$full_ar'
22179 full_csh='$full_csh'
22180 full_sed='$full_sed'
22181 gccansipedantic='$gccansipedantic'
22182 gccosandvers='$gccosandvers'
22183 gccversion='$gccversion'
22184 getgrent_r_proto='$getgrent_r_proto'
22185 getgrgid_r_proto='$getgrgid_r_proto'
22186 getgrnam_r_proto='$getgrnam_r_proto'
22187 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22188 gethostbyname_r_proto='$gethostbyname_r_proto'
22189 gethostent_r_proto='$gethostent_r_proto'
22190 getlogin_r_proto='$getlogin_r_proto'
22191 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22192 getnetbyname_r_proto='$getnetbyname_r_proto'
22193 getnetent_r_proto='$getnetent_r_proto'
22194 getprotobyname_r_proto='$getprotobyname_r_proto'
22195 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22196 getprotoent_r_proto='$getprotoent_r_proto'
22197 getpwent_r_proto='$getpwent_r_proto'
22198 getpwnam_r_proto='$getpwnam_r_proto'
22199 getpwuid_r_proto='$getpwuid_r_proto'
22200 getservbyname_r_proto='$getservbyname_r_proto'
22201 getservbyport_r_proto='$getservbyport_r_proto'
22202 getservent_r_proto='$getservent_r_proto'
22203 getspnam_r_proto='$getspnam_r_proto'
22204 gidformat='$gidformat'
22205 gidsign='$gidsign'
22206 gidsize='$gidsize'
22207 gidtype='$gidtype'
22208 glibpth='$glibpth'
22209 gmake='$gmake'
22210 gmtime_r_proto='$gmtime_r_proto'
22211 gnulibc_version='$gnulibc_version'
22212 grep='$grep'
22213 groupcat='$groupcat'
22214 groupstype='$groupstype'
22215 gzip='$gzip'
22216 h_fcntl='$h_fcntl'
22217 h_sysfile='$h_sysfile'
22218 hint='$hint'
22219 hostcat='$hostcat'
22220 html1dir='$html1dir'
22221 html1direxp='$html1direxp'
22222 html3dir='$html3dir'
22223 html3direxp='$html3direxp'
22224 i16size='$i16size'
22225 i16type='$i16type'
22226 i32size='$i32size'
22227 i32type='$i32type'
22228 i64size='$i64size'
22229 i64type='$i64type'
22230 i8size='$i8size'
22231 i8type='$i8type'
22232 i_arpainet='$i_arpainet'
22233 i_assert='$i_assert'
22234 i_bsdioctl='$i_bsdioctl'
22235 i_crypt='$i_crypt'
22236 i_db='$i_db'
22237 i_dbm='$i_dbm'
22238 i_dirent='$i_dirent'
22239 i_dld='$i_dld'
22240 i_dlfcn='$i_dlfcn'
22241 i_fcntl='$i_fcntl'
22242 i_float='$i_float'
22243 i_fp='$i_fp'
22244 i_fp_class='$i_fp_class'
22245 i_gdbm='$i_gdbm'
22246 i_grp='$i_grp'
22247 i_ieeefp='$i_ieeefp'
22248 i_inttypes='$i_inttypes'
22249 i_langinfo='$i_langinfo'
22250 i_libutil='$i_libutil'
22251 i_limits='$i_limits'
22252 i_locale='$i_locale'
22253 i_machcthr='$i_machcthr'
22254 i_malloc='$i_malloc'
22255 i_math='$i_math'
22256 i_memory='$i_memory'
22257 i_mntent='$i_mntent'
22258 i_ndbm='$i_ndbm'
22259 i_netdb='$i_netdb'
22260 i_neterrno='$i_neterrno'
22261 i_netinettcp='$i_netinettcp'
22262 i_niin='$i_niin'
22263 i_poll='$i_poll'
22264 i_prot='$i_prot'
22265 i_pthread='$i_pthread'
22266 i_pwd='$i_pwd'
22267 i_rpcsvcdbm='$i_rpcsvcdbm'
22268 i_sfio='$i_sfio'
22269 i_sgtty='$i_sgtty'
22270 i_shadow='$i_shadow'
22271 i_socks='$i_socks'
22272 i_stdarg='$i_stdarg'
22273 i_stddef='$i_stddef'
22274 i_stdlib='$i_stdlib'
22275 i_string='$i_string'
22276 i_sunmath='$i_sunmath'
22277 i_sysaccess='$i_sysaccess'
22278 i_sysdir='$i_sysdir'
22279 i_sysfile='$i_sysfile'
22280 i_sysfilio='$i_sysfilio'
22281 i_sysin='$i_sysin'
22282 i_sysioctl='$i_sysioctl'
22283 i_syslog='$i_syslog'
22284 i_sysmman='$i_sysmman'
22285 i_sysmode='$i_sysmode'
22286 i_sysmount='$i_sysmount'
22287 i_sysndir='$i_sysndir'
22288 i_sysparam='$i_sysparam'
22289 i_sysresrc='$i_sysresrc'
22290 i_syssecrt='$i_syssecrt'
22291 i_sysselct='$i_sysselct'
22292 i_syssockio='$i_syssockio'
22293 i_sysstat='$i_sysstat'
22294 i_sysstatfs='$i_sysstatfs'
22295 i_sysstatvfs='$i_sysstatvfs'
22296 i_systime='$i_systime'
22297 i_systimek='$i_systimek'
22298 i_systimes='$i_systimes'
22299 i_systypes='$i_systypes'
22300 i_sysuio='$i_sysuio'
22301 i_sysun='$i_sysun'
22302 i_sysutsname='$i_sysutsname'
22303 i_sysvfs='$i_sysvfs'
22304 i_syswait='$i_syswait'
22305 i_termio='$i_termio'
22306 i_termios='$i_termios'
22307 i_time='$i_time'
22308 i_unistd='$i_unistd'
22309 i_ustat='$i_ustat'
22310 i_utime='$i_utime'
22311 i_values='$i_values'
22312 i_varargs='$i_varargs'
22313 i_varhdr='$i_varhdr'
22314 i_vfork='$i_vfork'
22315 ignore_versioned_solibs='$ignore_versioned_solibs'
22316 inc_version_list='$inc_version_list'
22317 inc_version_list_init='$inc_version_list_init'
22318 incpath='$incpath'
22319 inews='$inews'
22320 initialinstalllocation='$initialinstalllocation'
22321 installarchlib='$installarchlib'
22322 installbin='$installbin'
22323 installhtml1dir='$installhtml1dir'
22324 installhtml3dir='$installhtml3dir'
22325 installman1dir='$installman1dir'
22326 installman3dir='$installman3dir'
22327 installprefix='$installprefix'
22328 installprefixexp='$installprefixexp'
22329 installprivlib='$installprivlib'
22330 installscript='$installscript'
22331 installsitearch='$installsitearch'
22332 installsitebin='$installsitebin'
22333 installsitehtml1dir='$installsitehtml1dir'
22334 installsitehtml3dir='$installsitehtml3dir'
22335 installsitelib='$installsitelib'
22336 installsiteman1dir='$installsiteman1dir'
22337 installsiteman3dir='$installsiteman3dir'
22338 installsitescript='$installsitescript'
22339 installstyle='$installstyle'
22340 installusrbinperl='$installusrbinperl'
22341 installvendorarch='$installvendorarch'
22342 installvendorbin='$installvendorbin'
22343 installvendorhtml1dir='$installvendorhtml1dir'
22344 installvendorhtml3dir='$installvendorhtml3dir'
22345 installvendorlib='$installvendorlib'
22346 installvendorman1dir='$installvendorman1dir'
22347 installvendorman3dir='$installvendorman3dir'
22348 installvendorscript='$installvendorscript'
22349 intsize='$intsize'
22350 issymlink='$issymlink'
22351 ivdformat='$ivdformat'
22352 ivsize='$ivsize'
22353 ivtype='$ivtype'
22354 known_extensions='$known_extensions'
22355 ksh='$ksh'
22356 ld='$ld'
22357 lddlflags='$lddlflags'
22358 ldflags='$ldflags'
22359 ldflags_uselargefiles='$ldflags_uselargefiles'
22360 ldlibpthname='$ldlibpthname'
22361 less='$less'
22362 lib_ext='$lib_ext'
22363 libc='$libc'
22364 libperl='$libperl'
22365 libpth='$libpth'
22366 libs='$libs'
22367 libsdirs='$libsdirs'
22368 libsfiles='$libsfiles'
22369 libsfound='$libsfound'
22370 libspath='$libspath'
22371 libswanted='$libswanted'
22372 libswanted_uselargefiles='$libswanted_uselargefiles'
22373 line='$line'
22374 lint='$lint'
22375 lkflags='$lkflags'
22376 ln='$ln'
22377 lns='$lns'
22378 localtime_r_proto='$localtime_r_proto'
22379 locincpth='$locincpth'
22380 loclibpth='$loclibpth'
22381 longdblsize='$longdblsize'
22382 longlongsize='$longlongsize'
22383 longsize='$longsize'
22384 lp='$lp'
22385 lpr='$lpr'
22386 ls='$ls'
22387 lseeksize='$lseeksize'
22388 lseektype='$lseektype'
22389 mad='$mad'
22390 madlyh='$madlyh'
22391 madlyobj='$madlyobj'
22392 madlysrc='$madlysrc'
22393 mail='$mail'
22394 mailx='$mailx'
22395 make='$make'
22396 make_set_make='$make_set_make'
22397 mallocobj='$mallocobj'
22398 mallocsrc='$mallocsrc'
22399 malloctype='$malloctype'
22400 man1dir='$man1dir'
22401 man1direxp='$man1direxp'
22402 man1ext='$man1ext'
22403 man3dir='$man3dir'
22404 man3direxp='$man3direxp'
22405 man3ext='$man3ext'
22406 mips_type='$mips_type'
22407 mistrustnm='$mistrustnm'
22408 mkdir='$mkdir'
22409 mmaptype='$mmaptype'
22410 modetype='$modetype'
22411 more='$more'
22412 multiarch='$multiarch'
22413 mv='$mv'
22414 myarchname='$myarchname'
22415 mydomain='$mydomain'
22416 myhostname='$myhostname'
22417 myuname='$myuname'
22418 n='$n'
22419 need_va_copy='$need_va_copy'
22420 netdb_hlen_type='$netdb_hlen_type'
22421 netdb_host_type='$netdb_host_type'
22422 netdb_name_type='$netdb_name_type'
22423 netdb_net_type='$netdb_net_type'
22424 nm='$nm'
22425 nm_opt='$nm_opt'
22426 nm_so_opt='$nm_so_opt'
22427 nonxs_ext='$nonxs_ext'
22428 nroff='$nroff'
22429 nvEUformat='$nvEUformat'
22430 nvFUformat='$nvFUformat'
22431 nvGUformat='$nvGUformat'
22432 nv_preserves_uv_bits='$nv_preserves_uv_bits'
22433 nveformat='$nveformat'
22434 nvfformat='$nvfformat'
22435 nvgformat='$nvgformat'
22436 nvsize='$nvsize'
22437 nvtype='$nvtype'
22438 o_nonblock='$o_nonblock'
22439 obj_ext='$obj_ext'
22440 old_pthread_create_joinable='$old_pthread_create_joinable'
22441 optimize='$optimize'
22442 orderlib='$orderlib'
22443 osname='$osname'
22444 osvers='$osvers'
22445 otherlibdirs='$otherlibdirs'
22446 package='$package'
22447 pager='$pager'
22448 passcat='$passcat'
22449 patchlevel='$patchlevel'
22450 path_sep='$path_sep'
22451 perl5='$perl5'
22452 perl='$perl'
22453 perl_patchlevel='$perl_patchlevel'
22454 perladmin='$perladmin'
22455 perllibs='$perllibs'
22456 perlpath='$perlpath'
22457 pg='$pg'
22458 phostname='$phostname'
22459 pidtype='$pidtype'
22460 plibpth='$plibpth'
22461 pmake='$pmake'
22462 pr='$pr'
22463 prefix='$prefix'
22464 prefixexp='$prefixexp'
22465 privlib='$privlib'
22466 privlibexp='$privlibexp'
22467 procselfexe='$procselfexe'
22468 prototype='$prototype'
22469 ptrsize='$ptrsize'
22470 quadkind='$quadkind'
22471 quadtype='$quadtype'
22472 randbits='$randbits'
22473 randfunc='$randfunc'
22474 random_r_proto='$random_r_proto'
22475 randseedtype='$randseedtype'
22476 ranlib='$ranlib'
22477 rd_nodata='$rd_nodata'
22478 readdir64_r_proto='$readdir64_r_proto'
22479 readdir_r_proto='$readdir_r_proto'
22480 revision='$revision'
22481 rm='$rm'
22482 rm_try='$rm_try'
22483 rmail='$rmail'
22484 run='$run'
22485 runnm='$runnm'
22486 sPRIEUldbl='$sPRIEUldbl'
22487 sPRIFUldbl='$sPRIFUldbl'
22488 sPRIGUldbl='$sPRIGUldbl'
22489 sPRIXU64='$sPRIXU64'
22490 sPRId64='$sPRId64'
22491 sPRIeldbl='$sPRIeldbl'
22492 sPRIfldbl='$sPRIfldbl'
22493 sPRIgldbl='$sPRIgldbl'
22494 sPRIi64='$sPRIi64'
22495 sPRIo64='$sPRIo64'
22496 sPRIu64='$sPRIu64'
22497 sPRIx64='$sPRIx64'
22498 sSCNfldbl='$sSCNfldbl'
22499 sched_yield='$sched_yield'
22500 scriptdir='$scriptdir'
22501 scriptdirexp='$scriptdirexp'
22502 sed='$sed'
22503 seedfunc='$seedfunc'
22504 selectminbits='$selectminbits'
22505 selecttype='$selecttype'
22506 sendmail='$sendmail'
22507 setgrent_r_proto='$setgrent_r_proto'
22508 sethostent_r_proto='$sethostent_r_proto'
22509 setlocale_r_proto='$setlocale_r_proto'
22510 setnetent_r_proto='$setnetent_r_proto'
22511 setprotoent_r_proto='$setprotoent_r_proto'
22512 setpwent_r_proto='$setpwent_r_proto'
22513 setservent_r_proto='$setservent_r_proto'
22514 sh='$sh'
22515 shar='$shar'
22516 sharpbang='$sharpbang'
22517 shmattype='$shmattype'
22518 shortsize='$shortsize'
22519 shrpenv='$shrpenv'
22520 shsharp='$shsharp'
22521 sig_count='$sig_count'
22522 sig_name='$sig_name'
22523 sig_name_init='$sig_name_init'
22524 sig_num='$sig_num'
22525 sig_num_init='$sig_num_init'
22526 sig_size='$sig_size'
22527 signal_t='$signal_t'
22528 sitearch='$sitearch'
22529 sitearchexp='$sitearchexp'
22530 sitebin='$sitebin'
22531 sitebinexp='$sitebinexp'
22532 sitehtml1dir='$sitehtml1dir'
22533 sitehtml1direxp='$sitehtml1direxp'
22534 sitehtml3dir='$sitehtml3dir'
22535 sitehtml3direxp='$sitehtml3direxp'
22536 sitelib='$sitelib'
22537 sitelib_stem='$sitelib_stem'
22538 sitelibexp='$sitelibexp'
22539 siteman1dir='$siteman1dir'
22540 siteman1direxp='$siteman1direxp'
22541 siteman3dir='$siteman3dir'
22542 siteman3direxp='$siteman3direxp'
22543 siteprefix='$siteprefix'
22544 siteprefixexp='$siteprefixexp'
22545 sitescript='$sitescript'
22546 sitescriptexp='$sitescriptexp'
22547 sizesize='$sizesize'
22548 sizetype='$sizetype'
22549 sleep='$sleep'
22550 smail='$smail'
22551 so='$so'
22552 sockethdr='$sockethdr'
22553 socketlib='$socketlib'
22554 socksizetype='$socksizetype'
22555 sort='$sort'
22556 spackage='$spackage'
22557 spitshell='$spitshell'
22558 srand48_r_proto='$srand48_r_proto'
22559 srandom_r_proto='$srandom_r_proto'
22560 src='$src'
22561 ssizetype='$ssizetype'
22562 startperl='$startperl'
22563 startsh='$startsh'
22564 static_ext='$static_ext'
22565 stdchar='$stdchar'
22566 stdio_base='$stdio_base'
22567 stdio_bufsiz='$stdio_bufsiz'
22568 stdio_cnt='$stdio_cnt'
22569 stdio_filbuf='$stdio_filbuf'
22570 stdio_ptr='$stdio_ptr'
22571 stdio_stream_array='$stdio_stream_array'
22572 strerror_r_proto='$strerror_r_proto'
22573 strings='$strings'
22574 submit='$submit'
22575 subversion='$subversion'
22576 sysman='$sysman'
22577 tail='$tail'
22578 tar='$tar'
22579 targetarch='$targetarch'
22580 tbl='$tbl'
22581 tee='$tee'
22582 test='$test'
22583 timeincl='$timeincl'
22584 timetype='$timetype'
22585 tmpnam_r_proto='$tmpnam_r_proto'
22586 to='$to'
22587 touch='$touch'
22588 tr='$tr'
22589 trnl='$trnl'
22590 troff='$troff'
22591 ttyname_r_proto='$ttyname_r_proto'
22592 u16size='$u16size'
22593 u16type='$u16type'
22594 u32size='$u32size'
22595 u32type='$u32type'
22596 u64size='$u64size'
22597 u64type='$u64type'
22598 u8size='$u8size'
22599 u8type='$u8type'
22600 uidformat='$uidformat'
22601 uidsign='$uidsign'
22602 uidsize='$uidsize'
22603 uidtype='$uidtype'
22604 uname='$uname'
22605 uniq='$uniq'
22606 uquadtype='$uquadtype'
22607 use5005threads='$use5005threads'
22608 use64bitall='$use64bitall'
22609 use64bitint='$use64bitint'
22610 usecrosscompile='$usecrosscompile'
22611 usedl='$usedl'
22612 usedtrace='$usedtrace'
22613 usefaststdio='$usefaststdio'
22614 useithreads='$useithreads'
22615 uselargefiles='$uselargefiles'
22616 uselongdouble='$uselongdouble'
22617 usemallocwrap='$usemallocwrap'
22618 usemorebits='$usemorebits'
22619 usemultiplicity='$usemultiplicity'
22620 usemymalloc='$usemymalloc'
22621 usenm='$usenm'
22622 useopcode='$useopcode'
22623 useperlio='$useperlio'
22624 useposix='$useposix'
22625 usereentrant='$usereentrant'
22626 userelocatableinc='$userelocatableinc'
22627 usesfio='$usesfio'
22628 useshrplib='$useshrplib'
22629 usesitecustomize='$usesitecustomize'
22630 usesocks='$usesocks'
22631 usethreads='$usethreads'
22632 usevendorprefix='$usevendorprefix'
22633 usevfork='$usevfork'
22634 usrinc='$usrinc'
22635 uuname='$uuname'
22636 uvXUformat='$uvXUformat'
22637 uvoformat='$uvoformat'
22638 uvsize='$uvsize'
22639 uvtype='$uvtype'
22640 uvuformat='$uvuformat'
22641 uvxformat='$uvxformat'
22642 vendorarch='$vendorarch'
22643 vendorarchexp='$vendorarchexp'
22644 vendorbin='$vendorbin'
22645 vendorbinexp='$vendorbinexp'
22646 vendorhtml1dir='$vendorhtml1dir'
22647 vendorhtml1direxp='$vendorhtml1direxp'
22648 vendorhtml3dir='$vendorhtml3dir'
22649 vendorhtml3direxp='$vendorhtml3direxp'
22650 vendorlib='$vendorlib'
22651 vendorlib_stem='$vendorlib_stem'
22652 vendorlibexp='$vendorlibexp'
22653 vendorman1dir='$vendorman1dir'
22654 vendorman1direxp='$vendorman1direxp'
22655 vendorman3dir='$vendorman3dir'
22656 vendorman3direxp='$vendorman3direxp'
22657 vendorprefix='$vendorprefix'
22658 vendorprefixexp='$vendorprefixexp'
22659 vendorscript='$vendorscript'
22660 vendorscriptexp='$vendorscriptexp'
22661 version='$version'
22662 version_patchlevel_string='$version_patchlevel_string'
22663 versiononly='$versiononly'
22664 vi='$vi'
22665 voidflags='$voidflags'
22666 xlibpth='$xlibpth'
22667 yacc='$yacc'
22668 yaccflags='$yaccflags'
22669 zcat='$zcat'
22670 zip='$zip'
22671 EOT
22672
22673 : Add in command line options if available
22674 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22675
22676 : add special variables
22677 $test -f $src/patchlevel.h && \
22678 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22679 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22680 echo "PERL_CONFIG_SH=true" >>config.sh
22681
22682 : propagate old symbols
22683 if $test -f UU/config.sh; then
22684         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22685         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
22686         $sort | $uniq -u >UU/oldsyms
22687         set X `cat UU/oldsyms`
22688         shift
22689         case $# in
22690         0) ;;
22691         *)
22692                 cat <<EOM
22693 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22694 EOM
22695                 echo "# Variables propagated from previous config.sh file." >>config.sh
22696                 for sym in `cat UU/oldsyms`; do
22697                         echo "    Propagating $hint variable "'$'"$sym..."
22698                         eval 'tmp="$'"${sym}"'"'
22699                         echo "$tmp" | \
22700                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22701                 done
22702                 ;;
22703         esac
22704 fi
22705
22706 : Finish up by extracting the .SH files
22707 case "$alldone" in
22708 exit)
22709         $rm -rf UU
22710         echo "Extraction done."
22711         exit 0
22712         ;;
22713 cont)
22714         ;;
22715 '')
22716         dflt=''
22717         nostick=true
22718         $cat <<EOM
22719
22720 If you'd like to make any changes to the config.sh file before I begin
22721 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22722
22723 EOM
22724         rp="Press return or use a shell escape to edit config.sh:"
22725         . UU/myread
22726         nostick=''
22727         case "$ans" in
22728         '') ;;
22729         *) : in case they cannot read
22730                 sh 1>&4 -c "$ans";;
22731         esac
22732         ;;
22733 esac
22734
22735 : if this fails, just run all the .SH files by hand
22736 . ./config.sh
22737
22738 echo " "
22739 exec 1>&4
22740 pwd=`pwd`
22741 . ./UU/extract
22742 cd "$pwd"
22743
22744 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22745         dflt=y
22746         case "$silent" in
22747         true) ;;
22748         *)
22749                 $cat <<EOM
22750
22751 Now you need to generate make dependencies by running "$make depend".
22752 You might prefer to run it in background: "$make depend > makedepend.out &"
22753 It can take a while, so you might not want to run it right now.
22754
22755 EOM
22756                 ;;
22757         esac
22758         rp="Run $make depend now?"
22759         . UU/myread
22760         case "$ans" in
22761         y*)
22762                 $make depend && echo "Now you must run '$make'."
22763                 ;;
22764         *)
22765                 echo "You must run '$make depend' then '$make'."
22766                 ;;
22767         esac
22768 elif test -f [Mm]akefile; then
22769         echo " "
22770         echo "Now you must run a $make."
22771 else
22772         echo "Configure done."
22773 fi
22774
22775 if $test -f Policy.sh; then
22776     $cat <<EOM
22777
22778 If you compile $package on a different machine or from a different object
22779 directory, copy the Policy.sh file from this object directory to the
22780 new one before you run Configure -- this will help you with most of
22781 the policy defaults.
22782
22783 EOM
22784 fi
22785 if $test -f config.msg; then
22786     echo "Hmm.  I also noted the following information while running:"
22787     echo " "
22788     $cat config.msg >&4
22789     $rm -f config.msg
22790 fi
22791 $rm -f kit*isdone ark*isdone
22792 $rm -rf UU
22793
22794 : End of Configure
22795