Make lib/open.t under -Duseperlio
[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 Tue May 27 17:17:47 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         ;;
5265 *) dflt="$ldflags";;
5266 esac
5267 # See note above about -fstack-protector
5268 case "$ccflags" in
5269 *-fstack-protector*) 
5270         case "$dflt" in
5271         *-fstack-protector*) ;; # Don't add it again
5272         *) dflt="$dflt -fstack-protector" ;; 
5273         esac
5274         ;;
5275 esac
5276
5277 : Try to guess additional flags to pick up local libraries.
5278 for thislibdir in $libpth; do
5279         case " $loclibpth " in
5280         *" $thislibdir "*)
5281                 case "$dflt " in
5282                 *"-L$thislibdir "*) ;;
5283                 *)  dflt="$dflt -L$thislibdir" ;;
5284                 esac
5285                 ;;
5286         esac
5287 done
5288
5289 case "$dflt" in
5290 '') dflt='none' ;;
5291 esac
5292
5293 $cat <<EOH
5294
5295 Your C linker may need flags.  For this question you should
5296 include -L/whatever and any other flags used by the C linker, but you
5297 should NOT include libraries like -lwhatever.
5298
5299 Make sure you include the appropriate -L/path flags if your C linker
5300 does not normally search all of the directories you specified above,
5301 namely
5302         $libpth
5303 To use no flags, specify the word "none".
5304
5305 EOH
5306
5307 rp="Any additional ld flags (NOT including libraries)?"
5308 . ./myread
5309 case "$ans" in
5310 none) ldflags='';;
5311 *) ldflags="$ans";;
5312 esac
5313 rmlist="$rmlist pdp11"
5314
5315 : coherency check
5316 echo " "
5317 echo "Checking your choice of C compiler and flags for coherency..." >&4
5318 $cat > try.c <<'EOF'
5319 #include <stdio.h>
5320 int main() { printf("Ok\n"); return(0); }
5321 EOF
5322 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5323 shift
5324 $cat >try.msg <<'EOM'
5325 I've tried to compile and run the following simple program:
5326
5327 EOM
5328 $cat try.c >> try.msg
5329
5330 $cat >> try.msg <<EOM
5331
5332 I used the command:
5333
5334         $*
5335         $run ./try
5336
5337 and I got the following output:
5338
5339 EOM
5340 dflt=y
5341 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5342         if $sh -c "$run ./try " >>try.msg 2>&1; then
5343                 xxx=`$run ./try`
5344                 case "$xxx" in
5345                 "Ok") dflt=n ;;
5346                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5347                         case " $libs " in
5348                         *" -lsfio "*)
5349                                 cat >> try.msg <<'EOQS'
5350 If $libs contains -lsfio, and sfio is mis-configured, then it
5351 sometimes (apparently) runs and exits with a 0 status, but with no
5352 output!  It may have to do with sfio's use of _exit vs. exit.
5353
5354 EOQS
5355                                 rp="You have a big problem.  Shall I abort Configure"
5356                                 dflt=y
5357                                 ;;
5358                         esac
5359                         ;;
5360                 esac
5361         else
5362                 echo "The program compiled OK, but exited with status $?." >>try.msg
5363                 rp="You have a problem.  Shall I abort Configure"
5364                 dflt=y
5365         fi
5366 else
5367         echo "I can't compile the test program." >>try.msg
5368         rp="You have a BIG problem.  Shall I abort Configure"
5369         dflt=y
5370 fi
5371 case "$dflt" in
5372 y)
5373         $cat try.msg >&4
5374         case "$knowitall" in
5375         '')
5376                 echo "(The supplied flags or libraries might be incorrect.)"
5377                 ;;
5378         *) dflt=n;;
5379         esac
5380         echo " "
5381         . ./myread
5382         case "$ans" in
5383         n*|N*) ;;
5384         *)      echo "Ok.  Stopping Configure." >&4
5385                 exit 1
5386                 ;;
5387         esac
5388         ;;
5389 n) echo "OK, that should do.";;
5390 esac
5391 $rm_try gcctest gcctest.out
5392
5393 : define a shorthand compile call
5394 compile='
5395 mc_file=$1;
5396 shift;
5397 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5398 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5399 exit 1;
5400 fi;
5401 esac;
5402 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5403 : define a shorthand compile call for compilations that should be ok.
5404 compile_ok='
5405 mc_file=$1;
5406 shift;
5407 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5408
5409 : determine filename position in cpp output
5410 echo " "
5411 echo "Computing filename position in cpp output for #include directives..." >&4
5412 case "$osname" in
5413 vos) testaccess=-e ;;
5414 *)   testaccess=-r ;;
5415 esac
5416 echo '#include <stdio.h>' > foo.c
5417 $cat >fieldn <<EOF
5418 $startsh
5419 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5420 $grep '^[       ]*#.*stdio\.h' | \
5421 while read cline; do
5422         pos=1
5423         set \$cline
5424         while $test \$# -gt 0; do
5425                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5426                         echo "\$pos"
5427                         exit 0
5428                 fi
5429                 shift
5430                 pos=\`expr \$pos + 1\`
5431         done
5432 done
5433 EOF
5434 chmod +x fieldn
5435 fieldn=`./fieldn`
5436 $rm -f foo.c fieldn
5437 case $fieldn in
5438 '') pos='???';;
5439 1) pos=first;;
5440 2) pos=second;;
5441 3) pos=third;;
5442 *) pos="${fieldn}th";;
5443 esac
5444 echo "Your cpp writes the filename in the $pos field of the line."
5445
5446 case "$osname" in
5447 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5448 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5449 *)   cppfilter='' ;;
5450 esac
5451 : locate header file
5452 $cat >findhdr <<EOF
5453 $startsh
5454 wanted=\$1
5455 name=''
5456 for usrincdir in $usrinc
5457 do
5458         if test -f \$usrincdir/\$wanted; then
5459                 echo "\$usrincdir/\$wanted"
5460                 exit 0
5461         fi
5462 done
5463 awkprg='{ print \$$fieldn }'
5464 echo "#include <\$wanted>" > foo\$\$.c
5465 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5466 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5467 while read cline; do
5468         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5469         case "\$name" in
5470         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5471         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5472         *) exit 2;;
5473         esac;
5474 done;
5475 #
5476 # status = 0: grep returned 0 lines, case statement not executed
5477 # status = 1: headerfile found
5478 # status = 2: while loop executed, no headerfile found
5479 #
5480 status=\$?
5481 $rm -f foo\$\$.c;
5482 if test \$status -eq 1; then
5483         exit 0;
5484 fi
5485 exit 1
5486 EOF
5487 chmod +x findhdr
5488
5489 : define an alternate in-header-list? function
5490 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5491 cont=true; xxf="echo \"<\$1> found.\" >&4";
5492 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5493 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5494 esac;
5495 case $# in 4) instead=instead;; *) instead="at last";; esac;
5496 while $test "$cont"; do
5497         xxx=`./findhdr $1`
5498         var=$2; eval "was=\$$2";
5499         if $test "$xxx" && $test -r "$xxx";
5500         then eval $xxf;
5501         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5502                 cont="";
5503         else eval $xxnf;
5504         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5505         set $yyy; shift; shift; yyy=$@;
5506         case $# in 0) cont="";;
5507         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5508                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5509         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5510                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5511         esac;
5512 done;
5513 while $test "$yyy";
5514 do set $yyy; var=$2; eval "was=\$$2";
5515         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5516         set $yyy; shift; shift; yyy=$@;
5517 done'
5518
5519 : see if stdlib is available
5520 set stdlib.h i_stdlib
5521 eval $inhdr
5522
5523 : check for lengths of integral types
5524 echo " "
5525 case "$intsize" in
5526 '')
5527         echo "Checking to see how big your integers are..." >&4
5528         $cat >try.c <<EOCP
5529 #include <stdio.h>
5530 #$i_stdlib I_STDLIB
5531 #ifdef I_STDLIB
5532 #include <stdlib.h>
5533 #endif
5534 int main()
5535 {
5536         printf("intsize=%d;\n", (int)sizeof(int));
5537         printf("longsize=%d;\n", (int)sizeof(long));
5538         printf("shortsize=%d;\n", (int)sizeof(short));
5539         exit(0);
5540 }
5541 EOCP
5542         set try
5543         if eval $compile_ok && $run ./try > /dev/null; then
5544                 eval `$run ./try`
5545                 echo "Your integers are $intsize bytes long."
5546                 echo "Your long integers are $longsize bytes long."
5547                 echo "Your short integers are $shortsize bytes long."
5548         else
5549                 $cat >&4 <<EOM
5550 !
5551 Help! I can't compile and run the intsize test program: please enlighten me!
5552 (This is probably a misconfiguration in your system or libraries, and
5553 you really ought to fix it.  Still, I'll try anyway.)
5554 !
5555 EOM
5556                 dflt=4
5557                 rp="What is the size of an integer (in bytes)?"
5558                 . ./myread
5559                 intsize="$ans"
5560                 dflt=$intsize
5561                 rp="What is the size of a long integer (in bytes)?"
5562                 . ./myread
5563                 longsize="$ans"
5564                 dflt=2
5565                 rp="What is the size of a short integer (in bytes)?"
5566                 . ./myread
5567                 shortsize="$ans"
5568         fi
5569         ;;
5570 esac
5571 $rm_try
5572
5573 : check for long long
5574 echo " "
5575 echo "Checking to see if you have long long..." >&4
5576 echo 'int main() { long long x = 7; return 0; }' > try.c
5577 set try
5578 if eval $compile; then
5579         val="$define"
5580         echo "You have long long."
5581 else
5582         val="$undef"
5583         echo "You do not have long long."
5584 fi
5585 $rm_try
5586 set d_longlong
5587 eval $setvar
5588
5589 : check for length of long long
5590 case "${d_longlong}${longlongsize}" in
5591 $define)
5592         echo " "
5593         echo "Checking to see how big your long longs are..." >&4
5594         $cat >try.c <<'EOCP'
5595 #include <stdio.h>
5596 int main()
5597 {
5598     printf("%d\n", (int)sizeof(long long));
5599     return(0);
5600 }
5601 EOCP
5602         set try
5603         if eval $compile_ok; then
5604                 longlongsize=`$run ./try`
5605                 echo "Your long longs are $longlongsize bytes long."
5606         else
5607                 dflt='8'
5608                 echo " "
5609                 echo "(I can't seem to compile the test program.  Guessing...)"
5610                 rp="What is the size of a long long (in bytes)?"
5611                 . ./myread
5612                 longlongsize="$ans"
5613         fi
5614         if $test "X$longsize" = "X$longlongsize"; then
5615                 echo "(That isn't any different from an ordinary long.)"
5616         fi
5617         ;;
5618 esac
5619 $rm_try
5620
5621 : see if inttypes.h is available
5622 : we want a real compile instead of Inhdr because some systems
5623 : have an inttypes.h which includes non-existent headers
5624 echo " "
5625 $cat >try.c <<EOCP
5626 #include <inttypes.h>
5627 int main() {
5628         static int32_t foo32 = 0x12345678;
5629 }
5630 EOCP
5631 set try
5632 if eval $compile; then
5633         echo "<inttypes.h> found." >&4
5634         val="$define"
5635 else
5636         echo "<inttypes.h> NOT found." >&4
5637         val="$undef"
5638 fi
5639 $rm_try
5640 set i_inttypes
5641 eval $setvar
5642
5643 : check for int64_t
5644 echo " "
5645 echo "Checking to see if you have int64_t..." >&4
5646 $cat >try.c <<EOCP
5647 #include <sys/types.h>
5648 #$i_inttypes I_INTTYPES
5649 #ifdef I_INTTYPES
5650 #include <inttypes.h>
5651 #endif
5652 int main() { int64_t x = 7; }
5653 EOCP
5654 set try
5655 if eval $compile; then
5656         val="$define"
5657         echo "You have int64_t."
5658 else
5659         val="$undef"
5660         echo "You do not have int64_t."
5661 fi
5662 $rm_try
5663 set d_int64_t
5664 eval $setvar
5665
5666 : Check if 64bit ints have a quad type
5667 echo " "
5668 echo "Checking which 64-bit integer type we could use..." >&4
5669
5670 case "$intsize" in
5671 8) val=int
5672    set quadtype
5673    eval $setvar
5674    val='"unsigned int"'
5675    set uquadtype
5676    eval $setvar
5677    quadkind=1
5678    ;;
5679 *) case "$longsize" in
5680    8) val=long
5681       set quadtype
5682       eval $setvar
5683       val='"unsigned long"'
5684       set uquadtype
5685       eval $setvar
5686       quadkind=2
5687       ;;
5688    *) case "$d_longlong:$longlongsize" in
5689       define:8)
5690         val='"long long"'
5691         set quadtype
5692         eval $setvar
5693         val='"unsigned long long"'
5694         set uquadtype
5695         eval $setvar
5696         quadkind=3
5697         ;;
5698       *) case "$d_int64_t" in
5699          define)
5700            val=int64_t
5701            set quadtype
5702            eval $setvar
5703            val=uint64_t
5704            set uquadtype
5705            eval $setvar
5706            quadkind=4
5707            ;;
5708          esac
5709          ;;
5710       esac
5711       ;;
5712    esac
5713    ;;
5714 esac
5715
5716 case "$quadtype" in
5717 '')     echo "Alas, no 64-bit integer types in sight." >&4
5718         d_quad="$undef"
5719         ;;
5720 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5721         d_quad="$define"
5722         ;;
5723 esac
5724
5725 : Do we want 64bit support
5726 case "$uselonglong" in
5727 "$define"|true|[yY]*)
5728         cat <<EOM >&4
5729
5730 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5731 EOM
5732         use64bitint="$define"
5733         ;;
5734 esac
5735 case "$use64bits" in
5736 "$define"|true|[yY]*)
5737         cat <<EOM >&4
5738
5739 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5740 EOM
5741         use64bitint="$define"
5742         ;;
5743 esac
5744 case "$use64bitints" in
5745 "$define"|true|[yY]*)
5746         cat <<EOM >&4
5747
5748 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5749 EOM
5750         use64bitint="$define"
5751         ;;
5752 esac
5753 case "$use64bitsint" in
5754 "$define"|true|[yY]*)
5755         cat <<EOM >&4
5756
5757 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5758 EOM
5759         use64bitint="$define"
5760         ;;
5761 esac
5762 case "$uselonglongs" in
5763 "$define"|true|[yY]*)
5764         cat <<EOM >&4
5765
5766 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5767 EOM
5768         use64bitint="$define"
5769         ;;
5770 esac
5771 case "$use64bitsall" in
5772 "$define"|true|[yY]*)
5773         cat <<EOM >&4
5774
5775 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5776 EOM
5777         use64bitall="$define"
5778         ;;
5779 esac
5780
5781 case "$ccflags" in
5782 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5783 esac
5784 case "$use64bitall" in
5785 "$define"|true|[yY]*) use64bitint="$define" ;;
5786 esac
5787
5788 case "$longsize" in
5789 8) cat <<EOM
5790
5791 You have natively 64-bit long integers.
5792 EOM
5793    val="$define"
5794    ;;
5795 *) case "$use64bitint" in
5796    "$define"|true|[yY]*) dflt='y';;
5797    *) dflt='n';;
5798    esac
5799    case "$d_quad" in
5800    "$define") ;;
5801    *) dflt='n' ;;
5802    esac
5803    cat <<EOM
5804
5805 Perl can be built to take advantage of 64-bit integer types
5806 on some systems.  To do so, Configure can be run with -Duse64bitint.
5807 Choosing this option will most probably introduce binary incompatibilities.
5808
5809 If this doesn't make any sense to you, just accept the default '$dflt'.
5810 (The default has been chosen based on your configuration.)
5811 EOM
5812    rp='Try to use 64-bit integers, if available?'
5813    . ./myread
5814    case "$ans" in
5815    [yY]*) val="$define" ;;
5816    *)     val="$undef"  ;;
5817    esac
5818    ;;
5819 esac
5820 set use64bitint
5821 eval $setvar
5822
5823 case "$use64bitall" in
5824 "$define"|true|[yY]*) dflt='y' ;;
5825 *) case "$longsize" in
5826    8) dflt='y' ;;
5827    *) dflt='n' ;;
5828    esac
5829    ;;
5830 esac
5831 cat <<EOM
5832
5833 You may also choose to try maximal 64-bitness.  It means using as much
5834 64-bitness as possible on the platform.  This in turn means even more
5835 binary incompatibilities.  On the other hand, your platform may not
5836 have any more 64-bitness available than what you already have chosen.
5837
5838 If this doesn't make any sense to you, just accept the default '$dflt'.
5839 (The default has been chosen based on your configuration.)
5840 EOM
5841 rp='Try to use maximal 64-bit support, if available?'
5842 . ./myread
5843 case "$ans" in
5844 [yY]*) val="$define" ;;
5845 *)     val="$undef"  ;;
5846 esac
5847 set use64bitall
5848 eval $setvar
5849 case "$use64bitall" in
5850 "$define")
5851         case "$use64bitint" in
5852         "$undef")
5853                 cat <<EOM
5854
5855 Since you have chosen a maximally 64-bit build, I'm also turning on
5856 the use of 64-bit integers.
5857 EOM
5858                 use64bitint="$define" ;;
5859         esac
5860         ;;
5861 esac
5862
5863 : Look for a hint-file generated 'call-back-unit'.  If the
5864 : user has specified that a 64-bit perl is to be built,
5865 : we may need to set or change some other defaults.
5866 if $test -f use64bitint.cbu; then
5867         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5868         . ./use64bitint.cbu
5869 fi
5870 case "$use64bitint" in
5871 "$define"|true|[yY]*)
5872         case "$longsize" in
5873         4) case "$archname64" in
5874            '') archname64=64int ;;
5875            esac
5876            ;;
5877         esac
5878         ;;
5879 esac
5880
5881 : Look for a hint-file generated 'call-back-unit'.  If the
5882 : user has specified that a maximally 64-bit perl is to be built,
5883 : we may need to set or change some other defaults.
5884 if $test -f use64bitall.cbu; then
5885         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5886         . ./use64bitall.cbu
5887 fi
5888 case "$use64bitall" in
5889 "$define"|true|[yY]*)
5890         case "$longsize" in
5891         4) case "$archname64" in
5892            ''|64int) archname64=64all ;;
5893            esac
5894            ;;
5895         esac
5896         ;;
5897 esac
5898
5899 case "$d_quad:$use64bitint" in
5900 $undef:$define)
5901         cat >&4 <<EOF
5902
5903 *** You have chosen to use 64-bit integers,
5904 *** but none can be found.
5905 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5906 *** Cannot continue, aborting.
5907
5908 EOF
5909         exit 1
5910         ;;
5911 esac
5912
5913 : check for length of double
5914 echo " "
5915 case "$doublesize" in
5916 '')
5917         echo "Checking to see how big your double precision numbers are..." >&4
5918         $cat >try.c <<EOCP
5919 #include <stdio.h>
5920 #$i_stdlib I_STDLIB
5921 #ifdef I_STDLIB
5922 #include <stdlib.h>
5923 #endif
5924 int main()
5925 {
5926     printf("%d\n", (int)sizeof(double));
5927     exit(0);
5928 }
5929 EOCP
5930         set try
5931         if eval $compile_ok; then
5932                 doublesize=`$run ./try`
5933                 echo "Your double is $doublesize bytes long."
5934         else
5935                 dflt='8'
5936                 echo "(I can't seem to compile the test program.  Guessing...)"
5937                 rp="What is the size of a double precision number (in bytes)?"
5938                 . ./myread
5939                 doublesize="$ans"
5940         fi
5941         ;;
5942 esac
5943 $rm_try
5944
5945 : check for long doubles
5946 echo " "
5947 echo "Checking to see if you have long double..." >&4
5948 echo 'int main() { long double x = 7.0; }' > try.c
5949 set try
5950 if eval $compile; then
5951         val="$define"
5952         echo "You have long double."
5953 else
5954         val="$undef"
5955         echo "You do not have long double."
5956 fi
5957 $rm_try
5958 set d_longdbl
5959 eval $setvar
5960
5961 : check for length of long double
5962 case "${d_longdbl}${longdblsize}" in
5963 $define)
5964         echo " "
5965         echo "Checking to see how big your long doubles are..." >&4
5966         $cat >try.c <<'EOCP'
5967 #include <stdio.h>
5968 int main()
5969 {
5970         printf("%d\n", sizeof(long double));
5971 }
5972 EOCP
5973         set try
5974         set try
5975         if eval $compile; then
5976                 longdblsize=`$run ./try`
5977                 echo "Your long doubles are $longdblsize bytes long."
5978         else
5979                 dflt='8'
5980                 echo " "
5981                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5982                 rp="What is the size of a long double (in bytes)?"
5983                 . ./myread
5984                 longdblsize="$ans"
5985         fi
5986         if $test "X$doublesize" = "X$longdblsize"; then
5987                 echo "That isn't any different from an ordinary double."
5988                 echo "I'll keep your setting anyway, but you may see some"
5989                 echo "harmless compilation warnings."
5990         fi
5991         ;;
5992 esac
5993 $rm_try
5994
5995 : determine the architecture name
5996 echo " "
5997 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5998         tarch=`arch`"-$osname"
5999 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6000         if uname -m > tmparch 2>&1 ; then
6001                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6002                         -e 's/$/'"-$osname/" tmparch`
6003         else
6004                 tarch="$osname"
6005         fi
6006         $rm -f tmparch
6007 else
6008         tarch="$osname"
6009 fi
6010 case "$myarchname" in
6011 ''|"$tarch") ;;
6012 *)
6013         echo "(Your architecture name used to be $myarchname.)"
6014         archname=''
6015         ;;
6016 esac
6017 case "$targetarch" in
6018 '') ;;
6019 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6020 esac
6021 myarchname="$tarch"
6022 case "$archname" in
6023 '') dflt="$tarch";;
6024 *) dflt="$archname";;
6025 esac
6026 rp='What is your architecture name'
6027 . ./myread
6028 archname="$ans"
6029 case "$usethreads" in
6030 $define)
6031         echo "Threads selected." >&4
6032         case "$archname" in
6033         *-thread*) echo "...and architecture name already has -thread." >&4
6034                 ;;
6035         *)      archname="$archname-thread"
6036                 echo "...setting architecture name to $archname." >&4
6037                 ;;
6038         esac
6039         ;;
6040 esac
6041 case "$usemultiplicity" in
6042 $define)
6043         echo "Multiplicity selected." >&4
6044         case "$archname" in
6045         *-multi*) echo "...and architecture name already has -multi." >&4
6046                 ;;
6047         *)      archname="$archname-multi"
6048                 echo "...setting architecture name to $archname." >&4
6049                 ;;
6050         esac
6051         ;;
6052 esac
6053 case "$use64bitint$use64bitall" in
6054 *"$define"*)
6055         case "$archname64" in
6056         '')
6057                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6058                 ;;
6059         *)
6060                 case "$use64bitint" in
6061                 "$define") echo "64 bit integers selected." >&4 ;;
6062                 esac
6063                 case "$use64bitall" in
6064                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6065                 esac
6066                 case "$archname" in
6067                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6068                         ;;
6069                 *)      archname="$archname-$archname64"
6070                         echo "...setting architecture name to $archname." >&4
6071                         ;;
6072                 esac
6073                 ;;
6074         esac
6075 esac
6076 case "$uselongdouble" in
6077 $define)
6078         echo "Long doubles selected." >&4
6079         case "$longdblsize" in
6080         $doublesize)
6081                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6082                 ;;
6083         *)
6084                 case "$archname" in
6085                 *-ld*) echo "...and architecture name already has -ld." >&4
6086                         ;;
6087                 *)      archname="$archname-ld"
6088                         echo "...setting architecture name to $archname." >&4
6089                         ;;
6090                 esac
6091                 ;;
6092         esac
6093         ;;
6094 esac
6095 case "$useperlio" in
6096 $define)
6097         echo "Perlio selected." >&4
6098         ;;
6099 *)
6100         echo "Perlio not selected, using stdio." >&4
6101         case "$archname" in
6102         *-stdio*) echo "...and architecture name already has -stdio." >&4
6103                 ;;
6104         *)      archname="$archname-stdio"
6105                 echo "...setting architecture name to $archname." >&4
6106                 ;;
6107         esac
6108         ;;
6109 esac
6110 if $test -f archname.cbu; then
6111         echo "Your platform has some specific hints for architecture name, using them..."
6112         . ./archname.cbu
6113 fi
6114
6115 : set the prefixit variable, to compute a suitable default value
6116 prefixit='case "$3" in
6117 ""|none)
6118         case "$oldprefix" in
6119         "") eval "$1=\"\$$2\"";;
6120         *)
6121                 case "$3" in
6122                 "") eval "$1=";;
6123                 none)
6124                         eval "tp=\"\$$2\"";
6125                         case "$tp" in
6126                         ""|" ") eval "$1=\"\$$2\"";;
6127                         *) eval "$1=";;
6128                         esac;;
6129                 esac;;
6130         esac;;
6131 *)
6132         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6133         case "$tp" in
6134         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6135         /*-$oldprefix/*|\~*-$oldprefix/*)
6136                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6137         *) eval "$1=\"\$$2\"";;
6138         esac;;
6139 esac'
6140
6141 : determine installation style
6142 : For now, try to deduce it from prefix unless it is already set.
6143 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6144 case "$installstyle" in
6145 '')     case "$prefix" in
6146                 *perl*) dflt='lib';;
6147                 *) dflt='lib/perl5' ;;
6148         esac
6149         ;;
6150 *)      dflt="$installstyle" ;;
6151 esac
6152 : Probably not worth prompting for this since we prompt for all
6153 : the directories individually, and the prompt would be too long and
6154 : confusing anyway.
6155 installstyle=$dflt
6156
6157 : determine where public executables go
6158 echo " "
6159 set dflt bin bin
6160 eval $prefixit
6161 fn=d~
6162 rp='Pathname where the public executables will reside?'
6163 . ./getfile
6164 if $test "X$ansexp" != "X$binexp"; then
6165         installbin=''
6166 fi
6167 prefixvar=bin
6168 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6169 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6170 :     this via initialinstalllocation
6171 . ./setprefixvar
6172
6173 case "$userelocatableinc" in
6174 $define|true|[yY]*)     dflt='y' ;;
6175 *)                      dflt='n' ;;
6176 esac
6177 cat <<EOM
6178
6179 Would you like to build Perl so that the installation is relocatable, so that
6180 library paths in @INC are determined relative to the path of the perl binary?
6181 This is not advised for system Perl installs, or if you need to run setid
6182 scripts or scripts under taint mode.
6183
6184 If this doesn't make any sense to you, just accept the default '$dflt'.
6185 EOM
6186 rp='Use relocatable @INC?'
6187 . ./myread
6188 case "$ans" in
6189 y|Y)    val="$define" ;;
6190 *)      val="$undef"  ;;
6191 esac
6192 set userelocatableinc
6193 eval $setvar
6194
6195 initialinstalllocation="$binexp"
6196 : Default prefix is now "up one level from where the binaries are"
6197 case "$userelocatableinc" in
6198 $define|true|[yY]*)
6199     bin=".../"
6200     binexp=".../"
6201     prefix=".../.."
6202     prefixexp=".../.."
6203     installprefixexp=".../.."
6204     ;;
6205 esac
6206
6207 : determine where private library files go
6208 : Usual default is /usr/local/lib/perl5/$version.
6209 : Also allow things like /opt/perl/lib/$version, since
6210 : /opt/perl/lib/perl5... would be redundant.
6211 : The default "style" setting is made in installstyle.U
6212 case "$installstyle" in
6213 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6214 *)       set dflt privlib lib/$version ;;
6215 esac
6216 eval $prefixit
6217 $cat <<EOM
6218
6219 There are some auxiliary files for $package that need to be put into a
6220 private library directory that is accessible by everyone.
6221
6222 EOM
6223 fn=$binexp
6224 fn=d~+
6225 rp='Pathname where the private library files will reside?'
6226 . ./getfile
6227 prefixvar=privlib
6228 . ./setprefixvar
6229
6230 : set the prefixup variable, to restore leading tilda escape
6231 prefixup='case "$prefixexp" in
6232 "$prefix") ;;
6233 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6234 esac'
6235
6236 : determine where public architecture dependent libraries go
6237 set archlib archlib
6238 eval $prefixit
6239 : privlib default is /usr/local/lib/$package/$version
6240 : archlib default is /usr/local/lib/$package/$version/$archname
6241 : privlib may have an optional trailing /share.
6242 tdflt=`echo $privlib | $sed 's,/share$,,'`
6243 tdflt=$tdflt/$archname
6244 case "$archlib" in
6245 '')     dflt=$tdflt
6246         ;;
6247 *)      dflt="$archlib"
6248     ;;
6249 esac
6250 $cat <<EOM
6251
6252 $spackage contains architecture-dependent library files.  If you are
6253 sharing libraries in a heterogeneous environment, you might store
6254 these files in a separate location.  Otherwise, you can just include
6255 them with the rest of the public library files.
6256
6257 EOM
6258 fn=$binexp
6259 fn=d+~
6260 rp='Where do you want to put the public architecture-dependent libraries?'
6261 . ./getfile
6262 prefixvar=archlib
6263 . ./setprefixvar
6264 if $test X"$archlib" = X"$privlib"; then
6265         d_archlib="$undef"
6266 else
6267         d_archlib="$define"
6268 fi
6269
6270 : see if setuid scripts can be secure
6271 $cat <<EOM
6272
6273 Some kernels have a bug that prevents setuid #! scripts from being
6274 secure.  Some sites have disabled setuid #! scripts because of this.
6275
6276 First let's decide if your kernel supports secure setuid #! scripts.
6277 (If setuid #! scripts would be secure but have been disabled anyway,
6278 don't say that they are secure if asked.)
6279
6280 EOM
6281
6282 val="$undef"
6283 if $test -d /dev/fd; then
6284         echo "#!$ls" >reflect
6285         chmod +x,u+s reflect
6286         ./reflect >flect 2>&1
6287         if $contains "/dev/fd" flect >/dev/null; then
6288                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6289                 val="$define"
6290         else
6291                 $cat <<EOM
6292 If you are not sure if they are secure, I can check but I'll need a
6293 username and password different from the one you are using right now.
6294 If you don't have such a username or don't want me to test, simply
6295 enter 'none'.
6296
6297 EOM
6298                 rp='Other username to test security of setuid scripts with?'
6299                 dflt='none'
6300                 . ./myread
6301                 case "$ans" in
6302                 n|none)
6303                         case "$d_suidsafe" in
6304                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6305                                 dflt=n;;
6306                         "$undef")
6307                                 echo "Well, the $hint value is *not* secure." >&4
6308                                 dflt=n;;
6309                         *)      echo "Well, the $hint value *is* secure." >&4
6310                                 dflt=y;;
6311                         esac
6312                         ;;
6313                 *)
6314                         $rm -f reflect flect
6315                         echo "#!$ls" >reflect
6316                         chmod +x,u+s reflect
6317                         echo >flect
6318                         chmod a+w flect
6319                         echo '"su" will (probably) prompt you for '"$ans's password."
6320                         su $ans -c './reflect >flect'
6321                         if $contains "/dev/fd" flect >/dev/null; then
6322                                 echo "Okay, it looks like setuid scripts are secure." >&4
6323                                 dflt=y
6324                         else
6325                                 echo "I don't think setuid scripts are secure." >&4
6326                                 dflt=n
6327                         fi
6328                         ;;
6329                 esac
6330                 rp='Does your kernel have *secure* setuid scripts?'
6331                 . ./myread
6332                 case "$ans" in
6333                 [yY]*)  val="$define";;
6334                 *)      val="$undef";;
6335                 esac
6336         fi
6337 else
6338         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6339         echo "(That's for file descriptors, not floppy disks.)"
6340         val="$undef"
6341 fi
6342 set d_suidsafe
6343 eval $setvar
6344
6345 $rm -f reflect flect
6346
6347 : now see if they want to do setuid emulation
6348 echo " "
6349 val="$undef"
6350 case "$d_suidsafe" in
6351 "$define")
6352         val="$undef"
6353         echo "No need to emulate SUID scripts since they are secure here." >&4
6354         ;;
6355 *)
6356         $cat <<EOM
6357 Some systems have disabled setuid scripts, especially systems where
6358 setuid scripts cannot be secure.  On systems where setuid scripts have
6359 been disabled, the setuid/setgid bits on scripts are currently
6360 useless.  It is possible for $package to detect those bits and emulate
6361 setuid/setgid in a secure fashion.  This emulation will only work if
6362 setuid scripts have been disabled in your kernel.
6363
6364 EOM
6365         case "$d_dosuid" in
6366         "$define") dflt=y ;;
6367         *) dflt=n ;;
6368         esac
6369         rp="Do you want to do setuid/setgid emulation?"
6370         . ./myread
6371         case "$ans" in
6372         [yY]*)  val="$define";;
6373         *)      val="$undef";;
6374         esac
6375         ;;
6376 esac
6377 set d_dosuid
6378 eval $setvar
6379
6380 : Find perl5.005 or later.
6381 echo "Looking for a previously installed perl5.005 or later... "
6382 case "$perl5" in
6383 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6384                 : Check if this perl is recent and can load a simple module
6385                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6386                         perl5=$tdir/perl
6387                         break;
6388                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6389                         perl5=$tdir/perl5
6390                         break;
6391                 fi
6392         done
6393         ;;
6394 *)      perl5="$perl5"
6395         ;;
6396 esac
6397 case "$perl5" in
6398 '')     echo "None found.  That's ok.";;
6399 *)      echo "Using $perl5." ;;
6400 esac
6401
6402 : Set the siteprefix variables
6403 $cat <<EOM
6404
6405 After $package is installed, you may wish to install various
6406 add-on modules and utilities.  Typically, these add-ons will
6407 be installed under $prefix with the rest
6408 of this package.  However, you may wish to install such add-ons
6409 elsewhere under a different prefix.
6410
6411 If you do not wish to put everything under a single prefix, that's
6412 ok.  You will be prompted for the individual locations; this siteprefix
6413 is only used to suggest the defaults.
6414
6415 The default should be fine for most people.
6416
6417 EOM
6418 fn=d~+
6419 rp='Installation prefix to use for add-on modules and utilities?'
6420 : XXX Here might be another good place for an installstyle setting.
6421 case "$siteprefix" in
6422 '') dflt=$prefix ;;
6423 *)  dflt=$siteprefix ;;
6424 esac
6425 . ./getfile
6426 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6427 oldsiteprefix=''
6428 case "$siteprefix" in
6429 '') ;;
6430 *)      case "$ans" in
6431         "$prefix") ;;
6432         *) oldsiteprefix="$prefix";;
6433         esac
6434         ;;
6435 esac
6436 siteprefix="$ans"
6437 siteprefixexp="$ansexp"
6438
6439 : determine where site specific libraries go.
6440 : Usual default is /usr/local/lib/perl5/site_perl/$version
6441 : The default "style" setting is made in installstyle.U
6442 : XXX No longer works with Prefixit stuff.
6443 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6444 case "$sitelib" in
6445 '') case "$installstyle" in
6446         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6447         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6448         esac
6449         ;;
6450 *)      dflt="$sitelib"
6451         ;;
6452 esac
6453 $cat <<EOM
6454
6455 The installation process will create a directory for
6456 site-specific extensions and modules.  Most users find it convenient
6457 to place all site-specific files in this directory rather than in the
6458 main distribution directory.
6459
6460 EOM
6461 fn=d~+
6462 rp='Pathname for the site-specific library files?'
6463 . ./getfile
6464 prefixvar=sitelib
6465 . ./setprefixvar
6466 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6467
6468 : Determine list of previous versions to include in @INC
6469 $cat > getverlist <<EOPL
6470 #!$perl5 -w
6471 use File::Basename;
6472 \$api_versionstring = "$api_versionstring";
6473 \$version = "$version";
6474 \$stem = "$sitelib_stem";
6475 \$archname = "$archname";
6476 EOPL
6477         $cat >> getverlist <<'EOPL'
6478 # The list found is store twice for each entry: the original name, and
6479 # the binary broken down version as pack "sss", so sorting is easy and
6480 # unambiguous. This will work for all versions that have a maximum of
6481 # three digit groups, separate by '.'s or '_'s. Names are extended with
6482 # ".0.0" to ensure at least three elements for the pack.
6483 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6484
6485 # Can't have leading @ because metaconfig interprets it as a command!
6486 ;@inc_version_list=();
6487 # XXX Redo to do opendir/readdir?
6488 if (-d $stem) {
6489     chdir($stem);
6490     ;@candidates = map {
6491         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6492 }
6493 else {
6494     ;@candidates = ();
6495 }
6496
6497 ($pversion, $aversion, $vsn5005) = map {
6498     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6499 foreach $d (@candidates) {
6500     if ($d->[1] lt $pversion) {
6501         if ($d->[1] ge $aversion) {
6502             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6503         }
6504         elsif ($d->[1] ge $vsn5005) {
6505             unshift(@inc_version_list, grep { -d } $d->[0]);
6506         }
6507     }
6508     else {
6509         # Skip newer version.  I.e. don't look in
6510         # 5.7.0 if we're installing 5.6.1.
6511     }
6512 }
6513
6514 if (@inc_version_list) {
6515     print join(' ', @inc_version_list);
6516 }
6517 else {
6518     # Blank space to preserve value for next Configure run.
6519     print " ";
6520 }
6521 EOPL
6522 chmod +x getverlist
6523 case "$inc_version_list" in
6524 '')     if test -x "$perl5$exe_ext"; then
6525                 dflt=`$perl5 getverlist`
6526         else
6527                 dflt='none'
6528         fi
6529         ;;
6530 $undef) dflt='none' ;;
6531 *)  eval dflt=\"$inc_version_list\" ;;
6532 esac
6533 case "$dflt" in
6534 ''|' ') dflt=none ;;
6535 esac
6536 case "$dflt" in
6537 5.005) dflt=none ;;
6538 esac
6539 $cat <<EOM
6540
6541 In order to ease the process of upgrading, this version of perl
6542 can be configured to use modules built and installed with earlier
6543 versions of perl that were installed under $prefix.  Specify here
6544 the list of earlier versions that this version of perl should check.
6545 If Configure detected no earlier versions of perl installed under
6546 $prefix, then the list will be empty.  Answer 'none' to tell perl
6547 to not search earlier versions.
6548
6549 The default should almost always be sensible, so if you're not sure,
6550 just accept the default.
6551 EOM
6552
6553 rp='List of earlier versions to include in @INC?'
6554 . ./myread
6555 case "$ans" in
6556 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6557 *) inc_version_list="$ans" ;;
6558 esac
6559 case "$inc_version_list" in
6560 ''|' ')
6561         inc_version_list_init='0'
6562         d_inc_version_list="$undef"
6563         ;;
6564 *)      inc_version_list_init=`echo $inc_version_list |
6565                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6566         d_inc_version_list="$define"
6567         ;;
6568 esac
6569 $rm -f getverlist
6570
6571 : see if malloc/malloc.h has to be included
6572 set malloc/malloc.h i_mallocmalloc
6573 eval $inhdr
6574
6575 : see if this is a malloc.h system
6576 : we want a real compile instead of Inhdr because some systems have a
6577 : malloc.h that just gives a compile error saying to use stdlib.h instead
6578 echo " "
6579 $cat >try.c <<EOCP
6580 #include <stdlib.h>
6581 #include <malloc.h>
6582 #$i_mallocmalloc I_MALLOCMALLOC
6583 #ifdef I_MALLOCMALLOC
6584 # include <malloc/malloc.h>
6585 #endif
6586
6587 int main () { return 0; }
6588 EOCP
6589 set try
6590 if eval $compile; then
6591     echo "<malloc.h> found." >&4
6592     val="$define"
6593 else
6594     echo "<malloc.h> NOT found." >&4
6595     val="$undef"
6596 fi
6597 $rm_try
6598 set i_malloc
6599 eval $setvar
6600
6601 : check for void type
6602 echo " "
6603 echo "Checking to see how well your C compiler groks the void type..." >&4
6604 case "$voidflags" in
6605 '')
6606         $cat >try.c <<EOCP
6607 #$i_stdlib I_STDLIB
6608 #ifdef I_STDLIB
6609 #include <stdlib.h>
6610 #endif
6611 #if TRY & 1
6612 void sub() {
6613 #else
6614 sub() {
6615 #endif
6616         extern void moo();      /* function returning void */
6617         void (*goo)();          /* ptr to func returning void */
6618 #if TRY & 8
6619         void *hue;              /* generic ptr */
6620 #endif
6621 #if TRY & 2
6622         void (*foo[10])();
6623 #endif
6624
6625 #if TRY & 4
6626         if(goo == moo) {
6627                 exit(0);
6628         }
6629 #endif
6630         exit(0);
6631 }
6632 int main() { sub(); }
6633 EOCP
6634         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6635                 voidflags=$defvoidused
6636         echo "Good.  It appears to support void to the level $package wants.">&4
6637                 if $contains warning .out >/dev/null 2>&1; then
6638                         echo "However, you might get some warnings that look like this:"
6639                         $cat .out
6640                 fi
6641         else
6642 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6643                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6644                         echo "It supports 1..."
6645                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6646                                 echo "It also supports 2..."
6647                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6648                                         voidflags=7
6649                                         echo "And it supports 4 but not 8 definitely."
6650                                 else
6651                                         echo "It doesn't support 4..."
6652                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6653                                                 voidflags=11
6654                                                 echo "But it supports 8."
6655                                         else
6656                                                 voidflags=3
6657                                                 echo "Neither does it support 8."
6658                                         fi
6659                                 fi
6660                         else
6661                                 echo "It does not support 2..."
6662                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6663                                         voidflags=13
6664                                         echo "But it supports 4 and 8."
6665                                 else
6666                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6667                                                 voidflags=5
6668                                                 echo "And it supports 4 but has not heard about 8."
6669                                         else
6670                                                 echo "However it supports 8 but not 4."
6671                                         fi
6672                                 fi
6673                         fi
6674                 else
6675                         echo "There is no support at all for void."
6676                         voidflags=0
6677                 fi
6678         fi
6679 esac
6680 case "$voidflags" in
6681 "$defvoidused") ;;
6682 *)      $cat >&4 <<'EOM'
6683   Support flag bits are:
6684     1: basic void declarations.
6685     2: arrays of pointers to functions returning void.
6686     4: operations between pointers to and addresses of void functions.
6687     8: generic void pointers.
6688 EOM
6689         dflt="$voidflags";
6690         rp="Your void support flags add up to what?"
6691         . ./myread
6692         voidflags="$ans"
6693         ;;
6694 esac
6695 $rm_try
6696
6697 : check for length of pointer
6698 echo " "
6699 case "$ptrsize" in
6700 '')
6701         echo "Checking to see how big your pointers are..." >&4
6702         if test "$voidflags" -gt 7; then
6703                 echo '#define VOID_PTR char *' > try.c
6704         else
6705                 echo '#define VOID_PTR void *' > try.c
6706         fi
6707         $cat >>try.c <<EOCP
6708 #include <stdio.h>
6709 #$i_stdlib I_STDLIB
6710 #ifdef I_STDLIB
6711 #include <stdlib.h>
6712 #endif
6713 int main()
6714 {
6715     printf("%d\n", (int)sizeof(VOID_PTR));
6716     exit(0);
6717 }
6718 EOCP
6719         set try
6720         if eval $compile_ok; then
6721                 ptrsize=`$run ./try`
6722                 echo "Your pointers are $ptrsize bytes long."
6723         else
6724                 dflt='4'
6725                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6726                 rp="What is the size of a pointer (in bytes)?"
6727                 . ./myread
6728                 ptrsize="$ans"
6729         fi
6730         ;;
6731 esac
6732 $rm_try
6733 case "$use64bitall" in
6734 "$define"|true|[yY]*)
6735         case "$ptrsize" in
6736         4)      cat <<EOM >&4
6737
6738 *** You have chosen a maximally 64-bit build,
6739 *** but your pointers are only 4 bytes wide.
6740 *** Please rerun Configure without -Duse64bitall.
6741 EOM
6742                 case "$d_quad" in
6743                 define)
6744                         cat <<EOM >&4
6745 *** Since you have quads, you could possibly try with -Duse64bitint.
6746 EOM
6747                         ;;
6748                 esac
6749                 cat <<EOM >&4
6750 *** Cannot continue, aborting.
6751
6752 EOM
6753
6754                 exit 1
6755                 ;;
6756         esac
6757         ;;
6758 esac
6759
6760
6761 : determine whether to use malloc wrapping
6762 echo " "
6763 case "$usemallocwrap" in
6764 [yY]*|true|$define)     dflt='y' ;;
6765 [nN]*|false|$undef)     dflt='n' ;;
6766 *)      case "$usedevel" in
6767         [yY]*|true|$define)     dflt='y' ;;
6768         *) dflt='n' ;;
6769         esac
6770         ;;
6771 esac
6772 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6773 . ./myread
6774 usemallocwrap="$ans"
6775 case "$ans" in
6776 y*|true)
6777         usemallocwrap="$define" ;;
6778 *)
6779         usemallocwrap="$undef" ;;
6780 esac
6781
6782 : determine which malloc to compile in
6783 echo " "
6784 case "$usemymalloc" in
6785 [yY]*|true|$define)     dflt='y' ;;
6786 [nN]*|false|$undef)     dflt='n' ;;
6787 *)      case "$ptrsize" in
6788         4) dflt='y' ;;
6789         *) dflt='n' ;;
6790         esac
6791         ;;
6792 esac
6793 rp="Do you wish to attempt to use the malloc that comes with $package?"
6794 . ./myread
6795 usemymalloc="$ans"
6796 case "$ans" in
6797 y*|true)
6798         usemymalloc='y'
6799         mallocsrc='malloc.c'
6800         mallocobj="malloc$_o"
6801         d_mymalloc="$define"
6802         case "$libs" in
6803         *-lmalloc*)
6804                 : Remove malloc from list of libraries to use
6805                 echo "Removing unneeded -lmalloc from library list" >&4
6806                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6807                 shift
6808                 libs="$*"
6809                 echo "libs = $libs" >&4
6810                 ;;
6811         esac
6812         ;;
6813 *)
6814         usemymalloc='n'
6815         mallocsrc=''
6816         mallocobj=''
6817         d_mymalloc="$undef"
6818         ;;
6819 esac
6820
6821 : compute the return types of malloc and free
6822 echo " "
6823 $cat >malloc.c <<END
6824 #$i_malloc I_MALLOC
6825 #$i_stdlib I_STDLIB
6826 #include <stdio.h>
6827 #include <sys/types.h>
6828 #ifdef I_MALLOC
6829 #include <malloc.h>
6830 #endif
6831 #ifdef I_STDLIB
6832 #include <stdlib.h>
6833 #endif
6834 #ifdef TRY_MALLOC
6835 void *malloc();
6836 #endif
6837 #ifdef TRY_FREE
6838 void free();
6839 #endif
6840 END
6841 case "$malloctype" in
6842 '')
6843         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6844                 malloctype='void *'
6845         else
6846                 malloctype='char *'
6847         fi
6848         ;;
6849 esac
6850 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6851
6852 case "$freetype" in
6853 '')
6854         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6855                 freetype='void'
6856         else
6857                 freetype='int'
6858         fi
6859         ;;
6860 esac
6861 echo "Your system uses $freetype free(), it would seem." >&4
6862 $rm -f malloc.[co]
6863 : determine where site specific architecture-dependent libraries go.
6864 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6865 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6866 : sitelib may have an optional trailing /share.
6867 case "$sitearch" in
6868 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6869         dflt="$dflt/$archname"
6870         ;;
6871 *)      dflt="$sitearch"
6872         ;;
6873 esac
6874 set sitearch sitearch none
6875 eval $prefixit
6876 $cat <<EOM
6877
6878 The installation process will also create a directory for
6879 architecture-dependent site-specific extensions and modules.
6880
6881 EOM
6882 fn=d~+
6883 rp='Pathname for the site-specific architecture-dependent library files?'
6884 . ./getfile
6885 prefixvar=sitearch
6886 . ./setprefixvar
6887 if $test X"$sitearch" = X"$sitelib"; then
6888         d_sitearch="$undef"
6889 else
6890         d_sitearch="$define"
6891 fi
6892
6893 : Set the vendorprefix variables
6894 $cat <<EOM
6895
6896 The installation process will also create a directory for
6897 vendor-supplied add-ons.  Vendors who supply perl with their system
6898 may find it convenient to place all vendor-supplied files in this
6899 directory rather than in the main distribution directory.  This will
6900 ease upgrades between binary-compatible maintenance versions of perl.
6901
6902 Of course you may also use these directories in whatever way you see
6903 fit.  For example, you might use them to access modules shared over a
6904 company-wide network.
6905
6906 The default answer should be fine for most people.
6907 This causes further questions about vendor add-ons to be skipped
6908 and no vendor-specific directories will be configured for perl.
6909
6910 EOM
6911 rp='Do you want to configure vendor-specific add-on directories?'
6912 case "$usevendorprefix" in
6913 define|true|[yY]*) dflt=y ;;
6914 *)      : User may have set vendorprefix directly on Configure command line.
6915         case "$vendorprefix" in
6916         ''|' ') dflt=n ;;
6917         *)      dflt=y ;;
6918         esac
6919         ;;
6920 esac
6921 . ./myread
6922 case "$ans" in
6923 [yY]*)  fn=d~+
6924         rp='Installation prefix to use for vendor-supplied add-ons?'
6925         case "$vendorprefix" in
6926         '') dflt='' ;;
6927         *)  dflt=$vendorprefix ;;
6928         esac
6929         . ./getfile
6930         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6931         oldvendorprefix=''
6932         case "$vendorprefix" in
6933         '') ;;
6934         *)      case "$ans" in
6935                 "$prefix") ;;
6936                 *) oldvendorprefix="$prefix";;
6937                 esac
6938                 ;;
6939         esac
6940         usevendorprefix="$define"
6941         vendorprefix="$ans"
6942         vendorprefixexp="$ansexp"
6943         ;;
6944 *)      usevendorprefix="$undef"
6945         vendorprefix=''
6946         vendorprefixexp=''
6947         ;;
6948 esac
6949
6950 : Set the vendorlib variables
6951 case "$vendorprefix" in
6952 '')     d_vendorlib="$undef"
6953         vendorlib=''
6954         vendorlibexp=''
6955         ;;
6956 *)      d_vendorlib="$define"
6957         : determine where vendor-supplied modules go.
6958         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6959         case "$vendorlib" in
6960         '')
6961                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6962                 case "$installstyle" in
6963                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6964                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6965                 esac
6966                 ;;
6967         *)      dflt="$vendorlib"
6968                 ;;
6969         esac
6970         fn=d~+
6971         rp='Pathname for the vendor-supplied library files?'
6972         . ./getfile
6973         vendorlib="$ans"
6974         vendorlibexp="$ansexp"
6975         ;;
6976 esac
6977 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6978 prefixvar=vendorlib
6979 . ./installprefix
6980
6981 : Set the vendorarch variables
6982 case "$vendorprefix" in
6983 '')     d_vendorarch="$undef"
6984         vendorarch=''
6985         vendorarchexp=''
6986         ;;
6987 *)      d_vendorarch="$define"
6988         : determine where vendor-supplied architecture-dependent libraries go.
6989         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6990         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6991         : vendorlib may have an optional trailing /share.
6992         case "$vendorarch" in
6993         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6994                 dflt="$dflt/$archname"
6995                 ;;
6996         *)      dflt="$vendorarch" ;;
6997         esac
6998         fn=d~+
6999         rp='Pathname for vendor-supplied architecture-dependent files?'
7000         . ./getfile
7001         vendorarch="$ans"
7002         vendorarchexp="$ansexp"
7003         ;;
7004 esac
7005 prefixvar=vendorarch
7006 . ./installprefix
7007
7008 : Final catch-all directories to search
7009 $cat <<EOM
7010
7011 Lastly, you can have perl look in other directories for extensions and
7012 modules in addition to those already specified.
7013 These directories will be searched after 
7014         $sitearch 
7015         $sitelib 
7016 EOM
7017 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7018 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7019 echo ' '
7020 case "$otherlibdirs" in
7021 ''|' ') dflt='none' ;;
7022 *)      dflt="$otherlibdirs" ;;
7023 esac
7024 $cat <<EOM
7025 Enter a colon-separated set of extra paths to include in perl's @INC
7026 search path, or enter 'none' for no extra paths.
7027
7028 EOM
7029
7030 rp='Colon-separated list of additional directories for perl to search?'
7031 . ./myread
7032 case "$ans" in
7033 ' '|''|none)    otherlibdirs=' ' ;;     
7034 *)      otherlibdirs="$ans" ;;
7035 esac
7036 case "$otherlibdirs" in
7037 ' ') val=$undef ;;
7038 *)      val=$define ;;
7039 esac
7040 set d_perl_otherlibdirs
7041 eval $setvar
7042
7043 : Cruising for prototypes
7044 echo " "
7045 echo "Checking out function prototypes..." >&4
7046 $cat >prototype.c <<EOCP
7047 #$i_stdlib I_STDLIB
7048 #ifdef I_STDLIB
7049 #include <stdlib.h>
7050 #endif
7051 int main(int argc, char *argv[]) {
7052         exit(0);}
7053 EOCP
7054 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7055         echo "Your C compiler appears to support function prototypes."
7056         val="$define"
7057 else
7058         echo "Your C compiler doesn't seem to understand function prototypes."
7059         val="$undef"
7060 fi
7061 set prototype
7062 eval $setvar
7063 $rm -f prototype*
7064
7065 : Check if ansi2knr is required
7066 case "$prototype" in
7067 "$define") ;;
7068 *)      ansi2knr='ansi2knr'
7069         echo " "
7070         cat <<EOM >&4
7071
7072 $me:  FATAL ERROR:
7073 This version of $package can only be compiled by a compiler that 
7074 understands function prototypes.  Unfortunately, your C compiler 
7075         $cc $ccflags
7076 doesn't seem to understand them.  Sorry about that.
7077
7078 If GNU cc is available for your system, perhaps you could try that instead.  
7079
7080 Eventually, we hope to support building Perl with pre-ANSI compilers.
7081 If you would like to help in that effort, please contact <perlbug@perl.org>.
7082
7083 Aborting Configure now.
7084 EOM
7085         exit 2
7086         ;;
7087 esac
7088
7089 : DTrace support
7090 dflt_dtrace='/usr/sbin/dtrace'
7091 cat <<EOM
7092
7093 Perl can be built to support DTrace on platforms that support it.
7094 DTrace is a diagnosis and performance analysis tool from Sun.
7095
7096 If this doesn't make any sense to you, just accept the default '$dflt'.
7097 EOM
7098
7099 while $test 1 ; do
7100         case "$usedtrace" in
7101         $define|true|[yY]*)
7102                 dflt='y'
7103                 ;;
7104         ?*)
7105                 dflt='y'
7106                 dflt_dtrace=$usedtrace
7107                 ;;
7108         *)
7109                 dflt='n'
7110                 ;;
7111         esac
7112
7113         rp='Support DTrace if available?'
7114         . ./myread
7115         case "$ans" in
7116         y|Y)    val="$define" ;;
7117         *)      val="$undef" ;;
7118         esac
7119         set usedtrace
7120         eval $setvar
7121
7122         test "X$usedtrace" != "X$define" && break
7123
7124         echo " "
7125         rp='Where is the dtrace executable?'
7126         dflt=$dflt_dtrace
7127         . ./getfile
7128         val="$ans"
7129         set dtrace
7130         eval $setvar
7131
7132         if $test -f $dtrace
7133         then
7134                 if $dtrace -h -s ../perldtrace.d \
7135                         -o perldtrace.tmp >/dev/null 2>&1 \
7136                         && rm -f perldtrace.tmp
7137                 then
7138                         echo " "
7139                         echo "Good: your $dtrace knows about the -h flag."
7140                 else
7141                         cat >&2 <<EOM
7142
7143 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7144 ***
7145 *** Your installed dtrace doesn't support the -h switch to compile a D
7146 *** program into a C header. Can't continue.
7147
7148 EOM
7149                         exit 1
7150                 fi
7151                 break;
7152         fi
7153
7154         case "$fastread" in
7155         yes)
7156                 cat >&2 <<EOM
7157
7158 *** $me:  Fatal Error:  $dtrace not found.
7159 *** Can't continue.
7160
7161 EOM
7162                 exit 1
7163                 ;;
7164         *)
7165                 echo "*** $dtrace was not found."
7166                 echo " "
7167                 ;;
7168         esac
7169 done
7170
7171 : See if we want extra modules installed
7172 echo " "
7173 case "$extras" in
7174 '') dflt='n';;
7175 *) dflt='y';;
7176 esac
7177 cat <<EOM
7178 Perl can be built with extra modules or bundles of modules which
7179 will be fetched from the CPAN and installed alongside Perl.
7180
7181 Notice that you will need access to the CPAN; either via the Internet,
7182 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7183 be asked later to configure the CPAN.pm module which will in turn do
7184 the installation of the rest of the extra modules or bundles.)
7185
7186 Notice also that if the modules require any external software such as
7187 libraries and headers (the libz library and the zlib.h header for the
7188 Compress::Zlib module, for example) you MUST have any such software
7189 already installed, this configuration process will NOT install such
7190 things for you.
7191
7192 If this doesn't make any sense to you, just accept the default '$dflt'.
7193 EOM
7194 rp='Install any extra modules (y or n)?'
7195 . ./myread
7196 case "$ans" in
7197 y|Y)
7198         cat <<EOM
7199
7200 Please list any extra modules or bundles to be installed from CPAN,
7201 with spaces between the names.  The names can be in any format the
7202 'install' command of CPAN.pm will understand.  (Answer 'none',
7203 without the quotes, to install no extra modules or bundles.)
7204 EOM
7205         rp='Extras?'
7206         dflt="$extras"
7207         . ./myread
7208         extras="$ans"
7209 esac
7210 case "$extras" in
7211 ''|'none')
7212         val=''
7213         $rm -f ../extras.lst
7214         ;;
7215 *)      echo "(Saving the list of extras for later...)"
7216         echo "$extras" > ../extras.lst
7217         val="'$extras'"
7218         ;;
7219 esac
7220 set extras
7221 eval $setvar
7222 echo " "
7223
7224 : determine where html pages for programs go
7225 set html1dir html1dir none
7226 eval $prefixit
7227 $cat <<EOM
7228
7229 If you wish to install html files for programs in $spackage, indicate
7230 the appropriate directory here.  To skip installing html files,
7231 answer "none".
7232 EOM
7233 case "$html1dir" in
7234 ''|none|$undef|' ') dflt=none ;;
7235 *) dflt=$html1dir ;;
7236 esac
7237 fn=dn+~
7238 rp="Directory for the main $spackage html pages?"
7239 . ./getfile
7240 prefixvar=html1dir
7241 . ./setprefixvar
7242 : Use ' ' for none so value is preserved next time through Configure
7243 $test X"$html1dir" = "X" && html1dir=' '
7244
7245 : determine where html pages for libraries and modules go
7246 set html3dir html3dir none
7247 eval $prefixit
7248 $cat <<EOM
7249
7250 If you wish to install html files for modules associated with $spackage,
7251 indicate the appropriate directory here.  To skip installing html files,
7252 answer "none".
7253 EOM
7254 : There is no obvious default.  If they have specified html1dir, then
7255 : try to key off that, possibly changing .../html1 into .../html3.
7256 case "$html3dir" in
7257 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7258 *) dflt=$html3dir ;;
7259 esac
7260 fn=dn+~
7261 rp="Directory for the $spackage module html pages?"
7262 . ./getfile
7263 prefixvar=html3dir
7264 . ./setprefixvar
7265 : Use ' ' for none so value is preserved next time through Configure
7266 $test X"$html3dir" = "X" && html3dir=' '
7267
7268 : determine whether to install perl also as /usr/bin/perl
7269
7270 echo " "
7271 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7272         $cat <<EOM
7273 Many scripts expect perl to be installed as /usr/bin/perl.
7274
7275 If you want to, I can install the perl you are about to compile
7276 as /usr/bin/perl (in addition to $bin/perl).
7277 EOM
7278         if test -f /usr/bin/perl; then
7279             $cat <<EOM
7280
7281 However, please note that because you already have a /usr/bin/perl,
7282 overwriting that with a new Perl would very probably cause problems.
7283 Therefore I'm assuming you don't want to do that (unless you insist).
7284
7285 EOM
7286             case "$installusrbinperl" in
7287             "$define"|[yY]*)    dflt='y';;
7288             *)                  dflt='n';;
7289             esac
7290         else
7291             $cat <<EOM
7292
7293 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7294
7295 EOM
7296             case "$installusrbinperl" in
7297             "$undef"|[nN]*)     dflt='n';;
7298             *)                  dflt='y';;
7299             esac
7300         fi
7301         rp="Do you want to install perl as /usr/bin/perl?"
7302         . ./myread
7303         case "$ans" in
7304         [yY]*)  val="$define";;
7305         *)      val="$undef" ;;
7306         esac
7307 else
7308         val="$undef"
7309 fi
7310 set installusrbinperl
7311 eval $setvar
7312
7313 : Check if we are using the GNU C library
7314 echo " "
7315 echo "Checking for GNU C Library..." >&4
7316 cat >try.c <<'EOCP'
7317 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7318    alone are insufficient to distinguish different versions, such as
7319    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7320    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7321 */
7322 #include <stdio.h>
7323 int main(void)
7324 {
7325 #ifdef __GLIBC__
7326 #   ifdef __GLIBC_MINOR__
7327 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7328 #           include <gnu/libc-version.h>
7329             printf("%s\n",  gnu_get_libc_version());
7330 #       else
7331             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7332 #       endif
7333 #   else
7334         printf("%d\n",  __GLIBC__);
7335 #   endif
7336     return 0;
7337 #else
7338     return 1;
7339 #endif
7340 }
7341 EOCP
7342 set try
7343 if eval $compile_ok && $run ./try > glibc.ver; then
7344         val="$define"
7345         gnulibc_version=`$cat glibc.ver`
7346         echo "You are using the GNU C Library version $gnulibc_version"
7347 else
7348         val="$undef"
7349         gnulibc_version=''
7350         echo "You are not using the GNU C Library"
7351 fi
7352 $rm_try glibc.ver
7353 set d_gnulibc
7354 eval $setvar
7355
7356 : see if nm is to be used to determine whether a symbol is defined or not
7357 case "$usenm" in
7358 '')
7359         dflt=''
7360         case "$d_gnulibc" in
7361         "$define")
7362                 echo " "
7363                 echo "nm probably won't work on the GNU C Library." >&4
7364                 dflt=n
7365                 ;;
7366         esac
7367         case "$dflt" in
7368         '') 
7369                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7370                         echo " "
7371                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7372                         echo "'nm' won't be sufficient on this sytem." >&4
7373                         dflt=n
7374                 fi
7375                 ;;
7376         esac
7377         case "$dflt" in
7378         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7379                 if $test $dflt -gt 20; then
7380                         dflt=y
7381                 else
7382                         dflt=n
7383                 fi
7384                 ;;
7385         esac
7386         ;;
7387 *)
7388         case "$usenm" in
7389         true|$define) dflt=y;;
7390         *) dflt=n;;
7391         esac
7392         ;;
7393 esac
7394 $cat <<EOM
7395
7396 I can use $nm to extract the symbols from your C libraries. This
7397 is a time consuming task which may generate huge output on the disk (up
7398 to 3 megabytes) but that should make the symbols extraction faster. The
7399 alternative is to skip the 'nm' extraction part and to compile a small
7400 test program instead to determine whether each symbol is present. If
7401 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7402 this may be the best solution.
7403
7404 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7405
7406 EOM
7407 rp="Shall I use $nm to extract C symbols from the libraries?"
7408 . ./myread
7409 case "$ans" in
7410 [Nn]*) usenm=false;;
7411 *) usenm=true;;
7412 esac
7413
7414 runnm=$usenm
7415 case "$reuseval" in
7416 true) runnm=false;;
7417 esac
7418
7419 : nm options which may be necessary
7420 case "$nm_opt" in
7421 '') if $test -f /mach_boot; then
7422                 nm_opt=''       # Mach
7423         elif $test -d /usr/ccs/lib; then
7424                 nm_opt='-p'     # Solaris (and SunOS?)
7425         elif $test -f /dgux; then
7426                 nm_opt='-p'     # DG-UX
7427         elif $test -f /lib64/rld; then
7428                 nm_opt='-p'     # 64-bit Irix
7429         else
7430                 nm_opt=''
7431         fi;;
7432 esac
7433
7434 : nm options which may be necessary for shared libraries but illegal
7435 : for archive libraries.  Thank you, Linux.
7436 case "$nm_so_opt" in
7437 '')     case "$myuname" in
7438         *linux*|gnu*)
7439                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7440                         nm_so_opt='--dynamic'
7441                 fi
7442                 ;;
7443         esac
7444         ;;
7445 esac
7446
7447 : get list of predefined functions in a handy place
7448 case "$runnm" in
7449 true)
7450 echo " "
7451 case "$libc" in
7452 '') libc=unknown
7453         case "$libs" in
7454         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7455         esac
7456         ;;
7457 esac
7458 case "$libs" in
7459 '') ;;
7460 *)  for thislib in $libs; do
7461         case "$thislib" in
7462         -lc|-lc_s)
7463                 : Handle C library specially below.
7464                 ;;
7465         -l*)
7466                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7467                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7468                         :
7469                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7470                         :
7471                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7472                         :
7473                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7474                         :
7475                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7476                         :
7477                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7478                         :
7479                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7480                         :
7481                 else
7482                         try=''
7483                 fi
7484                 libnames="$libnames $try"
7485                 ;;
7486         *) libnames="$libnames $thislib" ;;
7487         esac
7488         done
7489         ;;
7490 esac
7491 xxx=normal
7492 case "$libc" in
7493 unknown)
7494         set /lib/libc.$so
7495         for xxx in $libpth; do
7496                 $test -r $1 || set $xxx/libc.$so
7497                 : The messy sed command sorts on library version numbers.
7498                 $test -r $1 || \
7499                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7500                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7501                                 h
7502                                 s/[0-9][0-9]*/0000&/g
7503                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7504                                 G
7505                                 s/\n/ /' | \
7506                          $sort | $sed -e 's/^.* //'`
7507                 eval set \$$#
7508         done
7509         $test -r $1 || set /usr/ccs/lib/libc.$so
7510         $test -r $1 || set /lib/libsys_s$_a
7511         ;;
7512 *)
7513         set blurfl
7514         ;;
7515 esac
7516 if $test -r "$1"; then
7517         echo "Your (shared) C library seems to be in $1."
7518         libc="$1"
7519 elif $test -r /lib/libc && $test -r /lib/clib; then
7520         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7521         xxx=apollo
7522         libc='/lib/clib /lib/libc'
7523         if $test -r /lib/syslib; then
7524                 echo "(Your math library is in /lib/syslib.)"
7525                 libc="$libc /lib/syslib"
7526         fi
7527 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7528         echo "Your C library seems to be in $libc, as you said before."
7529 elif $test -r $incpath/usr/lib/libc$_a; then
7530         libc=$incpath/usr/lib/libc$_a;
7531         echo "Your C library seems to be in $libc.  That's fine."
7532 elif $test -r /lib/libc$_a; then
7533         libc=/lib/libc$_a;
7534         echo "Your C library seems to be in $libc.  You're normal."
7535 else
7536         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7537                 :
7538         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7539                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7540         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7541                 :
7542         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7543                 :
7544         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7545                 :
7546         else
7547                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7548         fi
7549         if $test -r "$tans"; then
7550                 echo "Your C library seems to be in $tans, of all places."
7551                 libc=$tans
7552         else
7553                 libc='blurfl'
7554         fi
7555 fi
7556 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7557         dflt="$libc"
7558         cat <<EOM
7559
7560 If the guess above is wrong (which it might be if you're using a strange
7561 compiler, or your machine supports multiple models), you can override it here.
7562
7563 EOM
7564 else
7565         dflt=''
7566         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7567         cat >&4 <<EOM
7568 I can't seem to find your C library.  I've looked in the following places:
7569
7570 EOM
7571         $sed 's/^/      /' libpath
7572         cat <<EOM
7573
7574 None of these seems to contain your C library. I need to get its name...
7575
7576 EOM
7577 fi
7578 fn=f
7579 rp='Where is your C library?'
7580 . ./getfile
7581 libc="$ans"
7582
7583 echo " "
7584 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7585 set X `cat libnames`
7586 shift
7587 xxx=files
7588 case $# in 1) xxx=file; esac
7589 echo "Extracting names from the following $xxx for later perusal:" >&4
7590 echo " "
7591 $sed 's/^/      /' libnames >&4
7592 echo " "
7593 $echo $n "This may take a while...$c" >&4
7594
7595 for file in $*; do
7596         case $file in
7597         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7598         *) $nm $nm_opt $file 2>/dev/null;;
7599         esac
7600 done >libc.tmp
7601
7602 $echo $n ".$c"
7603 $grep fprintf libc.tmp > libc.ptf
7604 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7605 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7606 xxx='[ADTSIW]'
7607 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7608         eval $xscan;\
7609         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7610                 eval $xrun
7611 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7612         eval $xscan;\
7613         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7614                 eval $xrun
7615 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7616         eval $xscan;\
7617         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7618                 eval $xrun
7619 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7620         eval $xscan;\
7621         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7622                 eval $xrun
7623 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7624         eval $xscan;\
7625         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7626                 eval $xrun
7627 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7628         eval $xscan;\
7629         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7630                 eval $xrun
7631 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7632                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7633         eval $xscan;\
7634         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7635                 eval $xrun
7636 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7637         eval $xscan;\
7638         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7639                 eval $xrun
7640 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7641         eval $xscan;\
7642         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7643                 eval $xrun
7644 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7645         eval $xscan;\
7646         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7647                 eval $xrun
7648 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7649         eval $xscan;\
7650         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7651                 eval $xrun
7652 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7653         eval $xscan;\
7654         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7655                 eval $xrun
7656 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7657         eval $xscan;\
7658         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7659                 eval $xrun
7660 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7661         eval $xscan;\
7662         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7663                 eval $xrun
7664 else
7665         $nm -p $* 2>/dev/null >libc.tmp
7666         $grep fprintf libc.tmp > libc.ptf
7667         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7668                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7669         then
7670                 nm_opt='-p'
7671                 eval $xrun
7672         else
7673                 echo " "
7674                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7675                 com=''
7676                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7677                         for thisname in $libnames $libc; do
7678                                 $ar t $thisname >>libc.tmp
7679                         done
7680                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7681                         echo "Ok." >&4
7682                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7683                         # Repeat libc to extract forwarders to DLL entries too
7684                         for thisname in $libnames $libc; do
7685                                 $ar tv $thisname >>libc.tmp
7686                                 # Revision 50 of EMX has bug in $ar.
7687                                 # it will not extract forwarders to DLL entries
7688                                 # Use emximp which will extract exactly them.
7689                                 emximp -o tmp.imp $thisname \
7690                                     2>/dev/null && \
7691                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7692                                     < tmp.imp >>libc.tmp
7693                                 $rm tmp.imp
7694                         done
7695                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7696                         echo "Ok." >&4
7697                 else
7698                         echo "$ar didn't seem to work right." >&4
7699                         echo "Maybe this is a Cray...trying bld instead..." >&4
7700                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7701                         then
7702                                 for thisname in $libnames; do
7703                                         bld t $libnames | \
7704                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7705                                         $ar t $thisname >>libc.tmp
7706                                 done
7707                                 echo "Ok." >&4
7708                         else
7709                                 echo "That didn't work either.  Giving up." >&4
7710                                 exit 1
7711                         fi
7712                 fi
7713         fi
7714 fi
7715 nm_extract="$com"
7716 case "$PASE" in
7717 define)
7718     echo " "
7719     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7720     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7721     ;;
7722 *)  if $test -f /lib/syscalls.exp; then
7723         echo " "
7724         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7725         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7726     fi
7727     ;;
7728 esac
7729 ;;
7730 esac
7731 $rm -f libnames libpath
7732
7733 : see if dld is available
7734 set dld.h i_dld
7735 eval $inhdr
7736
7737 : Check if we are using C++
7738 echo " "
7739 echo "Checking for C++..." >&4
7740 $cat >try.c <<'EOCP'
7741 #include <stdio.h>
7742 int main(void)
7743 {
7744 #ifdef __cplusplus
7745     return 0;
7746 #else
7747     return 1;
7748 #endif
7749 }
7750 EOCP
7751 set try
7752 if eval $compile_ok && $run ./try; then
7753         val="$define"
7754         echo "You are using a C++ compiler."
7755 else
7756         val="$undef"
7757         echo "You are not using a C++ compiler."
7758 fi
7759 $rm_try cplusplus$$
7760 set d_cplusplus
7761 eval $setvar
7762
7763 : is a C symbol defined?
7764 csym='tlook=$1;
7765 case "$3" in
7766 -v) tf=libc.tmp; tdc="";;
7767 -a) tf=libc.tmp; tdc="[]";;
7768 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7769 esac;
7770 tx=yes;
7771 case "$reuseval-$4" in
7772 true-) ;;
7773 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7774 esac;
7775 case "$tx" in
7776 yes)
7777         tval=false;
7778         case "$d_cplusplus" in
7779                 $define) extern_C=\"C\";;
7780         esac;
7781         if $test "$runnm" = true; then
7782                 if $contains $tlook $tf >/dev/null 2>&1; then
7783                         tval=true;
7784                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7785                         echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7786                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7787                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7788                         $rm_try;
7789                 fi;
7790         else
7791                 echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7792                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7793                 $rm_try;
7794         fi;
7795         ;;
7796 *)
7797         case "$tval" in
7798         $define) tval=true;;
7799         *) tval=false;;
7800         esac;
7801         ;;
7802 esac;
7803 eval "$2=$tval"'
7804
7805 : define an is-in-libc? function
7806 inlibc='echo " "; td=$define; tu=$undef;
7807 sym=$1; var=$2; eval "was=\$$2";
7808 tx=yes;
7809 case "$reuseval$was" in
7810 true) ;;
7811 true*) tx=no;;
7812 esac;
7813 case "$tx" in
7814 yes)
7815         set $sym tres -f;
7816         eval $csym;
7817         case "$tres" in
7818         true)
7819                 echo "$sym() found." >&4;
7820                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7821         *)
7822                 echo "$sym() NOT found." >&4;
7823                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7824         esac;;
7825 *)
7826         case "$was" in
7827         $define) echo "$sym() found." >&4;;
7828         *) echo "$sym() NOT found." >&4;;
7829         esac;;
7830 esac'
7831
7832 : see if dlopen exists
7833 xxx_runnm="$runnm"
7834 xxx_ccflags="$ccflags"
7835 runnm=false
7836 : with g++ one needs -shared to get is-in-libc to work for dlopen
7837 case "$gccversion" in
7838 '')     ;;
7839 *)      case "$d_cplusplus" in
7840         "$define") ccflags="$ccflags -shared" ;;
7841         esac
7842         ;;
7843 esac
7844 set dlopen d_dlopen
7845 eval $inlibc
7846 runnm="$xxx_runnm"
7847 ccflags="$xxx_ccflags"
7848
7849 : see if this is a unistd.h system
7850 set unistd.h i_unistd
7851 eval $inhdr
7852
7853 : determine which dynamic loading, if any, to compile in
7854 echo " "
7855 dldir="ext/DynaLoader"
7856 case "$usedl" in
7857 $define|y|true)
7858         dflt='y'
7859         usedl="$define"
7860         ;;
7861 $undef|n|false)
7862         dflt='n'
7863         usedl="$undef"
7864         ;;
7865 *)
7866         dflt='n'
7867         case "$d_dlopen" in
7868             $define) dflt='y' ;;
7869         esac
7870         case "$i_dld" in
7871             $define) dflt='y' ;;
7872         esac
7873         : Does a dl_xxx.xs file exist for this operating system
7874         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7875         ;;
7876 esac
7877 rp="Do you wish to use dynamic loading?"
7878 . ./myread
7879 usedl="$ans"
7880 case "$ans" in
7881 y*) usedl="$define"
7882         case "$dlsrc" in
7883         '')
7884                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7885                         dflt="$dldir/dl_${osname}.xs"
7886                 elif $test "$d_dlopen" = "$define" ; then
7887                         dflt="$dldir/dl_dlopen.xs"
7888                 elif $test "$i_dld" = "$define" ; then
7889                         dflt="$dldir/dl_dld.xs"
7890                 else
7891                         dflt=''
7892                 fi
7893                 ;;
7894         *)      dflt="$dldir/$dlsrc"
7895                 ;;
7896         esac
7897     echo "The following dynamic loading files are available:"
7898         : Can not go over to $dldir because getfile has path hard-coded in.
7899         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7900         rp="Source file to use for dynamic loading"
7901         fn="fne"
7902         gfpth="$src"
7903         . ./getfile
7904         usedl="$define"
7905         : emulate basename
7906         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7907
7908         $cat << EOM
7909
7910 Some systems may require passing special flags to $cc -c to
7911 compile modules that will be used to create a shared library.
7912 To use no flags, say "none".
7913
7914 EOM
7915     case "$cccdlflags" in
7916     '') case "$gccversion" in
7917                 '') case "$osname" in
7918                         hpux)   dflt='+z' ;;
7919                         next)   dflt='none' ;;
7920                         irix*)  dflt='-KPIC' ;;
7921                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7922                         sunos)  dflt='-pic' ;;
7923                         *)      dflt='none' ;;
7924                     esac
7925                         ;;
7926                 *)  case "$osname" in
7927                         darwin) dflt='none' ;;
7928                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7929                         *)      dflt='-fpic' ;;
7930                     esac ;;
7931             esac ;;
7932         ' ') dflt='none' ;;
7933     *)  dflt="$cccdlflags" ;;
7934     esac
7935     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7936     . ./myread
7937     case "$ans" in
7938     none) cccdlflags=' ' ;;
7939     *) cccdlflags="$ans" ;;
7940     esac
7941
7942     cat << EOM
7943
7944 Some systems use ld to create libraries that can be dynamically loaded,
7945 while other systems (such as those using ELF) use $cc.
7946
7947 EOM
7948         case "$ld" in
7949         '')     $cat >try.c <<EOM
7950 /* Test for whether ELF binaries are produced */
7951 #include <fcntl.h>
7952 #$i_stdlib I_STDLIB
7953 #ifdef I_STDLIB
7954 #include <stdlib.h>
7955 #endif
7956 #$i_unistd I_UNISTD
7957 #ifdef I_UNISTD
7958 #include <unistd.h>
7959 #endif
7960 int main() {
7961         char b[4];
7962         int i = open("a.out",O_RDONLY);
7963         if(i == -1)
7964                 exit(1); /* fail */
7965         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7966                 exit(0); /* succeed (yes, it's ELF) */
7967         else
7968                 exit(1); /* fail */
7969 }
7970 EOM
7971                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7972                         cat <<EOM
7973 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7974 EOM
7975                         dflt="$cc"
7976                 else
7977                         echo "I'll use ld to build dynamic libraries."
7978                         dflt='ld'
7979                 fi
7980                 $rm_try
7981                 ;;
7982         *)      dflt="$ld"
7983                 ;;
7984         esac
7985
7986     rp="What command should be used to create dynamic libraries?"
7987     . ./myread
7988         ld="$ans"
7989
7990     cat << EOM
7991
7992 Some systems may require passing special flags to $ld to create a
7993 library that can be dynamically loaded.  If your ld flags include
7994 -L/other/path options to locate libraries outside your loader's normal
7995 search path, you may need to specify those -L options here as well.  To
7996 use no flags, say "none".
7997
7998 EOM
7999     case "$lddlflags" in
8000     '') case "$osname" in
8001                         beos) dflt='-nostart' ;;
8002                         hpux) dflt='-b';
8003                               case "$gccversion" in
8004                               '') dflt="$dflt +vnocompatwarnings" ;;
8005                               esac
8006                               ;;
8007                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
8008                         next)  dflt='none' ;;
8009                         solaris) dflt='-G' ;;
8010                         sunos) dflt='-assert nodefinitions' ;;
8011                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8012                 *)     dflt='none' ;;
8013                         esac
8014                         ;;
8015     *) dflt="$lddlflags" ;;
8016     esac
8017
8018         : Try to guess additional flags to pick up local libraries.
8019         : Be careful not to append to a plain 'none'
8020         case "$dflt" in
8021         none) dflt='' ;;
8022         esac
8023         for thisflag in $ldflags; do
8024                 case "$thisflag" in
8025                 -L*|-R*|-Wl,-R*)
8026                         case " $dflt " in
8027                         *" $thisflag "*) ;;
8028                         *) dflt="$dflt $thisflag" ;;
8029                         esac
8030                         ;;
8031                 esac
8032         done
8033
8034         case "$dflt" in
8035         ''|' ') dflt='none' ;;
8036         esac
8037
8038         case "$ldflags" in
8039         *-fstack-protector*)
8040             case "$dflt" in
8041                         *-fstack-protector*) ;; # Don't add it again
8042                         *) dflt="$dflt -fstack-protector" ;; 
8043                 esac
8044                 ;;
8045         esac
8046
8047
8048     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8049     . ./myread
8050     case "$ans" in
8051     none) lddlflags=' ' ;;
8052     *) lddlflags="$ans" ;;
8053     esac
8054
8055         cat <<EOM
8056
8057 Some systems may require passing special flags to $cc to indicate that
8058 the resulting executable will use dynamic linking.  To use no flags,
8059 say "none".
8060
8061 EOM
8062     case "$ccdlflags" in
8063     '') case "$osname" in
8064             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8065             next|sunos) dflt='none' ;;
8066             *)          dflt='none' ;;
8067             esac ;;
8068     ' ')  dflt='none' ;;
8069     *)  dflt="$ccdlflags" ;;
8070     esac
8071     rp="Any special flags to pass to $cc to use dynamic linking?"
8072     . ./myread
8073     case "$ans" in
8074     none) ccdlflags=' ' ;;
8075     *) ccdlflags="$ans" ;;
8076     esac
8077     ;;
8078 *)  usedl="$undef"
8079         ld='ld'
8080     dlsrc='dl_none.xs'
8081     lddlflags=''
8082     ccdlflags=''
8083     ;;
8084 esac
8085
8086 : Do we want a shared libperl?
8087 also=''
8088 case "$usedl" in
8089 $undef)
8090         # No dynamic loading being used, so don't bother even to prompt.
8091         useshrplib='false'
8092         ;;
8093 *)      case "$useshrplib" in
8094         '')     case "$osname" in
8095                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
8096                         dflt=y
8097                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8098                         ;;
8099                 next*)
8100                         case "$osvers" in
8101                         4*)     dflt=y
8102                                 also='Building a shared libperl is needed for MAB support.'
8103                                 ;;
8104                         *)      dflt=n
8105                                 ;;
8106                         esac
8107                         ;;
8108                 *)      dflt=n
8109                         ;;
8110                 esac
8111                 ;;
8112         $define|true|[Yy]*)
8113                 dflt=y
8114                 ;;
8115         *)      dflt=n
8116                 ;;
8117         esac
8118         $cat << EOM
8119
8120 The perl executable is normally obtained by linking perlmain.c with
8121 libperl${_a}, any static extensions (usually just DynaLoader), and
8122 any other libraries needed on this system (such as -lm, etc.).  Since
8123 your system supports dynamic loading, it is probably possible to build
8124 a shared libperl.$so.  If you will have more than one executable linked
8125 to libperl.$so, this will significantly reduce the size of each
8126 executable, but it may have a noticeable effect on performance.  The
8127 default is probably sensible for your system.
8128 $also
8129
8130 EOM
8131         rp="Build a shared libperl.$so (y/n)"
8132         . ./myread
8133         case "$ans" in
8134         true|$define|[Yy]*)
8135                 useshrplib='true'  ;;
8136         *)      useshrplib='false' ;;
8137         esac
8138         ;;
8139 esac
8140
8141 case "$useshrplib" in
8142 true)
8143         case "$libperl" in
8144         '')
8145                 # Figure out a good name for libperl.so.  Since it gets stored in
8146                 # a version-specific architecture-dependent library, the version
8147                 # number isn't really that important, except for making cc/ld happy.
8148                 #
8149                 # A name such as libperl.so.3.1
8150                 majmin="libperl.$so.$patchlevel.$subversion"
8151                 # A name such as libperl.so.301
8152                 majonly=`echo $patchlevel $subversion |
8153                         $awk '{printf "%d%02d", $1, $2}'`
8154                 majonly=libperl.$so.$majonly
8155                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8156                 # rely on figuring it out from the naming of libc.
8157                 case "${osname}${osvers}" in
8158                 next4*)
8159                         dflt=libperl.5.$so
8160                         # XXX How handle the --version stuff for MAB?
8161                         ;;
8162                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8163                         dflt=libperl.$so
8164                         ;;
8165                 cygwin*) # ld links against an importlib
8166                         dflt=libperl$lib_ext
8167                         ;;
8168                 *)      # Try to guess based on whether libc has major.minor.
8169                         case "$libc" in
8170                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8171                         *libc.$so.[0-9]*) dflt=$majonly ;;
8172                         *)      dflt=libperl.$so ;;
8173                         esac
8174                         ;;
8175                 esac
8176                 ;;
8177         *)      dflt=$libperl
8178                 ;;
8179         esac
8180         cat << EOM
8181
8182 I need to select a good name for the shared libperl.  If your system uses
8183 library names with major and minor numbers, then you might want something
8184 like $majmin.  Alternatively, if your system uses a single version
8185 number for shared libraries, then you might want to use $majonly.
8186 Or, your system might be quite happy with a simple libperl.$so.
8187
8188 Since the shared libperl will get installed into a version-specific
8189 architecture-dependent directory, the version number of the shared perl
8190 library probably isn't important, so the default should be o.k.
8191
8192 EOM
8193         rp='What name do you want to give to the shared libperl?'
8194         . ./myread
8195         libperl=$ans
8196         echo "Ok, I'll use $libperl"
8197         ;;
8198 *)
8199         libperl="libperl${_a}"
8200         ;;
8201 esac
8202
8203 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8204 case "$shrpdir" in
8205 '') ;;
8206 *)      $cat >&4 <<EOM
8207 WARNING:  Use of the shrpdir variable for the installation location of
8208 the shared $libperl is not supported.  It was never documented and
8209 will not work in this version.  Let me (perlbug@perl.org)
8210 know of any problems this may cause.
8211
8212 EOM
8213         case "$shrpdir" in
8214         "$archlibexp/CORE")
8215                 $cat >&4 <<EOM
8216 But your current setting of $shrpdir is
8217 the default anyway, so it's harmless.
8218 EOM
8219                 ;;
8220         *)
8221                 $cat >&4 <<EOM
8222 Further, your current attempted setting of $shrpdir
8223 conflicts with the value of $archlibexp/CORE
8224 that installperl will use.
8225 EOM
8226                 ;;
8227         esac
8228         ;;
8229 esac
8230
8231 # How will the perl executable find the installed shared $libperl?
8232 # Add $xxx to ccdlflags.
8233 # If we can't figure out a command-line option, use $shrpenv to
8234 # set env LD_RUN_PATH.  The main perl makefile uses this.
8235 shrpdir=$archlibexp/CORE
8236 xxx=''
8237 tmp_shrpenv=''
8238 if "$useshrplib"; then
8239     case "$osname" in
8240         aix)
8241                 # We'll set it in Makefile.SH...
8242                 ;;
8243         solaris)
8244                 xxx="-R $shrpdir"
8245                 ;;
8246         freebsd|netbsd|openbsd|interix|dragonfly)
8247                 xxx="-Wl,-R$shrpdir"
8248                 ;;
8249         bsdos|linux|irix*|dec_osf|gnu*)
8250                 xxx="-Wl,-rpath,$shrpdir"
8251                 ;;
8252         next)
8253                 # next doesn't like the default...
8254                 ;;
8255         beos)
8256                 # beos doesn't like the default, either.
8257                 ;;
8258         hpux*)
8259                 # hpux doesn't like the default, either.
8260                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8261                 ;;
8262         *)
8263                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8264                 ;;
8265         esac
8266         case "$xxx" in
8267         '') ;;
8268         *)
8269                 # Only add $xxx if it isn't already in ccdlflags.
8270                 case " $ccdlflags " in
8271                 *" $xxx "*)     ;;
8272                 *)      ccdlflags="$ccdlflags $xxx"
8273                         cat <<EOM >&4
8274
8275 Adding $xxx to the flags
8276 passed to $ld so that the perl executable will find the
8277 installed shared $libperl.
8278
8279 EOM
8280                         ;;
8281                 esac
8282                 ;;
8283         esac
8284 fi
8285 # Fix ccdlflags in AIX for building external extensions.
8286 # (For building Perl itself bare -bE:perl.exp is needed,
8287 #  Makefile.SH takes care of this.)
8288 case "$osname" in
8289 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8290 esac
8291 # Respect a hint or command-line value.
8292 case "$shrpenv" in
8293 '') shrpenv="$tmp_shrpenv" ;;
8294 esac
8295 case "$ldlibpthname" in
8296 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8297 none)   ldlibpthname='' ;;
8298 esac
8299
8300 : determine where manual pages are on this system
8301 echo " "
8302 case "$sysman" in
8303 '') 
8304         syspath='/usr/share/man/man1 /usr/man/man1'
8305         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8306         syspath="$syspath /usr/man/u_man/man1"
8307         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8308         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8309         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8310         sysman=`./loc . /usr/man/man1 $syspath`
8311         ;;
8312 esac
8313 if $test -d "$sysman"; then
8314         echo "System manual is in $sysman." >&4
8315 else
8316         echo "Could not find manual pages in source form." >&4
8317 fi
8318
8319 : determine where manual pages go
8320 set man1dir man1dir none
8321 eval $prefixit
8322 $cat <<EOM
8323
8324 $spackage has manual pages available in source form.
8325 EOM
8326 case "$nroff" in
8327 nroff)
8328         echo "However, you don't have nroff, so they're probably useless to you."
8329         case "$man1dir" in
8330         '') man1dir="none";;
8331         esac;;
8332 esac
8333 echo "If you don't want the manual sources installed, answer 'none'."
8334 case "$man1dir" in
8335 ' ') dflt=none
8336         ;;
8337 '')
8338         lookpath="$prefixexp/share/man/man1"
8339         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8340         lookpath="$lookpath $prefixexp/man/p_man/man1"
8341         lookpath="$lookpath $prefixexp/man/u_man/man1"
8342         lookpath="$lookpath $prefixexp/man/man.1"
8343         case "$sysman" in
8344         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8345         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8346         esac
8347         set dflt
8348         eval $prefixup
8349         ;;
8350 *)  dflt="$man1dir"
8351         ;;
8352 esac
8353 echo " "
8354 fn=dn+~
8355 rp="Where do the main $spackage manual pages (source) go?"
8356 . ./getfile
8357 if $test "X$man1direxp" != "X$ansexp"; then
8358         installman1dir=''
8359 fi
8360 prefixvar=man1dir
8361 . ./setprefixvar
8362
8363 case "$man1dir" in
8364 '')     man1dir=' '
8365         installman1dir='';;
8366 esac
8367
8368 : What suffix to use on installed man pages
8369
8370 case "$man1dir" in
8371 ' ')
8372         man1ext='0'
8373         ;;
8374 *)
8375         rp="What suffix should be used for the main $spackage man pages?"
8376         case "$man1ext" in
8377         '')     case "$man1dir" in
8378                 *1)  dflt=1 ;;
8379                 *1p) dflt=1p ;;
8380                 *1pm) dflt=1pm ;;
8381                 *l) dflt=l;;
8382                 *n) dflt=n;;
8383                 *o) dflt=o;;
8384                 *p) dflt=p;;
8385                 *C) dflt=C;;
8386                 *L) dflt=L;;
8387                 *L1) dflt=L1;;
8388                 *) dflt=1;;
8389                 esac
8390                 ;;
8391         *)      dflt="$man1ext";;
8392         esac
8393         . ./myread
8394         man1ext="$ans"
8395         ;;
8396 esac
8397
8398 : see if we can have long filenames
8399 echo " "
8400 first=123456789abcdef
8401 $rm -f $first
8402 if (echo hi >$first) 2>/dev/null; then
8403         if $test -f 123456789abcde; then
8404                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8405                 val="$undef"
8406         else
8407                 echo 'You can have filenames longer than 14 characters.'>&4
8408                 val="$define"
8409         fi
8410 else
8411         $cat <<'EOM'
8412 You can't have filenames longer than 14 chars.
8413 You can't even think about them!
8414 EOM
8415         val="$undef"
8416 fi
8417 set d_flexfnam
8418 eval $setvar
8419 $rm -rf 123456789abcde*
8420
8421 : determine where library module manual pages go
8422 set man3dir man3dir none
8423 eval $prefixit
8424 $cat <<EOM
8425
8426 $spackage has manual pages for many of the library modules.
8427 EOM
8428
8429 case "$nroff" in
8430 nroff)
8431         $cat <<'EOM'
8432 However, you don't have nroff, so they're probably useless to you.
8433 EOM
8434         case "$man3dir" in
8435         '') man3dir="none";;
8436         esac;;
8437 esac
8438
8439 case "$d_flexfnam" in
8440 undef)
8441         $cat <<'EOM'
8442 However, your system can't handle the long file names like File::Basename.3.
8443 EOM
8444         case "$man3dir" in
8445         '') man3dir="none";;
8446         esac;;
8447 esac
8448
8449 echo "If you don't want the manual sources installed, answer 'none'."
8450 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8451 case "$man3dir" in
8452 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8453         if $test -d "$privlib/man/man3"; then
8454                 cat <<EOM >&4
8455
8456 WARNING:  Previous versions of perl installed man3 pages into
8457 $privlib/man/man3.  This version will suggest a
8458 new default of $dflt.
8459 EOM
8460                 tdflt=$dflt
8461                 dflt='n'
8462                 rp='Do you wish to preserve the old behavior?(y/n)'
8463                 . ./myread
8464                 case "$ans" in
8465                 y*) dflt="$privlib/man/man3" ;;
8466                 *)  dflt=$tdflt ;;
8467                 esac
8468     fi
8469         ;;
8470 *)      dflt="$man3dir" ;;
8471 esac
8472 case "$dflt" in
8473 ' ') dflt=none ;;
8474 esac
8475 echo " "
8476 fn=dn+~
8477 rp="Where do the $package library man pages (source) go?"
8478 . ./getfile
8479 prefixvar=man3dir
8480 . ./setprefixvar
8481
8482 case "$man3dir" in
8483 '')     man3dir=' '
8484         installman3dir='';;
8485 esac
8486
8487 : What suffix to use on installed man pages
8488 case "$man3dir" in
8489 ' ')
8490         man3ext='0'
8491         ;;
8492 *)
8493         rp="What suffix should be used for the $package library man pages?"
8494         case "$man3ext" in
8495         '')     case "$man3dir" in
8496                 *3)  dflt=3 ;;
8497                 *3p) dflt=3p ;;
8498                 *3pm) dflt=3pm ;;
8499                 *l) dflt=l;;
8500                 *n) dflt=n;;
8501                 *o) dflt=o;;
8502                 *p) dflt=p;;
8503                 *C) dflt=C;;
8504                 *L) dflt=L;;
8505                 *L3) dflt=L3;;
8506                 *) dflt=3;;
8507                 esac
8508                 ;;
8509         *)      dflt="$man3ext";;
8510         esac
8511         . ./myread
8512         man3ext="$ans"
8513         ;;
8514 esac
8515
8516 : see if we have to deal with yellow pages, now NIS.
8517 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8518         if $test -f /usr/etc/nibindd; then
8519                 echo " "
8520                 echo "I'm fairly confident you're on a NeXT."
8521                 echo " "
8522                 rp='Do you get the hosts file via NetInfo?'
8523                 dflt=y
8524                 case "$hostcat" in
8525                 nidump*) ;;
8526                 '') ;;
8527                 *) dflt=n;;
8528                 esac
8529                 . ./myread
8530                 case "$ans" in
8531                 y*) hostcat='nidump hosts .';;
8532                 *)      case "$hostcat" in
8533                         nidump*) hostcat='';;
8534                         esac
8535                         ;;
8536                 esac
8537         fi
8538         case "$hostcat" in
8539         nidump*) ;;
8540         *)
8541                 case "$hostcat" in
8542                 *ypcat*) dflt=y;;
8543                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8544                                 dflt=y
8545                         else
8546                                 dflt=n
8547                         fi;;
8548                 *) dflt=n;;
8549                 esac
8550                 echo " "
8551                 rp='Are you getting the hosts file via yellow pages?'
8552                 . ./myread
8553                 case "$ans" in
8554                 y*) hostcat='ypcat hosts';;
8555                 *) hostcat='cat /etc/hosts';;
8556                 esac
8557                 ;;
8558         esac
8559 fi
8560 case "$hostcat" in
8561 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8562 esac
8563 case "$groupcat" in
8564 '') test -f /etc/group && groupcat='cat /etc/group';;
8565 esac
8566 case "$passcat" in
8567 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8568 esac
8569
8570 : now get the host name
8571 echo " "
8572 echo "Figuring out host name..." >&4
8573 case "$myhostname" in
8574 '') cont=true
8575         echo 'Maybe "hostname" will work...'
8576         if tans=`sh -c hostname 2>&1` ; then
8577                 myhostname=$tans
8578                 phostname=hostname
8579                 cont=''
8580         fi
8581         ;;
8582 *) cont='';;
8583 esac
8584 if $test "$cont"; then
8585         if ./xenix; then
8586                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8587                 if tans=`cat /etc/systemid 2>&1` ; then
8588                         myhostname=$tans
8589                         phostname='cat /etc/systemid'
8590                         echo "Whadyaknow.  Xenix always was a bit strange..."
8591                         cont=''
8592                 fi
8593         elif $test -r /etc/systemid; then
8594                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8595         fi
8596 fi
8597 if $test "$cont"; then
8598         echo 'No, maybe "uuname -l" will work...'
8599         if tans=`sh -c 'uuname -l' 2>&1` ; then
8600                 myhostname=$tans
8601                 phostname='uuname -l'
8602         else
8603                 echo 'Strange.  Maybe "uname -n" will work...'
8604                 if tans=`sh -c 'uname -n' 2>&1` ; then
8605                         myhostname=$tans
8606                         phostname='uname -n'
8607                 else
8608                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8609                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8610                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8611                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8612                         else
8613                                 case "$myhostname" in
8614                                 '') echo "Does this machine have an identity crisis or something?"
8615                                         phostname='';;
8616                                 *)
8617                                         echo "Well, you said $myhostname before..."
8618                                         phostname='echo $myhostname';;
8619                                 esac
8620                         fi
8621                 fi
8622         fi
8623 fi
8624 case "$myhostname" in
8625 '') myhostname=noname ;;
8626 esac
8627 : you do not want to know about this
8628 set $myhostname
8629 myhostname=$1
8630
8631 : verify guess
8632 if $test "$myhostname" ; then
8633         dflt=y
8634         rp='Your host name appears to be "'$myhostname'".'" Right?"
8635         . ./myread
8636         case "$ans" in
8637         y*) ;;
8638         *) myhostname='';;
8639         esac
8640 fi
8641
8642 : bad guess or no guess
8643 while $test "X$myhostname" = X ; do
8644         dflt=''
8645         rp="Please type the (one word) name of your host:"
8646         . ./myread
8647         myhostname="$ans"
8648 done
8649
8650 : translate upper to lower if necessary
8651 case "$myhostname" in
8652 *[A-Z]*)
8653         echo "(Normalizing case in your host name)"
8654         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8655         ;;
8656 esac
8657
8658 case "$myhostname" in
8659 *.*)
8660         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8661         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8662         echo "(Trimming domain name from host name--host name is now $myhostname)"
8663         ;;
8664 *) case "$mydomain" in
8665         '')
8666                 {
8667                         test "X$hostcat" = "Xypcat hosts" &&
8668                         ypmatch "$myhostname" hosts 2>/dev/null |\
8669                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8670                         $test -s hosts
8671                 } || {
8672                         test "X$hostcat" != "X" &&
8673                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8674                                         /[       ]$myhostname[  . ]/p" > hosts
8675                 }
8676                 tmp_re="[       . ]"
8677                 if $test -f hosts; then
8678                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8679                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8680                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8681                                 hosts | $sort | $uniq | \
8682                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8683                         case `$echo X$dflt` in
8684                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8685                                 dflt=.
8686                                 ;;
8687                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8688                                 ;;
8689                         esac
8690                 else
8691                         echo "(I cannot locate a hosts database anywhere)"
8692                         dflt=.
8693                 fi
8694                 case "$dflt" in
8695                 .)
8696                         tans=`./loc resolv.conf X /etc /usr/etc`
8697                         if $test -f "$tans"; then
8698                                 echo "(Attempting domain name extraction from $tans)"
8699                                 dflt=.`$sed -n -e 's/   / /g' \
8700                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8701                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8702                                 case "$dflt" in
8703                                 .) dflt=.`$sed -n -e 's/        / /g' \
8704                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8705                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8706                                         ;;
8707                                 esac
8708                         fi
8709                         ;;
8710                 esac
8711                 case "$dflt" in
8712                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8713                         dflt=.`sh -c domainname 2>/dev/null`
8714                         case "$dflt" in
8715                         '') dflt='.';;
8716                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8717                         esac
8718                         ;;
8719                 esac
8720                 case "$dflt$osname" in
8721                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8722                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8723                         ;;
8724                 esac
8725                 case "$dflt" in
8726                 .) echo "(Lost all hope -- silly guess then)"
8727                         dflt='.nonet'
8728                         ;;
8729                 esac
8730                 $rm -f hosts
8731                 ;;
8732         *) dflt="$mydomain";;
8733         esac;;
8734 esac
8735 echo " "
8736 rp="What is your domain name?"
8737 . ./myread
8738 tans="$ans"
8739 case "$ans" in
8740 '') ;;
8741 .*) ;;
8742 *) tans=".$tans";;
8743 esac
8744 mydomain="$tans"
8745
8746 : translate upper to lower if necessary
8747 case "$mydomain" in
8748 *[A-Z]*)
8749         echo "(Normalizing case in your domain name)"
8750         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8751         ;;
8752 esac
8753
8754 : a little sanity check here
8755 case "$phostname" in
8756 '') ;;
8757 *)
8758         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8759         $myhostname$mydomain|$myhostname) ;;
8760         *)
8761                 case "$phostname" in
8762                 sed*)
8763                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8764                         ;;
8765                 *)
8766                         echo "(That doesn't agree with your $phostname command, by the way.)"
8767                         ;;
8768                 esac
8769         ;;
8770         esac
8771         ;;
8772 esac
8773
8774 : determine the e-mail address of the user who is running us
8775 $cat <<EOM
8776
8777 I need to get your e-mail address in Internet format if possible, i.e.
8778 something like user@host.domain. Please answer accurately since I have
8779 no easy means to double check it. The default value provided below
8780 is most probably close to reality but may not be valid from outside
8781 your organization...
8782
8783 EOM
8784 cont=x
8785 while test "$cont"; do
8786         case "$cf_email" in
8787         '') dflt="$cf_by@$myhostname$mydomain";;
8788         *) dflt="$cf_email";;
8789         esac
8790         rp='What is your e-mail address?'
8791         . ./myread
8792         cf_email="$ans"
8793         case "$cf_email" in
8794         *@*.*) cont='' ;;
8795         *)
8796                 rp='Address does not look like an Internet one.  Use it anyway?'
8797                 case "$fastread" in
8798                 yes) dflt=y ;;
8799                 *) dflt=n ;;
8800                 esac
8801                 . ./myread
8802                 case "$ans" in
8803                 y*) cont='' ;;
8804                 *) echo " " ;;
8805                 esac
8806                 ;;
8807         esac
8808 done
8809
8810 : Ask e-mail of administrator
8811 $cat <<EOM
8812
8813 If you or somebody else will be maintaining perl at your site, please
8814 fill in the correct e-mail address here so that they may be contacted
8815 if necessary. Currently, the "perlbug" program included with perl
8816 will send mail to this address in addition to perlbug@perl.org. You may
8817 enter "none" for no administrator.
8818
8819 EOM
8820 case "$perladmin" in
8821 '') dflt="$cf_email";;
8822 *) dflt="$perladmin";;
8823 esac
8824 rp='Perl administrator e-mail address'
8825 . ./myread
8826 perladmin="$ans"
8827
8828 : determine whether to only install version-specific parts.
8829 echo " "
8830 $cat <<EOM
8831 Do you want to install only the version-specific parts of the perl
8832 distribution?  Usually you do *not* want to do this.
8833 EOM
8834 case "$versiononly" in
8835 "$define"|[Yy]*|true) dflt='y' ;;
8836 *) dflt='n';
8837 esac
8838 rp="Do you want to install only the version-specific parts of perl?"
8839 . ./myread
8840 case "$ans" in
8841 [yY]*)  val="$define";;
8842 *)      val="$undef" ;;
8843 esac
8844 set versiononly
8845 eval $setvar
8846
8847 case "$versiononly" in
8848 "$define") inc_version_list=''
8849            inc_version_list_init=0
8850            ;;
8851 esac
8852
8853 : figure out how to guarantee perl startup
8854 : XXX Note that this currently takes advantage of the bug that binexp ignores
8855 :     the Configure -Dinstallprefix setting, which in turn means that under
8856 :     relocatable @INC, initialinstalllocation is what binexp started as.
8857 case "$startperl" in
8858 '')
8859         case "$sharpbang" in
8860         *!)
8861                 $cat <<EOH
8862
8863 I can use the #! construct to start perl on your system. This will
8864 make startup of perl scripts faster, but may cause problems if you
8865 want to share those scripts and perl is not in a standard place
8866 ($initialinstalllocation/perl) on all your platforms. The alternative
8867 is to force a shell by starting the script with a single ':' character.
8868
8869 EOH
8870                 case "$versiononly" in
8871                 "$define")      dflt="$initialinstalllocation/perl$version";;
8872                 *)              dflt="$initialinstalllocation/perl";;
8873                 esac
8874                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8875                 . ./myread
8876                 case "$ans" in
8877                 none)   startperl=": # use perl";;
8878                 *)      startperl="#!$ans"
8879                         if $test 30 -lt `echo "$ans" | wc -c`; then
8880                                 $cat >&4 <<EOM
8881
8882 WARNING:  Some systems limit the #! command to 32 characters.
8883 If you experience difficulty running Perl scripts with #!, try
8884 installing Perl in a directory with a shorter pathname.
8885
8886 EOM
8887                         fi ;;
8888                 esac
8889                 ;;
8890         *) startperl=": # use perl"
8891                 ;;
8892         esac
8893         ;;
8894 esac
8895 echo "I'll use $startperl to start perl scripts."
8896
8897 : figure best path for perl in scripts
8898 case "$perlpath" in
8899 '')
8900         case "$versiononly" in
8901         "$define")      perlpath="$initialinstalllocation/perl$version";;
8902         *)              perlpath="$initialinstalllocation/perl";;
8903         esac
8904         case "$startperl" in
8905         *!*) ;;
8906         *)
8907                 $cat <<EOH
8908
8909 I will use the "eval 'exec'" idiom to start Perl on your system.
8910 I can use the full path of your Perl binary for this purpose, but
8911 doing so may cause problems if you want to share those scripts and
8912 Perl is not always in a standard place ($initialinstalllocation/perl).
8913
8914 EOH
8915                 dflt="$initialinstalllocation/perl"
8916                 rp="What path shall I use in \"eval 'exec'\"?"
8917                 . ./myread
8918                 perlpath="$ans"
8919                 ;;
8920         esac
8921         ;;
8922 esac
8923 case "$startperl" in
8924 *!*)    ;;
8925 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8926 esac
8927
8928 : determine where public executable scripts go
8929 set scriptdir scriptdir
8930 eval $prefixit
8931 case "$scriptdir" in
8932 '')
8933         dflt="$bin"
8934         : guess some guesses
8935         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8936         $test -d /usr/share/bin     && dflt=/usr/share/bin
8937         $test -d /usr/local/script  && dflt=/usr/local/script
8938         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8939         $test -d $prefixexp/script  && dflt=$prefixexp/script
8940         set dflt
8941         eval $prefixup
8942         ;;
8943 *)  dflt="$scriptdir"
8944         ;;
8945 esac
8946 $cat <<EOM
8947
8948 Some installations have a separate directory just for executable scripts so
8949 that they can mount it across multiple architectures but keep the scripts in
8950 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8951 Or you might just lump your scripts in with all your other executables.
8952
8953 EOM
8954 fn=d~
8955 rp='Where do you keep publicly executable scripts?'
8956 . ./getfile
8957 if $test "X$ansexp" != "X$scriptdirexp"; then
8958         installscript=''
8959 fi
8960 installscriptdir=''
8961 prefixvar=scriptdir
8962 . ./setprefixvar
8963 : A little fix up for an irregularly named variable.
8964 installscript="$installscriptdir"
8965
8966 : determine where add-on public executables go
8967 case "$sitebin" in
8968 '')     dflt=$siteprefix/bin ;;
8969 *)      dflt=$sitebin ;;
8970 esac
8971 fn=d~
8972 rp='Pathname where the add-on public executables should be installed?'
8973 . ./getfile
8974 prefixvar=sitebin
8975 . ./setprefixvar
8976
8977 : determine where add-on html pages go
8978 : There is no standard location, so try to copy the previously-selected
8979 : directory structure for the core html pages.
8980 case "$sitehtml1dir" in
8981 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8982 *)     dflt=$sitehtml1dir ;;
8983 esac
8984 case "$dflt" in
8985 ''|' ') dflt=none ;;
8986 esac
8987 fn=dn+~
8988 rp='Pathname where the site-specific html pages should be installed?'
8989 . ./getfile
8990 prefixvar=sitehtml1dir
8991 . ./setprefixvar
8992
8993 : determine where add-on library html pages go
8994 : There is no standard location, so try to copy the previously-selected
8995 : directory structure for the core html pages.
8996 case "$sitehtml3dir" in
8997 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8998 *)     dflt=$sitehtml3dir ;;
8999 esac
9000 case "$dflt" in
9001 ''|' ') dflt=none ;;
9002 esac
9003 fn=dn+~
9004 rp='Pathname where the site-specific library html pages should be installed?'
9005 . ./getfile
9006 prefixvar=sitehtml3dir
9007 . ./setprefixvar
9008
9009 : determine where add-on manual pages go
9010 case "$siteman1dir" in
9011 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9012 *)      dflt=$siteman1dir ;;
9013 esac
9014 case "$dflt" in
9015 ''|' ') dflt=none ;;
9016 esac
9017 fn=dn+~
9018 rp='Pathname where the site-specific manual pages should be installed?'
9019 . ./getfile
9020 prefixvar=siteman1dir
9021 . ./setprefixvar
9022
9023 : determine where add-on library man pages go
9024 case "$siteman3dir" in
9025 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9026 *)      dflt=$siteman3dir ;;
9027 esac
9028 case "$dflt" in
9029 ''|' ') dflt=none ;;
9030 esac
9031 fn=dn+~
9032 rp='Pathname where the site-specific library manual pages should be installed?'
9033 . ./getfile
9034 prefixvar=siteman3dir
9035 . ./setprefixvar
9036
9037 : determine where add-on public executable scripts go
9038 case "$sitescript" in
9039 '')     dflt=$siteprefix/script
9040         $test -d $dflt || dflt=$sitebin ;;
9041 *)  dflt="$sitescript" ;;
9042 esac
9043 fn=d~+
9044 rp='Pathname where add-on public executable scripts should be installed?'
9045 . ./getfile
9046 prefixvar=sitescript
9047 . ./setprefixvar
9048
9049 : Check if faststdio is requested and available
9050 case "$usefaststdio" in
9051 $define|true|[yY]*|'')
9052         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9053         case "$xversion" in
9054         [68])   dflt='y' ;;
9055         *)      dflt='n' ;;
9056         esac
9057         ;;
9058 *) dflt='n';;
9059 esac
9060 cat <<EOM
9061
9062 Perl can be built to use 'fast stdio', which means using the stdio
9063 library but also directly manipulating the stdio buffers to enable
9064 faster I/O.  Using stdio is better for backward compatibility (especially
9065 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9066 interface has been preferred instead of stdio.
9067
9068 If this doesn't make any sense to you, just accept the default '$dflt'.
9069 EOM
9070 rp='Use the "fast stdio" if available?'
9071 . ./myread
9072 case "$ans" in
9073 y|Y)    val="$define" ;;
9074 *)      val="$undef" ;;
9075 esac
9076 set usefaststdio
9077 eval $setvar
9078
9079
9080 : define an is-a-typedef? function
9081 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9082 case "$inclist" in
9083 "") inclist="sys/types.h";;
9084 esac;
9085 eval "varval=\$$var";
9086 case "$varval" in
9087 "")
9088         $rm -f temp.c;
9089         for inc in $inclist; do
9090                 echo "#include <$inc>" >>temp.c;
9091         done;
9092         echo "#ifdef $type" >> temp.c;
9093         echo "printf(\"We have $type\");" >> temp.c;
9094         echo "#endif" >> temp.c;
9095         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9096         if $contains $type temp.E >/dev/null 2>&1; then
9097                 eval "$var=\$type";
9098         else
9099                 eval "$var=\$def";
9100         fi;
9101         $rm -f temp.?;;
9102 *) eval "$var=\$varval";;
9103 esac'
9104
9105 : define an is-a-typedef? function that prompts if the type is not available.
9106 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9107 case "$inclist" in
9108 "") inclist="sys/types.h";;
9109 esac;
9110 eval "varval=\$$var";
9111 case "$varval" in
9112 "")
9113         $rm -f temp.c;
9114         for inc in $inclist; do
9115                 echo "#include <$inc>" >>temp.c;
9116         done;
9117         echo "#ifdef $type" >> temp.c;
9118         echo "printf(\"We have $type\");" >> temp.c;
9119         echo "#endif" >> temp.c;
9120         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9121         echo " " ;
9122         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9123         if $contains $type temp.E >/dev/null 2>&1; then
9124                 echo "$type found." >&4;
9125                 eval "$var=\$type";
9126         else
9127                 echo "$type NOT found." >&4;
9128                 dflt="$def";
9129                 . ./myread ;
9130                 eval "$var=\$ans";
9131         fi;
9132         $rm -f temp.?;;
9133 *) eval "$var=\$varval";;
9134 esac'
9135
9136 : see what type lseek is declared as in the kernel
9137 rp="What is the type used for lseek's offset on this system?"
9138 set off_t lseektype long stdio.h sys/types.h
9139 eval $typedef_ask
9140
9141 echo " "
9142 echo "Checking to see how big your file offsets are..." >&4
9143 $cat >try.c <<EOCP
9144 #include <sys/types.h>
9145 #include <stdio.h>
9146 int main()
9147 {
9148     printf("%d\n", (int)sizeof($lseektype));
9149     return(0);
9150 }
9151 EOCP
9152 set try
9153 if eval $compile_ok; then
9154         lseeksize=`$run ./try`
9155         echo "Your file offsets are $lseeksize bytes long."
9156 else
9157         dflt=$longsize
9158         echo " "
9159         echo "(I can't seem to compile the test program.  Guessing...)"
9160         rp="What is the size of your file offsets (in bytes)?"
9161         . ./myread
9162         lseeksize="$ans"
9163 fi
9164 $rm_try
9165
9166 : see what type file positions are declared as in the library
9167 rp="What is the type for file position used by fsetpos()?"
9168 set fpos_t fpostype long stdio.h sys/types.h
9169 eval $typedef_ask
9170
9171 : Check size for Fpos_t
9172 echo " "
9173 case "$fpostype" in
9174 *_t) zzz="$fpostype"    ;;
9175 *)   zzz="fpos_t"       ;;
9176 esac
9177 echo "Checking the size of $zzz..." >&4
9178 cat > try.c <<EOCP
9179 #include <sys/types.h>
9180 #include <stdio.h>
9181 #$i_stdlib I_STDLIB
9182 #ifdef I_STDLIB
9183 #include <stdlib.h>
9184 #endif
9185 int main() {
9186     printf("%d\n", (int)sizeof($fpostype));
9187     exit(0);
9188 }
9189 EOCP
9190 set try
9191 if eval $compile_ok; then
9192         yyy=`$run ./try`
9193         case "$yyy" in
9194         '')     fpossize=4
9195                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9196                 ;;
9197         *)      fpossize=$yyy
9198                 echo "Your $zzz is $fpossize bytes long."
9199                 ;;
9200         esac
9201 else
9202         dflt="$longsize"
9203         echo " " >&4
9204         echo "(I can't compile the test program.  Guessing...)" >&4
9205         rp="What is the size of your file positions (in bytes)?"
9206         . ./myread
9207         fpossize="$ans"
9208 fi
9209
9210 : Check for large file support
9211 # Backward compatibility (uselfs is deprecated).
9212 case "$uselfs" in
9213 "$define"|true|[yY]*)
9214         cat <<EOM >&4
9215
9216 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9217 EOM
9218         uselargefiles="$define"
9219         ;;
9220 esac
9221
9222 case "$lseeksize:$fpossize" in
9223 8:8) cat <<EOM
9224
9225 You can have files larger than 2 gigabytes.
9226 EOM
9227    val="$define" ;;
9228 *)    case "$uselargefiles" in
9229    "$undef"|false|[nN]*) dflt='n' ;;
9230    *)   dflt='y' ;;
9231    esac
9232    cat <<EOM
9233
9234 Perl can be built to understand large files (files larger than 2 gigabytes)
9235 on some systems.  To do so, Configure can be run with -Duselargefiles.
9236
9237 If this doesn't make any sense to you, just accept the default '$dflt'.
9238 EOM
9239    rp='Try to understand large files, if available?'
9240    . ./myread
9241    case "$ans" in
9242    y|Y)         val="$define" ;;
9243    *)           val="$undef"  ;;
9244    esac
9245    ;;
9246 esac
9247 set uselargefiles
9248 eval $setvar
9249 : Look for a hint-file generated 'call-back-unit'.  If the
9250 : user has specified that a large files perl is to be built,
9251 : we may need to set or change some other defaults.
9252 if $test -f uselargefiles.cbu; then
9253         echo "Your platform has some specific hints regarding large file builds, using them..."
9254         . ./uselargefiles.cbu
9255 fi
9256 case "$uselargefiles" in
9257 "$define")
9258         if $test -f uselargefiles.cbu; then
9259                 echo " "
9260                 echo "Rechecking to see how big your file offsets are..." >&4
9261                 $cat >try.c <<EOCP
9262 #include <sys/types.h>
9263 #include <stdio.h>
9264 int main()
9265 {
9266     printf("%d\n", (int)sizeof($lseektype));
9267     return(0);
9268 }
9269 EOCP
9270                 set try
9271                 if eval $compile_ok; then
9272                         lseeksize=`$run ./try`
9273                         $echo "Your file offsets are now $lseeksize bytes long."
9274                 else
9275                         dflt="$lseeksize"
9276                         echo " "
9277                         echo "(I can't seem to compile the test program.  Guessing...)"
9278                         rp="What is the size of your file offsets (in bytes)?"
9279                         . ./myread
9280                         lseeksize="$ans"
9281                 fi
9282                 case "$fpostype" in
9283                 *_t) zzz="$fpostype"    ;;
9284                 *)   zzz="fpos_t"       ;;
9285                 esac
9286                 $echo $n "Rechecking the size of $zzz...$c" >&4
9287                 $cat > try.c <<EOCP
9288 #include <sys/types.h>
9289 #include <stdio.h>
9290 #$i_stdlib I_STDLIB
9291 #ifdef I_STDLIB
9292 #include <stdlib.h>
9293 #endif
9294 int main() {
9295     printf("%d\n", (int)sizeof($fpostype));
9296     return(0);
9297 }
9298 EOCP
9299                 set try
9300                 if eval $compile_ok; then
9301                         yyy=`$run ./try`
9302                         dflt="$lseeksize"
9303                         case "$yyy" in
9304                         '')     echo " "
9305                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9306                                 ;;
9307                         *)      fpossize=$yyy
9308                                 echo " $fpossize bytes." >&4
9309                                 ;;
9310                         esac
9311                 else
9312                         dflt="$fpossize"
9313                         echo " "
9314                         echo "(I can't compile the test program.  Guessing...)" >&4
9315                         rp="What is the size of your file positions (in bytes)?"
9316                         . ./myread
9317                         fpossize="$ans"
9318                 fi
9319                 $rm_try
9320         fi
9321         ;;
9322 esac
9323
9324 : Set the vendorbin variables
9325 case "$vendorprefix" in
9326 '')     d_vendorbin="$undef"
9327         vendorbin=''
9328         vendorbinexp=''
9329         ;;
9330 *)      d_vendorbin="$define"
9331         : determine where vendor-supplied executables go.
9332         case "$vendorbin" in
9333         '') dflt=$vendorprefix/bin ;;
9334         *)      dflt="$vendorbin" ;;
9335         esac
9336         fn=d~+
9337         rp='Pathname for the vendor-supplied executables directory?'
9338         . ./getfile
9339         vendorbin="$ans"
9340         vendorbinexp="$ansexp"
9341         ;;
9342 esac
9343 prefixvar=vendorbin
9344 . ./installprefix
9345
9346 : Set the vendorhtml1dir variables
9347 case "$vendorprefix" in
9348 '')     vendorhtml1dir=''
9349         vendorhtml1direxp=''
9350         ;;
9351 *)      : determine where vendor-supplied html pages go.
9352         : There is no standard location, so try to copy the previously-selected
9353         : directory structure for the core html pages.
9354         : XXX Better default suggestions would be welcome.
9355         case "$vendorhtml1dir" in
9356         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9357         *)      dflt=$vendorhtml1dir ;;
9358         esac
9359         case "$dflt" in
9360         ''|' ') dflt=none ;;
9361         esac
9362         fn=dn+~
9363         rp='Pathname for the vendor-supplied html pages?'
9364         . ./getfile
9365         vendorhtml1dir="$ans"
9366         vendorhtml1direxp="$ansexp"
9367         ;;
9368 esac
9369 : Use ' ' for none so value is preserved next time through Configure
9370 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9371 prefixvar=vendorhtml1dir
9372 . ./installprefix
9373
9374 : Set the vendorhtml3dir variables
9375 case "$vendorprefix" in
9376 '')     vendorhtml3dir=''
9377         vendorhtml3direxp=''
9378         ;;
9379 *)      : determine where vendor-supplied module html pages go.
9380         : There is no standard location, so try to copy the previously-selected
9381         : directory structure for the core html pages.
9382         : XXX Better default suggestions would be welcome.
9383         case "$vendorhtml3dir" in
9384         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9385         *)      dflt=$vendorhtml3dir ;;
9386         esac
9387         case "$dflt" in
9388         ''|' ') dflt=none ;;
9389         esac
9390         fn=dn+~
9391         rp='Pathname for the vendor-supplied html pages?'
9392         . ./getfile
9393         vendorhtml3dir="$ans"
9394         vendorhtml3direxp="$ansexp"
9395         ;;
9396 esac
9397 : Use ' ' for none so value is preserved next time through Configure
9398 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9399 prefixvar=vendorhtml3dir
9400 . ./installprefix
9401
9402 : Set the vendorman1dir variables
9403 case "$vendorprefix" in
9404 '')     vendorman1dir=''
9405         vendorman1direxp=''
9406         ;;
9407 *)      : determine where vendor-supplied manual pages go.
9408         case "$vendorman1dir" in
9409         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9410         *)      dflt=$vendorman1dir ;;
9411         esac
9412         case "$dflt" in
9413         ''|' ') dflt=none ;;
9414         esac
9415         fn=nd~+
9416         rp='Pathname for the vendor-supplied manual section 1 pages?'
9417         . ./getfile
9418         vendorman1dir="$ans"
9419         vendorman1direxp="$ansexp"
9420         ;;
9421 esac
9422 : Use ' ' for none so value is preserved next time through Configure
9423 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9424 prefixvar=vendorman1dir
9425 . ./installprefix
9426
9427 : Set the vendorman3dir variables
9428 case "$vendorprefix" in
9429 '')     vendorman3dir=''
9430         vendorman3direxp=''
9431         ;;
9432 *)      : determine where vendor-supplied module manual pages go.
9433         case "$vendorman3dir" in
9434         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9435         *)      dflt=$vendorman3dir ;;
9436         esac
9437         case "$dflt" in
9438         ''|' ') dflt=none ;;
9439         esac
9440         fn=nd~+
9441         rp='Pathname for the vendor-supplied manual section 3 pages?'
9442         . ./getfile
9443         vendorman3dir="$ans"
9444         vendorman3direxp="$ansexp"
9445         ;;
9446 esac
9447 : Use ' ' for none so value is preserved next time through Configure
9448 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9449 prefixvar=vendorman3dir
9450 . ./installprefix
9451
9452 : Set the vendorscript variables
9453 case "$vendorprefix" in
9454 '')     d_vendorscript="$undef"
9455         vendorscript=''
9456         vendorscriptexp=''
9457         ;;
9458 *)      d_vendorscript="$define"
9459         : determine where vendor-supplied scripts go.
9460         case "$vendorscript" in
9461         '')     dflt=$vendorprefix/script
9462                 $test -d $dflt || dflt=$vendorbin ;;
9463         *)  dflt="$vendorscript" ;;
9464         esac
9465         $cat <<EOM
9466
9467 The installation process will create a directory for
9468 vendor-supplied scripts.
9469
9470 EOM
9471         fn=d~+
9472         rp='Pathname for the vendor-supplied scripts directory?'
9473         . ./getfile
9474         vendorscript="$ans"
9475         vendorscriptexp="$ansexp"
9476         ;;
9477 esac
9478 prefixvar=vendorscript
9479 . ./installprefix
9480
9481 : see if qgcvt exists
9482 set qgcvt d_qgcvt
9483 eval $inlibc
9484
9485 : Check print/scan long double stuff
9486 echo " "
9487
9488 if $test X"$d_longdbl" = X"$define"; then
9489
9490 echo "Checking how to print long doubles..." >&4
9491
9492 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9493         $cat >try.c <<'EOCP'
9494 #include <sys/types.h>
9495 #include <stdio.h>
9496 int main() {
9497   double d = 123.456;
9498   printf("%.3f\n", d);
9499 }
9500 EOCP
9501         set try
9502         if eval $compile; then
9503                 yyy=`$run ./try`
9504                 case "$yyy" in
9505                 123.456)
9506                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9507                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9508                         echo "We will use %f."
9509                         ;;
9510                 esac
9511         fi
9512 fi
9513
9514 if $test X"$sPRIfldbl" = X; then
9515         $cat >try.c <<'EOCP'
9516 #include <sys/types.h>
9517 #include <stdio.h>
9518 int main() {
9519   long double d = 123.456;
9520   printf("%.3Lf\n", d);
9521 }
9522 EOCP
9523         set try
9524         if eval $compile; then
9525                 yyy=`$run ./try`
9526                 case "$yyy" in
9527                 123.456)
9528                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9529                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9530                         echo "We will use %Lf."
9531                         ;;
9532                 esac
9533         fi
9534 fi
9535
9536 if $test X"$sPRIfldbl" = X; then
9537         $cat >try.c <<'EOCP'
9538 #include <sys/types.h>
9539 #include <stdio.h>
9540 int main() {
9541   long double d = 123.456;
9542   printf("%.3llf\n", d);
9543 }
9544 EOCP
9545         set try
9546         if eval $compile; then
9547                 yyy=`$run ./try`
9548                 case "$yyy" in
9549                 123.456)
9550                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9551                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9552                         echo "We will use %llf."
9553                         ;;
9554                 esac
9555         fi
9556 fi
9557
9558 if $test X"$sPRIfldbl" = X; then
9559         $cat >try.c <<'EOCP'
9560 #include <sys/types.h>
9561 #include <stdio.h>
9562 int main() {
9563   long double d = 123.456;
9564   printf("%.3lf\n", d);
9565 }
9566 EOCP
9567         set try
9568         if eval $compile; then
9569                 yyy=`$run ./try`
9570                 case "$yyy" in
9571                 123.456)
9572                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9573                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9574                         echo "We will use %lf."
9575                         ;;
9576                 esac
9577         fi
9578 fi
9579
9580 if $test X"$sPRIfldbl" = X; then
9581         echo "Cannot figure out how to print long doubles." >&4
9582 else
9583         sSCNfldbl=$sPRIfldbl    # expect consistency
9584 fi
9585
9586 $rm_try
9587
9588 fi # d_longdbl
9589
9590 case "$sPRIfldbl" in
9591 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9592         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9593         d_SCNfldbl="$undef";
9594         ;;
9595 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9596         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9597         d_SCNfldbl="$define";
9598         ;;
9599 esac
9600
9601 : Check how to convert floats to strings.
9602
9603 if test "X$d_Gconvert" = X; then
9604
9605 echo " "
9606 echo "Checking for an efficient way to convert floats to strings."
9607 echo " " > try.c
9608 case "$uselongdouble" in
9609 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9610 esac
9611 case "$d_longdbl" in
9612 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9613 esac
9614 case "$d_PRIgldbl" in
9615 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9616 esac
9617 $cat >>try.c <<EOP
9618 #ifdef TRY_gconvert
9619 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9620 char *myname = "gconvert";
9621 #endif
9622 #ifdef TRY_gcvt
9623 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9624 char *myname = "gcvt";
9625 #endif
9626 #ifdef TRY_qgcvt
9627 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9628 char *myname = "qgcvt";
9629 #define DOUBLETYPE long double
9630 #endif
9631 #ifdef TRY_sprintf
9632 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9633 #ifdef HAS_PRIgldbl
9634 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9635 #else
9636 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9637 #endif
9638 #else
9639 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9640 #endif
9641 char *myname = "sprintf";
9642 #endif
9643
9644 #ifndef DOUBLETYPE
9645 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9646 #define DOUBLETYPE long double
9647 #else
9648 #define DOUBLETYPE double
9649 #endif
9650 #endif
9651
9652 #include <stdio.h>
9653
9654 #define I_STDLIB $i_stdlib
9655 #ifdef I_STDLIB
9656 #include <stdlib.h>
9657 #endif
9658
9659 int
9660 checkit(expect, got)
9661 char *expect;
9662 char *got;
9663 {
9664     if (strcmp(expect, got)) {
9665                 printf("%s oddity:  Expected %s, got %s\n",
9666                         myname, expect, got);
9667                 exit(1);
9668         }
9669 }
9670
9671 int main()
9672 {
9673         char buf[64];
9674         buf[63] = '\0';
9675
9676         /* This must be 1st test on (which?) platform */
9677         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9678         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9679         checkit("0.1", buf);
9680
9681         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9682         checkit("0.01", buf);
9683
9684         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9685         checkit("0.001", buf);
9686
9687         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9688         checkit("0.0001", buf);
9689
9690         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9691         if (strlen(buf) > 5)
9692             checkit("9e-005", buf); /* for Microsoft ?? */
9693         else
9694             checkit("9e-05", buf);
9695
9696         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9697         checkit("1", buf);
9698
9699         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9700         checkit("1.1", buf);
9701
9702         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9703         checkit("1.01", buf);
9704
9705         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9706         checkit("1.001", buf);
9707
9708         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9709         checkit("1.0001", buf);
9710
9711         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9712         checkit("1.00001", buf);
9713
9714         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9715         checkit("1.000001", buf);
9716
9717         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9718         checkit("0", buf);
9719
9720         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9721         checkit("-1", buf);
9722
9723         /* Some Linux gcvt's give 1.e+5 here. */
9724         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9725         checkit("100000", buf);
9726
9727         /* Some Linux gcvt's give -1.e+5 here. */
9728         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9729         checkit("-100000", buf);
9730
9731         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9732         checkit("123.456", buf);
9733
9734         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9735         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9736         /* 34 should be enough to scare even long double
9737          * places into using the e notation. */
9738         if (strlen(buf) > 5)
9739             checkit("1e+034", buf); /* for Microsoft */
9740         else
9741             checkit("1e+34", buf);
9742
9743         /* For Perl, if you add additional tests here, also add them to
9744          * t/base/num.t for benefit of platforms not using Configure or
9745          * overriding d_Gconvert */
9746
9747         exit(0);
9748 }
9749 EOP
9750 : first add preferred functions to our list
9751 xxx_list=""
9752 for xxx_convert in $gconvert_preference; do
9753     case $xxx_convert in
9754     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9755     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9756     esac
9757 done
9758 : then add any others
9759 for xxx_convert in gconvert gcvt sprintf; do
9760     case "$xxx_list" in
9761     *$xxx_convert*) ;;
9762     *) xxx_list="$xxx_list $xxx_convert" ;;
9763     esac
9764 done
9765
9766 case "$d_longdbl$uselongdouble" in
9767 "$define$define")
9768     : again, add prefered functions to our list first
9769     xxx_ld_list=""
9770     for xxx_convert in $gconvert_ld_preference; do
9771         case $xxx_convert in
9772         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9773         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9774         esac
9775     done
9776     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9777     for xxx_convert in qgcvt sprintf $xxx_list; do
9778         case "$xxx_ld_list" in
9779         $xxx_convert*|*" $xxx_convert"*) ;;
9780         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9781         esac
9782     done
9783     : if sprintf cannot do long doubles, move it to the end
9784     if test "$d_PRIgldbl" != "$define"; then
9785         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9786     fi
9787     : if no qgcvt, remove it
9788     if test "$d_qgcvt" != "$define"; then
9789         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9790     fi
9791     : use the ld_list
9792     xxx_list="$xxx_ld_list"
9793     ;;
9794 esac
9795
9796 for xxx_convert in $xxx_list; do
9797         echo "Trying $xxx_convert..."
9798         $rm -f try try$_o core
9799         set try -DTRY_$xxx_convert
9800         if eval $compile; then
9801                 echo "$xxx_convert() found." >&4
9802                 if $run ./try; then
9803                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9804                         break;
9805                 else
9806                         echo "...But $xxx_convert didn't work as I expected."
9807                         xxx_convert=''
9808                 fi
9809         else
9810                 echo "$xxx_convert NOT found." >&4
9811         fi
9812 done
9813
9814 if test X$xxx_convert = X; then
9815     echo "*** WHOA THERE!!! ***" >&4
9816     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9817     xxx_convert=sprintf
9818 fi
9819
9820 case "$xxx_convert" in
9821 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9822 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9823 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9824 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9825    "$define$define$define")
9826       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9827    "$define$define$undef")
9828       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9829    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9830    esac
9831    ;;
9832 esac
9833
9834 fi
9835 $rm_try
9836
9837 : see if _fwalk exists
9838 set fwalk d__fwalk
9839 eval $inlibc
9840
9841 : Initialize h_fcntl
9842 h_fcntl=false
9843
9844 : Initialize h_sysfile
9845 h_sysfile=false
9846
9847 : access call always available on UNIX
9848 set access d_access
9849 eval $inlibc
9850
9851 : locate the flags for 'access()'
9852 case "$d_access" in
9853 "$define")
9854         echo " "
9855         $cat >access.c <<EOCP
9856 #include <sys/types.h>
9857 #ifdef I_FCNTL
9858 #include <fcntl.h>
9859 #endif
9860 #ifdef I_SYS_FILE
9861 #include <sys/file.h>
9862 #endif
9863 #ifdef I_UNISTD
9864 #include <unistd.h>
9865 #endif
9866 #$i_stdlib I_STDLIB
9867 #ifdef I_STDLIB
9868 #include <stdlib.h>
9869 #endif
9870 int main() {
9871         exit(R_OK);
9872 }
9873 EOCP
9874         : check sys/file.h first, no particular reason here
9875         if $test `./findhdr sys/file.h` && \
9876                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9877                 h_sysfile=true;
9878                 echo "<sys/file.h> defines the *_OK access constants." >&4
9879         elif $test `./findhdr fcntl.h` && \
9880                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9881                 h_fcntl=true;
9882                 echo "<fcntl.h> defines the *_OK access constants." >&4
9883         elif $test `./findhdr unistd.h` && \
9884                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9885                 echo "<unistd.h> defines the *_OK access constants." >&4
9886         else
9887                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9888         fi
9889         ;;
9890 esac
9891 $rm -f access*
9892
9893 : see if accessx exists
9894 set accessx d_accessx
9895 eval $inlibc
9896
9897 : see if aintl exists
9898 set aintl d_aintl
9899 eval $inlibc
9900
9901 : see if alarm exists
9902 set alarm d_alarm
9903 eval $inlibc
9904
9905 : see if POSIX threads are available
9906 set pthread.h i_pthread
9907 eval $inhdr
9908
9909 : define a fucntion to check prototypes
9910 $cat > protochk <<EOSH
9911 $startsh
9912 cc="$cc"
9913 optimize="$optimize"
9914 ccflags="$ccflags"
9915 prototype="$prototype"
9916 define="$define"
9917 rm_try="$rm_try"
9918 usethreads=$usethreads
9919 i_pthread=$i_pthread
9920 pthread_h_first=$pthread_h_first
9921 EOSH
9922
9923 $cat >> protochk <<'EOSH'
9924
9925 $rm_try
9926 foo="$1"
9927 shift
9928 while test $# -ge 2; do
9929         case "$1" in
9930                 $define) echo "#include <$2>" >> try.c ;;
9931                 literal) echo "$2" >> try.c ;;
9932         esac
9933     # Extra magic for the benefit of systems that need pthread.h
9934     # to be included early to correctly detect threadsafe functions.
9935     # Such functions must guarantee themselves, though, that the usethreads
9936     # and i_pthread have been defined, before calling protochk.
9937     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9938         echo "#include <pthread.h>" >> try.c
9939         pthread_h_done=yes
9940     fi
9941     shift 2
9942 done
9943 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9944 cat >> try.c <<'EOCP'
9945 #ifdef CAN_PROTOTYPE
9946 #define _(args) args
9947 #else
9948 #define _(args) ()
9949 #endif
9950 EOCP
9951 echo "$foo" >> try.c
9952 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9953 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9954 status=$?
9955 $rm_try
9956 exit $status
9957 EOSH
9958 chmod +x protochk
9959 $eunicefix protochk
9960
9961 : Define hasproto macro for Configure internal use
9962 hasproto='varname=$1; func=$2; shift; shift;
9963 while $test $# -ge 2; do
9964         case "$1" in
9965         $define) echo "#include <$2>";;
9966         esac ;
9967     shift 2;
9968 done > try.c;
9969 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9970 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9971         echo "$func() prototype found.";
9972         val="$define";
9973 else
9974         echo "$func() prototype NOT found.";
9975         val="$undef";
9976 fi;
9977 set $varname;
9978 eval $setvar;
9979 $rm_try tryout.c'
9980
9981 : see if sys/types.h has to be included
9982 set sys/types.h i_systypes
9983 eval $inhdr
9984
9985 : see if sys/select.h has to be included
9986 set sys/select.h i_sysselct
9987 eval $inhdr
9988
9989 : Define hasfield macro for Configure internal use
9990 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9991 while $test $# -ge 2; do
9992         case "$1" in
9993         $define) echo "#include <$2>";;
9994         esac ;
9995     shift 2;
9996 done > try.c;
9997 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9998 set try;
9999 if eval $compile; then
10000         val="$define";
10001 else
10002         val="$undef";
10003 fi;
10004 set $varname;
10005 eval $setvar;
10006 $rm_try'
10007
10008 : see if we should include time.h, sys/time.h, or both
10009 echo " "
10010 if test "X$timeincl" = X; then
10011         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10012         $echo $n "I'm now running the test program...$c"
10013         $cat >try.c <<EOCP
10014 #include <sys/types.h>
10015 #ifdef I_TIME
10016 #include <time.h>
10017 #endif
10018 #ifdef I_SYSTIME
10019 #ifdef SYSTIMEKERNEL
10020 #define KERNEL
10021 #endif
10022 #include <sys/time.h>
10023 #endif
10024 #ifdef I_SYSSELECT
10025 #include <sys/select.h>
10026 #endif
10027 #$i_stdlib I_STDLIB
10028 #ifdef I_STDLIB
10029 #include <stdlib.h>
10030 #endif
10031 int main()
10032 {
10033         struct tm foo;
10034 #ifdef S_TIMEVAL
10035         struct timeval bar;
10036 #endif
10037 #ifdef S_TIMEZONE
10038         struct timezone tzp;
10039 #endif
10040         if (foo.tm_sec == foo.tm_sec)
10041                 exit(0);
10042 #ifdef S_TIMEVAL
10043         if (bar.tv_sec == bar.tv_sec)
10044                 exit(0);
10045 #endif
10046         exit(1);
10047 }
10048 EOCP
10049         flags=''
10050         for s_timezone in '-DS_TIMEZONE' ''; do
10051         sysselect=''
10052         for s_timeval in '-DS_TIMEVAL' ''; do
10053         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10054         for i_time in '' '-DI_TIME'; do
10055         for i_systime in '-DI_SYSTIME' ''; do
10056                 case "$flags" in
10057                 '') $echo $n ".$c"
10058                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10059                         if eval $compile; then
10060                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10061                                 shift
10062                                 flags="$*"
10063                                 echo " "
10064                                 $echo $n "Succeeded with $flags$c"
10065                         fi
10066                         ;;
10067                 esac
10068         done
10069         done
10070         done
10071         done
10072         done
10073         timeincl=''
10074         echo " "
10075         case "$flags" in
10076         *SYSTIMEKERNEL*) i_systimek="$define"
10077                 timeincl=`./findhdr sys/time.h`
10078                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10079         *) i_systimek="$undef";;
10080         esac
10081         case "$flags" in
10082         *I_TIME*) i_time="$define"
10083                 timeincl=`./findhdr time.h`" $timeincl"
10084                 echo "We'll include <time.h>." >&4;;
10085         *) i_time="$undef";;
10086         esac
10087         case "$flags" in
10088         *I_SYSTIME*) i_systime="$define"
10089                 timeincl=`./findhdr sys/time.h`" $timeincl"
10090                 echo "We'll include <sys/time.h>." >&4;;
10091         *) i_systime="$undef";;
10092         esac
10093         $rm_try
10094 fi
10095 : see if struct tm knows about tm_zone
10096 case "$i_systime$i_time" in
10097 *$define*)
10098         echo " "
10099         echo "Checking to see if your struct tm has tm_zone field..." >&4
10100         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10101         eval $hasfield
10102         ;;
10103 *)      val="$undef"
10104         set d_tm_tm_zone
10105         eval $setvar
10106         ;;
10107 esac
10108 case "$d_tm_tm_zone" in
10109 "$define")      echo "Yes, it does."   ;;
10110 *)              echo "No, it doesn't." ;;
10111 esac
10112 : see if struct tm knows about tm_gmtoff
10113 case "$i_systime$i_time" in
10114 *$define*)
10115         echo " "
10116         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10117         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10118         eval $hasfield
10119         ;;
10120 *)      val="$undef"
10121         set d_tm_tm_gmtoff
10122         eval $setvar
10123         ;;
10124 esac
10125 case "$d_tm_tm_gmtoff" in
10126 "$define")      echo "Yes, it does."   ;;
10127 *)              echo "No, it doesn't." ;;
10128 esac
10129
10130 : see if asctime_r exists
10131 set asctime_r d_asctime_r
10132 eval $inlibc
10133 case "$d_asctime_r" in
10134 "$define")
10135         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10136         case "$d_asctime_r_proto:$usethreads" in
10137         ":define")      d_asctime_r_proto=define
10138                 set d_asctime_r_proto asctime_r $hdrs
10139                 eval $hasproto ;;
10140         *)      ;;
10141         esac
10142         case "$d_asctime_r_proto" in
10143         define)
10144         case "$asctime_r_proto" in
10145         ''|0) try='char* asctime_r(const struct tm*, char*);'
10146         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
10147         esac
10148         case "$asctime_r_proto" in
10149         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10150         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
10151         esac
10152         case "$asctime_r_proto" in
10153         ''|0) try='int asctime_r(const struct tm*, char*);'
10154         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
10155         esac
10156         case "$asctime_r_proto" in
10157         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10158         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
10159         esac
10160         case "$asctime_r_proto" in
10161         ''|0)   d_asctime_r=undef
10162                 asctime_r_proto=0
10163                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10164         * )     case "$asctime_r_proto" in
10165                 REENTRANT_PROTO*) ;;
10166                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10167                 esac
10168                 echo "Prototype: $try" ;;
10169         esac
10170         ;;
10171         *)      case "$usethreads" in
10172                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10173                 esac
10174                 d_asctime_r=undef
10175                 asctime_r_proto=0
10176                 ;;
10177         esac
10178         ;;
10179 *)      asctime_r_proto=0
10180         ;;
10181 esac
10182
10183 : see if atolf exists
10184 set atolf d_atolf
10185 eval $inlibc
10186
10187 : see if atoll exists
10188 set atoll d_atoll
10189 eval $inlibc
10190
10191 : Look for GCC-style attribute format
10192 case "$d_attribute_format" in
10193 '')
10194 echo " "
10195 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10196 $cat >attrib.c <<'EOCP'
10197 #include <stdio.h>
10198 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10199 EOCP
10200 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10201         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10202                 echo "Your C compiler doesn't support __attribute__((format))."
10203                 val="$undef"
10204         else
10205                 echo "Your C compiler supports __attribute__((format))."
10206                 val="$define"
10207         fi
10208 else
10209         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10210         val="$undef"
10211 fi
10212 ;;
10213 *) val="$d_attribute_format" ;;
10214 esac
10215 set d_attribute_format
10216 eval $setvar
10217 $rm -f attrib*
10218
10219 : Look for GCC-style attribute format with null format allowed
10220 case "$d_printf_format_null" in
10221 '') case "$d_attribute_format" in
10222     $define)
10223         echo " "
10224         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10225 $cat >attrib.c <<EOCP
10226 #include <stdio.h>
10227 #$i_stdlib I_STDLIB
10228 #ifdef I_STDLIB
10229 #include <stdlib.h>
10230 #endif
10231 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10232 int null_printf (char* pat,...) { return (int)pat; }
10233 int main () { exit(null_printf(NULL)); }
10234 EOCP
10235         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10236             : run the executable in case it produces a run-time warning
10237             if $run ./attrib >>attrib.out 2>&1; then
10238                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10239                     echo "Your C compiler doesn't allow __printf__ format to be null."
10240                     val="$undef"
10241                 else
10242                     echo "Your C compiler allows __printf__ format to be null."
10243                     val="$define"
10244                 fi
10245             else
10246             echo "Your C compiler executable failed with __printf__ format null."
10247             val="$undef"
10248         fi
10249     else
10250         echo "Your C compiler fails with __printf__ format null."
10251         val="$undef"
10252     fi
10253     ;;
10254     *)  val="$undef" ;;
10255     esac
10256 ;;
10257 *)  val="$d_printf_format_null" ;;
10258 esac
10259 set d_printf_format_null
10260 eval $setvar
10261 $rm -f attrib*
10262
10263 : Look for GCC-style attribute malloc
10264 case "$d_attribute_malloc" in
10265 '')
10266 echo " "
10267 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10268 $cat >attrib.c <<'EOCP'
10269 #include <stdio.h>
10270 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10271 EOCP
10272 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10273         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10274                 echo "Your C compiler doesn't support __attribute__((malloc))."
10275                 val="$undef"
10276         else
10277                 echo "Your C compiler supports __attribute__((malloc))."
10278                 val="$define"
10279         fi
10280 else
10281         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10282         val="$undef"
10283 fi
10284 ;;
10285 *) val="$d_attribute_malloc" ;;
10286 esac
10287 set d_attribute_malloc
10288 eval $setvar
10289 $rm -f attrib*
10290
10291 : Look for GCC-style attribute nonnull
10292 case "$d_attribute_nonnull" in
10293 '')
10294 echo " "
10295 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10296 $cat >attrib.c <<'EOCP'
10297 #include <stdio.h>
10298 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10299 EOCP
10300 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10301         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10302                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10303                 val="$undef"
10304         else
10305                 echo "Your C compiler supports __attribute__((nonnull))."
10306                 val="$define"
10307         fi
10308 else
10309         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10310         val="$undef"
10311 fi
10312 ;;
10313 *) val="$d_attribute_nonnull" ;;
10314 esac
10315 set d_attribute_nonnull
10316 eval $setvar
10317 $rm -f attrib*
10318
10319 : Look for GCC-style attribute noreturn
10320 case "$d_attribute_noreturn" in
10321 '')
10322 echo " "
10323 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10324 $cat >attrib.c <<'EOCP'
10325 #include <stdio.h>
10326 void fall_over_dead( void ) __attribute__((noreturn));
10327 EOCP
10328 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10329         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10330                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10331                 val="$undef"
10332         else
10333                 echo "Your C compiler supports __attribute__((noreturn))."
10334                 val="$define"
10335         fi
10336 else
10337         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10338         val="$undef"
10339 fi
10340 ;;
10341 *) val="$d_attribute_noreturn" ;;
10342 esac
10343 set d_attribute_noreturn
10344 eval $setvar
10345 $rm -f attrib*
10346
10347 : Look for GCC-style attribute pure
10348 case "$d_attribute_pure" in
10349 '')
10350 echo " "
10351 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10352 $cat >attrib.c <<'EOCP'
10353 #include <stdio.h>
10354 int square( int n ) __attribute__((pure));
10355 EOCP
10356 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10357         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10358                 echo "Your C compiler doesn't support __attribute__((pure))."
10359                 val="$undef"
10360         else
10361                 echo "Your C compiler supports __attribute__((pure))."
10362                 val="$define"
10363         fi
10364 else
10365         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10366         val="$undef"
10367 fi
10368 ;;
10369 *) val="$d_attribute_pure" ;;
10370 esac
10371 set d_attribute_pure
10372 eval $setvar
10373 $rm -f attrib*
10374
10375 : Look for GCC-style attribute unused
10376 case "$d_attribute_unused" in
10377 '')
10378 echo " "
10379 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10380 $cat >attrib.c <<'EOCP'
10381 #include <stdio.h>
10382 int do_something( int dummy __attribute__((unused)), int n );
10383 EOCP
10384 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10385         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10386                 echo "Your C compiler doesn't support __attribute__((unused))."
10387                 val="$undef"
10388         else
10389                 echo "Your C compiler supports __attribute__((unused))."
10390                 val="$define"
10391         fi
10392 else
10393         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10394         val="$undef"
10395 fi
10396 ;;
10397 *) val="$d_attribute_unused" ;;
10398 esac
10399 set d_attribute_unused
10400 eval $setvar
10401 $rm -f attrib*
10402
10403 : Look for GCC-style attribute warn_unused_result
10404 case "$d_attribute_warn_unused_result" in
10405 '')
10406 echo " "
10407 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10408 $cat >attrib.c <<'EOCP'
10409 #include <stdio.h>
10410 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10411 EOCP
10412 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10413         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10414                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10415                 val="$undef"
10416         else
10417                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10418                 val="$define"
10419         fi
10420 else
10421         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10422         val="$undef"
10423 fi
10424 ;;
10425 *) val="$d_attribute_warn_unused_result" ;;
10426 esac
10427 set d_attribute_warn_unused_result
10428 eval $setvar
10429 $rm -f attrib*
10430
10431 : see if bcmp exists
10432 set bcmp d_bcmp
10433 eval $inlibc
10434
10435 : see if bcopy exists
10436 set bcopy d_bcopy
10437 eval $inlibc
10438
10439 : see if getpgrp exists
10440 set getpgrp d_getpgrp
10441 eval $inlibc
10442
10443 case "$d_getpgrp" in
10444 "$define")
10445         echo " "
10446         echo "Checking to see which flavor of getpgrp is in use..."
10447         $cat >try.c <<EOP
10448 #$i_unistd I_UNISTD
10449 #include <sys/types.h>
10450 #ifdef I_UNISTD
10451 #  include <unistd.h>
10452 #endif
10453 #$i_stdlib I_STDLIB
10454 #ifdef I_STDLIB
10455 #include <stdlib.h>
10456 #endif
10457 int main()
10458 {
10459         if (getuid() == 0) {
10460                 printf("(I see you are running Configure as super-user...)\n");
10461                 setuid(1);
10462         }
10463 #ifdef TRY_BSD_PGRP
10464         if (getpgrp(1) == 0)
10465                 exit(0);
10466 #else
10467         if (getpgrp() > 0)
10468                 exit(0);
10469 #endif
10470         exit(1);
10471 }
10472 EOP
10473         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10474                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10475                 val="$define"
10476         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10477                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10478                 val="$undef"
10479         else
10480                 echo "I can't seem to compile and run the test program."
10481                 if ./usg; then
10482                         xxx="a USG one, i.e. you use getpgrp()."
10483                 else
10484                         # SVR4 systems can appear rather BSD-ish.
10485                         case "$i_unistd" in
10486                         $undef)
10487                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10488                                 val="$define"
10489                                 ;;
10490                         $define)
10491                                 xxx="probably a USG one, i.e. you use getpgrp()."
10492                                 val="$undef"
10493                                 ;;
10494                         esac
10495                 fi
10496                 echo "Assuming your getpgrp is $xxx" >&4
10497         fi
10498         ;;
10499 *) val="$undef";;
10500 esac
10501 set d_bsdgetpgrp
10502 eval $setvar
10503 $rm_try
10504
10505 : see if setpgrp exists
10506 set setpgrp d_setpgrp
10507 eval $inlibc
10508
10509 case "$d_setpgrp" in
10510 "$define")
10511         echo " "
10512         echo "Checking to see which flavor of setpgrp is in use..."
10513         $cat >try.c <<EOP
10514 #$i_unistd I_UNISTD
10515 #include <sys/types.h>
10516 #ifdef I_UNISTD
10517 #  include <unistd.h>
10518 #endif
10519 #$i_stdlib I_STDLIB
10520 #ifdef I_STDLIB
10521 #include <stdlib.h>
10522 #endif
10523 int main()
10524 {
10525         if (getuid() == 0) {
10526                 printf("(I see you are running Configure as super-user...)\n");
10527                 setuid(1);
10528         }
10529 #ifdef TRY_BSD_PGRP
10530         if (-1 == setpgrp(1, 1))
10531                 exit(0);
10532 #else
10533         if (setpgrp() != -1)
10534                 exit(0);
10535 #endif
10536         exit(1);
10537 }
10538 EOP
10539         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10540                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10541                 val="$define"
10542         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10543                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10544                 val="$undef"
10545         else
10546                 echo "(I can't seem to compile and run the test program.)"
10547                 if ./usg; then
10548                         xxx="a USG one, i.e. you use setpgrp()."
10549                 else
10550                         # SVR4 systems can appear rather BSD-ish.
10551                         case "$i_unistd" in
10552                         $undef)
10553                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10554                                 val="$define"
10555                                 ;;
10556                         $define)
10557                                 xxx="probably a USG one, i.e. you use setpgrp()."
10558                                 val="$undef"
10559                                 ;;
10560                         esac
10561                 fi
10562                 echo "Assuming your setpgrp is $xxx" >&4
10563         fi
10564         ;;
10565 *) val="$undef";;
10566 esac
10567 set d_bsdsetpgrp
10568 eval $setvar
10569 $rm_try
10570
10571 : Look for GCC-style __builtin_choose_expr
10572 case "$d_builtin_choose_expr" in
10573 '')
10574     echo " "
10575     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10576     $cat >try.c <<'EOCP'
10577 #include <assert.h>
10578 #include <stdlib.h>
10579 #include <stdio.h>
10580
10581 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10582
10583 int main(void) {
10584     assert( SYRINX(1) == 2112 );
10585     assert( SYRINX(1) != 5150 );
10586     assert( SYRINX(0) == 5150 );
10587     assert( SYRINX(0) != 2112 );
10588     puts( "All good!" );
10589     exit(0);
10590 }
10591
10592 EOCP
10593     set try
10594     if eval $compile && $run ./try; then
10595         echo "Your C compiler supports __builtin_choose_expr."
10596         val="$define"
10597     else
10598         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10599         val="$undef"
10600     fi
10601 ;;
10602 *) val="$d_builtin_choose_expr" ;;
10603 esac
10604
10605 set d_builtin_choose_expr
10606 eval $setvar
10607 $rm_try
10608
10609 : Look for GCC-style __builtin_expect
10610 case "$d_builtin_expect" in
10611 '')
10612     echo " "
10613     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10614     $cat >try.c <<'EOCP'
10615 int main(void) {
10616     int n = 50;
10617     if ( __builtin_expect(n, 0) ) n = 1;
10618     /* Remember shell exit code truth is 0, C truth is non-zero */
10619     return !(n == 1);
10620 }
10621 EOCP
10622     set try
10623     if eval $compile && $run ./try; then
10624         echo "Your C compiler supports __builtin_expect."
10625         val="$define"
10626     else
10627         echo "Your C compiler doesn't seem to understand __builtin_expect."
10628         val="$undef"
10629     fi
10630     ;;
10631 *) val="$d_builtin_expect" ;;
10632 esac
10633
10634 set d_builtin_expect
10635 eval $setvar
10636 $rm_try
10637
10638 : see if bzero exists
10639 set bzero d_bzero
10640 eval $inlibc
10641
10642 : see if stdarg is available
10643 echo " "
10644 if $test `./findhdr stdarg.h`; then
10645         echo "<stdarg.h> found." >&4
10646         valstd="$define"
10647 else
10648         echo "<stdarg.h> NOT found." >&4
10649         valstd="$undef"
10650 fi
10651
10652 : see if varags is available
10653 echo " "
10654 if $test `./findhdr varargs.h`; then
10655         echo "<varargs.h> found." >&4
10656 else
10657         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10658 fi
10659
10660 : set up the varargs testing programs
10661 $cat > varargs.c <<EOP
10662 #ifdef I_STDARG
10663 #include <stdarg.h>
10664 #endif
10665 #ifdef I_VARARGS
10666 #include <varargs.h>
10667 #endif
10668
10669 #ifdef I_STDARG
10670 int f(char *p, ...)
10671 #else
10672 int f(va_alist)
10673 va_dcl
10674 #endif
10675 {
10676         va_list ap;
10677 #ifndef I_STDARG
10678         char *p;
10679 #endif
10680 #ifdef I_STDARG
10681         va_start(ap,p);
10682 #else
10683         va_start(ap);
10684         p = va_arg(ap, char *);
10685 #endif
10686         va_end(ap);
10687         return 0;
10688 }
10689 EOP
10690 $cat > varargs <<EOP
10691 $startsh
10692 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10693         echo "true"
10694 else
10695         echo "false"
10696 fi
10697 $rm -f varargs$_o
10698 EOP
10699 chmod +x varargs
10700
10701 : now check which varargs header should be included
10702 echo " "
10703 i_varhdr=''
10704 case "$valstd" in
10705 "$define")
10706         if `./varargs I_STDARG`; then
10707                 val='stdarg.h'
10708         elif `./varargs I_VARARGS`; then
10709                 val='varargs.h'
10710         fi
10711         ;;
10712 *)
10713         if `./varargs I_VARARGS`; then
10714                 val='varargs.h'
10715         fi
10716         ;;
10717 esac
10718 case "$val" in
10719 '')
10720 echo "I could not find the definition for va_dcl... You have problems..." >&4
10721         val="$undef"; set i_stdarg; eval $setvar
10722         val="$undef"; set i_varargs; eval $setvar
10723         ;;
10724 *)
10725         set i_varhdr
10726         eval $setvar
10727         case "$i_varhdr" in
10728         stdarg.h)
10729                 val="$define"; set i_stdarg; eval $setvar
10730                 val="$undef"; set i_varargs; eval $setvar
10731                 ;;
10732         varargs.h)
10733                 val="$undef"; set i_stdarg; eval $setvar
10734                 val="$define"; set i_varargs; eval $setvar
10735                 ;;
10736         esac
10737         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10738 esac
10739 $rm -f varargs*
10740
10741 : see if the Compiler supports C99 variadic macros
10742 case "$i_stdarg$i_stdlib" in
10743     "$define$define")
10744     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10745     $cat >try.c <<EOCP
10746 #include <stdio.h>
10747 #include <stdarg.h>
10748
10749 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10750
10751 int main() {
10752   char buf[20];
10753   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10754   puts(buf);
10755   return 0;
10756 }
10757 EOCP
10758     set try
10759     if eval $compile && $run ./try 2>&1 >/dev/null; then
10760         case "`$run ./try`" in
10761             "123 456 789")
10762             echo "You have C99 variadic macros." >&4
10763             d_c99_variadic_macros="$define"
10764             ;;
10765             *)
10766             echo "You don't have functional C99 variadic macros." >&4
10767             d_c99_variadic_macros="$undef"
10768             ;;
10769         esac
10770     else
10771         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10772         d_c99_variadic_macros="$undef"
10773     fi
10774     $rm_try
10775     ;;
10776     *)
10777     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10778     d_c99_variadic_macros="$undef"
10779     ;;
10780 esac
10781
10782 : see if signal is declared as pointer to function returning int or void
10783 echo " "
10784 xxx=`./findhdr signal.h`
10785 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10786 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10787         echo "You have int (*signal())() instead of void." >&4
10788         val="$undef"
10789 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10790         echo "You have void (*signal())()." >&4
10791         val="$define"
10792 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10793         echo "You have int (*signal())() instead of void." >&4
10794         val="$undef"
10795 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10796         echo "You have void (*signal())()." >&4
10797         val="$define"
10798 else
10799         case "$d_voidsig" in
10800         '')
10801         echo "I can't determine whether signal handler returns void or int..." >&4
10802                 dflt=void
10803                 rp="What type does your signal handler return?"
10804                 . ./myread
10805                 case "$ans" in
10806                 v*) val="$define";;
10807                 *) val="$undef";;
10808                 esac;;
10809         "$define")
10810                 echo "As you already told me, signal handler returns void." >&4
10811                 val="$define"
10812                 ;;
10813         *)      echo "As you already told me, signal handler returns int." >&4
10814                 val="$undef"
10815                 ;;
10816         esac
10817 fi
10818 set d_voidsig
10819 eval $setvar
10820 case "$d_voidsig" in
10821 "$define") signal_t="void";;
10822 *) signal_t="int";;
10823 esac
10824 $rm -f $$.tmp
10825
10826 : check for ability to cast large floats to 32-bit ints.
10827 echo " "
10828 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10829 if $test "$intsize" -ge 4; then
10830         xxx=int
10831 else
10832         xxx=long
10833 fi
10834 $cat >try.c <<EOCP
10835 #include <stdio.h>
10836 #$i_stdlib I_STDLIB
10837 #ifdef I_STDLIB
10838 #include <stdlib.h>
10839 #endif
10840 #include <sys/types.h>
10841 #include <signal.h>
10842 $signal_t blech(int s) { exit(3); }
10843 int main()
10844 {
10845         $xxx i32;
10846         double f, g;
10847         int result = 0;
10848         char str[16];
10849         signal(SIGFPE, blech);
10850
10851         /* Don't let compiler optimize the test away.  Store the number
10852            in a writable string for gcc to pass to sscanf under HP/UX.
10853         */
10854         sprintf(str, "2147483647");
10855         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10856         g = 10 * f;
10857         i32  = ($xxx) g;
10858
10859         /* x86 processors will probably give 0x8000 0000, which is a
10860            sign change.  We don't want that.  We want to mimic SPARC
10861            behavior here, which is to preserve the sign and give
10862            back 0x7fff ffff.
10863         */
10864         if (i32 != ($xxx) f)
10865                 result |= 1;
10866         exit(result);
10867 }
10868 EOCP
10869 set try
10870 if eval $compile_ok; then
10871         $run ./try
10872         yyy=$?
10873 else
10874         echo "(I can't seem to compile the test program--assuming it can't)"
10875         yyy=1
10876 fi
10877 case "$yyy" in
10878 0)      val="$define"
10879         echo "Yup, it can."
10880         ;;
10881 *)      val="$undef"
10882         echo "Nope, it can't."
10883         ;;
10884 esac
10885 set d_casti32
10886 eval $setvar
10887 $rm_try
10888
10889 : check for ability to cast negative floats to unsigned
10890 echo " "
10891 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10892 $cat >try.c <<EOCP
10893 #include <stdio.h>
10894 #$i_stdlib I_STDLIB
10895 #ifdef I_STDLIB
10896 #include <stdlib.h>
10897 #endif
10898 #include <sys/types.h>
10899 #include <signal.h>
10900 $signal_t blech(int s) { exit(7); }
10901 $signal_t blech_in_list(int s) { exit(4); }
10902 unsigned long dummy_long(unsigned long p) { return p; }
10903 unsigned int dummy_int(unsigned int p) { return p; }
10904 unsigned short dummy_short(unsigned short p) { return p; }
10905 int main()
10906 {
10907         double f;
10908         unsigned long along;
10909         unsigned int aint;
10910         unsigned short ashort;
10911         int result = 0;
10912         char str[16];
10913
10914         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10915            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10916            optimized the whole file away
10917         */
10918         /* Store the number in a writable string for gcc to pass to
10919            sscanf under HP/UX.
10920         */
10921         sprintf(str, "-123");
10922         sscanf(str, "%lf", &f);  /* f = -123.; */
10923
10924         signal(SIGFPE, blech);
10925         along = (unsigned long)f;
10926         aint = (unsigned int)f;
10927         ashort = (unsigned short)f;
10928         if (along != (unsigned long)-123)
10929                 result |= 1;
10930         if (aint != (unsigned int)-123)
10931                 result |= 1;
10932         if (ashort != (unsigned short)-123)
10933                 result |= 1;
10934         sprintf(str, "1073741824.");
10935         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10936         f = f + f;
10937         along = 0;
10938         along = (unsigned long)f;
10939         if (along != 0x80000000)
10940                 result |= 2;
10941         f -= 1.;
10942         along = 0;
10943         along = (unsigned long)f;
10944         if (along != 0x7fffffff)
10945                 result |= 1;
10946         f += 2.;
10947         along = 0;
10948         along = (unsigned long)f;
10949         if (along != 0x80000001)
10950                 result |= 2;
10951         if (result)
10952                 exit(result);
10953         signal(SIGFPE, blech_in_list);
10954         sprintf(str, "123.");
10955         sscanf(str, "%lf", &f);  /* f = 123.; */
10956         along = dummy_long((unsigned long)f);
10957         aint = dummy_int((unsigned int)f);
10958         ashort = dummy_short((unsigned short)f);
10959         if (along != (unsigned long)123)
10960                 result |= 4;
10961         if (aint != (unsigned int)123)
10962                 result |= 4;
10963         if (ashort != (unsigned short)123)
10964                 result |= 4;
10965         exit(result);
10966
10967 }
10968 EOCP
10969 set try
10970 if eval $compile_ok; then
10971         $run ./try
10972         castflags=$?
10973 else
10974         echo "(I can't seem to compile the test program--assuming it can't)"
10975         castflags=7
10976 fi
10977 case "$castflags" in
10978 0)      val="$define"
10979         echo "Yup, it can."
10980         ;;
10981 *)      val="$undef"
10982         echo "Nope, it can't."
10983         ;;
10984 esac
10985 set d_castneg
10986 eval $setvar
10987 $rm_try
10988
10989 : see if vprintf exists
10990 echo " "
10991 if set vprintf val -f d_vprintf; eval $csym; $val; then
10992         echo 'vprintf() found.' >&4
10993         val="$define"
10994         $cat >try.c <<EOF
10995 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
10996 #$i_varargs I_VARARGS
10997
10998 #$i_stdlib I_STDLIB
10999 #$i_unistd I_UNISTD
11000
11001 #ifdef I_STDARG
11002 #  include <stdarg.h>
11003 #else /* I_VARARGS */
11004 #  include <varargs.h>
11005 #endif
11006
11007 #ifdef I_UNISTD
11008 #  include <unistd.h>
11009 #endif
11010
11011 #ifdef I_STDLIB
11012 #  include <stdlib.h>
11013 #endif
11014
11015 #include <stdio.h> /* vsprintf prototype */
11016
11017 #ifdef I_STDARG
11018 void xxx(int n, ...)
11019 {
11020     va_list args;
11021     char buf[10];
11022     va_start(args, n);
11023     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11024 }
11025 int main() { xxx(1, "foo"); }
11026
11027 #else /* I_VARARGS */
11028
11029 xxx(va_alist)
11030 va_dcl
11031 {
11032     va_list args;
11033     char buf[10];
11034     va_start(args);
11035     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11036 }
11037 int main() { xxx("foo"); }
11038
11039 #endif
11040
11041 EOF
11042         set try
11043         if eval $compile_ok; then
11044                 if $run ./try; then
11045                         echo "Your vsprintf() returns (int)." >&4
11046                         val2="$undef"
11047                 else
11048                         echo "Your vsprintf() returns (char*)." >&4
11049                         val2="$define"
11050                 fi
11051         else
11052                 echo 'I am unable to compile the vsprintf() test program.' >&4
11053                 # We shouldn't get here.  If we do, assume the standard signature,
11054                 # not the old BSD one.
11055                 echo 'Guessing that vsprintf() returns (int).' >&4
11056                 val2="$undef"
11057         fi
11058 else
11059         echo 'vprintf() NOT found.' >&4
11060         val="$undef"
11061         val2="$undef"
11062 fi
11063 $rm_try
11064 set d_vprintf
11065 eval $setvar
11066 val=$val2
11067 set d_charvspr
11068 eval $setvar
11069
11070 : see if chown exists
11071 set chown d_chown
11072 eval $inlibc
11073
11074 : see if chroot exists
11075 set chroot d_chroot
11076 eval $inlibc
11077
11078 : see if chsize exists
11079 set chsize d_chsize
11080 eval $inlibc
11081
11082 : see if class exists
11083 set class d_class
11084 eval $inlibc
11085
11086 : see if clearenv exists
11087 set clearenv d_clearenv
11088 eval $inlibc
11089
11090 : Define hasstruct macro for Configure internal use
11091 hasstruct='varname=$1; struct=$2; shift; shift;
11092 while $test $# -ge 2; do
11093         case "$1" in
11094         $define) echo "#include <$2>";;
11095         esac ;
11096     shift 2;
11097 done > try.c;
11098 echo "int main () { struct $struct foo; }" >> try.c;
11099 set try;
11100 if eval $compile; then
11101         val="$define";
11102 else
11103         val="$undef";
11104 fi;
11105 set $varname;
11106 eval $setvar;
11107 $rm_try'
11108
11109 : see whether socket exists
11110 socketlib=''
11111 sockethdr=''
11112 echo " "
11113 $echo $n "Hmm... $c" >&4
11114 if set socket val -f d_socket; eval $csym; $val; then
11115         echo "Looks like you have Berkeley networking support." >&4
11116         d_socket="$define"
11117         if set setsockopt val -f; eval $csym; $val; then
11118                 d_oldsock="$undef"
11119         else
11120                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11121                 d_oldsock="$define"
11122         fi
11123 else
11124         if $contains socklib libc.list >/dev/null 2>&1; then
11125                 echo "Looks like you have Berkeley networking support." >&4
11126                 d_socket="$define"
11127                 : we will have to assume that it supports the 4.2 BSD interface
11128                 d_oldsock="$undef"
11129         else
11130                 echo "You don't have Berkeley networking in libc$_a..." >&4
11131                 if test "X$d_socket" = "X$define"; then
11132                    echo "...but you seem to believe that you have sockets." >&4
11133                 else
11134                         for net in net socket
11135                         do
11136                                 if test -f /usr/lib/lib$net$_a; then
11137                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11138                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11139                                         if $contains socket libc.list >/dev/null 2>&1; then
11140                                                 d_socket="$define"
11141                                                 socketlib="-l$net"
11142                                                 case "$net" in
11143                                                 net)
11144                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11145                                                         sockethdr="-I/usr/netinclude"
11146                                                         ;;
11147                                                 esac
11148                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11149                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11150                                                         d_oldsock="$undef"
11151                                                 else
11152                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11153                                                         d_oldsock="$define"
11154                                                 fi
11155                                                 break
11156                                         fi
11157                                 fi
11158                         done
11159                         if test "X$d_socket" != "X$define"; then
11160                            echo "or anywhere else I see." >&4
11161                            d_socket="$undef"
11162                            d_oldsock="$undef"
11163                         fi
11164                 fi
11165         fi
11166 fi
11167
11168 : see if socketpair exists
11169 set socketpair d_sockpair
11170 eval $inlibc
11171
11172
11173 echo " "
11174 echo "Checking the availability of certain socket constants..." >&4
11175 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11176         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11177         $cat >try.c <<EOF
11178 #include <sys/types.h>
11179 #include <sys/socket.h>
11180 int main() {
11181     int i = $ENUM;
11182 }
11183 EOF
11184         val="$undef"
11185         set try; if eval $compile; then
11186                 val="$define"
11187         fi
11188         set d_${enum}; eval $setvar
11189         $rm_try
11190 done
11191
11192 : see if this is a sys/uio.h system
11193 set sys/uio.h i_sysuio
11194 eval $inhdr
11195
11196 : Check for cmsghdr support
11197 echo " "
11198 echo "Checking to see if your system supports struct cmsghdr..." >&4
11199 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11200 eval $hasstruct
11201 case "$d_cmsghdr_s" in
11202 "$define")      echo "Yes, it does."   ;;
11203 *)              echo "No, it doesn't." ;;
11204 esac
11205
11206
11207 : check for const keyword
11208 echo " "
11209 echo 'Checking to see if your C compiler knows about "const"...' >&4
11210 $cat >const.c <<'EOCP'
11211 typedef struct spug { int drokk; } spug;
11212 int main()
11213 {
11214         const char *foo;
11215         const spug y = { 0 };
11216 }
11217 EOCP
11218 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11219         val="$define"
11220         echo "Yup, it does."
11221 else
11222         val="$undef"
11223         echo "Nope, it doesn't."
11224 fi
11225 set d_const
11226 eval $setvar
11227
11228 : see if copysignl exists
11229 set copysignl d_copysignl
11230 eval $inlibc
11231
11232 : see if crypt exists
11233 echo " "
11234 set crypt d_crypt
11235 eval $inlibc
11236 case "$d_crypt" in
11237 $define) cryptlib='' ;;
11238 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11239                 echo 'crypt() found.' >&4
11240                 val="$define"
11241                 cryptlib=''
11242         else
11243                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11244                 if $test -z "$cryptlib"; then
11245                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11246                 else
11247                         cryptlib=-lcrypt
11248                 fi
11249                 if $test -z "$cryptlib"; then
11250                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11251                 else
11252                         cryptlib=-lcrypt
11253                 fi
11254                 if $test -z "$cryptlib"; then
11255                         cryptlib=`./loc libcrypt$_a "" $libpth`
11256                 else
11257                         cryptlib=-lcrypt
11258                 fi
11259                 if $test -z "$cryptlib"; then
11260                         echo 'crypt() NOT found.' >&4
11261                         val="$undef"
11262                 else
11263                         val="$define"
11264                 fi
11265         fi
11266         set d_crypt
11267         eval $setvar
11268         ;;
11269 esac
11270
11271 : see if this is a crypt.h system
11272 set crypt.h i_crypt
11273 eval $inhdr
11274
11275 : see if crypt_r exists
11276 set crypt_r d_crypt_r
11277 eval $inlibc
11278 case "$d_crypt_r" in
11279 "$define")
11280         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11281         case "$d_crypt_r_proto:$usethreads" in
11282         ":define")      d_crypt_r_proto=define
11283                 set d_crypt_r_proto crypt_r $hdrs
11284                 eval $hasproto ;;
11285         *)      ;;
11286         esac
11287         case "$d_crypt_r_proto" in
11288         define)
11289         case "$crypt_r_proto" in
11290         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11291         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
11292         esac
11293         case "$crypt_r_proto" in
11294         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11295         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
11296         esac
11297         case "$crypt_r_proto" in
11298         ''|0)   d_crypt_r=undef
11299                 crypt_r_proto=0
11300                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11301         * )     case "$crypt_r_proto" in
11302                 REENTRANT_PROTO*) ;;
11303                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11304                 esac
11305                 echo "Prototype: $try" ;;
11306         esac
11307         ;;
11308         *)      case "$usethreads" in
11309                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11310                 esac
11311                 d_crypt_r=undef
11312                 crypt_r_proto=0
11313                 ;;
11314         esac
11315         ;;
11316 *)      crypt_r_proto=0
11317         ;;
11318 esac
11319
11320 : get csh whereabouts
11321 case "$csh" in
11322 'csh') val="$undef" ;;
11323 *) val="$define" ;;
11324 esac
11325 set d_csh
11326 eval $setvar
11327 : Respect a hint or command line value for full_csh.
11328 case "$full_csh" in
11329 '') full_csh=$csh ;;
11330 esac
11331
11332 : see if ctermid exists
11333 set ctermid d_ctermid
11334 eval $inlibc
11335
11336 : see if ctermid_r exists
11337 set ctermid_r d_ctermid_r
11338 eval $inlibc
11339 case "$d_ctermid_r" in
11340 "$define")
11341         hdrs="$i_systypes sys/types.h define stdio.h "
11342         case "$d_ctermid_r_proto:$usethreads" in
11343         ":define")      d_ctermid_r_proto=define
11344                 set d_ctermid_r_proto ctermid_r $hdrs
11345                 eval $hasproto ;;
11346         *)      ;;
11347         esac
11348         case "$d_ctermid_r_proto" in
11349         define)
11350         case "$ctermid_r_proto" in
11351         ''|0) try='char* ctermid_r(char*);'
11352         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
11353         esac
11354         case "$ctermid_r_proto" in
11355         ''|0)   d_ctermid_r=undef
11356                 ctermid_r_proto=0
11357                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11358         * )     case "$ctermid_r_proto" in
11359                 REENTRANT_PROTO*) ;;
11360                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11361                 esac
11362                 echo "Prototype: $try" ;;
11363         esac
11364         ;;
11365         *)      case "$usethreads" in
11366                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11367                 esac
11368                 d_ctermid_r=undef
11369                 ctermid_r_proto=0
11370                 ;;
11371         esac
11372         ;;
11373 *)      ctermid_r_proto=0
11374         ;;
11375 esac
11376
11377 : see if ctime_r exists
11378 set ctime_r d_ctime_r
11379 eval $inlibc
11380 case "$d_ctime_r" in
11381 "$define")
11382         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11383         case "$d_ctime_r_proto:$usethreads" in
11384         ":define")      d_ctime_r_proto=define
11385                 set d_ctime_r_proto ctime_r $hdrs
11386                 eval $hasproto ;;
11387         *)      ;;
11388         esac
11389         case "$d_ctime_r_proto" in
11390         define)
11391         case "$ctime_r_proto" in
11392         ''|0) try='char* ctime_r(const time_t*, char*);'
11393         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
11394         esac
11395         case "$ctime_r_proto" in
11396         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11397         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
11398         esac
11399         case "$ctime_r_proto" in
11400         ''|0) try='int ctime_r(const time_t*, char*);'
11401         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
11402         esac
11403         case "$ctime_r_proto" in
11404         ''|0) try='int ctime_r(const time_t*, char*, int);'
11405         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
11406         esac
11407         case "$ctime_r_proto" in
11408         ''|0)   d_ctime_r=undef
11409                 ctime_r_proto=0
11410                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11411         * )     case "$ctime_r_proto" in
11412                 REENTRANT_PROTO*) ;;
11413                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11414                 esac
11415                 echo "Prototype: $try" ;;
11416         esac
11417         ;;
11418         *)      case "$usethreads" in
11419                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11420                 esac
11421                 d_ctime_r=undef
11422                 ctime_r_proto=0
11423                 ;;
11424         esac
11425         ;;
11426 *)      ctime_r_proto=0
11427         ;;
11428 esac
11429
11430 : see if cuserid exists
11431 set cuserid d_cuserid
11432 eval $inlibc
11433
11434 : see if this is a limits.h system
11435 set limits.h i_limits
11436 eval $inhdr
11437
11438 : see if this is a float.h system
11439 set float.h i_float
11440 eval $inhdr
11441
11442 : See if number of significant digits in a double precision number is known
11443 echo " "
11444 $cat >dbl_dig.c <<EOM
11445 #$i_limits I_LIMITS
11446 #$i_float I_FLOAT
11447 #ifdef I_LIMITS
11448 #include <limits.h>
11449 #endif
11450 #ifdef I_FLOAT
11451 #include <float.h>
11452 #endif
11453 #ifdef DBL_DIG
11454 printf("Contains DBL_DIG");
11455 #endif
11456 EOM
11457 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11458 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11459         echo "DBL_DIG found." >&4
11460         val="$define"
11461 else
11462         echo "DBL_DIG NOT found." >&4
11463         val="$undef"
11464 fi
11465 $rm -f dbl_dig.?
11466 set d_dbl_dig
11467 eval $setvar
11468
11469 : see if dbm.h is available
11470 : see if dbmclose exists
11471 set dbmclose d_dbmclose
11472 eval $inlibc
11473
11474 case "$d_dbmclose" in
11475 $define)
11476         set dbm.h i_dbm
11477         eval $inhdr
11478         case "$i_dbm" in
11479         $define)
11480                 val="$undef"
11481                 set i_rpcsvcdbm
11482                 eval $setvar
11483                 ;;
11484         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11485                 eval $inhdr
11486                 ;;
11487         esac
11488         ;;
11489 *)      echo "We won't be including <dbm.h>"
11490         val="$undef"
11491         set i_dbm
11492         eval $setvar
11493         val="$undef"
11494         set i_rpcsvcdbm
11495         eval $setvar
11496         ;;
11497 esac
11498
11499 : see if prototype for dbminit is available
11500 echo " "
11501 set d_dbminitproto dbminit $i_dbm dbm.h
11502 eval $hasproto
11503
11504 : see if difftime exists
11505 set difftime d_difftime
11506 eval $inlibc
11507
11508 : see if this is a dirent system
11509 echo " "
11510 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11511         val="$define"
11512         echo "<dirent.h> found." >&4
11513 else
11514         val="$undef"
11515         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11516                 echo "<sys/dir.h> found." >&4
11517                 echo " "
11518         else
11519                 xinc=`./findhdr sys/ndir.h`
11520         fi
11521         echo "<dirent.h> NOT found." >&4
11522 fi
11523 set i_dirent
11524 eval $setvar
11525
11526 : Look for type of directory structure.
11527 echo " "
11528 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11529
11530 case "$direntrytype" in
11531 ''|' ')
11532         case "$i_dirent" in
11533         $define) guess1='struct dirent' ;;
11534         *) guess1='struct direct'  ;;
11535         esac
11536         ;;
11537 *)      guess1="$direntrytype"
11538         ;;
11539 esac
11540
11541 case "$guess1" in
11542 'struct dirent') guess2='struct direct' ;;
11543 *) guess2='struct dirent' ;;
11544 esac
11545
11546 if $contains "$guess1" try.c >/dev/null 2>&1; then
11547         direntrytype="$guess1"
11548         echo "Your directory entries are $direntrytype." >&4
11549 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11550         direntrytype="$guess2"
11551         echo "Your directory entries seem to be $direntrytype." >&4
11552 else
11553         echo "I don't recognize your system's directory entries." >&4
11554         rp="What type is used for directory entries on this system?"
11555         dflt="$guess1"
11556         . ./myread
11557         direntrytype="$ans"
11558 fi
11559 $rm_try
11560
11561 : see if the directory entry stores field length
11562 echo " "
11563 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11564 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11565         echo "Good, your directory entry keeps length information in d_namlen." >&4
11566         val="$define"
11567 else
11568         echo "Your directory entry does not know about the d_namlen field." >&4
11569         val="$undef"
11570 fi
11571 set d_dirnamlen
11572 eval $setvar
11573 $rm_try
11574
11575 : Look for DIR.dd_fd
11576 case "$i_dirent" in
11577 "$define")
11578     echo "Checking to see if DIR has a dd_fd member variable" >&4
11579     $cat >try.c <<EOCP
11580 #$i_stdlib I_STDLIB
11581 #ifdef I_STDLIB
11582 #include <stdlib.h>
11583 #endif
11584 #include <dirent.h>
11585
11586 int main() {
11587     DIR dir;
11588     dir.dd_fd = 1;
11589     return 0;
11590 }
11591 EOCP
11592     val=$undef
11593     set try
11594     if eval $compile; then
11595         echo "Yes, it does."
11596         val="$define"
11597     else
11598         echo "No, it does not."
11599         val="$undef"
11600     fi
11601     ;;
11602 *)
11603     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11604     val="$undef"
11605     ;;
11606 esac
11607 set d_dir_dd_fd
11608 eval $setvar
11609 $rm_try
11610
11611 : see if this is an sysdir system
11612 set sys/dir.h i_sysdir
11613 eval $inhdr
11614
11615 : see if this is an sysndir system
11616 set sys/ndir.h i_sysndir
11617 eval $inhdr
11618
11619 : Look for dirfd
11620 echo " "
11621 $cat >dirfd.c <<EOM
11622 #include <stdio.h>
11623 #$i_stdlib I_STDLIB
11624 #ifdef I_STDLIB
11625 #include <stdlib.h>
11626 #endif
11627 #$i_dirent I_DIRENT             /**/
11628 #$i_sysdir I_SYS_DIR            /**/
11629 #$i_sysndir I_SYS_NDIR          /**/
11630 #$i_systypes I_SYS_TYPES        /**/
11631 #if defined(I_SYS_TYPES)
11632 #include <sys/types.h>
11633 #endif
11634 #if defined(I_DIRENT)
11635 #include <dirent.h>
11636 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11637 #include <sys/dir.h>
11638 #endif
11639 #else
11640 #ifdef I_SYS_NDIR
11641 #include <sys/ndir.h>
11642 #else
11643 #ifdef I_SYS_DIR
11644 #ifdef hp9000s500
11645 #include <ndir.h>       /* may be wrong in the future */
11646 #else
11647 #include <sys/dir.h>
11648 #endif
11649 #endif
11650 #endif
11651 #endif 
11652 int main() {
11653         DIR *dirp = opendir(".");
11654         if (dirfd(dirp) >= 0)
11655                 exit(0);
11656         else
11657                 exit(1);
11658 }
11659 EOM
11660 val=$undef
11661 set dirfd
11662 if eval $compile; then
11663         val="$define"
11664 fi
11665 case "$val" in
11666 $define)        echo "dirfd() found." >&4       ;;
11667 *)              echo "dirfd() NOT found." >&4   ;;
11668 esac
11669 set d_dirfd
11670 eval $setvar
11671 $rm -f dirfd*
11672
11673 : see if dlerror exists
11674 xxx_runnm="$runnm"
11675 runnm=false
11676 set dlerror d_dlerror
11677 eval $inlibc
11678 runnm="$xxx_runnm"
11679
11680 : see if dlfcn is available
11681 set dlfcn.h i_dlfcn
11682 eval $inhdr
11683
11684 : Check what extension to use for shared libs
11685 case "$usedl" in
11686 $define|y|true)
11687         $cat << EOM
11688
11689 On a few systems, the dynamically loaded modules that perl generates and uses
11690 will need a different extension than shared libs. The default will probably
11691 be appropriate.
11692
11693 EOM
11694         case "$dlext" in
11695         '')     dflt="$so" ;;
11696         *)      dflt="$dlext" ;;
11697         esac
11698         rp='What is the extension of dynamically loaded modules'
11699         . ./myread
11700         dlext="$ans"
11701         ;;
11702 *)
11703         dlext="none"
11704         ;;
11705 esac
11706
11707 : Check if dlsym need a leading underscore
11708 echo " "
11709 val="$undef"
11710
11711 case "$dlsrc" in
11712 dl_dlopen.xs)
11713         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11714         $cat >dyna.c <<'EOM'
11715 fred () { }
11716 EOM
11717
11718 $cat >fred.c<<EOM
11719
11720 #include <stdio.h>
11721 #$i_stdlib I_STDLIB
11722 #ifdef I_STDLIB
11723 #include <stdlib.h>
11724 #endif
11725 #$i_dlfcn I_DLFCN
11726 #ifdef I_DLFCN
11727 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11728 #else
11729 #include <sys/types.h>
11730 #include <nlist.h>
11731 #include <link.h>
11732 #endif
11733
11734 extern int fred() ;
11735
11736 int main()
11737 {
11738     void * handle ;
11739     void * symbol ;
11740 #ifndef RTLD_LAZY
11741     int mode = 1 ;
11742 #else
11743     int mode = RTLD_LAZY ;
11744 #endif
11745     handle = dlopen("./dyna.$dlext", mode) ;
11746     if (handle == NULL) {
11747         printf ("1\n") ;
11748         fflush (stdout) ;
11749         exit(0);
11750     }
11751     symbol = dlsym(handle, "fred") ;
11752     if (symbol == NULL) {
11753         /* try putting a leading underscore */
11754         symbol = dlsym(handle, "_fred") ;
11755         if (symbol == NULL) {
11756             printf ("2\n") ;
11757             fflush (stdout) ;
11758             exit(0);
11759         }
11760         printf ("3\n") ;
11761     }
11762     else
11763         printf ("4\n") ;
11764     fflush (stdout) ;
11765     exit(0);
11766 }
11767 EOM
11768         : Call the object file tmp-dyna.o in case dlext=o.
11769         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11770                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11771                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
11772                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11773                 xxx=`$run ./fred`
11774                 case $xxx in
11775                 1)      echo "Test program failed using dlopen." >&4
11776                         echo "Perhaps you should not use dynamic loading." >&4;;
11777                 2)      echo "Test program failed using dlsym." >&4
11778                         echo "Perhaps you should not use dynamic loading." >&4;;
11779                 3)      echo "dlsym needs a leading underscore" >&4
11780                         val="$define" ;;
11781                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11782                 esac
11783         else
11784                 echo "I can't compile and run the test program." >&4
11785                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11786         fi
11787         ;;
11788 esac
11789
11790 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11791
11792 set d_dlsymun
11793 eval $setvar
11794
11795 : see if drand48_r exists
11796 set drand48_r d_drand48_r
11797 eval $inlibc
11798 case "$d_drand48_r" in
11799 "$define")
11800         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11801         case "$d_drand48_r_proto:$usethreads" in
11802         ":define")      d_drand48_r_proto=define
11803                 set d_drand48_r_proto drand48_r $hdrs
11804                 eval $hasproto ;;
11805         *)      ;;
11806         esac
11807         case "$d_drand48_r_proto" in
11808         define)
11809         case "$drand48_r_proto" in
11810         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11811         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11812         esac
11813         case "$drand48_r_proto" in
11814         ''|0)   d_drand48_r=undef
11815                 drand48_r_proto=0
11816                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11817         * )     case "$drand48_r_proto" in
11818                 REENTRANT_PROTO*) ;;
11819                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11820                 esac
11821                 echo "Prototype: $try" ;;
11822         esac
11823         ;;
11824         *)      case "$usethreads" in
11825                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11826                 esac
11827                 d_drand48_r=undef
11828                 drand48_r_proto=0
11829                 ;;
11830         esac
11831         ;;
11832 *)      drand48_r_proto=0
11833         ;;
11834 esac
11835
11836 : see if prototype for drand48 is available
11837 echo " "
11838 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11839 eval $hasproto
11840
11841 : see if dup2 exists
11842 set dup2 d_dup2
11843 eval $inlibc
11844
11845 : see if eaccess exists
11846 set eaccess d_eaccess
11847 eval $inlibc
11848
11849 : see if endgrent exists
11850 set endgrent d_endgrent
11851 eval $inlibc
11852
11853 : see if this is an grp system
11854 set grp.h i_grp
11855 eval $inhdr
11856
11857 case "$i_grp" in
11858 $define)
11859         xxx=`./findhdr grp.h`
11860         $cppstdin $cppflags $cppminus < $xxx >$$.h
11861
11862         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11863                 val="$define"
11864         else
11865                 val="$undef"
11866         fi
11867         set d_grpasswd
11868         eval $setvar
11869
11870         $rm -f $$.h
11871         ;;
11872 *)
11873         val="$undef";
11874         set d_grpasswd; eval $setvar
11875         ;;
11876 esac
11877
11878 : see if endgrent_r exists
11879 set endgrent_r d_endgrent_r
11880 eval $inlibc
11881 case "$d_endgrent_r" in
11882 "$define")
11883         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11884         case "$d_endgrent_r_proto:$usethreads" in
11885         ":define")      d_endgrent_r_proto=define
11886                 set d_endgrent_r_proto endgrent_r $hdrs
11887                 eval $hasproto ;;
11888         *)      ;;
11889         esac
11890         case "$d_endgrent_r_proto" in
11891         define)
11892         case "$endgrent_r_proto" in
11893         ''|0) try='int endgrent_r(FILE**);'
11894         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11895         esac
11896         case "$endgrent_r_proto" in
11897         ''|0) try='void endgrent_r(FILE**);'
11898         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11899         esac
11900         case "$endgrent_r_proto" in
11901         ''|0)   d_endgrent_r=undef
11902                 endgrent_r_proto=0
11903                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11904         * )     case "$endgrent_r_proto" in
11905                 REENTRANT_PROTO*) ;;
11906                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11907                 esac
11908                 echo "Prototype: $try" ;;
11909         esac
11910         ;;
11911         *)      case "$usethreads" in
11912                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11913                 esac
11914                 d_endgrent_r=undef
11915                 endgrent_r_proto=0
11916                 ;;
11917         esac
11918         ;;
11919 *)      endgrent_r_proto=0
11920         ;;
11921 esac
11922
11923 : see if endhostent exists
11924 set endhostent d_endhent
11925 eval $inlibc
11926
11927 : see if this is a netdb.h system
11928 set netdb.h i_netdb
11929 eval $inhdr
11930
11931 : see if endhostent_r exists
11932 set endhostent_r d_endhostent_r
11933 eval $inlibc
11934 case "$d_endhostent_r" in
11935 "$define")
11936         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11937         case "$d_endhostent_r_proto:$usethreads" in
11938         ":define")      d_endhostent_r_proto=define
11939                 set d_endhostent_r_proto endhostent_r $hdrs
11940                 eval $hasproto ;;
11941         *)      ;;
11942         esac
11943         case "$d_endhostent_r_proto" in
11944         define)
11945         case "$endhostent_r_proto" in
11946         ''|0) try='int endhostent_r(struct hostent_data*);'
11947         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11948         esac
11949         case "$endhostent_r_proto" in
11950         ''|0) try='void endhostent_r(struct hostent_data*);'
11951         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11952         esac
11953         case "$endhostent_r_proto" in
11954         ''|0)   d_endhostent_r=undef
11955                 endhostent_r_proto=0
11956                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11957         * )     case "$endhostent_r_proto" in
11958                 REENTRANT_PROTO*) ;;
11959                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11960                 esac
11961                 echo "Prototype: $try" ;;
11962         esac
11963         ;;
11964         *)      case "$usethreads" in
11965                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11966                 esac
11967                 d_endhostent_r=undef
11968                 endhostent_r_proto=0
11969                 ;;
11970         esac
11971         ;;
11972 *)      endhostent_r_proto=0
11973         ;;
11974 esac
11975
11976 : see if endnetent exists
11977 set endnetent d_endnent
11978 eval $inlibc
11979
11980 : see if endnetent_r exists
11981 set endnetent_r d_endnetent_r
11982 eval $inlibc
11983 case "$d_endnetent_r" in
11984 "$define")
11985         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11986         case "$d_endnetent_r_proto:$usethreads" in
11987         ":define")      d_endnetent_r_proto=define
11988                 set d_endnetent_r_proto endnetent_r $hdrs
11989                 eval $hasproto ;;
11990         *)      ;;
11991         esac
11992         case "$d_endnetent_r_proto" in
11993         define)
11994         case "$endnetent_r_proto" in
11995         ''|0) try='int endnetent_r(struct netent_data*);'
11996         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11997         esac
11998         case "$endnetent_r_proto" in
11999         ''|0) try='void endnetent_r(struct netent_data*);'
12000         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
12001         esac
12002         case "$endnetent_r_proto" in
12003         ''|0)   d_endnetent_r=undef
12004                 endnetent_r_proto=0
12005                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12006         * )     case "$endnetent_r_proto" in
12007                 REENTRANT_PROTO*) ;;
12008                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12009                 esac
12010                 echo "Prototype: $try" ;;
12011         esac
12012         ;;
12013         *)      case "$usethreads" in
12014                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12015                 esac
12016                 d_endnetent_r=undef
12017                 endnetent_r_proto=0
12018                 ;;
12019         esac
12020         ;;
12021 *)      endnetent_r_proto=0
12022         ;;
12023 esac
12024
12025 : see if endprotoent exists
12026 set endprotoent d_endpent
12027 eval $inlibc
12028
12029 : see if endprotoent_r exists
12030 set endprotoent_r d_endprotoent_r
12031 eval $inlibc
12032 case "$d_endprotoent_r" in
12033 "$define")
12034         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12035         case "$d_endprotoent_r_proto:$usethreads" in
12036         ":define")      d_endprotoent_r_proto=define
12037                 set d_endprotoent_r_proto endprotoent_r $hdrs
12038                 eval $hasproto ;;
12039         *)      ;;
12040         esac
12041         case "$d_endprotoent_r_proto" in
12042         define)
12043         case "$endprotoent_r_proto" in
12044         ''|0) try='int endprotoent_r(struct protoent_data*);'
12045         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
12046         esac
12047         case "$endprotoent_r_proto" in
12048         ''|0) try='void endprotoent_r(struct protoent_data*);'
12049         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
12050         esac
12051         case "$endprotoent_r_proto" in
12052         ''|0)   d_endprotoent_r=undef
12053                 endprotoent_r_proto=0
12054                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12055         * )     case "$endprotoent_r_proto" in
12056                 REENTRANT_PROTO*) ;;
12057                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12058                 esac
12059                 echo "Prototype: $try" ;;
12060         esac
12061         ;;
12062         *)      case "$usethreads" in
12063                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12064                 esac
12065                 d_endprotoent_r=undef
12066                 endprotoent_r_proto=0
12067                 ;;
12068         esac
12069         ;;
12070 *)      endprotoent_r_proto=0
12071         ;;
12072 esac
12073
12074 : see if endpwent exists
12075 set endpwent d_endpwent
12076 eval $inlibc
12077
12078 : see if this is a pwd.h system
12079 set pwd.h i_pwd
12080 eval $inhdr
12081
12082 case "$i_pwd" in
12083 $define)
12084         xxx=`./findhdr pwd.h`
12085         $cppstdin $cppflags $cppminus < $xxx >$$.h
12086
12087         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12088                 val="$define"
12089         else
12090                 val="$undef"
12091         fi
12092         set d_pwquota
12093         eval $setvar
12094
12095         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12096                 val="$define"
12097         else
12098                 val="$undef"
12099         fi
12100         set d_pwage
12101         eval $setvar
12102
12103         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12104                 val="$define"
12105         else
12106                 val="$undef"
12107         fi
12108         set d_pwchange
12109         eval $setvar
12110
12111         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12112                 val="$define"
12113         else
12114                 val="$undef"
12115         fi
12116         set d_pwclass
12117         eval $setvar
12118
12119         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12120                 val="$define"
12121         else
12122                 val="$undef"
12123         fi
12124         set d_pwexpire
12125         eval $setvar
12126
12127         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12128                 val="$define"
12129         else
12130                 val="$undef"
12131         fi
12132         set d_pwcomment
12133         eval $setvar
12134
12135         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12136                 val="$define"
12137         else
12138                 val="$undef"
12139         fi
12140         set d_pwgecos
12141         eval $setvar
12142
12143         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12144                 val="$define"
12145         else
12146                 val="$undef"
12147         fi
12148         set d_pwpasswd
12149         eval $setvar
12150
12151         $rm -f $$.h
12152         ;;
12153 *)
12154         val="$undef"; 
12155         set d_pwquota; eval $setvar
12156         set d_pwage; eval $setvar
12157         set d_pwchange; eval $setvar
12158         set d_pwclass; eval $setvar
12159         set d_pwexpire; eval $setvar
12160         set d_pwcomment; eval $setvar
12161         set d_pwgecos; eval $setvar
12162         set d_pwpasswd; eval $setvar
12163         ;;
12164 esac
12165
12166 : see if endpwent_r exists
12167 set endpwent_r d_endpwent_r
12168 eval $inlibc
12169 case "$d_endpwent_r" in
12170 "$define")
12171         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12172         case "$d_endpwent_r_proto:$usethreads" in
12173         ":define")      d_endpwent_r_proto=define
12174                 set d_endpwent_r_proto endpwent_r $hdrs
12175                 eval $hasproto ;;
12176         *)      ;;
12177         esac
12178         case "$d_endpwent_r_proto" in
12179         define)
12180         case "$endpwent_r_proto" in
12181         ''|0) try='int endpwent_r(FILE**);'
12182         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
12183         esac
12184         case "$endpwent_r_proto" in
12185         ''|0) try='void endpwent_r(FILE**);'
12186         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
12187         esac
12188         case "$endpwent_r_proto" in
12189         ''|0)   d_endpwent_r=undef
12190                 endpwent_r_proto=0
12191                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12192         * )     case "$endpwent_r_proto" in
12193                 REENTRANT_PROTO*) ;;
12194                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12195                 esac
12196                 echo "Prototype: $try" ;;
12197         esac
12198         ;;
12199         *)      case "$usethreads" in
12200                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12201                 esac
12202                 d_endpwent_r=undef
12203                 endpwent_r_proto=0
12204                 ;;
12205         esac
12206         ;;
12207 *)      endpwent_r_proto=0
12208         ;;
12209 esac
12210
12211 : see if endservent exists
12212 set endservent d_endsent
12213 eval $inlibc
12214
12215 : see if endservent_r exists
12216 set endservent_r d_endservent_r
12217 eval $inlibc
12218 case "$d_endservent_r" in
12219 "$define")
12220         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12221         case "$d_endservent_r_proto:$usethreads" in
12222         ":define")      d_endservent_r_proto=define
12223                 set d_endservent_r_proto endservent_r $hdrs
12224                 eval $hasproto ;;
12225         *)      ;;
12226         esac
12227         case "$d_endservent_r_proto" in
12228         define)
12229         case "$endservent_r_proto" in
12230         ''|0) try='int endservent_r(struct servent_data*);'
12231         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
12232         esac
12233         case "$endservent_r_proto" in
12234         ''|0) try='void endservent_r(struct servent_data*);'
12235         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
12236         esac
12237         case "$endservent_r_proto" in
12238         ''|0)   d_endservent_r=undef
12239                 endservent_r_proto=0
12240                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12241         * )     case "$endservent_r_proto" in
12242                 REENTRANT_PROTO*) ;;
12243                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12244                 esac
12245                 echo "Prototype: $try" ;;
12246         esac
12247         ;;
12248         *)      case "$usethreads" in
12249                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12250                 esac
12251                 d_endservent_r=undef
12252                 endservent_r_proto=0
12253                 ;;
12254         esac
12255         ;;
12256 *)      endservent_r_proto=0
12257         ;;
12258 esac
12259
12260 : Locate the flags for 'open()'
12261 echo " "
12262 $cat >try.c <<EOCP
12263 #include <sys/types.h>
12264 #ifdef I_FCNTL
12265 #include <fcntl.h>
12266 #endif
12267 #ifdef I_SYS_FILE
12268 #include <sys/file.h>
12269 #endif
12270 #$i_stdlib I_STDLIB
12271 #ifdef I_STDLIB
12272 #include <stdlib.h>
12273 #endif
12274 int main() {
12275         if(O_RDONLY);
12276 #ifdef O_TRUNC
12277         exit(0);
12278 #else
12279         exit(1);
12280 #endif
12281 }
12282 EOCP
12283 : check sys/file.h first to get FREAD on Sun
12284 if $test `./findhdr sys/file.h` && \
12285                 set try -DI_SYS_FILE && eval $compile; then
12286         h_sysfile=true;
12287         echo "<sys/file.h> defines the O_* constants..." >&4
12288         if $run ./try; then
12289                 echo "and you have the 3 argument form of open()." >&4
12290                 val="$define"
12291         else
12292                 echo "but not the 3 argument form of open().  Oh, well." >&4
12293                 val="$undef"
12294         fi
12295 elif $test `./findhdr fcntl.h` && \
12296                 set try -DI_FCNTL && eval $compile; then
12297         h_fcntl=true;
12298         echo "<fcntl.h> defines the O_* constants..." >&4
12299         if $run ./try; then
12300                 echo "and you have the 3 argument form of open()." >&4
12301                 val="$define"
12302         else
12303                 echo "but not the 3 argument form of open().  Oh, well." >&4
12304                 val="$undef"
12305         fi
12306 else
12307         val="$undef"
12308         echo "I can't find the O_* constant definitions!  You got problems." >&4
12309 fi
12310 set d_open3
12311 eval $setvar
12312 $rm_try
12313
12314 : script used to emit important warnings
12315 cat >warn <<EOS
12316 $startsh
12317 if test \$# -gt 0; then
12318         echo "\$@" >msg
12319 else
12320         cat >msg
12321 fi
12322 echo "*** WARNING:" >&4
12323 sed -e 's/^/*** /' <msg >&4
12324 echo "*** " >&4
12325 cat msg >>config.msg
12326 echo " " >>config.msg
12327 rm -f msg
12328 EOS
12329 chmod +x warn
12330 $eunicefix warn
12331
12332 : see which of string.h or strings.h is needed
12333 echo " "
12334 strings=`./findhdr string.h`
12335 if $test "$strings" && $test -r "$strings"; then
12336         echo "Using <string.h> instead of <strings.h>." >&4
12337         val="$define"
12338 else
12339         val="$undef"
12340         strings=`./findhdr strings.h`
12341         if $test "$strings" && $test -r "$strings"; then
12342                 echo "Using <strings.h> instead of <string.h>." >&4
12343         else
12344                 ./warn "No string header found -- You'll surely have problems."
12345         fi
12346 fi
12347 set i_string
12348 eval $setvar
12349 case "$i_string" in
12350 "$undef") strings=`./findhdr strings.h`;;
12351 *)        strings=`./findhdr string.h`;;
12352 esac
12353
12354 : see if this is a sys/file.h system
12355 val=''
12356 set sys/file.h val
12357 eval $inhdr
12358
12359 : do we need to include sys/file.h ?
12360 case "$val" in
12361 "$define")
12362         echo " "
12363         if $h_sysfile; then
12364                 val="$define"
12365                 echo "We'll be including <sys/file.h>." >&4
12366         else
12367                 val="$undef"
12368                 echo "We won't be including <sys/file.h>." >&4
12369         fi
12370         ;;
12371 *)
12372         h_sysfile=false
12373         ;;
12374 esac
12375 set i_sysfile
12376 eval $setvar
12377
12378 : see if fcntl.h is there
12379 val=''
12380 set fcntl.h val
12381 eval $inhdr
12382
12383 : see if we can include fcntl.h
12384 case "$val" in
12385 "$define")
12386         echo " "
12387         if $h_fcntl; then
12388                 val="$define"
12389                 echo "We'll be including <fcntl.h>." >&4
12390         else
12391                 val="$undef"
12392                 if $h_sysfile; then
12393         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12394                 else
12395                         echo "We won't be including <fcntl.h>." >&4
12396                 fi
12397         fi
12398         ;;
12399 *)
12400         h_fcntl=false
12401         val="$undef"
12402         ;;
12403 esac
12404 set i_fcntl
12405 eval $setvar
12406
12407 : see if fork exists
12408 set fork d_fork
12409 eval $inlibc
12410
12411 : see if pipe exists
12412 set pipe d_pipe
12413 eval $inlibc
12414
12415 : check for non-blocking I/O stuff
12416 case "$h_sysfile" in
12417 true) echo "#include <sys/file.h>" > head.c;;
12418 *)
12419        case "$h_fcntl" in
12420        true) echo "#include <fcntl.h>" > head.c;;
12421        *) echo "#include <sys/fcntl.h>" > head.c;;
12422        esac
12423        ;;
12424 esac
12425 echo " "
12426 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12427 case "$o_nonblock" in
12428 '')
12429         $cat head.c > try.c
12430         $cat >>try.c <<EOCP
12431 #include <stdio.h>
12432 #$i_stdlib I_STDLIB
12433 #ifdef I_STDLIB
12434 #include <stdlib.h>
12435 #endif
12436 #$i_fcntl I_FCNTL
12437 #ifdef I_FCNTL
12438 #include <fcntl.h>
12439 #endif
12440 int main() {
12441 #ifdef O_NONBLOCK
12442         printf("O_NONBLOCK\n");
12443         exit(0);
12444 #endif
12445 #ifdef O_NDELAY
12446         printf("O_NDELAY\n");
12447         exit(0);
12448 #endif
12449 #ifdef FNDELAY
12450         printf("FNDELAY\n");
12451         exit(0);
12452 #endif
12453         exit(0);
12454 }
12455 EOCP
12456         set try
12457         if eval $compile_ok; then
12458                 o_nonblock=`$run ./try`
12459                 case "$o_nonblock" in
12460                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12461                 *) echo "Seems like we can use $o_nonblock.";;
12462                 esac
12463         else
12464                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12465         fi
12466         ;;
12467 *) echo "Using $hint value $o_nonblock.";;
12468 esac
12469 $rm_try
12470
12471 echo " "
12472 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12473 case "$eagain" in
12474 '')
12475         case "$d_fork:$d_pipe" in
12476         define:define)
12477         $cat head.c > try.c
12478         $cat >>try.c <<EOCP
12479 #include <errno.h>
12480 #include <sys/types.h>
12481 #include <signal.h>
12482 #include <stdio.h>
12483 #$i_stdlib I_STDLIB
12484 #ifdef I_STDLIB
12485 #include <stdlib.h>
12486 #endif
12487 #$i_fcntl I_FCNTL
12488 #ifdef I_FCNTL
12489 #include <fcntl.h>
12490 #endif
12491 #define MY_O_NONBLOCK $o_nonblock
12492 #ifndef errno  /* XXX need better Configure test */
12493 extern int errno;
12494 #endif
12495 #$i_unistd I_UNISTD
12496 #ifdef I_UNISTD
12497 #include <unistd.h>
12498 #endif
12499 #$i_string I_STRING
12500 #ifdef I_STRING
12501 #include <string.h>
12502 #else
12503 #include <strings.h>
12504 #endif
12505 $signal_t blech(int x) { exit(3); }
12506 EOCP
12507         $cat >> try.c <<'EOCP'
12508 int main()
12509 {
12510         int pd[2];
12511         int pu[2];
12512         char buf[1];
12513         char string[100];
12514
12515         pipe(pd);       /* Down: child -> parent */
12516         pipe(pu);       /* Up: parent -> child */
12517         if (0 != fork()) {
12518                 int ret;
12519                 close(pd[1]);   /* Parent reads from pd[0] */
12520                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12521 #ifdef F_SETFL
12522                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12523                         exit(1);
12524 #else
12525                 exit(4);
12526 #endif
12527                 signal(SIGALRM, blech);
12528                 alarm(5);
12529                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12530                         exit(2);
12531                 sprintf(string, "%d\n", ret);
12532                 write(2, string, strlen(string));
12533                 alarm(0);
12534 #ifdef EAGAIN
12535                 if (errno == EAGAIN) {
12536                         printf("EAGAIN\n");
12537                         goto ok;
12538                 }
12539 #endif
12540 #ifdef EWOULDBLOCK
12541                 if (errno == EWOULDBLOCK)
12542                         printf("EWOULDBLOCK\n");
12543 #endif
12544         ok:
12545                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12546                 sleep(2);                               /* Give it time to close our pipe */
12547                 alarm(5);
12548                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12549                 alarm(0);
12550                 sprintf(string, "%d\n", ret);
12551                 write(4, string, strlen(string));
12552                 exit(0);
12553         }
12554
12555         close(pd[0]);                   /* We write to pd[1] */
12556         close(pu[1]);                   /* We read from pu[0] */
12557         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12558         close(pd[1]);                   /* Pipe pd is now fully closed! */
12559         exit(0);                                /* Bye bye, thank you for playing! */
12560 }
12561 EOCP
12562         set try
12563         if eval $compile_ok; then
12564                 echo "$startsh" >mtry
12565                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12566                 chmod +x mtry
12567                 ./mtry >/dev/null 2>&1
12568                 case $? in
12569                 0) eagain=`$cat try.out`;;
12570                 1) echo "Could not perform non-blocking setting!";;
12571                 2) echo "I did a successful read() for something that was not there!";;
12572                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12573                 4) echo "Could not find F_SETFL!";;
12574                 *) echo "Something terribly wrong happened during testing.";;
12575                 esac
12576                 rd_nodata=`$cat try.ret`
12577                 echo "A read() system call with no data present returns $rd_nodata."
12578                 case "$rd_nodata" in
12579                 0|-1) ;;
12580                 *)
12581                         echo "(That's peculiar, fixing that to be -1.)"
12582                         rd_nodata=-1
12583                         ;;
12584                 esac
12585                 case "$eagain" in
12586                 '')
12587                         echo "Forcing errno EAGAIN on read() with no data available."
12588                         eagain=EAGAIN
12589                         ;;
12590                 *)
12591                         echo "Your read() sets errno to $eagain when no data is available."
12592                         ;;
12593                 esac
12594                 status=`$cat try.err`
12595                 case "$status" in
12596                 0) echo "And it correctly returns 0 to signal EOF.";;
12597                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12598                 *) echo "However, your read() returns '$status' on EOF??";;
12599                 esac
12600                 val="$define"
12601                 if test "$status" = "$rd_nodata"; then
12602                         echo "WARNING: you can't distinguish between EOF and no data!"
12603                         val="$undef"
12604                 fi
12605         else
12606                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12607                 eagain=EAGAIN
12608         fi
12609         ;;
12610         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12611                 eagain=EAGAIN
12612                 val="$define"
12613                 ;;
12614         esac
12615         set d_eofnblk
12616         eval $setvar
12617         ;;
12618 *)
12619         echo "Using $hint value $eagain."
12620         echo "Your read() returns $rd_nodata when no data is present."
12621         case "$d_eofnblk" in
12622         "$define") echo "And you can see EOF because read() returns 0.";;
12623         "$undef") echo "But you can't see EOF status from read() returned value.";;
12624         *)
12625                 echo "(Assuming you can't see EOF status from read anyway.)"
12626                 d_eofnblk=$undef
12627                 ;;
12628         esac
12629         ;;
12630 esac
12631 $rm_try head.c mtry
12632
12633 : see if _ptr and _cnt from stdio act std
12634 echo " "
12635
12636 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12637         echo "(Looks like you have stdio.h from BSD.)"
12638         case "$stdio_ptr" in
12639         '') stdio_ptr='((fp)->_p)'
12640                 ptr_lval=$define
12641                 ;;
12642         *)      ptr_lval=$d_stdio_ptr_lval;;
12643         esac
12644         case "$stdio_cnt" in
12645         '') stdio_cnt='((fp)->_r)'
12646                 cnt_lval=$define
12647                 ;;
12648         *)      cnt_lval=$d_stdio_cnt_lval;;
12649         esac
12650         case "$stdio_base" in
12651         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12652         esac
12653         case "$stdio_bufsiz" in
12654         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12655         esac
12656 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12657         echo "(Looks like you have stdio.h from Linux.)"
12658         case "$stdio_ptr" in
12659         '') stdio_ptr='((fp)->_IO_read_ptr)'
12660                 ptr_lval=$define
12661                 ;;
12662         *)      ptr_lval=$d_stdio_ptr_lval;;
12663         esac
12664         case "$stdio_cnt" in
12665         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12666                 cnt_lval=$undef
12667                 ;;
12668         *)      cnt_lval=$d_stdio_cnt_lval;;
12669         esac
12670         case "$stdio_base" in
12671         '') stdio_base='((fp)->_IO_read_base)';;
12672         esac
12673         case "$stdio_bufsiz" in
12674         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12675         esac
12676 else
12677         case "$stdio_ptr" in
12678         '') stdio_ptr='((fp)->_ptr)'
12679                 ptr_lval=$define
12680                 ;;
12681         *)      ptr_lval=$d_stdio_ptr_lval;;
12682         esac
12683         case "$stdio_cnt" in
12684         '') stdio_cnt='((fp)->_cnt)'
12685                 cnt_lval=$define
12686                 ;;
12687         *)      cnt_lval=$d_stdio_cnt_lval;;
12688         esac
12689         case "$stdio_base" in
12690         '') stdio_base='((fp)->_base)';;
12691         esac
12692         case "$stdio_bufsiz" in
12693         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12694         esac
12695 fi
12696
12697 : test whether _ptr and _cnt really work
12698 echo "Checking how std your stdio is..." >&4
12699 $cat >try.c <<EOP
12700 #include <stdio.h>
12701 #$i_stdlib I_STDLIB
12702 #ifdef I_STDLIB
12703 #include <stdlib.h>
12704 #endif
12705 #define FILE_ptr(fp)    $stdio_ptr
12706 #define FILE_cnt(fp)    $stdio_cnt
12707 int main() {
12708         FILE *fp = fopen("try.c", "r");
12709         char c = getc(fp);
12710         if (
12711                 18 <= FILE_cnt(fp) &&
12712                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12713         )
12714                 exit(0);
12715         exit(1);
12716 }
12717 EOP
12718 val="$undef"
12719 set try
12720 if eval $compile && $to try.c; then
12721         if $run ./try; then
12722                 echo "Your stdio acts pretty std."
12723                 val="$define"
12724         else
12725                 echo "Your stdio isn't very std."
12726         fi
12727 else
12728         echo "Your stdio doesn't appear very std."
12729 fi
12730 $rm_try
12731
12732 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12733 # direct buffer manipulation no longer works.  The Configure tests
12734 # should be changed to correctly detect this, but until then,
12735 # the following check should at least let perl compile and run.
12736 # (This quick fix should be updated before 5.8.1.)
12737 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12738 # A. Dougherty, June 3, 2002.
12739 case "$d_gnulibc" in
12740 $define)
12741         case "$gnulibc_version" in
12742         2.[01]*)  ;;
12743         2.2) ;;
12744         2.2.[0-9]) ;;
12745         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12746                 val="$undef"
12747                 ;;
12748         esac
12749         ;;
12750 esac
12751 set d_stdstdio
12752 eval $setvar
12753
12754 : Can _ptr be used as an lvalue?
12755 case "$d_stdstdio$ptr_lval" in
12756 $define$define) val=$define ;;
12757 *) val=$undef ;;
12758 esac
12759 set d_stdio_ptr_lval
12760 eval $setvar
12761
12762 : Can _cnt be used as an lvalue?
12763 case "$d_stdstdio$cnt_lval" in
12764 $define$define) val=$define ;;
12765 *) val=$undef ;;
12766 esac
12767 set d_stdio_cnt_lval
12768 eval $setvar
12769
12770
12771 : test whether setting _ptr sets _cnt as a side effect
12772 d_stdio_ptr_lval_sets_cnt="$undef"
12773 d_stdio_ptr_lval_nochange_cnt="$undef"
12774 case "$d_stdio_ptr_lval$d_stdstdio" in
12775 $define$define)
12776         echo "Checking to see what happens if we set the stdio ptr..." >&4
12777 $cat >try.c <<EOP
12778 #include <stdio.h>
12779 /* Can we scream? */
12780 /* Eat dust sed :-) */
12781 /* In the buffer space, no one can hear you scream. */
12782 #$i_stdlib I_STDLIB
12783 #ifdef I_STDLIB
12784 #include <stdlib.h>
12785 #endif
12786 #define FILE_ptr(fp)    $stdio_ptr
12787 #define FILE_cnt(fp)    $stdio_cnt
12788 #include <sys/types.h>
12789 int main() {
12790         FILE *fp = fopen("try.c", "r");
12791         int c;
12792         char *ptr;
12793         size_t cnt;
12794         if (!fp) {
12795             puts("Fail even to read");
12796             exit(1);
12797         }
12798         c = getc(fp); /* Read away the first # */
12799         if (c == EOF) {
12800             puts("Fail even to read");
12801             exit(1);
12802         }
12803         if (!(
12804                 18 <= FILE_cnt(fp) &&
12805                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12806         )) {
12807                 puts("Fail even to read");
12808                 exit (1);
12809         }
12810         ptr = (char*) FILE_ptr(fp);
12811         cnt = (size_t)FILE_cnt(fp);
12812
12813         FILE_ptr(fp) += 42;
12814
12815         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12816                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12817                 exit (1);
12818         }
12819         if (FILE_cnt(fp) <= 20) {
12820                 printf ("Fail (<20 chars to test)");
12821                 exit (1);
12822         }
12823         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12824                 puts("Fail compare");
12825                 exit (1);
12826         }
12827         if (cnt == FILE_cnt(fp)) {
12828                 puts("Pass_unchanged");
12829                 exit (0);
12830         }
12831         if (FILE_cnt(fp) == (cnt - 42)) {
12832                 puts("Pass_changed");
12833                 exit (0);
12834         }
12835         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12836         return 1;
12837
12838 }
12839 EOP
12840         set try
12841         if eval $compile && $to try.c; then
12842                 case `$run ./try` in
12843                 Pass_changed)
12844                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12845                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12846                 Pass_unchanged)
12847                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12848                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12849                 Fail*)
12850                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12851                 *)
12852                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12853         esac
12854         else
12855                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12856         fi
12857         $rm_try
12858         ;;
12859 esac
12860
12861 : see if _base is also standard
12862 val="$undef"
12863 case "$d_stdstdio" in
12864 $define)
12865         $cat >try.c <<EOP
12866 #include <stdio.h>
12867 #$i_stdlib I_STDLIB
12868 #ifdef I_STDLIB
12869 #include <stdlib.h>
12870 #endif
12871 #define FILE_base(fp)   $stdio_base
12872 #define FILE_bufsiz(fp) $stdio_bufsiz
12873 int main() {
12874         FILE *fp = fopen("try.c", "r");
12875         char c = getc(fp);
12876         if (
12877                 19 <= FILE_bufsiz(fp) &&
12878                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12879         )
12880                 exit(0);
12881         exit(1);
12882 }
12883 EOP
12884         set try
12885         if eval $compile && $to try.c; then
12886                 if $run ./try; then
12887                         echo "And its _base field acts std."
12888                         val="$define"
12889                 else
12890                         echo "But its _base field isn't std."
12891                 fi
12892         else
12893                 echo "However, it seems to be lacking the _base field."
12894         fi
12895         $rm_try
12896         ;;
12897 esac
12898 set d_stdiobase
12899 eval $setvar
12900
12901 : see if fast_stdio exists
12902 val="$undef"
12903 case "$d_stdstdio:$d_stdio_ptr_lval" in
12904 "$define:$define")
12905         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12906         *$define*)
12907                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12908                 val="$define"
12909                 ;;
12910         esac
12911         ;;
12912 esac
12913 set d_faststdio
12914 eval $setvar
12915
12916
12917
12918 : see if fchdir exists
12919 set fchdir d_fchdir
12920 eval $inlibc
12921
12922 : see if fchmod exists
12923 set fchmod d_fchmod
12924 eval $inlibc
12925
12926 : see if fchown exists
12927 set fchown d_fchown
12928 eval $inlibc
12929
12930 : see if this is an fcntl system
12931 set fcntl d_fcntl
12932 eval $inlibc
12933
12934 : See if fcntl-based locking works.
12935 echo " "
12936 $cat >try.c <<EOCP
12937 #$i_stdlib I_STDLIB
12938 #ifdef I_STDLIB
12939 #include <stdlib.h>
12940 #endif
12941 #include <unistd.h>
12942 #include <fcntl.h>
12943 #include <signal.h>
12944 $signal_t blech(int x) { exit(3); }
12945 int main() {
12946 #if defined(F_SETLK) && defined(F_SETLKW)
12947      struct flock flock;
12948      int retval, fd;
12949      fd = open("try.c", O_RDONLY);
12950      flock.l_type = F_RDLCK;
12951      flock.l_whence = SEEK_SET;
12952      flock.l_start = flock.l_len = 0;
12953      signal(SIGALRM, blech);
12954      alarm(10);
12955      retval = fcntl(fd, F_SETLK, &flock);
12956      close(fd);
12957      (retval < 0 ? exit(2) : exit(0));
12958 #else
12959      exit(2);
12960 #endif
12961 }
12962 EOCP
12963 echo "Checking if fcntl-based file locking works... "
12964 case "$d_fcntl" in
12965 "$define")
12966         set try
12967         if eval $compile_ok; then
12968                 if $run ./try; then
12969                         echo "Yes, it seems to work."
12970                         val="$define"
12971                 else
12972                         echo "Nope, it didn't work."
12973                         val="$undef"
12974                         case "$?" in
12975                         3) $cat >&4 <<EOM
12976 ***
12977 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12978 *** This is (almost) impossible.
12979 *** If your NFS lock daemons are not feeling well, something like
12980 *** this may happen, please investigate.  Cannot continue, aborting.
12981 ***
12982 EOM
12983                                 exit 1
12984                                 ;;
12985                         esac
12986                 fi
12987         else
12988                 echo "I'm unable to compile the test program, so I'll assume not."
12989                 val="$undef"
12990         fi
12991         ;;
12992 *) val="$undef";
12993         echo "Nope, since you don't even have fcntl()."
12994         ;;
12995 esac
12996 set d_fcntl_can_lock
12997 eval $setvar
12998 $rm_try
12999
13000 : check for fd_set items
13001 $cat <<EOM
13002
13003 Checking to see how well your C compiler handles fd_set and friends ...
13004 EOM
13005 $cat >try.c <<EOCP
13006 #$i_stdlib I_STDLIB
13007 #ifdef I_STDLIB
13008 #include <stdlib.h>
13009 #endif
13010 #$i_systime I_SYS_TIME
13011 #$i_sysselct I_SYS_SELECT
13012 #$d_socket HAS_SOCKET
13013 #include <sys/types.h>
13014 #ifdef HAS_SOCKET
13015 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13016 #endif
13017 #ifdef I_SYS_TIME
13018 #include <sys/time.h>
13019 #endif
13020 #ifdef I_SYS_SELECT
13021 #include <sys/select.h>
13022 #endif
13023 int main() {
13024         fd_set fds;
13025
13026 #ifdef TRYBITS
13027         if(fds.fds_bits);
13028 #endif
13029
13030 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13031         exit(0);
13032 #else
13033         exit(1);
13034 #endif
13035 }
13036 EOCP
13037 set try -DTRYBITS
13038 if eval $compile; then
13039         d_fds_bits="$define"
13040         d_fd_set="$define"
13041         echo "Well, your system knows about the normal fd_set typedef..." >&4
13042         if $run ./try; then
13043                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13044                 d_fd_macros="$define"
13045         else
13046                 $cat >&4 <<'EOM'
13047 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13048 EOM
13049                 d_fd_macros="$undef"
13050         fi
13051 else
13052         $cat <<'EOM'
13053 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13054 EOM
13055         set try
13056         if eval $compile; then
13057                 d_fds_bits="$undef"
13058                 d_fd_set="$define"
13059                 echo "Well, your system has some sort of fd_set available..." >&4
13060                 if $run ./try; then
13061                         echo "and you have the normal fd_set macros." >&4
13062                         d_fd_macros="$define"
13063                 else
13064                         $cat <<'EOM'
13065 but not the normal fd_set macros!  Gross!  More work for me...
13066 EOM
13067                         d_fd_macros="$undef"
13068                 fi
13069         else
13070         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13071                 d_fd_set="$undef"
13072                 d_fds_bits="$undef"
13073                 d_fd_macros="$undef"
13074         fi
13075 fi
13076 $rm_try
13077
13078 : see if fgetpos exists
13079 set fgetpos d_fgetpos
13080 eval $inlibc
13081
13082 : see if finite exists
13083 set finite d_finite
13084 eval $inlibc
13085
13086 : see if finitel exists
13087 set finitel d_finitel
13088 eval $inlibc
13089
13090 : see if flock exists
13091 set flock d_flock
13092 eval $inlibc
13093
13094 : see if prototype for flock is available
13095 echo " "
13096 set d_flockproto flock $i_sysfile sys/file.h
13097 eval $hasproto
13098
13099 : see if fp_class exists
13100 set fp_class d_fp_class
13101 eval $inlibc
13102
13103 : see if pathconf exists
13104 set pathconf d_pathconf
13105 eval $inlibc
13106
13107 : see if fpathconf exists
13108 set fpathconf d_fpathconf
13109 eval $inlibc
13110
13111 : see if fpclass exists
13112 set fpclass d_fpclass
13113 eval $inlibc
13114
13115 : see if fpclassify exists
13116 set fpclassify d_fpclassify
13117 eval $inlibc
13118
13119 : see if fpclassl exists
13120 set fpclassl d_fpclassl
13121 eval $inlibc
13122
13123 : check for fpos64_t
13124 echo " "
13125 echo "Checking to see if you have fpos64_t..." >&4
13126 $cat >try.c <<EOCP
13127 #include <stdio.h>
13128 int main() { fpos64_t x = 7; }
13129 EOCP
13130 set try
13131 if eval $compile; then
13132         val="$define"
13133         echo "You have fpos64_t."
13134 else
13135         val="$undef"
13136         echo "You do not have fpos64_t."
13137         case "$fpossize" in
13138         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13139         esac
13140 fi
13141 $rm_try
13142 set d_fpos64_t
13143 eval $setvar
13144
13145 : see if frexpl exists
13146 set frexpl d_frexpl
13147 eval $inlibc
13148
13149 : see if this is a sys/param system
13150 set sys/param.h i_sysparam
13151 eval $inhdr
13152
13153 : see if this is a sys/mount.h system
13154 set sys/mount.h i_sysmount
13155 eval $inhdr
13156
13157 : Check for fs_data_s
13158 echo " "
13159 echo "Checking to see if your system supports struct fs_data..." >&4
13160 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13161 eval $hasstruct
13162 case "$d_fs_data_s" in
13163 "$define")      echo "Yes, it does."   ;;
13164 *)              echo "No, it doesn't." ;;
13165 esac
13166
13167 : see if fseeko exists
13168 set fseeko d_fseeko
13169 eval $inlibc
13170 case "$longsize" in
13171 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13172 esac
13173
13174 : see if fsetpos exists
13175 set fsetpos d_fsetpos
13176 eval $inlibc
13177
13178 : see if fstatfs exists
13179 set fstatfs d_fstatfs
13180 eval $inlibc
13181
13182 : see if statvfs exists
13183 set statvfs d_statvfs
13184 eval $inlibc
13185
13186 : see if fstatvfs exists
13187 set fstatvfs d_fstatvfs
13188 eval $inlibc
13189
13190
13191 : see if fsync exists
13192 set fsync d_fsync
13193 eval $inlibc
13194
13195 : see if ftello exists
13196 set ftello d_ftello
13197 eval $inlibc
13198 case "$longsize" in
13199 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13200 esac
13201
13202 : check for a working futimes
13203 d_futimes="$undef"
13204 echo " "
13205 echo "Checking if you have a working futimes()" >&4
13206 $cat >try.c <<EOCP
13207 #include <stdio.h>
13208 #include <sys/time.h>
13209 #include <errno.h>
13210 #include <fcntl.h>
13211
13212 int main ()
13213 {
13214     int fd, rv;
13215     fd = open ("try.c", O_RDWR);
13216     if (-1 == fd) exit (1);
13217     rv = futimes (fd, NULL);
13218     exit (rv == -1 ? errno : 0);
13219 }
13220 EOCP
13221 set try
13222 if eval $compile; then
13223     `$run ./try`
13224     rc=$?
13225     case "$rc" in
13226         0)  echo "Yes, you have" >&4
13227             d_futimes="$define"
13228             ;;
13229         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13230             ;;
13231     esac
13232 else
13233     echo "No, it does not (probably harmless)" >&4
13234 fi
13235 $rm_try
13236
13237 : see if getcwd exists
13238 set getcwd d_getcwd
13239 eval $inlibc
13240
13241 : see if getespwnam exists
13242 set getespwnam d_getespwnam
13243 eval $inlibc
13244
13245 : see if getfsstat exists
13246 set getfsstat d_getfsstat
13247 eval $inlibc
13248
13249 : see if getgrent exists
13250 set getgrent d_getgrent
13251 eval $inlibc
13252
13253 : see if getgrent_r exists
13254 set getgrent_r d_getgrent_r
13255 eval $inlibc
13256 case "$d_getgrent_r" in
13257 "$define")
13258         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13259         case "$d_getgrent_r_proto:$usethreads" in
13260         ":define")      d_getgrent_r_proto=define
13261                 set d_getgrent_r_proto getgrent_r $hdrs
13262                 eval $hasproto ;;
13263         *)      ;;
13264         esac
13265         case "$d_getgrent_r_proto" in
13266         define)
13267         case "$getgrent_r_proto" in
13268         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13269         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13270         esac
13271         case "$getgrent_r_proto" in
13272         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13273         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13274         esac
13275         case "$getgrent_r_proto" in
13276         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13277         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
13278         esac
13279         case "$getgrent_r_proto" in
13280         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13281         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
13282         esac
13283         case "$getgrent_r_proto" in
13284         ''|0) try='int getgrent_r(struct group*, char*, int);'
13285         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
13286         esac
13287         case "$getgrent_r_proto" in
13288         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13289         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13290         esac
13291         case "$getgrent_r_proto" in
13292         ''|0)   d_getgrent_r=undef
13293                 getgrent_r_proto=0
13294                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13295         * )     case "$getgrent_r_proto" in
13296                 REENTRANT_PROTO*) ;;
13297                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13298                 esac
13299                 echo "Prototype: $try" ;;
13300         esac
13301         ;;
13302         *)      case "$usethreads" in
13303                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13304                 esac
13305                 d_getgrent_r=undef
13306                 getgrent_r_proto=0
13307                 ;;
13308         esac
13309         ;;
13310 *)      getgrent_r_proto=0
13311         ;;
13312 esac
13313
13314 : see if getgrgid_r exists
13315 set getgrgid_r d_getgrgid_r
13316 eval $inlibc
13317 case "$d_getgrgid_r" in
13318 "$define")
13319         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13320         case "$d_getgrgid_r_proto:$usethreads" in
13321         ":define")      d_getgrgid_r_proto=define
13322                 set d_getgrgid_r_proto getgrgid_r $hdrs
13323                 eval $hasproto ;;
13324         *)      ;;
13325         esac
13326         case "$d_getgrgid_r_proto" in
13327         define)
13328         case "$getgrgid_r_proto" in
13329         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13330         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13331         esac
13332         case "$getgrgid_r_proto" in
13333         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13334         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13335         esac
13336         case "$getgrgid_r_proto" in
13337         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13338         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13339         esac
13340         case "$getgrgid_r_proto" in
13341         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13342         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13343         esac
13344         case "$getgrgid_r_proto" in
13345         ''|0)   d_getgrgid_r=undef
13346                 getgrgid_r_proto=0
13347                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13348         * )     case "$getgrgid_r_proto" in
13349                 REENTRANT_PROTO*) ;;
13350                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13351                 esac
13352                 echo "Prototype: $try" ;;
13353         esac
13354         ;;
13355         *)      case "$usethreads" in
13356                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13357                 esac
13358                 d_getgrgid_r=undef
13359                 getgrgid_r_proto=0
13360                 ;;
13361         esac
13362         ;;
13363 *)      getgrgid_r_proto=0
13364         ;;
13365 esac
13366
13367 : see if getgrnam_r exists
13368 set getgrnam_r d_getgrnam_r
13369 eval $inlibc
13370 case "$d_getgrnam_r" in
13371 "$define")
13372         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13373         case "$d_getgrnam_r_proto:$usethreads" in
13374         ":define")      d_getgrnam_r_proto=define
13375                 set d_getgrnam_r_proto getgrnam_r $hdrs
13376                 eval $hasproto ;;
13377         *)      ;;
13378         esac
13379         case "$d_getgrnam_r_proto" in
13380         define)
13381         case "$getgrnam_r_proto" in
13382         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13383         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13384         esac
13385         case "$getgrnam_r_proto" in
13386         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13387         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13388         esac
13389         case "$getgrnam_r_proto" in
13390         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13391         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13392         esac
13393         case "$getgrnam_r_proto" in
13394         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13395         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13396         esac
13397         case "$getgrnam_r_proto" in
13398         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13399         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13400         esac
13401         case "$getgrnam_r_proto" in
13402         ''|0)   d_getgrnam_r=undef
13403                 getgrnam_r_proto=0
13404                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13405         * )     case "$getgrnam_r_proto" in
13406                 REENTRANT_PROTO*) ;;
13407                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13408                 esac
13409                 echo "Prototype: $try" ;;
13410         esac
13411         ;;
13412         *)      case "$usethreads" in
13413                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13414                 esac
13415                 d_getgrnam_r=undef
13416                 getgrnam_r_proto=0
13417                 ;;
13418         esac
13419         ;;
13420 *)      getgrnam_r_proto=0
13421         ;;
13422 esac
13423
13424 : see if gethostbyaddr exists
13425 set gethostbyaddr d_gethbyaddr
13426 eval $inlibc
13427
13428 : see if gethostbyname exists
13429 set gethostbyname d_gethbyname
13430 eval $inlibc
13431
13432 : see if gethostent exists
13433 set gethostent d_gethent
13434 eval $inlibc
13435
13436 : see how we will look up host name
13437 echo " "
13438 call=''
13439 if set gethostname val -f d_gethname; eval $csym; $val; then
13440         echo 'gethostname() found.' >&4
13441         d_gethname="$define"
13442         call=gethostname
13443 fi
13444 if set uname val -f d_uname; eval $csym; $val; then
13445         if ./xenix; then
13446                 $cat <<'EOM'
13447 uname() was found, but you're running xenix, and older versions of xenix
13448 have a broken uname(). If you don't really know whether your xenix is old
13449 enough to have a broken system call, use the default answer.
13450
13451 EOM
13452                 dflt=y
13453                 case "$d_uname" in
13454                 "$define") dflt=n;;
13455                 esac
13456                 rp='Is your uname() broken?'
13457                 . ./myread
13458                 case "$ans" in
13459                 n*) d_uname="$define"; call=uname;;
13460                 esac
13461         else
13462                 echo 'uname() found.' >&4
13463                 d_uname="$define"
13464                 case "$call" in
13465                 '') call=uname ;;
13466                 esac
13467         fi
13468 fi
13469 case "$d_gethname" in
13470 '') d_gethname="$undef";;
13471 esac
13472 case "$d_uname" in
13473 '') d_uname="$undef";;
13474 esac
13475 case "$d_uname$d_gethname" in
13476 *define*)
13477         dflt=n
13478         cat <<EOM
13479
13480 Every now and then someone has a $call() that lies about the hostname
13481 but can't be fixed for political or economic reasons.  If you wish, I can
13482 pretend $call() isn't there and maybe compute hostname at run-time
13483 thanks to the '$phostname' command.
13484
13485 EOM
13486         rp="Shall I ignore $call() from now on?"
13487         . ./myread
13488         case "$ans" in
13489         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13490         esac;;
13491 esac
13492 case "$phostname" in
13493 '') aphostname='';;
13494 *) case "$aphostname" in
13495         /*) ;;
13496         *) set X $phostname
13497                 shift
13498                 file=$1
13499                 shift
13500                 file=`./loc $file $file $pth`
13501                 aphostname=`echo $file $*`
13502                 ;;
13503         esac
13504         ;;
13505 esac
13506 case "$d_uname$d_gethname" in
13507 *define*) ;;
13508 *)
13509         case "$phostname" in
13510         '')
13511                 echo "There will be no way for $package to get your hostname." >&4;;
13512         *)
13513         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13514                 ;;
13515         esac;;
13516 esac
13517 case "$d_phostname" in
13518 '') d_phostname="$undef";;
13519 esac
13520
13521 : see if gethostbyaddr_r exists
13522 set gethostbyaddr_r d_gethostbyaddr_r
13523 eval $inlibc
13524 case "$d_gethostbyaddr_r" in
13525 "$define")
13526         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13527         case "$d_gethostbyaddr_r_proto:$usethreads" in
13528         ":define")      d_gethostbyaddr_r_proto=define
13529                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13530                 eval $hasproto ;;
13531         *)      ;;
13532         esac
13533         case "$d_gethostbyaddr_r_proto" in
13534         define)
13535         case "$gethostbyaddr_r_proto" in
13536         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13537         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13538         esac
13539         case "$gethostbyaddr_r_proto" in
13540         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13541         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13542         esac
13543         case "$gethostbyaddr_r_proto" in
13544         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13545         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13546         esac
13547         case "$gethostbyaddr_r_proto" in
13548         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13549         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13550         esac
13551         case "$gethostbyaddr_r_proto" in
13552         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13553         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13554         esac
13555         case "$gethostbyaddr_r_proto" in
13556         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13557         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13558         esac
13559         case "$gethostbyaddr_r_proto" in
13560         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13561         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13562         esac
13563         case "$gethostbyaddr_r_proto" in
13564         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13565         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13566         esac
13567         case "$gethostbyaddr_r_proto" in
13568         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13569         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13570         esac
13571         case "$gethostbyaddr_r_proto" in
13572         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13573         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13574         esac
13575         case "$gethostbyaddr_r_proto" in
13576         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13577         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13578         esac
13579         case "$gethostbyaddr_r_proto" in
13580         ''|0)   d_gethostbyaddr_r=undef
13581                 gethostbyaddr_r_proto=0
13582                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13583         * )     case "$gethostbyaddr_r_proto" in
13584                 REENTRANT_PROTO*) ;;
13585                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13586                 esac
13587                 echo "Prototype: $try" ;;
13588         esac
13589         ;;
13590         *)      case "$usethreads" in
13591                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13592                 esac
13593                 d_gethostbyaddr_r=undef
13594                 gethostbyaddr_r_proto=0
13595                 ;;
13596         esac
13597         ;;
13598 *)      gethostbyaddr_r_proto=0
13599         ;;
13600 esac
13601
13602 : see if gethostbyname_r exists
13603 set gethostbyname_r d_gethostbyname_r
13604 eval $inlibc
13605 case "$d_gethostbyname_r" in
13606 "$define")
13607         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13608         case "$d_gethostbyname_r_proto:$usethreads" in
13609         ":define")      d_gethostbyname_r_proto=define
13610                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13611                 eval $hasproto ;;
13612         *)      ;;
13613         esac
13614         case "$d_gethostbyname_r_proto" in
13615         define)
13616         case "$gethostbyname_r_proto" in
13617         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13618         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13619         esac
13620         case "$gethostbyname_r_proto" in
13621         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13622         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13623         esac
13624         case "$gethostbyname_r_proto" in
13625         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13626         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13627         esac
13628         case "$gethostbyname_r_proto" in
13629         ''|0)   d_gethostbyname_r=undef
13630                 gethostbyname_r_proto=0
13631                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13632         * )     case "$gethostbyname_r_proto" in
13633                 REENTRANT_PROTO*) ;;
13634                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13635                 esac
13636                 echo "Prototype: $try" ;;
13637         esac
13638         ;;
13639         *)      case "$usethreads" in
13640                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13641                 esac
13642                 d_gethostbyname_r=undef
13643                 gethostbyname_r_proto=0
13644                 ;;
13645         esac
13646         ;;
13647 *)      gethostbyname_r_proto=0
13648         ;;
13649 esac
13650
13651 : see if gethostent_r exists
13652 set gethostent_r d_gethostent_r
13653 eval $inlibc
13654 case "$d_gethostent_r" in
13655 "$define")
13656         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13657         case "$d_gethostent_r_proto:$usethreads" in
13658         ":define")      d_gethostent_r_proto=define
13659                 set d_gethostent_r_proto gethostent_r $hdrs
13660                 eval $hasproto ;;
13661         *)      ;;
13662         esac
13663         case "$d_gethostent_r_proto" in
13664         define)
13665         case "$gethostent_r_proto" in
13666         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13667         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13668         esac
13669         case "$gethostent_r_proto" in
13670         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13671         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13672         esac
13673         case "$gethostent_r_proto" in
13674         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13675         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13676         esac
13677         case "$gethostent_r_proto" in
13678         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13679         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13680         esac
13681         case "$gethostent_r_proto" in
13682         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13683         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13684         esac
13685         case "$gethostent_r_proto" in
13686         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13687         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13688         esac
13689         case "$gethostent_r_proto" in
13690         ''|0)   d_gethostent_r=undef
13691                 gethostent_r_proto=0
13692                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13693         * )     case "$gethostent_r_proto" in
13694                 REENTRANT_PROTO*) ;;
13695                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13696                 esac
13697                 echo "Prototype: $try" ;;
13698         esac
13699         ;;
13700         *)      case "$usethreads" in
13701                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13702                 esac
13703                 d_gethostent_r=undef
13704                 gethostent_r_proto=0
13705                 ;;
13706         esac
13707         ;;
13708 *)      gethostent_r_proto=0
13709         ;;
13710 esac
13711
13712 : see if prototypes for various gethostxxx netdb.h functions are available
13713 echo " "
13714 set d_gethostprotos gethostent $i_netdb netdb.h
13715 eval $hasproto
13716
13717 : see if getitimer exists
13718 set getitimer d_getitimer
13719 eval $inlibc
13720
13721 : see if getlogin exists
13722 set getlogin d_getlogin
13723 eval $inlibc
13724
13725 : see if getlogin_r exists
13726 set getlogin_r d_getlogin_r
13727 eval $inlibc
13728 case "$d_getlogin_r" in
13729 "$define")
13730         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13731         case "$d_getlogin_r_proto:$usethreads" in
13732         ":define")      d_getlogin_r_proto=define
13733                 set d_getlogin_r_proto getlogin_r $hdrs
13734                 eval $hasproto ;;
13735         *)      ;;
13736         esac
13737         case "$d_getlogin_r_proto" in
13738         define)
13739         case "$getlogin_r_proto" in
13740         ''|0) try='int getlogin_r(char*, size_t);'
13741         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13742         esac
13743         case "$getlogin_r_proto" in
13744         ''|0) try='int getlogin_r(char*, int);'
13745         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13746         esac
13747         case "$getlogin_r_proto" in
13748         ''|0) try='char* getlogin_r(char*, size_t);'
13749         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13750         esac
13751         case "$getlogin_r_proto" in
13752         ''|0) try='char* getlogin_r(char*, int);'
13753         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13754         esac
13755         case "$getlogin_r_proto" in
13756         ''|0)   d_getlogin_r=undef
13757                 getlogin_r_proto=0
13758                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13759         * )     case "$getlogin_r_proto" in
13760                 REENTRANT_PROTO*) ;;
13761                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13762                 esac
13763                 echo "Prototype: $try" ;;
13764         esac
13765         ;;
13766         *)      case "$usethreads" in
13767                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13768                 esac
13769                 d_getlogin_r=undef
13770                 getlogin_r_proto=0
13771                 ;;
13772         esac
13773         ;;
13774 *)      getlogin_r_proto=0
13775         ;;
13776 esac
13777
13778 : see if getmnt exists
13779 set getmnt d_getmnt
13780 eval $inlibc
13781
13782 : see if getmntent exists
13783 set getmntent d_getmntent
13784 eval $inlibc
13785
13786 : see if getnetbyaddr exists
13787 set getnetbyaddr d_getnbyaddr
13788 eval $inlibc
13789
13790 : see if getnetbyname exists
13791 set getnetbyname d_getnbyname
13792 eval $inlibc
13793
13794 : see if getnetent exists
13795 set getnetent d_getnent
13796 eval $inlibc
13797
13798 : see if getnetbyaddr_r exists
13799 set getnetbyaddr_r d_getnetbyaddr_r
13800 eval $inlibc
13801 case "$d_getnetbyaddr_r" in
13802 "$define")
13803         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13804         case "$d_getnetbyaddr_r_proto:$usethreads" in
13805         ":define")      d_getnetbyaddr_r_proto=define
13806                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13807                 eval $hasproto ;;
13808         *)      ;;
13809         esac
13810         case "$d_getnetbyaddr_r_proto" in
13811         define)
13812         case "$getnetbyaddr_r_proto" in
13813         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13814         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13815         esac
13816         case "$getnetbyaddr_r_proto" in
13817         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13818         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13819         esac
13820         case "$getnetbyaddr_r_proto" in
13821         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13822         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13823         esac
13824         case "$getnetbyaddr_r_proto" in
13825         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13826         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13827         esac
13828         case "$getnetbyaddr_r_proto" in
13829         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13830         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13831         esac
13832         case "$getnetbyaddr_r_proto" in
13833         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13834         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13835         esac
13836         case "$getnetbyaddr_r_proto" in
13837         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13838         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13839         esac
13840         case "$getnetbyaddr_r_proto" in
13841         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13842         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13843         esac
13844         case "$getnetbyaddr_r_proto" in
13845         ''|0)   d_getnetbyaddr_r=undef
13846                 getnetbyaddr_r_proto=0
13847                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13848         * )     case "$getnetbyaddr_r_proto" in
13849                 REENTRANT_PROTO*) ;;
13850                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13851                 esac
13852                 echo "Prototype: $try" ;;
13853         esac
13854         ;;
13855         *)      case "$usethreads" in
13856                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13857                 esac
13858                 d_getnetbyaddr_r=undef
13859                 getnetbyaddr_r_proto=0
13860                 ;;
13861         esac
13862         ;;
13863 *)      getnetbyaddr_r_proto=0
13864         ;;
13865 esac
13866
13867 : see if getnetbyname_r exists
13868 set getnetbyname_r d_getnetbyname_r
13869 eval $inlibc
13870 case "$d_getnetbyname_r" in
13871 "$define")
13872         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13873         case "$d_getnetbyname_r_proto:$usethreads" in
13874         ":define")      d_getnetbyname_r_proto=define
13875                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13876                 eval $hasproto ;;
13877         *)      ;;
13878         esac
13879         case "$d_getnetbyname_r_proto" in
13880         define)
13881         case "$getnetbyname_r_proto" in
13882         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13883         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13884         esac
13885         case "$getnetbyname_r_proto" in
13886         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13887         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13888         esac
13889         case "$getnetbyname_r_proto" in
13890         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13891         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13892         esac
13893         case "$getnetbyname_r_proto" in
13894         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13895         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13896         esac
13897         case "$getnetbyname_r_proto" in
13898         ''|0)   d_getnetbyname_r=undef
13899                 getnetbyname_r_proto=0
13900                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13901         * )     case "$getnetbyname_r_proto" in
13902                 REENTRANT_PROTO*) ;;
13903                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13904                 esac
13905                 echo "Prototype: $try" ;;
13906         esac
13907         ;;
13908         *)      case "$usethreads" in
13909                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13910                 esac
13911                 d_getnetbyname_r=undef
13912                 getnetbyname_r_proto=0
13913                 ;;
13914         esac
13915         ;;
13916 *)      getnetbyname_r_proto=0
13917         ;;
13918 esac
13919
13920 : see if getnetent_r exists
13921 set getnetent_r d_getnetent_r
13922 eval $inlibc
13923 case "$d_getnetent_r" in
13924 "$define")
13925         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13926         case "$d_getnetent_r_proto:$usethreads" in
13927         ":define")      d_getnetent_r_proto=define
13928                 set d_getnetent_r_proto getnetent_r $hdrs
13929                 eval $hasproto ;;
13930         *)      ;;
13931         esac
13932         case "$d_getnetent_r_proto" in
13933         define)
13934         case "$getnetent_r_proto" in
13935         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13936         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13937         esac
13938         case "$getnetent_r_proto" in
13939         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13940         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13941         esac
13942         case "$getnetent_r_proto" in
13943         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13944         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13945         esac
13946         case "$getnetent_r_proto" in
13947         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13948         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13949         esac
13950         case "$getnetent_r_proto" in
13951         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13952         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13953         esac
13954         case "$getnetent_r_proto" in
13955         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13956         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13957         esac
13958         case "$getnetent_r_proto" in
13959         ''|0)   d_getnetent_r=undef
13960                 getnetent_r_proto=0
13961                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13962         * )     case "$getnetent_r_proto" in
13963                 REENTRANT_PROTO*) ;;
13964                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13965                 esac
13966                 echo "Prototype: $try" ;;
13967         esac
13968         ;;
13969         *)      case "$usethreads" in
13970                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13971                 esac
13972                 d_getnetent_r=undef
13973                 getnetent_r_proto=0
13974                 ;;
13975         esac
13976         ;;
13977 *)      getnetent_r_proto=0
13978         ;;
13979 esac
13980
13981 : see if prototypes for various getnetxxx netdb.h functions are available
13982 echo " "
13983 set d_getnetprotos getnetent $i_netdb netdb.h
13984 eval $hasproto
13985
13986 : see if getpagesize exists
13987 set getpagesize d_getpagsz
13988 eval $inlibc
13989
13990 : Optional checks for getprotobyname and getprotobynumber
13991
13992 : see if getprotobyname exists
13993 set getprotobyname d_getpbyname
13994 eval $inlibc
13995
13996 : see if getprotobynumber exists
13997 set getprotobynumber d_getpbynumber
13998 eval $inlibc
13999
14000 : see if getprotoent exists
14001 set getprotoent d_getpent
14002 eval $inlibc
14003
14004 : see if getpgid exists
14005 set getpgid d_getpgid
14006 eval $inlibc
14007
14008 : see if getpgrp2 exists
14009 set getpgrp2 d_getpgrp2
14010 eval $inlibc
14011
14012 : see if getppid exists
14013 set getppid d_getppid
14014 eval $inlibc
14015
14016 : see if getpriority exists
14017 set getpriority d_getprior
14018 eval $inlibc
14019
14020 : see if getprotobyname_r exists
14021 set getprotobyname_r d_getprotobyname_r
14022 eval $inlibc
14023 case "$d_getprotobyname_r" in
14024 "$define")
14025         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14026         case "$d_getprotobyname_r_proto:$usethreads" in
14027         ":define")      d_getprotobyname_r_proto=define
14028                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14029                 eval $hasproto ;;
14030         *)      ;;
14031         esac
14032         case "$d_getprotobyname_r_proto" in
14033         define)
14034         case "$getprotobyname_r_proto" in
14035         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14036         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14037         esac
14038         case "$getprotobyname_r_proto" in
14039         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14040         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14041         esac
14042         case "$getprotobyname_r_proto" in
14043         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14044         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14045         esac
14046         case "$getprotobyname_r_proto" in
14047         ''|0)   d_getprotobyname_r=undef
14048                 getprotobyname_r_proto=0
14049                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14050         * )     case "$getprotobyname_r_proto" in
14051                 REENTRANT_PROTO*) ;;
14052                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14053                 esac
14054                 echo "Prototype: $try" ;;
14055         esac
14056         ;;
14057         *)      case "$usethreads" in
14058                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14059                 esac
14060                 d_getprotobyname_r=undef
14061                 getprotobyname_r_proto=0
14062                 ;;
14063         esac
14064         ;;
14065 *)      getprotobyname_r_proto=0
14066         ;;
14067 esac
14068
14069 : see if getprotobynumber_r exists
14070 set getprotobynumber_r d_getprotobynumber_r
14071 eval $inlibc
14072 case "$d_getprotobynumber_r" in
14073 "$define")
14074         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14075         case "$d_getprotobynumber_r_proto:$usethreads" in
14076         ":define")      d_getprotobynumber_r_proto=define
14077                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14078                 eval $hasproto ;;
14079         *)      ;;
14080         esac
14081         case "$d_getprotobynumber_r_proto" in
14082         define)
14083         case "$getprotobynumber_r_proto" in
14084         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14085         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14086         esac
14087         case "$getprotobynumber_r_proto" in
14088         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14089         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14090         esac
14091         case "$getprotobynumber_r_proto" in
14092         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14093         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14094         esac
14095         case "$getprotobynumber_r_proto" in
14096         ''|0)   d_getprotobynumber_r=undef
14097                 getprotobynumber_r_proto=0
14098                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14099         * )     case "$getprotobynumber_r_proto" in
14100                 REENTRANT_PROTO*) ;;
14101                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14102                 esac
14103                 echo "Prototype: $try" ;;
14104         esac
14105         ;;
14106         *)      case "$usethreads" in
14107                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14108                 esac
14109                 d_getprotobynumber_r=undef
14110                 getprotobynumber_r_proto=0
14111                 ;;
14112         esac
14113         ;;
14114 *)      getprotobynumber_r_proto=0
14115         ;;
14116 esac
14117
14118 : see if getprotoent_r exists
14119 set getprotoent_r d_getprotoent_r
14120 eval $inlibc
14121 case "$d_getprotoent_r" in
14122 "$define")
14123         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14124         case "$d_getprotoent_r_proto:$usethreads" in
14125         ":define")      d_getprotoent_r_proto=define
14126                 set d_getprotoent_r_proto getprotoent_r $hdrs
14127                 eval $hasproto ;;
14128         *)      ;;
14129         esac
14130         case "$d_getprotoent_r_proto" in
14131         define)
14132         case "$getprotoent_r_proto" in
14133         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14134         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14135         esac
14136         case "$getprotoent_r_proto" in
14137         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14138         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14139         esac
14140         case "$getprotoent_r_proto" in
14141         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14142         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14143         esac
14144         case "$getprotoent_r_proto" in
14145         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14146         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
14147         esac
14148         case "$getprotoent_r_proto" in
14149         ''|0)   d_getprotoent_r=undef
14150                 getprotoent_r_proto=0
14151                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14152         * )     case "$getprotoent_r_proto" in
14153                 REENTRANT_PROTO*) ;;
14154                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14155                 esac
14156                 echo "Prototype: $try" ;;
14157         esac
14158         ;;
14159         *)      case "$usethreads" in
14160                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14161                 esac
14162                 d_getprotoent_r=undef
14163                 getprotoent_r_proto=0
14164                 ;;
14165         esac
14166         ;;
14167 *)      getprotoent_r_proto=0
14168         ;;
14169 esac
14170
14171 : see if prototypes for various getprotoxxx netdb.h functions are available
14172 echo " "
14173 set d_getprotoprotos getprotoent $i_netdb netdb.h
14174 eval $hasproto
14175
14176 : see if getprpwnam exists
14177 set getprpwnam d_getprpwnam
14178 eval $inlibc
14179
14180 : see if getpwent exists
14181 set getpwent d_getpwent
14182 eval $inlibc
14183
14184 : see if getpwent_r exists
14185 set getpwent_r d_getpwent_r
14186 eval $inlibc
14187 case "$d_getpwent_r" in
14188 "$define")
14189         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14190         case "$d_getpwent_r_proto:$usethreads" in
14191         ":define")      d_getpwent_r_proto=define
14192                 set d_getpwent_r_proto getpwent_r $hdrs
14193                 eval $hasproto ;;
14194         *)      ;;
14195         esac
14196         case "$d_getpwent_r_proto" in
14197         define)
14198         case "$getpwent_r_proto" in
14199         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14200         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14201         esac
14202         case "$getpwent_r_proto" in
14203         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14204         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14205         esac
14206         case "$getpwent_r_proto" in
14207         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14208         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
14209         esac
14210         case "$getpwent_r_proto" in
14211         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14212         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
14213         esac
14214         case "$getpwent_r_proto" in
14215         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14216         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
14217         esac
14218         case "$getpwent_r_proto" in
14219         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14220         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14221         esac
14222         case "$getpwent_r_proto" in
14223         ''|0)   d_getpwent_r=undef
14224                 getpwent_r_proto=0
14225                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14226         * )     case "$getpwent_r_proto" in
14227                 REENTRANT_PROTO*) ;;
14228                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14229                 esac
14230                 echo "Prototype: $try" ;;
14231         esac
14232         ;;
14233         *)      case "$usethreads" in
14234                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14235                 esac
14236                 d_getpwent_r=undef
14237                 getpwent_r_proto=0
14238                 ;;
14239         esac
14240         ;;
14241 *)      getpwent_r_proto=0
14242         ;;
14243 esac
14244
14245 : see if getpwnam_r exists
14246 set getpwnam_r d_getpwnam_r
14247 eval $inlibc
14248 case "$d_getpwnam_r" in
14249 "$define")
14250         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14251         case "$d_getpwnam_r_proto:$usethreads" in
14252         ":define")      d_getpwnam_r_proto=define
14253                 set d_getpwnam_r_proto getpwnam_r $hdrs
14254                 eval $hasproto ;;
14255         *)      ;;
14256         esac
14257         case "$d_getpwnam_r_proto" in
14258         define)
14259         case "$getpwnam_r_proto" in
14260         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14261         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14262         esac
14263         case "$getpwnam_r_proto" in
14264         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14265         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14266         esac
14267         case "$getpwnam_r_proto" in
14268         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14269         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14270         esac
14271         case "$getpwnam_r_proto" in
14272         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14273         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14274         esac
14275         case "$getpwnam_r_proto" in
14276         ''|0)   d_getpwnam_r=undef
14277                 getpwnam_r_proto=0
14278                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14279         * )     case "$getpwnam_r_proto" in
14280                 REENTRANT_PROTO*) ;;
14281                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14282                 esac
14283                 echo "Prototype: $try" ;;
14284         esac
14285         ;;
14286         *)      case "$usethreads" in
14287                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14288                 esac
14289                 d_getpwnam_r=undef
14290                 getpwnam_r_proto=0
14291                 ;;
14292         esac
14293         ;;
14294 *)      getpwnam_r_proto=0
14295         ;;
14296 esac
14297
14298 : see if getpwuid_r exists
14299 set getpwuid_r d_getpwuid_r
14300 eval $inlibc
14301 case "$d_getpwuid_r" in
14302 "$define")
14303         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14304         case "$d_getpwuid_r_proto:$usethreads" in
14305         ":define")      d_getpwuid_r_proto=define
14306                 set d_getpwuid_r_proto getpwuid_r $hdrs
14307                 eval $hasproto ;;
14308         *)      ;;
14309         esac
14310         case "$d_getpwuid_r_proto" in
14311         define)
14312         case "$getpwuid_r_proto" in
14313         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14314         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14315         esac
14316         case "$getpwuid_r_proto" in
14317         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14318         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14319         esac
14320         case "$getpwuid_r_proto" in
14321         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14322         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14323         esac
14324         case "$getpwuid_r_proto" in
14325         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14326         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14327         esac
14328         case "$getpwuid_r_proto" in
14329         ''|0)   d_getpwuid_r=undef
14330                 getpwuid_r_proto=0
14331                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14332         * )     case "$getpwuid_r_proto" in
14333                 REENTRANT_PROTO*) ;;
14334                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14335                 esac
14336                 echo "Prototype: $try" ;;
14337         esac
14338         ;;
14339         *)      case "$usethreads" in
14340                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14341                 esac
14342                 d_getpwuid_r=undef
14343                 getpwuid_r_proto=0
14344                 ;;
14345         esac
14346         ;;
14347 *)      getpwuid_r_proto=0
14348         ;;
14349 esac
14350
14351 : Optional checks for getsbyname and getsbyport
14352
14353 : see if getservbyname exists
14354 set getservbyname d_getsbyname
14355 eval $inlibc
14356
14357 : see if getservbyport exists
14358 set getservbyport d_getsbyport
14359 eval $inlibc
14360
14361 : see if getservent exists
14362 set getservent d_getsent
14363 eval $inlibc
14364
14365 : see if getservbyname_r exists
14366 set getservbyname_r d_getservbyname_r
14367 eval $inlibc
14368 case "$d_getservbyname_r" in
14369 "$define")
14370         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14371         case "$d_getservbyname_r_proto:$usethreads" in
14372         ":define")      d_getservbyname_r_proto=define
14373                 set d_getservbyname_r_proto getservbyname_r $hdrs
14374                 eval $hasproto ;;
14375         *)      ;;
14376         esac
14377         case "$d_getservbyname_r_proto" in
14378         define)
14379         case "$getservbyname_r_proto" in
14380         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14381         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14382         esac
14383         case "$getservbyname_r_proto" in
14384         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14385         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14386         esac
14387         case "$getservbyname_r_proto" in
14388         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14389         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14390         esac
14391         case "$getservbyname_r_proto" in
14392         ''|0)   d_getservbyname_r=undef
14393                 getservbyname_r_proto=0
14394                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14395         * )     case "$getservbyname_r_proto" in
14396                 REENTRANT_PROTO*) ;;
14397                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14398                 esac
14399                 echo "Prototype: $try" ;;
14400         esac
14401         ;;
14402         *)      case "$usethreads" in
14403                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14404                 esac
14405                 d_getservbyname_r=undef
14406                 getservbyname_r_proto=0
14407                 ;;
14408         esac
14409         ;;
14410 *)      getservbyname_r_proto=0
14411         ;;
14412 esac
14413
14414 : see if getservbyport_r exists
14415 set getservbyport_r d_getservbyport_r
14416 eval $inlibc
14417 case "$d_getservbyport_r" in
14418 "$define")
14419         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14420         case "$d_getservbyport_r_proto:$usethreads" in
14421         ":define")      d_getservbyport_r_proto=define
14422                 set d_getservbyport_r_proto getservbyport_r $hdrs
14423                 eval $hasproto ;;
14424         *)      ;;
14425         esac
14426         case "$d_getservbyport_r_proto" in
14427         define)
14428         case "$getservbyport_r_proto" in
14429         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14430         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14431         esac
14432         case "$getservbyport_r_proto" in
14433         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14434         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14435         esac
14436         case "$getservbyport_r_proto" in
14437         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14438         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14439         esac
14440         case "$getservbyport_r_proto" in
14441         ''|0)   d_getservbyport_r=undef
14442                 getservbyport_r_proto=0
14443                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14444         * )     case "$getservbyport_r_proto" in
14445                 REENTRANT_PROTO*) ;;
14446                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14447                 esac
14448                 echo "Prototype: $try" ;;
14449         esac
14450         ;;
14451         *)      case "$usethreads" in
14452                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14453                 esac
14454                 d_getservbyport_r=undef
14455                 getservbyport_r_proto=0
14456                 ;;
14457         esac
14458         ;;
14459 *)      getservbyport_r_proto=0
14460         ;;
14461 esac
14462
14463 : see if getservent_r exists
14464 set getservent_r d_getservent_r
14465 eval $inlibc
14466 case "$d_getservent_r" in
14467 "$define")
14468         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14469         case "$d_getservent_r_proto:$usethreads" in
14470         ":define")      d_getservent_r_proto=define
14471                 set d_getservent_r_proto getservent_r $hdrs
14472                 eval $hasproto ;;
14473         *)      ;;
14474         esac
14475         case "$d_getservent_r_proto" in
14476         define)
14477         case "$getservent_r_proto" in
14478         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14479         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
14480         esac
14481         case "$getservent_r_proto" in
14482         ''|0) try='int getservent_r(struct servent*, char*, int);'
14483         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
14484         esac
14485         case "$getservent_r_proto" in
14486         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14487         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
14488         esac
14489         case "$getservent_r_proto" in
14490         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14491         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
14492         esac
14493         case "$getservent_r_proto" in
14494         ''|0)   d_getservent_r=undef
14495                 getservent_r_proto=0
14496                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14497         * )     case "$getservent_r_proto" in
14498                 REENTRANT_PROTO*) ;;
14499                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14500                 esac
14501                 echo "Prototype: $try" ;;
14502         esac
14503         ;;
14504         *)      case "$usethreads" in
14505                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14506                 esac
14507                 d_getservent_r=undef
14508                 getservent_r_proto=0
14509                 ;;
14510         esac
14511         ;;
14512 *)      getservent_r_proto=0
14513         ;;
14514 esac
14515
14516 : see if prototypes for various getservxxx netdb.h functions are available
14517 echo " "
14518 set d_getservprotos getservent $i_netdb netdb.h
14519 eval $hasproto
14520
14521 : see if getspnam exists
14522 set getspnam d_getspnam
14523 eval $inlibc
14524
14525 : see if this is a shadow.h system
14526 set shadow.h i_shadow
14527 eval $inhdr
14528
14529 : see if getspnam_r exists
14530 set getspnam_r d_getspnam_r
14531 eval $inlibc
14532 case "$d_getspnam_r" in
14533 "$define")
14534         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14535         case "$d_getspnam_r_proto:$usethreads" in
14536         ":define")      d_getspnam_r_proto=define
14537                 set d_getspnam_r_proto getspnam_r $hdrs
14538                 eval $hasproto ;;
14539         *)      ;;
14540         esac
14541         case "$d_getspnam_r_proto" in
14542         define)
14543         case "$getspnam_r_proto" in
14544         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14545         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14546         esac
14547         case "$getspnam_r_proto" in
14548         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14549         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14550         esac
14551         case "$getspnam_r_proto" in
14552         ''|0)   d_getspnam_r=undef
14553                 getspnam_r_proto=0
14554                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14555         * )     case "$getspnam_r_proto" in
14556                 REENTRANT_PROTO*) ;;
14557                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14558                 esac
14559                 echo "Prototype: $try" ;;
14560         esac
14561         ;;
14562         *)      case "$usethreads" in
14563                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14564                 esac
14565                 d_getspnam_r=undef
14566                 getspnam_r_proto=0
14567                 ;;
14568         esac
14569         ;;
14570 *)      getspnam_r_proto=0
14571         ;;
14572 esac
14573
14574 : see if gettimeofday or ftime exists
14575 set gettimeofday d_gettimeod
14576 eval $inlibc
14577 case "$d_gettimeod" in
14578 "$undef")
14579         set ftime d_ftime 
14580         eval $inlibc
14581         ;;
14582 *)
14583         val="$undef"; set d_ftime; eval $setvar
14584         ;;
14585 esac
14586 case "$d_gettimeod$d_ftime" in
14587 "$undef$undef")
14588         echo " "
14589         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14590         ;;
14591 esac
14592
14593 : see if gmtime_r exists
14594 set gmtime_r d_gmtime_r
14595 eval $inlibc
14596 case "$d_gmtime_r" in
14597 "$define")
14598         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14599         case "$d_gmtime_r_proto:$usethreads" in
14600         ":define")      d_gmtime_r_proto=define
14601                 set d_gmtime_r_proto gmtime_r $hdrs
14602                 eval $hasproto ;;
14603         *)      ;;
14604         esac
14605         case "$d_gmtime_r_proto" in
14606         define)
14607         case "$gmtime_r_proto" in
14608         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14609         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14610         esac
14611         case "$gmtime_r_proto" in
14612         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14613         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14614         esac
14615         case "$gmtime_r_proto" in
14616         ''|0)   d_gmtime_r=undef
14617                 gmtime_r_proto=0
14618                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14619         * )     case "$gmtime_r_proto" in
14620                 REENTRANT_PROTO*) ;;
14621                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14622                 esac
14623                 echo "Prototype: $try" ;;
14624         esac
14625         ;;
14626         *)      case "$usethreads" in
14627                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14628                 esac
14629                 d_gmtime_r=undef
14630                 gmtime_r_proto=0
14631                 ;;
14632         esac
14633         ;;
14634 *)      gmtime_r_proto=0
14635         ;;
14636 esac
14637
14638 : see if hasmntopt exists
14639 set hasmntopt d_hasmntopt
14640 eval $inlibc
14641
14642 : see if this is a netinet/in.h or sys/in.h system
14643 set netinet/in.h i_niin sys/in.h i_sysin
14644 eval $inhdr
14645
14646 : see if arpa/inet.h has to be included
14647 set arpa/inet.h i_arpainet
14648 eval $inhdr
14649
14650 : see if htonl --and friends-- exists
14651 val=''
14652 set htonl val
14653 eval $inlibc
14654
14655 : Maybe they are macros.
14656 case "$val" in
14657 $undef)
14658         $cat >htonl.c <<EOM
14659 #include <stdio.h>
14660 #include <sys/types.h>
14661 #$i_niin I_NETINET_IN
14662 #$i_sysin I_SYS_IN
14663 #$i_arpainet I_ARPA_INET
14664 #ifdef I_NETINET_IN
14665 #include <netinet/in.h>
14666 #endif
14667 #ifdef I_SYS_IN
14668 #include <sys/in.h>
14669 #endif
14670 #ifdef I_ARPA_INET
14671 #include <arpa/inet.h>
14672 #endif
14673 #ifdef htonl
14674 printf("Defined as a macro.");
14675 #endif
14676 EOM
14677         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14678         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14679                 val="$define"
14680                 echo "But it seems to be defined as a macro." >&4
14681         fi
14682         $rm -f htonl.?
14683         ;;
14684 esac
14685 set d_htonl
14686 eval $setvar
14687
14688 : see if ilogbl exists
14689 set ilogbl d_ilogbl
14690 eval $inlibc
14691
14692 : index or strchr
14693 echo " "
14694 if set index val -f; eval $csym; $val; then
14695         if set strchr val -f d_strchr; eval $csym; $val; then
14696                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14697                         val="$define"
14698                         vali="$undef"
14699                         echo "strchr() found." >&4
14700                 else
14701                         val="$undef"
14702                         vali="$define"
14703                         echo "index() found." >&4
14704                 fi
14705         else
14706                 val="$undef"
14707                 vali="$define"
14708                 echo "index() found." >&4
14709         fi
14710 else
14711         if set strchr val -f d_strchr; eval $csym; $val; then
14712                 val="$define"
14713                 vali="$undef"
14714                 echo "strchr() found." >&4
14715         else
14716                 echo "No index() or strchr() found!" >&4
14717                 val="$undef"
14718                 vali="$undef"
14719         fi
14720 fi
14721 set d_strchr; eval $setvar
14722 val="$vali"
14723 set d_index; eval $setvar
14724
14725 : check whether inet_aton exists
14726 set inet_aton d_inetaton
14727 eval $inlibc
14728
14729 : Look for isascii
14730 echo " "
14731 $cat >isascii.c <<EOCP
14732 #include <stdio.h>
14733 #include <ctype.h>
14734 #$i_stdlib I_STDLIB
14735 #ifdef I_STDLIB
14736 #include <stdlib.h>
14737 #endif
14738 int main() {
14739         int c = 'A';
14740         if (isascii(c))
14741                 exit(0);
14742         else
14743                 exit(1);
14744 }
14745 EOCP
14746 set isascii
14747 if eval $compile; then
14748         echo "isascii() found." >&4
14749         val="$define"
14750 else
14751         echo "isascii() NOT found." >&4
14752         val="$undef"
14753 fi
14754 set d_isascii
14755 eval $setvar
14756 $rm -f isascii*
14757
14758 : see if isfinite exists
14759 set isfinite d_isfinite
14760 eval $inlibc
14761
14762 : see if isinf exists
14763 set isinf d_isinf
14764 eval $inlibc
14765
14766 : see if isnan exists
14767 set isnan d_isnan
14768 eval $inlibc
14769
14770 : see if isnanl exists
14771 set isnanl d_isnanl
14772 eval $inlibc
14773
14774 : see if killpg exists
14775 set killpg d_killpg
14776 eval $inlibc
14777
14778 : see if lchown exists
14779 echo " "
14780 $cat > try.c <<'EOCP'
14781 /* System header to define __stub macros and hopefully few prototypes,
14782     which can conflict with char lchown(); below.  */
14783 #include <assert.h>
14784 /* Override any gcc2 internal prototype to avoid an error.  */
14785 /* We use char because int might match the return type of a gcc2
14786    builtin and then its argument prototype would still apply.  */
14787 char lchown();
14788 int main() {
14789     /*  The GNU C library defines this for functions which it implements
14790         to always fail with ENOSYS.  Some functions are actually named
14791         something starting with __ and the normal name is an alias.  */
14792 #if defined (__stub_lchown) || defined (__stub___lchown)
14793 choke me
14794 #else
14795 lchown();
14796 #endif
14797 ; return 0; }
14798 EOCP
14799 set try
14800 if eval $compile; then
14801     $echo "lchown() found." >&4
14802     val="$define"
14803 else
14804     $echo "lchown() NOT found." >&4
14805     val="$undef"
14806 fi
14807 set d_lchown
14808 eval $setvar
14809
14810 : See if number of significant digits in a double precision number is known
14811 echo " "
14812 $cat >ldbl_dig.c <<EOM
14813 #$i_limits I_LIMITS
14814 #$i_float I_FLOAT
14815 #ifdef I_LIMITS
14816 #include <limits.h>
14817 #endif
14818 #ifdef I_FLOAT
14819 #include <float.h>
14820 #endif
14821 #ifdef LDBL_DIG
14822 printf("Contains LDBL_DIG");
14823 #endif
14824 EOM
14825 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14826 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14827         echo "LDBL_DIG found." >&4
14828         val="$define"
14829 else
14830         echo "LDBL_DIG NOT found." >&4
14831         val="$undef"
14832 fi
14833 $rm -f ldbl_dig.?
14834 set d_ldbl_dig
14835 eval $setvar
14836
14837 : see if this is a math.h system
14838 set math.h i_math
14839 eval $inhdr
14840
14841 : check to see if math.h defines _LIB_VERSION
14842 d_libm_lib_version="$undef"
14843 case $i_math in
14844     $define)
14845         echo " "
14846         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14847         $cat >try.c <<EOCP
14848 #include <unistd.h>
14849 #include <math.h>
14850 int main (int argc, char *argv[])
14851 {
14852     printf ("%d\n", _LIB_VERSION);
14853     return (0);
14854     } /* main */
14855 EOCP
14856         set try
14857         if eval $compile; then
14858             foo=`$run ./try`
14859             echo "Yes, it does ($foo)" >&4
14860             d_libm_lib_version="$define"
14861         else
14862             echo "No, it does not (probably harmless)" >&4
14863             fi
14864         $rm_try
14865         ;;
14866
14867     esac
14868
14869 : see if link exists
14870 set link d_link
14871 eval $inlibc
14872
14873 : see if localtime_r exists
14874 set localtime_r d_localtime_r
14875 eval $inlibc
14876 case "$d_localtime_r" in
14877 "$define")
14878         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14879         case "$d_localtime_r_proto:$usethreads" in
14880         ":define")      d_localtime_r_proto=define
14881                 set d_localtime_r_proto localtime_r $hdrs
14882                 eval $hasproto ;;
14883         *)      ;;
14884         esac
14885         case "$d_localtime_r_proto" in
14886         define)
14887         case "$localtime_r_proto" in
14888         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14889         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14890         esac
14891         case "$localtime_r_proto" in
14892         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14893         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14894         esac
14895         case "$localtime_r_proto" in
14896         ''|0)   d_localtime_r=undef
14897                 localtime_r_proto=0
14898                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14899         * )     case "$localtime_r_proto" in
14900                 REENTRANT_PROTO*) ;;
14901                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14902                 esac
14903                 echo "Prototype: $try" ;;
14904         esac
14905         ;;
14906         *)      case "$usethreads" in
14907                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14908                 esac
14909                 d_localtime_r=undef
14910                 localtime_r_proto=0
14911                 ;;
14912         esac
14913         ;;
14914 *)      localtime_r_proto=0
14915         ;;
14916 esac
14917
14918 : see if localtime_r calls tzset
14919 case "$localtime_r_proto" in
14920 REENTRANT_PROTO*)
14921         $cat >try.c <<EOCP
14922 /*  Does our libc's localtime_r call tzset ?
14923  *  return 0 if so, 1 otherwise.
14924  */
14925 #include <sys/types.h>
14926 #include <unistd.h>
14927 #include <time.h>
14928 #include <string.h>
14929 #include <malloc.h>
14930 int main()
14931 {
14932     time_t t = time(0L);
14933     char w_tz[]="TZ" "=GMT+5",
14934          e_tz[]="TZ" "=GMT-5",
14935         *tz_e = (char*)malloc(16),
14936         *tz_w = (char*)malloc(16);
14937     struct tm tm_e, tm_w;
14938     memset(&tm_e,'\0',sizeof(struct tm));
14939     memset(&tm_w,'\0',sizeof(struct tm));
14940     strcpy(tz_e,e_tz);
14941     strcpy(tz_w,w_tz);
14942
14943     putenv(tz_e);
14944     localtime_r(&t, &tm_e);
14945
14946     putenv(tz_w);
14947     localtime_r(&t, &tm_w);
14948
14949     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
14950         return 1;
14951     return 0;
14952 }
14953 EOCP
14954         set try
14955         if eval $compile; then
14956             if $run ./try; then
14957                 d_localtime_r_needs_tzset=undef;
14958             else
14959                 d_localtime_r_needs_tzset=define;
14960             fi;
14961         else
14962             d_localtime_r_needs_tzset=undef;
14963         fi;
14964      ;;
14965   *)
14966      d_localtime_r_needs_tzset=undef;
14967      ;;
14968 esac
14969 $rm_try
14970
14971 : see if localeconv exists
14972 set localeconv d_locconv
14973 eval $inlibc
14974
14975 : see if lockf exists
14976 set lockf d_lockf
14977 eval $inlibc
14978
14979 : see if prototype for lseek is available
14980 echo " "
14981 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14982 eval $hasproto
14983
14984 : see if lstat exists
14985 set lstat d_lstat
14986 eval $inlibc
14987
14988 : see if madvise exists
14989 set madvise d_madvise
14990 eval $inlibc
14991
14992 : see if malloc_size exists
14993 set malloc_size d_malloc_size
14994 eval $inlibc
14995
14996 : see if malloc_size_good exists
14997 set malloc_good_size d_malloc_good_size
14998 eval $inlibc
14999
15000 : see if mblen exists
15001 set mblen d_mblen
15002 eval $inlibc
15003
15004 : see if mbstowcs exists
15005 set mbstowcs d_mbstowcs
15006 eval $inlibc
15007
15008 : see if mbtowc exists
15009 set mbtowc d_mbtowc
15010 eval $inlibc
15011
15012 : see if memchr exists
15013 set memchr d_memchr
15014 eval $inlibc
15015
15016 : see if memcmp exists
15017 set memcmp d_memcmp
15018 eval $inlibc
15019
15020 : see if memcpy exists
15021 set memcpy d_memcpy
15022 eval $inlibc
15023
15024 : see if memmove exists
15025 set memmove d_memmove
15026 eval $inlibc
15027
15028 : see if memset exists
15029 set memset d_memset
15030 eval $inlibc
15031
15032 : see if mkdir exists
15033 set mkdir d_mkdir
15034 eval $inlibc
15035
15036 : see if mkdtemp exists
15037 set mkdtemp d_mkdtemp
15038 eval $inlibc
15039
15040 : see if mkfifo exists
15041 set mkfifo d_mkfifo
15042 eval $inlibc
15043
15044 : see if mkstemp exists
15045 set mkstemp d_mkstemp
15046 eval $inlibc
15047
15048 : see if mkstemps exists
15049 set mkstemps d_mkstemps
15050 eval $inlibc
15051
15052 : see if mktime exists
15053 set mktime d_mktime
15054 eval $inlibc
15055
15056 : see if this is a sys/mman.h system
15057 set sys/mman.h i_sysmman
15058 eval $inhdr
15059
15060 : see if mmap exists
15061 set mmap d_mmap
15062 eval $inlibc
15063 : see what shmat returns
15064 : default to something harmless
15065 mmaptype='void *'
15066 case "$i_sysmman$d_mmap" in
15067 "$define$define")
15068         $cat >mmap.c <<'END'
15069 #include <sys/mman.h>
15070 void *mmap();
15071 END
15072         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15073                 mmaptype='void *'
15074         else
15075                 mmaptype='caddr_t'
15076         fi
15077         echo "and it returns ($mmaptype)." >&4
15078         ;;
15079 esac
15080
15081
15082
15083 : see if sqrtl exists
15084 set sqrtl d_sqrtl
15085 eval $inlibc
15086
15087 : see if scalbnl exists
15088 set scalbnl d_scalbnl
15089 eval $inlibc
15090
15091 : see if modfl exists
15092 set modfl d_modfl
15093 eval $inlibc
15094
15095 : see if prototype for modfl is available
15096 echo " "
15097 set d_modflproto modfl $i_math math.h
15098 eval $hasproto
15099
15100 d_modfl_pow32_bug="$undef"
15101
15102 case "$d_longdbl$d_modfl" in
15103 $define$define)
15104         $cat <<EOM
15105 Checking to see whether your modfl() is okay for large values...
15106 EOM
15107 $cat >try.c <<EOCP
15108 #include <math.h>
15109 #include <stdio.h>
15110 EOCP
15111 if $test "X$d_modflproto" != "X$define"; then
15112         $cat >>try.c <<EOCP
15113 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15114 long double modfl (long double, long double *);
15115 EOCP
15116 fi
15117 $cat >>try.c <<EOCP
15118 int main() {
15119     long double nv = 4294967303.15;
15120     long double v, w;
15121     v = modfl(nv, &w);
15122 #ifdef __GLIBC__
15123     printf("glibc");
15124 #endif
15125     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15126     return 0;
15127 }
15128 EOCP
15129         case "$osname:$gccversion" in
15130         aix:)   saveccflags="$ccflags"
15131                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15132         esac
15133         set try
15134         if eval $compile; then
15135                 foo=`$run ./try`
15136                 case "$foo" in
15137                 *" 4294967303.150000 1.150000 4294967302.000000")
15138                         echo >&4 "Your modfl() is broken for large values."
15139                         d_modfl_pow32_bug="$define"
15140                         case "$foo" in
15141                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15142                         ;;
15143                         esac
15144                         ;;
15145                 *" 4294967303.150000 0.150000 4294967303.000000")
15146                         echo >&4 "Your modfl() seems okay for large values."
15147                         ;;
15148                 *)      echo >&4 "I don't understand your modfl() at all."
15149                         d_modfl="$undef"
15150                         ;;
15151                 esac
15152                 $rm_try
15153         else
15154                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15155                 d_modfl="$undef"
15156         fi
15157         case "$osname:$gccversion" in
15158         aix:)   ccflags="$saveccflags" ;; # restore
15159         esac
15160         ;;
15161 esac
15162
15163 if $test "$uselongdouble" = "$define"; then
15164     message=""
15165     if $test "$d_sqrtl" != "$define"; then
15166         message="$message sqrtl"
15167     fi
15168     if $test "$d_modfl" != "$define"; then
15169         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15170             echo "You have both aintl and copysignl, so I can emulate modfl."
15171         else
15172             message="$message modfl"
15173         fi
15174     fi
15175     if $test "$d_frexpl" != "$define"; then
15176         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15177             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15178         else
15179             message="$message frexpl"
15180         fi
15181     fi
15182
15183     if $test "$message" != ""; then
15184         $cat <<EOM >&4
15185
15186 *** You requested the use of long doubles but you do not seem to have
15187 *** the following mathematical functions needed for long double support:
15188 ***    $message
15189 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15190 *** Cannot continue, aborting.
15191
15192 EOM
15193
15194         exit 1
15195     fi
15196 fi
15197
15198 : see if mprotect exists
15199 set mprotect d_mprotect
15200 eval $inlibc
15201
15202 : see if msgctl exists
15203 set msgctl d_msgctl
15204 eval $inlibc
15205
15206 : see if msgget exists
15207 set msgget d_msgget
15208 eval $inlibc
15209
15210 : see if msgsnd exists
15211 set msgsnd d_msgsnd
15212 eval $inlibc
15213
15214 : see if msgrcv exists
15215 set msgrcv d_msgrcv
15216 eval $inlibc
15217
15218 : see how much of the 'msg*(2)' library is present.
15219 h_msg=true
15220 echo " "
15221 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15222 *"$undef"*) h_msg=false;;
15223 esac
15224 case "$osname" in
15225 freebsd)
15226     case "`ipcs 2>&1`" in
15227     "SVID messages"*"not configured"*)
15228         echo "Your $osname does not have the msg*(2) configured." >&4
15229         h_msg=false
15230         val="$undef"
15231         set msgctl d_msgctl
15232         eval $setvar
15233         set msgget d_msgget
15234         eval $setvar
15235         set msgsnd d_msgsnd
15236         eval $setvar
15237         set msgrcv d_msgrcv
15238         eval $setvar
15239         ;;
15240     esac
15241     ;;
15242 esac
15243 : we could also check for sys/ipc.h ...
15244 if $h_msg && $test `./findhdr sys/msg.h`; then
15245         echo "You have the full msg*(2) library." >&4
15246         val="$define"
15247 else
15248         echo "You don't have the full msg*(2) library." >&4
15249         val="$undef"
15250 fi
15251 set d_msg
15252 eval $setvar
15253
15254 : Check for msghdr_s
15255 echo " "
15256 echo "Checking to see if your system supports struct msghdr..." >&4
15257 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15258 eval $hasstruct
15259 case "$d_msghdr_s" in
15260 "$define")      echo "Yes, it does."   ;;
15261 *)              echo "No, it doesn't." ;;
15262 esac
15263
15264
15265 : see if msync exists
15266 set msync d_msync
15267 eval $inlibc
15268
15269 : see if munmap exists
15270 set munmap d_munmap
15271 eval $inlibc
15272
15273 : see if nice exists
15274 set nice d_nice
15275 eval $inlibc
15276
15277 : see if this is a langinfo.h system
15278 set langinfo.h i_langinfo
15279 eval $inhdr
15280
15281 : see if nl_langinfo exists
15282 set nl_langinfo d_nl_langinfo
15283 eval $inlibc
15284
15285 : check for volatile keyword
15286 echo " "
15287 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15288 $cat >try.c <<'EOCP'
15289 int main()
15290 {
15291         typedef struct _goo_struct goo_struct;
15292         goo_struct * volatile goo = ((goo_struct *)0);
15293         struct _goo_struct {
15294                 long long_int;
15295                 int reg_int;
15296                 char char_var;
15297         };
15298         typedef unsigned short foo_t;
15299         char *volatile foo;
15300         volatile int bar;
15301         volatile foo_t blech;
15302         foo = foo;
15303 }
15304 EOCP
15305 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15306         val="$define"
15307         echo "Yup, it does."
15308 else
15309         val="$undef"
15310         echo "Nope, it doesn't."
15311 fi
15312 set d_volatile
15313 eval $setvar
15314 $rm_try
15315
15316 : Check basic sizes
15317 echo " "
15318 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15319
15320 case "$use64bitint:$d_quad:$quadtype" in
15321 define:define:?*)
15322         ivtype="$quadtype"
15323         uvtype="$uquadtype"
15324         ivsize=8
15325         uvsize=8
15326         ;;
15327 *)      ivtype="long"
15328         uvtype="unsigned long"
15329         ivsize=$longsize
15330         uvsize=$longsize
15331         ;;
15332 esac
15333
15334 case "$uselongdouble:$d_longdbl" in
15335 define:define)
15336         nvtype="long double"
15337         nvsize=$longdblsize
15338         ;;
15339 *)      nvtype=double
15340         nvsize=$doublesize
15341         ;;
15342 esac
15343
15344 $echo "(IV will be "$ivtype", $ivsize bytes)"
15345 $echo "(UV will be "$uvtype", $uvsize bytes)"
15346 $echo "(NV will be "$nvtype", $nvsize bytes)"
15347
15348 $cat >try.c <<EOCP
15349 #$i_inttypes I_INTTYPES
15350 #ifdef I_INTTYPES
15351 #include <inttypes.h>
15352 #endif
15353 #include <stdio.h>
15354 int main() {
15355 #ifdef INT8
15356    int8_t i =  INT8_MAX;
15357   uint8_t u = UINT8_MAX;
15358   printf("int8_t\n");
15359 #endif
15360 #ifdef INT16
15361    int16_t i =  INT16_MAX;
15362   uint16_t i = UINT16_MAX;
15363   printf("int16_t\n");
15364 #endif
15365 #ifdef INT32
15366    int32_t i =  INT32_MAX;
15367   uint32_t u = UINT32_MAX;
15368   printf("int32_t\n");
15369 #endif
15370 }
15371 EOCP
15372
15373 i8type="signed char"
15374 u8type="unsigned char"
15375 i8size=1
15376 u8size=1
15377
15378 case "$i16type" in
15379 '')     case "$shortsize" in
15380         2)      i16type=short
15381                 u16type="unsigned short"
15382                 i16size=$shortsize
15383                 u16size=$shortsize
15384                 ;;
15385         esac
15386         ;;
15387 esac
15388 case "$i16type" in
15389 '')     set try -DINT16
15390         if eval $compile; then
15391                 case "`$run ./try`" in
15392                 int16_t)
15393                         i16type=int16_t
15394                         u16type=uint16_t
15395                         i16size=2
15396                         u16size=2
15397                         ;;
15398                 esac
15399         fi
15400         ;;
15401 esac
15402 case "$i16type" in
15403 '')     if $test $shortsize -ge 2; then
15404                 i16type=short
15405                 u16type="unsigned short"
15406                 i16size=$shortsize
15407                 u16size=$shortsize
15408         fi
15409         ;;
15410 esac
15411
15412 case "$i32type" in
15413 '')     case "$longsize" in
15414         4)      i32type=long
15415                 u32type="unsigned long"
15416                 i32size=$longsize
15417                 u32size=$longsize
15418                 ;;
15419         *)      case "$intsize" in
15420                 4)      i32type=int
15421                         u32type="unsigned int"
15422                         i32size=$intsize
15423                         u32size=$intsize
15424                         ;;
15425                 esac
15426                 ;;
15427         esac
15428         ;;
15429 esac
15430 case "$i32type" in
15431 '')     set try -DINT32
15432         if eval $compile; then
15433                 case "`$run ./try`" in
15434                 int32_t)
15435                         i32type=int32_t
15436                         u32type=uint32_t
15437                         i32size=4
15438                         u32size=4
15439                         ;;
15440                 esac
15441         fi
15442         ;;
15443 esac
15444 case "$i32type" in
15445 '')     if $test $intsize -ge 4; then
15446                 i32type=int
15447                 u32type="unsigned int"
15448                 i32size=$intsize
15449                 u32size=$intsize
15450         fi
15451         ;;
15452 esac
15453
15454 case "$i64type" in
15455 '')     case "$d_quad:$quadtype" in
15456         define:?*)
15457                 i64type="$quadtype"
15458                 u64type="$uquadtype"
15459                 i64size=8
15460                 u64size=8
15461                 ;;
15462         esac
15463         ;;
15464 esac
15465
15466 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15467 : volatile so that the compiler has to store it out to memory.
15468 if test X"$d_volatile" = X"$define"; then
15469         volatile=volatile
15470 fi
15471 $cat <<EOP >try.c
15472 #include <stdio.h>
15473 #$i_stdlib I_STDLIB
15474 #ifdef I_STDLIB
15475 #include <stdlib.h>
15476 #endif
15477 #include <sys/types.h>
15478 #include <signal.h>
15479 #ifdef SIGFPE
15480 $volatile int bletched = 0;
15481 $signal_t blech(int s) { bletched = 1; }
15482 #endif
15483 int main() {
15484     $uvtype u = 0;
15485     $nvtype d;
15486     int     n = 8 * $uvsize;
15487     int     i;
15488 #ifdef SIGFPE
15489     signal(SIGFPE, blech);
15490 #endif
15491
15492     for (i = 0; i < n; i++) {
15493       u = u << 1 | ($uvtype)1;
15494       d = ($nvtype)u;
15495       if (($uvtype)d != u)
15496         break;
15497       if (d <= 0)
15498         break;
15499       d = ($nvtype)(u - 1);
15500       if (($uvtype)d != (u - 1))
15501         break;
15502 #ifdef SIGFPE
15503       if (bletched)
15504         break;
15505 #endif
15506     }
15507     printf("%d\n", ((i == n) ? -n : i));
15508     exit(0);
15509 }
15510 EOP
15511 set try
15512
15513 d_nv_preserves_uv="$undef"
15514 if eval $compile; then
15515         nv_preserves_uv_bits="`$run ./try`"
15516 fi
15517 case "$nv_preserves_uv_bits" in
15518 \-[1-9]*)
15519         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15520         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15521         d_nv_preserves_uv="$define"
15522         ;;
15523 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15524         d_nv_preserves_uv="$undef" ;;
15525 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15526         nv_preserves_uv_bits="0" ;;
15527 esac
15528 $rm_try
15529
15530 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15531 : volatile so that the compiler has to store it out to memory.
15532 if test X"$d_volatile" = X"$define"; then
15533         volatile=volatile
15534 fi
15535 $cat <<EOP >try.c
15536 #include <stdio.h>
15537
15538 typedef $nvtype NV;
15539
15540 int
15541 main() {
15542   NV value = 2;
15543   int count = 1;
15544
15545   while(count < 256) {
15546     $volatile NV up = value + 1.0;
15547     $volatile NV negated = -value;
15548     $volatile NV down = negated - 1.0;
15549     $volatile NV got_up = up - value;
15550     int up_good = got_up == 1.0;
15551     int got_down = down - negated;
15552     int down_good = got_down == -1.0;
15553
15554     if (down_good != up_good) {
15555       fprintf(stderr,
15556               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15557               up_good, (double) got_up, down_good, (double) got_down,
15558               count, (double) value);
15559       return 1;
15560     }
15561     if (!up_good) {
15562       while (1) {
15563         if (count > 8) {
15564           count -= 8;
15565           fputs("256.0", stdout);
15566         } else {
15567           count--;
15568           fputs("2.0", stdout);
15569         }
15570         if (!count) {
15571           puts("");
15572           return 0;
15573         }
15574         fputs("*", stdout);
15575       }
15576     }
15577     value *= 2;
15578     ++count;
15579   }
15580   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15581           count, (double) value);
15582   return 1;
15583 }
15584 EOP
15585 set try
15586
15587 nv_overflows_integers_at='0'
15588 if eval $compile; then
15589     xxx="`$run ./try`"
15590     case "$?" in
15591         0)
15592             case "$xxx" in
15593                 2*)  cat >&4 <<EOM
15594 The largest integer your NVs can preserve is equal to $xxx
15595 EOM
15596                     nv_overflows_integers_at="$xxx"
15597                     ;;
15598                 *)  cat >&4 <<EOM
15599 Cannot determine the largest integer value your NVs can hold, unexpected output
15600 '$xxx'
15601 EOM
15602                     ;;
15603             esac
15604             ;;
15605         *)  cat >&4 <<EOM
15606 Cannot determine the largest integer value your NVs can hold
15607 EOM
15608             ;;
15609     esac
15610 fi
15611 $rm_try
15612
15613 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15614 : volatile so that the compiler has to store it out to memory.
15615 if test X"$d_volatile" = X"$define"; then
15616         volatile=volatile
15617 fi
15618 $cat <<EOP >try.c
15619 #include <stdio.h>
15620 #$i_stdlib I_STDLIB
15621 #ifdef I_STDLIB
15622 #include <stdlib.h>
15623 #endif
15624 #$i_string I_STRING
15625 #ifdef I_STRING
15626 #  include <string.h>
15627 #else
15628 #  include <strings.h>
15629 #endif
15630 #include <sys/types.h>
15631 #include <signal.h>
15632 #ifdef SIGFPE
15633 $volatile int bletched = 0;
15634 $signal_t blech(int s) { bletched = 1; }
15635 #endif
15636
15637 int checkit($nvtype d, char *where) {
15638     unsigned char *p = (char *)&d;
15639     unsigned char *end = p + sizeof(d);
15640     int fail = 0;
15641
15642     while (p < end)
15643         fail += *p++;
15644
15645     if (!fail)
15646         return 0;
15647
15648     p = (char *)&d;
15649     printf("No - %s: 0x", where);
15650     while (p < end)
15651         printf ("%02X", *p++);
15652     printf("\n");
15653     return 1;
15654 }
15655
15656 int main(int argc, char **argv) {
15657     $nvtype d = 0.0;
15658     int fail = 0;
15659     fail += checkit(d, "0.0");
15660
15661     /* The compiler shouldn't be assuming that bletched is 0  */
15662     d = bletched;
15663
15664     fail += checkit(d, "bleched");
15665
15666 #ifdef SIGFPE
15667     signal(SIGFPE, blech);
15668 #endif
15669
15670     /* Paranoia - the compiler should have no way of knowing that ANSI says
15671        that argv[argc] will always be NULL.  Actually, if it did assume this it
15672        would be buggy, as this is C and main() can be called from elsewhere in
15673        the program.  */
15674     d = argv[argc] ? 1 : 0;
15675
15676     if (d) {
15677         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15678     }
15679
15680     fail += checkit(d, "ternary");
15681
15682     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15683
15684     if (d != 0.0) {
15685         printf("No - memset doesn't give 0.0\n");
15686         /* This might just blow up:  */
15687         printf("(gives %g)\n", d);
15688         return 1;
15689     }
15690
15691 #ifdef SIGFPE
15692     if (bletched) {
15693         printf("No - something bleched\n");
15694         return 1;
15695     }
15696 #endif
15697     if (fail) {
15698       printf("No - %d fail(s)\n", fail);
15699       return 1;
15700     }
15701     printf("Yes\n");
15702     return 0;
15703 }
15704 EOP
15705 set try
15706
15707 d_nv_zero_is_allbits_zero="$undef"
15708 if eval $compile; then
15709     xxx="`$run ./try`"
15710     case "$?" in
15711         0)
15712             case "$xxx" in
15713                 Yes)  cat >&4 <<EOM
15714 0.0 is represented as all bits zero in memory
15715 EOM
15716                     d_nv_zero_is_allbits_zero="$define"
15717                     ;;
15718                 *)  cat >&4 <<EOM
15719 0.0 is not represented as all bits zero in memory
15720 EOM
15721                     d_nv_zero_is_allbits_zero="$undef"
15722                     ;;
15723             esac
15724             ;;
15725         *)  cat >&4 <<EOM
15726 0.0 is not represented as all bits zero in memory
15727 EOM
15728             d_nv_zero_is_allbits_zero="$undef"
15729             ;;
15730     esac
15731 fi
15732 $rm_try
15733
15734 : check for off64_t
15735 echo " "
15736 echo "Checking to see if you have off64_t..." >&4
15737 $cat >try.c <<EOCP
15738 #include <sys/types.h>
15739 #include <unistd.h>
15740 int main() { off64_t x = 7; }
15741 EOCP
15742 set try
15743 if eval $compile; then
15744         val="$define"
15745         echo "You have off64_t."
15746 else
15747         val="$undef"
15748         echo "You do not have off64_t."
15749         case "$lseeksize" in
15750         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15751         esac
15752 fi
15753 $rm_try
15754 set d_off64_t
15755 eval $setvar
15756
15757 : how to create joinable pthreads
15758 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15759         echo " "
15760         echo "Checking what constant to use for creating joinable pthreads..." >&4
15761         $cat >try.c <<'EOCP'
15762 #include <pthread.h>
15763 int main() {
15764     int detachstate = JOINABLE;
15765 }
15766 EOCP
15767         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15768         if eval $compile; then
15769                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15770                 val="$undef" # Yes, undef.
15771                 set d_old_pthread_create_joinable
15772                 eval $setvar
15773                 val=""
15774                 set old_pthread_create_joinable
15775                 eval $setvar
15776         else
15777                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15778                 if eval $compile; then
15779                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15780                         val="$define"
15781                         set d_old_pthread_create_joinable
15782                         eval $setvar
15783                         val=PTHREAD_CREATE_UNDETACHED
15784                         set old_pthread_create_joinable
15785                         eval $setvar
15786                 else
15787                         set try -DJOINABLE=__UNDETACHED
15788                         if eval $compile; then
15789                                 echo "You seem to use __UNDETACHED." >&4
15790                                 val="$define"
15791                                 set d_old_pthread_create_joinable
15792                                 eval $setvar
15793                                 val=__UNDETACHED
15794                                 set old_pthread_create_joinable
15795                                 eval $setvar
15796                         else
15797                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15798                                 val="$define"
15799                                 set d_old_pthread_create_joinable
15800                                 eval $setvar
15801                                 val=0
15802                                 set old_pthread_create_joinable
15803                                 eval $setvar
15804                         fi
15805                 fi
15806         fi
15807         $rm_try
15808 else
15809     d_old_pthread_create_joinable="$undef"
15810     old_pthread_create_joinable=""
15811 fi
15812
15813 : see if pause exists
15814 set pause d_pause
15815 eval $inlibc
15816
15817 : see if poll exists
15818 set poll d_poll
15819 eval $inlibc
15820
15821 : see if readlink exists
15822 set readlink d_readlink
15823 eval $inlibc
15824
15825 : Check if exe is symlink to abs path of executing program
15826 echo " "
15827 procselfexe=''
15828 val="$undef"
15829 case "$d_readlink" in
15830 "$define")
15831         if $issymlink /proc/self/exe ; then
15832                 $ls -l /proc/self/exe > reflect
15833                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15834                         echo "You have Linux-like /proc/self/exe."
15835                         procselfexe='"/proc/self/exe"'
15836                         val="$define"
15837                 fi
15838         fi
15839         if $issymlink /proc/curproc/file ; then
15840                 $ls -l /proc/curproc/file > reflect
15841                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15842                         echo "You have BSD-like /proc/curproc/file."
15843                         procselfexe='"/proc/curproc/file"'
15844                         val="$define"
15845                 fi
15846         fi
15847         ;;
15848 esac
15849 $rm -f reflect
15850 set d_procselfexe
15851 eval $setvar
15852
15853 : backward compatibility for d_hvfork
15854 if test X$d_hvfork != X; then
15855         d_vfork="$d_hvfork"
15856         d_hvfork=''
15857 fi
15858 : see if there is a vfork
15859 val=''
15860 set vfork val
15861 eval $inlibc
15862
15863 d_pseudofork=$undef
15864
15865 : Ok, but do we want to use it. vfork is reportedly unreliable in
15866 : perl on Solaris 2.x, and probably elsewhere.
15867 case "$val" in
15868 $define)
15869         echo " "
15870         case "$usevfork" in
15871         false) dflt='n';;
15872         *) dflt='y';;
15873         esac
15874         cat <<'EOM'
15875
15876 Perl can only use a vfork() that doesn't suffer from strict
15877 restrictions on calling functions or modifying global data in
15878 the child.  For example, glibc-2.1 contains such a vfork()
15879 that is unsuitable.  If your system provides a proper fork()
15880 call, chances are that you do NOT want perl to use vfork().
15881
15882 EOM
15883         rp="Do you still want to use vfork()?"
15884         . ./myread
15885         case "$ans" in
15886         y|Y) ;;
15887         *)
15888                 echo "Ok, we won't use vfork()."
15889                 val="$undef"
15890                 ;;
15891         esac
15892         ;;
15893 esac
15894 set d_vfork
15895 eval $setvar
15896 case "$d_vfork" in
15897 $define) usevfork='true';;
15898 *) usevfork='false';;
15899 esac
15900
15901 : see whether the pthread_atfork exists
15902 $cat >try.c <<EOP
15903 #include <pthread.h>
15904 #include <stdio.h>
15905 int main() {
15906 #ifdef  PTHREAD_ATFORK
15907         pthread_atfork(NULL,NULL,NULL);
15908 #endif
15909 }
15910 EOP
15911
15912 : see if pthread_atfork exists
15913 set try -DPTHREAD_ATFORK
15914 if eval $compile; then
15915     val="$define"
15916 else
15917     val="$undef"
15918 fi
15919 case "$usethreads" in
15920 $define)
15921         case "$val" in
15922         $define) echo 'pthread_atfork found.' >&4        ;;
15923         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15924         esac
15925 esac
15926 set d_pthread_atfork
15927 eval $setvar
15928
15929 : see if pthread_attr_setscope exists
15930 set pthread_attr_setscope d_pthread_attr_setscope
15931 eval $inlibc
15932
15933 : see whether the various POSIXish _yields exist
15934 $cat >try.c <<EOP
15935 #include <pthread.h>
15936 #include <stdio.h>
15937 int main() {
15938 #ifdef SCHED_YIELD
15939         sched_yield();
15940 #else
15941 #ifdef PTHREAD_YIELD
15942         pthread_yield();
15943 #else
15944 #ifdef PTHREAD_YIELD_NULL
15945         pthread_yield(NULL);
15946 #endif
15947 #endif
15948 #endif
15949 }
15950 EOP
15951 : see if sched_yield exists
15952 set try -DSCHED_YIELD
15953 if eval $compile; then
15954     val="$define"
15955     sched_yield='sched_yield()'
15956 else
15957     val="$undef"
15958 fi
15959 case "$usethreads" in
15960 $define)
15961         case "$val" in
15962         $define) echo 'sched_yield() found.' >&4        ;;
15963         *)       echo 'sched_yield() NOT found.' >&4    ;;
15964         esac
15965 esac
15966 set d_sched_yield
15967 eval $setvar
15968
15969 : see if pthread_yield exists
15970 set try -DPTHREAD_YIELD
15971 if eval $compile; then
15972     val="$define"
15973     case "$sched_yield" in
15974     '') sched_yield='pthread_yield()' ;;
15975     esac
15976 else
15977     set try -DPTHREAD_YIELD_NULL
15978     if eval $compile; then
15979         val="$define"
15980         case "$sched_yield" in
15981         '') sched_yield='pthread_yield(NULL)' ;;
15982         esac
15983     else
15984         val="$undef"
15985     fi
15986 fi
15987 case "$usethreads" in
15988 $define)
15989         case "$val" in
15990         $define) echo 'pthread_yield() found.' >&4      ;;
15991         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15992         esac
15993         ;;
15994 esac
15995 set d_pthread_yield
15996 eval $setvar
15997 case "$sched_yield" in
15998 '') sched_yield=undef ;;
15999 esac
16000 $rm_try
16001
16002 : see if random_r exists
16003 set random_r d_random_r
16004 eval $inlibc
16005 case "$d_random_r" in
16006 "$define")
16007         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16008         case "$d_random_r_proto:$usethreads" in
16009         ":define")      d_random_r_proto=define
16010                 set d_random_r_proto random_r $hdrs
16011                 eval $hasproto ;;
16012         *)      ;;
16013         esac
16014         case "$d_random_r_proto" in
16015         define)
16016         case "$random_r_proto" in
16017         ''|0) try='int random_r(int*, struct random_data*);'
16018         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
16019         esac
16020         case "$random_r_proto" in
16021         ''|0) try='int random_r(long*, struct random_data*);'
16022         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
16023         esac
16024         case "$random_r_proto" in
16025         ''|0) try='int random_r(struct random_data*, int32_t*);'
16026         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
16027         esac
16028         case "$random_r_proto" in
16029         ''|0)   d_random_r=undef
16030                 random_r_proto=0
16031                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16032         * )     case "$random_r_proto" in
16033                 REENTRANT_PROTO*) ;;
16034                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16035                 esac
16036                 echo "Prototype: $try" ;;
16037         esac
16038         ;;
16039         *)      case "$usethreads" in
16040                 define) echo "random_r has no prototype, not using it." >&4 ;;
16041                 esac
16042                 d_random_r=undef
16043                 random_r_proto=0
16044                 ;;
16045         esac
16046         ;;
16047 *)      random_r_proto=0
16048         ;;
16049 esac
16050
16051 : see if readdir and friends exist
16052 set readdir d_readdir
16053 eval $inlibc
16054 set seekdir d_seekdir
16055 eval $inlibc
16056 set telldir d_telldir
16057 eval $inlibc
16058 set rewinddir d_rewinddir
16059 eval $inlibc
16060
16061 : see if readdir64_r exists
16062 set readdir64_r d_readdir64_r
16063 eval $inlibc
16064 case "$d_readdir64_r" in
16065 "$define")
16066         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16067         case "$d_readdir64_r_proto:$usethreads" in
16068         ":define")      d_readdir64_r_proto=define
16069                 set d_readdir64_r_proto readdir64_r $hdrs
16070                 eval $hasproto ;;
16071         *)      ;;
16072         esac
16073         case "$d_readdir64_r_proto" in
16074         define)
16075         case "$readdir64_r_proto" in
16076         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16077         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
16078         esac
16079         case "$readdir64_r_proto" in
16080         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16081         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
16082         esac
16083         case "$readdir64_r_proto" in
16084         ''|0)   d_readdir64_r=undef
16085                 readdir64_r_proto=0
16086                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16087         * )     case "$readdir64_r_proto" in
16088                 REENTRANT_PROTO*) ;;
16089                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16090                 esac
16091                 echo "Prototype: $try" ;;
16092         esac
16093         ;;
16094         *)      case "$usethreads" in
16095                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16096                 esac
16097                 d_readdir64_r=undef
16098                 readdir64_r_proto=0
16099                 ;;
16100         esac
16101         ;;
16102 *)      readdir64_r_proto=0
16103         ;;
16104 esac
16105
16106 : see if readdir_r exists
16107 set readdir_r d_readdir_r
16108 eval $inlibc
16109 case "$d_readdir_r" in
16110 "$define")
16111         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16112         case "$d_readdir_r_proto:$usethreads" in
16113         ":define")      d_readdir_r_proto=define
16114                 set d_readdir_r_proto readdir_r $hdrs
16115                 eval $hasproto ;;
16116         *)      ;;
16117         esac
16118         case "$d_readdir_r_proto" in
16119         define)
16120         case "$readdir_r_proto" in
16121         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16122         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
16123         esac
16124         case "$readdir_r_proto" in
16125         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16126         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
16127         esac
16128         case "$readdir_r_proto" in
16129         ''|0)   d_readdir_r=undef
16130                 readdir_r_proto=0
16131                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16132         * )     case "$readdir_r_proto" in
16133                 REENTRANT_PROTO*) ;;
16134                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16135                 esac
16136                 echo "Prototype: $try" ;;
16137         esac
16138         ;;
16139         *)      case "$usethreads" in
16140                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16141                 esac
16142                 d_readdir_r=undef
16143                 readdir_r_proto=0
16144                 ;;
16145         esac
16146         ;;
16147 *)      readdir_r_proto=0
16148         ;;
16149 esac
16150
16151 : see if readv exists
16152 set readv d_readv
16153 eval $inlibc
16154
16155 : see if recvmsg exists
16156 set recvmsg d_recvmsg
16157 eval $inlibc
16158
16159 : see if rename exists
16160 set rename d_rename
16161 eval $inlibc
16162
16163 : see if rmdir exists
16164 set rmdir d_rmdir
16165 eval $inlibc
16166
16167 : see if memory.h is available.
16168 val=''
16169 set memory.h val
16170 eval $inhdr
16171
16172 : See if it conflicts with string.h
16173 case "$val" in
16174 $define)
16175         case "$strings" in
16176         '') ;;
16177         *)
16178                 $cppstdin $cppflags $cppminus < $strings > mem.h
16179                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16180                         echo " "
16181                         echo "We won't be including <memory.h>."
16182                         val="$undef"
16183                 fi
16184                 $rm -f mem.h
16185                 ;;
16186         esac
16187 esac
16188 set i_memory
16189 eval $setvar
16190
16191 : can bcopy handle overlapping blocks?
16192 echo " "
16193 val="$undef"
16194 case "$d_memmove" in
16195 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16196 *)      case "$d_bcopy" in
16197         "$define")
16198                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16199                 $cat >try.c <<EOCP
16200 #$i_memory I_MEMORY
16201 #$i_stdlib I_STDLIB
16202 #$i_string I_STRING
16203 #$i_unistd I_UNISTD
16204 EOCP
16205         $cat >>try.c <<'EOCP'
16206 #include <stdio.h>
16207 #ifdef I_MEMORY
16208 #  include <memory.h>
16209 #endif
16210 #ifdef I_STDLIB
16211 #  include <stdlib.h>
16212 #endif
16213 #ifdef I_STRING
16214 #  include <string.h>
16215 #else
16216 #  include <strings.h>
16217 #endif
16218 #ifdef I_UNISTD
16219 #  include <unistd.h>  /* Needed for NetBSD */
16220 #endif
16221 int main()
16222 {
16223 char buf[128], abc[128];
16224 char *b;
16225 int len;
16226 int off;
16227 int align;
16228
16229 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16230    try to store the string in read-only memory. */
16231 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16232
16233 for (align = 7; align >= 0; align--) {
16234         for (len = 36; len; len--) {
16235                 b = buf+align;
16236                 bcopy(abc, b, len);
16237                 for (off = 1; off <= len; off++) {
16238                         bcopy(b, b+off, len);
16239                         bcopy(b+off, b, len);
16240                         if (bcmp(b, abc, len))
16241                                 exit(1);
16242                 }
16243         }
16244 }
16245 exit(0);
16246 }
16247 EOCP
16248                 set try
16249                 if eval $compile_ok; then
16250                         if $run ./try 2>/dev/null; then
16251                                 echo "Yes, it can."
16252                                 val="$define"
16253                         else
16254                                 echo "It can't, sorry."
16255                         fi
16256                 else
16257                         echo "(I can't compile the test program, so we'll assume not...)"
16258                 fi
16259                 ;;
16260         esac
16261         $rm_try
16262         ;;
16263 esac
16264 set d_safebcpy
16265 eval $setvar
16266
16267 : can memcpy handle overlapping blocks?
16268 echo " "
16269 val="$undef"
16270 case "$d_memmove" in
16271 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16272 *)      case "$d_memcpy" in
16273         "$define")
16274                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16275                 $cat >try.c <<EOCP
16276 #$i_memory I_MEMORY
16277 #$i_stdlib I_STDLIB
16278 #$i_string I_STRING
16279 #$i_unistd I_UNISTD
16280 EOCP
16281         $cat >>try.c <<'EOCP'
16282 #include <stdio.h>
16283 #ifdef I_MEMORY
16284 #  include <memory.h>
16285 #endif
16286 #ifdef I_STDLIB
16287 #  include <stdlib.h>
16288 #endif
16289 #ifdef I_STRING
16290 #  include <string.h>
16291 #else
16292 #  include <strings.h>
16293 #endif
16294 #ifdef I_UNISTD
16295 #  include <unistd.h>  /* Needed for NetBSD */
16296 #endif
16297 int main()
16298 {
16299 char buf[128], abc[128];
16300 char *b;
16301 int len;
16302 int off;
16303 int align;
16304
16305 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16306    try to store the string in read-only memory. */
16307 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16308
16309 for (align = 7; align >= 0; align--) {
16310         for (len = 36; len; len--) {
16311                 b = buf+align;
16312                 memcpy(b, abc, len);
16313                 for (off = 1; off <= len; off++) {
16314                         memcpy(b+off, b, len);
16315                         memcpy(b, b+off, len);
16316                         if (memcmp(b, abc, len))
16317                                 exit(1);
16318                 }
16319         }
16320 }
16321 exit(0);
16322 }
16323 EOCP
16324                 set try
16325                 if eval $compile_ok; then
16326                         if $run ./try 2>/dev/null; then
16327                                 echo "Yes, it can."
16328                                 val="$define"
16329                         else
16330                                 echo "It can't, sorry."
16331                         fi
16332                 else
16333                         echo "(I can't compile the test program, so we'll assume not...)"
16334                 fi
16335                 ;;
16336         esac
16337         $rm_try
16338         ;;
16339 esac
16340 set d_safemcpy
16341 eval $setvar
16342
16343 : can memcmp be trusted to compare relative magnitude?
16344 val="$undef"
16345 case "$d_memcmp" in
16346 "$define")
16347         echo " "
16348         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16349         $cat >try.c <<EOCP
16350 #$i_memory I_MEMORY
16351 #$i_stdlib I_STDLIB
16352 #$i_string I_STRING
16353 #$i_unistd I_UNISTD
16354 EOCP
16355         $cat >>try.c <<'EOCP'
16356 #include <stdio.h>
16357 #ifdef I_MEMORY
16358 #  include <memory.h>
16359 #endif
16360 #ifdef I_STDLIB
16361 #  include <stdlib.h>
16362 #endif
16363 #ifdef I_STRING
16364 #  include <string.h>
16365 #else
16366 #  include <strings.h>
16367 #endif
16368 #ifdef I_UNISTD
16369 #  include <unistd.h>  /* Needed for NetBSD */
16370 #endif
16371 int main()
16372 {
16373 char a = -1;
16374 char b = 0;
16375 if ((a < b) && memcmp(&a, &b, 1) < 0)
16376         exit(1);
16377 exit(0);
16378 }
16379 EOCP
16380         set try
16381         if eval $compile_ok; then
16382                 if $run ./try 2>/dev/null; then
16383                         echo "Yes, it can."
16384                         val="$define"
16385                 else
16386                         echo "No, it can't (it uses signed chars)."
16387                 fi
16388         else
16389                 echo "(I can't compile the test program, so we'll assume not...)"
16390         fi
16391         ;;
16392 esac
16393 $rm_try
16394 set d_sanemcmp
16395 eval $setvar
16396
16397 : see if prototype for sbrk is available
16398 echo " "
16399 set d_sbrkproto sbrk $i_unistd unistd.h
16400 eval $hasproto
16401
16402 : see if select exists
16403 set select d_select
16404 eval $inlibc
16405
16406 : see if semctl exists
16407 set semctl d_semctl
16408 eval $inlibc
16409
16410 : see if semget exists
16411 set semget d_semget
16412 eval $inlibc
16413
16414 : see if semop exists
16415 set semop d_semop
16416 eval $inlibc
16417
16418 : see how much of the 'sem*(2)' library is present.
16419 h_sem=true
16420 echo " "
16421 case "$d_semctl$d_semget$d_semop" in
16422 *"$undef"*) h_sem=false;;
16423 esac
16424 case "$osname" in
16425 freebsd)
16426     case "`ipcs 2>&1`" in
16427     "SVID messages"*"not configured"*)
16428         echo "Your $osname does not have the sem*(2) configured." >&4
16429         h_sem=false
16430         val="$undef"
16431         set semctl d_semctl
16432         eval $setvar
16433         set semget d_semget
16434         eval $setvar
16435         set semop d_semop
16436         eval $setvar
16437         ;;
16438     esac
16439     ;;
16440 esac
16441 : we could also check for sys/ipc.h ...
16442 if $h_sem && $test `./findhdr sys/sem.h`; then
16443         echo "You have the full sem*(2) library." >&4
16444         val="$define"
16445 else
16446         echo "You don't have the full sem*(2) library." >&4
16447         val="$undef"
16448 fi
16449 set d_sem
16450 eval $setvar
16451
16452 : see whether sys/sem.h defines union semun
16453 echo " "
16454 $cat > try.c <<'END'
16455 #include <sys/types.h>
16456 #include <sys/ipc.h>
16457 #include <sys/sem.h>
16458 int main () { union semun semun; semun.buf = 0; }
16459 END
16460 set try
16461 if eval $compile; then
16462     echo "You have union semun in <sys/sem.h>." >&4
16463     val="$define"
16464 else
16465     echo "You do not have union semun in <sys/sem.h>." >&4
16466     val="$undef"
16467 fi
16468 $rm_try
16469 set d_union_semun
16470 eval $setvar
16471
16472 : see how to do semctl IPC_STAT
16473 case "$d_sem" in
16474 $define)
16475     echo " "
16476     $cat > tryh.h <<END
16477 #ifndef S_IRUSR
16478 #   ifdef S_IREAD
16479 #       define S_IRUSR S_IREAD
16480 #       define S_IWUSR S_IWRITE
16481 #       define S_IXUSR S_IEXEC
16482 #   else
16483 #       define S_IRUSR 0400
16484 #       define S_IWUSR 0200
16485 #       define S_IXUSR 0100
16486 #   endif
16487 #   define S_IRGRP (S_IRUSR>>3)
16488 #   define S_IWGRP (S_IWUSR>>3)
16489 #   define S_IXGRP (S_IXUSR>>3)
16490 #   define S_IROTH (S_IRUSR>>6)
16491 #   define S_IWOTH (S_IWUSR>>6)
16492 #   define S_IXOTH (S_IXUSR>>6)
16493 #endif
16494 #ifndef S_IRWXU
16495 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16496 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16497 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16498 #endif
16499 END
16500     : see whether semctl IPC_STAT can use union semun
16501     case "$d_semctl_semun" in
16502     '')
16503       val="$undef"
16504       $cat > try.c <<END
16505 #include <sys/types.h>
16506 #include <sys/ipc.h>
16507 #include <sys/sem.h>
16508 #include <sys/stat.h>
16509 #include <stdio.h>
16510 #include <errno.h>
16511 #include "tryh.h"
16512 #ifndef errno
16513 extern int errno;
16514 #endif
16515 #$d_union_semun HAS_UNION_SEMUN
16516 int main() {
16517     union semun
16518 #ifndef HAS_UNION_SEMUN
16519     {
16520         int val;
16521         struct semid_ds *buf;
16522         unsigned short *array;
16523     }
16524 #endif
16525     arg;
16526     int sem, st;
16527
16528 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16529     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16530     if (sem > -1) {
16531         struct semid_ds argbuf;
16532         arg.buf = &argbuf;
16533 #       ifdef IPC_STAT
16534         st = semctl(sem, 0, IPC_STAT, arg);
16535         if (st == 0)
16536             printf("semun\n");
16537         else
16538 #       endif /* IPC_STAT */
16539             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16540 #       ifdef IPC_RMID
16541         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16542 #       endif /* IPC_RMID */
16543             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16544     } else
16545 #endif /* IPC_PRIVATE && ... */
16546         printf("semget failed: errno = %d\n", errno);
16547   return 0;
16548 }
16549 END
16550       set try
16551       if eval $compile; then
16552           xxx=`$run ./try`
16553           case "$xxx" in
16554           semun) val="$define" ;;
16555           esac
16556       fi
16557       $rm_try
16558       set d_semctl_semun
16559       eval $setvar
16560       ;;
16561     esac
16562     case "$d_semctl_semun" in
16563     $define)
16564         echo "You can use union semun for semctl IPC_STAT." >&4
16565         also='also'
16566         ;;
16567     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16568         also=''
16569         ;;
16570     esac
16571
16572     : see whether semctl IPC_STAT can use struct semid_ds pointer
16573     case "$d_semctl_semid_ds" in
16574     '')
16575       val="$undef"
16576       $cat > try.c <<'END'
16577 #include <sys/types.h>
16578 #include <sys/ipc.h>
16579 #include <sys/sem.h>
16580 #include <sys/stat.h>
16581 #include "tryh.h"
16582 #include <stdio.h>
16583 #include <errno.h>
16584 #ifndef errno
16585 extern int errno;
16586 #endif
16587 int main() {
16588     struct semid_ds arg;
16589     int sem, st;
16590
16591 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16592     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16593     if (sem > -1) {
16594 #       ifdef IPC_STAT
16595         st = semctl(sem, 0, IPC_STAT, &arg);
16596         if (st == 0)
16597             printf("semid_ds\n");
16598         else
16599 #       endif /* IPC_STAT */
16600             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16601 #       ifdef IPC_RMID
16602         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16603 #       endif /* IPC_RMID */
16604             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16605     } else
16606 #endif /* IPC_PRIVATE && ... */
16607         printf("semget failed: errno = %d\n", errno);
16608
16609     return 0;
16610 }
16611 END
16612       set try
16613       if eval $compile; then
16614           xxx=`$run ./try`
16615           case "$xxx" in
16616           semid_ds) val="$define" ;;
16617           esac
16618       fi
16619       $rm_try
16620       set d_semctl_semid_ds
16621       eval $setvar
16622       ;;
16623     esac
16624     case "$d_semctl_semid_ds" in
16625     $define)
16626         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16627         ;;
16628     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16629         ;;
16630     esac
16631     ;;
16632 *)  val="$undef"
16633
16634     # We do not have the full sem*(2) library, so assume we can not
16635     # use either.
16636
16637     set d_semctl_semun
16638     eval $setvar
16639
16640     set d_semctl_semid_ds
16641     eval $setvar
16642     ;;
16643 esac
16644 $rm_try tryh.h
16645
16646 : see if sendmsg exists
16647 set sendmsg d_sendmsg
16648 eval $inlibc
16649
16650 : see if setegid exists
16651 set setegid d_setegid
16652 eval $inlibc
16653
16654 : see if seteuid exists
16655 set seteuid d_seteuid
16656 eval $inlibc
16657
16658 : see if setgrent exists
16659 set setgrent d_setgrent
16660 eval $inlibc
16661
16662 : see if setgrent_r exists
16663 set setgrent_r d_setgrent_r
16664 eval $inlibc
16665 case "$d_setgrent_r" in
16666 "$define")
16667         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16668         case "$d_setgrent_r_proto:$usethreads" in
16669         ":define")      d_setgrent_r_proto=define
16670                 set d_setgrent_r_proto setgrent_r $hdrs
16671                 eval $hasproto ;;
16672         *)      ;;
16673         esac
16674         case "$d_setgrent_r_proto" in
16675         define)
16676         case "$setgrent_r_proto" in
16677         ''|0) try='int setgrent_r(FILE**);'
16678         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
16679         esac
16680         case "$setgrent_r_proto" in
16681         ''|0) try='void setgrent_r(FILE**);'
16682         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
16683         esac
16684         case "$setgrent_r_proto" in
16685         ''|0)   d_setgrent_r=undef
16686                 setgrent_r_proto=0
16687                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16688         * )     case "$setgrent_r_proto" in
16689                 REENTRANT_PROTO*) ;;
16690                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16691                 esac
16692                 echo "Prototype: $try" ;;
16693         esac
16694         ;;
16695         *)      case "$usethreads" in
16696                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16697                 esac
16698                 d_setgrent_r=undef
16699                 setgrent_r_proto=0
16700                 ;;
16701         esac
16702         ;;
16703 *)      setgrent_r_proto=0
16704         ;;
16705 esac
16706
16707 : see if sethostent exists
16708 set sethostent d_sethent
16709 eval $inlibc
16710
16711 : see if sethostent_r exists
16712 set sethostent_r d_sethostent_r
16713 eval $inlibc
16714 case "$d_sethostent_r" in
16715 "$define")
16716         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16717         case "$d_sethostent_r_proto:$usethreads" in
16718         ":define")      d_sethostent_r_proto=define
16719                 set d_sethostent_r_proto sethostent_r $hdrs
16720                 eval $hasproto ;;
16721         *)      ;;
16722         esac
16723         case "$d_sethostent_r_proto" in
16724         define)
16725         case "$sethostent_r_proto" in
16726         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16727         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16728         esac
16729         case "$sethostent_r_proto" in
16730         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16731         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16732         esac
16733         case "$sethostent_r_proto" in
16734         ''|0)   d_sethostent_r=undef
16735                 sethostent_r_proto=0
16736                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16737         * )     case "$sethostent_r_proto" in
16738                 REENTRANT_PROTO*) ;;
16739                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16740                 esac
16741                 echo "Prototype: $try" ;;
16742         esac
16743         ;;
16744         *)      case "$usethreads" in
16745                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16746                 esac
16747                 d_sethostent_r=undef
16748                 sethostent_r_proto=0
16749                 ;;
16750         esac
16751         ;;
16752 *)      sethostent_r_proto=0
16753         ;;
16754 esac
16755
16756 : see if setitimer exists
16757 set setitimer d_setitimer
16758 eval $inlibc
16759
16760 : see if setlinebuf exists
16761 set setlinebuf d_setlinebuf
16762 eval $inlibc
16763
16764 : see if setlocale exists
16765 set setlocale d_setlocale
16766 eval $inlibc
16767
16768 : see if locale.h is available
16769 set locale.h i_locale
16770 eval $inhdr
16771
16772 : see if setlocale_r exists
16773 set setlocale_r d_setlocale_r
16774 eval $inlibc
16775 case "$d_setlocale_r" in
16776 "$define")
16777         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16778         case "$d_setlocale_r_proto:$usethreads" in
16779         ":define")      d_setlocale_r_proto=define
16780                 set d_setlocale_r_proto setlocale_r $hdrs
16781                 eval $hasproto ;;
16782         *)      ;;
16783         esac
16784         case "$d_setlocale_r_proto" in
16785         define)
16786         case "$setlocale_r_proto" in
16787         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16788         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16789         esac
16790         case "$setlocale_r_proto" in
16791         ''|0)   d_setlocale_r=undef
16792                 setlocale_r_proto=0
16793                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16794         * )     case "$setlocale_r_proto" in
16795                 REENTRANT_PROTO*) ;;
16796                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16797                 esac
16798                 echo "Prototype: $try" ;;
16799         esac
16800         ;;
16801         *)      case "$usethreads" in
16802                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16803                 esac
16804                 d_setlocale_r=undef
16805                 setlocale_r_proto=0
16806                 ;;
16807         esac
16808         ;;
16809 *)      setlocale_r_proto=0
16810         ;;
16811 esac
16812
16813 : see if setnetent exists
16814 set setnetent d_setnent
16815 eval $inlibc
16816
16817 : see if setnetent_r exists
16818 set setnetent_r d_setnetent_r
16819 eval $inlibc
16820 case "$d_setnetent_r" in
16821 "$define")
16822         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16823         case "$d_setnetent_r_proto:$usethreads" in
16824         ":define")      d_setnetent_r_proto=define
16825                 set d_setnetent_r_proto setnetent_r $hdrs
16826                 eval $hasproto ;;
16827         *)      ;;
16828         esac
16829         case "$d_setnetent_r_proto" in
16830         define)
16831         case "$setnetent_r_proto" in
16832         ''|0) try='int setnetent_r(int, struct netent_data*);'
16833         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16834         esac
16835         case "$setnetent_r_proto" in
16836         ''|0) try='void setnetent_r(int, struct netent_data*);'
16837         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16838         esac
16839         case "$setnetent_r_proto" in
16840         ''|0)   d_setnetent_r=undef
16841                 setnetent_r_proto=0
16842                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16843         * )     case "$setnetent_r_proto" in
16844                 REENTRANT_PROTO*) ;;
16845                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16846                 esac
16847                 echo "Prototype: $try" ;;
16848         esac
16849         ;;
16850         *)      case "$usethreads" in
16851                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16852                 esac
16853                 d_setnetent_r=undef
16854                 setnetent_r_proto=0
16855                 ;;
16856         esac
16857         ;;
16858 *)      setnetent_r_proto=0
16859         ;;
16860 esac
16861
16862 : see if setprotoent exists
16863 set setprotoent d_setpent
16864 eval $inlibc
16865
16866 : see if setpgid exists
16867 set setpgid d_setpgid
16868 eval $inlibc
16869
16870 : see if setpgrp2 exists
16871 set setpgrp2 d_setpgrp2
16872 eval $inlibc
16873
16874 : see if setpriority exists
16875 set setpriority d_setprior
16876 eval $inlibc
16877
16878 : see if setproctitle exists
16879 set setproctitle d_setproctitle
16880 eval $inlibc
16881
16882 : see if setprotoent_r exists
16883 set setprotoent_r d_setprotoent_r
16884 eval $inlibc
16885 case "$d_setprotoent_r" in
16886 "$define")
16887         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16888         case "$d_setprotoent_r_proto:$usethreads" in
16889         ":define")      d_setprotoent_r_proto=define
16890                 set d_setprotoent_r_proto setprotoent_r $hdrs
16891                 eval $hasproto ;;
16892         *)      ;;
16893         esac
16894         case "$d_setprotoent_r_proto" in
16895         define)
16896         case "$setprotoent_r_proto" in
16897         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16898         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16899         esac
16900         case "$setprotoent_r_proto" in
16901         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16902         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16903         esac
16904         case "$setprotoent_r_proto" in
16905         ''|0)   d_setprotoent_r=undef
16906                 setprotoent_r_proto=0
16907                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16908         * )     case "$setprotoent_r_proto" in
16909                 REENTRANT_PROTO*) ;;
16910                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16911                 esac
16912                 echo "Prototype: $try" ;;
16913         esac
16914         ;;
16915         *)      case "$usethreads" in
16916                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16917                 esac
16918                 d_setprotoent_r=undef
16919                 setprotoent_r_proto=0
16920                 ;;
16921         esac
16922         ;;
16923 *)      setprotoent_r_proto=0
16924         ;;
16925 esac
16926
16927 : see if setpwent exists
16928 set setpwent d_setpwent
16929 eval $inlibc
16930
16931 : see if setpwent_r exists
16932 set setpwent_r d_setpwent_r
16933 eval $inlibc
16934 case "$d_setpwent_r" in
16935 "$define")
16936         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16937         case "$d_setpwent_r_proto:$usethreads" in
16938         ":define")      d_setpwent_r_proto=define
16939                 set d_setpwent_r_proto setpwent_r $hdrs
16940                 eval $hasproto ;;
16941         *)      ;;
16942         esac
16943         case "$d_setpwent_r_proto" in
16944         define)
16945         case "$setpwent_r_proto" in
16946         ''|0) try='int setpwent_r(FILE**);'
16947         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16948         esac
16949         case "$setpwent_r_proto" in
16950         ''|0) try='void setpwent_r(FILE**);'
16951         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16952         esac
16953         case "$setpwent_r_proto" in
16954         ''|0)   d_setpwent_r=undef
16955                 setpwent_r_proto=0
16956                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16957         * )     case "$setpwent_r_proto" in
16958                 REENTRANT_PROTO*) ;;
16959                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16960                 esac
16961                 echo "Prototype: $try" ;;
16962         esac
16963         ;;
16964         *)      case "$usethreads" in
16965                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16966                 esac
16967                 d_setpwent_r=undef
16968                 setpwent_r_proto=0
16969                 ;;
16970         esac
16971         ;;
16972 *)      setpwent_r_proto=0
16973         ;;
16974 esac
16975
16976 : see if setregid exists
16977 set setregid d_setregid
16978 eval $inlibc
16979 set setresgid d_setresgid
16980 eval $inlibc
16981
16982 : see if setreuid exists
16983 set setreuid d_setreuid
16984 eval $inlibc
16985 set setresuid d_setresuid
16986 eval $inlibc
16987
16988 : see if setrgid exists
16989 set setrgid d_setrgid
16990 eval $inlibc
16991
16992 : see if setruid exists
16993 set setruid d_setruid
16994 eval $inlibc
16995
16996 : see if setservent exists
16997 set setservent d_setsent
16998 eval $inlibc
16999
17000 : see if setservent_r exists
17001 set setservent_r d_setservent_r
17002 eval $inlibc
17003 case "$d_setservent_r" in
17004 "$define")
17005         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17006         case "$d_setservent_r_proto:$usethreads" in
17007         ":define")      d_setservent_r_proto=define
17008                 set d_setservent_r_proto setservent_r $hdrs
17009                 eval $hasproto ;;
17010         *)      ;;
17011         esac
17012         case "$d_setservent_r_proto" in
17013         define)
17014         case "$setservent_r_proto" in
17015         ''|0) try='int setservent_r(int, struct servent_data*);'
17016         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
17017         esac
17018         case "$setservent_r_proto" in
17019         ''|0) try='void setservent_r(int, struct servent_data*);'
17020         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
17021         esac
17022         case "$setservent_r_proto" in
17023         ''|0)   d_setservent_r=undef
17024                 setservent_r_proto=0
17025                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17026         * )     case "$setservent_r_proto" in
17027                 REENTRANT_PROTO*) ;;
17028                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17029                 esac
17030                 echo "Prototype: $try" ;;
17031         esac
17032         ;;
17033         *)      case "$usethreads" in
17034                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17035                 esac
17036                 d_setservent_r=undef
17037                 setservent_r_proto=0
17038                 ;;
17039         esac
17040         ;;
17041 *)      setservent_r_proto=0
17042         ;;
17043 esac
17044
17045 : see if setsid exists
17046 set setsid d_setsid
17047 eval $inlibc
17048
17049 : see if setvbuf exists
17050 set setvbuf d_setvbuf
17051 eval $inlibc
17052
17053 : see if sfio.h is available
17054 set sfio.h i_sfio
17055 eval $inhdr
17056
17057 : see if sfio library is available
17058 case "$i_sfio" in
17059 $define)
17060         val=''
17061         set sfreserve val
17062         eval $inlibc
17063         ;;
17064 *)
17065         val="$undef"
17066         ;;
17067 esac
17068 : Ok, but do we want to use it.
17069 case "$val" in
17070 $define)
17071         case "$usesfio" in
17072         true|$define|[yY]*) dflt='y';;
17073         *) dflt='n';;
17074         esac
17075         echo "$package can use the sfio library, but it is experimental."
17076         case "$useperlio" in
17077         "$undef")
17078             echo "For sfio also the PerlIO abstraction layer is needed."
17079             echo "Earlier you said you wouldn't want that."
17080             ;;
17081         esac
17082         rp="You seem to have sfio available, do you want to try using it?"
17083         . ./myread
17084         case "$ans" in
17085         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
17086                 useperlio="$define"
17087                 val="$define"
17088                 ;;
17089         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17090                 val="$undef"
17091                 ;;
17092         esac
17093         ;;
17094 *)      case "$usesfio" in
17095         true|$define|[yY]*)
17096                 echo "Sorry, cannot find sfio on this machine." >&4
17097                 echo "Ignoring your setting of usesfio=$usesfio." >&4
17098                 val="$undef"
17099                 ;;
17100         esac
17101         ;;
17102 esac
17103 set d_sfio
17104 eval $setvar
17105 case "$d_sfio" in
17106 $define) usesfio='true';;
17107 *) usesfio='false';;
17108 esac
17109 case "$d_sfio" in
17110 $define) ;;
17111 *)      : Remove sfio from list of libraries to use
17112         case "$libs" in
17113         *-lsfio*)
17114                 echo "Removing unneeded -lsfio from library list" >&4
17115                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17116                 shift
17117                 libs="$*"
17118                 echo "libs = $libs" >&4
17119                 ;;
17120         esac
17121 ;;
17122 esac
17123
17124
17125 : see if shmctl exists
17126 set shmctl d_shmctl
17127 eval $inlibc
17128
17129 : see if shmget exists
17130 set shmget d_shmget
17131 eval $inlibc
17132
17133 : see if shmat exists
17134 set shmat d_shmat
17135 eval $inlibc
17136 : see what shmat returns
17137 case "$d_shmat" in
17138 "$define")
17139         $cat >shmat.c <<'END'
17140 #include <sys/shm.h>
17141 void *shmat();
17142 END
17143         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17144                 shmattype='void *'
17145         else
17146                 shmattype='char *'
17147         fi
17148         echo "and it returns ($shmattype)." >&4
17149         : see if a prototype for shmat is available
17150         xxx=`./findhdr sys/shm.h`
17151         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17152         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17153                 val="$define"
17154         else
17155                 val="$undef"
17156         fi
17157         $rm -f shmat.[co]
17158         ;;
17159 *)
17160         val="$undef"
17161         ;;
17162 esac
17163 set d_shmatprototype
17164 eval $setvar
17165
17166 : see if shmdt exists
17167 set shmdt d_shmdt
17168 eval $inlibc
17169
17170 : see how much of the 'shm*(2)' library is present.
17171 h_shm=true
17172 echo " "
17173 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17174 *"$undef"*) h_shm=false;;
17175 esac
17176 case "$osname" in
17177 freebsd)
17178     case "`ipcs 2>&1`" in
17179     "SVID shared memory"*"not configured"*)
17180         echo "Your $osname does not have the shm*(2) configured." >&4
17181         h_shm=false
17182         val="$undef"
17183         set shmctl d_shmctl
17184         evat $setvar
17185         set shmget d_shmget
17186         evat $setvar
17187         set shmat d_shmat
17188         evat $setvar
17189         set shmdt d_shmdt
17190         evat $setvar
17191         ;;
17192     esac
17193     ;;
17194 esac
17195 : we could also check for sys/ipc.h ...
17196 if $h_shm && $test `./findhdr sys/shm.h`; then
17197         echo "You have the full shm*(2) library." >&4
17198         val="$define"
17199 else
17200         echo "You don't have the full shm*(2) library." >&4
17201         val="$undef"
17202 fi
17203 set d_shm
17204 eval $setvar
17205
17206 : see if we have sigaction
17207 echo " "
17208 if set sigaction val -f d_sigaction; eval $csym; $val; then
17209         echo 'sigaction() found.' >&4
17210         $cat > try.c <<EOP
17211 #include <stdio.h>
17212 #include <sys/types.h>
17213 #include <signal.h>
17214 #$i_stdlib I_STDLIB
17215 #ifdef I_STDLIB
17216 #include <stdlib.h>
17217 #endif
17218 int main()
17219 {
17220     struct sigaction act, oact;
17221     act.sa_flags = 0;
17222     oact.sa_handler = 0;
17223     /* so that act and oact are used */
17224     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17225 }
17226 EOP
17227         set try
17228         if eval $compile_ok; then
17229                 val="$define"
17230         else
17231                 echo "But you don't seem to have a useable struct sigaction." >&4
17232                 val="$undef"
17233         fi
17234 else
17235         echo 'sigaction NOT found.' >&4
17236         val="$undef"
17237 fi
17238 set d_sigaction; eval $setvar
17239 $rm_try
17240
17241 : see if this is a sunmath.h system
17242 set sunmath.h i_sunmath
17243 eval $inhdr
17244
17245 : see if signbit exists
17246 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17247 $cat >try.c <<EOCP
17248 #$i_math I_MATH
17249 #$i_sunmath I_SUNMATH
17250 #ifdef I_MATH
17251 #  include <math.h>
17252 #endif
17253 #ifdef I_SUNMATH  /* Solaris special math library */
17254 #  include <sunmath.h>
17255 #endif
17256 #define NV $nvtype
17257 int main(int argc, char **argv)
17258 {
17259     NV x = 0.0;
17260     NV y = -0.0;
17261     if ((signbit(x) == 0) && (signbit(y) != 0))
17262         return 0;
17263     else
17264         return 1;
17265 }
17266 EOCP
17267 val="$undef"
17268 set try
17269 if eval $compile; then
17270     if $run ./try; then
17271         $echo "Yes." >&4
17272         val="$define"
17273     else
17274         $echo "Signbit seems to be available, but doesn't work as I expected."
17275         $echo "I won't use it." >&4
17276         val="$undef"
17277     fi
17278 else
17279     $echo "Nope." >&4
17280     dflt="$undef"
17281 fi
17282 set d_signbit
17283 eval $setvar
17284 $rm_try
17285
17286 : see if sigprocmask exists
17287 set sigprocmask d_sigprocmask
17288 eval $inlibc
17289
17290 : see if sigsetjmp exists
17291 echo " "
17292 case "$d_sigsetjmp" in
17293 '')
17294         $cat >try.c <<EOP
17295 #include <setjmp.h>
17296 #$i_stdlib I_STDLIB
17297 #ifdef I_STDLIB
17298 #include <stdlib.h>
17299 #endif
17300 sigjmp_buf env;
17301 int set = 1;
17302 int main()
17303 {
17304         if (sigsetjmp(env,1))
17305                 exit(set);
17306         set = 0;
17307         siglongjmp(env, 1);
17308         exit(1);
17309 }
17310 EOP
17311         set try
17312         if eval $compile; then
17313                 if $run ./try >/dev/null 2>&1; then
17314                         echo "POSIX sigsetjmp found." >&4
17315                         val="$define"
17316                 else
17317                         $cat >&4 <<EOM
17318 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17319 I'll ignore them.
17320 EOM
17321                         val="$undef"
17322                 fi
17323         else
17324                 echo "sigsetjmp not found." >&4
17325                 val="$undef"
17326         fi
17327         ;;
17328 *) val="$d_sigsetjmp"
17329         case "$d_sigsetjmp" in
17330         $define) echo "POSIX sigsetjmp found." >&4;;
17331         $undef) echo "sigsetjmp not found." >&4;;
17332         esac
17333         ;;
17334 esac
17335 set d_sigsetjmp
17336 eval $setvar
17337 $rm_try
17338
17339 : see if snprintf exists
17340 set snprintf d_snprintf
17341 eval $inlibc
17342
17343 : see if vsnprintf exists
17344 set vsnprintf d_vsnprintf
17345 eval $inlibc
17346
17347 case "$d_snprintf-$d_vsnprintf" in
17348 "$define-$define")
17349     $cat <<EOM
17350 Checking whether your snprintf() and vsnprintf() work okay...
17351 EOM
17352     $cat >try.c <<'EOCP'
17353 /* v?snprintf testing logic courtesy of Russ Allbery.
17354  * According to C99:
17355  * - if the buffer is too short it still must be \0-terminated
17356  * - if the buffer is too short the potentially required length
17357  *   must be returned and not -1
17358  * - if the buffer is NULL the potentially required length
17359  *   must be returned and not -1 or core dump
17360  */
17361 #include <stdio.h>
17362 #include <stdarg.h>
17363
17364 char buf[2];
17365
17366 int test (char *format, ...)
17367 {
17368     va_list args;
17369     int count;
17370
17371     va_start (args, format);
17372     count = vsnprintf (buf, sizeof buf, format, args);
17373     va_end (args);
17374     return count;
17375 }
17376
17377 int main ()
17378 {
17379     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17380              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17381 }
17382 EOCP
17383     set try
17384     if eval $compile; then
17385         `$run ./try`
17386         case "$?" in
17387         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17388         *) cat <<EOM >&4
17389 Your snprintf() and snprintf() don't seem to be working okay.
17390 EOM
17391            d_snprintf="$undef"
17392            d_vsnprintf="$undef"
17393            ;;
17394         esac
17395     else
17396         echo "(I can't seem to compile the test program--assuming they don't)"
17397         d_snprintf="$undef"
17398         d_vsnprintf="$undef"
17399     fi
17400     $rm_try
17401     ;;
17402 esac
17403
17404 : see if sockatmark exists
17405 set sockatmark d_sockatmark
17406 eval $inlibc
17407
17408 : see if prototype for sockatmark is available
17409 echo " "
17410 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17411 eval $hasproto
17412
17413 : see if socks5_init exists
17414 set socks5_init d_socks5_init
17415 eval $inlibc
17416
17417 : see if sprintf returns the length of the string in the buffer as per ANSI
17418 $echo "Checking whether sprintf returns the length of the string..." >&4
17419 $cat <<EOP >try.c
17420 #include <stdio.h>
17421 #$i_stdlib I_STDLIB
17422 #ifdef I_STDLIB
17423 #include <stdlib.h>
17424 #endif
17425 #$i_string I_STRING
17426 #ifdef I_STRING
17427 #  include <string.h>
17428 #else
17429 #  include <strings.h>
17430 #endif
17431 #$i_math I_MATH
17432 #ifdef I_MATH
17433 #include <math.h>
17434 #endif
17435
17436 char buffer[256];
17437
17438 int check (size_t expect, int test) {
17439   size_t got = strlen(buffer);
17440   if (expect == got)
17441     return 0;
17442
17443   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17444        test, buffer);
17445   exit (test);
17446 }
17447
17448 int main(int argc, char **argv) {
17449   int test = 0;
17450
17451   check(sprintf(buffer, ""), ++test);
17452   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17453   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17454
17455   return 0;
17456 }
17457 EOP
17458 set try
17459
17460 d_sprintf_returns_strlen="$undef"
17461 if eval $compile; then
17462     xxx="`$run ./try`"
17463     case "$?" in
17464         0) cat >&4 <<EOM
17465 sprintf returns the length of the string (as ANSI says it should)
17466 EOM
17467         d_sprintf_returns_strlen="$define"
17468         ;;
17469         *) cat >&4 <<EOM
17470 sprintf does not return the length of the string (how old is this system?)
17471 EOM
17472         d_sprintf_returns_strlen="$undef"
17473         ;;
17474     esac
17475 fi
17476 $rm_try
17477
17478 : see if srand48_r exists
17479 set srand48_r d_srand48_r
17480 eval $inlibc
17481 case "$d_srand48_r" in
17482 "$define")
17483         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17484         case "$d_srand48_r_proto:$usethreads" in
17485         ":define")      d_srand48_r_proto=define
17486                 set d_srand48_r_proto srand48_r $hdrs
17487                 eval $hasproto ;;
17488         *)      ;;
17489         esac
17490         case "$d_srand48_r_proto" in
17491         define)
17492         case "$srand48_r_proto" in
17493         ''|0) try='int srand48_r(long, struct drand48_data*);'
17494         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
17495         esac
17496         case "$srand48_r_proto" in
17497         ''|0)   d_srand48_r=undef
17498                 srand48_r_proto=0
17499                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17500         * )     case "$srand48_r_proto" in
17501                 REENTRANT_PROTO*) ;;
17502                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17503                 esac
17504                 echo "Prototype: $try" ;;
17505         esac
17506         ;;
17507         *)      case "$usethreads" in
17508                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17509                 esac
17510                 d_srand48_r=undef
17511                 srand48_r_proto=0
17512                 ;;
17513         esac
17514         ;;
17515 *)      srand48_r_proto=0
17516         ;;
17517 esac
17518
17519 : see if srandom_r exists
17520 set srandom_r d_srandom_r
17521 eval $inlibc
17522 case "$d_srandom_r" in
17523 "$define")
17524         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17525         case "$d_srandom_r_proto:$usethreads" in
17526         ":define")      d_srandom_r_proto=define
17527                 set d_srandom_r_proto srandom_r $hdrs
17528                 eval $hasproto ;;
17529         *)      ;;
17530         esac
17531         case "$d_srandom_r_proto" in
17532         define)
17533         case "$srandom_r_proto" in
17534         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17535         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
17536         esac
17537         case "$srandom_r_proto" in
17538         ''|0)   d_srandom_r=undef
17539                 srandom_r_proto=0
17540                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17541         * )     case "$srandom_r_proto" in
17542                 REENTRANT_PROTO*) ;;
17543                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17544                 esac
17545                 echo "Prototype: $try" ;;
17546         esac
17547         ;;
17548         *)      case "$usethreads" in
17549                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17550                 esac
17551                 d_srandom_r=undef
17552                 srandom_r_proto=0
17553                 ;;
17554         esac
17555         ;;
17556 *)      srandom_r_proto=0
17557         ;;
17558 esac
17559
17560 : see if prototype for setresgid is available
17561 echo " "
17562 set d_sresgproto setresgid $i_unistd unistd.h
17563 eval $hasproto
17564
17565 : see if prototype for setresuid is available
17566 echo " "
17567 set d_sresuproto setresuid $i_unistd unistd.h
17568 eval $hasproto
17569
17570 : see if sys/stat.h is available
17571 set sys/stat.h i_sysstat
17572 eval $inhdr
17573
17574 : see if stat knows about block sizes
17575 echo " "
17576 echo "Checking to see if your struct stat has st_blocks field..." >&4
17577 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17578 eval $hasfield
17579
17580 : see if this is a sys/vfs.h system
17581 set sys/vfs.h i_sysvfs
17582 eval $inhdr
17583
17584 : see if this is a sys/statfs.h system
17585 set sys/statfs.h i_sysstatfs
17586 eval $inhdr
17587
17588 : Check for statfs_s
17589 echo " "
17590 echo "Checking to see if your system supports struct statfs..." >&4
17591 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
17592 eval $hasstruct
17593 case "$d_statfs_s" in
17594 "$define")      echo "Yes, it does."   ;;
17595 *)              echo "No, it doesn't." ;;
17596 esac
17597
17598
17599 : see if struct statfs knows about f_flags
17600 case "$d_statfs_s" in
17601 define)
17602         echo " "
17603         echo "Checking to see if your struct statfs has f_flags field..." >&4
17604         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
17605         eval $hasfield
17606         ;;
17607 *)      val="$undef"
17608         set d_statfs_f_flags
17609         eval $setvar
17610         ;;
17611 esac
17612 case "$d_statfs_f_flags" in
17613 "$define")      echo "Yes, it does."   ;;
17614 *)              echo "No, it doesn't." ;;
17615 esac
17616
17617 : Check stream access
17618 $cat >&4 <<EOM
17619 Checking how to access stdio streams by file descriptor number...
17620 EOM
17621 case "$stdio_stream_array" in
17622 '')     $cat >try.c <<EOCP
17623 #include <stdio.h>
17624 int main() {
17625   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17626     printf("yes\n");
17627 }
17628 EOCP
17629         for s in _iob __iob __sF
17630         do
17631                 set try -DSTDIO_STREAM_ARRAY=$s
17632                 if eval $compile; then
17633                         case "`$run ./try`" in
17634                         yes)    stdio_stream_array=$s; break ;;
17635                         esac
17636                 fi
17637         done
17638         $rm_try
17639 esac
17640 case "$stdio_stream_array" in
17641 '')     $cat >&4 <<EOM
17642 I can't figure out how to access stdio streams by file descriptor number.
17643 EOM
17644         d_stdio_stream_array="$undef"
17645         ;;
17646 *)      $cat >&4 <<EOM
17647 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17648 EOM
17649         d_stdio_stream_array="$define"
17650         ;;
17651 esac
17652
17653 : see if strcoll exists
17654 set strcoll d_strcoll
17655 eval $inlibc
17656
17657 : check for structure copying
17658 echo " "
17659 echo "Checking to see if your C compiler can copy structs..." >&4
17660 $cat >try.c <<'EOCP'
17661 int main()
17662 {
17663         struct blurfl {
17664                 int dyick;
17665         } foo, bar;
17666
17667         foo = bar;
17668 }
17669 EOCP
17670 if $cc -c try.c >/dev/null 2>&1 ; then
17671         val="$define"
17672         echo "Yup, it can."
17673 else
17674         val="$undef"
17675         echo "Nope, it can't."
17676 fi
17677 set d_strctcpy
17678 eval $setvar
17679 $rm_try
17680
17681 : see if strerror and/or sys_errlist[] exist
17682 echo " "
17683 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17684     if set strerror val -f d_strerror; eval $csym; $val; then
17685                 echo 'strerror() found.' >&4
17686                 d_strerror="$define"
17687                 d_strerrm='strerror(e)'
17688                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17689                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17690                         d_syserrlst="$define"
17691                 else
17692                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17693                         d_syserrlst="$undef"
17694                 fi
17695     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17696                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17697                 echo 'strerror() found in string header.' >&4
17698                 d_strerror="$define"
17699                 d_strerrm='strerror(e)'
17700                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17701                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17702                                 d_syserrlst="$define"
17703                 else
17704                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17705                         d_syserrlst="$undef"
17706                 fi
17707     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17708                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17709                 d_strerror="$undef"
17710                 d_syserrlst="$define"
17711                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17712     else
17713                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17714                 d_strerror="$undef"
17715                 d_syserrlst="$undef"
17716                 d_strerrm='"unknown"'
17717     fi
17718 fi
17719
17720 : see if strerror_r exists
17721 set strerror_r d_strerror_r
17722 eval $inlibc
17723 case "$d_strerror_r" in
17724 "$define")
17725         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17726         case "$d_strerror_r_proto:$usethreads" in
17727         ":define")      d_strerror_r_proto=define
17728                 set d_strerror_r_proto strerror_r $hdrs
17729                 eval $hasproto ;;
17730         *)      ;;
17731         esac
17732         case "$d_strerror_r_proto" in
17733         define)
17734         case "$strerror_r_proto" in
17735         ''|0) try='int strerror_r(int, char*, size_t);'
17736         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17737         esac
17738         case "$strerror_r_proto" in
17739         ''|0) try='int strerror_r(int, char*, int);'
17740         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17741         esac
17742         case "$strerror_r_proto" in
17743         ''|0) try='char* strerror_r(int, char*, size_t);'
17744         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17745         esac
17746         case "$strerror_r_proto" in
17747         ''|0)   d_strerror_r=undef
17748                 strerror_r_proto=0
17749                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17750         * )     case "$strerror_r_proto" in
17751                 REENTRANT_PROTO*) ;;
17752                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17753                 esac
17754                 echo "Prototype: $try" ;;
17755         esac
17756         ;;
17757         *)      case "$usethreads" in
17758                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17759                 esac
17760                 d_strerror_r=undef
17761                 strerror_r_proto=0
17762                 ;;
17763         esac
17764         ;;
17765 *)      strerror_r_proto=0
17766         ;;
17767 esac
17768
17769 : see if strftime exists
17770 set strftime d_strftime
17771 eval $inlibc
17772
17773 : see if strlcat exists
17774 set strlcat d_strlcat
17775 eval $inlibc
17776
17777 : see if strlcpy exists
17778 set strlcpy d_strlcpy
17779 eval $inlibc
17780
17781 : see if strtod exists
17782 set strtod d_strtod
17783 eval $inlibc
17784
17785 : see if strtol exists
17786 set strtol d_strtol
17787 eval $inlibc
17788
17789 : see if strtold exists
17790 set strtold d_strtold
17791 eval $inlibc
17792
17793 : see if strtoll exists
17794 set strtoll d_strtoll
17795 eval $inlibc
17796
17797 case "$d_longlong-$d_strtoll" in
17798 "$define-$define")
17799         $cat <<EOM
17800 Checking whether your strtoll() works okay...
17801 EOM
17802         $cat >try.c <<'EOCP'
17803 #include <errno.h>
17804 #ifdef __hpux
17805 #define strtoll __strtoll
17806 #endif
17807 #ifdef __EMX__
17808 #define strtoll _strtoll
17809 #endif
17810 #include <stdio.h>
17811 extern long long int strtoll(char *s, char **, int);
17812 static int bad = 0;
17813 int check(char *s, long long ell, int een) {
17814         long long gll;
17815         errno = 0;
17816         gll = strtoll(s, 0, 10);
17817         if (!((gll == ell) && (errno == een)))
17818                 bad++;
17819 }
17820 int main() {
17821         check(" 1",                                      1LL, 0);
17822         check(" 0",                                      0LL, 0);
17823         check("-1",                                     -1LL, 0);
17824         check("-9223372036854775808", -9223372036854775808LL, 0);
17825         check("-9223372036854775808", -9223372036854775808LL, 0);
17826         check(" 9223372036854775807",  9223372036854775807LL, 0);
17827         check("-9223372036854775808", -9223372036854775808LL, 0);
17828         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17829         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17830         if (!bad)
17831                 printf("ok\n");
17832 }
17833 EOCP
17834         set try
17835         if eval $compile; then
17836                 yyy=`$run ./try`
17837                 case "$yyy" in
17838                 ok) echo "Your strtoll() seems to be working okay." ;;
17839                 *) cat <<EOM >&4
17840 Your strtoll() doesn't seem to be working okay.
17841 EOM
17842                    d_strtoll="$undef"
17843                    ;;
17844                 esac
17845         else
17846                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17847                 d_strtoll="$undef"
17848         fi
17849         ;;
17850 esac
17851
17852 : see if strtoq exists
17853 set strtoq d_strtoq
17854 eval $inlibc
17855
17856 : see if strtoul exists
17857 set strtoul d_strtoul
17858 eval $inlibc
17859
17860 case "$d_strtoul" in
17861 "$define")
17862         $cat <<EOM
17863 Checking whether your strtoul() works okay...
17864 EOM
17865         $cat >try.c <<'EOCP'
17866 #include <errno.h>
17867 #include <stdio.h>
17868 extern unsigned long int strtoul(char *s, char **, int);
17869 static int bad = 0;
17870 void check(char *s, unsigned long eul, int een) {
17871         unsigned long gul;
17872         errno = 0;
17873         gul = strtoul(s, 0, 10);
17874         if (!((gul == eul) && (errno == een)))
17875                 bad++;
17876 }
17877 int main() {
17878         check(" 1", 1L, 0);
17879         check(" 0", 0L, 0);
17880 EOCP
17881         case "$longsize" in
17882         8)
17883             $cat >>try.c <<'EOCP'
17884         check("18446744073709551615", 18446744073709551615UL, 0);
17885         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17886 #if 0 /* strtoul() for /^-/ strings is undefined. */
17887         check("-1", 18446744073709551615UL, 0);
17888         check("-18446744073709551614", 2, 0);
17889         check("-18446744073709551615", 1, 0);
17890         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17891         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17892 #endif
17893 EOCP
17894                 ;;
17895         4)
17896                     $cat >>try.c <<'EOCP'
17897         check("4294967295", 4294967295UL, 0);
17898         check("4294967296", 4294967295UL, ERANGE);
17899 #if 0 /* strtoul() for /^-/ strings is undefined. */
17900         check("-1", 4294967295UL, 0);
17901         check("-4294967294", 2, 0);
17902         check("-4294967295", 1, 0);
17903         check("-4294967296", 4294967295UL, ERANGE);
17904         check("-4294967297", 4294967295UL, ERANGE);
17905 #endif
17906 EOCP
17907                 ;;
17908         *)
17909 : Should we write these tests to be more portable by sprintf-ing
17910 : ~0 and then manipulating that char string as input for strtol?
17911                 ;;
17912         esac
17913         $cat >>try.c <<'EOCP'
17914         if (!bad)
17915                 printf("ok\n");
17916         return 0;
17917 }
17918 EOCP
17919         set try
17920         if eval $compile; then
17921                 case "`$run ./try`" in
17922                 ok) echo "Your strtoul() seems to be working okay." ;;
17923                 *) cat <<EOM >&4
17924 Your strtoul() doesn't seem to be working okay.
17925 EOM
17926                    d_strtoul="$undef"
17927                    ;;
17928                 esac
17929         else
17930                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17931                 d_strtoul="$undef"
17932         fi
17933         ;;
17934 esac
17935
17936 : see if strtoull exists
17937 set strtoull d_strtoull
17938 eval $inlibc
17939
17940 case "$d_longlong-$d_strtoull" in
17941 "$define-$define")
17942         $cat <<EOM
17943 Checking whether your strtoull() works okay...
17944 EOM
17945         $cat >try.c <<'EOCP'
17946 #include <errno.h>
17947 #ifdef __hpux
17948 #define strtoull __strtoull
17949 #endif
17950 #include <stdio.h>
17951 extern unsigned long long int strtoull(char *s, char **, int);
17952 static int bad = 0;
17953 int check(char *s, long long eull, int een) {
17954         long long gull;
17955         errno = 0;
17956         gull = strtoull(s, 0, 10);
17957         if (!((gull == eull) && (errno == een)))
17958                 bad++;
17959 }
17960 int main() {
17961         check(" 1",                                        1LL, 0);
17962         check(" 0",                                        0LL, 0);
17963         check("18446744073709551615",  18446744073709551615ULL, 0);
17964         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17965 #if 0 /* strtoull() for /^-/ strings is undefined. */
17966         check("-1",                    18446744073709551615ULL, 0);
17967         check("-18446744073709551614",                     2LL, 0);
17968         check("-18446744073709551615",                     1LL, 0);
17969         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17970         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17971 #endif
17972         if (!bad)
17973                 printf("ok\n");
17974 }
17975 EOCP
17976         set try
17977         if eval $compile; then
17978                 case "`$run ./try`" in
17979                 ok) echo "Your strtoull() seems to be working okay." ;;
17980                 *) cat <<EOM >&4
17981 Your strtoull() doesn't seem to be working okay.
17982 EOM
17983                    d_strtoull="$undef"
17984                    ;;
17985                 esac
17986         else
17987                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17988                 d_strtoull="$undef"
17989         fi
17990         ;;
17991 esac
17992
17993 : see if strtouq exists
17994 set strtouq d_strtouq
17995 eval $inlibc
17996
17997 case "$d_strtouq" in
17998 "$define")
17999         $cat <<EOM
18000 Checking whether your strtouq() works okay...
18001 EOM
18002         $cat >try.c <<'EOCP'
18003 #include <errno.h>
18004 #include <stdio.h>
18005 extern unsigned long long int strtouq(char *s, char **, int);
18006 static int bad = 0;
18007 void check(char *s, unsigned long long eull, int een) {
18008         unsigned long long gull;
18009         errno = 0;
18010         gull = strtouq(s, 0, 10);
18011         if (!((gull == eull) && (errno == een)))
18012                 bad++;
18013 }
18014 int main() {
18015         check(" 1",                                        1LL, 0);
18016         check(" 0",                                        0LL, 0);
18017         check("18446744073709551615",  18446744073709551615ULL, 0);
18018         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18019 #if 0 /* strtouq() for /^-/ strings is undefined. */
18020         check("-1",                    18446744073709551615ULL, 0);
18021         check("-18446744073709551614",                     2LL, 0);
18022         check("-18446744073709551615",                     1LL, 0);
18023         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18024         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18025 #endif
18026         if (!bad)
18027                 printf("ok\n");
18028         return 0;
18029 }
18030 EOCP
18031         set try
18032         if eval $compile; then
18033                 case "`$run ./try`" in
18034                 ok) echo "Your strtouq() seems to be working okay." ;;
18035                 *) cat <<EOM >&4
18036 Your strtouq() doesn't seem to be working okay.
18037 EOM
18038                    d_strtouq="$undef"
18039                    ;;
18040                 esac
18041         else
18042                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18043                 d_strtouq="$undef"
18044         fi
18045         ;;
18046 esac
18047
18048 : see if strxfrm exists
18049 set strxfrm d_strxfrm
18050 eval $inlibc
18051
18052 : see if symlink exists
18053 set symlink d_symlink
18054 eval $inlibc
18055
18056 : see if syscall exists
18057 set syscall d_syscall
18058 eval $inlibc
18059
18060 : see if prototype for syscall is available
18061 echo " "
18062 set d_syscallproto syscall $i_unistd unistd.h
18063 eval $hasproto
18064
18065 : see if sysconf exists
18066 set sysconf d_sysconf
18067 eval $inlibc
18068
18069 : see if system exists
18070 set system d_system
18071 eval $inlibc
18072
18073 : see if tcgetpgrp exists
18074 set tcgetpgrp d_tcgetpgrp
18075 eval $inlibc
18076
18077 : see if tcsetpgrp exists
18078 set tcsetpgrp d_tcsetpgrp
18079 eval $inlibc
18080
18081 : see if prototype for telldir is available
18082 echo " "
18083 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18084 eval $hasproto
18085
18086 : see if time exists
18087 echo " "
18088 if test "X$d_time" = X -o X"$timetype" = X; then
18089     if set time val -f d_time; eval $csym; $val; then
18090                 echo 'time() found.' >&4
18091                 val="$define"
18092                 rp="What is the type returned by time() on this system?"
18093                 set time_t timetype long stdio.h sys/types.h
18094                 eval $typedef_ask
18095     else
18096                 echo 'time() not found, hope that will do.' >&4
18097                 val="$undef"
18098                 timetype='int';
18099     fi
18100     set d_time
18101     eval $setvar
18102 fi
18103
18104 : see if this is a sys/times.h system
18105 set sys/times.h i_systimes
18106 eval $inhdr
18107
18108 : see if times exists
18109 echo " "
18110 if set times val -f d_times; eval $csym; $val; then
18111         echo 'times() found.' >&4
18112         d_times="$define"
18113         inc=''
18114         case "$i_systimes" in
18115         "$define") inc='sys/times.h';;
18116         esac
18117         rp="What is the type returned by times() on this system?"
18118         set clock_t clocktype long stdio.h sys/types.h $inc
18119         eval $typedef_ask
18120 else
18121         echo 'times() NOT found, hope that will do.' >&4
18122         d_times="$undef"
18123         clocktype='int'
18124 fi
18125
18126 : see if tmpnam_r exists
18127 set tmpnam_r d_tmpnam_r
18128 eval $inlibc
18129 case "$d_tmpnam_r" in
18130 "$define")
18131         hdrs="$i_systypes sys/types.h define stdio.h "
18132         case "$d_tmpnam_r_proto:$usethreads" in
18133         ":define")      d_tmpnam_r_proto=define
18134                 set d_tmpnam_r_proto tmpnam_r $hdrs
18135                 eval $hasproto ;;
18136         *)      ;;
18137         esac
18138         case "$d_tmpnam_r_proto" in
18139         define)
18140         case "$tmpnam_r_proto" in
18141         ''|0) try='char* tmpnam_r(char*);'
18142         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
18143         esac
18144         case "$tmpnam_r_proto" in
18145         ''|0)   d_tmpnam_r=undef
18146                 tmpnam_r_proto=0
18147                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18148         * )     case "$tmpnam_r_proto" in
18149                 REENTRANT_PROTO*) ;;
18150                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18151                 esac
18152                 echo "Prototype: $try" ;;
18153         esac
18154         ;;
18155         *)      case "$usethreads" in
18156                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18157                 esac
18158                 d_tmpnam_r=undef
18159                 tmpnam_r_proto=0
18160                 ;;
18161         esac
18162         ;;
18163 *)      tmpnam_r_proto=0
18164         ;;
18165 esac
18166
18167 : see if truncate exists
18168 set truncate d_truncate
18169 eval $inlibc
18170
18171 : see if ttyname_r exists
18172 set ttyname_r d_ttyname_r
18173 eval $inlibc
18174 case "$d_ttyname_r" in
18175 "$define")
18176         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18177         case "$d_ttyname_r_proto:$usethreads" in
18178         ":define")      d_ttyname_r_proto=define
18179                 set d_ttyname_r_proto ttyname_r $hdrs
18180                 eval $hasproto ;;
18181         *)      ;;
18182         esac
18183         case "$d_ttyname_r_proto" in
18184         define)
18185         case "$ttyname_r_proto" in
18186         ''|0) try='int ttyname_r(int, char*, size_t);'
18187         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
18188         esac
18189         case "$ttyname_r_proto" in
18190         ''|0) try='int ttyname_r(int, char*, int);'
18191         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
18192         esac
18193         case "$ttyname_r_proto" in
18194         ''|0) try='char* ttyname_r(int, char*, int);'
18195         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
18196         esac
18197         case "$ttyname_r_proto" in
18198         ''|0)   d_ttyname_r=undef
18199                 ttyname_r_proto=0
18200                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18201         * )     case "$ttyname_r_proto" in
18202                 REENTRANT_PROTO*) ;;
18203                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18204                 esac
18205                 echo "Prototype: $try" ;;
18206         esac
18207         ;;
18208         *)      case "$usethreads" in
18209                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18210                 esac
18211                 d_ttyname_r=undef
18212                 ttyname_r_proto=0
18213                 ;;
18214         esac
18215         ;;
18216 *)      ttyname_r_proto=0
18217         ;;
18218 esac
18219
18220 : see if tzname[] exists
18221 echo " "
18222 if set tzname val -a d_tzname; eval $csym; $val; then
18223         val="$define"
18224         echo 'tzname[] found.' >&4
18225 else
18226         val="$undef"
18227         echo 'tzname[] NOT found.' >&4
18228 fi
18229 set d_tzname
18230 eval $setvar
18231
18232 : Check if is a multiplatform env
18233 case "$osname" in
18234 next|rhapsody|darwin) multiarch="$define" ;;
18235 esac
18236 case "$multiarch" in
18237 ''|[nN]*) multiarch="$undef" ;;
18238 esac
18239
18240 : check for ordering of bytes in a UV
18241 echo " "
18242 case "$usecrosscompile$multiarch" in
18243 *$define*)
18244         $cat <<EOM
18245 You seem to be either cross-compiling or doing a multiarchitecture build,
18246 skipping the byteorder check.
18247
18248 EOM
18249         byteorder='ffff'
18250         ;;
18251 *)
18252         case "$byteorder" in
18253         '')
18254                 $cat <<'EOM'
18255 In the following, larger digits indicate more significance.  A big-endian
18256 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18257 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18258 machines may have weird orders like 3412.  A Cray will report 87654321,
18259 an Alpha will report 12345678. If the test program works the default is
18260 probably right.
18261 I'm now running the test program...
18262 EOM
18263                 $cat >try.c <<EOCP
18264 #include <stdio.h>
18265 #$i_stdlib I_STDLIB
18266 #ifdef I_STDLIB
18267 #include <stdlib.h>
18268 #endif
18269 #include <sys/types.h>
18270 typedef $uvtype UV;
18271 int main()
18272 {
18273         int i;
18274         union {
18275                 UV l;
18276                 char c[$uvsize];
18277         } u;
18278
18279         if ($uvsize > 4)
18280                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18281         else
18282                 u.l = (UV)0x04030201;
18283         for (i = 0; i < $uvsize; i++)
18284                 printf("%c", u.c[i]+'0');
18285         printf("\n");
18286         exit(0);
18287 }
18288 EOCP
18289                 xxx_prompt=y
18290                 set try
18291                 if eval $compile && $run ./try > /dev/null; then
18292                         dflt=`$run ./try`
18293                         case "$dflt" in
18294                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18295                                 echo "(The test program ran ok.)"
18296                                 echo "byteorder=$dflt"
18297                                 xxx_prompt=n
18298                         ;;
18299                         ????|????????) echo "(The test program ran ok.)" ;;
18300                         *) echo "(The test program didn't run right for some reason.)" ;;
18301                         esac
18302                 else
18303                         dflt='4321'
18304                         cat <<'EOM'
18305 (I can't seem to compile the test program.  Guessing big-endian...)
18306 EOM
18307                 fi
18308                 case "$xxx_prompt" in
18309                 y)
18310                         rp="What is the order of bytes in $uvtype?"
18311                         . ./myread
18312                         byteorder="$ans"
18313                         ;;
18314                 *)      byteorder=$dflt
18315                         ;;
18316                 esac
18317                 ;;
18318         esac
18319         $rm_try
18320         ;;
18321 esac
18322
18323 : Checking 32bit aligndness
18324 $cat <<EOM
18325
18326 Checking to see whether you can access character data unalignedly...
18327 EOM
18328 case "$d_u32align" in
18329 '')   $cat >try.c <<EOCP
18330 #include <stdio.h>
18331 #$i_stdlib I_STDLIB
18332 #ifdef I_STDLIB
18333 #include <stdlib.h>
18334 #endif
18335 #define U32 $u32type
18336 #define BYTEORDER 0x$byteorder
18337 #define U8 $u8type
18338 #include <signal.h>
18339 #ifdef SIGBUS
18340 $signal_t bletch(int s) { exit(4); }
18341 #endif
18342 int main() {
18343 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18344     U8 buf[8];
18345     U32 *up;
18346     int i;
18347
18348     if (sizeof(U32) != 4) {
18349         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18350         exit(1);
18351     }
18352
18353     fflush(stdout);
18354
18355 #ifdef SIGBUS
18356     signal(SIGBUS, bletch);
18357 #endif
18358
18359     buf[0] = 0;
18360     buf[1] = 0;
18361     buf[2] = 0;
18362     buf[3] = 1;
18363     buf[4] = 0;
18364     buf[5] = 0;
18365     buf[6] = 0;
18366     buf[7] = 1;
18367
18368     for (i = 0; i < 4; i++) {
18369         up = (U32*)(buf + i);
18370         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18371                (*up == 1 << (8*(3-i)))  /* little-endian */
18372               )
18373            )
18374         {
18375             printf("read failed (%x)\n", *up);
18376             exit(2);
18377         }
18378     }
18379
18380     /* write test */
18381     for (i = 0; i < 4; i++) {
18382         up = (U32*)(buf + i);
18383         *up = 0xBeef;
18384         if (*up != 0xBeef) {
18385             printf("write failed (%x)\n", *up);
18386             exit(3);
18387         }
18388     }
18389
18390     exit(0);
18391 #else
18392     printf("1\n");
18393     exit(1);
18394 #endif
18395     return 0;
18396 }
18397 EOCP
18398 set try
18399 if eval $compile_ok; then
18400         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18401         $run ./try 2>&1 >/dev/null
18402         case "$?" in
18403         0)      cat >&4 <<EOM
18404 You can access character data pretty unalignedly.
18405 EOM
18406                 d_u32align="$undef"
18407                 ;;
18408         *)      cat >&4 <<EOM
18409 It seems that you must access character data in an aligned manner.
18410 EOM
18411                 d_u32align="$define"
18412                 ;;
18413         esac
18414 else
18415         rp='Can you access character data at unaligned addresses?'
18416         dflt='n'
18417         . ./myread
18418         case "$ans" in
18419         [yY]*)  d_u32align="$undef"  ;;
18420         *)      d_u32align="$define" ;;
18421         esac
18422 fi
18423 $rm_try
18424 ;;
18425 esac
18426
18427 : see if ualarm exists
18428 set ualarm d_ualarm
18429 eval $inlibc
18430
18431 : see if umask exists
18432 set umask d_umask
18433 eval $inlibc
18434
18435 : see if unordered exists
18436 set unordered d_unordered
18437 eval $inlibc
18438
18439 : see if unsetenv exists
18440 set unsetenv d_unsetenv
18441 eval $inlibc
18442
18443 : see if usleep exists
18444 set usleep d_usleep
18445 eval $inlibc
18446
18447 : see if prototype for usleep is available
18448 echo " "
18449 set d_usleepproto usleep $i_unistd unistd.h
18450 eval $hasproto
18451
18452 : see if ustat exists
18453 set ustat d_ustat
18454 eval $inlibc
18455
18456 : see if closedir exists
18457 set closedir d_closedir
18458 eval $inlibc
18459
18460 case "$d_closedir" in
18461 "$define")
18462         echo " "
18463         echo "Checking whether closedir() returns a status..." >&4
18464         cat > try.c <<EOM
18465 #$i_dirent I_DIRENT             /**/
18466 #$i_sysdir I_SYS_DIR            /**/
18467 #$i_sysndir I_SYS_NDIR          /**/
18468 #$i_systypes I_SYS_TYPES        /**/
18469
18470 #if defined(I_SYS_TYPES)
18471 #include <sys/types.h>
18472 #endif
18473 #if defined(I_DIRENT)
18474 #include <dirent.h>
18475 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18476 #include <sys/dir.h>
18477 #endif
18478 #else
18479 #ifdef I_SYS_NDIR
18480 #include <sys/ndir.h>
18481 #else
18482 #ifdef I_SYS_DIR
18483 #ifdef hp9000s500
18484 #include <ndir.h>       /* may be wrong in the future */
18485 #else
18486 #include <sys/dir.h>
18487 #endif
18488 #endif
18489 #endif
18490 #endif
18491 int main() { return closedir(opendir(".")); }
18492 EOM
18493         set try
18494         if eval $compile_ok; then
18495                 if $run ./try > /dev/null 2>&1 ; then
18496                         echo "Yes, it does."
18497                         val="$undef"
18498                 else
18499                         echo "No, it doesn't."
18500                         val="$define"
18501                 fi
18502         else
18503                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18504                 val="$define"
18505         fi
18506         ;;
18507 *)
18508         val="$undef";
18509         ;;
18510 esac
18511 set d_void_closedir
18512 eval $setvar
18513 $rm_try
18514
18515 : see if there is a wait4
18516 set wait4 d_wait4
18517 eval $inlibc
18518
18519 : see if waitpid exists
18520 set waitpid d_waitpid
18521 eval $inlibc
18522
18523 : see if wcstombs exists
18524 set wcstombs d_wcstombs
18525 eval $inlibc
18526
18527 : see if wctomb exists
18528 set wctomb d_wctomb
18529 eval $inlibc
18530
18531 : see if writev exists
18532 set writev d_writev
18533 eval $inlibc
18534
18535 : preserve RCS keywords in files with variable substitution, grrr
18536 Date='$Date'
18537 Id='$Id'
18538 Log='$Log'
18539 RCSfile='$RCSfile'
18540 Revision='$Revision'
18541
18542 : check for alignment requirements
18543 echo " "
18544 case "$usecrosscompile$multiarch" in
18545 *$define*)
18546         $cat <<EOM
18547 You seem to be either cross-compiling or doing a multiarchitecture build,
18548 skipping the memory alignment check.
18549
18550 EOM
18551         case "$alignbytes" in
18552         '') alignbytes=8 ;;
18553         esac
18554         ;;
18555 *)
18556         case "$alignbytes" in
18557         '') echo "Checking alignment constraints..." >&4
18558                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18559                         $cat >try.c <<'EOCP'
18560 typedef long double NV;
18561 EOCP
18562                 else
18563                         $cat >try.c <<'EOCP'
18564 typedef double NV;
18565 EOCP
18566                 fi
18567                 $cat >>try.c <<'EOCP'
18568 #include <stdio.h>
18569 struct foobar {
18570         char foo;
18571         NV bar;
18572 } try_algn;
18573 int main()
18574 {
18575     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18576     return(0);
18577 }
18578 EOCP
18579                 set try
18580                 if eval $compile_ok; then
18581                         dflt=`$run ./try`
18582                 else
18583                         dflt='8'
18584                         echo "(I can't seem to compile the test program...)"
18585                 fi
18586                 ;;
18587         *) dflt="$alignbytes"
18588                 ;;
18589         esac
18590         rp="Doubles must be aligned on a how-many-byte boundary?"
18591         . ./myread
18592         alignbytes="$ans"
18593         $rm_try
18594         ;;
18595 esac
18596
18597
18598 : set the base revision
18599 baserev=5.0
18600
18601 : how do we concatenate cpp tokens here?
18602 echo " "
18603 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18604 $cat >cpp_stuff.c <<'EOCP'
18605 #define RCAT(a,b)a/**/b
18606 #define ACAT(a,b)a ## b
18607 RCAT(Rei,ser)
18608 ACAT(Cir,cus)
18609 EOCP
18610 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18611 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18612         echo "Oh!  Smells like ANSI's been here." >&4
18613         echo "We can catify or stringify, separately or together!"
18614         cpp_stuff=42
18615 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18616         echo "Ah, yes!  The good old days!" >&4
18617         echo "However, in the good old days we don't know how to stringify and"
18618         echo "catify at the same time."
18619         cpp_stuff=1
18620 else
18621         $cat >&4 <<EOM
18622 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18623 You're going to have to edit the values of CAT[2-5] in config.h...
18624 EOM
18625         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18626 fi
18627 $rm -f cpp_stuff.*
18628
18629 : see if this is a db.h system
18630 set db.h i_db
18631 eval $inhdr
18632
18633 case "$i_db" in
18634 $define)
18635         : Check db version.
18636         echo " "
18637         echo "Checking Berkeley DB version ..." >&4
18638         $cat >try.c <<EOCP
18639 #$d_const HASCONST
18640 #ifndef HASCONST
18641 #define const
18642 #endif
18643 #include <sys/types.h>
18644 #include <stdio.h>
18645 #$i_stdlib I_STDLIB
18646 #ifdef I_STDLIB
18647 #include <stdlib.h>
18648 #endif
18649 #include <db.h>
18650 int main(int argc, char *argv[])
18651 {
18652 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18653     int Major, Minor, Patch ;
18654     unsigned long Version ;
18655     (void)db_version(&Major, &Minor, &Patch) ;
18656     if (argc == 2) {
18657         printf("%d %d %d %d %d %d\n",
18658                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18659                Major, Minor, Patch);
18660         exit(0);
18661     }
18662     printf("You have Berkeley DB Version 2 or greater.\n");
18663
18664     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18665                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18666     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18667                 Major, Minor, Patch) ;
18668
18669     /* check that db.h & libdb are compatible */
18670     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18671         printf("db.h and libdb are incompatible.\n") ;
18672         exit(3);
18673     }
18674
18675     printf("db.h and libdb are compatible.\n") ;
18676
18677     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18678                 + DB_VERSION_PATCH ;
18679
18680     /* needs to be >= 2.3.4 */
18681     if (Version < 2003004) {
18682     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18683         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18684         exit(2);
18685     }
18686
18687     exit(0);
18688 #else
18689 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18690     if (argc == 2) {
18691         printf("1 0 0\n");
18692         exit(0);
18693     }
18694     printf("You have Berkeley DB Version 1.\n");
18695     exit(0);    /* DB version < 2: the coast is clear. */
18696 #else
18697     exit(1);    /* <db.h> not Berkeley DB? */
18698 #endif
18699 #endif
18700 }
18701 EOCP
18702         set try
18703         if eval $compile_ok && $run ./try; then
18704                 echo 'Looks OK.' >&4
18705                 set `$run ./try 1`
18706                 db_version_major=$1
18707                 db_version_minor=$2
18708                 db_version_patch=$3
18709         else
18710                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18711                 i_db=$undef
18712                 case " $libs " in
18713                 *"-ldb "*)
18714                         : Remove db from list of libraries to use
18715                         echo "Removing unusable -ldb from library list" >&4
18716                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18717                         shift
18718                         libs="$*"
18719                         echo "libs = $libs" >&4
18720                         ;;
18721                 esac
18722         fi
18723         $rm_try
18724         ;;
18725 esac
18726
18727 case "$i_db" in
18728 define)
18729         : Check the return type needed for hash
18730         echo " "
18731         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18732         $cat >try.c <<EOCP
18733 #$d_const HASCONST
18734 #ifndef HASCONST
18735 #define const
18736 #endif
18737 #include <sys/types.h>
18738 #include <db.h>
18739
18740 #ifndef DB_VERSION_MAJOR
18741 u_int32_t hash_cb (ptr, size)
18742 const void *ptr;
18743 size_t size;
18744 {
18745 }
18746 HASHINFO info;
18747 int main()
18748 {
18749         info.hash = hash_cb;
18750 }
18751 #endif
18752 EOCP
18753         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18754                 if $contains warning try.out >>/dev/null 2>&1 ; then
18755                         db_hashtype='int'
18756                 else
18757                         db_hashtype='u_int32_t'
18758                 fi
18759         else
18760                 : XXX Maybe we should just give up here.
18761                 db_hashtype=u_int32_t
18762                 $cat try.out >&4
18763                 echo "Help:  I can't seem to compile the db test program." >&4
18764                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18765         fi
18766         $rm_try
18767         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18768         ;;
18769 *)      db_hashtype=u_int32_t
18770         ;;
18771 esac
18772 case "$i_db" in
18773 define)
18774         : Check the return type needed for prefix
18775         echo " "
18776         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18777         cat >try.c <<EOCP
18778 #$d_const HASCONST
18779 #ifndef HASCONST
18780 #define const
18781 #endif
18782 #include <sys/types.h>
18783 #include <db.h>
18784
18785 #ifndef DB_VERSION_MAJOR
18786 size_t prefix_cb (key1, key2)
18787 const DBT *key1;
18788 const DBT *key2;
18789 {
18790 }
18791 BTREEINFO info;
18792 int main()
18793 {
18794         info.prefix = prefix_cb;
18795 }
18796 #endif
18797 EOCP
18798         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18799                 if $contains warning try.out >>/dev/null 2>&1 ; then
18800                         db_prefixtype='int'
18801                 else
18802                         db_prefixtype='size_t'
18803                 fi
18804         else
18805                 db_prefixtype='size_t'
18806                 : XXX Maybe we should just give up here.
18807                 $cat try.out >&4
18808                 echo "Help:  I can't seem to compile the db test program." >&4
18809                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18810         fi
18811         $rm_try
18812         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18813         ;;
18814 *)      db_prefixtype='size_t'
18815         ;;
18816 esac
18817
18818 : How can we generate normalized random numbers ?
18819 echo " "
18820 echo "Looking for a random number function..." >&4
18821 case "$randfunc" in
18822 '')
18823         if set drand48 val -f; eval $csym; $val; then
18824                 dflt="drand48"
18825                 echo "Good, found drand48()." >&4
18826         elif set random val -f; eval $csym; $val; then
18827                 dflt="random"
18828                 echo "OK, found random()." >&4
18829         else
18830                 dflt="rand"
18831                 echo "Yick, looks like I have to use rand()." >&4
18832         fi
18833         echo " "
18834         ;;
18835 *)
18836         dflt="$randfunc"
18837         ;;
18838 esac
18839 cont=true
18840
18841 case "$ccflags" in
18842 *-Dmy_rand=*|*-Dmy_srand=*)
18843         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18844         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18845         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18846         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18847         ;;
18848 esac
18849
18850 while $test "$cont"; do
18851         rp="Use which function to generate random numbers?"
18852         . ./myread
18853         if $test "$ans" = "$dflt"; then
18854                 : null
18855         else
18856                 randbits=''
18857         fi
18858         randfunc="$ans"
18859         if set $ans val -f; eval $csym; $val; then
18860                 cont=''
18861         else
18862                 dflt=y
18863                 rp="I cannot find function $ans. Use that name anyway?"
18864                 . ./myread
18865                 dflt=rand
18866                 case "$ans" in
18867                         [yY]*) cont='';;
18868                 esac
18869         fi
18870         case "$cont" in
18871         '')
18872                 case "$randfunc" in
18873                 drand48)
18874                         drand01="drand48()"
18875                         seedfunc="srand48"
18876                         randbits=48
18877                         randseedtype=long
18878                         ;;
18879                 rand|random)
18880                         case "$randbits" in
18881                         '')
18882 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18883                                 $cat >try.c <<EOCP
18884 #$i_unistd I_UNISTD
18885 #$i_stdlib I_STDLIB
18886 #include <stdio.h>
18887 #ifdef I_UNISTD
18888 #  include <unistd.h>
18889 #endif
18890 #ifdef I_STDLIB
18891 #  include <stdlib.h>
18892 #endif
18893 int main()
18894 {
18895         register int i;
18896         register unsigned long tmp;
18897         register unsigned long max = 0L;
18898
18899         for (i = 1000; i; i--) {
18900                 tmp = (unsigned long) $randfunc();
18901                 if (tmp > max) max = tmp;
18902         }
18903         for (i = 0; max; i++)
18904                 max /= 2;
18905         printf("%d\n",i);
18906 }
18907 EOCP
18908                                 set try
18909                                 if eval $compile_ok; then
18910                                         dflt=`try`
18911                                 else
18912                                         dflt='?'
18913                                         echo "(I can't seem to compile the test program...)"
18914                                 fi
18915                                 ;;
18916                         *)
18917                                 dflt="$randbits"
18918                                 ;;
18919                         esac
18920                         rp="How many bits does your $randfunc() function produce?"
18921                         . ./myread
18922                         randbits="$ans"
18923                         $rm_try
18924                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18925                         seedfunc="s$randfunc"
18926                         randseedtype=unsigned
18927                         ;;
18928                 *)
18929                         dflt="31"
18930                         rp="How many bits does your $randfunc() function produce?"
18931                         . ./myread
18932                         randbits="$ans"
18933                         seedfunc="s$randfunc"
18934                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18935                         if set $seedfunc val -f; eval $csym; $val; then
18936                                 echo "(Using $seedfunc() to seed random generator)"
18937                         else
18938                                 echo "(Warning: no $seedfunc() to seed random generator)"
18939                                 seedfunc=rand
18940                         fi
18941                         randseedtype=unsigned
18942                         ;;
18943                 esac
18944                 ;;
18945         esac
18946 done
18947
18948 : Determine if this is an EBCDIC system
18949 echo " "
18950 echo "Determining whether or not we are on an EBCDIC system..." >&4
18951 $cat >try.c <<'EOM'
18952 int main()
18953 {
18954   if ('M'==0xd4) return 0;
18955   return 1;
18956 }
18957 EOM
18958
18959 val=$undef
18960 set try
18961 if eval $compile_ok; then
18962         if $run ./try; then
18963                 echo "You seem to speak EBCDIC." >&4
18964                 val="$define"
18965         else
18966                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18967         fi
18968 else
18969         echo "I'm unable to compile the test program." >&4
18970         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18971 fi
18972 $rm_try
18973 set ebcdic
18974 eval $setvar
18975
18976 : Check how to flush
18977 echo " "
18978 $cat >&4 <<EOM
18979 Checking how to flush all pending stdio output...
18980 EOM
18981 # I only know how to find the first 32 possibly open files on SunOS.
18982 # See also hints/sunos_4_1.sh and util.c  --AD
18983 case "$osname" in
18984 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18985 esac
18986 $cat >>try.c <<EOCP
18987 #include <stdio.h>
18988 #$i_stdlib I_STDLIB
18989 #ifdef I_STDLIB
18990 #include <stdlib.h>
18991 #endif
18992 #$i_unistd I_UNISTD
18993 #ifdef I_UNISTD
18994 # include <unistd.h>
18995 #endif
18996 #$d_sysconf HAS_SYSCONF
18997 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18998 #ifdef HAS_STDIO_STREAM_ARRAY
18999 # define STDIO_STREAM_ARRAY $stdio_stream_array
19000 #endif
19001 int main() {
19002   FILE* p;
19003   unlink("try.out");
19004   p = fopen("try.out", "w");
19005 #ifdef TRY_FPUTC
19006   fputc('x', p);
19007 #else
19008 # ifdef TRY_FPRINTF
19009   fprintf(p, "x");
19010 # endif
19011 #endif
19012 #ifdef TRY_FFLUSH_NULL
19013   fflush(NULL);
19014 #endif
19015 #ifdef TRY_FFLUSH_ALL
19016   {
19017     long open_max = -1;
19018 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19019     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19020 # else
19021 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19022     open_max = sysconf(_SC_OPEN_MAX);
19023 #  else
19024 #   ifdef FOPEN_MAX
19025     open_max = FOPEN_MAX;
19026 #   else
19027 #    ifdef OPEN_MAX
19028     open_max = OPEN_MAX;
19029 #    else
19030 #     ifdef _NFILE
19031     open_max = _NFILE;
19032 #     endif
19033 #    endif
19034 #   endif
19035 #  endif
19036 # endif
19037 # ifdef HAS_STDIO_STREAM_ARRAY
19038     if (open_max > 0) {
19039       long i;
19040       for (i = 0; i < open_max; i++)
19041             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19042                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19043                 STDIO_STREAM_ARRAY[i]._flag)
19044                 fflush(&STDIO_STREAM_ARRAY[i]);
19045     }
19046   }
19047 # endif
19048 #endif
19049   _exit(42);
19050 }
19051 EOCP
19052 : first we have to find out how _not_ to flush
19053 $to try.c
19054 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19055     output=''
19056     set try -DTRY_FPUTC
19057     if eval $compile; then
19058             $run ./try 2>/dev/null
19059             code="$?"
19060             $from try.out
19061             if $test ! -s try.out -a "X$code" = X42; then
19062                 output=-DTRY_FPUTC
19063             fi
19064     fi
19065     case "$output" in
19066     '')
19067             set try -DTRY_FPRINTF
19068             if eval $compile; then
19069                     $run ./try 2>/dev/null
19070                     code="$?"
19071                     $from try.out
19072                     if $test ! -s try.out -a "X$code" = X42; then
19073                         output=-DTRY_FPRINTF
19074                     fi
19075             fi
19076         ;;
19077     esac
19078 fi
19079 : check for fflush NULL behaviour
19080 case "$fflushNULL" in
19081 '')     set try -DTRY_FFLUSH_NULL $output
19082         if eval $compile; then
19083                 $run ./try 2>/dev/null
19084                 code="$?"
19085                 $from try.out
19086                 if $test -s try.out -a "X$code" = X42; then
19087                         fflushNULL="`$cat try.out`"
19088                 else
19089                         if $test "X$code" != X42; then
19090                                 $cat >&4 <<EOM
19091 (If this test failed, don't worry, we'll try another method shortly.)
19092 EOM
19093                         fi
19094                 fi
19095         fi
19096         $rm -f core try.core core.try.*
19097         case "$fflushNULL" in
19098         x)      $cat >&4 <<EOM
19099 Your fflush(NULL) works okay for output streams.
19100 Let's see if it clobbers input pipes...
19101 EOM
19102 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19103 # bug that improperly flushes the input end of pipes.  So we avoid the
19104 # autoflush on fork/system/exec support for now. :-(
19105 $cat >tryp.c <<EOCP
19106 #include <stdio.h>
19107 int
19108 main(int argc, char **argv)
19109 {
19110     char buf[1024];
19111     int i;
19112     char *bp = buf;
19113     while (1) {
19114         while ((i = getc(stdin)) != -1
19115                && (*bp++ = i) != '\n'
19116                && bp < &buf[1024])
19117         /* DO NOTHING */ ;
19118         *bp = '\0';
19119         fprintf(stdout, "%s", buf);
19120         fflush(NULL);
19121         if (i == -1)
19122             return 0;
19123         bp = buf;
19124     }
19125 }
19126 EOCP
19127                 fflushNULL="$define"
19128                 set tryp
19129                 if eval $compile; then
19130                     $rm -f tryp.out
19131                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19132                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19133                        $cat >&4 <<EOM
19134 fflush(NULL) seems to behave okay with input streams.
19135 EOM
19136                         fflushNULL="$define"
19137                     else
19138                         $cat >&4 <<EOM
19139 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19140 EOM
19141                         fflushNULL="$undef"
19142                     fi
19143                 fi
19144                 $rm -f core tryp.c tryp.core core.tryp.*
19145                 ;;
19146         '')     $cat >&4 <<EOM
19147 Your fflush(NULL) isn't working (contrary to ANSI C).
19148 EOM
19149                 fflushNULL="$undef"
19150                 ;;
19151         *)      $cat >&4 <<EOM
19152 Cannot figure out whether your fflush(NULL) works or not.
19153 I'm assuming it doesn't (contrary to ANSI C).
19154 EOM
19155                 fflushNULL="$undef"
19156                 ;;
19157         esac
19158         ;;
19159 $define|true|[yY]*)
19160         fflushNULL="$define"
19161         ;;
19162 *)
19163         fflushNULL="$undef"
19164         ;;
19165 esac
19166 : check explicit looping only if NULL did not work, and if the pipe
19167 : bug does not show up on an explicit flush too
19168 case "$fflushNULL" in
19169 "$undef")
19170         $cat >tryp.c <<EOCP
19171 #include <stdio.h>
19172 int
19173 main(int argc, char **argv)
19174 {
19175     char buf[1024];
19176     int i;
19177     char *bp = buf;
19178     while (1) {
19179         while ((i = getc(stdin)) != -1
19180                && (*bp++ = i) != '\n'
19181                && bp < &buf[1024])
19182         /* DO NOTHING */ ;
19183         *bp = '\0';
19184         fprintf(stdout, "%s", buf);
19185         fflush(stdin);
19186         if (i == -1)
19187             return 0;
19188         bp = buf;
19189     }
19190 }
19191 EOCP
19192         set tryp
19193         if eval $compile; then
19194             $rm -f tryp.out
19195             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19196             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19197                $cat >&4 <<EOM
19198 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19199 EOM
19200                 : now check for fflushall behaviour
19201                 case "$fflushall" in
19202                 '')     set try -DTRY_FFLUSH_ALL $output
19203                         if eval $compile; then
19204                                 $cat >&4 <<EOM
19205 (Now testing the other method--but note that this also may fail.)
19206 EOM
19207                                 $run ./try 2>/dev/null
19208                                 code=$?
19209                                 $from try.out
19210                                 if $test -s try.out -a "X$code" = X42; then
19211                                         fflushall="`$cat try.out`"
19212                                 fi
19213                         fi
19214                         $rm_try
19215                         case "$fflushall" in
19216                         x)      $cat >&4 <<EOM
19217 Whew. Flushing explicitly all the stdio streams works.
19218 EOM
19219                                 fflushall="$define"
19220                                 ;;
19221                         '')     $cat >&4 <<EOM
19222 Sigh. Flushing explicitly all the stdio streams doesn't work.
19223 EOM
19224                                 fflushall="$undef"
19225                                 ;;
19226                         *)      $cat >&4 <<EOM
19227 Cannot figure out whether flushing stdio streams explicitly works or not.
19228 I'm assuming it doesn't.
19229 EOM
19230                                 fflushall="$undef"
19231                                 ;;
19232                         esac
19233                         ;;
19234                 "$define"|true|[yY]*)
19235                         fflushall="$define"
19236                         ;;
19237                 *)
19238                         fflushall="$undef"
19239                         ;;
19240                 esac
19241             else
19242                 $cat >&4 <<EOM
19243 All is futile.  Even fflush(stdin) clobbers input pipes!
19244 EOM
19245                 fflushall="$undef"
19246             fi
19247         else
19248             fflushall="$undef"
19249         fi
19250         $rm -f core tryp.c tryp.core core.tryp.*
19251         ;;
19252 *)      fflushall="$undef"
19253         ;;
19254 esac
19255
19256 case "$fflushNULL$fflushall" in
19257 undefundef)
19258         $cat <<EOM
19259 OK, I give up.  I cannot figure out how to flush pending stdio output.
19260 We won't be flushing handles at all before fork/exec/popen.
19261 EOM
19262         ;;
19263 esac
19264 $rm_try tryp
19265
19266 : Store the full pathname to the ar program for use in the C program
19267 : Respect a hint or command line value for full_ar.
19268 case "$full_ar" in
19269 '') full_ar=$ar ;;
19270 esac
19271
19272 : Store the full pathname to the sed program for use in the C program
19273 full_sed=$sed
19274
19275 : see what type gids are declared as in the kernel
19276 echo " "
19277 echo "Looking for the type for group ids returned by getgid()."
19278 set gid_t gidtype xxx stdio.h sys/types.h
19279 eval $typedef
19280 case "$gidtype" in
19281 xxx)
19282         xxx=`./findhdr sys/user.h`
19283         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19284         case $1 in
19285         unsigned) dflt="$1 $2" ;;
19286         *) dflt="$1" ;;
19287         esac
19288         ;;
19289 *) dflt="$gidtype";;
19290 esac
19291 case "$gidtype" in
19292 gid_t) echo "gid_t found." ;;
19293 *)      rp="What is the type for group ids returned by getgid()?"
19294         . ./myread
19295         gidtype="$ans"
19296         ;;
19297 esac
19298
19299 : Check the size of GID
19300 echo " "
19301 case "$gidtype" in
19302 *_t) zzz="$gidtype"     ;;
19303 *)   zzz="gid"          ;;
19304 esac
19305 echo "Checking the size of $zzz..." >&4
19306 cat > try.c <<EOCP
19307 #include <sys/types.h>
19308 #include <stdio.h>
19309 #$i_stdlib I_STDLIB
19310 #ifdef I_STDLIB
19311 #include <stdlib.h>
19312 #endif
19313 int main() {
19314     printf("%d\n", (int)sizeof($gidtype));
19315     exit(0);
19316 }
19317 EOCP
19318 set try
19319 if eval $compile_ok; then
19320         yyy=`$run ./try`
19321         case "$yyy" in
19322         '')     gidsize=4
19323                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19324                 ;;
19325         *)      gidsize=$yyy
19326                 echo "Your $zzz is $gidsize bytes long."
19327                 ;;
19328         esac
19329 else
19330         gidsize=4
19331         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19332 fi
19333
19334
19335 : Check if GID is signed
19336 echo " "
19337 case "$gidtype" in
19338 *_t) zzz="$gidtype"     ;;
19339 *)   zzz="gid"          ;;
19340 esac
19341 echo "Checking the sign of $zzz..." >&4
19342 cat > try.c <<EOCP
19343 #include <sys/types.h>
19344 #include <stdio.h>
19345 int main() {
19346         $gidtype foo = -1;
19347         if (foo < 0)
19348                 printf("-1\n");
19349         else
19350                 printf("1\n");
19351 }
19352 EOCP
19353 set try
19354 if eval $compile; then
19355         yyy=`$run ./try`
19356         case "$yyy" in
19357         '')     gidsign=1
19358                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19359                 ;;
19360         *)      gidsign=$yyy
19361                 case "$gidsign" in
19362                  1) echo "Your $zzz is unsigned." ;;
19363                 -1) echo "Your $zzz is signed."   ;;
19364                 esac
19365                 ;;
19366         esac
19367 else
19368         gidsign=1
19369         echo "(I can't compile the test program--guessing unsigned.)" >&4
19370 fi
19371
19372
19373 : Check 64bit sizes
19374 echo " "
19375
19376 if $test X"$quadtype" != X; then
19377
19378 echo "Checking how to print 64-bit integers..." >&4
19379
19380 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19381         $cat >try.c <<'EOCP'
19382 #include <sys/types.h>
19383 #include <stdio.h>
19384 int main() {
19385   int q = 12345678901;
19386   printf("%ld\n", q);
19387 }
19388 EOCP
19389         set try
19390         if eval $compile; then
19391                 yyy=`$run ./try`
19392                 case "$yyy" in
19393                 12345678901)
19394                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19395                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19396                         echo "We will use %d."
19397                         ;;
19398                 esac
19399         fi
19400 fi
19401
19402 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19403         $cat >try.c <<'EOCP'
19404 #include <sys/types.h>
19405 #include <stdio.h>
19406 int main() {
19407   long q = 12345678901;
19408   printf("%ld\n", q);
19409 }
19410 EOCP
19411         set try
19412         if eval $compile; then
19413                 yyy=`$run ./try`
19414                 case "$yyy" in
19415                 12345678901)
19416                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19417                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19418                         echo "We will use %ld."
19419                         ;;
19420                 esac
19421         fi
19422 fi
19423
19424 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19425         $cat >try.c <<'EOCP'
19426 #include <sys/types.h>
19427 #include <inttypes.h>
19428 #include <stdio.h>
19429 int main() {
19430   int64_t q = 12345678901;
19431   printf("%" PRId64 "\n", q);
19432 }
19433 EOCP
19434         set try
19435         if eval $compile; then
19436                 yyy=`$run ./try`
19437                 case "$yyy" in
19438                 12345678901)
19439                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19440                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19441                         echo "We will use the C9X style."
19442                         ;;
19443                 esac
19444         fi
19445 fi
19446
19447 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19448         $cat >try.c <<EOCP
19449 #include <sys/types.h>
19450 #include <stdio.h>
19451 int main() {
19452   $quadtype q = 12345678901;
19453   printf("%Ld\n", q);
19454 }
19455 EOCP
19456         set try
19457         if eval $compile; then
19458                 yyy=`$run ./try`
19459                 case "$yyy" in
19460                 12345678901)
19461                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19462                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19463                         echo "We will use %Ld."
19464                         ;;
19465                 esac
19466         fi
19467 fi
19468
19469 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19470         $cat >try.c <<'EOCP'
19471 #include <sys/types.h>
19472 #include <stdio.h>
19473 int main() {
19474   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19475   printf("%lld\n", q);
19476 }
19477 EOCP
19478         set try
19479         if eval $compile; then
19480                 yyy=`$run ./try`
19481                 case "$yyy" in
19482                 12345678901)
19483                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19484                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19485                         echo "We will use the %lld style."
19486                         ;;
19487                 esac
19488         fi
19489 fi
19490
19491 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19492         $cat >try.c <<EOCP
19493 #include <sys/types.h>
19494 #include <stdio.h>
19495 int main() {
19496   $quadtype q = 12345678901;
19497   printf("%qd\n", q);
19498 }
19499 EOCP
19500         set try
19501         if eval $compile; then
19502                 yyy=`$run ./try`
19503                 case "$yyy" in
19504                 12345678901)
19505                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19506                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19507                         echo "We will use %qd."
19508                         ;;
19509                 esac
19510         fi
19511 fi
19512
19513 if $test X"$sPRId64" = X; then
19514         echo "Cannot figure out how to print 64-bit integers." >&4
19515 fi
19516 $rm_try
19517
19518 fi
19519
19520 case "$sPRId64" in
19521 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19522         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19523         ;;
19524 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19525         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19526         ;;
19527 esac
19528
19529 : Check format strings for internal types
19530 echo " "
19531 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19532
19533 if $test X"$ivsize" = X8; then
19534         ivdformat="$sPRId64"
19535         uvuformat="$sPRIu64"
19536         uvoformat="$sPRIo64"
19537         uvxformat="$sPRIx64"
19538         uvXUformat="$sPRIXU64"
19539 else
19540         if $test X"$ivsize" = X"$longsize"; then
19541                 ivdformat='"ld"'
19542                 uvuformat='"lu"'
19543                 uvoformat='"lo"'
19544                 uvxformat='"lx"'
19545                 uvXUformat='"lX"'
19546         else
19547                 if $test X"$ivsize" = X"$intsize"; then
19548                         ivdformat='"d"'
19549                         uvuformat='"u"'
19550                         uvoformat='"o"'
19551                         uvxformat='"x"'
19552                         uvXUformat='"X"'
19553                 else
19554                         : far out
19555                         if $test X"$ivsize" = X"$shortsize"; then
19556                                 ivdformat='"hd"'
19557                                 uvuformat='"hu"'
19558                                 uvoformat='"ho"'
19559                                 uvxformat='"hx"'
19560                                 uvXUformat='"hX"'
19561                         fi
19562                 fi
19563         fi
19564 fi
19565
19566 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19567         nveformat="$sPRIeldbl"
19568         nvfformat="$sPRIfldbl"
19569         nvgformat="$sPRIgldbl"
19570         nvEUformat="$sPRIEUldbl"
19571         nvFUformat="$sPRIFUldbl"
19572         nvGUformat="$sPRIGUldbl"
19573 else
19574         nveformat='"e"'
19575         nvfformat='"f"'
19576         nvgformat='"g"'
19577         nvEUformat='"E"'
19578         nvFUformat='"F"'
19579         nvGUformat='"G"'
19580 fi
19581
19582 case "$ivdformat" in
19583 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19584     exit 1
19585     ;;
19586 esac
19587
19588 : Check format string for GID
19589
19590 echo " "
19591 $echo "Checking the format string to be used for gids..." >&4
19592
19593 case "$gidsign" in
19594 -1)     if $test X"$gidsize" = X"$ivsize"; then
19595                 gidformat="$ivdformat"
19596         else
19597                 if $test X"$gidsize" = X"$longsize"; then
19598                         gidformat='"ld"'
19599                 else
19600                         if $test X"$gidsize" = X"$intsize"; then
19601                                 gidformat='"d"'
19602                         else
19603                                 if $test X"$gidsize" = X"$shortsize"; then
19604                                         gidformat='"hd"'
19605                                 fi
19606                         fi
19607                 fi
19608         fi
19609         ;;
19610 *)      if $test X"$gidsize" = X"$uvsize"; then
19611                 gidformat="$uvuformat"
19612         else
19613                 if $test X"$gidsize" = X"$longsize"; then
19614                         gidformat='"lu"'
19615                 else
19616                         if $test X"$gidsize" = X"$intsize"; then
19617                                 gidformat='"u"'
19618                         else
19619                                 if $test X"$gidsize" = X"$shortsize"; then
19620                                         gidformat='"hu"'
19621                                 fi
19622                         fi
19623                 fi
19624         fi
19625         ;;
19626 esac
19627
19628 : see if getgroups exists
19629 set getgroups d_getgrps
19630 eval $inlibc
19631
19632 : see if setgroups exists
19633 set setgroups d_setgrps
19634 eval $inlibc
19635
19636 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19637 echo " "
19638 case "$d_getgrps$d_setgrps" in
19639 *define*)
19640         case "$groupstype" in
19641         '') dflt="$gidtype" ;;
19642         *)  dflt="$groupstype" ;;
19643         esac
19644         $cat <<EOM
19645 What type of pointer is the second argument to getgroups() and setgroups()?
19646 Usually this is the same as group ids, $gidtype, but not always.
19647
19648 EOM
19649         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19650         . ./myread
19651         groupstype="$ans"
19652         ;;
19653 *)  groupstype="$gidtype";;
19654 esac
19655
19656 : MAD = Misc Attribute Definition
19657
19658 if $test $patchlevel -lt 9; then
19659 : MAD is not available in 5.8.x or earlier.
19660     ans=n;
19661 else
19662     case "$mad" in
19663     $define|true|[yY]*) dflt='y' ;;
19664     *)                  dflt='n' ;;
19665     esac
19666     cat <<EOM
19667
19668 Would you like to build with Misc Attribute Decoration? This is development
19669 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19670 overhead on the interpreter.
19671
19672 If this doesn't make any sense to you, just accept the default '$dflt'.
19673 EOM
19674     rp='Build Perl with MAD?'
19675     . ./myread
19676 fi
19677 case "$ans" in
19678 y|Y)    val="$define"
19679         madlyh='madly.h madly.act madly.tab'
19680         madlysrc='madly.c'
19681         madlyobj="madly$_o" ;;
19682 *)      val="$undef"
19683         madlyh=''
19684         madlysrc=''
19685         madlyobj='' ;;
19686 esac
19687 set mad
19688 eval $setvar
19689
19690 : check whether make sets MAKE
19691 echo " "
19692 echo "Checking if your $make program sets \$(MAKE)..." >&4
19693 case "$make_set_make" in
19694 '')
19695         $sed 's/^X //' > testmake.mak << 'EOF'
19696 Xall:
19697 X       @echo 'maketemp="$(MAKE)"'
19698 EOF
19699         case "`$make -f testmake.mak 2>/dev/null`" in
19700         *maketemp=*) make_set_make='#' ;;
19701         *)      make_set_make="MAKE=$make" ;;
19702         esac
19703         $rm -f testmake.mak
19704         ;;
19705 esac
19706 case "$make_set_make" in
19707 '#') echo "Yup, it does.";;
19708 *) echo "Nope, it doesn't.";;
19709 esac
19710
19711 : see what type is used for mode_t
19712 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19713 set mode_t modetype int stdio.h sys/types.h
19714 eval $typedef_ask
19715
19716 : see if we need va_copy
19717 echo " "
19718 case "$i_stdarg" in
19719 "$define")
19720         $cat >try.c <<EOCP
19721 #include <stdarg.h>
19722 #include <stdio.h>
19723 #$i_stdlib I_STDLIB
19724 #ifdef I_STDLIB
19725 #include <stdlib.h>
19726 #endif
19727 #include <signal.h>
19728
19729 int
19730 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19731 {
19732   return vfprintf(f, fmt, *valp);
19733 }
19734
19735 int
19736 myvfprintf(FILE *f, const  char *fmt, va_list val)
19737 {
19738   return ivfprintf(f, fmt, &val);
19739 }
19740
19741 int
19742 myprintf(char *fmt, ...)
19743 {
19744   va_list val;
19745   va_start(val, fmt);
19746   return myvfprintf(stdout, fmt, val);
19747 }
19748
19749 int
19750 main(int ac, char **av)
19751 {
19752   signal(SIGSEGV, exit);
19753
19754   myprintf("%s%cs all right, then\n", "that", '\'');
19755   exit(0);
19756 }
19757 EOCP
19758         set try
19759         if eval $compile && $run ./try 2>&1 >/dev/null; then
19760                 case "`$run ./try`" in
19761                 "that's all right, then")
19762                         okay=yes
19763                         ;;
19764                 esac
19765         fi
19766         case "$okay" in
19767         yes)    echo "It seems that you don't need va_copy()." >&4
19768                 need_va_copy="$undef"
19769                 ;;
19770         *)      echo "It seems that va_copy() or similar will be needed." >&4
19771                 need_va_copy="$define"
19772                 ;;
19773         esac
19774         $rm_try
19775         ;;
19776 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19777         ;;
19778 esac
19779
19780 : see what type is used for size_t
19781 rp="What is the type used for the length parameter for string functions?"
19782 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19783 eval $typedef_ask
19784
19785 : check for type of arguments to gethostbyaddr. 
19786 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19787         case "$d_gethbyaddr" in
19788         $define)
19789                 $cat <<EOM
19790
19791 Checking to see what type of arguments are accepted by gethostbyaddr().
19792 EOM
19793                 hdrs="$define sys/types.h
19794                         $d_socket sys/socket.h 
19795                         $i_niin netinet/in.h 
19796                         $i_netdb netdb.h
19797                         $i_unistd unistd.h"
19798                 : The first arg can 'char *' or 'void *'
19799                 : The second arg is some of integral type
19800                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19801                         for yyy in size_t long int; do
19802                                 case "$netdb_host_type" in
19803                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19804                                         if ./protochk "$try" $hdrs; then
19805                                                 echo "Your system accepts $xxx for the first arg."
19806                                                 echo "...and $yyy for the second arg."
19807                                                 netdb_host_type="$xxx"
19808                                                 netdb_hlen_type="$yyy"
19809                                         fi
19810                                         ;;
19811                                 esac
19812                         done
19813                 done
19814                 : In case none of those worked, prompt the user.
19815                 case "$netdb_host_type" in
19816                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19817                         dflt='char *'
19818                         . ./myread
19819                         netdb_host_type=$ans
19820                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19821                         dflt="$sizetype"
19822                         . ./myread
19823                         netdb_hlen_type=$ans
19824                         ;;
19825                 esac
19826                 ;;
19827         *)      : no gethostbyaddr, so pick harmless defaults
19828                 netdb_host_type='char *'
19829                 netdb_hlen_type="$sizetype"
19830                 ;;
19831         esac
19832         # Remove the "const" if needed. -- but then we'll have a 
19833         # prototype clash!
19834         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19835 fi
19836
19837 : check for type of argument to gethostbyname. 
19838 if test "X$netdb_name_type" = X ; then
19839         case "$d_gethbyname" in
19840         $define)
19841                 $cat <<EOM
19842
19843 Checking to see what type of argument is accepted by gethostbyname().
19844 EOM
19845                 hdrs="$define sys/types.h
19846                         $d_socket sys/socket.h 
19847                         $i_niin netinet/in.h 
19848                         $i_netdb netdb.h
19849                         $i_unistd unistd.h"
19850                 for xxx in "const char *" "char *"; do
19851                         case "$netdb_name_type" in
19852                         '')     try="extern struct hostent *gethostbyname($xxx);"
19853                                 if ./protochk "$try" $hdrs; then
19854                                         echo "Your system accepts $xxx."
19855                                         netdb_name_type="$xxx"
19856                                 fi
19857                                 ;;
19858                         esac
19859                 done
19860                 : In case none of those worked, prompt the user.
19861                 case "$netdb_name_type" in
19862                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19863                         dflt='char *'
19864                         . ./myread
19865                         netdb_name_type=$ans
19866                         ;;
19867                 esac
19868                 ;;
19869         *)      : no gethostbyname, so pick harmless default
19870                 netdb_name_type='char *'
19871                 ;;
19872         esac
19873 fi
19874
19875 : check for type of 1st argument to getnetbyaddr. 
19876 if test "X$netdb_net_type" = X ; then
19877         case "$d_getnbyaddr" in
19878         $define)
19879                 $cat <<EOM
19880
19881 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19882 EOM
19883                 hdrs="$define sys/types.h
19884                         $d_socket sys/socket.h 
19885                         $i_niin netinet/in.h 
19886                         $i_netdb netdb.h
19887                         $i_unistd unistd.h"
19888                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19889                         case "$netdb_net_type" in
19890                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19891                                 if ./protochk "$try" $hdrs; then
19892                                         echo "Your system accepts $xxx."
19893                                         netdb_net_type="$xxx"
19894                                 fi
19895                                 ;;
19896                         esac
19897                 done
19898                 : In case none of those worked, prompt the user.
19899                 case "$netdb_net_type" in
19900                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19901                         dflt='long'
19902                         . ./myread
19903                         netdb_net_type=$ans
19904                         ;;
19905                 esac
19906                 ;;
19907         *)      : no getnetbyaddr, so pick harmless default
19908                 netdb_net_type='long'
19909                 ;;
19910         esac
19911 fi
19912 : locate the preferred pager for this system
19913 fn=f/
19914 case "$pager" in
19915 '')
19916         dflt=''
19917         case "$pg" in
19918         /*) dflt=$pg;;
19919         [a-zA-Z]:/*) dflt=$pg;;
19920         esac
19921         case "$more" in
19922         /*) dflt=$more;;
19923         [a-zA-Z]:/*) dflt=$more;;
19924         esac
19925         case "$less" in
19926         /*) dflt=$less;;
19927         [a-zA-Z]:/*) dflt=$less;;
19928         esac
19929         case "$dflt" in
19930         '') dflt=/usr/ucb/more;;
19931         esac
19932         ;;
19933 *)      dflt="$pager"
19934         : Instruct ./getfile to trust the hinted or previous pager value,
19935         : even if it does not begin with a slash.  For example, on os2,
19936         : pager might be cmd /c more.  See comments in UU/getfile.
19937         fn="f/($pager)"
19938         ;;
19939 esac
19940 echo " "
19941 rp='What pager is used on your system?'
19942 . ./getfile
19943 pager="$ans"
19944
19945 : see what type pids are declared as in the kernel
19946 rp="What is the type of process ids on this system?"
19947 set pid_t pidtype int stdio.h sys/types.h
19948 eval $typedef_ask
19949
19950 : see if ar generates random libraries by itself
19951 echo " "
19952 echo "Checking how to generate random libraries on your machine..." >&4
19953 echo 'int bar1() { return bar2(); }' > bar1.c
19954 echo 'int bar2() { return 2; }' > bar2.c
19955 $cat > foo.c <<EOP
19956 #$i_stdlib I_STDLIB
19957 #ifdef I_STDLIB
19958 #include <stdlib.h>
19959 #endif
19960 int main() { printf("%d\n", bar1()); exit(0); }
19961 EOP
19962 $cc $ccflags -c bar1.c >/dev/null 2>&1
19963 $cc $ccflags -c bar2.c >/dev/null 2>&1
19964 $cc $ccflags -c foo.c >/dev/null 2>&1
19965 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19966 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19967         $run ./foobar >/dev/null 2>&1; then
19968         echo "$ar appears to generate random libraries itself."
19969         orderlib=false
19970         if [ "X$ranlib" = "X" ]; then
19971             ranlib=":"
19972         fi
19973 elif $ar s bar$_a >/dev/null 2>&1 &&
19974         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19975         $run ./foobar >/dev/null 2>&1; then
19976                 echo "a table of contents needs to be added with '$ar s'."
19977                 orderlib=false
19978                 ranlib="$ar s"
19979 elif $ar ts bar$_a >/dev/null 2>&1 &&
19980         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19981         $run ./foobar >/dev/null 2>&1; then
19982                 echo "a table of contents needs to be added with '$ar ts'."
19983                 orderlib=false
19984                 ranlib="$ar ts"
19985 else
19986         case "$ranlib" in
19987         :) ranlib='';;
19988         '')
19989                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19990                 $test -f $ranlib || ranlib=''
19991                 ;;
19992         esac
19993         if $test -n "$ranlib"; then
19994                 echo "your system has '$ranlib'; we'll use that."
19995                 orderlib=false
19996         else
19997                 echo "your system doesn't seem to support random libraries"
19998                 echo "so we'll use lorder and tsort to order the libraries."
19999                 orderlib=true
20000                 ranlib=":"
20001         fi
20002 fi
20003 $rm -f foo* bar*
20004
20005 : check for type of arguments to select.
20006 case "$selecttype" in
20007 '') case "$d_select" in
20008         $define)
20009                 echo " "
20010                 $cat <<EOM
20011 Checking to see what type of arguments are accepted by select().
20012 EOM
20013                 hdrs="$define sys/types.h
20014                         $i_systime sys/time.h
20015                         $i_sysselct sys/select.h
20016                         $d_socket sys/socket.h"
20017                 : The first arg can be int, unsigned, or size_t
20018                 : The last arg may or may not be 'const'
20019                 val=''
20020                 : void pointer has been seen but using that
20021                 : breaks the selectminbits test
20022                 for xxx in 'fd_set *' 'int *'; do
20023                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20024                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20025                                         case "$val" in
20026                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20027                                                 if ./protochk "$try" $hdrs; then
20028                                                         echo "Your system accepts $xxx."
20029                                                         val="$xxx"
20030                                                 fi
20031                                                 ;;
20032                                         esac
20033                                 done
20034                         done
20035                 done
20036                 case "$val" in
20037                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20038                         case "$d_fd_set" in
20039                                 $define) dflt="fd_set *" ;;
20040                                 *)              dflt="int *" ;;
20041                         esac
20042                         . ./myread
20043                         val=$ans
20044                         ;;
20045                 esac
20046                 selecttype="$val"
20047                 ;;
20048         *)      : no select, so pick a harmless default
20049                 selecttype='int *'
20050                 ;;
20051         esac
20052         ;;
20053 esac
20054
20055 : check for the select 'width'
20056 case "$selectminbits" in
20057 '') safebits=`expr $ptrsize \* 8`
20058     case "$d_select" in
20059         $define)
20060                 $cat <<EOM
20061
20062 Checking to see on how many bits at a time your select() operates...
20063 EOM
20064                 $cat >try.c <<EOCP
20065 #include <sys/types.h>
20066 #$i_time I_TIME
20067 #$i_systime I_SYS_TIME
20068 #$i_systimek I_SYS_TIME_KERNEL
20069 #ifdef I_TIME
20070 #   include <time.h>
20071 #endif
20072 #ifdef I_SYS_TIME
20073 #   ifdef I_SYS_TIME_KERNEL
20074 #       define KERNEL
20075 #   endif
20076 #   include <sys/time.h>
20077 #   ifdef I_SYS_TIME_KERNEL
20078 #       undef KERNEL
20079 #   endif
20080 #endif
20081 #$i_sysselct I_SYS_SELECT
20082 #ifdef I_SYS_SELECT
20083 #include <sys/select.h>
20084 #endif
20085 #$d_socket HAS_SOCKET
20086 #ifdef HAS_SOCKET
20087 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20088 #endif
20089 #include <stdio.h>
20090 #$i_stdlib I_STDLIB
20091 #ifdef I_STDLIB
20092 #include <stdlib.h>
20093 #endif
20094 $selecttype b;
20095 #define S sizeof(*(b))
20096 #define MINBITS 64
20097 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20098 #define NBITS  (NBYTES * 8)
20099 int main() {
20100     char *s = (char *)malloc(NBYTES);
20101     struct timeval t;
20102     int i;
20103     FILE* fp;
20104     int fd;
20105
20106     if (!s)
20107         exit(1);
20108     fclose(stdin);
20109     fp = fopen("try.c", "r");
20110     if (fp == 0)
20111       exit(2);
20112     fd = fileno(fp);
20113     if (fd < 0)
20114       exit(3);
20115     b = ($selecttype)s;
20116     for (i = 0; i < NBITS; i++)
20117         FD_SET(i, b);
20118     t.tv_sec  = 0;
20119     t.tv_usec = 0;
20120     select(fd + 1, b, 0, 0, &t);
20121     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20122     free(s);
20123     printf("%d\n", i + 1);
20124     return 0;
20125 }
20126 EOCP
20127                 set try
20128                 if eval $compile_ok; then
20129                         selectminbits=`$run ./try`
20130                         case "$selectminbits" in
20131                         '')     cat >&4 <<EOM
20132 Cannot figure out on how many bits at a time your select() operates.
20133 I'll play safe and guess it is $safebits bits.
20134 EOM
20135                                 selectminbits=$safebits
20136                                 bits="$safebits bits"
20137                                 ;;
20138                         1)      bits="1 bit" ;;
20139                         *)      bits="$selectminbits bits" ;;
20140                         esac
20141                         echo "Your select() operates on $bits at a time." >&4
20142                 else
20143                         rp='What is the minimum number of bits your select() operates on?'
20144                         case "$byteorder" in
20145                         12345678)       dflt=64 ;;
20146                         1234)           dflt=32 ;;
20147                         *)              dflt=1  ;;
20148                         esac
20149                         . ./myread
20150                         val=$ans
20151                         selectminbits="$val"
20152                 fi
20153                 $rm_try
20154                 ;;
20155         *)      : no select, so pick a harmless default
20156                 selectminbits=$safebits
20157                 ;;
20158         esac
20159         ;;
20160 esac
20161
20162 : Trace out the files included by signal.h, then look for SIGxxx names.
20163 if [ "X$fieldn" = X ]; then
20164         : Just make some guesses.  We check them later.
20165         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20166 else
20167         xxx=`echo '#include <signal.h>' |
20168         $cppstdin $cppminus $cppflags 2>/dev/null |
20169         $grep '^[       ]*#.*include' |
20170         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20171                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20172 fi
20173 xxxfiles=''
20174 for xx in $xxx /dev/null ; do
20175         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20176 done
20177 case "$xxxfiles" in
20178 '')     xxxfiles=`./findhdr signal.h` ;;
20179 esac
20180 xxx=`awk '
20181 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20182         print substr($2, 4, 20)
20183 }
20184 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20185         print substr($3, 4, 20)
20186 }' $xxxfiles`
20187 : Append some common names just in case the awk scan failed.
20188 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20189 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20190 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20191 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20192 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20193
20194 : generate a few handy files for later
20195 $cat > signal.c <<EOCP
20196 #include <sys/types.h>
20197 #include <signal.h>
20198 #$i_stdlib I_STDLIB
20199 #ifdef I_STDLIB
20200 #include <stdlib.h>
20201 #endif
20202 #include <stdio.h>
20203 int main() {
20204
20205 /* Strange style to avoid deeply-nested #if/#else/#endif */
20206 #ifndef NSIG
20207 #  ifdef _NSIG
20208 #    define NSIG (_NSIG)
20209 #  endif
20210 #endif
20211
20212 #ifndef NSIG
20213 #  ifdef SIGMAX
20214 #    define NSIG (SIGMAX+1)
20215 #  endif
20216 #endif
20217
20218 #ifndef NSIG
20219 #  ifdef SIG_MAX
20220 #    define NSIG (SIG_MAX+1)
20221 #  endif
20222 #endif
20223
20224 #ifndef NSIG
20225 #  ifdef _SIG_MAX
20226 #    define NSIG (_SIG_MAX+1)
20227 #  endif
20228 #endif
20229
20230 #ifndef NSIG
20231 #  ifdef MAXSIG
20232 #    define NSIG (MAXSIG+1)
20233 #  endif
20234 #endif
20235
20236 #ifndef NSIG
20237 #  ifdef MAX_SIG
20238 #    define NSIG (MAX_SIG+1)
20239 #  endif
20240 #endif
20241
20242 #ifndef NSIG
20243 #  ifdef SIGARRAYSIZE
20244 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20245 #  endif
20246 #endif
20247
20248 #ifndef NSIG
20249 #  ifdef _sys_nsig
20250 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20251 #  endif
20252 #endif
20253
20254 /* Default to some arbitrary number that's big enough to get most
20255    of the common signals.
20256 */
20257 #ifndef NSIG
20258 #    define NSIG 50
20259 #endif
20260
20261 printf("NSIG %d\n", NSIG);
20262
20263 #ifndef JUST_NSIG
20264
20265 EOCP
20266
20267 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20268 {
20269         printf "#ifdef SIG"; printf $1; printf "\n"
20270         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20271         printf $1; printf ");\n"
20272         printf "#endif\n"
20273 }
20274 END {
20275         printf "#endif /* JUST_NSIG */\n";
20276         printf "exit(0);\n}\n";
20277 }
20278 ' >>signal.c
20279 $cat >signal.awk <<'EOP'
20280 BEGIN { ndups = 0 }
20281 $1 ~ /^NSIG$/ { nsig = $2 }
20282 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20283     if ($2 > maxsig) { maxsig = $2 }
20284     if (sig_name[$2]) {
20285         dup_name[ndups] = $1
20286         dup_num[ndups] = $2
20287         ndups++
20288     }
20289     else {
20290         sig_name[$2] = $1
20291         sig_num[$2] = $2
20292     }
20293 }
20294 END {
20295     if (nsig == 0) {
20296         nsig = maxsig + 1
20297     }
20298     printf("NSIG %d\n", nsig);
20299     for (n = 1; n < nsig; n++) {
20300         if (sig_name[n]) {
20301             printf("%s %d\n", sig_name[n], sig_num[n])
20302         }
20303         else {
20304             printf("NUM%d %d\n", n, n)
20305         }
20306     }
20307     for (n = 0; n < ndups; n++) {
20308         printf("%s %d\n", dup_name[n], dup_num[n])
20309     }
20310 }
20311 EOP
20312 $cat >signal_cmd <<EOS
20313 $startsh
20314 if $test -s signal.lst; then
20315     echo "Using your existing signal.lst file"
20316         exit 0
20317 fi
20318 xxx="$xxx"
20319 EOS
20320 $cat >>signal_cmd <<'EOS'
20321
20322 set signal
20323 if eval $compile_ok; then
20324         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20325                 $uniq | $awk -f signal.awk >signal.lst
20326 else
20327         echo "(I can't seem be able to compile the whole test program)" >&4
20328         echo "(I'll try it in little pieces.)" >&4
20329         set signal -DJUST_NSIG
20330         if eval $compile_ok; then
20331                 $run ./signal$_exe > signal.nsg
20332                 $cat signal.nsg
20333         else
20334                 echo "I can't seem to figure out how many signals you have." >&4
20335                 echo "Guessing 50." >&4
20336                 echo 'NSIG 50' > signal.nsg
20337         fi
20338         : Now look at all the signal names, one at a time.
20339         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20340                 $cat > signal.c <<EOCP
20341 #include <sys/types.h>
20342 #include <signal.h>
20343 #include <stdio.h>
20344 int main() {
20345 printf("$xx %d\n", SIG${xx});
20346 return 0;
20347 }
20348 EOCP
20349                 set signal
20350                 if eval $compile; then
20351                         echo "SIG${xx} found."
20352                         $run ./signal$_exe  >> signal.ls1
20353                 else
20354                         echo "SIG${xx} NOT found."
20355                 fi
20356         done
20357         if $test -s signal.ls1; then
20358                 $cat signal.nsg signal.ls1 |
20359                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20360         fi
20361
20362 fi
20363 if $test -s signal.lst; then
20364         :
20365 else
20366         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20367         echo 'kill -l' >signal
20368         set X `csh -f <signal`
20369         $rm -f signal
20370         shift
20371         case $# in
20372         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20373         esac
20374         echo $@ | $tr ' ' $trnl | \
20375             $awk '{ printf "%s %d\n", $1, ++s; }
20376                   END { printf "NSIG %d\n", ++s }' >signal.lst
20377 fi
20378 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20379 EOS
20380 chmod a+x signal_cmd
20381 $eunicefix signal_cmd
20382
20383 : generate list of signal names
20384 echo " "
20385 case "$sig_name_init" in
20386 '') doinit=yes ;;
20387 *)  case "$sig_num_init" in
20388     ''|*,*) doinit=yes ;;
20389     esac ;;
20390 esac
20391 case "$doinit" in
20392 yes)
20393         echo "Generating a list of signal names and numbers..." >&4
20394         . ./signal_cmd
20395         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20396         sig_name=`$awk 'BEGIN { printf "ZERO " }
20397                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20398         sig_num=`$awk  'BEGIN { printf "0 " }
20399                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20400         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20401                              !/^NSIG/   { printf "\"%s\", ", $1 }
20402                              END        { printf "0\n" }' signal.lst`
20403         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20404                              !/^NSIG/   { printf "%d, ", $2}
20405                              END        { printf "0\n"}' signal.lst`
20406         ;;
20407 esac
20408 echo "The following $sig_count signals are available:"
20409 echo " "
20410 echo $sig_name | $awk \
20411 'BEGIN { linelen = 0 }
20412 {
20413         for (i = 1; i <= NF; i++) {
20414                 name = "SIG" $i " "
20415                 linelen = linelen + length(name)
20416                 if (linelen > 70) {
20417                         printf "\n"
20418                         linelen = length(name)
20419                 }
20420                 printf "%s", name
20421         }
20422         printf "\n"
20423 }'
20424 sig_size=`echo $sig_name | awk '{print NF}'`
20425 $rm -f signal signal.c signal.awk signal.lst signal_cmd
20426
20427 : Check size of size
20428 echo " "
20429 case "$sizetype" in
20430 *_t) zzz="$sizetype"    ;;
20431 *)   zzz="filesize"     ;;
20432 esac
20433 echo "Checking the size of $zzz..." >&4
20434 cat > try.c <<EOCP
20435 #include <sys/types.h>
20436 #include <stdio.h>
20437 #$i_stdlib I_STDLIB
20438 #ifdef I_STDLIB
20439 #include <stdlib.h>
20440 #endif
20441 int main() {
20442     printf("%d\n", (int)sizeof($sizetype));
20443     exit(0);
20444 }
20445 EOCP
20446 set try
20447 if eval $compile_ok; then
20448         yyy=`$run ./try`
20449         case "$yyy" in
20450         '')     sizesize=4
20451                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20452                 ;;
20453         *)      sizesize=$yyy
20454                 echo "Your $zzz size is $sizesize bytes."
20455                 ;;
20456         esac
20457 else
20458         sizesize=4
20459         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20460 fi
20461
20462
20463 : check for socklen_t
20464 echo " "
20465 echo "Checking to see if you have socklen_t..." >&4
20466 $cat >try.c <<EOCP
20467 #include <sys/types.h>
20468 #$d_socket HAS_SOCKET
20469 #ifdef HAS_SOCKET
20470 #include <sys/socket.h>
20471 #endif
20472 int main() { socklen_t x = 16; }
20473 EOCP
20474 set try
20475 if eval $compile; then
20476         val="$define"
20477         echo "You have socklen_t."
20478 else
20479         val="$undef"
20480         echo "You do not have socklen_t."
20481         case "$sizetype" in
20482         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20483         esac
20484 fi
20485 $rm_try
20486 set d_socklen_t
20487 eval $setvar
20488
20489 : see if this is a socks.h system
20490 set socks.h i_socks
20491 eval $inhdr
20492
20493 : check for type of the size argument to socket calls
20494 case "$d_socket" in
20495 "$define")
20496         $cat <<EOM
20497
20498 Checking to see what type is the last argument of accept().
20499 EOM
20500         yyy=''
20501         case "$d_socklen_t" in
20502         "$define") yyy="$yyy socklen_t"
20503         esac
20504         yyy="$yyy $sizetype int long unsigned"
20505         for xxx in $yyy; do
20506                 case "$socksizetype" in
20507                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
20508                         case "$usesocks" in
20509                         "$define")
20510                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20511                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20512                                         socksizetype="$xxx"
20513                                 fi
20514                                 ;;
20515                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20516                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20517                                         socksizetype="$xxx"
20518                                 fi
20519                                 ;;
20520                         esac
20521                         ;;
20522                 esac
20523         done
20524 : In case none of those worked, prompt the user.
20525         case "$socksizetype" in
20526         '')     rp='What is the type for socket address structure sizes?'
20527                 dflt='int'
20528                 . ./myread
20529                 socksizetype=$ans
20530                 ;;
20531         esac
20532         ;;
20533 *)      : no sockets, so pick relatively harmless default
20534         socksizetype='int'
20535         ;;
20536 esac
20537
20538 : see what type is used for signed size_t
20539 set ssize_t ssizetype int stdio.h sys/types.h
20540 eval $typedef
20541 dflt="$ssizetype"
20542 $cat > try.c <<EOM
20543 #include <stdio.h>
20544 #$i_stdlib I_STDLIB
20545 #ifdef I_STDLIB
20546 #include <stdlib.h>
20547 #endif
20548 #include <sys/types.h>
20549 #define Size_t $sizetype
20550 #define SSize_t $dflt
20551 int main()
20552 {
20553         if (sizeof(Size_t) == sizeof(SSize_t))
20554                 printf("$dflt\n");
20555         else if (sizeof(Size_t) == sizeof(int))
20556                 printf("int\n");
20557         else
20558                 printf("long\n");
20559         exit(0);
20560 }
20561 EOM
20562 echo " "
20563 set try
20564 if eval $compile_ok && $run ./try > /dev/null; then
20565         ssizetype=`$run ./try`
20566         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20567 else
20568         $cat >&4 <<EOM
20569 Help! I can't compile and run the ssize_t test program: please enlighten me!
20570 (This is probably a misconfiguration in your system or libraries, and
20571 you really ought to fix it.  Still, I'll try anyway.)
20572
20573 I need a type that is the same size as $sizetype, but is guaranteed to
20574 be signed.  Common values are ssize_t, int and long.
20575
20576 EOM
20577         rp="What signed type is the same size as $sizetype?"
20578         . ./myread
20579         ssizetype="$ans"
20580 fi
20581 $rm_try
20582
20583 : see what type of char stdio uses.
20584 echo " "
20585 echo '#include <stdio.h>' > stdio.c
20586 $cppstdin $cppminus < stdio.c > stdioh
20587 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20588         echo "Your stdio uses unsigned chars." >&4
20589         stdchar="unsigned char"
20590 else
20591         echo "Your stdio uses signed chars." >&4
20592         stdchar="char"
20593 fi
20594 $rm -f stdio.* stdioh
20595
20596 : see what type uids are declared as in the kernel
20597 echo " "
20598 echo "Looking for the type for user ids returned by getuid()."
20599 set uid_t uidtype xxx stdio.h sys/types.h
20600 eval $typedef
20601 case "$uidtype" in
20602 xxx)
20603         xxx=`./findhdr sys/user.h`
20604         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20605         case $1 in
20606         unsigned) dflt="$1 $2" ;;
20607         *) dflt="$1" ;;
20608         esac
20609         ;;
20610 *) dflt="$uidtype";;
20611 esac
20612 case "$uidtype" in
20613 uid_t)  echo "uid_t found." ;;
20614 *)      rp="What is the type for user ids returned by getuid()?"
20615         . ./myread
20616         uidtype="$ans"
20617         ;;
20618 esac
20619
20620 : Check size of UID
20621 echo " "
20622 case "$uidtype" in
20623 *_t) zzz="$uidtype"     ;;
20624 *)   zzz="uid"          ;;
20625 esac
20626 echo "Checking the size of $zzz..." >&4
20627 cat > try.c <<EOCP
20628 #include <sys/types.h>
20629 #include <stdio.h>
20630 #$i_stdlib I_STDLIB
20631 #ifdef I_STDLIB
20632 #include <stdlib.h>
20633 #endif
20634 int main() {
20635     printf("%d\n", (int)sizeof($uidtype));
20636     exit(0);
20637 }
20638 EOCP
20639 set try
20640 if eval $compile_ok; then
20641         yyy=`$run ./try`
20642         case "$yyy" in
20643         '')     uidsize=4
20644                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20645                 ;;
20646         *)      uidsize=$yyy
20647                 echo "Your $zzz is $uidsize bytes long."
20648                 ;;
20649         esac
20650 else
20651         uidsize=4
20652         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20653 fi
20654
20655 : Check if UID is signed
20656 echo " "
20657 case "$uidtype" in
20658 *_t) zzz="$uidtype"     ;;
20659 *)   zzz="uid"          ;;
20660 esac
20661 echo "Checking the sign of $zzz..." >&4
20662 cat > try.c <<EOCP
20663 #include <sys/types.h>
20664 #include <stdio.h>
20665 int main() {
20666         $uidtype foo = -1;
20667         if (foo < 0)
20668                 printf("-1\n");
20669         else
20670                 printf("1\n");
20671 }
20672 EOCP
20673 set try
20674 if eval $compile; then
20675         yyy=`$run ./try`
20676         case "$yyy" in
20677         '')     uidsign=1
20678                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20679                 ;;
20680         *)      uidsign=$yyy
20681                 case "$uidsign" in
20682                  1) echo "Your $zzz is unsigned." ;;
20683                 -1) echo "Your $zzz is signed."   ;;
20684                 esac
20685                 ;;
20686         esac
20687 else
20688         uidsign=1
20689         echo "(I can't compile the test program--guessing unsigned.)" >&4
20690 fi
20691
20692
20693 : Check format string for UID
20694 echo " "
20695 $echo "Checking the format string to be used for uids..." >&4
20696
20697 case "$uidsign" in
20698 -1)     if $test X"$uidsize" = X"$ivsize"; then
20699                 uidformat="$ivdformat"
20700         else
20701                 if $test X"$uidsize" = X"$longsize"; then
20702                         uidformat='"ld"'
20703                 else
20704                         if $test X"$uidsize" = X"$intsize"; then
20705                                 uidformat='"d"'
20706                         else
20707                                 if $test X"$uidsize" = X"$shortsize"; then
20708                                         uidformat='"hd"'
20709                                 fi
20710                         fi
20711                 fi
20712         fi
20713         ;;
20714 *)      if $test X"$uidsize" = X"$uvsize"; then
20715                 uidformat="$uvuformat"
20716         else
20717                 if $test X"$uidsize" = X"$longsize"; then
20718                         uidformat='"lu"'
20719                 else
20720                         if $test X"$uidsize" = X"$intsize"; then
20721                                 uidformat='"u"'
20722                         else
20723                                 if $test X"$uidsize" = X"$shortsize"; then
20724                                         uidformat='"hu"'
20725                                 fi
20726                         fi
20727                 fi
20728         fi
20729         ;;
20730 esac
20731
20732 : Check if site customization support was requested
20733 case "$usesitecustomize" in
20734     $define|true|[Yy]*)
20735         usesitecustomize="$define"
20736         ;;
20737     *)
20738         usesitecustomize="$undef"
20739         ;;
20740     esac
20741
20742 : determine compiler compiler
20743 case "$yacc" in
20744 '')
20745         dflt=yacc;;
20746 *)
20747         dflt="$yacc";;
20748 esac
20749 echo " "
20750 comp='yacc'
20751 if $test -f "$byacc$_exe"; then
20752         dflt="$byacc"
20753         comp="byacc or $comp"
20754 fi
20755 if $test -f "$bison$_exe"; then
20756         comp="$comp or bison -y"
20757 fi
20758 rp="Which compiler compiler ($comp) shall I use?"
20759 . ./myread
20760 yacc="$ans"
20761 case "$yacc" in
20762 *bis*)
20763         case "$yacc" in
20764         *-y*) ;;
20765         *)
20766                 yacc="$yacc -y"
20767                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20768                 ;;
20769         esac
20770         ;;
20771 esac
20772
20773 : see if this is a assert.h system
20774 set assert.h i_assert
20775 eval $inhdr
20776
20777 : see if this is a fp.h system
20778 set fp.h i_fp
20779 eval $inhdr
20780
20781 : see if this is a fp_class.h system
20782 set fp_class.h i_fp_class
20783 eval $inhdr
20784
20785 : see if gdbm.h is available
20786 set gdbm.h t_gdbm
20787 eval $inhdr
20788 case "$t_gdbm" in
20789 $define)
20790         : see if gdbm_open exists
20791         set gdbm_open d_gdbm_open
20792         eval $inlibc
20793         case "$d_gdbm_open" in
20794         $undef)
20795                 t_gdbm="$undef"
20796                 echo "We won't be including <gdbm.h>"
20797                 ;;
20798         esac
20799         ;;
20800 esac
20801 val="$t_gdbm"
20802 set i_gdbm
20803 eval $setvar
20804
20805 : see if ndbm.h is available
20806 set ndbm.h i_ndbm
20807 eval $inhdr
20808 : Compatibility location for RedHat 7.1
20809 set gdbm/ndbm.h i_gdbmndbm
20810 eval $inhdr
20811 : Compatibility location for Debian 4.0
20812 set gdbm-ndbm.h i_gdbm_ndbm
20813 eval $inhdr
20814
20815 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
20816         : see if dbm_open exists
20817         set dbm_open d_dbm_open
20818         eval $inlibc
20819         case "$d_dbm_open" in
20820         $undef)
20821                 i_ndbm="$undef"
20822                 i_gdbmndbm="$undef"
20823                 i_gdbm_ndbm="$undef"
20824                 echo "We won't be including <ndbm.h>"
20825             val="$undef"
20826                 ;;
20827         *) val="$define"
20828            ;;
20829         esac
20830 fi
20831 set d_ndbm
20832 eval $setvar
20833
20834 : see if this is a ieeefp.h system
20835 case "$i_ieeefp" in
20836 '' ) set ieeefp.h i_ieeefp
20837      eval $inhdr
20838      ;;
20839 esac
20840
20841 : see if this is a libutil.h system
20842 set libutil.h i_libutil
20843 eval $inhdr
20844
20845 : see if mach cthreads are available
20846 if test "X$usethreads" = "X$define"; then
20847         set mach/cthreads.h i_machcthr
20848         eval $inhdr
20849 else
20850         i_machcthr="$undef"
20851 fi
20852
20853 : see if this is a mntent.h system
20854 set mntent.h i_mntent
20855 eval $inhdr
20856
20857 : see if net/errno.h is available
20858 val=''
20859 set net/errno.h val
20860 eval $inhdr
20861
20862 : Unfortunately, it causes problems on some systems.  Arrgh.
20863 case "$val" in
20864 $define)
20865         cat > try.c <<'EOM'
20866 #include <stdio.h>
20867 #include <errno.h>
20868 #include <net/errno.h>
20869 int func()
20870 {
20871         return ENOTSOCK;
20872 }
20873 EOM
20874         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20875                 echo "We'll be including <net/errno.h>." >&4
20876         else
20877                 echo "We won't be including <net/errno.h>." >&4
20878                 val="$undef"
20879         fi
20880         $rm_try
20881         ;;
20882 esac
20883 set i_neterrno
20884 eval $setvar
20885
20886 : see if netinet/tcp.h is available
20887 set netinet/tcp.h i_netinettcp
20888 eval $inhdr
20889
20890 : see if this is a poll.h system
20891 set poll.h i_poll
20892 eval $inhdr
20893
20894 : see if this is a prot.h system
20895 set prot.h i_prot
20896 eval $inhdr
20897
20898 : Preprocessor symbols
20899 echo " "
20900 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20901 $cat <<'EOSH' > Cppsym.know
20902 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20903 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20904 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20905 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20906 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20907 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20908 bull c cadmus clipper CMU COFF COMPILER_VERSION
20909 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20910 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20911 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20912 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20913 GLIBC GLIBC_MINOR
20914 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20915 H3050R H3050RX hbullx20 hcx host_mips
20916 hp200 hp300 hp700 HP700 hp800 hp9000
20917 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20918 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20919 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20920 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20921 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20922 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20923 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20924 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20925 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20926 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20927 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20928 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20929 MATH_HAS_NO_SIDE_EFFECTS
20930 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20931 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20932 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20933 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20934 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20935 NetBSD news1500 news1700 news1800 news1900 news3700
20936 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20937 ns32016 ns32332 ns32k nsc32000
20938 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20939 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20940 pc532 pdp11 PGC PIC plexus PORTAR posix
20941 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20942 POSIX_C_SOURCE POSIX_SOURCE POWER
20943 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
20944 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20945 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20946 sony sony_news sonyrisc sparc sparclite spectrum
20947 stardent stdc STDC_EXT stratos sun sun3 sun386
20948 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20949 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20950 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20951 sysV68 sysV88 Tek4132 Tek4300 titan
20952 TM3200 TM5400 TM5600
20953 tower tower32 tower32_200 tower32_600 tower32_700
20954 tower32_800 tower32_850 tss
20955 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20956 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20957 unix UNIX95 UNIX99 unixpc unos
20958 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20959 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20960 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20961 USGr4 USGr4_2
20962 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20963 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20964 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20965 z8000
20966 EOSH
20967 # Maybe put other stuff here too.
20968 cat <<EOSH >>Cppsym.know
20969 $osname
20970 EOSH
20971 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20972 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20973 $cat Cppsym.know > Cppsym.c
20974 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20975 $rm -f Cppsym.a Cppsym.b Cppsym.c
20976 cat <<EOSH > Cppsym
20977 $startsh
20978 if $test \$# -gt 0; then
20979     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20980     if $test -s Cppsym.got; then
20981         $rm -f Cppsym.got
20982         exit 0
20983     fi
20984     $rm -f Cppsym.got
20985     exit 1
20986 else
20987     $tr " " "$trnl" | ./Cppsym.try
20988     exit 0
20989 fi
20990 EOSH
20991 chmod +x Cppsym
20992 $eunicefix Cppsym
20993 cat <<EOSH > Cppsym.try
20994 $startsh
20995 cat <<'EOCP' > try.c
20996 #include <stdio.h>
20997 #if cpp_stuff == 1
20998 #define STRINGIFY(a)    "a"
20999 #endif
21000 #if cpp_stuff == 42
21001 #define StGiFy(a)  #a
21002 #define STRINGIFY(a)    StGiFy(a)
21003 #endif
21004 #if $cpp_stuff != 1 && $cpp_stuff != 42
21005 #   include "Bletch: How does this C preprocessor stringify macros?"
21006 #endif
21007 int main() {
21008 EOCP
21009 $awk \\
21010 EOSH
21011 cat <<'EOSH' >> Cppsym.try
21012 'length($1) > 0 {
21013     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21014     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21015     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21016     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
21017 }'       >> try.c
21018 echo 'return 0;}' >> try.c
21019 EOSH
21020 cat <<EOSH >> Cppsym.try
21021 ccflags="$ccflags"
21022 case "$osname-$gccversion" in
21023 irix-) ccflags="\$ccflags -woff 1178" ;;
21024 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21025 esac
21026 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
21027 EOSH
21028 chmod +x Cppsym.try
21029 $eunicefix Cppsym.try
21030 ./Cppsym < Cppsym.know > Cppsym.true
21031 : Add in any linux cpp "predefined macros":
21032 case "$osname::$gccversion" in
21033   *linux*::*.*)
21034     tHdrH=_tmpHdr
21035     rm -f $tHdrH'.h' $tHdrH
21036     touch $tHdrH'.h'
21037     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
21038        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21039        if [ -s $tHdrH'_cppsym.real' ]; then
21040           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21041        fi
21042     fi
21043     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21044   ;;
21045 esac
21046 : now check the C compiler for additional symbols
21047 postprocess_cc_v=''
21048 case "$osname" in
21049 aix) postprocess_cc_v="|$tr , ' '" ;;
21050 esac
21051 $cat >ccsym <<EOS
21052 $startsh
21053 $cat >tmp.c <<EOF
21054 extern int foo;
21055 EOF
21056 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21057 do
21058         case "\$i" in
21059         -D*) echo "\$i" | $sed 's/^-D//';;
21060         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
21061         esac
21062 done
21063 $rm_try
21064 EOS
21065 postprocess_cc_v=''
21066 chmod +x ccsym
21067 $eunicefix ccsym
21068 ./ccsym > ccsym1.raw
21069 if $test -s ccsym1.raw; then
21070        $sort ccsym1.raw | $uniq >ccsym.raw
21071 else
21072        mv ccsym1.raw ccsym.raw
21073 fi
21074
21075 $awk '/\=/ { print $0; next }
21076         { print $0"=1" }' ccsym.raw >ccsym.list
21077 $comm -13 Cppsym.true ccsym.list >ccsym.own
21078 $comm -12 Cppsym.true ccsym.list >ccsym.com
21079 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
21080 also=''
21081 if $test -z ccsym.raw; then
21082         echo "Your C compiler doesn't seem to define any symbols!" >&4
21083         echo " "
21084         echo "However, your C preprocessor defines the following symbols:"
21085         $cat Cppsym.true
21086         ccsymbols=''
21087         cppsymbols=`$cat Cppsym.true`
21088         cppsymbols=`echo $cppsymbols`
21089         cppccsymbols="$cppsymbols"
21090 else
21091         if $test -s ccsym.com; then
21092                 echo "Your C compiler and pre-processor define these symbols:"
21093                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21094                 also='also '
21095                 symbols='ones'
21096                 cppccsymbols=`$cat ccsym.com`
21097                 cppccsymbols=`echo $cppccsymbols`
21098                 $test "$silent" || sleep 1
21099         fi
21100         if $test -s ccsym.cpp; then
21101                 $test "$also" && echo " "
21102                 echo "Your C pre-processor ${also}defines the following symbols:"
21103                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21104                 also='further '
21105                 cppsymbols=`$cat ccsym.cpp`
21106                 cppsymbols=`echo $cppsymbols`
21107                 $test "$silent" || sleep 1
21108         fi
21109         if $test -s ccsym.own; then
21110                 $test "$also" && echo " "
21111                 echo "Your C compiler ${also}defines the following cpp symbols:"
21112                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21113                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21114                 ccsymbols=`$cat ccsym.own`
21115                 ccsymbols=`echo $ccsymbols`
21116                 $test "$silent" || sleep 1
21117         fi
21118 fi
21119
21120 : see if this is a termio system
21121 val="$undef"
21122 val2="$undef"
21123 val3="$undef"
21124 if $test `./findhdr termios.h`; then
21125         set tcsetattr i_termios
21126         eval $inlibc
21127         val3="$i_termios"
21128 fi
21129 echo " "
21130 case "$val3" in
21131 "$define") echo "You have POSIX termios.h... good!" >&4;;
21132 *) if ./Cppsym pyr; then
21133                 case "`/bin/universe`" in
21134                 ucb) if $test `./findhdr sgtty.h`; then
21135                                 val2="$define"
21136                                 echo "<sgtty.h> found." >&4
21137                         else
21138                                 echo "System is pyramid with BSD universe."
21139                                 ./warn "<sgtty.h> not found--you could have problems."
21140                         fi;;
21141                 *) if $test `./findhdr termio.h`; then
21142                                 val="$define"
21143                                 echo "<termio.h> found." >&4
21144                         else
21145                                 echo "System is pyramid with USG universe."
21146                                 ./warn "<termio.h> not found--you could have problems."
21147                         fi;;
21148                 esac
21149         elif ./usg; then
21150                 if $test `./findhdr termio.h`; then
21151                         echo "<termio.h> found." >&4
21152                         val="$define"
21153                 elif $test `./findhdr sgtty.h`; then
21154                         echo "<sgtty.h> found." >&4
21155                         val2="$define"
21156                 else
21157                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
21158                 fi
21159         else
21160                 if $test `./findhdr sgtty.h`; then
21161                         echo "<sgtty.h> found." >&4
21162                         val2="$define"
21163                 elif $test `./findhdr termio.h`; then
21164                         echo "<termio.h> found." >&4
21165                         val="$define"
21166                 else
21167                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
21168                 fi
21169         fi;;
21170 esac
21171 set i_termio; eval $setvar
21172 val=$val2; set i_sgtty; eval $setvar
21173 val=$val3; set i_termios; eval $setvar
21174
21175 : see if stddef is available
21176 set stddef.h i_stddef
21177 eval $inhdr
21178
21179 : see if sys/access.h is available
21180 set sys/access.h i_sysaccess
21181 eval $inhdr
21182
21183 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
21184 set sys/filio.h i_sysfilio
21185 eval $inhdr
21186 echo " "
21187 if $test `./findhdr sys/ioctl.h`; then
21188         val="$define"
21189         echo '<sys/ioctl.h> found.' >&4
21190 else
21191         val="$undef"
21192         if $test $i_sysfilio = "$define"; then
21193             echo '<sys/ioctl.h> NOT found.' >&4
21194         else
21195                 $test $i_sgtty = "$define" && xxx="sgtty.h"
21196                 $test $i_termio = "$define" && xxx="termio.h"
21197                 $test $i_termios = "$define" && xxx="termios.h"
21198 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
21199         fi
21200 fi
21201 set i_sysioctl
21202 eval $setvar
21203
21204 : see if socket ioctl defs are in sys/sockio.h
21205 echo " "
21206 xxx=`./findhdr sys/sockio.h`
21207 if $test "$xxx"; then
21208         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
21209                 val="$define"
21210                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
21211         else
21212                 val="$undef"
21213                 echo "No socket ioctls found in <sys/sockio.h>." >&4
21214         fi
21215 else
21216         val="$undef"
21217         $cat <<EOM
21218 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
21219 EOM
21220 fi
21221 set i_syssockio
21222 eval $setvar
21223
21224 : see if this is a syslog.h system
21225 set syslog.h i_syslog
21226 eval $inhdr
21227
21228 : see if this is a sys/mode.h system
21229 set sys/mode.h i_sysmode
21230 eval $inhdr
21231
21232 : see if there is a sys/poll.h file
21233 set sys/poll.h i_syspoll
21234 eval $inhdr
21235
21236 : see if sys/resource.h has to be included
21237 set sys/resource.h i_sysresrc
21238 eval $inhdr
21239
21240 : see if sys/security.h is available
21241 set sys/security.h i_syssecrt
21242 eval $inhdr
21243
21244 : see if this is a sys/statvfs.h system
21245 set sys/statvfs.h i_sysstatvfs
21246 eval $inhdr
21247
21248 : see if this is a sys/un.h system
21249 set sys/un.h i_sysun
21250 eval $inhdr
21251
21252 : see if this is a sys/utsname.h system
21253 set sys/utsname.h i_sysutsname
21254 eval $inhdr
21255
21256 : see if this is a syswait system
21257 set sys/wait.h i_syswait
21258 eval $inhdr
21259
21260 : see if this is a ustat.h system
21261 set ustat.h i_ustat
21262 eval $inhdr
21263
21264 : see if this is an utime system
21265 set utime.h i_utime
21266 eval $inhdr
21267
21268 : see if this is a values.h system
21269 set values.h i_values
21270 eval $inhdr
21271
21272 : see if this is a vfork system
21273 case "$d_vfork" in
21274 "$define")
21275         set vfork.h i_vfork
21276         eval $inhdr
21277         ;;
21278 *)
21279         i_vfork="$undef"
21280         ;;
21281 esac
21282
21283 : Check extensions
21284 echo " "
21285 echo "Looking for extensions..." >&4
21286 : If we are using the old config.sh, known_extensions may contain
21287 : old or inaccurate or duplicate values.
21288 known_extensions=''
21289 nonxs_extensions=''
21290 : We do not use find because it might not be available.
21291 : We do not just use MANIFEST because the user may have dropped
21292 : some additional extensions into the source tree and expect them
21293 : to be built.
21294
21295 : Function to recursively find available extensions, ignoring DynaLoader
21296 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21297 find_extensions='
21298     for xxx in *; do
21299         case "$xxx" in
21300             DynaLoader|dynaload) ;;
21301             *)
21302             if $test -f $xxx/$xxx.xs -o -f $xxx/$xxx.c; then
21303                 known_extensions="$known_extensions $1$xxx";
21304             elif $test -f $xxx/Makefile.PL; then
21305                 nonxs_extensions="$nonxs_extensions $1$xxx";
21306             else
21307                 if $test -d $xxx -a $# -lt 10; then
21308                     set $1$xxx/ $*;
21309                     cd "$xxx";
21310                     eval $find_extensions;
21311                     cd ..;
21312                     shift;
21313                 fi;
21314             fi
21315             ;;
21316         esac;
21317     done'
21318 tdir=`pwd`
21319 cd "$rsrc/ext"
21320 set X
21321 shift
21322 eval $find_extensions
21323 # Special case:  Add in modules that nest beyond the first level.
21324 # Currently threads/shared and Hash/Util/FieldHash, since they are
21325 # not picked up by the recursive find above (and adding in general
21326 # recursive finding breaks SDBM_File/sdbm).
21327 # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21328 known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
21329 set X $known_extensions
21330 shift
21331 known_extensions="$*"
21332 set X $nonxs_extensions
21333 shift
21334 nonxs_extensions="$*"
21335 cd "$tdir"
21336
21337 : Now see which are supported on this system.
21338 avail_ext=''
21339 for xxx in $known_extensions ; do
21340         case "$xxx" in
21341         DB_File|db_file)
21342                 case "$i_db" in
21343                 $define) avail_ext="$avail_ext $xxx" ;;
21344                 esac
21345                 ;;
21346         GDBM_File|gdbm_fil)
21347                 case "$i_gdbm" in
21348                 $define) avail_ext="$avail_ext $xxx" ;;
21349                 esac
21350                 ;;
21351         I18N/Langinfo|i18n_lan)
21352                 case "$i_langinfo$d_nl_langinfo" in
21353                 $define$define) avail_ext="$avail_ext $xxx" ;;
21354                 esac
21355                 ;;
21356         IPC/SysV|ipc/sysv)
21357                 : XXX Do we need a useipcsysv variable here
21358                 case "${d_msg}${d_sem}${d_shm}" in
21359                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21360                 esac
21361                 ;;
21362         NDBM_File|ndbm_fil)
21363                 case "$i_ndbm" in
21364                 $define)
21365                     case "$osname-$use64bitint" in
21366                     hpux-define)
21367                         case "$libs" in
21368                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21369                         esac
21370                         ;;
21371                     *) avail_ext="$avail_ext $xxx" ;;
21372                     esac
21373                     ;;
21374                 esac
21375                 ;;
21376         ODBM_File|odbm_fil)
21377                 case "${i_dbm}${i_rpcsvcdbm}" in
21378                 *"${define}"*)
21379                     case "$d_cplusplus" in
21380                     define) ;; # delete as a function name will not work
21381                     *)  case "$osname-$use64bitint" in
21382                         hpux-define)
21383                             case "$libs" in
21384                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21385                             esac
21386                             ;;
21387                         *) avail_ext="$avail_ext $xxx" ;;
21388                         esac
21389                         ;;
21390                     esac
21391                     ;;
21392                 esac
21393                 ;;
21394         Opcode|opcode)
21395                 case "$useopcode" in
21396                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21397                 esac
21398                 ;;
21399         POSIX|posix)
21400                 case "$useposix" in
21401                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21402                 esac
21403                 ;;
21404         Socket|socket)
21405                 case "$d_socket" in
21406                 true|$define|y)
21407                     case "$osname" in
21408                     beos) ;; # not unless BONE
21409                     *) avail_ext="$avail_ext $xxx" ;;
21410                     esac
21411                     ;;
21412                 esac
21413                 ;;
21414         Sys/Syslog|sys/syslog)
21415                 : XXX syslog requires socket
21416                 case "$d_socket" in
21417                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21418                 esac
21419                 ;;
21420         Thread|thread)
21421                 case "$usethreads" in
21422                 true|$define|y)
21423                         case "$use5005threads" in
21424                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
21425                         esac
21426                 esac
21427                 ;;
21428         threads|threads/shared)
21429                 # threads and threads::shared are special cases.
21430                 # To stop people from asking "Perl 5.8.0 was supposed
21431                 # to have this new fancy threads implementation but my
21432                 # perl doesn't have it" and from people trying to
21433                 # (re)install the threads module using CPAN.pm and
21434                 # CPAN.pm then offering to reinstall Perl 5.8.0,
21435                 # the threads.pm and threads/shared.pm will always be
21436                 # there, croaking informatively ("you need to rebuild
21437                 # all of Perl with threads, sorry") when threads haven't
21438                 # been compiled in.
21439                 # --jhi
21440                 avail_ext="$avail_ext $xxx"
21441                 ;;
21442         Win32*)
21443                 case "$osname" in
21444                 cygwin) avail_ext="$avail_ext $xxx" ;;
21445                 esac
21446                 ;;
21447         XS/APItest|xs/apitest)
21448                 # This is just for testing.  Skip it unless we have dynamic loading.
21449
21450                 case "$usedl" in
21451                 $define) avail_ext="$avail_ext $xxx" ;;
21452                 esac
21453                 ;;
21454         XS/Typemap|xs/typemap)
21455                 # This is just for testing.  Skip it unless we have dynamic loading.
21456                 case "$usedl" in
21457                 $define) avail_ext="$avail_ext $xxx" ;;
21458                 esac
21459                 ;;
21460         *)      avail_ext="$avail_ext $xxx"
21461                 ;;
21462         esac
21463 done
21464
21465 set X $avail_ext
21466 shift
21467 avail_ext="$*"
21468
21469 case "$onlyextensions" in
21470 '') ;;
21471 *)  keepextensions=''
21472     echo "You have requested that only certains extensions be included..." >&4
21473     for i in $onlyextensions; do
21474         case " $avail_ext " in
21475         *" $i "*)
21476             echo "Keeping extension $i."
21477             keepextensions="$keepextensions $i"
21478             ;;
21479         *) echo "Ignoring extension $i." ;;
21480         esac
21481     done
21482     avail_ext="$keepextensions"
21483     ;;
21484 esac
21485
21486 case "$noextensions" in
21487 '') ;;
21488 *)  keepextensions=''
21489     echo "You have requested that certain extensions be ignored..." >&4
21490     for i in $avail_ext; do
21491         case " $noextensions " in
21492         *" $i "*) echo "Ignoring extension $i." ;;
21493         *) echo "Keeping extension $i.";
21494            keepextensions="$keepextensions $i"
21495            ;;
21496         esac
21497     done
21498     avail_ext="$keepextensions"
21499     ;;
21500 esac
21501
21502 : Now see which nonxs extensions are supported on this system.
21503 : For now assume all are.
21504 nonxs_ext=''
21505 for xxx in $nonxs_extensions ; do
21506         case "$xxx" in
21507         *)      nonxs_ext="$nonxs_ext $xxx"
21508                 ;;
21509         esac
21510 done
21511
21512 set X $nonxs_ext
21513 shift
21514 nonxs_ext="$*"
21515
21516 case $usedl in
21517 $define)
21518         $cat <<EOM
21519 A number of extensions are supplied with $package.  You may choose to
21520 compile these extensions for dynamic loading (the default), compile
21521 them into the $package executable (static loading), or not include
21522 them at all.  Answer "none" to include no extensions.
21523 Note that DynaLoader is always built and need not be mentioned here.
21524
21525 EOM
21526         case "$dynamic_ext" in
21527         '')
21528                 : Exclude those listed in static_ext
21529                 dflt=''
21530                 for xxx in $avail_ext; do
21531                         case " $static_ext " in
21532                         *" $xxx "*) ;;
21533                         *) dflt="$dflt $xxx" ;;
21534                         esac
21535                 done
21536                 set X $dflt
21537                 shift
21538                 dflt="$*"
21539                 ;;
21540         *)      dflt="$dynamic_ext"
21541                 # Perhaps we are reusing an old out-of-date config.sh.
21542                 case "$hint" in
21543                 previous)
21544                         if test X"$dynamic_ext" != X"$avail_ext"; then
21545                                 $cat <<EOM
21546 NOTICE:  Your previous config.sh list may be incorrect.
21547 The extensions now available to you are
21548         ${avail_ext}
21549 but the default list from your previous config.sh is
21550         ${dynamic_ext}
21551
21552 EOM
21553                         fi
21554                         ;;
21555                 esac
21556                 ;;
21557         esac
21558         case "$dflt" in
21559         '')     dflt=none;;
21560         esac
21561         rp="What extensions do you wish to load dynamically?"
21562         . ./myread
21563         case "$ans" in
21564         none) dynamic_ext=' ' ;;
21565         *) dynamic_ext="$ans" ;;
21566         esac
21567
21568         case "$static_ext" in
21569         '')
21570                 : Exclude those already listed in dynamic linking
21571                 dflt=''
21572                 for xxx in $avail_ext; do
21573                         case " $dynamic_ext " in
21574                         *" $xxx "*) ;;
21575                         *) dflt="$dflt $xxx" ;;
21576                         esac
21577                 done
21578                 set X $dflt
21579                 shift
21580                 dflt="$*"
21581                 ;;
21582         *)  dflt="$static_ext"
21583                 ;;
21584         esac
21585
21586         case "$dflt" in
21587         '')     dflt=none;;
21588         esac
21589         rp="What extensions do you wish to load statically?"
21590         . ./myread
21591         case "$ans" in
21592         none) static_ext=' ' ;;
21593         *) static_ext="$ans" ;;
21594         esac
21595         ;;
21596 *)
21597         $cat <<EOM
21598 A number of extensions are supplied with $package.  Answer "none"
21599 to include no extensions.
21600 Note that DynaLoader is always built and need not be mentioned here.
21601
21602 EOM
21603         case "$static_ext" in
21604         '') dflt="$avail_ext" ;;
21605         *)      dflt="$static_ext"
21606                 # Perhaps we are reusing an old out-of-date config.sh.
21607                 case "$hint" in
21608                 previous)
21609                         if test X"$static_ext" != X"$avail_ext"; then
21610                                 $cat <<EOM
21611 NOTICE:  Your previous config.sh list may be incorrect.
21612 The extensions now available to you are
21613         ${avail_ext}
21614 but the default list from your previous config.sh is
21615         ${static_ext}
21616
21617 EOM
21618                         fi
21619                         ;;
21620                 esac
21621                 ;;
21622         esac
21623         : Exclude those that are not xs extensions
21624         case "$dflt" in
21625         '')     dflt=none;;
21626         esac
21627         rp="What extensions do you wish to include?"
21628         . ./myread
21629         case "$ans" in
21630         none) static_ext=' ' ;;
21631         *) static_ext="$ans" ;;
21632         esac
21633         ;;
21634 esac
21635 #
21636 # Encode is a special case.  If we are building Encode as a static
21637 # extension, we need to explicitly list its subextensions as well.
21638 # For other nested extensions, this is handled automatically by
21639 # the appropriate Makefile.PL.
21640 case " $static_ext " in
21641         *" Encode "*) # Add the subextensions of Encode
21642         cd "$rsrc/ext"
21643         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21644                 static_ext="$static_ext Encode/$xxx"
21645         done
21646         cd "$tdir"
21647         ;;
21648 esac
21649
21650 set X $dynamic_ext $static_ext $nonxs_ext
21651 shift
21652 extensions="$*"
21653
21654 # Sanity check:  We require an extension suitable for use with
21655 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21656 # should show up as failures in the test suite, but it's helpful to
21657 # catch them now.) The 'extensions' list is normally sorted
21658 # alphabetically, so we need to accept either
21659 #    DB_File ... Fcntl ... IO  ....
21660 # or something like
21661 #    Fcntl ... NDBM_File ... IO  ....
21662 case " $extensions"  in
21663 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21664 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21665 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21666 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21667    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21668    ;;
21669 esac
21670
21671 : Remove libraries needed only for extensions
21672 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21673 : The exception is SunOS 4.x, which needs them.
21674 case "${osname}X${osvers}" in
21675 sunos*X4*)
21676     perllibs="$libs"
21677     ;;
21678 *) case "$usedl" in
21679     $define|true|[yY]*)
21680             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21681             shift
21682             perllibs="$*"
21683             ;;
21684     *)  perllibs="$libs"
21685             ;;
21686     esac
21687     ;;
21688 esac
21689
21690 : Remove build directory name from cppstdin so it can be used from
21691 : either the present location or the final installed location.
21692 echo " "
21693 : Get out of the UU directory to get correct path name.
21694 cd ..
21695 case "$cppstdin" in
21696 `pwd`/cppstdin)
21697         echo "Stripping down cppstdin path name"
21698         cppstdin=cppstdin
21699         ;;
21700 esac
21701 cd UU
21702
21703 : end of configuration questions
21704 echo " "
21705 echo "End of configuration questions."
21706 echo " "
21707
21708 : back to where it started
21709 if test -d ../UU; then
21710         cd ..
21711 fi
21712
21713 : configuration may be unconditionally patched via a 'config.arch' file
21714 if $test -f config.arch; then
21715         echo "I see a config.arch file, loading it." >&4
21716         . ./config.arch
21717 fi
21718
21719 : configuration may be patched via a 'config.over' file
21720 if $test -f config.over; then
21721         echo " "
21722         dflt=y
21723         rp='I see a config.over file.  Do you wish to load it?'
21724         . UU/myread
21725         case "$ans" in
21726         n*) echo "OK, I'll ignore it.";;
21727         *)      . ./config.over
21728                 echo "Configuration override changes have been loaded."
21729                 ;;
21730         esac
21731 fi
21732
21733 : in case they want portability, strip down executable paths
21734 case "$d_portable" in
21735 "$define")
21736         echo " "
21737         echo "Stripping down executable paths..." >&4
21738         for file in $loclist $trylist; do
21739                 eval temp=\$$file
21740                 eval $file=`basename $temp`
21741         done
21742         ;;
21743 esac
21744
21745 : create config.sh file
21746 echo " "
21747 echo "Creating config.sh..." >&4
21748 $spitshell <<EOT >config.sh
21749 $startsh
21750 #
21751 # This file was produced by running the Configure script. It holds all the
21752 # definitions figured out by Configure. Should you modify one of these values,
21753 # do not forget to propagate your changes by running "Configure -der". You may
21754 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21755 #
21756
21757 # Package name      : $package
21758 # Source directory  : $src
21759 # Configuration time: $cf_time
21760 # Configured by     : $cf_by
21761 # Target system     : $myuname
21762
21763 EOT
21764 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
21765 $spitshell <<EOT >>config.sh
21766
21767 Author='$Author'
21768 Date='$Date'
21769 Header='$Header'
21770 Id='$Id'
21771 Locker='$Locker'
21772 Log='$Log'
21773 RCSfile='$RCSfile'
21774 Revision='$Revision'
21775 Source='$Source'
21776 State='$State'
21777 _a='$_a'
21778 _exe='$_exe'
21779 _o='$_o'
21780 afs='$afs'
21781 afsroot='$afsroot'
21782 alignbytes='$alignbytes'
21783 ansi2knr='$ansi2knr'
21784 aphostname='$aphostname'
21785 api_revision='$api_revision'
21786 api_subversion='$api_subversion'
21787 api_version='$api_version'
21788 api_versionstring='$api_versionstring'
21789 ar='$ar'
21790 archlib='$archlib'
21791 archlibexp='$archlibexp'
21792 archname64='$archname64'
21793 archname='$archname'
21794 archobjs='$archobjs'
21795 asctime_r_proto='$asctime_r_proto'
21796 awk='$awk'
21797 baserev='$baserev'
21798 bash='$bash'
21799 bin='$bin'
21800 binexp='$binexp'
21801 bison='$bison'
21802 byacc='$byacc'
21803 byteorder='$byteorder'
21804 c='$c'
21805 castflags='$castflags'
21806 cat='$cat'
21807 cc='$cc'
21808 cccdlflags='$cccdlflags'
21809 ccdlflags='$ccdlflags'
21810 ccflags='$ccflags'
21811 ccflags_uselargefiles='$ccflags_uselargefiles'
21812 ccname='$ccname'
21813 ccsymbols='$ccsymbols'
21814 ccversion='$ccversion'
21815 cf_by='$cf_by'
21816 cf_email='$cf_email'
21817 cf_time='$cf_time'
21818 chgrp='$chgrp'
21819 chmod='$chmod'
21820 chown='$chown'
21821 clocktype='$clocktype'
21822 comm='$comm'
21823 compress='$compress'
21824 contains='$contains'
21825 cp='$cp'
21826 cpio='$cpio'
21827 cpp='$cpp'
21828 cpp_stuff='$cpp_stuff'
21829 cppccsymbols='$cppccsymbols'
21830 cppflags='$cppflags'
21831 cpplast='$cpplast'
21832 cppminus='$cppminus'
21833 cpprun='$cpprun'
21834 cppstdin='$cppstdin'
21835 cppsymbols='$cppsymbols'
21836 crypt_r_proto='$crypt_r_proto'
21837 cryptlib='$cryptlib'
21838 csh='$csh'
21839 ctermid_r_proto='$ctermid_r_proto'
21840 ctime_r_proto='$ctime_r_proto'
21841 d_Gconvert='$d_Gconvert'
21842 d_PRIEUldbl='$d_PRIEUldbl'
21843 d_PRIFUldbl='$d_PRIFUldbl'
21844 d_PRIGUldbl='$d_PRIGUldbl'
21845 d_PRIXU64='$d_PRIXU64'
21846 d_PRId64='$d_PRId64'
21847 d_PRIeldbl='$d_PRIeldbl'
21848 d_PRIfldbl='$d_PRIfldbl'
21849 d_PRIgldbl='$d_PRIgldbl'
21850 d_PRIi64='$d_PRIi64'
21851 d_PRIo64='$d_PRIo64'
21852 d_PRIu64='$d_PRIu64'
21853 d_PRIx64='$d_PRIx64'
21854 d_SCNfldbl='$d_SCNfldbl'
21855 d__fwalk='$d__fwalk'
21856 d_access='$d_access'
21857 d_accessx='$d_accessx'
21858 d_aintl='$d_aintl'
21859 d_alarm='$d_alarm'
21860 d_archlib='$d_archlib'
21861 d_asctime_r='$d_asctime_r'
21862 d_atolf='$d_atolf'
21863 d_atoll='$d_atoll'
21864 d_attribute_format='$d_attribute_format'
21865 d_attribute_malloc='$d_attribute_malloc'
21866 d_attribute_nonnull='$d_attribute_nonnull'
21867 d_attribute_noreturn='$d_attribute_noreturn'
21868 d_attribute_pure='$d_attribute_pure'
21869 d_attribute_unused='$d_attribute_unused'
21870 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21871 d_bcmp='$d_bcmp'
21872 d_bcopy='$d_bcopy'
21873 d_bsd='$d_bsd'
21874 d_bsdgetpgrp='$d_bsdgetpgrp'
21875 d_bsdsetpgrp='$d_bsdsetpgrp'
21876 d_builtin_choose_expr='$d_builtin_choose_expr'
21877 d_builtin_expect='$d_builtin_expect'
21878 d_bzero='$d_bzero'
21879 d_c99_variadic_macros='$d_c99_variadic_macros'
21880 d_casti32='$d_casti32'
21881 d_castneg='$d_castneg'
21882 d_charvspr='$d_charvspr'
21883 d_chown='$d_chown'
21884 d_chroot='$d_chroot'
21885 d_chsize='$d_chsize'
21886 d_class='$d_class'
21887 d_clearenv='$d_clearenv'
21888 d_closedir='$d_closedir'
21889 d_cmsghdr_s='$d_cmsghdr_s'
21890 d_const='$d_const'
21891 d_copysignl='$d_copysignl'
21892 d_cplusplus='$d_cplusplus'
21893 d_crypt='$d_crypt'
21894 d_crypt_r='$d_crypt_r'
21895 d_csh='$d_csh'
21896 d_ctermid='$d_ctermid'
21897 d_ctermid_r='$d_ctermid_r'
21898 d_ctime_r='$d_ctime_r'
21899 d_cuserid='$d_cuserid'
21900 d_dbl_dig='$d_dbl_dig'
21901 d_dbminitproto='$d_dbminitproto'
21902 d_difftime='$d_difftime'
21903 d_dir_dd_fd='$d_dir_dd_fd'
21904 d_dirfd='$d_dirfd'
21905 d_dirnamlen='$d_dirnamlen'
21906 d_dlerror='$d_dlerror'
21907 d_dlopen='$d_dlopen'
21908 d_dlsymun='$d_dlsymun'
21909 d_dosuid='$d_dosuid'
21910 d_drand48_r='$d_drand48_r'
21911 d_drand48proto='$d_drand48proto'
21912 d_dup2='$d_dup2'
21913 d_eaccess='$d_eaccess'
21914 d_endgrent='$d_endgrent'
21915 d_endgrent_r='$d_endgrent_r'
21916 d_endhent='$d_endhent'
21917 d_endhostent_r='$d_endhostent_r'
21918 d_endnent='$d_endnent'
21919 d_endnetent_r='$d_endnetent_r'
21920 d_endpent='$d_endpent'
21921 d_endprotoent_r='$d_endprotoent_r'
21922 d_endpwent='$d_endpwent'
21923 d_endpwent_r='$d_endpwent_r'
21924 d_endsent='$d_endsent'
21925 d_endservent_r='$d_endservent_r'
21926 d_eofnblk='$d_eofnblk'
21927 d_eunice='$d_eunice'
21928 d_faststdio='$d_faststdio'
21929 d_fchdir='$d_fchdir'
21930 d_fchmod='$d_fchmod'
21931 d_fchown='$d_fchown'
21932 d_fcntl='$d_fcntl'
21933 d_fcntl_can_lock='$d_fcntl_can_lock'
21934 d_fd_macros='$d_fd_macros'
21935 d_fd_set='$d_fd_set'
21936 d_fds_bits='$d_fds_bits'
21937 d_fgetpos='$d_fgetpos'
21938 d_finite='$d_finite'
21939 d_finitel='$d_finitel'
21940 d_flexfnam='$d_flexfnam'
21941 d_flock='$d_flock'
21942 d_flockproto='$d_flockproto'
21943 d_fork='$d_fork'
21944 d_fp_class='$d_fp_class'
21945 d_fpathconf='$d_fpathconf'
21946 d_fpclass='$d_fpclass'
21947 d_fpclassify='$d_fpclassify'
21948 d_fpclassl='$d_fpclassl'
21949 d_fpos64_t='$d_fpos64_t'
21950 d_frexpl='$d_frexpl'
21951 d_fs_data_s='$d_fs_data_s'
21952 d_fseeko='$d_fseeko'
21953 d_fsetpos='$d_fsetpos'
21954 d_fstatfs='$d_fstatfs'
21955 d_fstatvfs='$d_fstatvfs'
21956 d_fsync='$d_fsync'
21957 d_ftello='$d_ftello'
21958 d_ftime='$d_ftime'
21959 d_futimes='$d_futimes'
21960 d_getcwd='$d_getcwd'
21961 d_getespwnam='$d_getespwnam'
21962 d_getfsstat='$d_getfsstat'
21963 d_getgrent='$d_getgrent'
21964 d_getgrent_r='$d_getgrent_r'
21965 d_getgrgid_r='$d_getgrgid_r'
21966 d_getgrnam_r='$d_getgrnam_r'
21967 d_getgrps='$d_getgrps'
21968 d_gethbyaddr='$d_gethbyaddr'
21969 d_gethbyname='$d_gethbyname'
21970 d_gethent='$d_gethent'
21971 d_gethname='$d_gethname'
21972 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21973 d_gethostbyname_r='$d_gethostbyname_r'
21974 d_gethostent_r='$d_gethostent_r'
21975 d_gethostprotos='$d_gethostprotos'
21976 d_getitimer='$d_getitimer'
21977 d_getlogin='$d_getlogin'
21978 d_getlogin_r='$d_getlogin_r'
21979 d_getmnt='$d_getmnt'
21980 d_getmntent='$d_getmntent'
21981 d_getnbyaddr='$d_getnbyaddr'
21982 d_getnbyname='$d_getnbyname'
21983 d_getnent='$d_getnent'
21984 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21985 d_getnetbyname_r='$d_getnetbyname_r'
21986 d_getnetent_r='$d_getnetent_r'
21987 d_getnetprotos='$d_getnetprotos'
21988 d_getpagsz='$d_getpagsz'
21989 d_getpbyname='$d_getpbyname'
21990 d_getpbynumber='$d_getpbynumber'
21991 d_getpent='$d_getpent'
21992 d_getpgid='$d_getpgid'
21993 d_getpgrp2='$d_getpgrp2'
21994 d_getpgrp='$d_getpgrp'
21995 d_getppid='$d_getppid'
21996 d_getprior='$d_getprior'
21997 d_getprotobyname_r='$d_getprotobyname_r'
21998 d_getprotobynumber_r='$d_getprotobynumber_r'
21999 d_getprotoent_r='$d_getprotoent_r'
22000 d_getprotoprotos='$d_getprotoprotos'
22001 d_getprpwnam='$d_getprpwnam'
22002 d_getpwent='$d_getpwent'
22003 d_getpwent_r='$d_getpwent_r'
22004 d_getpwnam_r='$d_getpwnam_r'
22005 d_getpwuid_r='$d_getpwuid_r'
22006 d_getsbyname='$d_getsbyname'
22007 d_getsbyport='$d_getsbyport'
22008 d_getsent='$d_getsent'
22009 d_getservbyname_r='$d_getservbyname_r'
22010 d_getservbyport_r='$d_getservbyport_r'
22011 d_getservent_r='$d_getservent_r'
22012 d_getservprotos='$d_getservprotos'
22013 d_getspnam='$d_getspnam'
22014 d_getspnam_r='$d_getspnam_r'
22015 d_gettimeod='$d_gettimeod'
22016 d_gmtime_r='$d_gmtime_r'
22017 d_gnulibc='$d_gnulibc'
22018 d_grpasswd='$d_grpasswd'
22019 d_hasmntopt='$d_hasmntopt'
22020 d_htonl='$d_htonl'
22021 d_ilogbl='$d_ilogbl'
22022 d_inc_version_list='$d_inc_version_list'
22023 d_index='$d_index'
22024 d_inetaton='$d_inetaton'
22025 d_int64_t='$d_int64_t'
22026 d_isascii='$d_isascii'
22027 d_isfinite='$d_isfinite'
22028 d_isinf='$d_isinf'
22029 d_isnan='$d_isnan'
22030 d_isnanl='$d_isnanl'
22031 d_killpg='$d_killpg'
22032 d_lchown='$d_lchown'
22033 d_ldbl_dig='$d_ldbl_dig'
22034 d_libm_lib_version='$d_libm_lib_version'
22035 d_link='$d_link'
22036 d_localtime_r='$d_localtime_r'
22037 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
22038 d_locconv='$d_locconv'
22039 d_lockf='$d_lockf'
22040 d_longdbl='$d_longdbl'
22041 d_longlong='$d_longlong'
22042 d_lseekproto='$d_lseekproto'
22043 d_lstat='$d_lstat'
22044 d_madvise='$d_madvise'
22045 d_malloc_good_size='$d_malloc_good_size'
22046 d_malloc_size='$d_malloc_size'
22047 d_mblen='$d_mblen'
22048 d_mbstowcs='$d_mbstowcs'
22049 d_mbtowc='$d_mbtowc'
22050 d_memchr='$d_memchr'
22051 d_memcmp='$d_memcmp'
22052 d_memcpy='$d_memcpy'
22053 d_memmove='$d_memmove'
22054 d_memset='$d_memset'
22055 d_mkdir='$d_mkdir'
22056 d_mkdtemp='$d_mkdtemp'
22057 d_mkfifo='$d_mkfifo'
22058 d_mkstemp='$d_mkstemp'
22059 d_mkstemps='$d_mkstemps'
22060 d_mktime='$d_mktime'
22061 d_mmap='$d_mmap'
22062 d_modfl='$d_modfl'
22063 d_modfl_pow32_bug='$d_modfl_pow32_bug'
22064 d_modflproto='$d_modflproto'
22065 d_mprotect='$d_mprotect'
22066 d_msg='$d_msg'
22067 d_msg_ctrunc='$d_msg_ctrunc'
22068 d_msg_dontroute='$d_msg_dontroute'
22069 d_msg_oob='$d_msg_oob'
22070 d_msg_peek='$d_msg_peek'
22071 d_msg_proxy='$d_msg_proxy'
22072 d_msgctl='$d_msgctl'
22073 d_msgget='$d_msgget'
22074 d_msghdr_s='$d_msghdr_s'
22075 d_msgrcv='$d_msgrcv'
22076 d_msgsnd='$d_msgsnd'
22077 d_msync='$d_msync'
22078 d_munmap='$d_munmap'
22079 d_mymalloc='$d_mymalloc'
22080 d_ndbm='$d_ndbm'
22081 d_nice='$d_nice'
22082 d_nl_langinfo='$d_nl_langinfo'
22083 d_nv_preserves_uv='$d_nv_preserves_uv'
22084 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
22085 d_off64_t='$d_off64_t'
22086 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
22087 d_oldpthreads='$d_oldpthreads'
22088 d_oldsock='$d_oldsock'
22089 d_open3='$d_open3'
22090 d_pathconf='$d_pathconf'
22091 d_pause='$d_pause'
22092 d_perl_otherlibdirs='$d_perl_otherlibdirs'
22093 d_phostname='$d_phostname'
22094 d_pipe='$d_pipe'
22095 d_poll='$d_poll'
22096 d_portable='$d_portable'
22097 d_printf_format_null='$d_printf_format_null'
22098 d_procselfexe='$d_procselfexe'
22099 d_pseudofork='$d_pseudofork'
22100 d_pthread_atfork='$d_pthread_atfork'
22101 d_pthread_attr_setscope='$d_pthread_attr_setscope'
22102 d_pthread_yield='$d_pthread_yield'
22103 d_pwage='$d_pwage'
22104 d_pwchange='$d_pwchange'
22105 d_pwclass='$d_pwclass'
22106 d_pwcomment='$d_pwcomment'
22107 d_pwexpire='$d_pwexpire'
22108 d_pwgecos='$d_pwgecos'
22109 d_pwpasswd='$d_pwpasswd'
22110 d_pwquota='$d_pwquota'
22111 d_qgcvt='$d_qgcvt'
22112 d_quad='$d_quad'
22113 d_random_r='$d_random_r'
22114 d_readdir64_r='$d_readdir64_r'
22115 d_readdir='$d_readdir'
22116 d_readdir_r='$d_readdir_r'
22117 d_readlink='$d_readlink'
22118 d_readv='$d_readv'
22119 d_recvmsg='$d_recvmsg'
22120 d_rename='$d_rename'
22121 d_rewinddir='$d_rewinddir'
22122 d_rmdir='$d_rmdir'
22123 d_safebcpy='$d_safebcpy'
22124 d_safemcpy='$d_safemcpy'
22125 d_sanemcmp='$d_sanemcmp'
22126 d_sbrkproto='$d_sbrkproto'
22127 d_scalbnl='$d_scalbnl'
22128 d_sched_yield='$d_sched_yield'
22129 d_scm_rights='$d_scm_rights'
22130 d_seekdir='$d_seekdir'
22131 d_select='$d_select'
22132 d_sem='$d_sem'
22133 d_semctl='$d_semctl'
22134 d_semctl_semid_ds='$d_semctl_semid_ds'
22135 d_semctl_semun='$d_semctl_semun'
22136 d_semget='$d_semget'
22137 d_semop='$d_semop'
22138 d_sendmsg='$d_sendmsg'
22139 d_setegid='$d_setegid'
22140 d_seteuid='$d_seteuid'
22141 d_setgrent='$d_setgrent'
22142 d_setgrent_r='$d_setgrent_r'
22143 d_setgrps='$d_setgrps'
22144 d_sethent='$d_sethent'
22145 d_sethostent_r='$d_sethostent_r'
22146 d_setitimer='$d_setitimer'
22147 d_setlinebuf='$d_setlinebuf'
22148 d_setlocale='$d_setlocale'
22149 d_setlocale_r='$d_setlocale_r'
22150 d_setnent='$d_setnent'
22151 d_setnetent_r='$d_setnetent_r'
22152 d_setpent='$d_setpent'
22153 d_setpgid='$d_setpgid'
22154 d_setpgrp2='$d_setpgrp2'
22155 d_setpgrp='$d_setpgrp'
22156 d_setprior='$d_setprior'
22157 d_setproctitle='$d_setproctitle'
22158 d_setprotoent_r='$d_setprotoent_r'
22159 d_setpwent='$d_setpwent'
22160 d_setpwent_r='$d_setpwent_r'
22161 d_setregid='$d_setregid'
22162 d_setresgid='$d_setresgid'
22163 d_setresuid='$d_setresuid'
22164 d_setreuid='$d_setreuid'
22165 d_setrgid='$d_setrgid'
22166 d_setruid='$d_setruid'
22167 d_setsent='$d_setsent'
22168 d_setservent_r='$d_setservent_r'
22169 d_setsid='$d_setsid'
22170 d_setvbuf='$d_setvbuf'
22171 d_sfio='$d_sfio'
22172 d_shm='$d_shm'
22173 d_shmat='$d_shmat'
22174 d_shmatprototype='$d_shmatprototype'
22175 d_shmctl='$d_shmctl'
22176 d_shmdt='$d_shmdt'
22177 d_shmget='$d_shmget'
22178 d_sigaction='$d_sigaction'
22179 d_signbit='$d_signbit'
22180 d_sigprocmask='$d_sigprocmask'
22181 d_sigsetjmp='$d_sigsetjmp'
22182 d_sitearch='$d_sitearch'
22183 d_snprintf='$d_snprintf'
22184 d_sockatmark='$d_sockatmark'
22185 d_sockatmarkproto='$d_sockatmarkproto'
22186 d_socket='$d_socket'
22187 d_socklen_t='$d_socklen_t'
22188 d_sockpair='$d_sockpair'
22189 d_socks5_init='$d_socks5_init'
22190 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
22191 d_sqrtl='$d_sqrtl'
22192 d_srand48_r='$d_srand48_r'
22193 d_srandom_r='$d_srandom_r'
22194 d_sresgproto='$d_sresgproto'
22195 d_sresuproto='$d_sresuproto'
22196 d_statblks='$d_statblks'
22197 d_statfs_f_flags='$d_statfs_f_flags'
22198 d_statfs_s='$d_statfs_s'
22199 d_statvfs='$d_statvfs'
22200 d_stdio_cnt_lval='$d_stdio_cnt_lval'
22201 d_stdio_ptr_lval='$d_stdio_ptr_lval'
22202 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
22203 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
22204 d_stdio_stream_array='$d_stdio_stream_array'
22205 d_stdiobase='$d_stdiobase'
22206 d_stdstdio='$d_stdstdio'
22207 d_strchr='$d_strchr'
22208 d_strcoll='$d_strcoll'
22209 d_strctcpy='$d_strctcpy'
22210 d_strerrm='$d_strerrm'
22211 d_strerror='$d_strerror'
22212 d_strerror_r='$d_strerror_r'
22213 d_strftime='$d_strftime'
22214 d_strlcat='$d_strlcat'
22215 d_strlcpy='$d_strlcpy'
22216 d_strtod='$d_strtod'
22217 d_strtol='$d_strtol'
22218 d_strtold='$d_strtold'
22219 d_strtoll='$d_strtoll'
22220 d_strtoq='$d_strtoq'
22221 d_strtoul='$d_strtoul'
22222 d_strtoull='$d_strtoull'
22223 d_strtouq='$d_strtouq'
22224 d_strxfrm='$d_strxfrm'
22225 d_suidsafe='$d_suidsafe'
22226 d_symlink='$d_symlink'
22227 d_syscall='$d_syscall'
22228 d_syscallproto='$d_syscallproto'
22229 d_sysconf='$d_sysconf'
22230 d_sysernlst='$d_sysernlst'
22231 d_syserrlst='$d_syserrlst'
22232 d_system='$d_system'
22233 d_tcgetpgrp='$d_tcgetpgrp'
22234 d_tcsetpgrp='$d_tcsetpgrp'
22235 d_telldir='$d_telldir'
22236 d_telldirproto='$d_telldirproto'
22237 d_time='$d_time'
22238 d_times='$d_times'
22239 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
22240 d_tm_tm_zone='$d_tm_tm_zone'
22241 d_tmpnam_r='$d_tmpnam_r'
22242 d_truncate='$d_truncate'
22243 d_ttyname_r='$d_ttyname_r'
22244 d_tzname='$d_tzname'
22245 d_u32align='$d_u32align'
22246 d_ualarm='$d_ualarm'
22247 d_umask='$d_umask'
22248 d_uname='$d_uname'
22249 d_union_semun='$d_union_semun'
22250 d_unordered='$d_unordered'
22251 d_unsetenv='$d_unsetenv'
22252 d_usleep='$d_usleep'
22253 d_usleepproto='$d_usleepproto'
22254 d_ustat='$d_ustat'
22255 d_vendorarch='$d_vendorarch'
22256 d_vendorbin='$d_vendorbin'
22257 d_vendorlib='$d_vendorlib'
22258 d_vendorscript='$d_vendorscript'
22259 d_vfork='$d_vfork'
22260 d_void_closedir='$d_void_closedir'
22261 d_voidsig='$d_voidsig'
22262 d_voidtty='$d_voidtty'
22263 d_volatile='$d_volatile'
22264 d_vprintf='$d_vprintf'
22265 d_vsnprintf='$d_vsnprintf'
22266 d_wait4='$d_wait4'
22267 d_waitpid='$d_waitpid'
22268 d_wcstombs='$d_wcstombs'
22269 d_wctomb='$d_wctomb'
22270 d_writev='$d_writev'
22271 d_xenix='$d_xenix'
22272 date='$date'
22273 db_hashtype='$db_hashtype'
22274 db_prefixtype='$db_prefixtype'
22275 db_version_major='$db_version_major'
22276 db_version_minor='$db_version_minor'
22277 db_version_patch='$db_version_patch'
22278 defvoidused='$defvoidused'
22279 direntrytype='$direntrytype'
22280 dlext='$dlext'
22281 dlsrc='$dlsrc'
22282 doublesize='$doublesize'
22283 drand01='$drand01'
22284 drand48_r_proto='$drand48_r_proto'
22285 dtrace='$dtrace'
22286 dynamic_ext='$dynamic_ext'
22287 eagain='$eagain'
22288 ebcdic='$ebcdic'
22289 echo='$echo'
22290 egrep='$egrep'
22291 emacs='$emacs'
22292 endgrent_r_proto='$endgrent_r_proto'
22293 endhostent_r_proto='$endhostent_r_proto'
22294 endnetent_r_proto='$endnetent_r_proto'
22295 endprotoent_r_proto='$endprotoent_r_proto'
22296 endpwent_r_proto='$endpwent_r_proto'
22297 endservent_r_proto='$endservent_r_proto'
22298 eunicefix='$eunicefix'
22299 exe_ext='$exe_ext'
22300 expr='$expr'
22301 extensions='$extensions'
22302 extras='$extras'
22303 fflushNULL='$fflushNULL'
22304 fflushall='$fflushall'
22305 find='$find'
22306 firstmakefile='$firstmakefile'
22307 flex='$flex'
22308 fpossize='$fpossize'
22309 fpostype='$fpostype'
22310 freetype='$freetype'
22311 from='$from'
22312 full_ar='$full_ar'
22313 full_csh='$full_csh'
22314 full_sed='$full_sed'
22315 gccansipedantic='$gccansipedantic'
22316 gccosandvers='$gccosandvers'
22317 gccversion='$gccversion'
22318 getgrent_r_proto='$getgrent_r_proto'
22319 getgrgid_r_proto='$getgrgid_r_proto'
22320 getgrnam_r_proto='$getgrnam_r_proto'
22321 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22322 gethostbyname_r_proto='$gethostbyname_r_proto'
22323 gethostent_r_proto='$gethostent_r_proto'
22324 getlogin_r_proto='$getlogin_r_proto'
22325 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22326 getnetbyname_r_proto='$getnetbyname_r_proto'
22327 getnetent_r_proto='$getnetent_r_proto'
22328 getprotobyname_r_proto='$getprotobyname_r_proto'
22329 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22330 getprotoent_r_proto='$getprotoent_r_proto'
22331 getpwent_r_proto='$getpwent_r_proto'
22332 getpwnam_r_proto='$getpwnam_r_proto'
22333 getpwuid_r_proto='$getpwuid_r_proto'
22334 getservbyname_r_proto='$getservbyname_r_proto'
22335 getservbyport_r_proto='$getservbyport_r_proto'
22336 getservent_r_proto='$getservent_r_proto'
22337 getspnam_r_proto='$getspnam_r_proto'
22338 gidformat='$gidformat'
22339 gidsign='$gidsign'
22340 gidsize='$gidsize'
22341 gidtype='$gidtype'
22342 glibpth='$glibpth'
22343 gmake='$gmake'
22344 gmtime_r_proto='$gmtime_r_proto'
22345 gnulibc_version='$gnulibc_version'
22346 grep='$grep'
22347 groupcat='$groupcat'
22348 groupstype='$groupstype'
22349 gzip='$gzip'
22350 h_fcntl='$h_fcntl'
22351 h_sysfile='$h_sysfile'
22352 hint='$hint'
22353 hostcat='$hostcat'
22354 html1dir='$html1dir'
22355 html1direxp='$html1direxp'
22356 html3dir='$html3dir'
22357 html3direxp='$html3direxp'
22358 i16size='$i16size'
22359 i16type='$i16type'
22360 i32size='$i32size'
22361 i32type='$i32type'
22362 i64size='$i64size'
22363 i64type='$i64type'
22364 i8size='$i8size'
22365 i8type='$i8type'
22366 i_arpainet='$i_arpainet'
22367 i_assert='$i_assert'
22368 i_bsdioctl='$i_bsdioctl'
22369 i_crypt='$i_crypt'
22370 i_db='$i_db'
22371 i_dbm='$i_dbm'
22372 i_dirent='$i_dirent'
22373 i_dld='$i_dld'
22374 i_dlfcn='$i_dlfcn'
22375 i_fcntl='$i_fcntl'
22376 i_float='$i_float'
22377 i_fp='$i_fp'
22378 i_fp_class='$i_fp_class'
22379 i_gdbm='$i_gdbm'
22380 i_gdbm_ndbm='$i_gdbm_ndbm'
22381 i_gdbmndbm='$i_gdbmndbm'
22382 i_grp='$i_grp'
22383 i_ieeefp='$i_ieeefp'
22384 i_inttypes='$i_inttypes'
22385 i_langinfo='$i_langinfo'
22386 i_libutil='$i_libutil'
22387 i_limits='$i_limits'
22388 i_locale='$i_locale'
22389 i_machcthr='$i_machcthr'
22390 i_malloc='$i_malloc'
22391 i_mallocmalloc='$i_mallocmalloc'
22392 i_math='$i_math'
22393 i_memory='$i_memory'
22394 i_mntent='$i_mntent'
22395 i_ndbm='$i_ndbm'
22396 i_netdb='$i_netdb'
22397 i_neterrno='$i_neterrno'
22398 i_netinettcp='$i_netinettcp'
22399 i_niin='$i_niin'
22400 i_poll='$i_poll'
22401 i_prot='$i_prot'
22402 i_pthread='$i_pthread'
22403 i_pwd='$i_pwd'
22404 i_rpcsvcdbm='$i_rpcsvcdbm'
22405 i_sfio='$i_sfio'
22406 i_sgtty='$i_sgtty'
22407 i_shadow='$i_shadow'
22408 i_socks='$i_socks'
22409 i_stdarg='$i_stdarg'
22410 i_stddef='$i_stddef'
22411 i_stdlib='$i_stdlib'
22412 i_string='$i_string'
22413 i_sunmath='$i_sunmath'
22414 i_sysaccess='$i_sysaccess'
22415 i_sysdir='$i_sysdir'
22416 i_sysfile='$i_sysfile'
22417 i_sysfilio='$i_sysfilio'
22418 i_sysin='$i_sysin'
22419 i_sysioctl='$i_sysioctl'
22420 i_syslog='$i_syslog'
22421 i_sysmman='$i_sysmman'
22422 i_sysmode='$i_sysmode'
22423 i_sysmount='$i_sysmount'
22424 i_sysndir='$i_sysndir'
22425 i_sysparam='$i_sysparam'
22426 i_syspoll='$i_syspoll'
22427 i_sysresrc='$i_sysresrc'
22428 i_syssecrt='$i_syssecrt'
22429 i_sysselct='$i_sysselct'
22430 i_syssockio='$i_syssockio'
22431 i_sysstat='$i_sysstat'
22432 i_sysstatfs='$i_sysstatfs'
22433 i_sysstatvfs='$i_sysstatvfs'
22434 i_systime='$i_systime'
22435 i_systimek='$i_systimek'
22436 i_systimes='$i_systimes'
22437 i_systypes='$i_systypes'
22438 i_sysuio='$i_sysuio'
22439 i_sysun='$i_sysun'
22440 i_sysutsname='$i_sysutsname'
22441 i_sysvfs='$i_sysvfs'
22442 i_syswait='$i_syswait'
22443 i_termio='$i_termio'
22444 i_termios='$i_termios'
22445 i_time='$i_time'
22446 i_unistd='$i_unistd'
22447 i_ustat='$i_ustat'
22448 i_utime='$i_utime'
22449 i_values='$i_values'
22450 i_varargs='$i_varargs'
22451 i_varhdr='$i_varhdr'
22452 i_vfork='$i_vfork'
22453 ignore_versioned_solibs='$ignore_versioned_solibs'
22454 inc_version_list='$inc_version_list'
22455 inc_version_list_init='$inc_version_list_init'
22456 incpath='$incpath'
22457 inews='$inews'
22458 initialinstalllocation='$initialinstalllocation'
22459 installarchlib='$installarchlib'
22460 installbin='$installbin'
22461 installhtml1dir='$installhtml1dir'
22462 installhtml3dir='$installhtml3dir'
22463 installman1dir='$installman1dir'
22464 installman3dir='$installman3dir'
22465 installprefix='$installprefix'
22466 installprefixexp='$installprefixexp'
22467 installprivlib='$installprivlib'
22468 installscript='$installscript'
22469 installsitearch='$installsitearch'
22470 installsitebin='$installsitebin'
22471 installsitehtml1dir='$installsitehtml1dir'
22472 installsitehtml3dir='$installsitehtml3dir'
22473 installsitelib='$installsitelib'
22474 installsiteman1dir='$installsiteman1dir'
22475 installsiteman3dir='$installsiteman3dir'
22476 installsitescript='$installsitescript'
22477 installstyle='$installstyle'
22478 installusrbinperl='$installusrbinperl'
22479 installvendorarch='$installvendorarch'
22480 installvendorbin='$installvendorbin'
22481 installvendorhtml1dir='$installvendorhtml1dir'
22482 installvendorhtml3dir='$installvendorhtml3dir'
22483 installvendorlib='$installvendorlib'
22484 installvendorman1dir='$installvendorman1dir'
22485 installvendorman3dir='$installvendorman3dir'
22486 installvendorscript='$installvendorscript'
22487 intsize='$intsize'
22488 issymlink='$issymlink'
22489 ivdformat='$ivdformat'
22490 ivsize='$ivsize'
22491 ivtype='$ivtype'
22492 known_extensions='$known_extensions'
22493 ksh='$ksh'
22494 ld='$ld'
22495 lddlflags='$lddlflags'
22496 ldflags='$ldflags'
22497 ldflags_uselargefiles='$ldflags_uselargefiles'
22498 ldlibpthname='$ldlibpthname'
22499 less='$less'
22500 lib_ext='$lib_ext'
22501 libc='$libc'
22502 libperl='$libperl'
22503 libpth='$libpth'
22504 libs='$libs'
22505 libsdirs='$libsdirs'
22506 libsfiles='$libsfiles'
22507 libsfound='$libsfound'
22508 libspath='$libspath'
22509 libswanted='$libswanted'
22510 libswanted_uselargefiles='$libswanted_uselargefiles'
22511 line='$line'
22512 lint='$lint'
22513 lkflags='$lkflags'
22514 ln='$ln'
22515 lns='$lns'
22516 localtime_r_proto='$localtime_r_proto'
22517 locincpth='$locincpth'
22518 loclibpth='$loclibpth'
22519 longdblsize='$longdblsize'
22520 longlongsize='$longlongsize'
22521 longsize='$longsize'
22522 lp='$lp'
22523 lpr='$lpr'
22524 ls='$ls'
22525 lseeksize='$lseeksize'
22526 lseektype='$lseektype'
22527 mad='$mad'
22528 madlyh='$madlyh'
22529 madlyobj='$madlyobj'
22530 madlysrc='$madlysrc'
22531 mail='$mail'
22532 mailx='$mailx'
22533 make='$make'
22534 make_set_make='$make_set_make'
22535 mallocobj='$mallocobj'
22536 mallocsrc='$mallocsrc'
22537 malloctype='$malloctype'
22538 man1dir='$man1dir'
22539 man1direxp='$man1direxp'
22540 man1ext='$man1ext'
22541 man3dir='$man3dir'
22542 man3direxp='$man3direxp'
22543 man3ext='$man3ext'
22544 mips_type='$mips_type'
22545 mistrustnm='$mistrustnm'
22546 mkdir='$mkdir'
22547 mmaptype='$mmaptype'
22548 modetype='$modetype'
22549 more='$more'
22550 multiarch='$multiarch'
22551 mv='$mv'
22552 myarchname='$myarchname'
22553 mydomain='$mydomain'
22554 myhostname='$myhostname'
22555 myuname='$myuname'
22556 n='$n'
22557 need_va_copy='$need_va_copy'
22558 netdb_hlen_type='$netdb_hlen_type'
22559 netdb_host_type='$netdb_host_type'
22560 netdb_name_type='$netdb_name_type'
22561 netdb_net_type='$netdb_net_type'
22562 nm='$nm'
22563 nm_opt='$nm_opt'
22564 nm_so_opt='$nm_so_opt'
22565 nonxs_ext='$nonxs_ext'
22566 nroff='$nroff'
22567 nvEUformat='$nvEUformat'
22568 nvFUformat='$nvFUformat'
22569 nvGUformat='$nvGUformat'
22570 nv_overflows_integers_at='$nv_overflows_integers_at'
22571 nv_preserves_uv_bits='$nv_preserves_uv_bits'
22572 nveformat='$nveformat'
22573 nvfformat='$nvfformat'
22574 nvgformat='$nvgformat'
22575 nvsize='$nvsize'
22576 nvtype='$nvtype'
22577 o_nonblock='$o_nonblock'
22578 obj_ext='$obj_ext'
22579 old_pthread_create_joinable='$old_pthread_create_joinable'
22580 optimize='$optimize'
22581 orderlib='$orderlib'
22582 osname='$osname'
22583 osvers='$osvers'
22584 otherlibdirs='$otherlibdirs'
22585 package='$package'
22586 pager='$pager'
22587 passcat='$passcat'
22588 patchlevel='$patchlevel'
22589 path_sep='$path_sep'
22590 perl5='$perl5'
22591 perl='$perl'
22592 perl_patchlevel='$perl_patchlevel'
22593 perladmin='$perladmin'
22594 perllibs='$perllibs'
22595 perlpath='$perlpath'
22596 pg='$pg'
22597 phostname='$phostname'
22598 pidtype='$pidtype'
22599 plibpth='$plibpth'
22600 pmake='$pmake'
22601 pr='$pr'
22602 prefix='$prefix'
22603 prefixexp='$prefixexp'
22604 privlib='$privlib'
22605 privlibexp='$privlibexp'
22606 procselfexe='$procselfexe'
22607 prototype='$prototype'
22608 ptrsize='$ptrsize'
22609 quadkind='$quadkind'
22610 quadtype='$quadtype'
22611 randbits='$randbits'
22612 randfunc='$randfunc'
22613 random_r_proto='$random_r_proto'
22614 randseedtype='$randseedtype'
22615 ranlib='$ranlib'
22616 rd_nodata='$rd_nodata'
22617 readdir64_r_proto='$readdir64_r_proto'
22618 readdir_r_proto='$readdir_r_proto'
22619 revision='$revision'
22620 rm='$rm'
22621 rm_try='$rm_try'
22622 rmail='$rmail'
22623 run='$run'
22624 runnm='$runnm'
22625 sPRIEUldbl='$sPRIEUldbl'
22626 sPRIFUldbl='$sPRIFUldbl'
22627 sPRIGUldbl='$sPRIGUldbl'
22628 sPRIXU64='$sPRIXU64'
22629 sPRId64='$sPRId64'
22630 sPRIeldbl='$sPRIeldbl'
22631 sPRIfldbl='$sPRIfldbl'
22632 sPRIgldbl='$sPRIgldbl'
22633 sPRIi64='$sPRIi64'
22634 sPRIo64='$sPRIo64'
22635 sPRIu64='$sPRIu64'
22636 sPRIx64='$sPRIx64'
22637 sSCNfldbl='$sSCNfldbl'
22638 sched_yield='$sched_yield'
22639 scriptdir='$scriptdir'
22640 scriptdirexp='$scriptdirexp'
22641 sed='$sed'
22642 seedfunc='$seedfunc'
22643 selectminbits='$selectminbits'
22644 selecttype='$selecttype'
22645 sendmail='$sendmail'
22646 setgrent_r_proto='$setgrent_r_proto'
22647 sethostent_r_proto='$sethostent_r_proto'
22648 setlocale_r_proto='$setlocale_r_proto'
22649 setnetent_r_proto='$setnetent_r_proto'
22650 setprotoent_r_proto='$setprotoent_r_proto'
22651 setpwent_r_proto='$setpwent_r_proto'
22652 setservent_r_proto='$setservent_r_proto'
22653 sh='$sh'
22654 shar='$shar'
22655 sharpbang='$sharpbang'
22656 shmattype='$shmattype'
22657 shortsize='$shortsize'
22658 shrpenv='$shrpenv'
22659 shsharp='$shsharp'
22660 sig_count='$sig_count'
22661 sig_name='$sig_name'
22662 sig_name_init='$sig_name_init'
22663 sig_num='$sig_num'
22664 sig_num_init='$sig_num_init'
22665 sig_size='$sig_size'
22666 signal_t='$signal_t'
22667 sitearch='$sitearch'
22668 sitearchexp='$sitearchexp'
22669 sitebin='$sitebin'
22670 sitebinexp='$sitebinexp'
22671 sitehtml1dir='$sitehtml1dir'
22672 sitehtml1direxp='$sitehtml1direxp'
22673 sitehtml3dir='$sitehtml3dir'
22674 sitehtml3direxp='$sitehtml3direxp'
22675 sitelib='$sitelib'
22676 sitelib_stem='$sitelib_stem'
22677 sitelibexp='$sitelibexp'
22678 siteman1dir='$siteman1dir'
22679 siteman1direxp='$siteman1direxp'
22680 siteman3dir='$siteman3dir'
22681 siteman3direxp='$siteman3direxp'
22682 siteprefix='$siteprefix'
22683 siteprefixexp='$siteprefixexp'
22684 sitescript='$sitescript'
22685 sitescriptexp='$sitescriptexp'
22686 sizesize='$sizesize'
22687 sizetype='$sizetype'
22688 sleep='$sleep'
22689 smail='$smail'
22690 so='$so'
22691 sockethdr='$sockethdr'
22692 socketlib='$socketlib'
22693 socksizetype='$socksizetype'
22694 sort='$sort'
22695 spackage='$spackage'
22696 spitshell='$spitshell'
22697 srand48_r_proto='$srand48_r_proto'
22698 srandom_r_proto='$srandom_r_proto'
22699 src='$src'
22700 ssizetype='$ssizetype'
22701 startperl='$startperl'
22702 startsh='$startsh'
22703 static_ext='$static_ext'
22704 stdchar='$stdchar'
22705 stdio_base='$stdio_base'
22706 stdio_bufsiz='$stdio_bufsiz'
22707 stdio_cnt='$stdio_cnt'
22708 stdio_filbuf='$stdio_filbuf'
22709 stdio_ptr='$stdio_ptr'
22710 stdio_stream_array='$stdio_stream_array'
22711 strerror_r_proto='$strerror_r_proto'
22712 strings='$strings'
22713 submit='$submit'
22714 subversion='$subversion'
22715 sysman='$sysman'
22716 tail='$tail'
22717 tar='$tar'
22718 targetarch='$targetarch'
22719 tbl='$tbl'
22720 tee='$tee'
22721 test='$test'
22722 timeincl='$timeincl'
22723 timetype='$timetype'
22724 tmpnam_r_proto='$tmpnam_r_proto'
22725 to='$to'
22726 touch='$touch'
22727 tr='$tr'
22728 trnl='$trnl'
22729 troff='$troff'
22730 ttyname_r_proto='$ttyname_r_proto'
22731 u16size='$u16size'
22732 u16type='$u16type'
22733 u32size='$u32size'
22734 u32type='$u32type'
22735 u64size='$u64size'
22736 u64type='$u64type'
22737 u8size='$u8size'
22738 u8type='$u8type'
22739 uidformat='$uidformat'
22740 uidsign='$uidsign'
22741 uidsize='$uidsize'
22742 uidtype='$uidtype'
22743 uname='$uname'
22744 uniq='$uniq'
22745 uquadtype='$uquadtype'
22746 use5005threads='$use5005threads'
22747 use64bitall='$use64bitall'
22748 use64bitint='$use64bitint'
22749 usecrosscompile='$usecrosscompile'
22750 usedl='$usedl'
22751 usedtrace='$usedtrace'
22752 usefaststdio='$usefaststdio'
22753 useithreads='$useithreads'
22754 uselargefiles='$uselargefiles'
22755 uselongdouble='$uselongdouble'
22756 usemallocwrap='$usemallocwrap'
22757 usemorebits='$usemorebits'
22758 usemultiplicity='$usemultiplicity'
22759 usemymalloc='$usemymalloc'
22760 usenm='$usenm'
22761 useopcode='$useopcode'
22762 useperlio='$useperlio'
22763 useposix='$useposix'
22764 usereentrant='$usereentrant'
22765 userelocatableinc='$userelocatableinc'
22766 usesfio='$usesfio'
22767 useshrplib='$useshrplib'
22768 usesitecustomize='$usesitecustomize'
22769 usesocks='$usesocks'
22770 usethreads='$usethreads'
22771 usevendorprefix='$usevendorprefix'
22772 usevfork='$usevfork'
22773 usrinc='$usrinc'
22774 uuname='$uuname'
22775 uvXUformat='$uvXUformat'
22776 uvoformat='$uvoformat'
22777 uvsize='$uvsize'
22778 uvtype='$uvtype'
22779 uvuformat='$uvuformat'
22780 uvxformat='$uvxformat'
22781 vendorarch='$vendorarch'
22782 vendorarchexp='$vendorarchexp'
22783 vendorbin='$vendorbin'
22784 vendorbinexp='$vendorbinexp'
22785 vendorhtml1dir='$vendorhtml1dir'
22786 vendorhtml1direxp='$vendorhtml1direxp'
22787 vendorhtml3dir='$vendorhtml3dir'
22788 vendorhtml3direxp='$vendorhtml3direxp'
22789 vendorlib='$vendorlib'
22790 vendorlib_stem='$vendorlib_stem'
22791 vendorlibexp='$vendorlibexp'
22792 vendorman1dir='$vendorman1dir'
22793 vendorman1direxp='$vendorman1direxp'
22794 vendorman3dir='$vendorman3dir'
22795 vendorman3direxp='$vendorman3direxp'
22796 vendorprefix='$vendorprefix'
22797 vendorprefixexp='$vendorprefixexp'
22798 vendorscript='$vendorscript'
22799 vendorscriptexp='$vendorscriptexp'
22800 version='$version'
22801 version_patchlevel_string='$version_patchlevel_string'
22802 versiononly='$versiononly'
22803 vi='$vi'
22804 voidflags='$voidflags'
22805 xlibpth='$xlibpth'
22806 yacc='$yacc'
22807 yaccflags='$yaccflags'
22808 zcat='$zcat'
22809 zip='$zip'
22810 EOT
22811
22812 : Add in command line options if available
22813 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22814
22815 : add special variables
22816 $test -f $src/patchlevel.h && \
22817 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22818 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22819 echo "PERL_CONFIG_SH=true" >>config.sh
22820
22821 : propagate old symbols
22822 if $test -f UU/config.sh; then
22823         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22824         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
22825                 config.sh config.sh UU/oldconfig.sh |\
22826                 $sort | $uniq -u >UU/oldsyms
22827         set X `cat UU/oldsyms`
22828         shift
22829         case $# in
22830         0) ;;
22831         *)
22832                 cat <<EOM
22833 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22834 EOM
22835                 echo ": Variables propagated from previous config.sh file." >>config.sh
22836                 for sym in `cat UU/oldsyms`; do
22837                         echo "    Propagating $hint variable "'$'"$sym..."
22838                         eval 'tmp="$'"${sym}"'"'
22839                         echo "$tmp" | \
22840                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22841                 done
22842                 ;;
22843         esac
22844 fi
22845
22846 : Finish up by extracting the .SH files
22847 case "$alldone" in
22848 exit)
22849         $rm -rf UU
22850         echo "Extraction done."
22851         exit 0
22852         ;;
22853 cont)
22854         ;;
22855 '')
22856         dflt=''
22857         nostick=true
22858         $cat <<EOM
22859
22860 If you'd like to make any changes to the config.sh file before I begin
22861 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22862
22863 EOM
22864         rp="Press return or use a shell escape to edit config.sh:"
22865         . UU/myread
22866         nostick=''
22867         case "$ans" in
22868         '') ;;
22869         *) : in case they cannot read
22870                 sh 1>&4 -c "$ans";;
22871         esac
22872         ;;
22873 esac
22874
22875 : if this fails, just run all the .SH files by hand
22876 . ./config.sh
22877
22878 echo " "
22879 exec 1>&4
22880 pwd=`pwd`
22881 . ./UU/extract
22882 cd "$pwd"
22883
22884 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22885         dflt=y
22886         case "$silent" in
22887         true) ;;
22888         *)
22889                 $cat <<EOM
22890
22891 Now you need to generate make dependencies by running "$make depend".
22892 You might prefer to run it in background: "$make depend > makedepend.out &"
22893 It can take a while, so you might not want to run it right now.
22894
22895 EOM
22896                 ;;
22897         esac
22898         rp="Run $make depend now?"
22899         . UU/myread
22900         case "$ans" in
22901         y*)
22902                 $make depend && echo "Now you must run '$make'."
22903                 ;;
22904         *)
22905                 echo "You must run '$make depend' then '$make'."
22906                 ;;
22907         esac
22908 elif test -f [Mm]akefile; then
22909         echo " "
22910         echo "Now you must run a $make."
22911 else
22912         echo "Configure done."
22913 fi
22914
22915 if $test -f Policy.sh; then
22916     $cat <<EOM
22917
22918 If you compile $package on a different machine or from a different object
22919 directory, copy the Policy.sh file from this object directory to the
22920 new one before you run Configure -- this will help you with most of
22921 the policy defaults.
22922
22923 EOM
22924 fi
22925 if $test -f config.msg; then
22926     echo "Hmm.  I also noted the following information while running:"
22927     echo " "
22928     $cat config.msg >&4
22929     $rm -f config.msg
22930 fi
22931 $rm -f kit*isdone ark*isdone
22932 $rm -rf UU
22933
22934 : End of Configure
22935