bce1daa74da7545310ecba67ad47b5dbfd224c22
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist package (which contains metaconfig) is available via SVN:
17 #     svn co https://svn.sourceforge.net/svnroot/dist/trunk/dist
18 #
19 #
20 # Though this script was generated by metaconfig, it is OK to send
21 # patches against it. It's up to the Configure pumpkin to backport
22 # the patch to the metaunits if it is accepted.
23 # See Porting/pumpkin.pod for more information on metaconfig.
24 #
25
26 # $Id: Head.U 6 2006-08-25 22:21:46Z rmanfredi $
27 #
28 # Generated on Mon Jul  7 21:59:59 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 sGMTIME_max=''
1175 sGMTIME_min=''
1176 trnl=''
1177 uidformat=''
1178 uidsign=''
1179 uidsize=''
1180 uidtype=''
1181 archname64=''
1182 use64bitall=''
1183 use64bitint=''
1184 dtrace=''
1185 usedtrace=''
1186 usefaststdio=''
1187 ccflags_uselargefiles=''
1188 ldflags_uselargefiles=''
1189 libswanted_uselargefiles=''
1190 uselargefiles=''
1191 uselongdouble=''
1192 usemorebits=''
1193 usemultiplicity=''
1194 nm_opt=''
1195 nm_so_opt=''
1196 runnm=''
1197 usenm=''
1198 useperlio=''
1199 usesocks=''
1200 d_oldpthreads=''
1201 use5005threads=''
1202 useithreads=''
1203 usereentrant=''
1204 usethreads=''
1205 incpath=''
1206 mips_type=''
1207 usrinc=''
1208 d_vendorarch=''
1209 installvendorarch=''
1210 vendorarch=''
1211 vendorarchexp=''
1212 d_vendorbin=''
1213 installvendorbin=''
1214 vendorbin=''
1215 vendorbinexp=''
1216 installvendorhtml1dir=''
1217 vendorhtml1dir=''
1218 vendorhtml1direxp=''
1219 installvendorhtml3dir=''
1220 vendorhtml3dir=''
1221 vendorhtml3direxp=''
1222 d_vendorlib=''
1223 installvendorlib=''
1224 vendorlib=''
1225 vendorlib_stem=''
1226 vendorlibexp=''
1227 installvendorman1dir=''
1228 vendorman1dir=''
1229 vendorman1direxp=''
1230 installvendorman3dir=''
1231 vendorman3dir=''
1232 vendorman3direxp=''
1233 usevendorprefix=''
1234 vendorprefix=''
1235 vendorprefixexp=''
1236 d_vendorscript=''
1237 installvendorscript=''
1238 vendorscript=''
1239 vendorscriptexp=''
1240 versiononly=''
1241 defvoidused=''
1242 voidflags=''
1243 yacc=''
1244 yaccflags=''
1245 CONFIG=''
1246
1247 : Detect odd OSs
1248 define='define'
1249 undef='undef'
1250 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1251 rmlist=''
1252
1253 : We must find out about Eunice early
1254 eunicefix=':'
1255 if test -f /etc/unixtovms; then
1256         eunicefix=/etc/unixtovms
1257 fi
1258 if test -f /etc/unixtovms.exe; then
1259         eunicefix=/etc/unixtovms.exe
1260 fi
1261
1262 : Set executable suffix now -- needed before hints available
1263 if test -f "/libs/version.library"; then
1264 : Amiga OS
1265     _exe=""
1266 elif test -f "/system/gnu_library/bin/ar.pm"; then
1267 : Stratus VOS
1268     _exe=".pm"
1269 elif test -n "$DJGPP"; then
1270 : DOS DJGPP
1271     _exe=".exe"
1272 elif test -d c:/. -o -n "$is_os2" ; then
1273 : OS/2 or cygwin
1274     _exe=".exe"
1275 fi
1276
1277 groupstype=''
1278 i_whoami=''
1279 : Trailing extension.  Override this in a hint file, if needed.
1280 : Extra object files, if any, needed on this platform.
1281 archobjs=''
1282 archname=''
1283 libnames=''
1284 : change the next line if compiling for Xenix/286 on Xenix/386
1285 xlibpth='/usr/lib/386 /lib/386'
1286 : Possible local library directories to search.
1287 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1288 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1289
1290 : general looking path for locating libraries
1291 glibpth="/lib /usr/lib $xlibpth"
1292 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1293 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1294 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1295 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1296
1297 : Private path used by Configure to find libraries.  Its value
1298 : is prepended to libpth. This variable takes care of special
1299 : machines, like the mips.  Usually, it should be empty.
1300 plibpth=''
1301
1302 : default library list
1303 libswanted=''
1304 : some systems want to use only the non-versioned libso:s
1305 ignore_versioned_solibs=''
1306 : set usethreads on the Configure command line to enable threads.
1307 usereentrant='undef'
1308 : full support for void wanted by default
1309 defvoidused=15
1310
1311 : Possible local include directories to search.
1312 : Set locincpth to "" in a hint file to defeat local include searches.
1313 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1314 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1315 :
1316 : no include file wanted by default
1317 inclwanted=''
1318
1319 : Enable -DEBUGGING and -DDEBUGGING from the command line
1320 EBUGGING=''
1321 DEBUGGING=old
1322
1323 ccname=''
1324 ccversion=''
1325 perllibs=''
1326 : set useposix=false in your hint file to disable the POSIX extension.
1327 useposix=true
1328 : set useopcode=false in your hint file to disable the Opcode extension.
1329 useopcode=true
1330 archname64=''
1331 ccflags_uselargefiles=''
1332 ldflags_uselargefiles=''
1333 libswanted_uselargefiles=''
1334 : set usemultiplicity on the Configure command line to enable multiplicity.
1335 : set usesocks on the Configure command line to enable socks.
1336 : List of libraries we want.
1337 : If anyone needs extra -lxxx, put those in a hint file.
1338 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1339 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1340 : We probably want to search /usr/shlib before most other libraries.
1341 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1342 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1343 glibpth="/usr/shlib $glibpth"
1344 : Do not use vfork unless overridden by a hint file.
1345 usevfork=false
1346
1347 : Find the basic shell for Bourne shell scripts
1348 case "$sh" in
1349 '')
1350         case "$SYSTYPE" in
1351         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1352         *) xxx='/bin/sh';;
1353         esac
1354         if test -f "$xxx"; then
1355                 sh="$xxx"
1356         else
1357                 : Build up a list and do a single loop so we can 'break' out.
1358                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1359                 for xxx in sh bash ksh pdksh ash; do
1360                         for p in $pth; do
1361                                 try="$try ${p}/${xxx}"
1362                         done
1363                 done
1364                 for xxx in $try; do
1365                         if test -f "$xxx"; then
1366                                 sh="$xxx";
1367                                 break
1368                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1369                                 sh="$xxx";
1370                                 break
1371                         elif test -f "$xxx.exe"; then
1372                                 sh="$xxx";
1373                                 break
1374                         fi
1375                 done
1376         fi
1377         ;;
1378 esac
1379
1380 case "$sh" in
1381 '')     cat >&2 <<EOM
1382 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1383
1384 Usually it's in /bin/sh.  How did you even get this far?
1385 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1386 we'll try to straighten this all out.
1387 EOM
1388         exit 1
1389         ;;
1390 esac
1391
1392 : see if sh knows # comments
1393 if `$sh -c '#' >/dev/null 2>&1`; then
1394         shsharp=true
1395         spitshell=cat
1396         xcat=/bin/cat
1397         test -f $xcat$_exe || xcat=/usr/bin/cat
1398         if test ! -f $xcat$_exe; then
1399                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1400                         if test -f $p/cat$_exe; then
1401                                 xcat=$p/cat
1402                                 break
1403                         fi
1404                 done
1405                 if test ! -f $xcat$_exe; then
1406                         echo "Can't find cat anywhere!"
1407                         exit 1
1408                 fi
1409         fi
1410         echo "#!$xcat" >sharp
1411         $eunicefix sharp
1412         chmod +x sharp
1413         ./sharp > today 2>/dev/null
1414         if test -s today; then
1415                 sharpbang='#!'
1416         else
1417                 echo "#! $xcat" > sharp
1418                 $eunicefix sharp
1419                 chmod +x sharp
1420                 ./sharp > today 2>/dev/null
1421                 if test -s today; then
1422                         sharpbang='#! '
1423                 else
1424                         sharpbang=': use '
1425                 fi
1426         fi
1427 else
1428         echo " "
1429         echo "Your $sh doesn't grok # comments--I will strip them later on."
1430         shsharp=false
1431         cd ..
1432         echo "exec grep -v '^[  ]*#'" >spitshell
1433         chmod +x spitshell
1434         $eunicefix spitshell
1435         spitshell=`pwd`/spitshell
1436         cd UU
1437         echo "I presume that if # doesn't work, #! won't work either!"
1438         sharpbang=': use '
1439 fi
1440 rm -f sharp today
1441
1442 : figure out how to guarantee sh startup
1443 case "$startsh" in
1444 '') startsh=${sharpbang}${sh} ;;
1445 *)
1446 esac
1447 cat >sharp <<EOSS
1448 $startsh
1449 set abc
1450 test "$?abc" != 1
1451 EOSS
1452
1453 chmod +x sharp
1454 $eunicefix sharp
1455 if ./sharp; then
1456         : echo "Yup, it does."
1457 else
1458         echo "Hmm... '$startsh' does not guarantee sh startup..."
1459         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1460 fi
1461 rm -f sharp
1462
1463 : Save command line options in file UU/cmdline.opt for later use in
1464 : generating config.sh.
1465 cat > cmdline.opt <<EOSH
1466 : Configure command line arguments.
1467 config_arg0='$0'
1468 config_args='$*'
1469 config_argc=$#
1470 EOSH
1471 argn=1
1472 args_exp=''
1473 args_sep=''
1474 for arg in "$@"; do
1475         cat >>cmdline.opt <<EOSH
1476 config_arg$argn='$arg'
1477 EOSH
1478         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1479 $arg
1480 EOC
1481         arg_exp=`cat cmdl.opt`
1482         args_exp="$args_exp$args_sep'$arg_exp'"
1483         argn=`expr $argn + 1`
1484         args_sep=' '
1485 done
1486 rm -f cmdl.opt
1487
1488 : produce awk script to parse command line options
1489 cat >options.awk <<'EOF'
1490 BEGIN {
1491         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1492
1493         len = length(optstr);
1494         for (i = 1; i <= len; i++) {
1495                 c = substr(optstr, i, 1);
1496                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1497                 if (a == ":") {
1498                         arg[c] = 1;
1499                         i++;
1500                 }
1501                 opt[c] = 1;
1502         }
1503 }
1504 {
1505         expect = 0;
1506         str = $0;
1507         if (substr(str, 1, 1) != "-") {
1508                 printf("'%s'\n", str);
1509                 next;
1510         }
1511         len = length($0);
1512         for (i = 2; i <= len; i++) {
1513                 c = substr(str, i, 1);
1514                 if (!opt[c]) {
1515                         printf("-%s\n", substr(str, i));
1516                         next;
1517                 }
1518                 printf("-%s\n", c);
1519                 if (arg[c]) {
1520                         if (i < len)
1521                                 printf("'%s'\n", substr(str, i + 1));
1522                         else
1523                                 expect = 1;
1524                         next;
1525                 }
1526         }
1527 }
1528 END {
1529         if (expect)
1530                 print "?";
1531 }
1532 EOF
1533
1534 : process the command line options
1535 set X `for arg in "$@"; do echo "X$arg"; done |
1536         sed -e s/X// | awk -f options.awk`
1537 eval "set $*"
1538 shift
1539 rm -f options.awk
1540
1541 : set up default values
1542 fastread=''
1543 reuseval=false
1544 config_sh=''
1545 alldone=''
1546 error=''
1547 silent=''
1548 extractsh=''
1549 override=''
1550 knowitall=''
1551 rm -f optdef.sh posthint.sh
1552 cat >optdef.sh <<EOS
1553 $startsh
1554 EOS
1555
1556
1557 : option parsing
1558 while test $# -gt 0; do
1559         case "$1" in
1560         -d) shift; fastread=yes;;
1561         -e) shift; alldone=cont;;
1562         -f)
1563                 shift
1564                 cd ..
1565                 if test -r "$1"; then
1566                         config_sh="$1"
1567                 else
1568                         echo "$me: cannot read config file $1." >&2
1569                         error=true
1570                 fi
1571                 cd UU
1572                 shift;;
1573         --help|\
1574         -h) shift; error=true;;
1575         -r) shift; reuseval=true;;
1576         -s) shift; silent=true; realsilent=true;;
1577         -E) shift; alldone=exit;;
1578         -K) shift; knowitall=true;;
1579         -O) shift; override=true;;
1580         -S) shift; silent=true; extractsh=true;;
1581         -D)
1582                 shift
1583                 case "$1" in
1584                 *=)
1585                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1586                         echo "$me: ignoring -D $1" >&2
1587                         ;;
1588                 *=*) echo "$1" | \
1589                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1590                 *) echo "$1='define'" >> optdef.sh;;
1591                 esac
1592                 shift
1593                 ;;
1594         -U)
1595                 shift
1596                 case "$1" in
1597                 *=) echo "$1" >> optdef.sh;;
1598                 *=*)
1599                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1600                         echo "$me: ignoring -U $1" >&2
1601                         ;;
1602                 *) echo "$1='undef'" >> optdef.sh;;
1603                 esac
1604                 shift
1605                 ;;
1606         -A)
1607             shift
1608             xxx=''
1609             yyy="$1"
1610             zzz=''
1611             uuu=undef
1612             case "$yyy" in
1613             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1614                  case "$zzz" in
1615                  *:*) zzz='' ;;
1616                  *)   xxx=append
1617                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1618                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1619                  esac
1620                  ;;
1621             esac
1622             case "$xxx" in
1623             '')  case "$yyy" in
1624                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1625                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1626                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1627                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1628                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1629                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1630                  esac
1631                  ;;
1632             esac
1633             case "$xxx" in
1634             append)
1635                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1636             clear)
1637                 echo "$yyy=''"                  >> posthint.sh ;;
1638             define)
1639                 case "$zzz" in
1640                 '') zzz=define ;;
1641                 esac
1642                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1643             eval)
1644                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1645             prepend)
1646                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1647             undef)
1648                 case "$zzz" in
1649                 '') zzz="$uuu" ;;
1650                 esac
1651                 echo "$yyy=$zzz"                >> posthint.sh ;;
1652             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1653             esac
1654             shift
1655             ;;
1656         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1657             exit 0;;
1658         --) break;;
1659         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1660         *) break;;
1661         esac
1662 done
1663
1664 case "$error" in
1665 true)
1666         cat >&2 <<EOM
1667 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1668                  [-U symbol] [-U symbol=] [-A command:symbol...]
1669   -d : use defaults for all answers.
1670   -e : go on without questioning past the production of config.sh.
1671   -f : specify an alternate default configuration file.
1672   -h : print this help message and exit (with an error status).
1673   -r : reuse C symbols value if possible (skips costly nm extraction).
1674   -s : silent mode, only echoes questions and essential information.
1675   -D : define symbol to have some value:
1676          -D symbol         symbol gets the value 'define'
1677          -D symbol=value   symbol gets the value 'value'
1678        common used examples (see INSTALL for more info):
1679          -Duse64bitint            use 64bit integers
1680          -Duse64bitall            use 64bit integers and pointers
1681          -Dusethreads             use thread support
1682          -Dinc_version_list=none  do not include older perl trees in @INC
1683          -DEBUGGING=none          DEBUGGING options
1684          -Dcc=gcc                 choose your compiler
1685          -Dprefix=/opt/perl5      choose your destination
1686   -E : stop at the end of questions, after having produced config.sh.
1687   -K : do not use unless you know what you are doing.
1688   -O : let -D and -U override definitions from loaded configuration file.
1689   -S : perform variable substitutions on all .SH files (can mix with -f)
1690   -U : undefine symbol:
1691          -U symbol    symbol gets the value 'undef'
1692          -U symbol=   symbol gets completely empty
1693        e.g.:  -Uversiononly
1694   -A : manipulate symbol after the platform specific hints have been applied:
1695          -A append:symbol=value   append value to symbol
1696          -A symbol=value          like append:, but with a separating space
1697          -A define:symbol=value   define symbol to have value
1698          -A clear:symbol          define symbol to be ''
1699          -A define:symbol         define symbol to be 'define'
1700          -A eval:symbol=value     define symbol to be eval of value
1701          -A prepend:symbol=value  prepend value to symbol
1702          -A undef:symbol          define symbol to be 'undef'
1703          -A undef:symbol=         define symbol to be ''
1704        e.g.:  -A prepend:libswanted='cl pthread '
1705               -A ccflags=-DSOME_MACRO
1706   -V : print version number and exit (with a zero status).
1707 EOM
1708         exit 1
1709         ;;
1710 esac
1711
1712 : Sanity checks
1713 case "$fastread$alldone" in
1714 yescont|yesexit) ;;
1715 *)
1716         case "$extractsh" in
1717         true) ;;
1718         *)
1719                 if test ! -t 0; then
1720                         echo "Say 'sh Configure', not 'sh <Configure'"
1721                         exit 1
1722                 fi
1723                 ;;
1724         esac
1725         ;;
1726 esac
1727
1728 exec 4>&1
1729 case "$silent" in
1730 true) exec 1>/dev/null;;
1731 esac
1732
1733 : run the defines and the undefines, if any, but leave the file out there...
1734 touch optdef.sh
1735 . ./optdef.sh
1736 : create the posthint manipulation script and leave the file out there...
1737 touch posthint.sh
1738
1739 : set package name
1740 package='perl5'
1741 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1742 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1743 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1744 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1745 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1746 esac
1747
1748 : Some greps do not return status, grrr.
1749 echo "grimblepritz" >grimble
1750 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1751         contains=contains
1752 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1753         contains=grep
1754 else
1755         contains=contains
1756 fi
1757 rm -f grimble
1758 : the following should work in any shell
1759 case "$contains" in
1760 contains*)
1761         echo " "
1762         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1763         cat >contains <<'EOSS'
1764 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1765 EOSS
1766 chmod +x contains
1767 esac
1768
1769 : Find the path to the source tree
1770 case "$src" in
1771 '') case "$0" in
1772     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1773          case "$src" in
1774          /*)    ;;
1775          .)     ;;
1776          *)     src=`cd ../$src && pwd` ;;
1777          esac
1778          ;;
1779     *)   src='.';;
1780     esac;;
1781 esac
1782 case "$src" in
1783 '')     src=/
1784         rsrc=/
1785         ;;
1786 /*)     rsrc="$src";;
1787 *)      rsrc="../$src";;
1788 esac
1789 if test -f $rsrc/Configure && \
1790         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1791 then
1792    : found it, so we are ok.
1793 else
1794         rsrc=''
1795         for src in . .. ../.. ../../.. ../../../..; do
1796                 if test -f ../$src/Configure && \
1797                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1798                 then
1799                         rsrc=../$src
1800                         break
1801                 fi
1802         done
1803 fi
1804 case "$rsrc" in
1805 '')
1806         cat <<EOM >&4
1807
1808 Sorry, I can't seem to locate the source dir for $package.  Please start
1809 Configure with an explicit path -- i.e. /some/path/Configure.
1810
1811 EOM
1812         exit 1
1813         ;;
1814 ../.)   rsrc='..';;
1815 *)
1816         echo " "
1817         echo "Sources for $package found in \"$src\"." >&4
1818         ;;
1819 esac
1820
1821 : script used to extract .SH files with variable substitutions
1822 cat >extract <<'EOS'
1823 PERL_CONFIG_SH=true
1824 echo "Doing variable substitutions on .SH files..."
1825 if test -f MANIFEST; then
1826         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1827 else
1828         echo "(Looking for .SH files under the source directory.)"
1829         set x `(cd "$src"; find . -name "*.SH" -print)`
1830 fi
1831 shift
1832 case $# in
1833 0) set x `(cd "$src"; echo *.SH)`; shift;;
1834 esac
1835 if test ! -f "$src/$1"; then
1836         shift
1837 fi
1838 mkdir_p='
1839 name=$1;
1840 create="";
1841 while test $name; do
1842         if test ! -d "$name"; then
1843                 create="$name $create";
1844                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1845                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1846         else
1847                 name="";
1848         fi;
1849 done;
1850 for file in $create; do
1851         mkdir $file;
1852 done
1853 '
1854 for file in $*; do
1855         case "$src" in
1856         ".")
1857                 case "$file" in
1858                 */*)
1859                         dir=`expr X$file : 'X\(.*\)/'`
1860                         file=`expr X$file : 'X.*/\(.*\)'`
1861                         (cd "$dir" && . ./$file)
1862                         ;;
1863                 *)
1864                         . ./$file
1865                         ;;
1866                 esac
1867                 ;;
1868         *)
1869                 case "$file" in
1870                 */*)
1871                         dir=`expr X$file : 'X\(.*\)/'`
1872                         file=`expr X$file : 'X.*/\(.*\)'`
1873                         (set x $dir; shift; eval $mkdir_p)
1874                         sh <"$src/$dir/$file"
1875                         ;;
1876                 *)
1877                         sh <"$src/$file"
1878                         ;;
1879                 esac
1880                 ;;
1881         esac
1882 done
1883 if test -f "$src/config_h.SH"; then
1884         if test ! -f config.h; then
1885         : oops, they left it out of MANIFEST, probably, so do it anyway.
1886         . "$src/config_h.SH"
1887         fi
1888 fi
1889 EOS
1890
1891 : extract files and exit if asked to do so
1892 case "$extractsh" in
1893 true)
1894         case "$realsilent" in
1895         true) ;;
1896         *) exec 1>&4;;
1897         esac
1898         case "$config_sh" in
1899         '') config_sh='config.sh';;
1900         esac
1901         echo " "
1902         echo "Fetching answers from $config_sh..."
1903         cd ..
1904         . $config_sh
1905         test "$override" && . ./optdef.sh
1906         echo " "
1907         . UU/extract
1908         rm -rf UU
1909         echo "Extraction done."
1910         exit 0
1911         ;;
1912 esac
1913
1914 : Eunice requires " " instead of "", can you believe it
1915 echo " "
1916 : Here we go...
1917 echo "Beginning of configuration questions for $package."
1918
1919 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1920
1921 : first determine how to suppress newline on echo command
1922 echo " "
1923 echo "Checking echo to see how to suppress newlines..."
1924 (echo "hi there\c" ; echo " ") >.echotmp
1925 if $contains c .echotmp >/dev/null 2>&1 ; then
1926         echo "...using -n."
1927         n='-n'
1928         c=''
1929 else
1930         cat <<'EOM'
1931 ...using \c
1932 EOM
1933         n=''
1934         c='\c'
1935 fi
1936 echo $n "The star should be here-->$c"
1937 echo '*'
1938 rm -f .echotmp
1939
1940 : Now test for existence of everything in MANIFEST
1941 echo " "
1942 if test -f "$rsrc/MANIFEST"; then
1943         echo "First let's make sure your kit is complete.  Checking..." >&4
1944         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
1945                 (split -l 50 2>/dev/null || split -50)
1946         rm -f missing
1947         tmppwd=`pwd`
1948         for filelist in x??; do
1949                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1950                         >/dev/null 2>>"$tmppwd/missing")
1951         done
1952         if test -s missing; then
1953                 cat missing >&4
1954                 cat >&4 <<'EOM'
1955
1956 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1957
1958 You have the option of continuing the configuration process, despite the
1959 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1960 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1961 and contact the author (perlbug@perl.org).
1962
1963 EOM
1964                 echo $n "Continue? [n] $c" >&4
1965                 read ans
1966                 case "$ans" in
1967                 y*)
1968                         echo "Continuing..." >&4
1969                         rm -f missing
1970                         ;;
1971                 *)
1972                         echo "ABORTING..." >&4
1973                         kill $$
1974                         ;;
1975                 esac
1976         else
1977                 echo "Looks good..."
1978         fi
1979 else
1980         echo "There is no MANIFEST file.  I hope your kit is complete !"
1981 fi
1982 rm -f missing x??
1983
1984 : Find the appropriate value for a newline for tr
1985 echo " "
1986 if test -n "$DJGPP"; then
1987        trnl='\012'
1988 fi
1989 if test X"$trnl" = X; then
1990         case "`echo foo|tr '\n' x 2>/dev/null`" in
1991         foox) trnl='\n' ;;
1992         esac
1993 fi
1994 if test X"$trnl" = X; then
1995         case "`echo foo|tr '\012' x 2>/dev/null`" in
1996         foox) trnl='\012' ;;
1997         esac
1998 fi
1999 if test X"$trnl" = X; then
2000        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2001        fooxy) trnl='\n\r' ;;
2002        esac
2003 fi
2004 if test X"$trnl" = X; then
2005         cat <<EOM >&2
2006
2007 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2008
2009 EOM
2010         exit 1
2011 fi
2012
2013 : compute the number of columns on the terminal for proper question formatting
2014 case "$COLUMNS" in
2015 '') COLUMNS='80';;
2016 esac
2017
2018 : set up the echo used in my read
2019 myecho="case \"\$xxxm\" in
2020 '') echo $n \"\$rp $c\" >&4;;
2021 *) case \"\$rp\" in
2022         '') echo $n \"[\$xxxm] $c\";;
2023         *)
2024                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2025                         echo \"\$rp\" >&4
2026                         echo $n \"[\$xxxm] $c\" >&4
2027                 else
2028                         echo $n \"\$rp [\$xxxm] $c\" >&4
2029                 fi
2030                 ;;
2031         esac;;
2032 esac"
2033
2034 : now set up to do reads with possible shell escape and default assignment
2035 cat <<EOSC >myread
2036 $startsh
2037 xxxm=\$dflt
2038 $myecho
2039 ans='!'
2040 case "\$fastread" in
2041 yes) case "\$dflt" in
2042         '') ;;
2043         *) ans='';
2044                 case "\$silent-\$rp" in
2045                 true-) ;;
2046                 *) echo " " >&4;;
2047                 esac;;
2048         esac;;
2049 *) case "\$silent" in
2050         true) case "\$rp" in
2051                 '') ans='';;
2052                 esac;;
2053         esac;;
2054 esac
2055 while expr "X\$ans" : "X!" >/dev/null; do
2056         read answ
2057         set x \$xxxm
2058         shift
2059         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2060         case  "\$answ" in
2061         "!")
2062                 sh 1>&4
2063                 echo " "
2064                 $myecho
2065                 ;;
2066         !*)
2067                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2068                 shift
2069                 sh 1>&4 -c "\$*"
2070                 echo " "
2071                 $myecho
2072                 ;;
2073         "\$ans")
2074                 case "\$ans" in
2075                 \\&*)
2076                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2077                         shift
2078                         case "\$1" in
2079                         -d)
2080                                 fastread=yes
2081                                 echo "(OK, I'll run with -d after this question.)" >&4
2082                                 ;;
2083                         -*)
2084                                 echo "*** Sorry, \$1 not supported yet." >&4
2085                                 ;;
2086                         esac
2087                         $myecho
2088                         ans=!
2089                         ;;
2090                 esac;;
2091         *)
2092                 case "\$aok" in
2093                 y)
2094                         echo "*** Substitution done -- please confirm."
2095                         xxxm="\$ans"
2096                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2097                         xxxm="\$ans"
2098                         ans=!
2099                         ;;
2100                 *)
2101                         echo "*** Error -- try again."
2102                         ans=!
2103                         ;;
2104                 esac
2105                 $myecho
2106                 ;;
2107         esac
2108         case "\$ans\$xxxm\$nostick" in
2109         '')
2110                 ans=!
2111                 $myecho
2112                 ;;
2113         esac
2114 done
2115 case "\$ans" in
2116 '') ans="\$xxxm";;
2117 esac
2118 EOSC
2119
2120 : create .config dir to save info across Configure sessions
2121 test -d ../.config || mkdir ../.config
2122 cat >../.config/README <<EOF
2123 This directory created by Configure to save information that should
2124 persist across sessions for $package.
2125
2126 You may safely delete it if you wish.
2127 EOF
2128
2129 : See if we are using a devel version and want that
2130 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2131 case "$usedevel" in
2132 $define|true|[yY]*) ;;
2133 *) case "$xversion" in
2134    *[13579])
2135         cat >&4 <<EOH
2136 *** WHOA THERE!!! ***
2137
2138     This is an UNSTABLE DEVELOPMENT release.
2139     The version of this $package distribution is $xversion, that is, odd,
2140     (as opposed to even) and that signifies a development release.
2141     If you want a maintenance release, you want an even-numbered version.
2142
2143     Do ***NOT*** install this into production use.
2144     Data corruption and crashes are possible.
2145
2146     It is most seriously suggested that you do not continue any further
2147     unless you want to help in developing and debugging Perl.
2148
2149     If you *still* want to build perl, you can answer 'y' now,
2150     or pass -Dusedevel to Configure.
2151
2152 EOH
2153         rp='Do you really want to continue?'
2154         dflt='n'
2155         . ./myread
2156         case "$ans" in
2157         [yY]) echo >&4 "Okay, continuing."
2158               usedevel="$define" ;;
2159         *) echo >&4 "Okay, bye."
2160            exit 1
2161            ;;
2162         esac
2163         ;;
2164     esac
2165     ;;
2166 esac
2167 case "$usedevel" in
2168 $define|true|[yY]*)
2169         case "$versiononly" in
2170         '') versiononly="$define" ;;
2171         esac
2172         case "$installusrbinperl" in
2173         '') installusrbinperl="$undef" ;;
2174         esac
2175         ;;
2176 esac
2177
2178 : general instructions
2179 needman=true
2180 firsttime=true
2181 user=`(logname) 2>/dev/null`
2182 case "$user" in
2183 '') user=`whoami 2>&1`;;
2184 esac
2185 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2186         firsttime=false
2187         echo " "
2188         rp='Would you like to see the instructions?'
2189         dflt=n
2190         . ./myread
2191         case "$ans" in
2192         [yY]*) ;;
2193         *) needman=false;;
2194         esac
2195 fi
2196 if $needman; then
2197         cat <<EOH
2198
2199 This installation shell script will examine your system and ask you questions
2200 to determine how the perl5 package should be installed. If you get
2201 stuck on a question, you may use a ! shell escape to start a subshell or
2202 execute a command.  Many of the questions will have default answers in square
2203 brackets; typing carriage return will give you the default.
2204
2205 On some of the questions which ask for file or directory names you are allowed
2206 to use the ~name construct to specify the login directory belonging to "name",
2207 even if you don't have a shell which knows about that.  Questions where this is
2208 allowed will be marked "(~name ok)".
2209
2210 EOH
2211         rp=''
2212         dflt='Type carriage return to continue'
2213         . ./myread
2214         cat <<'EOH'
2215
2216 The prompter used in this script allows you to use shell variables and
2217 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2218 in the default answer, as if the default line was a set of arguments given to a
2219 script shell.  This means you may also use $* to repeat the whole default line,
2220 so you do not have to re-type everything to add something to the default.
2221
2222 Everytime there is a substitution, you will have to confirm.  If there is an
2223 error (e.g. an unmatched backtick), the default answer will remain unchanged
2224 and you will be prompted again.
2225
2226 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2227 the questions and use the computed defaults (or the previous answers if there
2228 was already a config.sh file). Type 'Configure -h' for a list of options.
2229 You may also start interactively and then answer '& -d' at any prompt to turn
2230 on the non-interactive behaviour for the remainder of the execution.
2231
2232 EOH
2233         . ./myread
2234         cat <<EOH
2235
2236 Much effort has been expended to ensure that this shell script will run on any
2237 Unix system.  If despite that it blows up on yours, your best bet is to edit
2238 Configure and run it again.  If you can't run Configure for some reason,
2239 you'll have to generate a config.sh file by hand.  Whatever problems you
2240 have, let me (perlbug@perl.org) know how I blew it.
2241
2242 This installation script affects things in two ways:
2243
2244 1) it may do direct variable substitutions on some of the files included
2245    in this kit.
2246 2) it builds a config.h file for inclusion in C programs.  You may edit
2247    any of these files as the need arises after running this script.
2248
2249 If you make a mistake on a question, there is no easy way to back up to it
2250 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2251 files.  Configure will offer to let you do this before it runs the SH files.
2252
2253 EOH
2254         dflt='Type carriage return to continue'
2255         . ./myread
2256         case "$firsttime" in
2257         true) echo $user >>../.config/instruct;;
2258         esac
2259 fi
2260
2261 : find out where common programs are
2262 echo " "
2263 echo "Locating common programs..." >&4
2264 cat <<EOSC >loc
2265 $startsh
2266 case \$# in
2267 0) exit 1;;
2268 esac
2269 thing=\$1
2270 shift
2271 dflt=\$1
2272 shift
2273 for dir in \$*; do
2274         case "\$thing" in
2275         .)
2276         if test -d \$dir/\$thing; then
2277                 echo \$dir
2278                 exit 0
2279         fi
2280         ;;
2281         *)
2282         for thisthing in \$dir/\$thing; do
2283                 : just loop through to pick last item
2284         done
2285         if test -f \$thisthing; then
2286                 echo \$thisthing
2287                 exit 0
2288         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2289                 echo \$thisthing
2290                 exit 0
2291         elif test -f \$dir/\$thing.exe; then
2292                 if test -n "$DJGPP"; then
2293                         echo \$dir/\$thing.exe
2294                 elif test "$eunicefix" != ":"; then
2295                         : on Eunice apparently
2296                         echo \$dir/\$thing
2297                 fi
2298                 exit 0
2299         fi
2300         ;;
2301         esac
2302 done
2303 echo \$dflt
2304 exit 1
2305 EOSC
2306 chmod +x loc
2307 $eunicefix loc
2308 loclist="
2309 awk
2310 cat
2311 chmod
2312 comm
2313 cp
2314 echo
2315 expr
2316 grep
2317 ls
2318 mkdir
2319 rm
2320 sed
2321 sort
2322 touch
2323 tr
2324 uniq
2325 "
2326 trylist="
2327 ar
2328 bison
2329 byacc
2330 cpp
2331 csh
2332 date
2333 egrep
2334 gmake
2335 gzip
2336 less
2337 ln
2338 make
2339 more
2340 nm
2341 nroff
2342 pg
2343 test
2344 uname
2345 zip
2346 "
2347 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2348 pth="$pth /lib /usr/lib"
2349 for file in $loclist; do
2350         eval xxx=\$$file
2351         case "$xxx" in
2352         /*|?:[\\/]*)
2353                 if test -f "$xxx"; then
2354                         : ok
2355                 else
2356                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2357                         xxx=`./loc $file $file $pth`
2358                 fi
2359                 ;;
2360         '') xxx=`./loc $file $file $pth`;;
2361         *) xxx=`./loc $xxx $xxx $pth`;;
2362         esac
2363         eval $file=$xxx$_exe
2364         eval _$file=$xxx
2365         case "$xxx" in
2366         /*)
2367                 echo $file is in $xxx.
2368                 ;;
2369         ?:[\\/]*)
2370                 echo $file is in $xxx.
2371                 ;;
2372         *)
2373                 echo "I don't know where '$file' is, and my life depends on it." >&4
2374                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2375                 exit 1
2376                 ;;
2377         esac
2378 done
2379 echo " "
2380 echo "Don't worry if any of the following aren't found..."
2381 say=offhand
2382 for file in $trylist; do
2383         eval xxx=\$$file
2384         case "$xxx" in
2385         /*|?:[\\/]*)
2386                 if test -f "$xxx"; then
2387                         : ok
2388                 else
2389                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2390                         xxx=`./loc $file $file $pth`
2391                 fi
2392                 ;;
2393         '') xxx=`./loc $file $file $pth`;;
2394         *) xxx=`./loc $xxx $xxx $pth`;;
2395         esac
2396         eval $file=$xxx$_exe
2397         eval _$file=$xxx
2398         case "$xxx" in
2399         /*)
2400                 echo $file is in $xxx.
2401                 ;;
2402         ?:[\\/]*)
2403                 echo $file is in $xxx.
2404                 ;;
2405         *)
2406                 echo "I don't see $file out there, $say."
2407                 say=either
2408                 ;;
2409         esac
2410 done
2411 case "$egrep" in
2412 egrep)
2413         echo "Substituting grep for egrep."
2414         egrep=$grep
2415         _egrep=$grep
2416         ;;
2417 esac
2418 case "$ln" in
2419 ln)
2420         echo "Substituting cp for ln."
2421         ln=$cp
2422         _ln=$cp
2423         ;;
2424 esac
2425 case "$make" in
2426 make)
2427         case "$gmake" in
2428         gmake)
2429         echo "I can't find make or gmake, and my life depends on it." >&4
2430         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2431         exit 1
2432         ;;
2433         esac
2434         ;;
2435 esac
2436 case "$gmake" in
2437 gmake)  ;;
2438 *)      # We can't have osname yet.
2439         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2440                 # Assume that gmake, if found, is definitely GNU make
2441                 # and prefer it over the system make.
2442                 echo "Substituting gmake for make."
2443                 make=$gmake
2444                 _make=$gmake
2445         fi
2446         ;;
2447 esac
2448 case "$test" in
2449 test)
2450         echo "Hopefully test is built into your sh."
2451         ;;
2452 *)
2453         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2454                 echo "Using the test built into your sh."
2455                 test=test
2456                 _test=test
2457         fi
2458         ;;
2459 esac
2460 case "$echo" in
2461 echo)
2462         echo "Hopefully echo is built into your sh."
2463         ;;
2464 '') ;;
2465 *)
2466         echo " "
2467 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2468         $echo $n "hi there$c" >foo1
2469         echo $n "hi there$c" >foo2
2470         if cmp foo1 foo2 >/dev/null 2>&1; then
2471                 echo "They are compatible.  In fact, they may be identical."
2472         else
2473                 case "$n" in
2474                 '-n') n='' c='\c';;
2475                 *) n='-n' c='';;
2476                 esac
2477                 cat <<FOO
2478 They are not compatible!  You are probably running ksh on a non-USG system.
2479 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2480 have echo built in and we may have to run some Bourne shell scripts.  That
2481 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2482
2483 FOO
2484                 $echo $n "The star should be here-->$c"
2485                 $echo "*"
2486         fi
2487         $rm -f foo1 foo2
2488         ;;
2489 esac
2490
2491 # This question was auctioned at YAPC::Europe-2007 in Vienna
2492 # I never promised you could answer it. I only auctioned the question.
2493 cat <<FOO
2494 The following message is sponsored by
2495
2496   Dresden.pm<--The stars should be here.
2497
2498 Dear Perl user, system administrator or package
2499 maintainer, the Perl community sends greetings to
2500 you. Do you (emblematical) greet back [Y/n]? n
2501
2502 FOO
2503
2504 : Check what type of C compiler we use
2505 cat <<EOS >trygcc
2506 $startsh
2507 EOS
2508 cat <<'EOSC' >>trygcc
2509 case "$cc" in
2510 '') ;;
2511 *)  $rm -f try try.*
2512     $cat >try.c <<EOM
2513 int main(int argc, char *argv[]) {
2514   return 0;
2515 }
2516 EOM
2517     if $cc -o try $ccflags $ldflags try.c; then
2518        :
2519     else
2520         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2521         despair=yes
2522         trygcc=yes
2523         case "$cc" in
2524         *gcc*) trygcc=no ;;
2525         esac
2526         # Skip this test because it gives a false match on output like:
2527         #    ./trygcc: line 23: cc: command not found
2528         # case "`$cc -v -c try.c 2>&1`" in
2529         # *gcc*) trygcc=no ;;
2530         # esac
2531         if $test X"$trygcc" = Xyes; then
2532             if gcc -o try -c try.c; then
2533                 echo " "
2534                 echo "You seem to have a working gcc, though." >&4
2535                 # Switching compilers may undo the work of hints files.
2536                 # The most common problem is -D_REENTRANT for threads.
2537                 # This heuristic catches that case, but gets false positives
2538                 # if -Dusethreads was not actually specified.  Better to
2539                 # bail out here with a useful message than fail 
2540                 # mysteriously later. Should we perhaps just try to
2541                 # re-invoke Configure -Dcc=gcc config_args ?
2542                 if $test -f usethreads.cbu; then
2543                         $cat >&4 <<EOM 
2544
2545 *** However, any setting of the C compiler flags (e.g. for thread support)
2546 *** will be lost.  It may be necessary for you to restart Configure and
2547 *** add -Dcc=gcc to your Configure command line.
2548
2549 EOM
2550                         rp="Would you like to go ahead and try gcc anyway?"
2551                         dflt=n
2552                 else
2553                         rp="Would you like to use it?"
2554                         dflt=y
2555                 fi
2556                 if $test -f myread; then
2557                     . ./myread
2558                 else
2559                     if $test -f UU/myread; then
2560                         . ./UU/myread
2561                     else
2562                         echo "Cannot find myread, sorry.  Aborting." >&2
2563                         exit 1
2564                     fi
2565                 fi  
2566                 case "$ans" in
2567                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2568                 esac
2569             fi
2570         fi
2571     fi
2572     $rm -f try try.*
2573     ;;
2574 esac
2575 EOSC
2576
2577 cat <<EOS >checkcc
2578 $startsh
2579 EOS
2580 cat <<'EOSC' >>checkcc
2581 case "$cc" in        
2582 '') ;;
2583 *)  $rm -f try try.*              
2584     $cat >try.c <<EOM
2585 int main(int argc, char *argv[]) {
2586   return 0;
2587 }
2588 EOM
2589     if $cc -o try $ccflags $ldflags try.c; then
2590        :
2591     else
2592         if $test X"$despair" = Xyes; then
2593            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2594         fi
2595         $cat >&4 <<EOM         
2596 You need to find a working C compiler.
2597 Either (purchase and) install the C compiler supplied by your OS vendor,
2598 or for a free C compiler try http://gcc.gnu.org/
2599 I cannot continue any further, aborting.
2600 EOM
2601         exit 1
2602     fi
2603     $rm -f try try.*
2604     ;;
2605 esac
2606 EOSC
2607
2608 : determine whether symbolic links are supported
2609 echo " "
2610 $touch blurfl
2611 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2612         echo "Symbolic links are supported." >&4
2613         lns="$ln -s"
2614 else
2615         echo "Symbolic links are NOT supported." >&4
2616         lns="$ln"
2617 fi
2618 $rm -f blurfl sym
2619
2620 : determine whether symbolic links are supported
2621 echo " "
2622 case "$lns" in
2623 *"ln"*" -s")
2624         echo "Checking how to test for symbolic links..." >&4
2625         $lns blurfl sym
2626         if $test "X$issymlink" = X; then
2627                 case "$newsh" in
2628                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2629                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2630                 esac
2631                 if test $? = 0; then
2632                         issymlink="test -h"
2633                 else
2634                         echo "Your builtin 'test -h' may be broken." >&4
2635                         case "$test" in
2636                         /*)     ;;
2637                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2638                                 for p in $pth
2639                                 do
2640                                         if test -f "$p/$test"; then
2641                                                 test="$p/$test"
2642                                                 break
2643                                         fi
2644                                 done
2645                                 ;;
2646                         esac
2647                         case "$test" in
2648                         /*)
2649                                 echo "Trying external '$test -h'." >&4
2650                                 issymlink="$test -h"
2651                                 if $test ! -h sym >/dev/null 2>&1; then
2652                                         echo "External '$test -h' is broken, too." >&4
2653                                         issymlink=''
2654                                 fi
2655                                 ;;
2656                         *)      issymlink='' ;;
2657                         esac
2658                 fi              
2659         fi
2660         if $test "X$issymlink" = X; then
2661                 if $test -L sym 2>/dev/null; then
2662                         issymlink="$test -L"
2663                         echo "The builtin '$test -L' worked." >&4
2664                 fi
2665         fi
2666         if $test "X$issymlink" != X; then
2667                 echo "You can test for symbolic links with '$issymlink'." >&4
2668         else
2669                 echo "I do not know how you can test for symbolic links." >&4
2670         fi
2671         $rm -f blurfl sym
2672         ;;
2673 *)      echo "No symbolic links, so not testing for their testing..." >&4
2674         ;;
2675 esac
2676 echo " "
2677
2678 : Make symlinks util
2679 case "$mksymlinks" in
2680 $define|true|[yY]*)
2681         case "$src" in
2682         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2683                 exit 1
2684                 ;;
2685         *)      case "$lns:$issymlink" in
2686                 *"ln"*" -s:"*"test -"?)
2687                         echo "Creating the symbolic links..." >&4
2688                         echo "(First creating the subdirectories...)" >&4
2689                         cd ..
2690                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2691                                 read directory
2692                                 test -z "$directory" && break
2693                                 mkdir -p $directory
2694                         done
2695                         # Sanity check 1.
2696                         if test ! -d t/base; then
2697                                 echo "Failed to create the subdirectories.  Aborting." >&4
2698                                 exit 1
2699                         fi
2700                         echo "(Then creating the symlinks...)" >&4
2701                         awk '{print $1}' $src/MANIFEST | while true; do
2702                                 read filename
2703                                 test -z "$filename" && break
2704                                 if test -f $filename; then
2705                                         if $issymlink $filename; then
2706                                                 rm -f $filename
2707                                         fi
2708                                 fi
2709                                 if test -f $filename; then
2710                                         echo "$filename already exists, not symlinking."
2711                                 else
2712                                         ln -s $src/$filename $filename
2713                                 fi
2714                         done
2715                         # Sanity check 2.
2716                         if test ! -f t/base/lex.t; then
2717                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2718                                 exit 1
2719                         fi
2720                         cd UU
2721                         ;;
2722                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2723                         ;;
2724                 esac
2725                 ;;
2726         esac
2727         ;;
2728 esac
2729
2730 : Check for Cross-Compilation
2731 case "$usecrosscompile" in
2732 $define|true|[yY]*)
2733         $echo "Cross-compiling..."
2734         croak=''
2735         case "$cc" in
2736         *-*-gcc) # A cross-compiling gcc, probably.
2737             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2738             ar=$targetarch-ar
2739             # leave out ld, choosing it is more complex
2740             nm=$targetarch-nm
2741             ranlib=$targetarch-ranlib
2742             $echo 'extern int foo;' > try.c
2743             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2744             shift
2745             if $test $# -gt 0; then
2746                 incpth="$incpth $*"
2747                 incpth="`$echo $incpth|$sed 's/^ //'`"
2748                 echo "Guessing incpth '$incpth'." >&4
2749                 for i in $*; do
2750                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2751                     if $test -d $j; then
2752                         libpth="$libpth $j"
2753                     fi
2754                 done   
2755                 libpth="`$echo $libpth|$sed 's/^ //'`"
2756                 echo "Guessing libpth '$libpth'." >&4
2757             fi
2758             $rm -f try.c
2759             ;;
2760         esac
2761         case "$targetarch" in
2762         '') echo "Targetarch not defined." >&4; croak=y ;;
2763         *)  echo "Using targetarch $targetarch." >&4 ;;
2764         esac
2765         case "$incpth" in
2766         '') echo "Incpth not defined." >&4; croak=y ;;
2767         *)  echo "Using incpth '$incpth'." >&4 ;;
2768         esac
2769         case "$libpth" in
2770         '') echo "Libpth not defined." >&4; croak=y ;;
2771         *)  echo "Using libpth '$libpth'." >&4 ;;
2772         esac
2773         case "$usrinc" in
2774         '') for i in $incpth; do
2775                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2776                     usrinc=$i
2777                     echo "Guessing usrinc $usrinc." >&4
2778                     break
2779                 fi
2780             done
2781             case "$usrinc" in
2782             '') echo "Usrinc not defined." >&4; croak=y ;;
2783             esac
2784             ;;
2785         *)  echo "Using usrinc $usrinc." >&4 ;;
2786         esac
2787         case "$targethost" in
2788         '') echo "Targethost not defined." >&4; croak=y ;;
2789         *)  echo "Using targethost $targethost." >&4
2790         esac
2791         locincpth=' '
2792         loclibpth=' '
2793         case "$croak" in
2794         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2795         esac
2796         case "$src" in
2797         /*) run=$src/Cross/run
2798             targetmkdir=$src/Cross/mkdir
2799             to=$src/Cross/to
2800             from=$src/Cross/from
2801             ;;
2802         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2803             run=$pwd/Cross/run
2804             targetmkdir=$pwd/Cross/mkdir
2805             to=$pwd/Cross/to
2806             from=$pwd/Cross/from
2807             ;;
2808         esac
2809         case "$targetrun" in
2810         '') targetrun=ssh ;;
2811         esac
2812         case "$targetto" in
2813         '') targetto=scp ;;
2814         esac
2815         case "$targetfrom" in
2816         '') targetfrom=scp ;;
2817         esac
2818         run=$run-$targetrun
2819         to=$to-$targetto
2820         from=$from-$targetfrom
2821         case "$targetdir" in
2822         '')  targetdir=/tmp
2823              echo "Guessing targetdir $targetdir." >&4
2824              ;;
2825         esac
2826         case "$targetuser" in
2827         '')  targetuser=root
2828              echo "Guessing targetuser $targetuser." >&4
2829              ;;
2830         esac
2831         case "$targetfrom" in
2832         scp)    q=-q ;;
2833         *)      q='' ;;
2834         esac
2835         case "$targetrun" in
2836         ssh|rsh)
2837             cat >$run <<EOF
2838 #!/bin/sh
2839 case "\$1" in
2840 -cwd)
2841   shift
2842   cwd=\$1
2843   shift
2844   ;;
2845 esac
2846 case "\$cwd" in
2847 '') cwd=$targetdir ;;
2848 esac
2849 exe=\$1
2850 shift
2851 if $test ! -f \$exe.xok; then
2852   $to \$exe
2853   $touch \$exe.xok
2854 fi
2855 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2856 EOF
2857             ;;
2858         *)  echo "Unknown targetrun '$targetrun'" >&4
2859             exit 1
2860             ;;
2861         esac
2862         case "$targetmkdir" in
2863         */Cross/mkdir)
2864             cat >$targetmkdir <<EOF
2865 #!/bin/sh
2866 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2867 EOF
2868             $chmod a+rx $targetmkdir
2869             ;;
2870         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2871             exit 1
2872             ;;
2873         esac
2874         case "$targetto" in
2875         scp|rcp)
2876             cat >$to <<EOF
2877 #!/bin/sh
2878 for f in \$@
2879 do
2880   case "\$f" in
2881   /*)
2882     $targetmkdir \`dirname \$f\`
2883     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2884     ;;
2885   *)
2886     $targetmkdir $targetdir/\`dirname \$f\`
2887     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2888     ;;
2889   esac
2890 done
2891 exit 0
2892 EOF
2893             ;;
2894         cp) cat >$to <<EOF
2895 #!/bin/sh
2896 for f in \$@
2897 do
2898   case "\$f" in
2899   /*)
2900     $mkdir -p $targetdir/\`dirname \$f\`
2901     $cp \$f $targetdir/\$f || exit 1
2902     ;;
2903   *)
2904     $targetmkdir $targetdir/\`dirname \$f\`
2905     $cp \$f $targetdir/\$f || exit 1
2906     ;;
2907   esac
2908 done
2909 exit 0
2910 EOF
2911             ;;
2912         *)  echo "Unknown targetto '$targetto'" >&4
2913             exit 1
2914             ;;
2915         esac
2916         case "$targetfrom" in
2917         scp|rcp)
2918           cat >$from <<EOF
2919 #!/bin/sh
2920 for f in \$@
2921 do
2922   $rm -f \$f
2923   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2924 done
2925 exit 0
2926 EOF
2927             ;;
2928         cp) cat >$from <<EOF
2929 #!/bin/sh
2930 for f in \$@
2931 do
2932   $rm -f \$f
2933   cp $targetdir/\$f . || exit 1
2934 done
2935 exit 0
2936 EOF
2937             ;;
2938         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2939             exit 1
2940             ;;
2941         esac
2942         if $test ! -f $run; then
2943             echo "Target 'run' script '$run' not found." >&4
2944         else
2945             $chmod a+rx $run
2946         fi
2947         if $test ! -f $to; then
2948             echo "Target 'to' script '$to' not found." >&4
2949         else
2950             $chmod a+rx $to
2951         fi
2952         if $test ! -f $from; then
2953             echo "Target 'from' script '$from' not found." >&4
2954         else
2955             $chmod a+rx $from
2956         fi
2957         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2958             exit 1
2959         fi
2960         cat >&4 <<EOF
2961 Using '$run' for remote execution,
2962 and '$from' and '$to'
2963 for remote file transfer.
2964 EOF
2965         ;;
2966 *)      run=''
2967         to=:
2968         from=:
2969         usecrosscompile='undef'
2970         targetarch=''
2971         ;;
2972 esac
2973
2974 : see whether [:lower:] and [:upper:] are supported character classes
2975 echo " "
2976 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2977 ABYZ)
2978         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2979         up='[:upper:]'
2980         low='[:lower:]'
2981         ;;
2982 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2983         # (0xd9 and 0xe2), therefore that is a nice testing point.
2984         if test "X$up" = X -o "X$low" = X; then
2985             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2986             rs) up='[A-Z]'
2987                 low='[a-z]'
2988                 ;;
2989             esac
2990         fi
2991         if test "X$up" = X -o "X$low" = X; then
2992             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2993             rs) up='A-Z'
2994                 low='a-z'
2995                 ;;
2996             esac
2997         fi
2998         if test "X$up" = X -o "X$low" = X; then
2999             case "`echo RS | od -x 2>/dev/null`" in
3000             *D9E2*|*d9e2*)
3001                 echo "Hey, this might be EBCDIC." >&4
3002                 if test "X$up" = X -o "X$low" = X; then
3003                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3004                     rs) up='[A-IJ-RS-Z]'
3005                         low='[a-ij-rs-z]'
3006                         ;;
3007                     esac
3008                 fi
3009                 if test "X$up" = X -o "X$low" = X; then
3010                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3011                     rs) up='A-IJ-RS-Z'
3012                         low='a-ij-rs-z'
3013                         ;;
3014                     esac
3015                 fi
3016                 ;;
3017             esac
3018         fi
3019 esac
3020 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3021 rs)
3022     echo "Using $up and $low to convert case." >&4
3023     ;;
3024 *)
3025     echo "I don't know how to translate letters from upper to lower case." >&4
3026     echo "Your tr is not acting any way I know of." >&4
3027     exit 1
3028     ;;
3029 esac
3030 : set up the translation script tr, must be called with ./tr of course
3031 cat >tr <<EOSC
3032 $startsh
3033 case "\$1\$2" in
3034 '[A-Z][a-z]') exec $tr '$up' '$low';;
3035 '[a-z][A-Z]') exec $tr '$low' '$up';;
3036 esac
3037 exec $tr "\$@"
3038 EOSC
3039 chmod +x tr
3040 $eunicefix tr
3041
3042 : Try to determine whether config.sh was made on this system
3043 case "$config_sh" in
3044 '')
3045 myuname=`$uname -a 2>/dev/null`
3046 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3047 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3048 # because the A-Z/a-z are not consecutive.
3049 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3050         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3051 newmyuname="$myuname"
3052 dflt=n
3053 case "$knowitall" in
3054 '')
3055         if test -f ../config.sh; then
3056                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3057                         eval "`grep myuname= ../config.sh`"
3058                 fi
3059                 if test "X$myuname" = "X$newmyuname"; then
3060                         dflt=y
3061                 fi
3062         fi
3063         ;;
3064 *) dflt=y;;
3065 esac
3066
3067 : Get old answers from old config file if Configure was run on the
3068 : same system, otherwise use the hints.
3069 hint=default
3070 cd ..
3071 if test -f config.sh; then
3072         echo " "
3073         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3074         . UU/myread
3075         case "$ans" in
3076         n*|N*) echo "OK, I'll ignore it."
3077                 mv config.sh config.sh.old
3078                 myuname="$newmyuname"
3079                 ;;
3080         *)  echo "Fetching default answers from your old config.sh file..." >&4
3081                 tmp_n="$n"
3082                 tmp_c="$c"
3083                 tmp_sh="$sh"
3084                 . ./config.sh
3085                 cp config.sh UU
3086                 n="$tmp_n"
3087                 c="$tmp_c"
3088                 : Older versions did not always set $sh.  Catch re-use of such
3089                 : an old config.sh.
3090                 case "$sh" in
3091                 '') sh="$tmp_sh" ;;
3092                 esac
3093                 hint=previous
3094                 ;;
3095         esac
3096 fi
3097 . ./UU/checkcc
3098 if test ! -f config.sh; then
3099         $cat <<EOM
3100
3101 First time through, eh?  I have some defaults handy for some systems
3102 that need some extra help getting the Configure answers right:
3103
3104 EOM
3105         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3106         dflt=''
3107         : Half the following guesses are probably wrong... If you have better
3108         : tests or hints, please send them to perlbug@perl.org
3109         : The metaconfig authors would also appreciate a copy...
3110         $test -f /irix && osname=irix
3111         $test -f /xenix && osname=sco_xenix
3112         $test -f /dynix && osname=dynix
3113         $test -f /dnix && osname=dnix
3114         $test -f /lynx.os && osname=lynxos
3115         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3116         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3117         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3118         $test -f /bin/mips && /bin/mips && osname=mips
3119         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3120                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3121         $test -d /usr/apollo/bin && osname=apollo
3122         $test -f /etc/saf/_sactab && osname=svr4
3123         $test -d /usr/include/minix && osname=minix
3124         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3125         if $test -d /MachTen -o -d /MachTen_Folder; then
3126                 osname=machten
3127                 if $test -x /sbin/version; then
3128                         osvers=`/sbin/version | $awk '{print $2}' |
3129                         $sed -e 's/[A-Za-z]$//'`
3130                 elif $test -x /usr/etc/version; then
3131                         osvers=`/usr/etc/version | $awk '{print $2}' |
3132                         $sed -e 's/[A-Za-z]$//'`
3133                 else
3134                         osvers="$2.$3"
3135                 fi
3136         fi
3137
3138         $test -f /sys/posix.dll &&
3139                 $test -f /usr/bin/what &&
3140                 set X `/usr/bin/what /sys/posix.dll` &&
3141                 $test "$3" = UWIN &&
3142                 osname=uwin &&
3143                 osvers="$5"
3144
3145         if $test -f $uname; then
3146                 set X $myuname
3147                 shift
3148
3149                 case "$5" in
3150                 fps*) osname=fps ;;
3151                 mips*)
3152                         case "$4" in
3153                         umips) osname=umips ;;
3154                         *) osname=mips ;;
3155                         esac;;
3156                 [23]100) osname=mips ;;
3157                 next*) osname=next ;;
3158                 i386*)
3159                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3160                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3161                                 osname='sco'
3162                                 osvers=$tmp
3163                         elif $test -f /etc/kconfig; then
3164                                 osname=isc
3165                                 if test "$lns" = "$ln -s"; then
3166                                         osvers=4
3167                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3168                                         osvers=3
3169                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3170                                         osvers=2
3171                                 fi
3172                         fi
3173                         tmp=''
3174                         ;;
3175                 pc*)
3176                         if test -n "$DJGPP"; then
3177                                 osname=dos
3178                                 osvers=djgpp
3179                         fi
3180                         ;;
3181                 esac
3182
3183                 case "$1" in
3184                 aix) osname=aix
3185                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3186                         case "$tmp" in
3187                         # oslevel can fail with:
3188                         # oslevel: Unable to acquire lock.
3189                         *not\ found) osvers="$4"."$3" ;;
3190                         '<3240'|'<>3240') osvers=3.2.0 ;;
3191                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3192                         '=3250'|'>3250') osvers=3.2.5 ;;
3193                         *) osvers=$tmp;;
3194                         esac
3195                         ;;
3196                 bsd386) osname=bsd386
3197                         osvers=`$uname -r`
3198                         ;;
3199                 cygwin*) osname=cygwin
3200                         osvers="$3"
3201                         ;;
3202                 *dc.osx) osname=dcosx
3203                         osvers="$3"
3204                         ;;
3205                 dnix) osname=dnix
3206                         osvers="$3"
3207                         ;;
3208                 domainos) osname=apollo
3209                         osvers="$3"
3210                         ;;
3211                 dgux)   osname=dgux
3212                         osvers="$3"
3213                         ;;
3214                 dragonfly) osname=dragonfly
3215                         osvers="$3"
3216                         ;;
3217                 dynixptx*) osname=dynixptx
3218                         osvers=`echo "$4"|sed 's/^v//'`
3219                         ;;
3220                 freebsd) osname=freebsd
3221                         osvers="$3" ;;
3222                 genix)  osname=genix ;;
3223                 gnu)    osname=gnu
3224                         osvers="$3" ;;
3225                 hp*)    osname=hpux
3226                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3227                         ;;
3228                 irix*)  osname=irix
3229                         case "$3" in
3230                         4*) osvers=4 ;;
3231                         5*) osvers=5 ;;
3232                         *)      osvers="$3" ;;
3233                         esac
3234                         ;;
3235                 linux)  osname=linux
3236                         case "$3" in
3237                         *)      osvers="$3" ;;
3238                         esac
3239                         ;;
3240                 MiNT)   osname=mint
3241                         ;;
3242                 netbsd*) osname=netbsd
3243                         osvers="$3"
3244                         ;;
3245                 news-os) osvers="$3"
3246                         case "$3" in
3247                         4*) osname=newsos4 ;;
3248                         *) osname=newsos ;;
3249                         esac
3250                         ;;
3251                 next*) osname=next ;;
3252                 nonstop-ux) osname=nonstopux ;;
3253                 openbsd) osname=openbsd
3254                         osvers="$3"
3255                         ;;
3256                 os2)    osname=os2
3257                         osvers="$4"
3258                         ;;
3259                 POSIX-BC | posix-bc ) osname=posix-bc
3260                         osvers="$3"
3261                         ;;
3262                 powerux | power_ux | powermax_os | powermaxos | \
3263                 powerunix | power_unix) osname=powerux
3264                         osvers="$3"
3265                         ;;
3266                 qnx) osname=qnx
3267                         osvers="$4"
3268                         ;;
3269                 solaris) osname=solaris
3270                         case "$3" in
3271                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3272                         *)      osvers="$3" ;;
3273                         esac
3274                         ;;
3275                 sunos) osname=sunos
3276                         case "$3" in
3277                         5*) osname=solaris
3278                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3279                         *)      osvers="$3" ;;
3280                         esac
3281                         ;;
3282                 titanos) osname=titanos
3283                         case "$3" in
3284                         1*) osvers=1 ;;
3285                         2*) osvers=2 ;;
3286                         3*) osvers=3 ;;
3287                         4*) osvers=4 ;;
3288                         *)      osvers="$3" ;;
3289                         esac
3290                         ;;
3291                 ultrix) osname=ultrix
3292                         osvers="$3"
3293                         ;;
3294                 osf1|mls+)      case "$5" in
3295                                 alpha)
3296                                         osname=dec_osf
3297                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3298                                         case "$osvers" in
3299                                         [1-9].[0-9]*) ;;
3300                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3301                                         esac
3302                                         ;;
3303                         hp*)    osname=hp_osf1  ;;
3304                         mips)   osname=mips_osf1 ;;
3305                         esac
3306                         ;;
3307                 # UnixWare 7.1.2 is known as Open UNIX 8
3308                 openunix|unixware) osname=svr5
3309                         osvers="$4"
3310                         ;;
3311                 uts)    osname=uts
3312                         osvers="$3"
3313                         ;;
3314                 vos) osvers="$3"
3315                         ;;
3316                 $2) case "$osname" in
3317                         *isc*) ;;
3318                         *freebsd*) ;;
3319                         svr*)
3320                                 : svr4.x or possibly later
3321                                 case "svr$3" in
3322                                 ${osname}*)
3323                                         osname=svr$3
3324                                         osvers=$4
3325                                         ;;
3326                                 esac
3327                                 case "$osname" in
3328                                 svr4.0)
3329                                         : Check for ESIX
3330                                         if test -f /stand/boot ; then
3331                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3332                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3333                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3334                                                         if test -n "$isesix"; then
3335                                                                 osname=esix4
3336                                                         fi
3337                                                 fi
3338                                         fi
3339                                         ;;
3340                                 esac
3341                                 ;;
3342                         *)      if test -f /etc/systemid; then
3343                                         osname=sco
3344                                         set `echo $3 | $sed 's/\./ /g'` $4
3345                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3346                                                 osvers=$1.$2.$3
3347                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3348                                                 osvers=$1.$2
3349                                         elif $test -f $src/hints/sco_$1.sh; then
3350                                                 osvers=$1
3351                                         fi
3352                                 else
3353                                         case "$osname" in
3354                                         '') : Still unknown.  Probably a generic Sys V.
3355                                                 osname="sysv"
3356                                                 osvers="$3"
3357                                                 ;;
3358                                         esac
3359                                 fi
3360                                 ;;
3361                         esac
3362                         ;;
3363                 *)      case "$osname" in
3364                         '') : Still unknown.  Probably a generic BSD.
3365                                 osname="$1"
3366                                 osvers="$3"
3367                                 ;;
3368                         esac
3369                         ;;
3370                 esac
3371         else
3372                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3373                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3374                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3375                                 osname=news_os
3376                         fi
3377                         $rm -f UU/kernel.what
3378                 elif test -d c:/. -o -n "$is_os2" ; then
3379                         set X $myuname
3380                         osname=os2
3381                         osvers="$5"
3382                 fi
3383         fi
3384
3385         case "$targetarch" in
3386         '') ;;
3387         *)  hostarch=$osname
3388             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3389             osvers=''
3390             ;;
3391         esac
3392
3393         : Now look for a hint file osname_osvers, unless one has been
3394         : specified already.
3395         case "$hintfile" in
3396         ''|' ')
3397                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3398                 : Also try without trailing minor version numbers.
3399                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3400                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3401                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3402                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3403                 case "$file" in
3404                 '') dflt=none ;;
3405                 *)  case "$osvers" in
3406                         '') dflt=$file
3407                                 ;;
3408                         *)  if $test -f $src/hints/$file.sh ; then
3409                                         dflt=$file
3410                                 elif $test -f $src/hints/$xfile.sh ; then
3411                                         dflt=$xfile
3412                                 elif $test -f $src/hints/$xxfile.sh ; then
3413                                         dflt=$xxfile
3414                                 elif $test -f $src/hints/$xxxfile.sh ; then
3415                                         dflt=$xxxfile
3416                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3417                                         dflt=$xxxxfile
3418                                 elif $test -f "$src/hints/${osname}.sh" ; then
3419                                         dflt="${osname}"
3420                                 else
3421                                         dflt=none
3422                                 fi
3423                                 ;;
3424                         esac
3425                         ;;
3426                 esac
3427                 if $test -f Policy.sh ; then
3428                         case "$dflt" in
3429                         *Policy*) ;;
3430                         none) dflt="Policy" ;;
3431                         *) dflt="Policy $dflt" ;;
3432                         esac
3433                 fi
3434                 ;;
3435         *)
3436                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3437                 ;;
3438         esac
3439
3440         if $test -f Policy.sh ; then
3441                 $cat <<EOM
3442
3443 There's also a Policy hint file available, which should make the
3444 site-specific (policy) questions easier to answer.
3445 EOM
3446
3447         fi
3448
3449         $cat <<EOM
3450
3451 You may give one or more space-separated answers, or "none" if appropriate.
3452 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3453 previous run of Configure, you may specify it as well as or instead of
3454 OS-specific hints.  If hints are provided for your OS, you should use them:
3455 although Perl can probably be built without hints on many platforms, using
3456 hints often improve performance and may enable features that Configure can't
3457 set up on its own. If there are no hints that match your OS, specify "none";
3458 DO NOT give a wrong version or a wrong OS.
3459
3460 EOM
3461
3462         rp="Which of these apply, if any?"
3463         . UU/myread
3464         tans=$ans
3465         for file in $tans; do
3466                 if $test X$file = XPolicy -a -f Policy.sh; then
3467                         . Policy.sh
3468                         $cat Policy.sh >> UU/config.sh
3469                 elif $test -f $src/hints/$file.sh; then
3470                         . $src/hints/$file.sh
3471                         $cat $src/hints/$file.sh >> UU/config.sh
3472                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3473                         : nothing
3474                 else
3475                         : Give one chance to correct a possible typo.
3476                         echo "$file.sh does not exist"
3477                         dflt=$file
3478                         rp="hint to use instead?"
3479                         . UU/myread
3480                         for file in $ans; do
3481                                 if $test -f "$src/hints/$file.sh"; then
3482                                         . $src/hints/$file.sh
3483                                         $cat $src/hints/$file.sh >> UU/config.sh
3484                                 elif $test X$ans = X -o X$ans = Xnone ; then
3485                                         : nothing
3486                                 else
3487                                         echo "$file.sh does not exist -- ignored."
3488                                 fi
3489                         done
3490                 fi
3491         done
3492
3493         hint=recommended
3494         : Remember our hint file for later.
3495         if $test -f "$src/hints/$file.sh" ; then
3496                 hintfile="$file"
3497         else
3498                 hintfile=''
3499         fi
3500 fi
3501 cd UU
3502 ;;
3503 *)
3504         echo " "
3505         echo "Fetching default answers from $config_sh..." >&4
3506         tmp_n="$n"
3507         tmp_c="$c"
3508         cd ..
3509         cp $config_sh config.sh 2>/dev/null
3510         chmod +w config.sh
3511         . ./config.sh
3512         cd UU
3513         cp ../config.sh .
3514         n="$tmp_n"
3515         c="$tmp_c"
3516         hint=previous
3517         ;;
3518 esac
3519 test "$override" && . ./optdef.sh
3520
3521 : Restore computed paths
3522 for file in $loclist $trylist; do
3523         eval $file="\$_$file"
3524 done
3525
3526 cat << EOM
3527
3528 Configure uses the operating system name and version to set some defaults.
3529 The default value is probably right if the name rings a bell. Otherwise,
3530 since spelling matters for me, either accept the default or answer "none"
3531 to leave it blank.
3532
3533 EOM
3534 case "$osname" in
3535         ''|' ')
3536                 case "$hintfile" in
3537                 ''|' '|none) dflt=none ;;
3538                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3539                 esac
3540                 ;;
3541         *) dflt="$osname" ;;
3542 esac
3543 rp="Operating system name?"
3544 . ./myread
3545 case "$ans" in
3546 none)  osname='' ;;
3547 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3548 esac
3549 echo " "
3550 case "$osvers" in
3551         ''|' ')
3552                 case "$hintfile" in
3553                 ''|' '|none) dflt=none ;;
3554                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3555                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3556                         case "$dflt" in
3557                         ''|' ') dflt=none ;;
3558                         esac
3559                         ;;
3560                 esac
3561                 ;;
3562         *) dflt="$osvers" ;;
3563 esac
3564 rp="Operating system version?"
3565 . ./myread
3566 case "$ans" in
3567 none)  osvers='' ;;
3568 *) osvers="$ans" ;;
3569 esac
3570
3571
3572 . ./posthint.sh
3573
3574 : who configured the system
3575 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3576 case "$cf_by" in
3577 "")
3578         cf_by=`(logname) 2>/dev/null`
3579         case "$cf_by" in
3580         "")
3581                 cf_by=`(whoami) 2>/dev/null`
3582                 case "$cf_by" in
3583                 "") cf_by=unknown ;;
3584                 esac ;;
3585         esac ;;
3586 esac
3587
3588 : decide how portable to be.  Allow command line overrides.
3589 case "$d_portable" in
3590 "$undef") ;;
3591 *)      d_portable="$define" ;;
3592 esac
3593
3594 : set up shell script to do ~ expansion
3595 cat >filexp <<EOSS
3596 $startsh
3597 : expand filename
3598 case "\$1" in
3599  \~/*|\~)
3600         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3601         ;;
3602  \~*)
3603         if $test -f /bin/csh; then
3604                 /bin/csh -f -c "glob \$1"
3605                 failed=\$?
3606                 echo ""
3607                 exit \$failed
3608         else
3609                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3610                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3611                 if $test ! -d "\$dir"; then
3612                         me=\`basename \$0\`
3613                         echo "\$me: can't locate home directory for: \$name" >&2
3614                         exit 1
3615                 fi
3616                 case "\$1" in
3617                 */*)
3618                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3619                         ;;
3620                 *)
3621                         echo \$dir
3622                         ;;
3623                 esac
3624         fi
3625         ;;
3626 *)
3627         echo \$1
3628         ;;
3629 esac
3630 EOSS
3631 chmod +x filexp
3632 $eunicefix filexp
3633
3634 : now set up to get a file name
3635 cat <<EOS >getfile
3636 $startsh
3637 EOS
3638 cat <<'EOSC' >>getfile
3639 tilde=''
3640 fullpath=''
3641 already=''
3642 skip=''
3643 none_ok=''
3644 exp_file=''
3645 nopath_ok=''
3646 orig_rp="$rp"
3647 orig_dflt="$dflt"
3648 case "$gfpth" in
3649 '') gfpth='.' ;;
3650 esac
3651
3652 case "$fn" in
3653 *\(*)
3654         : getfile will accept an answer from the comma-separated list
3655         : enclosed in parentheses even if it does not meet other criteria.
3656         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3657         fn=`echo $fn | sed 's/(.*)//'`
3658         ;;
3659 esac
3660
3661 case "$fn" in
3662 *:*)
3663         loc_file=`expr $fn : '.*:\(.*\)'`
3664         fn=`expr $fn : '\(.*\):.*'`
3665         ;;
3666 esac
3667
3668 case "$fn" in
3669 *~*) tilde=true;;
3670 esac
3671 case "$fn" in
3672 */*) fullpath=true;;
3673 esac
3674 case "$fn" in
3675 *+*) skip=true;;
3676 esac
3677 case "$fn" in
3678 *n*) none_ok=true;;
3679 esac
3680 case "$fn" in
3681 *e*) exp_file=true;;
3682 esac
3683 case "$fn" in
3684 *p*) nopath_ok=true;;
3685 esac
3686
3687 case "$fn" in
3688 *f*) type='File';;
3689 *d*) type='Directory';;
3690 *l*) type='Locate';;
3691 esac
3692
3693 what="$type"
3694 case "$what" in
3695 Locate) what='File';;
3696 esac
3697
3698 case "$exp_file" in
3699 '')
3700         case "$d_portable" in
3701         "$define") ;;
3702         *) exp_file=true;;
3703         esac
3704         ;;
3705 esac
3706
3707 cd ..
3708 while test "$type"; do
3709         redo=''
3710         rp="$orig_rp"
3711         dflt="$orig_dflt"
3712         case "$tilde" in
3713         true) rp="$rp (~name ok)";;
3714         esac
3715         . UU/myread
3716         if test -f UU/getfile.ok && \
3717                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3718         then
3719                 value="$ans"
3720                 ansexp="$ans"
3721                 break
3722         fi
3723         case "$ans" in
3724         none)
3725                 value=''
3726                 ansexp=''
3727                 case "$none_ok" in
3728                 true) type='';;
3729                 esac
3730                 ;;
3731         *)
3732                 case "$tilde" in
3733                 '') value="$ans"
3734                         ansexp="$ans";;
3735                 *)
3736                         value=`UU/filexp $ans`
3737                         case $? in
3738                         0)
3739                                 if test "$ans" != "$value"; then
3740                                         echo "(That expands to $value on this system.)"
3741                                 fi
3742                                 ;;
3743                         *) value="$ans";;
3744                         esac
3745                         ansexp="$value"
3746                         case "$exp_file" in
3747                         '') value="$ans";;
3748                         esac
3749                         ;;
3750                 esac
3751                 case "$fullpath" in
3752                 true)
3753                         case "$ansexp" in
3754                         /*) value="$ansexp" ;;
3755                         [a-zA-Z]:/*) value="$ansexp" ;;
3756                         *)
3757                                 redo=true
3758                                 case "$already" in
3759                                 true)
3760                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3761                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3762                                         ;;
3763                                 *)
3764                                 echo "Please give a full path name, starting with slash." >&4
3765                                         case "$tilde" in
3766                                         true)
3767                                 echo "Note that using ~name is ok provided it expands well." >&4
3768                                                 already=true
3769                                                 ;;
3770                                         esac
3771                                 esac
3772                                 ;;
3773                         esac
3774                         ;;
3775                 esac
3776                 case "$redo" in
3777                 '')
3778                         case "$type" in
3779                         File)
3780                                 for fp in $gfpth; do
3781                                         if test "X$fp" = X.; then
3782                                             pf="$ansexp"
3783                                         else    
3784                                             pf="$fp/$ansexp"
3785                                         fi
3786                                         if test -f "$pf"; then
3787                                                 type=''
3788                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3789                                         then
3790                                                 echo "($value is not a plain file, but that's ok.)"
3791                                                 type=''
3792                                         fi
3793                                         if test X"$type" = X; then
3794                                             value="$pf"
3795                                             break
3796                                         fi
3797                                 done
3798                                 ;;
3799                         Directory)
3800                                 for fp in $gfpth; do
3801                                         if test "X$fp" = X.; then
3802                                             dir="$ans"
3803                                             direxp="$ansexp"
3804                                         else    
3805                                             dir="$fp/$ansexp"
3806                                             direxp="$fp/$ansexp"
3807                                         fi
3808                                         if test -d "$direxp"; then
3809                                                 type=''
3810                                                 value="$dir"
3811                                                 break
3812                                         fi
3813                                 done
3814                                 ;;
3815                         Locate)
3816                                 if test -d "$ansexp"; then
3817                                         echo "(Looking for $loc_file in directory $value.)"
3818                                         value="$value/$loc_file"
3819                                         ansexp="$ansexp/$loc_file"
3820                                 fi
3821                                 if test -f "$ansexp"; then
3822                                         type=''
3823                                 fi
3824                                 case "$nopath_ok" in
3825                                 true)   case "$value" in
3826                                         */*) ;;
3827                                         *)      echo "Assuming $value will be in people's path."
3828                                                 type=''
3829                                                 ;;
3830                                         esac
3831                                         ;;
3832                                 esac
3833                                 ;;
3834                         esac
3835
3836                         case "$skip" in
3837                         true) type='';
3838                         esac
3839
3840                         case "$type" in
3841                         '') ;;
3842                         *)
3843                                 if test "$fastread" = yes; then
3844                                         dflt=y
3845                                 else
3846                                         dflt=n
3847                                 fi
3848                                 rp="$what $value doesn't exist.  Use that name anyway?"
3849                                 . UU/myread
3850                                 dflt=''
3851                                 case "$ans" in
3852                                 y*) type='';;
3853                                 *) echo " ";;
3854                                 esac
3855                                 ;;
3856                         esac
3857                         ;;
3858                 esac
3859                 ;;
3860         esac
3861 done
3862 cd UU
3863 ans="$value"
3864 rp="$orig_rp"
3865 dflt="$orig_dflt"
3866 rm -f getfile.ok
3867 test "X$gfpthkeep" != Xy && gfpth=""
3868 EOSC
3869
3870 : determine root of directory hierarchy where package will be installed.
3871 case "$prefix" in
3872 '')
3873         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3874         ;;
3875 *?/)
3876         dflt=`echo "$prefix" | sed 's/.$//'`
3877         ;;
3878 *)
3879         dflt="$prefix"
3880         ;;
3881 esac
3882 $cat <<EOM
3883
3884 By default, $package will be installed in $dflt/bin, manual pages
3885 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3886 installation directories. Typically this is something like /usr/local.
3887 If you wish to have binaries under /usr/bin but other parts of the
3888 installation under /usr/local, that's ok: you will be prompted
3889 separately for each of the installation directories, the prefix being
3890 only used to set the defaults.
3891
3892 EOM
3893 fn=d~
3894 rp='Installation prefix to use?'
3895 . ./getfile
3896 oldprefix=''
3897 case "$prefix" in
3898 '') ;;
3899 *)
3900         case "$ans" in
3901         "$prefix") ;;
3902         *) oldprefix="$prefix";;
3903         esac
3904         ;;
3905 esac
3906 prefix="$ans"
3907 prefixexp="$ansexp"
3908
3909 : allow them to override the AFS root
3910 case "$afsroot" in
3911 '')     afsroot=/afs ;;
3912 *)      afsroot=$afsroot ;;
3913 esac
3914
3915 : is AFS running?
3916 echo " "
3917 case "$afs" in
3918 $define|true)   afs=true ;;
3919 $undef|false)   afs=false ;;
3920 *)      if $test -d $afsroot; then
3921                 afs=true
3922         else
3923                 afs=false
3924         fi
3925         ;;
3926 esac
3927 if $afs; then
3928         echo "AFS may be running... I'll be extra cautious then..." >&4
3929 else
3930         echo "AFS does not seem to be running..." >&4
3931 fi
3932
3933 : determine installation prefix for where package is to be installed.
3934 if $afs; then 
3935 $cat <<EOM
3936
3937 Since you are running AFS, I need to distinguish the directory in which
3938 files will reside from the directory in which they are installed (and from
3939 which they are presumably copied to the former directory by occult means).
3940
3941 EOM
3942         case "$installprefix" in
3943         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3944         *) dflt="$installprefix";;
3945         esac
3946 else
3947 $cat <<EOM
3948
3949 In some special cases, particularly when building $package for distribution,
3950 it is convenient to distinguish the directory in which files should be
3951 installed from the directory ($prefix) in which they will
3952 eventually reside.  For most users, these two directories are the same.
3953
3954 EOM
3955         case "$installprefix" in
3956         '') dflt=$prefix ;;
3957         *) dflt=$installprefix;;
3958         esac
3959 fi
3960 fn=d~
3961 rp='What installation prefix should I use for installing files?'
3962 . ./getfile
3963 installprefix="$ans"
3964 installprefixexp="$ansexp"
3965
3966 : Perform the prefixexp/installprefixexp correction if necessary
3967 cat <<EOS >installprefix
3968 $startsh
3969 EOS
3970 cat <<'EOSC' >>installprefix
3971 : Change installation prefix, if necessary.
3972 if $test X"$prefix" != X"$installprefix"; then
3973     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3974 else
3975     eval "install${prefixvar}=\"\$${prefixvar}exp\""
3976 fi
3977 EOSC
3978 chmod +x installprefix
3979 $eunicefix installprefix
3980
3981 : Set variables such as privlib and privlibexp from the output of ./getfile
3982 : performing the prefixexp/installprefixexp correction if necessary.
3983 cat <<EOS >setprefixvar
3984 $startsh
3985 EOS
3986 cat <<'EOSC' >>setprefixvar
3987 eval "${prefixvar}=\"\$ans\""
3988 eval "${prefixvar}exp=\"\$ansexp\""
3989 . ./installprefix
3990 EOSC
3991 chmod +x setprefixvar
3992 $eunicefix setprefixvar
3993
3994 : set up the script used to warn in case of inconsistency
3995 cat <<EOS >whoa
3996 $startsh
3997 EOS
3998 cat <<'EOSC' >>whoa
3999 dflt=y
4000 case "$hint" in
4001     recommended)
4002         case "$hintfile" in
4003         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4004                 ;;
4005         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4006                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4007                 ;;
4008         esac
4009         ;;
4010     *)  echo " "
4011         echo "*** WHOA THERE!!! ***" >&4
4012         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4013         ;;
4014 esac
4015 rp="    Keep the $hint value?"
4016 . ./myread
4017 case "$ans" in
4018 y) td=$was; tu=$was;;
4019 esac
4020 EOSC
4021
4022 : function used to set '$1' to '$val'
4023 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4024 case "$val$was" in
4025 $define$undef) . ./whoa; eval "$var=\$td";;
4026 $undef$define) . ./whoa; eval "$var=\$tu";;
4027 *) eval "$var=$val";;
4028 esac'
4029
4030 : Check is we will use socks
4031 case "$usesocks" in
4032 $define|true|[yY]*)     dflt='y';;
4033 *) dflt='n';;
4034 esac
4035 cat <<EOM
4036
4037 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4038 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4039 to use the PerlIO abstraction layer, this will be implicitly selected.
4040
4041 If this doesn't make any sense to you, just accept the default '$dflt'.
4042 EOM
4043 rp='Build Perl for SOCKS?'
4044 . ./myread
4045 case "$ans" in
4046 y|Y)    val="$define" ;;
4047 *)      val="$undef" ;;
4048 esac
4049 set usesocks
4050 eval $setvar
4051
4052 case "$usesocks" in
4053 $define|true|[yY]*) useperlio="$define";;
4054 esac
4055
4056 : Check if we want perlio
4057 case "$useperlio" in
4058 $define|true|[yY]*|'')  dflt='y';;
4059 *) dflt='n';;
4060 esac
4061 cat <<EOM
4062
4063 Previous version of $package used the standard IO mechanisms as
4064 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4065 alternate IO mechanisms via the PerlIO abstraction layer, but the
4066 stdio mechanism is still available if needed.  The abstraction layer
4067 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4068 Using PerlIO with sfio may cause problems with some extension modules.
4069
4070 If this doesn't make any sense to you, just accept the default '$dflt'.
4071 EOM
4072 rp='Use the PerlIO abstraction layer?'
4073 . ./myread
4074 case "$ans" in
4075 y|Y)
4076         val="$define"
4077         ;;
4078 *)
4079         echo "Ok, doing things the stdio way."
4080         val="$undef"
4081         ;;
4082 esac
4083 set useperlio
4084 eval $setvar
4085
4086 case "$usesocks" in
4087 $define|true|[yY]*)
4088         case "$useperlio" in
4089         $define|true|[yY]*) ;;
4090         *)      cat >&4 <<EOM
4091
4092 You are using the SOCKS proxy protocol library which means that you
4093 should also use the PerlIO layer.  You may be headed for trouble.
4094
4095 EOM
4096                 ;;
4097         esac
4098         ;;
4099 esac
4100
4101 : get the patchlevel
4102 echo " "
4103 echo "Getting the current patchlevel..." >&4
4104 if $test -r $rsrc/patchlevel.h;then
4105         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4106         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4107         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4108         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4109         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4110         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4111         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4112 else
4113         revision=0
4114         patchlevel=0
4115         subversion=0
4116         api_revision=0
4117         api_version=0
4118         api_subversion=0
4119         perl_patchlevel=0
4120         $echo "(You do not have patchlevel.h.  Eek.)"
4121 fi
4122 if $test -r $rsrc/.patch ; then
4123         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4124                 perl_patchlevel=`cat $rsrc/.patch`
4125         fi
4126 fi
4127 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4128 version_patchlevel_string="version $patchlevel subversion $subversion"
4129 case "$perl_patchlevel" in
4130 0|'') ;;
4131 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
4132 esac
4133
4134 $echo "(You have $package $version_patchlevel_string.)"
4135
4136 case "$osname" in
4137 dos|vms)
4138         : XXX Should be a Configure test for double-dots in filenames.
4139         version=`echo $revision $patchlevel $subversion | \
4140                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4141         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4142                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4143         ;;
4144 *)
4145         version=`echo $revision $patchlevel $subversion | \
4146                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4147         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4148                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4149         ;;
4150 esac
4151 : Special case the 5.005_xx maintenance series, which used 5.005
4152 : without any subversion label as a subdirectory in $sitelib
4153 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4154         api_versionstring='5.005'
4155 fi
4156
4157 : Do we want threads support and if so, what type
4158 case "$usethreads" in
4159 $define|true|[yY]*)     dflt='y';;
4160 *)     # Catch case where user specified ithreads or 5005threads but
4161        # forgot -Dusethreads (A.D. 4/2002)
4162        case "$useithreads$use5005threads" in
4163        *$define*)
4164                 case "$useperlio" in
4165                 "$define")      dflt='y' ;;
4166                 *)              dflt='n' ;;
4167                 esac
4168                 ;;
4169        *)       dflt='n';;
4170        esac
4171        ;;
4172 esac
4173 cat <<EOM
4174
4175 Perl can be built to take advantage of threads on some systems.
4176 To do so, Configure can be run with -Dusethreads.
4177
4178 Note that Perl built with threading support runs slightly slower
4179 and uses more memory than plain Perl. The current implementation
4180 is believed to be stable, but it is fairly new, and so should be
4181 treated with caution.
4182
4183 If this doesn't make any sense to you, just accept the default '$dflt'.
4184 EOM
4185 rp='Build a threading Perl?'
4186 . ./myread
4187 case "$ans" in
4188 y|Y)    val="$define" ;;
4189 *)      val="$undef" ;;
4190 esac
4191 set usethreads
4192 eval $setvar
4193
4194 if $test $patchlevel -lt 9; then
4195     case "$usethreads" in
4196     $define)
4197         $cat <<EOM
4198
4199 Since release 5.6, Perl has had two different threading implementations,
4200 the newer interpreter-based version (ithreads) with one interpreter per
4201 thread, and the older 5.005 version (5005threads).
4202 The 5005threads version is effectively unmaintained and will probably be
4203 removed in Perl 5.10, so there should be no need to build a Perl using it
4204 unless needed for backwards compatibility with some existing 5.005threads
4205 code.
4206
4207 EOM
4208         : Default to ithreads unless overridden on command line or with
4209         : old config.sh
4210         dflt='y'
4211         case "$use5005threads" in
4212                 $define|true|[yY]*) dflt='n';;
4213         esac
4214         case "$useithreads" in
4215                 $undef|false|[nN]*) dflt='n';;
4216         esac
4217         rp='Use the newer interpreter-based ithreads?'
4218         . ./myread
4219         case "$ans" in
4220         y|Y)    val="$define" ;;
4221         *)      val="$undef" ;;
4222         esac
4223         set useithreads
4224         eval $setvar
4225         : Now set use5005threads to the opposite value.
4226         case "$useithreads" in
4227         $define) val="$undef" ;;
4228         *) val="$define" ;;
4229         esac
4230         set use5005threads
4231         eval $setvar
4232         ;;
4233     *)
4234         useithreads="$undef"
4235         use5005threads="$undef"
4236         ;;
4237     esac
4238
4239     case "$useithreads$use5005threads" in
4240     "$define$define")
4241         $cat >&4 <<EOM
4242
4243 You cannot have both the ithreads and the 5.005 threads enabled
4244 at the same time.  Disabling the 5.005 threads since they are
4245 much less stable than the ithreads.
4246
4247 EOM
4248         use5005threads="$undef"
4249         ;;
4250     esac
4251
4252 else
4253 : perl-5.9.x and later
4254
4255     if test X"$usethreads" = "X$define"; then
4256         case "$use5005threads" in
4257             $define|true|[yY]*)
4258                 $cat >&4 <<EOM
4259
4260 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4261
4262 EOM
4263             ;;
4264         esac
4265     fi
4266
4267     use5005threads="$undef"
4268     useithreads="$usethreads"
4269 fi
4270
4271 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4272         cat >&4 <<EOF
4273 ***
4274 *** To build with ithreads you must also use the PerlIO layer.
4275 *** Cannot continue, aborting.
4276 ***
4277 EOF
4278         exit 1
4279 fi
4280
4281 case "$d_oldpthreads" in
4282 '')     : Configure tests would be welcome here.  For now, assume undef.
4283         val="$undef" ;;
4284 *)      val="$d_oldpthreads" ;;
4285 esac
4286 set d_oldpthreads
4287 eval $setvar
4288
4289
4290 : Look for a hint-file generated 'call-back-unit'.  If the
4291 : user has specified that a threading perl is to be built,
4292 : we may need to set or change some other defaults.
4293 if $test -f usethreads.cbu; then
4294     echo "Your platform has some specific hints regarding threaded builds, using them..."
4295     . ./usethreads.cbu
4296 else
4297     case "$usethreads" in
4298         "$define"|true|[yY]*)
4299                 $cat <<EOM
4300 (Your platform does not have any specific hints for threaded builds.
4301  Assuming POSIX threads, then.)
4302 EOM
4303         ;;
4304     esac
4305 fi
4306
4307 : Check if multiplicity is required
4308 cat <<EOM
4309
4310 Perl can be built so that multiple Perl interpreters can coexist
4311 within the same Perl executable.
4312 EOM
4313
4314 case "$useithreads" in
4315 $define)
4316         cat <<EOM
4317 This multiple interpreter support is required for interpreter-based threads.
4318 EOM
4319         val="$define"
4320         ;;
4321 *)      case "$usemultiplicity" in
4322         $define|true|[yY]*)     dflt='y';;
4323         *) dflt='n';;
4324         esac
4325         echo " "
4326         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4327         rp='Build Perl for multiplicity?'
4328         . ./myread
4329         case "$ans" in
4330         y|Y)    val="$define" ;;
4331         *)      val="$undef" ;;
4332         esac
4333         ;;
4334 esac
4335 set usemultiplicity
4336 eval $setvar
4337
4338 : Check if morebits is requested
4339 case "$usemorebits" in
4340 "$define"|true|[yY]*)
4341         use64bitint="$define"
4342         uselongdouble="$define"
4343         usemorebits="$define"
4344         ;;
4345 *)      usemorebits="$undef"
4346         ;;
4347 esac
4348
4349 : Determine the C compiler to be used
4350 echo " "
4351 case "$cc" in
4352 '') dflt=cc;;
4353 *) dflt="$cc";;
4354 esac
4355 rp="Use which C compiler?"
4356 . ./myread
4357 cc="$ans"
4358
4359 : See whether they have no cc but they do have gcc
4360 . ./trygcc
4361 if $test -f cc.cbu; then
4362     . ./cc.cbu
4363 fi
4364 . ./checkcc
4365
4366 : make some quick guesses about what we are up against
4367 echo " "
4368 $echo $n "Hmm...  $c"
4369 echo exit 1 >bsd
4370 echo exit 1 >usg
4371 echo exit 1 >v7
4372 echo exit 1 >osf1
4373 echo exit 1 >eunice
4374 echo exit 1 >xenix
4375 echo exit 1 >venix
4376 echo exit 1 >os2
4377 d_bsd="$undef"
4378 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4379 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4380 then
4381         echo "Looks kind of like an OSF/1 system, but we'll see..."
4382         echo exit 0 >osf1
4383 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4384         xxx=`./loc addbib blurfl $pth`
4385         if $test -f $xxx; then
4386         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4387                 echo exit 0 >bsd
4388                 echo exit 0 >usg
4389         else
4390                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4391                         echo "Looks kind of like an extended USG system, but we'll see..."
4392                 else
4393                         echo "Looks kind of like a USG system, but we'll see..."
4394                 fi
4395                 echo exit 0 >usg
4396         fi
4397 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4398         echo "Looks kind of like a BSD system, but we'll see..."
4399         d_bsd="$define"
4400         echo exit 0 >bsd
4401 else
4402         echo "Looks kind of like a Version 7 system, but we'll see..."
4403         echo exit 0 >v7
4404 fi
4405 case "$eunicefix" in
4406 *unixtovms*)
4407         $cat <<'EOI'
4408 There is, however, a strange, musty smell in the air that reminds me of
4409 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4410 EOI
4411         echo exit 0 >eunice
4412         d_eunice="$define"
4413 : it so happens the Eunice I know will not run shell scripts in Unix format
4414         ;;
4415 *)
4416         echo " "
4417         echo "Congratulations.  You aren't running Eunice."
4418         d_eunice="$undef"
4419         ;;
4420 esac
4421 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4422 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4423 : semicolon as a patch separator
4424 case "$p_" in
4425 :) ;;
4426 *)
4427         $cat <<'EOI'
4428 I have the feeling something is not exactly right, however...don't tell me...
4429 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4430 (Or you may be running DOS with DJGPP.)
4431 EOI
4432         echo exit 0 >os2
4433         ;;
4434 esac
4435 if test -f /xenix; then
4436         echo "Actually, this looks more like a XENIX system..."
4437         echo exit 0 >xenix
4438         d_xenix="$define"
4439 else
4440         echo " "
4441         echo "It's not Xenix..."
4442         d_xenix="$undef"
4443 fi
4444 chmod +x xenix
4445 $eunicefix xenix
4446 if test -f /venix; then
4447         echo "Actually, this looks more like a VENIX system..."
4448         echo exit 0 >venix
4449 else
4450         echo " "
4451         if ./xenix; then
4452                 : null
4453         else
4454                 echo "Nor is it Venix..."
4455         fi
4456 fi
4457 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4458 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4459 $rm -f foo
4460
4461 : Check if we are using GNU gcc and what its version is
4462 echo " "
4463 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4464 $cat >try.c <<EOM
4465 #include <stdio.h>
4466 int main() {
4467 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4468 #ifdef __VERSION__
4469         printf("%s\n", __VERSION__);
4470 #else
4471         printf("%s\n", "1");
4472 #endif
4473 #endif
4474         return(0);
4475 }
4476 EOM
4477 if $cc -o try $ccflags $ldflags try.c; then
4478         gccversion=`$run ./try`
4479         case "$gccversion" in
4480         '') echo "You are not using GNU cc." ;;
4481         *)  echo "You are using GNU cc $gccversion."
4482             ccname=gcc
4483             ;;
4484         esac
4485 else
4486         echo " "
4487         echo "*** WHOA THERE!!! ***" >&4
4488         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4489         case "$knowitall" in
4490         '')
4491         echo "    You'd better start hunting for one and let me know about it." >&4
4492                 exit 1
4493                 ;;
4494         esac
4495 fi
4496 $rm -f try try.*
4497 case "$gccversion" in
4498 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4499 esac
4500 case "$gccversion" in
4501 '') gccosandvers='' ;;
4502 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4503    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4504    gccshortvers=''
4505    case "$gccosandvers" in
4506    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4507    $osname$osvers) ;; # looking good
4508    $osname*) cat <<EOM >&4
4509
4510 *** WHOA THERE!!! ***
4511
4512     Your gcc has not been compiled for the exact release of
4513     your operating system ($gccosandvers versus $osname$osvers).
4514
4515     In general it is a good idea to keep gcc synchronized with
4516     the operating system because otherwise serious problems
4517     may ensue when trying to compile software, like Perl.
4518
4519     I'm trying to be optimistic here, though, and will continue.
4520     If later during the configuration and build icky compilation
4521     problems appear (headerfile conflicts being the most common
4522     manifestation), I suggest reinstalling the gcc to match
4523     your operating system release.
4524
4525 EOM
4526       ;;
4527    *) gccosandvers='' ;; # failed to parse, better be silent
4528    esac
4529    ;;
4530 esac
4531 case "$ccname" in
4532 '') ccname="$cc" ;;
4533 esac
4534
4535 # gcc 3.* complain about adding -Idirectories that they already know about,
4536 # so we will take those off from locincpth.
4537 case "$gccversion" in
4538 3*)
4539     echo "main(){}">try.c
4540     for incdir in $locincpth; do
4541        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4542              grep '^c[cp]p*[01]: warning: changing search order '`
4543        if test "X$warn" != X; then
4544            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4545        fi
4546     done
4547     $rm -f try try.*
4548 esac
4549
4550 : What should the include directory be ?
4551 echo " "
4552 $echo $n "Hmm...  $c"
4553 dflt='/usr/include'
4554 incpath=''
4555 mips_type=''
4556 if $test -f /bin/mips && /bin/mips; then
4557         echo "Looks like a MIPS system..."
4558         $cat >usr.c <<'EOCP'
4559 #ifdef SYSTYPE_BSD43
4560 /bsd43
4561 #endif
4562 EOCP
4563         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4564                 dflt='/bsd43/usr/include'
4565                 incpath='/bsd43'
4566                 mips_type='BSD 4.3'
4567         else
4568                 mips_type='System V'
4569         fi
4570         $rm -f usr.c usr.out
4571         echo "and you're compiling with the $mips_type compiler and libraries."
4572         xxx_prompt=y
4573         echo "exit 0" >mips
4574 else
4575         echo "Doesn't look like a MIPS system."
4576         xxx_prompt=n
4577         echo "exit 1" >mips
4578 fi
4579 chmod +x mips
4580 $eunicefix mips
4581 case "$usrinc" in
4582 '') ;;
4583 *) dflt="$usrinc";;
4584 esac
4585 case "$xxx_prompt" in
4586 y)      fn=d/
4587         echo " "
4588         rp='Where are the include files you want to use?'
4589         . ./getfile
4590         usrinc="$ans"
4591         ;;
4592 *)      usrinc="$dflt"
4593         ;;
4594 esac
4595
4596 : see how we invoke the C preprocessor
4597 echo " "
4598 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4599 cat <<'EOT' >testcpp.c
4600 #define ABC abc
4601 #define XYZ xyz
4602 ABC.XYZ
4603 EOT
4604 cd ..
4605 if test ! -f cppstdin; then
4606         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4607                 # AIX cc -E doesn't show the absolute headerfile
4608                 # locations but we'll cheat by using the -M flag.
4609                 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
4610         else
4611                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4612         fi
4613 else
4614         echo "Keeping your $hint cppstdin wrapper."
4615 fi
4616 chmod 755 cppstdin
4617 wrapper=`pwd`/cppstdin
4618 ok='false'
4619 cd UU
4620
4621 if $test "X$cppstdin" != "X" && \
4622         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4623         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4624 then
4625         echo "You used to use $cppstdin $cppminus so we'll use that again."
4626         case "$cpprun" in
4627         '') echo "But let's see if we can live without a wrapper..." ;;
4628         *)
4629                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4630                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4631                 then
4632                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4633                         ok='true'
4634                 else
4635                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4636                 fi
4637                 ;;
4638         esac
4639 else
4640         case "$cppstdin" in
4641         '') ;;
4642         *)
4643                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4644                 ;;
4645         esac
4646 fi
4647
4648 if $ok; then
4649         : nothing
4650 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4651         $cc -E <testcpp.c >testcpp.out 2>&1; \
4652         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4653         echo "Yup, it does."
4654         x_cpp="$cc -E"
4655         x_minus='';
4656 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4657         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4658         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4659         echo "Yup, it does."
4660         x_cpp="$cc -E"
4661         x_minus='-';
4662 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4663         $cc -P <testcpp.c >testcpp.out 2>&1; \
4664         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4665         echo "Yipee, that works!"
4666         x_cpp="$cc -P"
4667         x_minus='';
4668 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4669         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4670         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4671         echo "At long last!"
4672         x_cpp="$cc -P"
4673         x_minus='-';
4674 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4675         $cpp <testcpp.c >testcpp.out 2>&1; \
4676         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4677         echo "It works!"
4678         x_cpp="$cpp"
4679         x_minus='';
4680 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4681         $cpp - <testcpp.c >testcpp.out 2>&1; \
4682         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4683         echo "Hooray, it works!  I was beginning to wonder."
4684         x_cpp="$cpp"
4685         x_minus='-';
4686 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4687         $wrapper <testcpp.c >testcpp.out 2>&1; \
4688         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4689         x_cpp="$wrapper"
4690         x_minus=''
4691         echo "Eureka!"
4692 else
4693         dflt=''
4694         rp="No dice.  I can't find a C preprocessor.  Name one:"
4695         . ./myread
4696         x_cpp="$ans"
4697         x_minus=''
4698         $x_cpp <testcpp.c >testcpp.out 2>&1
4699         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4700                 echo "OK, that will do." >&4
4701         else
4702 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4703                 exit 1
4704         fi
4705 fi
4706
4707 case "$ok" in
4708 false)
4709         cppstdin="$x_cpp"
4710         cppminus="$x_minus"
4711         cpprun="$x_cpp"
4712         cpplast="$x_minus"
4713         set X $x_cpp
4714         shift
4715         case "$1" in
4716         "$cpp")
4717                 echo "Perhaps can we force $cc -E using a wrapper..."
4718                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4719                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4720                 then
4721                         echo "Yup, we can."
4722                         cppstdin="$wrapper"
4723                         cppminus='';
4724                 else
4725                         echo "Nope, we'll have to live without it..."
4726                 fi
4727                 ;;
4728         esac
4729         case "$cpprun" in
4730         "$wrapper")
4731                 cpprun=''
4732                 cpplast=''
4733                 ;;
4734         esac
4735         ;;
4736 esac
4737
4738 case "$cppstdin" in
4739 "$wrapper"|'cppstdin') ;;
4740 *) $rm -f $wrapper;;
4741 esac
4742 $rm -f testcpp.c testcpp.out
4743
4744 : Set private lib path
4745 case "$plibpth" in
4746 '') if ./mips; then
4747                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4748         fi;;
4749 esac
4750 case "$libpth" in
4751 ' ') dlist='';;
4752 '') dlist="$loclibpth $plibpth $glibpth";;
4753 *) dlist="$libpth";;
4754 esac
4755
4756 : Now check and see which directories actually exist, avoiding duplicates
4757 libpth=''
4758 for xxx in $dlist
4759 do
4760     if $test -d $xxx; then
4761                 case " $libpth " in
4762                 *" $xxx "*) ;;
4763                 *) libpth="$libpth $xxx";;
4764                 esac
4765     fi
4766 done
4767 $cat <<'EOM'
4768
4769 Some systems have incompatible or broken versions of libraries.  Among
4770 the directories listed in the question below, please remove any you
4771 know not to be holding relevant libraries, and add any that are needed.
4772 Say "none" for none.
4773
4774 EOM
4775 case "$libpth" in
4776 '') dflt='none';;
4777 *)
4778         set X $libpth
4779         shift
4780         dflt=${1+"$@"}
4781         ;;
4782 esac
4783 rp="Directories to use for library searches?"
4784 . ./myread
4785 case "$ans" in
4786 none) libpth=' ';;
4787 *) libpth="$ans";;
4788 esac
4789
4790 : compute shared library extension
4791 case "$so" in
4792 '')
4793         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4794                 dflt='sl'
4795         else
4796                 dflt='so'
4797         fi
4798         ;;
4799 *) dflt="$so";;
4800 esac
4801 $cat <<EOM
4802
4803 On some systems, shared libraries may be available.  Answer 'none' if
4804 you want to suppress searching of shared libraries for the remainder
4805 of this configuration.
4806
4807 EOM
4808 rp='What is the file extension used for shared libraries?'
4809 . ./myread
4810 so="$ans"
4811
4812 : Define several unixisms.
4813 : Hints files or command line option can be used to override them.
4814 : The convoluted testing is in case hints files set either the old
4815 : or the new name.
4816 case "$_exe" in
4817 '')     case "$exe_ext" in
4818         '')     ;;
4819         *)      _exe="$exe_ext" ;;
4820         esac
4821         ;;
4822 esac
4823 case "$_a" in
4824 '')     case "$lib_ext" in
4825     '') _a='.a';;
4826         *)      _a="$lib_ext" ;;
4827         esac
4828         ;;
4829 esac
4830 case "$_o" in
4831 '') case "$obj_ext" in
4832         '')     _o='.o';;
4833         *)      _o="$obj_ext";;
4834         esac
4835         ;;
4836 esac
4837 case "$p_" in
4838 '') case "$path_sep" in
4839         '')     p_=':';;
4840         *)      p_="$path_sep";;
4841         esac
4842         ;;
4843 esac
4844 exe_ext=$_exe
4845 lib_ext=$_a
4846 obj_ext=$_o
4847 path_sep=$p_
4848
4849 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4850
4851 : Which makefile gets called first.  This is used by make depend.
4852 case "$firstmakefile" in
4853 '') firstmakefile='makefile';;
4854 esac
4855
4856 : Check for uselongdouble support
4857 case "$ccflags" in
4858 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4859 esac
4860
4861 case "$uselongdouble" in
4862 $define|true|[yY]*)     dflt='y';;
4863 *) dflt='n';;
4864 esac
4865 cat <<EOM
4866
4867 Perl can be built to take advantage of long doubles which
4868 (if available) may give more accuracy and range for floating point numbers.
4869
4870 If this doesn't make any sense to you, just accept the default '$dflt'.
4871 EOM
4872 rp='Try to use long doubles if available?'
4873 . ./myread
4874 case "$ans" in
4875 y|Y)    val="$define"   ;;
4876 *)      val="$undef"    ;;
4877 esac
4878 set uselongdouble
4879 eval $setvar
4880
4881 case "$uselongdouble" in
4882 true|[yY]*) uselongdouble="$define" ;;
4883 esac
4884
4885 : Look for a hint-file generated 'call-back-unit'.  If the
4886 : user has specified that long doubles should be used,
4887 : we may need to set or change some other defaults.
4888 if $test -f uselongdouble.cbu; then
4889     echo "Your platform has some specific hints regarding long doubles, using them..."
4890     . ./uselongdouble.cbu
4891 else
4892     case "$uselongdouble" in
4893         $define)
4894                 $cat <<EOM
4895 (Your platform does not have any specific hints for long doubles.)
4896 EOM
4897         ;;
4898     esac
4899 fi
4900
4901 : Looking for optional libraries
4902 echo " "
4903 echo "Checking for optional libraries..." >&4
4904 case "$libs" in
4905 ' '|'') dflt='';;
4906 *) dflt="$libs";;
4907 esac
4908 case "$libswanted" in
4909 '') libswanted='c_s';;
4910 esac
4911 case "$usesocks" in
4912 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4913 esac
4914 libsfound=''
4915 libsfiles=''
4916 libsdirs=''
4917 libspath=''
4918 for thisdir in $libpth $xlibpth; do
4919   test -d $thisdir && libspath="$libspath $thisdir"
4920 done
4921 for thislib in $libswanted; do
4922         for thisdir in $libspath; do
4923             xxx=''
4924             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4925                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4926                 $test -f "$xxx" && eval $libscheck
4927                 $test -f "$xxx" && libstyle=shared
4928             fi
4929             if test ! -f "$xxx"; then
4930                 xxx=$thisdir/lib$thislib.$so
4931                 $test -f "$xxx" && eval $libscheck
4932                 $test -f "$xxx" && libstyle=shared
4933             fi
4934             if test ! -f "$xxx"; then
4935                 xxx=$thisdir/lib$thislib$_a
4936                 $test -f "$xxx" && eval $libscheck
4937                 $test -f "$xxx" && libstyle=static
4938             fi
4939             if test ! -f "$xxx"; then
4940                 xxx=$thisdir/$thislib$_a
4941                 $test -f "$xxx" && eval $libscheck
4942                 $test -f "$xxx" && libstyle=static
4943             fi
4944             if test ! -f "$xxx"; then
4945                 xxx=$thisdir/lib${thislib}_s$_a
4946                 $test -f "$xxx" && eval $libscheck
4947                 $test -f "$xxx" && libstyle=static
4948                 $test -f "$xxx" && thislib=${thislib}_s
4949             fi
4950             if test ! -f "$xxx"; then
4951                 xxx=$thisdir/Slib$thislib$_a
4952                 $test -f "$xxx" && eval $libscheck
4953                 $test -f "$xxx" && libstyle=static
4954             fi
4955             if $test -f "$xxx"; then
4956                 case "$libstyle" in
4957                 shared) echo "Found -l$thislib (shared)." ;;
4958                 static) echo "Found -l$thislib." ;;
4959                 *)      echo "Found -l$thislib ($libstyle)." ;;
4960                 esac
4961                 case " $dflt " in
4962                 *"-l$thislib "*);;
4963                 *) dflt="$dflt -l$thislib"
4964                    libsfound="$libsfound $xxx"
4965                    yyy=`basename $xxx`
4966                    libsfiles="$libsfiles $yyy"
4967                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4968                    case " $libsdirs " in
4969                    *" $yyy "*) ;;
4970                    *) libsdirs="$libsdirs $yyy" ;;
4971                    esac
4972                    ;;
4973                 esac
4974                 break
4975             fi
4976         done
4977         if $test ! -f "$xxx"; then
4978             echo "No -l$thislib."
4979         fi
4980 done
4981 set X $dflt
4982 shift
4983 dflt="$*"
4984 case "$libs" in
4985 '') dflt="$dflt";;
4986 *) dflt="$libs";;
4987 esac
4988 case "$dflt" in
4989 ' '|'') dflt='none';;
4990 esac
4991
4992 $cat <<EOM
4993
4994 In order to compile $package on your machine, a number of libraries
4995 are usually needed.  Include any other special libraries here as well.
4996 Say "none" for none.  The default list is almost always right.
4997 EOM
4998
4999 echo " "
5000 rp="What libraries to use?"
5001 . ./myread
5002 case "$ans" in
5003 none) libs=' ';;
5004 *) libs="$ans";;
5005 esac
5006
5007 : determine optimization, if desired, or use for debug flag also
5008 case "$optimize" in
5009 ' '|$undef) dflt='none';;
5010 '') dflt='-O';;
5011 *) dflt="$optimize";;
5012 esac
5013 $cat <<EOH
5014
5015 By default, $package compiles with the -O flag to use the optimizer.
5016 Alternately, you might want to use the symbolic debugger, which uses
5017 the -g flag (on traditional Unix systems).  Either flag can be
5018 specified here.  To use neither flag, specify the word "none".
5019
5020 EOH
5021 rp="What optimizer/debugger flag should be used?"
5022 . ./myread
5023 optimize="$ans"
5024 case "$optimize" in
5025 'none') optimize=" ";;
5026 esac
5027
5028 : Check what DEBUGGING is required from the command line
5029 : -DEBUGGING      or -DDEBUGGING or
5030 : -DEBUGGING=both                       = -g + -DDEBUGGING
5031 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5032 : -DEBUGGING=none or -UDEBUGGING        =
5033 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5034 case "$EBUGGING" in
5035 '')     ;;
5036 *)      DEBUGGING=$EBUGGING ;;
5037 esac
5038
5039 case "$DEBUGGING" in
5040 -g|both|$define)
5041     case "$optimize" in
5042         *-g*) ;;
5043         *)    optimize="$optimize -g" ;;
5044     esac ;;
5045 none|$undef)
5046     case "$optimize" in
5047         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5048                 shift
5049                 optimize="$*"
5050                 ;;
5051     esac ;;
5052 esac
5053
5054 dflt=''
5055 case "$DEBUGGING" in
5056 both|$define) dflt='-DDEBUGGING'
5057 esac
5058
5059 : argument order is deliberate, as the flag will start with - which set could
5060 : think is an option
5061 checkccflag='check=$1; flag=$2; callback=$3;
5062 echo " ";
5063 echo "Checking if your compiler accepts $flag" 2>&1;
5064 echo "int main(void) { return 0; }" > gcctest.c;
5065 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5066     echo "Yes, it does." 2>&1;
5067     if $test -s gcctest.out ; then
5068         echo "But your platform does not like it:";
5069         cat gcctest.out;
5070     else
5071         case "$ccflags" in
5072         *$check*)
5073             echo "Leaving current flags $ccflags alone." 2>&1
5074             ;;
5075         *) dflt="$dflt $flag";
5076             eval $callback
5077             ;;
5078         esac
5079     fi
5080 else
5081     echo "Nope, it does not, but that is ok." 2>&1;
5082 fi
5083 '
5084
5085 : We will not override a previous value, but we might want to
5086 : augment a hint file
5087 case "$hint" in
5088 default|recommended)
5089         case "$gccversion" in
5090         1*) dflt="$dflt -fpcc-struct-return" ;;
5091         esac
5092         case "$optimize:$DEBUGGING" in
5093         *-g*:old) dflt="$dflt -DDEBUGGING";;
5094         esac
5095         case "$gccversion" in
5096         2*) if $test -d /etc/conf/kconfig.d &&
5097                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5098                 then
5099                         # Interactive Systems (ISC) POSIX mode.
5100                         dflt="$dflt -posix"
5101                 fi
5102                 ;;
5103         esac
5104         case "$gccversion" in
5105         1*) ;;
5106         2.[0-8]*) ;;
5107         ?*)     set strict-aliasing -fno-strict-aliasing
5108                 eval $checkccflag
5109                 ;;
5110         esac
5111         # For gcc, adding -pipe speeds up compilations for some, but apparently
5112         # some assemblers can't read from stdin.  (It also slows down compilations
5113         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5114         case "$gccversion" in
5115         ?*)     set pipe -pipe
5116                 eval $checkccflag
5117                 ;;
5118         esac
5119
5120         # on x86_64 (at least) we require an extra library (libssp) in the
5121         # link command line. This library is not named, so I infer that it is
5122         # an implementation detail that may change. Hence the safest approach
5123         # is to add the flag to the flags passed to the compiler at link time,
5124         # as that way the compiler can do the right implementation dependant
5125         # thing. (NWC)
5126         case "$gccversion" in
5127         ?*)     set stack-protector -fstack-protector
5128                 eval $checkccflag
5129                 ;;
5130         esac
5131         ;;
5132 esac
5133
5134 case "$mips_type" in
5135 *BSD*|'') inclwanted="$locincpth $usrinc";;
5136 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5137 esac
5138 for thisincl in $inclwanted; do
5139         if $test -d $thisincl; then
5140                 if $test x$thisincl != x$usrinc; then
5141                         case "$dflt" in
5142                         *" -I$thisincl "*);;
5143                         *) dflt="$dflt -I$thisincl ";;
5144                         esac
5145                 fi
5146         fi
5147 done
5148
5149 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5150         xxx=true;
5151 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5152         xxx=true;
5153 else
5154         xxx=false;
5155 fi;
5156 if $xxx; then
5157         case "$dflt" in
5158         *$2*);;
5159         *) dflt="$dflt -D$2";;
5160         esac;
5161 fi'
5162
5163 set signal.h LANGUAGE_C; eval $inctest
5164
5165 case "$usesocks" in
5166 $define)
5167         ccflags="$ccflags -DSOCKS"
5168         ;;
5169 esac
5170
5171 case "$hint" in
5172 default|recommended) dflt="$ccflags $dflt" ;;
5173 *) dflt="$ccflags";;
5174 esac
5175
5176 case "$dflt" in
5177 ''|' ') dflt=none;;
5178 esac
5179
5180 $cat <<EOH
5181
5182 Your C compiler may want other flags.  For this question you should include
5183 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5184 but you should NOT include libraries or ld flags like -lwhatever.  If you
5185 want $package to honor its debug switch, you should include -DDEBUGGING here.
5186 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5187
5188 To use no flags, specify the word "none".
5189
5190 EOH
5191 set X $dflt
5192 shift
5193 dflt=${1+"$@"}
5194 rp="Any additional cc flags?"
5195 . ./myread
5196 case "$ans" in
5197 none) ccflags='';;
5198 *) ccflags="$ans";;
5199 esac
5200
5201 : the following weeds options from ccflags that are of no interest to cpp
5202 case "$cppflags" in
5203 '') cppflags="$ccflags" ;;
5204 *)  cppflags="$cppflags $ccflags" ;;
5205 esac
5206 case "$gccversion" in
5207 1*) cppflags="$cppflags -D__GNUC__"
5208 esac
5209 case "$mips_type" in
5210 '');;
5211 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5212 esac
5213 case "$cppflags" in
5214 '');;
5215 *)
5216         echo " "
5217         echo "Let me guess what the preprocessor flags are..." >&4
5218         set X $cppflags
5219         shift
5220         cppflags=''
5221         $cat >cpp.c <<'EOM'
5222 #define BLURFL foo
5223
5224 BLURFL xx LFRULB
5225 EOM
5226         previous=''
5227         for flag in $*
5228         do
5229                 case "$flag" in
5230                 -*) ftry="$flag";;
5231                 *) ftry="$previous $flag";;
5232                 esac
5233                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5234                         >cpp1.out 2>/dev/null && \
5235                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5236                         >cpp2.out 2>/dev/null && \
5237                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5238                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5239                 then
5240                         cppflags="$cppflags $ftry"
5241                         previous=''
5242                 else
5243                         previous="$flag"
5244                 fi
5245         done
5246         set X $cppflags
5247         shift
5248         cppflags=${1+"$@"}
5249         case "$cppflags" in
5250         *-*)  echo "They appear to be: $cppflags";;
5251         esac
5252         $rm -f cpp.c cpp?.out
5253         ;;
5254 esac
5255
5256 : flags used in final linking phase
5257 case "$ldflags" in
5258 '') if ./venix; then
5259                 dflt='-i -z'
5260         else
5261                 dflt=''
5262         fi
5263         case "$ccflags" in
5264         *-posix*) dflt="$dflt -posix" ;;
5265         esac
5266         ;;
5267 *) dflt="$ldflags";;
5268 esac
5269 # See note above about -fstack-protector
5270 case "$ccflags" in
5271 *-fstack-protector*) 
5272         case "$dflt" in
5273         *-fstack-protector*) ;; # Don't add it again
5274         *) dflt="$dflt -fstack-protector" ;; 
5275         esac
5276         ;;
5277 esac
5278
5279 : Try to guess additional flags to pick up local libraries.
5280 for thislibdir in $libpth; do
5281         case " $loclibpth " in
5282         *" $thislibdir "*)
5283                 case "$dflt " in
5284                 *"-L$thislibdir "*) ;;
5285                 *)  dflt="$dflt -L$thislibdir" ;;
5286                 esac
5287                 ;;
5288         esac
5289 done
5290
5291 case "$dflt" in
5292 '') dflt='none' ;;
5293 esac
5294
5295 $cat <<EOH
5296
5297 Your C linker may need flags.  For this question you should
5298 include -L/whatever and any other flags used by the C linker, but you
5299 should NOT include libraries like -lwhatever.
5300
5301 Make sure you include the appropriate -L/path flags if your C linker
5302 does not normally search all of the directories you specified above,
5303 namely
5304         $libpth
5305 To use no flags, specify the word "none".
5306
5307 EOH
5308
5309 rp="Any additional ld flags (NOT including libraries)?"
5310 . ./myread
5311 case "$ans" in
5312 none) ldflags='';;
5313 *) ldflags="$ans";;
5314 esac
5315 rmlist="$rmlist pdp11"
5316
5317 : coherency check
5318 echo " "
5319 echo "Checking your choice of C compiler and flags for coherency..." >&4
5320 $cat > try.c <<'EOF'
5321 #include <stdio.h>
5322 int main() { printf("Ok\n"); return(0); }
5323 EOF
5324 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5325 shift
5326 $cat >try.msg <<'EOM'
5327 I've tried to compile and run the following simple program:
5328
5329 EOM
5330 $cat try.c >> try.msg
5331
5332 $cat >> try.msg <<EOM
5333
5334 I used the command:
5335
5336         $*
5337         $run ./try
5338
5339 and I got the following output:
5340
5341 EOM
5342 dflt=y
5343 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5344         if $sh -c "$run ./try " >>try.msg 2>&1; then
5345                 xxx=`$run ./try`
5346                 case "$xxx" in
5347                 "Ok") dflt=n ;;
5348                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5349                         case " $libs " in
5350                         *" -lsfio "*)
5351                                 cat >> try.msg <<'EOQS'
5352 If $libs contains -lsfio, and sfio is mis-configured, then it
5353 sometimes (apparently) runs and exits with a 0 status, but with no
5354 output!  It may have to do with sfio's use of _exit vs. exit.
5355
5356 EOQS
5357                                 rp="You have a big problem.  Shall I abort Configure"
5358                                 dflt=y
5359                                 ;;
5360                         esac
5361                         ;;
5362                 esac
5363         else
5364                 echo "The program compiled OK, but exited with status $?." >>try.msg
5365                 rp="You have a problem.  Shall I abort Configure"
5366                 dflt=y
5367         fi
5368 else
5369         echo "I can't compile the test program." >>try.msg
5370         rp="You have a BIG problem.  Shall I abort Configure"
5371         dflt=y
5372 fi
5373 case "$dflt" in
5374 y)
5375         $cat try.msg >&4
5376         case "$knowitall" in
5377         '')
5378                 echo "(The supplied flags or libraries might be incorrect.)"
5379                 ;;
5380         *) dflt=n;;
5381         esac
5382         echo " "
5383         . ./myread
5384         case "$ans" in
5385         n*|N*) ;;
5386         *)      echo "Ok.  Stopping Configure." >&4
5387                 exit 1
5388                 ;;
5389         esac
5390         ;;
5391 n) echo "OK, that should do.";;
5392 esac
5393 $rm_try gcctest gcctest.out
5394
5395 : define a shorthand compile call
5396 compile='
5397 mc_file=$1;
5398 shift;
5399 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5400 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5401 exit 1;
5402 fi;
5403 esac;
5404 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5405 : define a shorthand compile call for compilations that should be ok.
5406 compile_ok='
5407 mc_file=$1;
5408 shift;
5409 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5410
5411 : determine filename position in cpp output
5412 echo " "
5413 echo "Computing filename position in cpp output for #include directives..." >&4
5414 case "$osname" in
5415 vos) testaccess=-e ;;
5416 *)   testaccess=-r ;;
5417 esac
5418 echo '#include <stdio.h>' > foo.c
5419 $cat >fieldn <<EOF
5420 $startsh
5421 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5422 $grep '^[       ]*#.*stdio\.h' | \
5423 while read cline; do
5424         pos=1
5425         set \$cline
5426         while $test \$# -gt 0; do
5427                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5428                         echo "\$pos"
5429                         exit 0
5430                 fi
5431                 shift
5432                 pos=\`expr \$pos + 1\`
5433         done
5434 done
5435 EOF
5436 chmod +x fieldn
5437 fieldn=`./fieldn`
5438 $rm -f foo.c fieldn
5439 case $fieldn in
5440 '') pos='???';;
5441 1) pos=first;;
5442 2) pos=second;;
5443 3) pos=third;;
5444 *) pos="${fieldn}th";;
5445 esac
5446 echo "Your cpp writes the filename in the $pos field of the line."
5447
5448 case "$osname" in
5449 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5450 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5451 *)   cppfilter='' ;;
5452 esac
5453 : locate header file
5454 $cat >findhdr <<EOF
5455 $startsh
5456 wanted=\$1
5457 name=''
5458 for usrincdir in $usrinc
5459 do
5460         if test -f \$usrincdir/\$wanted; then
5461                 echo "\$usrincdir/\$wanted"
5462                 exit 0
5463         fi
5464 done
5465 awkprg='{ print \$$fieldn }'
5466 echo "#include <\$wanted>" > foo\$\$.c
5467 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5468 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5469 while read cline; do
5470         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5471         case "\$name" in
5472         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5473         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5474         *) exit 2;;
5475         esac;
5476 done;
5477 #
5478 # status = 0: grep returned 0 lines, case statement not executed
5479 # status = 1: headerfile found
5480 # status = 2: while loop executed, no headerfile found
5481 #
5482 status=\$?
5483 $rm -f foo\$\$.c;
5484 if test \$status -eq 1; then
5485         exit 0;
5486 fi
5487 exit 1
5488 EOF
5489 chmod +x findhdr
5490
5491 : define an alternate in-header-list? function
5492 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5493 cont=true; xxf="echo \"<\$1> found.\" >&4";
5494 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5495 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5496 esac;
5497 case $# in 4) instead=instead;; *) instead="at last";; esac;
5498 while $test "$cont"; do
5499         xxx=`./findhdr $1`
5500         var=$2; eval "was=\$$2";
5501         if $test "$xxx" && $test -r "$xxx";
5502         then eval $xxf;
5503         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5504                 cont="";
5505         else eval $xxnf;
5506         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5507         set $yyy; shift; shift; yyy=$@;
5508         case $# in 0) cont="";;
5509         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5510                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5511         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5512                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5513         esac;
5514 done;
5515 while $test "$yyy";
5516 do set $yyy; var=$2; eval "was=\$$2";
5517         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5518         set $yyy; shift; shift; yyy=$@;
5519 done'
5520
5521 : see if stdlib is available
5522 set stdlib.h i_stdlib
5523 eval $inhdr
5524
5525 : check for lengths of integral types
5526 echo " "
5527 case "$intsize" in
5528 '')
5529         echo "Checking to see how big your integers are..." >&4
5530         $cat >try.c <<EOCP
5531 #include <stdio.h>
5532 #$i_stdlib I_STDLIB
5533 #ifdef I_STDLIB
5534 #include <stdlib.h>
5535 #endif
5536 int main()
5537 {
5538         printf("intsize=%d;\n", (int)sizeof(int));
5539         printf("longsize=%d;\n", (int)sizeof(long));
5540         printf("shortsize=%d;\n", (int)sizeof(short));
5541         exit(0);
5542 }
5543 EOCP
5544         set try
5545         if eval $compile_ok && $run ./try > /dev/null; then
5546                 eval `$run ./try`
5547                 echo "Your integers are $intsize bytes long."
5548                 echo "Your long integers are $longsize bytes long."
5549                 echo "Your short integers are $shortsize bytes long."
5550         else
5551                 $cat >&4 <<EOM
5552 !
5553 Help! I can't compile and run the intsize test program: please enlighten me!
5554 (This is probably a misconfiguration in your system or libraries, and
5555 you really ought to fix it.  Still, I'll try anyway.)
5556 !
5557 EOM
5558                 dflt=4
5559                 rp="What is the size of an integer (in bytes)?"
5560                 . ./myread
5561                 intsize="$ans"
5562                 dflt=$intsize
5563                 rp="What is the size of a long integer (in bytes)?"
5564                 . ./myread
5565                 longsize="$ans"
5566                 dflt=2
5567                 rp="What is the size of a short integer (in bytes)?"
5568                 . ./myread
5569                 shortsize="$ans"
5570         fi
5571         ;;
5572 esac
5573 $rm_try
5574
5575 : check for long long
5576 echo " "
5577 echo "Checking to see if you have long long..." >&4
5578 echo 'int main() { long long x = 7; return 0; }' > try.c
5579 set try
5580 if eval $compile; then
5581         val="$define"
5582         echo "You have long long."
5583 else
5584         val="$undef"
5585         echo "You do not have long long."
5586 fi
5587 $rm_try
5588 set d_longlong
5589 eval $setvar
5590
5591 : check for length of long long
5592 case "${d_longlong}${longlongsize}" in
5593 $define)
5594         echo " "
5595         echo "Checking to see how big your long longs are..." >&4
5596         $cat >try.c <<'EOCP'
5597 #include <stdio.h>
5598 int main()
5599 {
5600     printf("%d\n", (int)sizeof(long long));
5601     return(0);
5602 }
5603 EOCP
5604         set try
5605         if eval $compile_ok; then
5606                 longlongsize=`$run ./try`
5607                 echo "Your long longs are $longlongsize bytes long."
5608         else
5609                 dflt='8'
5610                 echo " "
5611                 echo "(I can't seem to compile the test program.  Guessing...)"
5612                 rp="What is the size of a long long (in bytes)?"
5613                 . ./myread
5614                 longlongsize="$ans"
5615         fi
5616         if $test "X$longsize" = "X$longlongsize"; then
5617                 echo "(That isn't any different from an ordinary long.)"
5618         fi
5619         ;;
5620 esac
5621 $rm_try
5622
5623 : see if inttypes.h is available
5624 : we want a real compile instead of Inhdr because some systems
5625 : have an inttypes.h which includes non-existent headers
5626 echo " "
5627 $cat >try.c <<EOCP
5628 #include <inttypes.h>
5629 int main() {
5630         static int32_t foo32 = 0x12345678;
5631 }
5632 EOCP
5633 set try
5634 if eval $compile; then
5635         echo "<inttypes.h> found." >&4
5636         val="$define"
5637 else
5638         echo "<inttypes.h> NOT found." >&4
5639         val="$undef"
5640 fi
5641 $rm_try
5642 set i_inttypes
5643 eval $setvar
5644
5645 : check for int64_t
5646 echo " "
5647 echo "Checking to see if you have int64_t..." >&4
5648 $cat >try.c <<EOCP
5649 #include <sys/types.h>
5650 #$i_inttypes I_INTTYPES
5651 #ifdef I_INTTYPES
5652 #include <inttypes.h>
5653 #endif
5654 int main() { int64_t x = 7; }
5655 EOCP
5656 set try
5657 if eval $compile; then
5658         val="$define"
5659         echo "You have int64_t."
5660 else
5661         val="$undef"
5662         echo "You do not have int64_t."
5663 fi
5664 $rm_try
5665 set d_int64_t
5666 eval $setvar
5667
5668 : Check if 64bit ints have a quad type
5669 echo " "
5670 echo "Checking which 64-bit integer type we could use..." >&4
5671
5672 case "$intsize" in
5673 8) val=int
5674    set quadtype
5675    eval $setvar
5676    val='"unsigned int"'
5677    set uquadtype
5678    eval $setvar
5679    quadkind=1
5680    ;;
5681 *) case "$longsize" in
5682    8) val=long
5683       set quadtype
5684       eval $setvar
5685       val='"unsigned long"'
5686       set uquadtype
5687       eval $setvar
5688       quadkind=2
5689       ;;
5690    *) case "$d_longlong:$longlongsize" in
5691       define:8)
5692         val='"long long"'
5693         set quadtype
5694         eval $setvar
5695         val='"unsigned long long"'
5696         set uquadtype
5697         eval $setvar
5698         quadkind=3
5699         ;;
5700       *) case "$d_int64_t" in
5701          define)
5702            val=int64_t
5703            set quadtype
5704            eval $setvar
5705            val=uint64_t
5706            set uquadtype
5707            eval $setvar
5708            quadkind=4
5709            ;;
5710          esac
5711          ;;
5712       esac
5713       ;;
5714    esac
5715    ;;
5716 esac
5717
5718 case "$quadtype" in
5719 '')     echo "Alas, no 64-bit integer types in sight." >&4
5720         d_quad="$undef"
5721         ;;
5722 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5723         d_quad="$define"
5724         ;;
5725 esac
5726
5727 : Do we want 64bit support
5728 case "$uselonglong" in
5729 "$define"|true|[yY]*)
5730         cat <<EOM >&4
5731
5732 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5733 EOM
5734         use64bitint="$define"
5735         ;;
5736 esac
5737 case "$use64bits" in
5738 "$define"|true|[yY]*)
5739         cat <<EOM >&4
5740
5741 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5742 EOM
5743         use64bitint="$define"
5744         ;;
5745 esac
5746 case "$use64bitints" in
5747 "$define"|true|[yY]*)
5748         cat <<EOM >&4
5749
5750 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5751 EOM
5752         use64bitint="$define"
5753         ;;
5754 esac
5755 case "$use64bitsint" in
5756 "$define"|true|[yY]*)
5757         cat <<EOM >&4
5758
5759 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5760 EOM
5761         use64bitint="$define"
5762         ;;
5763 esac
5764 case "$uselonglongs" in
5765 "$define"|true|[yY]*)
5766         cat <<EOM >&4
5767
5768 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5769 EOM
5770         use64bitint="$define"
5771         ;;
5772 esac
5773 case "$use64bitsall" in
5774 "$define"|true|[yY]*)
5775         cat <<EOM >&4
5776
5777 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5778 EOM
5779         use64bitall="$define"
5780         ;;
5781 esac
5782
5783 case "$ccflags" in
5784 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5785 esac
5786 case "$use64bitall" in
5787 "$define"|true|[yY]*) use64bitint="$define" ;;
5788 esac
5789
5790 case "$longsize" in
5791 8) cat <<EOM
5792
5793 You have natively 64-bit long integers.
5794 EOM
5795    val="$define"
5796    ;;
5797 *) case "$use64bitint" in
5798    "$define"|true|[yY]*) dflt='y';;
5799    *) dflt='n';;
5800    esac
5801    case "$d_quad" in
5802    "$define") ;;
5803    *) dflt='n' ;;
5804    esac
5805    cat <<EOM
5806
5807 Perl can be built to take advantage of 64-bit integer types
5808 on some systems.  To do so, Configure can be run with -Duse64bitint.
5809 Choosing this option will most probably introduce binary incompatibilities.
5810
5811 If this doesn't make any sense to you, just accept the default '$dflt'.
5812 (The default has been chosen based on your configuration.)
5813 EOM
5814    rp='Try to use 64-bit integers, if available?'
5815    . ./myread
5816    case "$ans" in
5817    [yY]*) val="$define" ;;
5818    *)     val="$undef"  ;;
5819    esac
5820    ;;
5821 esac
5822 set use64bitint
5823 eval $setvar
5824
5825 case "$use64bitall" in
5826 "$define"|true|[yY]*) dflt='y' ;;
5827 *) case "$longsize" in
5828    8) dflt='y' ;;
5829    *) dflt='n' ;;
5830    esac
5831    ;;
5832 esac
5833 cat <<EOM
5834
5835 You may also choose to try maximal 64-bitness.  It means using as much
5836 64-bitness as possible on the platform.  This in turn means even more
5837 binary incompatibilities.  On the other hand, your platform may not
5838 have any more 64-bitness available than what you already have chosen.
5839
5840 If this doesn't make any sense to you, just accept the default '$dflt'.
5841 (The default has been chosen based on your configuration.)
5842 EOM
5843 rp='Try to use maximal 64-bit support, if available?'
5844 . ./myread
5845 case "$ans" in
5846 [yY]*) val="$define" ;;
5847 *)     val="$undef"  ;;
5848 esac
5849 set use64bitall
5850 eval $setvar
5851 case "$use64bitall" in
5852 "$define")
5853         case "$use64bitint" in
5854         "$undef")
5855                 cat <<EOM
5856
5857 Since you have chosen a maximally 64-bit build, I'm also turning on
5858 the use of 64-bit integers.
5859 EOM
5860                 use64bitint="$define" ;;
5861         esac
5862         ;;
5863 esac
5864
5865 : Look for a hint-file generated 'call-back-unit'.  If the
5866 : user has specified that a 64-bit perl is to be built,
5867 : we may need to set or change some other defaults.
5868 if $test -f use64bitint.cbu; then
5869         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5870         . ./use64bitint.cbu
5871 fi
5872 case "$use64bitint" in
5873 "$define"|true|[yY]*)
5874         case "$longsize" in
5875         4) case "$archname64" in
5876            '') archname64=64int ;;
5877            esac
5878            ;;
5879         esac
5880         ;;
5881 esac
5882
5883 : Look for a hint-file generated 'call-back-unit'.  If the
5884 : user has specified that a maximally 64-bit perl is to be built,
5885 : we may need to set or change some other defaults.
5886 if $test -f use64bitall.cbu; then
5887         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5888         . ./use64bitall.cbu
5889 fi
5890 case "$use64bitall" in
5891 "$define"|true|[yY]*)
5892         case "$longsize" in
5893         4) case "$archname64" in
5894            ''|64int) archname64=64all ;;
5895            esac
5896            ;;
5897         esac
5898         ;;
5899 esac
5900
5901 case "$d_quad:$use64bitint" in
5902 $undef:$define)
5903         cat >&4 <<EOF
5904
5905 *** You have chosen to use 64-bit integers,
5906 *** but none can be found.
5907 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5908 *** Cannot continue, aborting.
5909
5910 EOF
5911         exit 1
5912         ;;
5913 esac
5914
5915 : check for length of double
5916 echo " "
5917 case "$doublesize" in
5918 '')
5919         echo "Checking to see how big your double precision numbers are..." >&4
5920         $cat >try.c <<EOCP
5921 #include <stdio.h>
5922 #$i_stdlib I_STDLIB
5923 #ifdef I_STDLIB
5924 #include <stdlib.h>
5925 #endif
5926 int main()
5927 {
5928     printf("%d\n", (int)sizeof(double));
5929     exit(0);
5930 }
5931 EOCP
5932         set try
5933         if eval $compile_ok; then
5934                 doublesize=`$run ./try`
5935                 echo "Your double is $doublesize bytes long."
5936         else
5937                 dflt='8'
5938                 echo "(I can't seem to compile the test program.  Guessing...)"
5939                 rp="What is the size of a double precision number (in bytes)?"
5940                 . ./myread
5941                 doublesize="$ans"
5942         fi
5943         ;;
5944 esac
5945 $rm_try
5946
5947 : check for long doubles
5948 echo " "
5949 echo "Checking to see if you have long double..." >&4
5950 echo 'int main() { long double x = 7.0; }' > try.c
5951 set try
5952 if eval $compile; then
5953         val="$define"
5954         echo "You have long double."
5955 else
5956         val="$undef"
5957         echo "You do not have long double."
5958 fi
5959 $rm_try
5960 set d_longdbl
5961 eval $setvar
5962
5963 : check for length of long double
5964 case "${d_longdbl}${longdblsize}" in
5965 $define)
5966         echo " "
5967         echo "Checking to see how big your long doubles are..." >&4
5968         $cat >try.c <<'EOCP'
5969 #include <stdio.h>
5970 int main()
5971 {
5972         printf("%d\n", sizeof(long double));
5973 }
5974 EOCP
5975         set try
5976         set try
5977         if eval $compile; then
5978                 longdblsize=`$run ./try`
5979                 echo "Your long doubles are $longdblsize bytes long."
5980         else
5981                 dflt='8'
5982                 echo " "
5983                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5984                 rp="What is the size of a long double (in bytes)?"
5985                 . ./myread
5986                 longdblsize="$ans"
5987         fi
5988         if $test "X$doublesize" = "X$longdblsize"; then
5989                 echo "That isn't any different from an ordinary double."
5990                 echo "I'll keep your setting anyway, but you may see some"
5991                 echo "harmless compilation warnings."
5992         fi
5993         ;;
5994 esac
5995 $rm_try
5996
5997 : determine the architecture name
5998 echo " "
5999 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6000         tarch=`arch`"-$osname"
6001 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6002         if uname -m > tmparch 2>&1 ; then
6003                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6004                         -e 's/$/'"-$osname/" tmparch`
6005         else
6006                 tarch="$osname"
6007         fi
6008         $rm -f tmparch
6009 else
6010         tarch="$osname"
6011 fi
6012 case "$myarchname" in
6013 ''|"$tarch") ;;
6014 *)
6015         echo "(Your architecture name used to be $myarchname.)"
6016         archname=''
6017         ;;
6018 esac
6019 case "$targetarch" in
6020 '') ;;
6021 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6022 esac
6023 myarchname="$tarch"
6024 case "$archname" in
6025 '') dflt="$tarch";;
6026 *) dflt="$archname";;
6027 esac
6028 rp='What is your architecture name'
6029 . ./myread
6030 archname="$ans"
6031 case "$usethreads" in
6032 $define)
6033         echo "Threads selected." >&4
6034         case "$archname" in
6035         *-thread*) echo "...and architecture name already has -thread." >&4
6036                 ;;
6037         *)      archname="$archname-thread"
6038                 echo "...setting architecture name to $archname." >&4
6039                 ;;
6040         esac
6041         ;;
6042 esac
6043 case "$usemultiplicity" in
6044 $define)
6045         echo "Multiplicity selected." >&4
6046         case "$archname" in
6047         *-multi*) echo "...and architecture name already has -multi." >&4
6048                 ;;
6049         *)      archname="$archname-multi"
6050                 echo "...setting architecture name to $archname." >&4
6051                 ;;
6052         esac
6053         ;;
6054 esac
6055 case "$use64bitint$use64bitall" in
6056 *"$define"*)
6057         case "$archname64" in
6058         '')
6059                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6060                 ;;
6061         *)
6062                 case "$use64bitint" in
6063                 "$define") echo "64 bit integers selected." >&4 ;;
6064                 esac
6065                 case "$use64bitall" in
6066                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6067                 esac
6068                 case "$archname" in
6069                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6070                         ;;
6071                 *)      archname="$archname-$archname64"
6072                         echo "...setting architecture name to $archname." >&4
6073                         ;;
6074                 esac
6075                 ;;
6076         esac
6077 esac
6078 case "$uselongdouble" in
6079 $define)
6080         echo "Long doubles selected." >&4
6081         case "$longdblsize" in
6082         $doublesize)
6083                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6084                 ;;
6085         *)
6086                 case "$archname" in
6087                 *-ld*) echo "...and architecture name already has -ld." >&4
6088                         ;;
6089                 *)      archname="$archname-ld"
6090                         echo "...setting architecture name to $archname." >&4
6091                         ;;
6092                 esac
6093                 ;;
6094         esac
6095         ;;
6096 esac
6097 case "$useperlio" in
6098 $define)
6099         echo "Perlio selected." >&4
6100         ;;
6101 *)
6102         echo "Perlio not selected, using stdio." >&4
6103         case "$archname" in
6104         *-stdio*) echo "...and architecture name already has -stdio." >&4
6105                 ;;
6106         *)      archname="$archname-stdio"
6107                 echo "...setting architecture name to $archname." >&4
6108                 ;;
6109         esac
6110         ;;
6111 esac
6112 if $test -f archname.cbu; then
6113         echo "Your platform has some specific hints for architecture name, using them..."
6114         . ./archname.cbu
6115 fi
6116
6117 : set the prefixit variable, to compute a suitable default value
6118 prefixit='case "$3" in
6119 ""|none)
6120         case "$oldprefix" in
6121         "") eval "$1=\"\$$2\"";;
6122         *)
6123                 case "$3" in
6124                 "") eval "$1=";;
6125                 none)
6126                         eval "tp=\"\$$2\"";
6127                         case "$tp" in
6128                         ""|" ") eval "$1=\"\$$2\"";;
6129                         *) eval "$1=";;
6130                         esac;;
6131                 esac;;
6132         esac;;
6133 *)
6134         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6135         case "$tp" in
6136         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6137         /*-$oldprefix/*|\~*-$oldprefix/*)
6138                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6139         *) eval "$1=\"\$$2\"";;
6140         esac;;
6141 esac'
6142
6143 : determine installation style
6144 : For now, try to deduce it from prefix unless it is already set.
6145 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6146 case "$installstyle" in
6147 '')     case "$prefix" in
6148                 *perl*) dflt='lib';;
6149                 *) dflt='lib/perl5' ;;
6150         esac
6151         ;;
6152 *)      dflt="$installstyle" ;;
6153 esac
6154 : Probably not worth prompting for this since we prompt for all
6155 : the directories individually, and the prompt would be too long and
6156 : confusing anyway.
6157 installstyle=$dflt
6158
6159 : determine where public executables go
6160 echo " "
6161 set dflt bin bin
6162 eval $prefixit
6163 fn=d~
6164 rp='Pathname where the public executables will reside?'
6165 . ./getfile
6166 if $test "X$ansexp" != "X$binexp"; then
6167         installbin=''
6168 fi
6169 prefixvar=bin
6170 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6171 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6172 :     this via initialinstalllocation
6173 . ./setprefixvar
6174
6175 case "$userelocatableinc" in
6176 $define|true|[yY]*)     dflt='y' ;;
6177 *)                      dflt='n' ;;
6178 esac
6179 cat <<EOM
6180
6181 Would you like to build Perl so that the installation is relocatable, so that
6182 library paths in @INC are determined relative to the path of the perl binary?
6183 This is not advised for system Perl installs, or if you need to run setid
6184 scripts or scripts under taint mode.
6185
6186 If this doesn't make any sense to you, just accept the default '$dflt'.
6187 EOM
6188 rp='Use relocatable @INC?'
6189 . ./myread
6190 case "$ans" in
6191 y|Y)    val="$define" ;;
6192 *)      val="$undef"  ;;
6193 esac
6194 set userelocatableinc
6195 eval $setvar
6196
6197 initialinstalllocation="$binexp"
6198 : Default prefix is now "up one level from where the binaries are"
6199 case "$userelocatableinc" in
6200 $define|true|[yY]*)
6201     bin=".../"
6202     binexp=".../"
6203     prefix=".../.."
6204     prefixexp=".../.."
6205     installprefixexp=".../.."
6206     ;;
6207 esac
6208
6209 : determine where private library files go
6210 : Usual default is /usr/local/lib/perl5/$version.
6211 : Also allow things like /opt/perl/lib/$version, since
6212 : /opt/perl/lib/perl5... would be redundant.
6213 : The default "style" setting is made in installstyle.U
6214 case "$installstyle" in
6215 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6216 *)       set dflt privlib lib/$version ;;
6217 esac
6218 eval $prefixit
6219 $cat <<EOM
6220
6221 There are some auxiliary files for $package that need to be put into a
6222 private library directory that is accessible by everyone.
6223
6224 EOM
6225 fn=$binexp
6226 fn=d~+
6227 rp='Pathname where the private library files will reside?'
6228 . ./getfile
6229 prefixvar=privlib
6230 . ./setprefixvar
6231
6232 : set the prefixup variable, to restore leading tilda escape
6233 prefixup='case "$prefixexp" in
6234 "$prefix") ;;
6235 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6236 esac'
6237
6238 : determine where public architecture dependent libraries go
6239 set archlib archlib
6240 eval $prefixit
6241 : privlib default is /usr/local/lib/$package/$version
6242 : archlib default is /usr/local/lib/$package/$version/$archname
6243 : privlib may have an optional trailing /share.
6244 tdflt=`echo $privlib | $sed 's,/share$,,'`
6245 tdflt=$tdflt/$archname
6246 case "$archlib" in
6247 '')     dflt=$tdflt
6248         ;;
6249 *)      dflt="$archlib"
6250     ;;
6251 esac
6252 $cat <<EOM
6253
6254 $spackage contains architecture-dependent library files.  If you are
6255 sharing libraries in a heterogeneous environment, you might store
6256 these files in a separate location.  Otherwise, you can just include
6257 them with the rest of the public library files.
6258
6259 EOM
6260 fn=$binexp
6261 fn=d+~
6262 rp='Where do you want to put the public architecture-dependent libraries?'
6263 . ./getfile
6264 prefixvar=archlib
6265 . ./setprefixvar
6266 if $test X"$archlib" = X"$privlib"; then
6267         d_archlib="$undef"
6268 else
6269         d_archlib="$define"
6270 fi
6271
6272 : see if setuid scripts can be secure
6273 $cat <<EOM
6274
6275 Some kernels have a bug that prevents setuid #! scripts from being
6276 secure.  Some sites have disabled setuid #! scripts because of this.
6277
6278 First let's decide if your kernel supports secure setuid #! scripts.
6279 (If setuid #! scripts would be secure but have been disabled anyway,
6280 don't say that they are secure if asked.)
6281
6282 EOM
6283
6284 val="$undef"
6285 if $test -d /dev/fd; then
6286         echo "#!$ls" >reflect
6287         chmod +x,u+s reflect
6288         ./reflect >flect 2>&1
6289         if $contains "/dev/fd" flect >/dev/null; then
6290                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6291                 val="$define"
6292         else
6293                 $cat <<EOM
6294 If you are not sure if they are secure, I can check but I'll need a
6295 username and password different from the one you are using right now.
6296 If you don't have such a username or don't want me to test, simply
6297 enter 'none'.
6298
6299 EOM
6300                 rp='Other username to test security of setuid scripts with?'
6301                 dflt='none'
6302                 . ./myread
6303                 case "$ans" in
6304                 n|none)
6305                         case "$d_suidsafe" in
6306                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6307                                 dflt=n;;
6308                         "$undef")
6309                                 echo "Well, the $hint value is *not* secure." >&4
6310                                 dflt=n;;
6311                         *)      echo "Well, the $hint value *is* secure." >&4
6312                                 dflt=y;;
6313                         esac
6314                         ;;
6315                 *)
6316                         $rm -f reflect flect
6317                         echo "#!$ls" >reflect
6318                         chmod +x,u+s reflect
6319                         echo >flect
6320                         chmod a+w flect
6321                         echo '"su" will (probably) prompt you for '"$ans's password."
6322                         su $ans -c './reflect >flect'
6323                         if $contains "/dev/fd" flect >/dev/null; then
6324                                 echo "Okay, it looks like setuid scripts are secure." >&4
6325                                 dflt=y
6326                         else
6327                                 echo "I don't think setuid scripts are secure." >&4
6328                                 dflt=n
6329                         fi
6330                         ;;
6331                 esac
6332                 rp='Does your kernel have *secure* setuid scripts?'
6333                 . ./myread
6334                 case "$ans" in
6335                 [yY]*)  val="$define";;
6336                 *)      val="$undef";;
6337                 esac
6338         fi
6339 else
6340         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6341         echo "(That's for file descriptors, not floppy disks.)"
6342         val="$undef"
6343 fi
6344 set d_suidsafe
6345 eval $setvar
6346
6347 $rm -f reflect flect
6348
6349 : now see if they want to do setuid emulation
6350 echo " "
6351 val="$undef"
6352 case "$d_suidsafe" in
6353 "$define")
6354         val="$undef"
6355         echo "No need to emulate SUID scripts since they are secure here." >&4
6356         ;;
6357 *)
6358         $cat <<EOM
6359 Some systems have disabled setuid scripts, especially systems where
6360 setuid scripts cannot be secure.  On systems where setuid scripts have
6361 been disabled, the setuid/setgid bits on scripts are currently
6362 useless.  It is possible for $package to detect those bits and emulate
6363 setuid/setgid in a secure fashion.  This emulation will only work if
6364 setuid scripts have been disabled in your kernel.
6365
6366 EOM
6367         case "$d_dosuid" in
6368         "$define") dflt=y ;;
6369         *) dflt=n ;;
6370         esac
6371         rp="Do you want to do setuid/setgid emulation?"
6372         . ./myread
6373         case "$ans" in
6374         [yY]*)  val="$define";;
6375         *)      val="$undef";;
6376         esac
6377         ;;
6378 esac
6379 set d_dosuid
6380 eval $setvar
6381
6382 : Find perl5.005 or later.
6383 echo "Looking for a previously installed perl5.005 or later... "
6384 case "$perl5" in
6385 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6386                 : Check if this perl is recent and can load a simple module
6387                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6388                         perl5=$tdir/perl
6389                         break;
6390                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6391                         perl5=$tdir/perl5
6392                         break;
6393                 fi
6394         done
6395         ;;
6396 *)      perl5="$perl5"
6397         ;;
6398 esac
6399 case "$perl5" in
6400 '')     echo "None found.  That's ok.";;
6401 *)      echo "Using $perl5." ;;
6402 esac
6403
6404 : Set the siteprefix variables
6405 $cat <<EOM
6406
6407 After $package is installed, you may wish to install various
6408 add-on modules and utilities.  Typically, these add-ons will
6409 be installed under $prefix with the rest
6410 of this package.  However, you may wish to install such add-ons
6411 elsewhere under a different prefix.
6412
6413 If you do not wish to put everything under a single prefix, that's
6414 ok.  You will be prompted for the individual locations; this siteprefix
6415 is only used to suggest the defaults.
6416
6417 The default should be fine for most people.
6418
6419 EOM
6420 fn=d~+
6421 rp='Installation prefix to use for add-on modules and utilities?'
6422 : XXX Here might be another good place for an installstyle setting.
6423 case "$siteprefix" in
6424 '') dflt=$prefix ;;
6425 *)  dflt=$siteprefix ;;
6426 esac
6427 . ./getfile
6428 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6429 oldsiteprefix=''
6430 case "$siteprefix" in
6431 '') ;;
6432 *)      case "$ans" in
6433         "$prefix") ;;
6434         *) oldsiteprefix="$prefix";;
6435         esac
6436         ;;
6437 esac
6438 siteprefix="$ans"
6439 siteprefixexp="$ansexp"
6440
6441 : determine where site specific libraries go.
6442 : Usual default is /usr/local/lib/perl5/site_perl/$version
6443 : The default "style" setting is made in installstyle.U
6444 : XXX No longer works with Prefixit stuff.
6445 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6446 case "$sitelib" in
6447 '') case "$installstyle" in
6448         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6449         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6450         esac
6451         ;;
6452 *)      dflt="$sitelib"
6453         ;;
6454 esac
6455 $cat <<EOM
6456
6457 The installation process will create a directory for
6458 site-specific extensions and modules.  Most users find it convenient
6459 to place all site-specific files in this directory rather than in the
6460 main distribution directory.
6461
6462 EOM
6463 fn=d~+
6464 rp='Pathname for the site-specific library files?'
6465 . ./getfile
6466 prefixvar=sitelib
6467 . ./setprefixvar
6468 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6469
6470 : Determine list of previous versions to include in @INC
6471 $cat > getverlist <<EOPL
6472 #!$perl5 -w
6473 use File::Basename;
6474 \$api_versionstring = "$api_versionstring";
6475 \$version = "$version";
6476 \$stem = "$sitelib_stem";
6477 \$archname = "$archname";
6478 EOPL
6479         $cat >> getverlist <<'EOPL'
6480 # The list found is store twice for each entry: the original name, and
6481 # the binary broken down version as pack "sss", so sorting is easy and
6482 # unambiguous. This will work for all versions that have a maximum of
6483 # three digit groups, separate by '.'s or '_'s. Names are extended with
6484 # ".0.0" to ensure at least three elements for the pack.
6485 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6486
6487 # Can't have leading @ because metaconfig interprets it as a command!
6488 ;@inc_version_list=();
6489 # XXX Redo to do opendir/readdir?
6490 if (-d $stem) {
6491     chdir($stem);
6492     ;@candidates = map {
6493         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6494 }
6495 else {
6496     ;@candidates = ();
6497 }
6498
6499 ($pversion, $aversion, $vsn5005) = map {
6500     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6501 foreach $d (@candidates) {
6502     if ($d->[1] lt $pversion) {
6503         if ($d->[1] ge $aversion) {
6504             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6505         }
6506         elsif ($d->[1] ge $vsn5005) {
6507             unshift(@inc_version_list, grep { -d } $d->[0]);
6508         }
6509     }
6510     else {
6511         # Skip newer version.  I.e. don't look in
6512         # 5.7.0 if we're installing 5.6.1.
6513     }
6514 }
6515
6516 if (@inc_version_list) {
6517     print join(' ', @inc_version_list);
6518 }
6519 else {
6520     # Blank space to preserve value for next Configure run.
6521     print " ";
6522 }
6523 EOPL
6524 chmod +x getverlist
6525 case "$inc_version_list" in
6526 '')     if test -x "$perl5$exe_ext"; then
6527                 dflt=`$perl5 getverlist`
6528         else
6529                 dflt='none'
6530         fi
6531         ;;
6532 $undef) dflt='none' ;;
6533 *)  eval dflt=\"$inc_version_list\" ;;
6534 esac
6535 case "$dflt" in
6536 ''|' ') dflt=none ;;
6537 esac
6538 case "$dflt" in
6539 5.005) dflt=none ;;
6540 esac
6541 $cat <<EOM
6542
6543 In order to ease the process of upgrading, this version of perl
6544 can be configured to use modules built and installed with earlier
6545 versions of perl that were installed under $prefix.  Specify here
6546 the list of earlier versions that this version of perl should check.
6547 If Configure detected no earlier versions of perl installed under
6548 $prefix, then the list will be empty.  Answer 'none' to tell perl
6549 to not search earlier versions.
6550
6551 The default should almost always be sensible, so if you're not sure,
6552 just accept the default.
6553 EOM
6554
6555 rp='List of earlier versions to include in @INC?'
6556 . ./myread
6557 case "$ans" in
6558 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6559 *) inc_version_list="$ans" ;;
6560 esac
6561 case "$inc_version_list" in
6562 ''|' ')
6563         inc_version_list_init='0'
6564         d_inc_version_list="$undef"
6565         ;;
6566 *)      inc_version_list_init=`echo $inc_version_list |
6567                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6568         d_inc_version_list="$define"
6569         ;;
6570 esac
6571 $rm -f getverlist
6572
6573 : see if malloc/malloc.h has to be included
6574 set malloc/malloc.h i_mallocmalloc
6575 eval $inhdr
6576
6577 : see if this is a malloc.h system
6578 : we want a real compile instead of Inhdr because some systems have a
6579 : malloc.h that just gives a compile error saying to use stdlib.h instead
6580 echo " "
6581 $cat >try.c <<EOCP
6582 #include <stdlib.h>
6583 #include <malloc.h>
6584 #$i_mallocmalloc I_MALLOCMALLOC
6585 #ifdef I_MALLOCMALLOC
6586 # include <malloc/malloc.h>
6587 #endif
6588
6589 int main () { return 0; }
6590 EOCP
6591 set try
6592 if eval $compile; then
6593     echo "<malloc.h> found." >&4
6594     val="$define"
6595 else
6596     echo "<malloc.h> NOT found." >&4
6597     val="$undef"
6598 fi
6599 $rm_try
6600 set i_malloc
6601 eval $setvar
6602
6603 : check for void type
6604 echo " "
6605 echo "Checking to see how well your C compiler groks the void type..." >&4
6606 case "$voidflags" in
6607 '')
6608         $cat >try.c <<EOCP
6609 #$i_stdlib I_STDLIB
6610 #ifdef I_STDLIB
6611 #include <stdlib.h>
6612 #endif
6613 #if TRY & 1
6614 void sub() {
6615 #else
6616 sub() {
6617 #endif
6618         extern void moo();      /* function returning void */
6619         void (*goo)();          /* ptr to func returning void */
6620 #if TRY & 8
6621         void *hue;              /* generic ptr */
6622 #endif
6623 #if TRY & 2
6624         void (*foo[10])();
6625 #endif
6626
6627 #if TRY & 4
6628         if(goo == moo) {
6629                 exit(0);
6630         }
6631 #endif
6632         exit(0);
6633 }
6634 int main() { sub(); }
6635 EOCP
6636         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6637                 voidflags=$defvoidused
6638         echo "Good.  It appears to support void to the level $package wants.">&4
6639                 if $contains warning .out >/dev/null 2>&1; then
6640                         echo "However, you might get some warnings that look like this:"
6641                         $cat .out
6642                 fi
6643         else
6644 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6645                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6646                         echo "It supports 1..."
6647                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6648                                 echo "It also supports 2..."
6649                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6650                                         voidflags=7
6651                                         echo "And it supports 4 but not 8 definitely."
6652                                 else
6653                                         echo "It doesn't support 4..."
6654                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6655                                                 voidflags=11
6656                                                 echo "But it supports 8."
6657                                         else
6658                                                 voidflags=3
6659                                                 echo "Neither does it support 8."
6660                                         fi
6661                                 fi
6662                         else
6663                                 echo "It does not support 2..."
6664                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6665                                         voidflags=13
6666                                         echo "But it supports 4 and 8."
6667                                 else
6668                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6669                                                 voidflags=5
6670                                                 echo "And it supports 4 but has not heard about 8."
6671                                         else
6672                                                 echo "However it supports 8 but not 4."
6673                                         fi
6674                                 fi
6675                         fi
6676                 else
6677                         echo "There is no support at all for void."
6678                         voidflags=0
6679                 fi
6680         fi
6681 esac
6682 case "$voidflags" in
6683 "$defvoidused") ;;
6684 *)      $cat >&4 <<'EOM'
6685   Support flag bits are:
6686     1: basic void declarations.
6687     2: arrays of pointers to functions returning void.
6688     4: operations between pointers to and addresses of void functions.
6689     8: generic void pointers.
6690 EOM
6691         dflt="$voidflags";
6692         rp="Your void support flags add up to what?"
6693         . ./myread
6694         voidflags="$ans"
6695         ;;
6696 esac
6697 $rm_try
6698
6699 : check for length of pointer
6700 echo " "
6701 case "$ptrsize" in
6702 '')
6703         echo "Checking to see how big your pointers are..." >&4
6704         if test "$voidflags" -gt 7; then
6705                 echo '#define VOID_PTR char *' > try.c
6706         else
6707                 echo '#define VOID_PTR void *' > try.c
6708         fi
6709         $cat >>try.c <<EOCP
6710 #include <stdio.h>
6711 #$i_stdlib I_STDLIB
6712 #ifdef I_STDLIB
6713 #include <stdlib.h>
6714 #endif
6715 int main()
6716 {
6717     printf("%d\n", (int)sizeof(VOID_PTR));
6718     exit(0);
6719 }
6720 EOCP
6721         set try
6722         if eval $compile_ok; then
6723                 ptrsize=`$run ./try`
6724                 echo "Your pointers are $ptrsize bytes long."
6725         else
6726                 dflt='4'
6727                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6728                 rp="What is the size of a pointer (in bytes)?"
6729                 . ./myread
6730                 ptrsize="$ans"
6731         fi
6732         ;;
6733 esac
6734 $rm_try
6735 case "$use64bitall" in
6736 "$define"|true|[yY]*)
6737         case "$ptrsize" in
6738         4)      cat <<EOM >&4
6739
6740 *** You have chosen a maximally 64-bit build,
6741 *** but your pointers are only 4 bytes wide.
6742 *** Please rerun Configure without -Duse64bitall.
6743 EOM
6744                 case "$d_quad" in
6745                 define)
6746                         cat <<EOM >&4
6747 *** Since you have quads, you could possibly try with -Duse64bitint.
6748 EOM
6749                         ;;
6750                 esac
6751                 cat <<EOM >&4
6752 *** Cannot continue, aborting.
6753
6754 EOM
6755
6756                 exit 1
6757                 ;;
6758         esac
6759         ;;
6760 esac
6761
6762
6763 : determine whether to use malloc wrapping
6764 echo " "
6765 case "$usemallocwrap" in
6766 [yY]*|true|$define)     dflt='y' ;;
6767 [nN]*|false|$undef)     dflt='n' ;;
6768 *)      case "$usedevel" in
6769         [yY]*|true|$define)     dflt='y' ;;
6770         *) dflt='n' ;;
6771         esac
6772         ;;
6773 esac
6774 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6775 . ./myread
6776 usemallocwrap="$ans"
6777 case "$ans" in
6778 y*|true)
6779         usemallocwrap="$define" ;;
6780 *)
6781         usemallocwrap="$undef" ;;
6782 esac
6783
6784 : determine which malloc to compile in
6785 echo " "
6786 case "$usemymalloc" in
6787 [yY]*|true|$define)     dflt='y' ;;
6788 [nN]*|false|$undef)     dflt='n' ;;
6789 *)      case "$ptrsize" in
6790         4) dflt='y' ;;
6791         *) dflt='n' ;;
6792         esac
6793         ;;
6794 esac
6795 rp="Do you wish to attempt to use the malloc that comes with $package?"
6796 . ./myread
6797 usemymalloc="$ans"
6798 case "$ans" in
6799 y*|true)
6800         usemymalloc='y'
6801         mallocsrc='malloc.c'
6802         mallocobj="malloc$_o"
6803         d_mymalloc="$define"
6804         case "$libs" in
6805         *-lmalloc*)
6806                 : Remove malloc from list of libraries to use
6807                 echo "Removing unneeded -lmalloc from library list" >&4
6808                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6809                 shift
6810                 libs="$*"
6811                 echo "libs = $libs" >&4
6812                 ;;
6813         esac
6814         ;;
6815 *)
6816         usemymalloc='n'
6817         mallocsrc=''
6818         mallocobj=''
6819         d_mymalloc="$undef"
6820         ;;
6821 esac
6822
6823 : compute the return types of malloc and free
6824 echo " "
6825 $cat >malloc.c <<END
6826 #$i_malloc I_MALLOC
6827 #$i_stdlib I_STDLIB
6828 #include <stdio.h>
6829 #include <sys/types.h>
6830 #ifdef I_MALLOC
6831 #include <malloc.h>
6832 #endif
6833 #ifdef I_STDLIB
6834 #include <stdlib.h>
6835 #endif
6836 #ifdef TRY_MALLOC
6837 void *malloc();
6838 #endif
6839 #ifdef TRY_FREE
6840 void free();
6841 #endif
6842 END
6843 case "$malloctype" in
6844 '')
6845         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6846                 malloctype='void *'
6847         else
6848                 malloctype='char *'
6849         fi
6850         ;;
6851 esac
6852 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6853
6854 case "$freetype" in
6855 '')
6856         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6857                 freetype='void'
6858         else
6859                 freetype='int'
6860         fi
6861         ;;
6862 esac
6863 echo "Your system uses $freetype free(), it would seem." >&4
6864 $rm -f malloc.[co]
6865 : determine where site specific architecture-dependent libraries go.
6866 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6867 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6868 : sitelib may have an optional trailing /share.
6869 case "$sitearch" in
6870 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6871         dflt="$dflt/$archname"
6872         ;;
6873 *)      dflt="$sitearch"
6874         ;;
6875 esac
6876 set sitearch sitearch none
6877 eval $prefixit
6878 $cat <<EOM
6879
6880 The installation process will also create a directory for
6881 architecture-dependent site-specific extensions and modules.
6882
6883 EOM
6884 fn=d~+
6885 rp='Pathname for the site-specific architecture-dependent library files?'
6886 . ./getfile
6887 prefixvar=sitearch
6888 . ./setprefixvar
6889 if $test X"$sitearch" = X"$sitelib"; then
6890         d_sitearch="$undef"
6891 else
6892         d_sitearch="$define"
6893 fi
6894
6895 : Set the vendorprefix variables
6896 $cat <<EOM
6897
6898 The installation process will also create a directory for
6899 vendor-supplied add-ons.  Vendors who supply perl with their system
6900 may find it convenient to place all vendor-supplied files in this
6901 directory rather than in the main distribution directory.  This will
6902 ease upgrades between binary-compatible maintenance versions of perl.
6903
6904 Of course you may also use these directories in whatever way you see
6905 fit.  For example, you might use them to access modules shared over a
6906 company-wide network.
6907
6908 The default answer should be fine for most people.
6909 This causes further questions about vendor add-ons to be skipped
6910 and no vendor-specific directories will be configured for perl.
6911
6912 EOM
6913 rp='Do you want to configure vendor-specific add-on directories?'
6914 case "$usevendorprefix" in
6915 define|true|[yY]*) dflt=y ;;
6916 *)      : User may have set vendorprefix directly on Configure command line.
6917         case "$vendorprefix" in
6918         ''|' ') dflt=n ;;
6919         *)      dflt=y ;;
6920         esac
6921         ;;
6922 esac
6923 . ./myread
6924 case "$ans" in
6925 [yY]*)  fn=d~+
6926         rp='Installation prefix to use for vendor-supplied add-ons?'
6927         case "$vendorprefix" in
6928         '') dflt='' ;;
6929         *)  dflt=$vendorprefix ;;
6930         esac
6931         . ./getfile
6932         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6933         oldvendorprefix=''
6934         case "$vendorprefix" in
6935         '') ;;
6936         *)      case "$ans" in
6937                 "$prefix") ;;
6938                 *) oldvendorprefix="$prefix";;
6939                 esac
6940                 ;;
6941         esac
6942         usevendorprefix="$define"
6943         vendorprefix="$ans"
6944         vendorprefixexp="$ansexp"
6945         ;;
6946 *)      usevendorprefix="$undef"
6947         vendorprefix=''
6948         vendorprefixexp=''
6949         ;;
6950 esac
6951
6952 : Set the vendorlib variables
6953 case "$vendorprefix" in
6954 '')     d_vendorlib="$undef"
6955         vendorlib=''
6956         vendorlibexp=''
6957         ;;
6958 *)      d_vendorlib="$define"
6959         : determine where vendor-supplied modules go.
6960         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6961         case "$vendorlib" in
6962         '')
6963                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6964                 case "$installstyle" in
6965                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6966                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6967                 esac
6968                 ;;
6969         *)      dflt="$vendorlib"
6970                 ;;
6971         esac
6972         fn=d~+
6973         rp='Pathname for the vendor-supplied library files?'
6974         . ./getfile
6975         vendorlib="$ans"
6976         vendorlibexp="$ansexp"
6977         ;;
6978 esac
6979 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6980 prefixvar=vendorlib
6981 . ./installprefix
6982
6983 : Set the vendorarch variables
6984 case "$vendorprefix" in
6985 '')     d_vendorarch="$undef"
6986         vendorarch=''
6987         vendorarchexp=''
6988         ;;
6989 *)      d_vendorarch="$define"
6990         : determine where vendor-supplied architecture-dependent libraries go.
6991         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6992         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6993         : vendorlib may have an optional trailing /share.
6994         case "$vendorarch" in
6995         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6996                 dflt="$dflt/$archname"
6997                 ;;
6998         *)      dflt="$vendorarch" ;;
6999         esac
7000         fn=d~+
7001         rp='Pathname for vendor-supplied architecture-dependent files?'
7002         . ./getfile
7003         vendorarch="$ans"
7004         vendorarchexp="$ansexp"
7005         ;;
7006 esac
7007 prefixvar=vendorarch
7008 . ./installprefix
7009
7010 : Final catch-all directories to search
7011 $cat <<EOM
7012
7013 Lastly, you can have perl look in other directories for extensions and
7014 modules in addition to those already specified.
7015 These directories will be searched after 
7016         $sitearch 
7017         $sitelib 
7018 EOM
7019 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7020 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7021 echo ' '
7022 case "$otherlibdirs" in
7023 ''|' ') dflt='none' ;;
7024 *)      dflt="$otherlibdirs" ;;
7025 esac
7026 $cat <<EOM
7027 Enter a colon-separated set of extra paths to include in perl's @INC
7028 search path, or enter 'none' for no extra paths.
7029
7030 EOM
7031
7032 rp='Colon-separated list of additional directories for perl to search?'
7033 . ./myread
7034 case "$ans" in
7035 ' '|''|none)    otherlibdirs=' ' ;;     
7036 *)      otherlibdirs="$ans" ;;
7037 esac
7038 case "$otherlibdirs" in
7039 ' ') val=$undef ;;
7040 *)      val=$define ;;
7041 esac
7042 set d_perl_otherlibdirs
7043 eval $setvar
7044
7045 : Cruising for prototypes
7046 echo " "
7047 echo "Checking out function prototypes..." >&4
7048 $cat >prototype.c <<EOCP
7049 #$i_stdlib I_STDLIB
7050 #ifdef I_STDLIB
7051 #include <stdlib.h>
7052 #endif
7053 int main(int argc, char *argv[]) {
7054         exit(0);}
7055 EOCP
7056 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7057         echo "Your C compiler appears to support function prototypes."
7058         val="$define"
7059 else
7060         echo "Your C compiler doesn't seem to understand function prototypes."
7061         val="$undef"
7062 fi
7063 set prototype
7064 eval $setvar
7065 $rm -f prototype*
7066
7067 : Check if ansi2knr is required
7068 case "$prototype" in
7069 "$define") ;;
7070 *)      ansi2knr='ansi2knr'
7071         echo " "
7072         cat <<EOM >&4
7073
7074 $me:  FATAL ERROR:
7075 This version of $package can only be compiled by a compiler that 
7076 understands function prototypes.  Unfortunately, your C compiler 
7077         $cc $ccflags
7078 doesn't seem to understand them.  Sorry about that.
7079
7080 If GNU cc is available for your system, perhaps you could try that instead.  
7081
7082 Eventually, we hope to support building Perl with pre-ANSI compilers.
7083 If you would like to help in that effort, please contact <perlbug@perl.org>.
7084
7085 Aborting Configure now.
7086 EOM
7087         exit 2
7088         ;;
7089 esac
7090
7091 : DTrace support
7092 dflt_dtrace='/usr/sbin/dtrace'
7093 cat <<EOM
7094
7095 Perl can be built to support DTrace on platforms that support it.
7096 DTrace is a diagnosis and performance analysis tool from Sun.
7097
7098 If this doesn't make any sense to you, just accept the default '$dflt'.
7099 EOM
7100
7101 while $test 1 ; do
7102         case "$usedtrace" in
7103         $define|true|[yY]*)
7104                 dflt='y'
7105                 ;;
7106         ?*)
7107                 dflt='y'
7108                 dflt_dtrace=$usedtrace
7109                 ;;
7110         *)
7111                 dflt='n'
7112                 ;;
7113         esac
7114
7115         rp='Support DTrace if available?'
7116         . ./myread
7117         case "$ans" in
7118         y|Y)    val="$define" ;;
7119         *)      val="$undef" ;;
7120         esac
7121         set usedtrace
7122         eval $setvar
7123
7124         test "X$usedtrace" != "X$define" && break
7125
7126         echo " "
7127         rp='Where is the dtrace executable?'
7128         dflt=$dflt_dtrace
7129         . ./getfile
7130         val="$ans"
7131         set dtrace
7132         eval $setvar
7133
7134         if $test -f $dtrace
7135         then
7136                 if $dtrace -h -s ../perldtrace.d \
7137                         -o perldtrace.tmp >/dev/null 2>&1 \
7138                         && rm -f perldtrace.tmp
7139                 then
7140                         echo " "
7141                         echo "Good: your $dtrace knows about the -h flag."
7142                 else
7143                         cat >&2 <<EOM
7144
7145 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7146 ***
7147 *** Your installed dtrace doesn't support the -h switch to compile a D
7148 *** program into a C header. Can't continue.
7149
7150 EOM
7151                         exit 1
7152                 fi
7153                 break;
7154         fi
7155
7156         case "$fastread" in
7157         yes)
7158                 cat >&2 <<EOM
7159
7160 *** $me:  Fatal Error:  $dtrace not found.
7161 *** Can't continue.
7162
7163 EOM
7164                 exit 1
7165                 ;;
7166         *)
7167                 echo "*** $dtrace was not found."
7168                 echo " "
7169                 ;;
7170         esac
7171 done
7172
7173 : See if we want extra modules installed
7174 echo " "
7175 case "$extras" in
7176 '') dflt='n';;
7177 *) dflt='y';;
7178 esac
7179 cat <<EOM
7180 Perl can be built with extra modules or bundles of modules which
7181 will be fetched from the CPAN and installed alongside Perl.
7182
7183 Notice that you will need access to the CPAN; either via the Internet,
7184 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7185 be asked later to configure the CPAN.pm module which will in turn do
7186 the installation of the rest of the extra modules or bundles.)
7187
7188 Notice also that if the modules require any external software such as
7189 libraries and headers (the libz library and the zlib.h header for the
7190 Compress::Zlib module, for example) you MUST have any such software
7191 already installed, this configuration process will NOT install such
7192 things for you.
7193
7194 If this doesn't make any sense to you, just accept the default '$dflt'.
7195 EOM
7196 rp='Install any extra modules (y or n)?'
7197 . ./myread
7198 case "$ans" in
7199 y|Y)
7200         cat <<EOM
7201
7202 Please list any extra modules or bundles to be installed from CPAN,
7203 with spaces between the names.  The names can be in any format the
7204 'install' command of CPAN.pm will understand.  (Answer 'none',
7205 without the quotes, to install no extra modules or bundles.)
7206 EOM
7207         rp='Extras?'
7208         dflt="$extras"
7209         . ./myread
7210         extras="$ans"
7211 esac
7212 case "$extras" in
7213 ''|'none')
7214         val=''
7215         $rm -f ../extras.lst
7216         ;;
7217 *)      echo "(Saving the list of extras for later...)"
7218         echo "$extras" > ../extras.lst
7219         val="'$extras'"
7220         ;;
7221 esac
7222 set extras
7223 eval $setvar
7224 echo " "
7225
7226 : determine where html pages for programs go
7227 set html1dir html1dir none
7228 eval $prefixit
7229 $cat <<EOM
7230
7231 If you wish to install html files for programs in $spackage, indicate
7232 the appropriate directory here.  To skip installing html files,
7233 answer "none".
7234 EOM
7235 case "$html1dir" in
7236 ''|none|$undef|' ') dflt=none ;;
7237 *) dflt=$html1dir ;;
7238 esac
7239 fn=dn+~
7240 rp="Directory for the main $spackage html pages?"
7241 . ./getfile
7242 prefixvar=html1dir
7243 . ./setprefixvar
7244 : Use ' ' for none so value is preserved next time through Configure
7245 $test X"$html1dir" = "X" && html1dir=' '
7246
7247 : determine where html pages for libraries and modules go
7248 set html3dir html3dir none
7249 eval $prefixit
7250 $cat <<EOM
7251
7252 If you wish to install html files for modules associated with $spackage,
7253 indicate the appropriate directory here.  To skip installing html files,
7254 answer "none".
7255 EOM
7256 : There is no obvious default.  If they have specified html1dir, then
7257 : try to key off that, possibly changing .../html1 into .../html3.
7258 case "$html3dir" in
7259 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7260 *) dflt=$html3dir ;;
7261 esac
7262 fn=dn+~
7263 rp="Directory for the $spackage module html pages?"
7264 . ./getfile
7265 prefixvar=html3dir
7266 . ./setprefixvar
7267 : Use ' ' for none so value is preserved next time through Configure
7268 $test X"$html3dir" = "X" && html3dir=' '
7269
7270 : determine whether to install perl also as /usr/bin/perl
7271
7272 echo " "
7273 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7274         $cat <<EOM
7275 Many scripts expect perl to be installed as /usr/bin/perl.
7276
7277 If you want to, I can install the perl you are about to compile
7278 as /usr/bin/perl (in addition to $bin/perl).
7279 EOM
7280         if test -f /usr/bin/perl; then
7281             $cat <<EOM
7282
7283 However, please note that because you already have a /usr/bin/perl,
7284 overwriting that with a new Perl would very probably cause problems.
7285 Therefore I'm assuming you don't want to do that (unless you insist).
7286
7287 EOM
7288             case "$installusrbinperl" in
7289             "$define"|[yY]*)    dflt='y';;
7290             *)                  dflt='n';;
7291             esac
7292         else
7293             $cat <<EOM
7294
7295 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7296
7297 EOM
7298             case "$installusrbinperl" in
7299             "$undef"|[nN]*)     dflt='n';;
7300             *)                  dflt='y';;
7301             esac
7302         fi
7303         rp="Do you want to install perl as /usr/bin/perl?"
7304         . ./myread
7305         case "$ans" in
7306         [yY]*)  val="$define";;
7307         *)      val="$undef" ;;
7308         esac
7309 else
7310         val="$undef"
7311 fi
7312 set installusrbinperl
7313 eval $setvar
7314
7315 : Check if we are using the GNU C library
7316 echo " "
7317 echo "Checking for GNU C Library..." >&4
7318 cat >try.c <<'EOCP'
7319 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7320    alone are insufficient to distinguish different versions, such as
7321    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7322    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7323 */
7324 #include <stdio.h>
7325 int main(void)
7326 {
7327 #ifdef __GLIBC__
7328 #   ifdef __GLIBC_MINOR__
7329 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7330 #           include <gnu/libc-version.h>
7331             printf("%s\n",  gnu_get_libc_version());
7332 #       else
7333             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7334 #       endif
7335 #   else
7336         printf("%d\n",  __GLIBC__);
7337 #   endif
7338     return 0;
7339 #else
7340     return 1;
7341 #endif
7342 }
7343 EOCP
7344 set try
7345 if eval $compile_ok && $run ./try > glibc.ver; then
7346         val="$define"
7347         gnulibc_version=`$cat glibc.ver`
7348         echo "You are using the GNU C Library version $gnulibc_version"
7349 else
7350         val="$undef"
7351         gnulibc_version=''
7352         echo "You are not using the GNU C Library"
7353 fi
7354 $rm_try glibc.ver
7355 set d_gnulibc
7356 eval $setvar
7357
7358 : see if nm is to be used to determine whether a symbol is defined or not
7359 case "$usenm" in
7360 '')
7361         dflt=''
7362         case "$d_gnulibc" in
7363         "$define")
7364                 echo " "
7365                 echo "nm probably won't work on the GNU C Library." >&4
7366                 dflt=n
7367                 ;;
7368         esac
7369         case "$dflt" in
7370         '') 
7371                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7372                         echo " "
7373                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7374                         echo "'nm' won't be sufficient on this sytem." >&4
7375                         dflt=n
7376                 fi
7377                 ;;
7378         esac
7379         case "$dflt" in
7380         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7381                 if $test $dflt -gt 20; then
7382                         dflt=y
7383                 else
7384                         dflt=n
7385                 fi
7386                 ;;
7387         esac
7388         ;;
7389 *)
7390         case "$usenm" in
7391         true|$define) dflt=y;;
7392         *) dflt=n;;
7393         esac
7394         ;;
7395 esac
7396 $cat <<EOM
7397
7398 I can use $nm to extract the symbols from your C libraries. This
7399 is a time consuming task which may generate huge output on the disk (up
7400 to 3 megabytes) but that should make the symbols extraction faster. The
7401 alternative is to skip the 'nm' extraction part and to compile a small
7402 test program instead to determine whether each symbol is present. If
7403 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7404 this may be the best solution.
7405
7406 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7407
7408 EOM
7409 rp="Shall I use $nm to extract C symbols from the libraries?"
7410 . ./myread
7411 case "$ans" in
7412 [Nn]*) usenm=false;;
7413 *) usenm=true;;
7414 esac
7415
7416 runnm=$usenm
7417 case "$reuseval" in
7418 true) runnm=false;;
7419 esac
7420
7421 : nm options which may be necessary
7422 case "$nm_opt" in
7423 '') if $test -f /mach_boot; then
7424                 nm_opt=''       # Mach
7425         elif $test -d /usr/ccs/lib; then
7426                 nm_opt='-p'     # Solaris (and SunOS?)
7427         elif $test -f /dgux; then
7428                 nm_opt='-p'     # DG-UX
7429         elif $test -f /lib64/rld; then
7430                 nm_opt='-p'     # 64-bit Irix
7431         else
7432                 nm_opt=''
7433         fi;;
7434 esac
7435
7436 : nm options which may be necessary for shared libraries but illegal
7437 : for archive libraries.  Thank you, Linux.
7438 case "$nm_so_opt" in
7439 '')     case "$myuname" in
7440         *linux*|gnu*)
7441                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7442                         nm_so_opt='--dynamic'
7443                 fi
7444                 ;;
7445         esac
7446         ;;
7447 esac
7448
7449 : Figure out where the libc is located
7450 case "$runnm" in
7451 true)
7452 : get list of predefined functions in a handy place
7453 echo " "
7454 case "$libc" in
7455 '') libc=unknown
7456         case "$libs" in
7457         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7458         esac
7459         ;;
7460 esac
7461 case "$libs" in
7462 '') ;;
7463 *)  for thislib in $libs; do
7464         case "$thislib" in
7465         -lc|-lc_s)
7466                 : Handle C library specially below.
7467                 ;;
7468         -l*)
7469                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7470                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7471                         :
7472                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7473                         :
7474                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7475                         :
7476                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7477                         :
7478                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7479                         :
7480                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7481                         :
7482                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7483                         :
7484                 else
7485                         try=''
7486                 fi
7487                 libnames="$libnames $try"
7488                 ;;
7489         *) libnames="$libnames $thislib" ;;
7490         esac
7491         done
7492         ;;
7493 esac
7494 xxx=normal
7495 case "$libc" in
7496 unknown)
7497         set /lib/libc.$so
7498         for xxx in $libpth; do
7499                 $test -r $1 || set $xxx/libc.$so
7500                 : The messy sed command sorts on library version numbers.
7501                 $test -r $1 || \
7502                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7503                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7504                                 h
7505                                 s/[0-9][0-9]*/0000&/g
7506                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7507                                 G
7508                                 s/\n/ /' | \
7509                          $sort | $sed -e 's/^.* //'`
7510                 eval set \$$#
7511         done
7512         $test -r $1 || set /usr/ccs/lib/libc.$so
7513         $test -r $1 || set /lib/libsys_s$_a
7514         ;;
7515 *)
7516         set blurfl
7517         ;;
7518 esac
7519 if $test -r "$1"; then
7520         echo "Your (shared) C library seems to be in $1."
7521         libc="$1"
7522 elif $test -r /lib/libc && $test -r /lib/clib; then
7523         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7524         xxx=apollo
7525         libc='/lib/clib /lib/libc'
7526         if $test -r /lib/syslib; then
7527                 echo "(Your math library is in /lib/syslib.)"
7528                 libc="$libc /lib/syslib"
7529         fi
7530 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7531         echo "Your C library seems to be in $libc, as you said before."
7532 elif $test -r $incpath/usr/lib/libc$_a; then
7533         libc=$incpath/usr/lib/libc$_a;
7534         echo "Your C library seems to be in $libc.  That's fine."
7535 elif $test -r /lib/libc$_a; then
7536         libc=/lib/libc$_a;
7537         echo "Your C library seems to be in $libc.  You're normal."
7538 else
7539         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7540                 :
7541         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7542                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7543         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7544                 :
7545         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7546                 :
7547         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7548                 :
7549         else
7550                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7551         fi
7552         if $test -r "$tans"; then
7553                 echo "Your C library seems to be in $tans, of all places."
7554                 libc=$tans
7555         else
7556                 libc='blurfl'
7557         fi
7558 fi
7559 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7560         dflt="$libc"
7561         cat <<EOM
7562
7563 If the guess above is wrong (which it might be if you're using a strange
7564 compiler, or your machine supports multiple models), you can override it here.
7565
7566 EOM
7567 else
7568         dflt=''
7569         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7570         cat >&4 <<EOM
7571 I can't seem to find your C library.  I've looked in the following places:
7572
7573 EOM
7574         $sed 's/^/      /' libpath
7575         cat <<EOM
7576
7577 None of these seems to contain your C library. I need to get its name...
7578
7579 EOM
7580 fi
7581 fn=f
7582 rp='Where is your C library?'
7583 . ./getfile
7584 libc="$ans"
7585
7586 echo " "
7587 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7588 set X `cat libnames`
7589 shift
7590 xxx=files
7591 case $# in 1) xxx=file; esac
7592 echo "Extracting names from the following $xxx for later perusal:" >&4
7593 echo " "
7594 $sed 's/^/      /' libnames >&4
7595 echo " "
7596 $echo $n "This may take a while...$c" >&4
7597
7598 for file in $*; do
7599         case $file in
7600         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7601         *) $nm $nm_opt $file 2>/dev/null;;
7602         esac
7603 done >libc.tmp
7604
7605 $echo $n ".$c"
7606 $grep fprintf libc.tmp > libc.ptf
7607 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7608 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7609 xxx='[ADTSIW]'
7610 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7611         eval $xscan;\
7612         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7613                 eval $xrun
7614 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7615         eval $xscan;\
7616         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7617                 eval $xrun
7618 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7619         eval $xscan;\
7620         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7621                 eval $xrun
7622 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7623         eval $xscan;\
7624         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7625                 eval $xrun
7626 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7627         eval $xscan;\
7628         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7629                 eval $xrun
7630 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7631         eval $xscan;\
7632         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7633                 eval $xrun
7634 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7635                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7636         eval $xscan;\
7637         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7638                 eval $xrun
7639 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7640         eval $xscan;\
7641         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7642                 eval $xrun
7643 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7644         eval $xscan;\
7645         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7646                 eval $xrun
7647 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7648         eval $xscan;\
7649         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7650                 eval $xrun
7651 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7652         eval $xscan;\
7653         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7654                 eval $xrun
7655 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7656         eval $xscan;\
7657         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7658                 eval $xrun
7659 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7660         eval $xscan;\
7661         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7662                 eval $xrun
7663 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7664         eval $xscan;\
7665         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7666                 eval $xrun
7667 else
7668         $nm -p $* 2>/dev/null >libc.tmp
7669         $grep fprintf libc.tmp > libc.ptf
7670         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7671                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7672         then
7673                 nm_opt='-p'
7674                 eval $xrun
7675         else
7676                 echo " "
7677                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7678                 com=''
7679                 if $ar t $libc > libc.tmp && \
7680                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7681                 then
7682                         for thisname in $libnames $libc; do
7683                                 $ar t $thisname >>libc.tmp
7684                         done
7685                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7686                         echo "Ok." >&4
7687                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7688                         for thisname in $libnames $libc; do
7689                                 $ar tv $thisname >>libc.tmp
7690                                 emximp -o tmp.imp $thisname \
7691                                     2>/dev/null && \
7692                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7693                                     < tmp.imp >>libc.tmp
7694                                 $rm -f tmp.imp
7695                         done
7696                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7697                         echo "Ok." >&4
7698                 else
7699                         echo "$ar didn't seem to work right." >&4
7700                         echo "Maybe this is a Cray...trying bld instead..." >&4
7701                         if  bld t $libc | \
7702                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7703                                 $test -s libc.list
7704                         then
7705                                 for thisname in $libnames; do
7706                                         bld t $libnames | \
7707                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7708                                         $ar t $thisname >>libc.tmp
7709                                 done
7710                                 echo "Ok." >&4
7711                         else
7712                                 echo "That didn't work either.  Giving up." >&4
7713                                 exit 1
7714                         fi
7715                 fi
7716         fi
7717 fi
7718 nm_extract="$com"
7719 case "$PASE" in
7720 define)
7721     echo " "
7722     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7723     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7724     ;;
7725 *)  if $test -f /lib/syscalls.exp; then
7726         echo " "
7727         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7728         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7729                 /lib/syscalls.exp >>libc.list
7730     fi
7731     ;;
7732 esac
7733 ;;
7734 esac
7735 $rm -f libnames libpath
7736
7737 : see if dld is available
7738 set dld.h i_dld
7739 eval $inhdr
7740
7741 : Check if we are using C++
7742 echo " "
7743 echo "Checking for C++..." >&4
7744 $cat >try.c <<'EOCP'
7745 #include <stdio.h>
7746 int main(void)
7747 {
7748 #ifdef __cplusplus
7749     return 0;
7750 #else
7751     return 1;
7752 #endif
7753 }
7754 EOCP
7755 set try
7756 if eval $compile_ok && $run ./try; then
7757         val="$define"
7758         echo "You are using a C++ compiler."
7759 else
7760         val="$undef"
7761         echo "You are not using a C++ compiler."
7762 fi
7763 $rm_try cplusplus$$
7764 set d_cplusplus
7765 eval $setvar
7766
7767 : is a C symbol defined?
7768 csym='tlook=$1;
7769 case "$3" in
7770 -v) tf=libc.tmp; tdc="";;
7771 -a) tf=libc.tmp; tdc="[]";;
7772 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7773 esac;
7774 tx=yes;
7775 case "$reuseval-$4" in
7776 true-) ;;
7777 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7778 esac;
7779 case "$tx" in
7780 yes)
7781         tval=false;
7782         case "$d_cplusplus" in
7783                 $define) extern_C=\"C\";;
7784         esac;
7785         if $test "$runnm" = true; then
7786                 if $contains $tlook $tf >/dev/null 2>&1; then
7787                         tval=true;
7788                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7789                         echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7790                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7791                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7792                         $rm_try;
7793                 fi;
7794         else
7795                 echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7796                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7797                 $rm_try;
7798         fi;
7799         ;;
7800 *)
7801         case "$tval" in
7802         $define) tval=true;;
7803         *) tval=false;;
7804         esac;
7805         ;;
7806 esac;
7807 eval "$2=$tval"'
7808
7809 : define an is-in-libc? function
7810 inlibc='echo " "; td=$define; tu=$undef;
7811 sym=$1; var=$2; eval "was=\$$2";
7812 tx=yes;
7813 case "$reuseval$was" in
7814 true) ;;
7815 true*) tx=no;;
7816 esac;
7817 case "$tx" in
7818 yes)
7819         set $sym tres -f;
7820         eval $csym;
7821         case "$tres" in
7822         true)
7823                 echo "$sym() found." >&4;
7824                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7825         *)
7826                 echo "$sym() NOT found." >&4;
7827                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7828         esac;;
7829 *)
7830         case "$was" in
7831         $define) echo "$sym() found." >&4;;
7832         *) echo "$sym() NOT found." >&4;;
7833         esac;;
7834 esac'
7835
7836 : see if dlopen exists
7837 xxx_runnm="$runnm"
7838 xxx_ccflags="$ccflags"
7839 runnm=false
7840 : with g++ one needs -shared to get is-in-libc to work for dlopen
7841 case "$gccversion" in
7842 '')     ;;
7843 *)      case "$d_cplusplus" in
7844         "$define") ccflags="$ccflags -shared" ;;
7845         esac
7846         ;;
7847 esac
7848 set dlopen d_dlopen
7849 eval $inlibc
7850 runnm="$xxx_runnm"
7851 ccflags="$xxx_ccflags"
7852
7853 : see if this is a unistd.h system
7854 set unistd.h i_unistd
7855 eval $inhdr
7856
7857 : determine which dynamic loading, if any, to compile in
7858 echo " "
7859 dldir="ext/DynaLoader"
7860 case "$usedl" in
7861 $define|y|true)
7862         dflt='y'
7863         usedl="$define"
7864         ;;
7865 $undef|n|false)
7866         dflt='n'
7867         usedl="$undef"
7868         ;;
7869 *)
7870         dflt='n'
7871         case "$d_dlopen" in
7872             $define) dflt='y' ;;
7873         esac
7874         case "$i_dld" in
7875             $define) dflt='y' ;;
7876         esac
7877         : Does a dl_xxx.xs file exist for this operating system
7878         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7879         ;;
7880 esac
7881 rp="Do you wish to use dynamic loading?"
7882 . ./myread
7883 usedl="$ans"
7884 case "$ans" in
7885 y*) usedl="$define"
7886         case "$dlsrc" in
7887         '')
7888                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7889                         dflt="$dldir/dl_${osname}.xs"
7890                 elif $test "$d_dlopen" = "$define" ; then
7891                         dflt="$dldir/dl_dlopen.xs"
7892                 elif $test "$i_dld" = "$define" ; then
7893                         dflt="$dldir/dl_dld.xs"
7894                 else
7895                         dflt=''
7896                 fi
7897                 ;;
7898         *)      dflt="$dldir/$dlsrc"
7899                 ;;
7900         esac
7901     echo "The following dynamic loading files are available:"
7902         : Can not go over to $dldir because getfile has path hard-coded in.
7903         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7904         rp="Source file to use for dynamic loading"
7905         fn="fne"
7906         gfpth="$src"
7907         . ./getfile
7908         usedl="$define"
7909         : emulate basename
7910         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7911
7912         $cat << EOM
7913
7914 Some systems may require passing special flags to $cc -c to
7915 compile modules that will be used to create a shared library.
7916 To use no flags, say "none".
7917
7918 EOM
7919     case "$cccdlflags" in
7920     '') case "$gccversion" in
7921                 '') case "$osname" in
7922                         hpux)   dflt='+z' ;;
7923                         next)   dflt='none' ;;
7924                         irix*)  dflt='-KPIC' ;;
7925                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7926                         sunos)  dflt='-pic' ;;
7927                         *)      dflt='none' ;;
7928                     esac
7929                         ;;
7930                 *)  case "$osname" in
7931                         darwin) dflt='none' ;;
7932                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7933                         *)      dflt='-fpic' ;;
7934                     esac ;;
7935             esac ;;
7936         ' ') dflt='none' ;;
7937     *)  dflt="$cccdlflags" ;;
7938     esac
7939     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7940     . ./myread
7941     case "$ans" in
7942     none) cccdlflags=' ' ;;
7943     *) cccdlflags="$ans" ;;
7944     esac
7945
7946     cat << EOM
7947
7948 Some systems use ld to create libraries that can be dynamically loaded,
7949 while other systems (such as those using ELF) use $cc.
7950
7951 EOM
7952         case "$ld" in
7953         '')     $cat >try.c <<EOM
7954 /* Test for whether ELF binaries are produced */
7955 #include <fcntl.h>
7956 #$i_stdlib I_STDLIB
7957 #ifdef I_STDLIB
7958 #include <stdlib.h>
7959 #endif
7960 #$i_unistd I_UNISTD
7961 #ifdef I_UNISTD
7962 #include <unistd.h>
7963 #endif
7964 int main() {
7965         char b[4];
7966         int i = open("a.out",O_RDONLY);
7967         if(i == -1)
7968                 exit(1); /* fail */
7969         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7970                 exit(0); /* succeed (yes, it's ELF) */
7971         else
7972                 exit(1); /* fail */
7973 }
7974 EOM
7975                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7976                         cat <<EOM
7977 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7978 EOM
7979                         dflt="$cc"
7980                 else
7981                         echo "I'll use ld to build dynamic libraries."
7982                         dflt='ld'
7983                 fi
7984                 $rm_try
7985                 ;;
7986         *)      dflt="$ld"
7987                 ;;
7988         esac
7989
7990     rp="What command should be used to create dynamic libraries?"
7991     . ./myread
7992         ld="$ans"
7993
7994     cat << EOM
7995
7996 Some systems may require passing special flags to $ld to create a
7997 library that can be dynamically loaded.  If your ld flags include
7998 -L/other/path options to locate libraries outside your loader's normal
7999 search path, you may need to specify those -L options here as well.  To
8000 use no flags, say "none".
8001
8002 EOM
8003     case "$lddlflags" in
8004     '') case "$osname" in
8005                         beos) dflt='-nostart' ;;
8006                         hpux) dflt='-b';
8007                               case "$gccversion" in
8008                               '') dflt="$dflt +vnocompatwarnings" ;;
8009                               esac
8010                               ;;
8011                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
8012                         next)  dflt='none' ;;
8013                         solaris) dflt='-G' ;;
8014                         sunos) dflt='-assert nodefinitions' ;;
8015                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8016                 *)     dflt='none' ;;
8017                         esac
8018                         ;;
8019     *) dflt="$lddlflags" ;;
8020     esac
8021
8022         : Try to guess additional flags to pick up local libraries.
8023         : Be careful not to append to a plain 'none'
8024         case "$dflt" in
8025         none) dflt='' ;;
8026         esac
8027         for thisflag in $ldflags; do
8028                 case "$thisflag" in
8029                 -L*|-R*|-Wl,-R*)
8030                         case " $dflt " in
8031                         *" $thisflag "*) ;;
8032                         *) dflt="$dflt $thisflag" ;;
8033                         esac
8034                         ;;
8035                 esac
8036         done
8037
8038         case "$dflt" in
8039         ''|' ') dflt='none' ;;
8040         esac
8041
8042         case "$ldflags" in
8043         *-fstack-protector*)
8044             case "$dflt" in
8045                         *-fstack-protector*) ;; # Don't add it again
8046                         *) dflt="$dflt -fstack-protector" ;; 
8047                 esac
8048                 ;;
8049         esac
8050
8051
8052     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8053     . ./myread
8054     case "$ans" in
8055     none) lddlflags=' ' ;;
8056     *) lddlflags="$ans" ;;
8057     esac
8058
8059         cat <<EOM
8060
8061 Some systems may require passing special flags to $cc to indicate that
8062 the resulting executable will use dynamic linking.  To use no flags,
8063 say "none".
8064
8065 EOM
8066     case "$ccdlflags" in
8067     '') case "$osname" in
8068             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8069             next|sunos) dflt='none' ;;
8070             *)          dflt='none' ;;
8071             esac ;;
8072     ' ')  dflt='none' ;;
8073     *)  dflt="$ccdlflags" ;;
8074     esac
8075     rp="Any special flags to pass to $cc to use dynamic linking?"
8076     . ./myread
8077     case "$ans" in
8078     none) ccdlflags=' ' ;;
8079     *) ccdlflags="$ans" ;;
8080     esac
8081     ;;
8082 *)  usedl="$undef"
8083         ld='ld'
8084     dlsrc='dl_none.xs'
8085     lddlflags=''
8086     ccdlflags=''
8087     ;;
8088 esac
8089
8090 : Do we want a shared libperl?
8091 also=''
8092 case "$usedl" in
8093 $undef)
8094         # No dynamic loading being used, so don't bother even to prompt.
8095         useshrplib='false'
8096         ;;
8097 *)      case "$useshrplib" in
8098         '')     case "$osname" in
8099                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
8100                         dflt=y
8101                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8102                         ;;
8103                 next*)
8104                         case "$osvers" in
8105                         4*)     dflt=y
8106                                 also='Building a shared libperl is needed for MAB support.'
8107                                 ;;
8108                         *)      dflt=n
8109                                 ;;
8110                         esac
8111                         ;;
8112                 *)      dflt=n
8113                         ;;
8114                 esac
8115                 ;;
8116         $define|true|[Yy]*)
8117                 dflt=y
8118                 ;;
8119         *)      dflt=n
8120                 ;;
8121         esac
8122         $cat << EOM
8123
8124 The perl executable is normally obtained by linking perlmain.c with
8125 libperl${_a}, any static extensions (usually just DynaLoader), and
8126 any other libraries needed on this system (such as -lm, etc.).  Since
8127 your system supports dynamic loading, it is probably possible to build
8128 a shared libperl.$so.  If you will have more than one executable linked
8129 to libperl.$so, this will significantly reduce the size of each
8130 executable, but it may have a noticeable effect on performance.  The
8131 default is probably sensible for your system.
8132 $also
8133
8134 EOM
8135         rp="Build a shared libperl.$so (y/n)"
8136         . ./myread
8137         case "$ans" in
8138         true|$define|[Yy]*)
8139                 useshrplib='true'  ;;
8140         *)      useshrplib='false' ;;
8141         esac
8142         ;;
8143 esac
8144
8145 case "$useshrplib" in
8146 true)
8147         case "$libperl" in
8148         '')
8149                 # Figure out a good name for libperl.so.  Since it gets stored in
8150                 # a version-specific architecture-dependent library, the version
8151                 # number isn't really that important, except for making cc/ld happy.
8152                 #
8153                 # A name such as libperl.so.3.1
8154                 majmin="libperl.$so.$patchlevel.$subversion"
8155                 # A name such as libperl.so.301
8156                 majonly=`echo $patchlevel $subversion |
8157                         $awk '{printf "%d%02d", $1, $2}'`
8158                 majonly=libperl.$so.$majonly
8159                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8160                 # rely on figuring it out from the naming of libc.
8161                 case "${osname}${osvers}" in
8162                 next4*)
8163                         dflt=libperl.5.$so
8164                         # XXX How handle the --version stuff for MAB?
8165                         ;;
8166                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8167                         dflt=libperl.$so
8168                         ;;
8169                 cygwin*) # ld links against an importlib
8170                         dflt=libperl$lib_ext
8171                         ;;
8172                 *)      # Try to guess based on whether libc has major.minor.
8173                         case "$libc" in
8174                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8175                         *libc.$so.[0-9]*) dflt=$majonly ;;
8176                         *)      dflt=libperl.$so ;;
8177                         esac
8178                         ;;
8179                 esac
8180                 ;;
8181         *)      dflt=$libperl
8182                 ;;
8183         esac
8184         cat << EOM
8185
8186 I need to select a good name for the shared libperl.  If your system uses
8187 library names with major and minor numbers, then you might want something
8188 like $majmin.  Alternatively, if your system uses a single version
8189 number for shared libraries, then you might want to use $majonly.
8190 Or, your system might be quite happy with a simple libperl.$so.
8191
8192 Since the shared libperl will get installed into a version-specific
8193 architecture-dependent directory, the version number of the shared perl
8194 library probably isn't important, so the default should be o.k.
8195
8196 EOM
8197         rp='What name do you want to give to the shared libperl?'
8198         . ./myread
8199         libperl=$ans
8200         echo "Ok, I'll use $libperl"
8201         ;;
8202 *)
8203         libperl="libperl${_a}"
8204         ;;
8205 esac
8206
8207 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8208 case "$shrpdir" in
8209 '') ;;
8210 *)      $cat >&4 <<EOM
8211 WARNING:  Use of the shrpdir variable for the installation location of
8212 the shared $libperl is not supported.  It was never documented and
8213 will not work in this version.  Let me (perlbug@perl.org)
8214 know of any problems this may cause.
8215
8216 EOM
8217         case "$shrpdir" in
8218         "$archlibexp/CORE")
8219                 $cat >&4 <<EOM
8220 But your current setting of $shrpdir is
8221 the default anyway, so it's harmless.
8222 EOM
8223                 ;;
8224         *)
8225                 $cat >&4 <<EOM
8226 Further, your current attempted setting of $shrpdir
8227 conflicts with the value of $archlibexp/CORE
8228 that installperl will use.
8229 EOM
8230                 ;;
8231         esac
8232         ;;
8233 esac
8234
8235 # How will the perl executable find the installed shared $libperl?
8236 # Add $xxx to ccdlflags.
8237 # If we can't figure out a command-line option, use $shrpenv to
8238 # set env LD_RUN_PATH.  The main perl makefile uses this.
8239 shrpdir=$archlibexp/CORE
8240 xxx=''
8241 tmp_shrpenv=''
8242 if "$useshrplib"; then
8243     case "$osname" in
8244         aix)
8245                 # We'll set it in Makefile.SH...
8246                 ;;
8247         solaris)
8248                 xxx="-R $shrpdir"
8249                 ;;
8250         freebsd|netbsd|openbsd|interix|dragonfly)
8251                 xxx="-Wl,-R$shrpdir"
8252                 ;;
8253         bsdos|linux|irix*|dec_osf|gnu*)
8254                 xxx="-Wl,-rpath,$shrpdir"
8255                 ;;
8256         next)
8257                 # next doesn't like the default...
8258                 ;;
8259         beos)
8260                 # beos doesn't like the default, either.
8261                 ;;
8262         hpux*)
8263                 # hpux doesn't like the default, either.
8264                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8265                 ;;
8266         *)
8267                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8268                 ;;
8269         esac
8270         case "$xxx" in
8271         '') ;;
8272         *)
8273                 # Only add $xxx if it isn't already in ccdlflags.
8274                 case " $ccdlflags " in
8275                 *" $xxx "*)     ;;
8276                 *)      ccdlflags="$ccdlflags $xxx"
8277                         cat <<EOM >&4
8278
8279 Adding $xxx to the flags
8280 passed to $ld so that the perl executable will find the
8281 installed shared $libperl.
8282
8283 EOM
8284                         ;;
8285                 esac
8286                 ;;
8287         esac
8288 fi
8289 # Fix ccdlflags in AIX for building external extensions.
8290 # (For building Perl itself bare -bE:perl.exp is needed,
8291 #  Makefile.SH takes care of this.)
8292 case "$osname" in
8293 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8294 esac
8295 # Respect a hint or command-line value.
8296 case "$shrpenv" in
8297 '') shrpenv="$tmp_shrpenv" ;;
8298 esac
8299 case "$ldlibpthname" in
8300 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8301 none)   ldlibpthname='' ;;
8302 esac
8303
8304 : determine where manual pages are on this system
8305 echo " "
8306 case "$sysman" in
8307 '') 
8308         syspath='/usr/share/man/man1 /usr/man/man1'
8309         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8310         syspath="$syspath /usr/man/u_man/man1"
8311         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8312         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8313         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8314         sysman=`./loc . /usr/man/man1 $syspath`
8315         ;;
8316 esac
8317 if $test -d "$sysman"; then
8318         echo "System manual is in $sysman." >&4
8319 else
8320         echo "Could not find manual pages in source form." >&4
8321 fi
8322
8323 : determine where manual pages go
8324 set man1dir man1dir none
8325 eval $prefixit
8326 $cat <<EOM
8327
8328 $spackage has manual pages available in source form.
8329 EOM
8330 case "$nroff" in
8331 nroff)
8332         echo "However, you don't have nroff, so they're probably useless to you."
8333         case "$man1dir" in
8334         '') man1dir="none";;
8335         esac;;
8336 esac
8337 echo "If you don't want the manual sources installed, answer 'none'."
8338 case "$man1dir" in
8339 ' ') dflt=none
8340         ;;
8341 '')
8342         lookpath="$prefixexp/share/man/man1"
8343         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8344         lookpath="$lookpath $prefixexp/man/p_man/man1"
8345         lookpath="$lookpath $prefixexp/man/u_man/man1"
8346         lookpath="$lookpath $prefixexp/man/man.1"
8347         case "$sysman" in
8348         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8349         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8350         esac
8351         set dflt
8352         eval $prefixup
8353         ;;
8354 *)  dflt="$man1dir"
8355         ;;
8356 esac
8357 echo " "
8358 fn=dn+~
8359 rp="Where do the main $spackage manual pages (source) go?"
8360 . ./getfile
8361 if $test "X$man1direxp" != "X$ansexp"; then
8362         installman1dir=''
8363 fi
8364 prefixvar=man1dir
8365 . ./setprefixvar
8366
8367 case "$man1dir" in
8368 '')     man1dir=' '
8369         installman1dir='';;
8370 esac
8371
8372 : What suffix to use on installed man pages
8373
8374 case "$man1dir" in
8375 ' ')
8376         man1ext='0'
8377         ;;
8378 *)
8379         rp="What suffix should be used for the main $spackage man pages?"
8380         case "$man1ext" in
8381         '')     case "$man1dir" in
8382                 *1)  dflt=1 ;;
8383                 *1p) dflt=1p ;;
8384                 *1pm) dflt=1pm ;;
8385                 *l) dflt=l;;
8386                 *n) dflt=n;;
8387                 *o) dflt=o;;
8388                 *p) dflt=p;;
8389                 *C) dflt=C;;
8390                 *L) dflt=L;;
8391                 *L1) dflt=L1;;
8392                 *) dflt=1;;
8393                 esac
8394                 ;;
8395         *)      dflt="$man1ext";;
8396         esac
8397         . ./myread
8398         man1ext="$ans"
8399         ;;
8400 esac
8401
8402 : see if we can have long filenames
8403 echo " "
8404 first=123456789abcdef
8405 $rm -f $first
8406 if (echo hi >$first) 2>/dev/null; then
8407         if $test -f 123456789abcde; then
8408                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8409                 val="$undef"
8410         else
8411                 echo 'You can have filenames longer than 14 characters.'>&4
8412                 val="$define"
8413         fi
8414 else
8415         $cat <<'EOM'
8416 You can't have filenames longer than 14 chars.
8417 You can't even think about them!
8418 EOM
8419         val="$undef"
8420 fi
8421 set d_flexfnam
8422 eval $setvar
8423 $rm -rf 123456789abcde*
8424
8425 : determine where library module manual pages go
8426 set man3dir man3dir none
8427 eval $prefixit
8428 $cat <<EOM
8429
8430 $spackage has manual pages for many of the library modules.
8431 EOM
8432
8433 case "$nroff" in
8434 nroff)
8435         $cat <<'EOM'
8436 However, you don't have nroff, so they're probably useless to you.
8437 EOM
8438         case "$man3dir" in
8439         '') man3dir="none";;
8440         esac;;
8441 esac
8442
8443 case "$d_flexfnam" in
8444 undef)
8445         $cat <<'EOM'
8446 However, your system can't handle the long file names like File::Basename.3.
8447 EOM
8448         case "$man3dir" in
8449         '') man3dir="none";;
8450         esac;;
8451 esac
8452
8453 echo "If you don't want the manual sources installed, answer 'none'."
8454 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8455 case "$man3dir" in
8456 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8457         if $test -d "$privlib/man/man3"; then
8458                 cat <<EOM >&4
8459
8460 WARNING:  Previous versions of perl installed man3 pages into
8461 $privlib/man/man3.  This version will suggest a
8462 new default of $dflt.
8463 EOM
8464                 tdflt=$dflt
8465                 dflt='n'
8466                 rp='Do you wish to preserve the old behavior?(y/n)'
8467                 . ./myread
8468                 case "$ans" in
8469                 y*) dflt="$privlib/man/man3" ;;
8470                 *)  dflt=$tdflt ;;
8471                 esac
8472     fi
8473         ;;
8474 *)      dflt="$man3dir" ;;
8475 esac
8476 case "$dflt" in
8477 ' ') dflt=none ;;
8478 esac
8479 echo " "
8480 fn=dn+~
8481 rp="Where do the $package library man pages (source) go?"
8482 . ./getfile
8483 prefixvar=man3dir
8484 . ./setprefixvar
8485
8486 case "$man3dir" in
8487 '')     man3dir=' '
8488         installman3dir='';;
8489 esac
8490
8491 : What suffix to use on installed man pages
8492 case "$man3dir" in
8493 ' ')
8494         man3ext='0'
8495         ;;
8496 *)
8497         rp="What suffix should be used for the $package library man pages?"
8498         case "$man3ext" in
8499         '')     case "$man3dir" in
8500                 *3)  dflt=3 ;;
8501                 *3p) dflt=3p ;;
8502                 *3pm) dflt=3pm ;;
8503                 *l) dflt=l;;
8504                 *n) dflt=n;;
8505                 *o) dflt=o;;
8506                 *p) dflt=p;;
8507                 *C) dflt=C;;
8508                 *L) dflt=L;;
8509                 *L3) dflt=L3;;
8510                 *) dflt=3;;
8511                 esac
8512                 ;;
8513         *)      dflt="$man3ext";;
8514         esac
8515         . ./myread
8516         man3ext="$ans"
8517         ;;
8518 esac
8519
8520 : see if we have to deal with yellow pages, now NIS.
8521 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8522         if $test -f /usr/etc/nibindd; then
8523                 echo " "
8524                 echo "I'm fairly confident you're on a NeXT."
8525                 echo " "
8526                 rp='Do you get the hosts file via NetInfo?'
8527                 dflt=y
8528                 case "$hostcat" in
8529                 nidump*) ;;
8530                 '') ;;
8531                 *) dflt=n;;
8532                 esac
8533                 . ./myread
8534                 case "$ans" in
8535                 y*) hostcat='nidump hosts .';;
8536                 *)      case "$hostcat" in
8537                         nidump*) hostcat='';;
8538                         esac
8539                         ;;
8540                 esac
8541         fi
8542         case "$hostcat" in
8543         nidump*) ;;
8544         *)
8545                 case "$hostcat" in
8546                 *ypcat*) dflt=y;;
8547                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8548                                 dflt=y
8549                         else
8550                                 dflt=n
8551                         fi;;
8552                 *) dflt=n;;
8553                 esac
8554                 echo " "
8555                 rp='Are you getting the hosts file via yellow pages?'
8556                 . ./myread
8557                 case "$ans" in
8558                 y*) hostcat='ypcat hosts';;
8559                 *) hostcat='cat /etc/hosts';;
8560                 esac
8561                 ;;
8562         esac
8563 fi
8564 case "$hostcat" in
8565 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8566 esac
8567 case "$groupcat" in
8568 '') test -f /etc/group && groupcat='cat /etc/group';;
8569 esac
8570 case "$passcat" in
8571 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8572 esac
8573
8574 : now get the host name
8575 echo " "
8576 echo "Figuring out host name..." >&4
8577 case "$myhostname" in
8578 '') cont=true
8579         echo 'Maybe "hostname" will work...'
8580         if tans=`sh -c hostname 2>&1` ; then
8581                 myhostname=$tans
8582                 phostname=hostname
8583                 cont=''
8584         fi
8585         ;;
8586 *) cont='';;
8587 esac
8588 if $test "$cont"; then
8589         if ./xenix; then
8590                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8591                 if tans=`cat /etc/systemid 2>&1` ; then
8592                         myhostname=$tans
8593                         phostname='cat /etc/systemid'
8594                         echo "Whadyaknow.  Xenix always was a bit strange..."
8595                         cont=''
8596                 fi
8597         elif $test -r /etc/systemid; then
8598                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8599         fi
8600 fi
8601 if $test "$cont"; then
8602         echo 'No, maybe "uuname -l" will work...'
8603         if tans=`sh -c 'uuname -l' 2>&1` ; then
8604                 myhostname=$tans
8605                 phostname='uuname -l'
8606         else
8607                 echo 'Strange.  Maybe "uname -n" will work...'
8608                 if tans=`sh -c 'uname -n' 2>&1` ; then
8609                         myhostname=$tans
8610                         phostname='uname -n'
8611                 else
8612                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8613                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8614                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8615                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8616                         else
8617                                 case "$myhostname" in
8618                                 '') echo "Does this machine have an identity crisis or something?"
8619                                         phostname='';;
8620                                 *)
8621                                         echo "Well, you said $myhostname before..."
8622                                         phostname='echo $myhostname';;
8623                                 esac
8624                         fi
8625                 fi
8626         fi
8627 fi
8628 case "$myhostname" in
8629 '') myhostname=noname ;;
8630 esac
8631 : you do not want to know about this
8632 set $myhostname
8633 myhostname=$1
8634
8635 : verify guess
8636 if $test "$myhostname" ; then
8637         dflt=y
8638         rp='Your host name appears to be "'$myhostname'".'" Right?"
8639         . ./myread
8640         case "$ans" in
8641         y*) ;;
8642         *) myhostname='';;
8643         esac
8644 fi
8645
8646 : bad guess or no guess
8647 while $test "X$myhostname" = X ; do
8648         dflt=''
8649         rp="Please type the (one word) name of your host:"
8650         . ./myread
8651         myhostname="$ans"
8652 done
8653
8654 : translate upper to lower if necessary
8655 case "$myhostname" in
8656 *[A-Z]*)
8657         echo "(Normalizing case in your host name)"
8658         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8659         ;;
8660 esac
8661
8662 case "$myhostname" in
8663 *.*)
8664         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8665         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8666         echo "(Trimming domain name from host name--host name is now $myhostname)"
8667         ;;
8668 *) case "$mydomain" in
8669         '')
8670                 {
8671                         test "X$hostcat" = "Xypcat hosts" &&
8672                         ypmatch "$myhostname" hosts 2>/dev/null |\
8673                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8674                         $test -s hosts
8675                 } || {
8676                         test "X$hostcat" != "X" &&
8677                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8678                                         /[       ]$myhostname[  . ]/p" > hosts
8679                 }
8680                 tmp_re="[       . ]"
8681                 if $test -f hosts; then
8682                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8683                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8684                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8685                                 hosts | $sort | $uniq | \
8686                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8687                         case `$echo X$dflt` in
8688                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8689                                 dflt=.
8690                                 ;;
8691                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8692                                 ;;
8693                         esac
8694                 else
8695                         echo "(I cannot locate a hosts database anywhere)"
8696                         dflt=.
8697                 fi
8698                 case "$dflt" in
8699                 .)
8700                         tans=`./loc resolv.conf X /etc /usr/etc`
8701                         if $test -f "$tans"; then
8702                                 echo "(Attempting domain name extraction from $tans)"
8703                                 dflt=.`$sed -n -e 's/   / /g' \
8704                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8705                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8706                                 case "$dflt" in
8707                                 .) dflt=.`$sed -n -e 's/        / /g' \
8708                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8709                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8710                                         ;;
8711                                 esac
8712                         fi
8713                         ;;
8714                 esac
8715                 case "$dflt" in
8716                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8717                         dflt=.`sh -c domainname 2>/dev/null`
8718                         case "$dflt" in
8719                         '') dflt='.';;
8720                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8721                         esac
8722                         ;;
8723                 esac
8724                 case "$dflt$osname" in
8725                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8726                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8727                         ;;
8728                 esac
8729                 case "$dflt" in
8730                 .) echo "(Lost all hope -- silly guess then)"
8731                         dflt='.nonet'
8732                         ;;
8733                 esac
8734                 $rm -f hosts
8735                 ;;
8736         *) dflt="$mydomain";;
8737         esac;;
8738 esac
8739 echo " "
8740 rp="What is your domain name?"
8741 . ./myread
8742 tans="$ans"
8743 case "$ans" in
8744 '') ;;
8745 .*) ;;
8746 *) tans=".$tans";;
8747 esac
8748 mydomain="$tans"
8749
8750 : translate upper to lower if necessary
8751 case "$mydomain" in
8752 *[A-Z]*)
8753         echo "(Normalizing case in your domain name)"
8754         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8755         ;;
8756 esac
8757
8758 : a little sanity check here
8759 case "$phostname" in
8760 '') ;;
8761 *)
8762         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8763         $myhostname$mydomain|$myhostname) ;;
8764         *)
8765                 case "$phostname" in
8766                 sed*)
8767                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8768                         ;;
8769                 *)
8770                         echo "(That doesn't agree with your $phostname command, by the way.)"
8771                         ;;
8772                 esac
8773         ;;
8774         esac
8775         ;;
8776 esac
8777
8778 : determine the e-mail address of the user who is running us
8779 $cat <<EOM
8780
8781 I need to get your e-mail address in Internet format if possible, i.e.
8782 something like user@host.domain. Please answer accurately since I have
8783 no easy means to double check it. The default value provided below
8784 is most probably close to reality but may not be valid from outside
8785 your organization...
8786
8787 EOM
8788 cont=x
8789 while test "$cont"; do
8790         case "$cf_email" in
8791         '') dflt="$cf_by@$myhostname$mydomain";;
8792         *) dflt="$cf_email";;
8793         esac
8794         rp='What is your e-mail address?'
8795         . ./myread
8796         cf_email="$ans"
8797         case "$cf_email" in
8798         *@*.*) cont='' ;;
8799         *)
8800                 rp='Address does not look like an Internet one.  Use it anyway?'
8801                 case "$fastread" in
8802                 yes) dflt=y ;;
8803                 *) dflt=n ;;
8804                 esac
8805                 . ./myread
8806                 case "$ans" in
8807                 y*) cont='' ;;
8808                 *) echo " " ;;
8809                 esac
8810                 ;;
8811         esac
8812 done
8813
8814 : Ask e-mail of administrator
8815 $cat <<EOM
8816
8817 If you or somebody else will be maintaining perl at your site, please
8818 fill in the correct e-mail address here so that they may be contacted
8819 if necessary. Currently, the "perlbug" program included with perl
8820 will send mail to this address in addition to perlbug@perl.org. You may
8821 enter "none" for no administrator.
8822
8823 EOM
8824 case "$perladmin" in
8825 '') dflt="$cf_email";;
8826 *) dflt="$perladmin";;
8827 esac
8828 rp='Perl administrator e-mail address'
8829 . ./myread
8830 perladmin="$ans"
8831
8832 : determine whether to only install version-specific parts.
8833 echo " "
8834 $cat <<EOM
8835 Do you want to install only the version-specific parts of the perl
8836 distribution?  Usually you do *not* want to do this.
8837 EOM
8838 case "$versiononly" in
8839 "$define"|[Yy]*|true) dflt='y' ;;
8840 *) dflt='n';
8841 esac
8842 rp="Do you want to install only the version-specific parts of perl?"
8843 . ./myread
8844 case "$ans" in
8845 [yY]*)  val="$define";;
8846 *)      val="$undef" ;;
8847 esac
8848 set versiononly
8849 eval $setvar
8850
8851 case "$versiononly" in
8852 "$define") inc_version_list=''
8853            inc_version_list_init=0
8854            ;;
8855 esac
8856
8857 : figure out how to guarantee perl startup
8858 : XXX Note that this currently takes advantage of the bug that binexp ignores
8859 :     the Configure -Dinstallprefix setting, which in turn means that under
8860 :     relocatable @INC, initialinstalllocation is what binexp started as.
8861 case "$startperl" in
8862 '')
8863         case "$sharpbang" in
8864         *!)
8865                 $cat <<EOH
8866
8867 I can use the #! construct to start perl on your system. This will
8868 make startup of perl scripts faster, but may cause problems if you
8869 want to share those scripts and perl is not in a standard place
8870 ($initialinstalllocation/perl) on all your platforms. The alternative
8871 is to force a shell by starting the script with a single ':' character.
8872
8873 EOH
8874                 case "$versiononly" in
8875                 "$define")      dflt="$initialinstalllocation/perl$version";;
8876                 *)              dflt="$initialinstalllocation/perl";;
8877                 esac
8878                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8879                 . ./myread
8880                 case "$ans" in
8881                 none)   startperl=": # use perl";;
8882                 *)      startperl="#!$ans"
8883                         if $test 30 -lt `echo "$ans" | wc -c`; then
8884                                 $cat >&4 <<EOM
8885
8886 WARNING:  Some systems limit the #! command to 32 characters.
8887 If you experience difficulty running Perl scripts with #!, try
8888 installing Perl in a directory with a shorter pathname.
8889
8890 EOM
8891                         fi ;;
8892                 esac
8893                 ;;
8894         *) startperl=": # use perl"
8895                 ;;
8896         esac
8897         ;;
8898 esac
8899 echo "I'll use $startperl to start perl scripts."
8900
8901 : figure best path for perl in scripts
8902 case "$perlpath" in
8903 '')
8904         case "$versiononly" in
8905         "$define")      perlpath="$initialinstalllocation/perl$version";;
8906         *)              perlpath="$initialinstalllocation/perl";;
8907         esac
8908         case "$startperl" in
8909         *!*) ;;
8910         *)
8911                 $cat <<EOH
8912
8913 I will use the "eval 'exec'" idiom to start Perl on your system.
8914 I can use the full path of your Perl binary for this purpose, but
8915 doing so may cause problems if you want to share those scripts and
8916 Perl is not always in a standard place ($initialinstalllocation/perl).
8917
8918 EOH
8919                 dflt="$initialinstalllocation/perl"
8920                 rp="What path shall I use in \"eval 'exec'\"?"
8921                 . ./myread
8922                 perlpath="$ans"
8923                 ;;
8924         esac
8925         ;;
8926 esac
8927 case "$startperl" in
8928 *!*)    ;;
8929 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8930 esac
8931
8932 : determine where public executable scripts go
8933 set scriptdir scriptdir
8934 eval $prefixit
8935 case "$scriptdir" in
8936 '')
8937         dflt="$bin"
8938         : guess some guesses
8939         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8940         $test -d /usr/share/bin     && dflt=/usr/share/bin
8941         $test -d /usr/local/script  && dflt=/usr/local/script
8942         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8943         $test -d $prefixexp/script  && dflt=$prefixexp/script
8944         set dflt
8945         eval $prefixup
8946         ;;
8947 *)  dflt="$scriptdir"
8948         ;;
8949 esac
8950 $cat <<EOM
8951
8952 Some installations have a separate directory just for executable scripts so
8953 that they can mount it across multiple architectures but keep the scripts in
8954 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8955 Or you might just lump your scripts in with all your other executables.
8956
8957 EOM
8958 fn=d~
8959 rp='Where do you keep publicly executable scripts?'
8960 . ./getfile
8961 if $test "X$ansexp" != "X$scriptdirexp"; then
8962         installscript=''
8963 fi
8964 installscriptdir=''
8965 prefixvar=scriptdir
8966 . ./setprefixvar
8967 : A little fix up for an irregularly named variable.
8968 installscript="$installscriptdir"
8969
8970 : determine where add-on public executables go
8971 case "$sitebin" in
8972 '')     dflt=$siteprefix/bin ;;
8973 *)      dflt=$sitebin ;;
8974 esac
8975 fn=d~
8976 rp='Pathname where the add-on public executables should be installed?'
8977 . ./getfile
8978 prefixvar=sitebin
8979 . ./setprefixvar
8980
8981 : determine where add-on html pages go
8982 : There is no standard location, so try to copy the previously-selected
8983 : directory structure for the core html pages.
8984 case "$sitehtml1dir" in
8985 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8986 *)     dflt=$sitehtml1dir ;;
8987 esac
8988 case "$dflt" in
8989 ''|' ') dflt=none ;;
8990 esac
8991 fn=dn+~
8992 rp='Pathname where the site-specific html pages should be installed?'
8993 . ./getfile
8994 prefixvar=sitehtml1dir
8995 . ./setprefixvar
8996
8997 : determine where add-on library html pages go
8998 : There is no standard location, so try to copy the previously-selected
8999 : directory structure for the core html pages.
9000 case "$sitehtml3dir" in
9001 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9002 *)     dflt=$sitehtml3dir ;;
9003 esac
9004 case "$dflt" in
9005 ''|' ') dflt=none ;;
9006 esac
9007 fn=dn+~
9008 rp='Pathname where the site-specific library html pages should be installed?'
9009 . ./getfile
9010 prefixvar=sitehtml3dir
9011 . ./setprefixvar
9012
9013 : determine where add-on manual pages go
9014 case "$siteman1dir" in
9015 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9016 *)      dflt=$siteman1dir ;;
9017 esac
9018 case "$dflt" in
9019 ''|' ') dflt=none ;;
9020 esac
9021 fn=dn+~
9022 rp='Pathname where the site-specific manual pages should be installed?'
9023 . ./getfile
9024 prefixvar=siteman1dir
9025 . ./setprefixvar
9026
9027 : determine where add-on library man pages go
9028 case "$siteman3dir" in
9029 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9030 *)      dflt=$siteman3dir ;;
9031 esac
9032 case "$dflt" in
9033 ''|' ') dflt=none ;;
9034 esac
9035 fn=dn+~
9036 rp='Pathname where the site-specific library manual pages should be installed?'
9037 . ./getfile
9038 prefixvar=siteman3dir
9039 . ./setprefixvar
9040
9041 : determine where add-on public executable scripts go
9042 case "$sitescript" in
9043 '')     dflt=$siteprefix/script
9044         $test -d $dflt || dflt=$sitebin ;;
9045 *)  dflt="$sitescript" ;;
9046 esac
9047 fn=d~+
9048 rp='Pathname where add-on public executable scripts should be installed?'
9049 . ./getfile
9050 prefixvar=sitescript
9051 . ./setprefixvar
9052
9053 : Check if faststdio is requested and available
9054 case "$usefaststdio" in
9055 $define|true|[yY]*|'')
9056         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9057         case "$xversion" in
9058         [68])   dflt='y' ;;
9059         *)      dflt='n' ;;
9060         esac
9061         ;;
9062 *) dflt='n';;
9063 esac
9064 cat <<EOM
9065
9066 Perl can be built to use 'fast stdio', which means using the stdio
9067 library but also directly manipulating the stdio buffers to enable
9068 faster I/O.  Using stdio is better for backward compatibility (especially
9069 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9070 interface has been preferred instead of stdio.
9071
9072 If this doesn't make any sense to you, just accept the default '$dflt'.
9073 EOM
9074 rp='Use the "fast stdio" if available?'
9075 . ./myread
9076 case "$ans" in
9077 y|Y)    val="$define" ;;
9078 *)      val="$undef" ;;
9079 esac
9080 set usefaststdio
9081 eval $setvar
9082
9083
9084 : define an is-a-typedef? function
9085 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9086 case "$inclist" in
9087 "") inclist="sys/types.h";;
9088 esac;
9089 eval "varval=\$$var";
9090 case "$varval" in
9091 "")
9092         $rm -f temp.c;
9093         for inc in $inclist; do
9094                 echo "#include <$inc>" >>temp.c;
9095         done;
9096         echo "#ifdef $type" >> temp.c;
9097         echo "printf(\"We have $type\");" >> temp.c;
9098         echo "#endif" >> temp.c;
9099         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9100         if $contains $type temp.E >/dev/null 2>&1; then
9101                 eval "$var=\$type";
9102         else
9103                 eval "$var=\$def";
9104         fi;
9105         $rm -f temp.?;;
9106 *) eval "$var=\$varval";;
9107 esac'
9108
9109 : define an is-a-typedef? function that prompts if the type is not available.
9110 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9111 case "$inclist" in
9112 "") inclist="sys/types.h";;
9113 esac;
9114 eval "varval=\$$var";
9115 case "$varval" in
9116 "")
9117         $rm -f temp.c;
9118         for inc in $inclist; do
9119                 echo "#include <$inc>" >>temp.c;
9120         done;
9121         echo "#ifdef $type" >> temp.c;
9122         echo "printf(\"We have $type\");" >> temp.c;
9123         echo "#endif" >> temp.c;
9124         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9125         echo " " ;
9126         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9127         if $contains $type temp.E >/dev/null 2>&1; then
9128                 echo "$type found." >&4;
9129                 eval "$var=\$type";
9130         else
9131                 echo "$type NOT found." >&4;
9132                 dflt="$def";
9133                 . ./myread ;
9134                 eval "$var=\$ans";
9135         fi;
9136         $rm -f temp.?;;
9137 *) eval "$var=\$varval";;
9138 esac'
9139
9140 : see what type lseek is declared as in the kernel
9141 rp="What is the type used for lseek's offset on this system?"
9142 set off_t lseektype long stdio.h sys/types.h
9143 eval $typedef_ask
9144
9145 echo " "
9146 echo "Checking to see how big your file offsets are..." >&4
9147 $cat >try.c <<EOCP
9148 #include <sys/types.h>
9149 #include <stdio.h>
9150 int main()
9151 {
9152     printf("%d\n", (int)sizeof($lseektype));
9153     return(0);
9154 }
9155 EOCP
9156 set try
9157 if eval $compile_ok; then
9158         lseeksize=`$run ./try`
9159         echo "Your file offsets are $lseeksize bytes long."
9160 else
9161         dflt=$longsize
9162         echo " "
9163         echo "(I can't seem to compile the test program.  Guessing...)"
9164         rp="What is the size of your file offsets (in bytes)?"
9165         . ./myread
9166         lseeksize="$ans"
9167 fi
9168 $rm_try
9169
9170 : see what type file positions are declared as in the library
9171 rp="What is the type for file position used by fsetpos()?"
9172 set fpos_t fpostype long stdio.h sys/types.h
9173 eval $typedef_ask
9174
9175 : Check size for Fpos_t
9176 echo " "
9177 case "$fpostype" in
9178 *_t) zzz="$fpostype"    ;;
9179 *)   zzz="fpos_t"       ;;
9180 esac
9181 echo "Checking the size of $zzz..." >&4
9182 cat > try.c <<EOCP
9183 #include <sys/types.h>
9184 #include <stdio.h>
9185 #$i_stdlib I_STDLIB
9186 #ifdef I_STDLIB
9187 #include <stdlib.h>
9188 #endif
9189 int main() {
9190     printf("%d\n", (int)sizeof($fpostype));
9191     exit(0);
9192 }
9193 EOCP
9194 set try
9195 if eval $compile_ok; then
9196         yyy=`$run ./try`
9197         case "$yyy" in
9198         '')     fpossize=4
9199                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9200                 ;;
9201         *)      fpossize=$yyy
9202                 echo "Your $zzz is $fpossize bytes long."
9203                 ;;
9204         esac
9205 else
9206         dflt="$longsize"
9207         echo " " >&4
9208         echo "(I can't compile the test program.  Guessing...)" >&4
9209         rp="What is the size of your file positions (in bytes)?"
9210         . ./myread
9211         fpossize="$ans"
9212 fi
9213
9214 : Check for large file support
9215 # Backward compatibility (uselfs is deprecated).
9216 case "$uselfs" in
9217 "$define"|true|[yY]*)
9218         cat <<EOM >&4
9219
9220 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9221 EOM
9222         uselargefiles="$define"
9223         ;;
9224 esac
9225
9226 case "$lseeksize:$fpossize" in
9227 8:8) cat <<EOM
9228
9229 You can have files larger than 2 gigabytes.
9230 EOM
9231    val="$define" ;;
9232 *)    case "$uselargefiles" in
9233    "$undef"|false|[nN]*) dflt='n' ;;
9234    *)   dflt='y' ;;
9235    esac
9236    cat <<EOM
9237
9238 Perl can be built to understand large files (files larger than 2 gigabytes)
9239 on some systems.  To do so, Configure can be run with -Duselargefiles.
9240
9241 If this doesn't make any sense to you, just accept the default '$dflt'.
9242 EOM
9243    rp='Try to understand large files, if available?'
9244    . ./myread
9245    case "$ans" in
9246    y|Y)         val="$define" ;;
9247    *)           val="$undef"  ;;
9248    esac
9249    ;;
9250 esac
9251 set uselargefiles
9252 eval $setvar
9253 : Look for a hint-file generated 'call-back-unit'.  If the
9254 : user has specified that a large files perl is to be built,
9255 : we may need to set or change some other defaults.
9256 if $test -f uselargefiles.cbu; then
9257         echo "Your platform has some specific hints regarding large file builds, using them..."
9258         . ./uselargefiles.cbu
9259 fi
9260 case "$uselargefiles" in
9261 "$define")
9262         if $test -f uselargefiles.cbu; then
9263                 echo " "
9264                 echo "Rechecking to see how big your file offsets are..." >&4
9265                 $cat >try.c <<EOCP
9266 #include <sys/types.h>
9267 #include <stdio.h>
9268 int main()
9269 {
9270     printf("%d\n", (int)sizeof($lseektype));
9271     return(0);
9272 }
9273 EOCP
9274                 set try
9275                 if eval $compile_ok; then
9276                         lseeksize=`$run ./try`
9277                         $echo "Your file offsets are now $lseeksize bytes long."
9278                 else
9279                         dflt="$lseeksize"
9280                         echo " "
9281                         echo "(I can't seem to compile the test program.  Guessing...)"
9282                         rp="What is the size of your file offsets (in bytes)?"
9283                         . ./myread
9284                         lseeksize="$ans"
9285                 fi
9286                 case "$fpostype" in
9287                 *_t) zzz="$fpostype"    ;;
9288                 *)   zzz="fpos_t"       ;;
9289                 esac
9290                 $echo $n "Rechecking the size of $zzz...$c" >&4
9291                 $cat > try.c <<EOCP
9292 #include <sys/types.h>
9293 #include <stdio.h>
9294 #$i_stdlib I_STDLIB
9295 #ifdef I_STDLIB
9296 #include <stdlib.h>
9297 #endif
9298 int main() {
9299     printf("%d\n", (int)sizeof($fpostype));
9300     return(0);
9301 }
9302 EOCP
9303                 set try
9304                 if eval $compile_ok; then
9305                         yyy=`$run ./try`
9306                         dflt="$lseeksize"
9307                         case "$yyy" in
9308                         '')     echo " "
9309                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9310                                 ;;
9311                         *)      fpossize=$yyy
9312                                 echo " $fpossize bytes." >&4
9313                                 ;;
9314                         esac
9315                 else
9316                         dflt="$fpossize"
9317                         echo " "
9318                         echo "(I can't compile the test program.  Guessing...)" >&4
9319                         rp="What is the size of your file positions (in bytes)?"
9320                         . ./myread
9321                         fpossize="$ans"
9322                 fi
9323                 $rm_try
9324         fi
9325         ;;
9326 esac
9327
9328 : Set the vendorbin variables
9329 case "$vendorprefix" in
9330 '')     d_vendorbin="$undef"
9331         vendorbin=''
9332         vendorbinexp=''
9333         ;;
9334 *)      d_vendorbin="$define"
9335         : determine where vendor-supplied executables go.
9336         case "$vendorbin" in
9337         '') dflt=$vendorprefix/bin ;;
9338         *)      dflt="$vendorbin" ;;
9339         esac
9340         fn=d~+
9341         rp='Pathname for the vendor-supplied executables directory?'
9342         . ./getfile
9343         vendorbin="$ans"
9344         vendorbinexp="$ansexp"
9345         ;;
9346 esac
9347 prefixvar=vendorbin
9348 . ./installprefix
9349
9350 : Set the vendorhtml1dir variables
9351 case "$vendorprefix" in
9352 '')     vendorhtml1dir=''
9353         vendorhtml1direxp=''
9354         ;;
9355 *)      : determine where vendor-supplied html pages go.
9356         : There is no standard location, so try to copy the previously-selected
9357         : directory structure for the core html pages.
9358         : XXX Better default suggestions would be welcome.
9359         case "$vendorhtml1dir" in
9360         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9361         *)      dflt=$vendorhtml1dir ;;
9362         esac
9363         case "$dflt" in
9364         ''|' ') dflt=none ;;
9365         esac
9366         fn=dn+~
9367         rp='Pathname for the vendor-supplied html pages?'
9368         . ./getfile
9369         vendorhtml1dir="$ans"
9370         vendorhtml1direxp="$ansexp"
9371         ;;
9372 esac
9373 : Use ' ' for none so value is preserved next time through Configure
9374 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9375 prefixvar=vendorhtml1dir
9376 . ./installprefix
9377
9378 : Set the vendorhtml3dir variables
9379 case "$vendorprefix" in
9380 '')     vendorhtml3dir=''
9381         vendorhtml3direxp=''
9382         ;;
9383 *)      : determine where vendor-supplied module html pages go.
9384         : There is no standard location, so try to copy the previously-selected
9385         : directory structure for the core html pages.
9386         : XXX Better default suggestions would be welcome.
9387         case "$vendorhtml3dir" in
9388         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9389         *)      dflt=$vendorhtml3dir ;;
9390         esac
9391         case "$dflt" in
9392         ''|' ') dflt=none ;;
9393         esac
9394         fn=dn+~
9395         rp='Pathname for the vendor-supplied html pages?'
9396         . ./getfile
9397         vendorhtml3dir="$ans"
9398         vendorhtml3direxp="$ansexp"
9399         ;;
9400 esac
9401 : Use ' ' for none so value is preserved next time through Configure
9402 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9403 prefixvar=vendorhtml3dir
9404 . ./installprefix
9405
9406 : Set the vendorman1dir variables
9407 case "$vendorprefix" in
9408 '')     vendorman1dir=''
9409         vendorman1direxp=''
9410         ;;
9411 *)      : determine where vendor-supplied manual pages go.
9412         case "$vendorman1dir" in
9413         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9414         *)      dflt=$vendorman1dir ;;
9415         esac
9416         case "$dflt" in
9417         ''|' ') dflt=none ;;
9418         esac
9419         fn=nd~+
9420         rp='Pathname for the vendor-supplied manual section 1 pages?'
9421         . ./getfile
9422         vendorman1dir="$ans"
9423         vendorman1direxp="$ansexp"
9424         ;;
9425 esac
9426 : Use ' ' for none so value is preserved next time through Configure
9427 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9428 prefixvar=vendorman1dir
9429 . ./installprefix
9430
9431 : Set the vendorman3dir variables
9432 case "$vendorprefix" in
9433 '')     vendorman3dir=''
9434         vendorman3direxp=''
9435         ;;
9436 *)      : determine where vendor-supplied module manual pages go.
9437         case "$vendorman3dir" in
9438         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9439         *)      dflt=$vendorman3dir ;;
9440         esac
9441         case "$dflt" in
9442         ''|' ') dflt=none ;;
9443         esac
9444         fn=nd~+
9445         rp='Pathname for the vendor-supplied manual section 3 pages?'
9446         . ./getfile
9447         vendorman3dir="$ans"
9448         vendorman3direxp="$ansexp"
9449         ;;
9450 esac
9451 : Use ' ' for none so value is preserved next time through Configure
9452 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9453 prefixvar=vendorman3dir
9454 . ./installprefix
9455
9456 : Set the vendorscript variables
9457 case "$vendorprefix" in
9458 '')     d_vendorscript="$undef"
9459         vendorscript=''
9460         vendorscriptexp=''
9461         ;;
9462 *)      d_vendorscript="$define"
9463         : determine where vendor-supplied scripts go.
9464         case "$vendorscript" in
9465         '')     dflt=$vendorprefix/script
9466                 $test -d $dflt || dflt=$vendorbin ;;
9467         *)  dflt="$vendorscript" ;;
9468         esac
9469         $cat <<EOM
9470
9471 The installation process will create a directory for
9472 vendor-supplied scripts.
9473
9474 EOM
9475         fn=d~+
9476         rp='Pathname for the vendor-supplied scripts directory?'
9477         . ./getfile
9478         vendorscript="$ans"
9479         vendorscriptexp="$ansexp"
9480         ;;
9481 esac
9482 prefixvar=vendorscript
9483 . ./installprefix
9484
9485 : see if qgcvt exists
9486 set qgcvt d_qgcvt
9487 eval $inlibc
9488
9489 : Check print/scan long double stuff
9490 echo " "
9491
9492 if $test X"$d_longdbl" = X"$define"; then
9493
9494 echo "Checking how to print long doubles..." >&4
9495
9496 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9497         $cat >try.c <<'EOCP'
9498 #include <sys/types.h>
9499 #include <stdio.h>
9500 int main() {
9501   double d = 123.456;
9502   printf("%.3f\n", d);
9503 }
9504 EOCP
9505         set try
9506         if eval $compile; then
9507                 yyy=`$run ./try`
9508                 case "$yyy" in
9509                 123.456)
9510                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9511                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9512                         echo "We will use %f."
9513                         ;;
9514                 esac
9515         fi
9516 fi
9517
9518 if $test X"$sPRIfldbl" = X; then
9519         $cat >try.c <<'EOCP'
9520 #include <sys/types.h>
9521 #include <stdio.h>
9522 int main() {
9523   long double d = 123.456;
9524   printf("%.3Lf\n", d);
9525 }
9526 EOCP
9527         set try
9528         if eval $compile; then
9529                 yyy=`$run ./try`
9530                 case "$yyy" in
9531                 123.456)
9532                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9533                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9534                         echo "We will use %Lf."
9535                         ;;
9536                 esac
9537         fi
9538 fi
9539
9540 if $test X"$sPRIfldbl" = X; then
9541         $cat >try.c <<'EOCP'
9542 #include <sys/types.h>
9543 #include <stdio.h>
9544 int main() {
9545   long double d = 123.456;
9546   printf("%.3llf\n", d);
9547 }
9548 EOCP
9549         set try
9550         if eval $compile; then
9551                 yyy=`$run ./try`
9552                 case "$yyy" in
9553                 123.456)
9554                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9555                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9556                         echo "We will use %llf."
9557                         ;;
9558                 esac
9559         fi
9560 fi
9561
9562 if $test X"$sPRIfldbl" = X; then
9563         $cat >try.c <<'EOCP'
9564 #include <sys/types.h>
9565 #include <stdio.h>
9566 int main() {
9567   long double d = 123.456;
9568   printf("%.3lf\n", d);
9569 }
9570 EOCP
9571         set try
9572         if eval $compile; then
9573                 yyy=`$run ./try`
9574                 case "$yyy" in
9575                 123.456)
9576                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9577                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9578                         echo "We will use %lf."
9579                         ;;
9580                 esac
9581         fi
9582 fi
9583
9584 if $test X"$sPRIfldbl" = X; then
9585         echo "Cannot figure out how to print long doubles." >&4
9586 else
9587         sSCNfldbl=$sPRIfldbl    # expect consistency
9588 fi
9589
9590 $rm_try
9591
9592 fi # d_longdbl
9593
9594 case "$sPRIfldbl" in
9595 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9596         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9597         d_SCNfldbl="$undef";
9598         ;;
9599 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9600         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9601         d_SCNfldbl="$define";
9602         ;;
9603 esac
9604
9605 : Check how to convert floats to strings.
9606
9607 if test "X$d_Gconvert" = X; then
9608
9609 echo " "
9610 echo "Checking for an efficient way to convert floats to strings."
9611 echo " " > try.c
9612 case "$uselongdouble" in
9613 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9614 esac
9615 case "$d_longdbl" in
9616 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9617 esac
9618 case "$d_PRIgldbl" in
9619 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9620 esac
9621 $cat >>try.c <<EOP
9622 #ifdef TRY_gconvert
9623 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9624 char *myname = "gconvert";
9625 #endif
9626 #ifdef TRY_gcvt
9627 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9628 char *myname = "gcvt";
9629 #endif
9630 #ifdef TRY_qgcvt
9631 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9632 char *myname = "qgcvt";
9633 #define DOUBLETYPE long double
9634 #endif
9635 #ifdef TRY_sprintf
9636 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9637 #ifdef HAS_PRIgldbl
9638 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9639 #else
9640 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9641 #endif
9642 #else
9643 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9644 #endif
9645 char *myname = "sprintf";
9646 #endif
9647
9648 #ifndef DOUBLETYPE
9649 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9650 #define DOUBLETYPE long double
9651 #else
9652 #define DOUBLETYPE double
9653 #endif
9654 #endif
9655
9656 #include <stdio.h>
9657
9658 #define I_STDLIB $i_stdlib
9659 #ifdef I_STDLIB
9660 #include <stdlib.h>
9661 #endif
9662
9663 int
9664 checkit(expect, got)
9665 char *expect;
9666 char *got;
9667 {
9668     if (strcmp(expect, got)) {
9669                 printf("%s oddity:  Expected %s, got %s\n",
9670                         myname, expect, got);
9671                 exit(1);
9672         }
9673 }
9674
9675 int main()
9676 {
9677         char buf[64];
9678         buf[63] = '\0';
9679
9680         /* This must be 1st test on (which?) platform */
9681         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9682         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9683         checkit("0.1", buf);
9684
9685         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9686         checkit("0.01", buf);
9687
9688         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9689         checkit("0.001", buf);
9690
9691         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9692         checkit("0.0001", buf);
9693
9694         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9695         if (strlen(buf) > 5)
9696             checkit("9e-005", buf); /* for Microsoft ?? */
9697         else
9698             checkit("9e-05", buf);
9699
9700         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9701         checkit("1", buf);
9702
9703         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9704         checkit("1.1", buf);
9705
9706         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9707         checkit("1.01", buf);
9708
9709         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9710         checkit("1.001", buf);
9711
9712         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9713         checkit("1.0001", buf);
9714
9715         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9716         checkit("1.00001", buf);
9717
9718         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9719         checkit("1.000001", buf);
9720
9721         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9722         checkit("0", buf);
9723
9724         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9725         checkit("-1", 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         /* Some Linux gcvt's give -1.e+5 here. */
9732         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9733         checkit("-100000", buf);
9734
9735         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9736         checkit("123.456", buf);
9737
9738         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9739         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9740         /* 34 should be enough to scare even long double
9741          * places into using the e notation. */
9742         if (strlen(buf) > 5)
9743             checkit("1e+034", buf); /* for Microsoft */
9744         else
9745             checkit("1e+34", buf);
9746
9747         /* For Perl, if you add additional tests here, also add them to
9748          * t/base/num.t for benefit of platforms not using Configure or
9749          * overriding d_Gconvert */
9750
9751         exit(0);
9752 }
9753 EOP
9754 : first add preferred functions to our list
9755 xxx_list=""
9756 for xxx_convert in $gconvert_preference; do
9757     case $xxx_convert in
9758     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9759     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9760     esac
9761 done
9762 : then add any others
9763 for xxx_convert in gconvert gcvt sprintf; do
9764     case "$xxx_list" in
9765     *$xxx_convert*) ;;
9766     *) xxx_list="$xxx_list $xxx_convert" ;;
9767     esac
9768 done
9769
9770 case "$d_longdbl$uselongdouble" in
9771 "$define$define")
9772     : again, add prefered functions to our list first
9773     xxx_ld_list=""
9774     for xxx_convert in $gconvert_ld_preference; do
9775         case $xxx_convert in
9776         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9777         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9778         esac
9779     done
9780     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9781     for xxx_convert in qgcvt sprintf $xxx_list; do
9782         case "$xxx_ld_list" in
9783         $xxx_convert*|*" $xxx_convert"*) ;;
9784         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9785         esac
9786     done
9787     : if sprintf cannot do long doubles, move it to the end
9788     if test "$d_PRIgldbl" != "$define"; then
9789         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9790     fi
9791     : if no qgcvt, remove it
9792     if test "$d_qgcvt" != "$define"; then
9793         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9794     fi
9795     : use the ld_list
9796     xxx_list="$xxx_ld_list"
9797     ;;
9798 esac
9799
9800 for xxx_convert in $xxx_list; do
9801         echo "Trying $xxx_convert..."
9802         $rm -f try try$_o core
9803         set try -DTRY_$xxx_convert
9804         if eval $compile; then
9805                 echo "$xxx_convert() found." >&4
9806                 if $run ./try; then
9807                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9808                         break;
9809                 else
9810                         echo "...But $xxx_convert didn't work as I expected."
9811                         xxx_convert=''
9812                 fi
9813         else
9814                 echo "$xxx_convert NOT found." >&4
9815         fi
9816 done
9817
9818 if test X$xxx_convert = X; then
9819     echo "*** WHOA THERE!!! ***" >&4
9820     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9821     xxx_convert=sprintf
9822 fi
9823
9824 case "$xxx_convert" in
9825 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9826 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9827 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9828 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9829    "$define$define$define")
9830       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9831    "$define$define$undef")
9832       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9833    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9834    esac
9835    ;;
9836 esac
9837
9838 fi
9839 $rm_try
9840
9841 : see if _fwalk exists
9842 set fwalk d__fwalk
9843 eval $inlibc
9844
9845 : Initialize h_fcntl
9846 h_fcntl=false
9847
9848 : Initialize h_sysfile
9849 h_sysfile=false
9850
9851 : access call always available on UNIX
9852 set access d_access
9853 eval $inlibc
9854
9855 : locate the flags for 'access()'
9856 case "$d_access" in
9857 "$define")
9858         echo " "
9859         $cat >access.c <<EOCP
9860 #include <sys/types.h>
9861 #ifdef I_FCNTL
9862 #include <fcntl.h>
9863 #endif
9864 #ifdef I_SYS_FILE
9865 #include <sys/file.h>
9866 #endif
9867 #ifdef I_UNISTD
9868 #include <unistd.h>
9869 #endif
9870 #$i_stdlib I_STDLIB
9871 #ifdef I_STDLIB
9872 #include <stdlib.h>
9873 #endif
9874 int main() {
9875         exit(R_OK);
9876 }
9877 EOCP
9878         : check sys/file.h first, no particular reason here
9879         if $test `./findhdr sys/file.h` && \
9880                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9881                 h_sysfile=true;
9882                 echo "<sys/file.h> defines the *_OK access constants." >&4
9883         elif $test `./findhdr fcntl.h` && \
9884                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9885                 h_fcntl=true;
9886                 echo "<fcntl.h> defines the *_OK access constants." >&4
9887         elif $test `./findhdr unistd.h` && \
9888                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9889                 echo "<unistd.h> defines the *_OK access constants." >&4
9890         else
9891                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9892         fi
9893         ;;
9894 esac
9895 $rm -f access*
9896
9897 : see if accessx exists
9898 set accessx d_accessx
9899 eval $inlibc
9900
9901 : see if aintl exists
9902 set aintl d_aintl
9903 eval $inlibc
9904
9905 : see if alarm exists
9906 set alarm d_alarm
9907 eval $inlibc
9908
9909 : see if POSIX threads are available
9910 set pthread.h i_pthread
9911 eval $inhdr
9912
9913 : define a fucntion to check prototypes
9914 $cat > protochk <<EOSH
9915 $startsh
9916 cc="$cc"
9917 optimize="$optimize"
9918 ccflags="$ccflags"
9919 prototype="$prototype"
9920 define="$define"
9921 rm_try="$rm_try"
9922 usethreads=$usethreads
9923 i_pthread=$i_pthread
9924 pthread_h_first=$pthread_h_first
9925 EOSH
9926
9927 $cat >> protochk <<'EOSH'
9928
9929 $rm_try
9930 foo="$1"
9931 shift
9932 while test $# -ge 2; do
9933         case "$1" in
9934                 $define) echo "#include <$2>" >> try.c ;;
9935                 literal) echo "$2" >> try.c ;;
9936         esac
9937     # Extra magic for the benefit of systems that need pthread.h
9938     # to be included early to correctly detect threadsafe functions.
9939     # Such functions must guarantee themselves, though, that the usethreads
9940     # and i_pthread have been defined, before calling protochk.
9941     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9942         echo "#include <pthread.h>" >> try.c
9943         pthread_h_done=yes
9944     fi
9945     shift 2
9946 done
9947 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9948 cat >> try.c <<'EOCP'
9949 #ifdef CAN_PROTOTYPE
9950 #define _(args) args
9951 #else
9952 #define _(args) ()
9953 #endif
9954 EOCP
9955 echo "$foo" >> try.c
9956 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9957 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9958 status=$?
9959 $rm_try
9960 exit $status
9961 EOSH
9962 chmod +x protochk
9963 $eunicefix protochk
9964
9965 : Define hasproto macro for Configure internal use
9966 hasproto='varname=$1; func=$2; shift; shift;
9967 while $test $# -ge 2; do
9968         case "$1" in
9969         $define) echo "#include <$2>";;
9970         esac ;
9971     shift 2;
9972 done > try.c;
9973 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9974 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9975         echo "$func() prototype found.";
9976         val="$define";
9977 else
9978         echo "$func() prototype NOT found.";
9979         val="$undef";
9980 fi;
9981 set $varname;
9982 eval $setvar;
9983 $rm_try tryout.c'
9984
9985 : see if sys/types.h has to be included
9986 set sys/types.h i_systypes
9987 eval $inhdr
9988
9989 : see if sys/select.h has to be included
9990 set sys/select.h i_sysselct
9991 eval $inhdr
9992
9993 : Define hasfield macro for Configure internal use
9994 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9995 while $test $# -ge 2; do
9996         case "$1" in
9997         $define) echo "#include <$2>";;
9998         esac ;
9999     shift 2;
10000 done > try.c;
10001 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10002 set try;
10003 if eval $compile; then
10004         val="$define";
10005 else
10006         val="$undef";
10007 fi;
10008 set $varname;
10009 eval $setvar;
10010 $rm_try'
10011
10012 : see if we should include time.h, sys/time.h, or both
10013 echo " "
10014 if test "X$timeincl" = X; then
10015         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10016         $echo $n "I'm now running the test program...$c"
10017         $cat >try.c <<EOCP
10018 #include <sys/types.h>
10019 #ifdef I_TIME
10020 #include <time.h>
10021 #endif
10022 #ifdef I_SYSTIME
10023 #ifdef SYSTIMEKERNEL
10024 #define KERNEL
10025 #endif
10026 #include <sys/time.h>
10027 #endif
10028 #ifdef I_SYSSELECT
10029 #include <sys/select.h>
10030 #endif
10031 #$i_stdlib I_STDLIB
10032 #ifdef I_STDLIB
10033 #include <stdlib.h>
10034 #endif
10035 int main()
10036 {
10037         struct tm foo;
10038 #ifdef S_TIMEVAL
10039         struct timeval bar;
10040 #endif
10041 #ifdef S_TIMEZONE
10042         struct timezone tzp;
10043 #endif
10044         if (foo.tm_sec == foo.tm_sec)
10045                 exit(0);
10046 #ifdef S_TIMEVAL
10047         if (bar.tv_sec == bar.tv_sec)
10048                 exit(0);
10049 #endif
10050         exit(1);
10051 }
10052 EOCP
10053         flags=''
10054         for s_timezone in '-DS_TIMEZONE' ''; do
10055         sysselect=''
10056         for s_timeval in '-DS_TIMEVAL' ''; do
10057         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10058         for i_time in '' '-DI_TIME'; do
10059         for i_systime in '-DI_SYSTIME' ''; do
10060                 case "$flags" in
10061                 '') $echo $n ".$c"
10062                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10063                         if eval $compile; then
10064                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10065                                 shift
10066                                 flags="$*"
10067                                 echo " "
10068                                 $echo $n "Succeeded with $flags$c"
10069                         fi
10070                         ;;
10071                 esac
10072         done
10073         done
10074         done
10075         done
10076         done
10077         timeincl=''
10078         echo " "
10079         case "$flags" in
10080         *SYSTIMEKERNEL*) i_systimek="$define"
10081                 timeincl=`./findhdr sys/time.h`
10082                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10083         *) i_systimek="$undef";;
10084         esac
10085         case "$flags" in
10086         *I_TIME*) i_time="$define"
10087                 timeincl=`./findhdr time.h`" $timeincl"
10088                 echo "We'll include <time.h>." >&4;;
10089         *) i_time="$undef";;
10090         esac
10091         case "$flags" in
10092         *I_SYSTIME*) i_systime="$define"
10093                 timeincl=`./findhdr sys/time.h`" $timeincl"
10094                 echo "We'll include <sys/time.h>." >&4;;
10095         *) i_systime="$undef";;
10096         esac
10097         $rm_try
10098 fi
10099 : see if struct tm knows about tm_zone
10100 case "$i_systime$i_time" in
10101 *$define*)
10102         echo " "
10103         echo "Checking to see if your struct tm has tm_zone field..." >&4
10104         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10105         eval $hasfield
10106         ;;
10107 *)      val="$undef"
10108         set d_tm_tm_zone
10109         eval $setvar
10110         ;;
10111 esac
10112 case "$d_tm_tm_zone" in
10113 "$define")      echo "Yes, it does."   ;;
10114 *)              echo "No, it doesn't." ;;
10115 esac
10116 : see if struct tm knows about tm_gmtoff
10117 case "$i_systime$i_time" in
10118 *$define*)
10119         echo " "
10120         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10121         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10122         eval $hasfield
10123         ;;
10124 *)      val="$undef"
10125         set d_tm_tm_gmtoff
10126         eval $setvar
10127         ;;
10128 esac
10129 case "$d_tm_tm_gmtoff" in
10130 "$define")      echo "Yes, it does."   ;;
10131 *)              echo "No, it doesn't." ;;
10132 esac
10133
10134 : see if asctime_r exists
10135 set asctime_r d_asctime_r
10136 eval $inlibc
10137 case "$d_asctime_r" in
10138 "$define")
10139         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10140         case "$d_asctime_r_proto:$usethreads" in
10141         ":define")      d_asctime_r_proto=define
10142                 set d_asctime_r_proto asctime_r $hdrs
10143                 eval $hasproto ;;
10144         *)      ;;
10145         esac
10146         case "$d_asctime_r_proto" in
10147         define)
10148         case "$asctime_r_proto" in
10149         ''|0) try='char* asctime_r(const struct tm*, char*);'
10150         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
10151         esac
10152         case "$asctime_r_proto" in
10153         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10154         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
10155         esac
10156         case "$asctime_r_proto" in
10157         ''|0) try='int asctime_r(const struct tm*, char*);'
10158         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
10159         esac
10160         case "$asctime_r_proto" in
10161         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10162         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
10163         esac
10164         case "$asctime_r_proto" in
10165         ''|0)   d_asctime_r=undef
10166                 asctime_r_proto=0
10167                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10168         * )     case "$asctime_r_proto" in
10169                 REENTRANT_PROTO*) ;;
10170                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10171                 esac
10172                 echo "Prototype: $try" ;;
10173         esac
10174         ;;
10175         *)      case "$usethreads" in
10176                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10177                 esac
10178                 d_asctime_r=undef
10179                 asctime_r_proto=0
10180                 ;;
10181         esac
10182         ;;
10183 *)      asctime_r_proto=0
10184         ;;
10185 esac
10186
10187 : see if atolf exists
10188 set atolf d_atolf
10189 eval $inlibc
10190
10191 : see if atoll exists
10192 set atoll d_atoll
10193 eval $inlibc
10194
10195 : Look for GCC-style attribute format
10196 case "$d_attribute_format" in
10197 '')
10198 echo " "
10199 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10200 $cat >attrib.c <<'EOCP'
10201 #include <stdio.h>
10202 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10203 EOCP
10204 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10205         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10206                 echo "Your C compiler doesn't support __attribute__((format))."
10207                 val="$undef"
10208         else
10209                 echo "Your C compiler supports __attribute__((format))."
10210                 val="$define"
10211         fi
10212 else
10213         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10214         val="$undef"
10215 fi
10216 ;;
10217 *) val="$d_attribute_format" ;;
10218 esac
10219 set d_attribute_format
10220 eval $setvar
10221 $rm -f attrib*
10222
10223 : Look for GCC-style attribute format with null format allowed
10224 case "$d_printf_format_null" in
10225 '') case "$d_attribute_format" in
10226     $define)
10227         echo " "
10228         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10229 $cat >attrib.c <<EOCP
10230 #include <stdio.h>
10231 #$i_stdlib I_STDLIB
10232 #ifdef I_STDLIB
10233 #include <stdlib.h>
10234 #endif
10235 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10236 int null_printf (char* pat,...) { return (int)pat; }
10237 int main () { exit(null_printf(NULL)); }
10238 EOCP
10239         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10240             : run the executable in case it produces a run-time warning
10241             if $run ./attrib >>attrib.out 2>&1; then
10242                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10243                     echo "Your C compiler doesn't allow __printf__ format to be null."
10244                     val="$undef"
10245                 else
10246                     echo "Your C compiler allows __printf__ format to be null."
10247                     val="$define"
10248                 fi
10249             else
10250             echo "Your C compiler executable failed with __printf__ format null."
10251             val="$undef"
10252         fi
10253     else
10254         echo "Your C compiler fails with __printf__ format null."
10255         val="$undef"
10256     fi
10257     ;;
10258     *)  val="$undef" ;;
10259     esac
10260 ;;
10261 *)  val="$d_printf_format_null" ;;
10262 esac
10263 set d_printf_format_null
10264 eval $setvar
10265 $rm -f attrib*
10266
10267 : Look for GCC-style attribute malloc
10268 case "$d_attribute_malloc" in
10269 '')
10270 echo " "
10271 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10272 $cat >attrib.c <<'EOCP'
10273 #include <stdio.h>
10274 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10275 EOCP
10276 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10277         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10278                 echo "Your C compiler doesn't support __attribute__((malloc))."
10279                 val="$undef"
10280         else
10281                 echo "Your C compiler supports __attribute__((malloc))."
10282                 val="$define"
10283         fi
10284 else
10285         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10286         val="$undef"
10287 fi
10288 ;;
10289 *) val="$d_attribute_malloc" ;;
10290 esac
10291 set d_attribute_malloc
10292 eval $setvar
10293 $rm -f attrib*
10294
10295 : Look for GCC-style attribute nonnull
10296 case "$d_attribute_nonnull" in
10297 '')
10298 echo " "
10299 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10300 $cat >attrib.c <<'EOCP'
10301 #include <stdio.h>
10302 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10303 EOCP
10304 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10305         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10306                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10307                 val="$undef"
10308         else
10309                 echo "Your C compiler supports __attribute__((nonnull))."
10310                 val="$define"
10311         fi
10312 else
10313         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10314         val="$undef"
10315 fi
10316 ;;
10317 *) val="$d_attribute_nonnull" ;;
10318 esac
10319 set d_attribute_nonnull
10320 eval $setvar
10321 $rm -f attrib*
10322
10323 : Look for GCC-style attribute noreturn
10324 case "$d_attribute_noreturn" in
10325 '')
10326 echo " "
10327 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10328 $cat >attrib.c <<'EOCP'
10329 #include <stdio.h>
10330 void fall_over_dead( void ) __attribute__((noreturn));
10331 EOCP
10332 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10333         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10334                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10335                 val="$undef"
10336         else
10337                 echo "Your C compiler supports __attribute__((noreturn))."
10338                 val="$define"
10339         fi
10340 else
10341         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10342         val="$undef"
10343 fi
10344 ;;
10345 *) val="$d_attribute_noreturn" ;;
10346 esac
10347 set d_attribute_noreturn
10348 eval $setvar
10349 $rm -f attrib*
10350
10351 : Look for GCC-style attribute pure
10352 case "$d_attribute_pure" in
10353 '')
10354 echo " "
10355 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10356 $cat >attrib.c <<'EOCP'
10357 #include <stdio.h>
10358 int square( int n ) __attribute__((pure));
10359 EOCP
10360 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10361         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10362                 echo "Your C compiler doesn't support __attribute__((pure))."
10363                 val="$undef"
10364         else
10365                 echo "Your C compiler supports __attribute__((pure))."
10366                 val="$define"
10367         fi
10368 else
10369         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10370         val="$undef"
10371 fi
10372 ;;
10373 *) val="$d_attribute_pure" ;;
10374 esac
10375 set d_attribute_pure
10376 eval $setvar
10377 $rm -f attrib*
10378
10379 : Look for GCC-style attribute unused
10380 case "$d_attribute_unused" in
10381 '')
10382 echo " "
10383 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10384 $cat >attrib.c <<'EOCP'
10385 #include <stdio.h>
10386 int do_something( int dummy __attribute__((unused)), int n );
10387 EOCP
10388 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10389         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10390                 echo "Your C compiler doesn't support __attribute__((unused))."
10391                 val="$undef"
10392         else
10393                 echo "Your C compiler supports __attribute__((unused))."
10394                 val="$define"
10395         fi
10396 else
10397         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10398         val="$undef"
10399 fi
10400 ;;
10401 *) val="$d_attribute_unused" ;;
10402 esac
10403 set d_attribute_unused
10404 eval $setvar
10405 $rm -f attrib*
10406
10407 : Look for GCC-style attribute warn_unused_result
10408 case "$d_attribute_warn_unused_result" in
10409 '')
10410 echo " "
10411 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10412 $cat >attrib.c <<'EOCP'
10413 #include <stdio.h>
10414 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10415 EOCP
10416 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10417         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10418                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10419                 val="$undef"
10420         else
10421                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10422                 val="$define"
10423         fi
10424 else
10425         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10426         val="$undef"
10427 fi
10428 ;;
10429 *) val="$d_attribute_warn_unused_result" ;;
10430 esac
10431 set d_attribute_warn_unused_result
10432 eval $setvar
10433 $rm -f attrib*
10434
10435 : see if bcmp exists
10436 set bcmp d_bcmp
10437 eval $inlibc
10438
10439 : see if bcopy exists
10440 set bcopy d_bcopy
10441 eval $inlibc
10442
10443 : see if getpgrp exists
10444 set getpgrp d_getpgrp
10445 eval $inlibc
10446
10447 case "$d_getpgrp" in
10448 "$define")
10449         echo " "
10450         echo "Checking to see which flavor of getpgrp is in use..."
10451         $cat >try.c <<EOP
10452 #$i_unistd I_UNISTD
10453 #include <sys/types.h>
10454 #ifdef I_UNISTD
10455 #  include <unistd.h>
10456 #endif
10457 #$i_stdlib I_STDLIB
10458 #ifdef I_STDLIB
10459 #include <stdlib.h>
10460 #endif
10461 int main()
10462 {
10463         if (getuid() == 0) {
10464                 printf("(I see you are running Configure as super-user...)\n");
10465                 setuid(1);
10466         }
10467 #ifdef TRY_BSD_PGRP
10468         if (getpgrp(1) == 0)
10469                 exit(0);
10470 #else
10471         if (getpgrp() > 0)
10472                 exit(0);
10473 #endif
10474         exit(1);
10475 }
10476 EOP
10477         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10478                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10479                 val="$define"
10480         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10481                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10482                 val="$undef"
10483         else
10484                 echo "I can't seem to compile and run the test program."
10485                 if ./usg; then
10486                         xxx="a USG one, i.e. you use getpgrp()."
10487                 else
10488                         # SVR4 systems can appear rather BSD-ish.
10489                         case "$i_unistd" in
10490                         $undef)
10491                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10492                                 val="$define"
10493                                 ;;
10494                         $define)
10495                                 xxx="probably a USG one, i.e. you use getpgrp()."
10496                                 val="$undef"
10497                                 ;;
10498                         esac
10499                 fi
10500                 echo "Assuming your getpgrp is $xxx" >&4
10501         fi
10502         ;;
10503 *) val="$undef";;
10504 esac
10505 set d_bsdgetpgrp
10506 eval $setvar
10507 $rm_try
10508
10509 : see if setpgrp exists
10510 set setpgrp d_setpgrp
10511 eval $inlibc
10512
10513 case "$d_setpgrp" in
10514 "$define")
10515         echo " "
10516         echo "Checking to see which flavor of setpgrp is in use..."
10517         $cat >try.c <<EOP
10518 #$i_unistd I_UNISTD
10519 #include <sys/types.h>
10520 #ifdef I_UNISTD
10521 #  include <unistd.h>
10522 #endif
10523 #$i_stdlib I_STDLIB
10524 #ifdef I_STDLIB
10525 #include <stdlib.h>
10526 #endif
10527 int main()
10528 {
10529         if (getuid() == 0) {
10530                 printf("(I see you are running Configure as super-user...)\n");
10531                 setuid(1);
10532         }
10533 #ifdef TRY_BSD_PGRP
10534         if (-1 == setpgrp(1, 1))
10535                 exit(0);
10536 #else
10537         if (setpgrp() != -1)
10538                 exit(0);
10539 #endif
10540         exit(1);
10541 }
10542 EOP
10543         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10544                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10545                 val="$define"
10546         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10547                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10548                 val="$undef"
10549         else
10550                 echo "(I can't seem to compile and run the test program.)"
10551                 if ./usg; then
10552                         xxx="a USG one, i.e. you use setpgrp()."
10553                 else
10554                         # SVR4 systems can appear rather BSD-ish.
10555                         case "$i_unistd" in
10556                         $undef)
10557                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10558                                 val="$define"
10559                                 ;;
10560                         $define)
10561                                 xxx="probably a USG one, i.e. you use setpgrp()."
10562                                 val="$undef"
10563                                 ;;
10564                         esac
10565                 fi
10566                 echo "Assuming your setpgrp is $xxx" >&4
10567         fi
10568         ;;
10569 *) val="$undef";;
10570 esac
10571 set d_bsdsetpgrp
10572 eval $setvar
10573 $rm_try
10574
10575 : Look for GCC-style __builtin_choose_expr
10576 case "$d_builtin_choose_expr" in
10577 '')
10578     echo " "
10579     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10580     $cat >try.c <<'EOCP'
10581 #include <assert.h>
10582 #include <stdlib.h>
10583 #include <stdio.h>
10584
10585 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10586
10587 int main(void) {
10588     assert( SYRINX(1) == 2112 );
10589     assert( SYRINX(1) != 5150 );
10590     assert( SYRINX(0) == 5150 );
10591     assert( SYRINX(0) != 2112 );
10592     puts( "All good!" );
10593     exit(0);
10594 }
10595
10596 EOCP
10597     set try
10598     if eval $compile && $run ./try; then
10599         echo "Your C compiler supports __builtin_choose_expr."
10600         val="$define"
10601     else
10602         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10603         val="$undef"
10604     fi
10605 ;;
10606 *) val="$d_builtin_choose_expr" ;;
10607 esac
10608
10609 set d_builtin_choose_expr
10610 eval $setvar
10611 $rm_try
10612
10613 : Look for GCC-style __builtin_expect
10614 case "$d_builtin_expect" in
10615 '')
10616     echo " "
10617     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10618     $cat >try.c <<'EOCP'
10619 int main(void) {
10620     int n = 50;
10621     if ( __builtin_expect(n, 0) ) n = 1;
10622     /* Remember shell exit code truth is 0, C truth is non-zero */
10623     return !(n == 1);
10624 }
10625 EOCP
10626     set try
10627     if eval $compile && $run ./try; then
10628         echo "Your C compiler supports __builtin_expect."
10629         val="$define"
10630     else
10631         echo "Your C compiler doesn't seem to understand __builtin_expect."
10632         val="$undef"
10633     fi
10634     ;;
10635 *) val="$d_builtin_expect" ;;
10636 esac
10637
10638 set d_builtin_expect
10639 eval $setvar
10640 $rm_try
10641
10642 : see if bzero exists
10643 set bzero d_bzero
10644 eval $inlibc
10645
10646 : see if stdarg is available
10647 echo " "
10648 if $test `./findhdr stdarg.h`; then
10649         echo "<stdarg.h> found." >&4
10650         valstd="$define"
10651 else
10652         echo "<stdarg.h> NOT found." >&4
10653         valstd="$undef"
10654 fi
10655
10656 : see if varags is available
10657 echo " "
10658 if $test `./findhdr varargs.h`; then
10659         echo "<varargs.h> found." >&4
10660 else
10661         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10662 fi
10663
10664 : set up the varargs testing programs
10665 $cat > varargs.c <<EOP
10666 #ifdef I_STDARG
10667 #include <stdarg.h>
10668 #endif
10669 #ifdef I_VARARGS
10670 #include <varargs.h>
10671 #endif
10672
10673 #ifdef I_STDARG
10674 int f(char *p, ...)
10675 #else
10676 int f(va_alist)
10677 va_dcl
10678 #endif
10679 {
10680         va_list ap;
10681 #ifndef I_STDARG
10682         char *p;
10683 #endif
10684 #ifdef I_STDARG
10685         va_start(ap,p);
10686 #else
10687         va_start(ap);
10688         p = va_arg(ap, char *);
10689 #endif
10690         va_end(ap);
10691         return 0;
10692 }
10693 EOP
10694 $cat > varargs <<EOP
10695 $startsh
10696 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10697         echo "true"
10698 else
10699         echo "false"
10700 fi
10701 $rm -f varargs$_o
10702 EOP
10703 chmod +x varargs
10704
10705 : now check which varargs header should be included
10706 echo " "
10707 i_varhdr=''
10708 case "$valstd" in
10709 "$define")
10710         if `./varargs I_STDARG`; then
10711                 val='stdarg.h'
10712         elif `./varargs I_VARARGS`; then
10713                 val='varargs.h'
10714         fi
10715         ;;
10716 *)
10717         if `./varargs I_VARARGS`; then
10718                 val='varargs.h'
10719         fi
10720         ;;
10721 esac
10722 case "$val" in
10723 '')
10724 echo "I could not find the definition for va_dcl... You have problems..." >&4
10725         val="$undef"; set i_stdarg; eval $setvar
10726         val="$undef"; set i_varargs; eval $setvar
10727         ;;
10728 *)
10729         set i_varhdr
10730         eval $setvar
10731         case "$i_varhdr" in
10732         stdarg.h)
10733                 val="$define"; set i_stdarg; eval $setvar
10734                 val="$undef"; set i_varargs; eval $setvar
10735                 ;;
10736         varargs.h)
10737                 val="$undef"; set i_stdarg; eval $setvar
10738                 val="$define"; set i_varargs; eval $setvar
10739                 ;;
10740         esac
10741         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10742 esac
10743 $rm -f varargs*
10744
10745 : see if the Compiler supports C99 variadic macros
10746 case "$i_stdarg$i_stdlib" in
10747     "$define$define")
10748     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10749     $cat >try.c <<EOCP
10750 #include <stdio.h>
10751 #include <stdarg.h>
10752
10753 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10754
10755 int main() {
10756   char buf[20];
10757   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10758   puts(buf);
10759   return 0;
10760 }
10761 EOCP
10762     set try
10763     if eval $compile && $run ./try 2>&1 >/dev/null; then
10764         case "`$run ./try`" in
10765             "123 456 789")
10766             echo "You have C99 variadic macros." >&4
10767             d_c99_variadic_macros="$define"
10768             ;;
10769             *)
10770             echo "You don't have functional C99 variadic macros." >&4
10771             d_c99_variadic_macros="$undef"
10772             ;;
10773         esac
10774     else
10775         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10776         d_c99_variadic_macros="$undef"
10777     fi
10778     $rm_try
10779     ;;
10780     *)
10781     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10782     d_c99_variadic_macros="$undef"
10783     ;;
10784 esac
10785
10786 : see if signal is declared as pointer to function returning int or void
10787 echo " "
10788 xxx=`./findhdr signal.h`
10789 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10790 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10791         echo "You have int (*signal())() instead of void." >&4
10792         val="$undef"
10793 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10794         echo "You have void (*signal())()." >&4
10795         val="$define"
10796 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10797         echo "You have int (*signal())() instead of void." >&4
10798         val="$undef"
10799 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10800         echo "You have void (*signal())()." >&4
10801         val="$define"
10802 else
10803         case "$d_voidsig" in
10804         '')
10805         echo "I can't determine whether signal handler returns void or int..." >&4
10806                 dflt=void
10807                 rp="What type does your signal handler return?"
10808                 . ./myread
10809                 case "$ans" in
10810                 v*) val="$define";;
10811                 *) val="$undef";;
10812                 esac;;
10813         "$define")
10814                 echo "As you already told me, signal handler returns void." >&4
10815                 val="$define"
10816                 ;;
10817         *)      echo "As you already told me, signal handler returns int." >&4
10818                 val="$undef"
10819                 ;;
10820         esac
10821 fi
10822 set d_voidsig
10823 eval $setvar
10824 case "$d_voidsig" in
10825 "$define") signal_t="void";;
10826 *) signal_t="int";;
10827 esac
10828 $rm -f $$.tmp
10829
10830 : check for ability to cast large floats to 32-bit ints.
10831 echo " "
10832 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10833 if $test "$intsize" -ge 4; then
10834         xxx=int
10835 else
10836         xxx=long
10837 fi
10838 $cat >try.c <<EOCP
10839 #include <stdio.h>
10840 #$i_stdlib I_STDLIB
10841 #ifdef I_STDLIB
10842 #include <stdlib.h>
10843 #endif
10844 #include <sys/types.h>
10845 #include <signal.h>
10846 $signal_t blech(int s) { exit(3); }
10847 int main()
10848 {
10849         $xxx i32;
10850         double f, g;
10851         int result = 0;
10852         char str[16];
10853         signal(SIGFPE, blech);
10854
10855         /* Don't let compiler optimize the test away.  Store the number
10856            in a writable string for gcc to pass to sscanf under HP/UX.
10857         */
10858         sprintf(str, "2147483647");
10859         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10860         g = 10 * f;
10861         i32  = ($xxx) g;
10862
10863         /* x86 processors will probably give 0x8000 0000, which is a
10864            sign change.  We don't want that.  We want to mimic SPARC
10865            behavior here, which is to preserve the sign and give
10866            back 0x7fff ffff.
10867         */
10868         if (i32 != ($xxx) f)
10869                 result |= 1;
10870         exit(result);
10871 }
10872 EOCP
10873 set try
10874 if eval $compile_ok; then
10875         $run ./try
10876         yyy=$?
10877 else
10878         echo "(I can't seem to compile the test program--assuming it can't)"
10879         yyy=1
10880 fi
10881 case "$yyy" in
10882 0)      val="$define"
10883         echo "Yup, it can."
10884         ;;
10885 *)      val="$undef"
10886         echo "Nope, it can't."
10887         ;;
10888 esac
10889 set d_casti32
10890 eval $setvar
10891 $rm_try
10892
10893 : check for ability to cast negative floats to unsigned
10894 echo " "
10895 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10896 $cat >try.c <<EOCP
10897 #include <stdio.h>
10898 #$i_stdlib I_STDLIB
10899 #ifdef I_STDLIB
10900 #include <stdlib.h>
10901 #endif
10902 #include <sys/types.h>
10903 #include <signal.h>
10904 $signal_t blech(int s) { exit(7); }
10905 $signal_t blech_in_list(int s) { exit(4); }
10906 unsigned long dummy_long(unsigned long p) { return p; }
10907 unsigned int dummy_int(unsigned int p) { return p; }
10908 unsigned short dummy_short(unsigned short p) { return p; }
10909 int main()
10910 {
10911         double f;
10912         unsigned long along;
10913         unsigned int aint;
10914         unsigned short ashort;
10915         int result = 0;
10916         char str[16];
10917
10918         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10919            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10920            optimized the whole file away
10921         */
10922         /* Store the number in a writable string for gcc to pass to
10923            sscanf under HP/UX.
10924         */
10925         sprintf(str, "-123");
10926         sscanf(str, "%lf", &f);  /* f = -123.; */
10927
10928         signal(SIGFPE, blech);
10929         along = (unsigned long)f;
10930         aint = (unsigned int)f;
10931         ashort = (unsigned short)f;
10932         if (along != (unsigned long)-123)
10933                 result |= 1;
10934         if (aint != (unsigned int)-123)
10935                 result |= 1;
10936         if (ashort != (unsigned short)-123)
10937                 result |= 1;
10938         sprintf(str, "1073741824.");
10939         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10940         f = f + f;
10941         along = 0;
10942         along = (unsigned long)f;
10943         if (along != 0x80000000)
10944                 result |= 2;
10945         f -= 1.;
10946         along = 0;
10947         along = (unsigned long)f;
10948         if (along != 0x7fffffff)
10949                 result |= 1;
10950         f += 2.;
10951         along = 0;
10952         along = (unsigned long)f;
10953         if (along != 0x80000001)
10954                 result |= 2;
10955         if (result)
10956                 exit(result);
10957         signal(SIGFPE, blech_in_list);
10958         sprintf(str, "123.");
10959         sscanf(str, "%lf", &f);  /* f = 123.; */
10960         along = dummy_long((unsigned long)f);
10961         aint = dummy_int((unsigned int)f);
10962         ashort = dummy_short((unsigned short)f);
10963         if (along != (unsigned long)123)
10964                 result |= 4;
10965         if (aint != (unsigned int)123)
10966                 result |= 4;
10967         if (ashort != (unsigned short)123)
10968                 result |= 4;
10969         exit(result);
10970
10971 }
10972 EOCP
10973 set try
10974 if eval $compile_ok; then
10975         $run ./try
10976         castflags=$?
10977 else
10978         echo "(I can't seem to compile the test program--assuming it can't)"
10979         castflags=7
10980 fi
10981 case "$castflags" in
10982 0)      val="$define"
10983         echo "Yup, it can."
10984         ;;
10985 *)      val="$undef"
10986         echo "Nope, it can't."
10987         ;;
10988 esac
10989 set d_castneg
10990 eval $setvar
10991 $rm_try
10992
10993 : see if vprintf exists
10994 echo " "
10995 if set vprintf val -f d_vprintf; eval $csym; $val; then
10996         echo 'vprintf() found.' >&4
10997         val="$define"
10998         $cat >try.c <<EOF
10999 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11000 #$i_varargs I_VARARGS
11001
11002 #$i_stdlib I_STDLIB
11003 #$i_unistd I_UNISTD
11004
11005 #ifdef I_STDARG
11006 #  include <stdarg.h>
11007 #else /* I_VARARGS */
11008 #  include <varargs.h>
11009 #endif
11010
11011 #ifdef I_UNISTD
11012 #  include <unistd.h>
11013 #endif
11014
11015 #ifdef I_STDLIB
11016 #  include <stdlib.h>
11017 #endif
11018
11019 #include <stdio.h> /* vsprintf prototype */
11020
11021 #ifdef I_STDARG
11022 void xxx(int n, ...)
11023 {
11024     va_list args;
11025     char buf[10];
11026     va_start(args, n);
11027     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11028 }
11029 int main() { xxx(1, "foo"); }
11030
11031 #else /* I_VARARGS */
11032
11033 xxx(va_alist)
11034 va_dcl
11035 {
11036     va_list args;
11037     char buf[10];
11038     va_start(args);
11039     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11040 }
11041 int main() { xxx("foo"); }
11042
11043 #endif
11044
11045 EOF
11046         set try
11047         if eval $compile_ok; then
11048                 if $run ./try; then
11049                         echo "Your vsprintf() returns (int)." >&4
11050                         val2="$undef"
11051                 else
11052                         echo "Your vsprintf() returns (char*)." >&4
11053                         val2="$define"
11054                 fi
11055         else
11056                 echo 'I am unable to compile the vsprintf() test program.' >&4
11057                 # We shouldn't get here.  If we do, assume the standard signature,
11058                 # not the old BSD one.
11059                 echo 'Guessing that vsprintf() returns (int).' >&4
11060                 val2="$undef"
11061         fi
11062 else
11063         echo 'vprintf() NOT found.' >&4
11064         val="$undef"
11065         val2="$undef"
11066 fi
11067 $rm_try
11068 set d_vprintf
11069 eval $setvar
11070 val=$val2
11071 set d_charvspr
11072 eval $setvar
11073
11074 : see if chown exists
11075 set chown d_chown
11076 eval $inlibc
11077
11078 : see if chroot exists
11079 set chroot d_chroot
11080 eval $inlibc
11081
11082 : see if chsize exists
11083 set chsize d_chsize
11084 eval $inlibc
11085
11086 : see if class exists
11087 set class d_class
11088 eval $inlibc
11089
11090 : see if clearenv exists
11091 set clearenv d_clearenv
11092 eval $inlibc
11093
11094 : Define hasstruct macro for Configure internal use
11095 hasstruct='varname=$1; struct=$2; shift; shift;
11096 while $test $# -ge 2; do
11097         case "$1" in
11098         $define) echo "#include <$2>";;
11099         esac ;
11100     shift 2;
11101 done > try.c;
11102 echo "int main () { struct $struct foo; }" >> try.c;
11103 set try;
11104 if eval $compile; then
11105         val="$define";
11106 else
11107         val="$undef";
11108 fi;
11109 set $varname;
11110 eval $setvar;
11111 $rm_try'
11112
11113 : see whether socket exists
11114 socketlib=''
11115 sockethdr=''
11116 echo " "
11117 $echo $n "Hmm... $c" >&4
11118 if set socket val -f d_socket; eval $csym; $val; then
11119         echo "Looks like you have Berkeley networking support." >&4
11120         d_socket="$define"
11121         if set setsockopt val -f; eval $csym; $val; then
11122                 d_oldsock="$undef"
11123         else
11124                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11125                 d_oldsock="$define"
11126         fi
11127 else
11128         if $contains socklib libc.list >/dev/null 2>&1; then
11129                 echo "Looks like you have Berkeley networking support." >&4
11130                 d_socket="$define"
11131                 : we will have to assume that it supports the 4.2 BSD interface
11132                 d_oldsock="$undef"
11133         else
11134                 echo "You don't have Berkeley networking in libc$_a..." >&4
11135                 if test "X$d_socket" = "X$define"; then
11136                    echo "...but you seem to believe that you have sockets." >&4
11137                 else
11138                         for net in net socket
11139                         do
11140                                 if test -f /usr/lib/lib$net$_a; then
11141                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11142                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11143                                         if $contains socket libc.list >/dev/null 2>&1; then
11144                                                 d_socket="$define"
11145                                                 socketlib="-l$net"
11146                                                 case "$net" in
11147                                                 net)
11148                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11149                                                         sockethdr="-I/usr/netinclude"
11150                                                         ;;
11151                                                 esac
11152                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11153                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11154                                                         d_oldsock="$undef"
11155                                                 else
11156                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11157                                                         d_oldsock="$define"
11158                                                 fi
11159                                                 break
11160                                         fi
11161                                 fi
11162                         done
11163                         if test "X$d_socket" != "X$define"; then
11164                            echo "or anywhere else I see." >&4
11165                            d_socket="$undef"
11166                            d_oldsock="$undef"
11167                         fi
11168                 fi
11169         fi
11170 fi
11171
11172 : see if socketpair exists
11173 set socketpair d_sockpair
11174 eval $inlibc
11175
11176
11177 echo " "
11178 echo "Checking the availability of certain socket constants..." >&4
11179 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11180         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11181         $cat >try.c <<EOF
11182 #include <sys/types.h>
11183 #include <sys/socket.h>
11184 int main() {
11185     int i = $ENUM;
11186 }
11187 EOF
11188         val="$undef"
11189         set try; if eval $compile; then
11190                 val="$define"
11191         fi
11192         set d_${enum}; eval $setvar
11193         $rm_try
11194 done
11195
11196 : see if this is a sys/uio.h system
11197 set sys/uio.h i_sysuio
11198 eval $inhdr
11199
11200 : Check for cmsghdr support
11201 echo " "
11202 echo "Checking to see if your system supports struct cmsghdr..." >&4
11203 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11204 eval $hasstruct
11205 case "$d_cmsghdr_s" in
11206 "$define")      echo "Yes, it does."   ;;
11207 *)              echo "No, it doesn't." ;;
11208 esac
11209
11210
11211 : check for const keyword
11212 echo " "
11213 echo 'Checking to see if your C compiler knows about "const"...' >&4
11214 $cat >const.c <<'EOCP'
11215 typedef struct spug { int drokk; } spug;
11216 int main()
11217 {
11218         const char *foo;
11219         const spug y = { 0 };
11220 }
11221 EOCP
11222 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11223         val="$define"
11224         echo "Yup, it does."
11225 else
11226         val="$undef"
11227         echo "Nope, it doesn't."
11228 fi
11229 set d_const
11230 eval $setvar
11231
11232 : see if copysignl exists
11233 set copysignl d_copysignl
11234 eval $inlibc
11235
11236 : see if crypt exists
11237 echo " "
11238 set crypt d_crypt
11239 eval $inlibc
11240 case "$d_crypt" in
11241 $define) cryptlib='' ;;
11242 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11243                 echo 'crypt() found.' >&4
11244                 val="$define"
11245                 cryptlib=''
11246         else
11247                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11248                 if $test -z "$cryptlib"; then
11249                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11250                 else
11251                         cryptlib=-lcrypt
11252                 fi
11253                 if $test -z "$cryptlib"; then
11254                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11255                 else
11256                         cryptlib=-lcrypt
11257                 fi
11258                 if $test -z "$cryptlib"; then
11259                         cryptlib=`./loc libcrypt$_a "" $libpth`
11260                 else
11261                         cryptlib=-lcrypt
11262                 fi
11263                 if $test -z "$cryptlib"; then
11264                         echo 'crypt() NOT found.' >&4
11265                         val="$undef"
11266                 else
11267                         val="$define"
11268                 fi
11269         fi
11270         set d_crypt
11271         eval $setvar
11272         ;;
11273 esac
11274
11275 : see if this is a crypt.h system
11276 set crypt.h i_crypt
11277 eval $inhdr
11278
11279 : see if crypt_r exists
11280 set crypt_r d_crypt_r
11281 eval $inlibc
11282 case "$d_crypt_r" in
11283 "$define")
11284         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11285         case "$d_crypt_r_proto:$usethreads" in
11286         ":define")      d_crypt_r_proto=define
11287                 set d_crypt_r_proto crypt_r $hdrs
11288                 eval $hasproto ;;
11289         *)      ;;
11290         esac
11291         case "$d_crypt_r_proto" in
11292         define)
11293         case "$crypt_r_proto" in
11294         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11295         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
11296         esac
11297         case "$crypt_r_proto" in
11298         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11299         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
11300         esac
11301         case "$crypt_r_proto" in
11302         ''|0)   d_crypt_r=undef
11303                 crypt_r_proto=0
11304                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11305         * )     case "$crypt_r_proto" in
11306                 REENTRANT_PROTO*) ;;
11307                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11308                 esac
11309                 echo "Prototype: $try" ;;
11310         esac
11311         ;;
11312         *)      case "$usethreads" in
11313                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11314                 esac
11315                 d_crypt_r=undef
11316                 crypt_r_proto=0
11317                 ;;
11318         esac
11319         ;;
11320 *)      crypt_r_proto=0
11321         ;;
11322 esac
11323
11324 : get csh whereabouts
11325 case "$csh" in
11326 'csh') val="$undef" ;;
11327 *) val="$define" ;;
11328 esac
11329 set d_csh
11330 eval $setvar
11331 : Respect a hint or command line value for full_csh.
11332 case "$full_csh" in
11333 '') full_csh=$csh ;;
11334 esac
11335
11336 : see if ctermid exists
11337 set ctermid d_ctermid
11338 eval $inlibc
11339
11340 : see if ctermid_r exists
11341 set ctermid_r d_ctermid_r
11342 eval $inlibc
11343 case "$d_ctermid_r" in
11344 "$define")
11345         hdrs="$i_systypes sys/types.h define stdio.h "
11346         case "$d_ctermid_r_proto:$usethreads" in
11347         ":define")      d_ctermid_r_proto=define
11348                 set d_ctermid_r_proto ctermid_r $hdrs
11349                 eval $hasproto ;;
11350         *)      ;;
11351         esac
11352         case "$d_ctermid_r_proto" in
11353         define)
11354         case "$ctermid_r_proto" in
11355         ''|0) try='char* ctermid_r(char*);'
11356         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
11357         esac
11358         case "$ctermid_r_proto" in
11359         ''|0)   d_ctermid_r=undef
11360                 ctermid_r_proto=0
11361                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11362         * )     case "$ctermid_r_proto" in
11363                 REENTRANT_PROTO*) ;;
11364                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11365                 esac
11366                 echo "Prototype: $try" ;;
11367         esac
11368         ;;
11369         *)      case "$usethreads" in
11370                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11371                 esac
11372                 d_ctermid_r=undef
11373                 ctermid_r_proto=0
11374                 ;;
11375         esac
11376         ;;
11377 *)      ctermid_r_proto=0
11378         ;;
11379 esac
11380
11381 : see if ctime_r exists
11382 set ctime_r d_ctime_r
11383 eval $inlibc
11384 case "$d_ctime_r" in
11385 "$define")
11386         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11387         case "$d_ctime_r_proto:$usethreads" in
11388         ":define")      d_ctime_r_proto=define
11389                 set d_ctime_r_proto ctime_r $hdrs
11390                 eval $hasproto ;;
11391         *)      ;;
11392         esac
11393         case "$d_ctime_r_proto" in
11394         define)
11395         case "$ctime_r_proto" in
11396         ''|0) try='char* ctime_r(const time_t*, char*);'
11397         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
11398         esac
11399         case "$ctime_r_proto" in
11400         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11401         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
11402         esac
11403         case "$ctime_r_proto" in
11404         ''|0) try='int ctime_r(const time_t*, char*);'
11405         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
11406         esac
11407         case "$ctime_r_proto" in
11408         ''|0) try='int ctime_r(const time_t*, char*, int);'
11409         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
11410         esac
11411         case "$ctime_r_proto" in
11412         ''|0)   d_ctime_r=undef
11413                 ctime_r_proto=0
11414                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11415         * )     case "$ctime_r_proto" in
11416                 REENTRANT_PROTO*) ;;
11417                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11418                 esac
11419                 echo "Prototype: $try" ;;
11420         esac
11421         ;;
11422         *)      case "$usethreads" in
11423                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11424                 esac
11425                 d_ctime_r=undef
11426                 ctime_r_proto=0
11427                 ;;
11428         esac
11429         ;;
11430 *)      ctime_r_proto=0
11431         ;;
11432 esac
11433
11434 : see if cuserid exists
11435 set cuserid d_cuserid
11436 eval $inlibc
11437
11438 : see if this is a limits.h system
11439 set limits.h i_limits
11440 eval $inhdr
11441
11442 : see if this is a float.h system
11443 set float.h i_float
11444 eval $inhdr
11445
11446 : See if number of significant digits in a double precision number is known
11447 echo " "
11448 $cat >dbl_dig.c <<EOM
11449 #$i_limits I_LIMITS
11450 #$i_float I_FLOAT
11451 #ifdef I_LIMITS
11452 #include <limits.h>
11453 #endif
11454 #ifdef I_FLOAT
11455 #include <float.h>
11456 #endif
11457 #ifdef DBL_DIG
11458 printf("Contains DBL_DIG");
11459 #endif
11460 EOM
11461 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11462 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11463         echo "DBL_DIG found." >&4
11464         val="$define"
11465 else
11466         echo "DBL_DIG NOT found." >&4
11467         val="$undef"
11468 fi
11469 $rm -f dbl_dig.?
11470 set d_dbl_dig
11471 eval $setvar
11472
11473 : see if dbm.h is available
11474 : see if dbmclose exists
11475 set dbmclose d_dbmclose
11476 eval $inlibc
11477
11478 case "$d_dbmclose" in
11479 $define)
11480         set dbm.h i_dbm
11481         eval $inhdr
11482         case "$i_dbm" in
11483         $define)
11484                 val="$undef"
11485                 set i_rpcsvcdbm
11486                 eval $setvar
11487                 ;;
11488         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11489                 eval $inhdr
11490                 ;;
11491         esac
11492         ;;
11493 *)      echo "We won't be including <dbm.h>"
11494         val="$undef"
11495         set i_dbm
11496         eval $setvar
11497         val="$undef"
11498         set i_rpcsvcdbm
11499         eval $setvar
11500         ;;
11501 esac
11502
11503 : see if prototype for dbminit is available
11504 echo " "
11505 set d_dbminitproto dbminit $i_dbm dbm.h
11506 eval $hasproto
11507
11508 : see if difftime exists
11509 set difftime d_difftime
11510 eval $inlibc
11511
11512 : see if this is a dirent system
11513 echo " "
11514 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11515         val="$define"
11516         echo "<dirent.h> found." >&4
11517 else
11518         val="$undef"
11519         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11520                 echo "<sys/dir.h> found." >&4
11521                 echo " "
11522         else
11523                 xinc=`./findhdr sys/ndir.h`
11524         fi
11525         echo "<dirent.h> NOT found." >&4
11526 fi
11527 set i_dirent
11528 eval $setvar
11529
11530 : Look for type of directory structure.
11531 echo " "
11532 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11533
11534 case "$direntrytype" in
11535 ''|' ')
11536         case "$i_dirent" in
11537         $define) guess1='struct dirent' ;;
11538         *) guess1='struct direct'  ;;
11539         esac
11540         ;;
11541 *)      guess1="$direntrytype"
11542         ;;
11543 esac
11544
11545 case "$guess1" in
11546 'struct dirent') guess2='struct direct' ;;
11547 *) guess2='struct dirent' ;;
11548 esac
11549
11550 if $contains "$guess1" try.c >/dev/null 2>&1; then
11551         direntrytype="$guess1"
11552         echo "Your directory entries are $direntrytype." >&4
11553 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11554         direntrytype="$guess2"
11555         echo "Your directory entries seem to be $direntrytype." >&4
11556 else
11557         echo "I don't recognize your system's directory entries." >&4
11558         rp="What type is used for directory entries on this system?"
11559         dflt="$guess1"
11560         . ./myread
11561         direntrytype="$ans"
11562 fi
11563 $rm_try
11564
11565 : see if the directory entry stores field length
11566 echo " "
11567 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11568 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11569         echo "Good, your directory entry keeps length information in d_namlen." >&4
11570         val="$define"
11571 else
11572         echo "Your directory entry does not know about the d_namlen field." >&4
11573         val="$undef"
11574 fi
11575 set d_dirnamlen
11576 eval $setvar
11577 $rm_try
11578
11579 : Look for DIR.dd_fd
11580 case "$i_dirent" in
11581 "$define")
11582     echo "Checking to see if DIR has a dd_fd member variable" >&4
11583     $cat >try.c <<EOCP
11584 #$i_stdlib I_STDLIB
11585 #ifdef I_STDLIB
11586 #include <stdlib.h>
11587 #endif
11588 #include <dirent.h>
11589
11590 int main() {
11591     DIR dir;
11592     dir.dd_fd = 1;
11593     return 0;
11594 }
11595 EOCP
11596     val=$undef
11597     set try
11598     if eval $compile; then
11599         echo "Yes, it does."
11600         val="$define"
11601     else
11602         echo "No, it does not."
11603         val="$undef"
11604     fi
11605     ;;
11606 *)
11607     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11608     val="$undef"
11609     ;;
11610 esac
11611 set d_dir_dd_fd
11612 eval $setvar
11613 $rm_try
11614
11615 : see if this is an sysdir system
11616 set sys/dir.h i_sysdir
11617 eval $inhdr
11618
11619 : see if this is an sysndir system
11620 set sys/ndir.h i_sysndir
11621 eval $inhdr
11622
11623 : Look for dirfd
11624 echo " "
11625 $cat >dirfd.c <<EOM
11626 #include <stdio.h>
11627 #$i_stdlib I_STDLIB
11628 #ifdef I_STDLIB
11629 #include <stdlib.h>
11630 #endif
11631 #$i_dirent I_DIRENT             /**/
11632 #$i_sysdir I_SYS_DIR            /**/
11633 #$i_sysndir I_SYS_NDIR          /**/
11634 #$i_systypes I_SYS_TYPES        /**/
11635 #if defined(I_SYS_TYPES)
11636 #include <sys/types.h>
11637 #endif
11638 #if defined(I_DIRENT)
11639 #include <dirent.h>
11640 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11641 #include <sys/dir.h>
11642 #endif
11643 #else
11644 #ifdef I_SYS_NDIR
11645 #include <sys/ndir.h>
11646 #else
11647 #ifdef I_SYS_DIR
11648 #ifdef hp9000s500
11649 #include <ndir.h>       /* may be wrong in the future */
11650 #else
11651 #include <sys/dir.h>
11652 #endif
11653 #endif
11654 #endif
11655 #endif 
11656 int main() {
11657         DIR *dirp = opendir(".");
11658         if (dirfd(dirp) >= 0)
11659                 exit(0);
11660         else
11661                 exit(1);
11662 }
11663 EOM
11664 val=$undef
11665 set dirfd
11666 if eval $compile; then
11667         val="$define"
11668 fi
11669 case "$val" in
11670 $define)        echo "dirfd() found." >&4       ;;
11671 *)              echo "dirfd() NOT found." >&4   ;;
11672 esac
11673 set d_dirfd
11674 eval $setvar
11675 $rm -f dirfd*
11676
11677 : see if dlerror exists
11678 xxx_runnm="$runnm"
11679 runnm=false
11680 set dlerror d_dlerror
11681 eval $inlibc
11682 runnm="$xxx_runnm"
11683
11684 : see if dlfcn is available
11685 set dlfcn.h i_dlfcn
11686 eval $inhdr
11687
11688 : Check what extension to use for shared libs
11689 case "$usedl" in
11690 $define|y|true)
11691         $cat << EOM
11692
11693 On a few systems, the dynamically loaded modules that perl generates and uses
11694 will need a different extension than shared libs. The default will probably
11695 be appropriate.
11696
11697 EOM
11698         case "$dlext" in
11699         '')     dflt="$so" ;;
11700         *)      dflt="$dlext" ;;
11701         esac
11702         rp='What is the extension of dynamically loaded modules'
11703         . ./myread
11704         dlext="$ans"
11705         ;;
11706 *)
11707         dlext="none"
11708         ;;
11709 esac
11710
11711 : Check if dlsym need a leading underscore
11712 echo " "
11713 val="$undef"
11714
11715 case "$dlsrc" in
11716 dl_dlopen.xs)
11717         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11718         $cat >dyna.c <<'EOM'
11719 fred () { }
11720 EOM
11721
11722 $cat >fred.c<<EOM
11723
11724 #include <stdio.h>
11725 #$i_stdlib I_STDLIB
11726 #ifdef I_STDLIB
11727 #include <stdlib.h>
11728 #endif
11729 #$i_dlfcn I_DLFCN
11730 #ifdef I_DLFCN
11731 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11732 #else
11733 #include <sys/types.h>
11734 #include <nlist.h>
11735 #include <link.h>
11736 #endif
11737
11738 extern int fred() ;
11739
11740 int main()
11741 {
11742     void * handle ;
11743     void * symbol ;
11744 #ifndef RTLD_LAZY
11745     int mode = 1 ;
11746 #else
11747     int mode = RTLD_LAZY ;
11748 #endif
11749     handle = dlopen("./dyna.$dlext", mode) ;
11750     if (handle == NULL) {
11751         printf ("1\n") ;
11752         fflush (stdout) ;
11753         exit(0);
11754     }
11755     symbol = dlsym(handle, "fred") ;
11756     if (symbol == NULL) {
11757         /* try putting a leading underscore */
11758         symbol = dlsym(handle, "_fred") ;
11759         if (symbol == NULL) {
11760             printf ("2\n") ;
11761             fflush (stdout) ;
11762             exit(0);
11763         }
11764         printf ("3\n") ;
11765     }
11766     else
11767         printf ("4\n") ;
11768     fflush (stdout) ;
11769     exit(0);
11770 }
11771 EOM
11772         : Call the object file tmp-dyna.o in case dlext=o.
11773         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11774                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11775                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
11776                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11777                 xxx=`$run ./fred`
11778                 case $xxx in
11779                 1)      echo "Test program failed using dlopen." >&4
11780                         echo "Perhaps you should not use dynamic loading." >&4;;
11781                 2)      echo "Test program failed using dlsym." >&4
11782                         echo "Perhaps you should not use dynamic loading." >&4;;
11783                 3)      echo "dlsym needs a leading underscore" >&4
11784                         val="$define" ;;
11785                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11786                 esac
11787         else
11788                 echo "I can't compile and run the test program." >&4
11789                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11790         fi
11791         ;;
11792 esac
11793
11794 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11795
11796 set d_dlsymun
11797 eval $setvar
11798
11799 : see if drand48_r exists
11800 set drand48_r d_drand48_r
11801 eval $inlibc
11802 case "$d_drand48_r" in
11803 "$define")
11804         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11805         case "$d_drand48_r_proto:$usethreads" in
11806         ":define")      d_drand48_r_proto=define
11807                 set d_drand48_r_proto drand48_r $hdrs
11808                 eval $hasproto ;;
11809         *)      ;;
11810         esac
11811         case "$d_drand48_r_proto" in
11812         define)
11813         case "$drand48_r_proto" in
11814         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11815         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11816         esac
11817         case "$drand48_r_proto" in
11818         ''|0)   d_drand48_r=undef
11819                 drand48_r_proto=0
11820                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11821         * )     case "$drand48_r_proto" in
11822                 REENTRANT_PROTO*) ;;
11823                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11824                 esac
11825                 echo "Prototype: $try" ;;
11826         esac
11827         ;;
11828         *)      case "$usethreads" in
11829                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11830                 esac
11831                 d_drand48_r=undef
11832                 drand48_r_proto=0
11833                 ;;
11834         esac
11835         ;;
11836 *)      drand48_r_proto=0
11837         ;;
11838 esac
11839
11840 : see if prototype for drand48 is available
11841 echo " "
11842 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11843 eval $hasproto
11844
11845 : see if dup2 exists
11846 set dup2 d_dup2
11847 eval $inlibc
11848
11849 : see if eaccess exists
11850 set eaccess d_eaccess
11851 eval $inlibc
11852
11853 : see if endgrent exists
11854 set endgrent d_endgrent
11855 eval $inlibc
11856
11857 : see if this is an grp system
11858 set grp.h i_grp
11859 eval $inhdr
11860
11861 case "$i_grp" in
11862 $define)
11863         xxx=`./findhdr grp.h`
11864         $cppstdin $cppflags $cppminus < $xxx >$$.h
11865
11866         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11867                 val="$define"
11868         else
11869                 val="$undef"
11870         fi
11871         set d_grpasswd
11872         eval $setvar
11873
11874         $rm -f $$.h
11875         ;;
11876 *)
11877         val="$undef";
11878         set d_grpasswd; eval $setvar
11879         ;;
11880 esac
11881
11882 : see if endgrent_r exists
11883 set endgrent_r d_endgrent_r
11884 eval $inlibc
11885 case "$d_endgrent_r" in
11886 "$define")
11887         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11888         case "$d_endgrent_r_proto:$usethreads" in
11889         ":define")      d_endgrent_r_proto=define
11890                 set d_endgrent_r_proto endgrent_r $hdrs
11891                 eval $hasproto ;;
11892         *)      ;;
11893         esac
11894         case "$d_endgrent_r_proto" in
11895         define)
11896         case "$endgrent_r_proto" in
11897         ''|0) try='int endgrent_r(FILE**);'
11898         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11899         esac
11900         case "$endgrent_r_proto" in
11901         ''|0) try='void endgrent_r(FILE**);'
11902         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11903         esac
11904         case "$endgrent_r_proto" in
11905         ''|0)   d_endgrent_r=undef
11906                 endgrent_r_proto=0
11907                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11908         * )     case "$endgrent_r_proto" in
11909                 REENTRANT_PROTO*) ;;
11910                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11911                 esac
11912                 echo "Prototype: $try" ;;
11913         esac
11914         ;;
11915         *)      case "$usethreads" in
11916                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11917                 esac
11918                 d_endgrent_r=undef
11919                 endgrent_r_proto=0
11920                 ;;
11921         esac
11922         ;;
11923 *)      endgrent_r_proto=0
11924         ;;
11925 esac
11926
11927 : see if endhostent exists
11928 set endhostent d_endhent
11929 eval $inlibc
11930
11931 : see if this is a netdb.h system
11932 set netdb.h i_netdb
11933 eval $inhdr
11934
11935 : see if endhostent_r exists
11936 set endhostent_r d_endhostent_r
11937 eval $inlibc
11938 case "$d_endhostent_r" in
11939 "$define")
11940         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11941         case "$d_endhostent_r_proto:$usethreads" in
11942         ":define")      d_endhostent_r_proto=define
11943                 set d_endhostent_r_proto endhostent_r $hdrs
11944                 eval $hasproto ;;
11945         *)      ;;
11946         esac
11947         case "$d_endhostent_r_proto" in
11948         define)
11949         case "$endhostent_r_proto" in
11950         ''|0) try='int endhostent_r(struct hostent_data*);'
11951         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11952         esac
11953         case "$endhostent_r_proto" in
11954         ''|0) try='void endhostent_r(struct hostent_data*);'
11955         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11956         esac
11957         case "$endhostent_r_proto" in
11958         ''|0)   d_endhostent_r=undef
11959                 endhostent_r_proto=0
11960                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11961         * )     case "$endhostent_r_proto" in
11962                 REENTRANT_PROTO*) ;;
11963                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11964                 esac
11965                 echo "Prototype: $try" ;;
11966         esac
11967         ;;
11968         *)      case "$usethreads" in
11969                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11970                 esac
11971                 d_endhostent_r=undef
11972                 endhostent_r_proto=0
11973                 ;;
11974         esac
11975         ;;
11976 *)      endhostent_r_proto=0
11977         ;;
11978 esac
11979
11980 : see if endnetent exists
11981 set endnetent d_endnent
11982 eval $inlibc
11983
11984 : see if endnetent_r exists
11985 set endnetent_r d_endnetent_r
11986 eval $inlibc
11987 case "$d_endnetent_r" in
11988 "$define")
11989         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11990         case "$d_endnetent_r_proto:$usethreads" in
11991         ":define")      d_endnetent_r_proto=define
11992                 set d_endnetent_r_proto endnetent_r $hdrs
11993                 eval $hasproto ;;
11994         *)      ;;
11995         esac
11996         case "$d_endnetent_r_proto" in
11997         define)
11998         case "$endnetent_r_proto" in
11999         ''|0) try='int endnetent_r(struct netent_data*);'
12000         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
12001         esac
12002         case "$endnetent_r_proto" in
12003         ''|0) try='void endnetent_r(struct netent_data*);'
12004         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
12005         esac
12006         case "$endnetent_r_proto" in
12007         ''|0)   d_endnetent_r=undef
12008                 endnetent_r_proto=0
12009                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12010         * )     case "$endnetent_r_proto" in
12011                 REENTRANT_PROTO*) ;;
12012                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12013                 esac
12014                 echo "Prototype: $try" ;;
12015         esac
12016         ;;
12017         *)      case "$usethreads" in
12018                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12019                 esac
12020                 d_endnetent_r=undef
12021                 endnetent_r_proto=0
12022                 ;;
12023         esac
12024         ;;
12025 *)      endnetent_r_proto=0
12026         ;;
12027 esac
12028
12029 : see if endprotoent exists
12030 set endprotoent d_endpent
12031 eval $inlibc
12032
12033 : see if endprotoent_r exists
12034 set endprotoent_r d_endprotoent_r
12035 eval $inlibc
12036 case "$d_endprotoent_r" in
12037 "$define")
12038         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12039         case "$d_endprotoent_r_proto:$usethreads" in
12040         ":define")      d_endprotoent_r_proto=define
12041                 set d_endprotoent_r_proto endprotoent_r $hdrs
12042                 eval $hasproto ;;
12043         *)      ;;
12044         esac
12045         case "$d_endprotoent_r_proto" in
12046         define)
12047         case "$endprotoent_r_proto" in
12048         ''|0) try='int endprotoent_r(struct protoent_data*);'
12049         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
12050         esac
12051         case "$endprotoent_r_proto" in
12052         ''|0) try='void endprotoent_r(struct protoent_data*);'
12053         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
12054         esac
12055         case "$endprotoent_r_proto" in
12056         ''|0)   d_endprotoent_r=undef
12057                 endprotoent_r_proto=0
12058                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12059         * )     case "$endprotoent_r_proto" in
12060                 REENTRANT_PROTO*) ;;
12061                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12062                 esac
12063                 echo "Prototype: $try" ;;
12064         esac
12065         ;;
12066         *)      case "$usethreads" in
12067                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12068                 esac
12069                 d_endprotoent_r=undef
12070                 endprotoent_r_proto=0
12071                 ;;
12072         esac
12073         ;;
12074 *)      endprotoent_r_proto=0
12075         ;;
12076 esac
12077
12078 : see if endpwent exists
12079 set endpwent d_endpwent
12080 eval $inlibc
12081
12082 : see if this is a pwd.h system
12083 set pwd.h i_pwd
12084 eval $inhdr
12085
12086 case "$i_pwd" in
12087 $define)
12088         xxx=`./findhdr pwd.h`
12089         $cppstdin $cppflags $cppminus < $xxx >$$.h
12090
12091         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12092                 val="$define"
12093         else
12094                 val="$undef"
12095         fi
12096         set d_pwquota
12097         eval $setvar
12098
12099         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12100                 val="$define"
12101         else
12102                 val="$undef"
12103         fi
12104         set d_pwage
12105         eval $setvar
12106
12107         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12108                 val="$define"
12109         else
12110                 val="$undef"
12111         fi
12112         set d_pwchange
12113         eval $setvar
12114
12115         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12116                 val="$define"
12117         else
12118                 val="$undef"
12119         fi
12120         set d_pwclass
12121         eval $setvar
12122
12123         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12124                 val="$define"
12125         else
12126                 val="$undef"
12127         fi
12128         set d_pwexpire
12129         eval $setvar
12130
12131         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12132                 val="$define"
12133         else
12134                 val="$undef"
12135         fi
12136         set d_pwcomment
12137         eval $setvar
12138
12139         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12140                 val="$define"
12141         else
12142                 val="$undef"
12143         fi
12144         set d_pwgecos
12145         eval $setvar
12146
12147         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12148                 val="$define"
12149         else
12150                 val="$undef"
12151         fi
12152         set d_pwpasswd
12153         eval $setvar
12154
12155         $rm -f $$.h
12156         ;;
12157 *)
12158         val="$undef"; 
12159         set d_pwquota; eval $setvar
12160         set d_pwage; eval $setvar
12161         set d_pwchange; eval $setvar
12162         set d_pwclass; eval $setvar
12163         set d_pwexpire; eval $setvar
12164         set d_pwcomment; eval $setvar
12165         set d_pwgecos; eval $setvar
12166         set d_pwpasswd; eval $setvar
12167         ;;
12168 esac
12169
12170 : see if endpwent_r exists
12171 set endpwent_r d_endpwent_r
12172 eval $inlibc
12173 case "$d_endpwent_r" in
12174 "$define")
12175         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12176         case "$d_endpwent_r_proto:$usethreads" in
12177         ":define")      d_endpwent_r_proto=define
12178                 set d_endpwent_r_proto endpwent_r $hdrs
12179                 eval $hasproto ;;
12180         *)      ;;
12181         esac
12182         case "$d_endpwent_r_proto" in
12183         define)
12184         case "$endpwent_r_proto" in
12185         ''|0) try='int endpwent_r(FILE**);'
12186         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
12187         esac
12188         case "$endpwent_r_proto" in
12189         ''|0) try='void endpwent_r(FILE**);'
12190         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
12191         esac
12192         case "$endpwent_r_proto" in
12193         ''|0)   d_endpwent_r=undef
12194                 endpwent_r_proto=0
12195                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12196         * )     case "$endpwent_r_proto" in
12197                 REENTRANT_PROTO*) ;;
12198                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12199                 esac
12200                 echo "Prototype: $try" ;;
12201         esac
12202         ;;
12203         *)      case "$usethreads" in
12204                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12205                 esac
12206                 d_endpwent_r=undef
12207                 endpwent_r_proto=0
12208                 ;;
12209         esac
12210         ;;
12211 *)      endpwent_r_proto=0
12212         ;;
12213 esac
12214
12215 : see if endservent exists
12216 set endservent d_endsent
12217 eval $inlibc
12218
12219 : see if endservent_r exists
12220 set endservent_r d_endservent_r
12221 eval $inlibc
12222 case "$d_endservent_r" in
12223 "$define")
12224         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12225         case "$d_endservent_r_proto:$usethreads" in
12226         ":define")      d_endservent_r_proto=define
12227                 set d_endservent_r_proto endservent_r $hdrs
12228                 eval $hasproto ;;
12229         *)      ;;
12230         esac
12231         case "$d_endservent_r_proto" in
12232         define)
12233         case "$endservent_r_proto" in
12234         ''|0) try='int endservent_r(struct servent_data*);'
12235         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
12236         esac
12237         case "$endservent_r_proto" in
12238         ''|0) try='void endservent_r(struct servent_data*);'
12239         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
12240         esac
12241         case "$endservent_r_proto" in
12242         ''|0)   d_endservent_r=undef
12243                 endservent_r_proto=0
12244                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12245         * )     case "$endservent_r_proto" in
12246                 REENTRANT_PROTO*) ;;
12247                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12248                 esac
12249                 echo "Prototype: $try" ;;
12250         esac
12251         ;;
12252         *)      case "$usethreads" in
12253                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12254                 esac
12255                 d_endservent_r=undef
12256                 endservent_r_proto=0
12257                 ;;
12258         esac
12259         ;;
12260 *)      endservent_r_proto=0
12261         ;;
12262 esac
12263
12264 : Locate the flags for 'open()'
12265 echo " "
12266 $cat >try.c <<EOCP
12267 #include <sys/types.h>
12268 #ifdef I_FCNTL
12269 #include <fcntl.h>
12270 #endif
12271 #ifdef I_SYS_FILE
12272 #include <sys/file.h>
12273 #endif
12274 #$i_stdlib I_STDLIB
12275 #ifdef I_STDLIB
12276 #include <stdlib.h>
12277 #endif
12278 int main() {
12279         if(O_RDONLY);
12280 #ifdef O_TRUNC
12281         exit(0);
12282 #else
12283         exit(1);
12284 #endif
12285 }
12286 EOCP
12287 : check sys/file.h first to get FREAD on Sun
12288 if $test `./findhdr sys/file.h` && \
12289                 set try -DI_SYS_FILE && eval $compile; then
12290         h_sysfile=true;
12291         echo "<sys/file.h> defines the O_* constants..." >&4
12292         if $run ./try; then
12293                 echo "and you have the 3 argument form of open()." >&4
12294                 val="$define"
12295         else
12296                 echo "but not the 3 argument form of open().  Oh, well." >&4
12297                 val="$undef"
12298         fi
12299 elif $test `./findhdr fcntl.h` && \
12300                 set try -DI_FCNTL && eval $compile; then
12301         h_fcntl=true;
12302         echo "<fcntl.h> defines the O_* constants..." >&4
12303         if $run ./try; then
12304                 echo "and you have the 3 argument form of open()." >&4
12305                 val="$define"
12306         else
12307                 echo "but not the 3 argument form of open().  Oh, well." >&4
12308                 val="$undef"
12309         fi
12310 else
12311         val="$undef"
12312         echo "I can't find the O_* constant definitions!  You got problems." >&4
12313 fi
12314 set d_open3
12315 eval $setvar
12316 $rm_try
12317
12318 : script used to emit important warnings
12319 cat >warn <<EOS
12320 $startsh
12321 if test \$# -gt 0; then
12322         echo "\$@" >msg
12323 else
12324         cat >msg
12325 fi
12326 echo "*** WARNING:" >&4
12327 sed -e 's/^/*** /' <msg >&4
12328 echo "*** " >&4
12329 cat msg >>config.msg
12330 echo " " >>config.msg
12331 rm -f msg
12332 EOS
12333 chmod +x warn
12334 $eunicefix warn
12335
12336 : see which of string.h or strings.h is needed
12337 echo " "
12338 strings=`./findhdr string.h`
12339 if $test "$strings" && $test -r "$strings"; then
12340         echo "Using <string.h> instead of <strings.h>." >&4
12341         val="$define"
12342 else
12343         val="$undef"
12344         strings=`./findhdr strings.h`
12345         if $test "$strings" && $test -r "$strings"; then
12346                 echo "Using <strings.h> instead of <string.h>." >&4
12347         else
12348                 ./warn "No string header found -- You'll surely have problems."
12349         fi
12350 fi
12351 set i_string
12352 eval $setvar
12353 case "$i_string" in
12354 "$undef") strings=`./findhdr strings.h`;;
12355 *)        strings=`./findhdr string.h`;;
12356 esac
12357
12358 : see if this is a sys/file.h system
12359 val=''
12360 set sys/file.h val
12361 eval $inhdr
12362
12363 : do we need to include sys/file.h ?
12364 case "$val" in
12365 "$define")
12366         echo " "
12367         if $h_sysfile; then
12368                 val="$define"
12369                 echo "We'll be including <sys/file.h>." >&4
12370         else
12371                 val="$undef"
12372                 echo "We won't be including <sys/file.h>." >&4
12373         fi
12374         ;;
12375 *)
12376         h_sysfile=false
12377         ;;
12378 esac
12379 set i_sysfile
12380 eval $setvar
12381
12382 : see if fcntl.h is there
12383 val=''
12384 set fcntl.h val
12385 eval $inhdr
12386
12387 : see if we can include fcntl.h
12388 case "$val" in
12389 "$define")
12390         echo " "
12391         if $h_fcntl; then
12392                 val="$define"
12393                 echo "We'll be including <fcntl.h>." >&4
12394         else
12395                 val="$undef"
12396                 if $h_sysfile; then
12397         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12398                 else
12399                         echo "We won't be including <fcntl.h>." >&4
12400                 fi
12401         fi
12402         ;;
12403 *)
12404         h_fcntl=false
12405         val="$undef"
12406         ;;
12407 esac
12408 set i_fcntl
12409 eval $setvar
12410
12411 : see if fork exists
12412 set fork d_fork
12413 eval $inlibc
12414
12415 : see if pipe exists
12416 set pipe d_pipe
12417 eval $inlibc
12418
12419 : check for non-blocking I/O stuff
12420 case "$h_sysfile" in
12421 true) echo "#include <sys/file.h>" > head.c;;
12422 *)
12423        case "$h_fcntl" in
12424        true) echo "#include <fcntl.h>" > head.c;;
12425        *) echo "#include <sys/fcntl.h>" > head.c;;
12426        esac
12427        ;;
12428 esac
12429 echo " "
12430 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12431 case "$o_nonblock" in
12432 '')
12433         $cat head.c > try.c
12434         $cat >>try.c <<EOCP
12435 #include <stdio.h>
12436 #$i_stdlib I_STDLIB
12437 #ifdef I_STDLIB
12438 #include <stdlib.h>
12439 #endif
12440 #$i_fcntl I_FCNTL
12441 #ifdef I_FCNTL
12442 #include <fcntl.h>
12443 #endif
12444 int main() {
12445 #ifdef O_NONBLOCK
12446         printf("O_NONBLOCK\n");
12447         exit(0);
12448 #endif
12449 #ifdef O_NDELAY
12450         printf("O_NDELAY\n");
12451         exit(0);
12452 #endif
12453 #ifdef FNDELAY
12454         printf("FNDELAY\n");
12455         exit(0);
12456 #endif
12457         exit(0);
12458 }
12459 EOCP
12460         set try
12461         if eval $compile_ok; then
12462                 o_nonblock=`$run ./try`
12463                 case "$o_nonblock" in
12464                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12465                 *) echo "Seems like we can use $o_nonblock.";;
12466                 esac
12467         else
12468                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12469         fi
12470         ;;
12471 *) echo "Using $hint value $o_nonblock.";;
12472 esac
12473 $rm_try
12474
12475 echo " "
12476 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12477 case "$eagain" in
12478 '')
12479         case "$d_fork:$d_pipe" in
12480         define:define)
12481         $cat head.c > try.c
12482         $cat >>try.c <<EOCP
12483 #include <errno.h>
12484 #include <sys/types.h>
12485 #include <signal.h>
12486 #include <stdio.h>
12487 #$i_stdlib I_STDLIB
12488 #ifdef I_STDLIB
12489 #include <stdlib.h>
12490 #endif
12491 #$i_fcntl I_FCNTL
12492 #ifdef I_FCNTL
12493 #include <fcntl.h>
12494 #endif
12495 #define MY_O_NONBLOCK $o_nonblock
12496 #ifndef errno  /* XXX need better Configure test */
12497 extern int errno;
12498 #endif
12499 #$i_unistd I_UNISTD
12500 #ifdef I_UNISTD
12501 #include <unistd.h>
12502 #endif
12503 #$i_string I_STRING
12504 #ifdef I_STRING
12505 #include <string.h>
12506 #else
12507 #include <strings.h>
12508 #endif
12509 $signal_t blech(int x) { exit(3); }
12510 EOCP
12511         $cat >> try.c <<'EOCP'
12512 int main()
12513 {
12514         int pd[2];
12515         int pu[2];
12516         char buf[1];
12517         char string[100];
12518
12519         pipe(pd);       /* Down: child -> parent */
12520         pipe(pu);       /* Up: parent -> child */
12521         if (0 != fork()) {
12522                 int ret;
12523                 close(pd[1]);   /* Parent reads from pd[0] */
12524                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12525 #ifdef F_SETFL
12526                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12527                         exit(1);
12528 #else
12529                 exit(4);
12530 #endif
12531                 signal(SIGALRM, blech);
12532                 alarm(5);
12533                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12534                         exit(2);
12535                 sprintf(string, "%d\n", ret);
12536                 write(2, string, strlen(string));
12537                 alarm(0);
12538 #ifdef EAGAIN
12539                 if (errno == EAGAIN) {
12540                         printf("EAGAIN\n");
12541                         goto ok;
12542                 }
12543 #endif
12544 #ifdef EWOULDBLOCK
12545                 if (errno == EWOULDBLOCK)
12546                         printf("EWOULDBLOCK\n");
12547 #endif
12548         ok:
12549                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12550                 sleep(2);                               /* Give it time to close our pipe */
12551                 alarm(5);
12552                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12553                 alarm(0);
12554                 sprintf(string, "%d\n", ret);
12555                 write(4, string, strlen(string));
12556                 exit(0);
12557         }
12558
12559         close(pd[0]);                   /* We write to pd[1] */
12560         close(pu[1]);                   /* We read from pu[0] */
12561         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12562         close(pd[1]);                   /* Pipe pd is now fully closed! */
12563         exit(0);                                /* Bye bye, thank you for playing! */
12564 }
12565 EOCP
12566         set try
12567         if eval $compile_ok; then
12568                 echo "$startsh" >mtry
12569                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12570                 chmod +x mtry
12571                 ./mtry >/dev/null 2>&1
12572                 case $? in
12573                 0) eagain=`$cat try.out`;;
12574                 1) echo "Could not perform non-blocking setting!";;
12575                 2) echo "I did a successful read() for something that was not there!";;
12576                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12577                 4) echo "Could not find F_SETFL!";;
12578                 *) echo "Something terribly wrong happened during testing.";;
12579                 esac
12580                 rd_nodata=`$cat try.ret`
12581                 echo "A read() system call with no data present returns $rd_nodata."
12582                 case "$rd_nodata" in
12583                 0|-1) ;;
12584                 *)
12585                         echo "(That's peculiar, fixing that to be -1.)"
12586                         rd_nodata=-1
12587                         ;;
12588                 esac
12589                 case "$eagain" in
12590                 '')
12591                         echo "Forcing errno EAGAIN on read() with no data available."
12592                         eagain=EAGAIN
12593                         ;;
12594                 *)
12595                         echo "Your read() sets errno to $eagain when no data is available."
12596                         ;;
12597                 esac
12598                 status=`$cat try.err`
12599                 case "$status" in
12600                 0) echo "And it correctly returns 0 to signal EOF.";;
12601                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12602                 *) echo "However, your read() returns '$status' on EOF??";;
12603                 esac
12604                 val="$define"
12605                 if test "$status" = "$rd_nodata"; then
12606                         echo "WARNING: you can't distinguish between EOF and no data!"
12607                         val="$undef"
12608                 fi
12609         else
12610                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12611                 eagain=EAGAIN
12612         fi
12613         ;;
12614         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12615                 eagain=EAGAIN
12616                 val="$define"
12617                 ;;
12618         esac
12619         set d_eofnblk
12620         eval $setvar
12621         ;;
12622 *)
12623         echo "Using $hint value $eagain."
12624         echo "Your read() returns $rd_nodata when no data is present."
12625         case "$d_eofnblk" in
12626         "$define") echo "And you can see EOF because read() returns 0.";;
12627         "$undef") echo "But you can't see EOF status from read() returned value.";;
12628         *)
12629                 echo "(Assuming you can't see EOF status from read anyway.)"
12630                 d_eofnblk=$undef
12631                 ;;
12632         esac
12633         ;;
12634 esac
12635 $rm_try head.c mtry
12636
12637 : see if _ptr and _cnt from stdio act std
12638 echo " "
12639
12640 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12641         echo "(Looks like you have stdio.h from BSD.)"
12642         case "$stdio_ptr" in
12643         '') stdio_ptr='((fp)->_p)'
12644                 ptr_lval=$define
12645                 ;;
12646         *)      ptr_lval=$d_stdio_ptr_lval;;
12647         esac
12648         case "$stdio_cnt" in
12649         '') stdio_cnt='((fp)->_r)'
12650                 cnt_lval=$define
12651                 ;;
12652         *)      cnt_lval=$d_stdio_cnt_lval;;
12653         esac
12654         case "$stdio_base" in
12655         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12656         esac
12657         case "$stdio_bufsiz" in
12658         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12659         esac
12660 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12661         echo "(Looks like you have stdio.h from Linux.)"
12662         case "$stdio_ptr" in
12663         '') stdio_ptr='((fp)->_IO_read_ptr)'
12664                 ptr_lval=$define
12665                 ;;
12666         *)      ptr_lval=$d_stdio_ptr_lval;;
12667         esac
12668         case "$stdio_cnt" in
12669         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12670                 cnt_lval=$undef
12671                 ;;
12672         *)      cnt_lval=$d_stdio_cnt_lval;;
12673         esac
12674         case "$stdio_base" in
12675         '') stdio_base='((fp)->_IO_read_base)';;
12676         esac
12677         case "$stdio_bufsiz" in
12678         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12679         esac
12680 else
12681         case "$stdio_ptr" in
12682         '') stdio_ptr='((fp)->_ptr)'
12683                 ptr_lval=$define
12684                 ;;
12685         *)      ptr_lval=$d_stdio_ptr_lval;;
12686         esac
12687         case "$stdio_cnt" in
12688         '') stdio_cnt='((fp)->_cnt)'
12689                 cnt_lval=$define
12690                 ;;
12691         *)      cnt_lval=$d_stdio_cnt_lval;;
12692         esac
12693         case "$stdio_base" in
12694         '') stdio_base='((fp)->_base)';;
12695         esac
12696         case "$stdio_bufsiz" in
12697         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12698         esac
12699 fi
12700
12701 : test whether _ptr and _cnt really work
12702 echo "Checking how std your stdio is..." >&4
12703 $cat >try.c <<EOP
12704 #include <stdio.h>
12705 #$i_stdlib I_STDLIB
12706 #ifdef I_STDLIB
12707 #include <stdlib.h>
12708 #endif
12709 #define FILE_ptr(fp)    $stdio_ptr
12710 #define FILE_cnt(fp)    $stdio_cnt
12711 int main() {
12712         FILE *fp = fopen("try.c", "r");
12713         char c = getc(fp);
12714         if (
12715                 18 <= FILE_cnt(fp) &&
12716                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12717         )
12718                 exit(0);
12719         exit(1);
12720 }
12721 EOP
12722 val="$undef"
12723 set try
12724 if eval $compile && $to try.c; then
12725         if $run ./try; then
12726                 echo "Your stdio acts pretty std."
12727                 val="$define"
12728         else
12729                 echo "Your stdio isn't very std."
12730         fi
12731 else
12732         echo "Your stdio doesn't appear very std."
12733 fi
12734 $rm_try
12735
12736 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12737 # direct buffer manipulation no longer works.  The Configure tests
12738 # should be changed to correctly detect this, but until then,
12739 # the following check should at least let perl compile and run.
12740 # (This quick fix should be updated before 5.8.1.)
12741 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12742 # A. Dougherty, June 3, 2002.
12743 case "$d_gnulibc" in
12744 $define)
12745         case "$gnulibc_version" in
12746         2.[01]*)  ;;
12747         2.2) ;;
12748         2.2.[0-9]) ;;
12749         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12750                 val="$undef"
12751                 ;;
12752         esac
12753         ;;
12754 esac
12755 set d_stdstdio
12756 eval $setvar
12757
12758 : Can _ptr be used as an lvalue?
12759 case "$d_stdstdio$ptr_lval" in
12760 $define$define) val=$define ;;
12761 *) val=$undef ;;
12762 esac
12763 set d_stdio_ptr_lval
12764 eval $setvar
12765
12766 : Can _cnt be used as an lvalue?
12767 case "$d_stdstdio$cnt_lval" in
12768 $define$define) val=$define ;;
12769 *) val=$undef ;;
12770 esac
12771 set d_stdio_cnt_lval
12772 eval $setvar
12773
12774
12775 : test whether setting _ptr sets _cnt as a side effect
12776 d_stdio_ptr_lval_sets_cnt="$undef"
12777 d_stdio_ptr_lval_nochange_cnt="$undef"
12778 case "$d_stdio_ptr_lval$d_stdstdio" in
12779 $define$define)
12780         echo "Checking to see what happens if we set the stdio ptr..." >&4
12781 $cat >try.c <<EOP
12782 #include <stdio.h>
12783 /* Can we scream? */
12784 /* Eat dust sed :-) */
12785 /* In the buffer space, no one can hear you scream. */
12786 #$i_stdlib I_STDLIB
12787 #ifdef I_STDLIB
12788 #include <stdlib.h>
12789 #endif
12790 #define FILE_ptr(fp)    $stdio_ptr
12791 #define FILE_cnt(fp)    $stdio_cnt
12792 #include <sys/types.h>
12793 int main() {
12794         FILE *fp = fopen("try.c", "r");
12795         int c;
12796         char *ptr;
12797         size_t cnt;
12798         if (!fp) {
12799             puts("Fail even to read");
12800             exit(1);
12801         }
12802         c = getc(fp); /* Read away the first # */
12803         if (c == EOF) {
12804             puts("Fail even to read");
12805             exit(1);
12806         }
12807         if (!(
12808                 18 <= FILE_cnt(fp) &&
12809                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12810         )) {
12811                 puts("Fail even to read");
12812                 exit (1);
12813         }
12814         ptr = (char*) FILE_ptr(fp);
12815         cnt = (size_t)FILE_cnt(fp);
12816
12817         FILE_ptr(fp) += 42;
12818
12819         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12820                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12821                 exit (1);
12822         }
12823         if (FILE_cnt(fp) <= 20) {
12824                 printf ("Fail (<20 chars to test)");
12825                 exit (1);
12826         }
12827         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12828                 puts("Fail compare");
12829                 exit (1);
12830         }
12831         if (cnt == FILE_cnt(fp)) {
12832                 puts("Pass_unchanged");
12833                 exit (0);
12834         }
12835         if (FILE_cnt(fp) == (cnt - 42)) {
12836                 puts("Pass_changed");
12837                 exit (0);
12838         }
12839         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12840         return 1;
12841
12842 }
12843 EOP
12844         set try
12845         if eval $compile && $to try.c; then
12846                 case `$run ./try` in
12847                 Pass_changed)
12848                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12849                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12850                 Pass_unchanged)
12851                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12852                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12853                 Fail*)
12854                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12855                 *)
12856                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12857         esac
12858         else
12859                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12860         fi
12861         $rm_try
12862         ;;
12863 esac
12864
12865 : see if _base is also standard
12866 val="$undef"
12867 case "$d_stdstdio" in
12868 $define)
12869         $cat >try.c <<EOP
12870 #include <stdio.h>
12871 #$i_stdlib I_STDLIB
12872 #ifdef I_STDLIB
12873 #include <stdlib.h>
12874 #endif
12875 #define FILE_base(fp)   $stdio_base
12876 #define FILE_bufsiz(fp) $stdio_bufsiz
12877 int main() {
12878         FILE *fp = fopen("try.c", "r");
12879         char c = getc(fp);
12880         if (
12881                 19 <= FILE_bufsiz(fp) &&
12882                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12883         )
12884                 exit(0);
12885         exit(1);
12886 }
12887 EOP
12888         set try
12889         if eval $compile && $to try.c; then
12890                 if $run ./try; then
12891                         echo "And its _base field acts std."
12892                         val="$define"
12893                 else
12894                         echo "But its _base field isn't std."
12895                 fi
12896         else
12897                 echo "However, it seems to be lacking the _base field."
12898         fi
12899         $rm_try
12900         ;;
12901 esac
12902 set d_stdiobase
12903 eval $setvar
12904
12905 : see if fast_stdio exists
12906 val="$undef"
12907 case "$d_stdstdio:$d_stdio_ptr_lval" in
12908 "$define:$define")
12909         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12910         *$define*)
12911                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12912                 val="$define"
12913                 ;;
12914         esac
12915         ;;
12916 esac
12917 set d_faststdio
12918 eval $setvar
12919
12920
12921
12922 : see if fchdir exists
12923 set fchdir d_fchdir
12924 eval $inlibc
12925
12926 : see if fchmod exists
12927 set fchmod d_fchmod
12928 eval $inlibc
12929
12930 : see if fchown exists
12931 set fchown d_fchown
12932 eval $inlibc
12933
12934 : see if this is an fcntl system
12935 set fcntl d_fcntl
12936 eval $inlibc
12937
12938 : See if fcntl-based locking works.
12939 echo " "
12940 $cat >try.c <<EOCP
12941 #$i_stdlib I_STDLIB
12942 #ifdef I_STDLIB
12943 #include <stdlib.h>
12944 #endif
12945 #include <unistd.h>
12946 #include <fcntl.h>
12947 #include <signal.h>
12948 $signal_t blech(int x) { exit(3); }
12949 int main() {
12950 #if defined(F_SETLK) && defined(F_SETLKW)
12951      struct flock flock;
12952      int retval, fd;
12953      fd = open("try.c", O_RDONLY);
12954      flock.l_type = F_RDLCK;
12955      flock.l_whence = SEEK_SET;
12956      flock.l_start = flock.l_len = 0;
12957      signal(SIGALRM, blech);
12958      alarm(10);
12959      retval = fcntl(fd, F_SETLK, &flock);
12960      close(fd);
12961      (retval < 0 ? exit(2) : exit(0));
12962 #else
12963      exit(2);
12964 #endif
12965 }
12966 EOCP
12967 echo "Checking if fcntl-based file locking works... "
12968 case "$d_fcntl" in
12969 "$define")
12970         set try
12971         if eval $compile_ok; then
12972                 if $run ./try; then
12973                         echo "Yes, it seems to work."
12974                         val="$define"
12975                 else
12976                         echo "Nope, it didn't work."
12977                         val="$undef"
12978                         case "$?" in
12979                         3) $cat >&4 <<EOM
12980 ***
12981 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12982 *** This is (almost) impossible.
12983 *** If your NFS lock daemons are not feeling well, something like
12984 *** this may happen, please investigate.  Cannot continue, aborting.
12985 ***
12986 EOM
12987                                 exit 1
12988                                 ;;
12989                         esac
12990                 fi
12991         else
12992                 echo "I'm unable to compile the test program, so I'll assume not."
12993                 val="$undef"
12994         fi
12995         ;;
12996 *) val="$undef";
12997         echo "Nope, since you don't even have fcntl()."
12998         ;;
12999 esac
13000 set d_fcntl_can_lock
13001 eval $setvar
13002 $rm_try
13003
13004 : check for fd_set items
13005 $cat <<EOM
13006
13007 Checking to see how well your C compiler handles fd_set and friends ...
13008 EOM
13009 $cat >try.c <<EOCP
13010 #$i_stdlib I_STDLIB
13011 #ifdef I_STDLIB
13012 #include <stdlib.h>
13013 #endif
13014 #$i_systime I_SYS_TIME
13015 #$i_sysselct I_SYS_SELECT
13016 #$d_socket HAS_SOCKET
13017 #include <sys/types.h>
13018 #ifdef HAS_SOCKET
13019 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13020 #endif
13021 #ifdef I_SYS_TIME
13022 #include <sys/time.h>
13023 #endif
13024 #ifdef I_SYS_SELECT
13025 #include <sys/select.h>
13026 #endif
13027 int main() {
13028         fd_set fds;
13029
13030 #ifdef TRYBITS
13031         if(fds.fds_bits);
13032 #endif
13033
13034 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13035         exit(0);
13036 #else
13037         exit(1);
13038 #endif
13039 }
13040 EOCP
13041 set try -DTRYBITS
13042 if eval $compile; then
13043         d_fds_bits="$define"
13044         d_fd_set="$define"
13045         echo "Well, your system knows about the normal fd_set typedef..." >&4
13046         if $run ./try; then
13047                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13048                 d_fd_macros="$define"
13049         else
13050                 $cat >&4 <<'EOM'
13051 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13052 EOM
13053                 d_fd_macros="$undef"
13054         fi
13055 else
13056         $cat <<'EOM'
13057 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13058 EOM
13059         set try
13060         if eval $compile; then
13061                 d_fds_bits="$undef"
13062                 d_fd_set="$define"
13063                 echo "Well, your system has some sort of fd_set available..." >&4
13064                 if $run ./try; then
13065                         echo "and you have the normal fd_set macros." >&4
13066                         d_fd_macros="$define"
13067                 else
13068                         $cat <<'EOM'
13069 but not the normal fd_set macros!  Gross!  More work for me...
13070 EOM
13071                         d_fd_macros="$undef"
13072                 fi
13073         else
13074         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13075                 d_fd_set="$undef"
13076                 d_fds_bits="$undef"
13077                 d_fd_macros="$undef"
13078         fi
13079 fi
13080 $rm_try
13081
13082 : see if fgetpos exists
13083 set fgetpos d_fgetpos
13084 eval $inlibc
13085
13086 : see if finite exists
13087 set finite d_finite
13088 eval $inlibc
13089
13090 : see if finitel exists
13091 set finitel d_finitel
13092 eval $inlibc
13093
13094 : see if flock exists
13095 set flock d_flock
13096 eval $inlibc
13097
13098 : see if prototype for flock is available
13099 echo " "
13100 set d_flockproto flock $i_sysfile sys/file.h
13101 eval $hasproto
13102
13103 : see if fp_class exists
13104 set fp_class d_fp_class
13105 eval $inlibc
13106
13107 : see if pathconf exists
13108 set pathconf d_pathconf
13109 eval $inlibc
13110
13111 : see if fpathconf exists
13112 set fpathconf d_fpathconf
13113 eval $inlibc
13114
13115 : see if fpclass exists
13116 set fpclass d_fpclass
13117 eval $inlibc
13118
13119 : see if fpclassify exists
13120 set fpclassify d_fpclassify
13121 eval $inlibc
13122
13123 : see if fpclassl exists
13124 set fpclassl d_fpclassl
13125 eval $inlibc
13126
13127 : check for fpos64_t
13128 echo " "
13129 echo "Checking to see if you have fpos64_t..." >&4
13130 $cat >try.c <<EOCP
13131 #include <stdio.h>
13132 int main() { fpos64_t x = 7; }
13133 EOCP
13134 set try
13135 if eval $compile; then
13136         val="$define"
13137         echo "You have fpos64_t."
13138 else
13139         val="$undef"
13140         echo "You do not have fpos64_t."
13141         case "$fpossize" in
13142         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13143         esac
13144 fi
13145 $rm_try
13146 set d_fpos64_t
13147 eval $setvar
13148
13149 : see if frexpl exists
13150 set frexpl d_frexpl
13151 eval $inlibc
13152
13153 : see if this is a sys/param system
13154 set sys/param.h i_sysparam
13155 eval $inhdr
13156
13157 : see if this is a sys/mount.h system
13158 set sys/mount.h i_sysmount
13159 eval $inhdr
13160
13161 : Check for fs_data_s
13162 echo " "
13163 echo "Checking to see if your system supports struct fs_data..." >&4
13164 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13165 eval $hasstruct
13166 case "$d_fs_data_s" in
13167 "$define")      echo "Yes, it does."   ;;
13168 *)              echo "No, it doesn't." ;;
13169 esac
13170
13171 : see if fseeko exists
13172 set fseeko d_fseeko
13173 eval $inlibc
13174 case "$longsize" in
13175 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13176 esac
13177
13178 : see if fsetpos exists
13179 set fsetpos d_fsetpos
13180 eval $inlibc
13181
13182 : see if fstatfs exists
13183 set fstatfs d_fstatfs
13184 eval $inlibc
13185
13186 : see if statvfs exists
13187 set statvfs d_statvfs
13188 eval $inlibc
13189
13190 : see if fstatvfs exists
13191 set fstatvfs d_fstatvfs
13192 eval $inlibc
13193
13194
13195 : see if fsync exists
13196 set fsync d_fsync
13197 eval $inlibc
13198
13199 : see if ftello exists
13200 set ftello d_ftello
13201 eval $inlibc
13202 case "$longsize" in
13203 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13204 esac
13205
13206 : check for a working futimes
13207 d_futimes="$undef"
13208 echo " "
13209 echo "Checking if you have a working futimes()" >&4
13210 $cat >try.c <<EOCP
13211 #include <stdio.h>
13212 #include <sys/time.h>
13213 #include <errno.h>
13214 #include <fcntl.h>
13215
13216 int main ()
13217 {
13218     int fd, rv;
13219     fd = open ("try.c", O_RDWR);
13220     if (-1 == fd) exit (1);
13221     rv = futimes (fd, NULL);
13222     exit (rv == -1 ? errno : 0);
13223 }
13224 EOCP
13225 set try
13226 if eval $compile; then
13227     `$run ./try`
13228     rc=$?
13229     case "$rc" in
13230         0)  echo "Yes, you have" >&4
13231             d_futimes="$define"
13232             ;;
13233         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13234             ;;
13235     esac
13236 else
13237     echo "No, it does not (probably harmless)" >&4
13238 fi
13239 $rm_try
13240
13241 : see if getcwd exists
13242 set getcwd d_getcwd
13243 eval $inlibc
13244
13245 : see if getespwnam exists
13246 set getespwnam d_getespwnam
13247 eval $inlibc
13248
13249 : see if getfsstat exists
13250 set getfsstat d_getfsstat
13251 eval $inlibc
13252
13253 : see if getgrent exists
13254 set getgrent d_getgrent
13255 eval $inlibc
13256
13257 : see if getgrent_r exists
13258 set getgrent_r d_getgrent_r
13259 eval $inlibc
13260 case "$d_getgrent_r" in
13261 "$define")
13262         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13263         case "$d_getgrent_r_proto:$usethreads" in
13264         ":define")      d_getgrent_r_proto=define
13265                 set d_getgrent_r_proto getgrent_r $hdrs
13266                 eval $hasproto ;;
13267         *)      ;;
13268         esac
13269         case "$d_getgrent_r_proto" in
13270         define)
13271         case "$getgrent_r_proto" in
13272         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13273         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13274         esac
13275         case "$getgrent_r_proto" in
13276         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13277         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13278         esac
13279         case "$getgrent_r_proto" in
13280         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13281         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
13282         esac
13283         case "$getgrent_r_proto" in
13284         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13285         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
13286         esac
13287         case "$getgrent_r_proto" in
13288         ''|0) try='int getgrent_r(struct group*, char*, int);'
13289         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
13290         esac
13291         case "$getgrent_r_proto" in
13292         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13293         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13294         esac
13295         case "$getgrent_r_proto" in
13296         ''|0)   d_getgrent_r=undef
13297                 getgrent_r_proto=0
13298                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13299         * )     case "$getgrent_r_proto" in
13300                 REENTRANT_PROTO*) ;;
13301                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13302                 esac
13303                 echo "Prototype: $try" ;;
13304         esac
13305         ;;
13306         *)      case "$usethreads" in
13307                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13308                 esac
13309                 d_getgrent_r=undef
13310                 getgrent_r_proto=0
13311                 ;;
13312         esac
13313         ;;
13314 *)      getgrent_r_proto=0
13315         ;;
13316 esac
13317
13318 : see if getgrgid_r exists
13319 set getgrgid_r d_getgrgid_r
13320 eval $inlibc
13321 case "$d_getgrgid_r" in
13322 "$define")
13323         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13324         case "$d_getgrgid_r_proto:$usethreads" in
13325         ":define")      d_getgrgid_r_proto=define
13326                 set d_getgrgid_r_proto getgrgid_r $hdrs
13327                 eval $hasproto ;;
13328         *)      ;;
13329         esac
13330         case "$d_getgrgid_r_proto" in
13331         define)
13332         case "$getgrgid_r_proto" in
13333         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13334         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13335         esac
13336         case "$getgrgid_r_proto" in
13337         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13338         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13339         esac
13340         case "$getgrgid_r_proto" in
13341         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13342         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13343         esac
13344         case "$getgrgid_r_proto" in
13345         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13346         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13347         esac
13348         case "$getgrgid_r_proto" in
13349         ''|0)   d_getgrgid_r=undef
13350                 getgrgid_r_proto=0
13351                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13352         * )     case "$getgrgid_r_proto" in
13353                 REENTRANT_PROTO*) ;;
13354                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13355                 esac
13356                 echo "Prototype: $try" ;;
13357         esac
13358         ;;
13359         *)      case "$usethreads" in
13360                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13361                 esac
13362                 d_getgrgid_r=undef
13363                 getgrgid_r_proto=0
13364                 ;;
13365         esac
13366         ;;
13367 *)      getgrgid_r_proto=0
13368         ;;
13369 esac
13370
13371 : see if getgrnam_r exists
13372 set getgrnam_r d_getgrnam_r
13373 eval $inlibc
13374 case "$d_getgrnam_r" in
13375 "$define")
13376         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13377         case "$d_getgrnam_r_proto:$usethreads" in
13378         ":define")      d_getgrnam_r_proto=define
13379                 set d_getgrnam_r_proto getgrnam_r $hdrs
13380                 eval $hasproto ;;
13381         *)      ;;
13382         esac
13383         case "$d_getgrnam_r_proto" in
13384         define)
13385         case "$getgrnam_r_proto" in
13386         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13387         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13388         esac
13389         case "$getgrnam_r_proto" in
13390         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13391         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13392         esac
13393         case "$getgrnam_r_proto" in
13394         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13395         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13396         esac
13397         case "$getgrnam_r_proto" in
13398         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13399         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13400         esac
13401         case "$getgrnam_r_proto" in
13402         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13403         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13404         esac
13405         case "$getgrnam_r_proto" in
13406         ''|0)   d_getgrnam_r=undef
13407                 getgrnam_r_proto=0
13408                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13409         * )     case "$getgrnam_r_proto" in
13410                 REENTRANT_PROTO*) ;;
13411                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13412                 esac
13413                 echo "Prototype: $try" ;;
13414         esac
13415         ;;
13416         *)      case "$usethreads" in
13417                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13418                 esac
13419                 d_getgrnam_r=undef
13420                 getgrnam_r_proto=0
13421                 ;;
13422         esac
13423         ;;
13424 *)      getgrnam_r_proto=0
13425         ;;
13426 esac
13427
13428 : see if gethostbyaddr exists
13429 set gethostbyaddr d_gethbyaddr
13430 eval $inlibc
13431
13432 : see if gethostbyname exists
13433 set gethostbyname d_gethbyname
13434 eval $inlibc
13435
13436 : see if gethostent exists
13437 set gethostent d_gethent
13438 eval $inlibc
13439
13440 : see how we will look up host name
13441 echo " "
13442 call=''
13443 if set gethostname val -f d_gethname; eval $csym; $val; then
13444         echo 'gethostname() found.' >&4
13445         d_gethname="$define"
13446         call=gethostname
13447 fi
13448 if set uname val -f d_uname; eval $csym; $val; then
13449         if ./xenix; then
13450                 $cat <<'EOM'
13451 uname() was found, but you're running xenix, and older versions of xenix
13452 have a broken uname(). If you don't really know whether your xenix is old
13453 enough to have a broken system call, use the default answer.
13454
13455 EOM
13456                 dflt=y
13457                 case "$d_uname" in
13458                 "$define") dflt=n;;
13459                 esac
13460                 rp='Is your uname() broken?'
13461                 . ./myread
13462                 case "$ans" in
13463                 n*) d_uname="$define"; call=uname;;
13464                 esac
13465         else
13466                 echo 'uname() found.' >&4
13467                 d_uname="$define"
13468                 case "$call" in
13469                 '') call=uname ;;
13470                 esac
13471         fi
13472 fi
13473 case "$d_gethname" in
13474 '') d_gethname="$undef";;
13475 esac
13476 case "$d_uname" in
13477 '') d_uname="$undef";;
13478 esac
13479 case "$d_uname$d_gethname" in
13480 *define*)
13481         dflt=n
13482         cat <<EOM
13483
13484 Every now and then someone has a $call() that lies about the hostname
13485 but can't be fixed for political or economic reasons.  If you wish, I can
13486 pretend $call() isn't there and maybe compute hostname at run-time
13487 thanks to the '$phostname' command.
13488
13489 EOM
13490         rp="Shall I ignore $call() from now on?"
13491         . ./myread
13492         case "$ans" in
13493         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13494         esac;;
13495 esac
13496 case "$phostname" in
13497 '') aphostname='';;
13498 *) case "$aphostname" in
13499         /*) ;;
13500         *) set X $phostname
13501                 shift
13502                 file=$1
13503                 shift
13504                 file=`./loc $file $file $pth`
13505                 aphostname=`echo $file $*`
13506                 ;;
13507         esac
13508         ;;
13509 esac
13510 case "$d_uname$d_gethname" in
13511 *define*) ;;
13512 *)
13513         case "$phostname" in
13514         '')
13515                 echo "There will be no way for $package to get your hostname." >&4;;
13516         *)
13517         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13518                 ;;
13519         esac;;
13520 esac
13521 case "$d_phostname" in
13522 '') d_phostname="$undef";;
13523 esac
13524
13525 : see if gethostbyaddr_r exists
13526 set gethostbyaddr_r d_gethostbyaddr_r
13527 eval $inlibc
13528 case "$d_gethostbyaddr_r" in
13529 "$define")
13530         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13531         case "$d_gethostbyaddr_r_proto:$usethreads" in
13532         ":define")      d_gethostbyaddr_r_proto=define
13533                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13534                 eval $hasproto ;;
13535         *)      ;;
13536         esac
13537         case "$d_gethostbyaddr_r_proto" in
13538         define)
13539         case "$gethostbyaddr_r_proto" in
13540         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13541         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13542         esac
13543         case "$gethostbyaddr_r_proto" in
13544         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13545         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13546         esac
13547         case "$gethostbyaddr_r_proto" in
13548         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13549         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13550         esac
13551         case "$gethostbyaddr_r_proto" in
13552         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13553         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13554         esac
13555         case "$gethostbyaddr_r_proto" in
13556         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13557         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13558         esac
13559         case "$gethostbyaddr_r_proto" in
13560         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13561         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13562         esac
13563         case "$gethostbyaddr_r_proto" in
13564         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13565         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13566         esac
13567         case "$gethostbyaddr_r_proto" in
13568         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13569         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13570         esac
13571         case "$gethostbyaddr_r_proto" in
13572         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13573         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13574         esac
13575         case "$gethostbyaddr_r_proto" in
13576         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13577         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13578         esac
13579         case "$gethostbyaddr_r_proto" in
13580         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13581         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13582         esac
13583         case "$gethostbyaddr_r_proto" in
13584         ''|0)   d_gethostbyaddr_r=undef
13585                 gethostbyaddr_r_proto=0
13586                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13587         * )     case "$gethostbyaddr_r_proto" in
13588                 REENTRANT_PROTO*) ;;
13589                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13590                 esac
13591                 echo "Prototype: $try" ;;
13592         esac
13593         ;;
13594         *)      case "$usethreads" in
13595                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13596                 esac
13597                 d_gethostbyaddr_r=undef
13598                 gethostbyaddr_r_proto=0
13599                 ;;
13600         esac
13601         ;;
13602 *)      gethostbyaddr_r_proto=0
13603         ;;
13604 esac
13605
13606 : see if gethostbyname_r exists
13607 set gethostbyname_r d_gethostbyname_r
13608 eval $inlibc
13609 case "$d_gethostbyname_r" in
13610 "$define")
13611         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13612         case "$d_gethostbyname_r_proto:$usethreads" in
13613         ":define")      d_gethostbyname_r_proto=define
13614                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13615                 eval $hasproto ;;
13616         *)      ;;
13617         esac
13618         case "$d_gethostbyname_r_proto" in
13619         define)
13620         case "$gethostbyname_r_proto" in
13621         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13622         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13623         esac
13624         case "$gethostbyname_r_proto" in
13625         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13626         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13627         esac
13628         case "$gethostbyname_r_proto" in
13629         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13630         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13631         esac
13632         case "$gethostbyname_r_proto" in
13633         ''|0)   d_gethostbyname_r=undef
13634                 gethostbyname_r_proto=0
13635                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13636         * )     case "$gethostbyname_r_proto" in
13637                 REENTRANT_PROTO*) ;;
13638                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13639                 esac
13640                 echo "Prototype: $try" ;;
13641         esac
13642         ;;
13643         *)      case "$usethreads" in
13644                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13645                 esac
13646                 d_gethostbyname_r=undef
13647                 gethostbyname_r_proto=0
13648                 ;;
13649         esac
13650         ;;
13651 *)      gethostbyname_r_proto=0
13652         ;;
13653 esac
13654
13655 : see if gethostent_r exists
13656 set gethostent_r d_gethostent_r
13657 eval $inlibc
13658 case "$d_gethostent_r" in
13659 "$define")
13660         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13661         case "$d_gethostent_r_proto:$usethreads" in
13662         ":define")      d_gethostent_r_proto=define
13663                 set d_gethostent_r_proto gethostent_r $hdrs
13664                 eval $hasproto ;;
13665         *)      ;;
13666         esac
13667         case "$d_gethostent_r_proto" in
13668         define)
13669         case "$gethostent_r_proto" in
13670         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13671         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13672         esac
13673         case "$gethostent_r_proto" in
13674         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13675         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13676         esac
13677         case "$gethostent_r_proto" in
13678         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13679         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13680         esac
13681         case "$gethostent_r_proto" in
13682         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13683         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13684         esac
13685         case "$gethostent_r_proto" in
13686         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13687         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13688         esac
13689         case "$gethostent_r_proto" in
13690         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13691         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13692         esac
13693         case "$gethostent_r_proto" in
13694         ''|0)   d_gethostent_r=undef
13695                 gethostent_r_proto=0
13696                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13697         * )     case "$gethostent_r_proto" in
13698                 REENTRANT_PROTO*) ;;
13699                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13700                 esac
13701                 echo "Prototype: $try" ;;
13702         esac
13703         ;;
13704         *)      case "$usethreads" in
13705                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13706                 esac
13707                 d_gethostent_r=undef
13708                 gethostent_r_proto=0
13709                 ;;
13710         esac
13711         ;;
13712 *)      gethostent_r_proto=0
13713         ;;
13714 esac
13715
13716 : see if prototypes for various gethostxxx netdb.h functions are available
13717 echo " "
13718 set d_gethostprotos gethostent $i_netdb netdb.h
13719 eval $hasproto
13720
13721 : see if getitimer exists
13722 set getitimer d_getitimer
13723 eval $inlibc
13724
13725 : see if getlogin exists
13726 set getlogin d_getlogin
13727 eval $inlibc
13728
13729 : see if getlogin_r exists
13730 set getlogin_r d_getlogin_r
13731 eval $inlibc
13732 case "$d_getlogin_r" in
13733 "$define")
13734         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13735         case "$d_getlogin_r_proto:$usethreads" in
13736         ":define")      d_getlogin_r_proto=define
13737                 set d_getlogin_r_proto getlogin_r $hdrs
13738                 eval $hasproto ;;
13739         *)      ;;
13740         esac
13741         case "$d_getlogin_r_proto" in
13742         define)
13743         case "$getlogin_r_proto" in
13744         ''|0) try='int getlogin_r(char*, size_t);'
13745         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13746         esac
13747         case "$getlogin_r_proto" in
13748         ''|0) try='int getlogin_r(char*, int);'
13749         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13750         esac
13751         case "$getlogin_r_proto" in
13752         ''|0) try='char* getlogin_r(char*, size_t);'
13753         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13754         esac
13755         case "$getlogin_r_proto" in
13756         ''|0) try='char* getlogin_r(char*, int);'
13757         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13758         esac
13759         case "$getlogin_r_proto" in
13760         ''|0)   d_getlogin_r=undef
13761                 getlogin_r_proto=0
13762                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13763         * )     case "$getlogin_r_proto" in
13764                 REENTRANT_PROTO*) ;;
13765                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13766                 esac
13767                 echo "Prototype: $try" ;;
13768         esac
13769         ;;
13770         *)      case "$usethreads" in
13771                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13772                 esac
13773                 d_getlogin_r=undef
13774                 getlogin_r_proto=0
13775                 ;;
13776         esac
13777         ;;
13778 *)      getlogin_r_proto=0
13779         ;;
13780 esac
13781
13782 : see if getmnt exists
13783 set getmnt d_getmnt
13784 eval $inlibc
13785
13786 : see if getmntent exists
13787 set getmntent d_getmntent
13788 eval $inlibc
13789
13790 : see if getnetbyaddr exists
13791 set getnetbyaddr d_getnbyaddr
13792 eval $inlibc
13793
13794 : see if getnetbyname exists
13795 set getnetbyname d_getnbyname
13796 eval $inlibc
13797
13798 : see if getnetent exists
13799 set getnetent d_getnent
13800 eval $inlibc
13801
13802 : see if getnetbyaddr_r exists
13803 set getnetbyaddr_r d_getnetbyaddr_r
13804 eval $inlibc
13805 case "$d_getnetbyaddr_r" in
13806 "$define")
13807         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13808         case "$d_getnetbyaddr_r_proto:$usethreads" in
13809         ":define")      d_getnetbyaddr_r_proto=define
13810                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13811                 eval $hasproto ;;
13812         *)      ;;
13813         esac
13814         case "$d_getnetbyaddr_r_proto" in
13815         define)
13816         case "$getnetbyaddr_r_proto" in
13817         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13818         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13819         esac
13820         case "$getnetbyaddr_r_proto" in
13821         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13822         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13823         esac
13824         case "$getnetbyaddr_r_proto" in
13825         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13826         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13827         esac
13828         case "$getnetbyaddr_r_proto" in
13829         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13830         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13831         esac
13832         case "$getnetbyaddr_r_proto" in
13833         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13834         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13835         esac
13836         case "$getnetbyaddr_r_proto" in
13837         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13838         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13839         esac
13840         case "$getnetbyaddr_r_proto" in
13841         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13842         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13843         esac
13844         case "$getnetbyaddr_r_proto" in
13845         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13846         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13847         esac
13848         case "$getnetbyaddr_r_proto" in
13849         ''|0)   d_getnetbyaddr_r=undef
13850                 getnetbyaddr_r_proto=0
13851                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13852         * )     case "$getnetbyaddr_r_proto" in
13853                 REENTRANT_PROTO*) ;;
13854                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13855                 esac
13856                 echo "Prototype: $try" ;;
13857         esac
13858         ;;
13859         *)      case "$usethreads" in
13860                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13861                 esac
13862                 d_getnetbyaddr_r=undef
13863                 getnetbyaddr_r_proto=0
13864                 ;;
13865         esac
13866         ;;
13867 *)      getnetbyaddr_r_proto=0
13868         ;;
13869 esac
13870
13871 : see if getnetbyname_r exists
13872 set getnetbyname_r d_getnetbyname_r
13873 eval $inlibc
13874 case "$d_getnetbyname_r" in
13875 "$define")
13876         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13877         case "$d_getnetbyname_r_proto:$usethreads" in
13878         ":define")      d_getnetbyname_r_proto=define
13879                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13880                 eval $hasproto ;;
13881         *)      ;;
13882         esac
13883         case "$d_getnetbyname_r_proto" in
13884         define)
13885         case "$getnetbyname_r_proto" in
13886         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13887         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13888         esac
13889         case "$getnetbyname_r_proto" in
13890         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13891         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13892         esac
13893         case "$getnetbyname_r_proto" in
13894         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13895         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13896         esac
13897         case "$getnetbyname_r_proto" in
13898         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13899         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13900         esac
13901         case "$getnetbyname_r_proto" in
13902         ''|0)   d_getnetbyname_r=undef
13903                 getnetbyname_r_proto=0
13904                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13905         * )     case "$getnetbyname_r_proto" in
13906                 REENTRANT_PROTO*) ;;
13907                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13908                 esac
13909                 echo "Prototype: $try" ;;
13910         esac
13911         ;;
13912         *)      case "$usethreads" in
13913                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13914                 esac
13915                 d_getnetbyname_r=undef
13916                 getnetbyname_r_proto=0
13917                 ;;
13918         esac
13919         ;;
13920 *)      getnetbyname_r_proto=0
13921         ;;
13922 esac
13923
13924 : see if getnetent_r exists
13925 set getnetent_r d_getnetent_r
13926 eval $inlibc
13927 case "$d_getnetent_r" in
13928 "$define")
13929         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13930         case "$d_getnetent_r_proto:$usethreads" in
13931         ":define")      d_getnetent_r_proto=define
13932                 set d_getnetent_r_proto getnetent_r $hdrs
13933                 eval $hasproto ;;
13934         *)      ;;
13935         esac
13936         case "$d_getnetent_r_proto" in
13937         define)
13938         case "$getnetent_r_proto" in
13939         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13940         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13941         esac
13942         case "$getnetent_r_proto" in
13943         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13944         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13945         esac
13946         case "$getnetent_r_proto" in
13947         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13948         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13949         esac
13950         case "$getnetent_r_proto" in
13951         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13952         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13953         esac
13954         case "$getnetent_r_proto" in
13955         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13956         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13957         esac
13958         case "$getnetent_r_proto" in
13959         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13960         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13961         esac
13962         case "$getnetent_r_proto" in
13963         ''|0)   d_getnetent_r=undef
13964                 getnetent_r_proto=0
13965                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13966         * )     case "$getnetent_r_proto" in
13967                 REENTRANT_PROTO*) ;;
13968                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13969                 esac
13970                 echo "Prototype: $try" ;;
13971         esac
13972         ;;
13973         *)      case "$usethreads" in
13974                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13975                 esac
13976                 d_getnetent_r=undef
13977                 getnetent_r_proto=0
13978                 ;;
13979         esac
13980         ;;
13981 *)      getnetent_r_proto=0
13982         ;;
13983 esac
13984
13985 : see if prototypes for various getnetxxx netdb.h functions are available
13986 echo " "
13987 set d_getnetprotos getnetent $i_netdb netdb.h
13988 eval $hasproto
13989
13990 : see if getpagesize exists
13991 set getpagesize d_getpagsz
13992 eval $inlibc
13993
13994 : Optional checks for getprotobyname and getprotobynumber
13995
13996 : see if getprotobyname exists
13997 set getprotobyname d_getpbyname
13998 eval $inlibc
13999
14000 : see if getprotobynumber exists
14001 set getprotobynumber d_getpbynumber
14002 eval $inlibc
14003
14004 : see if getprotoent exists
14005 set getprotoent d_getpent
14006 eval $inlibc
14007
14008 : see if getpgid exists
14009 set getpgid d_getpgid
14010 eval $inlibc
14011
14012 : see if getpgrp2 exists
14013 set getpgrp2 d_getpgrp2
14014 eval $inlibc
14015
14016 : see if getppid exists
14017 set getppid d_getppid
14018 eval $inlibc
14019
14020 : see if getpriority exists
14021 set getpriority d_getprior
14022 eval $inlibc
14023
14024 : see if getprotobyname_r exists
14025 set getprotobyname_r d_getprotobyname_r
14026 eval $inlibc
14027 case "$d_getprotobyname_r" in
14028 "$define")
14029         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14030         case "$d_getprotobyname_r_proto:$usethreads" in
14031         ":define")      d_getprotobyname_r_proto=define
14032                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14033                 eval $hasproto ;;
14034         *)      ;;
14035         esac
14036         case "$d_getprotobyname_r_proto" in
14037         define)
14038         case "$getprotobyname_r_proto" in
14039         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14040         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14041         esac
14042         case "$getprotobyname_r_proto" in
14043         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14044         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14045         esac
14046         case "$getprotobyname_r_proto" in
14047         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14048         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14049         esac
14050         case "$getprotobyname_r_proto" in
14051         ''|0)   d_getprotobyname_r=undef
14052                 getprotobyname_r_proto=0
14053                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14054         * )     case "$getprotobyname_r_proto" in
14055                 REENTRANT_PROTO*) ;;
14056                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14057                 esac
14058                 echo "Prototype: $try" ;;
14059         esac
14060         ;;
14061         *)      case "$usethreads" in
14062                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14063                 esac
14064                 d_getprotobyname_r=undef
14065                 getprotobyname_r_proto=0
14066                 ;;
14067         esac
14068         ;;
14069 *)      getprotobyname_r_proto=0
14070         ;;
14071 esac
14072
14073 : see if getprotobynumber_r exists
14074 set getprotobynumber_r d_getprotobynumber_r
14075 eval $inlibc
14076 case "$d_getprotobynumber_r" in
14077 "$define")
14078         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14079         case "$d_getprotobynumber_r_proto:$usethreads" in
14080         ":define")      d_getprotobynumber_r_proto=define
14081                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14082                 eval $hasproto ;;
14083         *)      ;;
14084         esac
14085         case "$d_getprotobynumber_r_proto" in
14086         define)
14087         case "$getprotobynumber_r_proto" in
14088         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14089         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14090         esac
14091         case "$getprotobynumber_r_proto" in
14092         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14093         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14094         esac
14095         case "$getprotobynumber_r_proto" in
14096         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14097         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14098         esac
14099         case "$getprotobynumber_r_proto" in
14100         ''|0)   d_getprotobynumber_r=undef
14101                 getprotobynumber_r_proto=0
14102                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14103         * )     case "$getprotobynumber_r_proto" in
14104                 REENTRANT_PROTO*) ;;
14105                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14106                 esac
14107                 echo "Prototype: $try" ;;
14108         esac
14109         ;;
14110         *)      case "$usethreads" in
14111                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14112                 esac
14113                 d_getprotobynumber_r=undef
14114                 getprotobynumber_r_proto=0
14115                 ;;
14116         esac
14117         ;;
14118 *)      getprotobynumber_r_proto=0
14119         ;;
14120 esac
14121
14122 : see if getprotoent_r exists
14123 set getprotoent_r d_getprotoent_r
14124 eval $inlibc
14125 case "$d_getprotoent_r" in
14126 "$define")
14127         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14128         case "$d_getprotoent_r_proto:$usethreads" in
14129         ":define")      d_getprotoent_r_proto=define
14130                 set d_getprotoent_r_proto getprotoent_r $hdrs
14131                 eval $hasproto ;;
14132         *)      ;;
14133         esac
14134         case "$d_getprotoent_r_proto" in
14135         define)
14136         case "$getprotoent_r_proto" in
14137         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14138         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14139         esac
14140         case "$getprotoent_r_proto" in
14141         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14142         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14143         esac
14144         case "$getprotoent_r_proto" in
14145         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14146         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14147         esac
14148         case "$getprotoent_r_proto" in
14149         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14150         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
14151         esac
14152         case "$getprotoent_r_proto" in
14153         ''|0)   d_getprotoent_r=undef
14154                 getprotoent_r_proto=0
14155                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14156         * )     case "$getprotoent_r_proto" in
14157                 REENTRANT_PROTO*) ;;
14158                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14159                 esac
14160                 echo "Prototype: $try" ;;
14161         esac
14162         ;;
14163         *)      case "$usethreads" in
14164                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14165                 esac
14166                 d_getprotoent_r=undef
14167                 getprotoent_r_proto=0
14168                 ;;
14169         esac
14170         ;;
14171 *)      getprotoent_r_proto=0
14172         ;;
14173 esac
14174
14175 : see if prototypes for various getprotoxxx netdb.h functions are available
14176 echo " "
14177 set d_getprotoprotos getprotoent $i_netdb netdb.h
14178 eval $hasproto
14179
14180 : see if getprpwnam exists
14181 set getprpwnam d_getprpwnam
14182 eval $inlibc
14183
14184 : see if getpwent exists
14185 set getpwent d_getpwent
14186 eval $inlibc
14187
14188 : see if getpwent_r exists
14189 set getpwent_r d_getpwent_r
14190 eval $inlibc
14191 case "$d_getpwent_r" in
14192 "$define")
14193         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14194         case "$d_getpwent_r_proto:$usethreads" in
14195         ":define")      d_getpwent_r_proto=define
14196                 set d_getpwent_r_proto getpwent_r $hdrs
14197                 eval $hasproto ;;
14198         *)      ;;
14199         esac
14200         case "$d_getpwent_r_proto" in
14201         define)
14202         case "$getpwent_r_proto" in
14203         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14204         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14205         esac
14206         case "$getpwent_r_proto" in
14207         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14208         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14209         esac
14210         case "$getpwent_r_proto" in
14211         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14212         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
14213         esac
14214         case "$getpwent_r_proto" in
14215         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14216         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
14217         esac
14218         case "$getpwent_r_proto" in
14219         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14220         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
14221         esac
14222         case "$getpwent_r_proto" in
14223         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14224         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14225         esac
14226         case "$getpwent_r_proto" in
14227         ''|0)   d_getpwent_r=undef
14228                 getpwent_r_proto=0
14229                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14230         * )     case "$getpwent_r_proto" in
14231                 REENTRANT_PROTO*) ;;
14232                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14233                 esac
14234                 echo "Prototype: $try" ;;
14235         esac
14236         ;;
14237         *)      case "$usethreads" in
14238                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14239                 esac
14240                 d_getpwent_r=undef
14241                 getpwent_r_proto=0
14242                 ;;
14243         esac
14244         ;;
14245 *)      getpwent_r_proto=0
14246         ;;
14247 esac
14248
14249 : see if getpwnam_r exists
14250 set getpwnam_r d_getpwnam_r
14251 eval $inlibc
14252 case "$d_getpwnam_r" in
14253 "$define")
14254         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14255         case "$d_getpwnam_r_proto:$usethreads" in
14256         ":define")      d_getpwnam_r_proto=define
14257                 set d_getpwnam_r_proto getpwnam_r $hdrs
14258                 eval $hasproto ;;
14259         *)      ;;
14260         esac
14261         case "$d_getpwnam_r_proto" in
14262         define)
14263         case "$getpwnam_r_proto" in
14264         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14265         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14266         esac
14267         case "$getpwnam_r_proto" in
14268         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14269         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14270         esac
14271         case "$getpwnam_r_proto" in
14272         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14273         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14274         esac
14275         case "$getpwnam_r_proto" in
14276         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14277         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14278         esac
14279         case "$getpwnam_r_proto" in
14280         ''|0)   d_getpwnam_r=undef
14281                 getpwnam_r_proto=0
14282                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14283         * )     case "$getpwnam_r_proto" in
14284                 REENTRANT_PROTO*) ;;
14285                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14286                 esac
14287                 echo "Prototype: $try" ;;
14288         esac
14289         ;;
14290         *)      case "$usethreads" in
14291                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14292                 esac
14293                 d_getpwnam_r=undef
14294                 getpwnam_r_proto=0
14295                 ;;
14296         esac
14297         ;;
14298 *)      getpwnam_r_proto=0
14299         ;;
14300 esac
14301
14302 : see if getpwuid_r exists
14303 set getpwuid_r d_getpwuid_r
14304 eval $inlibc
14305 case "$d_getpwuid_r" in
14306 "$define")
14307         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14308         case "$d_getpwuid_r_proto:$usethreads" in
14309         ":define")      d_getpwuid_r_proto=define
14310                 set d_getpwuid_r_proto getpwuid_r $hdrs
14311                 eval $hasproto ;;
14312         *)      ;;
14313         esac
14314         case "$d_getpwuid_r_proto" in
14315         define)
14316         case "$getpwuid_r_proto" in
14317         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14318         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14319         esac
14320         case "$getpwuid_r_proto" in
14321         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14322         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14323         esac
14324         case "$getpwuid_r_proto" in
14325         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14326         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14327         esac
14328         case "$getpwuid_r_proto" in
14329         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14330         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14331         esac
14332         case "$getpwuid_r_proto" in
14333         ''|0)   d_getpwuid_r=undef
14334                 getpwuid_r_proto=0
14335                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14336         * )     case "$getpwuid_r_proto" in
14337                 REENTRANT_PROTO*) ;;
14338                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14339                 esac
14340                 echo "Prototype: $try" ;;
14341         esac
14342         ;;
14343         *)      case "$usethreads" in
14344                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14345                 esac
14346                 d_getpwuid_r=undef
14347                 getpwuid_r_proto=0
14348                 ;;
14349         esac
14350         ;;
14351 *)      getpwuid_r_proto=0
14352         ;;
14353 esac
14354
14355 : Optional checks for getsbyname and getsbyport
14356
14357 : see if getservbyname exists
14358 set getservbyname d_getsbyname
14359 eval $inlibc
14360
14361 : see if getservbyport exists
14362 set getservbyport d_getsbyport
14363 eval $inlibc
14364
14365 : see if getservent exists
14366 set getservent d_getsent
14367 eval $inlibc
14368
14369 : see if getservbyname_r exists
14370 set getservbyname_r d_getservbyname_r
14371 eval $inlibc
14372 case "$d_getservbyname_r" in
14373 "$define")
14374         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14375         case "$d_getservbyname_r_proto:$usethreads" in
14376         ":define")      d_getservbyname_r_proto=define
14377                 set d_getservbyname_r_proto getservbyname_r $hdrs
14378                 eval $hasproto ;;
14379         *)      ;;
14380         esac
14381         case "$d_getservbyname_r_proto" in
14382         define)
14383         case "$getservbyname_r_proto" in
14384         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14385         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14386         esac
14387         case "$getservbyname_r_proto" in
14388         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14389         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14390         esac
14391         case "$getservbyname_r_proto" in
14392         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14393         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14394         esac
14395         case "$getservbyname_r_proto" in
14396         ''|0)   d_getservbyname_r=undef
14397                 getservbyname_r_proto=0
14398                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14399         * )     case "$getservbyname_r_proto" in
14400                 REENTRANT_PROTO*) ;;
14401                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14402                 esac
14403                 echo "Prototype: $try" ;;
14404         esac
14405         ;;
14406         *)      case "$usethreads" in
14407                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14408                 esac
14409                 d_getservbyname_r=undef
14410                 getservbyname_r_proto=0
14411                 ;;
14412         esac
14413         ;;
14414 *)      getservbyname_r_proto=0
14415         ;;
14416 esac
14417
14418 : see if getservbyport_r exists
14419 set getservbyport_r d_getservbyport_r
14420 eval $inlibc
14421 case "$d_getservbyport_r" in
14422 "$define")
14423         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14424         case "$d_getservbyport_r_proto:$usethreads" in
14425         ":define")      d_getservbyport_r_proto=define
14426                 set d_getservbyport_r_proto getservbyport_r $hdrs
14427                 eval $hasproto ;;
14428         *)      ;;
14429         esac
14430         case "$d_getservbyport_r_proto" in
14431         define)
14432         case "$getservbyport_r_proto" in
14433         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14434         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14435         esac
14436         case "$getservbyport_r_proto" in
14437         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14438         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14439         esac
14440         case "$getservbyport_r_proto" in
14441         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14442         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14443         esac
14444         case "$getservbyport_r_proto" in
14445         ''|0)   d_getservbyport_r=undef
14446                 getservbyport_r_proto=0
14447                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14448         * )     case "$getservbyport_r_proto" in
14449                 REENTRANT_PROTO*) ;;
14450                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14451                 esac
14452                 echo "Prototype: $try" ;;
14453         esac
14454         ;;
14455         *)      case "$usethreads" in
14456                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14457                 esac
14458                 d_getservbyport_r=undef
14459                 getservbyport_r_proto=0
14460                 ;;
14461         esac
14462         ;;
14463 *)      getservbyport_r_proto=0
14464         ;;
14465 esac
14466
14467 : see if getservent_r exists
14468 set getservent_r d_getservent_r
14469 eval $inlibc
14470 case "$d_getservent_r" in
14471 "$define")
14472         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14473         case "$d_getservent_r_proto:$usethreads" in
14474         ":define")      d_getservent_r_proto=define
14475                 set d_getservent_r_proto getservent_r $hdrs
14476                 eval $hasproto ;;
14477         *)      ;;
14478         esac
14479         case "$d_getservent_r_proto" in
14480         define)
14481         case "$getservent_r_proto" in
14482         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14483         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
14484         esac
14485         case "$getservent_r_proto" in
14486         ''|0) try='int getservent_r(struct servent*, char*, int);'
14487         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
14488         esac
14489         case "$getservent_r_proto" in
14490         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14491         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
14492         esac
14493         case "$getservent_r_proto" in
14494         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14495         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
14496         esac
14497         case "$getservent_r_proto" in
14498         ''|0)   d_getservent_r=undef
14499                 getservent_r_proto=0
14500                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14501         * )     case "$getservent_r_proto" in
14502                 REENTRANT_PROTO*) ;;
14503                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14504                 esac
14505                 echo "Prototype: $try" ;;
14506         esac
14507         ;;
14508         *)      case "$usethreads" in
14509                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14510                 esac
14511                 d_getservent_r=undef
14512                 getservent_r_proto=0
14513                 ;;
14514         esac
14515         ;;
14516 *)      getservent_r_proto=0
14517         ;;
14518 esac
14519
14520 : see if prototypes for various getservxxx netdb.h functions are available
14521 echo " "
14522 set d_getservprotos getservent $i_netdb netdb.h
14523 eval $hasproto
14524
14525 : see if getspnam exists
14526 set getspnam d_getspnam
14527 eval $inlibc
14528
14529 : see if this is a shadow.h system
14530 set shadow.h i_shadow
14531 eval $inhdr
14532
14533 : see if getspnam_r exists
14534 set getspnam_r d_getspnam_r
14535 eval $inlibc
14536 case "$d_getspnam_r" in
14537 "$define")
14538         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14539         case "$d_getspnam_r_proto:$usethreads" in
14540         ":define")      d_getspnam_r_proto=define
14541                 set d_getspnam_r_proto getspnam_r $hdrs
14542                 eval $hasproto ;;
14543         *)      ;;
14544         esac
14545         case "$d_getspnam_r_proto" in
14546         define)
14547         case "$getspnam_r_proto" in
14548         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14549         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14550         esac
14551         case "$getspnam_r_proto" in
14552         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14553         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14554         esac
14555         case "$getspnam_r_proto" in
14556         ''|0)   d_getspnam_r=undef
14557                 getspnam_r_proto=0
14558                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14559         * )     case "$getspnam_r_proto" in
14560                 REENTRANT_PROTO*) ;;
14561                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14562                 esac
14563                 echo "Prototype: $try" ;;
14564         esac
14565         ;;
14566         *)      case "$usethreads" in
14567                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14568                 esac
14569                 d_getspnam_r=undef
14570                 getspnam_r_proto=0
14571                 ;;
14572         esac
14573         ;;
14574 *)      getspnam_r_proto=0
14575         ;;
14576 esac
14577
14578 : see if gettimeofday or ftime exists
14579 set gettimeofday d_gettimeod
14580 eval $inlibc
14581 case "$d_gettimeod" in
14582 "$undef")
14583         set ftime d_ftime 
14584         eval $inlibc
14585         ;;
14586 *)
14587         val="$undef"; set d_ftime; eval $setvar
14588         ;;
14589 esac
14590 case "$d_gettimeod$d_ftime" in
14591 "$undef$undef")
14592         echo " "
14593         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14594         ;;
14595 esac
14596
14597 : see if gmtime_r exists
14598 set gmtime_r d_gmtime_r
14599 eval $inlibc
14600 case "$d_gmtime_r" in
14601 "$define")
14602         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14603         case "$d_gmtime_r_proto:$usethreads" in
14604         ":define")      d_gmtime_r_proto=define
14605                 set d_gmtime_r_proto gmtime_r $hdrs
14606                 eval $hasproto ;;
14607         *)      ;;
14608         esac
14609         case "$d_gmtime_r_proto" in
14610         define)
14611         case "$gmtime_r_proto" in
14612         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14613         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14614         esac
14615         case "$gmtime_r_proto" in
14616         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14617         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14618         esac
14619         case "$gmtime_r_proto" in
14620         ''|0)   d_gmtime_r=undef
14621                 gmtime_r_proto=0
14622                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14623         * )     case "$gmtime_r_proto" in
14624                 REENTRANT_PROTO*) ;;
14625                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14626                 esac
14627                 echo "Prototype: $try" ;;
14628         esac
14629         ;;
14630         *)      case "$usethreads" in
14631                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14632                 esac
14633                 d_gmtime_r=undef
14634                 gmtime_r_proto=0
14635                 ;;
14636         esac
14637         ;;
14638 *)      gmtime_r_proto=0
14639         ;;
14640 esac
14641
14642 : see if hasmntopt exists
14643 set hasmntopt d_hasmntopt
14644 eval $inlibc
14645
14646 : see if this is a netinet/in.h or sys/in.h system
14647 set netinet/in.h i_niin sys/in.h i_sysin
14648 eval $inhdr
14649
14650 : see if arpa/inet.h has to be included
14651 set arpa/inet.h i_arpainet
14652 eval $inhdr
14653
14654 : see if htonl --and friends-- exists
14655 val=''
14656 set htonl val
14657 eval $inlibc
14658
14659 : Maybe they are macros.
14660 case "$val" in
14661 $undef)
14662         $cat >htonl.c <<EOM
14663 #include <stdio.h>
14664 #include <sys/types.h>
14665 #$i_niin I_NETINET_IN
14666 #$i_sysin I_SYS_IN
14667 #$i_arpainet I_ARPA_INET
14668 #ifdef I_NETINET_IN
14669 #include <netinet/in.h>
14670 #endif
14671 #ifdef I_SYS_IN
14672 #include <sys/in.h>
14673 #endif
14674 #ifdef I_ARPA_INET
14675 #include <arpa/inet.h>
14676 #endif
14677 #ifdef htonl
14678 printf("Defined as a macro.");
14679 #endif
14680 EOM
14681         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14682         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14683                 val="$define"
14684                 echo "But it seems to be defined as a macro." >&4
14685         fi
14686         $rm -f htonl.?
14687         ;;
14688 esac
14689 set d_htonl
14690 eval $setvar
14691
14692 : see if ilogbl exists
14693 set ilogbl d_ilogbl
14694 eval $inlibc
14695
14696 : index or strchr
14697 echo " "
14698 if set index val -f; eval $csym; $val; then
14699         if set strchr val -f d_strchr; eval $csym; $val; then
14700                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14701                         val="$define"
14702                         vali="$undef"
14703                         echo "strchr() found." >&4
14704                 else
14705                         val="$undef"
14706                         vali="$define"
14707                         echo "index() found." >&4
14708                 fi
14709         else
14710                 val="$undef"
14711                 vali="$define"
14712                 echo "index() found." >&4
14713         fi
14714 else
14715         if set strchr val -f d_strchr; eval $csym; $val; then
14716                 val="$define"
14717                 vali="$undef"
14718                 echo "strchr() found." >&4
14719         else
14720                 echo "No index() or strchr() found!" >&4
14721                 val="$undef"
14722                 vali="$undef"
14723         fi
14724 fi
14725 set d_strchr; eval $setvar
14726 val="$vali"
14727 set d_index; eval $setvar
14728
14729 : check whether inet_aton exists
14730 set inet_aton d_inetaton
14731 eval $inlibc
14732
14733 : Look for isascii
14734 echo " "
14735 $cat >isascii.c <<EOCP
14736 #include <stdio.h>
14737 #include <ctype.h>
14738 #$i_stdlib I_STDLIB
14739 #ifdef I_STDLIB
14740 #include <stdlib.h>
14741 #endif
14742 int main() {
14743         int c = 'A';
14744         if (isascii(c))
14745                 exit(0);
14746         else
14747                 exit(1);
14748 }
14749 EOCP
14750 set isascii
14751 if eval $compile; then
14752         echo "isascii() found." >&4
14753         val="$define"
14754 else
14755         echo "isascii() NOT found." >&4
14756         val="$undef"
14757 fi
14758 set d_isascii
14759 eval $setvar
14760 $rm -f isascii*
14761
14762 : see if isfinite exists
14763 set isfinite d_isfinite
14764 eval $inlibc
14765
14766 : see if isinf exists
14767 set isinf d_isinf
14768 eval $inlibc
14769
14770 : see if isnan exists
14771 set isnan d_isnan
14772 eval $inlibc
14773
14774 : see if isnanl exists
14775 set isnanl d_isnanl
14776 eval $inlibc
14777
14778 : see if killpg exists
14779 set killpg d_killpg
14780 eval $inlibc
14781
14782 : see if lchown exists
14783 echo " "
14784 $cat > try.c <<'EOCP'
14785 /* System header to define __stub macros and hopefully few prototypes,
14786     which can conflict with char lchown(); below.  */
14787 #include <assert.h>
14788 /* Override any gcc2 internal prototype to avoid an error.  */
14789 /* We use char because int might match the return type of a gcc2
14790    builtin and then its argument prototype would still apply.  */
14791 char lchown();
14792 int main() {
14793     /*  The GNU C library defines this for functions which it implements
14794         to always fail with ENOSYS.  Some functions are actually named
14795         something starting with __ and the normal name is an alias.  */
14796 #if defined (__stub_lchown) || defined (__stub___lchown)
14797 choke me
14798 #else
14799 lchown();
14800 #endif
14801 ; return 0; }
14802 EOCP
14803 set try
14804 if eval $compile; then
14805     $echo "lchown() found." >&4
14806     val="$define"
14807 else
14808     $echo "lchown() NOT found." >&4
14809     val="$undef"
14810 fi
14811 set d_lchown
14812 eval $setvar
14813
14814 : See if number of significant digits in a double precision number is known
14815 echo " "
14816 $cat >ldbl_dig.c <<EOM
14817 #$i_limits I_LIMITS
14818 #$i_float I_FLOAT
14819 #ifdef I_LIMITS
14820 #include <limits.h>
14821 #endif
14822 #ifdef I_FLOAT
14823 #include <float.h>
14824 #endif
14825 #ifdef LDBL_DIG
14826 printf("Contains LDBL_DIG");
14827 #endif
14828 EOM
14829 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14830 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14831         echo "LDBL_DIG found." >&4
14832         val="$define"
14833 else
14834         echo "LDBL_DIG NOT found." >&4
14835         val="$undef"
14836 fi
14837 $rm -f ldbl_dig.?
14838 set d_ldbl_dig
14839 eval $setvar
14840
14841 : see if this is a math.h system
14842 set math.h i_math
14843 eval $inhdr
14844
14845 : check to see if math.h defines _LIB_VERSION
14846 d_libm_lib_version="$undef"
14847 case $i_math in
14848     $define)
14849         echo " "
14850         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14851         $cat >try.c <<EOCP
14852 #include <unistd.h>
14853 #include <math.h>
14854 int main (int argc, char *argv[])
14855 {
14856     printf ("%d\n", _LIB_VERSION);
14857     return (0);
14858     } /* main */
14859 EOCP
14860         set try
14861         if eval $compile; then
14862             foo=`$run ./try`
14863             echo "Yes, it does ($foo)" >&4
14864             d_libm_lib_version="$define"
14865         else
14866             echo "No, it does not (probably harmless)" >&4
14867             fi
14868         $rm_try
14869         ;;
14870
14871     esac
14872
14873 : see if link exists
14874 set link d_link
14875 eval $inlibc
14876
14877 : see if localtime_r exists
14878 set localtime_r d_localtime_r
14879 eval $inlibc
14880 case "$d_localtime_r" in
14881 "$define")
14882         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14883         case "$d_localtime_r_proto:$usethreads" in
14884         ":define")      d_localtime_r_proto=define
14885                 set d_localtime_r_proto localtime_r $hdrs
14886                 eval $hasproto ;;
14887         *)      ;;
14888         esac
14889         case "$d_localtime_r_proto" in
14890         define)
14891         case "$localtime_r_proto" in
14892         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14893         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14894         esac
14895         case "$localtime_r_proto" in
14896         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14897         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14898         esac
14899         case "$localtime_r_proto" in
14900         ''|0)   d_localtime_r=undef
14901                 localtime_r_proto=0
14902                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14903         * )     case "$localtime_r_proto" in
14904                 REENTRANT_PROTO*) ;;
14905                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14906                 esac
14907                 echo "Prototype: $try" ;;
14908         esac
14909         ;;
14910         *)      case "$usethreads" in
14911                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14912                 esac
14913                 d_localtime_r=undef
14914                 localtime_r_proto=0
14915                 ;;
14916         esac
14917         ;;
14918 *)      localtime_r_proto=0
14919         ;;
14920 esac
14921
14922 : see if localtime_r calls tzset
14923 case "$localtime_r_proto" in
14924 REENTRANT_PROTO*)
14925         $cat >try.c <<EOCP
14926 /*  Does our libc's localtime_r call tzset ?
14927  *  return 0 if so, 1 otherwise.
14928  */
14929 #include <sys/types.h>
14930 #include <unistd.h>
14931 #include <time.h>
14932 #include <string.h>
14933 #include <malloc.h>
14934 int main()
14935 {
14936     time_t t = time(0L);
14937     char w_tz[]="TZ" "=GMT+5",
14938          e_tz[]="TZ" "=GMT-5",
14939         *tz_e = (char*)malloc(16),
14940         *tz_w = (char*)malloc(16);
14941     struct tm tm_e, tm_w;
14942     memset(&tm_e,'\0',sizeof(struct tm));
14943     memset(&tm_w,'\0',sizeof(struct tm));
14944     strcpy(tz_e,e_tz);
14945     strcpy(tz_w,w_tz);
14946
14947     putenv(tz_e);
14948     localtime_r(&t, &tm_e);
14949
14950     putenv(tz_w);
14951     localtime_r(&t, &tm_w);
14952
14953     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
14954         return 1;
14955     return 0;
14956 }
14957 EOCP
14958         set try
14959         if eval $compile; then
14960             if $run ./try; then
14961                 d_localtime_r_needs_tzset=undef;
14962             else
14963                 d_localtime_r_needs_tzset=define;
14964             fi;
14965         else
14966             d_localtime_r_needs_tzset=undef;
14967         fi;
14968      ;;
14969   *)
14970      d_localtime_r_needs_tzset=undef;
14971      ;;
14972 esac
14973 $rm_try
14974
14975 : see if localeconv exists
14976 set localeconv d_locconv
14977 eval $inlibc
14978
14979 : see if lockf exists
14980 set lockf d_lockf
14981 eval $inlibc
14982
14983 : see if prototype for lseek is available
14984 echo " "
14985 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14986 eval $hasproto
14987
14988 : see if lstat exists
14989 set lstat d_lstat
14990 eval $inlibc
14991
14992 : see if madvise exists
14993 set madvise d_madvise
14994 eval $inlibc
14995
14996 : see if malloc_size exists
14997 set malloc_size d_malloc_size
14998 eval $inlibc
14999
15000 : see if malloc_size_good exists
15001 set malloc_good_size d_malloc_good_size
15002 eval $inlibc
15003
15004 : see if mblen exists
15005 set mblen d_mblen
15006 eval $inlibc
15007
15008 : see if mbstowcs exists
15009 set mbstowcs d_mbstowcs
15010 eval $inlibc
15011
15012 : see if mbtowc exists
15013 set mbtowc d_mbtowc
15014 eval $inlibc
15015
15016 : see if memchr exists
15017 set memchr d_memchr
15018 eval $inlibc
15019
15020 : see if memcmp exists
15021 set memcmp d_memcmp
15022 eval $inlibc
15023
15024 : see if memcpy exists
15025 set memcpy d_memcpy
15026 eval $inlibc
15027
15028 : see if memmove exists
15029 set memmove d_memmove
15030 eval $inlibc
15031
15032 : see if memset exists
15033 set memset d_memset
15034 eval $inlibc
15035
15036 : see if mkdir exists
15037 set mkdir d_mkdir
15038 eval $inlibc
15039
15040 : see if mkdtemp exists
15041 set mkdtemp d_mkdtemp
15042 eval $inlibc
15043
15044 : see if mkfifo exists
15045 set mkfifo d_mkfifo
15046 eval $inlibc
15047
15048 : see if mkstemp exists
15049 set mkstemp d_mkstemp
15050 eval $inlibc
15051
15052 : see if mkstemps exists
15053 set mkstemps d_mkstemps
15054 eval $inlibc
15055
15056 : see if mktime exists
15057 set mktime d_mktime
15058 eval $inlibc
15059
15060 : see if this is a sys/mman.h system
15061 set sys/mman.h i_sysmman
15062 eval $inhdr
15063
15064 : see if mmap exists
15065 set mmap d_mmap
15066 eval $inlibc
15067 : see what shmat returns
15068 : default to something harmless
15069 mmaptype='void *'
15070 case "$i_sysmman$d_mmap" in
15071 "$define$define")
15072         $cat >mmap.c <<'END'
15073 #include <sys/mman.h>
15074 void *mmap();
15075 END
15076         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15077                 mmaptype='void *'
15078         else
15079                 mmaptype='caddr_t'
15080         fi
15081         echo "and it returns ($mmaptype)." >&4
15082         ;;
15083 esac
15084
15085
15086
15087 : see if sqrtl exists
15088 set sqrtl d_sqrtl
15089 eval $inlibc
15090
15091 : see if scalbnl exists
15092 set scalbnl d_scalbnl
15093 eval $inlibc
15094
15095 : see if modfl exists
15096 set modfl d_modfl
15097 eval $inlibc
15098
15099 : see if prototype for modfl is available
15100 echo " "
15101 set d_modflproto modfl $i_math math.h
15102 eval $hasproto
15103
15104 d_modfl_pow32_bug="$undef"
15105
15106 case "$d_longdbl$d_modfl" in
15107 $define$define)
15108         $cat <<EOM
15109 Checking to see whether your modfl() is okay for large values...
15110 EOM
15111 $cat >try.c <<EOCP
15112 #include <math.h>
15113 #include <stdio.h>
15114 EOCP
15115 if $test "X$d_modflproto" != "X$define"; then
15116         $cat >>try.c <<EOCP
15117 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15118 long double modfl (long double, long double *);
15119 EOCP
15120 fi
15121 $cat >>try.c <<EOCP
15122 int main() {
15123     long double nv = 4294967303.15;
15124     long double v, w;
15125     v = modfl(nv, &w);
15126 #ifdef __GLIBC__
15127     printf("glibc");
15128 #endif
15129     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15130     return 0;
15131 }
15132 EOCP
15133         case "$osname:$gccversion" in
15134         aix:)   saveccflags="$ccflags"
15135                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15136         esac
15137         set try
15138         if eval $compile; then
15139                 foo=`$run ./try`
15140                 case "$foo" in
15141                 *" 4294967303.150000 1.150000 4294967302.000000")
15142                         echo >&4 "Your modfl() is broken for large values."
15143                         d_modfl_pow32_bug="$define"
15144                         case "$foo" in
15145                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15146                         ;;
15147                         esac
15148                         ;;
15149                 *" 4294967303.150000 0.150000 4294967303.000000")
15150                         echo >&4 "Your modfl() seems okay for large values."
15151                         ;;
15152                 *)      echo >&4 "I don't understand your modfl() at all."
15153                         d_modfl="$undef"
15154                         ;;
15155                 esac
15156                 $rm_try
15157         else
15158                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15159                 d_modfl="$undef"
15160         fi
15161         case "$osname:$gccversion" in
15162         aix:)   ccflags="$saveccflags" ;; # restore
15163         esac
15164         ;;
15165 esac
15166
15167 if $test "$uselongdouble" = "$define"; then
15168     message=""
15169     if $test "$d_sqrtl" != "$define"; then
15170         message="$message sqrtl"
15171     fi
15172     if $test "$d_modfl" != "$define"; then
15173         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15174             echo "You have both aintl and copysignl, so I can emulate modfl."
15175         else
15176             message="$message modfl"
15177         fi
15178     fi
15179     if $test "$d_frexpl" != "$define"; then
15180         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15181             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15182         else
15183             message="$message frexpl"
15184         fi
15185     fi
15186
15187     if $test "$message" != ""; then
15188         $cat <<EOM >&4
15189
15190 *** You requested the use of long doubles but you do not seem to have
15191 *** the following mathematical functions needed for long double support:
15192 ***    $message
15193 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15194 *** Cannot continue, aborting.
15195
15196 EOM
15197
15198         exit 1
15199     fi
15200 fi
15201
15202 : see if mprotect exists
15203 set mprotect d_mprotect
15204 eval $inlibc
15205
15206 : see if msgctl exists
15207 set msgctl d_msgctl
15208 eval $inlibc
15209
15210 : see if msgget exists
15211 set msgget d_msgget
15212 eval $inlibc
15213
15214 : see if msgsnd exists
15215 set msgsnd d_msgsnd
15216 eval $inlibc
15217
15218 : see if msgrcv exists
15219 set msgrcv d_msgrcv
15220 eval $inlibc
15221
15222 : see how much of the 'msg*(2)' library is present.
15223 h_msg=true
15224 echo " "
15225 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15226 *"$undef"*) h_msg=false;;
15227 esac
15228 case "$osname" in
15229 freebsd)
15230     case "`ipcs 2>&1`" in
15231     "SVID messages"*"not configured"*)
15232         echo "Your $osname does not have the msg*(2) configured." >&4
15233         h_msg=false
15234         val="$undef"
15235         set msgctl d_msgctl
15236         eval $setvar
15237         set msgget d_msgget
15238         eval $setvar
15239         set msgsnd d_msgsnd
15240         eval $setvar
15241         set msgrcv d_msgrcv
15242         eval $setvar
15243         ;;
15244     esac
15245     ;;
15246 esac
15247 : we could also check for sys/ipc.h ...
15248 if $h_msg && $test `./findhdr sys/msg.h`; then
15249         echo "You have the full msg*(2) library." >&4
15250         val="$define"
15251 else
15252         echo "You don't have the full msg*(2) library." >&4
15253         val="$undef"
15254 fi
15255 set d_msg
15256 eval $setvar
15257
15258 : Check for msghdr_s
15259 echo " "
15260 echo "Checking to see if your system supports struct msghdr..." >&4
15261 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15262 eval $hasstruct
15263 case "$d_msghdr_s" in
15264 "$define")      echo "Yes, it does."   ;;
15265 *)              echo "No, it doesn't." ;;
15266 esac
15267
15268
15269 : see if msync exists
15270 set msync d_msync
15271 eval $inlibc
15272
15273 : see if munmap exists
15274 set munmap d_munmap
15275 eval $inlibc
15276
15277 : see if nice exists
15278 set nice d_nice
15279 eval $inlibc
15280
15281 : see if this is a langinfo.h system
15282 set langinfo.h i_langinfo
15283 eval $inhdr
15284
15285 : see if nl_langinfo exists
15286 set nl_langinfo d_nl_langinfo
15287 eval $inlibc
15288
15289 : check for volatile keyword
15290 echo " "
15291 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15292 $cat >try.c <<'EOCP'
15293 int main()
15294 {
15295         typedef struct _goo_struct goo_struct;
15296         goo_struct * volatile goo = ((goo_struct *)0);
15297         struct _goo_struct {
15298                 long long_int;
15299                 int reg_int;
15300                 char char_var;
15301         };
15302         typedef unsigned short foo_t;
15303         char *volatile foo;
15304         volatile int bar;
15305         volatile foo_t blech;
15306         foo = foo;
15307 }
15308 EOCP
15309 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15310         val="$define"
15311         echo "Yup, it does."
15312 else
15313         val="$undef"
15314         echo "Nope, it doesn't."
15315 fi
15316 set d_volatile
15317 eval $setvar
15318 $rm_try
15319
15320 : Check basic sizes
15321 echo " "
15322 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15323
15324 case "$use64bitint:$d_quad:$quadtype" in
15325 define:define:?*)
15326         ivtype="$quadtype"
15327         uvtype="$uquadtype"
15328         ivsize=8
15329         uvsize=8
15330         ;;
15331 *)      ivtype="long"
15332         uvtype="unsigned long"
15333         ivsize=$longsize
15334         uvsize=$longsize
15335         ;;
15336 esac
15337
15338 case "$uselongdouble:$d_longdbl" in
15339 define:define)
15340         nvtype="long double"
15341         nvsize=$longdblsize
15342         ;;
15343 *)      nvtype=double
15344         nvsize=$doublesize
15345         ;;
15346 esac
15347
15348 $echo "(IV will be "$ivtype", $ivsize bytes)"
15349 $echo "(UV will be "$uvtype", $uvsize bytes)"
15350 $echo "(NV will be "$nvtype", $nvsize bytes)"
15351
15352 $cat >try.c <<EOCP
15353 #$i_inttypes I_INTTYPES
15354 #ifdef I_INTTYPES
15355 #include <inttypes.h>
15356 #endif
15357 #include <stdio.h>
15358 int main() {
15359 #ifdef INT8
15360    int8_t i =  INT8_MAX;
15361   uint8_t u = UINT8_MAX;
15362   printf("int8_t\n");
15363 #endif
15364 #ifdef INT16
15365    int16_t i =  INT16_MAX;
15366   uint16_t i = UINT16_MAX;
15367   printf("int16_t\n");
15368 #endif
15369 #ifdef INT32
15370    int32_t i =  INT32_MAX;
15371   uint32_t u = UINT32_MAX;
15372   printf("int32_t\n");
15373 #endif
15374 }
15375 EOCP
15376
15377 i8type="signed char"
15378 u8type="unsigned char"
15379 i8size=1
15380 u8size=1
15381
15382 case "$i16type" in
15383 '')     case "$shortsize" in
15384         2)      i16type=short
15385                 u16type="unsigned short"
15386                 i16size=$shortsize
15387                 u16size=$shortsize
15388                 ;;
15389         esac
15390         ;;
15391 esac
15392 case "$i16type" in
15393 '')     set try -DINT16
15394         if eval $compile; then
15395                 case "`$run ./try`" in
15396                 int16_t)
15397                         i16type=int16_t
15398                         u16type=uint16_t
15399                         i16size=2
15400                         u16size=2
15401                         ;;
15402                 esac
15403         fi
15404         ;;
15405 esac
15406 case "$i16type" in
15407 '')     if $test $shortsize -ge 2; then
15408                 i16type=short
15409                 u16type="unsigned short"
15410                 i16size=$shortsize
15411                 u16size=$shortsize
15412         fi
15413         ;;
15414 esac
15415
15416 case "$i32type" in
15417 '')     case "$longsize" in
15418         4)      i32type=long
15419                 u32type="unsigned long"
15420                 i32size=$longsize
15421                 u32size=$longsize
15422                 ;;
15423         *)      case "$intsize" in
15424                 4)      i32type=int
15425                         u32type="unsigned int"
15426                         i32size=$intsize
15427                         u32size=$intsize
15428                         ;;
15429                 esac
15430                 ;;
15431         esac
15432         ;;
15433 esac
15434 case "$i32type" in
15435 '')     set try -DINT32
15436         if eval $compile; then
15437                 case "`$run ./try`" in
15438                 int32_t)
15439                         i32type=int32_t
15440                         u32type=uint32_t
15441                         i32size=4
15442                         u32size=4
15443                         ;;
15444                 esac
15445         fi
15446         ;;
15447 esac
15448 case "$i32type" in
15449 '')     if $test $intsize -ge 4; then
15450                 i32type=int
15451                 u32type="unsigned int"
15452                 i32size=$intsize
15453                 u32size=$intsize
15454         fi
15455         ;;
15456 esac
15457
15458 case "$i64type" in
15459 '')     case "$d_quad:$quadtype" in
15460         define:?*)
15461                 i64type="$quadtype"
15462                 u64type="$uquadtype"
15463                 i64size=8
15464                 u64size=8
15465                 ;;
15466         esac
15467         ;;
15468 esac
15469
15470 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15471 : volatile so that the compiler has to store it out to memory.
15472 if test X"$d_volatile" = X"$define"; then
15473         volatile=volatile
15474 fi
15475 $cat <<EOP >try.c
15476 #include <stdio.h>
15477 #$i_stdlib I_STDLIB
15478 #ifdef I_STDLIB
15479 #include <stdlib.h>
15480 #endif
15481 #include <sys/types.h>
15482 #include <signal.h>
15483 #ifdef SIGFPE
15484 $volatile int bletched = 0;
15485 $signal_t blech(int s) { bletched = 1; }
15486 #endif
15487 int main() {
15488     $uvtype u = 0;
15489     $nvtype d;
15490     int     n = 8 * $uvsize;
15491     int     i;
15492 #ifdef SIGFPE
15493     signal(SIGFPE, blech);
15494 #endif
15495
15496     for (i = 0; i < n; i++) {
15497       u = u << 1 | ($uvtype)1;
15498       d = ($nvtype)u;
15499       if (($uvtype)d != u)
15500         break;
15501       if (d <= 0)
15502         break;
15503       d = ($nvtype)(u - 1);
15504       if (($uvtype)d != (u - 1))
15505         break;
15506 #ifdef SIGFPE
15507       if (bletched)
15508         break;
15509 #endif
15510     }
15511     printf("%d\n", ((i == n) ? -n : i));
15512     exit(0);
15513 }
15514 EOP
15515 set try
15516
15517 d_nv_preserves_uv="$undef"
15518 if eval $compile; then
15519         nv_preserves_uv_bits="`$run ./try`"
15520 fi
15521 case "$nv_preserves_uv_bits" in
15522 \-[1-9]*)
15523         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15524         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15525         d_nv_preserves_uv="$define"
15526         ;;
15527 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15528         d_nv_preserves_uv="$undef" ;;
15529 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15530         nv_preserves_uv_bits="0" ;;
15531 esac
15532 $rm_try
15533
15534 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15535 : volatile so that the compiler has to store it out to memory.
15536 if test X"$d_volatile" = X"$define"; then
15537         volatile=volatile
15538 fi
15539 $cat <<EOP >try.c
15540 #include <stdio.h>
15541
15542 typedef $nvtype NV;
15543
15544 int
15545 main() {
15546   NV value = 2;
15547   int count = 1;
15548
15549   while(count < 256) {
15550     $volatile NV up = value + 1.0;
15551     $volatile NV negated = -value;
15552     $volatile NV down = negated - 1.0;
15553     $volatile NV got_up = up - value;
15554     int up_good = got_up == 1.0;
15555     int got_down = down - negated;
15556     int down_good = got_down == -1.0;
15557
15558     if (down_good != up_good) {
15559       fprintf(stderr,
15560               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15561               up_good, (double) got_up, down_good, (double) got_down,
15562               count, (double) value);
15563       return 1;
15564     }
15565     if (!up_good) {
15566       while (1) {
15567         if (count > 8) {
15568           count -= 8;
15569           fputs("256.0", stdout);
15570         } else {
15571           count--;
15572           fputs("2.0", stdout);
15573         }
15574         if (!count) {
15575           puts("");
15576           return 0;
15577         }
15578         fputs("*", stdout);
15579       }
15580     }
15581     value *= 2;
15582     ++count;
15583   }
15584   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15585           count, (double) value);
15586   return 1;
15587 }
15588 EOP
15589 set try
15590
15591 nv_overflows_integers_at='0'
15592 if eval $compile; then
15593     xxx="`$run ./try`"
15594     case "$?" in
15595         0)
15596             case "$xxx" in
15597                 2*)  cat >&4 <<EOM
15598 The largest integer your NVs can preserve is equal to $xxx
15599 EOM
15600                     nv_overflows_integers_at="$xxx"
15601                     ;;
15602                 *)  cat >&4 <<EOM
15603 Cannot determine the largest integer value your NVs can hold, unexpected output
15604 '$xxx'
15605 EOM
15606                     ;;
15607             esac
15608             ;;
15609         *)  cat >&4 <<EOM
15610 Cannot determine the largest integer value your NVs can hold
15611 EOM
15612             ;;
15613     esac
15614 fi
15615 $rm_try
15616
15617 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15618 : volatile so that the compiler has to store it out to memory.
15619 if test X"$d_volatile" = X"$define"; then
15620         volatile=volatile
15621 fi
15622 $cat <<EOP >try.c
15623 #include <stdio.h>
15624 #$i_stdlib I_STDLIB
15625 #ifdef I_STDLIB
15626 #include <stdlib.h>
15627 #endif
15628 #$i_string I_STRING
15629 #ifdef I_STRING
15630 #  include <string.h>
15631 #else
15632 #  include <strings.h>
15633 #endif
15634 #include <sys/types.h>
15635 #include <signal.h>
15636 #ifdef SIGFPE
15637 $volatile int bletched = 0;
15638 $signal_t blech(int s) { bletched = 1; }
15639 #endif
15640
15641 int checkit($nvtype d, char *where) {
15642     unsigned char *p = (char *)&d;
15643     unsigned char *end = p + sizeof(d);
15644     int fail = 0;
15645
15646     while (p < end)
15647         fail += *p++;
15648
15649     if (!fail)
15650         return 0;
15651
15652     p = (char *)&d;
15653     printf("No - %s: 0x", where);
15654     while (p < end)
15655         printf ("%02X", *p++);
15656     printf("\n");
15657     return 1;
15658 }
15659
15660 int main(int argc, char **argv) {
15661     $nvtype d = 0.0;
15662     int fail = 0;
15663     fail += checkit(d, "0.0");
15664
15665     /* The compiler shouldn't be assuming that bletched is 0  */
15666     d = bletched;
15667
15668     fail += checkit(d, "bleched");
15669
15670 #ifdef SIGFPE
15671     signal(SIGFPE, blech);
15672 #endif
15673
15674     /* Paranoia - the compiler should have no way of knowing that ANSI says
15675        that argv[argc] will always be NULL.  Actually, if it did assume this it
15676        would be buggy, as this is C and main() can be called from elsewhere in
15677        the program.  */
15678     d = argv[argc] ? 1 : 0;
15679
15680     if (d) {
15681         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15682     }
15683
15684     fail += checkit(d, "ternary");
15685
15686     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15687
15688     if (d != 0.0) {
15689         printf("No - memset doesn't give 0.0\n");
15690         /* This might just blow up:  */
15691         printf("(gives %g)\n", d);
15692         return 1;
15693     }
15694
15695 #ifdef SIGFPE
15696     if (bletched) {
15697         printf("No - something bleched\n");
15698         return 1;
15699     }
15700 #endif
15701     if (fail) {
15702       printf("No - %d fail(s)\n", fail);
15703       return 1;
15704     }
15705     printf("Yes\n");
15706     return 0;
15707 }
15708 EOP
15709 set try
15710
15711 d_nv_zero_is_allbits_zero="$undef"
15712 if eval $compile; then
15713     xxx="`$run ./try`"
15714     case "$?" in
15715         0)
15716             case "$xxx" in
15717                 Yes)  cat >&4 <<EOM
15718 0.0 is represented as all bits zero in memory
15719 EOM
15720                     d_nv_zero_is_allbits_zero="$define"
15721                     ;;
15722                 *)  cat >&4 <<EOM
15723 0.0 is not represented as all bits zero in memory
15724 EOM
15725                     d_nv_zero_is_allbits_zero="$undef"
15726                     ;;
15727             esac
15728             ;;
15729         *)  cat >&4 <<EOM
15730 0.0 is not represented as all bits zero in memory
15731 EOM
15732             d_nv_zero_is_allbits_zero="$undef"
15733             ;;
15734     esac
15735 fi
15736 $rm_try
15737
15738 : check for off64_t
15739 echo " "
15740 echo "Checking to see if you have off64_t..." >&4
15741 $cat >try.c <<EOCP
15742 #include <sys/types.h>
15743 #include <unistd.h>
15744 int main() { off64_t x = 7; }
15745 EOCP
15746 set try
15747 if eval $compile; then
15748         val="$define"
15749         echo "You have off64_t."
15750 else
15751         val="$undef"
15752         echo "You do not have off64_t."
15753         case "$lseeksize" in
15754         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15755         esac
15756 fi
15757 $rm_try
15758 set d_off64_t
15759 eval $setvar
15760
15761 : how to create joinable pthreads
15762 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15763         echo " "
15764         echo "Checking what constant to use for creating joinable pthreads..." >&4
15765         $cat >try.c <<'EOCP'
15766 #include <pthread.h>
15767 int main() {
15768     int detachstate = JOINABLE;
15769 }
15770 EOCP
15771         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15772         if eval $compile; then
15773                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15774                 val="$undef" # Yes, undef.
15775                 set d_old_pthread_create_joinable
15776                 eval $setvar
15777                 val=""
15778                 set old_pthread_create_joinable
15779                 eval $setvar
15780         else
15781                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15782                 if eval $compile; then
15783                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15784                         val="$define"
15785                         set d_old_pthread_create_joinable
15786                         eval $setvar
15787                         val=PTHREAD_CREATE_UNDETACHED
15788                         set old_pthread_create_joinable
15789                         eval $setvar
15790                 else
15791                         set try -DJOINABLE=__UNDETACHED
15792                         if eval $compile; then
15793                                 echo "You seem to use __UNDETACHED." >&4
15794                                 val="$define"
15795                                 set d_old_pthread_create_joinable
15796                                 eval $setvar
15797                                 val=__UNDETACHED
15798                                 set old_pthread_create_joinable
15799                                 eval $setvar
15800                         else
15801                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15802                                 val="$define"
15803                                 set d_old_pthread_create_joinable
15804                                 eval $setvar
15805                                 val=0
15806                                 set old_pthread_create_joinable
15807                                 eval $setvar
15808                         fi
15809                 fi
15810         fi
15811         $rm_try
15812 else
15813     d_old_pthread_create_joinable="$undef"
15814     old_pthread_create_joinable=""
15815 fi
15816
15817 : see if pause exists
15818 set pause d_pause
15819 eval $inlibc
15820
15821 : see if poll exists
15822 set poll d_poll
15823 eval $inlibc
15824
15825 : see if readlink exists
15826 set readlink d_readlink
15827 eval $inlibc
15828
15829 : Check if exe is symlink to abs path of executing program
15830 echo " "
15831 procselfexe=''
15832 val="$undef"
15833 case "$d_readlink" in
15834 "$define")
15835         if $issymlink /proc/self/exe ; then
15836                 $ls -l /proc/self/exe > reflect
15837                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15838                         echo "You have Linux-like /proc/self/exe."
15839                         procselfexe='"/proc/self/exe"'
15840                         val="$define"
15841                 fi
15842         fi
15843         if $issymlink /proc/curproc/file ; then
15844                 $ls -l /proc/curproc/file > reflect
15845                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15846                         echo "You have BSD-like /proc/curproc/file."
15847                         procselfexe='"/proc/curproc/file"'
15848                         val="$define"
15849                 fi
15850         fi
15851         ;;
15852 esac
15853 $rm -f reflect
15854 set d_procselfexe
15855 eval $setvar
15856
15857 : backward compatibility for d_hvfork
15858 if test X$d_hvfork != X; then
15859         d_vfork="$d_hvfork"
15860         d_hvfork=''
15861 fi
15862 : see if there is a vfork
15863 val=''
15864 set vfork val
15865 eval $inlibc
15866
15867 d_pseudofork=$undef
15868
15869 : Ok, but do we want to use it. vfork is reportedly unreliable in
15870 : perl on Solaris 2.x, and probably elsewhere.
15871 case "$val" in
15872 $define)
15873         echo " "
15874         case "$usevfork" in
15875         false) dflt='n';;
15876         *) dflt='y';;
15877         esac
15878         cat <<'EOM'
15879
15880 Perl can only use a vfork() that doesn't suffer from strict
15881 restrictions on calling functions or modifying global data in
15882 the child.  For example, glibc-2.1 contains such a vfork()
15883 that is unsuitable.  If your system provides a proper fork()
15884 call, chances are that you do NOT want perl to use vfork().
15885
15886 EOM
15887         rp="Do you still want to use vfork()?"
15888         . ./myread
15889         case "$ans" in
15890         y|Y) ;;
15891         *)
15892                 echo "Ok, we won't use vfork()."
15893                 val="$undef"
15894                 ;;
15895         esac
15896         ;;
15897 esac
15898 set d_vfork
15899 eval $setvar
15900 case "$d_vfork" in
15901 $define) usevfork='true';;
15902 *) usevfork='false';;
15903 esac
15904
15905 : see whether the pthread_atfork exists
15906 $cat >try.c <<EOP
15907 #include <pthread.h>
15908 #include <stdio.h>
15909 int main() {
15910 #ifdef  PTHREAD_ATFORK
15911         pthread_atfork(NULL,NULL,NULL);
15912 #endif
15913 }
15914 EOP
15915
15916 : see if pthread_atfork exists
15917 set try -DPTHREAD_ATFORK
15918 if eval $compile; then
15919     val="$define"
15920 else
15921     val="$undef"
15922 fi
15923 case "$usethreads" in
15924 $define)
15925         case "$val" in
15926         $define) echo 'pthread_atfork found.' >&4        ;;
15927         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15928         esac
15929 esac
15930 set d_pthread_atfork
15931 eval $setvar
15932
15933 : see if pthread_attr_setscope exists
15934 set pthread_attr_setscope d_pthread_attr_setscope
15935 eval $inlibc
15936
15937 : see whether the various POSIXish _yields exist
15938 $cat >try.c <<EOP
15939 #include <pthread.h>
15940 #include <stdio.h>
15941 int main() {
15942 #ifdef SCHED_YIELD
15943         sched_yield();
15944 #else
15945 #ifdef PTHREAD_YIELD
15946         pthread_yield();
15947 #else
15948 #ifdef PTHREAD_YIELD_NULL
15949         pthread_yield(NULL);
15950 #endif
15951 #endif
15952 #endif
15953 }
15954 EOP
15955 : see if sched_yield exists
15956 set try -DSCHED_YIELD
15957 if eval $compile; then
15958     val="$define"
15959     sched_yield='sched_yield()'
15960 else
15961     val="$undef"
15962 fi
15963 case "$usethreads" in
15964 $define)
15965         case "$val" in
15966         $define) echo 'sched_yield() found.' >&4        ;;
15967         *)       echo 'sched_yield() NOT found.' >&4    ;;
15968         esac
15969 esac
15970 set d_sched_yield
15971 eval $setvar
15972
15973 : see if pthread_yield exists
15974 set try -DPTHREAD_YIELD
15975 if eval $compile; then
15976     val="$define"
15977     case "$sched_yield" in
15978     '') sched_yield='pthread_yield()' ;;
15979     esac
15980 else
15981     set try -DPTHREAD_YIELD_NULL
15982     if eval $compile; then
15983         val="$define"
15984         case "$sched_yield" in
15985         '') sched_yield='pthread_yield(NULL)' ;;
15986         esac
15987     else
15988         val="$undef"
15989     fi
15990 fi
15991 case "$usethreads" in
15992 $define)
15993         case "$val" in
15994         $define) echo 'pthread_yield() found.' >&4      ;;
15995         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15996         esac
15997         ;;
15998 esac
15999 set d_pthread_yield
16000 eval $setvar
16001 case "$sched_yield" in
16002 '') sched_yield=undef ;;
16003 esac
16004 $rm_try
16005
16006 : see if random_r exists
16007 set random_r d_random_r
16008 eval $inlibc
16009 case "$d_random_r" in
16010 "$define")
16011         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16012         case "$d_random_r_proto:$usethreads" in
16013         ":define")      d_random_r_proto=define
16014                 set d_random_r_proto random_r $hdrs
16015                 eval $hasproto ;;
16016         *)      ;;
16017         esac
16018         case "$d_random_r_proto" in
16019         define)
16020         case "$random_r_proto" in
16021         ''|0) try='int random_r(int*, struct random_data*);'
16022         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
16023         esac
16024         case "$random_r_proto" in
16025         ''|0) try='int random_r(long*, struct random_data*);'
16026         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
16027         esac
16028         case "$random_r_proto" in
16029         ''|0) try='int random_r(struct random_data*, int32_t*);'
16030         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
16031         esac
16032         case "$random_r_proto" in
16033         ''|0)   d_random_r=undef
16034                 random_r_proto=0
16035                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16036         * )     case "$random_r_proto" in
16037                 REENTRANT_PROTO*) ;;
16038                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16039                 esac
16040                 echo "Prototype: $try" ;;
16041         esac
16042         ;;
16043         *)      case "$usethreads" in
16044                 define) echo "random_r has no prototype, not using it." >&4 ;;
16045                 esac
16046                 d_random_r=undef
16047                 random_r_proto=0
16048                 ;;
16049         esac
16050         ;;
16051 *)      random_r_proto=0
16052         ;;
16053 esac
16054
16055 : see if readdir and friends exist
16056 set readdir d_readdir
16057 eval $inlibc
16058 set seekdir d_seekdir
16059 eval $inlibc
16060 set telldir d_telldir
16061 eval $inlibc
16062 set rewinddir d_rewinddir
16063 eval $inlibc
16064
16065 : see if readdir64_r exists
16066 set readdir64_r d_readdir64_r
16067 eval $inlibc
16068 case "$d_readdir64_r" in
16069 "$define")
16070         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16071         case "$d_readdir64_r_proto:$usethreads" in
16072         ":define")      d_readdir64_r_proto=define
16073                 set d_readdir64_r_proto readdir64_r $hdrs
16074                 eval $hasproto ;;
16075         *)      ;;
16076         esac
16077         case "$d_readdir64_r_proto" in
16078         define)
16079         case "$readdir64_r_proto" in
16080         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16081         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
16082         esac
16083         case "$readdir64_r_proto" in
16084         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16085         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
16086         esac
16087         case "$readdir64_r_proto" in
16088         ''|0)   d_readdir64_r=undef
16089                 readdir64_r_proto=0
16090                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16091         * )     case "$readdir64_r_proto" in
16092                 REENTRANT_PROTO*) ;;
16093                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16094                 esac
16095                 echo "Prototype: $try" ;;
16096         esac
16097         ;;
16098         *)      case "$usethreads" in
16099                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16100                 esac
16101                 d_readdir64_r=undef
16102                 readdir64_r_proto=0
16103                 ;;
16104         esac
16105         ;;
16106 *)      readdir64_r_proto=0
16107         ;;
16108 esac
16109
16110 : see if readdir_r exists
16111 set readdir_r d_readdir_r
16112 eval $inlibc
16113 case "$d_readdir_r" in
16114 "$define")
16115         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16116         case "$d_readdir_r_proto:$usethreads" in
16117         ":define")      d_readdir_r_proto=define
16118                 set d_readdir_r_proto readdir_r $hdrs
16119                 eval $hasproto ;;
16120         *)      ;;
16121         esac
16122         case "$d_readdir_r_proto" in
16123         define)
16124         case "$readdir_r_proto" in
16125         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16126         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
16127         esac
16128         case "$readdir_r_proto" in
16129         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16130         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
16131         esac
16132         case "$readdir_r_proto" in
16133         ''|0)   d_readdir_r=undef
16134                 readdir_r_proto=0
16135                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16136         * )     case "$readdir_r_proto" in
16137                 REENTRANT_PROTO*) ;;
16138                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16139                 esac
16140                 echo "Prototype: $try" ;;
16141         esac
16142         ;;
16143         *)      case "$usethreads" in
16144                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16145                 esac
16146                 d_readdir_r=undef
16147                 readdir_r_proto=0
16148                 ;;
16149         esac
16150         ;;
16151 *)      readdir_r_proto=0
16152         ;;
16153 esac
16154
16155 : see if readv exists
16156 set readv d_readv
16157 eval $inlibc
16158
16159 : see if recvmsg exists
16160 set recvmsg d_recvmsg
16161 eval $inlibc
16162
16163 : see if rename exists
16164 set rename d_rename
16165 eval $inlibc
16166
16167 : see if rmdir exists
16168 set rmdir d_rmdir
16169 eval $inlibc
16170
16171 : see if memory.h is available.
16172 val=''
16173 set memory.h val
16174 eval $inhdr
16175
16176 : See if it conflicts with string.h
16177 case "$val" in
16178 $define)
16179         case "$strings" in
16180         '') ;;
16181         *)
16182                 $cppstdin $cppflags $cppminus < $strings > mem.h
16183                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16184                         echo " "
16185                         echo "We won't be including <memory.h>."
16186                         val="$undef"
16187                 fi
16188                 $rm -f mem.h
16189                 ;;
16190         esac
16191 esac
16192 set i_memory
16193 eval $setvar
16194
16195 : can bcopy handle overlapping blocks?
16196 echo " "
16197 val="$undef"
16198 case "$d_memmove" in
16199 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16200 *)      case "$d_bcopy" in
16201         "$define")
16202                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16203                 $cat >try.c <<EOCP
16204 #$i_memory I_MEMORY
16205 #$i_stdlib I_STDLIB
16206 #$i_string I_STRING
16207 #$i_unistd I_UNISTD
16208 EOCP
16209         $cat >>try.c <<'EOCP'
16210 #include <stdio.h>
16211 #ifdef I_MEMORY
16212 #  include <memory.h>
16213 #endif
16214 #ifdef I_STDLIB
16215 #  include <stdlib.h>
16216 #endif
16217 #ifdef I_STRING
16218 #  include <string.h>
16219 #else
16220 #  include <strings.h>
16221 #endif
16222 #ifdef I_UNISTD
16223 #  include <unistd.h>  /* Needed for NetBSD */
16224 #endif
16225 int main()
16226 {
16227 char buf[128], abc[128];
16228 char *b;
16229 int len;
16230 int off;
16231 int align;
16232
16233 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16234    try to store the string in read-only memory. */
16235 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16236
16237 for (align = 7; align >= 0; align--) {
16238         for (len = 36; len; len--) {
16239                 b = buf+align;
16240                 bcopy(abc, b, len);
16241                 for (off = 1; off <= len; off++) {
16242                         bcopy(b, b+off, len);
16243                         bcopy(b+off, b, len);
16244                         if (bcmp(b, abc, len))
16245                                 exit(1);
16246                 }
16247         }
16248 }
16249 exit(0);
16250 }
16251 EOCP
16252                 set try
16253                 if eval $compile_ok; then
16254                         if $run ./try 2>/dev/null; then
16255                                 echo "Yes, it can."
16256                                 val="$define"
16257                         else
16258                                 echo "It can't, sorry."
16259                         fi
16260                 else
16261                         echo "(I can't compile the test program, so we'll assume not...)"
16262                 fi
16263                 ;;
16264         esac
16265         $rm_try
16266         ;;
16267 esac
16268 set d_safebcpy
16269 eval $setvar
16270
16271 : can memcpy handle overlapping blocks?
16272 echo " "
16273 val="$undef"
16274 case "$d_memmove" in
16275 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16276 *)      case "$d_memcpy" in
16277         "$define")
16278                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16279                 $cat >try.c <<EOCP
16280 #$i_memory I_MEMORY
16281 #$i_stdlib I_STDLIB
16282 #$i_string I_STRING
16283 #$i_unistd I_UNISTD
16284 EOCP
16285         $cat >>try.c <<'EOCP'
16286 #include <stdio.h>
16287 #ifdef I_MEMORY
16288 #  include <memory.h>
16289 #endif
16290 #ifdef I_STDLIB
16291 #  include <stdlib.h>
16292 #endif
16293 #ifdef I_STRING
16294 #  include <string.h>
16295 #else
16296 #  include <strings.h>
16297 #endif
16298 #ifdef I_UNISTD
16299 #  include <unistd.h>  /* Needed for NetBSD */
16300 #endif
16301 int main()
16302 {
16303 char buf[128], abc[128];
16304 char *b;
16305 int len;
16306 int off;
16307 int align;
16308
16309 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16310    try to store the string in read-only memory. */
16311 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16312
16313 for (align = 7; align >= 0; align--) {
16314         for (len = 36; len; len--) {
16315                 b = buf+align;
16316                 memcpy(b, abc, len);
16317                 for (off = 1; off <= len; off++) {
16318                         memcpy(b+off, b, len);
16319                         memcpy(b, b+off, len);
16320                         if (memcmp(b, abc, len))
16321                                 exit(1);
16322                 }
16323         }
16324 }
16325 exit(0);
16326 }
16327 EOCP
16328                 set try
16329                 if eval $compile_ok; then
16330                         if $run ./try 2>/dev/null; then
16331                                 echo "Yes, it can."
16332                                 val="$define"
16333                         else
16334                                 echo "It can't, sorry."
16335                         fi
16336                 else
16337                         echo "(I can't compile the test program, so we'll assume not...)"
16338                 fi
16339                 ;;
16340         esac
16341         $rm_try
16342         ;;
16343 esac
16344 set d_safemcpy
16345 eval $setvar
16346
16347 : can memcmp be trusted to compare relative magnitude?
16348 val="$undef"
16349 case "$d_memcmp" in
16350 "$define")
16351         echo " "
16352         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16353         $cat >try.c <<EOCP
16354 #$i_memory I_MEMORY
16355 #$i_stdlib I_STDLIB
16356 #$i_string I_STRING
16357 #$i_unistd I_UNISTD
16358 EOCP
16359         $cat >>try.c <<'EOCP'
16360 #include <stdio.h>
16361 #ifdef I_MEMORY
16362 #  include <memory.h>
16363 #endif
16364 #ifdef I_STDLIB
16365 #  include <stdlib.h>
16366 #endif
16367 #ifdef I_STRING
16368 #  include <string.h>
16369 #else
16370 #  include <strings.h>
16371 #endif
16372 #ifdef I_UNISTD
16373 #  include <unistd.h>  /* Needed for NetBSD */
16374 #endif
16375 int main()
16376 {
16377 char a = -1;
16378 char b = 0;
16379 if ((a < b) && memcmp(&a, &b, 1) < 0)
16380         exit(1);
16381 exit(0);
16382 }
16383 EOCP
16384         set try
16385         if eval $compile_ok; then
16386                 if $run ./try 2>/dev/null; then
16387                         echo "Yes, it can."
16388                         val="$define"
16389                 else
16390                         echo "No, it can't (it uses signed chars)."
16391                 fi
16392         else
16393                 echo "(I can't compile the test program, so we'll assume not...)"
16394         fi
16395         ;;
16396 esac
16397 $rm_try
16398 set d_sanemcmp
16399 eval $setvar
16400
16401 : see if prototype for sbrk is available
16402 echo " "
16403 set d_sbrkproto sbrk $i_unistd unistd.h
16404 eval $hasproto
16405
16406 : see if select exists
16407 set select d_select
16408 eval $inlibc
16409
16410 : see if semctl exists
16411 set semctl d_semctl
16412 eval $inlibc
16413
16414 : see if semget exists
16415 set semget d_semget
16416 eval $inlibc
16417
16418 : see if semop exists
16419 set semop d_semop
16420 eval $inlibc
16421
16422 : see how much of the 'sem*(2)' library is present.
16423 h_sem=true
16424 echo " "
16425 case "$d_semctl$d_semget$d_semop" in
16426 *"$undef"*) h_sem=false;;
16427 esac
16428 case "$osname" in
16429 freebsd)
16430     case "`ipcs 2>&1`" in
16431     "SVID messages"*"not configured"*)
16432         echo "Your $osname does not have the sem*(2) configured." >&4
16433         h_sem=false
16434         val="$undef"
16435         set semctl d_semctl
16436         eval $setvar
16437         set semget d_semget
16438         eval $setvar
16439         set semop d_semop
16440         eval $setvar
16441         ;;
16442     esac
16443     ;;
16444 esac
16445 : we could also check for sys/ipc.h ...
16446 if $h_sem && $test `./findhdr sys/sem.h`; then
16447         echo "You have the full sem*(2) library." >&4
16448         val="$define"
16449 else
16450         echo "You don't have the full sem*(2) library." >&4
16451         val="$undef"
16452 fi
16453 set d_sem
16454 eval $setvar
16455
16456 : see whether sys/sem.h defines union semun
16457 echo " "
16458 $cat > try.c <<'END'
16459 #include <sys/types.h>
16460 #include <sys/ipc.h>
16461 #include <sys/sem.h>
16462 int main () { union semun semun; semun.buf = 0; }
16463 END
16464 set try
16465 if eval $compile; then
16466     echo "You have union semun in <sys/sem.h>." >&4
16467     val="$define"
16468 else
16469     echo "You do not have union semun in <sys/sem.h>." >&4
16470     val="$undef"
16471 fi
16472 $rm_try
16473 set d_union_semun
16474 eval $setvar
16475
16476 : see how to do semctl IPC_STAT
16477 case "$d_sem" in
16478 $define)
16479     echo " "
16480     $cat > tryh.h <<END
16481 #ifndef S_IRUSR
16482 #   ifdef S_IREAD
16483 #       define S_IRUSR S_IREAD
16484 #       define S_IWUSR S_IWRITE
16485 #       define S_IXUSR S_IEXEC
16486 #   else
16487 #       define S_IRUSR 0400
16488 #       define S_IWUSR 0200
16489 #       define S_IXUSR 0100
16490 #   endif
16491 #   define S_IRGRP (S_IRUSR>>3)
16492 #   define S_IWGRP (S_IWUSR>>3)
16493 #   define S_IXGRP (S_IXUSR>>3)
16494 #   define S_IROTH (S_IRUSR>>6)
16495 #   define S_IWOTH (S_IWUSR>>6)
16496 #   define S_IXOTH (S_IXUSR>>6)
16497 #endif
16498 #ifndef S_IRWXU
16499 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16500 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16501 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16502 #endif
16503 END
16504     : see whether semctl IPC_STAT can use union semun
16505     case "$d_semctl_semun" in
16506     '')
16507       val="$undef"
16508       $cat > try.c <<END
16509 #include <sys/types.h>
16510 #include <sys/ipc.h>
16511 #include <sys/sem.h>
16512 #include <sys/stat.h>
16513 #include <stdio.h>
16514 #include <errno.h>
16515 #include "tryh.h"
16516 #ifndef errno
16517 extern int errno;
16518 #endif
16519 #$d_union_semun HAS_UNION_SEMUN
16520 int main() {
16521     union semun
16522 #ifndef HAS_UNION_SEMUN
16523     {
16524         int val;
16525         struct semid_ds *buf;
16526         unsigned short *array;
16527     }
16528 #endif
16529     arg;
16530     int sem, st;
16531
16532 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16533     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16534     if (sem > -1) {
16535         struct semid_ds argbuf;
16536         arg.buf = &argbuf;
16537 #       ifdef IPC_STAT
16538         st = semctl(sem, 0, IPC_STAT, arg);
16539         if (st == 0)
16540             printf("semun\n");
16541         else
16542 #       endif /* IPC_STAT */
16543             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16544 #       ifdef IPC_RMID
16545         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16546 #       endif /* IPC_RMID */
16547             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16548     } else
16549 #endif /* IPC_PRIVATE && ... */
16550         printf("semget failed: errno = %d\n", errno);
16551   return 0;
16552 }
16553 END
16554       set try
16555       if eval $compile; then
16556           xxx=`$run ./try`
16557           case "$xxx" in
16558           semun) val="$define" ;;
16559           esac
16560       fi
16561       $rm_try
16562       set d_semctl_semun
16563       eval $setvar
16564       ;;
16565     esac
16566     case "$d_semctl_semun" in
16567     $define)
16568         echo "You can use union semun for semctl IPC_STAT." >&4
16569         also='also'
16570         ;;
16571     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16572         also=''
16573         ;;
16574     esac
16575
16576     : see whether semctl IPC_STAT can use struct semid_ds pointer
16577     case "$d_semctl_semid_ds" in
16578     '')
16579       val="$undef"
16580       $cat > try.c <<'END'
16581 #include <sys/types.h>
16582 #include <sys/ipc.h>
16583 #include <sys/sem.h>
16584 #include <sys/stat.h>
16585 #include "tryh.h"
16586 #include <stdio.h>
16587 #include <errno.h>
16588 #ifndef errno
16589 extern int errno;
16590 #endif
16591 int main() {
16592     struct semid_ds arg;
16593     int sem, st;
16594
16595 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16596     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16597     if (sem > -1) {
16598 #       ifdef IPC_STAT
16599         st = semctl(sem, 0, IPC_STAT, &arg);
16600         if (st == 0)
16601             printf("semid_ds\n");
16602         else
16603 #       endif /* IPC_STAT */
16604             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16605 #       ifdef IPC_RMID
16606         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16607 #       endif /* IPC_RMID */
16608             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16609     } else
16610 #endif /* IPC_PRIVATE && ... */
16611         printf("semget failed: errno = %d\n", errno);
16612
16613     return 0;
16614 }
16615 END
16616       set try
16617       if eval $compile; then
16618           xxx=`$run ./try`
16619           case "$xxx" in
16620           semid_ds) val="$define" ;;
16621           esac
16622       fi
16623       $rm_try
16624       set d_semctl_semid_ds
16625       eval $setvar
16626       ;;
16627     esac
16628     case "$d_semctl_semid_ds" in
16629     $define)
16630         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16631         ;;
16632     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16633         ;;
16634     esac
16635     ;;
16636 *)  val="$undef"
16637
16638     # We do not have the full sem*(2) library, so assume we can not
16639     # use either.
16640
16641     set d_semctl_semun
16642     eval $setvar
16643
16644     set d_semctl_semid_ds
16645     eval $setvar
16646     ;;
16647 esac
16648 $rm_try tryh.h
16649
16650 : see if sendmsg exists
16651 set sendmsg d_sendmsg
16652 eval $inlibc
16653
16654 : see if setegid exists
16655 set setegid d_setegid
16656 eval $inlibc
16657
16658 : see if seteuid exists
16659 set seteuid d_seteuid
16660 eval $inlibc
16661
16662 : see if setgrent exists
16663 set setgrent d_setgrent
16664 eval $inlibc
16665
16666 : see if setgrent_r exists
16667 set setgrent_r d_setgrent_r
16668 eval $inlibc
16669 case "$d_setgrent_r" in
16670 "$define")
16671         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16672         case "$d_setgrent_r_proto:$usethreads" in
16673         ":define")      d_setgrent_r_proto=define
16674                 set d_setgrent_r_proto setgrent_r $hdrs
16675                 eval $hasproto ;;
16676         *)      ;;
16677         esac
16678         case "$d_setgrent_r_proto" in
16679         define)
16680         case "$setgrent_r_proto" in
16681         ''|0) try='int setgrent_r(FILE**);'
16682         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
16683         esac
16684         case "$setgrent_r_proto" in
16685         ''|0) try='void setgrent_r(FILE**);'
16686         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
16687         esac
16688         case "$setgrent_r_proto" in
16689         ''|0)   d_setgrent_r=undef
16690                 setgrent_r_proto=0
16691                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16692         * )     case "$setgrent_r_proto" in
16693                 REENTRANT_PROTO*) ;;
16694                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16695                 esac
16696                 echo "Prototype: $try" ;;
16697         esac
16698         ;;
16699         *)      case "$usethreads" in
16700                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16701                 esac
16702                 d_setgrent_r=undef
16703                 setgrent_r_proto=0
16704                 ;;
16705         esac
16706         ;;
16707 *)      setgrent_r_proto=0
16708         ;;
16709 esac
16710
16711 : see if sethostent exists
16712 set sethostent d_sethent
16713 eval $inlibc
16714
16715 : see if sethostent_r exists
16716 set sethostent_r d_sethostent_r
16717 eval $inlibc
16718 case "$d_sethostent_r" in
16719 "$define")
16720         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16721         case "$d_sethostent_r_proto:$usethreads" in
16722         ":define")      d_sethostent_r_proto=define
16723                 set d_sethostent_r_proto sethostent_r $hdrs
16724                 eval $hasproto ;;
16725         *)      ;;
16726         esac
16727         case "$d_sethostent_r_proto" in
16728         define)
16729         case "$sethostent_r_proto" in
16730         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16731         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16732         esac
16733         case "$sethostent_r_proto" in
16734         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16735         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16736         esac
16737         case "$sethostent_r_proto" in
16738         ''|0)   d_sethostent_r=undef
16739                 sethostent_r_proto=0
16740                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16741         * )     case "$sethostent_r_proto" in
16742                 REENTRANT_PROTO*) ;;
16743                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16744                 esac
16745                 echo "Prototype: $try" ;;
16746         esac
16747         ;;
16748         *)      case "$usethreads" in
16749                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16750                 esac
16751                 d_sethostent_r=undef
16752                 sethostent_r_proto=0
16753                 ;;
16754         esac
16755         ;;
16756 *)      sethostent_r_proto=0
16757         ;;
16758 esac
16759
16760 : see if setitimer exists
16761 set setitimer d_setitimer
16762 eval $inlibc
16763
16764 : see if setlinebuf exists
16765 set setlinebuf d_setlinebuf
16766 eval $inlibc
16767
16768 : see if setlocale exists
16769 set setlocale d_setlocale
16770 eval $inlibc
16771
16772 : see if locale.h is available
16773 set locale.h i_locale
16774 eval $inhdr
16775
16776 : see if setlocale_r exists
16777 set setlocale_r d_setlocale_r
16778 eval $inlibc
16779 case "$d_setlocale_r" in
16780 "$define")
16781         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16782         case "$d_setlocale_r_proto:$usethreads" in
16783         ":define")      d_setlocale_r_proto=define
16784                 set d_setlocale_r_proto setlocale_r $hdrs
16785                 eval $hasproto ;;
16786         *)      ;;
16787         esac
16788         case "$d_setlocale_r_proto" in
16789         define)
16790         case "$setlocale_r_proto" in
16791         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16792         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16793         esac
16794         case "$setlocale_r_proto" in
16795         ''|0)   d_setlocale_r=undef
16796                 setlocale_r_proto=0
16797                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16798         * )     case "$setlocale_r_proto" in
16799                 REENTRANT_PROTO*) ;;
16800                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16801                 esac
16802                 echo "Prototype: $try" ;;
16803         esac
16804         ;;
16805         *)      case "$usethreads" in
16806                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16807                 esac
16808                 d_setlocale_r=undef
16809                 setlocale_r_proto=0
16810                 ;;
16811         esac
16812         ;;
16813 *)      setlocale_r_proto=0
16814         ;;
16815 esac
16816
16817 : see if setnetent exists
16818 set setnetent d_setnent
16819 eval $inlibc
16820
16821 : see if setnetent_r exists
16822 set setnetent_r d_setnetent_r
16823 eval $inlibc
16824 case "$d_setnetent_r" in
16825 "$define")
16826         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16827         case "$d_setnetent_r_proto:$usethreads" in
16828         ":define")      d_setnetent_r_proto=define
16829                 set d_setnetent_r_proto setnetent_r $hdrs
16830                 eval $hasproto ;;
16831         *)      ;;
16832         esac
16833         case "$d_setnetent_r_proto" in
16834         define)
16835         case "$setnetent_r_proto" in
16836         ''|0) try='int setnetent_r(int, struct netent_data*);'
16837         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16838         esac
16839         case "$setnetent_r_proto" in
16840         ''|0) try='void setnetent_r(int, struct netent_data*);'
16841         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16842         esac
16843         case "$setnetent_r_proto" in
16844         ''|0)   d_setnetent_r=undef
16845                 setnetent_r_proto=0
16846                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16847         * )     case "$setnetent_r_proto" in
16848                 REENTRANT_PROTO*) ;;
16849                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16850                 esac
16851                 echo "Prototype: $try" ;;
16852         esac
16853         ;;
16854         *)      case "$usethreads" in
16855                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16856                 esac
16857                 d_setnetent_r=undef
16858                 setnetent_r_proto=0
16859                 ;;
16860         esac
16861         ;;
16862 *)      setnetent_r_proto=0
16863         ;;
16864 esac
16865
16866 : see if setprotoent exists
16867 set setprotoent d_setpent
16868 eval $inlibc
16869
16870 : see if setpgid exists
16871 set setpgid d_setpgid
16872 eval $inlibc
16873
16874 : see if setpgrp2 exists
16875 set setpgrp2 d_setpgrp2
16876 eval $inlibc
16877
16878 : see if setpriority exists
16879 set setpriority d_setprior
16880 eval $inlibc
16881
16882 : see if setproctitle exists
16883 set setproctitle d_setproctitle
16884 eval $inlibc
16885
16886 : see if setprotoent_r exists
16887 set setprotoent_r d_setprotoent_r
16888 eval $inlibc
16889 case "$d_setprotoent_r" in
16890 "$define")
16891         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16892         case "$d_setprotoent_r_proto:$usethreads" in
16893         ":define")      d_setprotoent_r_proto=define
16894                 set d_setprotoent_r_proto setprotoent_r $hdrs
16895                 eval $hasproto ;;
16896         *)      ;;
16897         esac
16898         case "$d_setprotoent_r_proto" in
16899         define)
16900         case "$setprotoent_r_proto" in
16901         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16902         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16903         esac
16904         case "$setprotoent_r_proto" in
16905         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16906         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16907         esac
16908         case "$setprotoent_r_proto" in
16909         ''|0)   d_setprotoent_r=undef
16910                 setprotoent_r_proto=0
16911                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16912         * )     case "$setprotoent_r_proto" in
16913                 REENTRANT_PROTO*) ;;
16914                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16915                 esac
16916                 echo "Prototype: $try" ;;
16917         esac
16918         ;;
16919         *)      case "$usethreads" in
16920                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16921                 esac
16922                 d_setprotoent_r=undef
16923                 setprotoent_r_proto=0
16924                 ;;
16925         esac
16926         ;;
16927 *)      setprotoent_r_proto=0
16928         ;;
16929 esac
16930
16931 : see if setpwent exists
16932 set setpwent d_setpwent
16933 eval $inlibc
16934
16935 : see if setpwent_r exists
16936 set setpwent_r d_setpwent_r
16937 eval $inlibc
16938 case "$d_setpwent_r" in
16939 "$define")
16940         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16941         case "$d_setpwent_r_proto:$usethreads" in
16942         ":define")      d_setpwent_r_proto=define
16943                 set d_setpwent_r_proto setpwent_r $hdrs
16944                 eval $hasproto ;;
16945         *)      ;;
16946         esac
16947         case "$d_setpwent_r_proto" in
16948         define)
16949         case "$setpwent_r_proto" in
16950         ''|0) try='int setpwent_r(FILE**);'
16951         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16952         esac
16953         case "$setpwent_r_proto" in
16954         ''|0) try='void setpwent_r(FILE**);'
16955         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16956         esac
16957         case "$setpwent_r_proto" in
16958         ''|0)   d_setpwent_r=undef
16959                 setpwent_r_proto=0
16960                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16961         * )     case "$setpwent_r_proto" in
16962                 REENTRANT_PROTO*) ;;
16963                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16964                 esac
16965                 echo "Prototype: $try" ;;
16966         esac
16967         ;;
16968         *)      case "$usethreads" in
16969                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16970                 esac
16971                 d_setpwent_r=undef
16972                 setpwent_r_proto=0
16973                 ;;
16974         esac
16975         ;;
16976 *)      setpwent_r_proto=0
16977         ;;
16978 esac
16979
16980 : see if setregid exists
16981 set setregid d_setregid
16982 eval $inlibc
16983 set setresgid d_setresgid
16984 eval $inlibc
16985
16986 : see if setreuid exists
16987 set setreuid d_setreuid
16988 eval $inlibc
16989 set setresuid d_setresuid
16990 eval $inlibc
16991
16992 : see if setrgid exists
16993 set setrgid d_setrgid
16994 eval $inlibc
16995
16996 : see if setruid exists
16997 set setruid d_setruid
16998 eval $inlibc
16999
17000 : see if setservent exists
17001 set setservent d_setsent
17002 eval $inlibc
17003
17004 : see if setservent_r exists
17005 set setservent_r d_setservent_r
17006 eval $inlibc
17007 case "$d_setservent_r" in
17008 "$define")
17009         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17010         case "$d_setservent_r_proto:$usethreads" in
17011         ":define")      d_setservent_r_proto=define
17012                 set d_setservent_r_proto setservent_r $hdrs
17013                 eval $hasproto ;;
17014         *)      ;;
17015         esac
17016         case "$d_setservent_r_proto" in
17017         define)
17018         case "$setservent_r_proto" in
17019         ''|0) try='int setservent_r(int, struct servent_data*);'
17020         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
17021         esac
17022         case "$setservent_r_proto" in
17023         ''|0) try='void setservent_r(int, struct servent_data*);'
17024         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
17025         esac
17026         case "$setservent_r_proto" in
17027         ''|0)   d_setservent_r=undef
17028                 setservent_r_proto=0
17029                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17030         * )     case "$setservent_r_proto" in
17031                 REENTRANT_PROTO*) ;;
17032                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17033                 esac
17034                 echo "Prototype: $try" ;;
17035         esac
17036         ;;
17037         *)      case "$usethreads" in
17038                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17039                 esac
17040                 d_setservent_r=undef
17041                 setservent_r_proto=0
17042                 ;;
17043         esac
17044         ;;
17045 *)      setservent_r_proto=0
17046         ;;
17047 esac
17048
17049 : see if setsid exists
17050 set setsid d_setsid
17051 eval $inlibc
17052
17053 : see if setvbuf exists
17054 set setvbuf d_setvbuf
17055 eval $inlibc
17056
17057 : see if sfio.h is available
17058 set sfio.h i_sfio
17059 eval $inhdr
17060
17061 : see if sfio library is available
17062 case "$i_sfio" in
17063 $define)
17064         val=''
17065         set sfreserve val
17066         eval $inlibc
17067         ;;
17068 *)
17069         val="$undef"
17070         ;;
17071 esac
17072 : Ok, but do we want to use it.
17073 case "$val" in
17074 $define)
17075         case "$usesfio" in
17076         true|$define|[yY]*) dflt='y';;
17077         *) dflt='n';;
17078         esac
17079         echo "$package can use the sfio library, but it is experimental."
17080         case "$useperlio" in
17081         "$undef")
17082             echo "For sfio also the PerlIO abstraction layer is needed."
17083             echo "Earlier you said you wouldn't want that."
17084             ;;
17085         esac
17086         rp="You seem to have sfio available, do you want to try using it?"
17087         . ./myread
17088         case "$ans" in
17089         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
17090                 useperlio="$define"
17091                 val="$define"
17092                 ;;
17093         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17094                 val="$undef"
17095                 ;;
17096         esac
17097         ;;
17098 *)      case "$usesfio" in
17099         true|$define|[yY]*)
17100                 echo "Sorry, cannot find sfio on this machine." >&4
17101                 echo "Ignoring your setting of usesfio=$usesfio." >&4
17102                 val="$undef"
17103                 ;;
17104         esac
17105         ;;
17106 esac
17107 set d_sfio
17108 eval $setvar
17109 case "$d_sfio" in
17110 $define) usesfio='true';;
17111 *) usesfio='false';;
17112 esac
17113 case "$d_sfio" in
17114 $define) ;;
17115 *)      : Remove sfio from list of libraries to use
17116         case "$libs" in
17117         *-lsfio*)
17118                 echo "Removing unneeded -lsfio from library list" >&4
17119                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17120                 shift
17121                 libs="$*"
17122                 echo "libs = $libs" >&4
17123                 ;;
17124         esac
17125 ;;
17126 esac
17127
17128
17129 : see if shmctl exists
17130 set shmctl d_shmctl
17131 eval $inlibc
17132
17133 : see if shmget exists
17134 set shmget d_shmget
17135 eval $inlibc
17136
17137 : see if shmat exists
17138 set shmat d_shmat
17139 eval $inlibc
17140 : see what shmat returns
17141 case "$d_shmat" in
17142 "$define")
17143         $cat >shmat.c <<'END'
17144 #include <sys/shm.h>
17145 void *shmat();
17146 END
17147         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17148                 shmattype='void *'
17149         else
17150                 shmattype='char *'
17151         fi
17152         echo "and it returns ($shmattype)." >&4
17153         : see if a prototype for shmat is available
17154         xxx=`./findhdr sys/shm.h`
17155         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17156         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17157                 val="$define"
17158         else
17159                 val="$undef"
17160         fi
17161         $rm -f shmat.[co]
17162         ;;
17163 *)
17164         val="$undef"
17165         ;;
17166 esac
17167 set d_shmatprototype
17168 eval $setvar
17169
17170 : see if shmdt exists
17171 set shmdt d_shmdt
17172 eval $inlibc
17173
17174 : see how much of the 'shm*(2)' library is present.
17175 h_shm=true
17176 echo " "
17177 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17178 *"$undef"*) h_shm=false;;
17179 esac
17180 case "$osname" in
17181 freebsd)
17182     case "`ipcs 2>&1`" in
17183     "SVID shared memory"*"not configured"*)
17184         echo "Your $osname does not have the shm*(2) configured." >&4
17185         h_shm=false
17186         val="$undef"
17187         set shmctl d_shmctl
17188         evat $setvar
17189         set shmget d_shmget
17190         evat $setvar
17191         set shmat d_shmat
17192         evat $setvar
17193         set shmdt d_shmdt
17194         evat $setvar
17195         ;;
17196     esac
17197     ;;
17198 esac
17199 : we could also check for sys/ipc.h ...
17200 if $h_shm && $test `./findhdr sys/shm.h`; then
17201         echo "You have the full shm*(2) library." >&4
17202         val="$define"
17203 else
17204         echo "You don't have the full shm*(2) library." >&4
17205         val="$undef"
17206 fi
17207 set d_shm
17208 eval $setvar
17209
17210 : see if we have sigaction
17211 echo " "
17212 if set sigaction val -f d_sigaction; eval $csym; $val; then
17213         echo 'sigaction() found.' >&4
17214         $cat > try.c <<EOP
17215 #include <stdio.h>
17216 #include <sys/types.h>
17217 #include <signal.h>
17218 #$i_stdlib I_STDLIB
17219 #ifdef I_STDLIB
17220 #include <stdlib.h>
17221 #endif
17222 int main()
17223 {
17224     struct sigaction act, oact;
17225     act.sa_flags = 0;
17226     oact.sa_handler = 0;
17227     /* so that act and oact are used */
17228     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17229 }
17230 EOP
17231         set try
17232         if eval $compile_ok; then
17233                 val="$define"
17234         else
17235                 echo "But you don't seem to have a useable struct sigaction." >&4
17236                 val="$undef"
17237         fi
17238 else
17239         echo 'sigaction NOT found.' >&4
17240         val="$undef"
17241 fi
17242 set d_sigaction; eval $setvar
17243 $rm_try
17244
17245 : see if this is a sunmath.h system
17246 set sunmath.h i_sunmath
17247 eval $inhdr
17248
17249 : see if signbit exists
17250 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17251 $cat >try.c <<EOCP
17252 #$i_math I_MATH
17253 #$i_sunmath I_SUNMATH
17254 #ifdef I_MATH
17255 #  include <math.h>
17256 #endif
17257 #ifdef I_SUNMATH  /* Solaris special math library */
17258 #  include <sunmath.h>
17259 #endif
17260 #define NV $nvtype
17261 int main(int argc, char **argv)
17262 {
17263     NV x = 0.0;
17264     NV y = -0.0;
17265     if ((signbit(x) == 0) && (signbit(y) != 0))
17266         return 0;
17267     else
17268         return 1;
17269 }
17270 EOCP
17271 val="$undef"
17272 set try
17273 if eval $compile; then
17274     if $run ./try; then
17275         $echo "Yes." >&4
17276         val="$define"
17277     else
17278         $echo "Signbit seems to be available, but doesn't work as I expected."
17279         $echo "I won't use it." >&4
17280         val="$undef"
17281     fi
17282 else
17283     $echo "Nope." >&4
17284     dflt="$undef"
17285 fi
17286 set d_signbit
17287 eval $setvar
17288 $rm_try
17289
17290 : see if sigprocmask exists
17291 set sigprocmask d_sigprocmask
17292 eval $inlibc
17293
17294 : see if sigsetjmp exists
17295 echo " "
17296 case "$d_sigsetjmp" in
17297 '')
17298         $cat >try.c <<EOP
17299 #include <setjmp.h>
17300 #$i_stdlib I_STDLIB
17301 #ifdef I_STDLIB
17302 #include <stdlib.h>
17303 #endif
17304 sigjmp_buf env;
17305 int set = 1;
17306 int main()
17307 {
17308         if (sigsetjmp(env,1))
17309                 exit(set);
17310         set = 0;
17311         siglongjmp(env, 1);
17312         exit(1);
17313 }
17314 EOP
17315         set try
17316         if eval $compile; then
17317                 if $run ./try >/dev/null 2>&1; then
17318                         echo "POSIX sigsetjmp found." >&4
17319                         val="$define"
17320                 else
17321                         $cat >&4 <<EOM
17322 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17323 I'll ignore them.
17324 EOM
17325                         val="$undef"
17326                 fi
17327         else
17328                 echo "sigsetjmp not found." >&4
17329                 val="$undef"
17330         fi
17331         ;;
17332 *) val="$d_sigsetjmp"
17333         case "$d_sigsetjmp" in
17334         $define) echo "POSIX sigsetjmp found." >&4;;
17335         $undef) echo "sigsetjmp not found." >&4;;
17336         esac
17337         ;;
17338 esac
17339 set d_sigsetjmp
17340 eval $setvar
17341 $rm_try
17342
17343 : see if snprintf exists
17344 set snprintf d_snprintf
17345 eval $inlibc
17346
17347 : see if vsnprintf exists
17348 set vsnprintf d_vsnprintf
17349 eval $inlibc
17350
17351 case "$d_snprintf-$d_vsnprintf" in
17352 "$define-$define")
17353     $cat <<EOM
17354 Checking whether your snprintf() and vsnprintf() work okay...
17355 EOM
17356     $cat >try.c <<'EOCP'
17357 /* v?snprintf testing logic courtesy of Russ Allbery.
17358  * According to C99:
17359  * - if the buffer is too short it still must be \0-terminated
17360  * - if the buffer is too short the potentially required length
17361  *   must be returned and not -1
17362  * - if the buffer is NULL the potentially required length
17363  *   must be returned and not -1 or core dump
17364  */
17365 #include <stdio.h>
17366 #include <stdarg.h>
17367
17368 char buf[2];
17369
17370 int test (char *format, ...)
17371 {
17372     va_list args;
17373     int count;
17374
17375     va_start (args, format);
17376     count = vsnprintf (buf, sizeof buf, format, args);
17377     va_end (args);
17378     return count;
17379 }
17380
17381 int main ()
17382 {
17383     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17384              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17385 }
17386 EOCP
17387     set try
17388     if eval $compile; then
17389         `$run ./try`
17390         case "$?" in
17391         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17392         *) cat <<EOM >&4
17393 Your snprintf() and snprintf() don't seem to be working okay.
17394 EOM
17395            d_snprintf="$undef"
17396            d_vsnprintf="$undef"
17397            ;;
17398         esac
17399     else
17400         echo "(I can't seem to compile the test program--assuming they don't)"
17401         d_snprintf="$undef"
17402         d_vsnprintf="$undef"
17403     fi
17404     $rm_try
17405     ;;
17406 esac
17407
17408 : see if sockatmark exists
17409 set sockatmark d_sockatmark
17410 eval $inlibc
17411
17412 : see if prototype for sockatmark is available
17413 echo " "
17414 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17415 eval $hasproto
17416
17417 : see if socks5_init exists
17418 set socks5_init d_socks5_init
17419 eval $inlibc
17420
17421 : see if sprintf returns the length of the string in the buffer as per ANSI
17422 $echo "Checking whether sprintf returns the length of the string..." >&4
17423 $cat <<EOP >try.c
17424 #include <stdio.h>
17425 #$i_stdlib I_STDLIB
17426 #ifdef I_STDLIB
17427 #include <stdlib.h>
17428 #endif
17429 #$i_string I_STRING
17430 #ifdef I_STRING
17431 #  include <string.h>
17432 #else
17433 #  include <strings.h>
17434 #endif
17435 #$i_math I_MATH
17436 #ifdef I_MATH
17437 #include <math.h>
17438 #endif
17439
17440 char buffer[256];
17441
17442 int check (size_t expect, int test) {
17443   size_t got = strlen(buffer);
17444   if (expect == got)
17445     return 0;
17446
17447   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17448        test, buffer);
17449   exit (test);
17450 }
17451
17452 int main(int argc, char **argv) {
17453   int test = 0;
17454
17455   check(sprintf(buffer, ""), ++test);
17456   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17457   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17458
17459   return 0;
17460 }
17461 EOP
17462 set try
17463
17464 d_sprintf_returns_strlen="$undef"
17465 if eval $compile; then
17466     xxx="`$run ./try`"
17467     case "$?" in
17468         0) cat >&4 <<EOM
17469 sprintf returns the length of the string (as ANSI says it should)
17470 EOM
17471         d_sprintf_returns_strlen="$define"
17472         ;;
17473         *) cat >&4 <<EOM
17474 sprintf does not return the length of the string (how old is this system?)
17475 EOM
17476         d_sprintf_returns_strlen="$undef"
17477         ;;
17478     esac
17479 fi
17480 $rm_try
17481
17482 : see if srand48_r exists
17483 set srand48_r d_srand48_r
17484 eval $inlibc
17485 case "$d_srand48_r" in
17486 "$define")
17487         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17488         case "$d_srand48_r_proto:$usethreads" in
17489         ":define")      d_srand48_r_proto=define
17490                 set d_srand48_r_proto srand48_r $hdrs
17491                 eval $hasproto ;;
17492         *)      ;;
17493         esac
17494         case "$d_srand48_r_proto" in
17495         define)
17496         case "$srand48_r_proto" in
17497         ''|0) try='int srand48_r(long, struct drand48_data*);'
17498         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
17499         esac
17500         case "$srand48_r_proto" in
17501         ''|0)   d_srand48_r=undef
17502                 srand48_r_proto=0
17503                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17504         * )     case "$srand48_r_proto" in
17505                 REENTRANT_PROTO*) ;;
17506                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17507                 esac
17508                 echo "Prototype: $try" ;;
17509         esac
17510         ;;
17511         *)      case "$usethreads" in
17512                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17513                 esac
17514                 d_srand48_r=undef
17515                 srand48_r_proto=0
17516                 ;;
17517         esac
17518         ;;
17519 *)      srand48_r_proto=0
17520         ;;
17521 esac
17522
17523 : see if srandom_r exists
17524 set srandom_r d_srandom_r
17525 eval $inlibc
17526 case "$d_srandom_r" in
17527 "$define")
17528         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17529         case "$d_srandom_r_proto:$usethreads" in
17530         ":define")      d_srandom_r_proto=define
17531                 set d_srandom_r_proto srandom_r $hdrs
17532                 eval $hasproto ;;
17533         *)      ;;
17534         esac
17535         case "$d_srandom_r_proto" in
17536         define)
17537         case "$srandom_r_proto" in
17538         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17539         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
17540         esac
17541         case "$srandom_r_proto" in
17542         ''|0)   d_srandom_r=undef
17543                 srandom_r_proto=0
17544                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17545         * )     case "$srandom_r_proto" in
17546                 REENTRANT_PROTO*) ;;
17547                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17548                 esac
17549                 echo "Prototype: $try" ;;
17550         esac
17551         ;;
17552         *)      case "$usethreads" in
17553                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17554                 esac
17555                 d_srandom_r=undef
17556                 srandom_r_proto=0
17557                 ;;
17558         esac
17559         ;;
17560 *)      srandom_r_proto=0
17561         ;;
17562 esac
17563
17564 : see if prototype for setresgid is available
17565 echo " "
17566 set d_sresgproto setresgid $i_unistd unistd.h
17567 eval $hasproto
17568
17569 : see if prototype for setresuid is available
17570 echo " "
17571 set d_sresuproto setresuid $i_unistd unistd.h
17572 eval $hasproto
17573
17574 : see if sys/stat.h is available
17575 set sys/stat.h i_sysstat
17576 eval $inhdr
17577
17578 : see if stat knows about block sizes
17579 echo " "
17580 echo "Checking to see if your struct stat has st_blocks field..." >&4
17581 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17582 eval $hasfield
17583
17584 : see if this is a sys/vfs.h system
17585 set sys/vfs.h i_sysvfs
17586 eval $inhdr
17587
17588 : see if this is a sys/statfs.h system
17589 set sys/statfs.h i_sysstatfs
17590 eval $inhdr
17591
17592 : Check for statfs_s
17593 echo " "
17594 echo "Checking to see if your system supports struct statfs..." >&4
17595 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
17596 eval $hasstruct
17597 case "$d_statfs_s" in
17598 "$define")      echo "Yes, it does."   ;;
17599 *)              echo "No, it doesn't." ;;
17600 esac
17601
17602
17603 : see if struct statfs knows about f_flags
17604 case "$d_statfs_s" in
17605 define)
17606         echo " "
17607         echo "Checking to see if your struct statfs has f_flags field..." >&4
17608         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
17609         eval $hasfield
17610         ;;
17611 *)      val="$undef"
17612         set d_statfs_f_flags
17613         eval $setvar
17614         ;;
17615 esac
17616 case "$d_statfs_f_flags" in
17617 "$define")      echo "Yes, it does."   ;;
17618 *)              echo "No, it doesn't." ;;
17619 esac
17620
17621 : Check stream access
17622 $cat >&4 <<EOM
17623 Checking how to access stdio streams by file descriptor number...
17624 EOM
17625 case "$stdio_stream_array" in
17626 '')     $cat >try.c <<EOCP
17627 #include <stdio.h>
17628 int main() {
17629   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17630     printf("yes\n");
17631 }
17632 EOCP
17633         for s in _iob __iob __sF
17634         do
17635                 set try -DSTDIO_STREAM_ARRAY=$s
17636                 if eval $compile; then
17637                         case "`$run ./try`" in
17638                         yes)    stdio_stream_array=$s; break ;;
17639                         esac
17640                 fi
17641         done
17642         $rm_try
17643 esac
17644 case "$stdio_stream_array" in
17645 '')     $cat >&4 <<EOM
17646 I can't figure out how to access stdio streams by file descriptor number.
17647 EOM
17648         d_stdio_stream_array="$undef"
17649         ;;
17650 *)      $cat >&4 <<EOM
17651 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17652 EOM
17653         d_stdio_stream_array="$define"
17654         ;;
17655 esac
17656
17657 : see if strcoll exists
17658 set strcoll d_strcoll
17659 eval $inlibc
17660
17661 : check for structure copying
17662 echo " "
17663 echo "Checking to see if your C compiler can copy structs..." >&4
17664 $cat >try.c <<'EOCP'
17665 int main()
17666 {
17667         struct blurfl {
17668                 int dyick;
17669         } foo, bar;
17670
17671         foo = bar;
17672 }
17673 EOCP
17674 if $cc -c try.c >/dev/null 2>&1 ; then
17675         val="$define"
17676         echo "Yup, it can."
17677 else
17678         val="$undef"
17679         echo "Nope, it can't."
17680 fi
17681 set d_strctcpy
17682 eval $setvar
17683 $rm_try
17684
17685 : see if strerror and/or sys_errlist[] exist
17686 echo " "
17687 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17688     if set strerror val -f d_strerror; eval $csym; $val; then
17689                 echo 'strerror() found.' >&4
17690                 d_strerror="$define"
17691                 d_strerrm='strerror(e)'
17692                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17693                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17694                         d_syserrlst="$define"
17695                 else
17696                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17697                         d_syserrlst="$undef"
17698                 fi
17699     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17700                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17701                 echo 'strerror() found in string header.' >&4
17702                 d_strerror="$define"
17703                 d_strerrm='strerror(e)'
17704                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17705                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17706                                 d_syserrlst="$define"
17707                 else
17708                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17709                         d_syserrlst="$undef"
17710                 fi
17711     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17712                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17713                 d_strerror="$undef"
17714                 d_syserrlst="$define"
17715                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17716     else
17717                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17718                 d_strerror="$undef"
17719                 d_syserrlst="$undef"
17720                 d_strerrm='"unknown"'
17721     fi
17722 fi
17723
17724 : see if strerror_r exists
17725 set strerror_r d_strerror_r
17726 eval $inlibc
17727 case "$d_strerror_r" in
17728 "$define")
17729         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17730         case "$d_strerror_r_proto:$usethreads" in
17731         ":define")      d_strerror_r_proto=define
17732                 set d_strerror_r_proto strerror_r $hdrs
17733                 eval $hasproto ;;
17734         *)      ;;
17735         esac
17736         case "$d_strerror_r_proto" in
17737         define)
17738         case "$strerror_r_proto" in
17739         ''|0) try='int strerror_r(int, char*, size_t);'
17740         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17741         esac
17742         case "$strerror_r_proto" in
17743         ''|0) try='int strerror_r(int, char*, int);'
17744         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17745         esac
17746         case "$strerror_r_proto" in
17747         ''|0) try='char* strerror_r(int, char*, size_t);'
17748         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17749         esac
17750         case "$strerror_r_proto" in
17751         ''|0)   d_strerror_r=undef
17752                 strerror_r_proto=0
17753                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17754         * )     case "$strerror_r_proto" in
17755                 REENTRANT_PROTO*) ;;
17756                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17757                 esac
17758                 echo "Prototype: $try" ;;
17759         esac
17760         ;;
17761         *)      case "$usethreads" in
17762                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17763                 esac
17764                 d_strerror_r=undef
17765                 strerror_r_proto=0
17766                 ;;
17767         esac
17768         ;;
17769 *)      strerror_r_proto=0
17770         ;;
17771 esac
17772
17773 : see if strftime exists
17774 set strftime d_strftime
17775 eval $inlibc
17776
17777 : see if strlcat exists
17778 set strlcat d_strlcat
17779 eval $inlibc
17780
17781 : see if strlcpy exists
17782 set strlcpy d_strlcpy
17783 eval $inlibc
17784
17785 : see if strtod exists
17786 set strtod d_strtod
17787 eval $inlibc
17788
17789 : see if strtol exists
17790 set strtol d_strtol
17791 eval $inlibc
17792
17793 : see if strtold exists
17794 set strtold d_strtold
17795 eval $inlibc
17796
17797 : see if strtoll exists
17798 set strtoll d_strtoll
17799 eval $inlibc
17800
17801 case "$d_longlong-$d_strtoll" in
17802 "$define-$define")
17803         $cat <<EOM
17804 Checking whether your strtoll() works okay...
17805 EOM
17806         $cat >try.c <<'EOCP'
17807 #include <errno.h>
17808 #ifdef __hpux
17809 #define strtoll __strtoll
17810 #endif
17811 #ifdef __EMX__
17812 #define strtoll _strtoll
17813 #endif
17814 #include <stdio.h>
17815 extern long long int strtoll(char *s, char **, int);
17816 static int bad = 0;
17817 int check(char *s, long long ell, int een) {
17818         long long gll;
17819         errno = 0;
17820         gll = strtoll(s, 0, 10);
17821         if (!((gll == ell) && (errno == een)))
17822                 bad++;
17823 }
17824 int main() {
17825         check(" 1",                                      1LL, 0);
17826         check(" 0",                                      0LL, 0);
17827         check("-1",                                     -1LL, 0);
17828         check("-9223372036854775808", -9223372036854775808LL, 0);
17829         check("-9223372036854775808", -9223372036854775808LL, 0);
17830         check(" 9223372036854775807",  9223372036854775807LL, 0);
17831         check("-9223372036854775808", -9223372036854775808LL, 0);
17832         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17833         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17834         if (!bad)
17835                 printf("ok\n");
17836 }
17837 EOCP
17838         set try
17839         if eval $compile; then
17840                 yyy=`$run ./try`
17841                 case "$yyy" in
17842                 ok) echo "Your strtoll() seems to be working okay." ;;
17843                 *) cat <<EOM >&4
17844 Your strtoll() doesn't seem to be working okay.
17845 EOM
17846                    d_strtoll="$undef"
17847                    ;;
17848                 esac
17849         else
17850                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17851                 d_strtoll="$undef"
17852         fi
17853         ;;
17854 esac
17855
17856 : see if strtoq exists
17857 set strtoq d_strtoq
17858 eval $inlibc
17859
17860 : see if strtoul exists
17861 set strtoul d_strtoul
17862 eval $inlibc
17863
17864 case "$d_strtoul" in
17865 "$define")
17866         $cat <<EOM
17867 Checking whether your strtoul() works okay...
17868 EOM
17869         $cat >try.c <<'EOCP'
17870 #include <errno.h>
17871 #include <stdio.h>
17872 extern unsigned long int strtoul(char *s, char **, int);
17873 static int bad = 0;
17874 void check(char *s, unsigned long eul, int een) {
17875         unsigned long gul;
17876         errno = 0;
17877         gul = strtoul(s, 0, 10);
17878         if (!((gul == eul) && (errno == een)))
17879                 bad++;
17880 }
17881 int main() {
17882         check(" 1", 1L, 0);
17883         check(" 0", 0L, 0);
17884 EOCP
17885         case "$longsize" in
17886         8)
17887             $cat >>try.c <<'EOCP'
17888         check("18446744073709551615", 18446744073709551615UL, 0);
17889         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17890 #if 0 /* strtoul() for /^-/ strings is undefined. */
17891         check("-1", 18446744073709551615UL, 0);
17892         check("-18446744073709551614", 2, 0);
17893         check("-18446744073709551615", 1, 0);
17894         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17895         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17896 #endif
17897 EOCP
17898                 ;;
17899         4)
17900                     $cat >>try.c <<'EOCP'
17901         check("4294967295", 4294967295UL, 0);
17902         check("4294967296", 4294967295UL, ERANGE);
17903 #if 0 /* strtoul() for /^-/ strings is undefined. */
17904         check("-1", 4294967295UL, 0);
17905         check("-4294967294", 2, 0);
17906         check("-4294967295", 1, 0);
17907         check("-4294967296", 4294967295UL, ERANGE);
17908         check("-4294967297", 4294967295UL, ERANGE);
17909 #endif
17910 EOCP
17911                 ;;
17912         *)
17913 : Should we write these tests to be more portable by sprintf-ing
17914 : ~0 and then manipulating that char string as input for strtol?
17915                 ;;
17916         esac
17917         $cat >>try.c <<'EOCP'
17918         if (!bad)
17919                 printf("ok\n");
17920         return 0;
17921 }
17922 EOCP
17923         set try
17924         if eval $compile; then
17925                 case "`$run ./try`" in
17926                 ok) echo "Your strtoul() seems to be working okay." ;;
17927                 *) cat <<EOM >&4
17928 Your strtoul() doesn't seem to be working okay.
17929 EOM
17930                    d_strtoul="$undef"
17931                    ;;
17932                 esac
17933         else
17934                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17935                 d_strtoul="$undef"
17936         fi
17937         ;;
17938 esac
17939
17940 : see if strtoull exists
17941 set strtoull d_strtoull
17942 eval $inlibc
17943
17944 case "$d_longlong-$d_strtoull" in
17945 "$define-$define")
17946         $cat <<EOM
17947 Checking whether your strtoull() works okay...
17948 EOM
17949         $cat >try.c <<'EOCP'
17950 #include <errno.h>
17951 #ifdef __hpux
17952 #define strtoull __strtoull
17953 #endif
17954 #include <stdio.h>
17955 extern unsigned long long int strtoull(char *s, char **, int);
17956 static int bad = 0;
17957 int check(char *s, long long eull, int een) {
17958         long long gull;
17959         errno = 0;
17960         gull = strtoull(s, 0, 10);
17961         if (!((gull == eull) && (errno == een)))
17962                 bad++;
17963 }
17964 int main() {
17965         check(" 1",                                        1LL, 0);
17966         check(" 0",                                        0LL, 0);
17967         check("18446744073709551615",  18446744073709551615ULL, 0);
17968         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17969 #if 0 /* strtoull() for /^-/ strings is undefined. */
17970         check("-1",                    18446744073709551615ULL, 0);
17971         check("-18446744073709551614",                     2LL, 0);
17972         check("-18446744073709551615",                     1LL, 0);
17973         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17974         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17975 #endif
17976         if (!bad)
17977                 printf("ok\n");
17978 }
17979 EOCP
17980         set try
17981         if eval $compile; then
17982                 case "`$run ./try`" in
17983                 ok) echo "Your strtoull() seems to be working okay." ;;
17984                 *) cat <<EOM >&4
17985 Your strtoull() doesn't seem to be working okay.
17986 EOM
17987                    d_strtoull="$undef"
17988                    ;;
17989                 esac
17990         else
17991                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17992                 d_strtoull="$undef"
17993         fi
17994         ;;
17995 esac
17996
17997 : see if strtouq exists
17998 set strtouq d_strtouq
17999 eval $inlibc
18000
18001 case "$d_strtouq" in
18002 "$define")
18003         $cat <<EOM
18004 Checking whether your strtouq() works okay...
18005 EOM
18006         $cat >try.c <<'EOCP'
18007 #include <errno.h>
18008 #include <stdio.h>
18009 extern unsigned long long int strtouq(char *s, char **, int);
18010 static int bad = 0;
18011 void check(char *s, unsigned long long eull, int een) {
18012         unsigned long long gull;
18013         errno = 0;
18014         gull = strtouq(s, 0, 10);
18015         if (!((gull == eull) && (errno == een)))
18016                 bad++;
18017 }
18018 int main() {
18019         check(" 1",                                        1LL, 0);
18020         check(" 0",                                        0LL, 0);
18021         check("18446744073709551615",  18446744073709551615ULL, 0);
18022         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18023 #if 0 /* strtouq() for /^-/ strings is undefined. */
18024         check("-1",                    18446744073709551615ULL, 0);
18025         check("-18446744073709551614",                     2LL, 0);
18026         check("-18446744073709551615",                     1LL, 0);
18027         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18028         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18029 #endif
18030         if (!bad)
18031                 printf("ok\n");
18032         return 0;
18033 }
18034 EOCP
18035         set try
18036         if eval $compile; then
18037                 case "`$run ./try`" in
18038                 ok) echo "Your strtouq() seems to be working okay." ;;
18039                 *) cat <<EOM >&4
18040 Your strtouq() doesn't seem to be working okay.
18041 EOM
18042                    d_strtouq="$undef"
18043                    ;;
18044                 esac
18045         else
18046                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18047                 d_strtouq="$undef"
18048         fi
18049         ;;
18050 esac
18051
18052 : see if strxfrm exists
18053 set strxfrm d_strxfrm
18054 eval $inlibc
18055
18056 : see if symlink exists
18057 set symlink d_symlink
18058 eval $inlibc
18059
18060 : see if syscall exists
18061 set syscall d_syscall
18062 eval $inlibc
18063
18064 : see if prototype for syscall is available
18065 echo " "
18066 set d_syscallproto syscall $i_unistd unistd.h
18067 eval $hasproto
18068
18069 : see if sysconf exists
18070 set sysconf d_sysconf
18071 eval $inlibc
18072
18073 : see if system exists
18074 set system d_system
18075 eval $inlibc
18076
18077 : see if tcgetpgrp exists
18078 set tcgetpgrp d_tcgetpgrp
18079 eval $inlibc
18080
18081 : see if tcsetpgrp exists
18082 set tcsetpgrp d_tcsetpgrp
18083 eval $inlibc
18084
18085 : see if prototype for telldir is available
18086 echo " "
18087 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18088 eval $hasproto
18089
18090 : see if time exists
18091 echo " "
18092 if test "X$d_time" = X -o X"$timetype" = X; then
18093     if set time val -f d_time; eval $csym; $val; then
18094                 echo 'time() found.' >&4
18095                 val="$define"
18096                 rp="What is the type returned by time() on this system?"
18097                 set time_t timetype long stdio.h sys/types.h
18098                 eval $typedef_ask
18099     else
18100                 echo 'time() not found, hope that will do.' >&4
18101                 val="$undef"
18102                 timetype='int';
18103     fi
18104     set d_time
18105     eval $setvar
18106 fi
18107
18108 : see if this is a sys/times.h system
18109 set sys/times.h i_systimes
18110 eval $inhdr
18111
18112 : see if times exists
18113 echo " "
18114 if set times val -f d_times; eval $csym; $val; then
18115         echo 'times() found.' >&4
18116         d_times="$define"
18117         inc=''
18118         case "$i_systimes" in
18119         "$define") inc='sys/times.h';;
18120         esac
18121         rp="What is the type returned by times() on this system?"
18122         set clock_t clocktype long stdio.h sys/types.h $inc
18123         eval $typedef_ask
18124 else
18125         echo 'times() NOT found, hope that will do.' >&4
18126         d_times="$undef"
18127         clocktype='int'
18128 fi
18129
18130 : see if tmpnam_r exists
18131 set tmpnam_r d_tmpnam_r
18132 eval $inlibc
18133 case "$d_tmpnam_r" in
18134 "$define")
18135         hdrs="$i_systypes sys/types.h define stdio.h "
18136         case "$d_tmpnam_r_proto:$usethreads" in
18137         ":define")      d_tmpnam_r_proto=define
18138                 set d_tmpnam_r_proto tmpnam_r $hdrs
18139                 eval $hasproto ;;
18140         *)      ;;
18141         esac
18142         case "$d_tmpnam_r_proto" in
18143         define)
18144         case "$tmpnam_r_proto" in
18145         ''|0) try='char* tmpnam_r(char*);'
18146         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
18147         esac
18148         case "$tmpnam_r_proto" in
18149         ''|0)   d_tmpnam_r=undef
18150                 tmpnam_r_proto=0
18151                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18152         * )     case "$tmpnam_r_proto" in
18153                 REENTRANT_PROTO*) ;;
18154                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18155                 esac
18156                 echo "Prototype: $try" ;;
18157         esac
18158         ;;
18159         *)      case "$usethreads" in
18160                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18161                 esac
18162                 d_tmpnam_r=undef
18163                 tmpnam_r_proto=0
18164                 ;;
18165         esac
18166         ;;
18167 *)      tmpnam_r_proto=0
18168         ;;
18169 esac
18170
18171 : see if truncate exists
18172 set truncate d_truncate
18173 eval $inlibc
18174
18175 : see if ttyname_r exists
18176 set ttyname_r d_ttyname_r
18177 eval $inlibc
18178 case "$d_ttyname_r" in
18179 "$define")
18180         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18181         case "$d_ttyname_r_proto:$usethreads" in
18182         ":define")      d_ttyname_r_proto=define
18183                 set d_ttyname_r_proto ttyname_r $hdrs
18184                 eval $hasproto ;;
18185         *)      ;;
18186         esac
18187         case "$d_ttyname_r_proto" in
18188         define)
18189         case "$ttyname_r_proto" in
18190         ''|0) try='int ttyname_r(int, char*, size_t);'
18191         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
18192         esac
18193         case "$ttyname_r_proto" in
18194         ''|0) try='int ttyname_r(int, char*, int);'
18195         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
18196         esac
18197         case "$ttyname_r_proto" in
18198         ''|0) try='char* ttyname_r(int, char*, int);'
18199         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
18200         esac
18201         case "$ttyname_r_proto" in
18202         ''|0)   d_ttyname_r=undef
18203                 ttyname_r_proto=0
18204                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18205         * )     case "$ttyname_r_proto" in
18206                 REENTRANT_PROTO*) ;;
18207                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18208                 esac
18209                 echo "Prototype: $try" ;;
18210         esac
18211         ;;
18212         *)      case "$usethreads" in
18213                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18214                 esac
18215                 d_ttyname_r=undef
18216                 ttyname_r_proto=0
18217                 ;;
18218         esac
18219         ;;
18220 *)      ttyname_r_proto=0
18221         ;;
18222 esac
18223
18224 : see if tzname[] exists
18225 echo " "
18226 if set tzname val -a d_tzname; eval $csym; $val; then
18227         val="$define"
18228         echo 'tzname[] found.' >&4
18229 else
18230         val="$undef"
18231         echo 'tzname[] NOT found.' >&4
18232 fi
18233 set d_tzname
18234 eval $setvar
18235
18236 : Check if is a multiplatform env
18237 case "$osname" in
18238 next|rhapsody|darwin) multiarch="$define" ;;
18239 esac
18240 case "$multiarch" in
18241 ''|[nN]*) multiarch="$undef" ;;
18242 esac
18243
18244 : check for ordering of bytes in a UV
18245 echo " "
18246 case "$usecrosscompile$multiarch" in
18247 *$define*)
18248         $cat <<EOM
18249 You seem to be either cross-compiling or doing a multiarchitecture build,
18250 skipping the byteorder check.
18251
18252 EOM
18253         byteorder='ffff'
18254         ;;
18255 *)
18256         case "$byteorder" in
18257         '')
18258                 $cat <<'EOM'
18259 In the following, larger digits indicate more significance.  A big-endian
18260 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18261 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18262 machines may have weird orders like 3412.  A Cray will report 87654321,
18263 an Alpha will report 12345678. If the test program works the default is
18264 probably right.
18265 I'm now running the test program...
18266 EOM
18267                 $cat >try.c <<EOCP
18268 #include <stdio.h>
18269 #$i_stdlib I_STDLIB
18270 #ifdef I_STDLIB
18271 #include <stdlib.h>
18272 #endif
18273 #include <sys/types.h>
18274 typedef $uvtype UV;
18275 int main()
18276 {
18277         int i;
18278         union {
18279                 UV l;
18280                 char c[$uvsize];
18281         } u;
18282
18283         if ($uvsize > 4)
18284                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18285         else
18286                 u.l = (UV)0x04030201;
18287         for (i = 0; i < $uvsize; i++)
18288                 printf("%c", u.c[i]+'0');
18289         printf("\n");
18290         exit(0);
18291 }
18292 EOCP
18293                 xxx_prompt=y
18294                 set try
18295                 if eval $compile && $run ./try > /dev/null; then
18296                         dflt=`$run ./try`
18297                         case "$dflt" in
18298                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18299                                 echo "(The test program ran ok.)"
18300                                 echo "byteorder=$dflt"
18301                                 xxx_prompt=n
18302                         ;;
18303                         ????|????????) echo "(The test program ran ok.)" ;;
18304                         *) echo "(The test program didn't run right for some reason.)" ;;
18305                         esac
18306                 else
18307                         dflt='4321'
18308                         cat <<'EOM'
18309 (I can't seem to compile the test program.  Guessing big-endian...)
18310 EOM
18311                 fi
18312                 case "$xxx_prompt" in
18313                 y)
18314                         rp="What is the order of bytes in $uvtype?"
18315                         . ./myread
18316                         byteorder="$ans"
18317                         ;;
18318                 *)      byteorder=$dflt
18319                         ;;
18320                 esac
18321                 ;;
18322         esac
18323         $rm_try
18324         ;;
18325 esac
18326
18327 : Checking 32bit aligndness
18328 $cat <<EOM
18329
18330 Checking to see whether you can access character data unalignedly...
18331 EOM
18332 case "$d_u32align" in
18333 '')   $cat >try.c <<EOCP
18334 #include <stdio.h>
18335 #$i_stdlib I_STDLIB
18336 #ifdef I_STDLIB
18337 #include <stdlib.h>
18338 #endif
18339 #define U32 $u32type
18340 #define BYTEORDER 0x$byteorder
18341 #define U8 $u8type
18342 #include <signal.h>
18343 #ifdef SIGBUS
18344 $signal_t bletch(int s) { exit(4); }
18345 #endif
18346 int main() {
18347 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18348     U8 buf[8];
18349     U32 *up;
18350     int i;
18351
18352     if (sizeof(U32) != 4) {
18353         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18354         exit(1);
18355     }
18356
18357     fflush(stdout);
18358
18359 #ifdef SIGBUS
18360     signal(SIGBUS, bletch);
18361 #endif
18362
18363     buf[0] = 0;
18364     buf[1] = 0;
18365     buf[2] = 0;
18366     buf[3] = 1;
18367     buf[4] = 0;
18368     buf[5] = 0;
18369     buf[6] = 0;
18370     buf[7] = 1;
18371
18372     for (i = 0; i < 4; i++) {
18373         up = (U32*)(buf + i);
18374         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18375                (*up == 1 << (8*(3-i)))  /* little-endian */
18376               )
18377            )
18378         {
18379             printf("read failed (%x)\n", *up);
18380             exit(2);
18381         }
18382     }
18383
18384     /* write test */
18385     for (i = 0; i < 4; i++) {
18386         up = (U32*)(buf + i);
18387         *up = 0xBeef;
18388         if (*up != 0xBeef) {
18389             printf("write failed (%x)\n", *up);
18390             exit(3);
18391         }
18392     }
18393
18394     exit(0);
18395 #else
18396     printf("1\n");
18397     exit(1);
18398 #endif
18399     return 0;
18400 }
18401 EOCP
18402 set try
18403 if eval $compile_ok; then
18404         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18405         $run ./try 2>&1 >/dev/null
18406         case "$?" in
18407         0)      cat >&4 <<EOM
18408 You can access character data pretty unalignedly.
18409 EOM
18410                 d_u32align="$undef"
18411                 ;;
18412         *)      cat >&4 <<EOM
18413 It seems that you must access character data in an aligned manner.
18414 EOM
18415                 d_u32align="$define"
18416                 ;;
18417         esac
18418 else
18419         rp='Can you access character data at unaligned addresses?'
18420         dflt='n'
18421         . ./myread
18422         case "$ans" in
18423         [yY]*)  d_u32align="$undef"  ;;
18424         *)      d_u32align="$define" ;;
18425         esac
18426 fi
18427 $rm_try
18428 ;;
18429 esac
18430
18431 : see if ualarm exists
18432 set ualarm d_ualarm
18433 eval $inlibc
18434
18435 : see if umask exists
18436 set umask d_umask
18437 eval $inlibc
18438
18439 : see if unordered exists
18440 set unordered d_unordered
18441 eval $inlibc
18442
18443 : see if unsetenv exists
18444 set unsetenv d_unsetenv
18445 eval $inlibc
18446
18447 : see if usleep exists
18448 set usleep d_usleep
18449 eval $inlibc
18450
18451 : see if prototype for usleep is available
18452 echo " "
18453 set d_usleepproto usleep $i_unistd unistd.h
18454 eval $hasproto
18455
18456 : see if ustat exists
18457 set ustat d_ustat
18458 eval $inlibc
18459
18460 : see if closedir exists
18461 set closedir d_closedir
18462 eval $inlibc
18463
18464 case "$d_closedir" in
18465 "$define")
18466         echo " "
18467         echo "Checking whether closedir() returns a status..." >&4
18468         cat > try.c <<EOM
18469 #$i_dirent I_DIRENT             /**/
18470 #$i_sysdir I_SYS_DIR            /**/
18471 #$i_sysndir I_SYS_NDIR          /**/
18472 #$i_systypes I_SYS_TYPES        /**/
18473
18474 #if defined(I_SYS_TYPES)
18475 #include <sys/types.h>
18476 #endif
18477 #if defined(I_DIRENT)
18478 #include <dirent.h>
18479 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18480 #include <sys/dir.h>
18481 #endif
18482 #else
18483 #ifdef I_SYS_NDIR
18484 #include <sys/ndir.h>
18485 #else
18486 #ifdef I_SYS_DIR
18487 #ifdef hp9000s500
18488 #include <ndir.h>       /* may be wrong in the future */
18489 #else
18490 #include <sys/dir.h>
18491 #endif
18492 #endif
18493 #endif
18494 #endif
18495 int main() { return closedir(opendir(".")); }
18496 EOM
18497         set try
18498         if eval $compile_ok; then
18499                 if $run ./try > /dev/null 2>&1 ; then
18500                         echo "Yes, it does."
18501                         val="$undef"
18502                 else
18503                         echo "No, it doesn't."
18504                         val="$define"
18505                 fi
18506         else
18507                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18508                 val="$define"
18509         fi
18510         ;;
18511 *)
18512         val="$undef";
18513         ;;
18514 esac
18515 set d_void_closedir
18516 eval $setvar
18517 $rm_try
18518
18519 : see if there is a wait4
18520 set wait4 d_wait4
18521 eval $inlibc
18522
18523 : see if waitpid exists
18524 set waitpid d_waitpid
18525 eval $inlibc
18526
18527 : see if wcstombs exists
18528 set wcstombs d_wcstombs
18529 eval $inlibc
18530
18531 : see if wctomb exists
18532 set wctomb d_wctomb
18533 eval $inlibc
18534
18535 : see if writev exists
18536 set writev d_writev
18537 eval $inlibc
18538
18539 : preserve RCS keywords in files with variable substitution, grrr
18540 Date='$Date'
18541 Id='$Id'
18542 Log='$Log'
18543 RCSfile='$RCSfile'
18544 Revision='$Revision'
18545
18546 : check for alignment requirements
18547 echo " "
18548 case "$usecrosscompile$multiarch" in
18549 *$define*)
18550         $cat <<EOM
18551 You seem to be either cross-compiling or doing a multiarchitecture build,
18552 skipping the memory alignment check.
18553
18554 EOM
18555         case "$alignbytes" in
18556         '') alignbytes=8 ;;
18557         esac
18558         ;;
18559 *)
18560         case "$alignbytes" in
18561         '') echo "Checking alignment constraints..." >&4
18562                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18563                         $cat >try.c <<'EOCP'
18564 typedef long double NV;
18565 EOCP
18566                 else
18567                         $cat >try.c <<'EOCP'
18568 typedef double NV;
18569 EOCP
18570                 fi
18571                 $cat >>try.c <<'EOCP'
18572 #include <stdio.h>
18573 struct foobar {
18574         char foo;
18575         NV bar;
18576 } try_algn;
18577 int main()
18578 {
18579     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18580     return(0);
18581 }
18582 EOCP
18583                 set try
18584                 if eval $compile_ok; then
18585                         dflt=`$run ./try`
18586                 else
18587                         dflt='8'
18588                         echo "(I can't seem to compile the test program...)"
18589                 fi
18590                 ;;
18591         *) dflt="$alignbytes"
18592                 ;;
18593         esac
18594         rp="Doubles must be aligned on a how-many-byte boundary?"
18595         . ./myread
18596         alignbytes="$ans"
18597         $rm_try
18598         ;;
18599 esac
18600
18601
18602 : set the base revision
18603 baserev=5.0
18604
18605 : how do we concatenate cpp tokens here?
18606 echo " "
18607 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18608 $cat >cpp_stuff.c <<'EOCP'
18609 #define RCAT(a,b)a/**/b
18610 #define ACAT(a,b)a ## b
18611 RCAT(Rei,ser)
18612 ACAT(Cir,cus)
18613 EOCP
18614 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18615 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18616         echo "Oh!  Smells like ANSI's been here." >&4
18617         echo "We can catify or stringify, separately or together!"
18618         cpp_stuff=42
18619 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18620         echo "Ah, yes!  The good old days!" >&4
18621         echo "However, in the good old days we don't know how to stringify and"
18622         echo "catify at the same time."
18623         cpp_stuff=1
18624 else
18625         $cat >&4 <<EOM
18626 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18627 You're going to have to edit the values of CAT[2-5] in config.h...
18628 EOM
18629         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18630 fi
18631 $rm -f cpp_stuff.*
18632
18633 : see if this is a db.h system
18634 set db.h i_db
18635 eval $inhdr
18636
18637 case "$i_db" in
18638 $define)
18639         : Check db version.
18640         echo " "
18641         echo "Checking Berkeley DB version ..." >&4
18642         $cat >try.c <<EOCP
18643 #$d_const HASCONST
18644 #ifndef HASCONST
18645 #define const
18646 #endif
18647 #include <sys/types.h>
18648 #include <stdio.h>
18649 #$i_stdlib I_STDLIB
18650 #ifdef I_STDLIB
18651 #include <stdlib.h>
18652 #endif
18653 #include <db.h>
18654 int main(int argc, char *argv[])
18655 {
18656 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18657     int Major, Minor, Patch ;
18658     unsigned long Version ;
18659     (void)db_version(&Major, &Minor, &Patch) ;
18660     if (argc == 2) {
18661         printf("%d %d %d %d %d %d\n",
18662                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18663                Major, Minor, Patch);
18664         exit(0);
18665     }
18666     printf("You have Berkeley DB Version 2 or greater.\n");
18667
18668     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18669                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18670     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18671                 Major, Minor, Patch) ;
18672
18673     /* check that db.h & libdb are compatible */
18674     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18675         printf("db.h and libdb are incompatible.\n") ;
18676         exit(3);
18677     }
18678
18679     printf("db.h and libdb are compatible.\n") ;
18680
18681     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18682                 + DB_VERSION_PATCH ;
18683
18684     /* needs to be >= 2.3.4 */
18685     if (Version < 2003004) {
18686     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18687         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18688         exit(2);
18689     }
18690
18691     exit(0);
18692 #else
18693 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18694     if (argc == 2) {
18695         printf("1 0 0\n");
18696         exit(0);
18697     }
18698     printf("You have Berkeley DB Version 1.\n");
18699     exit(0);    /* DB version < 2: the coast is clear. */
18700 #else
18701     exit(1);    /* <db.h> not Berkeley DB? */
18702 #endif
18703 #endif
18704 }
18705 EOCP
18706         set try
18707         if eval $compile_ok && $run ./try; then
18708                 echo 'Looks OK.' >&4
18709                 set `$run ./try 1`
18710                 db_version_major=$1
18711                 db_version_minor=$2
18712                 db_version_patch=$3
18713         else
18714                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18715                 i_db=$undef
18716                 case " $libs " in
18717                 *"-ldb "*)
18718                         : Remove db from list of libraries to use
18719                         echo "Removing unusable -ldb from library list" >&4
18720                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18721                         shift
18722                         libs="$*"
18723                         echo "libs = $libs" >&4
18724                         ;;
18725                 esac
18726         fi
18727         $rm_try
18728         ;;
18729 esac
18730
18731 case "$i_db" in
18732 define)
18733         : Check the return type needed for hash
18734         echo " "
18735         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18736         $cat >try.c <<EOCP
18737 #$d_const HASCONST
18738 #ifndef HASCONST
18739 #define const
18740 #endif
18741 #include <sys/types.h>
18742 #include <db.h>
18743
18744 #ifndef DB_VERSION_MAJOR
18745 u_int32_t hash_cb (ptr, size)
18746 const void *ptr;
18747 size_t size;
18748 {
18749 }
18750 HASHINFO info;
18751 int main()
18752 {
18753         info.hash = hash_cb;
18754 }
18755 #endif
18756 EOCP
18757         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18758                 if $contains warning try.out >>/dev/null 2>&1 ; then
18759                         db_hashtype='int'
18760                 else
18761                         db_hashtype='u_int32_t'
18762                 fi
18763         else
18764                 : XXX Maybe we should just give up here.
18765                 db_hashtype=u_int32_t
18766                 $cat try.out >&4
18767                 echo "Help:  I can't seem to compile the db test program." >&4
18768                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18769         fi
18770         $rm_try
18771         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18772         ;;
18773 *)      db_hashtype=u_int32_t
18774         ;;
18775 esac
18776 case "$i_db" in
18777 define)
18778         : Check the return type needed for prefix
18779         echo " "
18780         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18781         cat >try.c <<EOCP
18782 #$d_const HASCONST
18783 #ifndef HASCONST
18784 #define const
18785 #endif
18786 #include <sys/types.h>
18787 #include <db.h>
18788
18789 #ifndef DB_VERSION_MAJOR
18790 size_t prefix_cb (key1, key2)
18791 const DBT *key1;
18792 const DBT *key2;
18793 {
18794 }
18795 BTREEINFO info;
18796 int main()
18797 {
18798         info.prefix = prefix_cb;
18799 }
18800 #endif
18801 EOCP
18802         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18803                 if $contains warning try.out >>/dev/null 2>&1 ; then
18804                         db_prefixtype='int'
18805                 else
18806                         db_prefixtype='size_t'
18807                 fi
18808         else
18809                 db_prefixtype='size_t'
18810                 : XXX Maybe we should just give up here.
18811                 $cat try.out >&4
18812                 echo "Help:  I can't seem to compile the db test program." >&4
18813                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18814         fi
18815         $rm_try
18816         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18817         ;;
18818 *)      db_prefixtype='size_t'
18819         ;;
18820 esac
18821
18822 : How can we generate normalized random numbers ?
18823 echo " "
18824 echo "Looking for a random number function..." >&4
18825 case "$randfunc" in
18826 '')
18827         if set drand48 val -f; eval $csym; $val; then
18828                 dflt="drand48"
18829                 echo "Good, found drand48()." >&4
18830         elif set random val -f; eval $csym; $val; then
18831                 dflt="random"
18832                 echo "OK, found random()." >&4
18833         else
18834                 dflt="rand"
18835                 echo "Yick, looks like I have to use rand()." >&4
18836         fi
18837         echo " "
18838         ;;
18839 *)
18840         dflt="$randfunc"
18841         ;;
18842 esac
18843 cont=true
18844
18845 case "$ccflags" in
18846 *-Dmy_rand=*|*-Dmy_srand=*)
18847         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18848         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18849         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18850         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18851         ;;
18852 esac
18853
18854 while $test "$cont"; do
18855         rp="Use which function to generate random numbers?"
18856         . ./myread
18857         if $test "$ans" = "$dflt"; then
18858                 : null
18859         else
18860                 randbits=''
18861         fi
18862         randfunc="$ans"
18863         if set $ans val -f; eval $csym; $val; then
18864                 cont=''
18865         else
18866                 dflt=y
18867                 rp="I cannot find function $ans. Use that name anyway?"
18868                 . ./myread
18869                 dflt=rand
18870                 case "$ans" in
18871                         [yY]*) cont='';;
18872                 esac
18873         fi
18874         case "$cont" in
18875         '')
18876                 case "$randfunc" in
18877                 drand48)
18878                         drand01="drand48()"
18879                         seedfunc="srand48"
18880                         randbits=48
18881                         randseedtype=long
18882                         ;;
18883                 rand|random)
18884                         case "$randbits" in
18885                         '')
18886 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18887                                 $cat >try.c <<EOCP
18888 #$i_unistd I_UNISTD
18889 #$i_stdlib I_STDLIB
18890 #include <stdio.h>
18891 #ifdef I_UNISTD
18892 #  include <unistd.h>
18893 #endif
18894 #ifdef I_STDLIB
18895 #  include <stdlib.h>
18896 #endif
18897 int main()
18898 {
18899         register int i;
18900         register unsigned long tmp;
18901         register unsigned long max = 0L;
18902
18903         for (i = 1000; i; i--) {
18904                 tmp = (unsigned long) $randfunc();
18905                 if (tmp > max) max = tmp;
18906         }
18907         for (i = 0; max; i++)
18908                 max /= 2;
18909         printf("%d\n",i);
18910 }
18911 EOCP
18912                                 set try
18913                                 if eval $compile_ok; then
18914                                         dflt=`try`
18915                                 else
18916                                         dflt='?'
18917                                         echo "(I can't seem to compile the test program...)"
18918                                 fi
18919                                 ;;
18920                         *)
18921                                 dflt="$randbits"
18922                                 ;;
18923                         esac
18924                         rp="How many bits does your $randfunc() function produce?"
18925                         . ./myread
18926                         randbits="$ans"
18927                         $rm_try
18928                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18929                         seedfunc="s$randfunc"
18930                         randseedtype=unsigned
18931                         ;;
18932                 *)
18933                         dflt="31"
18934                         rp="How many bits does your $randfunc() function produce?"
18935                         . ./myread
18936                         randbits="$ans"
18937                         seedfunc="s$randfunc"
18938                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18939                         if set $seedfunc val -f; eval $csym; $val; then
18940                                 echo "(Using $seedfunc() to seed random generator)"
18941                         else
18942                                 echo "(Warning: no $seedfunc() to seed random generator)"
18943                                 seedfunc=rand
18944                         fi
18945                         randseedtype=unsigned
18946                         ;;
18947                 esac
18948                 ;;
18949         esac
18950 done
18951
18952 : Determine if this is an EBCDIC system
18953 echo " "
18954 echo "Determining whether or not we are on an EBCDIC system..." >&4
18955 $cat >try.c <<'EOM'
18956 int main()
18957 {
18958   if ('M'==0xd4) return 0;
18959   return 1;
18960 }
18961 EOM
18962
18963 val=$undef
18964 set try
18965 if eval $compile_ok; then
18966         if $run ./try; then
18967                 echo "You seem to speak EBCDIC." >&4
18968                 val="$define"
18969         else
18970                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18971         fi
18972 else
18973         echo "I'm unable to compile the test program." >&4
18974         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18975 fi
18976 $rm_try
18977 set ebcdic
18978 eval $setvar
18979
18980 : Check how to flush
18981 echo " "
18982 $cat >&4 <<EOM
18983 Checking how to flush all pending stdio output...
18984 EOM
18985 # I only know how to find the first 32 possibly open files on SunOS.
18986 # See also hints/sunos_4_1.sh and util.c  --AD
18987 case "$osname" in
18988 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18989 esac
18990 $cat >>try.c <<EOCP
18991 #include <stdio.h>
18992 #$i_stdlib I_STDLIB
18993 #ifdef I_STDLIB
18994 #include <stdlib.h>
18995 #endif
18996 #$i_unistd I_UNISTD
18997 #ifdef I_UNISTD
18998 # include <unistd.h>
18999 #endif
19000 #$d_sysconf HAS_SYSCONF
19001 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19002 #ifdef HAS_STDIO_STREAM_ARRAY
19003 # define STDIO_STREAM_ARRAY $stdio_stream_array
19004 #endif
19005 int main() {
19006   FILE* p;
19007   unlink("try.out");
19008   p = fopen("try.out", "w");
19009 #ifdef TRY_FPUTC
19010   fputc('x', p);
19011 #else
19012 # ifdef TRY_FPRINTF
19013   fprintf(p, "x");
19014 # endif
19015 #endif
19016 #ifdef TRY_FFLUSH_NULL
19017   fflush(NULL);
19018 #endif
19019 #ifdef TRY_FFLUSH_ALL
19020   {
19021     long open_max = -1;
19022 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19023     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19024 # else
19025 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19026     open_max = sysconf(_SC_OPEN_MAX);
19027 #  else
19028 #   ifdef FOPEN_MAX
19029     open_max = FOPEN_MAX;
19030 #   else
19031 #    ifdef OPEN_MAX
19032     open_max = OPEN_MAX;
19033 #    else
19034 #     ifdef _NFILE
19035     open_max = _NFILE;
19036 #     endif
19037 #    endif
19038 #   endif
19039 #  endif
19040 # endif
19041 # ifdef HAS_STDIO_STREAM_ARRAY
19042     if (open_max > 0) {
19043       long i;
19044       for (i = 0; i < open_max; i++)
19045             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19046                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19047                 STDIO_STREAM_ARRAY[i]._flag)
19048                 fflush(&STDIO_STREAM_ARRAY[i]);
19049     }
19050   }
19051 # endif
19052 #endif
19053   _exit(42);
19054 }
19055 EOCP
19056 : first we have to find out how _not_ to flush
19057 $to try.c
19058 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19059     output=''
19060     set try -DTRY_FPUTC
19061     if eval $compile; then
19062             $run ./try 2>/dev/null
19063             code="$?"
19064             $from try.out
19065             if $test ! -s try.out -a "X$code" = X42; then
19066                 output=-DTRY_FPUTC
19067             fi
19068     fi
19069     case "$output" in
19070     '')
19071             set try -DTRY_FPRINTF
19072             if eval $compile; then
19073                     $run ./try 2>/dev/null
19074                     code="$?"
19075                     $from try.out
19076                     if $test ! -s try.out -a "X$code" = X42; then
19077                         output=-DTRY_FPRINTF
19078                     fi
19079             fi
19080         ;;
19081     esac
19082 fi
19083 : check for fflush NULL behaviour
19084 case "$fflushNULL" in
19085 '')     set try -DTRY_FFLUSH_NULL $output
19086         if eval $compile; then
19087                 $run ./try 2>/dev/null
19088                 code="$?"
19089                 $from try.out
19090                 if $test -s try.out -a "X$code" = X42; then
19091                         fflushNULL="`$cat try.out`"
19092                 else
19093                         if $test "X$code" != X42; then
19094                                 $cat >&4 <<EOM
19095 (If this test failed, don't worry, we'll try another method shortly.)
19096 EOM
19097                         fi
19098                 fi
19099         fi
19100         $rm -f core try.core core.try.*
19101         case "$fflushNULL" in
19102         x)      $cat >&4 <<EOM
19103 Your fflush(NULL) works okay for output streams.
19104 Let's see if it clobbers input pipes...
19105 EOM
19106 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19107 # bug that improperly flushes the input end of pipes.  So we avoid the
19108 # autoflush on fork/system/exec support for now. :-(
19109 $cat >tryp.c <<EOCP
19110 #include <stdio.h>
19111 int
19112 main(int argc, char **argv)
19113 {
19114     char buf[1024];
19115     int i;
19116     char *bp = buf;
19117     while (1) {
19118         while ((i = getc(stdin)) != -1
19119                && (*bp++ = i) != '\n'
19120                && bp < &buf[1024])
19121         /* DO NOTHING */ ;
19122         *bp = '\0';
19123         fprintf(stdout, "%s", buf);
19124         fflush(NULL);
19125         if (i == -1)
19126             return 0;
19127         bp = buf;
19128     }
19129 }
19130 EOCP
19131                 fflushNULL="$define"
19132                 set tryp
19133                 if eval $compile; then
19134                     $rm -f tryp.out
19135                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19136                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19137                        $cat >&4 <<EOM
19138 fflush(NULL) seems to behave okay with input streams.
19139 EOM
19140                         fflushNULL="$define"
19141                     else
19142                         $cat >&4 <<EOM
19143 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19144 EOM
19145                         fflushNULL="$undef"
19146                     fi
19147                 fi
19148                 $rm -f core tryp.c tryp.core core.tryp.*
19149                 ;;
19150         '')     $cat >&4 <<EOM
19151 Your fflush(NULL) isn't working (contrary to ANSI C).
19152 EOM
19153                 fflushNULL="$undef"
19154                 ;;
19155         *)      $cat >&4 <<EOM
19156 Cannot figure out whether your fflush(NULL) works or not.
19157 I'm assuming it doesn't (contrary to ANSI C).
19158 EOM
19159                 fflushNULL="$undef"
19160                 ;;
19161         esac
19162         ;;
19163 $define|true|[yY]*)
19164         fflushNULL="$define"
19165         ;;
19166 *)
19167         fflushNULL="$undef"
19168         ;;
19169 esac
19170 : check explicit looping only if NULL did not work, and if the pipe
19171 : bug does not show up on an explicit flush too
19172 case "$fflushNULL" in
19173 "$undef")
19174         $cat >tryp.c <<EOCP
19175 #include <stdio.h>
19176 int
19177 main(int argc, char **argv)
19178 {
19179     char buf[1024];
19180     int i;
19181     char *bp = buf;
19182     while (1) {
19183         while ((i = getc(stdin)) != -1
19184                && (*bp++ = i) != '\n'
19185                && bp < &buf[1024])
19186         /* DO NOTHING */ ;
19187         *bp = '\0';
19188         fprintf(stdout, "%s", buf);
19189         fflush(stdin);
19190         if (i == -1)
19191             return 0;
19192         bp = buf;
19193     }
19194 }
19195 EOCP
19196         set tryp
19197         if eval $compile; then
19198             $rm -f tryp.out
19199             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19200             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19201                $cat >&4 <<EOM
19202 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19203 EOM
19204                 : now check for fflushall behaviour
19205                 case "$fflushall" in
19206                 '')     set try -DTRY_FFLUSH_ALL $output
19207                         if eval $compile; then
19208                                 $cat >&4 <<EOM
19209 (Now testing the other method--but note that this also may fail.)
19210 EOM
19211                                 $run ./try 2>/dev/null
19212                                 code=$?
19213                                 $from try.out
19214                                 if $test -s try.out -a "X$code" = X42; then
19215                                         fflushall="`$cat try.out`"
19216                                 fi
19217                         fi
19218                         $rm_try
19219                         case "$fflushall" in
19220                         x)      $cat >&4 <<EOM
19221 Whew. Flushing explicitly all the stdio streams works.
19222 EOM
19223                                 fflushall="$define"
19224                                 ;;
19225                         '')     $cat >&4 <<EOM
19226 Sigh. Flushing explicitly all the stdio streams doesn't work.
19227 EOM
19228                                 fflushall="$undef"
19229                                 ;;
19230                         *)      $cat >&4 <<EOM
19231 Cannot figure out whether flushing stdio streams explicitly works or not.
19232 I'm assuming it doesn't.
19233 EOM
19234                                 fflushall="$undef"
19235                                 ;;
19236                         esac
19237                         ;;
19238                 "$define"|true|[yY]*)
19239                         fflushall="$define"
19240                         ;;
19241                 *)
19242                         fflushall="$undef"
19243                         ;;
19244                 esac
19245             else
19246                 $cat >&4 <<EOM
19247 All is futile.  Even fflush(stdin) clobbers input pipes!
19248 EOM
19249                 fflushall="$undef"
19250             fi
19251         else
19252             fflushall="$undef"
19253         fi
19254         $rm -f core tryp.c tryp.core core.tryp.*
19255         ;;
19256 *)      fflushall="$undef"
19257         ;;
19258 esac
19259
19260 case "$fflushNULL$fflushall" in
19261 undefundef)
19262         $cat <<EOM
19263 OK, I give up.  I cannot figure out how to flush pending stdio output.
19264 We won't be flushing handles at all before fork/exec/popen.
19265 EOM
19266         ;;
19267 esac
19268 $rm_try tryp
19269
19270 : Store the full pathname to the ar program for use in the C program
19271 : Respect a hint or command line value for full_ar.
19272 case "$full_ar" in
19273 '') full_ar=$ar ;;
19274 esac
19275
19276 : Store the full pathname to the sed program for use in the C program
19277 full_sed=$sed
19278
19279 : see what type gids are declared as in the kernel
19280 echo " "
19281 echo "Looking for the type for group ids returned by getgid()."
19282 set gid_t gidtype xxx stdio.h sys/types.h
19283 eval $typedef
19284 case "$gidtype" in
19285 xxx)
19286         xxx=`./findhdr sys/user.h`
19287         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19288         case $1 in
19289         unsigned) dflt="$1 $2" ;;
19290         *) dflt="$1" ;;
19291         esac
19292         ;;
19293 *) dflt="$gidtype";;
19294 esac
19295 case "$gidtype" in
19296 gid_t) echo "gid_t found." ;;
19297 *)      rp="What is the type for group ids returned by getgid()?"
19298         . ./myread
19299         gidtype="$ans"
19300         ;;
19301 esac
19302
19303 : Check the size of GID
19304 echo " "
19305 case "$gidtype" in
19306 *_t) zzz="$gidtype"     ;;
19307 *)   zzz="gid"          ;;
19308 esac
19309 echo "Checking the size of $zzz..." >&4
19310 cat > try.c <<EOCP
19311 #include <sys/types.h>
19312 #include <stdio.h>
19313 #$i_stdlib I_STDLIB
19314 #ifdef I_STDLIB
19315 #include <stdlib.h>
19316 #endif
19317 int main() {
19318     printf("%d\n", (int)sizeof($gidtype));
19319     exit(0);
19320 }
19321 EOCP
19322 set try
19323 if eval $compile_ok; then
19324         yyy=`$run ./try`
19325         case "$yyy" in
19326         '')     gidsize=4
19327                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19328                 ;;
19329         *)      gidsize=$yyy
19330                 echo "Your $zzz is $gidsize bytes long."
19331                 ;;
19332         esac
19333 else
19334         gidsize=4
19335         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19336 fi
19337
19338
19339 : Check if GID is signed
19340 echo " "
19341 case "$gidtype" in
19342 *_t) zzz="$gidtype"     ;;
19343 *)   zzz="gid"          ;;
19344 esac
19345 echo "Checking the sign of $zzz..." >&4
19346 cat > try.c <<EOCP
19347 #include <sys/types.h>
19348 #include <stdio.h>
19349 int main() {
19350         $gidtype foo = -1;
19351         if (foo < 0)
19352                 printf("-1\n");
19353         else
19354                 printf("1\n");
19355 }
19356 EOCP
19357 set try
19358 if eval $compile; then
19359         yyy=`$run ./try`
19360         case "$yyy" in
19361         '')     gidsign=1
19362                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19363                 ;;
19364         *)      gidsign=$yyy
19365                 case "$gidsign" in
19366                  1) echo "Your $zzz is unsigned." ;;
19367                 -1) echo "Your $zzz is signed."   ;;
19368                 esac
19369                 ;;
19370         esac
19371 else
19372         gidsign=1
19373         echo "(I can't compile the test program--guessing unsigned.)" >&4
19374 fi
19375
19376
19377 : Check 64bit sizes
19378 echo " "
19379
19380 if $test X"$quadtype" != X; then
19381
19382 echo "Checking how to print 64-bit integers..." >&4
19383
19384 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19385         $cat >try.c <<'EOCP'
19386 #include <sys/types.h>
19387 #include <stdio.h>
19388 int main() {
19389   int q = 12345678901;
19390   printf("%ld\n", q);
19391 }
19392 EOCP
19393         set try
19394         if eval $compile; then
19395                 yyy=`$run ./try`
19396                 case "$yyy" in
19397                 12345678901)
19398                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19399                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19400                         echo "We will use %d."
19401                         ;;
19402                 esac
19403         fi
19404 fi
19405
19406 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19407         $cat >try.c <<'EOCP'
19408 #include <sys/types.h>
19409 #include <stdio.h>
19410 int main() {
19411   long q = 12345678901;
19412   printf("%ld\n", q);
19413 }
19414 EOCP
19415         set try
19416         if eval $compile; then
19417                 yyy=`$run ./try`
19418                 case "$yyy" in
19419                 12345678901)
19420                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19421                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19422                         echo "We will use %ld."
19423                         ;;
19424                 esac
19425         fi
19426 fi
19427
19428 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19429         $cat >try.c <<'EOCP'
19430 #include <sys/types.h>
19431 #include <inttypes.h>
19432 #include <stdio.h>
19433 int main() {
19434   int64_t q = 12345678901;
19435   printf("%" PRId64 "\n", q);
19436 }
19437 EOCP
19438         set try
19439         if eval $compile; then
19440                 yyy=`$run ./try`
19441                 case "$yyy" in
19442                 12345678901)
19443                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19444                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19445                         echo "We will use the C9X style."
19446                         ;;
19447                 esac
19448         fi
19449 fi
19450
19451 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19452         $cat >try.c <<EOCP
19453 #include <sys/types.h>
19454 #include <stdio.h>
19455 int main() {
19456   $quadtype q = 12345678901;
19457   printf("%Ld\n", q);
19458 }
19459 EOCP
19460         set try
19461         if eval $compile; then
19462                 yyy=`$run ./try`
19463                 case "$yyy" in
19464                 12345678901)
19465                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19466                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19467                         echo "We will use %Ld."
19468                         ;;
19469                 esac
19470         fi
19471 fi
19472
19473 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19474         $cat >try.c <<'EOCP'
19475 #include <sys/types.h>
19476 #include <stdio.h>
19477 int main() {
19478   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19479   printf("%lld\n", q);
19480 }
19481 EOCP
19482         set try
19483         if eval $compile; then
19484                 yyy=`$run ./try`
19485                 case "$yyy" in
19486                 12345678901)
19487                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19488                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19489                         echo "We will use the %lld style."
19490                         ;;
19491                 esac
19492         fi
19493 fi
19494
19495 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19496         $cat >try.c <<EOCP
19497 #include <sys/types.h>
19498 #include <stdio.h>
19499 int main() {
19500   $quadtype q = 12345678901;
19501   printf("%qd\n", q);
19502 }
19503 EOCP
19504         set try
19505         if eval $compile; then
19506                 yyy=`$run ./try`
19507                 case "$yyy" in
19508                 12345678901)
19509                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19510                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19511                         echo "We will use %qd."
19512                         ;;
19513                 esac
19514         fi
19515 fi
19516
19517 if $test X"$sPRId64" = X; then
19518         echo "Cannot figure out how to print 64-bit integers." >&4
19519 fi
19520 $rm_try
19521
19522 fi
19523
19524 case "$sPRId64" in
19525 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19526         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19527         ;;
19528 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19529         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19530         ;;
19531 esac
19532
19533 : Check format strings for internal types
19534 echo " "
19535 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19536
19537 if $test X"$ivsize" = X8; then
19538         ivdformat="$sPRId64"
19539         uvuformat="$sPRIu64"
19540         uvoformat="$sPRIo64"
19541         uvxformat="$sPRIx64"
19542         uvXUformat="$sPRIXU64"
19543 else
19544         if $test X"$ivsize" = X"$longsize"; then
19545                 ivdformat='"ld"'
19546                 uvuformat='"lu"'
19547                 uvoformat='"lo"'
19548                 uvxformat='"lx"'
19549                 uvXUformat='"lX"'
19550         else
19551                 if $test X"$ivsize" = X"$intsize"; then
19552                         ivdformat='"d"'
19553                         uvuformat='"u"'
19554                         uvoformat='"o"'
19555                         uvxformat='"x"'
19556                         uvXUformat='"X"'
19557                 else
19558                         : far out
19559                         if $test X"$ivsize" = X"$shortsize"; then
19560                                 ivdformat='"hd"'
19561                                 uvuformat='"hu"'
19562                                 uvoformat='"ho"'
19563                                 uvxformat='"hx"'
19564                                 uvXUformat='"hX"'
19565                         fi
19566                 fi
19567         fi
19568 fi
19569
19570 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19571         nveformat="$sPRIeldbl"
19572         nvfformat="$sPRIfldbl"
19573         nvgformat="$sPRIgldbl"
19574         nvEUformat="$sPRIEUldbl"
19575         nvFUformat="$sPRIFUldbl"
19576         nvGUformat="$sPRIGUldbl"
19577 else
19578         nveformat='"e"'
19579         nvfformat='"f"'
19580         nvgformat='"g"'
19581         nvEUformat='"E"'
19582         nvFUformat='"F"'
19583         nvGUformat='"G"'
19584 fi
19585
19586 case "$ivdformat" in
19587 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19588     exit 1
19589     ;;
19590 esac
19591
19592 : Check format string for GID
19593
19594 echo " "
19595 $echo "Checking the format string to be used for gids..." >&4
19596
19597 case "$gidsign" in
19598 -1)     if $test X"$gidsize" = X"$ivsize"; then
19599                 gidformat="$ivdformat"
19600         else
19601                 if $test X"$gidsize" = X"$longsize"; then
19602                         gidformat='"ld"'
19603                 else
19604                         if $test X"$gidsize" = X"$intsize"; then
19605                                 gidformat='"d"'
19606                         else
19607                                 if $test X"$gidsize" = X"$shortsize"; then
19608                                         gidformat='"hd"'
19609                                 fi
19610                         fi
19611                 fi
19612         fi
19613         ;;
19614 *)      if $test X"$gidsize" = X"$uvsize"; then
19615                 gidformat="$uvuformat"
19616         else
19617                 if $test X"$gidsize" = X"$longsize"; then
19618                         gidformat='"lu"'
19619                 else
19620                         if $test X"$gidsize" = X"$intsize"; then
19621                                 gidformat='"u"'
19622                         else
19623                                 if $test X"$gidsize" = X"$shortsize"; then
19624                                         gidformat='"hu"'
19625                                 fi
19626                         fi
19627                 fi
19628         fi
19629         ;;
19630 esac
19631
19632 : see if getgroups exists
19633 set getgroups d_getgrps
19634 eval $inlibc
19635
19636 : see if setgroups exists
19637 set setgroups d_setgrps
19638 eval $inlibc
19639
19640 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19641 echo " "
19642 case "$d_getgrps$d_setgrps" in
19643 *define*)
19644         case "$groupstype" in
19645         '') dflt="$gidtype" ;;
19646         *)  dflt="$groupstype" ;;
19647         esac
19648         $cat <<EOM
19649 What type of pointer is the second argument to getgroups() and setgroups()?
19650 Usually this is the same as group ids, $gidtype, but not always.
19651
19652 EOM
19653         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19654         . ./myread
19655         groupstype="$ans"
19656         ;;
19657 *)  groupstype="$gidtype";;
19658 esac
19659
19660 : MAD = Misc Attribute Definition
19661
19662 if $test $patchlevel -lt 9; then
19663 : MAD is not available in 5.8.x or earlier.
19664     ans=n;
19665 else
19666     case "$mad" in
19667     $define|true|[yY]*) dflt='y' ;;
19668     *)                  dflt='n' ;;
19669     esac
19670     cat <<EOM
19671
19672 Would you like to build with Misc Attribute Decoration? This is development
19673 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19674 overhead on the interpreter.
19675
19676 If this doesn't make any sense to you, just accept the default '$dflt'.
19677 EOM
19678     rp='Build Perl with MAD?'
19679     . ./myread
19680 fi
19681 case "$ans" in
19682 y|Y)    val="$define"
19683         madlyh='madly.h madly.act madly.tab'
19684         madlysrc='madly.c'
19685         madlyobj="madly$_o" ;;
19686 *)      val="$undef"
19687         madlyh=''
19688         madlysrc=''
19689         madlyobj='' ;;
19690 esac
19691 set mad
19692 eval $setvar
19693
19694 : check whether make sets MAKE
19695 echo " "
19696 echo "Checking if your $make program sets \$(MAKE)..." >&4
19697 case "$make_set_make" in
19698 '')
19699         $sed 's/^X //' > testmake.mak << 'EOF'
19700 Xall:
19701 X       @echo 'maketemp="$(MAKE)"'
19702 EOF
19703         case "`$make -f testmake.mak 2>/dev/null`" in
19704         *maketemp=*) make_set_make='#' ;;
19705         *)      make_set_make="MAKE=$make" ;;
19706         esac
19707         $rm -f testmake.mak
19708         ;;
19709 esac
19710 case "$make_set_make" in
19711 '#') echo "Yup, it does.";;
19712 *) echo "Nope, it doesn't.";;
19713 esac
19714
19715 : see what type is used for mode_t
19716 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19717 set mode_t modetype int stdio.h sys/types.h
19718 eval $typedef_ask
19719
19720 : see if we need va_copy
19721 echo " "
19722 case "$i_stdarg" in
19723 "$define")
19724         $cat >try.c <<EOCP
19725 #include <stdarg.h>
19726 #include <stdio.h>
19727 #$i_stdlib I_STDLIB
19728 #ifdef I_STDLIB
19729 #include <stdlib.h>
19730 #endif
19731 #include <signal.h>
19732
19733 int
19734 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19735 {
19736   return vfprintf(f, fmt, *valp);
19737 }
19738
19739 int
19740 myvfprintf(FILE *f, const  char *fmt, va_list val)
19741 {
19742   return ivfprintf(f, fmt, &val);
19743 }
19744
19745 int
19746 myprintf(char *fmt, ...)
19747 {
19748   va_list val;
19749   va_start(val, fmt);
19750   return myvfprintf(stdout, fmt, val);
19751 }
19752
19753 int
19754 main(int ac, char **av)
19755 {
19756   signal(SIGSEGV, exit);
19757
19758   myprintf("%s%cs all right, then\n", "that", '\'');
19759   exit(0);
19760 }
19761 EOCP
19762         set try
19763         if eval $compile && $run ./try 2>&1 >/dev/null; then
19764                 case "`$run ./try`" in
19765                 "that's all right, then")
19766                         okay=yes
19767                         ;;
19768                 esac
19769         fi
19770         case "$okay" in
19771         yes)    echo "It seems that you don't need va_copy()." >&4
19772                 need_va_copy="$undef"
19773                 ;;
19774         *)      echo "It seems that va_copy() or similar will be needed." >&4
19775                 need_va_copy="$define"
19776                 ;;
19777         esac
19778         $rm_try
19779         ;;
19780 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19781         ;;
19782 esac
19783
19784 : see what type is used for size_t
19785 rp="What is the type used for the length parameter for string functions?"
19786 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19787 eval $typedef_ask
19788
19789 : check for type of arguments to gethostbyaddr. 
19790 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19791         case "$d_gethbyaddr" in
19792         $define)
19793                 $cat <<EOM
19794
19795 Checking to see what type of arguments are accepted by gethostbyaddr().
19796 EOM
19797                 hdrs="$define sys/types.h
19798                         $d_socket sys/socket.h 
19799                         $i_niin netinet/in.h 
19800                         $i_netdb netdb.h
19801                         $i_unistd unistd.h"
19802                 : The first arg can 'char *' or 'void *'
19803                 : The second arg is some of integral type
19804                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19805                         for yyy in size_t long int; do
19806                                 case "$netdb_host_type" in
19807                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19808                                         if ./protochk "$try" $hdrs; then
19809                                                 echo "Your system accepts $xxx for the first arg."
19810                                                 echo "...and $yyy for the second arg."
19811                                                 netdb_host_type="$xxx"
19812                                                 netdb_hlen_type="$yyy"
19813                                         fi
19814                                         ;;
19815                                 esac
19816                         done
19817                 done
19818                 : In case none of those worked, prompt the user.
19819                 case "$netdb_host_type" in
19820                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19821                         dflt='char *'
19822                         . ./myread
19823                         netdb_host_type=$ans
19824                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19825                         dflt="$sizetype"
19826                         . ./myread
19827                         netdb_hlen_type=$ans
19828                         ;;
19829                 esac
19830                 ;;
19831         *)      : no gethostbyaddr, so pick harmless defaults
19832                 netdb_host_type='char *'
19833                 netdb_hlen_type="$sizetype"
19834                 ;;
19835         esac
19836         # Remove the "const" if needed. -- but then we'll have a 
19837         # prototype clash!
19838         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19839 fi
19840
19841 : check for type of argument to gethostbyname. 
19842 if test "X$netdb_name_type" = X ; then
19843         case "$d_gethbyname" in
19844         $define)
19845                 $cat <<EOM
19846
19847 Checking to see what type of argument is accepted by gethostbyname().
19848 EOM
19849                 hdrs="$define sys/types.h
19850                         $d_socket sys/socket.h 
19851                         $i_niin netinet/in.h 
19852                         $i_netdb netdb.h
19853                         $i_unistd unistd.h"
19854                 for xxx in "const char *" "char *"; do
19855                         case "$netdb_name_type" in
19856                         '')     try="extern struct hostent *gethostbyname($xxx);"
19857                                 if ./protochk "$try" $hdrs; then
19858                                         echo "Your system accepts $xxx."
19859                                         netdb_name_type="$xxx"
19860                                 fi
19861                                 ;;
19862                         esac
19863                 done
19864                 : In case none of those worked, prompt the user.
19865                 case "$netdb_name_type" in
19866                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19867                         dflt='char *'
19868                         . ./myread
19869                         netdb_name_type=$ans
19870                         ;;
19871                 esac
19872                 ;;
19873         *)      : no gethostbyname, so pick harmless default
19874                 netdb_name_type='char *'
19875                 ;;
19876         esac
19877 fi
19878
19879 : check for type of 1st argument to getnetbyaddr. 
19880 if test "X$netdb_net_type" = X ; then
19881         case "$d_getnbyaddr" in
19882         $define)
19883                 $cat <<EOM
19884
19885 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19886 EOM
19887                 hdrs="$define sys/types.h
19888                         $d_socket sys/socket.h 
19889                         $i_niin netinet/in.h 
19890                         $i_netdb netdb.h
19891                         $i_unistd unistd.h"
19892                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19893                         case "$netdb_net_type" in
19894                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19895                                 if ./protochk "$try" $hdrs; then
19896                                         echo "Your system accepts $xxx."
19897                                         netdb_net_type="$xxx"
19898                                 fi
19899                                 ;;
19900                         esac
19901                 done
19902                 : In case none of those worked, prompt the user.
19903                 case "$netdb_net_type" in
19904                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19905                         dflt='long'
19906                         . ./myread
19907                         netdb_net_type=$ans
19908                         ;;
19909                 esac
19910                 ;;
19911         *)      : no getnetbyaddr, so pick harmless default
19912                 netdb_net_type='long'
19913                 ;;
19914         esac
19915 fi
19916 : locate the preferred pager for this system
19917 fn=f/
19918 case "$pager" in
19919 '')
19920         dflt=''
19921         case "$pg" in
19922         /*) dflt=$pg;;
19923         [a-zA-Z]:/*) dflt=$pg;;
19924         esac
19925         case "$more" in
19926         /*) dflt=$more;;
19927         [a-zA-Z]:/*) dflt=$more;;
19928         esac
19929         case "$less" in
19930         /*) dflt=$less;;
19931         [a-zA-Z]:/*) dflt=$less;;
19932         esac
19933         case "$dflt" in
19934         '') dflt=/usr/ucb/more;;
19935         esac
19936         ;;
19937 *)      dflt="$pager"
19938         fn="f/($pager)"
19939         ;;
19940 esac
19941 echo " "
19942 rp='What pager is used on your system?'
19943 . ./getfile
19944 pager="$ans"
19945
19946 : see what type pids are declared as in the kernel
19947 rp="What is the type of process ids on this system?"
19948 set pid_t pidtype int stdio.h sys/types.h
19949 eval $typedef_ask
19950
19951 : see if ar generates random libraries by itself
19952 echo " "
19953 echo "Checking how to generate random libraries on your machine..." >&4
19954 echo 'int bar1() { return bar2(); }' > bar1.c
19955 echo 'int bar2() { return 2; }' > bar2.c
19956 $cat > foo.c <<EOP
19957 #$i_stdlib I_STDLIB
19958 #ifdef I_STDLIB
19959 #include <stdlib.h>
19960 #endif
19961 int main() { printf("%d\n", bar1()); exit(0); }
19962 EOP
19963 $cc $ccflags -c bar1.c >/dev/null 2>&1
19964 $cc $ccflags -c bar2.c >/dev/null 2>&1
19965 $cc $ccflags -c foo.c >/dev/null 2>&1
19966 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19967 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19968         $run ./foobar >/dev/null 2>&1; then
19969         echo "$ar appears to generate random libraries itself."
19970         orderlib=false
19971         if [ "X$ranlib" = "X" ]; then
19972             ranlib=":"
19973         fi
19974 elif $ar s bar$_a >/dev/null 2>&1 &&
19975         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19976         $run ./foobar >/dev/null 2>&1; then
19977                 echo "a table of contents needs to be added with '$ar s'."
19978                 orderlib=false
19979                 ranlib="$ar s"
19980 elif $ar ts bar$_a >/dev/null 2>&1 &&
19981         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19982         $run ./foobar >/dev/null 2>&1; then
19983                 echo "a table of contents needs to be added with '$ar ts'."
19984                 orderlib=false
19985                 ranlib="$ar ts"
19986 else
19987         case "$ranlib" in
19988         :) ranlib='';;
19989         '')
19990                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19991                 $test -f $ranlib || ranlib=''
19992                 ;;
19993         esac
19994         if $test -n "$ranlib"; then
19995                 echo "your system has '$ranlib'; we'll use that."
19996                 orderlib=false
19997         else
19998                 echo "your system doesn't seem to support random libraries"
19999                 echo "so we'll use lorder and tsort to order the libraries."
20000                 orderlib=true
20001                 ranlib=":"
20002         fi
20003 fi
20004 $rm -f foo* bar*
20005
20006 : Check the max offset that gmtime accepts
20007 echo "Checking max offset that gmtime () accepts"
20008
20009 $cat >try.c <<'EOCP'
20010 #include <sys/types.h>
20011 #include <stdio.h>
20012 #include <time.h>
20013 int main () {
20014   struct tm *tmp;
20015   int i, y = 0;
20016   time_t pt = 0;
20017
20018   for (i = 0; i < 78; i++) {
20019     time_t t = (1 << i) - 1;
20020     tmp = gmtime (&t);
20021     if (tmp == NULL || tmp->tm_year < y) {
20022       i--;
20023       printf ("%d\n", pt);
20024       return (i);
20025       }
20026
20027     y = tmp->tm_year;
20028     pt = t;
20029     }
20030   printf ("%d\n", pt);
20031   return (0);
20032   }
20033 EOCP
20034 set try
20035 if eval $compile; then
20036     sGMTIME_max=`$run ./try`
20037 else
20038     echo "Cannot determine sGMTIME_max"
20039     fi
20040 $rm_try
20041
20042 echo "Checking min offset that gmtime () accepts"
20043
20044 $cat >try.c <<'EOCP'
20045 #include <sys/types.h>
20046 #include <stdio.h>
20047 #include <time.h>
20048 int main () {
20049   struct tm *tmp;
20050   int i, y = 70;
20051   time_t pt = 0;
20052
20053   for (i = 0; i < 78; i++) {
20054     time_t t = - (1 << i);
20055     tmp = gmtime (&t);
20056     if (tmp == NULL || tmp->tm_year > y) {
20057       i--;
20058       printf ("%d\n", pt);
20059       return (i);
20060       }
20061
20062     y = tmp->tm_year;
20063     pt = t;
20064     }
20065   printf ("%d\n", pt);
20066   return (0);
20067   }
20068 EOCP
20069 set try
20070 if eval $compile; then
20071     sGMTIME_min=`$run ./try`
20072 else
20073     echo "Cannot determine sGMTIME_min"
20074     fi
20075 $rm_try
20076
20077 : check for type of arguments to select.
20078 case "$selecttype" in
20079 '') case "$d_select" in
20080         $define)
20081                 echo " "
20082                 $cat <<EOM
20083 Checking to see what type of arguments are accepted by select().
20084 EOM
20085                 hdrs="$define sys/types.h
20086                         $i_systime sys/time.h
20087                         $i_sysselct sys/select.h
20088                         $d_socket sys/socket.h"
20089                 : The first arg can be int, unsigned, or size_t
20090                 : The last arg may or may not be 'const'
20091                 val=''
20092                 : void pointer has been seen but using that
20093                 : breaks the selectminbits test
20094                 for xxx in 'fd_set *' 'int *'; do
20095                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20096                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20097                                         case "$val" in
20098                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20099                                                 if ./protochk "$try" $hdrs; then
20100                                                         echo "Your system accepts $xxx."
20101                                                         val="$xxx"
20102                                                 fi
20103                                                 ;;
20104                                         esac
20105                                 done
20106                         done
20107                 done
20108                 case "$val" in
20109                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20110                         case "$d_fd_set" in
20111                                 $define) dflt="fd_set *" ;;
20112                                 *)              dflt="int *" ;;
20113                         esac
20114                         . ./myread
20115                         val=$ans
20116                         ;;
20117                 esac
20118                 selecttype="$val"
20119                 ;;
20120         *)      : no select, so pick a harmless default
20121                 selecttype='int *'
20122                 ;;
20123         esac
20124         ;;
20125 esac
20126
20127 : check for the select 'width'
20128 case "$selectminbits" in
20129 '') safebits=`expr $ptrsize \* 8`
20130     case "$d_select" in
20131         $define)
20132                 $cat <<EOM
20133
20134 Checking to see on how many bits at a time your select() operates...
20135 EOM
20136                 $cat >try.c <<EOCP
20137 #include <sys/types.h>
20138 #$i_time I_TIME
20139 #$i_systime I_SYS_TIME
20140 #$i_systimek I_SYS_TIME_KERNEL
20141 #ifdef I_TIME
20142 #   include <time.h>
20143 #endif
20144 #ifdef I_SYS_TIME
20145 #   ifdef I_SYS_TIME_KERNEL
20146 #       define KERNEL
20147 #   endif
20148 #   include <sys/time.h>
20149 #   ifdef I_SYS_TIME_KERNEL
20150 #       undef KERNEL
20151 #   endif
20152 #endif
20153 #$i_sysselct I_SYS_SELECT
20154 #ifdef I_SYS_SELECT
20155 #include <sys/select.h>
20156 #endif
20157 #$d_socket HAS_SOCKET
20158 #ifdef HAS_SOCKET
20159 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20160 #endif
20161 #include <stdio.h>
20162 #$i_stdlib I_STDLIB
20163 #ifdef I_STDLIB
20164 #include <stdlib.h>
20165 #endif
20166 $selecttype b;
20167 #define S sizeof(*(b))
20168 #define MINBITS 64
20169 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20170 #define NBITS  (NBYTES * 8)
20171 int main() {
20172     char *s = (char *)malloc(NBYTES);
20173     struct timeval t;
20174     int i;
20175     FILE* fp;
20176     int fd;
20177
20178     if (!s)
20179         exit(1);
20180     fclose(stdin);
20181     fp = fopen("try.c", "r");
20182     if (fp == 0)
20183       exit(2);
20184     fd = fileno(fp);
20185     if (fd < 0)
20186       exit(3);
20187     b = ($selecttype)s;
20188     for (i = 0; i < NBITS; i++)
20189         FD_SET(i, b);
20190     t.tv_sec  = 0;
20191     t.tv_usec = 0;
20192     select(fd + 1, b, 0, 0, &t);
20193     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20194     free(s);
20195     printf("%d\n", i + 1);
20196     return 0;
20197 }
20198 EOCP
20199                 set try
20200                 if eval $compile_ok; then
20201                         selectminbits=`$run ./try`
20202                         case "$selectminbits" in
20203                         '')     cat >&4 <<EOM
20204 Cannot figure out on how many bits at a time your select() operates.
20205 I'll play safe and guess it is $safebits bits.
20206 EOM
20207                                 selectminbits=$safebits
20208                                 bits="$safebits bits"
20209                                 ;;
20210                         1)      bits="1 bit" ;;
20211                         *)      bits="$selectminbits bits" ;;
20212                         esac
20213                         echo "Your select() operates on $bits at a time." >&4
20214                 else
20215                         rp='What is the minimum number of bits your select() operates on?'
20216                         case "$byteorder" in
20217                         12345678)       dflt=64 ;;
20218                         1234)           dflt=32 ;;
20219                         *)              dflt=1  ;;
20220                         esac
20221                         . ./myread
20222                         val=$ans
20223                         selectminbits="$val"
20224                 fi
20225                 $rm_try
20226                 ;;
20227         *)      : no select, so pick a harmless default
20228                 selectminbits=$safebits
20229                 ;;
20230         esac
20231         ;;
20232 esac
20233
20234 : Trace out the files included by signal.h, then look for SIGxxx names.
20235 if [ "X$fieldn" = X ]; then
20236         : Just make some guesses.  We check them later.
20237         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20238 else
20239         xxx=`echo '#include <signal.h>' |
20240         $cppstdin $cppminus $cppflags 2>/dev/null |
20241         $grep '^[       ]*#.*include' |
20242         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20243                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20244 fi
20245 xxxfiles=''
20246 for xx in $xxx /dev/null ; do
20247         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20248 done
20249 case "$xxxfiles" in
20250 '')     xxxfiles=`./findhdr signal.h` ;;
20251 esac
20252 xxx=`awk '
20253 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20254         print substr($2, 4, 20)
20255 }
20256 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20257         print substr($3, 4, 20)
20258 }' $xxxfiles`
20259 : Append some common names just in case the awk scan failed.
20260 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20261 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20262 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20263 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20264 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20265
20266 : generate a few handy files for later
20267 $cat > signal.c <<EOCP
20268 #include <sys/types.h>
20269 #include <signal.h>
20270 #$i_stdlib I_STDLIB
20271 #ifdef I_STDLIB
20272 #include <stdlib.h>
20273 #endif
20274 #include <stdio.h>
20275 int main() {
20276
20277 /* Strange style to avoid deeply-nested #if/#else/#endif */
20278 #ifndef NSIG
20279 #  ifdef _NSIG
20280 #    define NSIG (_NSIG)
20281 #  endif
20282 #endif
20283
20284 #ifndef NSIG
20285 #  ifdef SIGMAX
20286 #    define NSIG (SIGMAX+1)
20287 #  endif
20288 #endif
20289
20290 #ifndef NSIG
20291 #  ifdef SIG_MAX
20292 #    define NSIG (SIG_MAX+1)
20293 #  endif
20294 #endif
20295
20296 #ifndef NSIG
20297 #  ifdef _SIG_MAX
20298 #    define NSIG (_SIG_MAX+1)
20299 #  endif
20300 #endif
20301
20302 #ifndef NSIG
20303 #  ifdef MAXSIG
20304 #    define NSIG (MAXSIG+1)
20305 #  endif
20306 #endif
20307
20308 #ifndef NSIG
20309 #  ifdef MAX_SIG
20310 #    define NSIG (MAX_SIG+1)
20311 #  endif
20312 #endif
20313
20314 #ifndef NSIG
20315 #  ifdef SIGARRAYSIZE
20316 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20317 #  endif
20318 #endif
20319
20320 #ifndef NSIG
20321 #  ifdef _sys_nsig
20322 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20323 #  endif
20324 #endif
20325
20326 /* Default to some arbitrary number that's big enough to get most
20327    of the common signals.
20328 */
20329 #ifndef NSIG
20330 #    define NSIG 50
20331 #endif
20332
20333 printf("NSIG %d\n", NSIG);
20334
20335 #ifndef JUST_NSIG
20336
20337 EOCP
20338
20339 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20340 {
20341         printf "#ifdef SIG"; printf $1; printf "\n"
20342         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20343         printf $1; printf ");\n"
20344         printf "#endif\n"
20345 }
20346 END {
20347         printf "#endif /* JUST_NSIG */\n";
20348         printf "exit(0);\n}\n";
20349 }
20350 ' >>signal.c
20351 $cat >signal.awk <<'EOP'
20352 BEGIN { ndups = 0 }
20353 $1 ~ /^NSIG$/ { nsig = $2 }
20354 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20355     if ($2 > maxsig) { maxsig = $2 }
20356     if (sig_name[$2]) {
20357         dup_name[ndups] = $1
20358         dup_num[ndups] = $2
20359         ndups++
20360     }
20361     else {
20362         sig_name[$2] = $1
20363         sig_num[$2] = $2
20364     }
20365 }
20366 END {
20367     if (nsig == 0) {
20368         nsig = maxsig + 1
20369     }
20370     printf("NSIG %d\n", nsig);
20371     for (n = 1; n < nsig; n++) {
20372         if (sig_name[n]) {
20373             printf("%s %d\n", sig_name[n], sig_num[n])
20374         }
20375         else {
20376             printf("NUM%d %d\n", n, n)
20377         }
20378     }
20379     for (n = 0; n < ndups; n++) {
20380         printf("%s %d\n", dup_name[n], dup_num[n])
20381     }
20382 }
20383 EOP
20384 $cat >signal_cmd <<EOS
20385 $startsh
20386 if $test -s signal.lst; then
20387     echo "Using your existing signal.lst file"
20388         exit 0
20389 fi
20390 xxx="$xxx"
20391 EOS
20392 $cat >>signal_cmd <<'EOS'
20393
20394 set signal
20395 if eval $compile_ok; then
20396         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20397                 $uniq | $awk -f signal.awk >signal.lst
20398 else
20399         echo "(I can't seem be able to compile the whole test program)" >&4
20400         echo "(I'll try it in little pieces.)" >&4
20401         set signal -DJUST_NSIG
20402         if eval $compile_ok; then
20403                 $run ./signal$_exe > signal.nsg
20404                 $cat signal.nsg
20405         else
20406                 echo "I can't seem to figure out how many signals you have." >&4
20407                 echo "Guessing 50." >&4
20408                 echo 'NSIG 50' > signal.nsg
20409         fi
20410         : Now look at all the signal names, one at a time.
20411         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20412                 $cat > signal.c <<EOCP
20413 #include <sys/types.h>
20414 #include <signal.h>
20415 #include <stdio.h>
20416 int main() {
20417 printf("$xx %d\n", SIG${xx});
20418 return 0;
20419 }
20420 EOCP
20421                 set signal
20422                 if eval $compile; then
20423                         echo "SIG${xx} found."
20424                         $run ./signal$_exe  >> signal.ls1
20425                 else
20426                         echo "SIG${xx} NOT found."
20427                 fi
20428         done
20429         if $test -s signal.ls1; then
20430                 $cat signal.nsg signal.ls1 |
20431                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20432         fi
20433
20434 fi
20435 if $test -s signal.lst; then
20436         :
20437 else
20438         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20439         echo 'kill -l' >signal
20440         set X `csh -f <signal`
20441         $rm -f signal
20442         shift
20443         case $# in
20444         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20445         esac
20446         echo $@ | $tr ' ' $trnl | \
20447             $awk '{ printf "%s %d\n", $1, ++s; }
20448                   END { printf "NSIG %d\n", ++s }' >signal.lst
20449 fi
20450 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20451 EOS
20452 chmod a+x signal_cmd
20453 $eunicefix signal_cmd
20454
20455 : generate list of signal names
20456 echo " "
20457 case "$sig_name_init" in
20458 '') doinit=yes ;;
20459 *)  case "$sig_num_init" in
20460     ''|*,*) doinit=yes ;;
20461     esac ;;
20462 esac
20463 case "$doinit" in
20464 yes)
20465         echo "Generating a list of signal names and numbers..." >&4
20466         . ./signal_cmd
20467         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20468         sig_name=`$awk 'BEGIN { printf "ZERO " }
20469                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20470         sig_num=`$awk  'BEGIN { printf "0 " }
20471                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20472         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20473                              !/^NSIG/   { printf "\"%s\", ", $1 }
20474                              END        { printf "0\n" }' signal.lst`
20475         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20476                              !/^NSIG/   { printf "%d, ", $2}
20477                              END        { printf "0\n"}' signal.lst`
20478         ;;
20479 esac
20480 echo "The following $sig_count signals are available:"
20481 echo " "
20482 echo $sig_name | $awk \
20483 'BEGIN { linelen = 0 }
20484 {
20485         for (i = 1; i <= NF; i++) {
20486                 name = "SIG" $i " "
20487                 linelen = linelen + length(name)
20488                 if (linelen > 70) {
20489                         printf "\n"
20490                         linelen = length(name)
20491                 }
20492                 printf "%s", name
20493         }
20494         printf "\n"
20495 }'
20496 sig_size=`echo $sig_name | awk '{print NF}'`
20497 $rm -f signal signal.c signal.awk signal.lst signal_cmd
20498
20499 : Check size of size
20500 echo " "
20501 case "$sizetype" in
20502 *_t) zzz="$sizetype"    ;;
20503 *)   zzz="filesize"     ;;
20504 esac
20505 echo "Checking the size of $zzz..." >&4
20506 cat > try.c <<EOCP
20507 #include <sys/types.h>
20508 #include <stdio.h>
20509 #$i_stdlib I_STDLIB
20510 #ifdef I_STDLIB
20511 #include <stdlib.h>
20512 #endif
20513 int main() {
20514     printf("%d\n", (int)sizeof($sizetype));
20515     exit(0);
20516 }
20517 EOCP
20518 set try
20519 if eval $compile_ok; then
20520         yyy=`$run ./try`
20521         case "$yyy" in
20522         '')     sizesize=4
20523                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20524                 ;;
20525         *)      sizesize=$yyy
20526                 echo "Your $zzz size is $sizesize bytes."
20527                 ;;
20528         esac
20529 else
20530         sizesize=4
20531         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20532 fi
20533
20534
20535 : check for socklen_t
20536 echo " "
20537 echo "Checking to see if you have socklen_t..." >&4
20538 $cat >try.c <<EOCP
20539 #include <sys/types.h>
20540 #$d_socket HAS_SOCKET
20541 #ifdef HAS_SOCKET
20542 #include <sys/socket.h>
20543 #endif
20544 int main() { socklen_t x = 16; }
20545 EOCP
20546 set try
20547 if eval $compile; then
20548         val="$define"
20549         echo "You have socklen_t."
20550 else
20551         val="$undef"
20552         echo "You do not have socklen_t."
20553         case "$sizetype" in
20554         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20555         esac
20556 fi
20557 $rm_try
20558 set d_socklen_t
20559 eval $setvar
20560
20561 : see if this is a socks.h system
20562 set socks.h i_socks
20563 eval $inhdr
20564
20565 : check for type of the size argument to socket calls
20566 case "$d_socket" in
20567 "$define")
20568         $cat <<EOM
20569
20570 Checking to see what type is the last argument of accept().
20571 EOM
20572         yyy=''
20573         case "$d_socklen_t" in
20574         "$define") yyy="$yyy socklen_t"
20575         esac
20576         yyy="$yyy $sizetype int long unsigned"
20577         for xxx in $yyy; do
20578                 case "$socksizetype" in
20579                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
20580                         case "$usesocks" in
20581                         "$define")
20582                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20583                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20584                                         socksizetype="$xxx"
20585                                 fi
20586                                 ;;
20587                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20588                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20589                                         socksizetype="$xxx"
20590                                 fi
20591                                 ;;
20592                         esac
20593                         ;;
20594                 esac
20595         done
20596 : In case none of those worked, prompt the user.
20597         case "$socksizetype" in
20598         '')     rp='What is the type for socket address structure sizes?'
20599                 dflt='int'
20600                 . ./myread
20601                 socksizetype=$ans
20602                 ;;
20603         esac
20604         ;;
20605 *)      : no sockets, so pick relatively harmless default
20606         socksizetype='int'
20607         ;;
20608 esac
20609
20610 : see what type is used for signed size_t
20611 set ssize_t ssizetype int stdio.h sys/types.h
20612 eval $typedef
20613 dflt="$ssizetype"
20614 $cat > try.c <<EOM
20615 #include <stdio.h>
20616 #$i_stdlib I_STDLIB
20617 #ifdef I_STDLIB
20618 #include <stdlib.h>
20619 #endif
20620 #include <sys/types.h>
20621 #define Size_t $sizetype
20622 #define SSize_t $dflt
20623 int main()
20624 {
20625         if (sizeof(Size_t) == sizeof(SSize_t))
20626                 printf("$dflt\n");
20627         else if (sizeof(Size_t) == sizeof(int))
20628                 printf("int\n");
20629         else
20630                 printf("long\n");
20631         exit(0);
20632 }
20633 EOM
20634 echo " "
20635 set try
20636 if eval $compile_ok && $run ./try > /dev/null; then
20637         ssizetype=`$run ./try`
20638         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20639 else
20640         $cat >&4 <<EOM
20641 Help! I can't compile and run the ssize_t test program: please enlighten me!
20642 (This is probably a misconfiguration in your system or libraries, and
20643 you really ought to fix it.  Still, I'll try anyway.)
20644
20645 I need a type that is the same size as $sizetype, but is guaranteed to
20646 be signed.  Common values are ssize_t, int and long.
20647
20648 EOM
20649         rp="What signed type is the same size as $sizetype?"
20650         . ./myread
20651         ssizetype="$ans"
20652 fi
20653 $rm_try
20654
20655 : see what type of char stdio uses.
20656 echo " "
20657 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
20658 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20659         echo "Your stdio uses unsigned chars." >&4
20660         stdchar="unsigned char"
20661 else
20662         echo "Your stdio uses signed chars." >&4
20663         stdchar="char"
20664 fi
20665 $rm -f stdioh
20666
20667 : see what type uids are declared as in the kernel
20668 echo " "
20669 echo "Looking for the type for user ids returned by getuid()."
20670 set uid_t uidtype xxx stdio.h sys/types.h
20671 eval $typedef
20672 case "$uidtype" in
20673 xxx)
20674         xxx=`./findhdr sys/user.h`
20675         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20676         case $1 in
20677         unsigned) dflt="$1 $2" ;;
20678         *) dflt="$1" ;;
20679         esac
20680         ;;
20681 *) dflt="$uidtype";;
20682 esac
20683 case "$uidtype" in
20684 uid_t)  echo "uid_t found." ;;
20685 *)      rp="What is the type for user ids returned by getuid()?"
20686         . ./myread
20687         uidtype="$ans"
20688         ;;
20689 esac
20690
20691 : Check size of UID
20692 echo " "
20693 case "$uidtype" in
20694 *_t) zzz="$uidtype"     ;;
20695 *)   zzz="uid"          ;;
20696 esac
20697 echo "Checking the size of $zzz..." >&4
20698 cat > try.c <<EOCP
20699 #include <sys/types.h>
20700 #include <stdio.h>
20701 #$i_stdlib I_STDLIB
20702 #ifdef I_STDLIB
20703 #include <stdlib.h>
20704 #endif
20705 int main() {
20706     printf("%d\n", (int)sizeof($uidtype));
20707     exit(0);
20708 }
20709 EOCP
20710 set try
20711 if eval $compile_ok; then
20712         yyy=`$run ./try`
20713         case "$yyy" in
20714         '')     uidsize=4
20715                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20716                 ;;
20717         *)      uidsize=$yyy
20718                 echo "Your $zzz is $uidsize bytes long."
20719                 ;;
20720         esac
20721 else
20722         uidsize=4
20723         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20724 fi
20725
20726 : Check if UID is signed
20727 echo " "
20728 case "$uidtype" in
20729 *_t) zzz="$uidtype"     ;;
20730 *)   zzz="uid"          ;;
20731 esac
20732 echo "Checking the sign of $zzz..." >&4
20733 cat > try.c <<EOCP
20734 #include <sys/types.h>
20735 #include <stdio.h>
20736 int main() {
20737         $uidtype foo = -1;
20738         if (foo < 0)
20739                 printf("-1\n");
20740         else
20741                 printf("1\n");
20742 }
20743 EOCP
20744 set try
20745 if eval $compile; then
20746         yyy=`$run ./try`
20747         case "$yyy" in
20748         '')     uidsign=1
20749                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20750                 ;;
20751         *)      uidsign=$yyy
20752                 case "$uidsign" in
20753                  1) echo "Your $zzz is unsigned." ;;
20754                 -1) echo "Your $zzz is signed."   ;;
20755                 esac
20756                 ;;
20757         esac
20758 else
20759         uidsign=1
20760         echo "(I can't compile the test program--guessing unsigned.)" >&4
20761 fi
20762
20763
20764 : Check format string for UID
20765 echo " "
20766 $echo "Checking the format string to be used for uids..." >&4
20767
20768 case "$uidsign" in
20769 -1)     if $test X"$uidsize" = X"$ivsize"; then
20770                 uidformat="$ivdformat"
20771         else
20772                 if $test X"$uidsize" = X"$longsize"; then
20773                         uidformat='"ld"'
20774                 else
20775                         if $test X"$uidsize" = X"$intsize"; then
20776                                 uidformat='"d"'
20777                         else
20778                                 if $test X"$uidsize" = X"$shortsize"; then
20779                                         uidformat='"hd"'
20780                                 fi
20781                         fi
20782                 fi
20783         fi
20784         ;;
20785 *)      if $test X"$uidsize" = X"$uvsize"; then
20786                 uidformat="$uvuformat"
20787         else
20788                 if $test X"$uidsize" = X"$longsize"; then
20789                         uidformat='"lu"'
20790                 else
20791                         if $test X"$uidsize" = X"$intsize"; then
20792                                 uidformat='"u"'
20793                         else
20794                                 if $test X"$uidsize" = X"$shortsize"; then
20795                                         uidformat='"hu"'
20796                                 fi
20797                         fi
20798                 fi
20799         fi
20800         ;;
20801 esac
20802
20803 : Check if site customization support was requested
20804 case "$usesitecustomize" in
20805     $define|true|[Yy]*)
20806         usesitecustomize="$define"
20807         ;;
20808     *)
20809         usesitecustomize="$undef"
20810         ;;
20811     esac
20812
20813 : determine compiler compiler
20814 case "$yacc" in
20815 '')
20816         dflt=yacc;;
20817 *)
20818         dflt="$yacc";;
20819 esac
20820 echo " "
20821 comp='yacc'
20822 if $test -f "$byacc$_exe"; then
20823         dflt="$byacc"
20824         comp="byacc or $comp"
20825 fi
20826 if $test -f "$bison$_exe"; then
20827         comp="$comp or bison -y"
20828 fi
20829 rp="Which compiler compiler ($comp) shall I use?"
20830 . ./myread
20831 yacc="$ans"
20832 case "$yacc" in
20833 *bis*)
20834         case "$yacc" in
20835         *-y*) ;;
20836         *)
20837                 yacc="$yacc -y"
20838                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20839                 ;;
20840         esac
20841         ;;
20842 esac
20843
20844 : see if this is a assert.h system
20845 set assert.h i_assert
20846 eval $inhdr
20847
20848 : see if this is a fp.h system
20849 set fp.h i_fp
20850 eval $inhdr
20851
20852 : see if this is a fp_class.h system
20853 set fp_class.h i_fp_class
20854 eval $inhdr
20855
20856 : see if gdbm.h is available
20857 set gdbm.h t_gdbm
20858 eval $inhdr
20859 case "$t_gdbm" in
20860 $define)
20861         : see if gdbm_open exists
20862         set gdbm_open d_gdbm_open
20863         eval $inlibc
20864         case "$d_gdbm_open" in
20865         $undef)
20866                 t_gdbm="$undef"
20867                 echo "We won't be including <gdbm.h>"
20868                 ;;
20869         esac
20870         ;;
20871 esac
20872 val="$t_gdbm"
20873 set i_gdbm
20874 eval $setvar
20875
20876 : see if ndbm.h is available
20877 set ndbm.h i_ndbm
20878 eval $inhdr
20879 : Compatibility location for RedHat 7.1
20880 set gdbm/ndbm.h i_gdbmndbm
20881 eval $inhdr
20882 : Compatibility location for Debian 4.0
20883 set gdbm-ndbm.h i_gdbm_ndbm
20884 eval $inhdr
20885
20886 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
20887         : see if dbm_open exists
20888         set dbm_open d_dbm_open
20889         eval $inlibc
20890         case "$d_dbm_open" in
20891         $undef)
20892                 i_ndbm="$undef"
20893                 i_gdbmndbm="$undef"
20894                 i_gdbm_ndbm="$undef"
20895                 echo "We won't be including <ndbm.h>"
20896             val="$undef"
20897                 ;;
20898         *) val="$define"
20899            ;;
20900         esac
20901 fi
20902 set d_ndbm
20903 eval $setvar
20904
20905 : see if this is a ieeefp.h system
20906 case "$i_ieeefp" in
20907 '' ) set ieeefp.h i_ieeefp
20908      eval $inhdr
20909      ;;
20910 esac
20911
20912 : see if this is a libutil.h system
20913 set libutil.h i_libutil
20914 eval $inhdr
20915
20916 : see if mach cthreads are available
20917 if test "X$usethreads" = "X$define"; then
20918         set mach/cthreads.h i_machcthr
20919         eval $inhdr
20920 else
20921         i_machcthr="$undef"
20922 fi
20923
20924 : see if this is a mntent.h system
20925 set mntent.h i_mntent
20926 eval $inhdr
20927
20928 : see if net/errno.h is available
20929 val=''
20930 set net/errno.h val
20931 eval $inhdr
20932
20933 : Unfortunately, it causes problems on some systems.  Arrgh.
20934 case "$val" in
20935 $define)
20936         cat > try.c <<'EOM'
20937 #include <stdio.h>
20938 #include <errno.h>
20939 #include <net/errno.h>
20940 int func()
20941 {
20942         return ENOTSOCK;
20943 }
20944 EOM
20945         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20946                 echo "We'll be including <net/errno.h>." >&4
20947         else
20948                 echo "We won't be including <net/errno.h>." >&4
20949                 val="$undef"
20950         fi
20951         $rm_try
20952         ;;
20953 esac
20954 set i_neterrno
20955 eval $setvar
20956
20957 : see if netinet/tcp.h is available
20958 set netinet/tcp.h i_netinettcp
20959 eval $inhdr
20960
20961 : see if this is a poll.h system
20962 set poll.h i_poll
20963 eval $inhdr
20964
20965 : see if this is a prot.h system
20966 set prot.h i_prot
20967 eval $inhdr
20968
20969 : Preprocessor symbols
20970 echo " "
20971 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20972 $cat <<'EOSH' > Cppsym.know
20973 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20974 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20975 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20976 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20977 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20978 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20979 bull c cadmus clipper CMU COFF COMPILER_VERSION
20980 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20981 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20982 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20983 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20984 GLIBC GLIBC_MINOR
20985 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20986 H3050R H3050RX hbullx20 hcx host_mips
20987 hp200 hp300 hp700 HP700 hp800 hp9000
20988 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20989 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20990 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20991 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20992 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20993 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20994 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20995 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20996 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20997 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20998 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20999 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21000 MATH_HAS_NO_SIDE_EFFECTS
21001 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21002 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21003 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21004 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21005 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21006 NetBSD news1500 news1700 news1800 news1900 news3700
21007 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21008 ns32016 ns32332 ns32k nsc32000
21009 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21010 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21011 pc532 pdp11 PGC PIC plexus PORTAR posix
21012 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21013 POSIX_C_SOURCE POSIX_SOURCE POWER
21014 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21015 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21016 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21017 sony sony_news sonyrisc sparc sparclite spectrum
21018 stardent stdc STDC_EXT stratos sun sun3 sun386
21019 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21020 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21021 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21022 sysV68 sysV88 Tek4132 Tek4300 titan
21023 TM3200 TM5400 TM5600
21024 tower tower32 tower32_200 tower32_600 tower32_700
21025 tower32_800 tower32_850 tss
21026 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21027 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
21028 unix UNIX95 UNIX99 unixpc unos
21029 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21030 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21031 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21032 USGr4 USGr4_2
21033 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
21034 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21035 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21036 z8000
21037 EOSH
21038 # Maybe put other stuff here too.
21039 cat <<EOSH >>Cppsym.know
21040 $osname
21041 EOSH
21042 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21043 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21044 $cat Cppsym.know > Cppsym.c
21045 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
21046 $rm -f Cppsym.a Cppsym.b Cppsym.c
21047 cat <<EOSH > Cppsym
21048 $startsh
21049 if $test \$# -gt 0; then
21050     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21051     if $test -s Cppsym.got; then
21052         $rm -f Cppsym.got
21053         exit 0
21054     fi
21055     $rm -f Cppsym.got
21056     exit 1
21057 else
21058     $tr " " "$trnl" | ./Cppsym.try
21059     exit 0
21060 fi
21061 EOSH
21062 chmod +x Cppsym
21063 $eunicefix Cppsym
21064 cat <<EOSH > Cppsym.try
21065 $startsh
21066 cat <<'EOCP' > try.c
21067 #include <stdio.h>
21068 #if cpp_stuff == 1
21069 #define STRINGIFY(a)    "a"
21070 #endif
21071 #if cpp_stuff == 42
21072 #define StGiFy(a)  #a
21073 #define STRINGIFY(a)    StGiFy(a)
21074 #endif
21075 #if $cpp_stuff != 1 && $cpp_stuff != 42
21076 #   include "Bletch: How does this C preprocessor stringify macros?"
21077 #endif
21078 int main() {
21079 EOCP
21080 $awk \\
21081 EOSH
21082 cat <<'EOSH' >> Cppsym.try
21083 'length($1) > 0 {
21084     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21085     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21086     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21087     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
21088 }'       >> try.c
21089 echo 'return 0;}' >> try.c
21090 EOSH
21091 cat <<EOSH >> Cppsym.try
21092 ccflags="$ccflags"
21093 case "$osname-$gccversion" in
21094 irix-) ccflags="\$ccflags -woff 1178" ;;
21095 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21096 esac
21097 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
21098 EOSH
21099 chmod +x Cppsym.try
21100 $eunicefix Cppsym.try
21101 ./Cppsym < Cppsym.know > Cppsym.true
21102 : Add in any linux cpp "predefined macros":
21103 case "$osname::$gccversion" in
21104   *linux*::*.*)
21105     tHdrH=_tmpHdr
21106     rm -f $tHdrH'.h' $tHdrH
21107     touch $tHdrH'.h'
21108     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
21109        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21110        if [ -s $tHdrH'_cppsym.real' ]; then
21111           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21112        fi
21113     fi
21114     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21115   ;;
21116 esac
21117 : now check the C compiler for additional symbols
21118 postprocess_cc_v=''
21119 case "$osname" in
21120 aix) postprocess_cc_v="|$tr , ' '" ;;
21121 esac
21122 $cat >ccsym <<EOS
21123 $startsh
21124 $cat >tmp.c <<EOF
21125 extern int foo;
21126 EOF
21127 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21128 do
21129         case "\$i" in
21130         -D*) echo "\$i" | $sed 's/^-D//';;
21131         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
21132         esac
21133 done
21134 $rm_try
21135 EOS
21136 postprocess_cc_v=''
21137 chmod +x ccsym
21138 $eunicefix ccsym
21139 ./ccsym > ccsym1.raw
21140 if $test -s ccsym1.raw; then
21141        $sort ccsym1.raw | $uniq >ccsym.raw
21142 else
21143        mv ccsym1.raw ccsym.raw
21144 fi
21145
21146 $awk '/\=/ { print $0; next }
21147         { print $0"=1" }' ccsym.raw >ccsym.list
21148 $comm -13 Cppsym.true ccsym.list >ccsym.own
21149 $comm -12 Cppsym.true ccsym.list >ccsym.com
21150 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
21151 also=''
21152 if $test -z ccsym.raw; then
21153         echo "Your C compiler doesn't seem to define any symbols!" >&4
21154         echo " "
21155         echo "However, your C preprocessor defines the following symbols:"
21156         $cat Cppsym.true
21157         ccsymbols=''
21158         cppsymbols=`$cat Cppsym.true`
21159         cppsymbols=`echo $cppsymbols`
21160         cppccsymbols="$cppsymbols"
21161 else
21162         if $test -s ccsym.com; then
21163                 echo "Your C compiler and pre-processor define these symbols:"
21164                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21165                 also='also '
21166                 symbols='ones'
21167                 cppccsymbols=`$cat ccsym.com`
21168                 cppccsymbols=`echo $cppccsymbols`
21169                 $test "$silent" || sleep 1
21170         fi
21171         if $test -s ccsym.cpp; then
21172                 $test "$also" && echo " "
21173                 echo "Your C pre-processor ${also}defines the following symbols:"
21174                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21175                 also='further '
21176                 cppsymbols=`$cat ccsym.cpp`
21177                 cppsymbols=`echo $cppsymbols`
21178                 $test "$silent" || sleep 1
21179         fi
21180         if $test -s ccsym.own; then
21181                 $test "$also" && echo " "
21182                 echo "Your C compiler ${also}defines the following cpp symbols:"
21183                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21184                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21185                 ccsymbols=`$cat ccsym.own`
21186                 ccsymbols=`echo $ccsymbols`
21187                 $test "$silent" || sleep 1
21188         fi
21189 fi
21190
21191 : see if this is a termio system
21192 val="$undef"
21193 val2="$undef"
21194 val3="$undef"
21195 if $test `./findhdr termios.h`; then
21196         set tcsetattr i_termios
21197         eval $inlibc
21198         val3="$i_termios"
21199 fi
21200 echo " "
21201 case "$val3" in
21202 "$define") echo "You have POSIX termios.h... good!" >&4;;
21203 *) if ./Cppsym pyr; then
21204                 case "`/bin/universe`" in
21205                 ucb) if $test `./findhdr sgtty.h`; then
21206                                 val2="$define"
21207                                 echo "<sgtty.h> found." >&4
21208                         else
21209                                 echo "System is pyramid with BSD universe."
21210                                 ./warn "<sgtty.h> not found--you could have problems."
21211                         fi;;
21212                 *) if $test `./findhdr termio.h`; then
21213                                 val="$define"
21214                                 echo "<termio.h> found." >&4
21215                         else
21216                                 echo "System is pyramid with USG universe."
21217                                 ./warn "<termio.h> not found--you could have problems."
21218                         fi;;
21219                 esac
21220         elif ./usg; then
21221                 if $test `./findhdr termio.h`; then
21222                         echo "<termio.h> found." >&4
21223                         val="$define"
21224                 elif $test `./findhdr sgtty.h`; then
21225                         echo "<sgtty.h> found." >&4
21226                         val2="$define"
21227                 else
21228                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
21229                 fi
21230         else
21231                 if $test `./findhdr sgtty.h`; then
21232                         echo "<sgtty.h> found." >&4
21233                         val2="$define"
21234                 elif $test `./findhdr termio.h`; then
21235                         echo "<termio.h> found." >&4
21236                         val="$define"
21237                 else
21238                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
21239                 fi
21240         fi;;
21241 esac
21242 set i_termio; eval $setvar
21243 val=$val2; set i_sgtty; eval $setvar
21244 val=$val3; set i_termios; eval $setvar
21245
21246 : see if stddef is available
21247 set stddef.h i_stddef
21248 eval $inhdr
21249
21250 : see if sys/access.h is available
21251 set sys/access.h i_sysaccess
21252 eval $inhdr
21253
21254 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
21255 set sys/filio.h i_sysfilio
21256 eval $inhdr
21257 echo " "
21258 if $test `./findhdr sys/ioctl.h`; then
21259         val="$define"
21260         echo '<sys/ioctl.h> found.' >&4
21261 else
21262         val="$undef"
21263         if $test $i_sysfilio = "$define"; then
21264             echo '<sys/ioctl.h> NOT found.' >&4
21265         else
21266                 $test $i_sgtty = "$define" && xxx="sgtty.h"
21267                 $test $i_termio = "$define" && xxx="termio.h"
21268                 $test $i_termios = "$define" && xxx="termios.h"
21269 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
21270         fi
21271 fi
21272 set i_sysioctl
21273 eval $setvar
21274
21275 : see if socket ioctl defs are in sys/sockio.h
21276 echo " "
21277 xxx=`./findhdr sys/sockio.h`
21278 if $test "$xxx"; then
21279         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
21280                 val="$define"
21281                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
21282         else
21283                 val="$undef"
21284                 echo "No socket ioctls found in <sys/sockio.h>." >&4
21285         fi
21286 else
21287         val="$undef"
21288         $cat <<EOM
21289 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
21290 EOM
21291 fi
21292 set i_syssockio
21293 eval $setvar
21294
21295 : see if this is a syslog.h system
21296 set syslog.h i_syslog
21297 eval $inhdr
21298
21299 : see if this is a sys/mode.h system
21300 set sys/mode.h i_sysmode
21301 eval $inhdr
21302
21303 : see if there is a sys/poll.h file
21304 set sys/poll.h i_syspoll
21305 eval $inhdr
21306
21307 : see if sys/resource.h has to be included
21308 set sys/resource.h i_sysresrc
21309 eval $inhdr
21310
21311 : see if sys/security.h is available
21312 set sys/security.h i_syssecrt
21313 eval $inhdr
21314
21315 : see if this is a sys/statvfs.h system
21316 set sys/statvfs.h i_sysstatvfs
21317 eval $inhdr
21318
21319 : see if this is a sys/un.h system
21320 set sys/un.h i_sysun
21321 eval $inhdr
21322
21323 : see if this is a sys/utsname.h system
21324 set sys/utsname.h i_sysutsname
21325 eval $inhdr
21326
21327 : see if this is a syswait system
21328 set sys/wait.h i_syswait
21329 eval $inhdr
21330
21331 : see if this is a ustat.h system
21332 set ustat.h i_ustat
21333 eval $inhdr
21334
21335 : see if this is an utime system
21336 set utime.h i_utime
21337 eval $inhdr
21338
21339 : see if this is a values.h system
21340 set values.h i_values
21341 eval $inhdr
21342
21343 : see if this is a vfork system
21344 case "$d_vfork" in
21345 "$define")
21346         set vfork.h i_vfork
21347         eval $inhdr
21348         ;;
21349 *)
21350         i_vfork="$undef"
21351         ;;
21352 esac
21353
21354 : Check extensions
21355 echo " "
21356 echo "Looking for extensions..." >&4
21357 : If we are using the old config.sh, known_extensions may contain
21358 : old or inaccurate or duplicate values.
21359 known_extensions=''
21360 nonxs_extensions=''
21361 : We do not use find because it might not be available.
21362 : We do not just use MANIFEST because the user may have dropped
21363 : some additional extensions into the source tree and expect them
21364 : to be built.
21365
21366 : Function to recursively find available extensions, ignoring DynaLoader
21367 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21368 find_extensions='
21369     for xxx in *; do
21370         case "$xxx" in
21371             DynaLoader|dynaload) ;;
21372             *)
21373             if $test -f $xxx/$xxx.xs -o -f $xxx/$xxx.c; then
21374                 known_extensions="$known_extensions $1$xxx";
21375             elif $test -f $xxx/Makefile.PL; then
21376                 nonxs_extensions="$nonxs_extensions $1$xxx";
21377             else
21378                 if $test -d $xxx -a $# -lt 10; then
21379                     set $1$xxx/ $*;
21380                     cd "$xxx";
21381                     eval $find_extensions;
21382                     cd ..;
21383                     shift;
21384                 fi;
21385             fi
21386             ;;
21387         esac;
21388     done'
21389 tdir=`pwd`
21390 cd "$rsrc/ext"
21391 set X
21392 shift
21393 eval $find_extensions
21394 # Special case:  Add in modules that nest beyond the first level.
21395 # Currently threads/shared and Hash/Util/FieldHash, since they are
21396 # not picked up by the recursive find above (and adding in general
21397 # recursive finding breaks SDBM_File/sdbm).
21398 # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21399 known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
21400 set X $known_extensions
21401 shift
21402 known_extensions="$*"
21403 set X $nonxs_extensions
21404 shift
21405 nonxs_extensions="$*"
21406 cd "$tdir"
21407
21408 : Now see which are supported on this system.
21409 avail_ext=''
21410 for xxx in $known_extensions ; do
21411         case "$xxx" in
21412         DB_File|db_file)
21413                 case "$i_db" in
21414                 $define) avail_ext="$avail_ext $xxx" ;;
21415                 esac
21416                 ;;
21417         GDBM_File|gdbm_fil)
21418                 case "$i_gdbm" in
21419                 $define) avail_ext="$avail_ext $xxx" ;;
21420                 esac
21421                 ;;
21422         I18N/Langinfo|i18n_lan)
21423                 case "$i_langinfo$d_nl_langinfo" in
21424                 $define$define) avail_ext="$avail_ext $xxx" ;;
21425                 esac
21426                 ;;
21427         IPC/SysV|ipc/sysv)
21428                 : XXX Do we need a useipcsysv variable here
21429                 case "${d_msg}${d_sem}${d_shm}" in
21430                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21431                 esac
21432                 ;;
21433         NDBM_File|ndbm_fil)
21434                 case "$i_ndbm" in
21435                 $define)
21436                     case "$osname-$use64bitint" in
21437                     hpux-define)
21438                         case "$libs" in
21439                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21440                         esac
21441                         ;;
21442                     *) avail_ext="$avail_ext $xxx" ;;
21443                     esac
21444                     ;;
21445                 esac
21446                 ;;
21447         ODBM_File|odbm_fil)
21448                 case "${i_dbm}${i_rpcsvcdbm}" in
21449                 *"${define}"*)
21450                     case "$d_cplusplus" in
21451                     define) ;; # delete as a function name will not work
21452                     *)  case "$osname-$use64bitint" in
21453                         hpux-define)
21454                             case "$libs" in
21455                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21456                             esac
21457                             ;;
21458                         *) avail_ext="$avail_ext $xxx" ;;
21459                         esac
21460                         ;;
21461                     esac
21462                     ;;
21463                 esac
21464                 ;;
21465         Opcode|opcode)
21466                 case "$useopcode" in
21467                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21468                 esac
21469                 ;;
21470         POSIX|posix)
21471                 case "$useposix" in
21472                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21473                 esac
21474                 ;;
21475         Socket|socket)
21476                 case "$d_socket" in
21477                 true|$define|y)
21478                     case "$osname" in
21479                     beos) ;; # not unless BONE
21480                     *) avail_ext="$avail_ext $xxx" ;;
21481                     esac
21482                     ;;
21483                 esac
21484                 ;;
21485         Sys/Syslog|sys/syslog)
21486                 : XXX syslog requires socket
21487                 case "$d_socket" in
21488                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21489                 esac
21490                 ;;
21491         Thread|thread)
21492                 case "$usethreads" in
21493                 true|$define|y)
21494                         case "$use5005threads" in
21495                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
21496                         esac
21497                 esac
21498                 ;;
21499         threads|threads/shared)
21500                 # threads and threads::shared are special cases.
21501                 # To stop people from asking "Perl 5.8.0 was supposed
21502                 # to have this new fancy threads implementation but my
21503                 # perl doesn't have it" and from people trying to
21504                 # (re)install the threads module using CPAN.pm and
21505                 # CPAN.pm then offering to reinstall Perl 5.8.0,
21506                 # the threads.pm and threads/shared.pm will always be
21507                 # there, croaking informatively ("you need to rebuild
21508                 # all of Perl with threads, sorry") when threads haven't
21509                 # been compiled in.
21510                 # --jhi
21511                 avail_ext="$avail_ext $xxx"
21512                 ;;
21513         Win32*)
21514                 case "$osname" in
21515                 cygwin) avail_ext="$avail_ext $xxx" ;;
21516                 esac
21517                 ;;
21518         XS/APItest|xs/apitest)
21519                 # This is just for testing.  Skip it unless we have dynamic loading.
21520
21521                 case "$usedl" in
21522                 $define) avail_ext="$avail_ext $xxx" ;;
21523                 esac
21524                 ;;
21525         XS/Typemap|xs/typemap)
21526                 # This is just for testing.  Skip it unless we have dynamic loading.
21527                 case "$usedl" in
21528                 $define) avail_ext="$avail_ext $xxx" ;;
21529                 esac
21530                 ;;
21531         *)      avail_ext="$avail_ext $xxx"
21532                 ;;
21533         esac
21534 done
21535
21536 set X $avail_ext
21537 shift
21538 avail_ext="$*"
21539
21540 case "$onlyextensions" in
21541 '') ;;
21542 *)  keepextensions=''
21543     echo "You have requested that only certains extensions be included..." >&4
21544     for i in $onlyextensions; do
21545         case " $avail_ext " in
21546         *" $i "*)
21547             echo "Keeping extension $i."
21548             keepextensions="$keepextensions $i"
21549             ;;
21550         *) echo "Ignoring extension $i." ;;
21551         esac
21552     done
21553     avail_ext="$keepextensions"
21554     ;;
21555 esac
21556
21557 case "$noextensions" in
21558 '') ;;
21559 *)  keepextensions=''
21560     echo "You have requested that certain extensions be ignored..." >&4
21561     for i in $avail_ext; do
21562         case " $noextensions " in
21563         *" $i "*) echo "Ignoring extension $i." ;;
21564         *) echo "Keeping extension $i.";
21565            keepextensions="$keepextensions $i"
21566            ;;
21567         esac
21568     done
21569     avail_ext="$keepextensions"
21570     ;;
21571 esac
21572
21573 : Now see which nonxs extensions are supported on this system.
21574 : For now assume all are.
21575 nonxs_ext=''
21576 for xxx in $nonxs_extensions ; do
21577         case "$xxx" in
21578         *)      nonxs_ext="$nonxs_ext $xxx"
21579                 ;;
21580         esac
21581 done
21582
21583 set X $nonxs_ext
21584 shift
21585 nonxs_ext="$*"
21586
21587 case $usedl in
21588 $define)
21589         $cat <<EOM
21590 A number of extensions are supplied with $package.  You may choose to
21591 compile these extensions for dynamic loading (the default), compile
21592 them into the $package executable (static loading), or not include
21593 them at all.  Answer "none" to include no extensions.
21594 Note that DynaLoader is always built and need not be mentioned here.
21595
21596 EOM
21597         case "$dynamic_ext" in
21598         '')
21599                 : Exclude those listed in static_ext
21600                 dflt=''
21601                 for xxx in $avail_ext; do
21602                         case " $static_ext " in
21603                         *" $xxx "*) ;;
21604                         *) dflt="$dflt $xxx" ;;
21605                         esac
21606                 done
21607                 set X $dflt
21608                 shift
21609                 dflt="$*"
21610                 ;;
21611         *)      dflt="$dynamic_ext"
21612                 # Perhaps we are reusing an old out-of-date config.sh.
21613                 case "$hint" in
21614                 previous)
21615                         if test X"$dynamic_ext" != X"$avail_ext"; then
21616                                 $cat <<EOM
21617 NOTICE:  Your previous config.sh list may be incorrect.
21618 The extensions now available to you are
21619         ${avail_ext}
21620 but the default list from your previous config.sh is
21621         ${dynamic_ext}
21622
21623 EOM
21624                         fi
21625                         ;;
21626                 esac
21627                 ;;
21628         esac
21629         case "$dflt" in
21630         '')     dflt=none;;
21631         esac
21632         rp="What extensions do you wish to load dynamically?"
21633         . ./myread
21634         case "$ans" in
21635         none) dynamic_ext=' ' ;;
21636         *) dynamic_ext="$ans" ;;
21637         esac
21638
21639         case "$static_ext" in
21640         '')
21641                 : Exclude those already listed in dynamic linking
21642                 dflt=''
21643                 for xxx in $avail_ext; do
21644                         case " $dynamic_ext " in
21645                         *" $xxx "*) ;;
21646                         *) dflt="$dflt $xxx" ;;
21647                         esac
21648                 done
21649                 set X $dflt
21650                 shift
21651                 dflt="$*"
21652                 ;;
21653         *)  dflt="$static_ext"
21654                 ;;
21655         esac
21656
21657         case "$dflt" in
21658         '')     dflt=none;;
21659         esac
21660         rp="What extensions do you wish to load statically?"
21661         . ./myread
21662         case "$ans" in
21663         none) static_ext=' ' ;;
21664         *) static_ext="$ans" ;;
21665         esac
21666         ;;
21667 *)
21668         $cat <<EOM
21669 A number of extensions are supplied with $package.  Answer "none"
21670 to include no extensions.
21671 Note that DynaLoader is always built and need not be mentioned here.
21672
21673 EOM
21674         case "$static_ext" in
21675         '') dflt="$avail_ext" ;;
21676         *)      dflt="$static_ext"
21677                 # Perhaps we are reusing an old out-of-date config.sh.
21678                 case "$hint" in
21679                 previous)
21680                         if test X"$static_ext" != X"$avail_ext"; then
21681                                 $cat <<EOM
21682 NOTICE:  Your previous config.sh list may be incorrect.
21683 The extensions now available to you are
21684         ${avail_ext}
21685 but the default list from your previous config.sh is
21686         ${static_ext}
21687
21688 EOM
21689                         fi
21690                         ;;
21691                 esac
21692                 ;;
21693         esac
21694         : Exclude those that are not xs extensions
21695         case "$dflt" in
21696         '')     dflt=none;;
21697         esac
21698         rp="What extensions do you wish to include?"
21699         . ./myread
21700         case "$ans" in
21701         none) static_ext=' ' ;;
21702         *) static_ext="$ans" ;;
21703         esac
21704         ;;
21705 esac
21706 #
21707 # Encode is a special case.  If we are building Encode as a static
21708 # extension, we need to explicitly list its subextensions as well.
21709 # For other nested extensions, this is handled automatically by
21710 # the appropriate Makefile.PL.
21711 case " $static_ext " in
21712         *" Encode "*) # Add the subextensions of Encode
21713         cd "$rsrc/ext"
21714         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21715                 static_ext="$static_ext Encode/$xxx"
21716         done
21717         cd "$tdir"
21718         ;;
21719 esac
21720
21721 set X $dynamic_ext $static_ext $nonxs_ext
21722 shift
21723 extensions="$*"
21724
21725 # Sanity check:  We require an extension suitable for use with
21726 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21727 # should show up as failures in the test suite, but it's helpful to
21728 # catch them now.) The 'extensions' list is normally sorted
21729 # alphabetically, so we need to accept either
21730 #    DB_File ... Fcntl ... IO  ....
21731 # or something like
21732 #    Fcntl ... NDBM_File ... IO  ....
21733 case " $extensions"  in
21734 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21735 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21736 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21737 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21738    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21739    ;;
21740 esac
21741
21742 : Remove libraries needed only for extensions
21743 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21744 : The exception is SunOS 4.x, which needs them.
21745 case "${osname}X${osvers}" in
21746 sunos*X4*)
21747     perllibs="$libs"
21748     ;;
21749 *) case "$usedl" in
21750     $define|true|[yY]*)
21751             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21752             shift
21753             perllibs="$*"
21754             ;;
21755     *)  perllibs="$libs"
21756             ;;
21757     esac
21758     ;;
21759 esac
21760
21761 : Remove build directory name from cppstdin so it can be used from
21762 : either the present location or the final installed location.
21763 echo " "
21764 : Get out of the UU directory to get correct path name.
21765 cd ..
21766 case "$cppstdin" in
21767 `pwd`/cppstdin)
21768         echo "Stripping down cppstdin path name"
21769         cppstdin=cppstdin
21770         ;;
21771 esac
21772 cd UU
21773
21774 : end of configuration questions
21775 echo " "
21776 echo "End of configuration questions."
21777 echo " "
21778
21779 : back to where it started
21780 if test -d ../UU; then
21781         cd ..
21782 fi
21783
21784 : configuration may be unconditionally patched via a 'config.arch' file
21785 if $test -f config.arch; then
21786         echo "I see a config.arch file, loading it." >&4
21787         . ./config.arch
21788 fi
21789
21790 : configuration may be patched via a 'config.over' file
21791 if $test -f config.over; then
21792         echo " "
21793         dflt=y
21794         rp='I see a config.over file.  Do you wish to load it?'
21795         . UU/myread
21796         case "$ans" in
21797         n*) echo "OK, I'll ignore it.";;
21798         *)      . ./config.over
21799                 echo "Configuration override changes have been loaded."
21800                 ;;
21801         esac
21802 fi
21803
21804 : in case they want portability, strip down executable paths
21805 case "$d_portable" in
21806 "$define")
21807         echo " "
21808         echo "Stripping down executable paths..." >&4
21809         for file in $loclist $trylist; do
21810                 eval temp=\$$file
21811                 eval $file=`basename $temp`
21812         done
21813         ;;
21814 esac
21815
21816 : create config.sh file
21817 echo " "
21818 echo "Creating config.sh..." >&4
21819 $spitshell <<EOT >config.sh
21820 $startsh
21821 #
21822 # This file was produced by running the Configure script. It holds all the
21823 # definitions figured out by Configure. Should you modify one of these values,
21824 # do not forget to propagate your changes by running "Configure -der". You may
21825 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21826 #
21827
21828 # Package name      : $package
21829 # Source directory  : $src
21830 # Configuration time: $cf_time
21831 # Configured by     : $cf_by
21832 # Target system     : $myuname
21833
21834 EOT
21835 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
21836 $spitshell <<EOT >>config.sh
21837
21838 Author='$Author'
21839 Date='$Date'
21840 Header='$Header'
21841 Id='$Id'
21842 Locker='$Locker'
21843 Log='$Log'
21844 RCSfile='$RCSfile'
21845 Revision='$Revision'
21846 Source='$Source'
21847 State='$State'
21848 _a='$_a'
21849 _exe='$_exe'
21850 _o='$_o'
21851 afs='$afs'
21852 afsroot='$afsroot'
21853 alignbytes='$alignbytes'
21854 ansi2knr='$ansi2knr'
21855 aphostname='$aphostname'
21856 api_revision='$api_revision'
21857 api_subversion='$api_subversion'
21858 api_version='$api_version'
21859 api_versionstring='$api_versionstring'
21860 ar='$ar'
21861 archlib='$archlib'
21862 archlibexp='$archlibexp'
21863 archname64='$archname64'
21864 archname='$archname'
21865 archobjs='$archobjs'
21866 asctime_r_proto='$asctime_r_proto'
21867 awk='$awk'
21868 baserev='$baserev'
21869 bash='$bash'
21870 bin='$bin'
21871 binexp='$binexp'
21872 bison='$bison'
21873 byacc='$byacc'
21874 byteorder='$byteorder'
21875 c='$c'
21876 castflags='$castflags'
21877 cat='$cat'
21878 cc='$cc'
21879 cccdlflags='$cccdlflags'
21880 ccdlflags='$ccdlflags'
21881 ccflags='$ccflags'
21882 ccflags_uselargefiles='$ccflags_uselargefiles'
21883 ccname='$ccname'
21884 ccsymbols='$ccsymbols'
21885 ccversion='$ccversion'
21886 cf_by='$cf_by'
21887 cf_email='$cf_email'
21888 cf_time='$cf_time'
21889 chgrp='$chgrp'
21890 chmod='$chmod'
21891 chown='$chown'
21892 clocktype='$clocktype'
21893 comm='$comm'
21894 compress='$compress'
21895 contains='$contains'
21896 cp='$cp'
21897 cpio='$cpio'
21898 cpp='$cpp'
21899 cpp_stuff='$cpp_stuff'
21900 cppccsymbols='$cppccsymbols'
21901 cppflags='$cppflags'
21902 cpplast='$cpplast'
21903 cppminus='$cppminus'
21904 cpprun='$cpprun'
21905 cppstdin='$cppstdin'
21906 cppsymbols='$cppsymbols'
21907 crypt_r_proto='$crypt_r_proto'
21908 cryptlib='$cryptlib'
21909 csh='$csh'
21910 ctermid_r_proto='$ctermid_r_proto'
21911 ctime_r_proto='$ctime_r_proto'
21912 d_Gconvert='$d_Gconvert'
21913 d_PRIEUldbl='$d_PRIEUldbl'
21914 d_PRIFUldbl='$d_PRIFUldbl'
21915 d_PRIGUldbl='$d_PRIGUldbl'
21916 d_PRIXU64='$d_PRIXU64'
21917 d_PRId64='$d_PRId64'
21918 d_PRIeldbl='$d_PRIeldbl'
21919 d_PRIfldbl='$d_PRIfldbl'
21920 d_PRIgldbl='$d_PRIgldbl'
21921 d_PRIi64='$d_PRIi64'
21922 d_PRIo64='$d_PRIo64'
21923 d_PRIu64='$d_PRIu64'
21924 d_PRIx64='$d_PRIx64'
21925 d_SCNfldbl='$d_SCNfldbl'
21926 d__fwalk='$d__fwalk'
21927 d_access='$d_access'
21928 d_accessx='$d_accessx'
21929 d_aintl='$d_aintl'
21930 d_alarm='$d_alarm'
21931 d_archlib='$d_archlib'
21932 d_asctime_r='$d_asctime_r'
21933 d_atolf='$d_atolf'
21934 d_atoll='$d_atoll'
21935 d_attribute_format='$d_attribute_format'
21936 d_attribute_malloc='$d_attribute_malloc'
21937 d_attribute_nonnull='$d_attribute_nonnull'
21938 d_attribute_noreturn='$d_attribute_noreturn'
21939 d_attribute_pure='$d_attribute_pure'
21940 d_attribute_unused='$d_attribute_unused'
21941 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21942 d_bcmp='$d_bcmp'
21943 d_bcopy='$d_bcopy'
21944 d_bsd='$d_bsd'
21945 d_bsdgetpgrp='$d_bsdgetpgrp'
21946 d_bsdsetpgrp='$d_bsdsetpgrp'
21947 d_builtin_choose_expr='$d_builtin_choose_expr'
21948 d_builtin_expect='$d_builtin_expect'
21949 d_bzero='$d_bzero'
21950 d_c99_variadic_macros='$d_c99_variadic_macros'
21951 d_casti32='$d_casti32'
21952 d_castneg='$d_castneg'
21953 d_charvspr='$d_charvspr'
21954 d_chown='$d_chown'
21955 d_chroot='$d_chroot'
21956 d_chsize='$d_chsize'
21957 d_class='$d_class'
21958 d_clearenv='$d_clearenv'
21959 d_closedir='$d_closedir'
21960 d_cmsghdr_s='$d_cmsghdr_s'
21961 d_const='$d_const'
21962 d_copysignl='$d_copysignl'
21963 d_cplusplus='$d_cplusplus'
21964 d_crypt='$d_crypt'
21965 d_crypt_r='$d_crypt_r'
21966 d_csh='$d_csh'
21967 d_ctermid='$d_ctermid'
21968 d_ctermid_r='$d_ctermid_r'
21969 d_ctime_r='$d_ctime_r'
21970 d_cuserid='$d_cuserid'
21971 d_dbl_dig='$d_dbl_dig'
21972 d_dbminitproto='$d_dbminitproto'
21973 d_difftime='$d_difftime'
21974 d_dir_dd_fd='$d_dir_dd_fd'
21975 d_dirfd='$d_dirfd'
21976 d_dirnamlen='$d_dirnamlen'
21977 d_dlerror='$d_dlerror'
21978 d_dlopen='$d_dlopen'
21979 d_dlsymun='$d_dlsymun'
21980 d_dosuid='$d_dosuid'
21981 d_drand48_r='$d_drand48_r'
21982 d_drand48proto='$d_drand48proto'
21983 d_dup2='$d_dup2'
21984 d_eaccess='$d_eaccess'
21985 d_endgrent='$d_endgrent'
21986 d_endgrent_r='$d_endgrent_r'
21987 d_endhent='$d_endhent'
21988 d_endhostent_r='$d_endhostent_r'
21989 d_endnent='$d_endnent'
21990 d_endnetent_r='$d_endnetent_r'
21991 d_endpent='$d_endpent'
21992 d_endprotoent_r='$d_endprotoent_r'
21993 d_endpwent='$d_endpwent'
21994 d_endpwent_r='$d_endpwent_r'
21995 d_endsent='$d_endsent'
21996 d_endservent_r='$d_endservent_r'
21997 d_eofnblk='$d_eofnblk'
21998 d_eunice='$d_eunice'
21999 d_faststdio='$d_faststdio'
22000 d_fchdir='$d_fchdir'
22001 d_fchmod='$d_fchmod'
22002 d_fchown='$d_fchown'
22003 d_fcntl='$d_fcntl'
22004 d_fcntl_can_lock='$d_fcntl_can_lock'
22005 d_fd_macros='$d_fd_macros'
22006 d_fd_set='$d_fd_set'
22007 d_fds_bits='$d_fds_bits'
22008 d_fgetpos='$d_fgetpos'
22009 d_finite='$d_finite'
22010 d_finitel='$d_finitel'
22011 d_flexfnam='$d_flexfnam'
22012 d_flock='$d_flock'
22013 d_flockproto='$d_flockproto'
22014 d_fork='$d_fork'
22015 d_fp_class='$d_fp_class'
22016 d_fpathconf='$d_fpathconf'
22017 d_fpclass='$d_fpclass'
22018 d_fpclassify='$d_fpclassify'
22019 d_fpclassl='$d_fpclassl'
22020 d_fpos64_t='$d_fpos64_t'
22021 d_frexpl='$d_frexpl'
22022 d_fs_data_s='$d_fs_data_s'
22023 d_fseeko='$d_fseeko'
22024 d_fsetpos='$d_fsetpos'
22025 d_fstatfs='$d_fstatfs'
22026 d_fstatvfs='$d_fstatvfs'
22027 d_fsync='$d_fsync'
22028 d_ftello='$d_ftello'
22029 d_ftime='$d_ftime'
22030 d_futimes='$d_futimes'
22031 d_getcwd='$d_getcwd'
22032 d_getespwnam='$d_getespwnam'
22033 d_getfsstat='$d_getfsstat'
22034 d_getgrent='$d_getgrent'
22035 d_getgrent_r='$d_getgrent_r'
22036 d_getgrgid_r='$d_getgrgid_r'
22037 d_getgrnam_r='$d_getgrnam_r'
22038 d_getgrps='$d_getgrps'
22039 d_gethbyaddr='$d_gethbyaddr'
22040 d_gethbyname='$d_gethbyname'
22041 d_gethent='$d_gethent'
22042 d_gethname='$d_gethname'
22043 d_gethostbyaddr_r='$d_gethostbyaddr_r'
22044 d_gethostbyname_r='$d_gethostbyname_r'
22045 d_gethostent_r='$d_gethostent_r'
22046 d_gethostprotos='$d_gethostprotos'
22047 d_getitimer='$d_getitimer'
22048 d_getlogin='$d_getlogin'
22049 d_getlogin_r='$d_getlogin_r'
22050 d_getmnt='$d_getmnt'
22051 d_getmntent='$d_getmntent'
22052 d_getnbyaddr='$d_getnbyaddr'
22053 d_getnbyname='$d_getnbyname'
22054 d_getnent='$d_getnent'
22055 d_getnetbyaddr_r='$d_getnetbyaddr_r'
22056 d_getnetbyname_r='$d_getnetbyname_r'
22057 d_getnetent_r='$d_getnetent_r'
22058 d_getnetprotos='$d_getnetprotos'
22059 d_getpagsz='$d_getpagsz'
22060 d_getpbyname='$d_getpbyname'
22061 d_getpbynumber='$d_getpbynumber'
22062 d_getpent='$d_getpent'
22063 d_getpgid='$d_getpgid'
22064 d_getpgrp2='$d_getpgrp2'
22065 d_getpgrp='$d_getpgrp'
22066 d_getppid='$d_getppid'
22067 d_getprior='$d_getprior'
22068 d_getprotobyname_r='$d_getprotobyname_r'
22069 d_getprotobynumber_r='$d_getprotobynumber_r'
22070 d_getprotoent_r='$d_getprotoent_r'
22071 d_getprotoprotos='$d_getprotoprotos'
22072 d_getprpwnam='$d_getprpwnam'
22073 d_getpwent='$d_getpwent'
22074 d_getpwent_r='$d_getpwent_r'
22075 d_getpwnam_r='$d_getpwnam_r'
22076 d_getpwuid_r='$d_getpwuid_r'
22077 d_getsbyname='$d_getsbyname'
22078 d_getsbyport='$d_getsbyport'
22079 d_getsent='$d_getsent'
22080 d_getservbyname_r='$d_getservbyname_r'
22081 d_getservbyport_r='$d_getservbyport_r'
22082 d_getservent_r='$d_getservent_r'
22083 d_getservprotos='$d_getservprotos'
22084 d_getspnam='$d_getspnam'
22085 d_getspnam_r='$d_getspnam_r'
22086 d_gettimeod='$d_gettimeod'
22087 d_gmtime_r='$d_gmtime_r'
22088 d_gnulibc='$d_gnulibc'
22089 d_grpasswd='$d_grpasswd'
22090 d_hasmntopt='$d_hasmntopt'
22091 d_htonl='$d_htonl'
22092 d_ilogbl='$d_ilogbl'
22093 d_inc_version_list='$d_inc_version_list'
22094 d_index='$d_index'
22095 d_inetaton='$d_inetaton'
22096 d_int64_t='$d_int64_t'
22097 d_isascii='$d_isascii'
22098 d_isfinite='$d_isfinite'
22099 d_isinf='$d_isinf'
22100 d_isnan='$d_isnan'
22101 d_isnanl='$d_isnanl'
22102 d_killpg='$d_killpg'
22103 d_lchown='$d_lchown'
22104 d_ldbl_dig='$d_ldbl_dig'
22105 d_libm_lib_version='$d_libm_lib_version'
22106 d_link='$d_link'
22107 d_localtime_r='$d_localtime_r'
22108 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
22109 d_locconv='$d_locconv'
22110 d_lockf='$d_lockf'
22111 d_longdbl='$d_longdbl'
22112 d_longlong='$d_longlong'
22113 d_lseekproto='$d_lseekproto'
22114 d_lstat='$d_lstat'
22115 d_madvise='$d_madvise'
22116 d_malloc_good_size='$d_malloc_good_size'
22117 d_malloc_size='$d_malloc_size'
22118 d_mblen='$d_mblen'
22119 d_mbstowcs='$d_mbstowcs'
22120 d_mbtowc='$d_mbtowc'
22121 d_memchr='$d_memchr'
22122 d_memcmp='$d_memcmp'
22123 d_memcpy='$d_memcpy'
22124 d_memmove='$d_memmove'
22125 d_memset='$d_memset'
22126 d_mkdir='$d_mkdir'
22127 d_mkdtemp='$d_mkdtemp'
22128 d_mkfifo='$d_mkfifo'
22129 d_mkstemp='$d_mkstemp'
22130 d_mkstemps='$d_mkstemps'
22131 d_mktime='$d_mktime'
22132 d_mmap='$d_mmap'
22133 d_modfl='$d_modfl'
22134 d_modfl_pow32_bug='$d_modfl_pow32_bug'
22135 d_modflproto='$d_modflproto'
22136 d_mprotect='$d_mprotect'
22137 d_msg='$d_msg'
22138 d_msg_ctrunc='$d_msg_ctrunc'
22139 d_msg_dontroute='$d_msg_dontroute'
22140 d_msg_oob='$d_msg_oob'
22141 d_msg_peek='$d_msg_peek'
22142 d_msg_proxy='$d_msg_proxy'
22143 d_msgctl='$d_msgctl'
22144 d_msgget='$d_msgget'
22145 d_msghdr_s='$d_msghdr_s'
22146 d_msgrcv='$d_msgrcv'
22147 d_msgsnd='$d_msgsnd'
22148 d_msync='$d_msync'
22149 d_munmap='$d_munmap'
22150 d_mymalloc='$d_mymalloc'
22151 d_ndbm='$d_ndbm'
22152 d_nice='$d_nice'
22153 d_nl_langinfo='$d_nl_langinfo'
22154 d_nv_preserves_uv='$d_nv_preserves_uv'
22155 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
22156 d_off64_t='$d_off64_t'
22157 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
22158 d_oldpthreads='$d_oldpthreads'
22159 d_oldsock='$d_oldsock'
22160 d_open3='$d_open3'
22161 d_pathconf='$d_pathconf'
22162 d_pause='$d_pause'
22163 d_perl_otherlibdirs='$d_perl_otherlibdirs'
22164 d_phostname='$d_phostname'
22165 d_pipe='$d_pipe'
22166 d_poll='$d_poll'
22167 d_portable='$d_portable'
22168 d_printf_format_null='$d_printf_format_null'
22169 d_procselfexe='$d_procselfexe'
22170 d_pseudofork='$d_pseudofork'
22171 d_pthread_atfork='$d_pthread_atfork'
22172 d_pthread_attr_setscope='$d_pthread_attr_setscope'
22173 d_pthread_yield='$d_pthread_yield'
22174 d_pwage='$d_pwage'
22175 d_pwchange='$d_pwchange'
22176 d_pwclass='$d_pwclass'
22177 d_pwcomment='$d_pwcomment'
22178 d_pwexpire='$d_pwexpire'
22179 d_pwgecos='$d_pwgecos'
22180 d_pwpasswd='$d_pwpasswd'
22181 d_pwquota='$d_pwquota'
22182 d_qgcvt='$d_qgcvt'
22183 d_quad='$d_quad'
22184 d_random_r='$d_random_r'
22185 d_readdir64_r='$d_readdir64_r'
22186 d_readdir='$d_readdir'
22187 d_readdir_r='$d_readdir_r'
22188 d_readlink='$d_readlink'
22189 d_readv='$d_readv'
22190 d_recvmsg='$d_recvmsg'
22191 d_rename='$d_rename'
22192 d_rewinddir='$d_rewinddir'
22193 d_rmdir='$d_rmdir'
22194 d_safebcpy='$d_safebcpy'
22195 d_safemcpy='$d_safemcpy'
22196 d_sanemcmp='$d_sanemcmp'
22197 d_sbrkproto='$d_sbrkproto'
22198 d_scalbnl='$d_scalbnl'
22199 d_sched_yield='$d_sched_yield'
22200 d_scm_rights='$d_scm_rights'
22201 d_seekdir='$d_seekdir'
22202 d_select='$d_select'
22203 d_sem='$d_sem'
22204 d_semctl='$d_semctl'
22205 d_semctl_semid_ds='$d_semctl_semid_ds'
22206 d_semctl_semun='$d_semctl_semun'
22207 d_semget='$d_semget'
22208 d_semop='$d_semop'
22209 d_sendmsg='$d_sendmsg'
22210 d_setegid='$d_setegid'
22211 d_seteuid='$d_seteuid'
22212 d_setgrent='$d_setgrent'
22213 d_setgrent_r='$d_setgrent_r'
22214 d_setgrps='$d_setgrps'
22215 d_sethent='$d_sethent'
22216 d_sethostent_r='$d_sethostent_r'
22217 d_setitimer='$d_setitimer'
22218 d_setlinebuf='$d_setlinebuf'
22219 d_setlocale='$d_setlocale'
22220 d_setlocale_r='$d_setlocale_r'
22221 d_setnent='$d_setnent'
22222 d_setnetent_r='$d_setnetent_r'
22223 d_setpent='$d_setpent'
22224 d_setpgid='$d_setpgid'
22225 d_setpgrp2='$d_setpgrp2'
22226 d_setpgrp='$d_setpgrp'
22227 d_setprior='$d_setprior'
22228 d_setproctitle='$d_setproctitle'
22229 d_setprotoent_r='$d_setprotoent_r'
22230 d_setpwent='$d_setpwent'
22231 d_setpwent_r='$d_setpwent_r'
22232 d_setregid='$d_setregid'
22233 d_setresgid='$d_setresgid'
22234 d_setresuid='$d_setresuid'
22235 d_setreuid='$d_setreuid'
22236 d_setrgid='$d_setrgid'
22237 d_setruid='$d_setruid'
22238 d_setsent='$d_setsent'
22239 d_setservent_r='$d_setservent_r'
22240 d_setsid='$d_setsid'
22241 d_setvbuf='$d_setvbuf'
22242 d_sfio='$d_sfio'
22243 d_shm='$d_shm'
22244 d_shmat='$d_shmat'
22245 d_shmatprototype='$d_shmatprototype'
22246 d_shmctl='$d_shmctl'
22247 d_shmdt='$d_shmdt'
22248 d_shmget='$d_shmget'
22249 d_sigaction='$d_sigaction'
22250 d_signbit='$d_signbit'
22251 d_sigprocmask='$d_sigprocmask'
22252 d_sigsetjmp='$d_sigsetjmp'
22253 d_sitearch='$d_sitearch'
22254 d_snprintf='$d_snprintf'
22255 d_sockatmark='$d_sockatmark'
22256 d_sockatmarkproto='$d_sockatmarkproto'
22257 d_socket='$d_socket'
22258 d_socklen_t='$d_socklen_t'
22259 d_sockpair='$d_sockpair'
22260 d_socks5_init='$d_socks5_init'
22261 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
22262 d_sqrtl='$d_sqrtl'
22263 d_srand48_r='$d_srand48_r'
22264 d_srandom_r='$d_srandom_r'
22265 d_sresgproto='$d_sresgproto'
22266 d_sresuproto='$d_sresuproto'
22267 d_statblks='$d_statblks'
22268 d_statfs_f_flags='$d_statfs_f_flags'
22269 d_statfs_s='$d_statfs_s'
22270 d_statvfs='$d_statvfs'
22271 d_stdio_cnt_lval='$d_stdio_cnt_lval'
22272 d_stdio_ptr_lval='$d_stdio_ptr_lval'
22273 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
22274 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
22275 d_stdio_stream_array='$d_stdio_stream_array'
22276 d_stdiobase='$d_stdiobase'
22277 d_stdstdio='$d_stdstdio'
22278 d_strchr='$d_strchr'
22279 d_strcoll='$d_strcoll'
22280 d_strctcpy='$d_strctcpy'
22281 d_strerrm='$d_strerrm'
22282 d_strerror='$d_strerror'
22283 d_strerror_r='$d_strerror_r'
22284 d_strftime='$d_strftime'
22285 d_strlcat='$d_strlcat'
22286 d_strlcpy='$d_strlcpy'
22287 d_strtod='$d_strtod'
22288 d_strtol='$d_strtol'
22289 d_strtold='$d_strtold'
22290 d_strtoll='$d_strtoll'
22291 d_strtoq='$d_strtoq'
22292 d_strtoul='$d_strtoul'
22293 d_strtoull='$d_strtoull'
22294 d_strtouq='$d_strtouq'
22295 d_strxfrm='$d_strxfrm'
22296 d_suidsafe='$d_suidsafe'
22297 d_symlink='$d_symlink'
22298 d_syscall='$d_syscall'
22299 d_syscallproto='$d_syscallproto'
22300 d_sysconf='$d_sysconf'
22301 d_sysernlst='$d_sysernlst'
22302 d_syserrlst='$d_syserrlst'
22303 d_system='$d_system'
22304 d_tcgetpgrp='$d_tcgetpgrp'
22305 d_tcsetpgrp='$d_tcsetpgrp'
22306 d_telldir='$d_telldir'
22307 d_telldirproto='$d_telldirproto'
22308 d_time='$d_time'
22309 d_times='$d_times'
22310 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
22311 d_tm_tm_zone='$d_tm_tm_zone'
22312 d_tmpnam_r='$d_tmpnam_r'
22313 d_truncate='$d_truncate'
22314 d_ttyname_r='$d_ttyname_r'
22315 d_tzname='$d_tzname'
22316 d_u32align='$d_u32align'
22317 d_ualarm='$d_ualarm'
22318 d_umask='$d_umask'
22319 d_uname='$d_uname'
22320 d_union_semun='$d_union_semun'
22321 d_unordered='$d_unordered'
22322 d_unsetenv='$d_unsetenv'
22323 d_usleep='$d_usleep'
22324 d_usleepproto='$d_usleepproto'
22325 d_ustat='$d_ustat'
22326 d_vendorarch='$d_vendorarch'
22327 d_vendorbin='$d_vendorbin'
22328 d_vendorlib='$d_vendorlib'
22329 d_vendorscript='$d_vendorscript'
22330 d_vfork='$d_vfork'
22331 d_void_closedir='$d_void_closedir'
22332 d_voidsig='$d_voidsig'
22333 d_voidtty='$d_voidtty'
22334 d_volatile='$d_volatile'
22335 d_vprintf='$d_vprintf'
22336 d_vsnprintf='$d_vsnprintf'
22337 d_wait4='$d_wait4'
22338 d_waitpid='$d_waitpid'
22339 d_wcstombs='$d_wcstombs'
22340 d_wctomb='$d_wctomb'
22341 d_writev='$d_writev'
22342 d_xenix='$d_xenix'
22343 date='$date'
22344 db_hashtype='$db_hashtype'
22345 db_prefixtype='$db_prefixtype'
22346 db_version_major='$db_version_major'
22347 db_version_minor='$db_version_minor'
22348 db_version_patch='$db_version_patch'
22349 defvoidused='$defvoidused'
22350 direntrytype='$direntrytype'
22351 dlext='$dlext'
22352 dlsrc='$dlsrc'
22353 doublesize='$doublesize'
22354 drand01='$drand01'
22355 drand48_r_proto='$drand48_r_proto'
22356 dtrace='$dtrace'
22357 dynamic_ext='$dynamic_ext'
22358 eagain='$eagain'
22359 ebcdic='$ebcdic'
22360 echo='$echo'
22361 egrep='$egrep'
22362 emacs='$emacs'
22363 endgrent_r_proto='$endgrent_r_proto'
22364 endhostent_r_proto='$endhostent_r_proto'
22365 endnetent_r_proto='$endnetent_r_proto'
22366 endprotoent_r_proto='$endprotoent_r_proto'
22367 endpwent_r_proto='$endpwent_r_proto'
22368 endservent_r_proto='$endservent_r_proto'
22369 eunicefix='$eunicefix'
22370 exe_ext='$exe_ext'
22371 expr='$expr'
22372 extensions='$extensions'
22373 extras='$extras'
22374 fflushNULL='$fflushNULL'
22375 fflushall='$fflushall'
22376 find='$find'
22377 firstmakefile='$firstmakefile'
22378 flex='$flex'
22379 fpossize='$fpossize'
22380 fpostype='$fpostype'
22381 freetype='$freetype'
22382 from='$from'
22383 full_ar='$full_ar'
22384 full_csh='$full_csh'
22385 full_sed='$full_sed'
22386 gccansipedantic='$gccansipedantic'
22387 gccosandvers='$gccosandvers'
22388 gccversion='$gccversion'
22389 getgrent_r_proto='$getgrent_r_proto'
22390 getgrgid_r_proto='$getgrgid_r_proto'
22391 getgrnam_r_proto='$getgrnam_r_proto'
22392 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22393 gethostbyname_r_proto='$gethostbyname_r_proto'
22394 gethostent_r_proto='$gethostent_r_proto'
22395 getlogin_r_proto='$getlogin_r_proto'
22396 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22397 getnetbyname_r_proto='$getnetbyname_r_proto'
22398 getnetent_r_proto='$getnetent_r_proto'
22399 getprotobyname_r_proto='$getprotobyname_r_proto'
22400 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22401 getprotoent_r_proto='$getprotoent_r_proto'
22402 getpwent_r_proto='$getpwent_r_proto'
22403 getpwnam_r_proto='$getpwnam_r_proto'
22404 getpwuid_r_proto='$getpwuid_r_proto'
22405 getservbyname_r_proto='$getservbyname_r_proto'
22406 getservbyport_r_proto='$getservbyport_r_proto'
22407 getservent_r_proto='$getservent_r_proto'
22408 getspnam_r_proto='$getspnam_r_proto'
22409 gidformat='$gidformat'
22410 gidsign='$gidsign'
22411 gidsize='$gidsize'
22412 gidtype='$gidtype'
22413 glibpth='$glibpth'
22414 gmake='$gmake'
22415 gmtime_r_proto='$gmtime_r_proto'
22416 gnulibc_version='$gnulibc_version'
22417 grep='$grep'
22418 groupcat='$groupcat'
22419 groupstype='$groupstype'
22420 gzip='$gzip'
22421 h_fcntl='$h_fcntl'
22422 h_sysfile='$h_sysfile'
22423 hint='$hint'
22424 hostcat='$hostcat'
22425 html1dir='$html1dir'
22426 html1direxp='$html1direxp'
22427 html3dir='$html3dir'
22428 html3direxp='$html3direxp'
22429 i16size='$i16size'
22430 i16type='$i16type'
22431 i32size='$i32size'
22432 i32type='$i32type'
22433 i64size='$i64size'
22434 i64type='$i64type'
22435 i8size='$i8size'
22436 i8type='$i8type'
22437 i_arpainet='$i_arpainet'
22438 i_assert='$i_assert'
22439 i_bsdioctl='$i_bsdioctl'
22440 i_crypt='$i_crypt'
22441 i_db='$i_db'
22442 i_dbm='$i_dbm'
22443 i_dirent='$i_dirent'
22444 i_dld='$i_dld'
22445 i_dlfcn='$i_dlfcn'
22446 i_fcntl='$i_fcntl'
22447 i_float='$i_float'
22448 i_fp='$i_fp'
22449 i_fp_class='$i_fp_class'
22450 i_gdbm='$i_gdbm'
22451 i_gdbm_ndbm='$i_gdbm_ndbm'
22452 i_gdbmndbm='$i_gdbmndbm'
22453 i_grp='$i_grp'
22454 i_ieeefp='$i_ieeefp'
22455 i_inttypes='$i_inttypes'
22456 i_langinfo='$i_langinfo'
22457 i_libutil='$i_libutil'
22458 i_limits='$i_limits'
22459 i_locale='$i_locale'
22460 i_machcthr='$i_machcthr'
22461 i_malloc='$i_malloc'
22462 i_mallocmalloc='$i_mallocmalloc'
22463 i_math='$i_math'
22464 i_memory='$i_memory'
22465 i_mntent='$i_mntent'
22466 i_ndbm='$i_ndbm'
22467 i_netdb='$i_netdb'
22468 i_neterrno='$i_neterrno'
22469 i_netinettcp='$i_netinettcp'
22470 i_niin='$i_niin'
22471 i_poll='$i_poll'
22472 i_prot='$i_prot'
22473 i_pthread='$i_pthread'
22474 i_pwd='$i_pwd'
22475 i_rpcsvcdbm='$i_rpcsvcdbm'
22476 i_sfio='$i_sfio'
22477 i_sgtty='$i_sgtty'
22478 i_shadow='$i_shadow'
22479 i_socks='$i_socks'
22480 i_stdarg='$i_stdarg'
22481 i_stddef='$i_stddef'
22482 i_stdlib='$i_stdlib'
22483 i_string='$i_string'
22484 i_sunmath='$i_sunmath'
22485 i_sysaccess='$i_sysaccess'
22486 i_sysdir='$i_sysdir'
22487 i_sysfile='$i_sysfile'
22488 i_sysfilio='$i_sysfilio'
22489 i_sysin='$i_sysin'
22490 i_sysioctl='$i_sysioctl'
22491 i_syslog='$i_syslog'
22492 i_sysmman='$i_sysmman'
22493 i_sysmode='$i_sysmode'
22494 i_sysmount='$i_sysmount'
22495 i_sysndir='$i_sysndir'
22496 i_sysparam='$i_sysparam'
22497 i_syspoll='$i_syspoll'
22498 i_sysresrc='$i_sysresrc'
22499 i_syssecrt='$i_syssecrt'
22500 i_sysselct='$i_sysselct'
22501 i_syssockio='$i_syssockio'
22502 i_sysstat='$i_sysstat'
22503 i_sysstatfs='$i_sysstatfs'
22504 i_sysstatvfs='$i_sysstatvfs'
22505 i_systime='$i_systime'
22506 i_systimek='$i_systimek'
22507 i_systimes='$i_systimes'
22508 i_systypes='$i_systypes'
22509 i_sysuio='$i_sysuio'
22510 i_sysun='$i_sysun'
22511 i_sysutsname='$i_sysutsname'
22512 i_sysvfs='$i_sysvfs'
22513 i_syswait='$i_syswait'
22514 i_termio='$i_termio'
22515 i_termios='$i_termios'
22516 i_time='$i_time'
22517 i_unistd='$i_unistd'
22518 i_ustat='$i_ustat'
22519 i_utime='$i_utime'
22520 i_values='$i_values'
22521 i_varargs='$i_varargs'
22522 i_varhdr='$i_varhdr'
22523 i_vfork='$i_vfork'
22524 ignore_versioned_solibs='$ignore_versioned_solibs'
22525 inc_version_list='$inc_version_list'
22526 inc_version_list_init='$inc_version_list_init'
22527 incpath='$incpath'
22528 inews='$inews'
22529 initialinstalllocation='$initialinstalllocation'
22530 installarchlib='$installarchlib'
22531 installbin='$installbin'
22532 installhtml1dir='$installhtml1dir'
22533 installhtml3dir='$installhtml3dir'
22534 installman1dir='$installman1dir'
22535 installman3dir='$installman3dir'
22536 installprefix='$installprefix'
22537 installprefixexp='$installprefixexp'
22538 installprivlib='$installprivlib'
22539 installscript='$installscript'
22540 installsitearch='$installsitearch'
22541 installsitebin='$installsitebin'
22542 installsitehtml1dir='$installsitehtml1dir'
22543 installsitehtml3dir='$installsitehtml3dir'
22544 installsitelib='$installsitelib'
22545 installsiteman1dir='$installsiteman1dir'
22546 installsiteman3dir='$installsiteman3dir'
22547 installsitescript='$installsitescript'
22548 installstyle='$installstyle'
22549 installusrbinperl='$installusrbinperl'
22550 installvendorarch='$installvendorarch'
22551 installvendorbin='$installvendorbin'
22552 installvendorhtml1dir='$installvendorhtml1dir'
22553 installvendorhtml3dir='$installvendorhtml3dir'
22554 installvendorlib='$installvendorlib'
22555 installvendorman1dir='$installvendorman1dir'
22556 installvendorman3dir='$installvendorman3dir'
22557 installvendorscript='$installvendorscript'
22558 intsize='$intsize'
22559 issymlink='$issymlink'
22560 ivdformat='$ivdformat'
22561 ivsize='$ivsize'
22562 ivtype='$ivtype'
22563 known_extensions='$known_extensions'
22564 ksh='$ksh'
22565 ld='$ld'
22566 lddlflags='$lddlflags'
22567 ldflags='$ldflags'
22568 ldflags_uselargefiles='$ldflags_uselargefiles'
22569 ldlibpthname='$ldlibpthname'
22570 less='$less'
22571 lib_ext='$lib_ext'
22572 libc='$libc'
22573 libperl='$libperl'
22574 libpth='$libpth'
22575 libs='$libs'
22576 libsdirs='$libsdirs'
22577 libsfiles='$libsfiles'
22578 libsfound='$libsfound'
22579 libspath='$libspath'
22580 libswanted='$libswanted'
22581 libswanted_uselargefiles='$libswanted_uselargefiles'
22582 line='$line'
22583 lint='$lint'
22584 lkflags='$lkflags'
22585 ln='$ln'
22586 lns='$lns'
22587 localtime_r_proto='$localtime_r_proto'
22588 locincpth='$locincpth'
22589 loclibpth='$loclibpth'
22590 longdblsize='$longdblsize'
22591 longlongsize='$longlongsize'
22592 longsize='$longsize'
22593 lp='$lp'
22594 lpr='$lpr'
22595 ls='$ls'
22596 lseeksize='$lseeksize'
22597 lseektype='$lseektype'
22598 mad='$mad'
22599 madlyh='$madlyh'
22600 madlyobj='$madlyobj'
22601 madlysrc='$madlysrc'
22602 mail='$mail'
22603 mailx='$mailx'
22604 make='$make'
22605 make_set_make='$make_set_make'
22606 mallocobj='$mallocobj'
22607 mallocsrc='$mallocsrc'
22608 malloctype='$malloctype'
22609 man1dir='$man1dir'
22610 man1direxp='$man1direxp'
22611 man1ext='$man1ext'
22612 man3dir='$man3dir'
22613 man3direxp='$man3direxp'
22614 man3ext='$man3ext'
22615 mips_type='$mips_type'
22616 mistrustnm='$mistrustnm'
22617 mkdir='$mkdir'
22618 mmaptype='$mmaptype'
22619 modetype='$modetype'
22620 more='$more'
22621 multiarch='$multiarch'
22622 mv='$mv'
22623 myarchname='$myarchname'
22624 mydomain='$mydomain'
22625 myhostname='$myhostname'
22626 myuname='$myuname'
22627 n='$n'
22628 need_va_copy='$need_va_copy'
22629 netdb_hlen_type='$netdb_hlen_type'
22630 netdb_host_type='$netdb_host_type'
22631 netdb_name_type='$netdb_name_type'
22632 netdb_net_type='$netdb_net_type'
22633 nm='$nm'
22634 nm_opt='$nm_opt'
22635 nm_so_opt='$nm_so_opt'
22636 nonxs_ext='$nonxs_ext'
22637 nroff='$nroff'
22638 nvEUformat='$nvEUformat'
22639 nvFUformat='$nvFUformat'
22640 nvGUformat='$nvGUformat'
22641 nv_overflows_integers_at='$nv_overflows_integers_at'
22642 nv_preserves_uv_bits='$nv_preserves_uv_bits'
22643 nveformat='$nveformat'
22644 nvfformat='$nvfformat'
22645 nvgformat='$nvgformat'
22646 nvsize='$nvsize'
22647 nvtype='$nvtype'
22648 o_nonblock='$o_nonblock'
22649 obj_ext='$obj_ext'
22650 old_pthread_create_joinable='$old_pthread_create_joinable'
22651 optimize='$optimize'
22652 orderlib='$orderlib'
22653 osname='$osname'
22654 osvers='$osvers'
22655 otherlibdirs='$otherlibdirs'
22656 package='$package'
22657 pager='$pager'
22658 passcat='$passcat'
22659 patchlevel='$patchlevel'
22660 path_sep='$path_sep'
22661 perl5='$perl5'
22662 perl='$perl'
22663 perl_patchlevel='$perl_patchlevel'
22664 perladmin='$perladmin'
22665 perllibs='$perllibs'
22666 perlpath='$perlpath'
22667 pg='$pg'
22668 phostname='$phostname'
22669 pidtype='$pidtype'
22670 plibpth='$plibpth'
22671 pmake='$pmake'
22672 pr='$pr'
22673 prefix='$prefix'
22674 prefixexp='$prefixexp'
22675 privlib='$privlib'
22676 privlibexp='$privlibexp'
22677 procselfexe='$procselfexe'
22678 prototype='$prototype'
22679 ptrsize='$ptrsize'
22680 quadkind='$quadkind'
22681 quadtype='$quadtype'
22682 randbits='$randbits'
22683 randfunc='$randfunc'
22684 random_r_proto='$random_r_proto'
22685 randseedtype='$randseedtype'
22686 ranlib='$ranlib'
22687 rd_nodata='$rd_nodata'
22688 readdir64_r_proto='$readdir64_r_proto'
22689 readdir_r_proto='$readdir_r_proto'
22690 revision='$revision'
22691 rm='$rm'
22692 rm_try='$rm_try'
22693 rmail='$rmail'
22694 run='$run'
22695 runnm='$runnm'
22696 sGMTIME_max='$sGMTIME_max'
22697 sGMTIME_min='$sGMTIME_min'
22698 sPRIEUldbl='$sPRIEUldbl'
22699 sPRIFUldbl='$sPRIFUldbl'
22700 sPRIGUldbl='$sPRIGUldbl'
22701 sPRIXU64='$sPRIXU64'
22702 sPRId64='$sPRId64'
22703 sPRIeldbl='$sPRIeldbl'
22704 sPRIfldbl='$sPRIfldbl'
22705 sPRIgldbl='$sPRIgldbl'
22706 sPRIi64='$sPRIi64'
22707 sPRIo64='$sPRIo64'
22708 sPRIu64='$sPRIu64'
22709 sPRIx64='$sPRIx64'
22710 sSCNfldbl='$sSCNfldbl'
22711 sched_yield='$sched_yield'
22712 scriptdir='$scriptdir'
22713 scriptdirexp='$scriptdirexp'
22714 sed='$sed'
22715 seedfunc='$seedfunc'
22716 selectminbits='$selectminbits'
22717 selecttype='$selecttype'
22718 sendmail='$sendmail'
22719 setgrent_r_proto='$setgrent_r_proto'
22720 sethostent_r_proto='$sethostent_r_proto'
22721 setlocale_r_proto='$setlocale_r_proto'
22722 setnetent_r_proto='$setnetent_r_proto'
22723 setprotoent_r_proto='$setprotoent_r_proto'
22724 setpwent_r_proto='$setpwent_r_proto'
22725 setservent_r_proto='$setservent_r_proto'
22726 sh='$sh'
22727 shar='$shar'
22728 sharpbang='$sharpbang'
22729 shmattype='$shmattype'
22730 shortsize='$shortsize'
22731 shrpenv='$shrpenv'
22732 shsharp='$shsharp'
22733 sig_count='$sig_count'
22734 sig_name='$sig_name'
22735 sig_name_init='$sig_name_init'
22736 sig_num='$sig_num'
22737 sig_num_init='$sig_num_init'
22738 sig_size='$sig_size'
22739 signal_t='$signal_t'
22740 sitearch='$sitearch'
22741 sitearchexp='$sitearchexp'
22742 sitebin='$sitebin'
22743 sitebinexp='$sitebinexp'
22744 sitehtml1dir='$sitehtml1dir'
22745 sitehtml1direxp='$sitehtml1direxp'
22746 sitehtml3dir='$sitehtml3dir'
22747 sitehtml3direxp='$sitehtml3direxp'
22748 sitelib='$sitelib'
22749 sitelib_stem='$sitelib_stem'
22750 sitelibexp='$sitelibexp'
22751 siteman1dir='$siteman1dir'
22752 siteman1direxp='$siteman1direxp'
22753 siteman3dir='$siteman3dir'
22754 siteman3direxp='$siteman3direxp'
22755 siteprefix='$siteprefix'
22756 siteprefixexp='$siteprefixexp'
22757 sitescript='$sitescript'
22758 sitescriptexp='$sitescriptexp'
22759 sizesize='$sizesize'
22760 sizetype='$sizetype'
22761 sleep='$sleep'
22762 smail='$smail'
22763 so='$so'
22764 sockethdr='$sockethdr'
22765 socketlib='$socketlib'
22766 socksizetype='$socksizetype'
22767 sort='$sort'
22768 spackage='$spackage'
22769 spitshell='$spitshell'
22770 srand48_r_proto='$srand48_r_proto'
22771 srandom_r_proto='$srandom_r_proto'
22772 src='$src'
22773 ssizetype='$ssizetype'
22774 startperl='$startperl'
22775 startsh='$startsh'
22776 static_ext='$static_ext'
22777 stdchar='$stdchar'
22778 stdio_base='$stdio_base'
22779 stdio_bufsiz='$stdio_bufsiz'
22780 stdio_cnt='$stdio_cnt'
22781 stdio_filbuf='$stdio_filbuf'
22782 stdio_ptr='$stdio_ptr'
22783 stdio_stream_array='$stdio_stream_array'
22784 strerror_r_proto='$strerror_r_proto'
22785 strings='$strings'
22786 submit='$submit'
22787 subversion='$subversion'
22788 sysman='$sysman'
22789 tail='$tail'
22790 tar='$tar'
22791 targetarch='$targetarch'
22792 tbl='$tbl'
22793 tee='$tee'
22794 test='$test'
22795 timeincl='$timeincl'
22796 timetype='$timetype'
22797 tmpnam_r_proto='$tmpnam_r_proto'
22798 to='$to'
22799 touch='$touch'
22800 tr='$tr'
22801 trnl='$trnl'
22802 troff='$troff'
22803 ttyname_r_proto='$ttyname_r_proto'
22804 u16size='$u16size'
22805 u16type='$u16type'
22806 u32size='$u32size'
22807 u32type='$u32type'
22808 u64size='$u64size'
22809 u64type='$u64type'
22810 u8size='$u8size'
22811 u8type='$u8type'
22812 uidformat='$uidformat'
22813 uidsign='$uidsign'
22814 uidsize='$uidsize'
22815 uidtype='$uidtype'
22816 uname='$uname'
22817 uniq='$uniq'
22818 uquadtype='$uquadtype'
22819 use5005threads='$use5005threads'
22820 use64bitall='$use64bitall'
22821 use64bitint='$use64bitint'
22822 usecrosscompile='$usecrosscompile'
22823 usedl='$usedl'
22824 usedtrace='$usedtrace'
22825 usefaststdio='$usefaststdio'
22826 useithreads='$useithreads'
22827 uselargefiles='$uselargefiles'
22828 uselongdouble='$uselongdouble'
22829 usemallocwrap='$usemallocwrap'
22830 usemorebits='$usemorebits'
22831 usemultiplicity='$usemultiplicity'
22832 usemymalloc='$usemymalloc'
22833 usenm='$usenm'
22834 useopcode='$useopcode'
22835 useperlio='$useperlio'
22836 useposix='$useposix'
22837 usereentrant='$usereentrant'
22838 userelocatableinc='$userelocatableinc'
22839 usesfio='$usesfio'
22840 useshrplib='$useshrplib'
22841 usesitecustomize='$usesitecustomize'
22842 usesocks='$usesocks'
22843 usethreads='$usethreads'
22844 usevendorprefix='$usevendorprefix'
22845 usevfork='$usevfork'
22846 usrinc='$usrinc'
22847 uuname='$uuname'
22848 uvXUformat='$uvXUformat'
22849 uvoformat='$uvoformat'
22850 uvsize='$uvsize'
22851 uvtype='$uvtype'
22852 uvuformat='$uvuformat'
22853 uvxformat='$uvxformat'
22854 vendorarch='$vendorarch'
22855 vendorarchexp='$vendorarchexp'
22856 vendorbin='$vendorbin'
22857 vendorbinexp='$vendorbinexp'
22858 vendorhtml1dir='$vendorhtml1dir'
22859 vendorhtml1direxp='$vendorhtml1direxp'
22860 vendorhtml3dir='$vendorhtml3dir'
22861 vendorhtml3direxp='$vendorhtml3direxp'
22862 vendorlib='$vendorlib'
22863 vendorlib_stem='$vendorlib_stem'
22864 vendorlibexp='$vendorlibexp'
22865 vendorman1dir='$vendorman1dir'
22866 vendorman1direxp='$vendorman1direxp'
22867 vendorman3dir='$vendorman3dir'
22868 vendorman3direxp='$vendorman3direxp'
22869 vendorprefix='$vendorprefix'
22870 vendorprefixexp='$vendorprefixexp'
22871 vendorscript='$vendorscript'
22872 vendorscriptexp='$vendorscriptexp'
22873 version='$version'
22874 version_patchlevel_string='$version_patchlevel_string'
22875 versiononly='$versiononly'
22876 vi='$vi'
22877 voidflags='$voidflags'
22878 xlibpth='$xlibpth'
22879 yacc='$yacc'
22880 yaccflags='$yaccflags'
22881 zcat='$zcat'
22882 zip='$zip'
22883 EOT
22884
22885 : Add in command line options if available
22886 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22887
22888 : add special variables
22889 $test -f $src/patchlevel.h && \
22890 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22891 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22892 echo "PERL_CONFIG_SH=true" >>config.sh
22893
22894 : propagate old symbols
22895 if $test -f UU/config.sh; then
22896         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22897         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
22898                 config.sh config.sh UU/oldconfig.sh |\
22899                 $sort | $uniq -u >UU/oldsyms
22900         set X `cat UU/oldsyms`
22901         shift
22902         case $# in
22903         0) ;;
22904         *)
22905                 cat <<EOM
22906 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22907 EOM
22908                 echo ": Variables propagated from previous config.sh file." >>config.sh
22909                 for sym in `cat UU/oldsyms`; do
22910                         echo "    Propagating $hint variable "'$'"$sym..."
22911                         eval 'tmp="$'"${sym}"'"'
22912                         echo "$tmp" | \
22913                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22914                 done
22915                 ;;
22916         esac
22917 fi
22918
22919 : Finish up by extracting the .SH files
22920 case "$alldone" in
22921 exit)
22922         $rm -rf UU
22923         echo "Extraction done."
22924         exit 0
22925         ;;
22926 cont)
22927         ;;
22928 '')
22929         dflt=''
22930         nostick=true
22931         $cat <<EOM
22932
22933 If you'd like to make any changes to the config.sh file before I begin
22934 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22935
22936 EOM
22937         rp="Press return or use a shell escape to edit config.sh:"
22938         . UU/myread
22939         nostick=''
22940         case "$ans" in
22941         '') ;;
22942         *) : in case they cannot read
22943                 sh 1>&4 -c "$ans";;
22944         esac
22945         ;;
22946 esac
22947
22948 : if this fails, just run all the .SH files by hand
22949 . ./config.sh
22950
22951 echo " "
22952 exec 1>&4
22953 pwd=`pwd`
22954 . ./UU/extract
22955 cd "$pwd"
22956
22957 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22958         dflt=y
22959         case "$silent" in
22960         true) ;;
22961         *)
22962                 $cat <<EOM
22963
22964 Now you need to generate make dependencies by running "$make depend".
22965 You might prefer to run it in background: "$make depend > makedepend.out &"
22966 It can take a while, so you might not want to run it right now.
22967
22968 EOM
22969                 ;;
22970         esac
22971         rp="Run $make depend now?"
22972         . UU/myread
22973         case "$ans" in
22974         y*)
22975                 $make depend && echo "Now you must run '$make'."
22976                 ;;
22977         *)
22978                 echo "You must run '$make depend' then '$make'."
22979                 ;;
22980         esac
22981 elif test -f [Mm]akefile; then
22982         echo " "
22983         echo "Now you must run a $make."
22984 else
22985         echo "Configure done."
22986 fi
22987
22988 if $test -f Policy.sh; then
22989     $cat <<EOM
22990
22991 If you compile $package on a different machine or from a different object
22992 directory, copy the Policy.sh file from this object directory to the
22993 new one before you run Configure -- this will help you with most of
22994 the policy defaults.
22995
22996 EOM
22997 fi
22998 if $test -f config.msg; then
22999     echo "Hmm.  I also noted the following information while running:"
23000     echo " "
23001     $cat config.msg >&4
23002     $rm -f config.msg
23003 fi
23004 $rm -f kit*isdone ark*isdone
23005 $rm -rf UU
23006
23007 : End of Configure
23008