New separations for the pattern match operator documentation,
[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 Sat May 17 16:03:30 CEST 2008 [metaconfig 3.5 PL0]
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 ar=''
225 awk=''
226 bash=''
227 bison=''
228 byacc=''
229 cat=''
230 chgrp=''
231 chmod=''
232 chown=''
233 comm=''
234 compress=''
235 cp=''
236 cpio=''
237 cpp=''
238 csh=''
239 date=''
240 echo=''
241 egrep=''
242 emacs=''
243 expr=''
244 find=''
245 flex=''
246 gmake=''
247 grep=''
248 gzip=''
249 inews=''
250 ksh=''
251 less=''
252 line=''
253 lint=''
254 ln=''
255 lp=''
256 lpr=''
257 ls=''
258 mail=''
259 mailx=''
260 make=''
261 mkdir=''
262 more=''
263 mv=''
264 nm=''
265 nroff=''
266 perl=''
267 pg=''
268 pmake=''
269 pr=''
270 rm=''
271 rmail=''
272 sed=''
273 sendmail=''
274 shar=''
275 sleep=''
276 smail=''
277 sort=''
278 submit=''
279 tail=''
280 tar=''
281 tbl=''
282 tee=''
283 test=''
284 touch=''
285 tr=''
286 troff=''
287 uname=''
288 uniq=''
289 uuname=''
290 vi=''
291 zcat=''
292 zip=''
293 full_ar=''
294 full_sed=''
295 libswanted=''
296 hint=''
297 myuname=''
298 osname=''
299 osvers=''
300 Author=''
301 Date=''
302 Header=''
303 Id=''
304 Locker=''
305 Log=''
306 RCSfile=''
307 Revision=''
308 Source=''
309 State=''
310 _a=''
311 _exe=''
312 _o=''
313 archobjs=''
314 exe_ext=''
315 firstmakefile=''
316 lib_ext=''
317 obj_ext=''
318 path_sep=''
319 rm_try=''
320 afs=''
321 afsroot=''
322 alignbytes=''
323 ansi2knr=''
324 archlib=''
325 archlibexp=''
326 d_archlib=''
327 installarchlib=''
328 archname=''
329 myarchname=''
330 d_atolf=''
331 d_atoll=''
332 baserev=''
333 bin=''
334 binexp=''
335 initialinstalllocation=''
336 installbin=''
337 userelocatableinc=''
338 byteorder=''
339 cc=''
340 ccflags=''
341 cppflags=''
342 ldflags=''
343 lkflags=''
344 locincpth=''
345 optimize=''
346 cf_email=''
347 cf_by=''
348 cf_time=''
349 contains=''
350 cpp_stuff=''
351 cpplast=''
352 cppminus=''
353 cpprun=''
354 cppstdin=''
355 d__fwalk=''
356 d_access=''
357 d_accessx=''
358 d_aintl=''
359 d_alarm=''
360 asctime_r_proto=''
361 d_asctime_r=''
362 d_attribute_format=''
363 d_attribute_malloc=''
364 d_attribute_nonnull=''
365 d_attribute_noreturn=''
366 d_attribute_pure=''
367 d_attribute_unused=''
368 d_attribute_warn_unused_result=''
369 d_printf_format_null=''
370 d_bcmp=''
371 d_bcopy=''
372 d_builtin_choose_expr=''
373 d_builtin_expect=''
374 d_bzero=''
375 d_c99_variadic_macros=''
376 d_casti32=''
377 castflags=''
378 d_castneg=''
379 d_chown=''
380 d_chroot=''
381 d_chsize=''
382 d_class=''
383 d_clearenv=''
384 d_closedir=''
385 d_void_closedir=''
386 d_cmsghdr_s=''
387 d_const=''
388 d_copysignl=''
389 d_cplusplus=''
390 cryptlib=''
391 d_crypt=''
392 crypt_r_proto=''
393 d_crypt_r=''
394 d_csh=''
395 full_csh=''
396 d_ctermid=''
397 ctermid_r_proto=''
398 d_ctermid_r=''
399 ctime_r_proto=''
400 d_ctime_r=''
401 d_cuserid=''
402 d_dbl_dig=''
403 d_dbminitproto=''
404 d_difftime=''
405 d_dir_dd_fd=''
406 d_dirfd=''
407 d_dlerror=''
408 d_dlopen=''
409 d_dlsymun=''
410 d_dosuid=''
411 d_suidsafe=''
412 d_drand48_r=''
413 drand48_r_proto=''
414 d_drand48proto=''
415 d_dup2=''
416 d_eaccess=''
417 d_endgrent=''
418 d_endgrent_r=''
419 endgrent_r_proto=''
420 d_endhent=''
421 d_endhostent_r=''
422 endhostent_r_proto=''
423 d_endnent=''
424 d_endnetent_r=''
425 endnetent_r_proto=''
426 d_endpent=''
427 d_endprotoent_r=''
428 endprotoent_r_proto=''
429 d_endpwent=''
430 d_endpwent_r=''
431 endpwent_r_proto=''
432 d_endsent=''
433 d_endservent_r=''
434 endservent_r_proto=''
435 d_faststdio=''
436 d_fchdir=''
437 d_fchmod=''
438 d_fchown=''
439 d_fcntl=''
440 d_fcntl_can_lock=''
441 d_fd_macros=''
442 d_fd_set=''
443 d_fds_bits=''
444 d_fgetpos=''
445 d_finite=''
446 d_finitel=''
447 d_flexfnam=''
448 d_flock=''
449 d_flockproto=''
450 d_fork=''
451 d_fp_class=''
452 d_fpclass=''
453 d_fpclassify=''
454 d_fpclassl=''
455 d_fpos64_t=''
456 d_frexpl=''
457 d_fs_data_s=''
458 d_fseeko=''
459 d_fsetpos=''
460 d_fstatfs=''
461 d_fsync=''
462 d_ftello=''
463 d_ftime=''
464 d_gettimeod=''
465 d_futimes=''
466 d_Gconvert=''
467 d_getcwd=''
468 d_getespwnam=''
469 d_getfsstat=''
470 d_getgrent=''
471 d_getgrent_r=''
472 getgrent_r_proto=''
473 d_getgrgid_r=''
474 getgrgid_r_proto=''
475 d_getgrnam_r=''
476 getgrnam_r_proto=''
477 d_getgrps=''
478 d_gethbyaddr=''
479 d_gethbyname=''
480 d_gethent=''
481 aphostname=''
482 d_gethname=''
483 d_phostname=''
484 d_uname=''
485 d_gethostbyaddr_r=''
486 gethostbyaddr_r_proto=''
487 d_gethostbyname_r=''
488 gethostbyname_r_proto=''
489 d_gethostent_r=''
490 gethostent_r_proto=''
491 d_gethostprotos=''
492 d_getitimer=''
493 d_getlogin=''
494 d_getlogin_r=''
495 getlogin_r_proto=''
496 d_getmnt=''
497 d_getmntent=''
498 d_getnbyaddr=''
499 d_getnbyname=''
500 d_getnent=''
501 d_getnetbyaddr_r=''
502 getnetbyaddr_r_proto=''
503 d_getnetbyname_r=''
504 getnetbyname_r_proto=''
505 d_getnetent_r=''
506 getnetent_r_proto=''
507 d_getnetprotos=''
508 d_getpagsz=''
509 d_getpent=''
510 d_getpgid=''
511 d_getpgrp2=''
512 d_bsdgetpgrp=''
513 d_getpgrp=''
514 d_getppid=''
515 d_getprior=''
516 d_getpbyname=''
517 d_getpbynumber=''
518 d_getprotobyname_r=''
519 getprotobyname_r_proto=''
520 d_getprotobynumber_r=''
521 getprotobynumber_r_proto=''
522 d_getprotoent_r=''
523 getprotoent_r_proto=''
524 d_getprotoprotos=''
525 d_getprpwnam=''
526 d_getpwent=''
527 d_getpwent_r=''
528 getpwent_r_proto=''
529 d_getpwnam_r=''
530 getpwnam_r_proto=''
531 d_getpwuid_r=''
532 getpwuid_r_proto=''
533 d_getsent=''
534 d_getservbyname_r=''
535 getservbyname_r_proto=''
536 d_getservbyport_r=''
537 getservbyport_r_proto=''
538 d_getservent_r=''
539 getservent_r_proto=''
540 d_getservprotos=''
541 d_getspnam=''
542 d_getspnam_r=''
543 getspnam_r_proto=''
544 d_getsbyname=''
545 d_getsbyport=''
546 d_gmtime_r=''
547 gmtime_r_proto=''
548 d_gnulibc=''
549 gnulibc_version=''
550 d_hasmntopt=''
551 d_htonl=''
552 d_ilogbl=''
553 d_inetaton=''
554 d_int64_t=''
555 d_isascii=''
556 d_isfinite=''
557 d_isinf=''
558 d_isnan=''
559 d_isnanl=''
560 d_killpg=''
561 d_lchown=''
562 d_ldbl_dig=''
563 d_libm_lib_version=''
564 d_link=''
565 d_localtime_r=''
566 d_localtime_r_needs_tzset=''
567 localtime_r_proto=''
568 d_locconv=''
569 d_lockf=''
570 d_longdbl=''
571 longdblsize=''
572 d_longlong=''
573 longlongsize=''
574 d_lseekproto=''
575 d_lstat=''
576 d_madvise=''
577 d_malloc_good_size=''
578 d_malloc_size=''
579 d_mblen=''
580 d_mbstowcs=''
581 d_mbtowc=''
582 d_memchr=''
583 d_memcmp=''
584 d_memcpy=''
585 d_memmove=''
586 d_memset=''
587 d_mkdir=''
588 d_mkdtemp=''
589 d_mkfifo=''
590 d_mkstemp=''
591 d_mkstemps=''
592 d_mktime=''
593 d_mmap=''
594 mmaptype=''
595 d_modfl=''
596 d_modfl_pow32_bug=''
597 d_modflproto=''
598 d_mprotect=''
599 d_msg=''
600 d_msgctl=''
601 d_msgget=''
602 d_msghdr_s=''
603 d_msgrcv=''
604 d_msgsnd=''
605 d_msync=''
606 d_munmap=''
607 d_nice=''
608 d_nl_langinfo=''
609 d_off64_t=''
610 d_open3=''
611 d_fpathconf=''
612 d_pathconf=''
613 d_pause=''
614 d_pipe=''
615 d_poll=''
616 d_portable=''
617 d_procselfexe=''
618 procselfexe=''
619 d_old_pthread_create_joinable=''
620 old_pthread_create_joinable=''
621 d_pthread_atfork=''
622 d_pthread_attr_setscope=''
623 d_pthread_yield=''
624 d_sched_yield=''
625 sched_yield=''
626 d_qgcvt=''
627 d_random_r=''
628 random_r_proto=''
629 d_readdir64_r=''
630 readdir64_r_proto=''
631 d_readdir=''
632 d_rewinddir=''
633 d_seekdir=''
634 d_telldir=''
635 d_readdir_r=''
636 readdir_r_proto=''
637 d_readlink=''
638 d_readv=''
639 d_recvmsg=''
640 d_rename=''
641 d_rmdir=''
642 d_safebcpy=''
643 d_safemcpy=''
644 d_sanemcmp=''
645 d_sbrkproto=''
646 d_scalbnl=''
647 d_select=''
648 d_sem=''
649 d_semctl=''
650 d_semget=''
651 d_semop=''
652 d_sendmsg=''
653 d_setegid=''
654 d_seteuid=''
655 d_setgrent=''
656 d_setgrent_r=''
657 setgrent_r_proto=''
658 d_setgrps=''
659 d_sethent=''
660 d_sethostent_r=''
661 sethostent_r_proto=''
662 d_setitimer=''
663 d_setlinebuf=''
664 d_setlocale=''
665 d_setlocale_r=''
666 setlocale_r_proto=''
667 d_setnent=''
668 d_setnetent_r=''
669 setnetent_r_proto=''
670 d_setpent=''
671 d_setpgid=''
672 d_setpgrp2=''
673 d_bsdsetpgrp=''
674 d_setpgrp=''
675 d_setprior=''
676 d_setproctitle=''
677 d_setprotoent_r=''
678 setprotoent_r_proto=''
679 d_setpwent=''
680 d_setpwent_r=''
681 setpwent_r_proto=''
682 d_setregid=''
683 d_setresgid=''
684 d_setresuid=''
685 d_setreuid=''
686 d_setrgid=''
687 d_setruid=''
688 d_setsent=''
689 d_setservent_r=''
690 setservent_r_proto=''
691 d_setsid=''
692 d_setvbuf=''
693 d_sfio=''
694 usesfio=''
695 d_shm=''
696 d_shmat=''
697 d_shmatprototype=''
698 shmattype=''
699 d_shmctl=''
700 d_shmdt=''
701 d_shmget=''
702 d_sigaction=''
703 d_signbit=''
704 d_sigprocmask=''
705 d_sigsetjmp=''
706 usesitecustomize=''
707 d_snprintf=''
708 d_vsnprintf=''
709 d_sockatmark=''
710 d_sockatmarkproto=''
711 d_msg_ctrunc=''
712 d_msg_dontroute=''
713 d_msg_oob=''
714 d_msg_peek=''
715 d_msg_proxy=''
716 d_oldsock=''
717 d_scm_rights=''
718 d_socket=''
719 d_sockpair=''
720 sockethdr=''
721 socketlib=''
722 d_socklen_t=''
723 d_socks5_init=''
724 d_sprintf_returns_strlen=''
725 d_sqrtl=''
726 d_srand48_r=''
727 srand48_r_proto=''
728 d_srandom_r=''
729 srandom_r_proto=''
730 d_sresgproto=''
731 d_sresuproto=''
732 d_statblks=''
733 d_statfs_f_flags=''
734 d_statfs_s=''
735 d_fstatvfs=''
736 d_statvfs=''
737 d_stdio_cnt_lval=''
738 d_stdio_ptr_lval=''
739 d_stdio_ptr_lval_nochange_cnt=''
740 d_stdio_ptr_lval_sets_cnt=''
741 d_stdiobase=''
742 d_stdstdio=''
743 stdio_base=''
744 stdio_bufsiz=''
745 stdio_cnt=''
746 stdio_filbuf=''
747 stdio_ptr=''
748 d_index=''
749 d_strchr=''
750 d_strcoll=''
751 d_strctcpy=''
752 d_strerrm=''
753 d_strerror=''
754 d_sysernlst=''
755 d_syserrlst=''
756 d_strerror_r=''
757 strerror_r_proto=''
758 d_strftime=''
759 d_strlcat=''
760 d_strlcpy=''
761 d_strtod=''
762 d_strtol=''
763 d_strtold=''
764 d_strtoll=''
765 d_strtoq=''
766 d_strtoul=''
767 d_strtoull=''
768 d_strtouq=''
769 d_strxfrm=''
770 d_symlink=''
771 d_syscall=''
772 d_syscallproto=''
773 d_sysconf=''
774 d_system=''
775 d_tcgetpgrp=''
776 d_tcsetpgrp=''
777 d_telldirproto=''
778 d_time=''
779 timetype=''
780 clocktype=''
781 d_times=''
782 d_tmpnam_r=''
783 tmpnam_r_proto=''
784 d_truncate=''
785 d_ttyname_r=''
786 ttyname_r_proto=''
787 d_tzname=''
788 d_u32align=''
789 d_ualarm=''
790 d_umask=''
791 d_semctl_semid_ds=''
792 d_semctl_semun=''
793 d_union_semun=''
794 d_unordered=''
795 d_unsetenv=''
796 d_usleep=''
797 d_usleepproto=''
798 d_ustat=''
799 d_pseudofork=''
800 d_vfork=''
801 usevfork=''
802 d_voidsig=''
803 signal_t=''
804 d_volatile=''
805 d_charvspr=''
806 d_vprintf=''
807 d_wait4=''
808 d_waitpid=''
809 d_wcstombs=''
810 d_wctomb=''
811 d_writev=''
812 dlext=''
813 cccdlflags=''
814 ccdlflags=''
815 dlsrc=''
816 ld=''
817 lddlflags=''
818 usedl=''
819 doublesize=''
820 ebcdic=''
821 fflushNULL=''
822 fflushall=''
823 fpossize=''
824 fpostype=''
825 gccansipedantic=''
826 gccosandvers=''
827 gccversion=''
828 gidformat=''
829 gidsign=''
830 gidsize=''
831 gidtype=''
832 groupstype=''
833 h_fcntl=''
834 h_sysfile=''
835 html1dir=''
836 html1direxp=''
837 installhtml1dir=''
838 html3dir=''
839 html3direxp=''
840 installhtml3dir=''
841 i_arpainet=''
842 i_assert=''
843 i_crypt=''
844 db_hashtype=''
845 db_prefixtype=''
846 db_version_major=''
847 db_version_minor=''
848 db_version_patch=''
849 i_db=''
850 i_dbm=''
851 i_rpcsvcdbm=''
852 d_dirnamlen=''
853 direntrytype=''
854 i_dirent=''
855 i_dld=''
856 i_dlfcn=''
857 i_fcntl=''
858 i_float=''
859 i_fp=''
860 i_fp_class=''
861 i_gdbm=''
862 d_grpasswd=''
863 i_grp=''
864 i_ieeefp=''
865 i_inttypes=''
866 i_langinfo=''
867 i_libutil=''
868 i_limits=''
869 i_locale=''
870 i_machcthr=''
871 i_malloc=''
872 i_mallocmalloc=''
873 i_math=''
874 i_memory=''
875 i_mntent=''
876 d_ndbm=''
877 i_gdbm_ndbm=''
878 i_gdbmndbm=''
879 i_ndbm=''
880 i_netdb=''
881 i_neterrno=''
882 i_netinettcp=''
883 i_niin=''
884 i_sysin=''
885 i_poll=''
886 i_prot=''
887 i_pthread=''
888 d_pwage=''
889 d_pwchange=''
890 d_pwclass=''
891 d_pwcomment=''
892 d_pwexpire=''
893 d_pwgecos=''
894 d_pwpasswd=''
895 d_pwquota=''
896 i_pwd=''
897 i_sfio=''
898 i_shadow=''
899 i_socks=''
900 i_stddef=''
901 i_stdlib=''
902 i_string=''
903 strings=''
904 i_sunmath=''
905 i_sysaccess=''
906 i_sysdir=''
907 i_sysfile=''
908 d_voidtty=''
909 i_bsdioctl=''
910 i_sysfilio=''
911 i_sysioctl=''
912 i_syssockio=''
913 i_syslog=''
914 i_sysmman=''
915 i_sysmode=''
916 i_sysmount=''
917 i_sysndir=''
918 i_sysparam=''
919 i_syspoll=''
920 i_sysresrc=''
921 i_syssecrt=''
922 i_sysselct=''
923 i_sysstat=''
924 i_sysstatfs=''
925 i_sysstatvfs=''
926 i_systimes=''
927 i_systypes=''
928 i_sysuio=''
929 i_sysun=''
930 i_sysutsname=''
931 i_sysvfs=''
932 i_syswait=''
933 i_sgtty=''
934 i_termio=''
935 i_termios=''
936 d_tm_tm_gmtoff=''
937 d_tm_tm_zone=''
938 i_systime=''
939 i_systimek=''
940 i_time=''
941 timeincl=''
942 i_unistd=''
943 i_ustat=''
944 i_utime=''
945 i_values=''
946 i_stdarg=''
947 i_varargs=''
948 i_varhdr=''
949 i_vfork=''
950 d_inc_version_list=''
951 inc_version_list=''
952 inc_version_list_init=''
953 installprefix=''
954 installprefixexp=''
955 installstyle=''
956 installusrbinperl=''
957 intsize=''
958 longsize=''
959 shortsize=''
960 issymlink=''
961 libc=''
962 ldlibpthname=''
963 libperl=''
964 shrpenv=''
965 useshrplib=''
966 glibpth=''
967 libpth=''
968 loclibpth=''
969 plibpth=''
970 xlibpth=''
971 ignore_versioned_solibs=''
972 libs=''
973 libsdirs=''
974 libsfiles=''
975 libsfound=''
976 libspath=''
977 lns=''
978 d_PRIEUldbl=''
979 d_PRIFUldbl=''
980 d_PRIGUldbl=''
981 d_PRIeldbl=''
982 d_PRIfldbl=''
983 d_PRIgldbl=''
984 d_SCNfldbl=''
985 sPRIEUldbl=''
986 sPRIFUldbl=''
987 sPRIGUldbl=''
988 sPRIeldbl=''
989 sPRIfldbl=''
990 sPRIgldbl=''
991 sSCNfldbl=''
992 lseeksize=''
993 lseektype=''
994 mad=''
995 madlyh=''
996 madlyobj=''
997 madlysrc=''
998 make_set_make=''
999 d_mymalloc=''
1000 freetype=''
1001 mallocobj=''
1002 mallocsrc=''
1003 malloctype=''
1004 usemallocwrap=''
1005 usemymalloc=''
1006 installman1dir=''
1007 man1dir=''
1008 man1direxp=''
1009 man1ext=''
1010 installman3dir=''
1011 man3dir=''
1012 man3direxp=''
1013 man3ext=''
1014 modetype=''
1015 multiarch=''
1016 mydomain=''
1017 myhostname=''
1018 phostname=''
1019 c=''
1020 n=''
1021 d_eofnblk=''
1022 eagain=''
1023 o_nonblock=''
1024 rd_nodata=''
1025 need_va_copy=''
1026 netdb_hlen_type=''
1027 netdb_host_type=''
1028 netdb_name_type=''
1029 netdb_net_type=''
1030 groupcat=''
1031 hostcat=''
1032 passcat=''
1033 orderlib=''
1034 ranlib=''
1035 d_perl_otherlibdirs=''
1036 otherlibdirs=''
1037 package=''
1038 spackage=''
1039 pager=''
1040 api_revision=''
1041 api_subversion=''
1042 api_version=''
1043 api_versionstring=''
1044 patchlevel=''
1045 perl_patchlevel=''
1046 revision=''
1047 subversion=''
1048 version=''
1049 version_patchlevel_string=''
1050 perl5=''
1051 perladmin=''
1052 perlpath=''
1053 d_nv_preserves_uv=''
1054 d_nv_zero_is_allbits_zero=''
1055 i16size=''
1056 i16type=''
1057 i32size=''
1058 i32type=''
1059 i64size=''
1060 i64type=''
1061 i8size=''
1062 i8type=''
1063 ivsize=''
1064 ivtype=''
1065 nv_overflows_integers_at=''
1066 nv_preserves_uv_bits=''
1067 nvsize=''
1068 nvtype=''
1069 u16size=''
1070 u16type=''
1071 u32size=''
1072 u32type=''
1073 u64size=''
1074 u64type=''
1075 u8size=''
1076 u8type=''
1077 uvsize=''
1078 uvtype=''
1079 ivdformat=''
1080 nvEUformat=''
1081 nvFUformat=''
1082 nvGUformat=''
1083 nveformat=''
1084 nvfformat=''
1085 nvgformat=''
1086 uvXUformat=''
1087 uvoformat=''
1088 uvuformat=''
1089 uvxformat=''
1090 pidtype=''
1091 prefix=''
1092 prefixexp=''
1093 installprivlib=''
1094 privlib=''
1095 privlibexp=''
1096 prototype=''
1097 ptrsize=''
1098 d_PRIXU64=''
1099 d_PRId64=''
1100 d_PRIi64=''
1101 d_PRIo64=''
1102 d_PRIu64=''
1103 d_PRIx64=''
1104 sPRIXU64=''
1105 sPRId64=''
1106 sPRIi64=''
1107 sPRIo64=''
1108 sPRIu64=''
1109 sPRIx64=''
1110 d_quad=''
1111 quadkind=''
1112 quadtype=''
1113 uquadtype=''
1114 drand01=''
1115 randbits=''
1116 randfunc=''
1117 randseedtype=''
1118 seedfunc=''
1119 installscript=''
1120 scriptdir=''
1121 scriptdirexp=''
1122 selectminbits=''
1123 selecttype=''
1124 sh=''
1125 sig_count=''
1126 sig_name=''
1127 sig_name_init=''
1128 sig_num=''
1129 sig_num_init=''
1130 sig_size=''
1131 d_sitearch=''
1132 installsitearch=''
1133 sitearch=''
1134 sitearchexp=''
1135 installsitebin=''
1136 sitebin=''
1137 sitebinexp=''
1138 installsitehtml1dir=''
1139 sitehtml1dir=''
1140 sitehtml1direxp=''
1141 installsitehtml3dir=''
1142 sitehtml3dir=''
1143 sitehtml3direxp=''
1144 installsitelib=''
1145 sitelib=''
1146 sitelib_stem=''
1147 sitelibexp=''
1148 installsiteman1dir=''
1149 siteman1dir=''
1150 siteman1direxp=''
1151 installsiteman3dir=''
1152 siteman3dir=''
1153 siteman3direxp=''
1154 siteprefix=''
1155 siteprefixexp=''
1156 installsitescript=''
1157 sitescript=''
1158 sitescriptexp=''
1159 sizesize=''
1160 sizetype=''
1161 so=''
1162 socksizetype=''
1163 sharpbang=''
1164 shsharp=''
1165 spitshell=''
1166 src=''
1167 ssizetype=''
1168 startperl=''
1169 startsh=''
1170 stdchar=''
1171 d_stdio_stream_array=''
1172 stdio_stream_array=''
1173 sysman=''
1174 trnl=''
1175 uidformat=''
1176 uidsign=''
1177 uidsize=''
1178 uidtype=''
1179 archname64=''
1180 use64bitall=''
1181 use64bitint=''
1182 dtrace=''
1183 usedtrace=''
1184 usefaststdio=''
1185 ccflags_uselargefiles=''
1186 ldflags_uselargefiles=''
1187 libswanted_uselargefiles=''
1188 uselargefiles=''
1189 uselongdouble=''
1190 usemorebits=''
1191 usemultiplicity=''
1192 nm_opt=''
1193 nm_so_opt=''
1194 runnm=''
1195 usenm=''
1196 useperlio=''
1197 usesocks=''
1198 d_oldpthreads=''
1199 use5005threads=''
1200 useithreads=''
1201 usereentrant=''
1202 usethreads=''
1203 incpath=''
1204 mips_type=''
1205 usrinc=''
1206 d_vendorarch=''
1207 installvendorarch=''
1208 vendorarch=''
1209 vendorarchexp=''
1210 d_vendorbin=''
1211 installvendorbin=''
1212 vendorbin=''
1213 vendorbinexp=''
1214 installvendorhtml1dir=''
1215 vendorhtml1dir=''
1216 vendorhtml1direxp=''
1217 installvendorhtml3dir=''
1218 vendorhtml3dir=''
1219 vendorhtml3direxp=''
1220 d_vendorlib=''
1221 installvendorlib=''
1222 vendorlib=''
1223 vendorlib_stem=''
1224 vendorlibexp=''
1225 installvendorman1dir=''
1226 vendorman1dir=''
1227 vendorman1direxp=''
1228 installvendorman3dir=''
1229 vendorman3dir=''
1230 vendorman3direxp=''
1231 usevendorprefix=''
1232 vendorprefix=''
1233 vendorprefixexp=''
1234 d_vendorscript=''
1235 installvendorscript=''
1236 vendorscript=''
1237 vendorscriptexp=''
1238 versiononly=''
1239 defvoidused=''
1240 voidflags=''
1241 yacc=''
1242 yaccflags=''
1243 CONFIG=''
1244
1245 : Detect odd OSs
1246 define='define'
1247 undef='undef'
1248 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1249 rmlist=''
1250
1251 : We must find out about Eunice early
1252 eunicefix=':'
1253 if test -f /etc/unixtovms; then
1254         eunicefix=/etc/unixtovms
1255 fi
1256 if test -f /etc/unixtovms.exe; then
1257         eunicefix=/etc/unixtovms.exe
1258 fi
1259
1260 : Set executable suffix now -- needed before hints available
1261 if test -f "/libs/version.library"; then
1262 : Amiga OS
1263     _exe=""
1264 elif test -f "/system/gnu_library/bin/ar.pm"; then
1265 : Stratus VOS
1266     _exe=".pm"
1267 elif test -n "$DJGPP"; then
1268 : DOS DJGPP
1269     _exe=".exe"
1270 elif test -d c:/. -o -n "$is_os2" ; then
1271 : OS/2 or cygwin
1272     _exe=".exe"
1273 fi
1274
1275 i_whoami=''
1276 : Trailing extension.  Override this in a hint file, if needed.
1277 : Extra object files, if any, needed on this platform.
1278 archobjs=''
1279 archname=''
1280 groupstype=''
1281 libnames=''
1282 : change the next line if compiling for Xenix/286 on Xenix/386
1283 xlibpth='/usr/lib/386 /lib/386'
1284 : Possible local library directories to search.
1285 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1286 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1287
1288 : general looking path for locating libraries
1289 glibpth="/lib /usr/lib $xlibpth"
1290 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1291 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1292 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1293 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1294
1295 : Private path used by Configure to find libraries.  Its value
1296 : is prepended to libpth. This variable takes care of special
1297 : machines, like the mips.  Usually, it should be empty.
1298 plibpth=''
1299
1300 : default library list
1301 libswanted=''
1302 : some systems want to use only the non-versioned libso:s
1303 ignore_versioned_solibs=''
1304 : set usethreads on the Configure command line to enable threads.
1305 usereentrant='undef'
1306 : full support for void wanted by default
1307 defvoidused=15
1308
1309 : Possible local include directories to search.
1310 : Set locincpth to "" in a hint file to defeat local include searches.
1311 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1312 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1313 :
1314 : no include file wanted by default
1315 inclwanted=''
1316
1317 : Enable -DEBUGGING and -DDEBUGGING from the command line
1318 EBUGGING=''
1319 DEBUGGING=old
1320
1321 ccname=''
1322 ccversion=''
1323 perllibs=''
1324 : set useposix=false in your hint file to disable the POSIX extension.
1325 useposix=true
1326 : set useopcode=false in your hint file to disable the Opcode extension.
1327 useopcode=true
1328 archname64=''
1329 ccflags_uselargefiles=''
1330 ldflags_uselargefiles=''
1331 libswanted_uselargefiles=''
1332 : set usemultiplicity on the Configure command line to enable multiplicity.
1333 : set usesocks on the Configure command line to enable socks.
1334 : List of libraries we want.
1335 : If anyone needs extra -lxxx, put those in a hint file.
1336 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1337 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1338 : We probably want to search /usr/shlib before most other libraries.
1339 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1340 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1341 glibpth="/usr/shlib $glibpth"
1342 : Do not use vfork unless overridden by a hint file.
1343 usevfork=false
1344
1345 : Find the basic shell for Bourne shell scripts
1346 case "$sh" in
1347 '')
1348         case "$SYSTYPE" in
1349         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1350         *) xxx='/bin/sh';;
1351         esac
1352         if test -f "$xxx"; then
1353                 sh="$xxx"
1354         else
1355                 : Build up a list and do a single loop so we can 'break' out.
1356                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1357                 for xxx in sh bash ksh pdksh ash; do
1358                         for p in $pth; do
1359                                 try="$try ${p}/${xxx}"
1360                         done
1361                 done
1362                 for xxx in $try; do
1363                         if test -f "$xxx"; then
1364                                 sh="$xxx";
1365                                 break
1366                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1367                                 sh="$xxx";
1368                                 break
1369                         elif test -f "$xxx.exe"; then
1370                                 sh="$xxx";
1371                                 break
1372                         fi
1373                 done
1374         fi
1375         ;;
1376 esac
1377
1378 case "$sh" in
1379 '')     cat >&2 <<EOM
1380 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1381
1382 Usually it's in /bin/sh.  How did you even get this far?
1383 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1384 we'll try to straighten this all out.
1385 EOM
1386         exit 1
1387         ;;
1388 esac
1389
1390 : see if sh knows # comments
1391 if `$sh -c '#' >/dev/null 2>&1`; then
1392         shsharp=true
1393         spitshell=cat
1394         xcat=/bin/cat
1395         test -f $xcat$_exe || xcat=/usr/bin/cat
1396         if test ! -f $xcat$_exe; then
1397                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1398                         if test -f $p/cat$_exe; then
1399                                 xcat=$p/cat
1400                                 break
1401                         fi
1402                 done
1403                 if test ! -f $xcat$_exe; then
1404                         echo "Can't find cat anywhere!"
1405                         exit 1
1406                 fi
1407         fi
1408         echo "#!$xcat" >sharp
1409         $eunicefix sharp
1410         chmod +x sharp
1411         ./sharp > today
1412         if test -s today; then
1413                 sharpbang='#!'
1414         else
1415                 echo "#! $xcat" > sharp
1416                 $eunicefix sharp
1417                 chmod +x sharp
1418                 ./sharp > today
1419                 if test -s today; then
1420                         sharpbang='#! '
1421                 else
1422                         sharpbang=': use '
1423                 fi
1424         fi
1425 else
1426         echo " "
1427         echo "Your $sh doesn't grok # comments--I will strip them later on."
1428         shsharp=false
1429         cd ..
1430         echo "exec grep -v '^[  ]*#'" >spitshell
1431         chmod +x spitshell
1432         $eunicefix spitshell
1433         spitshell=`pwd`/spitshell
1434         cd UU
1435         echo "I presume that if # doesn't work, #! won't work either!"
1436         sharpbang=': use '
1437 fi
1438 rm -f sharp today
1439
1440 : figure out how to guarantee sh startup
1441 case "$startsh" in
1442 '') startsh=${sharpbang}${sh} ;;
1443 *)
1444 esac
1445 cat >sharp <<EOSS
1446 $startsh
1447 set abc
1448 test "$?abc" != 1
1449 EOSS
1450
1451 chmod +x sharp
1452 $eunicefix sharp
1453 if ./sharp; then
1454         : echo "Yup, it does."
1455 else
1456         echo "Hmm... '$startsh' does not guarantee sh startup..."
1457         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1458 fi
1459 rm -f sharp
1460
1461 : Save command line options in file UU/cmdline.opt for later use in
1462 : generating config.sh.
1463 cat > cmdline.opt <<EOSH
1464 : Configure command line arguments.
1465 config_arg0='$0'
1466 config_args='$*'
1467 config_argc=$#
1468 EOSH
1469 argn=1
1470 args_exp=''
1471 args_sep=''
1472 for arg in "$@"; do
1473         cat >>cmdline.opt <<EOSH
1474 config_arg$argn='$arg'
1475 EOSH
1476         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1477 $arg
1478 EOC
1479         arg_exp=`cat cmdl.opt`
1480         args_exp="$args_exp$args_sep'$arg_exp'"
1481         argn=`expr $argn + 1`
1482         args_sep=' '
1483 done
1484 rm -f cmdl.opt
1485
1486 : produce awk script to parse command line options
1487 cat >options.awk <<'EOF'
1488 BEGIN {
1489         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1490
1491         len = length(optstr);
1492         for (i = 1; i <= len; i++) {
1493                 c = substr(optstr, i, 1);
1494                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1495                 if (a == ":") {
1496                         arg[c] = 1;
1497                         i++;
1498                 }
1499                 opt[c] = 1;
1500         }
1501 }
1502 {
1503         expect = 0;
1504         str = $0;
1505         if (substr(str, 1, 1) != "-") {
1506                 printf("'%s'\n", str);
1507                 next;
1508         }
1509         len = length($0);
1510         for (i = 2; i <= len; i++) {
1511                 c = substr(str, i, 1);
1512                 if (!opt[c]) {
1513                         printf("-%s\n", substr(str, i));
1514                         next;
1515                 }
1516                 printf("-%s\n", c);
1517                 if (arg[c]) {
1518                         if (i < len)
1519                                 printf("'%s'\n", substr(str, i + 1));
1520                         else
1521                                 expect = 1;
1522                         next;
1523                 }
1524         }
1525 }
1526 END {
1527         if (expect)
1528                 print "?";
1529 }
1530 EOF
1531
1532 : process the command line options
1533 set X `for arg in "$@"; do echo "X$arg"; done |
1534         sed -e s/X// | awk -f options.awk`
1535 eval "set $*"
1536 shift
1537 rm -f options.awk
1538
1539 : set up default values
1540 fastread=''
1541 reuseval=false
1542 config_sh=''
1543 alldone=''
1544 error=''
1545 silent=''
1546 extractsh=''
1547 override=''
1548 knowitall=''
1549 rm -f optdef.sh posthint.sh
1550 cat >optdef.sh <<EOS
1551 $startsh
1552 EOS
1553
1554
1555 : option parsing
1556 while test $# -gt 0; do
1557         case "$1" in
1558         -d) shift; fastread=yes;;
1559         -e) shift; alldone=cont;;
1560         -f)
1561                 shift
1562                 cd ..
1563                 if test -r "$1"; then
1564                         config_sh="$1"
1565                 else
1566                         echo "$me: cannot read config file $1." >&2
1567                         error=true
1568                 fi
1569                 cd UU
1570                 shift;;
1571         --help|\
1572         -h) shift; error=true;;
1573         -r) shift; reuseval=true;;
1574         -s) shift; silent=true; realsilent=true;;
1575         -E) shift; alldone=exit;;
1576         -K) shift; knowitall=true;;
1577         -O) shift; override=true;;
1578         -S) shift; silent=true; extractsh=true;;
1579         -D)
1580                 shift
1581                 case "$1" in
1582                 *=)
1583                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1584                         echo "$me: ignoring -D $1" >&2
1585                         ;;
1586                 *=*) echo "$1" | \
1587                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1588                 *) echo "$1='define'" >> optdef.sh;;
1589                 esac
1590                 shift
1591                 ;;
1592         -U)
1593                 shift
1594                 case "$1" in
1595                 *=) echo "$1" >> optdef.sh;;
1596                 *=*)
1597                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1598                         echo "$me: ignoring -U $1" >&2
1599                         ;;
1600                 *) echo "$1='undef'" >> optdef.sh;;
1601                 esac
1602                 shift
1603                 ;;
1604         -A)
1605             shift
1606             xxx=''
1607             yyy="$1"
1608             zzz=''
1609             uuu=undef
1610             case "$yyy" in
1611             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1612                  case "$zzz" in
1613                  *:*) zzz='' ;;
1614                  *)   xxx=append
1615                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1616                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1617                  esac
1618                  ;;
1619             esac
1620             case "$xxx" in
1621             '')  case "$yyy" in
1622                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1623                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1624                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1625                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1626                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1627                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1628                  esac
1629                  ;;
1630             esac
1631             case "$xxx" in
1632             append)
1633                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1634             clear)
1635                 echo "$yyy=''"                  >> posthint.sh ;;
1636             define)
1637                 case "$zzz" in
1638                 '') zzz=define ;;
1639                 esac
1640                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1641             eval)
1642                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1643             prepend)
1644                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1645             undef)
1646                 case "$zzz" in
1647                 '') zzz="$uuu" ;;
1648                 esac
1649                 echo "$yyy=$zzz"                >> posthint.sh ;;
1650             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1651             esac
1652             shift
1653             ;;
1654         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1655             exit 0;;
1656         --) break;;
1657         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1658         *) break;;
1659         esac
1660 done
1661
1662 case "$error" in
1663 true)
1664         cat >&2 <<EOM
1665 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1666                  [-U symbol] [-U symbol=] [-A command:symbol...]
1667   -d : use defaults for all answers.
1668   -e : go on without questioning past the production of config.sh.
1669   -f : specify an alternate default configuration file.
1670   -h : print this help message and exit (with an error status).
1671   -r : reuse C symbols value if possible (skips costly nm extraction).
1672   -s : silent mode, only echoes questions and essential information.
1673   -D : define symbol to have some value:
1674          -D symbol         symbol gets the value 'define'
1675          -D symbol=value   symbol gets the value 'value'
1676        common used examples (see INSTALL for more info):
1677          -Duse64bitint            use 64bit integers
1678          -Duse64bitall            use 64bit integers and pointers
1679          -Dusethreads             use thread support
1680          -Dinc_version_list=none  do not include older perl trees in @INC
1681          -DEBUGGING=none          DEBUGGING options
1682          -Dcc=gcc                 choose your compiler
1683          -Dprefix=/opt/perl5      choose your destination
1684   -E : stop at the end of questions, after having produced config.sh.
1685   -K : do not use unless you know what you are doing.
1686   -O : let -D and -U override definitions from loaded configuration file.
1687   -S : perform variable substitutions on all .SH files (can mix with -f)
1688   -U : undefine symbol:
1689          -U symbol    symbol gets the value 'undef'
1690          -U symbol=   symbol gets completely empty
1691        e.g.:  -Uversiononly
1692   -A : manipulate symbol after the platform specific hints have been applied:
1693          -A append:symbol=value   append value to symbol
1694          -A symbol=value          like append:, but with a separating space
1695          -A define:symbol=value   define symbol to have value
1696          -A clear:symbol          define symbol to be ''
1697          -A define:symbol         define symbol to be 'define'
1698          -A eval:symbol=value     define symbol to be eval of value
1699          -A prepend:symbol=value  prepend value to symbol
1700          -A undef:symbol          define symbol to be 'undef'
1701          -A undef:symbol=         define symbol to be ''
1702        e.g.:  -A prepend:libswanted='cl pthread '
1703               -A ccflags=-DSOME_MACRO
1704   -V : print version number and exit (with a zero status).
1705 EOM
1706         exit 1
1707         ;;
1708 esac
1709
1710 : Sanity checks
1711 case "$fastread$alldone" in
1712 yescont|yesexit) ;;
1713 *)
1714         case "$extractsh" in
1715         true) ;;
1716         *)
1717                 if test ! -t 0; then
1718                         echo "Say 'sh Configure', not 'sh <Configure'"
1719                         exit 1
1720                 fi
1721                 ;;
1722         esac
1723         ;;
1724 esac
1725
1726 exec 4>&1
1727 case "$silent" in
1728 true) exec 1>/dev/null;;
1729 esac
1730
1731 : run the defines and the undefines, if any, but leave the file out there...
1732 touch optdef.sh
1733 . ./optdef.sh
1734 : create the posthint manipulation script and leave the file out there...
1735 touch posthint.sh
1736
1737 : set package name
1738 package='perl5'
1739 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1740 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1741 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1742 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1743 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1744 esac
1745
1746 : Some greps do not return status, grrr.
1747 echo "grimblepritz" >grimble
1748 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1749         contains=contains
1750 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1751         contains=grep
1752 else
1753         contains=contains
1754 fi
1755 rm -f grimble
1756 : the following should work in any shell
1757 case "$contains" in
1758 contains*)
1759         echo " "
1760         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1761         cat >contains <<'EOSS'
1762 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1763 EOSS
1764 chmod +x contains
1765 esac
1766
1767 : Find the path to the source tree
1768 case "$src" in
1769 '') case "$0" in
1770     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1771          case "$src" in
1772          /*)    ;;
1773          .)     ;;
1774          *)     src=`cd ../$src && pwd` ;;
1775          esac
1776          ;;
1777     *)   src='.';;
1778     esac;;
1779 esac
1780 case "$src" in
1781 '')     src=/
1782         rsrc=/
1783         ;;
1784 /*)     rsrc="$src";;
1785 *)      rsrc="../$src";;
1786 esac
1787 if test -f $rsrc/Configure && \
1788         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1789 then
1790    : found it, so we are ok.
1791 else
1792         rsrc=''
1793         for src in . .. ../.. ../../.. ../../../..; do
1794                 if test -f ../$src/Configure && \
1795                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1796                 then
1797                         rsrc=../$src
1798                         break
1799                 fi
1800         done
1801 fi
1802 case "$rsrc" in
1803 '')
1804         cat <<EOM >&4
1805
1806 Sorry, I can't seem to locate the source dir for $package.  Please start
1807 Configure with an explicit path -- i.e. /some/path/Configure.
1808
1809 EOM
1810         exit 1
1811         ;;
1812 ../.)   rsrc='..';;
1813 *)
1814         echo " "
1815         echo "Sources for $package found in \"$src\"." >&4
1816         ;;
1817 esac
1818
1819 : script used to extract .SH files with variable substitutions
1820 cat >extract <<'EOS'
1821 PERL_CONFIG_SH=true
1822 echo "Doing variable substitutions on .SH files..."
1823 if test -f MANIFEST; then
1824         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1825 else
1826         echo "(Looking for .SH files under the source directory.)"
1827         set x `(cd "$src"; find . -name "*.SH" -print)`
1828 fi
1829 shift
1830 case $# in
1831 0) set x `(cd "$src"; echo *.SH)`; shift;;
1832 esac
1833 if test ! -f "$src/$1"; then
1834         shift
1835 fi
1836 mkdir_p='
1837 name=$1;
1838 create="";
1839 while test $name; do
1840         if test ! -d "$name"; then
1841                 create="$name $create";
1842                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1843                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1844         else
1845                 name="";
1846         fi;
1847 done;
1848 for file in $create; do
1849         mkdir $file;
1850 done
1851 '
1852 for file in $*; do
1853         case "$src" in
1854         ".")
1855                 case "$file" in
1856                 */*)
1857                         dir=`expr X$file : 'X\(.*\)/'`
1858                         file=`expr X$file : 'X.*/\(.*\)'`
1859                         (cd "$dir" && . ./$file)
1860                         ;;
1861                 *)
1862                         . ./$file
1863                         ;;
1864                 esac
1865                 ;;
1866         *)
1867                 case "$file" in
1868                 */*)
1869                         dir=`expr X$file : 'X\(.*\)/'`
1870                         file=`expr X$file : 'X.*/\(.*\)'`
1871                         (set x $dir; shift; eval $mkdir_p)
1872                         sh <"$src/$dir/$file"
1873                         ;;
1874                 *)
1875                         sh <"$src/$file"
1876                         ;;
1877                 esac
1878                 ;;
1879         esac
1880 done
1881 if test -f "$src/config_h.SH"; then
1882         if test ! -f config.h; then
1883         : oops, they left it out of MANIFEST, probably, so do it anyway.
1884         . "$src/config_h.SH"
1885         fi
1886 fi
1887 EOS
1888
1889 : extract files and exit if asked to do so
1890 case "$extractsh" in
1891 true)
1892         case "$realsilent" in
1893         true) ;;
1894         *) exec 1>&4;;
1895         esac
1896         case "$config_sh" in
1897         '') config_sh='config.sh';;
1898         esac
1899         echo " "
1900         echo "Fetching answers from $config_sh..."
1901         cd ..
1902         . $config_sh
1903         test "$override" && . ./optdef.sh
1904         echo " "
1905         . UU/extract
1906         rm -rf UU
1907         echo "Extraction done."
1908         exit 0
1909         ;;
1910 esac
1911
1912 : Eunice requires " " instead of "", can you believe it
1913 echo " "
1914 : Here we go...
1915 echo "Beginning of configuration questions for $package."
1916
1917 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1918
1919 : first determine how to suppress newline on echo command
1920 echo " "
1921 echo "Checking echo to see how to suppress newlines..."
1922 (echo "hi there\c" ; echo " ") >.echotmp
1923 if $contains c .echotmp >/dev/null 2>&1 ; then
1924         echo "...using -n."
1925         n='-n'
1926         c=''
1927 else
1928         cat <<'EOM'
1929 ...using \c
1930 EOM
1931         n=''
1932         c='\c'
1933 fi
1934 echo $n "The star should be here-->$c"
1935 echo '*'
1936 rm -f .echotmp
1937
1938 : Now test for existence of everything in MANIFEST
1939 echo " "
1940 if test -f "$rsrc/MANIFEST"; then
1941         echo "First let's make sure your kit is complete.  Checking..." >&4
1942         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" |\
1943                 (split -l 50 2>/dev/null || split -50)
1944         rm -f missing
1945         tmppwd=`pwd`
1946         for filelist in x??; do
1947                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1948                         >/dev/null 2>>"$tmppwd/missing")
1949         done
1950         if test -s missing; then
1951                 cat missing >&4
1952                 cat >&4 <<'EOM'
1953
1954 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1955
1956 You have the option of continuing the configuration process, despite the
1957 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1958 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1959 and contact the author (perlbug@perl.org).
1960
1961 EOM
1962                 echo $n "Continue? [n] $c" >&4
1963                 read ans
1964                 case "$ans" in
1965                 y*)
1966                         echo "Continuing..." >&4
1967                         rm -f missing
1968                         ;;
1969                 *)
1970                         echo "ABORTING..." >&4
1971                         kill $$
1972                         ;;
1973                 esac
1974         else
1975                 echo "Looks good..."
1976         fi
1977 else
1978         echo "There is no MANIFEST file.  I hope your kit is complete !"
1979 fi
1980 rm -f missing x??
1981
1982 : Find the appropriate value for a newline for tr
1983 echo " "
1984 if test -n "$DJGPP"; then
1985        trnl='\012'
1986 fi
1987 if test X"$trnl" = X; then
1988         case "`echo foo|tr '\n' x 2>/dev/null`" in
1989         foox) trnl='\n' ;;
1990         esac
1991 fi
1992 if test X"$trnl" = X; then
1993         case "`echo foo|tr '\012' x 2>/dev/null`" in
1994         foox) trnl='\012' ;;
1995         esac
1996 fi
1997 if test X"$trnl" = X; then
1998        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1999        fooxy) trnl='\n\r' ;;
2000        esac
2001 fi
2002 if test X"$trnl" = X; then
2003         cat <<EOM >&2
2004
2005 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2006
2007 EOM
2008         exit 1
2009 fi
2010
2011 : compute the number of columns on the terminal for proper question formatting
2012 case "$COLUMNS" in
2013 '') COLUMNS='80';;
2014 esac
2015
2016 : set up the echo used in my read
2017 myecho="case \"\$xxxm\" in
2018 '') echo $n \"\$rp $c\" >&4;;
2019 *) case \"\$rp\" in
2020         '') echo $n \"[\$xxxm] $c\";;
2021         *)
2022                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2023                         echo \"\$rp\" >&4
2024                         echo $n \"[\$xxxm] $c\" >&4
2025                 else
2026                         echo $n \"\$rp [\$xxxm] $c\" >&4
2027                 fi
2028                 ;;
2029         esac;;
2030 esac"
2031
2032 : now set up to do reads with possible shell escape and default assignment
2033 cat <<EOSC >myread
2034 $startsh
2035 xxxm=\$dflt
2036 $myecho
2037 ans='!'
2038 case "\$fastread" in
2039 yes) case "\$dflt" in
2040         '') ;;
2041         *) ans='';
2042                 case "\$silent-\$rp" in
2043                 true-) ;;
2044                 *) echo " " >&4;;
2045                 esac;;
2046         esac;;
2047 *) case "\$silent" in
2048         true) case "\$rp" in
2049                 '') ans='';;
2050                 esac;;
2051         esac;;
2052 esac
2053 while expr "X\$ans" : "X!" >/dev/null; do
2054         read answ
2055         set x \$xxxm
2056         shift
2057         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2058         case  "\$answ" in
2059         "!")
2060                 sh 1>&4
2061                 echo " "
2062                 $myecho
2063                 ;;
2064         !*)
2065                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2066                 shift
2067                 sh 1>&4 -c "\$*"
2068                 echo " "
2069                 $myecho
2070                 ;;
2071         "\$ans")
2072                 case "\$ans" in
2073                 \\&*)
2074                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2075                         shift
2076                         case "\$1" in
2077                         -d)
2078                                 fastread=yes
2079                                 echo "(OK, I'll run with -d after this question.)" >&4
2080                                 ;;
2081                         -*)
2082                                 echo "*** Sorry, \$1 not supported yet." >&4
2083                                 ;;
2084                         esac
2085                         $myecho
2086                         ans=!
2087                         ;;
2088                 esac;;
2089         *)
2090                 case "\$aok" in
2091                 y)
2092                         echo "*** Substitution done -- please confirm."
2093                         xxxm="\$ans"
2094                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2095                         xxxm="\$ans"
2096                         ans=!
2097                         ;;
2098                 *)
2099                         echo "*** Error -- try again."
2100                         ans=!
2101                         ;;
2102                 esac
2103                 $myecho
2104                 ;;
2105         esac
2106         case "\$ans\$xxxm\$nostick" in
2107         '')
2108                 ans=!
2109                 $myecho
2110                 ;;
2111         esac
2112 done
2113 case "\$ans" in
2114 '') ans="\$xxxm";;
2115 esac
2116 EOSC
2117
2118 : create .config dir to save info across Configure sessions
2119 test -d ../.config || mkdir ../.config
2120 cat >../.config/README <<EOF
2121 This directory created by Configure to save information that should
2122 persist across sessions for $package.
2123
2124 You may safely delete it if you wish.
2125 EOF
2126
2127 : See if we are using a devel version and want that
2128 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2129 case "$usedevel" in
2130 $define|true|[yY]*) ;;
2131 *) case "$xversion" in
2132    *[13579])
2133         cat >&4 <<EOH
2134 *** WHOA THERE!!! ***
2135
2136     This is an UNSTABLE DEVELOPMENT release.
2137     The version of this $package distribution is $xversion, that is, odd,
2138     (as opposed to even) and that signifies a development release.
2139     If you want a maintenance release, you want an even-numbered version.
2140
2141     Do ***NOT*** install this into production use.
2142     Data corruption and crashes are possible.
2143
2144     It is most seriously suggested that you do not continue any further
2145     unless you want to help in developing and debugging Perl.
2146
2147     If you *still* want to build perl, you can answer 'y' now,
2148     or pass -Dusedevel to Configure.
2149
2150 EOH
2151         rp='Do you really want to continue?'
2152         dflt='n'
2153         . ./myread
2154         case "$ans" in
2155         [yY]) echo >&4 "Okay, continuing."
2156               usedevel="$define" ;;
2157         *) echo >&4 "Okay, bye."
2158            exit 1
2159            ;;
2160         esac
2161         ;;
2162     esac
2163     ;;
2164 esac
2165 case "$usedevel" in
2166 $define|true|[yY]*)
2167         case "$versiononly" in
2168         '') versiononly="$define" ;;
2169         esac
2170         case "$installusrbinperl" in
2171         '') installusrbinperl="$undef" ;;
2172         esac
2173         ;;
2174 esac
2175
2176 : general instructions
2177 needman=true
2178 firsttime=true
2179 user=`(logname) 2>/dev/null`
2180 case "$user" in
2181 '') user=`whoami 2>&1`;;
2182 esac
2183 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2184         firsttime=false
2185         echo " "
2186         rp='Would you like to see the instructions?'
2187         dflt=n
2188         . ./myread
2189         case "$ans" in
2190         [yY]*) ;;
2191         *) needman=false;;
2192         esac
2193 fi
2194 if $needman; then
2195         cat <<EOH
2196
2197 This installation shell script will examine your system and ask you questions
2198 to determine how the perl5 package should be installed. If you get
2199 stuck on a question, you may use a ! shell escape to start a subshell or
2200 execute a command.  Many of the questions will have default answers in square
2201 brackets; typing carriage return will give you the default.
2202
2203 On some of the questions which ask for file or directory names you are allowed
2204 to use the ~name construct to specify the login directory belonging to "name",
2205 even if you don't have a shell which knows about that.  Questions where this is
2206 allowed will be marked "(~name ok)".
2207
2208 EOH
2209         rp=''
2210         dflt='Type carriage return to continue'
2211         . ./myread
2212         cat <<'EOH'
2213
2214 The prompter used in this script allows you to use shell variables and
2215 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2216 in the default answer, as if the default line was a set of arguments given to a
2217 script shell.  This means you may also use $* to repeat the whole default line,
2218 so you do not have to re-type everything to add something to the default.
2219
2220 Everytime there is a substitution, you will have to confirm.  If there is an
2221 error (e.g. an unmatched backtick), the default answer will remain unchanged
2222 and you will be prompted again.
2223
2224 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2225 the questions and use the computed defaults (or the previous answers if there
2226 was already a config.sh file). Type 'Configure -h' for a list of options.
2227 You may also start interactively and then answer '& -d' at any prompt to turn
2228 on the non-interactive behaviour for the remainder of the execution.
2229
2230 EOH
2231         . ./myread
2232         cat <<EOH
2233
2234 Much effort has been expended to ensure that this shell script will run on any
2235 Unix system.  If despite that it blows up on yours, your best bet is to edit
2236 Configure and run it again.  If you can't run Configure for some reason,
2237 you'll have to generate a config.sh file by hand.  Whatever problems you
2238 have, let me (perlbug@perl.org) know how I blew it.
2239
2240 This installation script affects things in two ways:
2241
2242 1) it may do direct variable substitutions on some of the files included
2243    in this kit.
2244 2) it builds a config.h file for inclusion in C programs.  You may edit
2245    any of these files as the need arises after running this script.
2246
2247 If you make a mistake on a question, there is no easy way to back up to it
2248 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2249 files.  Configure will offer to let you do this before it runs the SH files.
2250
2251 EOH
2252         dflt='Type carriage return to continue'
2253         . ./myread
2254         case "$firsttime" in
2255         true) echo $user >>../.config/instruct;;
2256         esac
2257 fi
2258
2259 : find out where common programs are
2260 echo " "
2261 echo "Locating common programs..." >&4
2262 cat <<EOSC >loc
2263 $startsh
2264 case \$# in
2265 0) exit 1;;
2266 esac
2267 thing=\$1
2268 shift
2269 dflt=\$1
2270 shift
2271 for dir in \$*; do
2272         case "\$thing" in
2273         .)
2274         if test -d \$dir/\$thing; then
2275                 echo \$dir
2276                 exit 0
2277         fi
2278         ;;
2279         *)
2280         for thisthing in \$dir/\$thing; do
2281                 : just loop through to pick last item
2282         done
2283         if test -f \$thisthing; then
2284                 echo \$thisthing
2285                 exit 0
2286         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2287                 echo \$thisthing
2288                 exit 0
2289         elif test -f \$dir/\$thing.exe; then
2290                 if test -n "$DJGPP"; then
2291                         echo \$dir/\$thing.exe
2292                 elif test "$eunicefix" != ":"; then
2293                         : on Eunice apparently
2294                         echo \$dir/\$thing
2295                 fi
2296                 exit 0
2297         fi
2298         ;;
2299         esac
2300 done
2301 echo \$dflt
2302 exit 1
2303 EOSC
2304 chmod +x loc
2305 $eunicefix loc
2306 loclist="
2307 awk
2308 cat
2309 chmod
2310 comm
2311 cp
2312 echo
2313 expr
2314 grep
2315 ls
2316 mkdir
2317 rm
2318 sed
2319 sort
2320 touch
2321 tr
2322 uniq
2323 "
2324 trylist="
2325 ar
2326 bison
2327 byacc
2328 cpp
2329 csh
2330 date
2331 egrep
2332 gmake
2333 gzip
2334 less
2335 ln
2336 make
2337 more
2338 nm
2339 nroff
2340 pg
2341 test
2342 uname
2343 zip
2344 "
2345 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2346 pth="$pth /lib /usr/lib"
2347 for file in $loclist; do
2348         eval xxx=\$$file
2349         case "$xxx" in
2350         /*|?:[\\/]*)
2351                 if test -f "$xxx"; then
2352                         : ok
2353                 else
2354                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2355                         xxx=`./loc $file $file $pth`
2356                 fi
2357                 ;;
2358         '') xxx=`./loc $file $file $pth`;;
2359         *) xxx=`./loc $xxx $xxx $pth`;;
2360         esac
2361         eval $file=$xxx$_exe
2362         eval _$file=$xxx
2363         case "$xxx" in
2364         /*)
2365                 echo $file is in $xxx.
2366                 ;;
2367         ?:[\\/]*)
2368                 echo $file is in $xxx.
2369                 ;;
2370         *)
2371                 echo "I don't know where '$file' is, and my life depends on it." >&4
2372                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2373                 exit 1
2374                 ;;
2375         esac
2376 done
2377 echo " "
2378 echo "Don't worry if any of the following aren't found..."
2379 say=offhand
2380 for file in $trylist; do
2381         eval xxx=\$$file
2382         case "$xxx" in
2383         /*|?:[\\/]*)
2384                 if test -f "$xxx"; then
2385                         : ok
2386                 else
2387                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2388                         xxx=`./loc $file $file $pth`
2389                 fi
2390                 ;;
2391         '') xxx=`./loc $file $file $pth`;;
2392         *) xxx=`./loc $xxx $xxx $pth`;;
2393         esac
2394         eval $file=$xxx$_exe
2395         eval _$file=$xxx
2396         case "$xxx" in
2397         /*)
2398                 echo $file is in $xxx.
2399                 ;;
2400         ?:[\\/]*)
2401                 echo $file is in $xxx.
2402                 ;;
2403         *)
2404                 echo "I don't see $file out there, $say."
2405                 say=either
2406                 ;;
2407         esac
2408 done
2409 case "$egrep" in
2410 egrep)
2411         echo "Substituting grep for egrep."
2412         egrep=$grep
2413         _egrep=$grep
2414         ;;
2415 esac
2416 case "$ln" in
2417 ln)
2418         echo "Substituting cp for ln."
2419         ln=$cp
2420         _ln=$cp
2421         ;;
2422 esac
2423 case "$make" in
2424 make)
2425         case "$gmake" in
2426         gmake)
2427         echo "I can't find make or gmake, and my life depends on it." >&4
2428         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2429         exit 1
2430         ;;
2431         esac
2432         ;;
2433 esac
2434 case "$gmake" in
2435 gmake)  ;;
2436 *)      # We can't have osname yet.
2437         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2438                 # Assume that gmake, if found, is definitely GNU make
2439                 # and prefer it over the system make.
2440                 echo "Substituting gmake for make."
2441                 make=$gmake
2442                 _make=$gmake
2443         fi
2444         ;;
2445 esac
2446 case "$test" in
2447 test)
2448         echo "Hopefully test is built into your sh."
2449         ;;
2450 *)
2451         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2452                 echo "Using the test built into your sh."
2453                 test=test
2454                 _test=test
2455         fi
2456         ;;
2457 esac
2458 case "$echo" in
2459 echo)
2460         echo "Hopefully echo is built into your sh."
2461         ;;
2462 '') ;;
2463 *)
2464         echo " "
2465 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2466         $echo $n "hi there$c" >foo1
2467         echo $n "hi there$c" >foo2
2468         if cmp foo1 foo2 >/dev/null 2>&1; then
2469                 echo "They are compatible.  In fact, they may be identical."
2470         else
2471                 case "$n" in
2472                 '-n') n='' c='\c';;
2473                 *) n='-n' c='';;
2474                 esac
2475                 cat <<FOO
2476 They are not compatible!  You are probably running ksh on a non-USG system.
2477 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2478 have echo built in and we may have to run some Bourne shell scripts.  That
2479 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2480
2481 FOO
2482                 $echo $n "The star should be here-->$c"
2483                 $echo "*"
2484         fi
2485         $rm -f foo1 foo2
2486         ;;
2487 esac
2488
2489 # This question was auctioned at YAPC::Europe-2007 in Vienna
2490 # I never promised you could answer it. I only auctioned the question.
2491 cat <<FOO
2492 The following message is sponsored by
2493
2494   Dresden.pm<--The stars should be here.
2495
2496 Dear Perl user, system administrator or package
2497 maintainer, the Perl community sends greetings to
2498 you. Do you (emblematical) greet back [Y/n]? n
2499
2500 FOO
2501
2502 : Check what type of C compiler we use
2503 cat <<EOS >trygcc
2504 $startsh
2505 EOS
2506 cat <<'EOSC' >>trygcc
2507 case "$cc" in
2508 '') ;;
2509 *)  $rm -f try try.*
2510     $cat >try.c <<EOM
2511 int main(int argc, char *argv[]) {
2512   return 0;
2513 }
2514 EOM
2515     if $cc -o try $ccflags $ldflags try.c; then
2516        :
2517     else
2518         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2519         despair=yes
2520         trygcc=yes
2521         case "$cc" in
2522         *gcc*) trygcc=no ;;
2523         esac
2524         # Skip this test because it gives a false match on output like:
2525         #    ./trygcc: line 23: cc: command not found
2526         # case "`$cc -v -c try.c 2>&1`" in
2527         # *gcc*) trygcc=no ;;
2528         # esac
2529         if $test X"$trygcc" = Xyes; then
2530             if gcc -o try -c try.c; then
2531                 echo " "
2532                 echo "You seem to have a working gcc, though." >&4
2533                 # Switching compilers may undo the work of hints files.
2534                 # The most common problem is -D_REENTRANT for threads.
2535                 # This heuristic catches that case, but gets false positives
2536                 # if -Dusethreads was not actually specified.  Better to
2537                 # bail out here with a useful message than fail 
2538                 # mysteriously later. Should we perhaps just try to
2539                 # re-invoke Configure -Dcc=gcc config_args ?
2540                 if $test -f usethreads.cbu; then
2541                         $cat >&4 <<EOM 
2542
2543 *** However, any setting of the C compiler flags (e.g. for thread support)
2544 *** will be lost.  It may be necessary for you to restart Configure and
2545 *** add -Dcc=gcc to your Configure command line.
2546
2547 EOM
2548                         rp="Would you like to go ahead and try gcc anyway?"
2549                         dflt=n
2550                 else
2551                         rp="Would you like to use it?"
2552                         dflt=y
2553                 fi
2554                 if $test -f myread; then
2555                     . ./myread
2556                 else
2557                     if $test -f UU/myread; then
2558                         . ./UU/myread
2559                     else
2560                         echo "Cannot find myread, sorry.  Aborting." >&2
2561                         exit 1
2562                     fi
2563                 fi  
2564                 case "$ans" in
2565                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2566                 esac
2567             fi
2568         fi
2569     fi
2570     $rm -f try try.*
2571     ;;
2572 esac
2573 EOSC
2574
2575 cat <<EOS >checkcc
2576 $startsh
2577 EOS
2578 cat <<'EOSC' >>checkcc
2579 case "$cc" in        
2580 '') ;;
2581 *)  $rm -f try try.*              
2582     $cat >try.c <<EOM
2583 int main(int argc, char *argv[]) {
2584   return 0;
2585 }
2586 EOM
2587     if $cc -o try $ccflags $ldflags try.c; then
2588        :
2589     else
2590         if $test X"$despair" = Xyes; then
2591            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2592         fi
2593         $cat >&4 <<EOM         
2594 You need to find a working C compiler.
2595 Either (purchase and) install the C compiler supplied by your OS vendor,
2596 or for a free C compiler try http://gcc.gnu.org/
2597 I cannot continue any further, aborting.
2598 EOM
2599         exit 1
2600     fi
2601     $rm -f try try.*
2602     ;;
2603 esac
2604 EOSC
2605
2606 : determine whether symbolic links are supported
2607 echo " "
2608 $touch blurfl
2609 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2610         echo "Symbolic links are supported." >&4
2611         lns="$ln -s"
2612 else
2613         echo "Symbolic links are NOT supported." >&4
2614         lns="$ln"
2615 fi
2616 $rm -f blurfl sym
2617
2618 : determine whether symbolic links are supported
2619 echo " "
2620 case "$lns" in
2621 *"ln"*" -s")
2622         echo "Checking how to test for symbolic links..." >&4
2623         $lns blurfl sym
2624         if $test "X$issymlink" = X; then
2625                 case "$newsh" in
2626                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2627                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2628                 esac
2629                 if test $? = 0; then
2630                         issymlink="test -h"
2631                 else
2632                         echo "Your builtin 'test -h' may be broken." >&4
2633                         case "$test" in
2634                         /*)     ;;
2635                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2636                                 for p in $pth
2637                                 do
2638                                         if test -f "$p/$test"; then
2639                                                 test="$p/$test"
2640                                                 break
2641                                         fi
2642                                 done
2643                                 ;;
2644                         esac
2645                         case "$test" in
2646                         /*)
2647                                 echo "Trying external '$test -h'." >&4
2648                                 issymlink="$test -h"
2649                                 if $test ! -h sym >/dev/null 2>&1; then
2650                                         echo "External '$test -h' is broken, too." >&4
2651                                         issymlink=''
2652                                 fi
2653                                 ;;
2654                         *)      issymlink='' ;;
2655                         esac
2656                 fi              
2657         fi
2658         if $test "X$issymlink" = X; then
2659                 if $test -L sym 2>/dev/null; then
2660                         issymlink="$test -L"
2661                         echo "The builtin '$test -L' worked." >&4
2662                 fi
2663         fi
2664         if $test "X$issymlink" != X; then
2665                 echo "You can test for symbolic links with '$issymlink'." >&4
2666         else
2667                 echo "I do not know how you can test for symbolic links." >&4
2668         fi
2669         $rm -f blurfl sym
2670         ;;
2671 *)      echo "No symbolic links, so not testing for their testing..." >&4
2672         ;;
2673 esac
2674 echo " "
2675
2676 : Make symlinks util
2677 case "$mksymlinks" in
2678 $define|true|[yY]*)
2679         case "$src" in
2680         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2681                 exit 1
2682                 ;;
2683         *)      case "$lns:$issymlink" in
2684                 *"ln"*" -s:"*"test -"?)
2685                         echo "Creating the symbolic links..." >&4
2686                         echo "(First creating the subdirectories...)" >&4
2687                         cd ..
2688                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2689                                 read directory
2690                                 test -z "$directory" && break
2691                                 mkdir -p $directory
2692                         done
2693                         # Sanity check 1.
2694                         if test ! -d t/base; then
2695                                 echo "Failed to create the subdirectories.  Aborting." >&4
2696                                 exit 1
2697                         fi
2698                         echo "(Then creating the symlinks...)" >&4
2699                         awk '{print $1}' $src/MANIFEST | while true; do
2700                                 read filename
2701                                 test -z "$filename" && break
2702                                 if test -f $filename; then
2703                                         if $issymlink $filename; then
2704                                                 rm -f $filename
2705                                         fi
2706                                 fi
2707                                 if test -f $filename; then
2708                                         echo "$filename already exists, not symlinking."
2709                                 else
2710                                         ln -s $src/$filename $filename
2711                                 fi
2712                         done
2713                         # Sanity check 2.
2714                         if test ! -f t/base/lex.t; then
2715                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2716                                 exit 1
2717                         fi
2718                         cd UU
2719                         ;;
2720                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2721                         ;;
2722                 esac
2723                 ;;
2724         esac
2725         ;;
2726 esac
2727
2728 : Check for Cross-Compilation
2729 case "$usecrosscompile" in
2730 $define|true|[yY]*)
2731         $echo "Cross-compiling..."
2732         croak=''
2733         case "$cc" in
2734         *-*-gcc) # A cross-compiling gcc, probably.
2735             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2736             ar=$targetarch-ar
2737             # leave out ld, choosing it is more complex
2738             nm=$targetarch-nm
2739             ranlib=$targetarch-ranlib
2740             $echo 'extern int foo;' > try.c
2741             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2742             shift
2743             if $test $# -gt 0; then
2744                 incpth="$incpth $*"
2745                 incpth="`$echo $incpth|$sed 's/^ //'`"
2746                 echo "Guessing incpth '$incpth'." >&4
2747                 for i in $*; do
2748                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2749                     if $test -d $j; then
2750                         libpth="$libpth $j"
2751                     fi
2752                 done   
2753                 libpth="`$echo $libpth|$sed 's/^ //'`"
2754                 echo "Guessing libpth '$libpth'." >&4
2755             fi
2756             $rm -f try.c
2757             ;;
2758         esac
2759         case "$targetarch" in
2760         '') echo "Targetarch not defined." >&4; croak=y ;;
2761         *)  echo "Using targetarch $targetarch." >&4 ;;
2762         esac
2763         case "$incpth" in
2764         '') echo "Incpth not defined." >&4; croak=y ;;
2765         *)  echo "Using incpth '$incpth'." >&4 ;;
2766         esac
2767         case "$libpth" in
2768         '') echo "Libpth not defined." >&4; croak=y ;;
2769         *)  echo "Using libpth '$libpth'." >&4 ;;
2770         esac
2771         case "$usrinc" in
2772         '') for i in $incpth; do
2773                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2774                     usrinc=$i
2775                     echo "Guessing usrinc $usrinc." >&4
2776                     break
2777                 fi
2778             done
2779             case "$usrinc" in
2780             '') echo "Usrinc not defined." >&4; croak=y ;;
2781             esac
2782             ;;
2783         *)  echo "Using usrinc $usrinc." >&4 ;;
2784         esac
2785         case "$targethost" in
2786         '') echo "Targethost not defined." >&4; croak=y ;;
2787         *)  echo "Using targethost $targethost." >&4
2788         esac
2789         locincpth=' '
2790         loclibpth=' '
2791         case "$croak" in
2792         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2793         esac
2794         case "$src" in
2795         /*) run=$src/Cross/run
2796             targetmkdir=$src/Cross/mkdir
2797             to=$src/Cross/to
2798             from=$src/Cross/from
2799             ;;
2800         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2801             run=$pwd/Cross/run
2802             targetmkdir=$pwd/Cross/mkdir
2803             to=$pwd/Cross/to
2804             from=$pwd/Cross/from
2805             ;;
2806         esac
2807         case "$targetrun" in
2808         '') targetrun=ssh ;;
2809         esac
2810         case "$targetto" in
2811         '') targetto=scp ;;
2812         esac
2813         case "$targetfrom" in
2814         '') targetfrom=scp ;;
2815         esac
2816         run=$run-$targetrun
2817         to=$to-$targetto
2818         from=$from-$targetfrom
2819         case "$targetdir" in
2820         '')  targetdir=/tmp
2821              echo "Guessing targetdir $targetdir." >&4
2822              ;;
2823         esac
2824         case "$targetuser" in
2825         '')  targetuser=root
2826              echo "Guessing targetuser $targetuser." >&4
2827              ;;
2828         esac
2829         case "$targetfrom" in
2830         scp)    q=-q ;;
2831         *)      q='' ;;
2832         esac
2833         case "$targetrun" in
2834         ssh|rsh)
2835             cat >$run <<EOF
2836 #!/bin/sh
2837 case "\$1" in
2838 -cwd)
2839   shift
2840   cwd=\$1
2841   shift
2842   ;;
2843 esac
2844 case "\$cwd" in
2845 '') cwd=$targetdir ;;
2846 esac
2847 exe=\$1
2848 shift
2849 if $test ! -f \$exe.xok; then
2850   $to \$exe
2851   $touch \$exe.xok
2852 fi
2853 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2854 EOF
2855             ;;
2856         *)  echo "Unknown targetrun '$targetrun'" >&4
2857             exit 1
2858             ;;
2859         esac
2860         case "$targetmkdir" in
2861         */Cross/mkdir)
2862             cat >$targetmkdir <<EOF
2863 #!/bin/sh
2864 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2865 EOF
2866             $chmod a+rx $targetmkdir
2867             ;;
2868         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2869             exit 1
2870             ;;
2871         esac
2872         case "$targetto" in
2873         scp|rcp)
2874             cat >$to <<EOF
2875 #!/bin/sh
2876 for f in \$@
2877 do
2878   case "\$f" in
2879   /*)
2880     $targetmkdir \`dirname \$f\`
2881     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2882     ;;
2883   *)
2884     $targetmkdir $targetdir/\`dirname \$f\`
2885     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2886     ;;
2887   esac
2888 done
2889 exit 0
2890 EOF
2891             ;;
2892         cp) cat >$to <<EOF
2893 #!/bin/sh
2894 for f in \$@
2895 do
2896   case "\$f" in
2897   /*)
2898     $mkdir -p $targetdir/\`dirname \$f\`
2899     $cp \$f $targetdir/\$f || exit 1
2900     ;;
2901   *)
2902     $targetmkdir $targetdir/\`dirname \$f\`
2903     $cp \$f $targetdir/\$f || exit 1
2904     ;;
2905   esac
2906 done
2907 exit 0
2908 EOF
2909             ;;
2910         *)  echo "Unknown targetto '$targetto'" >&4
2911             exit 1
2912             ;;
2913         esac
2914         case "$targetfrom" in
2915         scp|rcp)
2916           cat >$from <<EOF
2917 #!/bin/sh
2918 for f in \$@
2919 do
2920   $rm -f \$f
2921   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2922 done
2923 exit 0
2924 EOF
2925             ;;
2926         cp) cat >$from <<EOF
2927 #!/bin/sh
2928 for f in \$@
2929 do
2930   $rm -f \$f
2931   cp $targetdir/\$f . || exit 1
2932 done
2933 exit 0
2934 EOF
2935             ;;
2936         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2937             exit 1
2938             ;;
2939         esac
2940         if $test ! -f $run; then
2941             echo "Target 'run' script '$run' not found." >&4
2942         else
2943             $chmod a+rx $run
2944         fi
2945         if $test ! -f $to; then
2946             echo "Target 'to' script '$to' not found." >&4
2947         else
2948             $chmod a+rx $to
2949         fi
2950         if $test ! -f $from; then
2951             echo "Target 'from' script '$from' not found." >&4
2952         else
2953             $chmod a+rx $from
2954         fi
2955         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2956             exit 1
2957         fi
2958         cat >&4 <<EOF
2959 Using '$run' for remote execution,
2960 and '$from' and '$to'
2961 for remote file transfer.
2962 EOF
2963         ;;
2964 *)      run=''
2965         to=:
2966         from=:
2967         usecrosscompile='undef'
2968         targetarch=''
2969         ;;
2970 esac
2971
2972 : see whether [:lower:] and [:upper:] are supported character classes
2973 echo " "
2974 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2975 ABYZ)
2976         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2977         up='[:upper:]'
2978         low='[:lower:]'
2979         ;;
2980 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2981         # (0xd9 and 0xe2), therefore that is a nice testing point.
2982         if test "X$up" = X -o "X$low" = X; then
2983             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2984             rs) up='[A-Z]'
2985                 low='[a-z]'
2986                 ;;
2987             esac
2988         fi
2989         if test "X$up" = X -o "X$low" = X; then
2990             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2991             rs) up='A-Z'
2992                 low='a-z'
2993                 ;;
2994             esac
2995         fi
2996         if test "X$up" = X -o "X$low" = X; then
2997             case "`echo RS | od -x 2>/dev/null`" in
2998             *D9E2*|*d9e2*)
2999                 echo "Hey, this might be EBCDIC." >&4
3000                 if test "X$up" = X -o "X$low" = X; then
3001                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3002                     rs) up='[A-IJ-RS-Z]'
3003                         low='[a-ij-rs-z]'
3004                         ;;
3005                     esac
3006                 fi
3007                 if test "X$up" = X -o "X$low" = X; then
3008                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3009                     rs) up='A-IJ-RS-Z'
3010                         low='a-ij-rs-z'
3011                         ;;
3012                     esac
3013                 fi
3014                 ;;
3015             esac
3016         fi
3017 esac
3018 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3019 rs)
3020     echo "Using $up and $low to convert case." >&4
3021     ;;
3022 *)
3023     echo "I don't know how to translate letters from upper to lower case." >&4
3024     echo "Your tr is not acting any way I know of." >&4
3025     exit 1
3026     ;;
3027 esac
3028 : set up the translation script tr, must be called with ./tr of course
3029 cat >tr <<EOSC
3030 $startsh
3031 case "\$1\$2" in
3032 '[A-Z][a-z]') exec $tr '$up' '$low';;
3033 '[a-z][A-Z]') exec $tr '$low' '$up';;
3034 esac
3035 exec $tr "\$@"
3036 EOSC
3037 chmod +x tr
3038 $eunicefix tr
3039
3040 : Try to determine whether config.sh was made on this system
3041 case "$config_sh" in
3042 '')
3043 myuname=`$uname -a 2>/dev/null`
3044 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3045 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3046 # because the A-Z/a-z are not consecutive.
3047 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3048         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3049 newmyuname="$myuname"
3050 dflt=n
3051 case "$knowitall" in
3052 '')
3053         if test -f ../config.sh; then
3054                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3055                         eval "`grep myuname= ../config.sh`"
3056                 fi
3057                 if test "X$myuname" = "X$newmyuname"; then
3058                         dflt=y
3059                 fi
3060         fi
3061         ;;
3062 *) dflt=y;;
3063 esac
3064
3065 : Get old answers from old config file if Configure was run on the
3066 : same system, otherwise use the hints.
3067 hint=default
3068 cd ..
3069 if test -f config.sh; then
3070         echo " "
3071         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3072         . UU/myread
3073         case "$ans" in
3074         n*|N*) echo "OK, I'll ignore it."
3075                 mv config.sh config.sh.old
3076                 myuname="$newmyuname"
3077                 ;;
3078         *)  echo "Fetching default answers from your old config.sh file..." >&4
3079                 tmp_n="$n"
3080                 tmp_c="$c"
3081                 tmp_sh="$sh"
3082                 . ./config.sh
3083                 cp config.sh UU
3084                 n="$tmp_n"
3085                 c="$tmp_c"
3086                 : Older versions did not always set $sh.  Catch re-use of such
3087                 : an old config.sh.
3088                 case "$sh" in
3089                 '') sh="$tmp_sh" ;;
3090                 esac
3091                 hint=previous
3092                 ;;
3093         esac
3094 fi
3095 . ./UU/checkcc
3096 if test ! -f config.sh; then
3097         $cat <<EOM
3098
3099 First time through, eh?  I have some defaults handy for some systems
3100 that need some extra help getting the Configure answers right:
3101
3102 EOM
3103         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3104         dflt=''
3105         : Half the following guesses are probably wrong... If you have better
3106         : tests or hints, please send them to perlbug@perl.org
3107         : The metaconfig authors would also appreciate a copy...
3108         $test -f /irix && osname=irix
3109         $test -f /xenix && osname=sco_xenix
3110         $test -f /dynix && osname=dynix
3111         $test -f /dnix && osname=dnix
3112         $test -f /lynx.os && osname=lynxos
3113         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3114         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3115         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3116         $test -f /bin/mips && /bin/mips && osname=mips
3117         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3118                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3119         $test -d /usr/apollo/bin && osname=apollo
3120         $test -f /etc/saf/_sactab && osname=svr4
3121         $test -d /usr/include/minix && osname=minix
3122         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3123         if $test -d /MachTen -o -d /MachTen_Folder; then
3124                 osname=machten
3125                 if $test -x /sbin/version; then
3126                         osvers=`/sbin/version | $awk '{print $2}' |
3127                         $sed -e 's/[A-Za-z]$//'`
3128                 elif $test -x /usr/etc/version; then
3129                         osvers=`/usr/etc/version | $awk '{print $2}' |
3130                         $sed -e 's/[A-Za-z]$//'`
3131                 else
3132                         osvers="$2.$3"
3133                 fi
3134         fi
3135
3136         $test -f /sys/posix.dll &&
3137                 $test -f /usr/bin/what &&
3138                 set X `/usr/bin/what /sys/posix.dll` &&
3139                 $test "$3" = UWIN &&
3140                 osname=uwin &&
3141                 osvers="$5"
3142
3143         if $test -f $uname; then
3144                 set X $myuname
3145                 shift
3146
3147                 case "$5" in
3148                 fps*) osname=fps ;;
3149                 mips*)
3150                         case "$4" in
3151                         umips) osname=umips ;;
3152                         *) osname=mips ;;
3153                         esac;;
3154                 [23]100) osname=mips ;;
3155                 next*) osname=next ;;
3156                 i386*)
3157                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3158                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3159                                 osname='sco'
3160                                 osvers=$tmp
3161                         elif $test -f /etc/kconfig; then
3162                                 osname=isc
3163                                 if test "$lns" = "$ln -s"; then
3164                                         osvers=4
3165                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3166                                         osvers=3
3167                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3168                                         osvers=2
3169                                 fi
3170                         fi
3171                         tmp=''
3172                         ;;
3173                 pc*)
3174                         if test -n "$DJGPP"; then
3175                                 osname=dos
3176                                 osvers=djgpp
3177                         fi
3178                         ;;
3179                 esac
3180
3181                 case "$1" in
3182                 aix) osname=aix
3183                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3184                         case "$tmp" in
3185                         # oslevel can fail with:
3186                         # oslevel: Unable to acquire lock.
3187                         *not\ found) osvers="$4"."$3" ;;
3188                         '<3240'|'<>3240') osvers=3.2.0 ;;
3189                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3190                         '=3250'|'>3250') osvers=3.2.5 ;;
3191                         *) osvers=$tmp;;
3192                         esac
3193                         ;;
3194                 bsd386) osname=bsd386
3195                         osvers=`$uname -r`
3196                         ;;
3197                 cygwin*) osname=cygwin
3198                         osvers="$3"
3199                         ;;
3200                 *dc.osx) osname=dcosx
3201                         osvers="$3"
3202                         ;;
3203                 dnix) osname=dnix
3204                         osvers="$3"
3205                         ;;
3206                 domainos) osname=apollo
3207                         osvers="$3"
3208                         ;;
3209                 dgux)   osname=dgux
3210                         osvers="$3"
3211                         ;;
3212                 dragonfly) osname=dragonfly
3213                         osvers="$3"
3214                         ;;
3215                 dynixptx*) osname=dynixptx
3216                         osvers=`echo "$4"|sed 's/^v//'`
3217                         ;;
3218                 freebsd) osname=freebsd
3219                         osvers="$3" ;;
3220                 genix)  osname=genix ;;
3221                 gnu)    osname=gnu
3222                         osvers="$3" ;;
3223                 hp*)    osname=hpux
3224                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3225                         ;;
3226                 irix*)  osname=irix
3227                         case "$3" in
3228                         4*) osvers=4 ;;
3229                         5*) osvers=5 ;;
3230                         *)      osvers="$3" ;;
3231                         esac
3232                         ;;
3233                 linux)  osname=linux
3234                         case "$3" in
3235                         *)      osvers="$3" ;;
3236                         esac
3237                         ;;
3238                 MiNT)   osname=mint
3239                         ;;
3240                 netbsd*) osname=netbsd
3241                         osvers="$3"
3242                         ;;
3243                 news-os) osvers="$3"
3244                         case "$3" in
3245                         4*) osname=newsos4 ;;
3246                         *) osname=newsos ;;
3247                         esac
3248                         ;;
3249                 next*) osname=next ;;
3250                 nonstop-ux) osname=nonstopux ;;
3251                 openbsd) osname=openbsd
3252                         osvers="$3"
3253                         ;;
3254                 os2)    osname=os2
3255                         osvers="$4"
3256                         ;;
3257                 POSIX-BC | posix-bc ) osname=posix-bc
3258                         osvers="$3"
3259                         ;;
3260                 powerux | power_ux | powermax_os | powermaxos | \
3261                 powerunix | power_unix) osname=powerux
3262                         osvers="$3"
3263                         ;;
3264                 qnx) osname=qnx
3265                         osvers="$4"
3266                         ;;
3267                 solaris) osname=solaris
3268                         case "$3" in
3269                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3270                         *)      osvers="$3" ;;
3271                         esac
3272                         ;;
3273                 sunos) osname=sunos
3274                         case "$3" in
3275                         5*) osname=solaris
3276                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3277                         *)      osvers="$3" ;;
3278                         esac
3279                         ;;
3280                 titanos) osname=titanos
3281                         case "$3" in
3282                         1*) osvers=1 ;;
3283                         2*) osvers=2 ;;
3284                         3*) osvers=3 ;;
3285                         4*) osvers=4 ;;
3286                         *)      osvers="$3" ;;
3287                         esac
3288                         ;;
3289                 ultrix) osname=ultrix
3290                         osvers="$3"
3291                         ;;
3292                 osf1|mls+)      case "$5" in
3293                                 alpha)
3294                                         osname=dec_osf
3295                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3296                                         case "$osvers" in
3297                                         [1-9].[0-9]*) ;;
3298                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3299                                         esac
3300                                         ;;
3301                         hp*)    osname=hp_osf1  ;;
3302                         mips)   osname=mips_osf1 ;;
3303                         esac
3304                         ;;
3305                 # UnixWare 7.1.2 is known as Open UNIX 8
3306                 openunix|unixware) osname=svr5
3307                         osvers="$4"
3308                         ;;
3309                 uts)    osname=uts
3310                         osvers="$3"
3311                         ;;
3312                 vos) osvers="$3"
3313                         ;;
3314                 $2) case "$osname" in
3315                         *isc*) ;;
3316                         *freebsd*) ;;
3317                         svr*)
3318                                 : svr4.x or possibly later
3319                                 case "svr$3" in
3320                                 ${osname}*)
3321                                         osname=svr$3
3322                                         osvers=$4
3323                                         ;;
3324                                 esac
3325                                 case "$osname" in
3326                                 svr4.0)
3327                                         : Check for ESIX
3328                                         if test -f /stand/boot ; then
3329                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3330                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3331                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3332                                                         if test -n "$isesix"; then
3333                                                                 osname=esix4
3334                                                         fi
3335                                                 fi
3336                                         fi
3337                                         ;;
3338                                 esac
3339                                 ;;
3340                         *)      if test -f /etc/systemid; then
3341                                         osname=sco
3342                                         set `echo $3 | $sed 's/\./ /g'` $4
3343                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3344                                                 osvers=$1.$2.$3
3345                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3346                                                 osvers=$1.$2
3347                                         elif $test -f $src/hints/sco_$1.sh; then
3348                                                 osvers=$1
3349                                         fi
3350                                 else
3351                                         case "$osname" in
3352                                         '') : Still unknown.  Probably a generic Sys V.
3353                                                 osname="sysv"
3354                                                 osvers="$3"
3355                                                 ;;
3356                                         esac
3357                                 fi
3358                                 ;;
3359                         esac
3360                         ;;
3361                 *)      case "$osname" in
3362                         '') : Still unknown.  Probably a generic BSD.
3363                                 osname="$1"
3364                                 osvers="$3"
3365                                 ;;
3366                         esac
3367                         ;;
3368                 esac
3369         else
3370                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3371                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3372                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3373                                 osname=news_os
3374                         fi
3375                         $rm -f UU/kernel.what
3376                 elif test -d c:/. -o -n "$is_os2" ; then
3377                         set X $myuname
3378                         osname=os2
3379                         osvers="$5"
3380                 fi
3381         fi
3382
3383         case "$targetarch" in
3384         '') ;;
3385         *)  hostarch=$osname
3386             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3387             osvers=''
3388             ;;
3389         esac
3390
3391         : Now look for a hint file osname_osvers, unless one has been
3392         : specified already.
3393         case "$hintfile" in
3394         ''|' ')
3395                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3396                 : Also try without trailing minor version numbers.
3397                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3398                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3399                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3400                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3401                 case "$file" in
3402                 '') dflt=none ;;
3403                 *)  case "$osvers" in
3404                         '') dflt=$file
3405                                 ;;
3406                         *)  if $test -f $src/hints/$file.sh ; then
3407                                         dflt=$file
3408                                 elif $test -f $src/hints/$xfile.sh ; then
3409                                         dflt=$xfile
3410                                 elif $test -f $src/hints/$xxfile.sh ; then
3411                                         dflt=$xxfile
3412                                 elif $test -f $src/hints/$xxxfile.sh ; then
3413                                         dflt=$xxxfile
3414                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3415                                         dflt=$xxxxfile
3416                                 elif $test -f "$src/hints/${osname}.sh" ; then
3417                                         dflt="${osname}"
3418                                 else
3419                                         dflt=none
3420                                 fi
3421                                 ;;
3422                         esac
3423                         ;;
3424                 esac
3425                 if $test -f Policy.sh ; then
3426                         case "$dflt" in
3427                         *Policy*) ;;
3428                         none) dflt="Policy" ;;
3429                         *) dflt="Policy $dflt" ;;
3430                         esac
3431                 fi
3432                 ;;
3433         *)
3434                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3435                 ;;
3436         esac
3437
3438         if $test -f Policy.sh ; then
3439                 $cat <<EOM
3440
3441 There's also a Policy hint file available, which should make the
3442 site-specific (policy) questions easier to answer.
3443 EOM
3444
3445         fi
3446
3447         $cat <<EOM
3448
3449 You may give one or more space-separated answers, or "none" if appropriate.
3450 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3451 previous run of Configure, you may specify it as well as or instead of
3452 OS-specific hints.  If hints are provided for your OS, you should use them:
3453 although Perl can probably be built without hints on many platforms, using
3454 hints often improve performance and may enable features that Configure can't
3455 set up on its own. If there are no hints that match your OS, specify "none";
3456 DO NOT give a wrong version or a wrong OS.
3457
3458 EOM
3459
3460         rp="Which of these apply, if any?"
3461         . UU/myread
3462         tans=$ans
3463         for file in $tans; do
3464                 if $test X$file = XPolicy -a -f Policy.sh; then
3465                         . Policy.sh
3466                         $cat Policy.sh >> UU/config.sh
3467                 elif $test -f $src/hints/$file.sh; then
3468                         . $src/hints/$file.sh
3469                         $cat $src/hints/$file.sh >> UU/config.sh
3470                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3471                         : nothing
3472                 else
3473                         : Give one chance to correct a possible typo.
3474                         echo "$file.sh does not exist"
3475                         dflt=$file
3476                         rp="hint to use instead?"
3477                         . UU/myread
3478                         for file in $ans; do
3479                                 if $test -f "$src/hints/$file.sh"; then
3480                                         . $src/hints/$file.sh
3481                                         $cat $src/hints/$file.sh >> UU/config.sh
3482                                 elif $test X$ans = X -o X$ans = Xnone ; then
3483                                         : nothing
3484                                 else
3485                                         echo "$file.sh does not exist -- ignored."
3486                                 fi
3487                         done
3488                 fi
3489         done
3490
3491         hint=recommended
3492         : Remember our hint file for later.
3493         if $test -f "$src/hints/$file.sh" ; then
3494                 hintfile="$file"
3495         else
3496                 hintfile=''
3497         fi
3498 fi
3499 cd UU
3500 ;;
3501 *)
3502         echo " "
3503         echo "Fetching default answers from $config_sh..." >&4
3504         tmp_n="$n"
3505         tmp_c="$c"
3506         cd ..
3507         cp $config_sh config.sh 2>/dev/null
3508         chmod +w config.sh
3509         . ./config.sh
3510         cd UU
3511         cp ../config.sh .
3512         n="$tmp_n"
3513         c="$tmp_c"
3514         hint=previous
3515         ;;
3516 esac
3517 test "$override" && . ./optdef.sh
3518
3519 : Restore computed paths
3520 for file in $loclist $trylist; do
3521         eval $file="\$_$file"
3522 done
3523
3524 cat << EOM
3525
3526 Configure uses the operating system name and version to set some defaults.
3527 The default value is probably right if the name rings a bell. Otherwise,
3528 since spelling matters for me, either accept the default or answer "none"
3529 to leave it blank.
3530
3531 EOM
3532 case "$osname" in
3533         ''|' ')
3534                 case "$hintfile" in
3535                 ''|' '|none) dflt=none ;;
3536                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3537                 esac
3538                 ;;
3539         *) dflt="$osname" ;;
3540 esac
3541 rp="Operating system name?"
3542 . ./myread
3543 case "$ans" in
3544 none)  osname='' ;;
3545 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3546 esac
3547 echo " "
3548 case "$osvers" in
3549         ''|' ')
3550                 case "$hintfile" in
3551                 ''|' '|none) dflt=none ;;
3552                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3553                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3554                         case "$dflt" in
3555                         ''|' ') dflt=none ;;
3556                         esac
3557                         ;;
3558                 esac
3559                 ;;
3560         *) dflt="$osvers" ;;
3561 esac
3562 rp="Operating system version?"
3563 . ./myread
3564 case "$ans" in
3565 none)  osvers='' ;;
3566 *) osvers="$ans" ;;
3567 esac
3568
3569
3570 . ./posthint.sh
3571
3572 : who configured the system
3573 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3574 case "$cf_by" in
3575 "")
3576         cf_by=`(logname) 2>/dev/null`
3577         case "$cf_by" in
3578         "")
3579                 cf_by=`(whoami) 2>/dev/null`
3580                 case "$cf_by" in
3581                 "") cf_by=unknown ;;
3582                 esac ;;
3583         esac ;;
3584 esac
3585
3586 : decide how portable to be.  Allow command line overrides.
3587 case "$d_portable" in
3588 "$undef") ;;
3589 *)      d_portable="$define" ;;
3590 esac
3591
3592 : set up shell script to do ~ expansion
3593 cat >filexp <<EOSS
3594 $startsh
3595 : expand filename
3596 case "\$1" in
3597  \~/*|\~)
3598         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3599         ;;
3600  \~*)
3601         if $test -f /bin/csh; then
3602                 /bin/csh -f -c "glob \$1"
3603                 failed=\$?
3604                 echo ""
3605                 exit \$failed
3606         else
3607                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3608                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3609                 if $test ! -d "\$dir"; then
3610                         me=\`basename \$0\`
3611                         echo "\$me: can't locate home directory for: \$name" >&2
3612                         exit 1
3613                 fi
3614                 case "\$1" in
3615                 */*)
3616                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3617                         ;;
3618                 *)
3619                         echo \$dir
3620                         ;;
3621                 esac
3622         fi
3623         ;;
3624 *)
3625         echo \$1
3626         ;;
3627 esac
3628 EOSS
3629 chmod +x filexp
3630 $eunicefix filexp
3631
3632 : now set up to get a file name
3633 cat <<EOS >getfile
3634 $startsh
3635 EOS
3636 cat <<'EOSC' >>getfile
3637 tilde=''
3638 fullpath=''
3639 already=''
3640 skip=''
3641 none_ok=''
3642 exp_file=''
3643 nopath_ok=''
3644 orig_rp="$rp"
3645 orig_dflt="$dflt"
3646 case "$gfpth" in
3647 '') gfpth='.' ;;
3648 esac
3649
3650 case "$fn" in
3651 *\(*)
3652         : getfile will accept an answer from the comma-separated list
3653         : enclosed in parentheses even if it does not meet other criteria.
3654         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3655         fn=`echo $fn | sed 's/(.*)//'`
3656         ;;
3657 esac
3658
3659 case "$fn" in
3660 *:*)
3661         loc_file=`expr $fn : '.*:\(.*\)'`
3662         fn=`expr $fn : '\(.*\):.*'`
3663         ;;
3664 esac
3665
3666 case "$fn" in
3667 *~*) tilde=true;;
3668 esac
3669 case "$fn" in
3670 */*) fullpath=true;;
3671 esac
3672 case "$fn" in
3673 *+*) skip=true;;
3674 esac
3675 case "$fn" in
3676 *n*) none_ok=true;;
3677 esac
3678 case "$fn" in
3679 *e*) exp_file=true;;
3680 esac
3681 case "$fn" in
3682 *p*) nopath_ok=true;;
3683 esac
3684
3685 case "$fn" in
3686 *f*) type='File';;
3687 *d*) type='Directory';;
3688 *l*) type='Locate';;
3689 esac
3690
3691 what="$type"
3692 case "$what" in
3693 Locate) what='File';;
3694 esac
3695
3696 case "$exp_file" in
3697 '')
3698         case "$d_portable" in
3699         "$define") ;;
3700         *) exp_file=true;;
3701         esac
3702         ;;
3703 esac
3704
3705 cd ..
3706 while test "$type"; do
3707         redo=''
3708         rp="$orig_rp"
3709         dflt="$orig_dflt"
3710         case "$tilde" in
3711         true) rp="$rp (~name ok)";;
3712         esac
3713         . UU/myread
3714         if test -f UU/getfile.ok && \
3715                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3716         then
3717                 value="$ans"
3718                 ansexp="$ans"
3719                 break
3720         fi
3721         case "$ans" in
3722         none)
3723                 value=''
3724                 ansexp=''
3725                 case "$none_ok" in
3726                 true) type='';;
3727                 esac
3728                 ;;
3729         *)
3730                 case "$tilde" in
3731                 '') value="$ans"
3732                         ansexp="$ans";;
3733                 *)
3734                         value=`UU/filexp $ans`
3735                         case $? in
3736                         0)
3737                                 if test "$ans" != "$value"; then
3738                                         echo "(That expands to $value on this system.)"
3739                                 fi
3740                                 ;;
3741                         *) value="$ans";;
3742                         esac
3743                         ansexp="$value"
3744                         case "$exp_file" in
3745                         '') value="$ans";;
3746                         esac
3747                         ;;
3748                 esac
3749                 case "$fullpath" in
3750                 true)
3751                         case "$ansexp" in
3752                         /*) value="$ansexp" ;;
3753                         [a-zA-Z]:/*) value="$ansexp" ;;
3754                         *)
3755                                 redo=true
3756                                 case "$already" in
3757                                 true)
3758                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3759                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3760                                         ;;
3761                                 *)
3762                                 echo "Please give a full path name, starting with slash." >&4
3763                                         case "$tilde" in
3764                                         true)
3765                                 echo "Note that using ~name is ok provided it expands well." >&4
3766                                                 already=true
3767                                                 ;;
3768                                         esac
3769                                 esac
3770                                 ;;
3771                         esac
3772                         ;;
3773                 esac
3774                 case "$redo" in
3775                 '')
3776                         case "$type" in
3777                         File)
3778                                 for fp in $gfpth; do
3779                                         if test "X$fp" = X.; then
3780                                             pf="$ansexp"
3781                                         else    
3782                                             pf="$fp/$ansexp"
3783                                         fi
3784                                         if test -f "$pf"; then
3785                                                 type=''
3786                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3787                                         then
3788                                                 echo "($value is not a plain file, but that's ok.)"
3789                                                 type=''
3790                                         fi
3791                                         if test X"$type" = X; then
3792                                             value="$pf"
3793                                             break
3794                                         fi
3795                                 done
3796                                 ;;
3797                         Directory)
3798                                 for fp in $gfpth; do
3799                                         if test "X$fp" = X.; then
3800                                             dir="$ans"
3801                                             direxp="$ansexp"
3802                                         else    
3803                                             dir="$fp/$ansexp"
3804                                             direxp="$fp/$ansexp"
3805                                         fi
3806                                         if test -d "$direxp"; then
3807                                                 type=''
3808                                                 value="$dir"
3809                                                 break
3810                                         fi
3811                                 done
3812                                 ;;
3813                         Locate)
3814                                 if test -d "$ansexp"; then
3815                                         echo "(Looking for $loc_file in directory $value.)"
3816                                         value="$value/$loc_file"
3817                                         ansexp="$ansexp/$loc_file"
3818                                 fi
3819                                 if test -f "$ansexp"; then
3820                                         type=''
3821                                 fi
3822                                 case "$nopath_ok" in
3823                                 true)   case "$value" in
3824                                         */*) ;;
3825                                         *)      echo "Assuming $value will be in people's path."
3826                                                 type=''
3827                                                 ;;
3828                                         esac
3829                                         ;;
3830                                 esac
3831                                 ;;
3832                         esac
3833
3834                         case "$skip" in
3835                         true) type='';
3836                         esac
3837
3838                         case "$type" in
3839                         '') ;;
3840                         *)
3841                                 if test "$fastread" = yes; then
3842                                         dflt=y
3843                                 else
3844                                         dflt=n
3845                                 fi
3846                                 rp="$what $value doesn't exist.  Use that name anyway?"
3847                                 . UU/myread
3848                                 dflt=''
3849                                 case "$ans" in
3850                                 y*) type='';;
3851                                 *) echo " ";;
3852                                 esac
3853                                 ;;
3854                         esac
3855                         ;;
3856                 esac
3857                 ;;
3858         esac
3859 done
3860 cd UU
3861 ans="$value"
3862 rp="$orig_rp"
3863 dflt="$orig_dflt"
3864 rm -f getfile.ok
3865 test "X$gfpthkeep" != Xy && gfpth=""
3866 EOSC
3867
3868 : determine root of directory hierarchy where package will be installed.
3869 case "$prefix" in
3870 '')
3871         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3872         ;;
3873 *?/)
3874         dflt=`echo "$prefix" | sed 's/.$//'`
3875         ;;
3876 *)
3877         dflt="$prefix"
3878         ;;
3879 esac
3880 $cat <<EOM
3881
3882 By default, $package will be installed in $dflt/bin, manual pages
3883 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3884 installation directories. Typically this is something like /usr/local.
3885 If you wish to have binaries under /usr/bin but other parts of the
3886 installation under /usr/local, that's ok: you will be prompted
3887 separately for each of the installation directories, the prefix being
3888 only used to set the defaults.
3889
3890 EOM
3891 fn=d~
3892 rp='Installation prefix to use?'
3893 . ./getfile
3894 oldprefix=''
3895 case "$prefix" in
3896 '') ;;
3897 *)
3898         case "$ans" in
3899         "$prefix") ;;
3900         *) oldprefix="$prefix";;
3901         esac
3902         ;;
3903 esac
3904 prefix="$ans"
3905 prefixexp="$ansexp"
3906
3907 : allow them to override the AFS root
3908 case "$afsroot" in
3909 '')     afsroot=/afs ;;
3910 *)      afsroot=$afsroot ;;
3911 esac
3912
3913 : is AFS running?
3914 echo " "
3915 case "$afs" in
3916 $define|true)   afs=true ;;
3917 $undef|false)   afs=false ;;
3918 *)      if $test -d $afsroot; then
3919                 afs=true
3920         else
3921                 afs=false
3922         fi
3923         ;;
3924 esac
3925 if $afs; then
3926         echo "AFS may be running... I'll be extra cautious then..." >&4
3927 else
3928         echo "AFS does not seem to be running..." >&4
3929 fi
3930
3931 : determine installation prefix for where package is to be installed.
3932 if $afs; then 
3933 $cat <<EOM
3934
3935 Since you are running AFS, I need to distinguish the directory in which
3936 files will reside from the directory in which they are installed (and from
3937 which they are presumably copied to the former directory by occult means).
3938
3939 EOM
3940         case "$installprefix" in
3941         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3942         *) dflt="$installprefix";;
3943         esac
3944 else
3945 $cat <<EOM
3946
3947 In some special cases, particularly when building $package for distribution,
3948 it is convenient to distinguish the directory in which files should be
3949 installed from the directory ($prefix) in which they will
3950 eventually reside.  For most users, these two directories are the same.
3951
3952 EOM
3953         case "$installprefix" in
3954         '') dflt=$prefix ;;
3955         *) dflt=$installprefix;;
3956         esac
3957 fi
3958 fn=d~
3959 rp='What installation prefix should I use for installing files?'
3960 . ./getfile
3961 installprefix="$ans"
3962 installprefixexp="$ansexp"
3963
3964 : Perform the prefixexp/installprefixexp correction if necessary
3965 cat <<EOS >installprefix
3966 $startsh
3967 EOS
3968 cat <<'EOSC' >>installprefix
3969 : Change installation prefix, if necessary.
3970 if $test X"$prefix" != X"$installprefix"; then
3971     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3972 else
3973     eval "install${prefixvar}=\"\$${prefixvar}exp\""
3974 fi
3975 EOSC
3976 chmod +x installprefix
3977 $eunicefix installprefix
3978
3979 : Set variables such as privlib and privlibexp from the output of ./getfile
3980 : performing the prefixexp/installprefixexp correction if necessary.
3981 cat <<EOS >setprefixvar
3982 $startsh
3983 EOS
3984 cat <<'EOSC' >>setprefixvar
3985 eval "${prefixvar}=\"\$ans\""
3986 eval "${prefixvar}exp=\"\$ansexp\""
3987 . ./installprefix
3988 EOSC
3989 chmod +x setprefixvar
3990 $eunicefix setprefixvar
3991
3992 : set up the script used to warn in case of inconsistency
3993 cat <<EOS >whoa
3994 $startsh
3995 EOS
3996 cat <<'EOSC' >>whoa
3997 dflt=y
3998 case "$hint" in
3999     recommended)
4000         case "$hintfile" in
4001         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4002                 ;;
4003         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4004                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4005                 ;;
4006         esac
4007         ;;
4008     *)  echo " "
4009         echo "*** WHOA THERE!!! ***" >&4
4010         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4011         ;;
4012 esac
4013 rp="    Keep the $hint value?"
4014 . ./myread
4015 case "$ans" in
4016 y) td=$was; tu=$was;;
4017 esac
4018 EOSC
4019
4020 : function used to set '$1' to '$val'
4021 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4022 case "$val$was" in
4023 $define$undef) . ./whoa; eval "$var=\$td";;
4024 $undef$define) . ./whoa; eval "$var=\$tu";;
4025 *) eval "$var=$val";;
4026 esac'
4027
4028 : Check is we will use socks
4029 case "$usesocks" in
4030 $define|true|[yY]*)     dflt='y';;
4031 *) dflt='n';;
4032 esac
4033 cat <<EOM
4034
4035 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4036 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4037 to use the PerlIO abstraction layer, this will be implicitly selected.
4038
4039 If this doesn't make any sense to you, just accept the default '$dflt'.
4040 EOM
4041 rp='Build Perl for SOCKS?'
4042 . ./myread
4043 case "$ans" in
4044 y|Y)    val="$define" ;;
4045 *)      val="$undef" ;;
4046 esac
4047 set usesocks
4048 eval $setvar
4049
4050 case "$usesocks" in
4051 $define|true|[yY]*) useperlio="$define";;
4052 esac
4053
4054 : Check if we want perlio
4055 case "$useperlio" in
4056 $define|true|[yY]*|'')  dflt='y';;
4057 *) dflt='n';;
4058 esac
4059 cat <<EOM
4060
4061 Previous version of $package used the standard IO mechanisms as
4062 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4063 alternate IO mechanisms via the PerlIO abstraction layer, but the
4064 stdio mechanism is still available if needed.  The abstraction layer
4065 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4066 Using PerlIO with sfio may cause problems with some extension modules.
4067
4068 If this doesn't make any sense to you, just accept the default '$dflt'.
4069 EOM
4070 rp='Use the PerlIO abstraction layer?'
4071 . ./myread
4072 case "$ans" in
4073 y|Y)
4074         val="$define"
4075         ;;
4076 *)
4077         echo "Ok, doing things the stdio way."
4078         val="$undef"
4079         ;;
4080 esac
4081 set useperlio
4082 eval $setvar
4083
4084 case "$usesocks" in
4085 $define|true|[yY]*)
4086         case "$useperlio" in
4087         $define|true|[yY]*) ;;
4088         *)      cat >&4 <<EOM
4089
4090 You are using the SOCKS proxy protocol library which means that you
4091 should also use the PerlIO layer.  You may be headed for trouble.
4092
4093 EOM
4094                 ;;
4095         esac
4096         ;;
4097 esac
4098
4099 : get the patchlevel
4100 echo " "
4101 echo "Getting the current patchlevel..." >&4
4102 if $test -r $rsrc/patchlevel.h;then
4103         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4104         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4105         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4106         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4107         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4108         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4109         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4110 else
4111         revision=0
4112         patchlevel=0
4113         subversion=0
4114         api_revision=0
4115         api_version=0
4116         api_subversion=0
4117         perl_patchlevel=0
4118         $echo "(You do not have patchlevel.h.  Eek.)"
4119 fi
4120 if $test -r $rsrc/.patch ; then
4121         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4122                 perl_patchlevel=`cat $rsrc/.patch`
4123         fi
4124 fi
4125 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4126 version_patchlevel_string="version $patchlevel subversion $subversion"
4127 case "$perl_patchlevel" in
4128 0|'') ;;
4129 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
4130 esac
4131
4132 $echo "(You have $package $version_patchlevel_string.)"
4133
4134 case "$osname" in
4135 dos|vms)
4136         : XXX Should be a Configure test for double-dots in filenames.
4137         version=`echo $revision $patchlevel $subversion | \
4138                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4139         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4140                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4141         ;;
4142 *)
4143         version=`echo $revision $patchlevel $subversion | \
4144                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4145         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4146                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4147         ;;
4148 esac
4149 : Special case the 5.005_xx maintenance series, which used 5.005
4150 : without any subversion label as a subdirectory in $sitelib
4151 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4152         api_versionstring='5.005'
4153 fi
4154
4155 : Do we want threads support and if so, what type
4156 case "$usethreads" in
4157 $define|true|[yY]*)     dflt='y';;
4158 *)     # Catch case where user specified ithreads or 5005threads but
4159        # forgot -Dusethreads (A.D. 4/2002)
4160        case "$useithreads$use5005threads" in
4161        *$define*)
4162                 case "$useperlio" in
4163                 "$define")      dflt='y' ;;
4164                 *)              dflt='n' ;;
4165                 esac
4166                 ;;
4167        *)       dflt='n';;
4168        esac
4169        ;;
4170 esac
4171 cat <<EOM
4172
4173 Perl can be built to take advantage of threads on some systems.
4174 To do so, Configure can be run with -Dusethreads.
4175
4176 Note that Perl built with threading support runs slightly slower
4177 and uses more memory than plain Perl. The current implementation
4178 is believed to be stable, but it is fairly new, and so should be
4179 treated with caution.
4180
4181 If this doesn't make any sense to you, just accept the default '$dflt'.
4182 EOM
4183 rp='Build a threading Perl?'
4184 . ./myread
4185 case "$ans" in
4186 y|Y)    val="$define" ;;
4187 *)      val="$undef" ;;
4188 esac
4189 set usethreads
4190 eval $setvar
4191
4192 if $test $patchlevel -lt 9; then
4193     case "$usethreads" in
4194     $define)
4195         $cat <<EOM
4196
4197 Since release 5.6, Perl has had two different threading implementations,
4198 the newer interpreter-based version (ithreads) with one interpreter per
4199 thread, and the older 5.005 version (5005threads).
4200 The 5005threads version is effectively unmaintained and will probably be
4201 removed in Perl 5.10, so there should be no need to build a Perl using it
4202 unless needed for backwards compatibility with some existing 5.005threads
4203 code.
4204
4205 EOM
4206         : Default to ithreads unless overridden on command line or with
4207         : old config.sh
4208         dflt='y'
4209         case "$use5005threads" in
4210                 $define|true|[yY]*) dflt='n';;
4211         esac
4212         case "$useithreads" in
4213                 $undef|false|[nN]*) dflt='n';;
4214         esac
4215         rp='Use the newer interpreter-based ithreads?'
4216         . ./myread
4217         case "$ans" in
4218         y|Y)    val="$define" ;;
4219         *)      val="$undef" ;;
4220         esac
4221         set useithreads
4222         eval $setvar
4223         : Now set use5005threads to the opposite value.
4224         case "$useithreads" in
4225         $define) val="$undef" ;;
4226         *) val="$define" ;;
4227         esac
4228         set use5005threads
4229         eval $setvar
4230         ;;
4231     *)
4232         useithreads="$undef"
4233         use5005threads="$undef"
4234         ;;
4235     esac
4236
4237     case "$useithreads$use5005threads" in
4238     "$define$define")
4239         $cat >&4 <<EOM
4240
4241 You cannot have both the ithreads and the 5.005 threads enabled
4242 at the same time.  Disabling the 5.005 threads since they are
4243 much less stable than the ithreads.
4244
4245 EOM
4246         use5005threads="$undef"
4247         ;;
4248     esac
4249
4250 else
4251 : perl-5.9.x and later
4252
4253     if test X"$usethreads" = "X$define"; then
4254         case "$use5005threads" in
4255             $define|true|[yY]*)
4256                 $cat >&4 <<EOM
4257
4258 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4259
4260 EOM
4261             ;;
4262         esac
4263     fi
4264
4265     use5005threads="$undef"
4266     useithreads="$usethreads"
4267 fi
4268
4269 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4270         cat >&4 <<EOF
4271 ***
4272 *** To build with ithreads you must also use the PerlIO layer.
4273 *** Cannot continue, aborting.
4274 ***
4275 EOF
4276         exit 1
4277 fi
4278
4279 case "$d_oldpthreads" in
4280 '')     : Configure tests would be welcome here.  For now, assume undef.
4281         val="$undef" ;;
4282 *)      val="$d_oldpthreads" ;;
4283 esac
4284 set d_oldpthreads
4285 eval $setvar
4286
4287
4288 : Look for a hint-file generated 'call-back-unit'.  If the
4289 : user has specified that a threading perl is to be built,
4290 : we may need to set or change some other defaults.
4291 if $test -f usethreads.cbu; then
4292     echo "Your platform has some specific hints regarding threaded builds, using them..."
4293     . ./usethreads.cbu
4294 else
4295     case "$usethreads" in
4296         "$define"|true|[yY]*)
4297                 $cat <<EOM
4298 (Your platform does not have any specific hints for threaded builds.
4299  Assuming POSIX threads, then.)
4300 EOM
4301         ;;
4302     esac
4303 fi
4304
4305 : Check if multiplicity is required
4306 cat <<EOM
4307
4308 Perl can be built so that multiple Perl interpreters can coexist
4309 within the same Perl executable.
4310 EOM
4311
4312 case "$useithreads" in
4313 $define)
4314         cat <<EOM
4315 This multiple interpreter support is required for interpreter-based threads.
4316 EOM
4317         val="$define"
4318         ;;
4319 *)      case "$usemultiplicity" in
4320         $define|true|[yY]*)     dflt='y';;
4321         *) dflt='n';;
4322         esac
4323         echo " "
4324         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4325         rp='Build Perl for multiplicity?'
4326         . ./myread
4327         case "$ans" in
4328         y|Y)    val="$define" ;;
4329         *)      val="$undef" ;;
4330         esac
4331         ;;
4332 esac
4333 set usemultiplicity
4334 eval $setvar
4335
4336 : Check if morebits is requested
4337 case "$usemorebits" in
4338 "$define"|true|[yY]*)
4339         use64bitint="$define"
4340         uselongdouble="$define"
4341         usemorebits="$define"
4342         ;;
4343 *)      usemorebits="$undef"
4344         ;;
4345 esac
4346
4347 : Determine the C compiler to be used
4348 echo " "
4349 case "$cc" in
4350 '') dflt=cc;;
4351 *) dflt="$cc";;
4352 esac
4353 rp="Use which C compiler?"
4354 . ./myread
4355 cc="$ans"
4356
4357 : See whether they have no cc but they do have gcc
4358 . ./trygcc
4359 if $test -f cc.cbu; then
4360     . ./cc.cbu
4361 fi
4362 . ./checkcc
4363
4364 : make some quick guesses about what we are up against
4365 echo " "
4366 $echo $n "Hmm...  $c"
4367 echo exit 1 >bsd
4368 echo exit 1 >usg
4369 echo exit 1 >v7
4370 echo exit 1 >osf1
4371 echo exit 1 >eunice
4372 echo exit 1 >xenix
4373 echo exit 1 >venix
4374 echo exit 1 >os2
4375 d_bsd="$undef"
4376 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4377 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4378 then
4379         echo "Looks kind of like an OSF/1 system, but we'll see..."
4380         echo exit 0 >osf1
4381 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4382         xxx=`./loc addbib blurfl $pth`
4383         if $test -f $xxx; then
4384         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4385                 echo exit 0 >bsd
4386                 echo exit 0 >usg
4387         else
4388                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4389                         echo "Looks kind of like an extended USG system, but we'll see..."
4390                 else
4391                         echo "Looks kind of like a USG system, but we'll see..."
4392                 fi
4393                 echo exit 0 >usg
4394         fi
4395 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4396         echo "Looks kind of like a BSD system, but we'll see..."
4397         d_bsd="$define"
4398         echo exit 0 >bsd
4399 else
4400         echo "Looks kind of like a Version 7 system, but we'll see..."
4401         echo exit 0 >v7
4402 fi
4403 case "$eunicefix" in
4404 *unixtovms*)
4405         $cat <<'EOI'
4406 There is, however, a strange, musty smell in the air that reminds me of
4407 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4408 EOI
4409         echo exit 0 >eunice
4410         d_eunice="$define"
4411 : it so happens the Eunice I know will not run shell scripts in Unix format
4412         ;;
4413 *)
4414         echo " "
4415         echo "Congratulations.  You aren't running Eunice."
4416         d_eunice="$undef"
4417         ;;
4418 esac
4419 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4420 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4421 : semicolon as a patch separator
4422 case "$p_" in
4423 :) ;;
4424 *)
4425         $cat <<'EOI'
4426 I have the feeling something is not exactly right, however...don't tell me...
4427 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4428 (Or you may be running DOS with DJGPP.)
4429 EOI
4430         echo exit 0 >os2
4431         ;;
4432 esac
4433 if test -f /xenix; then
4434         echo "Actually, this looks more like a XENIX system..."
4435         echo exit 0 >xenix
4436         d_xenix="$define"
4437 else
4438         echo " "
4439         echo "It's not Xenix..."
4440         d_xenix="$undef"
4441 fi
4442 chmod +x xenix
4443 $eunicefix xenix
4444 if test -f /venix; then
4445         echo "Actually, this looks more like a VENIX system..."
4446         echo exit 0 >venix
4447 else
4448         echo " "
4449         if ./xenix; then
4450                 : null
4451         else
4452                 echo "Nor is it Venix..."
4453         fi
4454 fi
4455 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4456 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4457 $rm -f foo
4458
4459 : Check if we are using GNU gcc and what its version is
4460 echo " "
4461 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4462 $cat >try.c <<EOM
4463 #include <stdio.h>
4464 int main() {
4465 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4466 #ifdef __VERSION__
4467         printf("%s\n", __VERSION__);
4468 #else
4469         printf("%s\n", "1");
4470 #endif
4471 #endif
4472         return(0);
4473 }
4474 EOM
4475 if $cc -o try $ccflags $ldflags try.c; then
4476         gccversion=`$run ./try`
4477         case "$gccversion" in
4478         '') echo "You are not using GNU cc." ;;
4479         *)  echo "You are using GNU cc $gccversion."
4480             ccname=gcc
4481             ;;
4482         esac
4483 else
4484         echo " "
4485         echo "*** WHOA THERE!!! ***" >&4
4486         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4487         case "$knowitall" in
4488         '')
4489         echo "    You'd better start hunting for one and let me know about it." >&4
4490                 exit 1
4491                 ;;
4492         esac
4493 fi
4494 $rm -f try try.*
4495 case "$gccversion" in
4496 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4497 esac
4498 case "$gccversion" in
4499 '') gccosandvers='' ;;
4500 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4501    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4502    gccshortvers=''
4503    case "$gccosandvers" in
4504    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4505    $osname$osvers) ;; # looking good
4506    $osname*) cat <<EOM >&4
4507
4508 *** WHOA THERE!!! ***
4509
4510     Your gcc has not been compiled for the exact release of
4511     your operating system ($gccosandvers versus $osname$osvers).
4512
4513     In general it is a good idea to keep gcc synchronized with
4514     the operating system because otherwise serious problems
4515     may ensue when trying to compile software, like Perl.
4516
4517     I'm trying to be optimistic here, though, and will continue.
4518     If later during the configuration and build icky compilation
4519     problems appear (headerfile conflicts being the most common
4520     manifestation), I suggest reinstalling the gcc to match
4521     your operating system release.
4522
4523 EOM
4524       ;;
4525    *) gccosandvers='' ;; # failed to parse, better be silent
4526    esac
4527    ;;
4528 esac
4529 case "$ccname" in
4530 '') ccname="$cc" ;;
4531 esac
4532
4533 # gcc 3.* complain about adding -Idirectories that they already know about,
4534 # so we will take those off from locincpth.
4535 case "$gccversion" in
4536 3*)
4537     echo "main(){}">try.c
4538     for incdir in $locincpth; do
4539        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4540              grep '^c[cp]p*[01]: warning: changing search order '`
4541        if test "X$warn" != X; then
4542            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4543        fi
4544     done
4545     $rm -f try try.*
4546 esac
4547
4548 : What should the include directory be ?
4549 echo " "
4550 $echo $n "Hmm...  $c"
4551 dflt='/usr/include'
4552 incpath=''
4553 mips_type=''
4554 if $test -f /bin/mips && /bin/mips; then
4555         echo "Looks like a MIPS system..."
4556         $cat >usr.c <<'EOCP'
4557 #ifdef SYSTYPE_BSD43
4558 /bsd43
4559 #endif
4560 EOCP
4561         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4562                 dflt='/bsd43/usr/include'
4563                 incpath='/bsd43'
4564                 mips_type='BSD 4.3'
4565         else
4566                 mips_type='System V'
4567         fi
4568         $rm -f usr.c usr.out
4569         echo "and you're compiling with the $mips_type compiler and libraries."
4570         xxx_prompt=y
4571         echo "exit 0" >mips
4572 else
4573         echo "Doesn't look like a MIPS system."
4574         xxx_prompt=n
4575         echo "exit 1" >mips
4576 fi
4577 chmod +x mips
4578 $eunicefix mips
4579 case "$usrinc" in
4580 '') ;;
4581 *) dflt="$usrinc";;
4582 esac
4583 case "$xxx_prompt" in
4584 y)      fn=d/
4585         echo " "
4586         rp='Where are the include files you want to use?'
4587         . ./getfile
4588         usrinc="$ans"
4589         ;;
4590 *)      usrinc="$dflt"
4591         ;;
4592 esac
4593
4594 : see how we invoke the C preprocessor
4595 echo " "
4596 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4597 cat <<'EOT' >testcpp.c
4598 #define ABC abc
4599 #define XYZ xyz
4600 ABC.XYZ
4601 EOT
4602 cd ..
4603 if test ! -f cppstdin; then
4604         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4605                 # AIX cc -E doesn't show the absolute headerfile
4606                 # locations but we'll cheat by using the -M flag.
4607                 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
4608         else
4609                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4610         fi
4611 else
4612         echo "Keeping your $hint cppstdin wrapper."
4613 fi
4614 chmod 755 cppstdin
4615 wrapper=`pwd`/cppstdin
4616 ok='false'
4617 cd UU
4618
4619 if $test "X$cppstdin" != "X" && \
4620         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4621         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4622 then
4623         echo "You used to use $cppstdin $cppminus so we'll use that again."
4624         case "$cpprun" in
4625         '') echo "But let's see if we can live without a wrapper..." ;;
4626         *)
4627                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4628                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4629                 then
4630                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4631                         ok='true'
4632                 else
4633                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4634                 fi
4635                 ;;
4636         esac
4637 else
4638         case "$cppstdin" in
4639         '') ;;
4640         *)
4641                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4642                 ;;
4643         esac
4644 fi
4645
4646 if $ok; then
4647         : nothing
4648 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4649         $cc -E <testcpp.c >testcpp.out 2>&1; \
4650         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4651         echo "Yup, it does."
4652         x_cpp="$cc -E"
4653         x_minus='';
4654 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4655         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4656         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4657         echo "Yup, it does."
4658         x_cpp="$cc -E"
4659         x_minus='-';
4660 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4661         $cc -P <testcpp.c >testcpp.out 2>&1; \
4662         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4663         echo "Yipee, that works!"
4664         x_cpp="$cc -P"
4665         x_minus='';
4666 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4667         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4668         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4669         echo "At long last!"
4670         x_cpp="$cc -P"
4671         x_minus='-';
4672 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4673         $cpp <testcpp.c >testcpp.out 2>&1; \
4674         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4675         echo "It works!"
4676         x_cpp="$cpp"
4677         x_minus='';
4678 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4679         $cpp - <testcpp.c >testcpp.out 2>&1; \
4680         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4681         echo "Hooray, it works!  I was beginning to wonder."
4682         x_cpp="$cpp"
4683         x_minus='-';
4684 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4685         $wrapper <testcpp.c >testcpp.out 2>&1; \
4686         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4687         x_cpp="$wrapper"
4688         x_minus=''
4689         echo "Eureka!"
4690 else
4691         dflt=''
4692         rp="No dice.  I can't find a C preprocessor.  Name one:"
4693         . ./myread
4694         x_cpp="$ans"
4695         x_minus=''
4696         $x_cpp <testcpp.c >testcpp.out 2>&1
4697         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4698                 echo "OK, that will do." >&4
4699         else
4700 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4701                 exit 1
4702         fi
4703 fi
4704
4705 case "$ok" in
4706 false)
4707         cppstdin="$x_cpp"
4708         cppminus="$x_minus"
4709         cpprun="$x_cpp"
4710         cpplast="$x_minus"
4711         set X $x_cpp
4712         shift
4713         case "$1" in
4714         "$cpp")
4715                 echo "Perhaps can we force $cc -E using a wrapper..."
4716                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4717                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4718                 then
4719                         echo "Yup, we can."
4720                         cppstdin="$wrapper"
4721                         cppminus='';
4722                 else
4723                         echo "Nope, we'll have to live without it..."
4724                 fi
4725                 ;;
4726         esac
4727         case "$cpprun" in
4728         "$wrapper")
4729                 cpprun=''
4730                 cpplast=''
4731                 ;;
4732         esac
4733         ;;
4734 esac
4735
4736 case "$cppstdin" in
4737 "$wrapper"|'cppstdin') ;;
4738 *) $rm -f $wrapper;;
4739 esac
4740 $rm -f testcpp.c testcpp.out
4741
4742 : Set private lib path
4743 case "$plibpth" in
4744 '') if ./mips; then
4745                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4746         fi;;
4747 esac
4748 case "$libpth" in
4749 ' ') dlist='';;
4750 '') dlist="$loclibpth $plibpth $glibpth";;
4751 *) dlist="$libpth";;
4752 esac
4753
4754 : Now check and see which directories actually exist, avoiding duplicates
4755 libpth=''
4756 for xxx in $dlist
4757 do
4758     if $test -d $xxx; then
4759                 case " $libpth " in
4760                 *" $xxx "*) ;;
4761                 *) libpth="$libpth $xxx";;
4762                 esac
4763     fi
4764 done
4765 $cat <<'EOM'
4766
4767 Some systems have incompatible or broken versions of libraries.  Among
4768 the directories listed in the question below, please remove any you
4769 know not to be holding relevant libraries, and add any that are needed.
4770 Say "none" for none.
4771
4772 EOM
4773 case "$libpth" in
4774 '') dflt='none';;
4775 *)
4776         set X $libpth
4777         shift
4778         dflt=${1+"$@"}
4779         ;;
4780 esac
4781 rp="Directories to use for library searches?"
4782 . ./myread
4783 case "$ans" in
4784 none) libpth=' ';;
4785 *) libpth="$ans";;
4786 esac
4787
4788 : compute shared library extension
4789 case "$so" in
4790 '')
4791         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4792                 dflt='sl'
4793         else
4794                 dflt='so'
4795         fi
4796         ;;
4797 *) dflt="$so";;
4798 esac
4799 $cat <<EOM
4800
4801 On some systems, shared libraries may be available.  Answer 'none' if
4802 you want to suppress searching of shared libraries for the remainder
4803 of this configuration.
4804
4805 EOM
4806 rp='What is the file extension used for shared libraries?'
4807 . ./myread
4808 so="$ans"
4809
4810 : Define several unixisms.
4811 : Hints files or command line option can be used to override them.
4812 : The convoluted testing is in case hints files set either the old
4813 : or the new name.
4814 case "$_exe" in
4815 '')     case "$exe_ext" in
4816         '')     ;;
4817         *)      _exe="$exe_ext" ;;
4818         esac
4819         ;;
4820 esac
4821 case "$_a" in
4822 '')     case "$lib_ext" in
4823     '') _a='.a';;
4824         *)      _a="$lib_ext" ;;
4825         esac
4826         ;;
4827 esac
4828 case "$_o" in
4829 '') case "$obj_ext" in
4830         '')     _o='.o';;
4831         *)      _o="$obj_ext";;
4832         esac
4833         ;;
4834 esac
4835 case "$p_" in
4836 '') case "$path_sep" in
4837         '')     p_=':';;
4838         *)      p_="$path_sep";;
4839         esac
4840         ;;
4841 esac
4842 exe_ext=$_exe
4843 lib_ext=$_a
4844 obj_ext=$_o
4845 path_sep=$p_
4846
4847 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4848
4849 : Which makefile gets called first.  This is used by make depend.
4850 case "$firstmakefile" in
4851 '') firstmakefile='makefile';;
4852 esac
4853
4854 : Check for uselongdouble support
4855 case "$ccflags" in
4856 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4857 esac
4858
4859 case "$uselongdouble" in
4860 $define|true|[yY]*)     dflt='y';;
4861 *) dflt='n';;
4862 esac
4863 cat <<EOM
4864
4865 Perl can be built to take advantage of long doubles which
4866 (if available) may give more accuracy and range for floating point numbers.
4867
4868 If this doesn't make any sense to you, just accept the default '$dflt'.
4869 EOM
4870 rp='Try to use long doubles if available?'
4871 . ./myread
4872 case "$ans" in
4873 y|Y)    val="$define"   ;;
4874 *)      val="$undef"    ;;
4875 esac
4876 set uselongdouble
4877 eval $setvar
4878
4879 case "$uselongdouble" in
4880 true|[yY]*) uselongdouble="$define" ;;
4881 esac
4882
4883 : Look for a hint-file generated 'call-back-unit'.  If the
4884 : user has specified that long doubles should be used,
4885 : we may need to set or change some other defaults.
4886 if $test -f uselongdouble.cbu; then
4887     echo "Your platform has some specific hints regarding long doubles, using them..."
4888     . ./uselongdouble.cbu
4889 else
4890     case "$uselongdouble" in
4891         $define)
4892                 $cat <<EOM
4893 (Your platform does not have any specific hints for long doubles.)
4894 EOM
4895         ;;
4896     esac
4897 fi
4898
4899 : Looking for optional libraries
4900 echo " "
4901 echo "Checking for optional libraries..." >&4
4902 case "$libs" in
4903 ' '|'') dflt='';;
4904 *) dflt="$libs";;
4905 esac
4906 case "$libswanted" in
4907 '') libswanted='c_s';;
4908 esac
4909 case "$usesocks" in
4910 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4911 esac
4912 libsfound=''
4913 libsfiles=''
4914 libsdirs=''
4915 libspath=''
4916 for thisdir in $libpth $xlibpth; do
4917   test -d $thisdir && libspath="$libspath $thisdir"
4918 done
4919 for thislib in $libswanted; do
4920         for thisdir in $libspath; do
4921             xxx=''
4922             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4923                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4924                 $test -f "$xxx" && eval $libscheck
4925                 $test -f "$xxx" && libstyle=shared
4926             fi
4927             if test ! -f "$xxx"; then
4928                 xxx=$thisdir/lib$thislib.$so
4929                 $test -f "$xxx" && eval $libscheck
4930                 $test -f "$xxx" && libstyle=shared
4931             fi
4932             if test ! -f "$xxx"; then
4933                 xxx=$thisdir/lib$thislib$_a
4934                 $test -f "$xxx" && eval $libscheck
4935                 $test -f "$xxx" && libstyle=static
4936             fi
4937             if test ! -f "$xxx"; then
4938                 xxx=$thisdir/$thislib$_a
4939                 $test -f "$xxx" && eval $libscheck
4940                 $test -f "$xxx" && libstyle=static
4941             fi
4942             if test ! -f "$xxx"; then
4943                 xxx=$thisdir/lib${thislib}_s$_a
4944                 $test -f "$xxx" && eval $libscheck
4945                 $test -f "$xxx" && libstyle=static
4946                 $test -f "$xxx" && thislib=${thislib}_s
4947             fi
4948             if test ! -f "$xxx"; then
4949                 xxx=$thisdir/Slib$thislib$_a
4950                 $test -f "$xxx" && eval $libscheck
4951                 $test -f "$xxx" && libstyle=static
4952             fi
4953             if $test -f "$xxx"; then
4954                 case "$libstyle" in
4955                 shared) echo "Found -l$thislib (shared)." ;;
4956                 static) echo "Found -l$thislib." ;;
4957                 *)      echo "Found -l$thislib ($libstyle)." ;;
4958                 esac
4959                 case " $dflt " in
4960                 *"-l$thislib "*);;
4961                 *) dflt="$dflt -l$thislib"
4962                    libsfound="$libsfound $xxx"
4963                    yyy=`basename $xxx`
4964                    libsfiles="$libsfiles $yyy"
4965                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4966                    case " $libsdirs " in
4967                    *" $yyy "*) ;;
4968                    *) libsdirs="$libsdirs $yyy" ;;
4969                    esac
4970                    ;;
4971                 esac
4972                 break
4973             fi
4974         done
4975         if $test ! -f "$xxx"; then
4976             echo "No -l$thislib."
4977         fi
4978 done
4979 set X $dflt
4980 shift
4981 dflt="$*"
4982 case "$libs" in
4983 '') dflt="$dflt";;
4984 *) dflt="$libs";;
4985 esac
4986 case "$dflt" in
4987 ' '|'') dflt='none';;
4988 esac
4989
4990 $cat <<EOM
4991
4992 In order to compile $package on your machine, a number of libraries
4993 are usually needed.  Include any other special libraries here as well.
4994 Say "none" for none.  The default list is almost always right.
4995 EOM
4996
4997 echo " "
4998 rp="What libraries to use?"
4999 . ./myread
5000 case "$ans" in
5001 none) libs=' ';;
5002 *) libs="$ans";;
5003 esac
5004
5005 : determine optimization, if desired, or use for debug flag also
5006 case "$optimize" in
5007 ' '|$undef) dflt='none';;
5008 '') dflt='-O';;
5009 *) dflt="$optimize";;
5010 esac
5011 $cat <<EOH
5012
5013 By default, $package compiles with the -O flag to use the optimizer.
5014 Alternately, you might want to use the symbolic debugger, which uses
5015 the -g flag (on traditional Unix systems).  Either flag can be
5016 specified here.  To use neither flag, specify the word "none".
5017
5018 EOH
5019 rp="What optimizer/debugger flag should be used?"
5020 . ./myread
5021 optimize="$ans"
5022 case "$optimize" in
5023 'none') optimize=" ";;
5024 esac
5025
5026 : Check what DEBUGGING is required from the command line
5027 : -DEBUGGING      or -DDEBUGGING or
5028 : -DEBUGGING=both                       = -g + -DDEBUGGING
5029 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5030 : -DEBUGGING=none or -UDEBUGGING        =
5031 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5032 case "$EBUGGING" in
5033 '')     ;;
5034 *)      DEBUGGING=$EBUGGING ;;
5035 esac
5036
5037 case "$DEBUGGING" in
5038 -g|both|$define)
5039     case "$optimize" in
5040         *-g*) ;;
5041         *)    optimize="$optimize -g" ;;
5042     esac ;;
5043 none|$undef)
5044     case "$optimize" in
5045         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5046                 shift
5047                 optimize="$*"
5048                 ;;
5049     esac ;;
5050 esac
5051
5052 dflt=''
5053 case "$DEBUGGING" in
5054 both|$define) dflt='-DDEBUGGING'
5055 esac
5056
5057 : argument order is deliberate, as the flag will start with - which set could
5058 : think is an option
5059 checkccflag='check=$1; flag=$2; callback=$3;
5060 echo " ";
5061 echo "Checking if your compiler accepts $flag" 2>&1;
5062 echo "int main(void) { return 0; }" > gcctest.c;
5063 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5064     echo "Yes, it does." 2>&1;
5065     if $test -s gcctest.out ; then
5066         echo "But your platform does not like it:";
5067         cat gcctest.out;
5068     else
5069         case "$ccflags" in
5070         *$check*)
5071             echo "Leaving current flags $ccflags alone." 2>&1
5072             ;;
5073         *) dflt="$dflt $flag";
5074             eval $callback
5075             ;;
5076         esac
5077     fi
5078 else
5079     echo "Nope, it does not, but that is ok." 2>&1;
5080 fi
5081 '
5082
5083 : We will not override a previous value, but we might want to
5084 : augment a hint file
5085 case "$hint" in
5086 default|recommended)
5087         case "$gccversion" in
5088         1*) dflt="$dflt -fpcc-struct-return" ;;
5089         esac
5090         case "$optimize:$DEBUGGING" in
5091         *-g*:old) dflt="$dflt -DDEBUGGING";;
5092         esac
5093         case "$gccversion" in
5094         2*) if $test -d /etc/conf/kconfig.d &&
5095                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5096                 then
5097                         # Interactive Systems (ISC) POSIX mode.
5098                         dflt="$dflt -posix"
5099                 fi
5100                 ;;
5101         esac
5102         case "$gccversion" in
5103         1*) ;;
5104         2.[0-8]*) ;;
5105         ?*)     set strict-aliasing -fno-strict-aliasing
5106                 eval $checkccflag
5107                 ;;
5108         esac
5109         # For gcc, adding -pipe speeds up compilations for some, but apparently
5110         # some assemblers can't read from stdin.  (It also slows down compilations
5111         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5112         case "$gccversion" in
5113         ?*)     set pipe -pipe
5114                 eval $checkccflag
5115                 ;;
5116         esac
5117
5118         # on x86_64 (at least) we require an extra library (libssp) in the
5119         # link command line. This library is not named, so I infer that it is
5120         # an implementation detail that may change. Hence the safest approach
5121         # is to add the flag to the flags passed to the compiler at link time,
5122         # as that way the compiler can do the right implementation dependant
5123         # thing. (NWC)
5124         case "$gccversion" in
5125         ?*)     set stack-protector -fstack-protector
5126                 eval $checkccflag
5127                 ;;
5128         esac
5129         ;;
5130 esac
5131
5132 case "$mips_type" in
5133 *BSD*|'') inclwanted="$locincpth $usrinc";;
5134 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5135 esac
5136 for thisincl in $inclwanted; do
5137         if $test -d $thisincl; then
5138                 if $test x$thisincl != x$usrinc; then
5139                         case "$dflt" in
5140                         *" -I$thisincl "*);;
5141                         *) dflt="$dflt -I$thisincl ";;
5142                         esac
5143                 fi
5144         fi
5145 done
5146
5147 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5148         xxx=true;
5149 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5150         xxx=true;
5151 else
5152         xxx=false;
5153 fi;
5154 if $xxx; then
5155         case "$dflt" in
5156         *$2*);;
5157         *) dflt="$dflt -D$2";;
5158         esac;
5159 fi'
5160
5161 set signal.h LANGUAGE_C; eval $inctest
5162
5163 case "$usesocks" in
5164 $define)
5165         ccflags="$ccflags -DSOCKS"
5166         ;;
5167 esac
5168
5169 case "$hint" in
5170 default|recommended) dflt="$ccflags $dflt" ;;
5171 *) dflt="$ccflags";;
5172 esac
5173
5174 case "$dflt" in
5175 ''|' ') dflt=none;;
5176 esac
5177
5178 $cat <<EOH
5179
5180 Your C compiler may want other flags.  For this question you should include
5181 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5182 but you should NOT include libraries or ld flags like -lwhatever.  If you
5183 want $package to honor its debug switch, you should include -DDEBUGGING here.
5184 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5185
5186 To use no flags, specify the word "none".
5187
5188 EOH
5189 set X $dflt
5190 shift
5191 dflt=${1+"$@"}
5192 rp="Any additional cc flags?"
5193 . ./myread
5194 case "$ans" in
5195 none) ccflags='';;
5196 *) ccflags="$ans";;
5197 esac
5198
5199 : the following weeds options from ccflags that are of no interest to cpp
5200 case "$cppflags" in
5201 '') cppflags="$ccflags" ;;
5202 *)  cppflags="$cppflags $ccflags" ;;
5203 esac
5204 case "$gccversion" in
5205 1*) cppflags="$cppflags -D__GNUC__"
5206 esac
5207 case "$mips_type" in
5208 '');;
5209 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5210 esac
5211 case "$cppflags" in
5212 '');;
5213 *)
5214         echo " "
5215         echo "Let me guess what the preprocessor flags are..." >&4
5216         set X $cppflags
5217         shift
5218         cppflags=''
5219         $cat >cpp.c <<'EOM'
5220 #define BLURFL foo
5221
5222 BLURFL xx LFRULB
5223 EOM
5224         previous=''
5225         for flag in $*
5226         do
5227                 case "$flag" in
5228                 -*) ftry="$flag";;
5229                 *) ftry="$previous $flag";;
5230                 esac
5231                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5232                         >cpp1.out 2>/dev/null && \
5233                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5234                         >cpp2.out 2>/dev/null && \
5235                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5236                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5237                 then
5238                         cppflags="$cppflags $ftry"
5239                         previous=''
5240                 else
5241                         previous="$flag"
5242                 fi
5243         done
5244         set X $cppflags
5245         shift
5246         cppflags=${1+"$@"}
5247         case "$cppflags" in
5248         *-*)  echo "They appear to be: $cppflags";;
5249         esac
5250         $rm -f cpp.c cpp?.out
5251         ;;
5252 esac
5253
5254 : flags used in final linking phase
5255 case "$ldflags" in
5256 '') if ./venix; then
5257                 dflt='-i -z'
5258         else
5259                 dflt=''
5260         fi
5261         case "$ccflags" in
5262         *-posix*) dflt="$dflt -posix" ;;
5263         esac
5264         # See note above about -fstack-protector
5265         case "$ccflags" in
5266         *-fstack-protector*) dflt="$dflt -fstack-protector" ;;
5267         esac
5268         ;;
5269 *) dflt="$ldflags";;
5270 esac
5271
5272 : Try to guess additional flags to pick up local libraries.
5273 for thislibdir in $libpth; do
5274         case " $loclibpth " in
5275         *" $thislibdir "*)
5276                 case "$dflt " in
5277                 *"-L$thislibdir "*) ;;
5278                 *)  dflt="$dflt -L$thislibdir" ;;
5279                 esac
5280                 ;;
5281         esac
5282 done
5283
5284 case "$dflt" in
5285 '') dflt='none' ;;
5286 esac
5287
5288 $cat <<EOH
5289
5290 Your C linker may need flags.  For this question you should
5291 include -L/whatever and any other flags used by the C linker, but you
5292 should NOT include libraries like -lwhatever.
5293
5294 Make sure you include the appropriate -L/path flags if your C linker
5295 does not normally search all of the directories you specified above,
5296 namely
5297         $libpth
5298 To use no flags, specify the word "none".
5299
5300 EOH
5301
5302 rp="Any additional ld flags (NOT including libraries)?"
5303 . ./myread
5304 case "$ans" in
5305 none) ldflags='';;
5306 *) ldflags="$ans";;
5307 esac
5308 rmlist="$rmlist pdp11"
5309
5310 : coherency check
5311 echo " "
5312 echo "Checking your choice of C compiler and flags for coherency..." >&4
5313 $cat > try.c <<'EOF'
5314 #include <stdio.h>
5315 int main() { printf("Ok\n"); return(0); }
5316 EOF
5317 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5318 shift
5319 $cat >try.msg <<'EOM'
5320 I've tried to compile and run the following simple program:
5321
5322 EOM
5323 $cat try.c >> try.msg
5324
5325 $cat >> try.msg <<EOM
5326
5327 I used the command:
5328
5329         $*
5330         $run ./try
5331
5332 and I got the following output:
5333
5334 EOM
5335 dflt=y
5336 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5337         if $sh -c "$run ./try " >>try.msg 2>&1; then
5338                 xxx=`$run ./try`
5339                 case "$xxx" in
5340                 "Ok") dflt=n ;;
5341                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5342                         case " $libs " in
5343                         *" -lsfio "*)
5344                                 cat >> try.msg <<'EOQS'
5345 If $libs contains -lsfio, and sfio is mis-configured, then it
5346 sometimes (apparently) runs and exits with a 0 status, but with no
5347 output!  It may have to do with sfio's use of _exit vs. exit.
5348
5349 EOQS
5350                                 rp="You have a big problem.  Shall I abort Configure"
5351                                 dflt=y
5352                                 ;;
5353                         esac
5354                         ;;
5355                 esac
5356         else
5357                 echo "The program compiled OK, but exited with status $?." >>try.msg
5358                 rp="You have a problem.  Shall I abort Configure"
5359                 dflt=y
5360         fi
5361 else
5362         echo "I can't compile the test program." >>try.msg
5363         rp="You have a BIG problem.  Shall I abort Configure"
5364         dflt=y
5365 fi
5366 case "$dflt" in
5367 y)
5368         $cat try.msg >&4
5369         case "$knowitall" in
5370         '')
5371                 echo "(The supplied flags or libraries might be incorrect.)"
5372                 ;;
5373         *) dflt=n;;
5374         esac
5375         echo " "
5376         . ./myread
5377         case "$ans" in
5378         n*|N*) ;;
5379         *)      echo "Ok.  Stopping Configure." >&4
5380                 exit 1
5381                 ;;
5382         esac
5383         ;;
5384 n) echo "OK, that should do.";;
5385 esac
5386 $rm_try gcctest gcctest.out
5387
5388 : define a shorthand compile call
5389 compile='
5390 mc_file=$1;
5391 shift;
5392 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5393 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5394 exit 1;
5395 fi;
5396 esac;
5397 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5398 : define a shorthand compile call for compilations that should be ok.
5399 compile_ok='
5400 mc_file=$1;
5401 shift;
5402 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5403
5404 : determine filename position in cpp output
5405 echo " "
5406 echo "Computing filename position in cpp output for #include directives..." >&4
5407 case "$osname" in
5408 vos) testaccess=-e ;;
5409 *)   testaccess=-r ;;
5410 esac
5411 echo '#include <stdio.h>' > foo.c
5412 $cat >fieldn <<EOF
5413 $startsh
5414 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5415 $grep '^[       ]*#.*stdio\.h' | \
5416 while read cline; do
5417         pos=1
5418         set \$cline
5419         while $test \$# -gt 0; do
5420                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5421                         echo "\$pos"
5422                         exit 0
5423                 fi
5424                 shift
5425                 pos=\`expr \$pos + 1\`
5426         done
5427 done
5428 EOF
5429 chmod +x fieldn
5430 fieldn=`./fieldn`
5431 $rm -f foo.c fieldn
5432 case $fieldn in
5433 '') pos='???';;
5434 1) pos=first;;
5435 2) pos=second;;
5436 3) pos=third;;
5437 *) pos="${fieldn}th";;
5438 esac
5439 echo "Your cpp writes the filename in the $pos field of the line."
5440
5441 case "$osname" in
5442 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5443 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5444 *)   cppfilter='' ;;
5445 esac
5446 : locate header file
5447 $cat >findhdr <<EOF
5448 $startsh
5449 wanted=\$1
5450 name=''
5451 for usrincdir in $usrinc
5452 do
5453         if test -f \$usrincdir/\$wanted; then
5454                 echo "\$usrincdir/\$wanted"
5455                 exit 0
5456         fi
5457 done
5458 awkprg='{ print \$$fieldn }'
5459 echo "#include <\$wanted>" > foo\$\$.c
5460 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5461 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5462 while read cline; do
5463         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5464         case "\$name" in
5465         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5466         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5467         *) exit 2;;
5468         esac;
5469 done;
5470 #
5471 # status = 0: grep returned 0 lines, case statement not executed
5472 # status = 1: headerfile found
5473 # status = 2: while loop executed, no headerfile found
5474 #
5475 status=\$?
5476 $rm -f foo\$\$.c;
5477 if test \$status -eq 1; then
5478         exit 0;
5479 fi
5480 exit 1
5481 EOF
5482 chmod +x findhdr
5483
5484 : define an alternate in-header-list? function
5485 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5486 cont=true; xxf="echo \"<\$1> found.\" >&4";
5487 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5488 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5489 esac;
5490 case $# in 4) instead=instead;; *) instead="at last";; esac;
5491 while $test "$cont"; do
5492         xxx=`./findhdr $1`
5493         var=$2; eval "was=\$$2";
5494         if $test "$xxx" && $test -r "$xxx";
5495         then eval $xxf;
5496         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5497                 cont="";
5498         else eval $xxnf;
5499         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5500         set $yyy; shift; shift; yyy=$@;
5501         case $# in 0) cont="";;
5502         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5503                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5504         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5505                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5506         esac;
5507 done;
5508 while $test "$yyy";
5509 do set $yyy; var=$2; eval "was=\$$2";
5510         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5511         set $yyy; shift; shift; yyy=$@;
5512 done'
5513
5514 : see if stdlib is available
5515 set stdlib.h i_stdlib
5516 eval $inhdr
5517
5518 : check for lengths of integral types
5519 echo " "
5520 case "$intsize" in
5521 '')
5522         echo "Checking to see how big your integers are..." >&4
5523         $cat >try.c <<EOCP
5524 #include <stdio.h>
5525 #$i_stdlib I_STDLIB
5526 #ifdef I_STDLIB
5527 #include <stdlib.h>
5528 #endif
5529 int main()
5530 {
5531         printf("intsize=%d;\n", (int)sizeof(int));
5532         printf("longsize=%d;\n", (int)sizeof(long));
5533         printf("shortsize=%d;\n", (int)sizeof(short));
5534         exit(0);
5535 }
5536 EOCP
5537         set try
5538         if eval $compile_ok && $run ./try > /dev/null; then
5539                 eval `$run ./try`
5540                 echo "Your integers are $intsize bytes long."
5541                 echo "Your long integers are $longsize bytes long."
5542                 echo "Your short integers are $shortsize bytes long."
5543         else
5544                 $cat >&4 <<EOM
5545 !
5546 Help! I can't compile and run the intsize test program: please enlighten me!
5547 (This is probably a misconfiguration in your system or libraries, and
5548 you really ought to fix it.  Still, I'll try anyway.)
5549 !
5550 EOM
5551                 dflt=4
5552                 rp="What is the size of an integer (in bytes)?"
5553                 . ./myread
5554                 intsize="$ans"
5555                 dflt=$intsize
5556                 rp="What is the size of a long integer (in bytes)?"
5557                 . ./myread
5558                 longsize="$ans"
5559                 dflt=2
5560                 rp="What is the size of a short integer (in bytes)?"
5561                 . ./myread
5562                 shortsize="$ans"
5563         fi
5564         ;;
5565 esac
5566 $rm_try
5567
5568 : check for long long
5569 echo " "
5570 echo "Checking to see if you have long long..." >&4
5571 echo 'int main() { long long x = 7; return 0; }' > try.c
5572 set try
5573 if eval $compile; then
5574         val="$define"
5575         echo "You have long long."
5576 else
5577         val="$undef"
5578         echo "You do not have long long."
5579 fi
5580 $rm_try
5581 set d_longlong
5582 eval $setvar
5583
5584 : check for length of long long
5585 case "${d_longlong}${longlongsize}" in
5586 $define)
5587         echo " "
5588         echo "Checking to see how big your long longs are..." >&4
5589         $cat >try.c <<'EOCP'
5590 #include <stdio.h>
5591 int main()
5592 {
5593     printf("%d\n", (int)sizeof(long long));
5594     return(0);
5595 }
5596 EOCP
5597         set try
5598         if eval $compile_ok; then
5599                 longlongsize=`$run ./try`
5600                 echo "Your long longs are $longlongsize bytes long."
5601         else
5602                 dflt='8'
5603                 echo " "
5604                 echo "(I can't seem to compile the test program.  Guessing...)"
5605                 rp="What is the size of a long long (in bytes)?"
5606                 . ./myread
5607                 longlongsize="$ans"
5608         fi
5609         if $test "X$longsize" = "X$longlongsize"; then
5610                 echo "(That isn't any different from an ordinary long.)"
5611         fi
5612         ;;
5613 esac
5614 $rm_try
5615
5616 : see if inttypes.h is available
5617 : we want a real compile instead of Inhdr because some systems
5618 : have an inttypes.h which includes non-existent headers
5619 echo " "
5620 $cat >try.c <<EOCP
5621 #include <inttypes.h>
5622 int main() {
5623         static int32_t foo32 = 0x12345678;
5624 }
5625 EOCP
5626 set try
5627 if eval $compile; then
5628         echo "<inttypes.h> found." >&4
5629         val="$define"
5630 else
5631         echo "<inttypes.h> NOT found." >&4
5632         val="$undef"
5633 fi
5634 $rm_try
5635 set i_inttypes
5636 eval $setvar
5637
5638 : check for int64_t
5639 echo " "
5640 echo "Checking to see if you have int64_t..." >&4
5641 $cat >try.c <<EOCP
5642 #include <sys/types.h>
5643 #$i_inttypes I_INTTYPES
5644 #ifdef I_INTTYPES
5645 #include <inttypes.h>
5646 #endif
5647 int main() { int64_t x = 7; }
5648 EOCP
5649 set try
5650 if eval $compile; then
5651         val="$define"
5652         echo "You have int64_t."
5653 else
5654         val="$undef"
5655         echo "You do not have int64_t."
5656 fi
5657 $rm_try
5658 set d_int64_t
5659 eval $setvar
5660
5661 : Check if 64bit ints have a quad type
5662 echo " "
5663 echo "Checking which 64-bit integer type we could use..." >&4
5664
5665 case "$intsize" in
5666 8) val=int
5667    set quadtype
5668    eval $setvar
5669    val='"unsigned int"'
5670    set uquadtype
5671    eval $setvar
5672    quadkind=1
5673    ;;
5674 *) case "$longsize" in
5675    8) val=long
5676       set quadtype
5677       eval $setvar
5678       val='"unsigned long"'
5679       set uquadtype
5680       eval $setvar
5681       quadkind=2
5682       ;;
5683    *) case "$d_longlong:$longlongsize" in
5684       define:8)
5685         val='"long long"'
5686         set quadtype
5687         eval $setvar
5688         val='"unsigned long long"'
5689         set uquadtype
5690         eval $setvar
5691         quadkind=3
5692         ;;
5693       *) case "$d_int64_t" in
5694          define)
5695            val=int64_t
5696            set quadtype
5697            eval $setvar
5698            val=uint64_t
5699            set uquadtype
5700            eval $setvar
5701            quadkind=4
5702            ;;
5703          esac
5704          ;;
5705       esac
5706       ;;
5707    esac
5708    ;;
5709 esac
5710
5711 case "$quadtype" in
5712 '')     echo "Alas, no 64-bit integer types in sight." >&4
5713         d_quad="$undef"
5714         ;;
5715 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5716         d_quad="$define"
5717         ;;
5718 esac
5719
5720 : Do we want 64bit support
5721 case "$uselonglong" in
5722 "$define"|true|[yY]*)
5723         cat <<EOM >&4
5724
5725 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5726 EOM
5727         use64bitint="$define"
5728         ;;
5729 esac
5730 case "$use64bits" in
5731 "$define"|true|[yY]*)
5732         cat <<EOM >&4
5733
5734 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5735 EOM
5736         use64bitint="$define"
5737         ;;
5738 esac
5739 case "$use64bitints" in
5740 "$define"|true|[yY]*)
5741         cat <<EOM >&4
5742
5743 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5744 EOM
5745         use64bitint="$define"
5746         ;;
5747 esac
5748 case "$use64bitsint" in
5749 "$define"|true|[yY]*)
5750         cat <<EOM >&4
5751
5752 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5753 EOM
5754         use64bitint="$define"
5755         ;;
5756 esac
5757 case "$uselonglongs" in
5758 "$define"|true|[yY]*)
5759         cat <<EOM >&4
5760
5761 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5762 EOM
5763         use64bitint="$define"
5764         ;;
5765 esac
5766 case "$use64bitsall" in
5767 "$define"|true|[yY]*)
5768         cat <<EOM >&4
5769
5770 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5771 EOM
5772         use64bitall="$define"
5773         ;;
5774 esac
5775
5776 case "$ccflags" in
5777 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5778 esac
5779 case "$use64bitall" in
5780 "$define"|true|[yY]*) use64bitint="$define" ;;
5781 esac
5782
5783 case "$longsize" in
5784 8) cat <<EOM
5785
5786 You have natively 64-bit long integers.
5787 EOM
5788    val="$define"
5789    ;;
5790 *) case "$use64bitint" in
5791    "$define"|true|[yY]*) dflt='y';;
5792    *) dflt='n';;
5793    esac
5794    case "$d_quad" in
5795    "$define") ;;
5796    *) dflt='n' ;;
5797    esac
5798    cat <<EOM
5799
5800 Perl can be built to take advantage of 64-bit integer types
5801 on some systems.  To do so, Configure can be run with -Duse64bitint.
5802 Choosing this option will most probably introduce binary incompatibilities.
5803
5804 If this doesn't make any sense to you, just accept the default '$dflt'.
5805 (The default has been chosen based on your configuration.)
5806 EOM
5807    rp='Try to use 64-bit integers, if available?'
5808    . ./myread
5809    case "$ans" in
5810    [yY]*) val="$define" ;;
5811    *)     val="$undef"  ;;
5812    esac
5813    ;;
5814 esac
5815 set use64bitint
5816 eval $setvar
5817
5818 case "$use64bitall" in
5819 "$define"|true|[yY]*) dflt='y' ;;
5820 *) case "$longsize" in
5821    8) dflt='y' ;;
5822    *) dflt='n' ;;
5823    esac
5824    ;;
5825 esac
5826 cat <<EOM
5827
5828 You may also choose to try maximal 64-bitness.  It means using as much
5829 64-bitness as possible on the platform.  This in turn means even more
5830 binary incompatibilities.  On the other hand, your platform may not
5831 have any more 64-bitness available than what you already have chosen.
5832
5833 If this doesn't make any sense to you, just accept the default '$dflt'.
5834 (The default has been chosen based on your configuration.)
5835 EOM
5836 rp='Try to use maximal 64-bit support, if available?'
5837 . ./myread
5838 case "$ans" in
5839 [yY]*) val="$define" ;;
5840 *)     val="$undef"  ;;
5841 esac
5842 set use64bitall
5843 eval $setvar
5844 case "$use64bitall" in
5845 "$define")
5846         case "$use64bitint" in
5847         "$undef")
5848                 cat <<EOM
5849
5850 Since you have chosen a maximally 64-bit build, I'm also turning on
5851 the use of 64-bit integers.
5852 EOM
5853                 use64bitint="$define" ;;
5854         esac
5855         ;;
5856 esac
5857
5858 : Look for a hint-file generated 'call-back-unit'.  If the
5859 : user has specified that a 64-bit perl is to be built,
5860 : we may need to set or change some other defaults.
5861 if $test -f use64bitint.cbu; then
5862         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5863         . ./use64bitint.cbu
5864 fi
5865 case "$use64bitint" in
5866 "$define"|true|[yY]*)
5867         case "$longsize" in
5868         4) case "$archname64" in
5869            '') archname64=64int ;;
5870            esac
5871            ;;
5872         esac
5873         ;;
5874 esac
5875
5876 : Look for a hint-file generated 'call-back-unit'.  If the
5877 : user has specified that a maximally 64-bit perl is to be built,
5878 : we may need to set or change some other defaults.
5879 if $test -f use64bitall.cbu; then
5880         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5881         . ./use64bitall.cbu
5882 fi
5883 case "$use64bitall" in
5884 "$define"|true|[yY]*)
5885         case "$longsize" in
5886         4) case "$archname64" in
5887            ''|64int) archname64=64all ;;
5888            esac
5889            ;;
5890         esac
5891         ;;
5892 esac
5893
5894 case "$d_quad:$use64bitint" in
5895 $undef:$define)
5896         cat >&4 <<EOF
5897
5898 *** You have chosen to use 64-bit integers,
5899 *** but none can be found.
5900 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5901 *** Cannot continue, aborting.
5902
5903 EOF
5904         exit 1
5905         ;;
5906 esac
5907
5908 : check for length of double
5909 echo " "
5910 case "$doublesize" in
5911 '')
5912         echo "Checking to see how big your double precision numbers are..." >&4
5913         $cat >try.c <<EOCP
5914 #include <stdio.h>
5915 #$i_stdlib I_STDLIB
5916 #ifdef I_STDLIB
5917 #include <stdlib.h>
5918 #endif
5919 int main()
5920 {
5921     printf("%d\n", (int)sizeof(double));
5922     exit(0);
5923 }
5924 EOCP
5925         set try
5926         if eval $compile_ok; then
5927                 doublesize=`$run ./try`
5928                 echo "Your double is $doublesize bytes long."
5929         else
5930                 dflt='8'
5931                 echo "(I can't seem to compile the test program.  Guessing...)"
5932                 rp="What is the size of a double precision number (in bytes)?"
5933                 . ./myread
5934                 doublesize="$ans"
5935         fi
5936         ;;
5937 esac
5938 $rm_try
5939
5940 : check for long doubles
5941 echo " "
5942 echo "Checking to see if you have long double..." >&4
5943 echo 'int main() { long double x = 7.0; }' > try.c
5944 set try
5945 if eval $compile; then
5946         val="$define"
5947         echo "You have long double."
5948 else
5949         val="$undef"
5950         echo "You do not have long double."
5951 fi
5952 $rm_try
5953 set d_longdbl
5954 eval $setvar
5955
5956 : check for length of long double
5957 case "${d_longdbl}${longdblsize}" in
5958 $define)
5959         echo " "
5960         echo "Checking to see how big your long doubles are..." >&4
5961         $cat >try.c <<'EOCP'
5962 #include <stdio.h>
5963 int main()
5964 {
5965         printf("%d\n", sizeof(long double));
5966 }
5967 EOCP
5968         set try
5969         set try
5970         if eval $compile; then
5971                 longdblsize=`$run ./try`
5972                 echo "Your long doubles are $longdblsize bytes long."
5973         else
5974                 dflt='8'
5975                 echo " "
5976                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5977                 rp="What is the size of a long double (in bytes)?"
5978                 . ./myread
5979                 longdblsize="$ans"
5980         fi
5981         if $test "X$doublesize" = "X$longdblsize"; then
5982                 echo "That isn't any different from an ordinary double."
5983                 echo "I'll keep your setting anyway, but you may see some"
5984                 echo "harmless compilation warnings."
5985         fi
5986         ;;
5987 esac
5988 $rm_try
5989
5990 : determine the architecture name
5991 echo " "
5992 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5993         tarch=`arch`"-$osname"
5994 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5995         if uname -m > tmparch 2>&1 ; then
5996                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5997                         -e 's/$/'"-$osname/" tmparch`
5998         else
5999                 tarch="$osname"
6000         fi
6001         $rm -f tmparch
6002 else
6003         tarch="$osname"
6004 fi
6005 case "$myarchname" in
6006 ''|"$tarch") ;;
6007 *)
6008         echo "(Your architecture name used to be $myarchname.)"
6009         archname=''
6010         ;;
6011 esac
6012 case "$targetarch" in
6013 '') ;;
6014 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6015 esac
6016 myarchname="$tarch"
6017 case "$archname" in
6018 '') dflt="$tarch";;
6019 *) dflt="$archname";;
6020 esac
6021 rp='What is your architecture name'
6022 . ./myread
6023 archname="$ans"
6024 case "$usethreads" in
6025 $define)
6026         echo "Threads selected." >&4
6027         case "$archname" in
6028         *-thread*) echo "...and architecture name already has -thread." >&4
6029                 ;;
6030         *)      archname="$archname-thread"
6031                 echo "...setting architecture name to $archname." >&4
6032                 ;;
6033         esac
6034         ;;
6035 esac
6036 case "$usemultiplicity" in
6037 $define)
6038         echo "Multiplicity selected." >&4
6039         case "$archname" in
6040         *-multi*) echo "...and architecture name already has -multi." >&4
6041                 ;;
6042         *)      archname="$archname-multi"
6043                 echo "...setting architecture name to $archname." >&4
6044                 ;;
6045         esac
6046         ;;
6047 esac
6048 case "$use64bitint$use64bitall" in
6049 *"$define"*)
6050         case "$archname64" in
6051         '')
6052                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6053                 ;;
6054         *)
6055                 case "$use64bitint" in
6056                 "$define") echo "64 bit integers selected." >&4 ;;
6057                 esac
6058                 case "$use64bitall" in
6059                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6060                 esac
6061                 case "$archname" in
6062                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6063                         ;;
6064                 *)      archname="$archname-$archname64"
6065                         echo "...setting architecture name to $archname." >&4
6066                         ;;
6067                 esac
6068                 ;;
6069         esac
6070 esac
6071 case "$uselongdouble" in
6072 $define)
6073         echo "Long doubles selected." >&4
6074         case "$longdblsize" in
6075         $doublesize)
6076                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6077                 ;;
6078         *)
6079                 case "$archname" in
6080                 *-ld*) echo "...and architecture name already has -ld." >&4
6081                         ;;
6082                 *)      archname="$archname-ld"
6083                         echo "...setting architecture name to $archname." >&4
6084                         ;;
6085                 esac
6086                 ;;
6087         esac
6088         ;;
6089 esac
6090 case "$useperlio" in
6091 $define)
6092         echo "Perlio selected." >&4
6093         ;;
6094 *)
6095         echo "Perlio not selected, using stdio." >&4
6096         case "$archname" in
6097         *-stdio*) echo "...and architecture name already has -stdio." >&4
6098                 ;;
6099         *)      archname="$archname-stdio"
6100                 echo "...setting architecture name to $archname." >&4
6101                 ;;
6102         esac
6103         ;;
6104 esac
6105 if $test -f archname.cbu; then
6106         echo "Your platform has some specific hints for architecture name, using them..."
6107         . ./archname.cbu
6108 fi
6109
6110 : set the prefixit variable, to compute a suitable default value
6111 prefixit='case "$3" in
6112 ""|none)
6113         case "$oldprefix" in
6114         "") eval "$1=\"\$$2\"";;
6115         *)
6116                 case "$3" in
6117                 "") eval "$1=";;
6118                 none)
6119                         eval "tp=\"\$$2\"";
6120                         case "$tp" in
6121                         ""|" ") eval "$1=\"\$$2\"";;
6122                         *) eval "$1=";;
6123                         esac;;
6124                 esac;;
6125         esac;;
6126 *)
6127         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6128         case "$tp" in
6129         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6130         /*-$oldprefix/*|\~*-$oldprefix/*)
6131                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6132         *) eval "$1=\"\$$2\"";;
6133         esac;;
6134 esac'
6135
6136 : determine installation style
6137 : For now, try to deduce it from prefix unless it is already set.
6138 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6139 case "$installstyle" in
6140 '')     case "$prefix" in
6141                 *perl*) dflt='lib';;
6142                 *) dflt='lib/perl5' ;;
6143         esac
6144         ;;
6145 *)      dflt="$installstyle" ;;
6146 esac
6147 : Probably not worth prompting for this since we prompt for all
6148 : the directories individually, and the prompt would be too long and
6149 : confusing anyway.
6150 installstyle=$dflt
6151
6152 : determine where public executables go
6153 echo " "
6154 set dflt bin bin
6155 eval $prefixit
6156 fn=d~
6157 rp='Pathname where the public executables will reside?'
6158 . ./getfile
6159 if $test "X$ansexp" != "X$binexp"; then
6160         installbin=''
6161 fi
6162 prefixvar=bin
6163 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6164 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6165 :     this via initialinstalllocation
6166 . ./setprefixvar
6167
6168 case "$userelocatableinc" in
6169 $define|true|[yY]*)     dflt='y' ;;
6170 *)                      dflt='n' ;;
6171 esac
6172 cat <<EOM
6173
6174 Would you like to build Perl so that the installation is relocatable, so that
6175 library paths in @INC are determined relative to the path of the perl binary?
6176 This is not advised for system Perl installs, or if you need to run setid
6177 scripts or scripts under taint mode.
6178
6179 If this doesn't make any sense to you, just accept the default '$dflt'.
6180 EOM
6181 rp='Use relocatable @INC?'
6182 . ./myread
6183 case "$ans" in
6184 y|Y)    val="$define" ;;
6185 *)      val="$undef"  ;;
6186 esac
6187 set userelocatableinc
6188 eval $setvar
6189
6190 initialinstalllocation="$binexp"
6191 : Default prefix is now "up one level from where the binaries are"
6192 case "$userelocatableinc" in
6193 $define|true|[yY]*)
6194     bin=".../"
6195     binexp=".../"
6196     prefix=".../.."
6197     prefixexp=".../.."
6198     installprefixexp=".../.."
6199     ;;
6200 esac
6201
6202 : determine where private library files go
6203 : Usual default is /usr/local/lib/perl5/$version.
6204 : Also allow things like /opt/perl/lib/$version, since
6205 : /opt/perl/lib/perl5... would be redundant.
6206 : The default "style" setting is made in installstyle.U
6207 case "$installstyle" in
6208 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6209 *)       set dflt privlib lib/$version ;;
6210 esac
6211 eval $prefixit
6212 $cat <<EOM
6213
6214 There are some auxiliary files for $package that need to be put into a
6215 private library directory that is accessible by everyone.
6216
6217 EOM
6218 fn=$binexp
6219 fn=d~+
6220 rp='Pathname where the private library files will reside?'
6221 . ./getfile
6222 prefixvar=privlib
6223 . ./setprefixvar
6224
6225 : set the prefixup variable, to restore leading tilda escape
6226 prefixup='case "$prefixexp" in
6227 "$prefix") ;;
6228 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6229 esac'
6230
6231 : determine where public architecture dependent libraries go
6232 set archlib archlib
6233 eval $prefixit
6234 : privlib default is /usr/local/lib/$package/$version
6235 : archlib default is /usr/local/lib/$package/$version/$archname
6236 : privlib may have an optional trailing /share.
6237 tdflt=`echo $privlib | $sed 's,/share$,,'`
6238 tdflt=$tdflt/$archname
6239 case "$archlib" in
6240 '')     dflt=$tdflt
6241         ;;
6242 *)      dflt="$archlib"
6243     ;;
6244 esac
6245 $cat <<EOM
6246
6247 $spackage contains architecture-dependent library files.  If you are
6248 sharing libraries in a heterogeneous environment, you might store
6249 these files in a separate location.  Otherwise, you can just include
6250 them with the rest of the public library files.
6251
6252 EOM
6253 fn=$binexp
6254 fn=d+~
6255 rp='Where do you want to put the public architecture-dependent libraries?'
6256 . ./getfile
6257 prefixvar=archlib
6258 . ./setprefixvar
6259 if $test X"$archlib" = X"$privlib"; then
6260         d_archlib="$undef"
6261 else
6262         d_archlib="$define"
6263 fi
6264
6265 : see if setuid scripts can be secure
6266 $cat <<EOM
6267
6268 Some kernels have a bug that prevents setuid #! scripts from being
6269 secure.  Some sites have disabled setuid #! scripts because of this.
6270
6271 First let's decide if your kernel supports secure setuid #! scripts.
6272 (If setuid #! scripts would be secure but have been disabled anyway,
6273 don't say that they are secure if asked.)
6274
6275 EOM
6276
6277 val="$undef"
6278 if $test -d /dev/fd; then
6279         echo "#!$ls" >reflect
6280         chmod +x,u+s reflect
6281         ./reflect >flect 2>&1
6282         if $contains "/dev/fd" flect >/dev/null; then
6283                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6284                 val="$define"
6285         else
6286                 $cat <<EOM
6287 If you are not sure if they are secure, I can check but I'll need a
6288 username and password different from the one you are using right now.
6289 If you don't have such a username or don't want me to test, simply
6290 enter 'none'.
6291
6292 EOM
6293                 rp='Other username to test security of setuid scripts with?'
6294                 dflt='none'
6295                 . ./myread
6296                 case "$ans" in
6297                 n|none)
6298                         case "$d_suidsafe" in
6299                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6300                                 dflt=n;;
6301                         "$undef")
6302                                 echo "Well, the $hint value is *not* secure." >&4
6303                                 dflt=n;;
6304                         *)      echo "Well, the $hint value *is* secure." >&4
6305                                 dflt=y;;
6306                         esac
6307                         ;;
6308                 *)
6309                         $rm -f reflect flect
6310                         echo "#!$ls" >reflect
6311                         chmod +x,u+s reflect
6312                         echo >flect
6313                         chmod a+w flect
6314                         echo '"su" will (probably) prompt you for '"$ans's password."
6315                         su $ans -c './reflect >flect'
6316                         if $contains "/dev/fd" flect >/dev/null; then
6317                                 echo "Okay, it looks like setuid scripts are secure." >&4
6318                                 dflt=y
6319                         else
6320                                 echo "I don't think setuid scripts are secure." >&4
6321                                 dflt=n
6322                         fi
6323                         ;;
6324                 esac
6325                 rp='Does your kernel have *secure* setuid scripts?'
6326                 . ./myread
6327                 case "$ans" in
6328                 [yY]*)  val="$define";;
6329                 *)      val="$undef";;
6330                 esac
6331         fi
6332 else
6333         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6334         echo "(That's for file descriptors, not floppy disks.)"
6335         val="$undef"
6336 fi
6337 set d_suidsafe
6338 eval $setvar
6339
6340 $rm -f reflect flect
6341
6342 : now see if they want to do setuid emulation
6343 echo " "
6344 val="$undef"
6345 case "$d_suidsafe" in
6346 "$define")
6347         val="$undef"
6348         echo "No need to emulate SUID scripts since they are secure here." >&4
6349         ;;
6350 *)
6351         $cat <<EOM
6352 Some systems have disabled setuid scripts, especially systems where
6353 setuid scripts cannot be secure.  On systems where setuid scripts have
6354 been disabled, the setuid/setgid bits on scripts are currently
6355 useless.  It is possible for $package to detect those bits and emulate
6356 setuid/setgid in a secure fashion.  This emulation will only work if
6357 setuid scripts have been disabled in your kernel.
6358
6359 EOM
6360         case "$d_dosuid" in
6361         "$define") dflt=y ;;
6362         *) dflt=n ;;
6363         esac
6364         rp="Do you want to do setuid/setgid emulation?"
6365         . ./myread
6366         case "$ans" in
6367         [yY]*)  val="$define";;
6368         *)      val="$undef";;
6369         esac
6370         ;;
6371 esac
6372 set d_dosuid
6373 eval $setvar
6374
6375 : Find perl5.005 or later.
6376 echo "Looking for a previously installed perl5.005 or later... "
6377 case "$perl5" in
6378 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6379                 : Check if this perl is recent and can load a simple module
6380                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6381                         perl5=$tdir/perl
6382                         break;
6383                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6384                         perl5=$tdir/perl5
6385                         break;
6386                 fi
6387         done
6388         ;;
6389 *)      perl5="$perl5"
6390         ;;
6391 esac
6392 case "$perl5" in
6393 '')     echo "None found.  That's ok.";;
6394 *)      echo "Using $perl5." ;;
6395 esac
6396
6397 : Set the siteprefix variables
6398 $cat <<EOM
6399
6400 After $package is installed, you may wish to install various
6401 add-on modules and utilities.  Typically, these add-ons will
6402 be installed under $prefix with the rest
6403 of this package.  However, you may wish to install such add-ons
6404 elsewhere under a different prefix.
6405
6406 If you do not wish to put everything under a single prefix, that's
6407 ok.  You will be prompted for the individual locations; this siteprefix
6408 is only used to suggest the defaults.
6409
6410 The default should be fine for most people.
6411
6412 EOM
6413 fn=d~+
6414 rp='Installation prefix to use for add-on modules and utilities?'
6415 : XXX Here might be another good place for an installstyle setting.
6416 case "$siteprefix" in
6417 '') dflt=$prefix ;;
6418 *)  dflt=$siteprefix ;;
6419 esac
6420 . ./getfile
6421 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6422 oldsiteprefix=''
6423 case "$siteprefix" in
6424 '') ;;
6425 *)      case "$ans" in
6426         "$prefix") ;;
6427         *) oldsiteprefix="$prefix";;
6428         esac
6429         ;;
6430 esac
6431 siteprefix="$ans"
6432 siteprefixexp="$ansexp"
6433
6434 : determine where site specific libraries go.
6435 : Usual default is /usr/local/lib/perl5/site_perl/$version
6436 : The default "style" setting is made in installstyle.U
6437 : XXX No longer works with Prefixit stuff.
6438 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6439 case "$sitelib" in
6440 '') case "$installstyle" in
6441         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6442         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6443         esac
6444         ;;
6445 *)      dflt="$sitelib"
6446         ;;
6447 esac
6448 $cat <<EOM
6449
6450 The installation process will create a directory for
6451 site-specific extensions and modules.  Most users find it convenient
6452 to place all site-specific files in this directory rather than in the
6453 main distribution directory.
6454
6455 EOM
6456 fn=d~+
6457 rp='Pathname for the site-specific library files?'
6458 . ./getfile
6459 prefixvar=sitelib
6460 . ./setprefixvar
6461 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6462
6463 : Determine list of previous versions to include in @INC
6464 $cat > getverlist <<EOPL
6465 #!$perl5 -w
6466 use File::Basename;
6467 \$api_versionstring = "$api_versionstring";
6468 \$version = "$version";
6469 \$stem = "$sitelib_stem";
6470 \$archname = "$archname";
6471 EOPL
6472         $cat >> getverlist <<'EOPL'
6473 # The list found is store twice for each entry: the original name, and
6474 # the binary broken down version as pack "sss", so sorting is easy and
6475 # unambiguous. This will work for all versions that have a maximum of
6476 # three digit groups, separate by '.'s or '_'s. Names are extended with
6477 # ".0.0" to ensure at least three elements for the pack.
6478 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6479
6480 # Can't have leading @ because metaconfig interprets it as a command!
6481 ;@inc_version_list=();
6482 # XXX Redo to do opendir/readdir?
6483 if (-d $stem) {
6484     chdir($stem);
6485     ;@candidates = map {
6486         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6487 }
6488 else {
6489     ;@candidates = ();
6490 }
6491
6492 ($pversion, $aversion, $vsn5005) = map {
6493     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6494 foreach $d (@candidates) {
6495     if ($d->[1] lt $pversion) {
6496         if ($d->[1] ge $aversion) {
6497             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6498         }
6499         elsif ($d->[1] ge $vsn5005) {
6500             unshift(@inc_version_list, grep { -d } $d->[0]);
6501         }
6502     }
6503     else {
6504         # Skip newer version.  I.e. don't look in
6505         # 5.7.0 if we're installing 5.6.1.
6506     }
6507 }
6508
6509 if (@inc_version_list) {
6510     print join(' ', @inc_version_list);
6511 }
6512 else {
6513     # Blank space to preserve value for next Configure run.
6514     print " ";
6515 }
6516 EOPL
6517 chmod +x getverlist
6518 case "$inc_version_list" in
6519 '')     if test -x "$perl5$exe_ext"; then
6520                 dflt=`$perl5 getverlist`
6521         else
6522                 dflt='none'
6523         fi
6524         ;;
6525 $undef) dflt='none' ;;
6526 *)  eval dflt=\"$inc_version_list\" ;;
6527 esac
6528 case "$dflt" in
6529 ''|' ') dflt=none ;;
6530 esac
6531 case "$dflt" in
6532 5.005) dflt=none ;;
6533 esac
6534 $cat <<EOM
6535
6536 In order to ease the process of upgrading, this version of perl
6537 can be configured to use modules built and installed with earlier
6538 versions of perl that were installed under $prefix.  Specify here
6539 the list of earlier versions that this version of perl should check.
6540 If Configure detected no earlier versions of perl installed under
6541 $prefix, then the list will be empty.  Answer 'none' to tell perl
6542 to not search earlier versions.
6543
6544 The default should almost always be sensible, so if you're not sure,
6545 just accept the default.
6546 EOM
6547
6548 rp='List of earlier versions to include in @INC?'
6549 . ./myread
6550 case "$ans" in
6551 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6552 *) inc_version_list="$ans" ;;
6553 esac
6554 case "$inc_version_list" in
6555 ''|' ')
6556         inc_version_list_init='0'
6557         d_inc_version_list="$undef"
6558         ;;
6559 *)      inc_version_list_init=`echo $inc_version_list |
6560                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6561         d_inc_version_list="$define"
6562         ;;
6563 esac
6564 $rm -f getverlist
6565
6566 : see if malloc/malloc.h has to be included
6567 set malloc/malloc.h i_mallocmalloc
6568 eval $inhdr
6569
6570 : see if this is a malloc.h system
6571 : we want a real compile instead of Inhdr because some systems have a
6572 : malloc.h that just gives a compile error saying to use stdlib.h instead
6573 echo " "
6574 $cat >try.c <<EOCP
6575 #include <stdlib.h>
6576 #include <malloc.h>
6577 #$i_mallocmalloc I_MALLOCMALLOC
6578 #ifdef I_MALLOCMALLOC
6579 # include <malloc/malloc.h>
6580 #endif
6581
6582 int main () { return 0; }
6583 EOCP
6584 set try
6585 if eval $compile; then
6586     echo "<malloc.h> found." >&4
6587     val="$define"
6588 else
6589     echo "<malloc.h> NOT found." >&4
6590     val="$undef"
6591 fi
6592 $rm_try
6593 set i_malloc
6594 eval $setvar
6595
6596 : check for void type
6597 echo " "
6598 echo "Checking to see how well your C compiler groks the void type..." >&4
6599 case "$voidflags" in
6600 '')
6601         $cat >try.c <<EOCP
6602 #$i_stdlib I_STDLIB
6603 #ifdef I_STDLIB
6604 #include <stdlib.h>
6605 #endif
6606 #if TRY & 1
6607 void sub() {
6608 #else
6609 sub() {
6610 #endif
6611         extern void moo();      /* function returning void */
6612         void (*goo)();          /* ptr to func returning void */
6613 #if TRY & 8
6614         void *hue;              /* generic ptr */
6615 #endif
6616 #if TRY & 2
6617         void (*foo[10])();
6618 #endif
6619
6620 #if TRY & 4
6621         if(goo == moo) {
6622                 exit(0);
6623         }
6624 #endif
6625         exit(0);
6626 }
6627 int main() { sub(); }
6628 EOCP
6629         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6630                 voidflags=$defvoidused
6631         echo "Good.  It appears to support void to the level $package wants.">&4
6632                 if $contains warning .out >/dev/null 2>&1; then
6633                         echo "However, you might get some warnings that look like this:"
6634                         $cat .out
6635                 fi
6636         else
6637 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6638                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6639                         echo "It supports 1..."
6640                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6641                                 echo "It also supports 2..."
6642                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6643                                         voidflags=7
6644                                         echo "And it supports 4 but not 8 definitely."
6645                                 else
6646                                         echo "It doesn't support 4..."
6647                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6648                                                 voidflags=11
6649                                                 echo "But it supports 8."
6650                                         else
6651                                                 voidflags=3
6652                                                 echo "Neither does it support 8."
6653                                         fi
6654                                 fi
6655                         else
6656                                 echo "It does not support 2..."
6657                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6658                                         voidflags=13
6659                                         echo "But it supports 4 and 8."
6660                                 else
6661                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6662                                                 voidflags=5
6663                                                 echo "And it supports 4 but has not heard about 8."
6664                                         else
6665                                                 echo "However it supports 8 but not 4."
6666                                         fi
6667                                 fi
6668                         fi
6669                 else
6670                         echo "There is no support at all for void."
6671                         voidflags=0
6672                 fi
6673         fi
6674 esac
6675 case "$voidflags" in
6676 "$defvoidused") ;;
6677 *)      $cat >&4 <<'EOM'
6678   Support flag bits are:
6679     1: basic void declarations.
6680     2: arrays of pointers to functions returning void.
6681     4: operations between pointers to and addresses of void functions.
6682     8: generic void pointers.
6683 EOM
6684         dflt="$voidflags";
6685         rp="Your void support flags add up to what?"
6686         . ./myread
6687         voidflags="$ans"
6688         ;;
6689 esac
6690 $rm_try
6691
6692 : check for length of pointer
6693 echo " "
6694 case "$ptrsize" in
6695 '')
6696         echo "Checking to see how big your pointers are..." >&4
6697         if test "$voidflags" -gt 7; then
6698                 echo '#define VOID_PTR char *' > try.c
6699         else
6700                 echo '#define VOID_PTR void *' > try.c
6701         fi
6702         $cat >>try.c <<EOCP
6703 #include <stdio.h>
6704 #$i_stdlib I_STDLIB
6705 #ifdef I_STDLIB
6706 #include <stdlib.h>
6707 #endif
6708 int main()
6709 {
6710     printf("%d\n", (int)sizeof(VOID_PTR));
6711     exit(0);
6712 }
6713 EOCP
6714         set try
6715         if eval $compile_ok; then
6716                 ptrsize=`$run ./try`
6717                 echo "Your pointers are $ptrsize bytes long."
6718         else
6719                 dflt='4'
6720                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6721                 rp="What is the size of a pointer (in bytes)?"
6722                 . ./myread
6723                 ptrsize="$ans"
6724         fi
6725         ;;
6726 esac
6727 $rm_try
6728 case "$use64bitall" in
6729 "$define"|true|[yY]*)
6730         case "$ptrsize" in
6731         4)      cat <<EOM >&4
6732
6733 *** You have chosen a maximally 64-bit build,
6734 *** but your pointers are only 4 bytes wide.
6735 *** Please rerun Configure without -Duse64bitall.
6736 EOM
6737                 case "$d_quad" in
6738                 define)
6739                         cat <<EOM >&4
6740 *** Since you have quads, you could possibly try with -Duse64bitint.
6741 EOM
6742                         ;;
6743                 esac
6744                 cat <<EOM >&4
6745 *** Cannot continue, aborting.
6746
6747 EOM
6748
6749                 exit 1
6750                 ;;
6751         esac
6752         ;;
6753 esac
6754
6755
6756 : determine whether to use malloc wrapping
6757 echo " "
6758 case "$usemallocwrap" in
6759 [yY]*|true|$define)     dflt='y' ;;
6760 [nN]*|false|$undef)     dflt='n' ;;
6761 *)      case "$usedevel" in
6762         [yY]*|true|$define)     dflt='y' ;;
6763         *) dflt='n' ;;
6764         esac
6765         ;;
6766 esac
6767 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6768 . ./myread
6769 usemallocwrap="$ans"
6770 case "$ans" in
6771 y*|true)
6772         usemallocwrap="$define" ;;
6773 *)
6774         usemallocwrap="$undef" ;;
6775 esac
6776
6777 : determine which malloc to compile in
6778 echo " "
6779 case "$usemymalloc" in
6780 [yY]*|true|$define)     dflt='y' ;;
6781 [nN]*|false|$undef)     dflt='n' ;;
6782 *)      case "$ptrsize" in
6783         4) dflt='y' ;;
6784         *) dflt='n' ;;
6785         esac
6786         ;;
6787 esac
6788 rp="Do you wish to attempt to use the malloc that comes with $package?"
6789 . ./myread
6790 usemymalloc="$ans"
6791 case "$ans" in
6792 y*|true)
6793         usemymalloc='y'
6794         mallocsrc='malloc.c'
6795         mallocobj="malloc$_o"
6796         d_mymalloc="$define"
6797         case "$libs" in
6798         *-lmalloc*)
6799                 : Remove malloc from list of libraries to use
6800                 echo "Removing unneeded -lmalloc from library list" >&4
6801                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6802                 shift
6803                 libs="$*"
6804                 echo "libs = $libs" >&4
6805                 ;;
6806         esac
6807         ;;
6808 *)
6809         usemymalloc='n'
6810         mallocsrc=''
6811         mallocobj=''
6812         d_mymalloc="$undef"
6813         ;;
6814 esac
6815
6816 : compute the return types of malloc and free
6817 echo " "
6818 $cat >malloc.c <<END
6819 #$i_malloc I_MALLOC
6820 #$i_stdlib I_STDLIB
6821 #include <stdio.h>
6822 #include <sys/types.h>
6823 #ifdef I_MALLOC
6824 #include <malloc.h>
6825 #endif
6826 #ifdef I_STDLIB
6827 #include <stdlib.h>
6828 #endif
6829 #ifdef TRY_MALLOC
6830 void *malloc();
6831 #endif
6832 #ifdef TRY_FREE
6833 void free();
6834 #endif
6835 END
6836 case "$malloctype" in
6837 '')
6838         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6839                 malloctype='void *'
6840         else
6841                 malloctype='char *'
6842         fi
6843         ;;
6844 esac
6845 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6846
6847 case "$freetype" in
6848 '')
6849         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6850                 freetype='void'
6851         else
6852                 freetype='int'
6853         fi
6854         ;;
6855 esac
6856 echo "Your system uses $freetype free(), it would seem." >&4
6857 $rm -f malloc.[co]
6858 : determine where site specific architecture-dependent libraries go.
6859 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6860 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6861 : sitelib may have an optional trailing /share.
6862 case "$sitearch" in
6863 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6864         dflt="$dflt/$archname"
6865         ;;
6866 *)      dflt="$sitearch"
6867         ;;
6868 esac
6869 set sitearch sitearch none
6870 eval $prefixit
6871 $cat <<EOM
6872
6873 The installation process will also create a directory for
6874 architecture-dependent site-specific extensions and modules.
6875
6876 EOM
6877 fn=d~+
6878 rp='Pathname for the site-specific architecture-dependent library files?'
6879 . ./getfile
6880 prefixvar=sitearch
6881 . ./setprefixvar
6882 if $test X"$sitearch" = X"$sitelib"; then
6883         d_sitearch="$undef"
6884 else
6885         d_sitearch="$define"
6886 fi
6887
6888 : Set the vendorprefix variables
6889 $cat <<EOM
6890
6891 The installation process will also create a directory for
6892 vendor-supplied add-ons.  Vendors who supply perl with their system
6893 may find it convenient to place all vendor-supplied files in this
6894 directory rather than in the main distribution directory.  This will
6895 ease upgrades between binary-compatible maintenance versions of perl.
6896
6897 Of course you may also use these directories in whatever way you see
6898 fit.  For example, you might use them to access modules shared over a
6899 company-wide network.
6900
6901 The default answer should be fine for most people.
6902 This causes further questions about vendor add-ons to be skipped
6903 and no vendor-specific directories will be configured for perl.
6904
6905 EOM
6906 rp='Do you want to configure vendor-specific add-on directories?'
6907 case "$usevendorprefix" in
6908 define|true|[yY]*) dflt=y ;;
6909 *)      : User may have set vendorprefix directly on Configure command line.
6910         case "$vendorprefix" in
6911         ''|' ') dflt=n ;;
6912         *)      dflt=y ;;
6913         esac
6914         ;;
6915 esac
6916 . ./myread
6917 case "$ans" in
6918 [yY]*)  fn=d~+
6919         rp='Installation prefix to use for vendor-supplied add-ons?'
6920         case "$vendorprefix" in
6921         '') dflt='' ;;
6922         *)  dflt=$vendorprefix ;;
6923         esac
6924         . ./getfile
6925         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6926         oldvendorprefix=''
6927         case "$vendorprefix" in
6928         '') ;;
6929         *)      case "$ans" in
6930                 "$prefix") ;;
6931                 *) oldvendorprefix="$prefix";;
6932                 esac
6933                 ;;
6934         esac
6935         usevendorprefix="$define"
6936         vendorprefix="$ans"
6937         vendorprefixexp="$ansexp"
6938         ;;
6939 *)      usevendorprefix="$undef"
6940         vendorprefix=''
6941         vendorprefixexp=''
6942         ;;
6943 esac
6944
6945 : Set the vendorlib variables
6946 case "$vendorprefix" in
6947 '')     d_vendorlib="$undef"
6948         vendorlib=''
6949         vendorlibexp=''
6950         ;;
6951 *)      d_vendorlib="$define"
6952         : determine where vendor-supplied modules go.
6953         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6954         case "$vendorlib" in
6955         '')
6956                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6957                 case "$installstyle" in
6958                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6959                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6960                 esac
6961                 ;;
6962         *)      dflt="$vendorlib"
6963                 ;;
6964         esac
6965         fn=d~+
6966         rp='Pathname for the vendor-supplied library files?'
6967         . ./getfile
6968         vendorlib="$ans"
6969         vendorlibexp="$ansexp"
6970         ;;
6971 esac
6972 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6973 prefixvar=vendorlib
6974 . ./installprefix
6975
6976 : Set the vendorarch variables
6977 case "$vendorprefix" in
6978 '')     d_vendorarch="$undef"
6979         vendorarch=''
6980         vendorarchexp=''
6981         ;;
6982 *)      d_vendorarch="$define"
6983         : determine where vendor-supplied architecture-dependent libraries go.
6984         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6985         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6986         : vendorlib may have an optional trailing /share.
6987         case "$vendorarch" in
6988         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6989                 dflt="$dflt/$archname"
6990                 ;;
6991         *)      dflt="$vendorarch" ;;
6992         esac
6993         fn=d~+
6994         rp='Pathname for vendor-supplied architecture-dependent files?'
6995         . ./getfile
6996         vendorarch="$ans"
6997         vendorarchexp="$ansexp"
6998         ;;
6999 esac
7000 prefixvar=vendorarch
7001 . ./installprefix
7002
7003 : Final catch-all directories to search
7004 $cat <<EOM
7005
7006 Lastly, you can have perl look in other directories for extensions and
7007 modules in addition to those already specified.
7008 These directories will be searched after 
7009         $sitearch 
7010         $sitelib 
7011 EOM
7012 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7013 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7014 echo ' '
7015 case "$otherlibdirs" in
7016 ''|' ') dflt='none' ;;
7017 *)      dflt="$otherlibdirs" ;;
7018 esac
7019 $cat <<EOM
7020 Enter a colon-separated set of extra paths to include in perl's @INC
7021 search path, or enter 'none' for no extra paths.
7022
7023 EOM
7024
7025 rp='Colon-separated list of additional directories for perl to search?'
7026 . ./myread
7027 case "$ans" in
7028 ' '|''|none)    otherlibdirs=' ' ;;     
7029 *)      otherlibdirs="$ans" ;;
7030 esac
7031 case "$otherlibdirs" in
7032 ' ') val=$undef ;;
7033 *)      val=$define ;;
7034 esac
7035 set d_perl_otherlibdirs
7036 eval $setvar
7037
7038 : Cruising for prototypes
7039 echo " "
7040 echo "Checking out function prototypes..." >&4
7041 $cat >prototype.c <<EOCP
7042 #$i_stdlib I_STDLIB
7043 #ifdef I_STDLIB
7044 #include <stdlib.h>
7045 #endif
7046 int main(int argc, char *argv[]) {
7047         exit(0);}
7048 EOCP
7049 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7050         echo "Your C compiler appears to support function prototypes."
7051         val="$define"
7052 else
7053         echo "Your C compiler doesn't seem to understand function prototypes."
7054         val="$undef"
7055 fi
7056 set prototype
7057 eval $setvar
7058 $rm -f prototype*
7059
7060 : Check if ansi2knr is required
7061 case "$prototype" in
7062 "$define") ;;
7063 *)      ansi2knr='ansi2knr'
7064         echo " "
7065         cat <<EOM >&4
7066
7067 $me:  FATAL ERROR:
7068 This version of $package can only be compiled by a compiler that 
7069 understands function prototypes.  Unfortunately, your C compiler 
7070         $cc $ccflags
7071 doesn't seem to understand them.  Sorry about that.
7072
7073 If GNU cc is available for your system, perhaps you could try that instead.  
7074
7075 Eventually, we hope to support building Perl with pre-ANSI compilers.
7076 If you would like to help in that effort, please contact <perlbug@perl.org>.
7077
7078 Aborting Configure now.
7079 EOM
7080         exit 2
7081         ;;
7082 esac
7083
7084 : DTrace support
7085 dflt_dtrace='/usr/sbin/dtrace'
7086 cat <<EOM
7087
7088 Perl can be built to support DTrace on platforms that support it.
7089 DTrace is a diagnosis and performance analysis tool from Sun.
7090
7091 If this doesn't make any sense to you, just accept the default '$dflt'.
7092 EOM
7093
7094 while $test 1 ; do
7095         case "$usedtrace" in
7096         $define|true|[yY]*)
7097                 dflt='y'
7098                 ;;
7099         ?*)
7100                 dflt='y'
7101                 dflt_dtrace=$usedtrace
7102                 ;;
7103         *)
7104                 dflt='n'
7105                 ;;
7106         esac
7107
7108         rp='Support DTrace if available?'
7109         . ./myread
7110         case "$ans" in
7111         y|Y)    val="$define" ;;
7112         *)      val="$undef" ;;
7113         esac
7114         set usedtrace
7115         eval $setvar
7116
7117         test "X$usedtrace" != "X$define" && break
7118
7119         echo " "
7120         rp='Where is the dtrace executable?'
7121         dflt=$dflt_dtrace
7122         . ./getfile
7123         val="$ans"
7124         set dtrace
7125         eval $setvar
7126
7127         if $test -f $dtrace
7128         then
7129                 if $dtrace -h -s ../perldtrace.d \
7130                         -o perldtrace.tmp >/dev/null 2>&1 \
7131                         && rm -f perldtrace.tmp
7132                 then
7133                         echo " "
7134                         echo "Good: your $dtrace knows about the -h flag."
7135                 else
7136                         cat >&2 <<EOM
7137
7138 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7139 ***
7140 *** Your installed dtrace doesn't support the -h switch to compile a D
7141 *** program into a C header. Can't continue.
7142
7143 EOM
7144                         exit 1
7145                 fi
7146                 break;
7147         fi
7148
7149         case "$fastread" in
7150         yes)
7151                 cat >&2 <<EOM
7152
7153 *** $me:  Fatal Error:  $dtrace not found.
7154 *** Can't continue.
7155
7156 EOM
7157                 exit 1
7158                 ;;
7159         *)
7160                 echo "*** $dtrace was not found."
7161                 echo " "
7162                 ;;
7163         esac
7164 done
7165
7166 : See if we want extra modules installed
7167 echo " "
7168 case "$extras" in
7169 '') dflt='n';;
7170 *) dflt='y';;
7171 esac
7172 cat <<EOM
7173 Perl can be built with extra modules or bundles of modules which
7174 will be fetched from the CPAN and installed alongside Perl.
7175
7176 Notice that you will need access to the CPAN; either via the Internet,
7177 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7178 be asked later to configure the CPAN.pm module which will in turn do
7179 the installation of the rest of the extra modules or bundles.)
7180
7181 Notice also that if the modules require any external software such as
7182 libraries and headers (the libz library and the zlib.h header for the
7183 Compress::Zlib module, for example) you MUST have any such software
7184 already installed, this configuration process will NOT install such
7185 things for you.
7186
7187 If this doesn't make any sense to you, just accept the default '$dflt'.
7188 EOM
7189 rp='Install any extra modules (y or n)?'
7190 . ./myread
7191 case "$ans" in
7192 y|Y)
7193         cat <<EOM
7194
7195 Please list any extra modules or bundles to be installed from CPAN,
7196 with spaces between the names.  The names can be in any format the
7197 'install' command of CPAN.pm will understand.  (Answer 'none',
7198 without the quotes, to install no extra modules or bundles.)
7199 EOM
7200         rp='Extras?'
7201         dflt="$extras"
7202         . ./myread
7203         extras="$ans"
7204 esac
7205 case "$extras" in
7206 ''|'none')
7207         val=''
7208         $rm -f ../extras.lst
7209         ;;
7210 *)      echo "(Saving the list of extras for later...)"
7211         echo "$extras" > ../extras.lst
7212         val="'$extras'"
7213         ;;
7214 esac
7215 set extras
7216 eval $setvar
7217 echo " "
7218
7219 : determine where html pages for programs go
7220 set html1dir html1dir none
7221 eval $prefixit
7222 $cat <<EOM
7223
7224 If you wish to install html files for programs in $spackage, indicate
7225 the appropriate directory here.  To skip installing html files,
7226 answer "none".
7227 EOM
7228 case "$html1dir" in
7229 ''|none|$undef|' ') dflt=none ;;
7230 *) dflt=$html1dir ;;
7231 esac
7232 fn=dn+~
7233 rp="Directory for the main $spackage html pages?"
7234 . ./getfile
7235 prefixvar=html1dir
7236 . ./setprefixvar
7237 : Use ' ' for none so value is preserved next time through Configure
7238 $test X"$html1dir" = "X" && html1dir=' '
7239
7240 : determine where html pages for libraries and modules go
7241 set html3dir html3dir none
7242 eval $prefixit
7243 $cat <<EOM
7244
7245 If you wish to install html files for modules associated with $spackage,
7246 indicate the appropriate directory here.  To skip installing html files,
7247 answer "none".
7248 EOM
7249 : There is no obvious default.  If they have specified html1dir, then
7250 : try to key off that, possibly changing .../html1 into .../html3.
7251 case "$html3dir" in
7252 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7253 *) dflt=$html3dir ;;
7254 esac
7255 fn=dn+~
7256 rp="Directory for the $spackage module html pages?"
7257 . ./getfile
7258 prefixvar=html3dir
7259 . ./setprefixvar
7260 : Use ' ' for none so value is preserved next time through Configure
7261 $test X"$html3dir" = "X" && html3dir=' '
7262
7263 : determine whether to install perl also as /usr/bin/perl
7264
7265 echo " "
7266 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7267         $cat <<EOM
7268 Many scripts expect perl to be installed as /usr/bin/perl.
7269
7270 If you want to, I can install the perl you are about to compile
7271 as /usr/bin/perl (in addition to $bin/perl).
7272 EOM
7273         if test -f /usr/bin/perl; then
7274             $cat <<EOM
7275
7276 However, please note that because you already have a /usr/bin/perl,
7277 overwriting that with a new Perl would very probably cause problems.
7278 Therefore I'm assuming you don't want to do that (unless you insist).
7279
7280 EOM
7281             case "$installusrbinperl" in
7282             "$define"|[yY]*)    dflt='y';;
7283             *)                  dflt='n';;
7284             esac
7285         else
7286             $cat <<EOM
7287
7288 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7289
7290 EOM
7291             case "$installusrbinperl" in
7292             "$undef"|[nN]*)     dflt='n';;
7293             *)                  dflt='y';;
7294             esac
7295         fi
7296         rp="Do you want to install perl as /usr/bin/perl?"
7297         . ./myread
7298         case "$ans" in
7299         [yY]*)  val="$define";;
7300         *)      val="$undef" ;;
7301         esac
7302 else
7303         val="$undef"
7304 fi
7305 set installusrbinperl
7306 eval $setvar
7307
7308 : Check if we are using the GNU C library
7309 echo " "
7310 echo "Checking for GNU C Library..." >&4
7311 cat >try.c <<'EOCP'
7312 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7313    alone are insufficient to distinguish different versions, such as
7314    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7315    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7316 */
7317 #include <stdio.h>
7318 int main(void)
7319 {
7320 #ifdef __GLIBC__
7321 #   ifdef __GLIBC_MINOR__
7322 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7323 #           include <gnu/libc-version.h>
7324             printf("%s\n",  gnu_get_libc_version());
7325 #       else
7326             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7327 #       endif
7328 #   else
7329         printf("%d\n",  __GLIBC__);
7330 #   endif
7331     return 0;
7332 #else
7333     return 1;
7334 #endif
7335 }
7336 EOCP
7337 set try
7338 if eval $compile_ok && $run ./try > glibc.ver; then
7339         val="$define"
7340         gnulibc_version=`$cat glibc.ver`
7341         echo "You are using the GNU C Library version $gnulibc_version"
7342 else
7343         val="$undef"
7344         gnulibc_version=''
7345         echo "You are not using the GNU C Library"
7346 fi
7347 $rm_try glibc.ver
7348 set d_gnulibc
7349 eval $setvar
7350
7351 : see if nm is to be used to determine whether a symbol is defined or not
7352 case "$usenm" in
7353 '')
7354         dflt=''
7355         case "$d_gnulibc" in
7356         "$define")
7357                 echo " "
7358                 echo "nm probably won't work on the GNU C Library." >&4
7359                 dflt=n
7360                 ;;
7361         esac
7362         case "$dflt" in
7363         '') 
7364                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7365                         echo " "
7366                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7367                         echo "'nm' won't be sufficient on this sytem." >&4
7368                         dflt=n
7369                 fi
7370                 ;;
7371         esac
7372         case "$dflt" in
7373         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7374                 if $test $dflt -gt 20; then
7375                         dflt=y
7376                 else
7377                         dflt=n
7378                 fi
7379                 ;;
7380         esac
7381         ;;
7382 *)
7383         case "$usenm" in
7384         true|$define) dflt=y;;
7385         *) dflt=n;;
7386         esac
7387         ;;
7388 esac
7389 $cat <<EOM
7390
7391 I can use $nm to extract the symbols from your C libraries. This
7392 is a time consuming task which may generate huge output on the disk (up
7393 to 3 megabytes) but that should make the symbols extraction faster. The
7394 alternative is to skip the 'nm' extraction part and to compile a small
7395 test program instead to determine whether each symbol is present. If
7396 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7397 this may be the best solution.
7398
7399 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7400
7401 EOM
7402 rp="Shall I use $nm to extract C symbols from the libraries?"
7403 . ./myread
7404 case "$ans" in
7405 [Nn]*) usenm=false;;
7406 *) usenm=true;;
7407 esac
7408
7409 runnm=$usenm
7410 case "$reuseval" in
7411 true) runnm=false;;
7412 esac
7413
7414 : nm options which may be necessary
7415 case "$nm_opt" in
7416 '') if $test -f /mach_boot; then
7417                 nm_opt=''       # Mach
7418         elif $test -d /usr/ccs/lib; then
7419                 nm_opt='-p'     # Solaris (and SunOS?)
7420         elif $test -f /dgux; then
7421                 nm_opt='-p'     # DG-UX
7422         elif $test -f /lib64/rld; then
7423                 nm_opt='-p'     # 64-bit Irix
7424         else
7425                 nm_opt=''
7426         fi;;
7427 esac
7428
7429 : nm options which may be necessary for shared libraries but illegal
7430 : for archive libraries.  Thank you, Linux.
7431 case "$nm_so_opt" in
7432 '')     case "$myuname" in
7433         *linux*|gnu*)
7434                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7435                         nm_so_opt='--dynamic'
7436                 fi
7437                 ;;
7438         esac
7439         ;;
7440 esac
7441
7442 : get list of predefined functions in a handy place
7443 case "$runnm" in
7444 true)
7445 echo " "
7446 case "$libc" in
7447 '') libc=unknown
7448         case "$libs" in
7449         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7450         esac
7451         ;;
7452 esac
7453 case "$libs" in
7454 '') ;;
7455 *)  for thislib in $libs; do
7456         case "$thislib" in
7457         -lc|-lc_s)
7458                 : Handle C library specially below.
7459                 ;;
7460         -l*)
7461                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7462                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7463                         :
7464                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7465                         :
7466                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7467                         :
7468                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7469                         :
7470                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7471                         :
7472                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7473                         :
7474                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7475                         :
7476                 else
7477                         try=''
7478                 fi
7479                 libnames="$libnames $try"
7480                 ;;
7481         *) libnames="$libnames $thislib" ;;
7482         esac
7483         done
7484         ;;
7485 esac
7486 xxx=normal
7487 case "$libc" in
7488 unknown)
7489         set /lib/libc.$so
7490         for xxx in $libpth; do
7491                 $test -r $1 || set $xxx/libc.$so
7492                 : The messy sed command sorts on library version numbers.
7493                 $test -r $1 || \
7494                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7495                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7496                                 h
7497                                 s/[0-9][0-9]*/0000&/g
7498                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7499                                 G
7500                                 s/\n/ /' | \
7501                          $sort | $sed -e 's/^.* //'`
7502                 eval set \$$#
7503         done
7504         $test -r $1 || set /usr/ccs/lib/libc.$so
7505         $test -r $1 || set /lib/libsys_s$_a
7506         ;;
7507 *)
7508         set blurfl
7509         ;;
7510 esac
7511 if $test -r "$1"; then
7512         echo "Your (shared) C library seems to be in $1."
7513         libc="$1"
7514 elif $test -r /lib/libc && $test -r /lib/clib; then
7515         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7516         xxx=apollo
7517         libc='/lib/clib /lib/libc'
7518         if $test -r /lib/syslib; then
7519                 echo "(Your math library is in /lib/syslib.)"
7520                 libc="$libc /lib/syslib"
7521         fi
7522 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7523         echo "Your C library seems to be in $libc, as you said before."
7524 elif $test -r $incpath/usr/lib/libc$_a; then
7525         libc=$incpath/usr/lib/libc$_a;
7526         echo "Your C library seems to be in $libc.  That's fine."
7527 elif $test -r /lib/libc$_a; then
7528         libc=/lib/libc$_a;
7529         echo "Your C library seems to be in $libc.  You're normal."
7530 else
7531         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7532                 :
7533         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7534                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7535         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7536                 :
7537         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7538                 :
7539         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7540                 :
7541         else
7542                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7543         fi
7544         if $test -r "$tans"; then
7545                 echo "Your C library seems to be in $tans, of all places."
7546                 libc=$tans
7547         else
7548                 libc='blurfl'
7549         fi
7550 fi
7551 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7552         dflt="$libc"
7553         cat <<EOM
7554
7555 If the guess above is wrong (which it might be if you're using a strange
7556 compiler, or your machine supports multiple models), you can override it here.
7557
7558 EOM
7559 else
7560         dflt=''
7561         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7562         cat >&4 <<EOM
7563 I can't seem to find your C library.  I've looked in the following places:
7564
7565 EOM
7566         $sed 's/^/      /' libpath
7567         cat <<EOM
7568
7569 None of these seems to contain your C library. I need to get its name...
7570
7571 EOM
7572 fi
7573 fn=f
7574 rp='Where is your C library?'
7575 . ./getfile
7576 libc="$ans"
7577
7578 echo " "
7579 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7580 set X `cat libnames`
7581 shift
7582 xxx=files
7583 case $# in 1) xxx=file; esac
7584 echo "Extracting names from the following $xxx for later perusal:" >&4
7585 echo " "
7586 $sed 's/^/      /' libnames >&4
7587 echo " "
7588 $echo $n "This may take a while...$c" >&4
7589
7590 for file in $*; do
7591         case $file in
7592         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7593         *) $nm $nm_opt $file 2>/dev/null;;
7594         esac
7595 done >libc.tmp
7596
7597 $echo $n ".$c"
7598 $grep fprintf libc.tmp > libc.ptf
7599 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7600 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7601 xxx='[ADTSIW]'
7602 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7603         eval $xscan;\
7604         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7605                 eval $xrun
7606 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7607         eval $xscan;\
7608         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7609                 eval $xrun
7610 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7611         eval $xscan;\
7612         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7613                 eval $xrun
7614 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7615         eval $xscan;\
7616         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7617                 eval $xrun
7618 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7619         eval $xscan;\
7620         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7621                 eval $xrun
7622 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7623         eval $xscan;\
7624         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7625                 eval $xrun
7626 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7627                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7628         eval $xscan;\
7629         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7630                 eval $xrun
7631 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7632         eval $xscan;\
7633         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7634                 eval $xrun
7635 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7636         eval $xscan;\
7637         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7638                 eval $xrun
7639 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7640         eval $xscan;\
7641         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7642                 eval $xrun
7643 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7644         eval $xscan;\
7645         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7646                 eval $xrun
7647 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7648         eval $xscan;\
7649         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7650                 eval $xrun
7651 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7652         eval $xscan;\
7653         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7654                 eval $xrun
7655 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7656         eval $xscan;\
7657         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7658                 eval $xrun
7659 else
7660         $nm -p $* 2>/dev/null >libc.tmp
7661         $grep fprintf libc.tmp > libc.ptf
7662         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7663                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7664         then
7665                 nm_opt='-p'
7666                 eval $xrun
7667         else
7668                 echo " "
7669                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7670                 com=''
7671                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7672                         for thisname in $libnames $libc; do
7673                                 $ar t $thisname >>libc.tmp
7674                         done
7675                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7676                         echo "Ok." >&4
7677                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7678                         # Repeat libc to extract forwarders to DLL entries too
7679                         for thisname in $libnames $libc; do
7680                                 $ar tv $thisname >>libc.tmp
7681                                 # Revision 50 of EMX has bug in $ar.
7682                                 # it will not extract forwarders to DLL entries
7683                                 # Use emximp which will extract exactly them.
7684                                 emximp -o tmp.imp $thisname \
7685                                     2>/dev/null && \
7686                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7687                                     < tmp.imp >>libc.tmp
7688                                 $rm tmp.imp
7689                         done
7690                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7691                         echo "Ok." >&4
7692                 else
7693                         echo "$ar didn't seem to work right." >&4
7694                         echo "Maybe this is a Cray...trying bld instead..." >&4
7695                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7696                         then
7697                                 for thisname in $libnames; do
7698                                         bld t $libnames | \
7699                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7700                                         $ar t $thisname >>libc.tmp
7701                                 done
7702                                 echo "Ok." >&4
7703                         else
7704                                 echo "That didn't work either.  Giving up." >&4
7705                                 exit 1
7706                         fi
7707                 fi
7708         fi
7709 fi
7710 nm_extract="$com"
7711 case "$PASE" in
7712 define)
7713     echo " "
7714     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7715     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7716     ;;
7717 *)  if $test -f /lib/syscalls.exp; then
7718         echo " "
7719         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7720         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7721     fi
7722     ;;
7723 esac
7724 ;;
7725 esac
7726 $rm -f libnames libpath
7727
7728 : see if dld is available
7729 set dld.h i_dld
7730 eval $inhdr
7731
7732 : Check if we are using C++
7733 echo " "
7734 echo "Checking for C++..." >&4
7735 $cat >try.c <<'EOCP'
7736 #include <stdio.h>
7737 int main(void)
7738 {
7739 #ifdef __cplusplus
7740     return 0;
7741 #else
7742     return 1;
7743 #endif
7744 }
7745 EOCP
7746 set try
7747 if eval $compile_ok && $run ./try; then
7748         val="$define"
7749         echo "You are using a C++ compiler."
7750 else
7751         val="$undef"
7752         echo "You are not using a C++ compiler."
7753 fi
7754 $rm_try cplusplus$$
7755 set d_cplusplus
7756 eval $setvar
7757
7758 : is a C symbol defined?
7759 csym='tlook=$1;
7760 case "$3" in
7761 -v) tf=libc.tmp; tdc="";;
7762 -a) tf=libc.tmp; tdc="[]";;
7763 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7764 esac;
7765 tx=yes;
7766 case "$reuseval-$4" in
7767 true-) ;;
7768 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7769 esac;
7770 case "$tx" in
7771 yes)
7772         tval=false;
7773         case "$d_cplusplus" in
7774                 $define) extern_C=\"C\";;
7775         esac;
7776         if $test "$runnm" = true; then
7777                 if $contains $tlook $tf >/dev/null 2>&1; then
7778                         tval=true;
7779                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7780                         echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7781                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7782                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7783                         $rm_try;
7784                 fi;
7785         else
7786                 echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7787                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7788                 $rm_try;
7789         fi;
7790         ;;
7791 *)
7792         case "$tval" in
7793         $define) tval=true;;
7794         *) tval=false;;
7795         esac;
7796         ;;
7797 esac;
7798 eval "$2=$tval"'
7799
7800 : define an is-in-libc? function
7801 inlibc='echo " "; td=$define; tu=$undef;
7802 sym=$1; var=$2; eval "was=\$$2";
7803 tx=yes;
7804 case "$reuseval$was" in
7805 true) ;;
7806 true*) tx=no;;
7807 esac;
7808 case "$tx" in
7809 yes)
7810         set $sym tres -f;
7811         eval $csym;
7812         case "$tres" in
7813         true)
7814                 echo "$sym() found." >&4;
7815                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7816         *)
7817                 echo "$sym() NOT found." >&4;
7818                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7819         esac;;
7820 *)
7821         case "$was" in
7822         $define) echo "$sym() found." >&4;;
7823         *) echo "$sym() NOT found." >&4;;
7824         esac;;
7825 esac'
7826
7827 : see if dlopen exists
7828 xxx_runnm="$runnm"
7829 xxx_ccflags="$ccflags"
7830 runnm=false
7831 : with g++ one needs -shared to get is-in-libc to work for dlopen
7832 case "$gccversion" in
7833 '')     ;;
7834 *)      case "$d_cplusplus" in
7835         "$define") ccflags="$ccflags -shared" ;;
7836         esac
7837         ;;
7838 esac
7839 set dlopen d_dlopen
7840 eval $inlibc
7841 runnm="$xxx_runnm"
7842 ccflags="$xxx_ccflags"
7843
7844 : see if this is a unistd.h system
7845 set unistd.h i_unistd
7846 eval $inhdr
7847
7848 : determine which dynamic loading, if any, to compile in
7849 echo " "
7850 dldir="ext/DynaLoader"
7851 case "$usedl" in
7852 $define|y|true)
7853         dflt='y'
7854         usedl="$define"
7855         ;;
7856 $undef|n|false)
7857         dflt='n'
7858         usedl="$undef"
7859         ;;
7860 *)
7861         dflt='n'
7862         case "$d_dlopen" in
7863             $define) dflt='y' ;;
7864         esac
7865         case "$i_dld" in
7866             $define) dflt='y' ;;
7867         esac
7868         : Does a dl_xxx.xs file exist for this operating system
7869         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7870         ;;
7871 esac
7872 rp="Do you wish to use dynamic loading?"
7873 . ./myread
7874 usedl="$ans"
7875 case "$ans" in
7876 y*) usedl="$define"
7877         case "$dlsrc" in
7878         '')
7879                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7880                         dflt="$dldir/dl_${osname}.xs"
7881                 elif $test "$d_dlopen" = "$define" ; then
7882                         dflt="$dldir/dl_dlopen.xs"
7883                 elif $test "$i_dld" = "$define" ; then
7884                         dflt="$dldir/dl_dld.xs"
7885                 else
7886                         dflt=''
7887                 fi
7888                 ;;
7889         *)      dflt="$dldir/$dlsrc"
7890                 ;;
7891         esac
7892     echo "The following dynamic loading files are available:"
7893         : Can not go over to $dldir because getfile has path hard-coded in.
7894         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7895         rp="Source file to use for dynamic loading"
7896         fn="fne"
7897         gfpth="$src"
7898         . ./getfile
7899         usedl="$define"
7900         : emulate basename
7901         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7902
7903         $cat << EOM
7904
7905 Some systems may require passing special flags to $cc -c to
7906 compile modules that will be used to create a shared library.
7907 To use no flags, say "none".
7908
7909 EOM
7910     case "$cccdlflags" in
7911     '') case "$gccversion" in
7912                 '') case "$osname" in
7913                         hpux)   dflt='+z' ;;
7914                         next)   dflt='none' ;;
7915                         irix*)  dflt='-KPIC' ;;
7916                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7917                         sunos)  dflt='-pic' ;;
7918                         *)      dflt='none' ;;
7919                     esac
7920                         ;;
7921                 *)  case "$osname" in
7922                         darwin) dflt='none' ;;
7923                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7924                         *)      dflt='-fpic' ;;
7925                     esac ;;
7926             esac ;;
7927         ' ') dflt='none' ;;
7928     *)  dflt="$cccdlflags" ;;
7929     esac
7930     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7931     . ./myread
7932     case "$ans" in
7933     none) cccdlflags=' ' ;;
7934     *) cccdlflags="$ans" ;;
7935     esac
7936
7937     cat << EOM
7938
7939 Some systems use ld to create libraries that can be dynamically loaded,
7940 while other systems (such as those using ELF) use $cc.
7941
7942 EOM
7943         case "$ld" in
7944         '')     $cat >try.c <<EOM
7945 /* Test for whether ELF binaries are produced */
7946 #include <fcntl.h>
7947 #$i_stdlib I_STDLIB
7948 #ifdef I_STDLIB
7949 #include <stdlib.h>
7950 #endif
7951 #$i_unistd I_UNISTD
7952 #ifdef I_UNISTD
7953 #include <unistd.h>
7954 #endif
7955 int main() {
7956         char b[4];
7957         int i = open("a.out",O_RDONLY);
7958         if(i == -1)
7959                 exit(1); /* fail */
7960         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7961                 exit(0); /* succeed (yes, it's ELF) */
7962         else
7963                 exit(1); /* fail */
7964 }
7965 EOM
7966                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7967                         cat <<EOM
7968 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7969 EOM
7970                         dflt="$cc"
7971                 else
7972                         echo "I'll use ld to build dynamic libraries."
7973                         dflt='ld'
7974                 fi
7975                 $rm_try
7976                 ;;
7977         *)      dflt="$ld"
7978                 ;;
7979         esac
7980
7981     rp="What command should be used to create dynamic libraries?"
7982     . ./myread
7983         ld="$ans"
7984
7985     cat << EOM
7986
7987 Some systems may require passing special flags to $ld to create a
7988 library that can be dynamically loaded.  If your ld flags include
7989 -L/other/path options to locate libraries outside your loader's normal
7990 search path, you may need to specify those -L options here as well.  To
7991 use no flags, say "none".
7992
7993 EOM
7994     case "$lddlflags" in
7995     '') case "$osname" in
7996                         beos) dflt='-nostart' ;;
7997                         hpux) dflt='-b';
7998                               case "$gccversion" in
7999                               '') dflt="$dflt +vnocompatwarnings" ;;
8000                               esac
8001                               ;;
8002                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
8003                         next)  dflt='none' ;;
8004                         solaris) dflt='-G' ;;
8005                         sunos) dflt='-assert nodefinitions' ;;
8006                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8007                 *)     dflt='none' ;;
8008                         esac
8009                         ;;
8010     *) dflt="$lddlflags" ;;
8011     esac
8012
8013         : Try to guess additional flags to pick up local libraries.
8014         : Be careful not to append to a plain 'none'
8015         case "$dflt" in
8016         none) dflt='' ;;
8017         esac
8018         for thisflag in $ldflags; do
8019                 case "$thisflag" in
8020                 -L*|-R*|-Wl,-R*)
8021                         case " $dflt " in
8022                         *" $thisflag "*) ;;
8023                         *) dflt="$dflt $thisflag" ;;
8024                         esac
8025                         ;;
8026                 esac
8027         done
8028
8029         case "$dflt" in
8030         ''|' ') dflt='none' ;;
8031         esac
8032
8033         case "$ldflags" in
8034         *-fstack-protector*)
8035             case "$dflt" in
8036                         *-fstack-protector*) ;; # Don't add it again
8037                         *) dflt="$dflt -fstack-protector" ;; 
8038                 esac
8039                 ;;
8040         esac
8041
8042
8043     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8044     . ./myread
8045     case "$ans" in
8046     none) lddlflags=' ' ;;
8047     *) lddlflags="$ans" ;;
8048     esac
8049
8050         cat <<EOM
8051
8052 Some systems may require passing special flags to $cc to indicate that
8053 the resulting executable will use dynamic linking.  To use no flags,
8054 say "none".
8055
8056 EOM
8057     case "$ccdlflags" in
8058     '') case "$osname" in
8059             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8060             next|sunos) dflt='none' ;;
8061             *)          dflt='none' ;;
8062             esac ;;
8063     ' ')  dflt='none' ;;
8064     *)  dflt="$ccdlflags" ;;
8065     esac
8066     rp="Any special flags to pass to $cc to use dynamic linking?"
8067     . ./myread
8068     case "$ans" in
8069     none) ccdlflags=' ' ;;
8070     *) ccdlflags="$ans" ;;
8071     esac
8072     ;;
8073 *)  usedl="$undef"
8074         ld='ld'
8075     dlsrc='dl_none.xs'
8076     lddlflags=''
8077     ccdlflags=''
8078     ;;
8079 esac
8080
8081 : Do we want a shared libperl?
8082 also=''
8083 case "$usedl" in
8084 $undef)
8085         # No dynamic loading being used, so don't bother even to prompt.
8086         useshrplib='false'
8087         ;;
8088 *)      case "$useshrplib" in
8089         '')     case "$osname" in
8090                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
8091                         dflt=y
8092                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8093                         ;;
8094                 next*)
8095                         case "$osvers" in
8096                         4*)     dflt=y
8097                                 also='Building a shared libperl is needed for MAB support.'
8098                                 ;;
8099                         *)      dflt=n
8100                                 ;;
8101                         esac
8102                         ;;
8103                 *)      dflt=n
8104                         ;;
8105                 esac
8106                 ;;
8107         $define|true|[Yy]*)
8108                 dflt=y
8109                 ;;
8110         *)      dflt=n
8111                 ;;
8112         esac
8113         $cat << EOM
8114
8115 The perl executable is normally obtained by linking perlmain.c with
8116 libperl${_a}, any static extensions (usually just DynaLoader), and
8117 any other libraries needed on this system (such as -lm, etc.).  Since
8118 your system supports dynamic loading, it is probably possible to build
8119 a shared libperl.$so.  If you will have more than one executable linked
8120 to libperl.$so, this will significantly reduce the size of each
8121 executable, but it may have a noticeable effect on performance.  The
8122 default is probably sensible for your system.
8123 $also
8124
8125 EOM
8126         rp="Build a shared libperl.$so (y/n)"
8127         . ./myread
8128         case "$ans" in
8129         true|$define|[Yy]*)
8130                 useshrplib='true'  ;;
8131         *)      useshrplib='false' ;;
8132         esac
8133         ;;
8134 esac
8135
8136 case "$useshrplib" in
8137 true)
8138         case "$libperl" in
8139         '')
8140                 # Figure out a good name for libperl.so.  Since it gets stored in
8141                 # a version-specific architecture-dependent library, the version
8142                 # number isn't really that important, except for making cc/ld happy.
8143                 #
8144                 # A name such as libperl.so.3.1
8145                 majmin="libperl.$so.$patchlevel.$subversion"
8146                 # A name such as libperl.so.301
8147                 majonly=`echo $patchlevel $subversion |
8148                         $awk '{printf "%d%02d", $1, $2}'`
8149                 majonly=libperl.$so.$majonly
8150                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8151                 # rely on figuring it out from the naming of libc.
8152                 case "${osname}${osvers}" in
8153                 next4*)
8154                         dflt=libperl.5.$so
8155                         # XXX How handle the --version stuff for MAB?
8156                         ;;
8157                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8158                         dflt=libperl.$so
8159                         ;;
8160                 cygwin*) # ld links against an importlib
8161                         dflt=libperl$lib_ext
8162                         ;;
8163                 *)      # Try to guess based on whether libc has major.minor.
8164                         case "$libc" in
8165                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8166                         *libc.$so.[0-9]*) dflt=$majonly ;;
8167                         *)      dflt=libperl.$so ;;
8168                         esac
8169                         ;;
8170                 esac
8171                 ;;
8172         *)      dflt=$libperl
8173                 ;;
8174         esac
8175         cat << EOM
8176
8177 I need to select a good name for the shared libperl.  If your system uses
8178 library names with major and minor numbers, then you might want something
8179 like $majmin.  Alternatively, if your system uses a single version
8180 number for shared libraries, then you might want to use $majonly.
8181 Or, your system might be quite happy with a simple libperl.$so.
8182
8183 Since the shared libperl will get installed into a version-specific
8184 architecture-dependent directory, the version number of the shared perl
8185 library probably isn't important, so the default should be o.k.
8186
8187 EOM
8188         rp='What name do you want to give to the shared libperl?'
8189         . ./myread
8190         libperl=$ans
8191         echo "Ok, I'll use $libperl"
8192         ;;
8193 *)
8194         libperl="libperl${_a}"
8195         ;;
8196 esac
8197
8198 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8199 case "$shrpdir" in
8200 '') ;;
8201 *)      $cat >&4 <<EOM
8202 WARNING:  Use of the shrpdir variable for the installation location of
8203 the shared $libperl is not supported.  It was never documented and
8204 will not work in this version.  Let me (perlbug@perl.org)
8205 know of any problems this may cause.
8206
8207 EOM
8208         case "$shrpdir" in
8209         "$archlibexp/CORE")
8210                 $cat >&4 <<EOM
8211 But your current setting of $shrpdir is
8212 the default anyway, so it's harmless.
8213 EOM
8214                 ;;
8215         *)
8216                 $cat >&4 <<EOM
8217 Further, your current attempted setting of $shrpdir
8218 conflicts with the value of $archlibexp/CORE
8219 that installperl will use.
8220 EOM
8221                 ;;
8222         esac
8223         ;;
8224 esac
8225
8226 # How will the perl executable find the installed shared $libperl?
8227 # Add $xxx to ccdlflags.
8228 # If we can't figure out a command-line option, use $shrpenv to
8229 # set env LD_RUN_PATH.  The main perl makefile uses this.
8230 shrpdir=$archlibexp/CORE
8231 xxx=''
8232 tmp_shrpenv=''
8233 if "$useshrplib"; then
8234     case "$osname" in
8235         aix)
8236                 # We'll set it in Makefile.SH...
8237                 ;;
8238         solaris)
8239                 xxx="-R $shrpdir"
8240                 ;;
8241         freebsd|netbsd|openbsd|interix|dragonfly)
8242                 xxx="-Wl,-R$shrpdir"
8243                 ;;
8244         bsdos|linux|irix*|dec_osf|gnu*)
8245                 xxx="-Wl,-rpath,$shrpdir"
8246                 ;;
8247         next)
8248                 # next doesn't like the default...
8249                 ;;
8250         beos)
8251                 # beos doesn't like the default, either.
8252                 ;;
8253         hpux*)
8254                 # hpux doesn't like the default, either.
8255                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8256                 ;;
8257         *)
8258                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8259                 ;;
8260         esac
8261         case "$xxx" in
8262         '') ;;
8263         *)
8264                 # Only add $xxx if it isn't already in ccdlflags.
8265                 case " $ccdlflags " in
8266                 *" $xxx "*)     ;;
8267                 *)      ccdlflags="$ccdlflags $xxx"
8268                         cat <<EOM >&4
8269
8270 Adding $xxx to the flags
8271 passed to $ld so that the perl executable will find the
8272 installed shared $libperl.
8273
8274 EOM
8275                         ;;
8276                 esac
8277                 ;;
8278         esac
8279 fi
8280 # Fix ccdlflags in AIX for building external extensions.
8281 # (For building Perl itself bare -bE:perl.exp is needed,
8282 #  Makefile.SH takes care of this.)
8283 case "$osname" in
8284 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8285 esac
8286 # Respect a hint or command-line value.
8287 case "$shrpenv" in
8288 '') shrpenv="$tmp_shrpenv" ;;
8289 esac
8290 case "$ldlibpthname" in
8291 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8292 none)   ldlibpthname='' ;;
8293 esac
8294
8295 : determine where manual pages are on this system
8296 echo " "
8297 case "$sysman" in
8298 '') 
8299         syspath='/usr/share/man/man1 /usr/man/man1'
8300         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8301         syspath="$syspath /usr/man/u_man/man1"
8302         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8303         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8304         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8305         sysman=`./loc . /usr/man/man1 $syspath`
8306         ;;
8307 esac
8308 if $test -d "$sysman"; then
8309         echo "System manual is in $sysman." >&4
8310 else
8311         echo "Could not find manual pages in source form." >&4
8312 fi
8313
8314 : determine where manual pages go
8315 set man1dir man1dir none
8316 eval $prefixit
8317 $cat <<EOM
8318
8319 $spackage has manual pages available in source form.
8320 EOM
8321 case "$nroff" in
8322 nroff)
8323         echo "However, you don't have nroff, so they're probably useless to you."
8324         case "$man1dir" in
8325         '') man1dir="none";;
8326         esac;;
8327 esac
8328 echo "If you don't want the manual sources installed, answer 'none'."
8329 case "$man1dir" in
8330 ' ') dflt=none
8331         ;;
8332 '')
8333         lookpath="$prefixexp/share/man/man1"
8334         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8335         lookpath="$lookpath $prefixexp/man/p_man/man1"
8336         lookpath="$lookpath $prefixexp/man/u_man/man1"
8337         lookpath="$lookpath $prefixexp/man/man.1"
8338         case "$sysman" in
8339         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8340         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8341         esac
8342         set dflt
8343         eval $prefixup
8344         ;;
8345 *)  dflt="$man1dir"
8346         ;;
8347 esac
8348 echo " "
8349 fn=dn+~
8350 rp="Where do the main $spackage manual pages (source) go?"
8351 . ./getfile
8352 if $test "X$man1direxp" != "X$ansexp"; then
8353         installman1dir=''
8354 fi
8355 prefixvar=man1dir
8356 . ./setprefixvar
8357
8358 case "$man1dir" in
8359 '')     man1dir=' '
8360         installman1dir='';;
8361 esac
8362
8363 : What suffix to use on installed man pages
8364
8365 case "$man1dir" in
8366 ' ')
8367         man1ext='0'
8368         ;;
8369 *)
8370         rp="What suffix should be used for the main $spackage man pages?"
8371         case "$man1ext" in
8372         '')     case "$man1dir" in
8373                 *1)  dflt=1 ;;
8374                 *1p) dflt=1p ;;
8375                 *1pm) dflt=1pm ;;
8376                 *l) dflt=l;;
8377                 *n) dflt=n;;
8378                 *o) dflt=o;;
8379                 *p) dflt=p;;
8380                 *C) dflt=C;;
8381                 *L) dflt=L;;
8382                 *L1) dflt=L1;;
8383                 *) dflt=1;;
8384                 esac
8385                 ;;
8386         *)      dflt="$man1ext";;
8387         esac
8388         . ./myread
8389         man1ext="$ans"
8390         ;;
8391 esac
8392
8393 : see if we can have long filenames
8394 echo " "
8395 first=123456789abcdef
8396 $rm -f $first
8397 if (echo hi >$first) 2>/dev/null; then
8398         if $test -f 123456789abcde; then
8399                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8400                 val="$undef"
8401         else
8402                 echo 'You can have filenames longer than 14 characters.'>&4
8403                 val="$define"
8404         fi
8405 else
8406         $cat <<'EOM'
8407 You can't have filenames longer than 14 chars.
8408 You can't even think about them!
8409 EOM
8410         val="$undef"
8411 fi
8412 set d_flexfnam
8413 eval $setvar
8414 $rm -rf 123456789abcde*
8415
8416 : determine where library module manual pages go
8417 set man3dir man3dir none
8418 eval $prefixit
8419 $cat <<EOM
8420
8421 $spackage has manual pages for many of the library modules.
8422 EOM
8423
8424 case "$nroff" in
8425 nroff)
8426         $cat <<'EOM'
8427 However, you don't have nroff, so they're probably useless to you.
8428 EOM
8429         case "$man3dir" in
8430         '') man3dir="none";;
8431         esac;;
8432 esac
8433
8434 case "$d_flexfnam" in
8435 undef)
8436         $cat <<'EOM'
8437 However, your system can't handle the long file names like File::Basename.3.
8438 EOM
8439         case "$man3dir" in
8440         '') man3dir="none";;
8441         esac;;
8442 esac
8443
8444 echo "If you don't want the manual sources installed, answer 'none'."
8445 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8446 case "$man3dir" in
8447 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8448         if $test -d "$privlib/man/man3"; then
8449                 cat <<EOM >&4
8450
8451 WARNING:  Previous versions of perl installed man3 pages into
8452 $privlib/man/man3.  This version will suggest a
8453 new default of $dflt.
8454 EOM
8455                 tdflt=$dflt
8456                 dflt='n'
8457                 rp='Do you wish to preserve the old behavior?(y/n)'
8458                 . ./myread
8459                 case "$ans" in
8460                 y*) dflt="$privlib/man/man3" ;;
8461                 *)  dflt=$tdflt ;;
8462                 esac
8463     fi
8464         ;;
8465 *)      dflt="$man3dir" ;;
8466 esac
8467 case "$dflt" in
8468 ' ') dflt=none ;;
8469 esac
8470 echo " "
8471 fn=dn+~
8472 rp="Where do the $package library man pages (source) go?"
8473 . ./getfile
8474 prefixvar=man3dir
8475 . ./setprefixvar
8476
8477 case "$man3dir" in
8478 '')     man3dir=' '
8479         installman3dir='';;
8480 esac
8481
8482 : What suffix to use on installed man pages
8483 case "$man3dir" in
8484 ' ')
8485         man3ext='0'
8486         ;;
8487 *)
8488         rp="What suffix should be used for the $package library man pages?"
8489         case "$man3ext" in
8490         '')     case "$man3dir" in
8491                 *3)  dflt=3 ;;
8492                 *3p) dflt=3p ;;
8493                 *3pm) dflt=3pm ;;
8494                 *l) dflt=l;;
8495                 *n) dflt=n;;
8496                 *o) dflt=o;;
8497                 *p) dflt=p;;
8498                 *C) dflt=C;;
8499                 *L) dflt=L;;
8500                 *L3) dflt=L3;;
8501                 *) dflt=3;;
8502                 esac
8503                 ;;
8504         *)      dflt="$man3ext";;
8505         esac
8506         . ./myread
8507         man3ext="$ans"
8508         ;;
8509 esac
8510
8511 : see if we have to deal with yellow pages, now NIS.
8512 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8513         if $test -f /usr/etc/nibindd; then
8514                 echo " "
8515                 echo "I'm fairly confident you're on a NeXT."
8516                 echo " "
8517                 rp='Do you get the hosts file via NetInfo?'
8518                 dflt=y
8519                 case "$hostcat" in
8520                 nidump*) ;;
8521                 '') ;;
8522                 *) dflt=n;;
8523                 esac
8524                 . ./myread
8525                 case "$ans" in
8526                 y*) hostcat='nidump hosts .';;
8527                 *)      case "$hostcat" in
8528                         nidump*) hostcat='';;
8529                         esac
8530                         ;;
8531                 esac
8532         fi
8533         case "$hostcat" in
8534         nidump*) ;;
8535         *)
8536                 case "$hostcat" in
8537                 *ypcat*) dflt=y;;
8538                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8539                                 dflt=y
8540                         else
8541                                 dflt=n
8542                         fi;;
8543                 *) dflt=n;;
8544                 esac
8545                 echo " "
8546                 rp='Are you getting the hosts file via yellow pages?'
8547                 . ./myread
8548                 case "$ans" in
8549                 y*) hostcat='ypcat hosts';;
8550                 *) hostcat='cat /etc/hosts';;
8551                 esac
8552                 ;;
8553         esac
8554 fi
8555 case "$hostcat" in
8556 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8557 esac
8558 case "$groupcat" in
8559 '') test -f /etc/group && groupcat='cat /etc/group';;
8560 esac
8561 case "$passcat" in
8562 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8563 esac
8564
8565 : now get the host name
8566 echo " "
8567 echo "Figuring out host name..." >&4
8568 case "$myhostname" in
8569 '') cont=true
8570         echo 'Maybe "hostname" will work...'
8571         if tans=`sh -c hostname 2>&1` ; then
8572                 myhostname=$tans
8573                 phostname=hostname
8574                 cont=''
8575         fi
8576         ;;
8577 *) cont='';;
8578 esac
8579 if $test "$cont"; then
8580         if ./xenix; then
8581                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8582                 if tans=`cat /etc/systemid 2>&1` ; then
8583                         myhostname=$tans
8584                         phostname='cat /etc/systemid'
8585                         echo "Whadyaknow.  Xenix always was a bit strange..."
8586                         cont=''
8587                 fi
8588         elif $test -r /etc/systemid; then
8589                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8590         fi
8591 fi
8592 if $test "$cont"; then
8593         echo 'No, maybe "uuname -l" will work...'
8594         if tans=`sh -c 'uuname -l' 2>&1` ; then
8595                 myhostname=$tans
8596                 phostname='uuname -l'
8597         else
8598                 echo 'Strange.  Maybe "uname -n" will work...'
8599                 if tans=`sh -c 'uname -n' 2>&1` ; then
8600                         myhostname=$tans
8601                         phostname='uname -n'
8602                 else
8603                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8604                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8605                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8606                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8607                         else
8608                                 case "$myhostname" in
8609                                 '') echo "Does this machine have an identity crisis or something?"
8610                                         phostname='';;
8611                                 *)
8612                                         echo "Well, you said $myhostname before..."
8613                                         phostname='echo $myhostname';;
8614                                 esac
8615                         fi
8616                 fi
8617         fi
8618 fi
8619 case "$myhostname" in
8620 '') myhostname=noname ;;
8621 esac
8622 : you do not want to know about this
8623 set $myhostname
8624 myhostname=$1
8625
8626 : verify guess
8627 if $test "$myhostname" ; then
8628         dflt=y
8629         rp='Your host name appears to be "'$myhostname'".'" Right?"
8630         . ./myread
8631         case "$ans" in
8632         y*) ;;
8633         *) myhostname='';;
8634         esac
8635 fi
8636
8637 : bad guess or no guess
8638 while $test "X$myhostname" = X ; do
8639         dflt=''
8640         rp="Please type the (one word) name of your host:"
8641         . ./myread
8642         myhostname="$ans"
8643 done
8644
8645 : translate upper to lower if necessary
8646 case "$myhostname" in
8647 *[A-Z]*)
8648         echo "(Normalizing case in your host name)"
8649         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8650         ;;
8651 esac
8652
8653 case "$myhostname" in
8654 *.*)
8655         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8656         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8657         echo "(Trimming domain name from host name--host name is now $myhostname)"
8658         ;;
8659 *) case "$mydomain" in
8660         '')
8661                 {
8662                         test "X$hostcat" = "Xypcat hosts" &&
8663                         ypmatch "$myhostname" hosts 2>/dev/null |\
8664                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8665                         $test -s hosts
8666                 } || {
8667                         test "X$hostcat" != "X" &&
8668                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8669                                         /[       ]$myhostname[  . ]/p" > hosts
8670                 }
8671                 tmp_re="[       . ]"
8672                 if $test -f hosts; then
8673                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8674                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8675                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8676                                 hosts | $sort | $uniq | \
8677                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8678                         case `$echo X$dflt` in
8679                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8680                                 dflt=.
8681                                 ;;
8682                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8683                                 ;;
8684                         esac
8685                 else
8686                         echo "(I cannot locate a hosts database anywhere)"
8687                         dflt=.
8688                 fi
8689                 case "$dflt" in
8690                 .)
8691                         tans=`./loc resolv.conf X /etc /usr/etc`
8692                         if $test -f "$tans"; then
8693                                 echo "(Attempting domain name extraction from $tans)"
8694                                 dflt=.`$sed -n -e 's/   / /g' \
8695                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8696                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8697                                 case "$dflt" in
8698                                 .) dflt=.`$sed -n -e 's/        / /g' \
8699                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8700                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8701                                         ;;
8702                                 esac
8703                         fi
8704                         ;;
8705                 esac
8706                 case "$dflt" in
8707                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8708                         dflt=.`sh -c domainname 2>/dev/null`
8709                         case "$dflt" in
8710                         '') dflt='.';;
8711                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8712                         esac
8713                         ;;
8714                 esac
8715                 case "$dflt$osname" in
8716                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8717                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8718                         ;;
8719                 esac
8720                 case "$dflt" in
8721                 .) echo "(Lost all hope -- silly guess then)"
8722                         dflt='.nonet'
8723                         ;;
8724                 esac
8725                 $rm -f hosts
8726                 ;;
8727         *) dflt="$mydomain";;
8728         esac;;
8729 esac
8730 echo " "
8731 rp="What is your domain name?"
8732 . ./myread
8733 tans="$ans"
8734 case "$ans" in
8735 '') ;;
8736 .*) ;;
8737 *) tans=".$tans";;
8738 esac
8739 mydomain="$tans"
8740
8741 : translate upper to lower if necessary
8742 case "$mydomain" in
8743 *[A-Z]*)
8744         echo "(Normalizing case in your domain name)"
8745         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8746         ;;
8747 esac
8748
8749 : a little sanity check here
8750 case "$phostname" in
8751 '') ;;
8752 *)
8753         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8754         $myhostname$mydomain|$myhostname) ;;
8755         *)
8756                 case "$phostname" in
8757                 sed*)
8758                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8759                         ;;
8760                 *)
8761                         echo "(That doesn't agree with your $phostname command, by the way.)"
8762                         ;;
8763                 esac
8764         ;;
8765         esac
8766         ;;
8767 esac
8768
8769 : determine the e-mail address of the user who is running us
8770 $cat <<EOM
8771
8772 I need to get your e-mail address in Internet format if possible, i.e.
8773 something like user@host.domain. Please answer accurately since I have
8774 no easy means to double check it. The default value provided below
8775 is most probably close to reality but may not be valid from outside
8776 your organization...
8777
8778 EOM
8779 cont=x
8780 while test "$cont"; do
8781         case "$cf_email" in
8782         '') dflt="$cf_by@$myhostname$mydomain";;
8783         *) dflt="$cf_email";;
8784         esac
8785         rp='What is your e-mail address?'
8786         . ./myread
8787         cf_email="$ans"
8788         case "$cf_email" in
8789         *@*.*) cont='' ;;
8790         *)
8791                 rp='Address does not look like an Internet one.  Use it anyway?'
8792                 case "$fastread" in
8793                 yes) dflt=y ;;
8794                 *) dflt=n ;;
8795                 esac
8796                 . ./myread
8797                 case "$ans" in
8798                 y*) cont='' ;;
8799                 *) echo " " ;;
8800                 esac
8801                 ;;
8802         esac
8803 done
8804
8805 : Ask e-mail of administrator
8806 $cat <<EOM
8807
8808 If you or somebody else will be maintaining perl at your site, please
8809 fill in the correct e-mail address here so that they may be contacted
8810 if necessary. Currently, the "perlbug" program included with perl
8811 will send mail to this address in addition to perlbug@perl.org. You may
8812 enter "none" for no administrator.
8813
8814 EOM
8815 case "$perladmin" in
8816 '') dflt="$cf_email";;
8817 *) dflt="$perladmin";;
8818 esac
8819 rp='Perl administrator e-mail address'
8820 . ./myread
8821 perladmin="$ans"
8822
8823 : determine whether to only install version-specific parts.
8824 echo " "
8825 $cat <<EOM
8826 Do you want to install only the version-specific parts of the perl
8827 distribution?  Usually you do *not* want to do this.
8828 EOM
8829 case "$versiononly" in
8830 "$define"|[Yy]*|true) dflt='y' ;;
8831 *) dflt='n';
8832 esac
8833 rp="Do you want to install only the version-specific parts of perl?"
8834 . ./myread
8835 case "$ans" in
8836 [yY]*)  val="$define";;
8837 *)      val="$undef" ;;
8838 esac
8839 set versiononly
8840 eval $setvar
8841
8842 case "$versiononly" in
8843 "$define") inc_version_list=''
8844            inc_version_list_init=0
8845            ;;
8846 esac
8847
8848 : figure out how to guarantee perl startup
8849 : XXX Note that this currently takes advantage of the bug that binexp ignores
8850 :     the Configure -Dinstallprefix setting, which in turn means that under
8851 :     relocatable @INC, initialinstalllocation is what binexp started as.
8852 case "$startperl" in
8853 '')
8854         case "$sharpbang" in
8855         *!)
8856                 $cat <<EOH
8857
8858 I can use the #! construct to start perl on your system. This will
8859 make startup of perl scripts faster, but may cause problems if you
8860 want to share those scripts and perl is not in a standard place
8861 ($initialinstalllocation/perl) on all your platforms. The alternative
8862 is to force a shell by starting the script with a single ':' character.
8863
8864 EOH
8865                 case "$versiononly" in
8866                 "$define")      dflt="$initialinstalllocation/perl$version";;
8867                 *)              dflt="$initialinstalllocation/perl";;
8868                 esac
8869                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8870                 . ./myread
8871                 case "$ans" in
8872                 none)   startperl=": # use perl";;
8873                 *)      startperl="#!$ans"
8874                         if $test 30 -lt `echo "$ans" | wc -c`; then
8875                                 $cat >&4 <<EOM
8876
8877 WARNING:  Some systems limit the #! command to 32 characters.
8878 If you experience difficulty running Perl scripts with #!, try
8879 installing Perl in a directory with a shorter pathname.
8880
8881 EOM
8882                         fi ;;
8883                 esac
8884                 ;;
8885         *) startperl=": # use perl"
8886                 ;;
8887         esac
8888         ;;
8889 esac
8890 echo "I'll use $startperl to start perl scripts."
8891
8892 : figure best path for perl in scripts
8893 case "$perlpath" in
8894 '')
8895         case "$versiononly" in
8896         "$define")      perlpath="$initialinstalllocation/perl$version";;
8897         *)              perlpath="$initialinstalllocation/perl";;
8898         esac
8899         case "$startperl" in
8900         *!*) ;;
8901         *)
8902                 $cat <<EOH
8903
8904 I will use the "eval 'exec'" idiom to start Perl on your system.
8905 I can use the full path of your Perl binary for this purpose, but
8906 doing so may cause problems if you want to share those scripts and
8907 Perl is not always in a standard place ($initialinstalllocation/perl).
8908
8909 EOH
8910                 dflt="$initialinstalllocation/perl"
8911                 rp="What path shall I use in \"eval 'exec'\"?"
8912                 . ./myread
8913                 perlpath="$ans"
8914                 ;;
8915         esac
8916         ;;
8917 esac
8918 case "$startperl" in
8919 *!*)    ;;
8920 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8921 esac
8922
8923 : determine where public executable scripts go
8924 set scriptdir scriptdir
8925 eval $prefixit
8926 case "$scriptdir" in
8927 '')
8928         dflt="$bin"
8929         : guess some guesses
8930         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8931         $test -d /usr/share/bin     && dflt=/usr/share/bin
8932         $test -d /usr/local/script  && dflt=/usr/local/script
8933         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8934         $test -d $prefixexp/script  && dflt=$prefixexp/script
8935         set dflt
8936         eval $prefixup
8937         ;;
8938 *)  dflt="$scriptdir"
8939         ;;
8940 esac
8941 $cat <<EOM
8942
8943 Some installations have a separate directory just for executable scripts so
8944 that they can mount it across multiple architectures but keep the scripts in
8945 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8946 Or you might just lump your scripts in with all your other executables.
8947
8948 EOM
8949 fn=d~
8950 rp='Where do you keep publicly executable scripts?'
8951 . ./getfile
8952 if $test "X$ansexp" != "X$scriptdirexp"; then
8953         installscript=''
8954 fi
8955 installscriptdir=''
8956 prefixvar=scriptdir
8957 . ./setprefixvar
8958 : A little fix up for an irregularly named variable.
8959 installscript="$installscriptdir"
8960
8961 : determine where add-on public executables go
8962 case "$sitebin" in
8963 '')     dflt=$siteprefix/bin ;;
8964 *)      dflt=$sitebin ;;
8965 esac
8966 fn=d~
8967 rp='Pathname where the add-on public executables should be installed?'
8968 . ./getfile
8969 prefixvar=sitebin
8970 . ./setprefixvar
8971
8972 : determine where add-on html pages go
8973 : There is no standard location, so try to copy the previously-selected
8974 : directory structure for the core html pages.
8975 case "$sitehtml1dir" in
8976 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8977 *)     dflt=$sitehtml1dir ;;
8978 esac
8979 case "$dflt" in
8980 ''|' ') dflt=none ;;
8981 esac
8982 fn=dn+~
8983 rp='Pathname where the site-specific html pages should be installed?'
8984 . ./getfile
8985 prefixvar=sitehtml1dir
8986 . ./setprefixvar
8987
8988 : determine where add-on library html pages go
8989 : There is no standard location, so try to copy the previously-selected
8990 : directory structure for the core html pages.
8991 case "$sitehtml3dir" in
8992 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8993 *)     dflt=$sitehtml3dir ;;
8994 esac
8995 case "$dflt" in
8996 ''|' ') dflt=none ;;
8997 esac
8998 fn=dn+~
8999 rp='Pathname where the site-specific library html pages should be installed?'
9000 . ./getfile
9001 prefixvar=sitehtml3dir
9002 . ./setprefixvar
9003
9004 : determine where add-on manual pages go
9005 case "$siteman1dir" in
9006 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9007 *)      dflt=$siteman1dir ;;
9008 esac
9009 case "$dflt" in
9010 ''|' ') dflt=none ;;
9011 esac
9012 fn=dn+~
9013 rp='Pathname where the site-specific manual pages should be installed?'
9014 . ./getfile
9015 prefixvar=siteman1dir
9016 . ./setprefixvar
9017
9018 : determine where add-on library man pages go
9019 case "$siteman3dir" in
9020 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9021 *)      dflt=$siteman3dir ;;
9022 esac
9023 case "$dflt" in
9024 ''|' ') dflt=none ;;
9025 esac
9026 fn=dn+~
9027 rp='Pathname where the site-specific library manual pages should be installed?'
9028 . ./getfile
9029 prefixvar=siteman3dir
9030 . ./setprefixvar
9031
9032 : determine where add-on public executable scripts go
9033 case "$sitescript" in
9034 '')     dflt=$siteprefix/script
9035         $test -d $dflt || dflt=$sitebin ;;
9036 *)  dflt="$sitescript" ;;
9037 esac
9038 fn=d~+
9039 rp='Pathname where add-on public executable scripts should be installed?'
9040 . ./getfile
9041 prefixvar=sitescript
9042 . ./setprefixvar
9043
9044 : Check if faststdio is requested and available
9045 case "$usefaststdio" in
9046 $define|true|[yY]*|'')
9047         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9048         case "$xversion" in
9049         [68])   dflt='y' ;;
9050         *)      dflt='n' ;;
9051         esac
9052         ;;
9053 *) dflt='n';;
9054 esac
9055 cat <<EOM
9056
9057 Perl can be built to use 'fast stdio', which means using the stdio
9058 library but also directly manipulating the stdio buffers to enable
9059 faster I/O.  Using stdio is better for backward compatibility (especially
9060 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9061 interface has been preferred instead of stdio.
9062
9063 If this doesn't make any sense to you, just accept the default '$dflt'.
9064 EOM
9065 rp='Use the "fast stdio" if available?'
9066 . ./myread
9067 case "$ans" in
9068 y|Y)    val="$define" ;;
9069 *)      val="$undef" ;;
9070 esac
9071 set usefaststdio
9072 eval $setvar
9073
9074
9075 : define an is-a-typedef? function
9076 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9077 case "$inclist" in
9078 "") inclist="sys/types.h";;
9079 esac;
9080 eval "varval=\$$var";
9081 case "$varval" in
9082 "")
9083         $rm -f temp.c;
9084         for inc in $inclist; do
9085                 echo "#include <$inc>" >>temp.c;
9086         done;
9087         echo "#ifdef $type" >> temp.c;
9088         echo "printf(\"We have $type\");" >> temp.c;
9089         echo "#endif" >> temp.c;
9090         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9091         if $contains $type temp.E >/dev/null 2>&1; then
9092                 eval "$var=\$type";
9093         else
9094                 eval "$var=\$def";
9095         fi;
9096         $rm -f temp.?;;
9097 *) eval "$var=\$varval";;
9098 esac'
9099
9100 : define an is-a-typedef? function that prompts if the type is not available.
9101 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9102 case "$inclist" in
9103 "") inclist="sys/types.h";;
9104 esac;
9105 eval "varval=\$$var";
9106 case "$varval" in
9107 "")
9108         $rm -f temp.c;
9109         for inc in $inclist; do
9110                 echo "#include <$inc>" >>temp.c;
9111         done;
9112         echo "#ifdef $type" >> temp.c;
9113         echo "printf(\"We have $type\");" >> temp.c;
9114         echo "#endif" >> temp.c;
9115         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9116         echo " " ;
9117         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9118         if $contains $type temp.E >/dev/null 2>&1; then
9119                 echo "$type found." >&4;
9120                 eval "$var=\$type";
9121         else
9122                 echo "$type NOT found." >&4;
9123                 dflt="$def";
9124                 . ./myread ;
9125                 eval "$var=\$ans";
9126         fi;
9127         $rm -f temp.?;;
9128 *) eval "$var=\$varval";;
9129 esac'
9130
9131 : see what type lseek is declared as in the kernel
9132 rp="What is the type used for lseek's offset on this system?"
9133 set off_t lseektype long stdio.h sys/types.h
9134 eval $typedef_ask
9135
9136 echo " "
9137 echo "Checking to see how big your file offsets are..." >&4
9138 $cat >try.c <<EOCP
9139 #include <sys/types.h>
9140 #include <stdio.h>
9141 int main()
9142 {
9143     printf("%d\n", (int)sizeof($lseektype));
9144     return(0);
9145 }
9146 EOCP
9147 set try
9148 if eval $compile_ok; then
9149         lseeksize=`$run ./try`
9150         echo "Your file offsets are $lseeksize bytes long."
9151 else
9152         dflt=$longsize
9153         echo " "
9154         echo "(I can't seem to compile the test program.  Guessing...)"
9155         rp="What is the size of your file offsets (in bytes)?"
9156         . ./myread
9157         lseeksize="$ans"
9158 fi
9159 $rm_try
9160
9161 : see what type file positions are declared as in the library
9162 rp="What is the type for file position used by fsetpos()?"
9163 set fpos_t fpostype long stdio.h sys/types.h
9164 eval $typedef_ask
9165
9166 : Check size for Fpos_t
9167 echo " "
9168 case "$fpostype" in
9169 *_t) zzz="$fpostype"    ;;
9170 *)   zzz="fpos_t"       ;;
9171 esac
9172 echo "Checking the size of $zzz..." >&4
9173 cat > try.c <<EOCP
9174 #include <sys/types.h>
9175 #include <stdio.h>
9176 #$i_stdlib I_STDLIB
9177 #ifdef I_STDLIB
9178 #include <stdlib.h>
9179 #endif
9180 int main() {
9181     printf("%d\n", (int)sizeof($fpostype));
9182     exit(0);
9183 }
9184 EOCP
9185 set try
9186 if eval $compile_ok; then
9187         yyy=`$run ./try`
9188         case "$yyy" in
9189         '')     fpossize=4
9190                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9191                 ;;
9192         *)      fpossize=$yyy
9193                 echo "Your $zzz is $fpossize bytes long."
9194                 ;;
9195         esac
9196 else
9197         dflt="$longsize"
9198         echo " " >&4
9199         echo "(I can't compile the test program.  Guessing...)" >&4
9200         rp="What is the size of your file positions (in bytes)?"
9201         . ./myread
9202         fpossize="$ans"
9203 fi
9204
9205 : Check for large file support
9206 # Backward compatibility (uselfs is deprecated).
9207 case "$uselfs" in
9208 "$define"|true|[yY]*)
9209         cat <<EOM >&4
9210
9211 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9212 EOM
9213         uselargefiles="$define"
9214         ;;
9215 esac
9216
9217 case "$lseeksize:$fpossize" in
9218 8:8) cat <<EOM
9219
9220 You can have files larger than 2 gigabytes.
9221 EOM
9222    val="$define" ;;
9223 *)    case "$uselargefiles" in
9224    "$undef"|false|[nN]*) dflt='n' ;;
9225    *)   dflt='y' ;;
9226    esac
9227    cat <<EOM
9228
9229 Perl can be built to understand large files (files larger than 2 gigabytes)
9230 on some systems.  To do so, Configure can be run with -Duselargefiles.
9231
9232 If this doesn't make any sense to you, just accept the default '$dflt'.
9233 EOM
9234    rp='Try to understand large files, if available?'
9235    . ./myread
9236    case "$ans" in
9237    y|Y)         val="$define" ;;
9238    *)           val="$undef"  ;;
9239    esac
9240    ;;
9241 esac
9242 set uselargefiles
9243 eval $setvar
9244 : Look for a hint-file generated 'call-back-unit'.  If the
9245 : user has specified that a large files perl is to be built,
9246 : we may need to set or change some other defaults.
9247 if $test -f uselargefiles.cbu; then
9248         echo "Your platform has some specific hints regarding large file builds, using them..."
9249         . ./uselargefiles.cbu
9250 fi
9251 case "$uselargefiles" in
9252 "$define")
9253         if $test -f uselargefiles.cbu; then
9254                 echo " "
9255                 echo "Rechecking to see how big your file offsets are..." >&4
9256                 $cat >try.c <<EOCP
9257 #include <sys/types.h>
9258 #include <stdio.h>
9259 int main()
9260 {
9261     printf("%d\n", (int)sizeof($lseektype));
9262     return(0);
9263 }
9264 EOCP
9265                 set try
9266                 if eval $compile_ok; then
9267                         lseeksize=`$run ./try`
9268                         $echo "Your file offsets are now $lseeksize bytes long."
9269                 else
9270                         dflt="$lseeksize"
9271                         echo " "
9272                         echo "(I can't seem to compile the test program.  Guessing...)"
9273                         rp="What is the size of your file offsets (in bytes)?"
9274                         . ./myread
9275                         lseeksize="$ans"
9276                 fi
9277                 case "$fpostype" in
9278                 *_t) zzz="$fpostype"    ;;
9279                 *)   zzz="fpos_t"       ;;
9280                 esac
9281                 $echo $n "Rechecking the size of $zzz...$c" >&4
9282                 $cat > try.c <<EOCP
9283 #include <sys/types.h>
9284 #include <stdio.h>
9285 #$i_stdlib I_STDLIB
9286 #ifdef I_STDLIB
9287 #include <stdlib.h>
9288 #endif
9289 int main() {
9290     printf("%d\n", (int)sizeof($fpostype));
9291     return(0);
9292 }
9293 EOCP
9294                 set try
9295                 if eval $compile_ok; then
9296                         yyy=`$run ./try`
9297                         dflt="$lseeksize"
9298                         case "$yyy" in
9299                         '')     echo " "
9300                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9301                                 ;;
9302                         *)      fpossize=$yyy
9303                                 echo " $fpossize bytes." >&4
9304                                 ;;
9305                         esac
9306                 else
9307                         dflt="$fpossize"
9308                         echo " "
9309                         echo "(I can't compile the test program.  Guessing...)" >&4
9310                         rp="What is the size of your file positions (in bytes)?"
9311                         . ./myread
9312                         fpossize="$ans"
9313                 fi
9314                 $rm_try
9315         fi
9316         ;;
9317 esac
9318
9319 : Set the vendorbin variables
9320 case "$vendorprefix" in
9321 '')     d_vendorbin="$undef"
9322         vendorbin=''
9323         vendorbinexp=''
9324         ;;
9325 *)      d_vendorbin="$define"
9326         : determine where vendor-supplied executables go.
9327         case "$vendorbin" in
9328         '') dflt=$vendorprefix/bin ;;
9329         *)      dflt="$vendorbin" ;;
9330         esac
9331         fn=d~+
9332         rp='Pathname for the vendor-supplied executables directory?'
9333         . ./getfile
9334         vendorbin="$ans"
9335         vendorbinexp="$ansexp"
9336         ;;
9337 esac
9338 prefixvar=vendorbin
9339 . ./installprefix
9340
9341 : Set the vendorhtml1dir variables
9342 case "$vendorprefix" in
9343 '')     vendorhtml1dir=''
9344         vendorhtml1direxp=''
9345         ;;
9346 *)      : determine where vendor-supplied html pages go.
9347         : There is no standard location, so try to copy the previously-selected
9348         : directory structure for the core html pages.
9349         : XXX Better default suggestions would be welcome.
9350         case "$vendorhtml1dir" in
9351         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9352         *)      dflt=$vendorhtml1dir ;;
9353         esac
9354         case "$dflt" in
9355         ''|' ') dflt=none ;;
9356         esac
9357         fn=dn+~
9358         rp='Pathname for the vendor-supplied html pages?'
9359         . ./getfile
9360         vendorhtml1dir="$ans"
9361         vendorhtml1direxp="$ansexp"
9362         ;;
9363 esac
9364 : Use ' ' for none so value is preserved next time through Configure
9365 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9366 prefixvar=vendorhtml1dir
9367 . ./installprefix
9368
9369 : Set the vendorhtml3dir variables
9370 case "$vendorprefix" in
9371 '')     vendorhtml3dir=''
9372         vendorhtml3direxp=''
9373         ;;
9374 *)      : determine where vendor-supplied module html pages go.
9375         : There is no standard location, so try to copy the previously-selected
9376         : directory structure for the core html pages.
9377         : XXX Better default suggestions would be welcome.
9378         case "$vendorhtml3dir" in
9379         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9380         *)      dflt=$vendorhtml3dir ;;
9381         esac
9382         case "$dflt" in
9383         ''|' ') dflt=none ;;
9384         esac
9385         fn=dn+~
9386         rp='Pathname for the vendor-supplied html pages?'
9387         . ./getfile
9388         vendorhtml3dir="$ans"
9389         vendorhtml3direxp="$ansexp"
9390         ;;
9391 esac
9392 : Use ' ' for none so value is preserved next time through Configure
9393 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9394 prefixvar=vendorhtml3dir
9395 . ./installprefix
9396
9397 : Set the vendorman1dir variables
9398 case "$vendorprefix" in
9399 '')     vendorman1dir=''
9400         vendorman1direxp=''
9401         ;;
9402 *)      : determine where vendor-supplied manual pages go.
9403         case "$vendorman1dir" in
9404         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9405         *)      dflt=$vendorman1dir ;;
9406         esac
9407         case "$dflt" in
9408         ''|' ') dflt=none ;;
9409         esac
9410         fn=nd~+
9411         rp='Pathname for the vendor-supplied manual section 1 pages?'
9412         . ./getfile
9413         vendorman1dir="$ans"
9414         vendorman1direxp="$ansexp"
9415         ;;
9416 esac
9417 : Use ' ' for none so value is preserved next time through Configure
9418 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9419 prefixvar=vendorman1dir
9420 . ./installprefix
9421
9422 : Set the vendorman3dir variables
9423 case "$vendorprefix" in
9424 '')     vendorman3dir=''
9425         vendorman3direxp=''
9426         ;;
9427 *)      : determine where vendor-supplied module manual pages go.
9428         case "$vendorman3dir" in
9429         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9430         *)      dflt=$vendorman3dir ;;
9431         esac
9432         case "$dflt" in
9433         ''|' ') dflt=none ;;
9434         esac
9435         fn=nd~+
9436         rp='Pathname for the vendor-supplied manual section 3 pages?'
9437         . ./getfile
9438         vendorman3dir="$ans"
9439         vendorman3direxp="$ansexp"
9440         ;;
9441 esac
9442 : Use ' ' for none so value is preserved next time through Configure
9443 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9444 prefixvar=vendorman3dir
9445 . ./installprefix
9446
9447 : Set the vendorscript variables
9448 case "$vendorprefix" in
9449 '')     d_vendorscript="$undef"
9450         vendorscript=''
9451         vendorscriptexp=''
9452         ;;
9453 *)      d_vendorscript="$define"
9454         : determine where vendor-supplied scripts go.
9455         case "$vendorscript" in
9456         '')     dflt=$vendorprefix/script
9457                 $test -d $dflt || dflt=$vendorbin ;;
9458         *)  dflt="$vendorscript" ;;
9459         esac
9460         $cat <<EOM
9461
9462 The installation process will create a directory for
9463 vendor-supplied scripts.
9464
9465 EOM
9466         fn=d~+
9467         rp='Pathname for the vendor-supplied scripts directory?'
9468         . ./getfile
9469         vendorscript="$ans"
9470         vendorscriptexp="$ansexp"
9471         ;;
9472 esac
9473 prefixvar=vendorscript
9474 . ./installprefix
9475
9476 : see if qgcvt exists
9477 set qgcvt d_qgcvt
9478 eval $inlibc
9479
9480 : Check print/scan long double stuff
9481 echo " "
9482
9483 if $test X"$d_longdbl" = X"$define"; then
9484
9485 echo "Checking how to print long doubles..." >&4
9486
9487 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9488         $cat >try.c <<'EOCP'
9489 #include <sys/types.h>
9490 #include <stdio.h>
9491 int main() {
9492   double d = 123.456;
9493   printf("%.3f\n", d);
9494 }
9495 EOCP
9496         set try
9497         if eval $compile; then
9498                 yyy=`$run ./try`
9499                 case "$yyy" in
9500                 123.456)
9501                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9502                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9503                         echo "We will use %f."
9504                         ;;
9505                 esac
9506         fi
9507 fi
9508
9509 if $test X"$sPRIfldbl" = X; then
9510         $cat >try.c <<'EOCP'
9511 #include <sys/types.h>
9512 #include <stdio.h>
9513 int main() {
9514   long double d = 123.456;
9515   printf("%.3Lf\n", d);
9516 }
9517 EOCP
9518         set try
9519         if eval $compile; then
9520                 yyy=`$run ./try`
9521                 case "$yyy" in
9522                 123.456)
9523                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9524                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9525                         echo "We will use %Lf."
9526                         ;;
9527                 esac
9528         fi
9529 fi
9530
9531 if $test X"$sPRIfldbl" = X; then
9532         $cat >try.c <<'EOCP'
9533 #include <sys/types.h>
9534 #include <stdio.h>
9535 int main() {
9536   long double d = 123.456;
9537   printf("%.3llf\n", d);
9538 }
9539 EOCP
9540         set try
9541         if eval $compile; then
9542                 yyy=`$run ./try`
9543                 case "$yyy" in
9544                 123.456)
9545                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9546                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9547                         echo "We will use %llf."
9548                         ;;
9549                 esac
9550         fi
9551 fi
9552
9553 if $test X"$sPRIfldbl" = X; then
9554         $cat >try.c <<'EOCP'
9555 #include <sys/types.h>
9556 #include <stdio.h>
9557 int main() {
9558   long double d = 123.456;
9559   printf("%.3lf\n", d);
9560 }
9561 EOCP
9562         set try
9563         if eval $compile; then
9564                 yyy=`$run ./try`
9565                 case "$yyy" in
9566                 123.456)
9567                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9568                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9569                         echo "We will use %lf."
9570                         ;;
9571                 esac
9572         fi
9573 fi
9574
9575 if $test X"$sPRIfldbl" = X; then
9576         echo "Cannot figure out how to print long doubles." >&4
9577 else
9578         sSCNfldbl=$sPRIfldbl    # expect consistency
9579 fi
9580
9581 $rm_try
9582
9583 fi # d_longdbl
9584
9585 case "$sPRIfldbl" in
9586 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9587         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9588         d_SCNfldbl="$undef";
9589         ;;
9590 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9591         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9592         d_SCNfldbl="$define";
9593         ;;
9594 esac
9595
9596 : Check how to convert floats to strings.
9597
9598 if test "X$d_Gconvert" = X; then
9599
9600 echo " "
9601 echo "Checking for an efficient way to convert floats to strings."
9602 echo " " > try.c
9603 case "$uselongdouble" in
9604 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9605 esac
9606 case "$d_longdbl" in
9607 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9608 esac
9609 case "$d_PRIgldbl" in
9610 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9611 esac
9612 $cat >>try.c <<EOP
9613 #ifdef TRY_gconvert
9614 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9615 char *myname = "gconvert";
9616 #endif
9617 #ifdef TRY_gcvt
9618 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9619 char *myname = "gcvt";
9620 #endif
9621 #ifdef TRY_qgcvt
9622 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9623 char *myname = "qgcvt";
9624 #define DOUBLETYPE long double
9625 #endif
9626 #ifdef TRY_sprintf
9627 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9628 #ifdef HAS_PRIgldbl
9629 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9630 #else
9631 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9632 #endif
9633 #else
9634 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9635 #endif
9636 char *myname = "sprintf";
9637 #endif
9638
9639 #ifndef DOUBLETYPE
9640 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9641 #define DOUBLETYPE long double
9642 #else
9643 #define DOUBLETYPE double
9644 #endif
9645 #endif
9646
9647 #include <stdio.h>
9648
9649 #define I_STDLIB $i_stdlib
9650 #ifdef I_STDLIB
9651 #include <stdlib.h>
9652 #endif
9653
9654 int
9655 checkit(expect, got)
9656 char *expect;
9657 char *got;
9658 {
9659     if (strcmp(expect, got)) {
9660                 printf("%s oddity:  Expected %s, got %s\n",
9661                         myname, expect, got);
9662                 exit(1);
9663         }
9664 }
9665
9666 int main()
9667 {
9668         char buf[64];
9669         buf[63] = '\0';
9670
9671         /* This must be 1st test on (which?) platform */
9672         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9673         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9674         checkit("0.1", buf);
9675
9676         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9677         checkit("0.01", buf);
9678
9679         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9680         checkit("0.001", buf);
9681
9682         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9683         checkit("0.0001", buf);
9684
9685         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9686         if (strlen(buf) > 5)
9687             checkit("9e-005", buf); /* for Microsoft ?? */
9688         else
9689             checkit("9e-05", buf);
9690
9691         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9692         checkit("1", buf);
9693
9694         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9695         checkit("1.1", buf);
9696
9697         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9698         checkit("1.01", buf);
9699
9700         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9701         checkit("1.001", buf);
9702
9703         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9704         checkit("1.0001", buf);
9705
9706         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9707         checkit("1.00001", buf);
9708
9709         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9710         checkit("1.000001", buf);
9711
9712         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9713         checkit("0", buf);
9714
9715         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9716         checkit("-1", buf);
9717
9718         /* Some Linux gcvt's give 1.e+5 here. */
9719         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9720         checkit("100000", buf);
9721
9722         /* Some Linux gcvt's give -1.e+5 here. */
9723         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9724         checkit("-100000", buf);
9725
9726         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9727         checkit("123.456", buf);
9728
9729         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9730         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9731         /* 34 should be enough to scare even long double
9732          * places into using the e notation. */
9733         if (strlen(buf) > 5)
9734             checkit("1e+034", buf); /* for Microsoft */
9735         else
9736             checkit("1e+34", buf);
9737
9738         /* For Perl, if you add additional tests here, also add them to
9739          * t/base/num.t for benefit of platforms not using Configure or
9740          * overriding d_Gconvert */
9741
9742         exit(0);
9743 }
9744 EOP
9745 : first add preferred functions to our list
9746 xxx_list=""
9747 for xxx_convert in $gconvert_preference; do
9748     case $xxx_convert in
9749     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9750     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9751     esac
9752 done
9753 : then add any others
9754 for xxx_convert in gconvert gcvt sprintf; do
9755     case "$xxx_list" in
9756     *$xxx_convert*) ;;
9757     *) xxx_list="$xxx_list $xxx_convert" ;;
9758     esac
9759 done
9760
9761 case "$d_longdbl$uselongdouble" in
9762 "$define$define")
9763     : again, add prefered functions to our list first
9764     xxx_ld_list=""
9765     for xxx_convert in $gconvert_ld_preference; do
9766         case $xxx_convert in
9767         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9768         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9769         esac
9770     done
9771     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9772     for xxx_convert in qgcvt sprintf $xxx_list; do
9773         case "$xxx_ld_list" in
9774         $xxx_convert*|*" $xxx_convert"*) ;;
9775         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9776         esac
9777     done
9778     : if sprintf cannot do long doubles, move it to the end
9779     if test "$d_PRIgldbl" != "$define"; then
9780         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9781     fi
9782     : if no qgcvt, remove it
9783     if test "$d_qgcvt" != "$define"; then
9784         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9785     fi
9786     : use the ld_list
9787     xxx_list="$xxx_ld_list"
9788     ;;
9789 esac
9790
9791 for xxx_convert in $xxx_list; do
9792         echo "Trying $xxx_convert..."
9793         $rm -f try try$_o core
9794         set try -DTRY_$xxx_convert
9795         if eval $compile; then
9796                 echo "$xxx_convert() found." >&4
9797                 if $run ./try; then
9798                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9799                         break;
9800                 else
9801                         echo "...But $xxx_convert didn't work as I expected."
9802                         xxx_convert=''
9803                 fi
9804         else
9805                 echo "$xxx_convert NOT found." >&4
9806         fi
9807 done
9808
9809 if test X$xxx_convert = X; then
9810     echo "*** WHOA THERE!!! ***" >&4
9811     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9812     xxx_convert=sprintf
9813 fi
9814
9815 case "$xxx_convert" in
9816 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9817 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9818 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9819 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9820    "$define$define$define")
9821       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9822    "$define$define$undef")
9823       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9824    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9825    esac
9826    ;;
9827 esac
9828
9829 fi
9830 $rm_try
9831
9832 : see if _fwalk exists
9833 set fwalk d__fwalk
9834 eval $inlibc
9835
9836 : Initialize h_fcntl
9837 h_fcntl=false
9838
9839 : Initialize h_sysfile
9840 h_sysfile=false
9841
9842 : access call always available on UNIX
9843 set access d_access
9844 eval $inlibc
9845
9846 : locate the flags for 'access()'
9847 case "$d_access" in
9848 "$define")
9849         echo " "
9850         $cat >access.c <<EOCP
9851 #include <sys/types.h>
9852 #ifdef I_FCNTL
9853 #include <fcntl.h>
9854 #endif
9855 #ifdef I_SYS_FILE
9856 #include <sys/file.h>
9857 #endif
9858 #ifdef I_UNISTD
9859 #include <unistd.h>
9860 #endif
9861 #$i_stdlib I_STDLIB
9862 #ifdef I_STDLIB
9863 #include <stdlib.h>
9864 #endif
9865 int main() {
9866         exit(R_OK);
9867 }
9868 EOCP
9869         : check sys/file.h first, no particular reason here
9870         if $test `./findhdr sys/file.h` && \
9871                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9872                 h_sysfile=true;
9873                 echo "<sys/file.h> defines the *_OK access constants." >&4
9874         elif $test `./findhdr fcntl.h` && \
9875                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9876                 h_fcntl=true;
9877                 echo "<fcntl.h> defines the *_OK access constants." >&4
9878         elif $test `./findhdr unistd.h` && \
9879                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9880                 echo "<unistd.h> defines the *_OK access constants." >&4
9881         else
9882                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9883         fi
9884         ;;
9885 esac
9886 $rm -f access*
9887
9888 : see if accessx exists
9889 set accessx d_accessx
9890 eval $inlibc
9891
9892 : see if aintl exists
9893 set aintl d_aintl
9894 eval $inlibc
9895
9896 : see if alarm exists
9897 set alarm d_alarm
9898 eval $inlibc
9899
9900 : see if POSIX threads are available
9901 set pthread.h i_pthread
9902 eval $inhdr
9903
9904 : define a fucntion to check prototypes
9905 $cat > protochk <<EOSH
9906 $startsh
9907 cc="$cc"
9908 optimize="$optimize"
9909 ccflags="$ccflags"
9910 prototype="$prototype"
9911 define="$define"
9912 rm_try="$rm_try"
9913 usethreads=$usethreads
9914 i_pthread=$i_pthread
9915 pthread_h_first=$pthread_h_first
9916 EOSH
9917
9918 $cat >> protochk <<'EOSH'
9919
9920 $rm_try
9921 foo="$1"
9922 shift
9923 while test $# -ge 2; do
9924         case "$1" in
9925                 $define) echo "#include <$2>" >> try.c ;;
9926                 literal) echo "$2" >> try.c ;;
9927         esac
9928     # Extra magic for the benefit of systems that need pthread.h
9929     # to be included early to correctly detect threadsafe functions.
9930     # Such functions must guarantee themselves, though, that the usethreads
9931     # and i_pthread have been defined, before calling protochk.
9932     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9933         echo "#include <pthread.h>" >> try.c
9934         pthread_h_done=yes
9935     fi
9936     shift 2
9937 done
9938 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9939 cat >> try.c <<'EOCP'
9940 #ifdef CAN_PROTOTYPE
9941 #define _(args) args
9942 #else
9943 #define _(args) ()
9944 #endif
9945 EOCP
9946 echo "$foo" >> try.c
9947 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9948 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9949 status=$?
9950 $rm_try
9951 exit $status
9952 EOSH
9953 chmod +x protochk
9954 $eunicefix protochk
9955
9956 : Define hasproto macro for Configure internal use
9957 hasproto='varname=$1; func=$2; shift; shift;
9958 while $test $# -ge 2; do
9959         case "$1" in
9960         $define) echo "#include <$2>";;
9961         esac ;
9962     shift 2;
9963 done > try.c;
9964 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9965 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9966         echo "$func() prototype found.";
9967         val="$define";
9968 else
9969         echo "$func() prototype NOT found.";
9970         val="$undef";
9971 fi;
9972 set $varname;
9973 eval $setvar;
9974 $rm_try tryout.c'
9975
9976 : see if sys/types.h has to be included
9977 set sys/types.h i_systypes
9978 eval $inhdr
9979
9980 : see if sys/select.h has to be included
9981 set sys/select.h i_sysselct
9982 eval $inhdr
9983
9984 : Define hasfield macro for Configure internal use
9985 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9986 while $test $# -ge 2; do
9987         case "$1" in
9988         $define) echo "#include <$2>";;
9989         esac ;
9990     shift 2;
9991 done > try.c;
9992 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9993 set try;
9994 if eval $compile; then
9995         val="$define";
9996 else
9997         val="$undef";
9998 fi;
9999 set $varname;
10000 eval $setvar;
10001 $rm_try'
10002
10003 : see if we should include time.h, sys/time.h, or both
10004 echo " "
10005 if test "X$timeincl" = X; then
10006         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10007         $echo $n "I'm now running the test program...$c"
10008         $cat >try.c <<EOCP
10009 #include <sys/types.h>
10010 #ifdef I_TIME
10011 #include <time.h>
10012 #endif
10013 #ifdef I_SYSTIME
10014 #ifdef SYSTIMEKERNEL
10015 #define KERNEL
10016 #endif
10017 #include <sys/time.h>
10018 #endif
10019 #ifdef I_SYSSELECT
10020 #include <sys/select.h>
10021 #endif
10022 #$i_stdlib I_STDLIB
10023 #ifdef I_STDLIB
10024 #include <stdlib.h>
10025 #endif
10026 int main()
10027 {
10028         struct tm foo;
10029 #ifdef S_TIMEVAL
10030         struct timeval bar;
10031 #endif
10032 #ifdef S_TIMEZONE
10033         struct timezone tzp;
10034 #endif
10035         if (foo.tm_sec == foo.tm_sec)
10036                 exit(0);
10037 #ifdef S_TIMEVAL
10038         if (bar.tv_sec == bar.tv_sec)
10039                 exit(0);
10040 #endif
10041         exit(1);
10042 }
10043 EOCP
10044         flags=''
10045         for s_timezone in '-DS_TIMEZONE' ''; do
10046         sysselect=''
10047         for s_timeval in '-DS_TIMEVAL' ''; do
10048         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10049         for i_time in '' '-DI_TIME'; do
10050         for i_systime in '-DI_SYSTIME' ''; do
10051                 case "$flags" in
10052                 '') $echo $n ".$c"
10053                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10054                         if eval $compile; then
10055                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10056                                 shift
10057                                 flags="$*"
10058                                 echo " "
10059                                 $echo $n "Succeeded with $flags$c"
10060                         fi
10061                         ;;
10062                 esac
10063         done
10064         done
10065         done
10066         done
10067         done
10068         timeincl=''
10069         echo " "
10070         case "$flags" in
10071         *SYSTIMEKERNEL*) i_systimek="$define"
10072                 timeincl=`./findhdr sys/time.h`
10073                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10074         *) i_systimek="$undef";;
10075         esac
10076         case "$flags" in
10077         *I_TIME*) i_time="$define"
10078                 timeincl=`./findhdr time.h`" $timeincl"
10079                 echo "We'll include <time.h>." >&4;;
10080         *) i_time="$undef";;
10081         esac
10082         case "$flags" in
10083         *I_SYSTIME*) i_systime="$define"
10084                 timeincl=`./findhdr sys/time.h`" $timeincl"
10085                 echo "We'll include <sys/time.h>." >&4;;
10086         *) i_systime="$undef";;
10087         esac
10088         $rm_try
10089 fi
10090 : see if struct tm knows about tm_zone
10091 case "$i_systime$i_time" in
10092 *$define*)
10093         echo " "
10094         echo "Checking to see if your struct tm has tm_zone field..." >&4
10095         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10096         eval $hasfield
10097         ;;
10098 *)      val="$undef"
10099         set d_tm_tm_zone
10100         eval $setvar
10101         ;;
10102 esac
10103 case "$d_tm_tm_zone" in
10104 "$define")      echo "Yes, it does."   ;;
10105 *)              echo "No, it doesn't." ;;
10106 esac
10107 : see if struct tm knows about tm_gmtoff
10108 case "$i_systime$i_time" in
10109 *$define*)
10110         echo " "
10111         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10112         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10113         eval $hasfield
10114         ;;
10115 *)      val="$undef"
10116         set d_tm_tm_gmtoff
10117         eval $setvar
10118         ;;
10119 esac
10120 case "$d_tm_tm_gmtoff" in
10121 "$define")      echo "Yes, it does."   ;;
10122 *)              echo "No, it doesn't." ;;
10123 esac
10124
10125 : see if asctime_r exists
10126 set asctime_r d_asctime_r
10127 eval $inlibc
10128 case "$d_asctime_r" in
10129 "$define")
10130         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10131         case "$d_asctime_r_proto:$usethreads" in
10132         ":define")      d_asctime_r_proto=define
10133                 set d_asctime_r_proto asctime_r $hdrs
10134                 eval $hasproto ;;
10135         *)      ;;
10136         esac
10137         case "$d_asctime_r_proto" in
10138         define)
10139         case "$asctime_r_proto" in
10140         ''|0) try='char* asctime_r(const struct tm*, char*);'
10141         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
10142         esac
10143         case "$asctime_r_proto" in
10144         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10145         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
10146         esac
10147         case "$asctime_r_proto" in
10148         ''|0) try='int asctime_r(const struct tm*, char*);'
10149         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
10150         esac
10151         case "$asctime_r_proto" in
10152         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10153         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
10154         esac
10155         case "$asctime_r_proto" in
10156         ''|0)   d_asctime_r=undef
10157                 asctime_r_proto=0
10158                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10159         * )     case "$asctime_r_proto" in
10160                 REENTRANT_PROTO*) ;;
10161                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10162                 esac
10163                 echo "Prototype: $try" ;;
10164         esac
10165         ;;
10166         *)      case "$usethreads" in
10167                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10168                 esac
10169                 d_asctime_r=undef
10170                 asctime_r_proto=0
10171                 ;;
10172         esac
10173         ;;
10174 *)      asctime_r_proto=0
10175         ;;
10176 esac
10177
10178 : see if atolf exists
10179 set atolf d_atolf
10180 eval $inlibc
10181
10182 : see if atoll exists
10183 set atoll d_atoll
10184 eval $inlibc
10185
10186 : Look for GCC-style attribute format
10187 case "$d_attribute_format" in
10188 '')
10189 echo " "
10190 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10191 $cat >attrib.c <<'EOCP'
10192 #include <stdio.h>
10193 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10194 EOCP
10195 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10196         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10197                 echo "Your C compiler doesn't support __attribute__((format))."
10198                 val="$undef"
10199         else
10200                 echo "Your C compiler supports __attribute__((format))."
10201                 val="$define"
10202         fi
10203 else
10204         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10205         val="$undef"
10206 fi
10207 ;;
10208 *) val="$d_attribute_format" ;;
10209 esac
10210 set d_attribute_format
10211 eval $setvar
10212 $rm -f attrib*
10213
10214 : Look for GCC-style attribute format with null format allowed
10215 case "$d_printf_format_null" in
10216 '') case "$d_attribute_format" in
10217     $define)
10218         echo " "
10219         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10220 $cat >attrib.c <<EOCP
10221 #include <stdio.h>
10222 #$i_stdlib I_STDLIB
10223 #ifdef I_STDLIB
10224 #include <stdlib.h>
10225 #endif
10226 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10227 int null_printf (char* pat,...) { return (int)pat; }
10228 int main () { exit(null_printf(NULL)); }
10229 EOCP
10230         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10231             : run the executable in case it produces a run-time warning
10232             if $run ./attrib >>attrib.out 2>&1; then
10233                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10234                     echo "Your C compiler doesn't allow __printf__ format to be null."
10235                     val="$undef"
10236                 else
10237                     echo "Your C compiler allows __printf__ format to be null."
10238                     val="$define"
10239                 fi
10240             else
10241             echo "Your C compiler executable failed with __printf__ format null."
10242             val="$undef"
10243         fi
10244     else
10245         echo "Your C compiler fails with __printf__ format null."
10246         val="$undef"
10247     fi
10248     ;;
10249     *)  val="$undef" ;;
10250     esac
10251 ;;
10252 *)  val="$d_printf_format_null" ;;
10253 esac
10254 set d_printf_format_null
10255 eval $setvar
10256 $rm -f attrib*
10257
10258 : Look for GCC-style attribute malloc
10259 case "$d_attribute_malloc" in
10260 '')
10261 echo " "
10262 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10263 $cat >attrib.c <<'EOCP'
10264 #include <stdio.h>
10265 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10266 EOCP
10267 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10268         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10269                 echo "Your C compiler doesn't support __attribute__((malloc))."
10270                 val="$undef"
10271         else
10272                 echo "Your C compiler supports __attribute__((malloc))."
10273                 val="$define"
10274         fi
10275 else
10276         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10277         val="$undef"
10278 fi
10279 ;;
10280 *) val="$d_attribute_malloc" ;;
10281 esac
10282 set d_attribute_malloc
10283 eval $setvar
10284 $rm -f attrib*
10285
10286 : Look for GCC-style attribute nonnull
10287 case "$d_attribute_nonnull" in
10288 '')
10289 echo " "
10290 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10291 $cat >attrib.c <<'EOCP'
10292 #include <stdio.h>
10293 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10294 EOCP
10295 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10296         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10297                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10298                 val="$undef"
10299         else
10300                 echo "Your C compiler supports __attribute__((nonnull))."
10301                 val="$define"
10302         fi
10303 else
10304         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10305         val="$undef"
10306 fi
10307 ;;
10308 *) val="$d_attribute_nonnull" ;;
10309 esac
10310 set d_attribute_nonnull
10311 eval $setvar
10312 $rm -f attrib*
10313
10314 : Look for GCC-style attribute noreturn
10315 case "$d_attribute_noreturn" in
10316 '')
10317 echo " "
10318 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10319 $cat >attrib.c <<'EOCP'
10320 #include <stdio.h>
10321 void fall_over_dead( void ) __attribute__((noreturn));
10322 EOCP
10323 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10324         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10325                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10326                 val="$undef"
10327         else
10328                 echo "Your C compiler supports __attribute__((noreturn))."
10329                 val="$define"
10330         fi
10331 else
10332         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10333         val="$undef"
10334 fi
10335 ;;
10336 *) val="$d_attribute_noreturn" ;;
10337 esac
10338 set d_attribute_noreturn
10339 eval $setvar
10340 $rm -f attrib*
10341
10342 : Look for GCC-style attribute pure
10343 case "$d_attribute_pure" in
10344 '')
10345 echo " "
10346 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10347 $cat >attrib.c <<'EOCP'
10348 #include <stdio.h>
10349 int square( int n ) __attribute__((pure));
10350 EOCP
10351 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10352         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10353                 echo "Your C compiler doesn't support __attribute__((pure))."
10354                 val="$undef"
10355         else
10356                 echo "Your C compiler supports __attribute__((pure))."
10357                 val="$define"
10358         fi
10359 else
10360         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10361         val="$undef"
10362 fi
10363 ;;
10364 *) val="$d_attribute_pure" ;;
10365 esac
10366 set d_attribute_pure
10367 eval $setvar
10368 $rm -f attrib*
10369
10370 : Look for GCC-style attribute unused
10371 case "$d_attribute_unused" in
10372 '')
10373 echo " "
10374 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10375 $cat >attrib.c <<'EOCP'
10376 #include <stdio.h>
10377 int do_something( int dummy __attribute__((unused)), int n );
10378 EOCP
10379 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10380         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10381                 echo "Your C compiler doesn't support __attribute__((unused))."
10382                 val="$undef"
10383         else
10384                 echo "Your C compiler supports __attribute__((unused))."
10385                 val="$define"
10386         fi
10387 else
10388         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10389         val="$undef"
10390 fi
10391 ;;
10392 *) val="$d_attribute_unused" ;;
10393 esac
10394 set d_attribute_unused
10395 eval $setvar
10396 $rm -f attrib*
10397
10398 : Look for GCC-style attribute warn_unused_result
10399 case "$d_attribute_warn_unused_result" in
10400 '')
10401 echo " "
10402 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10403 $cat >attrib.c <<'EOCP'
10404 #include <stdio.h>
10405 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10406 EOCP
10407 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10408         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10409                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10410                 val="$undef"
10411         else
10412                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10413                 val="$define"
10414         fi
10415 else
10416         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10417         val="$undef"
10418 fi
10419 ;;
10420 *) val="$d_attribute_warn_unused_result" ;;
10421 esac
10422 set d_attribute_warn_unused_result
10423 eval $setvar
10424 $rm -f attrib*
10425
10426 : see if bcmp exists
10427 set bcmp d_bcmp
10428 eval $inlibc
10429
10430 : see if bcopy exists
10431 set bcopy d_bcopy
10432 eval $inlibc
10433
10434 : see if getpgrp exists
10435 set getpgrp d_getpgrp
10436 eval $inlibc
10437
10438 case "$d_getpgrp" in
10439 "$define")
10440         echo " "
10441         echo "Checking to see which flavor of getpgrp is in use..."
10442         $cat >try.c <<EOP
10443 #$i_unistd I_UNISTD
10444 #include <sys/types.h>
10445 #ifdef I_UNISTD
10446 #  include <unistd.h>
10447 #endif
10448 #$i_stdlib I_STDLIB
10449 #ifdef I_STDLIB
10450 #include <stdlib.h>
10451 #endif
10452 int main()
10453 {
10454         if (getuid() == 0) {
10455                 printf("(I see you are running Configure as super-user...)\n");
10456                 setuid(1);
10457         }
10458 #ifdef TRY_BSD_PGRP
10459         if (getpgrp(1) == 0)
10460                 exit(0);
10461 #else
10462         if (getpgrp() > 0)
10463                 exit(0);
10464 #endif
10465         exit(1);
10466 }
10467 EOP
10468         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10469                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10470                 val="$define"
10471         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10472                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10473                 val="$undef"
10474         else
10475                 echo "I can't seem to compile and run the test program."
10476                 if ./usg; then
10477                         xxx="a USG one, i.e. you use getpgrp()."
10478                 else
10479                         # SVR4 systems can appear rather BSD-ish.
10480                         case "$i_unistd" in
10481                         $undef)
10482                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10483                                 val="$define"
10484                                 ;;
10485                         $define)
10486                                 xxx="probably a USG one, i.e. you use getpgrp()."
10487                                 val="$undef"
10488                                 ;;
10489                         esac
10490                 fi
10491                 echo "Assuming your getpgrp is $xxx" >&4
10492         fi
10493         ;;
10494 *) val="$undef";;
10495 esac
10496 set d_bsdgetpgrp
10497 eval $setvar
10498 $rm_try
10499
10500 : see if setpgrp exists
10501 set setpgrp d_setpgrp
10502 eval $inlibc
10503
10504 case "$d_setpgrp" in
10505 "$define")
10506         echo " "
10507         echo "Checking to see which flavor of setpgrp is in use..."
10508         $cat >try.c <<EOP
10509 #$i_unistd I_UNISTD
10510 #include <sys/types.h>
10511 #ifdef I_UNISTD
10512 #  include <unistd.h>
10513 #endif
10514 #$i_stdlib I_STDLIB
10515 #ifdef I_STDLIB
10516 #include <stdlib.h>
10517 #endif
10518 int main()
10519 {
10520         if (getuid() == 0) {
10521                 printf("(I see you are running Configure as super-user...)\n");
10522                 setuid(1);
10523         }
10524 #ifdef TRY_BSD_PGRP
10525         if (-1 == setpgrp(1, 1))
10526                 exit(0);
10527 #else
10528         if (setpgrp() != -1)
10529                 exit(0);
10530 #endif
10531         exit(1);
10532 }
10533 EOP
10534         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10535                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10536                 val="$define"
10537         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10538                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10539                 val="$undef"
10540         else
10541                 echo "(I can't seem to compile and run the test program.)"
10542                 if ./usg; then
10543                         xxx="a USG one, i.e. you use setpgrp()."
10544                 else
10545                         # SVR4 systems can appear rather BSD-ish.
10546                         case "$i_unistd" in
10547                         $undef)
10548                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10549                                 val="$define"
10550                                 ;;
10551                         $define)
10552                                 xxx="probably a USG one, i.e. you use setpgrp()."
10553                                 val="$undef"
10554                                 ;;
10555                         esac
10556                 fi
10557                 echo "Assuming your setpgrp is $xxx" >&4
10558         fi
10559         ;;
10560 *) val="$undef";;
10561 esac
10562 set d_bsdsetpgrp
10563 eval $setvar
10564 $rm_try
10565
10566 : Look for GCC-style __builtin_choose_expr
10567 case "$d_builtin_choose_expr" in
10568 '')
10569     echo " "
10570     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10571     $cat >try.c <<'EOCP'
10572 #include <assert.h>
10573 #include <stdlib.h>
10574 #include <stdio.h>
10575
10576 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10577
10578 int main(void) {
10579     assert( SYRINX(1) == 2112 );
10580     assert( SYRINX(1) != 5150 );
10581     assert( SYRINX(0) == 5150 );
10582     assert( SYRINX(0) != 2112 );
10583     puts( "All good!" );
10584     exit(0);
10585 }
10586
10587 EOCP
10588     set try
10589     if eval $compile && $run ./try; then
10590         echo "Your C compiler supports __builtin_choose_expr."
10591         val="$define"
10592     else
10593         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10594         val="$undef"
10595     fi
10596 ;;
10597 *) val="$d_builtin_choose_expr" ;;
10598 esac
10599
10600 set d_builtin_choose_expr
10601 eval $setvar
10602 $rm_try
10603
10604 : Look for GCC-style __builtin_expect
10605 case "$d_builtin_expect" in
10606 '')
10607     echo " "
10608     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10609     $cat >try.c <<'EOCP'
10610 int main(void) {
10611     int n = 50;
10612     if ( __builtin_expect(n, 0) ) n = 1;
10613     /* Remember shell exit code truth is 0, C truth is non-zero */
10614     return !(n == 1);
10615 }
10616 EOCP
10617     set try
10618     if eval $compile && $run ./try; then
10619         echo "Your C compiler supports __builtin_expect."
10620         val="$define"
10621     else
10622         echo "Your C compiler doesn't seem to understand __builtin_expect."
10623         val="$undef"
10624     fi
10625     ;;
10626 *) val="$d_builtin_expect" ;;
10627 esac
10628
10629 set d_builtin_expect
10630 eval $setvar
10631 $rm_try
10632
10633 : see if bzero exists
10634 set bzero d_bzero
10635 eval $inlibc
10636
10637 : see if stdarg is available
10638 echo " "
10639 if $test `./findhdr stdarg.h`; then
10640         echo "<stdarg.h> found." >&4
10641         valstd="$define"
10642 else
10643         echo "<stdarg.h> NOT found." >&4
10644         valstd="$undef"
10645 fi
10646
10647 : see if varags is available
10648 echo " "
10649 if $test `./findhdr varargs.h`; then
10650         echo "<varargs.h> found." >&4
10651 else
10652         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10653 fi
10654
10655 : set up the varargs testing programs
10656 $cat > varargs.c <<EOP
10657 #ifdef I_STDARG
10658 #include <stdarg.h>
10659 #endif
10660 #ifdef I_VARARGS
10661 #include <varargs.h>
10662 #endif
10663
10664 #ifdef I_STDARG
10665 int f(char *p, ...)
10666 #else
10667 int f(va_alist)
10668 va_dcl
10669 #endif
10670 {
10671         va_list ap;
10672 #ifndef I_STDARG
10673         char *p;
10674 #endif
10675 #ifdef I_STDARG
10676         va_start(ap,p);
10677 #else
10678         va_start(ap);
10679         p = va_arg(ap, char *);
10680 #endif
10681         va_end(ap);
10682         return 0;
10683 }
10684 EOP
10685 $cat > varargs <<EOP
10686 $startsh
10687 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10688         echo "true"
10689 else
10690         echo "false"
10691 fi
10692 $rm -f varargs$_o
10693 EOP
10694 chmod +x varargs
10695
10696 : now check which varargs header should be included
10697 echo " "
10698 i_varhdr=''
10699 case "$valstd" in
10700 "$define")
10701         if `./varargs I_STDARG`; then
10702                 val='stdarg.h'
10703         elif `./varargs I_VARARGS`; then
10704                 val='varargs.h'
10705         fi
10706         ;;
10707 *)
10708         if `./varargs I_VARARGS`; then
10709                 val='varargs.h'
10710         fi
10711         ;;
10712 esac
10713 case "$val" in
10714 '')
10715 echo "I could not find the definition for va_dcl... You have problems..." >&4
10716         val="$undef"; set i_stdarg; eval $setvar
10717         val="$undef"; set i_varargs; eval $setvar
10718         ;;
10719 *)
10720         set i_varhdr
10721         eval $setvar
10722         case "$i_varhdr" in
10723         stdarg.h)
10724                 val="$define"; set i_stdarg; eval $setvar
10725                 val="$undef"; set i_varargs; eval $setvar
10726                 ;;
10727         varargs.h)
10728                 val="$undef"; set i_stdarg; eval $setvar
10729                 val="$define"; set i_varargs; eval $setvar
10730                 ;;
10731         esac
10732         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10733 esac
10734 $rm -f varargs*
10735
10736 : see if the Compiler supports C99 variadic macros
10737 case "$i_stdarg$i_stdlib" in
10738     "$define$define")
10739     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10740     $cat >try.c <<EOCP
10741 #include <stdio.h>
10742 #include <stdarg.h>
10743
10744 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10745
10746 int main() {
10747   char buf[20];
10748   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10749   puts(buf);
10750   return 0;
10751 }
10752 EOCP
10753     set try
10754     if eval $compile && $run ./try 2>&1 >/dev/null; then
10755         case "`$run ./try`" in
10756             "123 456 789")
10757             echo "You have C99 variadic macros." >&4
10758             d_c99_variadic_macros="$define"
10759             ;;
10760             *)
10761             echo "You don't have functional C99 variadic macros." >&4
10762             d_c99_variadic_macros="$undef"
10763             ;;
10764         esac
10765     else
10766         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10767         d_c99_variadic_macros="$undef"
10768     fi
10769     $rm_try
10770     ;;
10771     *)
10772     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10773     d_c99_variadic_macros="$undef"
10774     ;;
10775 esac
10776
10777 : see if signal is declared as pointer to function returning int or void
10778 echo " "
10779 xxx=`./findhdr signal.h`
10780 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10781 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10782         echo "You have int (*signal())() instead of void." >&4
10783         val="$undef"
10784 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10785         echo "You have void (*signal())()." >&4
10786         val="$define"
10787 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10788         echo "You have int (*signal())() instead of void." >&4
10789         val="$undef"
10790 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10791         echo "You have void (*signal())()." >&4
10792         val="$define"
10793 else
10794         case "$d_voidsig" in
10795         '')
10796         echo "I can't determine whether signal handler returns void or int..." >&4
10797                 dflt=void
10798                 rp="What type does your signal handler return?"
10799                 . ./myread
10800                 case "$ans" in
10801                 v*) val="$define";;
10802                 *) val="$undef";;
10803                 esac;;
10804         "$define")
10805                 echo "As you already told me, signal handler returns void." >&4
10806                 val="$define"
10807                 ;;
10808         *)      echo "As you already told me, signal handler returns int." >&4
10809                 val="$undef"
10810                 ;;
10811         esac
10812 fi
10813 set d_voidsig
10814 eval $setvar
10815 case "$d_voidsig" in
10816 "$define") signal_t="void";;
10817 *) signal_t="int";;
10818 esac
10819 $rm -f $$.tmp
10820
10821 : check for ability to cast large floats to 32-bit ints.
10822 echo " "
10823 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10824 if $test "$intsize" -ge 4; then
10825         xxx=int
10826 else
10827         xxx=long
10828 fi
10829 $cat >try.c <<EOCP
10830 #include <stdio.h>
10831 #$i_stdlib I_STDLIB
10832 #ifdef I_STDLIB
10833 #include <stdlib.h>
10834 #endif
10835 #include <sys/types.h>
10836 #include <signal.h>
10837 $signal_t blech(int s) { exit(3); }
10838 int main()
10839 {
10840         $xxx i32;
10841         double f, g;
10842         int result = 0;
10843         char str[16];
10844         signal(SIGFPE, blech);
10845
10846         /* Don't let compiler optimize the test away.  Store the number
10847            in a writable string for gcc to pass to sscanf under HP/UX.
10848         */
10849         sprintf(str, "2147483647");
10850         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10851         g = 10 * f;
10852         i32  = ($xxx) g;
10853
10854         /* x86 processors will probably give 0x8000 0000, which is a
10855            sign change.  We don't want that.  We want to mimic SPARC
10856            behavior here, which is to preserve the sign and give
10857            back 0x7fff ffff.
10858         */
10859         if (i32 != ($xxx) f)
10860                 result |= 1;
10861         exit(result);
10862 }
10863 EOCP
10864 set try
10865 if eval $compile_ok; then
10866         $run ./try
10867         yyy=$?
10868 else
10869         echo "(I can't seem to compile the test program--assuming it can't)"
10870         yyy=1
10871 fi
10872 case "$yyy" in
10873 0)      val="$define"
10874         echo "Yup, it can."
10875         ;;
10876 *)      val="$undef"
10877         echo "Nope, it can't."
10878         ;;
10879 esac
10880 set d_casti32
10881 eval $setvar
10882 $rm_try
10883
10884 : check for ability to cast negative floats to unsigned
10885 echo " "
10886 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10887 $cat >try.c <<EOCP
10888 #include <stdio.h>
10889 #$i_stdlib I_STDLIB
10890 #ifdef I_STDLIB
10891 #include <stdlib.h>
10892 #endif
10893 #include <sys/types.h>
10894 #include <signal.h>
10895 $signal_t blech(int s) { exit(7); }
10896 $signal_t blech_in_list(int s) { exit(4); }
10897 unsigned long dummy_long(unsigned long p) { return p; }
10898 unsigned int dummy_int(unsigned int p) { return p; }
10899 unsigned short dummy_short(unsigned short p) { return p; }
10900 int main()
10901 {
10902         double f;
10903         unsigned long along;
10904         unsigned int aint;
10905         unsigned short ashort;
10906         int result = 0;
10907         char str[16];
10908
10909         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10910            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10911            optimized the whole file away
10912         */
10913         /* Store the number in a writable string for gcc to pass to
10914            sscanf under HP/UX.
10915         */
10916         sprintf(str, "-123");
10917         sscanf(str, "%lf", &f);  /* f = -123.; */
10918
10919         signal(SIGFPE, blech);
10920         along = (unsigned long)f;
10921         aint = (unsigned int)f;
10922         ashort = (unsigned short)f;
10923         if (along != (unsigned long)-123)
10924                 result |= 1;
10925         if (aint != (unsigned int)-123)
10926                 result |= 1;
10927         if (ashort != (unsigned short)-123)
10928                 result |= 1;
10929         sprintf(str, "1073741824.");
10930         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10931         f = f + f;
10932         along = 0;
10933         along = (unsigned long)f;
10934         if (along != 0x80000000)
10935                 result |= 2;
10936         f -= 1.;
10937         along = 0;
10938         along = (unsigned long)f;
10939         if (along != 0x7fffffff)
10940                 result |= 1;
10941         f += 2.;
10942         along = 0;
10943         along = (unsigned long)f;
10944         if (along != 0x80000001)
10945                 result |= 2;
10946         if (result)
10947                 exit(result);
10948         signal(SIGFPE, blech_in_list);
10949         sprintf(str, "123.");
10950         sscanf(str, "%lf", &f);  /* f = 123.; */
10951         along = dummy_long((unsigned long)f);
10952         aint = dummy_int((unsigned int)f);
10953         ashort = dummy_short((unsigned short)f);
10954         if (along != (unsigned long)123)
10955                 result |= 4;
10956         if (aint != (unsigned int)123)
10957                 result |= 4;
10958         if (ashort != (unsigned short)123)
10959                 result |= 4;
10960         exit(result);
10961
10962 }
10963 EOCP
10964 set try
10965 if eval $compile_ok; then
10966         $run ./try
10967         castflags=$?
10968 else
10969         echo "(I can't seem to compile the test program--assuming it can't)"
10970         castflags=7
10971 fi
10972 case "$castflags" in
10973 0)      val="$define"
10974         echo "Yup, it can."
10975         ;;
10976 *)      val="$undef"
10977         echo "Nope, it can't."
10978         ;;
10979 esac
10980 set d_castneg
10981 eval $setvar
10982 $rm_try
10983
10984 : see if vprintf exists
10985 echo " "
10986 if set vprintf val -f d_vprintf; eval $csym; $val; then
10987         echo 'vprintf() found.' >&4
10988         val="$define"
10989         $cat >try.c <<EOF
10990 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
10991 #$i_varargs I_VARARGS
10992
10993 #$i_stdlib I_STDLIB
10994 #$i_unistd I_UNISTD
10995
10996 #ifdef I_STDARG
10997 #  include <stdarg.h>
10998 #else /* I_VARARGS */
10999 #  include <varargs.h>
11000 #endif
11001
11002 #ifdef I_UNISTD
11003 #  include <unistd.h>
11004 #endif
11005
11006 #ifdef I_STDLIB
11007 #  include <stdlib.h>
11008 #endif
11009
11010 #include <stdio.h> /* vsprintf prototype */
11011
11012 #ifdef I_STDARG
11013 void xxx(int n, ...)
11014 {
11015     va_list args;
11016     char buf[10];
11017     va_start(args, n);
11018     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11019 }
11020 int main() { xxx(1, "foo"); }
11021
11022 #else /* I_VARARGS */
11023
11024 xxx(va_alist)
11025 va_dcl
11026 {
11027     va_list args;
11028     char buf[10];
11029     va_start(args);
11030     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11031 }
11032 int main() { xxx("foo"); }
11033
11034 #endif
11035
11036 EOF
11037         set try
11038         if eval $compile_ok; then
11039                 if $run ./try; then
11040                         echo "Your vsprintf() returns (int)." >&4
11041                         val2="$undef"
11042                 else
11043                         echo "Your vsprintf() returns (char*)." >&4
11044                         val2="$define"
11045                 fi
11046         else
11047                 echo 'I am unable to compile the vsprintf() test program.' >&4
11048                 # We shouldn't get here.  If we do, assume the standard signature,
11049                 # not the old BSD one.
11050                 echo 'Guessing that vsprintf() returns (int).' >&4
11051                 val2="$undef"
11052         fi
11053 else
11054         echo 'vprintf() NOT found.' >&4
11055         val="$undef"
11056         val2="$undef"
11057 fi
11058 $rm_try
11059 set d_vprintf
11060 eval $setvar
11061 val=$val2
11062 set d_charvspr
11063 eval $setvar
11064
11065 : see if chown exists
11066 set chown d_chown
11067 eval $inlibc
11068
11069 : see if chroot exists
11070 set chroot d_chroot
11071 eval $inlibc
11072
11073 : see if chsize exists
11074 set chsize d_chsize
11075 eval $inlibc
11076
11077 : see if class exists
11078 set class d_class
11079 eval $inlibc
11080
11081 : see if clearenv exists
11082 set clearenv d_clearenv
11083 eval $inlibc
11084
11085 : Define hasstruct macro for Configure internal use
11086 hasstruct='varname=$1; struct=$2; shift; shift;
11087 while $test $# -ge 2; do
11088         case "$1" in
11089         $define) echo "#include <$2>";;
11090         esac ;
11091     shift 2;
11092 done > try.c;
11093 echo "int main () { struct $struct foo; }" >> try.c;
11094 set try;
11095 if eval $compile; then
11096         val="$define";
11097 else
11098         val="$undef";
11099 fi;
11100 set $varname;
11101 eval $setvar;
11102 $rm_try'
11103
11104 : see whether socket exists
11105 socketlib=''
11106 sockethdr=''
11107 echo " "
11108 $echo $n "Hmm... $c" >&4
11109 if set socket val -f d_socket; eval $csym; $val; then
11110         echo "Looks like you have Berkeley networking support." >&4
11111         d_socket="$define"
11112         if set setsockopt val -f; eval $csym; $val; then
11113                 d_oldsock="$undef"
11114         else
11115                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11116                 d_oldsock="$define"
11117         fi
11118 else
11119         if $contains socklib libc.list >/dev/null 2>&1; then
11120                 echo "Looks like you have Berkeley networking support." >&4
11121                 d_socket="$define"
11122                 : we will have to assume that it supports the 4.2 BSD interface
11123                 d_oldsock="$undef"
11124         else
11125                 echo "You don't have Berkeley networking in libc$_a..." >&4
11126                 if test "X$d_socket" = "X$define"; then
11127                    echo "...but you seem to believe that you have sockets." >&4
11128                 else
11129                         for net in net socket
11130                         do
11131                                 if test -f /usr/lib/lib$net$_a; then
11132                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11133                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11134                                         if $contains socket libc.list >/dev/null 2>&1; then
11135                                                 d_socket="$define"
11136                                                 socketlib="-l$net"
11137                                                 case "$net" in
11138                                                 net)
11139                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11140                                                         sockethdr="-I/usr/netinclude"
11141                                                         ;;
11142                                                 esac
11143                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11144                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11145                                                         d_oldsock="$undef"
11146                                                 else
11147                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11148                                                         d_oldsock="$define"
11149                                                 fi
11150                                                 break
11151                                         fi
11152                                 fi
11153                         done
11154                         if test "X$d_socket" != "X$define"; then
11155                            echo "or anywhere else I see." >&4
11156                            d_socket="$undef"
11157                            d_oldsock="$undef"
11158                         fi
11159                 fi
11160         fi
11161 fi
11162
11163 : see if socketpair exists
11164 set socketpair d_sockpair
11165 eval $inlibc
11166
11167
11168 echo " "
11169 echo "Checking the availability of certain socket constants..." >&4
11170 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11171         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11172         $cat >try.c <<EOF
11173 #include <sys/types.h>
11174 #include <sys/socket.h>
11175 int main() {
11176     int i = $ENUM;
11177 }
11178 EOF
11179         val="$undef"
11180         set try; if eval $compile; then
11181                 val="$define"
11182         fi
11183         set d_${enum}; eval $setvar
11184         $rm_try
11185 done
11186
11187 : see if this is a sys/uio.h system
11188 set sys/uio.h i_sysuio
11189 eval $inhdr
11190
11191 : Check for cmsghdr support
11192 echo " "
11193 echo "Checking to see if your system supports struct cmsghdr..." >&4
11194 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11195 eval $hasstruct
11196 case "$d_cmsghdr_s" in
11197 "$define")      echo "Yes, it does."   ;;
11198 *)              echo "No, it doesn't." ;;
11199 esac
11200
11201
11202 : check for const keyword
11203 echo " "
11204 echo 'Checking to see if your C compiler knows about "const"...' >&4
11205 $cat >const.c <<'EOCP'
11206 typedef struct spug { int drokk; } spug;
11207 int main()
11208 {
11209         const char *foo;
11210         const spug y = { 0 };
11211 }
11212 EOCP
11213 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11214         val="$define"
11215         echo "Yup, it does."
11216 else
11217         val="$undef"
11218         echo "Nope, it doesn't."
11219 fi
11220 set d_const
11221 eval $setvar
11222
11223 : see if copysignl exists
11224 set copysignl d_copysignl
11225 eval $inlibc
11226
11227 : see if crypt exists
11228 echo " "
11229 set crypt d_crypt
11230 eval $inlibc
11231 case "$d_crypt" in
11232 $define) cryptlib='' ;;
11233 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11234                 echo 'crypt() found.' >&4
11235                 val="$define"
11236                 cryptlib=''
11237         else
11238                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11239                 if $test -z "$cryptlib"; then
11240                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11241                 else
11242                         cryptlib=-lcrypt
11243                 fi
11244                 if $test -z "$cryptlib"; then
11245                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11246                 else
11247                         cryptlib=-lcrypt
11248                 fi
11249                 if $test -z "$cryptlib"; then
11250                         cryptlib=`./loc libcrypt$_a "" $libpth`
11251                 else
11252                         cryptlib=-lcrypt
11253                 fi
11254                 if $test -z "$cryptlib"; then
11255                         echo 'crypt() NOT found.' >&4
11256                         val="$undef"
11257                 else
11258                         val="$define"
11259                 fi
11260         fi
11261         set d_crypt
11262         eval $setvar
11263         ;;
11264 esac
11265
11266 : see if this is a crypt.h system
11267 set crypt.h i_crypt
11268 eval $inhdr
11269
11270 : see if crypt_r exists
11271 set crypt_r d_crypt_r
11272 eval $inlibc
11273 case "$d_crypt_r" in
11274 "$define")
11275         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11276         case "$d_crypt_r_proto:$usethreads" in
11277         ":define")      d_crypt_r_proto=define
11278                 set d_crypt_r_proto crypt_r $hdrs
11279                 eval $hasproto ;;
11280         *)      ;;
11281         esac
11282         case "$d_crypt_r_proto" in
11283         define)
11284         case "$crypt_r_proto" in
11285         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11286         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
11287         esac
11288         case "$crypt_r_proto" in
11289         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11290         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
11291         esac
11292         case "$crypt_r_proto" in
11293         ''|0)   d_crypt_r=undef
11294                 crypt_r_proto=0
11295                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11296         * )     case "$crypt_r_proto" in
11297                 REENTRANT_PROTO*) ;;
11298                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11299                 esac
11300                 echo "Prototype: $try" ;;
11301         esac
11302         ;;
11303         *)      case "$usethreads" in
11304                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11305                 esac
11306                 d_crypt_r=undef
11307                 crypt_r_proto=0
11308                 ;;
11309         esac
11310         ;;
11311 *)      crypt_r_proto=0
11312         ;;
11313 esac
11314
11315 : get csh whereabouts
11316 case "$csh" in
11317 'csh') val="$undef" ;;
11318 *) val="$define" ;;
11319 esac
11320 set d_csh
11321 eval $setvar
11322 : Respect a hint or command line value for full_csh.
11323 case "$full_csh" in
11324 '') full_csh=$csh ;;
11325 esac
11326
11327 : see if ctermid exists
11328 set ctermid d_ctermid
11329 eval $inlibc
11330
11331 : see if ctermid_r exists
11332 set ctermid_r d_ctermid_r
11333 eval $inlibc
11334 case "$d_ctermid_r" in
11335 "$define")
11336         hdrs="$i_systypes sys/types.h define stdio.h "
11337         case "$d_ctermid_r_proto:$usethreads" in
11338         ":define")      d_ctermid_r_proto=define
11339                 set d_ctermid_r_proto ctermid_r $hdrs
11340                 eval $hasproto ;;
11341         *)      ;;
11342         esac
11343         case "$d_ctermid_r_proto" in
11344         define)
11345         case "$ctermid_r_proto" in
11346         ''|0) try='char* ctermid_r(char*);'
11347         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
11348         esac
11349         case "$ctermid_r_proto" in
11350         ''|0)   d_ctermid_r=undef
11351                 ctermid_r_proto=0
11352                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11353         * )     case "$ctermid_r_proto" in
11354                 REENTRANT_PROTO*) ;;
11355                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11356                 esac
11357                 echo "Prototype: $try" ;;
11358         esac
11359         ;;
11360         *)      case "$usethreads" in
11361                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11362                 esac
11363                 d_ctermid_r=undef
11364                 ctermid_r_proto=0
11365                 ;;
11366         esac
11367         ;;
11368 *)      ctermid_r_proto=0
11369         ;;
11370 esac
11371
11372 : see if ctime_r exists
11373 set ctime_r d_ctime_r
11374 eval $inlibc
11375 case "$d_ctime_r" in
11376 "$define")
11377         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11378         case "$d_ctime_r_proto:$usethreads" in
11379         ":define")      d_ctime_r_proto=define
11380                 set d_ctime_r_proto ctime_r $hdrs
11381                 eval $hasproto ;;
11382         *)      ;;
11383         esac
11384         case "$d_ctime_r_proto" in
11385         define)
11386         case "$ctime_r_proto" in
11387         ''|0) try='char* ctime_r(const time_t*, char*);'
11388         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
11389         esac
11390         case "$ctime_r_proto" in
11391         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11392         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
11393         esac
11394         case "$ctime_r_proto" in
11395         ''|0) try='int ctime_r(const time_t*, char*);'
11396         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
11397         esac
11398         case "$ctime_r_proto" in
11399         ''|0) try='int ctime_r(const time_t*, char*, int);'
11400         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
11401         esac
11402         case "$ctime_r_proto" in
11403         ''|0)   d_ctime_r=undef
11404                 ctime_r_proto=0
11405                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11406         * )     case "$ctime_r_proto" in
11407                 REENTRANT_PROTO*) ;;
11408                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11409                 esac
11410                 echo "Prototype: $try" ;;
11411         esac
11412         ;;
11413         *)      case "$usethreads" in
11414                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11415                 esac
11416                 d_ctime_r=undef
11417                 ctime_r_proto=0
11418                 ;;
11419         esac
11420         ;;
11421 *)      ctime_r_proto=0
11422         ;;
11423 esac
11424
11425 : see if cuserid exists
11426 set cuserid d_cuserid
11427 eval $inlibc
11428
11429 : see if this is a limits.h system
11430 set limits.h i_limits
11431 eval $inhdr
11432
11433 : see if this is a float.h system
11434 set float.h i_float
11435 eval $inhdr
11436
11437 : See if number of significant digits in a double precision number is known
11438 echo " "
11439 $cat >dbl_dig.c <<EOM
11440 #$i_limits I_LIMITS
11441 #$i_float I_FLOAT
11442 #ifdef I_LIMITS
11443 #include <limits.h>
11444 #endif
11445 #ifdef I_FLOAT
11446 #include <float.h>
11447 #endif
11448 #ifdef DBL_DIG
11449 printf("Contains DBL_DIG");
11450 #endif
11451 EOM
11452 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11453 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11454         echo "DBL_DIG found." >&4
11455         val="$define"
11456 else
11457         echo "DBL_DIG NOT found." >&4
11458         val="$undef"
11459 fi
11460 $rm -f dbl_dig.?
11461 set d_dbl_dig
11462 eval $setvar
11463
11464 : see if dbm.h is available
11465 : see if dbmclose exists
11466 set dbmclose d_dbmclose
11467 eval $inlibc
11468
11469 case "$d_dbmclose" in
11470 $define)
11471         set dbm.h i_dbm
11472         eval $inhdr
11473         case "$i_dbm" in
11474         $define)
11475                 val="$undef"
11476                 set i_rpcsvcdbm
11477                 eval $setvar
11478                 ;;
11479         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11480                 eval $inhdr
11481                 ;;
11482         esac
11483         ;;
11484 *)      echo "We won't be including <dbm.h>"
11485         val="$undef"
11486         set i_dbm
11487         eval $setvar
11488         val="$undef"
11489         set i_rpcsvcdbm
11490         eval $setvar
11491         ;;
11492 esac
11493
11494 : see if prototype for dbminit is available
11495 echo " "
11496 set d_dbminitproto dbminit $i_dbm dbm.h
11497 eval $hasproto
11498
11499 : see if difftime exists
11500 set difftime d_difftime
11501 eval $inlibc
11502
11503 : see if this is a dirent system
11504 echo " "
11505 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11506         val="$define"
11507         echo "<dirent.h> found." >&4
11508 else
11509         val="$undef"
11510         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11511                 echo "<sys/dir.h> found." >&4
11512                 echo " "
11513         else
11514                 xinc=`./findhdr sys/ndir.h`
11515         fi
11516         echo "<dirent.h> NOT found." >&4
11517 fi
11518 set i_dirent
11519 eval $setvar
11520
11521 : Look for type of directory structure.
11522 echo " "
11523 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11524
11525 case "$direntrytype" in
11526 ''|' ')
11527         case "$i_dirent" in
11528         $define) guess1='struct dirent' ;;
11529         *) guess1='struct direct'  ;;
11530         esac
11531         ;;
11532 *)      guess1="$direntrytype"
11533         ;;
11534 esac
11535
11536 case "$guess1" in
11537 'struct dirent') guess2='struct direct' ;;
11538 *) guess2='struct dirent' ;;
11539 esac
11540
11541 if $contains "$guess1" try.c >/dev/null 2>&1; then
11542         direntrytype="$guess1"
11543         echo "Your directory entries are $direntrytype." >&4
11544 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11545         direntrytype="$guess2"
11546         echo "Your directory entries seem to be $direntrytype." >&4
11547 else
11548         echo "I don't recognize your system's directory entries." >&4
11549         rp="What type is used for directory entries on this system?"
11550         dflt="$guess1"
11551         . ./myread
11552         direntrytype="$ans"
11553 fi
11554 $rm_try
11555
11556 : see if the directory entry stores field length
11557 echo " "
11558 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11559 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11560         echo "Good, your directory entry keeps length information in d_namlen." >&4
11561         val="$define"
11562 else
11563         echo "Your directory entry does not know about the d_namlen field." >&4
11564         val="$undef"
11565 fi
11566 set d_dirnamlen
11567 eval $setvar
11568 $rm_try
11569
11570 : Look for DIR.dd_fd
11571 case "$i_dirent" in
11572 "$define")
11573     echo "Checking to see if DIR has a dd_fd member variable" >&4
11574     $cat >try.c <<EOCP
11575 #$i_stdlib I_STDLIB
11576 #ifdef I_STDLIB
11577 #include <stdlib.h>
11578 #endif
11579 #include <dirent.h>
11580
11581 int main() {
11582     DIR dir;
11583     dir.dd_fd = 1;
11584     return 0;
11585 }
11586 EOCP
11587     val=$undef
11588     set try
11589     if eval $compile; then
11590         echo "Yes, it does."
11591         val="$define"
11592     else
11593         echo "No, it does not."
11594         val="$undef"
11595     fi
11596     ;;
11597 *)
11598     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11599     val="$undef"
11600     ;;
11601 esac
11602 set d_dir_dd_fd
11603 eval $setvar
11604 $rm_try
11605
11606 : see if this is an sysdir system
11607 set sys/dir.h i_sysdir
11608 eval $inhdr
11609
11610 : see if this is an sysndir system
11611 set sys/ndir.h i_sysndir
11612 eval $inhdr
11613
11614 : Look for dirfd
11615 echo " "
11616 $cat >dirfd.c <<EOM
11617 #include <stdio.h>
11618 #$i_stdlib I_STDLIB
11619 #ifdef I_STDLIB
11620 #include <stdlib.h>
11621 #endif
11622 #$i_dirent I_DIRENT             /**/
11623 #$i_sysdir I_SYS_DIR            /**/
11624 #$i_sysndir I_SYS_NDIR          /**/
11625 #$i_systypes I_SYS_TYPES        /**/
11626 #if defined(I_SYS_TYPES)
11627 #include <sys/types.h>
11628 #endif
11629 #if defined(I_DIRENT)
11630 #include <dirent.h>
11631 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11632 #include <sys/dir.h>
11633 #endif
11634 #else
11635 #ifdef I_SYS_NDIR
11636 #include <sys/ndir.h>
11637 #else
11638 #ifdef I_SYS_DIR
11639 #ifdef hp9000s500
11640 #include <ndir.h>       /* may be wrong in the future */
11641 #else
11642 #include <sys/dir.h>
11643 #endif
11644 #endif
11645 #endif
11646 #endif 
11647 int main() {
11648         DIR *dirp = opendir(".");
11649         if (dirfd(dirp) >= 0)
11650                 exit(0);
11651         else
11652                 exit(1);
11653 }
11654 EOM
11655 val=$undef
11656 set dirfd
11657 if eval $compile; then
11658         val="$define"
11659 fi
11660 case "$val" in
11661 $define)        echo "dirfd() found." >&4       ;;
11662 *)              echo "dirfd() NOT found." >&4   ;;
11663 esac
11664 set d_dirfd
11665 eval $setvar
11666 $rm -f dirfd*
11667
11668 : see if dlerror exists
11669 xxx_runnm="$runnm"
11670 runnm=false
11671 set dlerror d_dlerror
11672 eval $inlibc
11673 runnm="$xxx_runnm"
11674
11675 : see if dlfcn is available
11676 set dlfcn.h i_dlfcn
11677 eval $inhdr
11678
11679 : Check what extension to use for shared libs
11680 case "$usedl" in
11681 $define|y|true)
11682         $cat << EOM
11683
11684 On a few systems, the dynamically loaded modules that perl generates and uses
11685 will need a different extension than shared libs. The default will probably
11686 be appropriate.
11687
11688 EOM
11689         case "$dlext" in
11690         '')     dflt="$so" ;;
11691         *)      dflt="$dlext" ;;
11692         esac
11693         rp='What is the extension of dynamically loaded modules'
11694         . ./myread
11695         dlext="$ans"
11696         ;;
11697 *)
11698         dlext="none"
11699         ;;
11700 esac
11701
11702 : Check if dlsym need a leading underscore
11703 echo " "
11704 val="$undef"
11705
11706 case "$dlsrc" in
11707 dl_dlopen.xs)
11708         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11709         $cat >dyna.c <<'EOM'
11710 fred () { }
11711 EOM
11712
11713 $cat >fred.c<<EOM
11714
11715 #include <stdio.h>
11716 #$i_stdlib I_STDLIB
11717 #ifdef I_STDLIB
11718 #include <stdlib.h>
11719 #endif
11720 #$i_dlfcn I_DLFCN
11721 #ifdef I_DLFCN
11722 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11723 #else
11724 #include <sys/types.h>
11725 #include <nlist.h>
11726 #include <link.h>
11727 #endif
11728
11729 extern int fred() ;
11730
11731 int main()
11732 {
11733     void * handle ;
11734     void * symbol ;
11735 #ifndef RTLD_LAZY
11736     int mode = 1 ;
11737 #else
11738     int mode = RTLD_LAZY ;
11739 #endif
11740     handle = dlopen("./dyna.$dlext", mode) ;
11741     if (handle == NULL) {
11742         printf ("1\n") ;
11743         fflush (stdout) ;
11744         exit(0);
11745     }
11746     symbol = dlsym(handle, "fred") ;
11747     if (symbol == NULL) {
11748         /* try putting a leading underscore */
11749         symbol = dlsym(handle, "_fred") ;
11750         if (symbol == NULL) {
11751             printf ("2\n") ;
11752             fflush (stdout) ;
11753             exit(0);
11754         }
11755         printf ("3\n") ;
11756     }
11757     else
11758         printf ("4\n") ;
11759     fflush (stdout) ;
11760     exit(0);
11761 }
11762 EOM
11763         : Call the object file tmp-dyna.o in case dlext=o.
11764         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11765                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11766                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
11767                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11768                 xxx=`$run ./fred`
11769                 case $xxx in
11770                 1)      echo "Test program failed using dlopen." >&4
11771                         echo "Perhaps you should not use dynamic loading." >&4;;
11772                 2)      echo "Test program failed using dlsym." >&4
11773                         echo "Perhaps you should not use dynamic loading." >&4;;
11774                 3)      echo "dlsym needs a leading underscore" >&4
11775                         val="$define" ;;
11776                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11777                 esac
11778         else
11779                 echo "I can't compile and run the test program." >&4
11780                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11781         fi
11782         ;;
11783 esac
11784
11785 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11786
11787 set d_dlsymun
11788 eval $setvar
11789
11790 : see if drand48_r exists
11791 set drand48_r d_drand48_r
11792 eval $inlibc
11793 case "$d_drand48_r" in
11794 "$define")
11795         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11796         case "$d_drand48_r_proto:$usethreads" in
11797         ":define")      d_drand48_r_proto=define
11798                 set d_drand48_r_proto drand48_r $hdrs
11799                 eval $hasproto ;;
11800         *)      ;;
11801         esac
11802         case "$d_drand48_r_proto" in
11803         define)
11804         case "$drand48_r_proto" in
11805         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11806         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11807         esac
11808         case "$drand48_r_proto" in
11809         ''|0)   d_drand48_r=undef
11810                 drand48_r_proto=0
11811                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11812         * )     case "$drand48_r_proto" in
11813                 REENTRANT_PROTO*) ;;
11814                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11815                 esac
11816                 echo "Prototype: $try" ;;
11817         esac
11818         ;;
11819         *)      case "$usethreads" in
11820                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11821                 esac
11822                 d_drand48_r=undef
11823                 drand48_r_proto=0
11824                 ;;
11825         esac
11826         ;;
11827 *)      drand48_r_proto=0
11828         ;;
11829 esac
11830
11831 : see if prototype for drand48 is available
11832 echo " "
11833 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11834 eval $hasproto
11835
11836 : see if dup2 exists
11837 set dup2 d_dup2
11838 eval $inlibc
11839
11840 : see if eaccess exists
11841 set eaccess d_eaccess
11842 eval $inlibc
11843
11844 : see if endgrent exists
11845 set endgrent d_endgrent
11846 eval $inlibc
11847
11848 : see if this is an grp system
11849 set grp.h i_grp
11850 eval $inhdr
11851
11852 case "$i_grp" in
11853 $define)
11854         xxx=`./findhdr grp.h`
11855         $cppstdin $cppflags $cppminus < $xxx >$$.h
11856
11857         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11858                 val="$define"
11859         else
11860                 val="$undef"
11861         fi
11862         set d_grpasswd
11863         eval $setvar
11864
11865         $rm -f $$.h
11866         ;;
11867 *)
11868         val="$undef";
11869         set d_grpasswd; eval $setvar
11870         ;;
11871 esac
11872
11873 : see if endgrent_r exists
11874 set endgrent_r d_endgrent_r
11875 eval $inlibc
11876 case "$d_endgrent_r" in
11877 "$define")
11878         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11879         case "$d_endgrent_r_proto:$usethreads" in
11880         ":define")      d_endgrent_r_proto=define
11881                 set d_endgrent_r_proto endgrent_r $hdrs
11882                 eval $hasproto ;;
11883         *)      ;;
11884         esac
11885         case "$d_endgrent_r_proto" in
11886         define)
11887         case "$endgrent_r_proto" in
11888         ''|0) try='int endgrent_r(FILE**);'
11889         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11890         esac
11891         case "$endgrent_r_proto" in
11892         ''|0) try='void endgrent_r(FILE**);'
11893         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11894         esac
11895         case "$endgrent_r_proto" in
11896         ''|0)   d_endgrent_r=undef
11897                 endgrent_r_proto=0
11898                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11899         * )     case "$endgrent_r_proto" in
11900                 REENTRANT_PROTO*) ;;
11901                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11902                 esac
11903                 echo "Prototype: $try" ;;
11904         esac
11905         ;;
11906         *)      case "$usethreads" in
11907                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11908                 esac
11909                 d_endgrent_r=undef
11910                 endgrent_r_proto=0
11911                 ;;
11912         esac
11913         ;;
11914 *)      endgrent_r_proto=0
11915         ;;
11916 esac
11917
11918 : see if endhostent exists
11919 set endhostent d_endhent
11920 eval $inlibc
11921
11922 : see if this is a netdb.h system
11923 set netdb.h i_netdb
11924 eval $inhdr
11925
11926 : see if endhostent_r exists
11927 set endhostent_r d_endhostent_r
11928 eval $inlibc
11929 case "$d_endhostent_r" in
11930 "$define")
11931         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11932         case "$d_endhostent_r_proto:$usethreads" in
11933         ":define")      d_endhostent_r_proto=define
11934                 set d_endhostent_r_proto endhostent_r $hdrs
11935                 eval $hasproto ;;
11936         *)      ;;
11937         esac
11938         case "$d_endhostent_r_proto" in
11939         define)
11940         case "$endhostent_r_proto" in
11941         ''|0) try='int endhostent_r(struct hostent_data*);'
11942         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11943         esac
11944         case "$endhostent_r_proto" in
11945         ''|0) try='void endhostent_r(struct hostent_data*);'
11946         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11947         esac
11948         case "$endhostent_r_proto" in
11949         ''|0)   d_endhostent_r=undef
11950                 endhostent_r_proto=0
11951                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11952         * )     case "$endhostent_r_proto" in
11953                 REENTRANT_PROTO*) ;;
11954                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11955                 esac
11956                 echo "Prototype: $try" ;;
11957         esac
11958         ;;
11959         *)      case "$usethreads" in
11960                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11961                 esac
11962                 d_endhostent_r=undef
11963                 endhostent_r_proto=0
11964                 ;;
11965         esac
11966         ;;
11967 *)      endhostent_r_proto=0
11968         ;;
11969 esac
11970
11971 : see if endnetent exists
11972 set endnetent d_endnent
11973 eval $inlibc
11974
11975 : see if endnetent_r exists
11976 set endnetent_r d_endnetent_r
11977 eval $inlibc
11978 case "$d_endnetent_r" in
11979 "$define")
11980         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11981         case "$d_endnetent_r_proto:$usethreads" in
11982         ":define")      d_endnetent_r_proto=define
11983                 set d_endnetent_r_proto endnetent_r $hdrs
11984                 eval $hasproto ;;
11985         *)      ;;
11986         esac
11987         case "$d_endnetent_r_proto" in
11988         define)
11989         case "$endnetent_r_proto" in
11990         ''|0) try='int endnetent_r(struct netent_data*);'
11991         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11992         esac
11993         case "$endnetent_r_proto" in
11994         ''|0) try='void endnetent_r(struct netent_data*);'
11995         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11996         esac
11997         case "$endnetent_r_proto" in
11998         ''|0)   d_endnetent_r=undef
11999                 endnetent_r_proto=0
12000                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12001         * )     case "$endnetent_r_proto" in
12002                 REENTRANT_PROTO*) ;;
12003                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12004                 esac
12005                 echo "Prototype: $try" ;;
12006         esac
12007         ;;
12008         *)      case "$usethreads" in
12009                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12010                 esac
12011                 d_endnetent_r=undef
12012                 endnetent_r_proto=0
12013                 ;;
12014         esac
12015         ;;
12016 *)      endnetent_r_proto=0
12017         ;;
12018 esac
12019
12020 : see if endprotoent exists
12021 set endprotoent d_endpent
12022 eval $inlibc
12023
12024 : see if endprotoent_r exists
12025 set endprotoent_r d_endprotoent_r
12026 eval $inlibc
12027 case "$d_endprotoent_r" in
12028 "$define")
12029         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12030         case "$d_endprotoent_r_proto:$usethreads" in
12031         ":define")      d_endprotoent_r_proto=define
12032                 set d_endprotoent_r_proto endprotoent_r $hdrs
12033                 eval $hasproto ;;
12034         *)      ;;
12035         esac
12036         case "$d_endprotoent_r_proto" in
12037         define)
12038         case "$endprotoent_r_proto" in
12039         ''|0) try='int endprotoent_r(struct protoent_data*);'
12040         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
12041         esac
12042         case "$endprotoent_r_proto" in
12043         ''|0) try='void endprotoent_r(struct protoent_data*);'
12044         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
12045         esac
12046         case "$endprotoent_r_proto" in
12047         ''|0)   d_endprotoent_r=undef
12048                 endprotoent_r_proto=0
12049                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12050         * )     case "$endprotoent_r_proto" in
12051                 REENTRANT_PROTO*) ;;
12052                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12053                 esac
12054                 echo "Prototype: $try" ;;
12055         esac
12056         ;;
12057         *)      case "$usethreads" in
12058                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12059                 esac
12060                 d_endprotoent_r=undef
12061                 endprotoent_r_proto=0
12062                 ;;
12063         esac
12064         ;;
12065 *)      endprotoent_r_proto=0
12066         ;;
12067 esac
12068
12069 : see if endpwent exists
12070 set endpwent d_endpwent
12071 eval $inlibc
12072
12073 : see if this is a pwd.h system
12074 set pwd.h i_pwd
12075 eval $inhdr
12076
12077 case "$i_pwd" in
12078 $define)
12079         xxx=`./findhdr pwd.h`
12080         $cppstdin $cppflags $cppminus < $xxx >$$.h
12081
12082         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12083                 val="$define"
12084         else
12085                 val="$undef"
12086         fi
12087         set d_pwquota
12088         eval $setvar
12089
12090         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12091                 val="$define"
12092         else
12093                 val="$undef"
12094         fi
12095         set d_pwage
12096         eval $setvar
12097
12098         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12099                 val="$define"
12100         else
12101                 val="$undef"
12102         fi
12103         set d_pwchange
12104         eval $setvar
12105
12106         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12107                 val="$define"
12108         else
12109                 val="$undef"
12110         fi
12111         set d_pwclass
12112         eval $setvar
12113
12114         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12115                 val="$define"
12116         else
12117                 val="$undef"
12118         fi
12119         set d_pwexpire
12120         eval $setvar
12121
12122         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12123                 val="$define"
12124         else
12125                 val="$undef"
12126         fi
12127         set d_pwcomment
12128         eval $setvar
12129
12130         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12131                 val="$define"
12132         else
12133                 val="$undef"
12134         fi
12135         set d_pwgecos
12136         eval $setvar
12137
12138         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12139                 val="$define"
12140         else
12141                 val="$undef"
12142         fi
12143         set d_pwpasswd
12144         eval $setvar
12145
12146         $rm -f $$.h
12147         ;;
12148 *)
12149         val="$undef"; 
12150         set d_pwquota; eval $setvar
12151         set d_pwage; eval $setvar
12152         set d_pwchange; eval $setvar
12153         set d_pwclass; eval $setvar
12154         set d_pwexpire; eval $setvar
12155         set d_pwcomment; eval $setvar
12156         set d_pwgecos; eval $setvar
12157         set d_pwpasswd; eval $setvar
12158         ;;
12159 esac
12160
12161 : see if endpwent_r exists
12162 set endpwent_r d_endpwent_r
12163 eval $inlibc
12164 case "$d_endpwent_r" in
12165 "$define")
12166         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12167         case "$d_endpwent_r_proto:$usethreads" in
12168         ":define")      d_endpwent_r_proto=define
12169                 set d_endpwent_r_proto endpwent_r $hdrs
12170                 eval $hasproto ;;
12171         *)      ;;
12172         esac
12173         case "$d_endpwent_r_proto" in
12174         define)
12175         case "$endpwent_r_proto" in
12176         ''|0) try='int endpwent_r(FILE**);'
12177         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
12178         esac
12179         case "$endpwent_r_proto" in
12180         ''|0) try='void endpwent_r(FILE**);'
12181         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
12182         esac
12183         case "$endpwent_r_proto" in
12184         ''|0)   d_endpwent_r=undef
12185                 endpwent_r_proto=0
12186                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12187         * )     case "$endpwent_r_proto" in
12188                 REENTRANT_PROTO*) ;;
12189                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12190                 esac
12191                 echo "Prototype: $try" ;;
12192         esac
12193         ;;
12194         *)      case "$usethreads" in
12195                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12196                 esac
12197                 d_endpwent_r=undef
12198                 endpwent_r_proto=0
12199                 ;;
12200         esac
12201         ;;
12202 *)      endpwent_r_proto=0
12203         ;;
12204 esac
12205
12206 : see if endservent exists
12207 set endservent d_endsent
12208 eval $inlibc
12209
12210 : see if endservent_r exists
12211 set endservent_r d_endservent_r
12212 eval $inlibc
12213 case "$d_endservent_r" in
12214 "$define")
12215         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12216         case "$d_endservent_r_proto:$usethreads" in
12217         ":define")      d_endservent_r_proto=define
12218                 set d_endservent_r_proto endservent_r $hdrs
12219                 eval $hasproto ;;
12220         *)      ;;
12221         esac
12222         case "$d_endservent_r_proto" in
12223         define)
12224         case "$endservent_r_proto" in
12225         ''|0) try='int endservent_r(struct servent_data*);'
12226         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
12227         esac
12228         case "$endservent_r_proto" in
12229         ''|0) try='void endservent_r(struct servent_data*);'
12230         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
12231         esac
12232         case "$endservent_r_proto" in
12233         ''|0)   d_endservent_r=undef
12234                 endservent_r_proto=0
12235                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12236         * )     case "$endservent_r_proto" in
12237                 REENTRANT_PROTO*) ;;
12238                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12239                 esac
12240                 echo "Prototype: $try" ;;
12241         esac
12242         ;;
12243         *)      case "$usethreads" in
12244                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12245                 esac
12246                 d_endservent_r=undef
12247                 endservent_r_proto=0
12248                 ;;
12249         esac
12250         ;;
12251 *)      endservent_r_proto=0
12252         ;;
12253 esac
12254
12255 : Locate the flags for 'open()'
12256 echo " "
12257 $cat >try.c <<EOCP
12258 #include <sys/types.h>
12259 #ifdef I_FCNTL
12260 #include <fcntl.h>
12261 #endif
12262 #ifdef I_SYS_FILE
12263 #include <sys/file.h>
12264 #endif
12265 #$i_stdlib I_STDLIB
12266 #ifdef I_STDLIB
12267 #include <stdlib.h>
12268 #endif
12269 int main() {
12270         if(O_RDONLY);
12271 #ifdef O_TRUNC
12272         exit(0);
12273 #else
12274         exit(1);
12275 #endif
12276 }
12277 EOCP
12278 : check sys/file.h first to get FREAD on Sun
12279 if $test `./findhdr sys/file.h` && \
12280                 set try -DI_SYS_FILE && eval $compile; then
12281         h_sysfile=true;
12282         echo "<sys/file.h> defines the O_* constants..." >&4
12283         if $run ./try; then
12284                 echo "and you have the 3 argument form of open()." >&4
12285                 val="$define"
12286         else
12287                 echo "but not the 3 argument form of open().  Oh, well." >&4
12288                 val="$undef"
12289         fi
12290 elif $test `./findhdr fcntl.h` && \
12291                 set try -DI_FCNTL && eval $compile; then
12292         h_fcntl=true;
12293         echo "<fcntl.h> defines the O_* constants..." >&4
12294         if $run ./try; then
12295                 echo "and you have the 3 argument form of open()." >&4
12296                 val="$define"
12297         else
12298                 echo "but not the 3 argument form of open().  Oh, well." >&4
12299                 val="$undef"
12300         fi
12301 else
12302         val="$undef"
12303         echo "I can't find the O_* constant definitions!  You got problems." >&4
12304 fi
12305 set d_open3
12306 eval $setvar
12307 $rm_try
12308
12309 : script used to emit important warnings
12310 cat >warn <<EOS
12311 $startsh
12312 if test \$# -gt 0; then
12313         echo "\$@" >msg
12314 else
12315         cat >msg
12316 fi
12317 echo "*** WARNING:" >&4
12318 sed -e 's/^/*** /' <msg >&4
12319 echo "*** " >&4
12320 cat msg >>config.msg
12321 echo " " >>config.msg
12322 rm -f msg
12323 EOS
12324 chmod +x warn
12325 $eunicefix warn
12326
12327 : see which of string.h or strings.h is needed
12328 echo " "
12329 strings=`./findhdr string.h`
12330 if $test "$strings" && $test -r "$strings"; then
12331         echo "Using <string.h> instead of <strings.h>." >&4
12332         val="$define"
12333 else
12334         val="$undef"
12335         strings=`./findhdr strings.h`
12336         if $test "$strings" && $test -r "$strings"; then
12337                 echo "Using <strings.h> instead of <string.h>." >&4
12338         else
12339                 ./warn "No string header found -- You'll surely have problems."
12340         fi
12341 fi
12342 set i_string
12343 eval $setvar
12344 case "$i_string" in
12345 "$undef") strings=`./findhdr strings.h`;;
12346 *)        strings=`./findhdr string.h`;;
12347 esac
12348
12349 : see if this is a sys/file.h system
12350 val=''
12351 set sys/file.h val
12352 eval $inhdr
12353
12354 : do we need to include sys/file.h ?
12355 case "$val" in
12356 "$define")
12357         echo " "
12358         if $h_sysfile; then
12359                 val="$define"
12360                 echo "We'll be including <sys/file.h>." >&4
12361         else
12362                 val="$undef"
12363                 echo "We won't be including <sys/file.h>." >&4
12364         fi
12365         ;;
12366 *)
12367         h_sysfile=false
12368         ;;
12369 esac
12370 set i_sysfile
12371 eval $setvar
12372
12373 : see if fcntl.h is there
12374 val=''
12375 set fcntl.h val
12376 eval $inhdr
12377
12378 : see if we can include fcntl.h
12379 case "$val" in
12380 "$define")
12381         echo " "
12382         if $h_fcntl; then
12383                 val="$define"
12384                 echo "We'll be including <fcntl.h>." >&4
12385         else
12386                 val="$undef"
12387                 if $h_sysfile; then
12388         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12389                 else
12390                         echo "We won't be including <fcntl.h>." >&4
12391                 fi
12392         fi
12393         ;;
12394 *)
12395         h_fcntl=false
12396         val="$undef"
12397         ;;
12398 esac
12399 set i_fcntl
12400 eval $setvar
12401
12402 : see if fork exists
12403 set fork d_fork
12404 eval $inlibc
12405
12406 : see if pipe exists
12407 set pipe d_pipe
12408 eval $inlibc
12409
12410 : check for non-blocking I/O stuff
12411 case "$h_sysfile" in
12412 true) echo "#include <sys/file.h>" > head.c;;
12413 *)
12414        case "$h_fcntl" in
12415        true) echo "#include <fcntl.h>" > head.c;;
12416        *) echo "#include <sys/fcntl.h>" > head.c;;
12417        esac
12418        ;;
12419 esac
12420 echo " "
12421 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12422 case "$o_nonblock" in
12423 '')
12424         $cat head.c > try.c
12425         $cat >>try.c <<EOCP
12426 #include <stdio.h>
12427 #$i_stdlib I_STDLIB
12428 #ifdef I_STDLIB
12429 #include <stdlib.h>
12430 #endif
12431 #$i_fcntl I_FCNTL
12432 #ifdef I_FCNTL
12433 #include <fcntl.h>
12434 #endif
12435 int main() {
12436 #ifdef O_NONBLOCK
12437         printf("O_NONBLOCK\n");
12438         exit(0);
12439 #endif
12440 #ifdef O_NDELAY
12441         printf("O_NDELAY\n");
12442         exit(0);
12443 #endif
12444 #ifdef FNDELAY
12445         printf("FNDELAY\n");
12446         exit(0);
12447 #endif
12448         exit(0);
12449 }
12450 EOCP
12451         set try
12452         if eval $compile_ok; then
12453                 o_nonblock=`$run ./try`
12454                 case "$o_nonblock" in
12455                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12456                 *) echo "Seems like we can use $o_nonblock.";;
12457                 esac
12458         else
12459                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12460         fi
12461         ;;
12462 *) echo "Using $hint value $o_nonblock.";;
12463 esac
12464 $rm_try
12465
12466 echo " "
12467 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12468 case "$eagain" in
12469 '')
12470         case "$d_fork:$d_pipe" in
12471         define:define)
12472         $cat head.c > try.c
12473         $cat >>try.c <<EOCP
12474 #include <errno.h>
12475 #include <sys/types.h>
12476 #include <signal.h>
12477 #include <stdio.h>
12478 #$i_stdlib I_STDLIB
12479 #ifdef I_STDLIB
12480 #include <stdlib.h>
12481 #endif
12482 #$i_fcntl I_FCNTL
12483 #ifdef I_FCNTL
12484 #include <fcntl.h>
12485 #endif
12486 #define MY_O_NONBLOCK $o_nonblock
12487 #ifndef errno  /* XXX need better Configure test */
12488 extern int errno;
12489 #endif
12490 #$i_unistd I_UNISTD
12491 #ifdef I_UNISTD
12492 #include <unistd.h>
12493 #endif
12494 #$i_string I_STRING
12495 #ifdef I_STRING
12496 #include <string.h>
12497 #else
12498 #include <strings.h>
12499 #endif
12500 $signal_t blech(int x) { exit(3); }
12501 EOCP
12502         $cat >> try.c <<'EOCP'
12503 int main()
12504 {
12505         int pd[2];
12506         int pu[2];
12507         char buf[1];
12508         char string[100];
12509
12510         pipe(pd);       /* Down: child -> parent */
12511         pipe(pu);       /* Up: parent -> child */
12512         if (0 != fork()) {
12513                 int ret;
12514                 close(pd[1]);   /* Parent reads from pd[0] */
12515                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12516 #ifdef F_SETFL
12517                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12518                         exit(1);
12519 #else
12520                 exit(4);
12521 #endif
12522                 signal(SIGALRM, blech);
12523                 alarm(5);
12524                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12525                         exit(2);
12526                 sprintf(string, "%d\n", ret);
12527                 write(2, string, strlen(string));
12528                 alarm(0);
12529 #ifdef EAGAIN
12530                 if (errno == EAGAIN) {
12531                         printf("EAGAIN\n");
12532                         goto ok;
12533                 }
12534 #endif
12535 #ifdef EWOULDBLOCK
12536                 if (errno == EWOULDBLOCK)
12537                         printf("EWOULDBLOCK\n");
12538 #endif
12539         ok:
12540                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12541                 sleep(2);                               /* Give it time to close our pipe */
12542                 alarm(5);
12543                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12544                 alarm(0);
12545                 sprintf(string, "%d\n", ret);
12546                 write(4, string, strlen(string));
12547                 exit(0);
12548         }
12549
12550         close(pd[0]);                   /* We write to pd[1] */
12551         close(pu[1]);                   /* We read from pu[0] */
12552         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12553         close(pd[1]);                   /* Pipe pd is now fully closed! */
12554         exit(0);                                /* Bye bye, thank you for playing! */
12555 }
12556 EOCP
12557         set try
12558         if eval $compile_ok; then
12559                 echo "$startsh" >mtry
12560                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12561                 chmod +x mtry
12562                 ./mtry >/dev/null 2>&1
12563                 case $? in
12564                 0) eagain=`$cat try.out`;;
12565                 1) echo "Could not perform non-blocking setting!";;
12566                 2) echo "I did a successful read() for something that was not there!";;
12567                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12568                 4) echo "Could not find F_SETFL!";;
12569                 *) echo "Something terribly wrong happened during testing.";;
12570                 esac
12571                 rd_nodata=`$cat try.ret`
12572                 echo "A read() system call with no data present returns $rd_nodata."
12573                 case "$rd_nodata" in
12574                 0|-1) ;;
12575                 *)
12576                         echo "(That's peculiar, fixing that to be -1.)"
12577                         rd_nodata=-1
12578                         ;;
12579                 esac
12580                 case "$eagain" in
12581                 '')
12582                         echo "Forcing errno EAGAIN on read() with no data available."
12583                         eagain=EAGAIN
12584                         ;;
12585                 *)
12586                         echo "Your read() sets errno to $eagain when no data is available."
12587                         ;;
12588                 esac
12589                 status=`$cat try.err`
12590                 case "$status" in
12591                 0) echo "And it correctly returns 0 to signal EOF.";;
12592                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12593                 *) echo "However, your read() returns '$status' on EOF??";;
12594                 esac
12595                 val="$define"
12596                 if test "$status" = "$rd_nodata"; then
12597                         echo "WARNING: you can't distinguish between EOF and no data!"
12598                         val="$undef"
12599                 fi
12600         else
12601                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12602                 eagain=EAGAIN
12603         fi
12604         ;;
12605         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12606                 eagain=EAGAIN
12607                 val="$define"
12608                 ;;
12609         esac
12610         set d_eofnblk
12611         eval $setvar
12612         ;;
12613 *)
12614         echo "Using $hint value $eagain."
12615         echo "Your read() returns $rd_nodata when no data is present."
12616         case "$d_eofnblk" in
12617         "$define") echo "And you can see EOF because read() returns 0.";;
12618         "$undef") echo "But you can't see EOF status from read() returned value.";;
12619         *)
12620                 echo "(Assuming you can't see EOF status from read anyway.)"
12621                 d_eofnblk=$undef
12622                 ;;
12623         esac
12624         ;;
12625 esac
12626 $rm_try head.c mtry
12627
12628 : see if _ptr and _cnt from stdio act std
12629 echo " "
12630
12631 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12632         echo "(Looks like you have stdio.h from BSD.)"
12633         case "$stdio_ptr" in
12634         '') stdio_ptr='((fp)->_p)'
12635                 ptr_lval=$define
12636                 ;;
12637         *)      ptr_lval=$d_stdio_ptr_lval;;
12638         esac
12639         case "$stdio_cnt" in
12640         '') stdio_cnt='((fp)->_r)'
12641                 cnt_lval=$define
12642                 ;;
12643         *)      cnt_lval=$d_stdio_cnt_lval;;
12644         esac
12645         case "$stdio_base" in
12646         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12647         esac
12648         case "$stdio_bufsiz" in
12649         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12650         esac
12651 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12652         echo "(Looks like you have stdio.h from Linux.)"
12653         case "$stdio_ptr" in
12654         '') stdio_ptr='((fp)->_IO_read_ptr)'
12655                 ptr_lval=$define
12656                 ;;
12657         *)      ptr_lval=$d_stdio_ptr_lval;;
12658         esac
12659         case "$stdio_cnt" in
12660         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12661                 cnt_lval=$undef
12662                 ;;
12663         *)      cnt_lval=$d_stdio_cnt_lval;;
12664         esac
12665         case "$stdio_base" in
12666         '') stdio_base='((fp)->_IO_read_base)';;
12667         esac
12668         case "$stdio_bufsiz" in
12669         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12670         esac
12671 else
12672         case "$stdio_ptr" in
12673         '') stdio_ptr='((fp)->_ptr)'
12674                 ptr_lval=$define
12675                 ;;
12676         *)      ptr_lval=$d_stdio_ptr_lval;;
12677         esac
12678         case "$stdio_cnt" in
12679         '') stdio_cnt='((fp)->_cnt)'
12680                 cnt_lval=$define
12681                 ;;
12682         *)      cnt_lval=$d_stdio_cnt_lval;;
12683         esac
12684         case "$stdio_base" in
12685         '') stdio_base='((fp)->_base)';;
12686         esac
12687         case "$stdio_bufsiz" in
12688         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12689         esac
12690 fi
12691
12692 : test whether _ptr and _cnt really work
12693 echo "Checking how std your stdio is..." >&4
12694 $cat >try.c <<EOP
12695 #include <stdio.h>
12696 #$i_stdlib I_STDLIB
12697 #ifdef I_STDLIB
12698 #include <stdlib.h>
12699 #endif
12700 #define FILE_ptr(fp)    $stdio_ptr
12701 #define FILE_cnt(fp)    $stdio_cnt
12702 int main() {
12703         FILE *fp = fopen("try.c", "r");
12704         char c = getc(fp);
12705         if (
12706                 18 <= FILE_cnt(fp) &&
12707                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12708         )
12709                 exit(0);
12710         exit(1);
12711 }
12712 EOP
12713 val="$undef"
12714 set try
12715 if eval $compile && $to try.c; then
12716         if $run ./try; then
12717                 echo "Your stdio acts pretty std."
12718                 val="$define"
12719         else
12720                 echo "Your stdio isn't very std."
12721         fi
12722 else
12723         echo "Your stdio doesn't appear very std."
12724 fi
12725 $rm_try
12726
12727 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12728 # direct buffer manipulation no longer works.  The Configure tests
12729 # should be changed to correctly detect this, but until then,
12730 # the following check should at least let perl compile and run.
12731 # (This quick fix should be updated before 5.8.1.)
12732 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12733 # A. Dougherty, June 3, 2002.
12734 case "$d_gnulibc" in
12735 $define)
12736         case "$gnulibc_version" in
12737         2.[01]*)  ;;
12738         2.2) ;;
12739         2.2.[0-9]) ;;
12740         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12741                 val="$undef"
12742                 ;;
12743         esac
12744         ;;
12745 esac
12746 set d_stdstdio
12747 eval $setvar
12748
12749 : Can _ptr be used as an lvalue?
12750 case "$d_stdstdio$ptr_lval" in
12751 $define$define) val=$define ;;
12752 *) val=$undef ;;
12753 esac
12754 set d_stdio_ptr_lval
12755 eval $setvar
12756
12757 : Can _cnt be used as an lvalue?
12758 case "$d_stdstdio$cnt_lval" in
12759 $define$define) val=$define ;;
12760 *) val=$undef ;;
12761 esac
12762 set d_stdio_cnt_lval
12763 eval $setvar
12764
12765
12766 : test whether setting _ptr sets _cnt as a side effect
12767 d_stdio_ptr_lval_sets_cnt="$undef"
12768 d_stdio_ptr_lval_nochange_cnt="$undef"
12769 case "$d_stdio_ptr_lval$d_stdstdio" in
12770 $define$define)
12771         echo "Checking to see what happens if we set the stdio ptr..." >&4
12772 $cat >try.c <<EOP
12773 #include <stdio.h>
12774 /* Can we scream? */
12775 /* Eat dust sed :-) */
12776 /* In the buffer space, no one can hear you scream. */
12777 #$i_stdlib I_STDLIB
12778 #ifdef I_STDLIB
12779 #include <stdlib.h>
12780 #endif
12781 #define FILE_ptr(fp)    $stdio_ptr
12782 #define FILE_cnt(fp)    $stdio_cnt
12783 #include <sys/types.h>
12784 int main() {
12785         FILE *fp = fopen("try.c", "r");
12786         int c;
12787         char *ptr;
12788         size_t cnt;
12789         if (!fp) {
12790             puts("Fail even to read");
12791             exit(1);
12792         }
12793         c = getc(fp); /* Read away the first # */
12794         if (c == EOF) {
12795             puts("Fail even to read");
12796             exit(1);
12797         }
12798         if (!(
12799                 18 <= FILE_cnt(fp) &&
12800                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12801         )) {
12802                 puts("Fail even to read");
12803                 exit (1);
12804         }
12805         ptr = (char*) FILE_ptr(fp);
12806         cnt = (size_t)FILE_cnt(fp);
12807
12808         FILE_ptr(fp) += 42;
12809
12810         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12811                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12812                 exit (1);
12813         }
12814         if (FILE_cnt(fp) <= 20) {
12815                 printf ("Fail (<20 chars to test)");
12816                 exit (1);
12817         }
12818         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12819                 puts("Fail compare");
12820                 exit (1);
12821         }
12822         if (cnt == FILE_cnt(fp)) {
12823                 puts("Pass_unchanged");
12824                 exit (0);
12825         }
12826         if (FILE_cnt(fp) == (cnt - 42)) {
12827                 puts("Pass_changed");
12828                 exit (0);
12829         }
12830         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12831         return 1;
12832
12833 }
12834 EOP
12835         set try
12836         if eval $compile && $to try.c; then
12837                 case `$run ./try` in
12838                 Pass_changed)
12839                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12840                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12841                 Pass_unchanged)
12842                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12843                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12844                 Fail*)
12845                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12846                 *)
12847                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12848         esac
12849         else
12850                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12851         fi
12852         $rm_try
12853         ;;
12854 esac
12855
12856 : see if _base is also standard
12857 val="$undef"
12858 case "$d_stdstdio" in
12859 $define)
12860         $cat >try.c <<EOP
12861 #include <stdio.h>
12862 #$i_stdlib I_STDLIB
12863 #ifdef I_STDLIB
12864 #include <stdlib.h>
12865 #endif
12866 #define FILE_base(fp)   $stdio_base
12867 #define FILE_bufsiz(fp) $stdio_bufsiz
12868 int main() {
12869         FILE *fp = fopen("try.c", "r");
12870         char c = getc(fp);
12871         if (
12872                 19 <= FILE_bufsiz(fp) &&
12873                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12874         )
12875                 exit(0);
12876         exit(1);
12877 }
12878 EOP
12879         set try
12880         if eval $compile && $to try.c; then
12881                 if $run ./try; then
12882                         echo "And its _base field acts std."
12883                         val="$define"
12884                 else
12885                         echo "But its _base field isn't std."
12886                 fi
12887         else
12888                 echo "However, it seems to be lacking the _base field."
12889         fi
12890         $rm_try
12891         ;;
12892 esac
12893 set d_stdiobase
12894 eval $setvar
12895
12896 : see if fast_stdio exists
12897 val="$undef"
12898 case "$d_stdstdio:$d_stdio_ptr_lval" in
12899 "$define:$define")
12900         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12901         *$define*)
12902                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12903                 val="$define"
12904                 ;;
12905         esac
12906         ;;
12907 esac
12908 set d_faststdio
12909 eval $setvar
12910
12911
12912
12913 : see if fchdir exists
12914 set fchdir d_fchdir
12915 eval $inlibc
12916
12917 : see if fchmod exists
12918 set fchmod d_fchmod
12919 eval $inlibc
12920
12921 : see if fchown exists
12922 set fchown d_fchown
12923 eval $inlibc
12924
12925 : see if this is an fcntl system
12926 set fcntl d_fcntl
12927 eval $inlibc
12928
12929 : See if fcntl-based locking works.
12930 echo " "
12931 $cat >try.c <<EOCP
12932 #$i_stdlib I_STDLIB
12933 #ifdef I_STDLIB
12934 #include <stdlib.h>
12935 #endif
12936 #include <unistd.h>
12937 #include <fcntl.h>
12938 #include <signal.h>
12939 $signal_t blech(int x) { exit(3); }
12940 int main() {
12941 #if defined(F_SETLK) && defined(F_SETLKW)
12942      struct flock flock;
12943      int retval, fd;
12944      fd = open("try.c", O_RDONLY);
12945      flock.l_type = F_RDLCK;
12946      flock.l_whence = SEEK_SET;
12947      flock.l_start = flock.l_len = 0;
12948      signal(SIGALRM, blech);
12949      alarm(10);
12950      retval = fcntl(fd, F_SETLK, &flock);
12951      close(fd);
12952      (retval < 0 ? exit(2) : exit(0));
12953 #else
12954      exit(2);
12955 #endif
12956 }
12957 EOCP
12958 echo "Checking if fcntl-based file locking works... "
12959 case "$d_fcntl" in
12960 "$define")
12961         set try
12962         if eval $compile_ok; then
12963                 if $run ./try; then
12964                         echo "Yes, it seems to work."
12965                         val="$define"
12966                 else
12967                         echo "Nope, it didn't work."
12968                         val="$undef"
12969                         case "$?" in
12970                         3) $cat >&4 <<EOM
12971 ***
12972 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12973 *** This is (almost) impossible.
12974 *** If your NFS lock daemons are not feeling well, something like
12975 *** this may happen, please investigate.  Cannot continue, aborting.
12976 ***
12977 EOM
12978                                 exit 1
12979                                 ;;
12980                         esac
12981                 fi
12982         else
12983                 echo "I'm unable to compile the test program, so I'll assume not."
12984                 val="$undef"
12985         fi
12986         ;;
12987 *) val="$undef";
12988         echo "Nope, since you don't even have fcntl()."
12989         ;;
12990 esac
12991 set d_fcntl_can_lock
12992 eval $setvar
12993 $rm_try
12994
12995 : check for fd_set items
12996 $cat <<EOM
12997
12998 Checking to see how well your C compiler handles fd_set and friends ...
12999 EOM
13000 $cat >try.c <<EOCP
13001 #$i_stdlib I_STDLIB
13002 #ifdef I_STDLIB
13003 #include <stdlib.h>
13004 #endif
13005 #$i_systime I_SYS_TIME
13006 #$i_sysselct I_SYS_SELECT
13007 #$d_socket HAS_SOCKET
13008 #include <sys/types.h>
13009 #ifdef HAS_SOCKET
13010 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13011 #endif
13012 #ifdef I_SYS_TIME
13013 #include <sys/time.h>
13014 #endif
13015 #ifdef I_SYS_SELECT
13016 #include <sys/select.h>
13017 #endif
13018 int main() {
13019         fd_set fds;
13020
13021 #ifdef TRYBITS
13022         if(fds.fds_bits);
13023 #endif
13024
13025 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13026         exit(0);
13027 #else
13028         exit(1);
13029 #endif
13030 }
13031 EOCP
13032 set try -DTRYBITS
13033 if eval $compile; then
13034         d_fds_bits="$define"
13035         d_fd_set="$define"
13036         echo "Well, your system knows about the normal fd_set typedef..." >&4
13037         if $run ./try; then
13038                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13039                 d_fd_macros="$define"
13040         else
13041                 $cat >&4 <<'EOM'
13042 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13043 EOM
13044                 d_fd_macros="$undef"
13045         fi
13046 else
13047         $cat <<'EOM'
13048 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13049 EOM
13050         set try
13051         if eval $compile; then
13052                 d_fds_bits="$undef"
13053                 d_fd_set="$define"
13054                 echo "Well, your system has some sort of fd_set available..." >&4
13055                 if $run ./try; then
13056                         echo "and you have the normal fd_set macros." >&4
13057                         d_fd_macros="$define"
13058                 else
13059                         $cat <<'EOM'
13060 but not the normal fd_set macros!  Gross!  More work for me...
13061 EOM
13062                         d_fd_macros="$undef"
13063                 fi
13064         else
13065         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13066                 d_fd_set="$undef"
13067                 d_fds_bits="$undef"
13068                 d_fd_macros="$undef"
13069         fi
13070 fi
13071 $rm_try
13072
13073 : see if fgetpos exists
13074 set fgetpos d_fgetpos
13075 eval $inlibc
13076
13077 : see if finite exists
13078 set finite d_finite
13079 eval $inlibc
13080
13081 : see if finitel exists
13082 set finitel d_finitel
13083 eval $inlibc
13084
13085 : see if flock exists
13086 set flock d_flock
13087 eval $inlibc
13088
13089 : see if prototype for flock is available
13090 echo " "
13091 set d_flockproto flock $i_sysfile sys/file.h
13092 eval $hasproto
13093
13094 : see if fp_class exists
13095 set fp_class d_fp_class
13096 eval $inlibc
13097
13098 : see if pathconf exists
13099 set pathconf d_pathconf
13100 eval $inlibc
13101
13102 : see if fpathconf exists
13103 set fpathconf d_fpathconf
13104 eval $inlibc
13105
13106 : see if fpclass exists
13107 set fpclass d_fpclass
13108 eval $inlibc
13109
13110 : see if fpclassify exists
13111 set fpclassify d_fpclassify
13112 eval $inlibc
13113
13114 : see if fpclassl exists
13115 set fpclassl d_fpclassl
13116 eval $inlibc
13117
13118 : check for fpos64_t
13119 echo " "
13120 echo "Checking to see if you have fpos64_t..." >&4
13121 $cat >try.c <<EOCP
13122 #include <stdio.h>
13123 int main() { fpos64_t x = 7; }
13124 EOCP
13125 set try
13126 if eval $compile; then
13127         val="$define"
13128         echo "You have fpos64_t."
13129 else
13130         val="$undef"
13131         echo "You do not have fpos64_t."
13132         case "$fpossize" in
13133         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13134         esac
13135 fi
13136 $rm_try
13137 set d_fpos64_t
13138 eval $setvar
13139
13140 : see if frexpl exists
13141 set frexpl d_frexpl
13142 eval $inlibc
13143
13144 : see if this is a sys/param system
13145 set sys/param.h i_sysparam
13146 eval $inhdr
13147
13148 : see if this is a sys/mount.h system
13149 set sys/mount.h i_sysmount
13150 eval $inhdr
13151
13152 : Check for fs_data_s
13153 echo " "
13154 echo "Checking to see if your system supports struct fs_data..." >&4
13155 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13156 eval $hasstruct
13157 case "$d_fs_data_s" in
13158 "$define")      echo "Yes, it does."   ;;
13159 *)              echo "No, it doesn't." ;;
13160 esac
13161
13162 : see if fseeko exists
13163 set fseeko d_fseeko
13164 eval $inlibc
13165 case "$longsize" in
13166 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13167 esac
13168
13169 : see if fsetpos exists
13170 set fsetpos d_fsetpos
13171 eval $inlibc
13172
13173 : see if fstatfs exists
13174 set fstatfs d_fstatfs
13175 eval $inlibc
13176
13177 : see if statvfs exists
13178 set statvfs d_statvfs
13179 eval $inlibc
13180
13181 : see if fstatvfs exists
13182 set fstatvfs d_fstatvfs
13183 eval $inlibc
13184
13185
13186 : see if fsync exists
13187 set fsync d_fsync
13188 eval $inlibc
13189
13190 : see if ftello exists
13191 set ftello d_ftello
13192 eval $inlibc
13193 case "$longsize" in
13194 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13195 esac
13196
13197 : check for a working futimes
13198 d_futimes="$undef"
13199 echo " "
13200 echo "Checking if you have a working futimes()" >&4
13201 $cat >try.c <<EOCP
13202 #include <stdio.h>
13203 #include <sys/time.h>
13204 #include <errno.h>
13205 #include <fcntl.h>
13206
13207 int main ()
13208 {
13209     int fd, rv;
13210     fd = open ("try.c", O_RDWR);
13211     if (-1 == fd) exit (1);
13212     rv = futimes (fd, NULL);
13213     exit (rv == -1 ? errno : 0);
13214 }
13215 EOCP
13216 set try
13217 if eval $compile; then
13218     `$run ./try`
13219     rc=$?
13220     case "$rc" in
13221         0)  echo "Yes, you have" >&4
13222             d_futimes="$define"
13223             ;;
13224         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13225             ;;
13226     esac
13227 else
13228     echo "No, it does not (probably harmless)" >&4
13229 fi
13230 $rm_try
13231
13232 : see if getcwd exists
13233 set getcwd d_getcwd
13234 eval $inlibc
13235
13236 : see if getespwnam exists
13237 set getespwnam d_getespwnam
13238 eval $inlibc
13239
13240 : see if getfsstat exists
13241 set getfsstat d_getfsstat
13242 eval $inlibc
13243
13244 : see if getgrent exists
13245 set getgrent d_getgrent
13246 eval $inlibc
13247
13248 : see if getgrent_r exists
13249 set getgrent_r d_getgrent_r
13250 eval $inlibc
13251 case "$d_getgrent_r" in
13252 "$define")
13253         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13254         case "$d_getgrent_r_proto:$usethreads" in
13255         ":define")      d_getgrent_r_proto=define
13256                 set d_getgrent_r_proto getgrent_r $hdrs
13257                 eval $hasproto ;;
13258         *)      ;;
13259         esac
13260         case "$d_getgrent_r_proto" in
13261         define)
13262         case "$getgrent_r_proto" in
13263         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13264         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13265         esac
13266         case "$getgrent_r_proto" in
13267         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13268         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13269         esac
13270         case "$getgrent_r_proto" in
13271         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13272         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
13273         esac
13274         case "$getgrent_r_proto" in
13275         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13276         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
13277         esac
13278         case "$getgrent_r_proto" in
13279         ''|0) try='int getgrent_r(struct group*, char*, int);'
13280         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
13281         esac
13282         case "$getgrent_r_proto" in
13283         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13284         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13285         esac
13286         case "$getgrent_r_proto" in
13287         ''|0)   d_getgrent_r=undef
13288                 getgrent_r_proto=0
13289                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13290         * )     case "$getgrent_r_proto" in
13291                 REENTRANT_PROTO*) ;;
13292                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13293                 esac
13294                 echo "Prototype: $try" ;;
13295         esac
13296         ;;
13297         *)      case "$usethreads" in
13298                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13299                 esac
13300                 d_getgrent_r=undef
13301                 getgrent_r_proto=0
13302                 ;;
13303         esac
13304         ;;
13305 *)      getgrent_r_proto=0
13306         ;;
13307 esac
13308
13309 : see if getgrgid_r exists
13310 set getgrgid_r d_getgrgid_r
13311 eval $inlibc
13312 case "$d_getgrgid_r" in
13313 "$define")
13314         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13315         case "$d_getgrgid_r_proto:$usethreads" in
13316         ":define")      d_getgrgid_r_proto=define
13317                 set d_getgrgid_r_proto getgrgid_r $hdrs
13318                 eval $hasproto ;;
13319         *)      ;;
13320         esac
13321         case "$d_getgrgid_r_proto" in
13322         define)
13323         case "$getgrgid_r_proto" in
13324         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13325         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13326         esac
13327         case "$getgrgid_r_proto" in
13328         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13329         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13330         esac
13331         case "$getgrgid_r_proto" in
13332         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13333         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13334         esac
13335         case "$getgrgid_r_proto" in
13336         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13337         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13338         esac
13339         case "$getgrgid_r_proto" in
13340         ''|0)   d_getgrgid_r=undef
13341                 getgrgid_r_proto=0
13342                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13343         * )     case "$getgrgid_r_proto" in
13344                 REENTRANT_PROTO*) ;;
13345                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13346                 esac
13347                 echo "Prototype: $try" ;;
13348         esac
13349         ;;
13350         *)      case "$usethreads" in
13351                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13352                 esac
13353                 d_getgrgid_r=undef
13354                 getgrgid_r_proto=0
13355                 ;;
13356         esac
13357         ;;
13358 *)      getgrgid_r_proto=0
13359         ;;
13360 esac
13361
13362 : see if getgrnam_r exists
13363 set getgrnam_r d_getgrnam_r
13364 eval $inlibc
13365 case "$d_getgrnam_r" in
13366 "$define")
13367         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13368         case "$d_getgrnam_r_proto:$usethreads" in
13369         ":define")      d_getgrnam_r_proto=define
13370                 set d_getgrnam_r_proto getgrnam_r $hdrs
13371                 eval $hasproto ;;
13372         *)      ;;
13373         esac
13374         case "$d_getgrnam_r_proto" in
13375         define)
13376         case "$getgrnam_r_proto" in
13377         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13378         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13379         esac
13380         case "$getgrnam_r_proto" in
13381         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13382         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13383         esac
13384         case "$getgrnam_r_proto" in
13385         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13386         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13387         esac
13388         case "$getgrnam_r_proto" in
13389         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13390         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13391         esac
13392         case "$getgrnam_r_proto" in
13393         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13394         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13395         esac
13396         case "$getgrnam_r_proto" in
13397         ''|0)   d_getgrnam_r=undef
13398                 getgrnam_r_proto=0
13399                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13400         * )     case "$getgrnam_r_proto" in
13401                 REENTRANT_PROTO*) ;;
13402                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13403                 esac
13404                 echo "Prototype: $try" ;;
13405         esac
13406         ;;
13407         *)      case "$usethreads" in
13408                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13409                 esac
13410                 d_getgrnam_r=undef
13411                 getgrnam_r_proto=0
13412                 ;;
13413         esac
13414         ;;
13415 *)      getgrnam_r_proto=0
13416         ;;
13417 esac
13418
13419 : see if gethostbyaddr exists
13420 set gethostbyaddr d_gethbyaddr
13421 eval $inlibc
13422
13423 : see if gethostbyname exists
13424 set gethostbyname d_gethbyname
13425 eval $inlibc
13426
13427 : see if gethostent exists
13428 set gethostent d_gethent
13429 eval $inlibc
13430
13431 : see how we will look up host name
13432 echo " "
13433 call=''
13434 if set gethostname val -f d_gethname; eval $csym; $val; then
13435         echo 'gethostname() found.' >&4
13436         d_gethname="$define"
13437         call=gethostname
13438 fi
13439 if set uname val -f d_uname; eval $csym; $val; then
13440         if ./xenix; then
13441                 $cat <<'EOM'
13442 uname() was found, but you're running xenix, and older versions of xenix
13443 have a broken uname(). If you don't really know whether your xenix is old
13444 enough to have a broken system call, use the default answer.
13445
13446 EOM
13447                 dflt=y
13448                 case "$d_uname" in
13449                 "$define") dflt=n;;
13450                 esac
13451                 rp='Is your uname() broken?'
13452                 . ./myread
13453                 case "$ans" in
13454                 n*) d_uname="$define"; call=uname;;
13455                 esac
13456         else
13457                 echo 'uname() found.' >&4
13458                 d_uname="$define"
13459                 case "$call" in
13460                 '') call=uname ;;
13461                 esac
13462         fi
13463 fi
13464 case "$d_gethname" in
13465 '') d_gethname="$undef";;
13466 esac
13467 case "$d_uname" in
13468 '') d_uname="$undef";;
13469 esac
13470 case "$d_uname$d_gethname" in
13471 *define*)
13472         dflt=n
13473         cat <<EOM
13474
13475 Every now and then someone has a $call() that lies about the hostname
13476 but can't be fixed for political or economic reasons.  If you wish, I can
13477 pretend $call() isn't there and maybe compute hostname at run-time
13478 thanks to the '$phostname' command.
13479
13480 EOM
13481         rp="Shall I ignore $call() from now on?"
13482         . ./myread
13483         case "$ans" in
13484         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13485         esac;;
13486 esac
13487 case "$phostname" in
13488 '') aphostname='';;
13489 *) case "$aphostname" in
13490         /*) ;;
13491         *) set X $phostname
13492                 shift
13493                 file=$1
13494                 shift
13495                 file=`./loc $file $file $pth`
13496                 aphostname=`echo $file $*`
13497                 ;;
13498         esac
13499         ;;
13500 esac
13501 case "$d_uname$d_gethname" in
13502 *define*) ;;
13503 *)
13504         case "$phostname" in
13505         '')
13506                 echo "There will be no way for $package to get your hostname." >&4;;
13507         *)
13508         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13509                 ;;
13510         esac;;
13511 esac
13512 case "$d_phostname" in
13513 '') d_phostname="$undef";;
13514 esac
13515
13516 : see if gethostbyaddr_r exists
13517 set gethostbyaddr_r d_gethostbyaddr_r
13518 eval $inlibc
13519 case "$d_gethostbyaddr_r" in
13520 "$define")
13521         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13522         case "$d_gethostbyaddr_r_proto:$usethreads" in
13523         ":define")      d_gethostbyaddr_r_proto=define
13524                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13525                 eval $hasproto ;;
13526         *)      ;;
13527         esac
13528         case "$d_gethostbyaddr_r_proto" in
13529         define)
13530         case "$gethostbyaddr_r_proto" in
13531         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13532         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13533         esac
13534         case "$gethostbyaddr_r_proto" in
13535         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13536         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13537         esac
13538         case "$gethostbyaddr_r_proto" in
13539         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13540         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13541         esac
13542         case "$gethostbyaddr_r_proto" in
13543         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13544         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13545         esac
13546         case "$gethostbyaddr_r_proto" in
13547         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13548         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13549         esac
13550         case "$gethostbyaddr_r_proto" in
13551         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13552         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13553         esac
13554         case "$gethostbyaddr_r_proto" in
13555         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13556         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13557         esac
13558         case "$gethostbyaddr_r_proto" in
13559         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13560         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13561         esac
13562         case "$gethostbyaddr_r_proto" in
13563         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13564         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13565         esac
13566         case "$gethostbyaddr_r_proto" in
13567         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13568         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13569         esac
13570         case "$gethostbyaddr_r_proto" in
13571         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13572         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13573         esac
13574         case "$gethostbyaddr_r_proto" in
13575         ''|0)   d_gethostbyaddr_r=undef
13576                 gethostbyaddr_r_proto=0
13577                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13578         * )     case "$gethostbyaddr_r_proto" in
13579                 REENTRANT_PROTO*) ;;
13580                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13581                 esac
13582                 echo "Prototype: $try" ;;
13583         esac
13584         ;;
13585         *)      case "$usethreads" in
13586                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13587                 esac
13588                 d_gethostbyaddr_r=undef
13589                 gethostbyaddr_r_proto=0
13590                 ;;
13591         esac
13592         ;;
13593 *)      gethostbyaddr_r_proto=0
13594         ;;
13595 esac
13596
13597 : see if gethostbyname_r exists
13598 set gethostbyname_r d_gethostbyname_r
13599 eval $inlibc
13600 case "$d_gethostbyname_r" in
13601 "$define")
13602         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13603         case "$d_gethostbyname_r_proto:$usethreads" in
13604         ":define")      d_gethostbyname_r_proto=define
13605                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13606                 eval $hasproto ;;
13607         *)      ;;
13608         esac
13609         case "$d_gethostbyname_r_proto" in
13610         define)
13611         case "$gethostbyname_r_proto" in
13612         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13613         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13614         esac
13615         case "$gethostbyname_r_proto" in
13616         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13617         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13618         esac
13619         case "$gethostbyname_r_proto" in
13620         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13621         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13622         esac
13623         case "$gethostbyname_r_proto" in
13624         ''|0)   d_gethostbyname_r=undef
13625                 gethostbyname_r_proto=0
13626                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13627         * )     case "$gethostbyname_r_proto" in
13628                 REENTRANT_PROTO*) ;;
13629                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13630                 esac
13631                 echo "Prototype: $try" ;;
13632         esac
13633         ;;
13634         *)      case "$usethreads" in
13635                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13636                 esac
13637                 d_gethostbyname_r=undef
13638                 gethostbyname_r_proto=0
13639                 ;;
13640         esac
13641         ;;
13642 *)      gethostbyname_r_proto=0
13643         ;;
13644 esac
13645
13646 : see if gethostent_r exists
13647 set gethostent_r d_gethostent_r
13648 eval $inlibc
13649 case "$d_gethostent_r" in
13650 "$define")
13651         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13652         case "$d_gethostent_r_proto:$usethreads" in
13653         ":define")      d_gethostent_r_proto=define
13654                 set d_gethostent_r_proto gethostent_r $hdrs
13655                 eval $hasproto ;;
13656         *)      ;;
13657         esac
13658         case "$d_gethostent_r_proto" in
13659         define)
13660         case "$gethostent_r_proto" in
13661         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13662         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13663         esac
13664         case "$gethostent_r_proto" in
13665         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13666         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13667         esac
13668         case "$gethostent_r_proto" in
13669         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13670         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13671         esac
13672         case "$gethostent_r_proto" in
13673         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13674         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13675         esac
13676         case "$gethostent_r_proto" in
13677         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13678         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13679         esac
13680         case "$gethostent_r_proto" in
13681         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13682         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13683         esac
13684         case "$gethostent_r_proto" in
13685         ''|0)   d_gethostent_r=undef
13686                 gethostent_r_proto=0
13687                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13688         * )     case "$gethostent_r_proto" in
13689                 REENTRANT_PROTO*) ;;
13690                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13691                 esac
13692                 echo "Prototype: $try" ;;
13693         esac
13694         ;;
13695         *)      case "$usethreads" in
13696                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13697                 esac
13698                 d_gethostent_r=undef
13699                 gethostent_r_proto=0
13700                 ;;
13701         esac
13702         ;;
13703 *)      gethostent_r_proto=0
13704         ;;
13705 esac
13706
13707 : see if prototypes for various gethostxxx netdb.h functions are available
13708 echo " "
13709 set d_gethostprotos gethostent $i_netdb netdb.h
13710 eval $hasproto
13711
13712 : see if getitimer exists
13713 set getitimer d_getitimer
13714 eval $inlibc
13715
13716 : see if getlogin exists
13717 set getlogin d_getlogin
13718 eval $inlibc
13719
13720 : see if getlogin_r exists
13721 set getlogin_r d_getlogin_r
13722 eval $inlibc
13723 case "$d_getlogin_r" in
13724 "$define")
13725         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13726         case "$d_getlogin_r_proto:$usethreads" in
13727         ":define")      d_getlogin_r_proto=define
13728                 set d_getlogin_r_proto getlogin_r $hdrs
13729                 eval $hasproto ;;
13730         *)      ;;
13731         esac
13732         case "$d_getlogin_r_proto" in
13733         define)
13734         case "$getlogin_r_proto" in
13735         ''|0) try='int getlogin_r(char*, size_t);'
13736         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13737         esac
13738         case "$getlogin_r_proto" in
13739         ''|0) try='int getlogin_r(char*, int);'
13740         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13741         esac
13742         case "$getlogin_r_proto" in
13743         ''|0) try='char* getlogin_r(char*, size_t);'
13744         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13745         esac
13746         case "$getlogin_r_proto" in
13747         ''|0) try='char* getlogin_r(char*, int);'
13748         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13749         esac
13750         case "$getlogin_r_proto" in
13751         ''|0)   d_getlogin_r=undef
13752                 getlogin_r_proto=0
13753                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13754         * )     case "$getlogin_r_proto" in
13755                 REENTRANT_PROTO*) ;;
13756                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13757                 esac
13758                 echo "Prototype: $try" ;;
13759         esac
13760         ;;
13761         *)      case "$usethreads" in
13762                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13763                 esac
13764                 d_getlogin_r=undef
13765                 getlogin_r_proto=0
13766                 ;;
13767         esac
13768         ;;
13769 *)      getlogin_r_proto=0
13770         ;;
13771 esac
13772
13773 : see if getmnt exists
13774 set getmnt d_getmnt
13775 eval $inlibc
13776
13777 : see if getmntent exists
13778 set getmntent d_getmntent
13779 eval $inlibc
13780
13781 : see if getnetbyaddr exists
13782 set getnetbyaddr d_getnbyaddr
13783 eval $inlibc
13784
13785 : see if getnetbyname exists
13786 set getnetbyname d_getnbyname
13787 eval $inlibc
13788
13789 : see if getnetent exists
13790 set getnetent d_getnent
13791 eval $inlibc
13792
13793 : see if getnetbyaddr_r exists
13794 set getnetbyaddr_r d_getnetbyaddr_r
13795 eval $inlibc
13796 case "$d_getnetbyaddr_r" in
13797 "$define")
13798         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13799         case "$d_getnetbyaddr_r_proto:$usethreads" in
13800         ":define")      d_getnetbyaddr_r_proto=define
13801                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13802                 eval $hasproto ;;
13803         *)      ;;
13804         esac
13805         case "$d_getnetbyaddr_r_proto" in
13806         define)
13807         case "$getnetbyaddr_r_proto" in
13808         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13809         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13810         esac
13811         case "$getnetbyaddr_r_proto" in
13812         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13813         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13814         esac
13815         case "$getnetbyaddr_r_proto" in
13816         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13817         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13818         esac
13819         case "$getnetbyaddr_r_proto" in
13820         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13821         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13822         esac
13823         case "$getnetbyaddr_r_proto" in
13824         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13825         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13826         esac
13827         case "$getnetbyaddr_r_proto" in
13828         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13829         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13830         esac
13831         case "$getnetbyaddr_r_proto" in
13832         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13833         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13834         esac
13835         case "$getnetbyaddr_r_proto" in
13836         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13837         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13838         esac
13839         case "$getnetbyaddr_r_proto" in
13840         ''|0)   d_getnetbyaddr_r=undef
13841                 getnetbyaddr_r_proto=0
13842                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13843         * )     case "$getnetbyaddr_r_proto" in
13844                 REENTRANT_PROTO*) ;;
13845                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13846                 esac
13847                 echo "Prototype: $try" ;;
13848         esac
13849         ;;
13850         *)      case "$usethreads" in
13851                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13852                 esac
13853                 d_getnetbyaddr_r=undef
13854                 getnetbyaddr_r_proto=0
13855                 ;;
13856         esac
13857         ;;
13858 *)      getnetbyaddr_r_proto=0
13859         ;;
13860 esac
13861
13862 : see if getnetbyname_r exists
13863 set getnetbyname_r d_getnetbyname_r
13864 eval $inlibc
13865 case "$d_getnetbyname_r" in
13866 "$define")
13867         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13868         case "$d_getnetbyname_r_proto:$usethreads" in
13869         ":define")      d_getnetbyname_r_proto=define
13870                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13871                 eval $hasproto ;;
13872         *)      ;;
13873         esac
13874         case "$d_getnetbyname_r_proto" in
13875         define)
13876         case "$getnetbyname_r_proto" in
13877         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13878         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13879         esac
13880         case "$getnetbyname_r_proto" in
13881         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13882         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13883         esac
13884         case "$getnetbyname_r_proto" in
13885         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13886         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13887         esac
13888         case "$getnetbyname_r_proto" in
13889         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13890         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13891         esac
13892         case "$getnetbyname_r_proto" in
13893         ''|0)   d_getnetbyname_r=undef
13894                 getnetbyname_r_proto=0
13895                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13896         * )     case "$getnetbyname_r_proto" in
13897                 REENTRANT_PROTO*) ;;
13898                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13899                 esac
13900                 echo "Prototype: $try" ;;
13901         esac
13902         ;;
13903         *)      case "$usethreads" in
13904                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13905                 esac
13906                 d_getnetbyname_r=undef
13907                 getnetbyname_r_proto=0
13908                 ;;
13909         esac
13910         ;;
13911 *)      getnetbyname_r_proto=0
13912         ;;
13913 esac
13914
13915 : see if getnetent_r exists
13916 set getnetent_r d_getnetent_r
13917 eval $inlibc
13918 case "$d_getnetent_r" in
13919 "$define")
13920         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13921         case "$d_getnetent_r_proto:$usethreads" in
13922         ":define")      d_getnetent_r_proto=define
13923                 set d_getnetent_r_proto getnetent_r $hdrs
13924                 eval $hasproto ;;
13925         *)      ;;
13926         esac
13927         case "$d_getnetent_r_proto" in
13928         define)
13929         case "$getnetent_r_proto" in
13930         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13931         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13932         esac
13933         case "$getnetent_r_proto" in
13934         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13935         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13936         esac
13937         case "$getnetent_r_proto" in
13938         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13939         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13940         esac
13941         case "$getnetent_r_proto" in
13942         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13943         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13944         esac
13945         case "$getnetent_r_proto" in
13946         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13947         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13948         esac
13949         case "$getnetent_r_proto" in
13950         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13951         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13952         esac
13953         case "$getnetent_r_proto" in
13954         ''|0)   d_getnetent_r=undef
13955                 getnetent_r_proto=0
13956                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13957         * )     case "$getnetent_r_proto" in
13958                 REENTRANT_PROTO*) ;;
13959                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13960                 esac
13961                 echo "Prototype: $try" ;;
13962         esac
13963         ;;
13964         *)      case "$usethreads" in
13965                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13966                 esac
13967                 d_getnetent_r=undef
13968                 getnetent_r_proto=0
13969                 ;;
13970         esac
13971         ;;
13972 *)      getnetent_r_proto=0
13973         ;;
13974 esac
13975
13976 : see if prototypes for various getnetxxx netdb.h functions are available
13977 echo " "
13978 set d_getnetprotos getnetent $i_netdb netdb.h
13979 eval $hasproto
13980
13981 : see if getpagesize exists
13982 set getpagesize d_getpagsz
13983 eval $inlibc
13984
13985 : Optional checks for getprotobyname and getprotobynumber
13986
13987 : see if getprotobyname exists
13988 set getprotobyname d_getpbyname
13989 eval $inlibc
13990
13991 : see if getprotobynumber exists
13992 set getprotobynumber d_getpbynumber
13993 eval $inlibc
13994
13995 : see if getprotoent exists
13996 set getprotoent d_getpent
13997 eval $inlibc
13998
13999 : see if getpgid exists
14000 set getpgid d_getpgid
14001 eval $inlibc
14002
14003 : see if getpgrp2 exists
14004 set getpgrp2 d_getpgrp2
14005 eval $inlibc
14006
14007 : see if getppid exists
14008 set getppid d_getppid
14009 eval $inlibc
14010
14011 : see if getpriority exists
14012 set getpriority d_getprior
14013 eval $inlibc
14014
14015 : see if getprotobyname_r exists
14016 set getprotobyname_r d_getprotobyname_r
14017 eval $inlibc
14018 case "$d_getprotobyname_r" in
14019 "$define")
14020         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14021         case "$d_getprotobyname_r_proto:$usethreads" in
14022         ":define")      d_getprotobyname_r_proto=define
14023                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14024                 eval $hasproto ;;
14025         *)      ;;
14026         esac
14027         case "$d_getprotobyname_r_proto" in
14028         define)
14029         case "$getprotobyname_r_proto" in
14030         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14031         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14032         esac
14033         case "$getprotobyname_r_proto" in
14034         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14035         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14036         esac
14037         case "$getprotobyname_r_proto" in
14038         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14039         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14040         esac
14041         case "$getprotobyname_r_proto" in
14042         ''|0)   d_getprotobyname_r=undef
14043                 getprotobyname_r_proto=0
14044                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14045         * )     case "$getprotobyname_r_proto" in
14046                 REENTRANT_PROTO*) ;;
14047                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14048                 esac
14049                 echo "Prototype: $try" ;;
14050         esac
14051         ;;
14052         *)      case "$usethreads" in
14053                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14054                 esac
14055                 d_getprotobyname_r=undef
14056                 getprotobyname_r_proto=0
14057                 ;;
14058         esac
14059         ;;
14060 *)      getprotobyname_r_proto=0
14061         ;;
14062 esac
14063
14064 : see if getprotobynumber_r exists
14065 set getprotobynumber_r d_getprotobynumber_r
14066 eval $inlibc
14067 case "$d_getprotobynumber_r" in
14068 "$define")
14069         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14070         case "$d_getprotobynumber_r_proto:$usethreads" in
14071         ":define")      d_getprotobynumber_r_proto=define
14072                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14073                 eval $hasproto ;;
14074         *)      ;;
14075         esac
14076         case "$d_getprotobynumber_r_proto" in
14077         define)
14078         case "$getprotobynumber_r_proto" in
14079         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14080         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14081         esac
14082         case "$getprotobynumber_r_proto" in
14083         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14084         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14085         esac
14086         case "$getprotobynumber_r_proto" in
14087         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14088         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14089         esac
14090         case "$getprotobynumber_r_proto" in
14091         ''|0)   d_getprotobynumber_r=undef
14092                 getprotobynumber_r_proto=0
14093                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14094         * )     case "$getprotobynumber_r_proto" in
14095                 REENTRANT_PROTO*) ;;
14096                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14097                 esac
14098                 echo "Prototype: $try" ;;
14099         esac
14100         ;;
14101         *)      case "$usethreads" in
14102                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14103                 esac
14104                 d_getprotobynumber_r=undef
14105                 getprotobynumber_r_proto=0
14106                 ;;
14107         esac
14108         ;;
14109 *)      getprotobynumber_r_proto=0
14110         ;;
14111 esac
14112
14113 : see if getprotoent_r exists
14114 set getprotoent_r d_getprotoent_r
14115 eval $inlibc
14116 case "$d_getprotoent_r" in
14117 "$define")
14118         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14119         case "$d_getprotoent_r_proto:$usethreads" in
14120         ":define")      d_getprotoent_r_proto=define
14121                 set d_getprotoent_r_proto getprotoent_r $hdrs
14122                 eval $hasproto ;;
14123         *)      ;;
14124         esac
14125         case "$d_getprotoent_r_proto" in
14126         define)
14127         case "$getprotoent_r_proto" in
14128         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14129         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14130         esac
14131         case "$getprotoent_r_proto" in
14132         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14133         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14134         esac
14135         case "$getprotoent_r_proto" in
14136         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14137         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14138         esac
14139         case "$getprotoent_r_proto" in
14140         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14141         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
14142         esac
14143         case "$getprotoent_r_proto" in
14144         ''|0)   d_getprotoent_r=undef
14145                 getprotoent_r_proto=0
14146                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14147         * )     case "$getprotoent_r_proto" in
14148                 REENTRANT_PROTO*) ;;
14149                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14150                 esac
14151                 echo "Prototype: $try" ;;
14152         esac
14153         ;;
14154         *)      case "$usethreads" in
14155                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14156                 esac
14157                 d_getprotoent_r=undef
14158                 getprotoent_r_proto=0
14159                 ;;
14160         esac
14161         ;;
14162 *)      getprotoent_r_proto=0
14163         ;;
14164 esac
14165
14166 : see if prototypes for various getprotoxxx netdb.h functions are available
14167 echo " "
14168 set d_getprotoprotos getprotoent $i_netdb netdb.h
14169 eval $hasproto
14170
14171 : see if getprpwnam exists
14172 set getprpwnam d_getprpwnam
14173 eval $inlibc
14174
14175 : see if getpwent exists
14176 set getpwent d_getpwent
14177 eval $inlibc
14178
14179 : see if getpwent_r exists
14180 set getpwent_r d_getpwent_r
14181 eval $inlibc
14182 case "$d_getpwent_r" in
14183 "$define")
14184         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14185         case "$d_getpwent_r_proto:$usethreads" in
14186         ":define")      d_getpwent_r_proto=define
14187                 set d_getpwent_r_proto getpwent_r $hdrs
14188                 eval $hasproto ;;
14189         *)      ;;
14190         esac
14191         case "$d_getpwent_r_proto" in
14192         define)
14193         case "$getpwent_r_proto" in
14194         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14195         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14196         esac
14197         case "$getpwent_r_proto" in
14198         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14199         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14200         esac
14201         case "$getpwent_r_proto" in
14202         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14203         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
14204         esac
14205         case "$getpwent_r_proto" in
14206         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14207         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
14208         esac
14209         case "$getpwent_r_proto" in
14210         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14211         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
14212         esac
14213         case "$getpwent_r_proto" in
14214         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14215         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14216         esac
14217         case "$getpwent_r_proto" in
14218         ''|0)   d_getpwent_r=undef
14219                 getpwent_r_proto=0
14220                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14221         * )     case "$getpwent_r_proto" in
14222                 REENTRANT_PROTO*) ;;
14223                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14224                 esac
14225                 echo "Prototype: $try" ;;
14226         esac
14227         ;;
14228         *)      case "$usethreads" in
14229                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14230                 esac
14231                 d_getpwent_r=undef
14232                 getpwent_r_proto=0
14233                 ;;
14234         esac
14235         ;;
14236 *)      getpwent_r_proto=0
14237         ;;
14238 esac
14239
14240 : see if getpwnam_r exists
14241 set getpwnam_r d_getpwnam_r
14242 eval $inlibc
14243 case "$d_getpwnam_r" in
14244 "$define")
14245         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14246         case "$d_getpwnam_r_proto:$usethreads" in
14247         ":define")      d_getpwnam_r_proto=define
14248                 set d_getpwnam_r_proto getpwnam_r $hdrs
14249                 eval $hasproto ;;
14250         *)      ;;
14251         esac
14252         case "$d_getpwnam_r_proto" in
14253         define)
14254         case "$getpwnam_r_proto" in
14255         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14256         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14257         esac
14258         case "$getpwnam_r_proto" in
14259         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14260         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14261         esac
14262         case "$getpwnam_r_proto" in
14263         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14264         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14265         esac
14266         case "$getpwnam_r_proto" in
14267         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14268         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14269         esac
14270         case "$getpwnam_r_proto" in
14271         ''|0)   d_getpwnam_r=undef
14272                 getpwnam_r_proto=0
14273                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14274         * )     case "$getpwnam_r_proto" in
14275                 REENTRANT_PROTO*) ;;
14276                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14277                 esac
14278                 echo "Prototype: $try" ;;
14279         esac
14280         ;;
14281         *)      case "$usethreads" in
14282                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14283                 esac
14284                 d_getpwnam_r=undef
14285                 getpwnam_r_proto=0
14286                 ;;
14287         esac
14288         ;;
14289 *)      getpwnam_r_proto=0
14290         ;;
14291 esac
14292
14293 : see if getpwuid_r exists
14294 set getpwuid_r d_getpwuid_r
14295 eval $inlibc
14296 case "$d_getpwuid_r" in
14297 "$define")
14298         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14299         case "$d_getpwuid_r_proto:$usethreads" in
14300         ":define")      d_getpwuid_r_proto=define
14301                 set d_getpwuid_r_proto getpwuid_r $hdrs
14302                 eval $hasproto ;;
14303         *)      ;;
14304         esac
14305         case "$d_getpwuid_r_proto" in
14306         define)
14307         case "$getpwuid_r_proto" in
14308         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14309         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14310         esac
14311         case "$getpwuid_r_proto" in
14312         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14313         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14314         esac
14315         case "$getpwuid_r_proto" in
14316         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14317         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14318         esac
14319         case "$getpwuid_r_proto" in
14320         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14321         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14322         esac
14323         case "$getpwuid_r_proto" in
14324         ''|0)   d_getpwuid_r=undef
14325                 getpwuid_r_proto=0
14326                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14327         * )     case "$getpwuid_r_proto" in
14328                 REENTRANT_PROTO*) ;;
14329                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14330                 esac
14331                 echo "Prototype: $try" ;;
14332         esac
14333         ;;
14334         *)      case "$usethreads" in
14335                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14336                 esac
14337                 d_getpwuid_r=undef
14338                 getpwuid_r_proto=0
14339                 ;;
14340         esac
14341         ;;
14342 *)      getpwuid_r_proto=0
14343         ;;
14344 esac
14345
14346 : Optional checks for getsbyname and getsbyport
14347
14348 : see if getservbyname exists
14349 set getservbyname d_getsbyname
14350 eval $inlibc
14351
14352 : see if getservbyport exists
14353 set getservbyport d_getsbyport
14354 eval $inlibc
14355
14356 : see if getservent exists
14357 set getservent d_getsent
14358 eval $inlibc
14359
14360 : see if getservbyname_r exists
14361 set getservbyname_r d_getservbyname_r
14362 eval $inlibc
14363 case "$d_getservbyname_r" in
14364 "$define")
14365         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14366         case "$d_getservbyname_r_proto:$usethreads" in
14367         ":define")      d_getservbyname_r_proto=define
14368                 set d_getservbyname_r_proto getservbyname_r $hdrs
14369                 eval $hasproto ;;
14370         *)      ;;
14371         esac
14372         case "$d_getservbyname_r_proto" in
14373         define)
14374         case "$getservbyname_r_proto" in
14375         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14376         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14377         esac
14378         case "$getservbyname_r_proto" in
14379         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14380         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14381         esac
14382         case "$getservbyname_r_proto" in
14383         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14384         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14385         esac
14386         case "$getservbyname_r_proto" in
14387         ''|0)   d_getservbyname_r=undef
14388                 getservbyname_r_proto=0
14389                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14390         * )     case "$getservbyname_r_proto" in
14391                 REENTRANT_PROTO*) ;;
14392                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14393                 esac
14394                 echo "Prototype: $try" ;;
14395         esac
14396         ;;
14397         *)      case "$usethreads" in
14398                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14399                 esac
14400                 d_getservbyname_r=undef
14401                 getservbyname_r_proto=0
14402                 ;;
14403         esac
14404         ;;
14405 *)      getservbyname_r_proto=0
14406         ;;
14407 esac
14408
14409 : see if getservbyport_r exists
14410 set getservbyport_r d_getservbyport_r
14411 eval $inlibc
14412 case "$d_getservbyport_r" in
14413 "$define")
14414         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14415         case "$d_getservbyport_r_proto:$usethreads" in
14416         ":define")      d_getservbyport_r_proto=define
14417                 set d_getservbyport_r_proto getservbyport_r $hdrs
14418                 eval $hasproto ;;
14419         *)      ;;
14420         esac
14421         case "$d_getservbyport_r_proto" in
14422         define)
14423         case "$getservbyport_r_proto" in
14424         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14425         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14426         esac
14427         case "$getservbyport_r_proto" in
14428         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14429         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14430         esac
14431         case "$getservbyport_r_proto" in
14432         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14433         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14434         esac
14435         case "$getservbyport_r_proto" in
14436         ''|0)   d_getservbyport_r=undef
14437                 getservbyport_r_proto=0
14438                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14439         * )     case "$getservbyport_r_proto" in
14440                 REENTRANT_PROTO*) ;;
14441                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14442                 esac
14443                 echo "Prototype: $try" ;;
14444         esac
14445         ;;
14446         *)      case "$usethreads" in
14447                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14448                 esac
14449                 d_getservbyport_r=undef
14450                 getservbyport_r_proto=0
14451                 ;;
14452         esac
14453         ;;
14454 *)      getservbyport_r_proto=0
14455         ;;
14456 esac
14457
14458 : see if getservent_r exists
14459 set getservent_r d_getservent_r
14460 eval $inlibc
14461 case "$d_getservent_r" in
14462 "$define")
14463         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14464         case "$d_getservent_r_proto:$usethreads" in
14465         ":define")      d_getservent_r_proto=define
14466                 set d_getservent_r_proto getservent_r $hdrs
14467                 eval $hasproto ;;
14468         *)      ;;
14469         esac
14470         case "$d_getservent_r_proto" in
14471         define)
14472         case "$getservent_r_proto" in
14473         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14474         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
14475         esac
14476         case "$getservent_r_proto" in
14477         ''|0) try='int getservent_r(struct servent*, char*, int);'
14478         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
14479         esac
14480         case "$getservent_r_proto" in
14481         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14482         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
14483         esac
14484         case "$getservent_r_proto" in
14485         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14486         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
14487         esac
14488         case "$getservent_r_proto" in
14489         ''|0)   d_getservent_r=undef
14490                 getservent_r_proto=0
14491                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14492         * )     case "$getservent_r_proto" in
14493                 REENTRANT_PROTO*) ;;
14494                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14495                 esac
14496                 echo "Prototype: $try" ;;
14497         esac
14498         ;;
14499         *)      case "$usethreads" in
14500                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14501                 esac
14502                 d_getservent_r=undef
14503                 getservent_r_proto=0
14504                 ;;
14505         esac
14506         ;;
14507 *)      getservent_r_proto=0
14508         ;;
14509 esac
14510
14511 : see if prototypes for various getservxxx netdb.h functions are available
14512 echo " "
14513 set d_getservprotos getservent $i_netdb netdb.h
14514 eval $hasproto
14515
14516 : see if getspnam exists
14517 set getspnam d_getspnam
14518 eval $inlibc
14519
14520 : see if this is a shadow.h system
14521 set shadow.h i_shadow
14522 eval $inhdr
14523
14524 : see if getspnam_r exists
14525 set getspnam_r d_getspnam_r
14526 eval $inlibc
14527 case "$d_getspnam_r" in
14528 "$define")
14529         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14530         case "$d_getspnam_r_proto:$usethreads" in
14531         ":define")      d_getspnam_r_proto=define
14532                 set d_getspnam_r_proto getspnam_r $hdrs
14533                 eval $hasproto ;;
14534         *)      ;;
14535         esac
14536         case "$d_getspnam_r_proto" in
14537         define)
14538         case "$getspnam_r_proto" in
14539         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14540         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14541         esac
14542         case "$getspnam_r_proto" in
14543         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14544         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14545         esac
14546         case "$getspnam_r_proto" in
14547         ''|0)   d_getspnam_r=undef
14548                 getspnam_r_proto=0
14549                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14550         * )     case "$getspnam_r_proto" in
14551                 REENTRANT_PROTO*) ;;
14552                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14553                 esac
14554                 echo "Prototype: $try" ;;
14555         esac
14556         ;;
14557         *)      case "$usethreads" in
14558                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14559                 esac
14560                 d_getspnam_r=undef
14561                 getspnam_r_proto=0
14562                 ;;
14563         esac
14564         ;;
14565 *)      getspnam_r_proto=0
14566         ;;
14567 esac
14568
14569 : see if gettimeofday or ftime exists
14570 set gettimeofday d_gettimeod
14571 eval $inlibc
14572 case "$d_gettimeod" in
14573 "$undef")
14574         set ftime d_ftime 
14575         eval $inlibc
14576         ;;
14577 *)
14578         val="$undef"; set d_ftime; eval $setvar
14579         ;;
14580 esac
14581 case "$d_gettimeod$d_ftime" in
14582 "$undef$undef")
14583         echo " "
14584         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14585         ;;
14586 esac
14587
14588 : see if gmtime_r exists
14589 set gmtime_r d_gmtime_r
14590 eval $inlibc
14591 case "$d_gmtime_r" in
14592 "$define")
14593         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14594         case "$d_gmtime_r_proto:$usethreads" in
14595         ":define")      d_gmtime_r_proto=define
14596                 set d_gmtime_r_proto gmtime_r $hdrs
14597                 eval $hasproto ;;
14598         *)      ;;
14599         esac
14600         case "$d_gmtime_r_proto" in
14601         define)
14602         case "$gmtime_r_proto" in
14603         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14604         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14605         esac
14606         case "$gmtime_r_proto" in
14607         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14608         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14609         esac
14610         case "$gmtime_r_proto" in
14611         ''|0)   d_gmtime_r=undef
14612                 gmtime_r_proto=0
14613                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14614         * )     case "$gmtime_r_proto" in
14615                 REENTRANT_PROTO*) ;;
14616                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14617                 esac
14618                 echo "Prototype: $try" ;;
14619         esac
14620         ;;
14621         *)      case "$usethreads" in
14622                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14623                 esac
14624                 d_gmtime_r=undef
14625                 gmtime_r_proto=0
14626                 ;;
14627         esac
14628         ;;
14629 *)      gmtime_r_proto=0
14630         ;;
14631 esac
14632
14633 : see if hasmntopt exists
14634 set hasmntopt d_hasmntopt
14635 eval $inlibc
14636
14637 : see if this is a netinet/in.h or sys/in.h system
14638 set netinet/in.h i_niin sys/in.h i_sysin
14639 eval $inhdr
14640
14641 : see if arpa/inet.h has to be included
14642 set arpa/inet.h i_arpainet
14643 eval $inhdr
14644
14645 : see if htonl --and friends-- exists
14646 val=''
14647 set htonl val
14648 eval $inlibc
14649
14650 : Maybe they are macros.
14651 case "$val" in
14652 $undef)
14653         $cat >htonl.c <<EOM
14654 #include <stdio.h>
14655 #include <sys/types.h>
14656 #$i_niin I_NETINET_IN
14657 #$i_sysin I_SYS_IN
14658 #$i_arpainet I_ARPA_INET
14659 #ifdef I_NETINET_IN
14660 #include <netinet/in.h>
14661 #endif
14662 #ifdef I_SYS_IN
14663 #include <sys/in.h>
14664 #endif
14665 #ifdef I_ARPA_INET
14666 #include <arpa/inet.h>
14667 #endif
14668 #ifdef htonl
14669 printf("Defined as a macro.");
14670 #endif
14671 EOM
14672         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14673         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14674                 val="$define"
14675                 echo "But it seems to be defined as a macro." >&4
14676         fi
14677         $rm -f htonl.?
14678         ;;
14679 esac
14680 set d_htonl
14681 eval $setvar
14682
14683 : see if ilogbl exists
14684 set ilogbl d_ilogbl
14685 eval $inlibc
14686
14687 : index or strchr
14688 echo " "
14689 if set index val -f; eval $csym; $val; then
14690         if set strchr val -f d_strchr; eval $csym; $val; then
14691                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14692                         val="$define"
14693                         vali="$undef"
14694                         echo "strchr() found." >&4
14695                 else
14696                         val="$undef"
14697                         vali="$define"
14698                         echo "index() found." >&4
14699                 fi
14700         else
14701                 val="$undef"
14702                 vali="$define"
14703                 echo "index() found." >&4
14704         fi
14705 else
14706         if set strchr val -f d_strchr; eval $csym; $val; then
14707                 val="$define"
14708                 vali="$undef"
14709                 echo "strchr() found." >&4
14710         else
14711                 echo "No index() or strchr() found!" >&4
14712                 val="$undef"
14713                 vali="$undef"
14714         fi
14715 fi
14716 set d_strchr; eval $setvar
14717 val="$vali"
14718 set d_index; eval $setvar
14719
14720 : check whether inet_aton exists
14721 set inet_aton d_inetaton
14722 eval $inlibc
14723
14724 : Look for isascii
14725 echo " "
14726 $cat >isascii.c <<EOCP
14727 #include <stdio.h>
14728 #include <ctype.h>
14729 #$i_stdlib I_STDLIB
14730 #ifdef I_STDLIB
14731 #include <stdlib.h>
14732 #endif
14733 int main() {
14734         int c = 'A';
14735         if (isascii(c))
14736                 exit(0);
14737         else
14738                 exit(1);
14739 }
14740 EOCP
14741 set isascii
14742 if eval $compile; then
14743         echo "isascii() found." >&4
14744         val="$define"
14745 else
14746         echo "isascii() NOT found." >&4
14747         val="$undef"
14748 fi
14749 set d_isascii
14750 eval $setvar
14751 $rm -f isascii*
14752
14753 : see if isfinite exists
14754 set isfinite d_isfinite
14755 eval $inlibc
14756
14757 : see if isinf exists
14758 set isinf d_isinf
14759 eval $inlibc
14760
14761 : see if isnan exists
14762 set isnan d_isnan
14763 eval $inlibc
14764
14765 : see if isnanl exists
14766 set isnanl d_isnanl
14767 eval $inlibc
14768
14769 : see if killpg exists
14770 set killpg d_killpg
14771 eval $inlibc
14772
14773 : see if lchown exists
14774 echo " "
14775 $cat > try.c <<'EOCP'
14776 /* System header to define __stub macros and hopefully few prototypes,
14777     which can conflict with char lchown(); below.  */
14778 #include <assert.h>
14779 /* Override any gcc2 internal prototype to avoid an error.  */
14780 /* We use char because int might match the return type of a gcc2
14781    builtin and then its argument prototype would still apply.  */
14782 char lchown();
14783 int main() {
14784     /*  The GNU C library defines this for functions which it implements
14785         to always fail with ENOSYS.  Some functions are actually named
14786         something starting with __ and the normal name is an alias.  */
14787 #if defined (__stub_lchown) || defined (__stub___lchown)
14788 choke me
14789 #else
14790 lchown();
14791 #endif
14792 ; return 0; }
14793 EOCP
14794 set try
14795 if eval $compile; then
14796     $echo "lchown() found." >&4
14797     val="$define"
14798 else
14799     $echo "lchown() NOT found." >&4
14800     val="$undef"
14801 fi
14802 set d_lchown
14803 eval $setvar
14804
14805 : See if number of significant digits in a double precision number is known
14806 echo " "
14807 $cat >ldbl_dig.c <<EOM
14808 #$i_limits I_LIMITS
14809 #$i_float I_FLOAT
14810 #ifdef I_LIMITS
14811 #include <limits.h>
14812 #endif
14813 #ifdef I_FLOAT
14814 #include <float.h>
14815 #endif
14816 #ifdef LDBL_DIG
14817 printf("Contains LDBL_DIG");
14818 #endif
14819 EOM
14820 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14821 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14822         echo "LDBL_DIG found." >&4
14823         val="$define"
14824 else
14825         echo "LDBL_DIG NOT found." >&4
14826         val="$undef"
14827 fi
14828 $rm -f ldbl_dig.?
14829 set d_ldbl_dig
14830 eval $setvar
14831
14832 : see if this is a math.h system
14833 set math.h i_math
14834 eval $inhdr
14835
14836 : check to see if math.h defines _LIB_VERSION
14837 d_libm_lib_version="$undef"
14838 case $i_math in
14839     $define)
14840         echo " "
14841         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14842         $cat >try.c <<EOCP
14843 #include <unistd.h>
14844 #include <math.h>
14845 int main (int argc, char *argv[])
14846 {
14847     printf ("%d\n", _LIB_VERSION);
14848     return (0);
14849     } /* main */
14850 EOCP
14851         set try
14852         if eval $compile; then
14853             foo=`$run ./try`
14854             echo "Yes, it does ($foo)" >&4
14855             d_libm_lib_version="$define"
14856         else
14857             echo "No, it does not (probably harmless)" >&4
14858             fi
14859         $rm_try
14860         ;;
14861
14862     esac
14863
14864 : see if link exists
14865 set link d_link
14866 eval $inlibc
14867
14868 : see if localtime_r exists
14869 set localtime_r d_localtime_r
14870 eval $inlibc
14871 case "$d_localtime_r" in
14872 "$define")
14873         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14874         case "$d_localtime_r_proto:$usethreads" in
14875         ":define")      d_localtime_r_proto=define
14876                 set d_localtime_r_proto localtime_r $hdrs
14877                 eval $hasproto ;;
14878         *)      ;;
14879         esac
14880         case "$d_localtime_r_proto" in
14881         define)
14882         case "$localtime_r_proto" in
14883         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14884         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14885         esac
14886         case "$localtime_r_proto" in
14887         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14888         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14889         esac
14890         case "$localtime_r_proto" in
14891         ''|0)   d_localtime_r=undef
14892                 localtime_r_proto=0
14893                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14894         * )     case "$localtime_r_proto" in
14895                 REENTRANT_PROTO*) ;;
14896                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14897                 esac
14898                 echo "Prototype: $try" ;;
14899         esac
14900         ;;
14901         *)      case "$usethreads" in
14902                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14903                 esac
14904                 d_localtime_r=undef
14905                 localtime_r_proto=0
14906                 ;;
14907         esac
14908         ;;
14909 *)      localtime_r_proto=0
14910         ;;
14911 esac
14912
14913 : see if localtime_r calls tzset
14914 case "$localtime_r_proto" in
14915 REENTRANT_PROTO*)
14916         $cat >try.c <<EOCP
14917 /*  Does our libc's localtime_r call tzset ?
14918  *  return 0 if so, 1 otherwise.
14919  */
14920 #include <sys/types.h>
14921 #include <unistd.h>
14922 #include <time.h>
14923 #include <string.h>
14924 #include <malloc.h>
14925 int main()
14926 {
14927     time_t t = time(0L);
14928     char w_tz[]="TZ" "=GMT+5",
14929          e_tz[]="TZ" "=GMT-5",
14930         *tz_e = (char*)malloc(16),
14931         *tz_w = (char*)malloc(16);
14932     struct tm tm_e, tm_w;
14933     memset(&tm_e,'\0',sizeof(struct tm));
14934     memset(&tm_w,'\0',sizeof(struct tm));
14935     strcpy(tz_e,e_tz);
14936     strcpy(tz_w,w_tz);
14937
14938     putenv(tz_e);
14939     localtime_r(&t, &tm_e);
14940
14941     putenv(tz_w);
14942     localtime_r(&t, &tm_w);
14943
14944     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
14945         return 1;
14946     return 0;
14947 }
14948 EOCP
14949         set try
14950         if eval $compile; then
14951             if $run ./try; then
14952                 d_localtime_r_needs_tzset=undef;
14953             else
14954                 d_localtime_r_needs_tzset=define;
14955             fi;
14956         else
14957             d_localtime_r_needs_tzset=undef;
14958         fi;
14959      ;;
14960   *)
14961      d_localtime_r_needs_tzset=undef;
14962      ;;
14963 esac
14964 $rm_try
14965
14966 : see if localeconv exists
14967 set localeconv d_locconv
14968 eval $inlibc
14969
14970 : see if lockf exists
14971 set lockf d_lockf
14972 eval $inlibc
14973
14974 : see if prototype for lseek is available
14975 echo " "
14976 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14977 eval $hasproto
14978
14979 : see if lstat exists
14980 set lstat d_lstat
14981 eval $inlibc
14982
14983 : see if madvise exists
14984 set madvise d_madvise
14985 eval $inlibc
14986
14987 : see if malloc_size exists
14988 set malloc_size d_malloc_size
14989 eval $inlibc
14990
14991 : see if malloc_size_good exists
14992 set malloc_good_size d_malloc_good_size
14993 eval $inlibc
14994
14995 : see if mblen exists
14996 set mblen d_mblen
14997 eval $inlibc
14998
14999 : see if mbstowcs exists
15000 set mbstowcs d_mbstowcs
15001 eval $inlibc
15002
15003 : see if mbtowc exists
15004 set mbtowc d_mbtowc
15005 eval $inlibc
15006
15007 : see if memchr exists
15008 set memchr d_memchr
15009 eval $inlibc
15010
15011 : see if memcmp exists
15012 set memcmp d_memcmp
15013 eval $inlibc
15014
15015 : see if memcpy exists
15016 set memcpy d_memcpy
15017 eval $inlibc
15018
15019 : see if memmove exists
15020 set memmove d_memmove
15021 eval $inlibc
15022
15023 : see if memset exists
15024 set memset d_memset
15025 eval $inlibc
15026
15027 : see if mkdir exists
15028 set mkdir d_mkdir
15029 eval $inlibc
15030
15031 : see if mkdtemp exists
15032 set mkdtemp d_mkdtemp
15033 eval $inlibc
15034
15035 : see if mkfifo exists
15036 set mkfifo d_mkfifo
15037 eval $inlibc
15038
15039 : see if mkstemp exists
15040 set mkstemp d_mkstemp
15041 eval $inlibc
15042
15043 : see if mkstemps exists
15044 set mkstemps d_mkstemps
15045 eval $inlibc
15046
15047 : see if mktime exists
15048 set mktime d_mktime
15049 eval $inlibc
15050
15051 : see if this is a sys/mman.h system
15052 set sys/mman.h i_sysmman
15053 eval $inhdr
15054
15055 : see if mmap exists
15056 set mmap d_mmap
15057 eval $inlibc
15058 : see what shmat returns
15059 : default to something harmless
15060 mmaptype='void *'
15061 case "$i_sysmman$d_mmap" in
15062 "$define$define")
15063         $cat >mmap.c <<'END'
15064 #include <sys/mman.h>
15065 void *mmap();
15066 END
15067         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15068                 mmaptype='void *'
15069         else
15070                 mmaptype='caddr_t'
15071         fi
15072         echo "and it returns ($mmaptype)." >&4
15073         ;;
15074 esac
15075
15076
15077
15078 : see if sqrtl exists
15079 set sqrtl d_sqrtl
15080 eval $inlibc
15081
15082 : see if scalbnl exists
15083 set scalbnl d_scalbnl
15084 eval $inlibc
15085
15086 : see if modfl exists
15087 set modfl d_modfl
15088 eval $inlibc
15089
15090 : see if prototype for modfl is available
15091 echo " "
15092 set d_modflproto modfl $i_math math.h
15093 eval $hasproto
15094
15095 d_modfl_pow32_bug="$undef"
15096
15097 case "$d_longdbl$d_modfl" in
15098 $define$define)
15099         $cat <<EOM
15100 Checking to see whether your modfl() is okay for large values...
15101 EOM
15102 $cat >try.c <<EOCP
15103 #include <math.h>
15104 #include <stdio.h>
15105 EOCP
15106 if $test "X$d_modflproto" != "X$define"; then
15107         $cat >>try.c <<EOCP
15108 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15109 long double modfl (long double, long double *);
15110 EOCP
15111 fi
15112 $cat >>try.c <<EOCP
15113 int main() {
15114     long double nv = 4294967303.15;
15115     long double v, w;
15116     v = modfl(nv, &w);
15117 #ifdef __GLIBC__
15118     printf("glibc");
15119 #endif
15120     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15121     return 0;
15122 }
15123 EOCP
15124         case "$osname:$gccversion" in
15125         aix:)   saveccflags="$ccflags"
15126                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15127         esac
15128         set try
15129         if eval $compile; then
15130                 foo=`$run ./try`
15131                 case "$foo" in
15132                 *" 4294967303.150000 1.150000 4294967302.000000")
15133                         echo >&4 "Your modfl() is broken for large values."
15134                         d_modfl_pow32_bug="$define"
15135                         case "$foo" in
15136                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15137                         ;;
15138                         esac
15139                         ;;
15140                 *" 4294967303.150000 0.150000 4294967303.000000")
15141                         echo >&4 "Your modfl() seems okay for large values."
15142                         ;;
15143                 *)      echo >&4 "I don't understand your modfl() at all."
15144                         d_modfl="$undef"
15145                         ;;
15146                 esac
15147                 $rm_try
15148         else
15149                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15150                 d_modfl="$undef"
15151         fi
15152         case "$osname:$gccversion" in
15153         aix:)   ccflags="$saveccflags" ;; # restore
15154         esac
15155         ;;
15156 esac
15157
15158 if $test "$uselongdouble" = "$define"; then
15159     message=""
15160     if $test "$d_sqrtl" != "$define"; then
15161         message="$message sqrtl"
15162     fi
15163     if $test "$d_modfl" != "$define"; then
15164         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15165             echo "You have both aintl and copysignl, so I can emulate modfl."
15166         else
15167             message="$message modfl"
15168         fi
15169     fi
15170     if $test "$d_frexpl" != "$define"; then
15171         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15172             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15173         else
15174             message="$message frexpl"
15175         fi
15176     fi
15177
15178     if $test "$message" != ""; then
15179         $cat <<EOM >&4
15180
15181 *** You requested the use of long doubles but you do not seem to have
15182 *** the following mathematical functions needed for long double support:
15183 ***    $message
15184 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15185 *** Cannot continue, aborting.
15186
15187 EOM
15188
15189         exit 1
15190     fi
15191 fi
15192
15193 : see if mprotect exists
15194 set mprotect d_mprotect
15195 eval $inlibc
15196
15197 : see if msgctl exists
15198 set msgctl d_msgctl
15199 eval $inlibc
15200
15201 : see if msgget exists
15202 set msgget d_msgget
15203 eval $inlibc
15204
15205 : see if msgsnd exists
15206 set msgsnd d_msgsnd
15207 eval $inlibc
15208
15209 : see if msgrcv exists
15210 set msgrcv d_msgrcv
15211 eval $inlibc
15212
15213 : see how much of the 'msg*(2)' library is present.
15214 h_msg=true
15215 echo " "
15216 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15217 *"$undef"*) h_msg=false;;
15218 esac
15219 case "$osname" in
15220 freebsd)
15221     case "`ipcs 2>&1`" in
15222     "SVID messages"*"not configured"*)
15223         echo "Your $osname does not have the msg*(2) configured." >&4
15224         h_msg=false
15225         val="$undef"
15226         set msgctl d_msgctl
15227         eval $setvar
15228         set msgget d_msgget
15229         eval $setvar
15230         set msgsnd d_msgsnd
15231         eval $setvar
15232         set msgrcv d_msgrcv
15233         eval $setvar
15234         ;;
15235     esac
15236     ;;
15237 esac
15238 : we could also check for sys/ipc.h ...
15239 if $h_msg && $test `./findhdr sys/msg.h`; then
15240         echo "You have the full msg*(2) library." >&4
15241         val="$define"
15242 else
15243         echo "You don't have the full msg*(2) library." >&4
15244         val="$undef"
15245 fi
15246 set d_msg
15247 eval $setvar
15248
15249 : Check for msghdr_s
15250 echo " "
15251 echo "Checking to see if your system supports struct msghdr..." >&4
15252 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15253 eval $hasstruct
15254 case "$d_msghdr_s" in
15255 "$define")      echo "Yes, it does."   ;;
15256 *)              echo "No, it doesn't." ;;
15257 esac
15258
15259
15260 : see if msync exists
15261 set msync d_msync
15262 eval $inlibc
15263
15264 : see if munmap exists
15265 set munmap d_munmap
15266 eval $inlibc
15267
15268 : see if nice exists
15269 set nice d_nice
15270 eval $inlibc
15271
15272 : see if this is a langinfo.h system
15273 set langinfo.h i_langinfo
15274 eval $inhdr
15275
15276 : see if nl_langinfo exists
15277 set nl_langinfo d_nl_langinfo
15278 eval $inlibc
15279
15280 : check for volatile keyword
15281 echo " "
15282 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15283 $cat >try.c <<'EOCP'
15284 int main()
15285 {
15286         typedef struct _goo_struct goo_struct;
15287         goo_struct * volatile goo = ((goo_struct *)0);
15288         struct _goo_struct {
15289                 long long_int;
15290                 int reg_int;
15291                 char char_var;
15292         };
15293         typedef unsigned short foo_t;
15294         char *volatile foo;
15295         volatile int bar;
15296         volatile foo_t blech;
15297         foo = foo;
15298 }
15299 EOCP
15300 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15301         val="$define"
15302         echo "Yup, it does."
15303 else
15304         val="$undef"
15305         echo "Nope, it doesn't."
15306 fi
15307 set d_volatile
15308 eval $setvar
15309 $rm_try
15310
15311 : Check basic sizes
15312 echo " "
15313 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15314
15315 case "$use64bitint:$d_quad:$quadtype" in
15316 define:define:?*)
15317         ivtype="$quadtype"
15318         uvtype="$uquadtype"
15319         ivsize=8
15320         uvsize=8
15321         ;;
15322 *)      ivtype="long"
15323         uvtype="unsigned long"
15324         ivsize=$longsize
15325         uvsize=$longsize
15326         ;;
15327 esac
15328
15329 case "$uselongdouble:$d_longdbl" in
15330 define:define)
15331         nvtype="long double"
15332         nvsize=$longdblsize
15333         ;;
15334 *)      nvtype=double
15335         nvsize=$doublesize
15336         ;;
15337 esac
15338
15339 $echo "(IV will be "$ivtype", $ivsize bytes)"
15340 $echo "(UV will be "$uvtype", $uvsize bytes)"
15341 $echo "(NV will be "$nvtype", $nvsize bytes)"
15342
15343 $cat >try.c <<EOCP
15344 #$i_inttypes I_INTTYPES
15345 #ifdef I_INTTYPES
15346 #include <inttypes.h>
15347 #endif
15348 #include <stdio.h>
15349 int main() {
15350 #ifdef INT8
15351    int8_t i =  INT8_MAX;
15352   uint8_t u = UINT8_MAX;
15353   printf("int8_t\n");
15354 #endif
15355 #ifdef INT16
15356    int16_t i =  INT16_MAX;
15357   uint16_t i = UINT16_MAX;
15358   printf("int16_t\n");
15359 #endif
15360 #ifdef INT32
15361    int32_t i =  INT32_MAX;
15362   uint32_t u = UINT32_MAX;
15363   printf("int32_t\n");
15364 #endif
15365 }
15366 EOCP
15367
15368 i8type="signed char"
15369 u8type="unsigned char"
15370 i8size=1
15371 u8size=1
15372
15373 case "$i16type" in
15374 '')     case "$shortsize" in
15375         2)      i16type=short
15376                 u16type="unsigned short"
15377                 i16size=$shortsize
15378                 u16size=$shortsize
15379                 ;;
15380         esac
15381         ;;
15382 esac
15383 case "$i16type" in
15384 '')     set try -DINT16
15385         if eval $compile; then
15386                 case "`$run ./try`" in
15387                 int16_t)
15388                         i16type=int16_t
15389                         u16type=uint16_t
15390                         i16size=2
15391                         u16size=2
15392                         ;;
15393                 esac
15394         fi
15395         ;;
15396 esac
15397 case "$i16type" in
15398 '')     if $test $shortsize -ge 2; then
15399                 i16type=short
15400                 u16type="unsigned short"
15401                 i16size=$shortsize
15402                 u16size=$shortsize
15403         fi
15404         ;;
15405 esac
15406
15407 case "$i32type" in
15408 '')     case "$longsize" in
15409         4)      i32type=long
15410                 u32type="unsigned long"
15411                 i32size=$longsize
15412                 u32size=$longsize
15413                 ;;
15414         *)      case "$intsize" in
15415                 4)      i32type=int
15416                         u32type="unsigned int"
15417                         i32size=$intsize
15418                         u32size=$intsize
15419                         ;;
15420                 esac
15421                 ;;
15422         esac
15423         ;;
15424 esac
15425 case "$i32type" in
15426 '')     set try -DINT32
15427         if eval $compile; then
15428                 case "`$run ./try`" in
15429                 int32_t)
15430                         i32type=int32_t
15431                         u32type=uint32_t
15432                         i32size=4
15433                         u32size=4
15434                         ;;
15435                 esac
15436         fi
15437         ;;
15438 esac
15439 case "$i32type" in
15440 '')     if $test $intsize -ge 4; then
15441                 i32type=int
15442                 u32type="unsigned int"
15443                 i32size=$intsize
15444                 u32size=$intsize
15445         fi
15446         ;;
15447 esac
15448
15449 case "$i64type" in
15450 '')     case "$d_quad:$quadtype" in
15451         define:?*)
15452                 i64type="$quadtype"
15453                 u64type="$uquadtype"
15454                 i64size=8
15455                 u64size=8
15456                 ;;
15457         esac
15458         ;;
15459 esac
15460
15461 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15462 : volatile so that the compiler has to store it out to memory.
15463 if test X"$d_volatile" = X"$define"; then
15464         volatile=volatile
15465 fi
15466 $cat <<EOP >try.c
15467 #include <stdio.h>
15468 #$i_stdlib I_STDLIB
15469 #ifdef I_STDLIB
15470 #include <stdlib.h>
15471 #endif
15472 #include <sys/types.h>
15473 #include <signal.h>
15474 #ifdef SIGFPE
15475 $volatile int bletched = 0;
15476 $signal_t blech(int s) { bletched = 1; }
15477 #endif
15478 int main() {
15479     $uvtype u = 0;
15480     $nvtype d;
15481     int     n = 8 * $uvsize;
15482     int     i;
15483 #ifdef SIGFPE
15484     signal(SIGFPE, blech);
15485 #endif
15486
15487     for (i = 0; i < n; i++) {
15488       u = u << 1 | ($uvtype)1;
15489       d = ($nvtype)u;
15490       if (($uvtype)d != u)
15491         break;
15492       if (d <= 0)
15493         break;
15494       d = ($nvtype)(u - 1);
15495       if (($uvtype)d != (u - 1))
15496         break;
15497 #ifdef SIGFPE
15498       if (bletched)
15499         break;
15500 #endif
15501     }
15502     printf("%d\n", ((i == n) ? -n : i));
15503     exit(0);
15504 }
15505 EOP
15506 set try
15507
15508 d_nv_preserves_uv="$undef"
15509 if eval $compile; then
15510         nv_preserves_uv_bits="`$run ./try`"
15511 fi
15512 case "$nv_preserves_uv_bits" in
15513 \-[1-9]*)
15514         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15515         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15516         d_nv_preserves_uv="$define"
15517         ;;
15518 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15519         d_nv_preserves_uv="$undef" ;;
15520 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15521         nv_preserves_uv_bits="0" ;;
15522 esac
15523 $rm_try
15524
15525 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15526 : volatile so that the compiler has to store it out to memory.
15527 if test X"$d_volatile" = X"$define"; then
15528         volatile=volatile
15529 fi
15530 $cat <<EOP >try.c
15531 #include <stdio.h>
15532
15533 typedef $nvtype NV;
15534
15535 int
15536 main() {
15537   NV value = 2;
15538   int count = 1;
15539
15540   while(count < 256) {
15541     $volatile NV up = value + 1.0;
15542     $volatile NV negated = -value;
15543     $volatile NV down = negated - 1.0;
15544     $volatile NV got_up = up - value;
15545     int up_good = got_up == 1.0;
15546     int got_down = down - negated;
15547     int down_good = got_down == -1.0;
15548
15549     if (down_good != up_good) {
15550       fprintf(stderr,
15551               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15552               up_good, (double) got_up, down_good, (double) got_down,
15553               count, (double) value);
15554       return 1;
15555     }
15556     if (!up_good) {
15557       while (1) {
15558         if (count > 8) {
15559           count -= 8;
15560           fputs("256.0", stdout);
15561         } else {
15562           count--;
15563           fputs("2.0", stdout);
15564         }
15565         if (!count) {
15566           puts("");
15567           return 0;
15568         }
15569         fputs("*", stdout);
15570       }
15571     }
15572     value *= 2;
15573     ++count;
15574   }
15575   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15576           count, (double) value);
15577   return 1;
15578 }
15579 EOP
15580 set try
15581
15582 nv_overflows_integers_at='0'
15583 if eval $compile; then
15584     xxx="`$run ./try`"
15585     case "$?" in
15586         0)
15587             case "$xxx" in
15588                 2*)  cat >&4 <<EOM
15589 The largest integer your NVs can preserve is equal to $xxx
15590 EOM
15591                     nv_overflows_integers_at="$xxx"
15592                     ;;
15593                 *)  cat >&4 <<EOM
15594 Cannot determine the largest integer value your NVs can hold, unexpected output
15595 '$xxx'
15596 EOM
15597                     ;;
15598             esac
15599             ;;
15600         *)  cat >&4 <<EOM
15601 Cannot determine the largest integer value your NVs can hold
15602 EOM
15603             ;;
15604     esac
15605 fi
15606 $rm_try
15607
15608 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15609 : volatile so that the compiler has to store it out to memory.
15610 if test X"$d_volatile" = X"$define"; then
15611         volatile=volatile
15612 fi
15613 $cat <<EOP >try.c
15614 #include <stdio.h>
15615 #$i_stdlib I_STDLIB
15616 #ifdef I_STDLIB
15617 #include <stdlib.h>
15618 #endif
15619 #$i_string I_STRING
15620 #ifdef I_STRING
15621 #  include <string.h>
15622 #else
15623 #  include <strings.h>
15624 #endif
15625 #include <sys/types.h>
15626 #include <signal.h>
15627 #ifdef SIGFPE
15628 $volatile int bletched = 0;
15629 $signal_t blech(int s) { bletched = 1; }
15630 #endif
15631
15632 int checkit($nvtype d, char *where) {
15633     unsigned char *p = (char *)&d;
15634     unsigned char *end = p + sizeof(d);
15635     int fail = 0;
15636
15637     while (p < end)
15638         fail += *p++;
15639
15640     if (!fail)
15641         return 0;
15642
15643     p = (char *)&d;
15644     printf("No - %s: 0x", where);
15645     while (p < end)
15646         printf ("%02X", *p++);
15647     printf("\n");
15648     return 1;
15649 }
15650
15651 int main(int argc, char **argv) {
15652     $nvtype d = 0.0;
15653     int fail = 0;
15654     fail += checkit(d, "0.0");
15655
15656     /* The compiler shouldn't be assuming that bletched is 0  */
15657     d = bletched;
15658
15659     fail += checkit(d, "bleched");
15660
15661 #ifdef SIGFPE
15662     signal(SIGFPE, blech);
15663 #endif
15664
15665     /* Paranoia - the compiler should have no way of knowing that ANSI says
15666        that argv[argc] will always be NULL.  Actually, if it did assume this it
15667        would be buggy, as this is C and main() can be called from elsewhere in
15668        the program.  */
15669     d = argv[argc] ? 1 : 0;
15670
15671     if (d) {
15672         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15673     }
15674
15675     fail += checkit(d, "ternary");
15676
15677     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15678
15679     if (d != 0.0) {
15680         printf("No - memset doesn't give 0.0\n");
15681         /* This might just blow up:  */
15682         printf("(gives %g)\n", d);
15683         return 1;
15684     }
15685
15686 #ifdef SIGFPE
15687     if (bletched) {
15688         printf("No - something bleched\n");
15689         return 1;
15690     }
15691 #endif
15692     if (fail) {
15693       printf("No - %d fail(s)\n", fail);
15694       return 1;
15695     }
15696     printf("Yes\n");
15697     return 0;
15698 }
15699 EOP
15700 set try
15701
15702 d_nv_zero_is_allbits_zero="$undef"
15703 if eval $compile; then
15704     xxx="`$run ./try`"
15705     case "$?" in
15706         0)
15707             case "$xxx" in
15708                 Yes)  cat >&4 <<EOM
15709 0.0 is represented as all bits zero in memory
15710 EOM
15711                     d_nv_zero_is_allbits_zero="$define"
15712                     ;;
15713                 *)  cat >&4 <<EOM
15714 0.0 is not represented as all bits zero in memory
15715 EOM
15716                     d_nv_zero_is_allbits_zero="$undef"
15717                     ;;
15718             esac
15719             ;;
15720         *)  cat >&4 <<EOM
15721 0.0 is not represented as all bits zero in memory
15722 EOM
15723             d_nv_zero_is_allbits_zero="$undef"
15724             ;;
15725     esac
15726 fi
15727 $rm_try
15728
15729 : check for off64_t
15730 echo " "
15731 echo "Checking to see if you have off64_t..." >&4
15732 $cat >try.c <<EOCP
15733 #include <sys/types.h>
15734 #include <unistd.h>
15735 int main() { off64_t x = 7; }
15736 EOCP
15737 set try
15738 if eval $compile; then
15739         val="$define"
15740         echo "You have off64_t."
15741 else
15742         val="$undef"
15743         echo "You do not have off64_t."
15744         case "$lseeksize" in
15745         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15746         esac
15747 fi
15748 $rm_try
15749 set d_off64_t
15750 eval $setvar
15751
15752 : how to create joinable pthreads
15753 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15754         echo " "
15755         echo "Checking what constant to use for creating joinable pthreads..." >&4
15756         $cat >try.c <<'EOCP'
15757 #include <pthread.h>
15758 int main() {
15759     int detachstate = JOINABLE;
15760 }
15761 EOCP
15762         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15763         if eval $compile; then
15764                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15765                 val="$undef" # Yes, undef.
15766                 set d_old_pthread_create_joinable
15767                 eval $setvar
15768                 val=""
15769                 set old_pthread_create_joinable
15770                 eval $setvar
15771         else
15772                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15773                 if eval $compile; then
15774                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15775                         val="$define"
15776                         set d_old_pthread_create_joinable
15777                         eval $setvar
15778                         val=PTHREAD_CREATE_UNDETACHED
15779                         set old_pthread_create_joinable
15780                         eval $setvar
15781                 else
15782                         set try -DJOINABLE=__UNDETACHED
15783                         if eval $compile; then
15784                                 echo "You seem to use __UNDETACHED." >&4
15785                                 val="$define"
15786                                 set d_old_pthread_create_joinable
15787                                 eval $setvar
15788                                 val=__UNDETACHED
15789                                 set old_pthread_create_joinable
15790                                 eval $setvar
15791                         else
15792                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15793                                 val="$define"
15794                                 set d_old_pthread_create_joinable
15795                                 eval $setvar
15796                                 val=0
15797                                 set old_pthread_create_joinable
15798                                 eval $setvar
15799                         fi
15800                 fi
15801         fi
15802         $rm_try
15803 else
15804     d_old_pthread_create_joinable="$undef"
15805     old_pthread_create_joinable=""
15806 fi
15807
15808 : see if pause exists
15809 set pause d_pause
15810 eval $inlibc
15811
15812 : see if poll exists
15813 set poll d_poll
15814 eval $inlibc
15815
15816 : see if readlink exists
15817 set readlink d_readlink
15818 eval $inlibc
15819
15820 : Check if exe is symlink to abs path of executing program
15821 echo " "
15822 procselfexe=''
15823 val="$undef"
15824 case "$d_readlink" in
15825 "$define")
15826         if $issymlink /proc/self/exe ; then
15827                 $ls -l /proc/self/exe > reflect
15828                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15829                         echo "You have Linux-like /proc/self/exe."
15830                         procselfexe='"/proc/self/exe"'
15831                         val="$define"
15832                 fi
15833         fi
15834         if $issymlink /proc/curproc/file ; then
15835                 $ls -l /proc/curproc/file > reflect
15836                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15837                         echo "You have BSD-like /proc/curproc/file."
15838                         procselfexe='"/proc/curproc/file"'
15839                         val="$define"
15840                 fi
15841         fi
15842         ;;
15843 esac
15844 $rm -f reflect
15845 set d_procselfexe
15846 eval $setvar
15847
15848 : backward compatibility for d_hvfork
15849 if test X$d_hvfork != X; then
15850         d_vfork="$d_hvfork"
15851         d_hvfork=''
15852 fi
15853 : see if there is a vfork
15854 val=''
15855 set vfork val
15856 eval $inlibc
15857
15858 d_pseudofork=$undef
15859
15860 : Ok, but do we want to use it. vfork is reportedly unreliable in
15861 : perl on Solaris 2.x, and probably elsewhere.
15862 case "$val" in
15863 $define)
15864         echo " "
15865         case "$usevfork" in
15866         false) dflt='n';;
15867         *) dflt='y';;
15868         esac
15869         cat <<'EOM'
15870
15871 Perl can only use a vfork() that doesn't suffer from strict
15872 restrictions on calling functions or modifying global data in
15873 the child.  For example, glibc-2.1 contains such a vfork()
15874 that is unsuitable.  If your system provides a proper fork()
15875 call, chances are that you do NOT want perl to use vfork().
15876
15877 EOM
15878         rp="Do you still want to use vfork()?"
15879         . ./myread
15880         case "$ans" in
15881         y|Y) ;;
15882         *)
15883                 echo "Ok, we won't use vfork()."
15884                 val="$undef"
15885                 ;;
15886         esac
15887         ;;
15888 esac
15889 set d_vfork
15890 eval $setvar
15891 case "$d_vfork" in
15892 $define) usevfork='true';;
15893 *) usevfork='false';;
15894 esac
15895
15896 : see whether the pthread_atfork exists
15897 $cat >try.c <<EOP
15898 #include <pthread.h>
15899 #include <stdio.h>
15900 int main() {
15901 #ifdef  PTHREAD_ATFORK
15902         pthread_atfork(NULL,NULL,NULL);
15903 #endif
15904 }
15905 EOP
15906
15907 : see if pthread_atfork exists
15908 set try -DPTHREAD_ATFORK
15909 if eval $compile; then
15910     val="$define"
15911 else
15912     val="$undef"
15913 fi
15914 case "$usethreads" in
15915 $define)
15916         case "$val" in
15917         $define) echo 'pthread_atfork found.' >&4        ;;
15918         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15919         esac
15920 esac
15921 set d_pthread_atfork
15922 eval $setvar
15923
15924 : see if pthread_attr_setscope exists
15925 set pthread_attr_setscope d_pthread_attr_setscope
15926 eval $inlibc
15927
15928 : see whether the various POSIXish _yields exist
15929 $cat >try.c <<EOP
15930 #include <pthread.h>
15931 #include <stdio.h>
15932 int main() {
15933 #ifdef SCHED_YIELD
15934         sched_yield();
15935 #else
15936 #ifdef PTHREAD_YIELD
15937         pthread_yield();
15938 #else
15939 #ifdef PTHREAD_YIELD_NULL
15940         pthread_yield(NULL);
15941 #endif
15942 #endif
15943 #endif
15944 }
15945 EOP
15946 : see if sched_yield exists
15947 set try -DSCHED_YIELD
15948 if eval $compile; then
15949     val="$define"
15950     sched_yield='sched_yield()'
15951 else
15952     val="$undef"
15953 fi
15954 case "$usethreads" in
15955 $define)
15956         case "$val" in
15957         $define) echo 'sched_yield() found.' >&4        ;;
15958         *)       echo 'sched_yield() NOT found.' >&4    ;;
15959         esac
15960 esac
15961 set d_sched_yield
15962 eval $setvar
15963
15964 : see if pthread_yield exists
15965 set try -DPTHREAD_YIELD
15966 if eval $compile; then
15967     val="$define"
15968     case "$sched_yield" in
15969     '') sched_yield='pthread_yield()' ;;
15970     esac
15971 else
15972     set try -DPTHREAD_YIELD_NULL
15973     if eval $compile; then
15974         val="$define"
15975         case "$sched_yield" in
15976         '') sched_yield='pthread_yield(NULL)' ;;
15977         esac
15978     else
15979         val="$undef"
15980     fi
15981 fi
15982 case "$usethreads" in
15983 $define)
15984         case "$val" in
15985         $define) echo 'pthread_yield() found.' >&4      ;;
15986         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15987         esac
15988         ;;
15989 esac
15990 set d_pthread_yield
15991 eval $setvar
15992 case "$sched_yield" in
15993 '') sched_yield=undef ;;
15994 esac
15995 $rm_try
15996
15997 : see if random_r exists
15998 set random_r d_random_r
15999 eval $inlibc
16000 case "$d_random_r" in
16001 "$define")
16002         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16003         case "$d_random_r_proto:$usethreads" in
16004         ":define")      d_random_r_proto=define
16005                 set d_random_r_proto random_r $hdrs
16006                 eval $hasproto ;;
16007         *)      ;;
16008         esac
16009         case "$d_random_r_proto" in
16010         define)
16011         case "$random_r_proto" in
16012         ''|0) try='int random_r(int*, struct random_data*);'
16013         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
16014         esac
16015         case "$random_r_proto" in
16016         ''|0) try='int random_r(long*, struct random_data*);'
16017         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
16018         esac
16019         case "$random_r_proto" in
16020         ''|0) try='int random_r(struct random_data*, int32_t*);'
16021         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
16022         esac
16023         case "$random_r_proto" in
16024         ''|0)   d_random_r=undef
16025                 random_r_proto=0
16026                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16027         * )     case "$random_r_proto" in
16028                 REENTRANT_PROTO*) ;;
16029                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16030                 esac
16031                 echo "Prototype: $try" ;;
16032         esac
16033         ;;
16034         *)      case "$usethreads" in
16035                 define) echo "random_r has no prototype, not using it." >&4 ;;
16036                 esac
16037                 d_random_r=undef
16038                 random_r_proto=0
16039                 ;;
16040         esac
16041         ;;
16042 *)      random_r_proto=0
16043         ;;
16044 esac
16045
16046 : see if readdir and friends exist
16047 set readdir d_readdir
16048 eval $inlibc
16049 set seekdir d_seekdir
16050 eval $inlibc
16051 set telldir d_telldir
16052 eval $inlibc
16053 set rewinddir d_rewinddir
16054 eval $inlibc
16055
16056 : see if readdir64_r exists
16057 set readdir64_r d_readdir64_r
16058 eval $inlibc
16059 case "$d_readdir64_r" in
16060 "$define")
16061         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16062         case "$d_readdir64_r_proto:$usethreads" in
16063         ":define")      d_readdir64_r_proto=define
16064                 set d_readdir64_r_proto readdir64_r $hdrs
16065                 eval $hasproto ;;
16066         *)      ;;
16067         esac
16068         case "$d_readdir64_r_proto" in
16069         define)
16070         case "$readdir64_r_proto" in
16071         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16072         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
16073         esac
16074         case "$readdir64_r_proto" in
16075         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16076         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
16077         esac
16078         case "$readdir64_r_proto" in
16079         ''|0)   d_readdir64_r=undef
16080                 readdir64_r_proto=0
16081                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16082         * )     case "$readdir64_r_proto" in
16083                 REENTRANT_PROTO*) ;;
16084                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16085                 esac
16086                 echo "Prototype: $try" ;;
16087         esac
16088         ;;
16089         *)      case "$usethreads" in
16090                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16091                 esac
16092                 d_readdir64_r=undef
16093                 readdir64_r_proto=0
16094                 ;;
16095         esac
16096         ;;
16097 *)      readdir64_r_proto=0
16098         ;;
16099 esac
16100
16101 : see if readdir_r exists
16102 set readdir_r d_readdir_r
16103 eval $inlibc
16104 case "$d_readdir_r" in
16105 "$define")
16106         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16107         case "$d_readdir_r_proto:$usethreads" in
16108         ":define")      d_readdir_r_proto=define
16109                 set d_readdir_r_proto readdir_r $hdrs
16110                 eval $hasproto ;;
16111         *)      ;;
16112         esac
16113         case "$d_readdir_r_proto" in
16114         define)
16115         case "$readdir_r_proto" in
16116         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16117         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
16118         esac
16119         case "$readdir_r_proto" in
16120         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16121         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
16122         esac
16123         case "$readdir_r_proto" in
16124         ''|0)   d_readdir_r=undef
16125                 readdir_r_proto=0
16126                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16127         * )     case "$readdir_r_proto" in
16128                 REENTRANT_PROTO*) ;;
16129                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16130                 esac
16131                 echo "Prototype: $try" ;;
16132         esac
16133         ;;
16134         *)      case "$usethreads" in
16135                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16136                 esac
16137                 d_readdir_r=undef
16138                 readdir_r_proto=0
16139                 ;;
16140         esac
16141         ;;
16142 *)      readdir_r_proto=0
16143         ;;
16144 esac
16145
16146 : see if readv exists
16147 set readv d_readv
16148 eval $inlibc
16149
16150 : see if recvmsg exists
16151 set recvmsg d_recvmsg
16152 eval $inlibc
16153
16154 : see if rename exists
16155 set rename d_rename
16156 eval $inlibc
16157
16158 : see if rmdir exists
16159 set rmdir d_rmdir
16160 eval $inlibc
16161
16162 : see if memory.h is available.
16163 val=''
16164 set memory.h val
16165 eval $inhdr
16166
16167 : See if it conflicts with string.h
16168 case "$val" in
16169 $define)
16170         case "$strings" in
16171         '') ;;
16172         *)
16173                 $cppstdin $cppflags $cppminus < $strings > mem.h
16174                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16175                         echo " "
16176                         echo "We won't be including <memory.h>."
16177                         val="$undef"
16178                 fi
16179                 $rm -f mem.h
16180                 ;;
16181         esac
16182 esac
16183 set i_memory
16184 eval $setvar
16185
16186 : can bcopy handle overlapping blocks?
16187 echo " "
16188 val="$undef"
16189 case "$d_memmove" in
16190 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16191 *)      case "$d_bcopy" in
16192         "$define")
16193                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16194                 $cat >try.c <<EOCP
16195 #$i_memory I_MEMORY
16196 #$i_stdlib I_STDLIB
16197 #$i_string I_STRING
16198 #$i_unistd I_UNISTD
16199 EOCP
16200         $cat >>try.c <<'EOCP'
16201 #include <stdio.h>
16202 #ifdef I_MEMORY
16203 #  include <memory.h>
16204 #endif
16205 #ifdef I_STDLIB
16206 #  include <stdlib.h>
16207 #endif
16208 #ifdef I_STRING
16209 #  include <string.h>
16210 #else
16211 #  include <strings.h>
16212 #endif
16213 #ifdef I_UNISTD
16214 #  include <unistd.h>  /* Needed for NetBSD */
16215 #endif
16216 int main()
16217 {
16218 char buf[128], abc[128];
16219 char *b;
16220 int len;
16221 int off;
16222 int align;
16223
16224 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16225    try to store the string in read-only memory. */
16226 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16227
16228 for (align = 7; align >= 0; align--) {
16229         for (len = 36; len; len--) {
16230                 b = buf+align;
16231                 bcopy(abc, b, len);
16232                 for (off = 1; off <= len; off++) {
16233                         bcopy(b, b+off, len);
16234                         bcopy(b+off, b, len);
16235                         if (bcmp(b, abc, len))
16236                                 exit(1);
16237                 }
16238         }
16239 }
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 "It can't, sorry."
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         ;;
16258 esac
16259 set d_safebcpy
16260 eval $setvar
16261
16262 : can memcpy handle overlapping blocks?
16263 echo " "
16264 val="$undef"
16265 case "$d_memmove" in
16266 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16267 *)      case "$d_memcpy" in
16268         "$define")
16269                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16270                 $cat >try.c <<EOCP
16271 #$i_memory I_MEMORY
16272 #$i_stdlib I_STDLIB
16273 #$i_string I_STRING
16274 #$i_unistd I_UNISTD
16275 EOCP
16276         $cat >>try.c <<'EOCP'
16277 #include <stdio.h>
16278 #ifdef I_MEMORY
16279 #  include <memory.h>
16280 #endif
16281 #ifdef I_STDLIB
16282 #  include <stdlib.h>
16283 #endif
16284 #ifdef I_STRING
16285 #  include <string.h>
16286 #else
16287 #  include <strings.h>
16288 #endif
16289 #ifdef I_UNISTD
16290 #  include <unistd.h>  /* Needed for NetBSD */
16291 #endif
16292 int main()
16293 {
16294 char buf[128], abc[128];
16295 char *b;
16296 int len;
16297 int off;
16298 int align;
16299
16300 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16301    try to store the string in read-only memory. */
16302 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16303
16304 for (align = 7; align >= 0; align--) {
16305         for (len = 36; len; len--) {
16306                 b = buf+align;
16307                 memcpy(b, abc, len);
16308                 for (off = 1; off <= len; off++) {
16309                         memcpy(b+off, b, len);
16310                         memcpy(b, b+off, len);
16311                         if (memcmp(b, abc, len))
16312                                 exit(1);
16313                 }
16314         }
16315 }
16316 exit(0);
16317 }
16318 EOCP
16319                 set try
16320                 if eval $compile_ok; then
16321                         if $run ./try 2>/dev/null; then
16322                                 echo "Yes, it can."
16323                                 val="$define"
16324                         else
16325                                 echo "It can't, sorry."
16326                         fi
16327                 else
16328                         echo "(I can't compile the test program, so we'll assume not...)"
16329                 fi
16330                 ;;
16331         esac
16332         $rm_try
16333         ;;
16334 esac
16335 set d_safemcpy
16336 eval $setvar
16337
16338 : can memcmp be trusted to compare relative magnitude?
16339 val="$undef"
16340 case "$d_memcmp" in
16341 "$define")
16342         echo " "
16343         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16344         $cat >try.c <<EOCP
16345 #$i_memory I_MEMORY
16346 #$i_stdlib I_STDLIB
16347 #$i_string I_STRING
16348 #$i_unistd I_UNISTD
16349 EOCP
16350         $cat >>try.c <<'EOCP'
16351 #include <stdio.h>
16352 #ifdef I_MEMORY
16353 #  include <memory.h>
16354 #endif
16355 #ifdef I_STDLIB
16356 #  include <stdlib.h>
16357 #endif
16358 #ifdef I_STRING
16359 #  include <string.h>
16360 #else
16361 #  include <strings.h>
16362 #endif
16363 #ifdef I_UNISTD
16364 #  include <unistd.h>  /* Needed for NetBSD */
16365 #endif
16366 int main()
16367 {
16368 char a = -1;
16369 char b = 0;
16370 if ((a < b) && memcmp(&a, &b, 1) < 0)
16371         exit(1);
16372 exit(0);
16373 }
16374 EOCP
16375         set try
16376         if eval $compile_ok; then
16377                 if $run ./try 2>/dev/null; then
16378                         echo "Yes, it can."
16379                         val="$define"
16380                 else
16381                         echo "No, it can't (it uses signed chars)."
16382                 fi
16383         else
16384                 echo "(I can't compile the test program, so we'll assume not...)"
16385         fi
16386         ;;
16387 esac
16388 $rm_try
16389 set d_sanemcmp
16390 eval $setvar
16391
16392 : see if prototype for sbrk is available
16393 echo " "
16394 set d_sbrkproto sbrk $i_unistd unistd.h
16395 eval $hasproto
16396
16397 : see if select exists
16398 set select d_select
16399 eval $inlibc
16400
16401 : see if semctl exists
16402 set semctl d_semctl
16403 eval $inlibc
16404
16405 : see if semget exists
16406 set semget d_semget
16407 eval $inlibc
16408
16409 : see if semop exists
16410 set semop d_semop
16411 eval $inlibc
16412
16413 : see how much of the 'sem*(2)' library is present.
16414 h_sem=true
16415 echo " "
16416 case "$d_semctl$d_semget$d_semop" in
16417 *"$undef"*) h_sem=false;;
16418 esac
16419 case "$osname" in
16420 freebsd)
16421     case "`ipcs 2>&1`" in
16422     "SVID messages"*"not configured"*)
16423         echo "Your $osname does not have the sem*(2) configured." >&4
16424         h_sem=false
16425         val="$undef"
16426         set semctl d_semctl
16427         eval $setvar
16428         set semget d_semget
16429         eval $setvar
16430         set semop d_semop
16431         eval $setvar
16432         ;;
16433     esac
16434     ;;
16435 esac
16436 : we could also check for sys/ipc.h ...
16437 if $h_sem && $test `./findhdr sys/sem.h`; then
16438         echo "You have the full sem*(2) library." >&4
16439         val="$define"
16440 else
16441         echo "You don't have the full sem*(2) library." >&4
16442         val="$undef"
16443 fi
16444 set d_sem
16445 eval $setvar
16446
16447 : see whether sys/sem.h defines union semun
16448 echo " "
16449 $cat > try.c <<'END'
16450 #include <sys/types.h>
16451 #include <sys/ipc.h>
16452 #include <sys/sem.h>
16453 int main () { union semun semun; semun.buf = 0; }
16454 END
16455 set try
16456 if eval $compile; then
16457     echo "You have union semun in <sys/sem.h>." >&4
16458     val="$define"
16459 else
16460     echo "You do not have union semun in <sys/sem.h>." >&4
16461     val="$undef"
16462 fi
16463 $rm_try
16464 set d_union_semun
16465 eval $setvar
16466
16467 : see how to do semctl IPC_STAT
16468 case "$d_sem" in
16469 $define)
16470     echo " "
16471     $cat > tryh.h <<END
16472 #ifndef S_IRUSR
16473 #   ifdef S_IREAD
16474 #       define S_IRUSR S_IREAD
16475 #       define S_IWUSR S_IWRITE
16476 #       define S_IXUSR S_IEXEC
16477 #   else
16478 #       define S_IRUSR 0400
16479 #       define S_IWUSR 0200
16480 #       define S_IXUSR 0100
16481 #   endif
16482 #   define S_IRGRP (S_IRUSR>>3)
16483 #   define S_IWGRP (S_IWUSR>>3)
16484 #   define S_IXGRP (S_IXUSR>>3)
16485 #   define S_IROTH (S_IRUSR>>6)
16486 #   define S_IWOTH (S_IWUSR>>6)
16487 #   define S_IXOTH (S_IXUSR>>6)
16488 #endif
16489 #ifndef S_IRWXU
16490 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16491 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16492 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16493 #endif
16494 END
16495     : see whether semctl IPC_STAT can use union semun
16496     case "$d_semctl_semun" in
16497     '')
16498       val="$undef"
16499       $cat > try.c <<END
16500 #include <sys/types.h>
16501 #include <sys/ipc.h>
16502 #include <sys/sem.h>
16503 #include <sys/stat.h>
16504 #include <stdio.h>
16505 #include <errno.h>
16506 #include "tryh.h"
16507 #ifndef errno
16508 extern int errno;
16509 #endif
16510 #$d_union_semun HAS_UNION_SEMUN
16511 int main() {
16512     union semun
16513 #ifndef HAS_UNION_SEMUN
16514     {
16515         int val;
16516         struct semid_ds *buf;
16517         unsigned short *array;
16518     }
16519 #endif
16520     arg;
16521     int sem, st;
16522
16523 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16524     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16525     if (sem > -1) {
16526         struct semid_ds argbuf;
16527         arg.buf = &argbuf;
16528 #       ifdef IPC_STAT
16529         st = semctl(sem, 0, IPC_STAT, arg);
16530         if (st == 0)
16531             printf("semun\n");
16532         else
16533 #       endif /* IPC_STAT */
16534             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16535 #       ifdef IPC_RMID
16536         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16537 #       endif /* IPC_RMID */
16538             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16539     } else
16540 #endif /* IPC_PRIVATE && ... */
16541         printf("semget failed: errno = %d\n", errno);
16542   return 0;
16543 }
16544 END
16545       set try
16546       if eval $compile; then
16547           xxx=`$run ./try`
16548           case "$xxx" in
16549           semun) val="$define" ;;
16550           esac
16551       fi
16552       $rm_try
16553       set d_semctl_semun
16554       eval $setvar
16555       ;;
16556     esac
16557     case "$d_semctl_semun" in
16558     $define)
16559         echo "You can use union semun for semctl IPC_STAT." >&4
16560         also='also'
16561         ;;
16562     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16563         also=''
16564         ;;
16565     esac
16566
16567     : see whether semctl IPC_STAT can use struct semid_ds pointer
16568     case "$d_semctl_semid_ds" in
16569     '')
16570       val="$undef"
16571       $cat > try.c <<'END'
16572 #include <sys/types.h>
16573 #include <sys/ipc.h>
16574 #include <sys/sem.h>
16575 #include <sys/stat.h>
16576 #include "tryh.h"
16577 #include <stdio.h>
16578 #include <errno.h>
16579 #ifndef errno
16580 extern int errno;
16581 #endif
16582 int main() {
16583     struct semid_ds arg;
16584     int sem, st;
16585
16586 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16587     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16588     if (sem > -1) {
16589 #       ifdef IPC_STAT
16590         st = semctl(sem, 0, IPC_STAT, &arg);
16591         if (st == 0)
16592             printf("semid_ds\n");
16593         else
16594 #       endif /* IPC_STAT */
16595             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16596 #       ifdef IPC_RMID
16597         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16598 #       endif /* IPC_RMID */
16599             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16600     } else
16601 #endif /* IPC_PRIVATE && ... */
16602         printf("semget failed: errno = %d\n", errno);
16603
16604     return 0;
16605 }
16606 END
16607       set try
16608       if eval $compile; then
16609           xxx=`$run ./try`
16610           case "$xxx" in
16611           semid_ds) val="$define" ;;
16612           esac
16613       fi
16614       $rm_try
16615       set d_semctl_semid_ds
16616       eval $setvar
16617       ;;
16618     esac
16619     case "$d_semctl_semid_ds" in
16620     $define)
16621         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16622         ;;
16623     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16624         ;;
16625     esac
16626     ;;
16627 *)  val="$undef"
16628
16629     # We do not have the full sem*(2) library, so assume we can not
16630     # use either.
16631
16632     set d_semctl_semun
16633     eval $setvar
16634
16635     set d_semctl_semid_ds
16636     eval $setvar
16637     ;;
16638 esac
16639 $rm_try tryh.h
16640
16641 : see if sendmsg exists
16642 set sendmsg d_sendmsg
16643 eval $inlibc
16644
16645 : see if setegid exists
16646 set setegid d_setegid
16647 eval $inlibc
16648
16649 : see if seteuid exists
16650 set seteuid d_seteuid
16651 eval $inlibc
16652
16653 : see if setgrent exists
16654 set setgrent d_setgrent
16655 eval $inlibc
16656
16657 : see if setgrent_r exists
16658 set setgrent_r d_setgrent_r
16659 eval $inlibc
16660 case "$d_setgrent_r" in
16661 "$define")
16662         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16663         case "$d_setgrent_r_proto:$usethreads" in
16664         ":define")      d_setgrent_r_proto=define
16665                 set d_setgrent_r_proto setgrent_r $hdrs
16666                 eval $hasproto ;;
16667         *)      ;;
16668         esac
16669         case "$d_setgrent_r_proto" in
16670         define)
16671         case "$setgrent_r_proto" in
16672         ''|0) try='int setgrent_r(FILE**);'
16673         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
16674         esac
16675         case "$setgrent_r_proto" in
16676         ''|0) try='void setgrent_r(FILE**);'
16677         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
16678         esac
16679         case "$setgrent_r_proto" in
16680         ''|0)   d_setgrent_r=undef
16681                 setgrent_r_proto=0
16682                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16683         * )     case "$setgrent_r_proto" in
16684                 REENTRANT_PROTO*) ;;
16685                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16686                 esac
16687                 echo "Prototype: $try" ;;
16688         esac
16689         ;;
16690         *)      case "$usethreads" in
16691                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16692                 esac
16693                 d_setgrent_r=undef
16694                 setgrent_r_proto=0
16695                 ;;
16696         esac
16697         ;;
16698 *)      setgrent_r_proto=0
16699         ;;
16700 esac
16701
16702 : see if sethostent exists
16703 set sethostent d_sethent
16704 eval $inlibc
16705
16706 : see if sethostent_r exists
16707 set sethostent_r d_sethostent_r
16708 eval $inlibc
16709 case "$d_sethostent_r" in
16710 "$define")
16711         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16712         case "$d_sethostent_r_proto:$usethreads" in
16713         ":define")      d_sethostent_r_proto=define
16714                 set d_sethostent_r_proto sethostent_r $hdrs
16715                 eval $hasproto ;;
16716         *)      ;;
16717         esac
16718         case "$d_sethostent_r_proto" in
16719         define)
16720         case "$sethostent_r_proto" in
16721         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16722         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16723         esac
16724         case "$sethostent_r_proto" in
16725         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16726         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16727         esac
16728         case "$sethostent_r_proto" in
16729         ''|0)   d_sethostent_r=undef
16730                 sethostent_r_proto=0
16731                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16732         * )     case "$sethostent_r_proto" in
16733                 REENTRANT_PROTO*) ;;
16734                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16735                 esac
16736                 echo "Prototype: $try" ;;
16737         esac
16738         ;;
16739         *)      case "$usethreads" in
16740                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16741                 esac
16742                 d_sethostent_r=undef
16743                 sethostent_r_proto=0
16744                 ;;
16745         esac
16746         ;;
16747 *)      sethostent_r_proto=0
16748         ;;
16749 esac
16750
16751 : see if setitimer exists
16752 set setitimer d_setitimer
16753 eval $inlibc
16754
16755 : see if setlinebuf exists
16756 set setlinebuf d_setlinebuf
16757 eval $inlibc
16758
16759 : see if setlocale exists
16760 set setlocale d_setlocale
16761 eval $inlibc
16762
16763 : see if locale.h is available
16764 set locale.h i_locale
16765 eval $inhdr
16766
16767 : see if setlocale_r exists
16768 set setlocale_r d_setlocale_r
16769 eval $inlibc
16770 case "$d_setlocale_r" in
16771 "$define")
16772         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16773         case "$d_setlocale_r_proto:$usethreads" in
16774         ":define")      d_setlocale_r_proto=define
16775                 set d_setlocale_r_proto setlocale_r $hdrs
16776                 eval $hasproto ;;
16777         *)      ;;
16778         esac
16779         case "$d_setlocale_r_proto" in
16780         define)
16781         case "$setlocale_r_proto" in
16782         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16783         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16784         esac
16785         case "$setlocale_r_proto" in
16786         ''|0)   d_setlocale_r=undef
16787                 setlocale_r_proto=0
16788                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16789         * )     case "$setlocale_r_proto" in
16790                 REENTRANT_PROTO*) ;;
16791                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16792                 esac
16793                 echo "Prototype: $try" ;;
16794         esac
16795         ;;
16796         *)      case "$usethreads" in
16797                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16798                 esac
16799                 d_setlocale_r=undef
16800                 setlocale_r_proto=0
16801                 ;;
16802         esac
16803         ;;
16804 *)      setlocale_r_proto=0
16805         ;;
16806 esac
16807
16808 : see if setnetent exists
16809 set setnetent d_setnent
16810 eval $inlibc
16811
16812 : see if setnetent_r exists
16813 set setnetent_r d_setnetent_r
16814 eval $inlibc
16815 case "$d_setnetent_r" in
16816 "$define")
16817         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16818         case "$d_setnetent_r_proto:$usethreads" in
16819         ":define")      d_setnetent_r_proto=define
16820                 set d_setnetent_r_proto setnetent_r $hdrs
16821                 eval $hasproto ;;
16822         *)      ;;
16823         esac
16824         case "$d_setnetent_r_proto" in
16825         define)
16826         case "$setnetent_r_proto" in
16827         ''|0) try='int setnetent_r(int, struct netent_data*);'
16828         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16829         esac
16830         case "$setnetent_r_proto" in
16831         ''|0) try='void setnetent_r(int, struct netent_data*);'
16832         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16833         esac
16834         case "$setnetent_r_proto" in
16835         ''|0)   d_setnetent_r=undef
16836                 setnetent_r_proto=0
16837                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16838         * )     case "$setnetent_r_proto" in
16839                 REENTRANT_PROTO*) ;;
16840                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16841                 esac
16842                 echo "Prototype: $try" ;;
16843         esac
16844         ;;
16845         *)      case "$usethreads" in
16846                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16847                 esac
16848                 d_setnetent_r=undef
16849                 setnetent_r_proto=0
16850                 ;;
16851         esac
16852         ;;
16853 *)      setnetent_r_proto=0
16854         ;;
16855 esac
16856
16857 : see if setprotoent exists
16858 set setprotoent d_setpent
16859 eval $inlibc
16860
16861 : see if setpgid exists
16862 set setpgid d_setpgid
16863 eval $inlibc
16864
16865 : see if setpgrp2 exists
16866 set setpgrp2 d_setpgrp2
16867 eval $inlibc
16868
16869 : see if setpriority exists
16870 set setpriority d_setprior
16871 eval $inlibc
16872
16873 : see if setproctitle exists
16874 set setproctitle d_setproctitle
16875 eval $inlibc
16876
16877 : see if setprotoent_r exists
16878 set setprotoent_r d_setprotoent_r
16879 eval $inlibc
16880 case "$d_setprotoent_r" in
16881 "$define")
16882         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16883         case "$d_setprotoent_r_proto:$usethreads" in
16884         ":define")      d_setprotoent_r_proto=define
16885                 set d_setprotoent_r_proto setprotoent_r $hdrs
16886                 eval $hasproto ;;
16887         *)      ;;
16888         esac
16889         case "$d_setprotoent_r_proto" in
16890         define)
16891         case "$setprotoent_r_proto" in
16892         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16893         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16894         esac
16895         case "$setprotoent_r_proto" in
16896         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16897         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16898         esac
16899         case "$setprotoent_r_proto" in
16900         ''|0)   d_setprotoent_r=undef
16901                 setprotoent_r_proto=0
16902                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16903         * )     case "$setprotoent_r_proto" in
16904                 REENTRANT_PROTO*) ;;
16905                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16906                 esac
16907                 echo "Prototype: $try" ;;
16908         esac
16909         ;;
16910         *)      case "$usethreads" in
16911                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16912                 esac
16913                 d_setprotoent_r=undef
16914                 setprotoent_r_proto=0
16915                 ;;
16916         esac
16917         ;;
16918 *)      setprotoent_r_proto=0
16919         ;;
16920 esac
16921
16922 : see if setpwent exists
16923 set setpwent d_setpwent
16924 eval $inlibc
16925
16926 : see if setpwent_r exists
16927 set setpwent_r d_setpwent_r
16928 eval $inlibc
16929 case "$d_setpwent_r" in
16930 "$define")
16931         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16932         case "$d_setpwent_r_proto:$usethreads" in
16933         ":define")      d_setpwent_r_proto=define
16934                 set d_setpwent_r_proto setpwent_r $hdrs
16935                 eval $hasproto ;;
16936         *)      ;;
16937         esac
16938         case "$d_setpwent_r_proto" in
16939         define)
16940         case "$setpwent_r_proto" in
16941         ''|0) try='int setpwent_r(FILE**);'
16942         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16943         esac
16944         case "$setpwent_r_proto" in
16945         ''|0) try='void setpwent_r(FILE**);'
16946         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16947         esac
16948         case "$setpwent_r_proto" in
16949         ''|0)   d_setpwent_r=undef
16950                 setpwent_r_proto=0
16951                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16952         * )     case "$setpwent_r_proto" in
16953                 REENTRANT_PROTO*) ;;
16954                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16955                 esac
16956                 echo "Prototype: $try" ;;
16957         esac
16958         ;;
16959         *)      case "$usethreads" in
16960                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16961                 esac
16962                 d_setpwent_r=undef
16963                 setpwent_r_proto=0
16964                 ;;
16965         esac
16966         ;;
16967 *)      setpwent_r_proto=0
16968         ;;
16969 esac
16970
16971 : see if setregid exists
16972 set setregid d_setregid
16973 eval $inlibc
16974 set setresgid d_setresgid
16975 eval $inlibc
16976
16977 : see if setreuid exists
16978 set setreuid d_setreuid
16979 eval $inlibc
16980 set setresuid d_setresuid
16981 eval $inlibc
16982
16983 : see if setrgid exists
16984 set setrgid d_setrgid
16985 eval $inlibc
16986
16987 : see if setruid exists
16988 set setruid d_setruid
16989 eval $inlibc
16990
16991 : see if setservent exists
16992 set setservent d_setsent
16993 eval $inlibc
16994
16995 : see if setservent_r exists
16996 set setservent_r d_setservent_r
16997 eval $inlibc
16998 case "$d_setservent_r" in
16999 "$define")
17000         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17001         case "$d_setservent_r_proto:$usethreads" in
17002         ":define")      d_setservent_r_proto=define
17003                 set d_setservent_r_proto setservent_r $hdrs
17004                 eval $hasproto ;;
17005         *)      ;;
17006         esac
17007         case "$d_setservent_r_proto" in
17008         define)
17009         case "$setservent_r_proto" in
17010         ''|0) try='int setservent_r(int, struct servent_data*);'
17011         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
17012         esac
17013         case "$setservent_r_proto" in
17014         ''|0) try='void setservent_r(int, struct servent_data*);'
17015         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
17016         esac
17017         case "$setservent_r_proto" in
17018         ''|0)   d_setservent_r=undef
17019                 setservent_r_proto=0
17020                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17021         * )     case "$setservent_r_proto" in
17022                 REENTRANT_PROTO*) ;;
17023                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17024                 esac
17025                 echo "Prototype: $try" ;;
17026         esac
17027         ;;
17028         *)      case "$usethreads" in
17029                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17030                 esac
17031                 d_setservent_r=undef
17032                 setservent_r_proto=0
17033                 ;;
17034         esac
17035         ;;
17036 *)      setservent_r_proto=0
17037         ;;
17038 esac
17039
17040 : see if setsid exists
17041 set setsid d_setsid
17042 eval $inlibc
17043
17044 : see if setvbuf exists
17045 set setvbuf d_setvbuf
17046 eval $inlibc
17047
17048 : see if sfio.h is available
17049 set sfio.h i_sfio
17050 eval $inhdr
17051
17052 : see if sfio library is available
17053 case "$i_sfio" in
17054 $define)
17055         val=''
17056         set sfreserve val
17057         eval $inlibc
17058         ;;
17059 *)
17060         val="$undef"
17061         ;;
17062 esac
17063 : Ok, but do we want to use it.
17064 case "$val" in
17065 $define)
17066         case "$usesfio" in
17067         true|$define|[yY]*) dflt='y';;
17068         *) dflt='n';;
17069         esac
17070         echo "$package can use the sfio library, but it is experimental."
17071         case "$useperlio" in
17072         "$undef")
17073             echo "For sfio also the PerlIO abstraction layer is needed."
17074             echo "Earlier you said you wouldn't want that."
17075             ;;
17076         esac
17077         rp="You seem to have sfio available, do you want to try using it?"
17078         . ./myread
17079         case "$ans" in
17080         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
17081                 useperlio="$define"
17082                 val="$define"
17083                 ;;
17084         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17085                 val="$undef"
17086                 ;;
17087         esac
17088         ;;
17089 *)      case "$usesfio" in
17090         true|$define|[yY]*)
17091                 echo "Sorry, cannot find sfio on this machine." >&4
17092                 echo "Ignoring your setting of usesfio=$usesfio." >&4
17093                 val="$undef"
17094                 ;;
17095         esac
17096         ;;
17097 esac
17098 set d_sfio
17099 eval $setvar
17100 case "$d_sfio" in
17101 $define) usesfio='true';;
17102 *) usesfio='false';;
17103 esac
17104 case "$d_sfio" in
17105 $define) ;;
17106 *)      : Remove sfio from list of libraries to use
17107         case "$libs" in
17108         *-lsfio*)
17109                 echo "Removing unneeded -lsfio from library list" >&4
17110                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17111                 shift
17112                 libs="$*"
17113                 echo "libs = $libs" >&4
17114                 ;;
17115         esac
17116 ;;
17117 esac
17118
17119
17120 : see if shmctl exists
17121 set shmctl d_shmctl
17122 eval $inlibc
17123
17124 : see if shmget exists
17125 set shmget d_shmget
17126 eval $inlibc
17127
17128 : see if shmat exists
17129 set shmat d_shmat
17130 eval $inlibc
17131 : see what shmat returns
17132 case "$d_shmat" in
17133 "$define")
17134         $cat >shmat.c <<'END'
17135 #include <sys/shm.h>
17136 void *shmat();
17137 END
17138         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17139                 shmattype='void *'
17140         else
17141                 shmattype='char *'
17142         fi
17143         echo "and it returns ($shmattype)." >&4
17144         : see if a prototype for shmat is available
17145         xxx=`./findhdr sys/shm.h`
17146         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17147         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17148                 val="$define"
17149         else
17150                 val="$undef"
17151         fi
17152         $rm -f shmat.[co]
17153         ;;
17154 *)
17155         val="$undef"
17156         ;;
17157 esac
17158 set d_shmatprototype
17159 eval $setvar
17160
17161 : see if shmdt exists
17162 set shmdt d_shmdt
17163 eval $inlibc
17164
17165 : see how much of the 'shm*(2)' library is present.
17166 h_shm=true
17167 echo " "
17168 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17169 *"$undef"*) h_shm=false;;
17170 esac
17171 case "$osname" in
17172 freebsd)
17173     case "`ipcs 2>&1`" in
17174     "SVID shared memory"*"not configured"*)
17175         echo "Your $osname does not have the shm*(2) configured." >&4
17176         h_shm=false
17177         val="$undef"
17178         set shmctl d_shmctl
17179         evat $setvar
17180         set shmget d_shmget
17181         evat $setvar
17182         set shmat d_shmat
17183         evat $setvar
17184         set shmdt d_shmdt
17185         evat $setvar
17186         ;;
17187     esac
17188     ;;
17189 esac
17190 : we could also check for sys/ipc.h ...
17191 if $h_shm && $test `./findhdr sys/shm.h`; then
17192         echo "You have the full shm*(2) library." >&4
17193         val="$define"
17194 else
17195         echo "You don't have the full shm*(2) library." >&4
17196         val="$undef"
17197 fi
17198 set d_shm
17199 eval $setvar
17200
17201 : see if we have sigaction
17202 echo " "
17203 if set sigaction val -f d_sigaction; eval $csym; $val; then
17204         echo 'sigaction() found.' >&4
17205         $cat > try.c <<EOP
17206 #include <stdio.h>
17207 #include <sys/types.h>
17208 #include <signal.h>
17209 #$i_stdlib I_STDLIB
17210 #ifdef I_STDLIB
17211 #include <stdlib.h>
17212 #endif
17213 int main()
17214 {
17215     struct sigaction act, oact;
17216     act.sa_flags = 0;
17217     oact.sa_handler = 0;
17218     /* so that act and oact are used */
17219     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17220 }
17221 EOP
17222         set try
17223         if eval $compile_ok; then
17224                 val="$define"
17225         else
17226                 echo "But you don't seem to have a useable struct sigaction." >&4
17227                 val="$undef"
17228         fi
17229 else
17230         echo 'sigaction NOT found.' >&4
17231         val="$undef"
17232 fi
17233 set d_sigaction; eval $setvar
17234 $rm_try
17235
17236 : see if this is a sunmath.h system
17237 set sunmath.h i_sunmath
17238 eval $inhdr
17239
17240 : see if signbit exists
17241 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17242 $cat >try.c <<EOCP
17243 #$i_math I_MATH
17244 #$i_sunmath I_SUNMATH
17245 #ifdef I_MATH
17246 #  include <math.h>
17247 #endif
17248 #ifdef I_SUNMATH  /* Solaris special math library */
17249 #  include <sunmath.h>
17250 #endif
17251 #define NV $nvtype
17252 int main(int argc, char **argv)
17253 {
17254     NV x = 0.0;
17255     NV y = -0.0;
17256     if ((signbit(x) == 0) && (signbit(y) != 0))
17257         return 0;
17258     else
17259         return 1;
17260 }
17261 EOCP
17262 val="$undef"
17263 set try
17264 if eval $compile; then
17265     if $run ./try; then
17266         $echo "Yes." >&4
17267         val="$define"
17268     else
17269         $echo "Signbit seems to be available, but doesn't work as I expected."
17270         $echo "I won't use it." >&4
17271         val="$undef"
17272     fi
17273 else
17274     $echo "Nope." >&4
17275     dflt="$undef"
17276 fi
17277 set d_signbit
17278 eval $setvar
17279 $rm_try
17280
17281 : see if sigprocmask exists
17282 set sigprocmask d_sigprocmask
17283 eval $inlibc
17284
17285 : see if sigsetjmp exists
17286 echo " "
17287 case "$d_sigsetjmp" in
17288 '')
17289         $cat >try.c <<EOP
17290 #include <setjmp.h>
17291 #$i_stdlib I_STDLIB
17292 #ifdef I_STDLIB
17293 #include <stdlib.h>
17294 #endif
17295 sigjmp_buf env;
17296 int set = 1;
17297 int main()
17298 {
17299         if (sigsetjmp(env,1))
17300                 exit(set);
17301         set = 0;
17302         siglongjmp(env, 1);
17303         exit(1);
17304 }
17305 EOP
17306         set try
17307         if eval $compile; then
17308                 if $run ./try >/dev/null 2>&1; then
17309                         echo "POSIX sigsetjmp found." >&4
17310                         val="$define"
17311                 else
17312                         $cat >&4 <<EOM
17313 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17314 I'll ignore them.
17315 EOM
17316                         val="$undef"
17317                 fi
17318         else
17319                 echo "sigsetjmp not found." >&4
17320                 val="$undef"
17321         fi
17322         ;;
17323 *) val="$d_sigsetjmp"
17324         case "$d_sigsetjmp" in
17325         $define) echo "POSIX sigsetjmp found." >&4;;
17326         $undef) echo "sigsetjmp not found." >&4;;
17327         esac
17328         ;;
17329 esac
17330 set d_sigsetjmp
17331 eval $setvar
17332 $rm_try
17333
17334 : see if snprintf exists
17335 set snprintf d_snprintf
17336 eval $inlibc
17337
17338 : see if vsnprintf exists
17339 set vsnprintf d_vsnprintf
17340 eval $inlibc
17341
17342 case "$d_snprintf-$d_vsnprintf" in
17343 "$define-$define")
17344     $cat <<EOM
17345 Checking whether your snprintf() and vsnprintf() work okay...
17346 EOM
17347     $cat >try.c <<'EOCP'
17348 /* v?snprintf testing logic courtesy of Russ Allbery.
17349  * According to C99:
17350  * - if the buffer is too short it still must be \0-terminated
17351  * - if the buffer is too short the potentially required length
17352  *   must be returned and not -1
17353  * - if the buffer is NULL the potentially required length
17354  *   must be returned and not -1 or core dump
17355  */
17356 #include <stdio.h>
17357 #include <stdarg.h>
17358
17359 char buf[2];
17360
17361 int test (char *format, ...)
17362 {
17363     va_list args;
17364     int count;
17365
17366     va_start (args, format);
17367     count = vsnprintf (buf, sizeof buf, format, args);
17368     va_end (args);
17369     return count;
17370 }
17371
17372 int main ()
17373 {
17374     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17375              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17376 }
17377 EOCP
17378     set try
17379     if eval $compile; then
17380         `$run ./try`
17381         case "$?" in
17382         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17383         *) cat <<EOM >&4
17384 Your snprintf() and snprintf() don't seem to be working okay.
17385 EOM
17386            d_snprintf="$undef"
17387            d_vsnprintf="$undef"
17388            ;;
17389         esac
17390     else
17391         echo "(I can't seem to compile the test program--assuming they don't)"
17392         d_snprintf="$undef"
17393         d_vsnprintf="$undef"
17394     fi
17395     $rm_try
17396     ;;
17397 esac
17398
17399 : see if sockatmark exists
17400 set sockatmark d_sockatmark
17401 eval $inlibc
17402
17403 : see if prototype for sockatmark is available
17404 echo " "
17405 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17406 eval $hasproto
17407
17408 : see if socks5_init exists
17409 set socks5_init d_socks5_init
17410 eval $inlibc
17411
17412 : see if sprintf returns the length of the string in the buffer as per ANSI
17413 $echo "Checking whether sprintf returns the length of the string..." >&4
17414 $cat <<EOP >try.c
17415 #include <stdio.h>
17416 #$i_stdlib I_STDLIB
17417 #ifdef I_STDLIB
17418 #include <stdlib.h>
17419 #endif
17420 #$i_string I_STRING
17421 #ifdef I_STRING
17422 #  include <string.h>
17423 #else
17424 #  include <strings.h>
17425 #endif
17426 #$i_math I_MATH
17427 #ifdef I_MATH
17428 #include <math.h>
17429 #endif
17430
17431 char buffer[256];
17432
17433 int check (size_t expect, int test) {
17434   size_t got = strlen(buffer);
17435   if (expect == got)
17436     return 0;
17437
17438   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17439        test, buffer);
17440   exit (test);
17441 }
17442
17443 int main(int argc, char **argv) {
17444   int test = 0;
17445
17446   check(sprintf(buffer, ""), ++test);
17447   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17448   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17449
17450   return 0;
17451 }
17452 EOP
17453 set try
17454
17455 d_sprintf_returns_strlen="$undef"
17456 if eval $compile; then
17457     xxx="`$run ./try`"
17458     case "$?" in
17459         0) cat >&4 <<EOM
17460 sprintf returns the length of the string (as ANSI says it should)
17461 EOM
17462         d_sprintf_returns_strlen="$define"
17463         ;;
17464         *) cat >&4 <<EOM
17465 sprintf does not return the length of the string (how old is this system?)
17466 EOM
17467         d_sprintf_returns_strlen="$undef"
17468         ;;
17469     esac
17470 fi
17471 $rm_try
17472
17473 : see if srand48_r exists
17474 set srand48_r d_srand48_r
17475 eval $inlibc
17476 case "$d_srand48_r" in
17477 "$define")
17478         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17479         case "$d_srand48_r_proto:$usethreads" in
17480         ":define")      d_srand48_r_proto=define
17481                 set d_srand48_r_proto srand48_r $hdrs
17482                 eval $hasproto ;;
17483         *)      ;;
17484         esac
17485         case "$d_srand48_r_proto" in
17486         define)
17487         case "$srand48_r_proto" in
17488         ''|0) try='int srand48_r(long, struct drand48_data*);'
17489         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
17490         esac
17491         case "$srand48_r_proto" in
17492         ''|0)   d_srand48_r=undef
17493                 srand48_r_proto=0
17494                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17495         * )     case "$srand48_r_proto" in
17496                 REENTRANT_PROTO*) ;;
17497                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17498                 esac
17499                 echo "Prototype: $try" ;;
17500         esac
17501         ;;
17502         *)      case "$usethreads" in
17503                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17504                 esac
17505                 d_srand48_r=undef
17506                 srand48_r_proto=0
17507                 ;;
17508         esac
17509         ;;
17510 *)      srand48_r_proto=0
17511         ;;
17512 esac
17513
17514 : see if srandom_r exists
17515 set srandom_r d_srandom_r
17516 eval $inlibc
17517 case "$d_srandom_r" in
17518 "$define")
17519         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17520         case "$d_srandom_r_proto:$usethreads" in
17521         ":define")      d_srandom_r_proto=define
17522                 set d_srandom_r_proto srandom_r $hdrs
17523                 eval $hasproto ;;
17524         *)      ;;
17525         esac
17526         case "$d_srandom_r_proto" in
17527         define)
17528         case "$srandom_r_proto" in
17529         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17530         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
17531         esac
17532         case "$srandom_r_proto" in
17533         ''|0)   d_srandom_r=undef
17534                 srandom_r_proto=0
17535                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17536         * )     case "$srandom_r_proto" in
17537                 REENTRANT_PROTO*) ;;
17538                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17539                 esac
17540                 echo "Prototype: $try" ;;
17541         esac
17542         ;;
17543         *)      case "$usethreads" in
17544                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17545                 esac
17546                 d_srandom_r=undef
17547                 srandom_r_proto=0
17548                 ;;
17549         esac
17550         ;;
17551 *)      srandom_r_proto=0
17552         ;;
17553 esac
17554
17555 : see if prototype for setresgid is available
17556 echo " "
17557 set d_sresgproto setresgid $i_unistd unistd.h
17558 eval $hasproto
17559
17560 : see if prototype for setresuid is available
17561 echo " "
17562 set d_sresuproto setresuid $i_unistd unistd.h
17563 eval $hasproto
17564
17565 : see if sys/stat.h is available
17566 set sys/stat.h i_sysstat
17567 eval $inhdr
17568
17569 : see if stat knows about block sizes
17570 echo " "
17571 echo "Checking to see if your struct stat has st_blocks field..." >&4
17572 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17573 eval $hasfield
17574
17575 : see if this is a sys/vfs.h system
17576 set sys/vfs.h i_sysvfs
17577 eval $inhdr
17578
17579 : see if this is a sys/statfs.h system
17580 set sys/statfs.h i_sysstatfs
17581 eval $inhdr
17582
17583 : Check for statfs_s
17584 echo " "
17585 echo "Checking to see if your system supports struct statfs..." >&4
17586 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
17587 eval $hasstruct
17588 case "$d_statfs_s" in
17589 "$define")      echo "Yes, it does."   ;;
17590 *)              echo "No, it doesn't." ;;
17591 esac
17592
17593
17594 : see if struct statfs knows about f_flags
17595 case "$d_statfs_s" in
17596 define)
17597         echo " "
17598         echo "Checking to see if your struct statfs has f_flags field..." >&4
17599         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
17600         eval $hasfield
17601         ;;
17602 *)      val="$undef"
17603         set d_statfs_f_flags
17604         eval $setvar
17605         ;;
17606 esac
17607 case "$d_statfs_f_flags" in
17608 "$define")      echo "Yes, it does."   ;;
17609 *)              echo "No, it doesn't." ;;
17610 esac
17611
17612 : Check stream access
17613 $cat >&4 <<EOM
17614 Checking how to access stdio streams by file descriptor number...
17615 EOM
17616 case "$stdio_stream_array" in
17617 '')     $cat >try.c <<EOCP
17618 #include <stdio.h>
17619 int main() {
17620   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17621     printf("yes\n");
17622 }
17623 EOCP
17624         for s in _iob __iob __sF
17625         do
17626                 set try -DSTDIO_STREAM_ARRAY=$s
17627                 if eval $compile; then
17628                         case "`$run ./try`" in
17629                         yes)    stdio_stream_array=$s; break ;;
17630                         esac
17631                 fi
17632         done
17633         $rm_try
17634 esac
17635 case "$stdio_stream_array" in
17636 '')     $cat >&4 <<EOM
17637 I can't figure out how to access stdio streams by file descriptor number.
17638 EOM
17639         d_stdio_stream_array="$undef"
17640         ;;
17641 *)      $cat >&4 <<EOM
17642 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17643 EOM
17644         d_stdio_stream_array="$define"
17645         ;;
17646 esac
17647
17648 : see if strcoll exists
17649 set strcoll d_strcoll
17650 eval $inlibc
17651
17652 : check for structure copying
17653 echo " "
17654 echo "Checking to see if your C compiler can copy structs..." >&4
17655 $cat >try.c <<'EOCP'
17656 int main()
17657 {
17658         struct blurfl {
17659                 int dyick;
17660         } foo, bar;
17661
17662         foo = bar;
17663 }
17664 EOCP
17665 if $cc -c try.c >/dev/null 2>&1 ; then
17666         val="$define"
17667         echo "Yup, it can."
17668 else
17669         val="$undef"
17670         echo "Nope, it can't."
17671 fi
17672 set d_strctcpy
17673 eval $setvar
17674 $rm_try
17675
17676 : see if strerror and/or sys_errlist[] exist
17677 echo " "
17678 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17679     if set strerror val -f d_strerror; eval $csym; $val; then
17680                 echo 'strerror() found.' >&4
17681                 d_strerror="$define"
17682                 d_strerrm='strerror(e)'
17683                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17684                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17685                         d_syserrlst="$define"
17686                 else
17687                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17688                         d_syserrlst="$undef"
17689                 fi
17690     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17691                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17692                 echo 'strerror() found in string header.' >&4
17693                 d_strerror="$define"
17694                 d_strerrm='strerror(e)'
17695                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17696                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17697                                 d_syserrlst="$define"
17698                 else
17699                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17700                         d_syserrlst="$undef"
17701                 fi
17702     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17703                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17704                 d_strerror="$undef"
17705                 d_syserrlst="$define"
17706                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17707     else
17708                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17709                 d_strerror="$undef"
17710                 d_syserrlst="$undef"
17711                 d_strerrm='"unknown"'
17712     fi
17713 fi
17714
17715 : see if strerror_r exists
17716 set strerror_r d_strerror_r
17717 eval $inlibc
17718 case "$d_strerror_r" in
17719 "$define")
17720         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17721         case "$d_strerror_r_proto:$usethreads" in
17722         ":define")      d_strerror_r_proto=define
17723                 set d_strerror_r_proto strerror_r $hdrs
17724                 eval $hasproto ;;
17725         *)      ;;
17726         esac
17727         case "$d_strerror_r_proto" in
17728         define)
17729         case "$strerror_r_proto" in
17730         ''|0) try='int strerror_r(int, char*, size_t);'
17731         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17732         esac
17733         case "$strerror_r_proto" in
17734         ''|0) try='int strerror_r(int, char*, int);'
17735         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17736         esac
17737         case "$strerror_r_proto" in
17738         ''|0) try='char* strerror_r(int, char*, size_t);'
17739         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17740         esac
17741         case "$strerror_r_proto" in
17742         ''|0)   d_strerror_r=undef
17743                 strerror_r_proto=0
17744                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17745         * )     case "$strerror_r_proto" in
17746                 REENTRANT_PROTO*) ;;
17747                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17748                 esac
17749                 echo "Prototype: $try" ;;
17750         esac
17751         ;;
17752         *)      case "$usethreads" in
17753                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17754                 esac
17755                 d_strerror_r=undef
17756                 strerror_r_proto=0
17757                 ;;
17758         esac
17759         ;;
17760 *)      strerror_r_proto=0
17761         ;;
17762 esac
17763
17764 : see if strftime exists
17765 set strftime d_strftime
17766 eval $inlibc
17767
17768 : see if strlcat exists
17769 set strlcat d_strlcat
17770 eval $inlibc
17771
17772 : see if strlcpy exists
17773 set strlcpy d_strlcpy
17774 eval $inlibc
17775
17776 : see if strtod exists
17777 set strtod d_strtod
17778 eval $inlibc
17779
17780 : see if strtol exists
17781 set strtol d_strtol
17782 eval $inlibc
17783
17784 : see if strtold exists
17785 set strtold d_strtold
17786 eval $inlibc
17787
17788 : see if strtoll exists
17789 set strtoll d_strtoll
17790 eval $inlibc
17791
17792 case "$d_longlong-$d_strtoll" in
17793 "$define-$define")
17794         $cat <<EOM
17795 Checking whether your strtoll() works okay...
17796 EOM
17797         $cat >try.c <<'EOCP'
17798 #include <errno.h>
17799 #ifdef __hpux
17800 #define strtoll __strtoll
17801 #endif
17802 #ifdef __EMX__
17803 #define strtoll _strtoll
17804 #endif
17805 #include <stdio.h>
17806 extern long long int strtoll(char *s, char **, int);
17807 static int bad = 0;
17808 int check(char *s, long long ell, int een) {
17809         long long gll;
17810         errno = 0;
17811         gll = strtoll(s, 0, 10);
17812         if (!((gll == ell) && (errno == een)))
17813                 bad++;
17814 }
17815 int main() {
17816         check(" 1",                                      1LL, 0);
17817         check(" 0",                                      0LL, 0);
17818         check("-1",                                     -1LL, 0);
17819         check("-9223372036854775808", -9223372036854775808LL, 0);
17820         check("-9223372036854775808", -9223372036854775808LL, 0);
17821         check(" 9223372036854775807",  9223372036854775807LL, 0);
17822         check("-9223372036854775808", -9223372036854775808LL, 0);
17823         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17824         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17825         if (!bad)
17826                 printf("ok\n");
17827 }
17828 EOCP
17829         set try
17830         if eval $compile; then
17831                 yyy=`$run ./try`
17832                 case "$yyy" in
17833                 ok) echo "Your strtoll() seems to be working okay." ;;
17834                 *) cat <<EOM >&4
17835 Your strtoll() doesn't seem to be working okay.
17836 EOM
17837                    d_strtoll="$undef"
17838                    ;;
17839                 esac
17840         else
17841                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17842                 d_strtoll="$undef"
17843         fi
17844         ;;
17845 esac
17846
17847 : see if strtoq exists
17848 set strtoq d_strtoq
17849 eval $inlibc
17850
17851 : see if strtoul exists
17852 set strtoul d_strtoul
17853 eval $inlibc
17854
17855 case "$d_strtoul" in
17856 "$define")
17857         $cat <<EOM
17858 Checking whether your strtoul() works okay...
17859 EOM
17860         $cat >try.c <<'EOCP'
17861 #include <errno.h>
17862 #include <stdio.h>
17863 extern unsigned long int strtoul(char *s, char **, int);
17864 static int bad = 0;
17865 void check(char *s, unsigned long eul, int een) {
17866         unsigned long gul;
17867         errno = 0;
17868         gul = strtoul(s, 0, 10);
17869         if (!((gul == eul) && (errno == een)))
17870                 bad++;
17871 }
17872 int main() {
17873         check(" 1", 1L, 0);
17874         check(" 0", 0L, 0);
17875 EOCP
17876         case "$longsize" in
17877         8)
17878             $cat >>try.c <<'EOCP'
17879         check("18446744073709551615", 18446744073709551615UL, 0);
17880         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17881 #if 0 /* strtoul() for /^-/ strings is undefined. */
17882         check("-1", 18446744073709551615UL, 0);
17883         check("-18446744073709551614", 2, 0);
17884         check("-18446744073709551615", 1, 0);
17885         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17886         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17887 #endif
17888 EOCP
17889                 ;;
17890         4)
17891                     $cat >>try.c <<'EOCP'
17892         check("4294967295", 4294967295UL, 0);
17893         check("4294967296", 4294967295UL, ERANGE);
17894 #if 0 /* strtoul() for /^-/ strings is undefined. */
17895         check("-1", 4294967295UL, 0);
17896         check("-4294967294", 2, 0);
17897         check("-4294967295", 1, 0);
17898         check("-4294967296", 4294967295UL, ERANGE);
17899         check("-4294967297", 4294967295UL, ERANGE);
17900 #endif
17901 EOCP
17902                 ;;
17903         *)
17904 : Should we write these tests to be more portable by sprintf-ing
17905 : ~0 and then manipulating that char string as input for strtol?
17906                 ;;
17907         esac
17908         $cat >>try.c <<'EOCP'
17909         if (!bad)
17910                 printf("ok\n");
17911         return 0;
17912 }
17913 EOCP
17914         set try
17915         if eval $compile; then
17916                 case "`$run ./try`" in
17917                 ok) echo "Your strtoul() seems to be working okay." ;;
17918                 *) cat <<EOM >&4
17919 Your strtoul() doesn't seem to be working okay.
17920 EOM
17921                    d_strtoul="$undef"
17922                    ;;
17923                 esac
17924         else
17925                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17926                 d_strtoul="$undef"
17927         fi
17928         ;;
17929 esac
17930
17931 : see if strtoull exists
17932 set strtoull d_strtoull
17933 eval $inlibc
17934
17935 case "$d_longlong-$d_strtoull" in
17936 "$define-$define")
17937         $cat <<EOM
17938 Checking whether your strtoull() works okay...
17939 EOM
17940         $cat >try.c <<'EOCP'
17941 #include <errno.h>
17942 #ifdef __hpux
17943 #define strtoull __strtoull
17944 #endif
17945 #include <stdio.h>
17946 extern unsigned long long int strtoull(char *s, char **, int);
17947 static int bad = 0;
17948 int check(char *s, long long eull, int een) {
17949         long long gull;
17950         errno = 0;
17951         gull = strtoull(s, 0, 10);
17952         if (!((gull == eull) && (errno == een)))
17953                 bad++;
17954 }
17955 int main() {
17956         check(" 1",                                        1LL, 0);
17957         check(" 0",                                        0LL, 0);
17958         check("18446744073709551615",  18446744073709551615ULL, 0);
17959         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17960 #if 0 /* strtoull() for /^-/ strings is undefined. */
17961         check("-1",                    18446744073709551615ULL, 0);
17962         check("-18446744073709551614",                     2LL, 0);
17963         check("-18446744073709551615",                     1LL, 0);
17964         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17965         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17966 #endif
17967         if (!bad)
17968                 printf("ok\n");
17969 }
17970 EOCP
17971         set try
17972         if eval $compile; then
17973                 case "`$run ./try`" in
17974                 ok) echo "Your strtoull() seems to be working okay." ;;
17975                 *) cat <<EOM >&4
17976 Your strtoull() doesn't seem to be working okay.
17977 EOM
17978                    d_strtoull="$undef"
17979                    ;;
17980                 esac
17981         else
17982                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17983                 d_strtoull="$undef"
17984         fi
17985         ;;
17986 esac
17987
17988 : see if strtouq exists
17989 set strtouq d_strtouq
17990 eval $inlibc
17991
17992 case "$d_strtouq" in
17993 "$define")
17994         $cat <<EOM
17995 Checking whether your strtouq() works okay...
17996 EOM
17997         $cat >try.c <<'EOCP'
17998 #include <errno.h>
17999 #include <stdio.h>
18000 extern unsigned long long int strtouq(char *s, char **, int);
18001 static int bad = 0;
18002 void check(char *s, unsigned long long eull, int een) {
18003         unsigned long long gull;
18004         errno = 0;
18005         gull = strtouq(s, 0, 10);
18006         if (!((gull == eull) && (errno == een)))
18007                 bad++;
18008 }
18009 int main() {
18010         check(" 1",                                        1LL, 0);
18011         check(" 0",                                        0LL, 0);
18012         check("18446744073709551615",  18446744073709551615ULL, 0);
18013         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18014 #if 0 /* strtouq() for /^-/ strings is undefined. */
18015         check("-1",                    18446744073709551615ULL, 0);
18016         check("-18446744073709551614",                     2LL, 0);
18017         check("-18446744073709551615",                     1LL, 0);
18018         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18019         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18020 #endif
18021         if (!bad)
18022                 printf("ok\n");
18023         return 0;
18024 }
18025 EOCP
18026         set try
18027         if eval $compile; then
18028                 case "`$run ./try`" in
18029                 ok) echo "Your strtouq() seems to be working okay." ;;
18030                 *) cat <<EOM >&4
18031 Your strtouq() doesn't seem to be working okay.
18032 EOM
18033                    d_strtouq="$undef"
18034                    ;;
18035                 esac
18036         else
18037                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18038                 d_strtouq="$undef"
18039         fi
18040         ;;
18041 esac
18042
18043 : see if strxfrm exists
18044 set strxfrm d_strxfrm
18045 eval $inlibc
18046
18047 : see if symlink exists
18048 set symlink d_symlink
18049 eval $inlibc
18050
18051 : see if syscall exists
18052 set syscall d_syscall
18053 eval $inlibc
18054
18055 : see if prototype for syscall is available
18056 echo " "
18057 set d_syscallproto syscall $i_unistd unistd.h
18058 eval $hasproto
18059
18060 : see if sysconf exists
18061 set sysconf d_sysconf
18062 eval $inlibc
18063
18064 : see if system exists
18065 set system d_system
18066 eval $inlibc
18067
18068 : see if tcgetpgrp exists
18069 set tcgetpgrp d_tcgetpgrp
18070 eval $inlibc
18071
18072 : see if tcsetpgrp exists
18073 set tcsetpgrp d_tcsetpgrp
18074 eval $inlibc
18075
18076 : see if prototype for telldir is available
18077 echo " "
18078 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18079 eval $hasproto
18080
18081 : see if time exists
18082 echo " "
18083 if test "X$d_time" = X -o X"$timetype" = X; then
18084     if set time val -f d_time; eval $csym; $val; then
18085                 echo 'time() found.' >&4
18086                 val="$define"
18087                 rp="What is the type returned by time() on this system?"
18088                 set time_t timetype long stdio.h sys/types.h
18089                 eval $typedef_ask
18090     else
18091                 echo 'time() not found, hope that will do.' >&4
18092                 val="$undef"
18093                 timetype='int';
18094     fi
18095     set d_time
18096     eval $setvar
18097 fi
18098
18099 : see if this is a sys/times.h system
18100 set sys/times.h i_systimes
18101 eval $inhdr
18102
18103 : see if times exists
18104 echo " "
18105 if set times val -f d_times; eval $csym; $val; then
18106         echo 'times() found.' >&4
18107         d_times="$define"
18108         inc=''
18109         case "$i_systimes" in
18110         "$define") inc='sys/times.h';;
18111         esac
18112         rp="What is the type returned by times() on this system?"
18113         set clock_t clocktype long stdio.h sys/types.h $inc
18114         eval $typedef_ask
18115 else
18116         echo 'times() NOT found, hope that will do.' >&4
18117         d_times="$undef"
18118         clocktype='int'
18119 fi
18120
18121 : see if tmpnam_r exists
18122 set tmpnam_r d_tmpnam_r
18123 eval $inlibc
18124 case "$d_tmpnam_r" in
18125 "$define")
18126         hdrs="$i_systypes sys/types.h define stdio.h "
18127         case "$d_tmpnam_r_proto:$usethreads" in
18128         ":define")      d_tmpnam_r_proto=define
18129                 set d_tmpnam_r_proto tmpnam_r $hdrs
18130                 eval $hasproto ;;
18131         *)      ;;
18132         esac
18133         case "$d_tmpnam_r_proto" in
18134         define)
18135         case "$tmpnam_r_proto" in
18136         ''|0) try='char* tmpnam_r(char*);'
18137         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
18138         esac
18139         case "$tmpnam_r_proto" in
18140         ''|0)   d_tmpnam_r=undef
18141                 tmpnam_r_proto=0
18142                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18143         * )     case "$tmpnam_r_proto" in
18144                 REENTRANT_PROTO*) ;;
18145                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18146                 esac
18147                 echo "Prototype: $try" ;;
18148         esac
18149         ;;
18150         *)      case "$usethreads" in
18151                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18152                 esac
18153                 d_tmpnam_r=undef
18154                 tmpnam_r_proto=0
18155                 ;;
18156         esac
18157         ;;
18158 *)      tmpnam_r_proto=0
18159         ;;
18160 esac
18161
18162 : see if truncate exists
18163 set truncate d_truncate
18164 eval $inlibc
18165
18166 : see if ttyname_r exists
18167 set ttyname_r d_ttyname_r
18168 eval $inlibc
18169 case "$d_ttyname_r" in
18170 "$define")
18171         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18172         case "$d_ttyname_r_proto:$usethreads" in
18173         ":define")      d_ttyname_r_proto=define
18174                 set d_ttyname_r_proto ttyname_r $hdrs
18175                 eval $hasproto ;;
18176         *)      ;;
18177         esac
18178         case "$d_ttyname_r_proto" in
18179         define)
18180         case "$ttyname_r_proto" in
18181         ''|0) try='int ttyname_r(int, char*, size_t);'
18182         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
18183         esac
18184         case "$ttyname_r_proto" in
18185         ''|0) try='int ttyname_r(int, char*, int);'
18186         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
18187         esac
18188         case "$ttyname_r_proto" in
18189         ''|0) try='char* ttyname_r(int, char*, int);'
18190         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
18191         esac
18192         case "$ttyname_r_proto" in
18193         ''|0)   d_ttyname_r=undef
18194                 ttyname_r_proto=0
18195                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18196         * )     case "$ttyname_r_proto" in
18197                 REENTRANT_PROTO*) ;;
18198                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18199                 esac
18200                 echo "Prototype: $try" ;;
18201         esac
18202         ;;
18203         *)      case "$usethreads" in
18204                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18205                 esac
18206                 d_ttyname_r=undef
18207                 ttyname_r_proto=0
18208                 ;;
18209         esac
18210         ;;
18211 *)      ttyname_r_proto=0
18212         ;;
18213 esac
18214
18215 : see if tzname[] exists
18216 echo " "
18217 if set tzname val -a d_tzname; eval $csym; $val; then
18218         val="$define"
18219         echo 'tzname[] found.' >&4
18220 else
18221         val="$undef"
18222         echo 'tzname[] NOT found.' >&4
18223 fi
18224 set d_tzname
18225 eval $setvar
18226
18227 : Check if is a multiplatform env
18228 case "$osname" in
18229 next|rhapsody|darwin) multiarch="$define" ;;
18230 esac
18231 case "$multiarch" in
18232 ''|[nN]*) multiarch="$undef" ;;
18233 esac
18234
18235 : check for ordering of bytes in a UV
18236 echo " "
18237 case "$usecrosscompile$multiarch" in
18238 *$define*)
18239         $cat <<EOM
18240 You seem to be either cross-compiling or doing a multiarchitecture build,
18241 skipping the byteorder check.
18242
18243 EOM
18244         byteorder='ffff'
18245         ;;
18246 *)
18247         case "$byteorder" in
18248         '')
18249                 $cat <<'EOM'
18250 In the following, larger digits indicate more significance.  A big-endian
18251 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18252 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18253 machines may have weird orders like 3412.  A Cray will report 87654321,
18254 an Alpha will report 12345678. If the test program works the default is
18255 probably right.
18256 I'm now running the test program...
18257 EOM
18258                 $cat >try.c <<EOCP
18259 #include <stdio.h>
18260 #$i_stdlib I_STDLIB
18261 #ifdef I_STDLIB
18262 #include <stdlib.h>
18263 #endif
18264 #include <sys/types.h>
18265 typedef $uvtype UV;
18266 int main()
18267 {
18268         int i;
18269         union {
18270                 UV l;
18271                 char c[$uvsize];
18272         } u;
18273
18274         if ($uvsize > 4)
18275                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18276         else
18277                 u.l = (UV)0x04030201;
18278         for (i = 0; i < $uvsize; i++)
18279                 printf("%c", u.c[i]+'0');
18280         printf("\n");
18281         exit(0);
18282 }
18283 EOCP
18284                 xxx_prompt=y
18285                 set try
18286                 if eval $compile && $run ./try > /dev/null; then
18287                         dflt=`$run ./try`
18288                         case "$dflt" in
18289                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18290                                 echo "(The test program ran ok.)"
18291                                 echo "byteorder=$dflt"
18292                                 xxx_prompt=n
18293                         ;;
18294                         ????|????????) echo "(The test program ran ok.)" ;;
18295                         *) echo "(The test program didn't run right for some reason.)" ;;
18296                         esac
18297                 else
18298                         dflt='4321'
18299                         cat <<'EOM'
18300 (I can't seem to compile the test program.  Guessing big-endian...)
18301 EOM
18302                 fi
18303                 case "$xxx_prompt" in
18304                 y)
18305                         rp="What is the order of bytes in $uvtype?"
18306                         . ./myread
18307                         byteorder="$ans"
18308                         ;;
18309                 *)      byteorder=$dflt
18310                         ;;
18311                 esac
18312                 ;;
18313         esac
18314         $rm_try
18315         ;;
18316 esac
18317
18318 : Checking 32bit aligndness
18319 $cat <<EOM
18320
18321 Checking to see whether you can access character data unalignedly...
18322 EOM
18323 case "$d_u32align" in
18324 '')   $cat >try.c <<EOCP
18325 #include <stdio.h>
18326 #$i_stdlib I_STDLIB
18327 #ifdef I_STDLIB
18328 #include <stdlib.h>
18329 #endif
18330 #define U32 $u32type
18331 #define BYTEORDER 0x$byteorder
18332 #define U8 $u8type
18333 #include <signal.h>
18334 #ifdef SIGBUS
18335 $signal_t bletch(int s) { exit(4); }
18336 #endif
18337 int main() {
18338 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18339     U8 buf[8];
18340     U32 *up;
18341     int i;
18342
18343     if (sizeof(U32) != 4) {
18344         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18345         exit(1);
18346     }
18347
18348     fflush(stdout);
18349
18350 #ifdef SIGBUS
18351     signal(SIGBUS, bletch);
18352 #endif
18353
18354     buf[0] = 0;
18355     buf[1] = 0;
18356     buf[2] = 0;
18357     buf[3] = 1;
18358     buf[4] = 0;
18359     buf[5] = 0;
18360     buf[6] = 0;
18361     buf[7] = 1;
18362
18363     for (i = 0; i < 4; i++) {
18364         up = (U32*)(buf + i);
18365         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18366                (*up == 1 << (8*(3-i)))  /* little-endian */
18367               )
18368            )
18369         {
18370             printf("read failed (%x)\n", *up);
18371             exit(2);
18372         }
18373     }
18374
18375     /* write test */
18376     for (i = 0; i < 4; i++) {
18377         up = (U32*)(buf + i);
18378         *up = 0xBeef;
18379         if (*up != 0xBeef) {
18380             printf("write failed (%x)\n", *up);
18381             exit(3);
18382         }
18383     }
18384
18385     exit(0);
18386 #else
18387     printf("1\n");
18388     exit(1);
18389 #endif
18390     return 0;
18391 }
18392 EOCP
18393 set try
18394 if eval $compile_ok; then
18395         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18396         $run ./try 2>&1 >/dev/null
18397         case "$?" in
18398         0)      cat >&4 <<EOM
18399 You can access character data pretty unalignedly.
18400 EOM
18401                 d_u32align="$undef"
18402                 ;;
18403         *)      cat >&4 <<EOM
18404 It seems that you must access character data in an aligned manner.
18405 EOM
18406                 d_u32align="$define"
18407                 ;;
18408         esac
18409 else
18410         rp='Can you access character data at unaligned addresses?'
18411         dflt='n'
18412         . ./myread
18413         case "$ans" in
18414         [yY]*)  d_u32align="$undef"  ;;
18415         *)      d_u32align="$define" ;;
18416         esac
18417 fi
18418 $rm_try
18419 ;;
18420 esac
18421
18422 : see if ualarm exists
18423 set ualarm d_ualarm
18424 eval $inlibc
18425
18426 : see if umask exists
18427 set umask d_umask
18428 eval $inlibc
18429
18430 : see if unordered exists
18431 set unordered d_unordered
18432 eval $inlibc
18433
18434 : see if unsetenv exists
18435 set unsetenv d_unsetenv
18436 eval $inlibc
18437
18438 : see if usleep exists
18439 set usleep d_usleep
18440 eval $inlibc
18441
18442 : see if prototype for usleep is available
18443 echo " "
18444 set d_usleepproto usleep $i_unistd unistd.h
18445 eval $hasproto
18446
18447 : see if ustat exists
18448 set ustat d_ustat
18449 eval $inlibc
18450
18451 : see if closedir exists
18452 set closedir d_closedir
18453 eval $inlibc
18454
18455 case "$d_closedir" in
18456 "$define")
18457         echo " "
18458         echo "Checking whether closedir() returns a status..." >&4
18459         cat > try.c <<EOM
18460 #$i_dirent I_DIRENT             /**/
18461 #$i_sysdir I_SYS_DIR            /**/
18462 #$i_sysndir I_SYS_NDIR          /**/
18463 #$i_systypes I_SYS_TYPES        /**/
18464
18465 #if defined(I_SYS_TYPES)
18466 #include <sys/types.h>
18467 #endif
18468 #if defined(I_DIRENT)
18469 #include <dirent.h>
18470 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18471 #include <sys/dir.h>
18472 #endif
18473 #else
18474 #ifdef I_SYS_NDIR
18475 #include <sys/ndir.h>
18476 #else
18477 #ifdef I_SYS_DIR
18478 #ifdef hp9000s500
18479 #include <ndir.h>       /* may be wrong in the future */
18480 #else
18481 #include <sys/dir.h>
18482 #endif
18483 #endif
18484 #endif
18485 #endif
18486 int main() { return closedir(opendir(".")); }
18487 EOM
18488         set try
18489         if eval $compile_ok; then
18490                 if $run ./try > /dev/null 2>&1 ; then
18491                         echo "Yes, it does."
18492                         val="$undef"
18493                 else
18494                         echo "No, it doesn't."
18495                         val="$define"
18496                 fi
18497         else
18498                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18499                 val="$define"
18500         fi
18501         ;;
18502 *)
18503         val="$undef";
18504         ;;
18505 esac
18506 set d_void_closedir
18507 eval $setvar
18508 $rm_try
18509
18510 : see if there is a wait4
18511 set wait4 d_wait4
18512 eval $inlibc
18513
18514 : see if waitpid exists
18515 set waitpid d_waitpid
18516 eval $inlibc
18517
18518 : see if wcstombs exists
18519 set wcstombs d_wcstombs
18520 eval $inlibc
18521
18522 : see if wctomb exists
18523 set wctomb d_wctomb
18524 eval $inlibc
18525
18526 : see if writev exists
18527 set writev d_writev
18528 eval $inlibc
18529
18530 : preserve RCS keywords in files with variable substitution, grrr
18531 Date='$Date'
18532 Id='$Id'
18533 Log='$Log'
18534 RCSfile='$RCSfile'
18535 Revision='$Revision'
18536
18537 : check for alignment requirements
18538 echo " "
18539 case "$usecrosscompile$multiarch" in
18540 *$define*)
18541         $cat <<EOM
18542 You seem to be either cross-compiling or doing a multiarchitecture build,
18543 skipping the memory alignment check.
18544
18545 EOM
18546         case "$alignbytes" in
18547         '') alignbytes=8 ;;
18548         esac
18549         ;;
18550 *)
18551         case "$alignbytes" in
18552         '') echo "Checking alignment constraints..." >&4
18553                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18554                         $cat >try.c <<'EOCP'
18555 typedef long double NV;
18556 EOCP
18557                 else
18558                         $cat >try.c <<'EOCP'
18559 typedef double NV;
18560 EOCP
18561                 fi
18562                 $cat >>try.c <<'EOCP'
18563 #include <stdio.h>
18564 struct foobar {
18565         char foo;
18566         NV bar;
18567 } try_algn;
18568 int main()
18569 {
18570     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18571     return(0);
18572 }
18573 EOCP
18574                 set try
18575                 if eval $compile_ok; then
18576                         dflt=`$run ./try`
18577                 else
18578                         dflt='8'
18579                         echo "(I can't seem to compile the test program...)"
18580                 fi
18581                 ;;
18582         *) dflt="$alignbytes"
18583                 ;;
18584         esac
18585         rp="Doubles must be aligned on a how-many-byte boundary?"
18586         . ./myread
18587         alignbytes="$ans"
18588         $rm_try
18589         ;;
18590 esac
18591
18592
18593 : set the base revision
18594 baserev=5.0
18595
18596 : how do we concatenate cpp tokens here?
18597 echo " "
18598 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18599 $cat >cpp_stuff.c <<'EOCP'
18600 #define RCAT(a,b)a/**/b
18601 #define ACAT(a,b)a ## b
18602 RCAT(Rei,ser)
18603 ACAT(Cir,cus)
18604 EOCP
18605 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18606 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18607         echo "Oh!  Smells like ANSI's been here." >&4
18608         echo "We can catify or stringify, separately or together!"
18609         cpp_stuff=42
18610 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18611         echo "Ah, yes!  The good old days!" >&4
18612         echo "However, in the good old days we don't know how to stringify and"
18613         echo "catify at the same time."
18614         cpp_stuff=1
18615 else
18616         $cat >&4 <<EOM
18617 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18618 You're going to have to edit the values of CAT[2-5] in config.h...
18619 EOM
18620         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18621 fi
18622 $rm -f cpp_stuff.*
18623
18624 : see if this is a db.h system
18625 set db.h i_db
18626 eval $inhdr
18627
18628 case "$i_db" in
18629 $define)
18630         : Check db version.
18631         echo " "
18632         echo "Checking Berkeley DB version ..." >&4
18633         $cat >try.c <<EOCP
18634 #$d_const HASCONST
18635 #ifndef HASCONST
18636 #define const
18637 #endif
18638 #include <sys/types.h>
18639 #include <stdio.h>
18640 #$i_stdlib I_STDLIB
18641 #ifdef I_STDLIB
18642 #include <stdlib.h>
18643 #endif
18644 #include <db.h>
18645 int main(int argc, char *argv[])
18646 {
18647 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18648     int Major, Minor, Patch ;
18649     unsigned long Version ;
18650     (void)db_version(&Major, &Minor, &Patch) ;
18651     if (argc == 2) {
18652         printf("%d %d %d %d %d %d\n",
18653                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18654                Major, Minor, Patch);
18655         exit(0);
18656     }
18657     printf("You have Berkeley DB Version 2 or greater.\n");
18658
18659     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18660                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18661     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18662                 Major, Minor, Patch) ;
18663
18664     /* check that db.h & libdb are compatible */
18665     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18666         printf("db.h and libdb are incompatible.\n") ;
18667         exit(3);
18668     }
18669
18670     printf("db.h and libdb are compatible.\n") ;
18671
18672     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18673                 + DB_VERSION_PATCH ;
18674
18675     /* needs to be >= 2.3.4 */
18676     if (Version < 2003004) {
18677     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18678         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18679         exit(2);
18680     }
18681
18682     exit(0);
18683 #else
18684 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18685     if (argc == 2) {
18686         printf("1 0 0\n");
18687         exit(0);
18688     }
18689     printf("You have Berkeley DB Version 1.\n");
18690     exit(0);    /* DB version < 2: the coast is clear. */
18691 #else
18692     exit(1);    /* <db.h> not Berkeley DB? */
18693 #endif
18694 #endif
18695 }
18696 EOCP
18697         set try
18698         if eval $compile_ok && $run ./try; then
18699                 echo 'Looks OK.' >&4
18700                 set `$run ./try 1`
18701                 db_version_major=$1
18702                 db_version_minor=$2
18703                 db_version_patch=$3
18704         else
18705                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18706                 i_db=$undef
18707                 case " $libs " in
18708                 *"-ldb "*)
18709                         : Remove db from list of libraries to use
18710                         echo "Removing unusable -ldb from library list" >&4
18711                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18712                         shift
18713                         libs="$*"
18714                         echo "libs = $libs" >&4
18715                         ;;
18716                 esac
18717         fi
18718         $rm_try
18719         ;;
18720 esac
18721
18722 case "$i_db" in
18723 define)
18724         : Check the return type needed for hash
18725         echo " "
18726         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18727         $cat >try.c <<EOCP
18728 #$d_const HASCONST
18729 #ifndef HASCONST
18730 #define const
18731 #endif
18732 #include <sys/types.h>
18733 #include <db.h>
18734
18735 #ifndef DB_VERSION_MAJOR
18736 u_int32_t hash_cb (ptr, size)
18737 const void *ptr;
18738 size_t size;
18739 {
18740 }
18741 HASHINFO info;
18742 int main()
18743 {
18744         info.hash = hash_cb;
18745 }
18746 #endif
18747 EOCP
18748         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18749                 if $contains warning try.out >>/dev/null 2>&1 ; then
18750                         db_hashtype='int'
18751                 else
18752                         db_hashtype='u_int32_t'
18753                 fi
18754         else
18755                 : XXX Maybe we should just give up here.
18756                 db_hashtype=u_int32_t
18757                 $cat try.out >&4
18758                 echo "Help:  I can't seem to compile the db test program." >&4
18759                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18760         fi
18761         $rm_try
18762         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18763         ;;
18764 *)      db_hashtype=u_int32_t
18765         ;;
18766 esac
18767 case "$i_db" in
18768 define)
18769         : Check the return type needed for prefix
18770         echo " "
18771         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18772         cat >try.c <<EOCP
18773 #$d_const HASCONST
18774 #ifndef HASCONST
18775 #define const
18776 #endif
18777 #include <sys/types.h>
18778 #include <db.h>
18779
18780 #ifndef DB_VERSION_MAJOR
18781 size_t prefix_cb (key1, key2)
18782 const DBT *key1;
18783 const DBT *key2;
18784 {
18785 }
18786 BTREEINFO info;
18787 int main()
18788 {
18789         info.prefix = prefix_cb;
18790 }
18791 #endif
18792 EOCP
18793         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18794                 if $contains warning try.out >>/dev/null 2>&1 ; then
18795                         db_prefixtype='int'
18796                 else
18797                         db_prefixtype='size_t'
18798                 fi
18799         else
18800                 db_prefixtype='size_t'
18801                 : XXX Maybe we should just give up here.
18802                 $cat try.out >&4
18803                 echo "Help:  I can't seem to compile the db test program." >&4
18804                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18805         fi
18806         $rm_try
18807         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18808         ;;
18809 *)      db_prefixtype='size_t'
18810         ;;
18811 esac
18812
18813 : How can we generate normalized random numbers ?
18814 echo " "
18815 echo "Looking for a random number function..." >&4
18816 case "$randfunc" in
18817 '')
18818         if set drand48 val -f; eval $csym; $val; then
18819                 dflt="drand48"
18820                 echo "Good, found drand48()." >&4
18821         elif set random val -f; eval $csym; $val; then
18822                 dflt="random"
18823                 echo "OK, found random()." >&4
18824         else
18825                 dflt="rand"
18826                 echo "Yick, looks like I have to use rand()." >&4
18827         fi
18828         echo " "
18829         ;;
18830 *)
18831         dflt="$randfunc"
18832         ;;
18833 esac
18834 cont=true
18835
18836 case "$ccflags" in
18837 *-Dmy_rand=*|*-Dmy_srand=*)
18838         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18839         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18840         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18841         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18842         ;;
18843 esac
18844
18845 while $test "$cont"; do
18846         rp="Use which function to generate random numbers?"
18847         . ./myread
18848         if $test "$ans" = "$dflt"; then
18849                 : null
18850         else
18851                 randbits=''
18852         fi
18853         randfunc="$ans"
18854         if set $ans val -f; eval $csym; $val; then
18855                 cont=''
18856         else
18857                 dflt=y
18858                 rp="I cannot find function $ans. Use that name anyway?"
18859                 . ./myread
18860                 dflt=rand
18861                 case "$ans" in
18862                         [yY]*) cont='';;
18863                 esac
18864         fi
18865         case "$cont" in
18866         '')
18867                 case "$randfunc" in
18868                 drand48)
18869                         drand01="drand48()"
18870                         seedfunc="srand48"
18871                         randbits=48
18872                         randseedtype=long
18873                         ;;
18874                 rand|random)
18875                         case "$randbits" in
18876                         '')
18877 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18878                                 $cat >try.c <<EOCP
18879 #$i_unistd I_UNISTD
18880 #$i_stdlib I_STDLIB
18881 #include <stdio.h>
18882 #ifdef I_UNISTD
18883 #  include <unistd.h>
18884 #endif
18885 #ifdef I_STDLIB
18886 #  include <stdlib.h>
18887 #endif
18888 int main()
18889 {
18890         register int i;
18891         register unsigned long tmp;
18892         register unsigned long max = 0L;
18893
18894         for (i = 1000; i; i--) {
18895                 tmp = (unsigned long) $randfunc();
18896                 if (tmp > max) max = tmp;
18897         }
18898         for (i = 0; max; i++)
18899                 max /= 2;
18900         printf("%d\n",i);
18901 }
18902 EOCP
18903                                 set try
18904                                 if eval $compile_ok; then
18905                                         dflt=`try`
18906                                 else
18907                                         dflt='?'
18908                                         echo "(I can't seem to compile the test program...)"
18909                                 fi
18910                                 ;;
18911                         *)
18912                                 dflt="$randbits"
18913                                 ;;
18914                         esac
18915                         rp="How many bits does your $randfunc() function produce?"
18916                         . ./myread
18917                         randbits="$ans"
18918                         $rm_try
18919                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18920                         seedfunc="s$randfunc"
18921                         randseedtype=unsigned
18922                         ;;
18923                 *)
18924                         dflt="31"
18925                         rp="How many bits does your $randfunc() function produce?"
18926                         . ./myread
18927                         randbits="$ans"
18928                         seedfunc="s$randfunc"
18929                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18930                         if set $seedfunc val -f; eval $csym; $val; then
18931                                 echo "(Using $seedfunc() to seed random generator)"
18932                         else
18933                                 echo "(Warning: no $seedfunc() to seed random generator)"
18934                                 seedfunc=rand
18935                         fi
18936                         randseedtype=unsigned
18937                         ;;
18938                 esac
18939                 ;;
18940         esac
18941 done
18942
18943 : Determine if this is an EBCDIC system
18944 echo " "
18945 echo "Determining whether or not we are on an EBCDIC system..." >&4
18946 $cat >try.c <<'EOM'
18947 int main()
18948 {
18949   if ('M'==0xd4) return 0;
18950   return 1;
18951 }
18952 EOM
18953
18954 val=$undef
18955 set try
18956 if eval $compile_ok; then
18957         if $run ./try; then
18958                 echo "You seem to speak EBCDIC." >&4
18959                 val="$define"
18960         else
18961                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18962         fi
18963 else
18964         echo "I'm unable to compile the test program." >&4
18965         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18966 fi
18967 $rm_try
18968 set ebcdic
18969 eval $setvar
18970
18971 : Check how to flush
18972 echo " "
18973 $cat >&4 <<EOM
18974 Checking how to flush all pending stdio output...
18975 EOM
18976 # I only know how to find the first 32 possibly open files on SunOS.
18977 # See also hints/sunos_4_1.sh and util.c  --AD
18978 case "$osname" in
18979 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18980 esac
18981 $cat >>try.c <<EOCP
18982 #include <stdio.h>
18983 #$i_stdlib I_STDLIB
18984 #ifdef I_STDLIB
18985 #include <stdlib.h>
18986 #endif
18987 #$i_unistd I_UNISTD
18988 #ifdef I_UNISTD
18989 # include <unistd.h>
18990 #endif
18991 #$d_sysconf HAS_SYSCONF
18992 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18993 #ifdef HAS_STDIO_STREAM_ARRAY
18994 # define STDIO_STREAM_ARRAY $stdio_stream_array
18995 #endif
18996 int main() {
18997   FILE* p;
18998   unlink("try.out");
18999   p = fopen("try.out", "w");
19000 #ifdef TRY_FPUTC
19001   fputc('x', p);
19002 #else
19003 # ifdef TRY_FPRINTF
19004   fprintf(p, "x");
19005 # endif
19006 #endif
19007 #ifdef TRY_FFLUSH_NULL
19008   fflush(NULL);
19009 #endif
19010 #ifdef TRY_FFLUSH_ALL
19011   {
19012     long open_max = -1;
19013 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19014     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19015 # else
19016 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19017     open_max = sysconf(_SC_OPEN_MAX);
19018 #  else
19019 #   ifdef FOPEN_MAX
19020     open_max = FOPEN_MAX;
19021 #   else
19022 #    ifdef OPEN_MAX
19023     open_max = OPEN_MAX;
19024 #    else
19025 #     ifdef _NFILE
19026     open_max = _NFILE;
19027 #     endif
19028 #    endif
19029 #   endif
19030 #  endif
19031 # endif
19032 # ifdef HAS_STDIO_STREAM_ARRAY
19033     if (open_max > 0) {
19034       long i;
19035       for (i = 0; i < open_max; i++)
19036             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19037                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19038                 STDIO_STREAM_ARRAY[i]._flag)
19039                 fflush(&STDIO_STREAM_ARRAY[i]);
19040     }
19041   }
19042 # endif
19043 #endif
19044   _exit(42);
19045 }
19046 EOCP
19047 : first we have to find out how _not_ to flush
19048 $to try.c
19049 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19050     output=''
19051     set try -DTRY_FPUTC
19052     if eval $compile; then
19053             $run ./try 2>/dev/null
19054             code="$?"
19055             $from try.out
19056             if $test ! -s try.out -a "X$code" = X42; then
19057                 output=-DTRY_FPUTC
19058             fi
19059     fi
19060     case "$output" in
19061     '')
19062             set try -DTRY_FPRINTF
19063             if eval $compile; then
19064                     $run ./try 2>/dev/null
19065                     code="$?"
19066                     $from try.out
19067                     if $test ! -s try.out -a "X$code" = X42; then
19068                         output=-DTRY_FPRINTF
19069                     fi
19070             fi
19071         ;;
19072     esac
19073 fi
19074 : check for fflush NULL behaviour
19075 case "$fflushNULL" in
19076 '')     set try -DTRY_FFLUSH_NULL $output
19077         if eval $compile; then
19078                 $run ./try 2>/dev/null
19079                 code="$?"
19080                 $from try.out
19081                 if $test -s try.out -a "X$code" = X42; then
19082                         fflushNULL="`$cat try.out`"
19083                 else
19084                         if $test "X$code" != X42; then
19085                                 $cat >&4 <<EOM
19086 (If this test failed, don't worry, we'll try another method shortly.)
19087 EOM
19088                         fi
19089                 fi
19090         fi
19091         $rm_try
19092         case "$fflushNULL" in
19093         x)      $cat >&4 <<EOM
19094 Your fflush(NULL) works okay for output streams.
19095 Let's see if it clobbers input pipes...
19096 EOM
19097 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19098 # bug that improperly flushes the input end of pipes.  So we avoid the
19099 # autoflush on fork/system/exec support for now. :-(
19100 $cat >tryp.c <<EOCP
19101 #include <stdio.h>
19102 int
19103 main(int argc, char **argv)
19104 {
19105     char buf[1024];
19106     int i;
19107     char *bp = buf;
19108     while (1) {
19109         while ((i = getc(stdin)) != -1
19110                && (*bp++ = i) != '\n'
19111                && bp < &buf[1024])
19112         /* DO NOTHING */ ;
19113         *bp = '\0';
19114         fprintf(stdout, "%s", buf);
19115         fflush(NULL);
19116         if (i == -1)
19117             return 0;
19118         bp = buf;
19119     }
19120 }
19121 EOCP
19122                 fflushNULL="$define"
19123                 set tryp
19124                 if eval $compile; then
19125                     $rm -f tryp.out
19126                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19127                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19128                        $cat >&4 <<EOM
19129 fflush(NULL) seems to behave okay with input streams.
19130 EOM
19131                         fflushNULL="$define"
19132                     else
19133                         $cat >&4 <<EOM
19134 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19135 EOM
19136                         fflushNULL="$undef"
19137                     fi
19138                 fi
19139                 $rm -f core tryp.c tryp.core core.tryp.*
19140                 ;;
19141         '')     $cat >&4 <<EOM
19142 Your fflush(NULL) isn't working (contrary to ANSI C).
19143 EOM
19144                 fflushNULL="$undef"
19145                 ;;
19146         *)      $cat >&4 <<EOM
19147 Cannot figure out whether your fflush(NULL) works or not.
19148 I'm assuming it doesn't (contrary to ANSI C).
19149 EOM
19150                 fflushNULL="$undef"
19151                 ;;
19152         esac
19153         ;;
19154 $define|true|[yY]*)
19155         fflushNULL="$define"
19156         ;;
19157 *)
19158         fflushNULL="$undef"
19159         ;;
19160 esac
19161 : check explicit looping only if NULL did not work, and if the pipe
19162 : bug does not show up on an explicit flush too
19163 case "$fflushNULL" in
19164 "$undef")
19165         $cat >tryp.c <<EOCP
19166 #include <stdio.h>
19167 int
19168 main(int argc, char **argv)
19169 {
19170     char buf[1024];
19171     int i;
19172     char *bp = buf;
19173     while (1) {
19174         while ((i = getc(stdin)) != -1
19175                && (*bp++ = i) != '\n'
19176                && bp < &buf[1024])
19177         /* DO NOTHING */ ;
19178         *bp = '\0';
19179         fprintf(stdout, "%s", buf);
19180         fflush(stdin);
19181         if (i == -1)
19182             return 0;
19183         bp = buf;
19184     }
19185 }
19186 EOCP
19187         set tryp
19188         if eval $compile; then
19189             $rm -f tryp.out
19190             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19191             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19192                $cat >&4 <<EOM
19193 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19194 EOM
19195                 : now check for fflushall behaviour
19196                 case "$fflushall" in
19197                 '')     set try -DTRY_FFLUSH_ALL $output
19198                         if eval $compile; then
19199                                 $cat >&4 <<EOM
19200 (Now testing the other method--but note that this also may fail.)
19201 EOM
19202                                 $run ./try 2>/dev/null
19203                                 code=$?
19204                                 $from try.out
19205                                 if $test -s try.out -a "X$code" = X42; then
19206                                         fflushall="`$cat try.out`"
19207                                 fi
19208                         fi
19209                         $rm_try
19210                         case "$fflushall" in
19211                         x)      $cat >&4 <<EOM
19212 Whew. Flushing explicitly all the stdio streams works.
19213 EOM
19214                                 fflushall="$define"
19215                                 ;;
19216                         '')     $cat >&4 <<EOM
19217 Sigh. Flushing explicitly all the stdio streams doesn't work.
19218 EOM
19219                                 fflushall="$undef"
19220                                 ;;
19221                         *)      $cat >&4 <<EOM
19222 Cannot figure out whether flushing stdio streams explicitly works or not.
19223 I'm assuming it doesn't.
19224 EOM
19225                                 fflushall="$undef"
19226                                 ;;
19227                         esac
19228                         ;;
19229                 "$define"|true|[yY]*)
19230                         fflushall="$define"
19231                         ;;
19232                 *)
19233                         fflushall="$undef"
19234                         ;;
19235                 esac
19236             else
19237                 $cat >&4 <<EOM
19238 All is futile.  Even fflush(stdin) clobbers input pipes!
19239 EOM
19240                 fflushall="$undef"
19241             fi
19242         else
19243             fflushall="$undef"
19244         fi
19245         $rm -f core tryp.c tryp.core core.tryp.*
19246         ;;
19247 *)      fflushall="$undef"
19248         ;;
19249 esac
19250
19251 case "$fflushNULL$fflushall" in
19252 undefundef)
19253         $cat <<EOM
19254 OK, I give up.  I cannot figure out how to flush pending stdio output.
19255 We won't be flushing handles at all before fork/exec/popen.
19256 EOM
19257         ;;
19258 esac
19259 $rm_try tryp
19260
19261 : Store the full pathname to the ar program for use in the C program
19262 : Respect a hint or command line value for full_ar.
19263 case "$full_ar" in
19264 '') full_ar=$ar ;;
19265 esac
19266
19267 : Store the full pathname to the sed program for use in the C program
19268 full_sed=$sed
19269
19270 : see what type gids are declared as in the kernel
19271 echo " "
19272 echo "Looking for the type for group ids returned by getgid()."
19273 set gid_t gidtype xxx stdio.h sys/types.h
19274 eval $typedef
19275 case "$gidtype" in
19276 xxx)
19277         xxx=`./findhdr sys/user.h`
19278         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19279         case $1 in
19280         unsigned) dflt="$1 $2" ;;
19281         *) dflt="$1" ;;
19282         esac
19283         ;;
19284 *) dflt="$gidtype";;
19285 esac
19286 case "$gidtype" in
19287 gid_t) echo "gid_t found." ;;
19288 *)      rp="What is the type for group ids returned by getgid()?"
19289         . ./myread
19290         gidtype="$ans"
19291         ;;
19292 esac
19293
19294 : Check the size of GID
19295 echo " "
19296 case "$gidtype" in
19297 *_t) zzz="$gidtype"     ;;
19298 *)   zzz="gid"          ;;
19299 esac
19300 echo "Checking the size of $zzz..." >&4
19301 cat > try.c <<EOCP
19302 #include <sys/types.h>
19303 #include <stdio.h>
19304 #$i_stdlib I_STDLIB
19305 #ifdef I_STDLIB
19306 #include <stdlib.h>
19307 #endif
19308 int main() {
19309     printf("%d\n", (int)sizeof($gidtype));
19310     exit(0);
19311 }
19312 EOCP
19313 set try
19314 if eval $compile_ok; then
19315         yyy=`$run ./try`
19316         case "$yyy" in
19317         '')     gidsize=4
19318                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19319                 ;;
19320         *)      gidsize=$yyy
19321                 echo "Your $zzz is $gidsize bytes long."
19322                 ;;
19323         esac
19324 else
19325         gidsize=4
19326         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19327 fi
19328
19329
19330 : Check if GID is signed
19331 echo " "
19332 case "$gidtype" in
19333 *_t) zzz="$gidtype"     ;;
19334 *)   zzz="gid"          ;;
19335 esac
19336 echo "Checking the sign of $zzz..." >&4
19337 cat > try.c <<EOCP
19338 #include <sys/types.h>
19339 #include <stdio.h>
19340 int main() {
19341         $gidtype foo = -1;
19342         if (foo < 0)
19343                 printf("-1\n");
19344         else
19345                 printf("1\n");
19346 }
19347 EOCP
19348 set try
19349 if eval $compile; then
19350         yyy=`$run ./try`
19351         case "$yyy" in
19352         '')     gidsign=1
19353                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19354                 ;;
19355         *)      gidsign=$yyy
19356                 case "$gidsign" in
19357                  1) echo "Your $zzz is unsigned." ;;
19358                 -1) echo "Your $zzz is signed."   ;;
19359                 esac
19360                 ;;
19361         esac
19362 else
19363         gidsign=1
19364         echo "(I can't compile the test program--guessing unsigned.)" >&4
19365 fi
19366
19367
19368 : Check 64bit sizes
19369 echo " "
19370
19371 if $test X"$quadtype" != X; then
19372
19373 echo "Checking how to print 64-bit integers..." >&4
19374
19375 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19376         $cat >try.c <<'EOCP'
19377 #include <sys/types.h>
19378 #include <stdio.h>
19379 int main() {
19380   int q = 12345678901;
19381   printf("%ld\n", q);
19382 }
19383 EOCP
19384         set try
19385         if eval $compile; then
19386                 yyy=`$run ./try`
19387                 case "$yyy" in
19388                 12345678901)
19389                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19390                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19391                         echo "We will use %d."
19392                         ;;
19393                 esac
19394         fi
19395 fi
19396
19397 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19398         $cat >try.c <<'EOCP'
19399 #include <sys/types.h>
19400 #include <stdio.h>
19401 int main() {
19402   long q = 12345678901;
19403   printf("%ld\n", q);
19404 }
19405 EOCP
19406         set try
19407         if eval $compile; then
19408                 yyy=`$run ./try`
19409                 case "$yyy" in
19410                 12345678901)
19411                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19412                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19413                         echo "We will use %ld."
19414                         ;;
19415                 esac
19416         fi
19417 fi
19418
19419 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19420         $cat >try.c <<'EOCP'
19421 #include <sys/types.h>
19422 #include <inttypes.h>
19423 #include <stdio.h>
19424 int main() {
19425   int64_t q = 12345678901;
19426   printf("%" PRId64 "\n", q);
19427 }
19428 EOCP
19429         set try
19430         if eval $compile; then
19431                 yyy=`$run ./try`
19432                 case "$yyy" in
19433                 12345678901)
19434                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19435                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19436                         echo "We will use the C9X style."
19437                         ;;
19438                 esac
19439         fi
19440 fi
19441
19442 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19443         $cat >try.c <<EOCP
19444 #include <sys/types.h>
19445 #include <stdio.h>
19446 int main() {
19447   $quadtype q = 12345678901;
19448   printf("%Ld\n", q);
19449 }
19450 EOCP
19451         set try
19452         if eval $compile; then
19453                 yyy=`$run ./try`
19454                 case "$yyy" in
19455                 12345678901)
19456                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19457                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19458                         echo "We will use %Ld."
19459                         ;;
19460                 esac
19461         fi
19462 fi
19463
19464 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19465         $cat >try.c <<'EOCP'
19466 #include <sys/types.h>
19467 #include <stdio.h>
19468 int main() {
19469   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19470   printf("%lld\n", q);
19471 }
19472 EOCP
19473         set try
19474         if eval $compile; then
19475                 yyy=`$run ./try`
19476                 case "$yyy" in
19477                 12345678901)
19478                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19479                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19480                         echo "We will use the %lld style."
19481                         ;;
19482                 esac
19483         fi
19484 fi
19485
19486 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19487         $cat >try.c <<EOCP
19488 #include <sys/types.h>
19489 #include <stdio.h>
19490 int main() {
19491   $quadtype q = 12345678901;
19492   printf("%qd\n", q);
19493 }
19494 EOCP
19495         set try
19496         if eval $compile; then
19497                 yyy=`$run ./try`
19498                 case "$yyy" in
19499                 12345678901)
19500                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19501                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19502                         echo "We will use %qd."
19503                         ;;
19504                 esac
19505         fi
19506 fi
19507
19508 if $test X"$sPRId64" = X; then
19509         echo "Cannot figure out how to print 64-bit integers." >&4
19510 fi
19511 $rm_try
19512
19513 fi
19514
19515 case "$sPRId64" in
19516 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19517         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19518         ;;
19519 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19520         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19521         ;;
19522 esac
19523
19524 : Check format strings for internal types
19525 echo " "
19526 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19527
19528 if $test X"$ivsize" = X8; then
19529         ivdformat="$sPRId64"
19530         uvuformat="$sPRIu64"
19531         uvoformat="$sPRIo64"
19532         uvxformat="$sPRIx64"
19533         uvXUformat="$sPRIXU64"
19534 else
19535         if $test X"$ivsize" = X"$longsize"; then
19536                 ivdformat='"ld"'
19537                 uvuformat='"lu"'
19538                 uvoformat='"lo"'
19539                 uvxformat='"lx"'
19540                 uvXUformat='"lX"'
19541         else
19542                 if $test X"$ivsize" = X"$intsize"; then
19543                         ivdformat='"d"'
19544                         uvuformat='"u"'
19545                         uvoformat='"o"'
19546                         uvxformat='"x"'
19547                         uvXUformat='"X"'
19548                 else
19549                         : far out
19550                         if $test X"$ivsize" = X"$shortsize"; then
19551                                 ivdformat='"hd"'
19552                                 uvuformat='"hu"'
19553                                 uvoformat='"ho"'
19554                                 uvxformat='"hx"'
19555                                 uvXUformat='"hX"'
19556                         fi
19557                 fi
19558         fi
19559 fi
19560
19561 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19562         nveformat="$sPRIeldbl"
19563         nvfformat="$sPRIfldbl"
19564         nvgformat="$sPRIgldbl"
19565         nvEUformat="$sPRIEUldbl"
19566         nvFUformat="$sPRIFUldbl"
19567         nvGUformat="$sPRIGUldbl"
19568 else
19569         nveformat='"e"'
19570         nvfformat='"f"'
19571         nvgformat='"g"'
19572         nvEUformat='"E"'
19573         nvFUformat='"F"'
19574         nvGUformat='"G"'
19575 fi
19576
19577 case "$ivdformat" in
19578 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19579     exit 1
19580     ;;
19581 esac
19582
19583 : Check format string for GID
19584
19585 echo " "
19586 $echo "Checking the format string to be used for gids..." >&4
19587
19588 case "$gidsign" in
19589 -1)     if $test X"$gidsize" = X"$ivsize"; then
19590                 gidformat="$ivdformat"
19591         else
19592                 if $test X"$gidsize" = X"$longsize"; then
19593                         gidformat='"ld"'
19594                 else
19595                         if $test X"$gidsize" = X"$intsize"; then
19596                                 gidformat='"d"'
19597                         else
19598                                 if $test X"$gidsize" = X"$shortsize"; then
19599                                         gidformat='"hd"'
19600                                 fi
19601                         fi
19602                 fi
19603         fi
19604         ;;
19605 *)      if $test X"$gidsize" = X"$uvsize"; then
19606                 gidformat="$uvuformat"
19607         else
19608                 if $test X"$gidsize" = X"$longsize"; then
19609                         gidformat='"lu"'
19610                 else
19611                         if $test X"$gidsize" = X"$intsize"; then
19612                                 gidformat='"u"'
19613                         else
19614                                 if $test X"$gidsize" = X"$shortsize"; then
19615                                         gidformat='"hu"'
19616                                 fi
19617                         fi
19618                 fi
19619         fi
19620         ;;
19621 esac
19622
19623 : see if getgroups exists
19624 set getgroups d_getgrps
19625 eval $inlibc
19626
19627 : see if setgroups exists
19628 set setgroups d_setgrps
19629 eval $inlibc
19630
19631 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19632 echo " "
19633 case "$d_getgrps$d_setgrps" in
19634 *define*)
19635         case "$groupstype" in
19636         '') dflt="$gidtype" ;;
19637         *)  dflt="$groupstype" ;;
19638         esac
19639         $cat <<EOM
19640 What type of pointer is the second argument to getgroups() and setgroups()?
19641 Usually this is the same as group ids, $gidtype, but not always.
19642
19643 EOM
19644         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19645         . ./myread
19646         groupstype="$ans"
19647         ;;
19648 *)  groupstype="$gidtype";;
19649 esac
19650
19651 : MAD = Misc Attribute Definition
19652
19653 if $test $patchlevel -lt 9; then
19654 : MAD is not available in 5.8.x or earlier.
19655     ans=n;
19656 else
19657     case "$mad" in
19658     $define|true|[yY]*) dflt='y' ;;
19659     *)                  dflt='n' ;;
19660     esac
19661     cat <<EOM
19662
19663 Would you like to build with Misc Attribute Decoration? This is development
19664 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19665 overhead on the interpreter.
19666
19667 If this doesn't make any sense to you, just accept the default '$dflt'.
19668 EOM
19669     rp='Build Perl with MAD?'
19670     . ./myread
19671 fi
19672 case "$ans" in
19673 y|Y)    val="$define"
19674         madlyh='madly.h madly.act madly.tab'
19675         madlysrc='madly.c'
19676         madlyobj="madly$_o" ;;
19677 *)      val="$undef"
19678         madlyh=''
19679         madlysrc=''
19680         madlyobj='' ;;
19681 esac
19682 set mad
19683 eval $setvar
19684
19685 : check whether make sets MAKE
19686 echo " "
19687 echo "Checking if your $make program sets \$(MAKE)..." >&4
19688 case "$make_set_make" in
19689 '')
19690         $sed 's/^X //' > testmake.mak << 'EOF'
19691 Xall:
19692 X       @echo 'maketemp="$(MAKE)"'
19693 EOF
19694         case "`$make -f testmake.mak 2>/dev/null`" in
19695         *maketemp=*) make_set_make='#' ;;
19696         *)      make_set_make="MAKE=$make" ;;
19697         esac
19698         $rm -f testmake.mak
19699         ;;
19700 esac
19701 case "$make_set_make" in
19702 '#') echo "Yup, it does.";;
19703 *) echo "Nope, it doesn't.";;
19704 esac
19705
19706 : see what type is used for mode_t
19707 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19708 set mode_t modetype int stdio.h sys/types.h
19709 eval $typedef_ask
19710
19711 : see if we need va_copy
19712 echo " "
19713 case "$i_stdarg" in
19714 "$define")
19715         $cat >try.c <<EOCP
19716 #include <stdarg.h>
19717 #include <stdio.h>
19718 #$i_stdlib I_STDLIB
19719 #ifdef I_STDLIB
19720 #include <stdlib.h>
19721 #endif
19722 #include <signal.h>
19723
19724 int
19725 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19726 {
19727   return vfprintf(f, fmt, *valp);
19728 }
19729
19730 int
19731 myvfprintf(FILE *f, const  char *fmt, va_list val)
19732 {
19733   return ivfprintf(f, fmt, &val);
19734 }
19735
19736 int
19737 myprintf(char *fmt, ...)
19738 {
19739   va_list val;
19740   va_start(val, fmt);
19741   return myvfprintf(stdout, fmt, val);
19742 }
19743
19744 int
19745 main(int ac, char **av)
19746 {
19747   signal(SIGSEGV, exit);
19748
19749   myprintf("%s%cs all right, then\n", "that", '\'');
19750   exit(0);
19751 }
19752 EOCP
19753         set try
19754         if eval $compile && $run ./try 2>&1 >/dev/null; then
19755                 case "`$run ./try`" in
19756                 "that's all right, then")
19757                         okay=yes
19758                         ;;
19759                 esac
19760         fi
19761         case "$okay" in
19762         yes)    echo "It seems that you don't need va_copy()." >&4
19763                 need_va_copy="$undef"
19764                 ;;
19765         *)      echo "It seems that va_copy() or similar will be needed." >&4
19766                 need_va_copy="$define"
19767                 ;;
19768         esac
19769         $rm_try
19770         ;;
19771 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19772         ;;
19773 esac
19774
19775 : see what type is used for size_t
19776 rp="What is the type used for the length parameter for string functions?"
19777 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19778 eval $typedef_ask
19779
19780 : check for type of arguments to gethostbyaddr. 
19781 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19782         case "$d_gethbyaddr" in
19783         $define)
19784                 $cat <<EOM
19785
19786 Checking to see what type of arguments are accepted by gethostbyaddr().
19787 EOM
19788                 hdrs="$define sys/types.h
19789                         $d_socket sys/socket.h 
19790                         $i_niin netinet/in.h 
19791                         $i_netdb netdb.h
19792                         $i_unistd unistd.h"
19793                 : The first arg can 'char *' or 'void *'
19794                 : The second arg is some of integral type
19795                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19796                         for yyy in size_t long int; do
19797                                 case "$netdb_host_type" in
19798                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19799                                         if ./protochk "$try" $hdrs; then
19800                                                 echo "Your system accepts $xxx for the first arg."
19801                                                 echo "...and $yyy for the second arg."
19802                                                 netdb_host_type="$xxx"
19803                                                 netdb_hlen_type="$yyy"
19804                                         fi
19805                                         ;;
19806                                 esac
19807                         done
19808                 done
19809                 : In case none of those worked, prompt the user.
19810                 case "$netdb_host_type" in
19811                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19812                         dflt='char *'
19813                         . ./myread
19814                         netdb_host_type=$ans
19815                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19816                         dflt="$sizetype"
19817                         . ./myread
19818                         netdb_hlen_type=$ans
19819                         ;;
19820                 esac
19821                 ;;
19822         *)      : no gethostbyaddr, so pick harmless defaults
19823                 netdb_host_type='char *'
19824                 netdb_hlen_type="$sizetype"
19825                 ;;
19826         esac
19827         # Remove the "const" if needed. -- but then we'll have a 
19828         # prototype clash!
19829         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19830 fi
19831
19832 : check for type of argument to gethostbyname. 
19833 if test "X$netdb_name_type" = X ; then
19834         case "$d_gethbyname" in
19835         $define)
19836                 $cat <<EOM
19837
19838 Checking to see what type of argument is accepted by gethostbyname().
19839 EOM
19840                 hdrs="$define sys/types.h
19841                         $d_socket sys/socket.h 
19842                         $i_niin netinet/in.h 
19843                         $i_netdb netdb.h
19844                         $i_unistd unistd.h"
19845                 for xxx in "const char *" "char *"; do
19846                         case "$netdb_name_type" in
19847                         '')     try="extern struct hostent *gethostbyname($xxx);"
19848                                 if ./protochk "$try" $hdrs; then
19849                                         echo "Your system accepts $xxx."
19850                                         netdb_name_type="$xxx"
19851                                 fi
19852                                 ;;
19853                         esac
19854                 done
19855                 : In case none of those worked, prompt the user.
19856                 case "$netdb_name_type" in
19857                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19858                         dflt='char *'
19859                         . ./myread
19860                         netdb_name_type=$ans
19861                         ;;
19862                 esac
19863                 ;;
19864         *)      : no gethostbyname, so pick harmless default
19865                 netdb_name_type='char *'
19866                 ;;
19867         esac
19868 fi
19869
19870 : check for type of 1st argument to getnetbyaddr. 
19871 if test "X$netdb_net_type" = X ; then
19872         case "$d_getnbyaddr" in
19873         $define)
19874                 $cat <<EOM
19875
19876 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19877 EOM
19878                 hdrs="$define sys/types.h
19879                         $d_socket sys/socket.h 
19880                         $i_niin netinet/in.h 
19881                         $i_netdb netdb.h
19882                         $i_unistd unistd.h"
19883                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19884                         case "$netdb_net_type" in
19885                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19886                                 if ./protochk "$try" $hdrs; then
19887                                         echo "Your system accepts $xxx."
19888                                         netdb_net_type="$xxx"
19889                                 fi
19890                                 ;;
19891                         esac
19892                 done
19893                 : In case none of those worked, prompt the user.
19894                 case "$netdb_net_type" in
19895                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19896                         dflt='long'
19897                         . ./myread
19898                         netdb_net_type=$ans
19899                         ;;
19900                 esac
19901                 ;;
19902         *)      : no getnetbyaddr, so pick harmless default
19903                 netdb_net_type='long'
19904                 ;;
19905         esac
19906 fi
19907 : locate the preferred pager for this system
19908 fn=f/
19909 case "$pager" in
19910 '')
19911         dflt=''
19912         case "$pg" in
19913         /*) dflt=$pg;;
19914         [a-zA-Z]:/*) dflt=$pg;;
19915         esac
19916         case "$more" in
19917         /*) dflt=$more;;
19918         [a-zA-Z]:/*) dflt=$more;;
19919         esac
19920         case "$less" in
19921         /*) dflt=$less;;
19922         [a-zA-Z]:/*) dflt=$less;;
19923         esac
19924         case "$dflt" in
19925         '') dflt=/usr/ucb/more;;
19926         esac
19927         ;;
19928 *)      dflt="$pager"
19929         : Instruct ./getfile to trust the hinted or previous pager value,
19930         : even if it does not begin with a slash.  For example, on os2,
19931         : pager might be cmd /c more.  See comments in UU/getfile.
19932         fn="f/($pager)"
19933         ;;
19934 esac
19935 echo " "
19936 rp='What pager is used on your system?'
19937 . ./getfile
19938 pager="$ans"
19939
19940 : see what type pids are declared as in the kernel
19941 rp="What is the type of process ids on this system?"
19942 set pid_t pidtype int stdio.h sys/types.h
19943 eval $typedef_ask
19944
19945 : see if ar generates random libraries by itself
19946 echo " "
19947 echo "Checking how to generate random libraries on your machine..." >&4
19948 echo 'int bar1() { return bar2(); }' > bar1.c
19949 echo 'int bar2() { return 2; }' > bar2.c
19950 $cat > foo.c <<EOP
19951 #$i_stdlib I_STDLIB
19952 #ifdef I_STDLIB
19953 #include <stdlib.h>
19954 #endif
19955 int main() { printf("%d\n", bar1()); exit(0); }
19956 EOP
19957 $cc $ccflags -c bar1.c >/dev/null 2>&1
19958 $cc $ccflags -c bar2.c >/dev/null 2>&1
19959 $cc $ccflags -c foo.c >/dev/null 2>&1
19960 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19961 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19962         $run ./foobar >/dev/null 2>&1; then
19963         echo "$ar appears to generate random libraries itself."
19964         orderlib=false
19965         if [ "X$ranlib" = "X" ]; then
19966             ranlib=":"
19967         fi
19968 elif $ar s bar$_a >/dev/null 2>&1 &&
19969         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19970         $run ./foobar >/dev/null 2>&1; then
19971                 echo "a table of contents needs to be added with '$ar s'."
19972                 orderlib=false
19973                 ranlib="$ar s"
19974 elif $ar ts bar$_a >/dev/null 2>&1 &&
19975         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19976         $run ./foobar >/dev/null 2>&1; then
19977                 echo "a table of contents needs to be added with '$ar ts'."
19978                 orderlib=false
19979                 ranlib="$ar ts"
19980 else
19981         case "$ranlib" in
19982         :) ranlib='';;
19983         '')
19984                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19985                 $test -f $ranlib || ranlib=''
19986                 ;;
19987         esac
19988         if $test -n "$ranlib"; then
19989                 echo "your system has '$ranlib'; we'll use that."
19990                 orderlib=false
19991         else
19992                 echo "your system doesn't seem to support random libraries"
19993                 echo "so we'll use lorder and tsort to order the libraries."
19994                 orderlib=true
19995                 ranlib=":"
19996         fi
19997 fi
19998 $rm -f foo* bar*
19999
20000 : check for type of arguments to select.
20001 case "$selecttype" in
20002 '') case "$d_select" in
20003         $define)
20004                 echo " "
20005                 $cat <<EOM
20006 Checking to see what type of arguments are accepted by select().
20007 EOM
20008                 hdrs="$define sys/types.h
20009                         $i_systime sys/time.h
20010                         $i_sysselct sys/select.h
20011                         $d_socket sys/socket.h"
20012                 : The first arg can be int, unsigned, or size_t
20013                 : The last arg may or may not be 'const'
20014                 val=''
20015                 : void pointer has been seen but using that
20016                 : breaks the selectminbits test
20017                 for xxx in 'fd_set *' 'int *'; do
20018                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20019                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20020                                         case "$val" in
20021                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20022                                                 if ./protochk "$try" $hdrs; then
20023                                                         echo "Your system accepts $xxx."
20024                                                         val="$xxx"
20025                                                 fi
20026                                                 ;;
20027                                         esac
20028                                 done
20029                         done
20030                 done
20031                 case "$val" in
20032                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20033                         case "$d_fd_set" in
20034                                 $define) dflt="fd_set *" ;;
20035                                 *)              dflt="int *" ;;
20036                         esac
20037                         . ./myread
20038                         val=$ans
20039                         ;;
20040                 esac
20041                 selecttype="$val"
20042                 ;;
20043         *)      : no select, so pick a harmless default
20044                 selecttype='int *'
20045                 ;;
20046         esac
20047         ;;
20048 esac
20049
20050 : check for the select 'width'
20051 case "$selectminbits" in
20052 '') safebits=`expr $ptrsize \* 8`
20053     case "$d_select" in
20054         $define)
20055                 $cat <<EOM
20056
20057 Checking to see on how many bits at a time your select() operates...
20058 EOM
20059                 $cat >try.c <<EOCP
20060 #include <sys/types.h>
20061 #$i_time I_TIME
20062 #$i_systime I_SYS_TIME
20063 #$i_systimek I_SYS_TIME_KERNEL
20064 #ifdef I_TIME
20065 #   include <time.h>
20066 #endif
20067 #ifdef I_SYS_TIME
20068 #   ifdef I_SYS_TIME_KERNEL
20069 #       define KERNEL
20070 #   endif
20071 #   include <sys/time.h>
20072 #   ifdef I_SYS_TIME_KERNEL
20073 #       undef KERNEL
20074 #   endif
20075 #endif
20076 #$i_sysselct I_SYS_SELECT
20077 #ifdef I_SYS_SELECT
20078 #include <sys/select.h>
20079 #endif
20080 #$d_socket HAS_SOCKET
20081 #ifdef HAS_SOCKET
20082 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20083 #endif
20084 #include <stdio.h>
20085 #$i_stdlib I_STDLIB
20086 #ifdef I_STDLIB
20087 #include <stdlib.h>
20088 #endif
20089 $selecttype b;
20090 #define S sizeof(*(b))
20091 #define MINBITS 64
20092 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20093 #define NBITS  (NBYTES * 8)
20094 int main() {
20095     char *s = (char *)malloc(NBYTES);
20096     struct timeval t;
20097     int i;
20098     FILE* fp;
20099     int fd;
20100
20101     if (!s)
20102         exit(1);
20103     fclose(stdin);
20104     fp = fopen("try.c", "r");
20105     if (fp == 0)
20106       exit(2);
20107     fd = fileno(fp);
20108     if (fd < 0)
20109       exit(3);
20110     b = ($selecttype)s;
20111     for (i = 0; i < NBITS; i++)
20112         FD_SET(i, b);
20113     t.tv_sec  = 0;
20114     t.tv_usec = 0;
20115     select(fd + 1, b, 0, 0, &t);
20116     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20117     free(s);
20118     printf("%d\n", i + 1);
20119     return 0;
20120 }
20121 EOCP
20122                 set try
20123                 if eval $compile_ok; then
20124                         selectminbits=`$run ./try`
20125                         case "$selectminbits" in
20126                         '')     cat >&4 <<EOM
20127 Cannot figure out on how many bits at a time your select() operates.
20128 I'll play safe and guess it is $safebits bits.
20129 EOM
20130                                 selectminbits=$safebits
20131                                 bits="$safebits bits"
20132                                 ;;
20133                         1)      bits="1 bit" ;;
20134                         *)      bits="$selectminbits bits" ;;
20135                         esac
20136                         echo "Your select() operates on $bits at a time." >&4
20137                 else
20138                         rp='What is the minimum number of bits your select() operates on?'
20139                         case "$byteorder" in
20140                         12345678)       dflt=64 ;;
20141                         1234)           dflt=32 ;;
20142                         *)              dflt=1  ;;
20143                         esac
20144                         . ./myread
20145                         val=$ans
20146                         selectminbits="$val"
20147                 fi
20148                 $rm_try
20149                 ;;
20150         *)      : no select, so pick a harmless default
20151                 selectminbits=$safebits
20152                 ;;
20153         esac
20154         ;;
20155 esac
20156
20157 : Trace out the files included by signal.h, then look for SIGxxx names.
20158 if [ "X$fieldn" = X ]; then
20159         : Just make some guesses.  We check them later.
20160         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20161 else
20162         xxx=`echo '#include <signal.h>' |
20163         $cppstdin $cppminus $cppflags 2>/dev/null |
20164         $grep '^[       ]*#.*include' |
20165         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20166                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20167 fi
20168 xxxfiles=''
20169 for xx in $xxx /dev/null ; do
20170         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20171 done
20172 case "$xxxfiles" in
20173 '')     xxxfiles=`./findhdr signal.h` ;;
20174 esac
20175 xxx=`awk '
20176 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20177         print substr($2, 4, 20)
20178 }
20179 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20180         print substr($3, 4, 20)
20181 }' $xxxfiles`
20182 : Append some common names just in case the awk scan failed.
20183 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20184 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20185 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20186 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20187 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20188
20189 : generate a few handy files for later
20190 $cat > signal.c <<EOCP
20191 #include <sys/types.h>
20192 #include <signal.h>
20193 #$i_stdlib I_STDLIB
20194 #ifdef I_STDLIB
20195 #include <stdlib.h>
20196 #endif
20197 #include <stdio.h>
20198 int main() {
20199
20200 /* Strange style to avoid deeply-nested #if/#else/#endif */
20201 #ifndef NSIG
20202 #  ifdef _NSIG
20203 #    define NSIG (_NSIG)
20204 #  endif
20205 #endif
20206
20207 #ifndef NSIG
20208 #  ifdef SIGMAX
20209 #    define NSIG (SIGMAX+1)
20210 #  endif
20211 #endif
20212
20213 #ifndef NSIG
20214 #  ifdef SIG_MAX
20215 #    define NSIG (SIG_MAX+1)
20216 #  endif
20217 #endif
20218
20219 #ifndef NSIG
20220 #  ifdef _SIG_MAX
20221 #    define NSIG (_SIG_MAX+1)
20222 #  endif
20223 #endif
20224
20225 #ifndef NSIG
20226 #  ifdef MAXSIG
20227 #    define NSIG (MAXSIG+1)
20228 #  endif
20229 #endif
20230
20231 #ifndef NSIG
20232 #  ifdef MAX_SIG
20233 #    define NSIG (MAX_SIG+1)
20234 #  endif
20235 #endif
20236
20237 #ifndef NSIG
20238 #  ifdef SIGARRAYSIZE
20239 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20240 #  endif
20241 #endif
20242
20243 #ifndef NSIG
20244 #  ifdef _sys_nsig
20245 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20246 #  endif
20247 #endif
20248
20249 /* Default to some arbitrary number that's big enough to get most
20250    of the common signals.
20251 */
20252 #ifndef NSIG
20253 #    define NSIG 50
20254 #endif
20255
20256 printf("NSIG %d\n", NSIG);
20257
20258 #ifndef JUST_NSIG
20259
20260 EOCP
20261
20262 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20263 {
20264         printf "#ifdef SIG"; printf $1; printf "\n"
20265         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20266         printf $1; printf ");\n"
20267         printf "#endif\n"
20268 }
20269 END {
20270         printf "#endif /* JUST_NSIG */\n";
20271         printf "exit(0);\n}\n";
20272 }
20273 ' >>signal.c
20274 $cat >signal.awk <<'EOP'
20275 BEGIN { ndups = 0 }
20276 $1 ~ /^NSIG$/ { nsig = $2 }
20277 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20278     if ($2 > maxsig) { maxsig = $2 }
20279     if (sig_name[$2]) {
20280         dup_name[ndups] = $1
20281         dup_num[ndups] = $2
20282         ndups++
20283     }
20284     else {
20285         sig_name[$2] = $1
20286         sig_num[$2] = $2
20287     }
20288 }
20289 END {
20290     if (nsig == 0) {
20291         nsig = maxsig + 1
20292     }
20293     printf("NSIG %d\n", nsig);
20294     for (n = 1; n < nsig; n++) {
20295         if (sig_name[n]) {
20296             printf("%s %d\n", sig_name[n], sig_num[n])
20297         }
20298         else {
20299             printf("NUM%d %d\n", n, n)
20300         }
20301     }
20302     for (n = 0; n < ndups; n++) {
20303         printf("%s %d\n", dup_name[n], dup_num[n])
20304     }
20305 }
20306 EOP
20307 $cat >signal_cmd <<EOS
20308 $startsh
20309 if $test -s signal.lst; then
20310     echo "Using your existing signal.lst file"
20311         exit 0
20312 fi
20313 xxx="$xxx"
20314 EOS
20315 $cat >>signal_cmd <<'EOS'
20316
20317 set signal
20318 if eval $compile_ok; then
20319         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20320                 $uniq | $awk -f signal.awk >signal.lst
20321 else
20322         echo "(I can't seem be able to compile the whole test program)" >&4
20323         echo "(I'll try it in little pieces.)" >&4
20324         set signal -DJUST_NSIG
20325         if eval $compile_ok; then
20326                 $run ./signal$_exe > signal.nsg
20327                 $cat signal.nsg
20328         else
20329                 echo "I can't seem to figure out how many signals you have." >&4
20330                 echo "Guessing 50." >&4
20331                 echo 'NSIG 50' > signal.nsg
20332         fi
20333         : Now look at all the signal names, one at a time.
20334         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20335                 $cat > signal.c <<EOCP
20336 #include <sys/types.h>
20337 #include <signal.h>
20338 #include <stdio.h>
20339 int main() {
20340 printf("$xx %d\n", SIG${xx});
20341 return 0;
20342 }
20343 EOCP
20344                 set signal
20345                 if eval $compile; then
20346                         echo "SIG${xx} found."
20347                         $run ./signal$_exe  >> signal.ls1
20348                 else
20349                         echo "SIG${xx} NOT found."
20350                 fi
20351         done
20352         if $test -s signal.ls1; then
20353                 $cat signal.nsg signal.ls1 |
20354                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20355         fi
20356
20357 fi
20358 if $test -s signal.lst; then
20359         :
20360 else
20361         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20362         echo 'kill -l' >signal
20363         set X `csh -f <signal`
20364         $rm -f signal
20365         shift
20366         case $# in
20367         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20368         esac
20369         echo $@ | $tr ' ' $trnl | \
20370             $awk '{ printf "%s %d\n", $1, ++s; }
20371                   END { printf "NSIG %d\n", ++s }' >signal.lst
20372 fi
20373 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20374 EOS
20375 chmod a+x signal_cmd
20376 $eunicefix signal_cmd
20377
20378 : generate list of signal names
20379 echo " "
20380 case "$sig_name_init" in
20381 '') doinit=yes ;;
20382 *)  case "$sig_num_init" in
20383     ''|*,*) doinit=yes ;;
20384     esac ;;
20385 esac
20386 case "$doinit" in
20387 yes)
20388         echo "Generating a list of signal names and numbers..." >&4
20389         . ./signal_cmd
20390         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20391         sig_name=`$awk 'BEGIN { printf "ZERO " }
20392                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20393         sig_num=`$awk  'BEGIN { printf "0 " }
20394                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20395         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20396                              !/^NSIG/   { printf "\"%s\", ", $1 }
20397                              END        { printf "0\n" }' signal.lst`
20398         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20399                              !/^NSIG/   { printf "%d, ", $2}
20400                              END        { printf "0\n"}' signal.lst`
20401         ;;
20402 esac
20403 echo "The following $sig_count signals are available:"
20404 echo " "
20405 echo $sig_name | $awk \
20406 'BEGIN { linelen = 0 }
20407 {
20408         for (i = 1; i <= NF; i++) {
20409                 name = "SIG" $i " "
20410                 linelen = linelen + length(name)
20411                 if (linelen > 70) {
20412                         printf "\n"
20413                         linelen = length(name)
20414                 }
20415                 printf "%s", name
20416         }
20417         printf "\n"
20418 }'
20419 sig_size=`echo $sig_name | awk '{print NF}'`
20420 $rm -f signal signal.c signal.awk signal.lst signal_cmd
20421
20422 : Check size of size
20423 echo " "
20424 case "$sizetype" in
20425 *_t) zzz="$sizetype"    ;;
20426 *)   zzz="filesize"     ;;
20427 esac
20428 echo "Checking the size of $zzz..." >&4
20429 cat > try.c <<EOCP
20430 #include <sys/types.h>
20431 #include <stdio.h>
20432 #$i_stdlib I_STDLIB
20433 #ifdef I_STDLIB
20434 #include <stdlib.h>
20435 #endif
20436 int main() {
20437     printf("%d\n", (int)sizeof($sizetype));
20438     exit(0);
20439 }
20440 EOCP
20441 set try
20442 if eval $compile_ok; then
20443         yyy=`$run ./try`
20444         case "$yyy" in
20445         '')     sizesize=4
20446                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20447                 ;;
20448         *)      sizesize=$yyy
20449                 echo "Your $zzz size is $sizesize bytes."
20450                 ;;
20451         esac
20452 else
20453         sizesize=4
20454         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20455 fi
20456
20457
20458 : check for socklen_t
20459 echo " "
20460 echo "Checking to see if you have socklen_t..." >&4
20461 $cat >try.c <<EOCP
20462 #include <sys/types.h>
20463 #$d_socket HAS_SOCKET
20464 #ifdef HAS_SOCKET
20465 #include <sys/socket.h>
20466 #endif
20467 int main() { socklen_t x = 16; }
20468 EOCP
20469 set try
20470 if eval $compile; then
20471         val="$define"
20472         echo "You have socklen_t."
20473 else
20474         val="$undef"
20475         echo "You do not have socklen_t."
20476         case "$sizetype" in
20477         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20478         esac
20479 fi
20480 $rm_try
20481 set d_socklen_t
20482 eval $setvar
20483
20484 : see if this is a socks.h system
20485 set socks.h i_socks
20486 eval $inhdr
20487
20488 : check for type of the size argument to socket calls
20489 case "$d_socket" in
20490 "$define")
20491         $cat <<EOM
20492
20493 Checking to see what type is the last argument of accept().
20494 EOM
20495         yyy=''
20496         case "$d_socklen_t" in
20497         "$define") yyy="$yyy socklen_t"
20498         esac
20499         yyy="$yyy $sizetype int long unsigned"
20500         for xxx in $yyy; do
20501                 case "$socksizetype" in
20502                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
20503                         case "$usesocks" in
20504                         "$define")
20505                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20506                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20507                                         socksizetype="$xxx"
20508                                 fi
20509                                 ;;
20510                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20511                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20512                                         socksizetype="$xxx"
20513                                 fi
20514                                 ;;
20515                         esac
20516                         ;;
20517                 esac
20518         done
20519 : In case none of those worked, prompt the user.
20520         case "$socksizetype" in
20521         '')     rp='What is the type for socket address structure sizes?'
20522                 dflt='int'
20523                 . ./myread
20524                 socksizetype=$ans
20525                 ;;
20526         esac
20527         ;;
20528 *)      : no sockets, so pick relatively harmless default
20529         socksizetype='int'
20530         ;;
20531 esac
20532
20533 : see what type is used for signed size_t
20534 set ssize_t ssizetype int stdio.h sys/types.h
20535 eval $typedef
20536 dflt="$ssizetype"
20537 $cat > try.c <<EOM
20538 #include <stdio.h>
20539 #$i_stdlib I_STDLIB
20540 #ifdef I_STDLIB
20541 #include <stdlib.h>
20542 #endif
20543 #include <sys/types.h>
20544 #define Size_t $sizetype
20545 #define SSize_t $dflt
20546 int main()
20547 {
20548         if (sizeof(Size_t) == sizeof(SSize_t))
20549                 printf("$dflt\n");
20550         else if (sizeof(Size_t) == sizeof(int))
20551                 printf("int\n");
20552         else
20553                 printf("long\n");
20554         exit(0);
20555 }
20556 EOM
20557 echo " "
20558 set try
20559 if eval $compile_ok && $run ./try > /dev/null; then
20560         ssizetype=`$run ./try`
20561         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20562 else
20563         $cat >&4 <<EOM
20564 Help! I can't compile and run the ssize_t test program: please enlighten me!
20565 (This is probably a misconfiguration in your system or libraries, and
20566 you really ought to fix it.  Still, I'll try anyway.)
20567
20568 I need a type that is the same size as $sizetype, but is guaranteed to
20569 be signed.  Common values are ssize_t, int and long.
20570
20571 EOM
20572         rp="What signed type is the same size as $sizetype?"
20573         . ./myread
20574         ssizetype="$ans"
20575 fi
20576 $rm_try
20577
20578 : see what type of char stdio uses.
20579 echo " "
20580 echo '#include <stdio.h>' > stdio.c
20581 $cppstdin $cppminus < stdio.c > stdioh
20582 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20583         echo "Your stdio uses unsigned chars." >&4
20584         stdchar="unsigned char"
20585 else
20586         echo "Your stdio uses signed chars." >&4
20587         stdchar="char"
20588 fi
20589 $rm -f stdio.* stdioh
20590
20591 : see what type uids are declared as in the kernel
20592 echo " "
20593 echo "Looking for the type for user ids returned by getuid()."
20594 set uid_t uidtype xxx stdio.h sys/types.h
20595 eval $typedef
20596 case "$uidtype" in
20597 xxx)
20598         xxx=`./findhdr sys/user.h`
20599         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20600         case $1 in
20601         unsigned) dflt="$1 $2" ;;
20602         *) dflt="$1" ;;
20603         esac
20604         ;;
20605 *) dflt="$uidtype";;
20606 esac
20607 case "$uidtype" in
20608 uid_t)  echo "uid_t found." ;;
20609 *)      rp="What is the type for user ids returned by getuid()?"
20610         . ./myread
20611         uidtype="$ans"
20612         ;;
20613 esac
20614
20615 : Check size of UID
20616 echo " "
20617 case "$uidtype" in
20618 *_t) zzz="$uidtype"     ;;
20619 *)   zzz="uid"          ;;
20620 esac
20621 echo "Checking the size of $zzz..." >&4
20622 cat > try.c <<EOCP
20623 #include <sys/types.h>
20624 #include <stdio.h>
20625 #$i_stdlib I_STDLIB
20626 #ifdef I_STDLIB
20627 #include <stdlib.h>
20628 #endif
20629 int main() {
20630     printf("%d\n", (int)sizeof($uidtype));
20631     exit(0);
20632 }
20633 EOCP
20634 set try
20635 if eval $compile_ok; then
20636         yyy=`$run ./try`
20637         case "$yyy" in
20638         '')     uidsize=4
20639                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20640                 ;;
20641         *)      uidsize=$yyy
20642                 echo "Your $zzz is $uidsize bytes long."
20643                 ;;
20644         esac
20645 else
20646         uidsize=4
20647         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20648 fi
20649
20650 : Check if UID is signed
20651 echo " "
20652 case "$uidtype" in
20653 *_t) zzz="$uidtype"     ;;
20654 *)   zzz="uid"          ;;
20655 esac
20656 echo "Checking the sign of $zzz..." >&4
20657 cat > try.c <<EOCP
20658 #include <sys/types.h>
20659 #include <stdio.h>
20660 int main() {
20661         $uidtype foo = -1;
20662         if (foo < 0)
20663                 printf("-1\n");
20664         else
20665                 printf("1\n");
20666 }
20667 EOCP
20668 set try
20669 if eval $compile; then
20670         yyy=`$run ./try`
20671         case "$yyy" in
20672         '')     uidsign=1
20673                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20674                 ;;
20675         *)      uidsign=$yyy
20676                 case "$uidsign" in
20677                  1) echo "Your $zzz is unsigned." ;;
20678                 -1) echo "Your $zzz is signed."   ;;
20679                 esac
20680                 ;;
20681         esac
20682 else
20683         uidsign=1
20684         echo "(I can't compile the test program--guessing unsigned.)" >&4
20685 fi
20686
20687
20688 : Check format string for UID
20689 echo " "
20690 $echo "Checking the format string to be used for uids..." >&4
20691
20692 case "$uidsign" in
20693 -1)     if $test X"$uidsize" = X"$ivsize"; then
20694                 uidformat="$ivdformat"
20695         else
20696                 if $test X"$uidsize" = X"$longsize"; then
20697                         uidformat='"ld"'
20698                 else
20699                         if $test X"$uidsize" = X"$intsize"; then
20700                                 uidformat='"d"'
20701                         else
20702                                 if $test X"$uidsize" = X"$shortsize"; then
20703                                         uidformat='"hd"'
20704                                 fi
20705                         fi
20706                 fi
20707         fi
20708         ;;
20709 *)      if $test X"$uidsize" = X"$uvsize"; then
20710                 uidformat="$uvuformat"
20711         else
20712                 if $test X"$uidsize" = X"$longsize"; then
20713                         uidformat='"lu"'
20714                 else
20715                         if $test X"$uidsize" = X"$intsize"; then
20716                                 uidformat='"u"'
20717                         else
20718                                 if $test X"$uidsize" = X"$shortsize"; then
20719                                         uidformat='"hu"'
20720                                 fi
20721                         fi
20722                 fi
20723         fi
20724         ;;
20725 esac
20726
20727 : Check if site customization support was requested
20728 case "$usesitecustomize" in
20729     $define|true|[Yy]*)
20730         usesitecustomize="$define"
20731         ;;
20732     *)
20733         usesitecustomize="$undef"
20734         ;;
20735     esac
20736
20737 : determine compiler compiler
20738 case "$yacc" in
20739 '')
20740         dflt=yacc;;
20741 *)
20742         dflt="$yacc";;
20743 esac
20744 echo " "
20745 comp='yacc'
20746 if $test -f "$byacc$_exe"; then
20747         dflt="$byacc"
20748         comp="byacc or $comp"
20749 fi
20750 if $test -f "$bison$_exe"; then
20751         comp="$comp or bison -y"
20752 fi
20753 rp="Which compiler compiler ($comp) shall I use?"
20754 . ./myread
20755 yacc="$ans"
20756 case "$yacc" in
20757 *bis*)
20758         case "$yacc" in
20759         *-y*) ;;
20760         *)
20761                 yacc="$yacc -y"
20762                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20763                 ;;
20764         esac
20765         ;;
20766 esac
20767
20768 : see if this is a assert.h system
20769 set assert.h i_assert
20770 eval $inhdr
20771
20772 : see if this is a fp.h system
20773 set fp.h i_fp
20774 eval $inhdr
20775
20776 : see if this is a fp_class.h system
20777 set fp_class.h i_fp_class
20778 eval $inhdr
20779
20780 : see if gdbm.h is available
20781 set gdbm.h t_gdbm
20782 eval $inhdr
20783 case "$t_gdbm" in
20784 $define)
20785         : see if gdbm_open exists
20786         set gdbm_open d_gdbm_open
20787         eval $inlibc
20788         case "$d_gdbm_open" in
20789         $undef)
20790                 t_gdbm="$undef"
20791                 echo "We won't be including <gdbm.h>"
20792                 ;;
20793         esac
20794         ;;
20795 esac
20796 val="$t_gdbm"
20797 set i_gdbm
20798 eval $setvar
20799
20800 : see if this is a ieeefp.h system
20801 case "$i_ieeefp" in
20802 '' ) set ieeefp.h i_ieeefp
20803      eval $inhdr
20804      ;;
20805 esac
20806
20807 : see if this is a libutil.h system
20808 set libutil.h i_libutil
20809 eval $inhdr
20810
20811 : see if mach cthreads are available
20812 if test "X$usethreads" = "X$define"; then
20813         set mach/cthreads.h i_machcthr
20814         eval $inhdr
20815 else
20816         i_machcthr="$undef"
20817 fi
20818
20819 : see if this is a mntent.h system
20820 set mntent.h i_mntent
20821 eval $inhdr
20822
20823 : see if ndbm.h is available
20824 set ndbm.h i_ndbm
20825 eval $inhdr
20826 : Compatibility location for RedHat 7.1
20827 set gdbm/ndbm.h i_gdbmndbm
20828 eval $inhdr
20829 : Compatibility location for Debian 4.0
20830 set gdbm-ndbm.h i_gdbm_ndbm
20831 eval $inhdr
20832
20833 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
20834         : see if dbm_open exists
20835         set dbm_open d_dbm_open
20836         eval $inlibc
20837         case "$d_dbm_open" in
20838         $undef)
20839                 i_ndbm="$undef"
20840                 i_gdbmndbm="$undef"
20841                 i_gdbm_ndbm="$undef"
20842                 echo "We won't be including <ndbm.h>"
20843             val="$undef"
20844                 ;;
20845         *) val="$define"
20846            ;;
20847         esac
20848 fi
20849 set d_ndbm
20850 eval $setvar
20851
20852 : see if net/errno.h is available
20853 val=''
20854 set net/errno.h val
20855 eval $inhdr
20856
20857 : Unfortunately, it causes problems on some systems.  Arrgh.
20858 case "$val" in
20859 $define)
20860         cat > try.c <<'EOM'
20861 #include <stdio.h>
20862 #include <errno.h>
20863 #include <net/errno.h>
20864 int func()
20865 {
20866         return ENOTSOCK;
20867 }
20868 EOM
20869         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20870                 echo "We'll be including <net/errno.h>." >&4
20871         else
20872                 echo "We won't be including <net/errno.h>." >&4
20873                 val="$undef"
20874         fi
20875         $rm_try
20876         ;;
20877 esac
20878 set i_neterrno
20879 eval $setvar
20880
20881 : see if netinet/tcp.h is available
20882 set netinet/tcp.h i_netinettcp
20883 eval $inhdr
20884
20885 : see if this is a poll.h system
20886 set poll.h i_poll
20887 eval $inhdr
20888
20889 : see if this is a prot.h system
20890 set prot.h i_prot
20891 eval $inhdr
20892
20893 : Preprocessor symbols
20894 echo " "
20895 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20896 $cat <<'EOSH' > Cppsym.know
20897 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20898 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20899 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20900 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20901 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20902 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20903 bull c cadmus clipper CMU COFF COMPILER_VERSION
20904 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20905 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20906 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20907 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20908 GLIBC GLIBC_MINOR
20909 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20910 H3050R H3050RX hbullx20 hcx host_mips
20911 hp200 hp300 hp700 HP700 hp800 hp9000
20912 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20913 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20914 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20915 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20916 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20917 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20918 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20919 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20920 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20921 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20922 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20923 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20924 MATH_HAS_NO_SIDE_EFFECTS
20925 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20926 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20927 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20928 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20929 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20930 NetBSD news1500 news1700 news1800 news1900 news3700
20931 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20932 ns32016 ns32332 ns32k nsc32000
20933 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20934 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20935 pc532 pdp11 PGC PIC plexus PORTAR posix
20936 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20937 POSIX_C_SOURCE POSIX_SOURCE POWER
20938 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
20939 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20940 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20941 sony sony_news sonyrisc sparc sparclite spectrum
20942 stardent stdc STDC_EXT stratos sun sun3 sun386
20943 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20944 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20945 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20946 sysV68 sysV88 Tek4132 Tek4300 titan
20947 TM3200 TM5400 TM5600
20948 tower tower32 tower32_200 tower32_600 tower32_700
20949 tower32_800 tower32_850 tss
20950 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20951 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20952 unix UNIX95 UNIX99 unixpc unos
20953 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20954 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20955 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20956 USGr4 USGr4_2
20957 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20958 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20959 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20960 z8000
20961 EOSH
20962 # Maybe put other stuff here too.
20963 cat <<EOSH >>Cppsym.know
20964 $osname
20965 EOSH
20966 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20967 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20968 $cat Cppsym.know > Cppsym.c
20969 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20970 $rm -f Cppsym.a Cppsym.b Cppsym.c
20971 cat <<EOSH > Cppsym
20972 $startsh
20973 if $test \$# -gt 0; then
20974     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20975     if $test -s Cppsym.got; then
20976         $rm -f Cppsym.got
20977         exit 0
20978     fi
20979     $rm -f Cppsym.got
20980     exit 1
20981 else
20982     $tr " " "$trnl" | ./Cppsym.try
20983     exit 0
20984 fi
20985 EOSH
20986 chmod +x Cppsym
20987 $eunicefix Cppsym
20988 cat <<EOSH > Cppsym.try
20989 $startsh
20990 cat <<'EOCP' > try.c
20991 #include <stdio.h>
20992 #if cpp_stuff == 1
20993 #define STRINGIFY(a)    "a"
20994 #endif
20995 #if cpp_stuff == 42
20996 #define StGiFy(a)  #a
20997 #define STRINGIFY(a)    StGiFy(a)
20998 #endif
20999 #if $cpp_stuff != 1 && $cpp_stuff != 42
21000 #   include "Bletch: How does this C preprocessor stringify macros?"
21001 #endif
21002 int main() {
21003 EOCP
21004 $awk \\
21005 EOSH
21006 cat <<'EOSH' >> Cppsym.try
21007 'length($1) > 0 {
21008     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21009     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21010     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21011     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
21012 }'       >> try.c
21013 echo 'return 0;}' >> try.c
21014 EOSH
21015 cat <<EOSH >> Cppsym.try
21016 ccflags="$ccflags"
21017 case "$osname-$gccversion" in
21018 irix-) ccflags="\$ccflags -woff 1178" ;;
21019 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21020 esac
21021 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
21022 EOSH
21023 chmod +x Cppsym.try
21024 $eunicefix Cppsym.try
21025 ./Cppsym < Cppsym.know > Cppsym.true
21026 : Add in any linux cpp "predefined macros":
21027 case "$osname::$gccversion" in
21028   *linux*::*.*)
21029     tHdrH=_tmpHdr
21030     rm -f $tHdrH'.h' $tHdrH
21031     touch $tHdrH'.h'
21032     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
21033        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21034        if [ -s $tHdrH'_cppsym.real' ]; then
21035           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21036        fi
21037     fi
21038     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21039   ;;
21040 esac
21041 : now check the C compiler for additional symbols
21042 postprocess_cc_v=''
21043 case "$osname" in
21044 aix) postprocess_cc_v="|$tr , ' '" ;;
21045 esac
21046 $cat >ccsym <<EOS
21047 $startsh
21048 $cat >tmp.c <<EOF
21049 extern int foo;
21050 EOF
21051 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21052 do
21053         case "\$i" in
21054         -D*) echo "\$i" | $sed 's/^-D//';;
21055         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
21056         esac
21057 done
21058 $rm_try
21059 EOS
21060 postprocess_cc_v=''
21061 chmod +x ccsym
21062 $eunicefix ccsym
21063 ./ccsym > ccsym1.raw
21064 if $test -s ccsym1.raw; then
21065        $sort ccsym1.raw | $uniq >ccsym.raw
21066 else
21067        mv ccsym1.raw ccsym.raw
21068 fi
21069
21070 $awk '/\=/ { print $0; next }
21071         { print $0"=1" }' ccsym.raw >ccsym.list
21072 $comm -13 Cppsym.true ccsym.list >ccsym.own
21073 $comm -12 Cppsym.true ccsym.list >ccsym.com
21074 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
21075 also=''
21076 if $test -z ccsym.raw; then
21077         echo "Your C compiler doesn't seem to define any symbols!" >&4
21078         echo " "
21079         echo "However, your C preprocessor defines the following symbols:"
21080         $cat Cppsym.true
21081         ccsymbols=''
21082         cppsymbols=`$cat Cppsym.true`
21083         cppsymbols=`echo $cppsymbols`
21084         cppccsymbols="$cppsymbols"
21085 else
21086         if $test -s ccsym.com; then
21087                 echo "Your C compiler and pre-processor define these symbols:"
21088                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21089                 also='also '
21090                 symbols='ones'
21091                 cppccsymbols=`$cat ccsym.com`
21092                 cppccsymbols=`echo $cppccsymbols`
21093                 $test "$silent" || sleep 1
21094         fi
21095         if $test -s ccsym.cpp; then
21096                 $test "$also" && echo " "
21097                 echo "Your C pre-processor ${also}defines the following symbols:"
21098                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21099                 also='further '
21100                 cppsymbols=`$cat ccsym.cpp`
21101                 cppsymbols=`echo $cppsymbols`
21102                 $test "$silent" || sleep 1
21103         fi
21104         if $test -s ccsym.own; then
21105                 $test "$also" && echo " "
21106                 echo "Your C compiler ${also}defines the following cpp symbols:"
21107                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21108                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21109                 ccsymbols=`$cat ccsym.own`
21110                 ccsymbols=`echo $ccsymbols`
21111                 $test "$silent" || sleep 1
21112         fi
21113 fi
21114
21115 : see if this is a termio system
21116 val="$undef"
21117 val2="$undef"
21118 val3="$undef"
21119 if $test `./findhdr termios.h`; then
21120         set tcsetattr i_termios
21121         eval $inlibc
21122         val3="$i_termios"
21123 fi
21124 echo " "
21125 case "$val3" in
21126 "$define") echo "You have POSIX termios.h... good!" >&4;;
21127 *) if ./Cppsym pyr; then
21128                 case "`/bin/universe`" in
21129                 ucb) if $test `./findhdr sgtty.h`; then
21130                                 val2="$define"
21131                                 echo "<sgtty.h> found." >&4
21132                         else
21133                                 echo "System is pyramid with BSD universe."
21134                                 ./warn "<sgtty.h> not found--you could have problems."
21135                         fi;;
21136                 *) if $test `./findhdr termio.h`; then
21137                                 val="$define"
21138                                 echo "<termio.h> found." >&4
21139                         else
21140                                 echo "System is pyramid with USG universe."
21141                                 ./warn "<termio.h> not found--you could have problems."
21142                         fi;;
21143                 esac
21144         elif ./usg; then
21145                 if $test `./findhdr termio.h`; then
21146                         echo "<termio.h> found." >&4
21147                         val="$define"
21148                 elif $test `./findhdr sgtty.h`; then
21149                         echo "<sgtty.h> found." >&4
21150                         val2="$define"
21151                 else
21152                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
21153                 fi
21154         else
21155                 if $test `./findhdr sgtty.h`; then
21156                         echo "<sgtty.h> found." >&4
21157                         val2="$define"
21158                 elif $test `./findhdr termio.h`; then
21159                         echo "<termio.h> found." >&4
21160                         val="$define"
21161                 else
21162                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
21163                 fi
21164         fi;;
21165 esac
21166 set i_termio; eval $setvar
21167 val=$val2; set i_sgtty; eval $setvar
21168 val=$val3; set i_termios; eval $setvar
21169
21170 : see if stddef is available
21171 set stddef.h i_stddef
21172 eval $inhdr
21173
21174 : see if sys/access.h is available
21175 set sys/access.h i_sysaccess
21176 eval $inhdr
21177
21178 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
21179 set sys/filio.h i_sysfilio
21180 eval $inhdr
21181 echo " "
21182 if $test `./findhdr sys/ioctl.h`; then
21183         val="$define"
21184         echo '<sys/ioctl.h> found.' >&4
21185 else
21186         val="$undef"
21187         if $test $i_sysfilio = "$define"; then
21188             echo '<sys/ioctl.h> NOT found.' >&4
21189         else
21190                 $test $i_sgtty = "$define" && xxx="sgtty.h"
21191                 $test $i_termio = "$define" && xxx="termio.h"
21192                 $test $i_termios = "$define" && xxx="termios.h"
21193 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
21194         fi
21195 fi
21196 set i_sysioctl
21197 eval $setvar
21198
21199 : see if socket ioctl defs are in sys/sockio.h
21200 echo " "
21201 xxx=`./findhdr sys/sockio.h`
21202 if $test "$xxx"; then
21203         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
21204                 val="$define"
21205                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
21206         else
21207                 val="$undef"
21208                 echo "No socket ioctls found in <sys/sockio.h>." >&4
21209         fi
21210 else
21211         val="$undef"
21212         $cat <<EOM
21213 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
21214 EOM
21215 fi
21216 set i_syssockio
21217 eval $setvar
21218
21219 : see if this is a syslog.h system
21220 set syslog.h i_syslog
21221 eval $inhdr
21222
21223 : see if this is a sys/mode.h system
21224 set sys/mode.h i_sysmode
21225 eval $inhdr
21226
21227 : see if there is a sys/poll.h file
21228 set sys/poll.h i_syspoll
21229 eval $inhdr
21230
21231 : see if sys/resource.h has to be included
21232 set sys/resource.h i_sysresrc
21233 eval $inhdr
21234
21235 : see if sys/security.h is available
21236 set sys/security.h i_syssecrt
21237 eval $inhdr
21238
21239 : see if this is a sys/statvfs.h system
21240 set sys/statvfs.h i_sysstatvfs
21241 eval $inhdr
21242
21243 : see if this is a sys/un.h system
21244 set sys/un.h i_sysun
21245 eval $inhdr
21246
21247 : see if this is a sys/utsname.h system
21248 set sys/utsname.h i_sysutsname
21249 eval $inhdr
21250
21251 : see if this is a syswait system
21252 set sys/wait.h i_syswait
21253 eval $inhdr
21254
21255 : see if this is a ustat.h system
21256 set ustat.h i_ustat
21257 eval $inhdr
21258
21259 : see if this is an utime system
21260 set utime.h i_utime
21261 eval $inhdr
21262
21263 : see if this is a values.h system
21264 set values.h i_values
21265 eval $inhdr
21266
21267 : see if this is a vfork system
21268 case "$d_vfork" in
21269 "$define")
21270         set vfork.h i_vfork
21271         eval $inhdr
21272         ;;
21273 *)
21274         i_vfork="$undef"
21275         ;;
21276 esac
21277
21278 : Check extensions
21279 echo " "
21280 echo "Looking for extensions..." >&4
21281 : If we are using the old config.sh, known_extensions may contain
21282 : old or inaccurate or duplicate values.
21283 known_extensions=''
21284 nonxs_extensions=''
21285 : We do not use find because it might not be available.
21286 : We do not just use MANIFEST because the user may have dropped
21287 : some additional extensions into the source tree and expect them
21288 : to be built.
21289
21290 : Function to recursively find available extensions, ignoring DynaLoader
21291 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21292 find_extensions='
21293     for xxx in *; do
21294         case "$xxx" in
21295             DynaLoader|dynaload) ;;
21296             *)
21297             if $test -f $xxx/$xxx.xs -o -f $xxx/$xxx.c; then
21298                 known_extensions="$known_extensions $1$xxx";
21299             elif $test -f $xxx/Makefile.PL; then
21300                 nonxs_extensions="$nonxs_extensions $1$xxx";
21301             else
21302                 if $test -d $xxx -a $# -lt 10; then
21303                     set $1$xxx/ $*;
21304                     cd "$xxx";
21305                     eval $find_extensions;
21306                     cd ..;
21307                     shift;
21308                 fi;
21309             fi
21310             ;;
21311         esac;
21312     done'
21313 tdir=`pwd`
21314 cd "$rsrc/ext"
21315 set X
21316 shift
21317 eval $find_extensions
21318 # Special case:  Add in modules that nest beyond the first level.
21319 # Currently threads/shared and Hash/Util/FieldHash, since they are
21320 # not picked up by the recursive find above (and adding in general
21321 # recursive finding breaks SDBM_File/sdbm).
21322 # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21323 known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
21324 set X $known_extensions
21325 shift
21326 known_extensions="$*"
21327 set X $nonxs_extensions
21328 shift
21329 nonxs_extensions="$*"
21330 cd "$tdir"
21331
21332 : Now see which are supported on this system.
21333 avail_ext=''
21334 for xxx in $known_extensions ; do
21335         case "$xxx" in
21336         DB_File|db_file)
21337                 case "$i_db" in
21338                 $define) avail_ext="$avail_ext $xxx" ;;
21339                 esac
21340                 ;;
21341         GDBM_File|gdbm_fil)
21342                 case "$i_gdbm" in
21343                 $define) avail_ext="$avail_ext $xxx" ;;
21344                 esac
21345                 ;;
21346         I18N/Langinfo|i18n_lan)
21347                 case "$i_langinfo$d_nl_langinfo" in
21348                 $define$define) avail_ext="$avail_ext $xxx" ;;
21349                 esac
21350                 ;;
21351         IPC/SysV|ipc/sysv)
21352                 : XXX Do we need a useipcsysv variable here
21353                 case "${d_msg}${d_sem}${d_shm}" in
21354                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21355                 esac
21356                 ;;
21357         NDBM_File|ndbm_fil)
21358                 case "$i_ndbm" in
21359                 $define)
21360                     case "$osname-$use64bitint" in
21361                     hpux-define)
21362                         case "$libs" in
21363                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21364                         esac
21365                         ;;
21366                     *) avail_ext="$avail_ext $xxx" ;;
21367                     esac
21368                     ;;
21369                 esac
21370                 ;;
21371         ODBM_File|odbm_fil)
21372                 case "${i_dbm}${i_rpcsvcdbm}" in
21373                 *"${define}"*)
21374                     case "$d_cplusplus" in
21375                     define) ;; # delete as a function name will not work
21376                     *)  case "$osname-$use64bitint" in
21377                         hpux-define)
21378                             case "$libs" in
21379                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21380                             esac
21381                             ;;
21382                         *) avail_ext="$avail_ext $xxx" ;;
21383                         esac
21384                         ;;
21385                     esac
21386                     ;;
21387                 esac
21388                 ;;
21389         Opcode|opcode)
21390                 case "$useopcode" in
21391                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21392                 esac
21393                 ;;
21394         POSIX|posix)
21395                 case "$useposix" in
21396                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21397                 esac
21398                 ;;
21399         Socket|socket)
21400                 case "$d_socket" in
21401                 true|$define|y)
21402                     case "$osname" in
21403                     beos) ;; # not unless BONE
21404                     *) avail_ext="$avail_ext $xxx" ;;
21405                     esac
21406                     ;;
21407                 esac
21408                 ;;
21409         Sys/Syslog|sys/syslog)
21410                 : XXX syslog requires socket
21411                 case "$d_socket" in
21412                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21413                 esac
21414                 ;;
21415         Thread|thread)
21416                 case "$usethreads" in
21417                 true|$define|y)
21418                         case "$use5005threads" in
21419                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
21420                         esac
21421                 esac
21422                 ;;
21423         threads|threads/shared)
21424                 # threads and threads::shared are special cases.
21425                 # To stop people from asking "Perl 5.8.0 was supposed
21426                 # to have this new fancy threads implementation but my
21427                 # perl doesn't have it" and from people trying to
21428                 # (re)install the threads module using CPAN.pm and
21429                 # CPAN.pm then offering to reinstall Perl 5.8.0,
21430                 # the threads.pm and threads/shared.pm will always be
21431                 # there, croaking informatively ("you need to rebuild
21432                 # all of Perl with threads, sorry") when threads haven't
21433                 # been compiled in.
21434                 # --jhi
21435                 avail_ext="$avail_ext $xxx"
21436                 ;;
21437         Win32*)
21438                 case "$osname" in
21439                 cygwin) avail_ext="$avail_ext $xxx" ;;
21440                 esac
21441                 ;;
21442         XS/APItest|xs/apitest)
21443                 # This is just for testing.  Skip it unless we have dynamic loading.
21444
21445                 case "$usedl" in
21446                 $define) avail_ext="$avail_ext $xxx" ;;
21447                 esac
21448                 ;;
21449         XS/Typemap|xs/typemap)
21450                 # This is just for testing.  Skip it unless we have dynamic loading.
21451                 case "$usedl" in
21452                 $define) avail_ext="$avail_ext $xxx" ;;
21453                 esac
21454                 ;;
21455         *)      avail_ext="$avail_ext $xxx"
21456                 ;;
21457         esac
21458 done
21459
21460 set X $avail_ext
21461 shift
21462 avail_ext="$*"
21463
21464 case "$onlyextensions" in
21465 '') ;;
21466 *)  keepextensions=''
21467     echo "You have requested that only certains extensions be included..." >&4
21468     for i in $onlyextensions; do
21469         case " $avail_ext " in
21470         *" $i "*)
21471             echo "Keeping extension $i."
21472             keepextensions="$keepextensions $i"
21473             ;;
21474         *) echo "Ignoring extension $i." ;;
21475         esac
21476     done
21477     avail_ext="$keepextensions"
21478     ;;
21479 esac
21480
21481 case "$noextensions" in
21482 '') ;;
21483 *)  keepextensions=''
21484     echo "You have requested that certain extensions be ignored..." >&4
21485     for i in $avail_ext; do
21486         case " $noextensions " in
21487         *" $i "*) echo "Ignoring extension $i." ;;
21488         *) echo "Keeping extension $i.";
21489            keepextensions="$keepextensions $i"
21490            ;;
21491         esac
21492     done
21493     avail_ext="$keepextensions"
21494     ;;
21495 esac
21496
21497 : Now see which nonxs extensions are supported on this system.
21498 : For now assume all are.
21499 nonxs_ext=''
21500 for xxx in $nonxs_extensions ; do
21501         case "$xxx" in
21502         *)      nonxs_ext="$nonxs_ext $xxx"
21503                 ;;
21504         esac
21505 done
21506
21507 set X $nonxs_ext
21508 shift
21509 nonxs_ext="$*"
21510
21511 case $usedl in
21512 $define)
21513         $cat <<EOM
21514 A number of extensions are supplied with $package.  You may choose to
21515 compile these extensions for dynamic loading (the default), compile
21516 them into the $package executable (static loading), or not include
21517 them at all.  Answer "none" to include no extensions.
21518 Note that DynaLoader is always built and need not be mentioned here.
21519
21520 EOM
21521         case "$dynamic_ext" in
21522         '')
21523                 : Exclude those listed in static_ext
21524                 dflt=''
21525                 for xxx in $avail_ext; do
21526                         case " $static_ext " in
21527                         *" $xxx "*) ;;
21528                         *) dflt="$dflt $xxx" ;;
21529                         esac
21530                 done
21531                 set X $dflt
21532                 shift
21533                 dflt="$*"
21534                 ;;
21535         *)      dflt="$dynamic_ext"
21536                 # Perhaps we are reusing an old out-of-date config.sh.
21537                 case "$hint" in
21538                 previous)
21539                         if test X"$dynamic_ext" != X"$avail_ext"; then
21540                                 $cat <<EOM
21541 NOTICE:  Your previous config.sh list may be incorrect.
21542 The extensions now available to you are
21543         ${avail_ext}
21544 but the default list from your previous config.sh is
21545         ${dynamic_ext}
21546
21547 EOM
21548                         fi
21549                         ;;
21550                 esac
21551                 ;;
21552         esac
21553         case "$dflt" in
21554         '')     dflt=none;;
21555         esac
21556         rp="What extensions do you wish to load dynamically?"
21557         . ./myread
21558         case "$ans" in
21559         none) dynamic_ext=' ' ;;
21560         *) dynamic_ext="$ans" ;;
21561         esac
21562
21563         case "$static_ext" in
21564         '')
21565                 : Exclude those already listed in dynamic linking
21566                 dflt=''
21567                 for xxx in $avail_ext; do
21568                         case " $dynamic_ext " in
21569                         *" $xxx "*) ;;
21570                         *) dflt="$dflt $xxx" ;;
21571                         esac
21572                 done
21573                 set X $dflt
21574                 shift
21575                 dflt="$*"
21576                 ;;
21577         *)  dflt="$static_ext"
21578                 ;;
21579         esac
21580
21581         case "$dflt" in
21582         '')     dflt=none;;
21583         esac
21584         rp="What extensions do you wish to load statically?"
21585         . ./myread
21586         case "$ans" in
21587         none) static_ext=' ' ;;
21588         *) static_ext="$ans" ;;
21589         esac
21590         ;;
21591 *)
21592         $cat <<EOM
21593 A number of extensions are supplied with $package.  Answer "none"
21594 to include no extensions.
21595 Note that DynaLoader is always built and need not be mentioned here.
21596
21597 EOM
21598         case "$static_ext" in
21599         '') dflt="$avail_ext" ;;
21600         *)      dflt="$static_ext"
21601                 # Perhaps we are reusing an old out-of-date config.sh.
21602                 case "$hint" in
21603                 previous)
21604                         if test X"$static_ext" != X"$avail_ext"; then
21605                                 $cat <<EOM
21606 NOTICE:  Your previous config.sh list may be incorrect.
21607 The extensions now available to you are
21608         ${avail_ext}
21609 but the default list from your previous config.sh is
21610         ${static_ext}
21611
21612 EOM
21613                         fi
21614                         ;;
21615                 esac
21616                 ;;
21617         esac
21618         : Exclude those that are not xs extensions
21619         case "$dflt" in
21620         '')     dflt=none;;
21621         esac
21622         rp="What extensions do you wish to include?"
21623         . ./myread
21624         case "$ans" in
21625         none) static_ext=' ' ;;
21626         *) static_ext="$ans" ;;
21627         esac
21628         ;;
21629 esac
21630 #
21631 # Encode is a special case.  If we are building Encode as a static
21632 # extension, we need to explicitly list its subextensions as well.
21633 # For other nested extensions, this is handled automatically by
21634 # the appropriate Makefile.PL.
21635 case " $static_ext " in
21636         *" Encode "*) # Add the subextensions of Encode
21637         cd "$rsrc/ext"
21638         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21639                 static_ext="$static_ext Encode/$xxx"
21640         done
21641         cd "$tdir"
21642         ;;
21643 esac
21644
21645 set X $dynamic_ext $static_ext $nonxs_ext
21646 shift
21647 extensions="$*"
21648
21649 # Sanity check:  We require an extension suitable for use with
21650 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21651 # should show up as failures in the test suite, but it's helpful to
21652 # catch them now.) The 'extensions' list is normally sorted
21653 # alphabetically, so we need to accept either
21654 #    DB_File ... Fcntl ... IO  ....
21655 # or something like
21656 #    Fcntl ... NDBM_File ... IO  ....
21657 case " $extensions"  in
21658 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21659 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21660 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21661 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21662    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21663    ;;
21664 esac
21665
21666 : Remove libraries needed only for extensions
21667 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21668 : The exception is SunOS 4.x, which needs them.
21669 case "${osname}X${osvers}" in
21670 sunos*X4*)
21671     perllibs="$libs"
21672     ;;
21673 *) case "$usedl" in
21674     $define|true|[yY]*)
21675             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21676             shift
21677             perllibs="$*"
21678             ;;
21679     *)  perllibs="$libs"
21680             ;;
21681     esac
21682     ;;
21683 esac
21684
21685 : Remove build directory name from cppstdin so it can be used from
21686 : either the present location or the final installed location.
21687 echo " "
21688 : Get out of the UU directory to get correct path name.
21689 cd ..
21690 case "$cppstdin" in
21691 `pwd`/cppstdin)
21692         echo "Stripping down cppstdin path name"
21693         cppstdin=cppstdin
21694         ;;
21695 esac
21696 cd UU
21697
21698 : end of configuration questions
21699 echo " "
21700 echo "End of configuration questions."
21701 echo " "
21702
21703 : back to where it started
21704 if test -d ../UU; then
21705         cd ..
21706 fi
21707
21708 : configuration may be unconditionally patched via a 'config.arch' file
21709 if $test -f config.arch; then
21710         echo "I see a config.arch file, loading it." >&4
21711         . ./config.arch
21712 fi
21713
21714 : configuration may be patched via a 'config.over' file
21715 if $test -f config.over; then
21716         echo " "
21717         dflt=y
21718         rp='I see a config.over file.  Do you wish to load it?'
21719         . UU/myread
21720         case "$ans" in
21721         n*) echo "OK, I'll ignore it.";;
21722         *)      . ./config.over
21723                 echo "Configuration override changes have been loaded."
21724                 ;;
21725         esac
21726 fi
21727
21728 : in case they want portability, strip down executable paths
21729 case "$d_portable" in
21730 "$define")
21731         echo " "
21732         echo "Stripping down executable paths..." >&4
21733         for file in $loclist $trylist; do
21734                 eval temp=\$$file
21735                 eval $file=`basename $temp`
21736         done
21737         ;;
21738 esac
21739
21740 : create config.sh file
21741 echo " "
21742 echo "Creating config.sh..." >&4
21743 $spitshell <<EOT >config.sh
21744 $startsh
21745 #
21746 # This file was produced by running the Configure script. It holds all the
21747 # definitions figured out by Configure. Should you modify one of these values,
21748 # do not forget to propagate your changes by running "Configure -der". You may
21749 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21750 #
21751
21752 # Package name      : $package
21753 # Source directory  : $src
21754 # Configuration time: $cf_time
21755 # Configured by     : $cf_by
21756 # Target system     : $myuname
21757
21758 EOT
21759 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
21760 $spitshell <<EOT >>config.sh
21761
21762 Author='$Author'
21763 Date='$Date'
21764 Header='$Header'
21765 Id='$Id'
21766 Locker='$Locker'
21767 Log='$Log'
21768 RCSfile='$RCSfile'
21769 Revision='$Revision'
21770 Source='$Source'
21771 State='$State'
21772 _a='$_a'
21773 _exe='$_exe'
21774 _o='$_o'
21775 afs='$afs'
21776 afsroot='$afsroot'
21777 alignbytes='$alignbytes'
21778 ansi2knr='$ansi2knr'
21779 aphostname='$aphostname'
21780 api_revision='$api_revision'
21781 api_subversion='$api_subversion'
21782 api_version='$api_version'
21783 api_versionstring='$api_versionstring'
21784 ar='$ar'
21785 archlib='$archlib'
21786 archlibexp='$archlibexp'
21787 archname64='$archname64'
21788 archname='$archname'
21789 archobjs='$archobjs'
21790 asctime_r_proto='$asctime_r_proto'
21791 awk='$awk'
21792 baserev='$baserev'
21793 bash='$bash'
21794 bin='$bin'
21795 binexp='$binexp'
21796 bison='$bison'
21797 byacc='$byacc'
21798 byteorder='$byteorder'
21799 c='$c'
21800 castflags='$castflags'
21801 cat='$cat'
21802 cc='$cc'
21803 cccdlflags='$cccdlflags'
21804 ccdlflags='$ccdlflags'
21805 ccflags='$ccflags'
21806 ccflags_uselargefiles='$ccflags_uselargefiles'
21807 ccname='$ccname'
21808 ccsymbols='$ccsymbols'
21809 ccversion='$ccversion'
21810 cf_by='$cf_by'
21811 cf_email='$cf_email'
21812 cf_time='$cf_time'
21813 chgrp='$chgrp'
21814 chmod='$chmod'
21815 chown='$chown'
21816 clocktype='$clocktype'
21817 comm='$comm'
21818 compress='$compress'
21819 contains='$contains'
21820 cp='$cp'
21821 cpio='$cpio'
21822 cpp='$cpp'
21823 cpp_stuff='$cpp_stuff'
21824 cppccsymbols='$cppccsymbols'
21825 cppflags='$cppflags'
21826 cpplast='$cpplast'
21827 cppminus='$cppminus'
21828 cpprun='$cpprun'
21829 cppstdin='$cppstdin'
21830 cppsymbols='$cppsymbols'
21831 crypt_r_proto='$crypt_r_proto'
21832 cryptlib='$cryptlib'
21833 csh='$csh'
21834 ctermid_r_proto='$ctermid_r_proto'
21835 ctime_r_proto='$ctime_r_proto'
21836 d_Gconvert='$d_Gconvert'
21837 d_PRIEUldbl='$d_PRIEUldbl'
21838 d_PRIFUldbl='$d_PRIFUldbl'
21839 d_PRIGUldbl='$d_PRIGUldbl'
21840 d_PRIXU64='$d_PRIXU64'
21841 d_PRId64='$d_PRId64'
21842 d_PRIeldbl='$d_PRIeldbl'
21843 d_PRIfldbl='$d_PRIfldbl'
21844 d_PRIgldbl='$d_PRIgldbl'
21845 d_PRIi64='$d_PRIi64'
21846 d_PRIo64='$d_PRIo64'
21847 d_PRIu64='$d_PRIu64'
21848 d_PRIx64='$d_PRIx64'
21849 d_SCNfldbl='$d_SCNfldbl'
21850 d__fwalk='$d__fwalk'
21851 d_access='$d_access'
21852 d_accessx='$d_accessx'
21853 d_aintl='$d_aintl'
21854 d_alarm='$d_alarm'
21855 d_archlib='$d_archlib'
21856 d_asctime_r='$d_asctime_r'
21857 d_atolf='$d_atolf'
21858 d_atoll='$d_atoll'
21859 d_attribute_format='$d_attribute_format'
21860 d_attribute_malloc='$d_attribute_malloc'
21861 d_attribute_nonnull='$d_attribute_nonnull'
21862 d_attribute_noreturn='$d_attribute_noreturn'
21863 d_attribute_pure='$d_attribute_pure'
21864 d_attribute_unused='$d_attribute_unused'
21865 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21866 d_bcmp='$d_bcmp'
21867 d_bcopy='$d_bcopy'
21868 d_bsd='$d_bsd'
21869 d_bsdgetpgrp='$d_bsdgetpgrp'
21870 d_bsdsetpgrp='$d_bsdsetpgrp'
21871 d_builtin_choose_expr='$d_builtin_choose_expr'
21872 d_builtin_expect='$d_builtin_expect'
21873 d_bzero='$d_bzero'
21874 d_c99_variadic_macros='$d_c99_variadic_macros'
21875 d_casti32='$d_casti32'
21876 d_castneg='$d_castneg'
21877 d_charvspr='$d_charvspr'
21878 d_chown='$d_chown'
21879 d_chroot='$d_chroot'
21880 d_chsize='$d_chsize'
21881 d_class='$d_class'
21882 d_clearenv='$d_clearenv'
21883 d_closedir='$d_closedir'
21884 d_cmsghdr_s='$d_cmsghdr_s'
21885 d_const='$d_const'
21886 d_copysignl='$d_copysignl'
21887 d_cplusplus='$d_cplusplus'
21888 d_crypt='$d_crypt'
21889 d_crypt_r='$d_crypt_r'
21890 d_csh='$d_csh'
21891 d_ctermid='$d_ctermid'
21892 d_ctermid_r='$d_ctermid_r'
21893 d_ctime_r='$d_ctime_r'
21894 d_cuserid='$d_cuserid'
21895 d_dbl_dig='$d_dbl_dig'
21896 d_dbminitproto='$d_dbminitproto'
21897 d_difftime='$d_difftime'
21898 d_dir_dd_fd='$d_dir_dd_fd'
21899 d_dirfd='$d_dirfd'
21900 d_dirnamlen='$d_dirnamlen'
21901 d_dlerror='$d_dlerror'
21902 d_dlopen='$d_dlopen'
21903 d_dlsymun='$d_dlsymun'
21904 d_dosuid='$d_dosuid'
21905 d_drand48_r='$d_drand48_r'
21906 d_drand48proto='$d_drand48proto'
21907 d_dup2='$d_dup2'
21908 d_eaccess='$d_eaccess'
21909 d_endgrent='$d_endgrent'
21910 d_endgrent_r='$d_endgrent_r'
21911 d_endhent='$d_endhent'
21912 d_endhostent_r='$d_endhostent_r'
21913 d_endnent='$d_endnent'
21914 d_endnetent_r='$d_endnetent_r'
21915 d_endpent='$d_endpent'
21916 d_endprotoent_r='$d_endprotoent_r'
21917 d_endpwent='$d_endpwent'
21918 d_endpwent_r='$d_endpwent_r'
21919 d_endsent='$d_endsent'
21920 d_endservent_r='$d_endservent_r'
21921 d_eofnblk='$d_eofnblk'
21922 d_eunice='$d_eunice'
21923 d_faststdio='$d_faststdio'
21924 d_fchdir='$d_fchdir'
21925 d_fchmod='$d_fchmod'
21926 d_fchown='$d_fchown'
21927 d_fcntl='$d_fcntl'
21928 d_fcntl_can_lock='$d_fcntl_can_lock'
21929 d_fd_macros='$d_fd_macros'
21930 d_fd_set='$d_fd_set'
21931 d_fds_bits='$d_fds_bits'
21932 d_fgetpos='$d_fgetpos'
21933 d_finite='$d_finite'
21934 d_finitel='$d_finitel'
21935 d_flexfnam='$d_flexfnam'
21936 d_flock='$d_flock'
21937 d_flockproto='$d_flockproto'
21938 d_fork='$d_fork'
21939 d_fp_class='$d_fp_class'
21940 d_fpathconf='$d_fpathconf'
21941 d_fpclass='$d_fpclass'
21942 d_fpclassify='$d_fpclassify'
21943 d_fpclassl='$d_fpclassl'
21944 d_fpos64_t='$d_fpos64_t'
21945 d_frexpl='$d_frexpl'
21946 d_fs_data_s='$d_fs_data_s'
21947 d_fseeko='$d_fseeko'
21948 d_fsetpos='$d_fsetpos'
21949 d_fstatfs='$d_fstatfs'
21950 d_fstatvfs='$d_fstatvfs'
21951 d_fsync='$d_fsync'
21952 d_ftello='$d_ftello'
21953 d_ftime='$d_ftime'
21954 d_futimes='$d_futimes'
21955 d_getcwd='$d_getcwd'
21956 d_getespwnam='$d_getespwnam'
21957 d_getfsstat='$d_getfsstat'
21958 d_getgrent='$d_getgrent'
21959 d_getgrent_r='$d_getgrent_r'
21960 d_getgrgid_r='$d_getgrgid_r'
21961 d_getgrnam_r='$d_getgrnam_r'
21962 d_getgrps='$d_getgrps'
21963 d_gethbyaddr='$d_gethbyaddr'
21964 d_gethbyname='$d_gethbyname'
21965 d_gethent='$d_gethent'
21966 d_gethname='$d_gethname'
21967 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21968 d_gethostbyname_r='$d_gethostbyname_r'
21969 d_gethostent_r='$d_gethostent_r'
21970 d_gethostprotos='$d_gethostprotos'
21971 d_getitimer='$d_getitimer'
21972 d_getlogin='$d_getlogin'
21973 d_getlogin_r='$d_getlogin_r'
21974 d_getmnt='$d_getmnt'
21975 d_getmntent='$d_getmntent'
21976 d_getnbyaddr='$d_getnbyaddr'
21977 d_getnbyname='$d_getnbyname'
21978 d_getnent='$d_getnent'
21979 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21980 d_getnetbyname_r='$d_getnetbyname_r'
21981 d_getnetent_r='$d_getnetent_r'
21982 d_getnetprotos='$d_getnetprotos'
21983 d_getpagsz='$d_getpagsz'
21984 d_getpbyname='$d_getpbyname'
21985 d_getpbynumber='$d_getpbynumber'
21986 d_getpent='$d_getpent'
21987 d_getpgid='$d_getpgid'
21988 d_getpgrp2='$d_getpgrp2'
21989 d_getpgrp='$d_getpgrp'
21990 d_getppid='$d_getppid'
21991 d_getprior='$d_getprior'
21992 d_getprotobyname_r='$d_getprotobyname_r'
21993 d_getprotobynumber_r='$d_getprotobynumber_r'
21994 d_getprotoent_r='$d_getprotoent_r'
21995 d_getprotoprotos='$d_getprotoprotos'
21996 d_getprpwnam='$d_getprpwnam'
21997 d_getpwent='$d_getpwent'
21998 d_getpwent_r='$d_getpwent_r'
21999 d_getpwnam_r='$d_getpwnam_r'
22000 d_getpwuid_r='$d_getpwuid_r'
22001 d_getsbyname='$d_getsbyname'
22002 d_getsbyport='$d_getsbyport'
22003 d_getsent='$d_getsent'
22004 d_getservbyname_r='$d_getservbyname_r'
22005 d_getservbyport_r='$d_getservbyport_r'
22006 d_getservent_r='$d_getservent_r'
22007 d_getservprotos='$d_getservprotos'
22008 d_getspnam='$d_getspnam'
22009 d_getspnam_r='$d_getspnam_r'
22010 d_gettimeod='$d_gettimeod'
22011 d_gmtime_r='$d_gmtime_r'
22012 d_gnulibc='$d_gnulibc'
22013 d_grpasswd='$d_grpasswd'
22014 d_hasmntopt='$d_hasmntopt'
22015 d_htonl='$d_htonl'
22016 d_ilogbl='$d_ilogbl'
22017 d_inc_version_list='$d_inc_version_list'
22018 d_index='$d_index'
22019 d_inetaton='$d_inetaton'
22020 d_int64_t='$d_int64_t'
22021 d_isascii='$d_isascii'
22022 d_isfinite='$d_isfinite'
22023 d_isinf='$d_isinf'
22024 d_isnan='$d_isnan'
22025 d_isnanl='$d_isnanl'
22026 d_killpg='$d_killpg'
22027 d_lchown='$d_lchown'
22028 d_ldbl_dig='$d_ldbl_dig'
22029 d_libm_lib_version='$d_libm_lib_version'
22030 d_link='$d_link'
22031 d_localtime_r='$d_localtime_r'
22032 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
22033 d_locconv='$d_locconv'
22034 d_lockf='$d_lockf'
22035 d_longdbl='$d_longdbl'
22036 d_longlong='$d_longlong'
22037 d_lseekproto='$d_lseekproto'
22038 d_lstat='$d_lstat'
22039 d_madvise='$d_madvise'
22040 d_malloc_good_size='$d_malloc_good_size'
22041 d_malloc_size='$d_malloc_size'
22042 d_mblen='$d_mblen'
22043 d_mbstowcs='$d_mbstowcs'
22044 d_mbtowc='$d_mbtowc'
22045 d_memchr='$d_memchr'
22046 d_memcmp='$d_memcmp'
22047 d_memcpy='$d_memcpy'
22048 d_memmove='$d_memmove'
22049 d_memset='$d_memset'
22050 d_mkdir='$d_mkdir'
22051 d_mkdtemp='$d_mkdtemp'
22052 d_mkfifo='$d_mkfifo'
22053 d_mkstemp='$d_mkstemp'
22054 d_mkstemps='$d_mkstemps'
22055 d_mktime='$d_mktime'
22056 d_mmap='$d_mmap'
22057 d_modfl='$d_modfl'
22058 d_modfl_pow32_bug='$d_modfl_pow32_bug'
22059 d_modflproto='$d_modflproto'
22060 d_mprotect='$d_mprotect'
22061 d_msg='$d_msg'
22062 d_msg_ctrunc='$d_msg_ctrunc'
22063 d_msg_dontroute='$d_msg_dontroute'
22064 d_msg_oob='$d_msg_oob'
22065 d_msg_peek='$d_msg_peek'
22066 d_msg_proxy='$d_msg_proxy'
22067 d_msgctl='$d_msgctl'
22068 d_msgget='$d_msgget'
22069 d_msghdr_s='$d_msghdr_s'
22070 d_msgrcv='$d_msgrcv'
22071 d_msgsnd='$d_msgsnd'
22072 d_msync='$d_msync'
22073 d_munmap='$d_munmap'
22074 d_mymalloc='$d_mymalloc'
22075 d_ndbm='$d_ndbm'
22076 d_nice='$d_nice'
22077 d_nl_langinfo='$d_nl_langinfo'
22078 d_nv_preserves_uv='$d_nv_preserves_uv'
22079 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
22080 d_off64_t='$d_off64_t'
22081 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
22082 d_oldpthreads='$d_oldpthreads'
22083 d_oldsock='$d_oldsock'
22084 d_open3='$d_open3'
22085 d_pathconf='$d_pathconf'
22086 d_pause='$d_pause'
22087 d_perl_otherlibdirs='$d_perl_otherlibdirs'
22088 d_phostname='$d_phostname'
22089 d_pipe='$d_pipe'
22090 d_poll='$d_poll'
22091 d_portable='$d_portable'
22092 d_printf_format_null='$d_printf_format_null'
22093 d_procselfexe='$d_procselfexe'
22094 d_pseudofork='$d_pseudofork'
22095 d_pthread_atfork='$d_pthread_atfork'
22096 d_pthread_attr_setscope='$d_pthread_attr_setscope'
22097 d_pthread_yield='$d_pthread_yield'
22098 d_pwage='$d_pwage'
22099 d_pwchange='$d_pwchange'
22100 d_pwclass='$d_pwclass'
22101 d_pwcomment='$d_pwcomment'
22102 d_pwexpire='$d_pwexpire'
22103 d_pwgecos='$d_pwgecos'
22104 d_pwpasswd='$d_pwpasswd'
22105 d_pwquota='$d_pwquota'
22106 d_qgcvt='$d_qgcvt'
22107 d_quad='$d_quad'
22108 d_random_r='$d_random_r'
22109 d_readdir64_r='$d_readdir64_r'
22110 d_readdir='$d_readdir'
22111 d_readdir_r='$d_readdir_r'
22112 d_readlink='$d_readlink'
22113 d_readv='$d_readv'
22114 d_recvmsg='$d_recvmsg'
22115 d_rename='$d_rename'
22116 d_rewinddir='$d_rewinddir'
22117 d_rmdir='$d_rmdir'
22118 d_safebcpy='$d_safebcpy'
22119 d_safemcpy='$d_safemcpy'
22120 d_sanemcmp='$d_sanemcmp'
22121 d_sbrkproto='$d_sbrkproto'
22122 d_scalbnl='$d_scalbnl'
22123 d_sched_yield='$d_sched_yield'
22124 d_scm_rights='$d_scm_rights'
22125 d_seekdir='$d_seekdir'
22126 d_select='$d_select'
22127 d_sem='$d_sem'
22128 d_semctl='$d_semctl'
22129 d_semctl_semid_ds='$d_semctl_semid_ds'
22130 d_semctl_semun='$d_semctl_semun'
22131 d_semget='$d_semget'
22132 d_semop='$d_semop'
22133 d_sendmsg='$d_sendmsg'
22134 d_setegid='$d_setegid'
22135 d_seteuid='$d_seteuid'
22136 d_setgrent='$d_setgrent'
22137 d_setgrent_r='$d_setgrent_r'
22138 d_setgrps='$d_setgrps'
22139 d_sethent='$d_sethent'
22140 d_sethostent_r='$d_sethostent_r'
22141 d_setitimer='$d_setitimer'
22142 d_setlinebuf='$d_setlinebuf'
22143 d_setlocale='$d_setlocale'
22144 d_setlocale_r='$d_setlocale_r'
22145 d_setnent='$d_setnent'
22146 d_setnetent_r='$d_setnetent_r'
22147 d_setpent='$d_setpent'
22148 d_setpgid='$d_setpgid'
22149 d_setpgrp2='$d_setpgrp2'
22150 d_setpgrp='$d_setpgrp'
22151 d_setprior='$d_setprior'
22152 d_setproctitle='$d_setproctitle'
22153 d_setprotoent_r='$d_setprotoent_r'
22154 d_setpwent='$d_setpwent'
22155 d_setpwent_r='$d_setpwent_r'
22156 d_setregid='$d_setregid'
22157 d_setresgid='$d_setresgid'
22158 d_setresuid='$d_setresuid'
22159 d_setreuid='$d_setreuid'
22160 d_setrgid='$d_setrgid'
22161 d_setruid='$d_setruid'
22162 d_setsent='$d_setsent'
22163 d_setservent_r='$d_setservent_r'
22164 d_setsid='$d_setsid'
22165 d_setvbuf='$d_setvbuf'
22166 d_sfio='$d_sfio'
22167 d_shm='$d_shm'
22168 d_shmat='$d_shmat'
22169 d_shmatprototype='$d_shmatprototype'
22170 d_shmctl='$d_shmctl'
22171 d_shmdt='$d_shmdt'
22172 d_shmget='$d_shmget'
22173 d_sigaction='$d_sigaction'
22174 d_signbit='$d_signbit'
22175 d_sigprocmask='$d_sigprocmask'
22176 d_sigsetjmp='$d_sigsetjmp'
22177 d_sitearch='$d_sitearch'
22178 d_snprintf='$d_snprintf'
22179 d_sockatmark='$d_sockatmark'
22180 d_sockatmarkproto='$d_sockatmarkproto'
22181 d_socket='$d_socket'
22182 d_socklen_t='$d_socklen_t'
22183 d_sockpair='$d_sockpair'
22184 d_socks5_init='$d_socks5_init'
22185 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
22186 d_sqrtl='$d_sqrtl'
22187 d_srand48_r='$d_srand48_r'
22188 d_srandom_r='$d_srandom_r'
22189 d_sresgproto='$d_sresgproto'
22190 d_sresuproto='$d_sresuproto'
22191 d_statblks='$d_statblks'
22192 d_statfs_f_flags='$d_statfs_f_flags'
22193 d_statfs_s='$d_statfs_s'
22194 d_statvfs='$d_statvfs'
22195 d_stdio_cnt_lval='$d_stdio_cnt_lval'
22196 d_stdio_ptr_lval='$d_stdio_ptr_lval'
22197 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
22198 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
22199 d_stdio_stream_array='$d_stdio_stream_array'
22200 d_stdiobase='$d_stdiobase'
22201 d_stdstdio='$d_stdstdio'
22202 d_strchr='$d_strchr'
22203 d_strcoll='$d_strcoll'
22204 d_strctcpy='$d_strctcpy'
22205 d_strerrm='$d_strerrm'
22206 d_strerror='$d_strerror'
22207 d_strerror_r='$d_strerror_r'
22208 d_strftime='$d_strftime'
22209 d_strlcat='$d_strlcat'
22210 d_strlcpy='$d_strlcpy'
22211 d_strtod='$d_strtod'
22212 d_strtol='$d_strtol'
22213 d_strtold='$d_strtold'
22214 d_strtoll='$d_strtoll'
22215 d_strtoq='$d_strtoq'
22216 d_strtoul='$d_strtoul'
22217 d_strtoull='$d_strtoull'
22218 d_strtouq='$d_strtouq'
22219 d_strxfrm='$d_strxfrm'
22220 d_suidsafe='$d_suidsafe'
22221 d_symlink='$d_symlink'
22222 d_syscall='$d_syscall'
22223 d_syscallproto='$d_syscallproto'
22224 d_sysconf='$d_sysconf'
22225 d_sysernlst='$d_sysernlst'
22226 d_syserrlst='$d_syserrlst'
22227 d_system='$d_system'
22228 d_tcgetpgrp='$d_tcgetpgrp'
22229 d_tcsetpgrp='$d_tcsetpgrp'
22230 d_telldir='$d_telldir'
22231 d_telldirproto='$d_telldirproto'
22232 d_time='$d_time'
22233 d_times='$d_times'
22234 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
22235 d_tm_tm_zone='$d_tm_tm_zone'
22236 d_tmpnam_r='$d_tmpnam_r'
22237 d_truncate='$d_truncate'
22238 d_ttyname_r='$d_ttyname_r'
22239 d_tzname='$d_tzname'
22240 d_u32align='$d_u32align'
22241 d_ualarm='$d_ualarm'
22242 d_umask='$d_umask'
22243 d_uname='$d_uname'
22244 d_union_semun='$d_union_semun'
22245 d_unordered='$d_unordered'
22246 d_unsetenv='$d_unsetenv'
22247 d_usleep='$d_usleep'
22248 d_usleepproto='$d_usleepproto'
22249 d_ustat='$d_ustat'
22250 d_vendorarch='$d_vendorarch'
22251 d_vendorbin='$d_vendorbin'
22252 d_vendorlib='$d_vendorlib'
22253 d_vendorscript='$d_vendorscript'
22254 d_vfork='$d_vfork'
22255 d_void_closedir='$d_void_closedir'
22256 d_voidsig='$d_voidsig'
22257 d_voidtty='$d_voidtty'
22258 d_volatile='$d_volatile'
22259 d_vprintf='$d_vprintf'
22260 d_vsnprintf='$d_vsnprintf'
22261 d_wait4='$d_wait4'
22262 d_waitpid='$d_waitpid'
22263 d_wcstombs='$d_wcstombs'
22264 d_wctomb='$d_wctomb'
22265 d_writev='$d_writev'
22266 d_xenix='$d_xenix'
22267 date='$date'
22268 db_hashtype='$db_hashtype'
22269 db_prefixtype='$db_prefixtype'
22270 db_version_major='$db_version_major'
22271 db_version_minor='$db_version_minor'
22272 db_version_patch='$db_version_patch'
22273 defvoidused='$defvoidused'
22274 direntrytype='$direntrytype'
22275 dlext='$dlext'
22276 dlsrc='$dlsrc'
22277 doublesize='$doublesize'
22278 drand01='$drand01'
22279 drand48_r_proto='$drand48_r_proto'
22280 dtrace='$dtrace'
22281 dynamic_ext='$dynamic_ext'
22282 eagain='$eagain'
22283 ebcdic='$ebcdic'
22284 echo='$echo'
22285 egrep='$egrep'
22286 emacs='$emacs'
22287 endgrent_r_proto='$endgrent_r_proto'
22288 endhostent_r_proto='$endhostent_r_proto'
22289 endnetent_r_proto='$endnetent_r_proto'
22290 endprotoent_r_proto='$endprotoent_r_proto'
22291 endpwent_r_proto='$endpwent_r_proto'
22292 endservent_r_proto='$endservent_r_proto'
22293 eunicefix='$eunicefix'
22294 exe_ext='$exe_ext'
22295 expr='$expr'
22296 extensions='$extensions'
22297 extras='$extras'
22298 fflushNULL='$fflushNULL'
22299 fflushall='$fflushall'
22300 find='$find'
22301 firstmakefile='$firstmakefile'
22302 flex='$flex'
22303 fpossize='$fpossize'
22304 fpostype='$fpostype'
22305 freetype='$freetype'
22306 from='$from'
22307 full_ar='$full_ar'
22308 full_csh='$full_csh'
22309 full_sed='$full_sed'
22310 gccansipedantic='$gccansipedantic'
22311 gccosandvers='$gccosandvers'
22312 gccversion='$gccversion'
22313 getgrent_r_proto='$getgrent_r_proto'
22314 getgrgid_r_proto='$getgrgid_r_proto'
22315 getgrnam_r_proto='$getgrnam_r_proto'
22316 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22317 gethostbyname_r_proto='$gethostbyname_r_proto'
22318 gethostent_r_proto='$gethostent_r_proto'
22319 getlogin_r_proto='$getlogin_r_proto'
22320 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22321 getnetbyname_r_proto='$getnetbyname_r_proto'
22322 getnetent_r_proto='$getnetent_r_proto'
22323 getprotobyname_r_proto='$getprotobyname_r_proto'
22324 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22325 getprotoent_r_proto='$getprotoent_r_proto'
22326 getpwent_r_proto='$getpwent_r_proto'
22327 getpwnam_r_proto='$getpwnam_r_proto'
22328 getpwuid_r_proto='$getpwuid_r_proto'
22329 getservbyname_r_proto='$getservbyname_r_proto'
22330 getservbyport_r_proto='$getservbyport_r_proto'
22331 getservent_r_proto='$getservent_r_proto'
22332 getspnam_r_proto='$getspnam_r_proto'
22333 gidformat='$gidformat'
22334 gidsign='$gidsign'
22335 gidsize='$gidsize'
22336 gidtype='$gidtype'
22337 glibpth='$glibpth'
22338 gmake='$gmake'
22339 gmtime_r_proto='$gmtime_r_proto'
22340 gnulibc_version='$gnulibc_version'
22341 grep='$grep'
22342 groupcat='$groupcat'
22343 groupstype='$groupstype'
22344 gzip='$gzip'
22345 h_fcntl='$h_fcntl'
22346 h_sysfile='$h_sysfile'
22347 hint='$hint'
22348 hostcat='$hostcat'
22349 html1dir='$html1dir'
22350 html1direxp='$html1direxp'
22351 html3dir='$html3dir'
22352 html3direxp='$html3direxp'
22353 i16size='$i16size'
22354 i16type='$i16type'
22355 i32size='$i32size'
22356 i32type='$i32type'
22357 i64size='$i64size'
22358 i64type='$i64type'
22359 i8size='$i8size'
22360 i8type='$i8type'
22361 i_arpainet='$i_arpainet'
22362 i_assert='$i_assert'
22363 i_bsdioctl='$i_bsdioctl'
22364 i_crypt='$i_crypt'
22365 i_db='$i_db'
22366 i_dbm='$i_dbm'
22367 i_dirent='$i_dirent'
22368 i_dld='$i_dld'
22369 i_dlfcn='$i_dlfcn'
22370 i_fcntl='$i_fcntl'
22371 i_float='$i_float'
22372 i_fp='$i_fp'
22373 i_fp_class='$i_fp_class'
22374 i_gdbm='$i_gdbm'
22375 i_gdbm_ndbm='$i_gdbm_ndbm'
22376 i_gdbmndbm='$i_gdbmndbm'
22377 i_grp='$i_grp'
22378 i_ieeefp='$i_ieeefp'
22379 i_inttypes='$i_inttypes'
22380 i_langinfo='$i_langinfo'
22381 i_libutil='$i_libutil'
22382 i_limits='$i_limits'
22383 i_locale='$i_locale'
22384 i_machcthr='$i_machcthr'
22385 i_malloc='$i_malloc'
22386 i_mallocmalloc='$i_mallocmalloc'
22387 i_math='$i_math'
22388 i_memory='$i_memory'
22389 i_mntent='$i_mntent'
22390 i_ndbm='$i_ndbm'
22391 i_netdb='$i_netdb'
22392 i_neterrno='$i_neterrno'
22393 i_netinettcp='$i_netinettcp'
22394 i_niin='$i_niin'
22395 i_poll='$i_poll'
22396 i_prot='$i_prot'
22397 i_pthread='$i_pthread'
22398 i_pwd='$i_pwd'
22399 i_rpcsvcdbm='$i_rpcsvcdbm'
22400 i_sfio='$i_sfio'
22401 i_sgtty='$i_sgtty'
22402 i_shadow='$i_shadow'
22403 i_socks='$i_socks'
22404 i_stdarg='$i_stdarg'
22405 i_stddef='$i_stddef'
22406 i_stdlib='$i_stdlib'
22407 i_string='$i_string'
22408 i_sunmath='$i_sunmath'
22409 i_sysaccess='$i_sysaccess'
22410 i_sysdir='$i_sysdir'
22411 i_sysfile='$i_sysfile'
22412 i_sysfilio='$i_sysfilio'
22413 i_sysin='$i_sysin'
22414 i_sysioctl='$i_sysioctl'
22415 i_syslog='$i_syslog'
22416 i_sysmman='$i_sysmman'
22417 i_sysmode='$i_sysmode'
22418 i_sysmount='$i_sysmount'
22419 i_sysndir='$i_sysndir'
22420 i_sysparam='$i_sysparam'
22421 i_syspoll='$i_syspoll'
22422 i_sysresrc='$i_sysresrc'
22423 i_syssecrt='$i_syssecrt'
22424 i_sysselct='$i_sysselct'
22425 i_syssockio='$i_syssockio'
22426 i_sysstat='$i_sysstat'
22427 i_sysstatfs='$i_sysstatfs'
22428 i_sysstatvfs='$i_sysstatvfs'
22429 i_systime='$i_systime'
22430 i_systimek='$i_systimek'
22431 i_systimes='$i_systimes'
22432 i_systypes='$i_systypes'
22433 i_sysuio='$i_sysuio'
22434 i_sysun='$i_sysun'
22435 i_sysutsname='$i_sysutsname'
22436 i_sysvfs='$i_sysvfs'
22437 i_syswait='$i_syswait'
22438 i_termio='$i_termio'
22439 i_termios='$i_termios'
22440 i_time='$i_time'
22441 i_unistd='$i_unistd'
22442 i_ustat='$i_ustat'
22443 i_utime='$i_utime'
22444 i_values='$i_values'
22445 i_varargs='$i_varargs'
22446 i_varhdr='$i_varhdr'
22447 i_vfork='$i_vfork'
22448 ignore_versioned_solibs='$ignore_versioned_solibs'
22449 inc_version_list='$inc_version_list'
22450 inc_version_list_init='$inc_version_list_init'
22451 incpath='$incpath'
22452 inews='$inews'
22453 initialinstalllocation='$initialinstalllocation'
22454 installarchlib='$installarchlib'
22455 installbin='$installbin'
22456 installhtml1dir='$installhtml1dir'
22457 installhtml3dir='$installhtml3dir'
22458 installman1dir='$installman1dir'
22459 installman3dir='$installman3dir'
22460 installprefix='$installprefix'
22461 installprefixexp='$installprefixexp'
22462 installprivlib='$installprivlib'
22463 installscript='$installscript'
22464 installsitearch='$installsitearch'
22465 installsitebin='$installsitebin'
22466 installsitehtml1dir='$installsitehtml1dir'
22467 installsitehtml3dir='$installsitehtml3dir'
22468 installsitelib='$installsitelib'
22469 installsiteman1dir='$installsiteman1dir'
22470 installsiteman3dir='$installsiteman3dir'
22471 installsitescript='$installsitescript'
22472 installstyle='$installstyle'
22473 installusrbinperl='$installusrbinperl'
22474 installvendorarch='$installvendorarch'
22475 installvendorbin='$installvendorbin'
22476 installvendorhtml1dir='$installvendorhtml1dir'
22477 installvendorhtml3dir='$installvendorhtml3dir'
22478 installvendorlib='$installvendorlib'
22479 installvendorman1dir='$installvendorman1dir'
22480 installvendorman3dir='$installvendorman3dir'
22481 installvendorscript='$installvendorscript'
22482 intsize='$intsize'
22483 issymlink='$issymlink'
22484 ivdformat='$ivdformat'
22485 ivsize='$ivsize'
22486 ivtype='$ivtype'
22487 known_extensions='$known_extensions'
22488 ksh='$ksh'
22489 ld='$ld'
22490 lddlflags='$lddlflags'
22491 ldflags='$ldflags'
22492 ldflags_uselargefiles='$ldflags_uselargefiles'
22493 ldlibpthname='$ldlibpthname'
22494 less='$less'
22495 lib_ext='$lib_ext'
22496 libc='$libc'
22497 libperl='$libperl'
22498 libpth='$libpth'
22499 libs='$libs'
22500 libsdirs='$libsdirs'
22501 libsfiles='$libsfiles'
22502 libsfound='$libsfound'
22503 libspath='$libspath'
22504 libswanted='$libswanted'
22505 libswanted_uselargefiles='$libswanted_uselargefiles'
22506 line='$line'
22507 lint='$lint'
22508 lkflags='$lkflags'
22509 ln='$ln'
22510 lns='$lns'
22511 localtime_r_proto='$localtime_r_proto'
22512 locincpth='$locincpth'
22513 loclibpth='$loclibpth'
22514 longdblsize='$longdblsize'
22515 longlongsize='$longlongsize'
22516 longsize='$longsize'
22517 lp='$lp'
22518 lpr='$lpr'
22519 ls='$ls'
22520 lseeksize='$lseeksize'
22521 lseektype='$lseektype'
22522 mad='$mad'
22523 madlyh='$madlyh'
22524 madlyobj='$madlyobj'
22525 madlysrc='$madlysrc'
22526 mail='$mail'
22527 mailx='$mailx'
22528 make='$make'
22529 make_set_make='$make_set_make'
22530 mallocobj='$mallocobj'
22531 mallocsrc='$mallocsrc'
22532 malloctype='$malloctype'
22533 man1dir='$man1dir'
22534 man1direxp='$man1direxp'
22535 man1ext='$man1ext'
22536 man3dir='$man3dir'
22537 man3direxp='$man3direxp'
22538 man3ext='$man3ext'
22539 mips_type='$mips_type'
22540 mistrustnm='$mistrustnm'
22541 mkdir='$mkdir'
22542 mmaptype='$mmaptype'
22543 modetype='$modetype'
22544 more='$more'
22545 multiarch='$multiarch'
22546 mv='$mv'
22547 myarchname='$myarchname'
22548 mydomain='$mydomain'
22549 myhostname='$myhostname'
22550 myuname='$myuname'
22551 n='$n'
22552 need_va_copy='$need_va_copy'
22553 netdb_hlen_type='$netdb_hlen_type'
22554 netdb_host_type='$netdb_host_type'
22555 netdb_name_type='$netdb_name_type'
22556 netdb_net_type='$netdb_net_type'
22557 nm='$nm'
22558 nm_opt='$nm_opt'
22559 nm_so_opt='$nm_so_opt'
22560 nonxs_ext='$nonxs_ext'
22561 nroff='$nroff'
22562 nvEUformat='$nvEUformat'
22563 nvFUformat='$nvFUformat'
22564 nvGUformat='$nvGUformat'
22565 nv_overflows_integers_at='$nv_overflows_integers_at'
22566 nv_preserves_uv_bits='$nv_preserves_uv_bits'
22567 nveformat='$nveformat'
22568 nvfformat='$nvfformat'
22569 nvgformat='$nvgformat'
22570 nvsize='$nvsize'
22571 nvtype='$nvtype'
22572 o_nonblock='$o_nonblock'
22573 obj_ext='$obj_ext'
22574 old_pthread_create_joinable='$old_pthread_create_joinable'
22575 optimize='$optimize'
22576 orderlib='$orderlib'
22577 osname='$osname'
22578 osvers='$osvers'
22579 otherlibdirs='$otherlibdirs'
22580 package='$package'
22581 pager='$pager'
22582 passcat='$passcat'
22583 patchlevel='$patchlevel'
22584 path_sep='$path_sep'
22585 perl5='$perl5'
22586 perl='$perl'
22587 perl_patchlevel='$perl_patchlevel'
22588 perladmin='$perladmin'
22589 perllibs='$perllibs'
22590 perlpath='$perlpath'
22591 pg='$pg'
22592 phostname='$phostname'
22593 pidtype='$pidtype'
22594 plibpth='$plibpth'
22595 pmake='$pmake'
22596 pr='$pr'
22597 prefix='$prefix'
22598 prefixexp='$prefixexp'
22599 privlib='$privlib'
22600 privlibexp='$privlibexp'
22601 procselfexe='$procselfexe'
22602 prototype='$prototype'
22603 ptrsize='$ptrsize'
22604 quadkind='$quadkind'
22605 quadtype='$quadtype'
22606 randbits='$randbits'
22607 randfunc='$randfunc'
22608 random_r_proto='$random_r_proto'
22609 randseedtype='$randseedtype'
22610 ranlib='$ranlib'
22611 rd_nodata='$rd_nodata'
22612 readdir64_r_proto='$readdir64_r_proto'
22613 readdir_r_proto='$readdir_r_proto'
22614 revision='$revision'
22615 rm='$rm'
22616 rm_try='$rm_try'
22617 rmail='$rmail'
22618 run='$run'
22619 runnm='$runnm'
22620 sPRIEUldbl='$sPRIEUldbl'
22621 sPRIFUldbl='$sPRIFUldbl'
22622 sPRIGUldbl='$sPRIGUldbl'
22623 sPRIXU64='$sPRIXU64'
22624 sPRId64='$sPRId64'
22625 sPRIeldbl='$sPRIeldbl'
22626 sPRIfldbl='$sPRIfldbl'
22627 sPRIgldbl='$sPRIgldbl'
22628 sPRIi64='$sPRIi64'
22629 sPRIo64='$sPRIo64'
22630 sPRIu64='$sPRIu64'
22631 sPRIx64='$sPRIx64'
22632 sSCNfldbl='$sSCNfldbl'
22633 sched_yield='$sched_yield'
22634 scriptdir='$scriptdir'
22635 scriptdirexp='$scriptdirexp'
22636 sed='$sed'
22637 seedfunc='$seedfunc'
22638 selectminbits='$selectminbits'
22639 selecttype='$selecttype'
22640 sendmail='$sendmail'
22641 setgrent_r_proto='$setgrent_r_proto'
22642 sethostent_r_proto='$sethostent_r_proto'
22643 setlocale_r_proto='$setlocale_r_proto'
22644 setnetent_r_proto='$setnetent_r_proto'
22645 setprotoent_r_proto='$setprotoent_r_proto'
22646 setpwent_r_proto='$setpwent_r_proto'
22647 setservent_r_proto='$setservent_r_proto'
22648 sh='$sh'
22649 shar='$shar'
22650 sharpbang='$sharpbang'
22651 shmattype='$shmattype'
22652 shortsize='$shortsize'
22653 shrpenv='$shrpenv'
22654 shsharp='$shsharp'
22655 sig_count='$sig_count'
22656 sig_name='$sig_name'
22657 sig_name_init='$sig_name_init'
22658 sig_num='$sig_num'
22659 sig_num_init='$sig_num_init'
22660 sig_size='$sig_size'
22661 signal_t='$signal_t'
22662 sitearch='$sitearch'
22663 sitearchexp='$sitearchexp'
22664 sitebin='$sitebin'
22665 sitebinexp='$sitebinexp'
22666 sitehtml1dir='$sitehtml1dir'
22667 sitehtml1direxp='$sitehtml1direxp'
22668 sitehtml3dir='$sitehtml3dir'
22669 sitehtml3direxp='$sitehtml3direxp'
22670 sitelib='$sitelib'
22671 sitelib_stem='$sitelib_stem'
22672 sitelibexp='$sitelibexp'
22673 siteman1dir='$siteman1dir'
22674 siteman1direxp='$siteman1direxp'
22675 siteman3dir='$siteman3dir'
22676 siteman3direxp='$siteman3direxp'
22677 siteprefix='$siteprefix'
22678 siteprefixexp='$siteprefixexp'
22679 sitescript='$sitescript'
22680 sitescriptexp='$sitescriptexp'
22681 sizesize='$sizesize'
22682 sizetype='$sizetype'
22683 sleep='$sleep'
22684 smail='$smail'
22685 so='$so'
22686 sockethdr='$sockethdr'
22687 socketlib='$socketlib'
22688 socksizetype='$socksizetype'
22689 sort='$sort'
22690 spackage='$spackage'
22691 spitshell='$spitshell'
22692 srand48_r_proto='$srand48_r_proto'
22693 srandom_r_proto='$srandom_r_proto'
22694 src='$src'
22695 ssizetype='$ssizetype'
22696 startperl='$startperl'
22697 startsh='$startsh'
22698 static_ext='$static_ext'
22699 stdchar='$stdchar'
22700 stdio_base='$stdio_base'
22701 stdio_bufsiz='$stdio_bufsiz'
22702 stdio_cnt='$stdio_cnt'
22703 stdio_filbuf='$stdio_filbuf'
22704 stdio_ptr='$stdio_ptr'
22705 stdio_stream_array='$stdio_stream_array'
22706 strerror_r_proto='$strerror_r_proto'
22707 strings='$strings'
22708 submit='$submit'
22709 subversion='$subversion'
22710 sysman='$sysman'
22711 tail='$tail'
22712 tar='$tar'
22713 targetarch='$targetarch'
22714 tbl='$tbl'
22715 tee='$tee'
22716 test='$test'
22717 timeincl='$timeincl'
22718 timetype='$timetype'
22719 tmpnam_r_proto='$tmpnam_r_proto'
22720 to='$to'
22721 touch='$touch'
22722 tr='$tr'
22723 trnl='$trnl'
22724 troff='$troff'
22725 ttyname_r_proto='$ttyname_r_proto'
22726 u16size='$u16size'
22727 u16type='$u16type'
22728 u32size='$u32size'
22729 u32type='$u32type'
22730 u64size='$u64size'
22731 u64type='$u64type'
22732 u8size='$u8size'
22733 u8type='$u8type'
22734 uidformat='$uidformat'
22735 uidsign='$uidsign'
22736 uidsize='$uidsize'
22737 uidtype='$uidtype'
22738 uname='$uname'
22739 uniq='$uniq'
22740 uquadtype='$uquadtype'
22741 use5005threads='$use5005threads'
22742 use64bitall='$use64bitall'
22743 use64bitint='$use64bitint'
22744 usecrosscompile='$usecrosscompile'
22745 usedl='$usedl'
22746 usedtrace='$usedtrace'
22747 usefaststdio='$usefaststdio'
22748 useithreads='$useithreads'
22749 uselargefiles='$uselargefiles'
22750 uselongdouble='$uselongdouble'
22751 usemallocwrap='$usemallocwrap'
22752 usemorebits='$usemorebits'
22753 usemultiplicity='$usemultiplicity'
22754 usemymalloc='$usemymalloc'
22755 usenm='$usenm'
22756 useopcode='$useopcode'
22757 useperlio='$useperlio'
22758 useposix='$useposix'
22759 usereentrant='$usereentrant'
22760 userelocatableinc='$userelocatableinc'
22761 usesfio='$usesfio'
22762 useshrplib='$useshrplib'
22763 usesitecustomize='$usesitecustomize'
22764 usesocks='$usesocks'
22765 usethreads='$usethreads'
22766 usevendorprefix='$usevendorprefix'
22767 usevfork='$usevfork'
22768 usrinc='$usrinc'
22769 uuname='$uuname'
22770 uvXUformat='$uvXUformat'
22771 uvoformat='$uvoformat'
22772 uvsize='$uvsize'
22773 uvtype='$uvtype'
22774 uvuformat='$uvuformat'
22775 uvxformat='$uvxformat'
22776 vendorarch='$vendorarch'
22777 vendorarchexp='$vendorarchexp'
22778 vendorbin='$vendorbin'
22779 vendorbinexp='$vendorbinexp'
22780 vendorhtml1dir='$vendorhtml1dir'
22781 vendorhtml1direxp='$vendorhtml1direxp'
22782 vendorhtml3dir='$vendorhtml3dir'
22783 vendorhtml3direxp='$vendorhtml3direxp'
22784 vendorlib='$vendorlib'
22785 vendorlib_stem='$vendorlib_stem'
22786 vendorlibexp='$vendorlibexp'
22787 vendorman1dir='$vendorman1dir'
22788 vendorman1direxp='$vendorman1direxp'
22789 vendorman3dir='$vendorman3dir'
22790 vendorman3direxp='$vendorman3direxp'
22791 vendorprefix='$vendorprefix'
22792 vendorprefixexp='$vendorprefixexp'
22793 vendorscript='$vendorscript'
22794 vendorscriptexp='$vendorscriptexp'
22795 version='$version'
22796 version_patchlevel_string='$version_patchlevel_string'
22797 versiononly='$versiononly'
22798 vi='$vi'
22799 voidflags='$voidflags'
22800 xlibpth='$xlibpth'
22801 yacc='$yacc'
22802 yaccflags='$yaccflags'
22803 zcat='$zcat'
22804 zip='$zip'
22805 EOT
22806
22807 : Add in command line options if available
22808 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22809
22810 : add special variables
22811 $test -f $src/patchlevel.h && \
22812 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22813 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22814 echo "PERL_CONFIG_SH=true" >>config.sh
22815
22816 : propagate old symbols
22817 if $test -f UU/config.sh; then
22818         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22819         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
22820                 config.sh config.sh UU/oldconfig.sh |\
22821                 $sort | $uniq -u >UU/oldsyms
22822         set X `cat UU/oldsyms`
22823         shift
22824         case $# in
22825         0) ;;
22826         *)
22827                 cat <<EOM
22828 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22829 EOM
22830                 echo ": Variables propagated from previous config.sh file." >>config.sh
22831                 for sym in `cat UU/oldsyms`; do
22832                         echo "    Propagating $hint variable "'$'"$sym..."
22833                         eval 'tmp="$'"${sym}"'"'
22834                         echo "$tmp" | \
22835                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22836                 done
22837                 ;;
22838         esac
22839 fi
22840
22841 : Finish up by extracting the .SH files
22842 case "$alldone" in
22843 exit)
22844         $rm -rf UU
22845         echo "Extraction done."
22846         exit 0
22847         ;;
22848 cont)
22849         ;;
22850 '')
22851         dflt=''
22852         nostick=true
22853         $cat <<EOM
22854
22855 If you'd like to make any changes to the config.sh file before I begin
22856 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22857
22858 EOM
22859         rp="Press return or use a shell escape to edit config.sh:"
22860         . UU/myread
22861         nostick=''
22862         case "$ans" in
22863         '') ;;
22864         *) : in case they cannot read
22865                 sh 1>&4 -c "$ans";;
22866         esac
22867         ;;
22868 esac
22869
22870 : if this fails, just run all the .SH files by hand
22871 . ./config.sh
22872
22873 echo " "
22874 exec 1>&4
22875 pwd=`pwd`
22876 . ./UU/extract
22877 cd "$pwd"
22878
22879 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22880         dflt=y
22881         case "$silent" in
22882         true) ;;
22883         *)
22884                 $cat <<EOM
22885
22886 Now you need to generate make dependencies by running "$make depend".
22887 You might prefer to run it in background: "$make depend > makedepend.out &"
22888 It can take a while, so you might not want to run it right now.
22889
22890 EOM
22891                 ;;
22892         esac
22893         rp="Run $make depend now?"
22894         . UU/myread
22895         case "$ans" in
22896         y*)
22897                 $make depend && echo "Now you must run '$make'."
22898                 ;;
22899         *)
22900                 echo "You must run '$make depend' then '$make'."
22901                 ;;
22902         esac
22903 elif test -f [Mm]akefile; then
22904         echo " "
22905         echo "Now you must run a $make."
22906 else
22907         echo "Configure done."
22908 fi
22909
22910 if $test -f Policy.sh; then
22911     $cat <<EOM
22912
22913 If you compile $package on a different machine or from a different object
22914 directory, copy the Policy.sh file from this object directory to the
22915 new one before you run Configure -- this will help you with most of
22916 the policy defaults.
22917
22918 EOM
22919 fi
22920 if $test -f config.msg; then
22921     echo "Hmm.  I also noted the following information while running:"
22922     echo " "
22923     $cat config.msg >&4
22924     $rm -f config.msg
22925 fi
22926 $rm -f kit*isdone ark*isdone
22927 $rm -rf UU
22928
22929 : End of Configure
22930