Implement IO::Handle::say the same way as the builtin say().
[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 Sep 15 10:06:16 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 d_timegm=''
781 clocktype=''
782 d_times=''
783 d_tmpnam_r=''
784 tmpnam_r_proto=''
785 d_truncate=''
786 d_ttyname_r=''
787 ttyname_r_proto=''
788 d_tzname=''
789 d_u32align=''
790 d_ualarm=''
791 d_umask=''
792 d_semctl_semid_ds=''
793 d_semctl_semun=''
794 d_union_semun=''
795 d_unordered=''
796 d_unsetenv=''
797 d_usleep=''
798 d_usleepproto=''
799 d_ustat=''
800 d_pseudofork=''
801 d_vfork=''
802 usevfork=''
803 d_voidsig=''
804 signal_t=''
805 d_volatile=''
806 d_charvspr=''
807 d_vprintf=''
808 d_wait4=''
809 d_waitpid=''
810 d_wcstombs=''
811 d_wctomb=''
812 d_writev=''
813 dlext=''
814 cccdlflags=''
815 ccdlflags=''
816 dlsrc=''
817 ld=''
818 lddlflags=''
819 usedl=''
820 doublesize=''
821 ebcdic=''
822 fflushNULL=''
823 fflushall=''
824 fpossize=''
825 fpostype=''
826 gccansipedantic=''
827 gccosandvers=''
828 gccversion=''
829 gidformat=''
830 gidsign=''
831 gidsize=''
832 gidtype=''
833 groupstype=''
834 h_fcntl=''
835 h_sysfile=''
836 html1dir=''
837 html1direxp=''
838 installhtml1dir=''
839 html3dir=''
840 html3direxp=''
841 installhtml3dir=''
842 i_arpainet=''
843 i_assert=''
844 i_crypt=''
845 db_hashtype=''
846 db_prefixtype=''
847 db_version_major=''
848 db_version_minor=''
849 db_version_patch=''
850 i_db=''
851 i_dbm=''
852 i_rpcsvcdbm=''
853 d_dirnamlen=''
854 direntrytype=''
855 i_dirent=''
856 i_dld=''
857 i_dlfcn=''
858 i_fcntl=''
859 i_float=''
860 i_fp=''
861 i_fp_class=''
862 i_gdbm=''
863 d_grpasswd=''
864 i_grp=''
865 i_ieeefp=''
866 i_inttypes=''
867 i_langinfo=''
868 i_libutil=''
869 i_limits=''
870 i_locale=''
871 i_machcthr=''
872 i_malloc=''
873 i_mallocmalloc=''
874 i_math=''
875 i_memory=''
876 i_mntent=''
877 d_ndbm=''
878 i_gdbm_ndbm=''
879 i_gdbmndbm=''
880 i_ndbm=''
881 i_netdb=''
882 i_neterrno=''
883 i_netinettcp=''
884 i_niin=''
885 i_sysin=''
886 i_poll=''
887 i_prot=''
888 i_pthread=''
889 d_pwage=''
890 d_pwchange=''
891 d_pwclass=''
892 d_pwcomment=''
893 d_pwexpire=''
894 d_pwgecos=''
895 d_pwpasswd=''
896 d_pwquota=''
897 i_pwd=''
898 i_sfio=''
899 i_shadow=''
900 i_socks=''
901 i_stddef=''
902 i_stdlib=''
903 i_string=''
904 strings=''
905 i_sunmath=''
906 i_sysaccess=''
907 i_sysdir=''
908 i_sysfile=''
909 d_voidtty=''
910 i_bsdioctl=''
911 i_sysfilio=''
912 i_sysioctl=''
913 i_syssockio=''
914 i_syslog=''
915 i_sysmman=''
916 i_sysmode=''
917 i_sysmount=''
918 i_sysndir=''
919 i_sysparam=''
920 i_syspoll=''
921 i_sysresrc=''
922 i_syssecrt=''
923 i_sysselct=''
924 i_sysstat=''
925 i_sysstatfs=''
926 i_sysstatvfs=''
927 i_systimes=''
928 i_systypes=''
929 i_sysuio=''
930 i_sysun=''
931 i_sysutsname=''
932 i_sysvfs=''
933 i_syswait=''
934 i_sgtty=''
935 i_termio=''
936 i_termios=''
937 d_tm_tm_gmtoff=''
938 d_tm_tm_zone=''
939 i_systime=''
940 i_systimek=''
941 i_time=''
942 timeincl=''
943 i_unistd=''
944 i_ustat=''
945 i_utime=''
946 i_values=''
947 i_stdarg=''
948 i_varargs=''
949 i_varhdr=''
950 i_vfork=''
951 d_inc_version_list=''
952 inc_version_list=''
953 inc_version_list_init=''
954 installprefix=''
955 installprefixexp=''
956 installstyle=''
957 installusrbinperl=''
958 intsize=''
959 longsize=''
960 shortsize=''
961 issymlink=''
962 libc=''
963 ldlibpthname=''
964 libperl=''
965 shrpenv=''
966 useshrplib=''
967 glibpth=''
968 libpth=''
969 loclibpth=''
970 plibpth=''
971 xlibpth=''
972 ignore_versioned_solibs=''
973 libs=''
974 libsdirs=''
975 libsfiles=''
976 libsfound=''
977 libspath=''
978 lns=''
979 d_PRIEUldbl=''
980 d_PRIFUldbl=''
981 d_PRIGUldbl=''
982 d_PRIeldbl=''
983 d_PRIfldbl=''
984 d_PRIgldbl=''
985 d_SCNfldbl=''
986 sPRIEUldbl=''
987 sPRIFUldbl=''
988 sPRIGUldbl=''
989 sPRIeldbl=''
990 sPRIfldbl=''
991 sPRIgldbl=''
992 sSCNfldbl=''
993 lseeksize=''
994 lseektype=''
995 mad=''
996 madlyh=''
997 madlyobj=''
998 madlysrc=''
999 make_set_make=''
1000 d_mymalloc=''
1001 freetype=''
1002 mallocobj=''
1003 mallocsrc=''
1004 malloctype=''
1005 usemallocwrap=''
1006 usemymalloc=''
1007 installman1dir=''
1008 man1dir=''
1009 man1direxp=''
1010 man1ext=''
1011 installman3dir=''
1012 man3dir=''
1013 man3direxp=''
1014 man3ext=''
1015 modetype=''
1016 multiarch=''
1017 mydomain=''
1018 myhostname=''
1019 phostname=''
1020 c=''
1021 n=''
1022 d_eofnblk=''
1023 eagain=''
1024 o_nonblock=''
1025 rd_nodata=''
1026 need_va_copy=''
1027 netdb_hlen_type=''
1028 netdb_host_type=''
1029 netdb_name_type=''
1030 netdb_net_type=''
1031 groupcat=''
1032 hostcat=''
1033 passcat=''
1034 orderlib=''
1035 ranlib=''
1036 d_perl_otherlibdirs=''
1037 otherlibdirs=''
1038 package=''
1039 spackage=''
1040 pager=''
1041 api_revision=''
1042 api_subversion=''
1043 api_version=''
1044 api_versionstring=''
1045 patchlevel=''
1046 perl_patchlevel=''
1047 revision=''
1048 subversion=''
1049 version=''
1050 version_patchlevel_string=''
1051 perl5=''
1052 perladmin=''
1053 perlpath=''
1054 d_nv_preserves_uv=''
1055 d_nv_zero_is_allbits_zero=''
1056 i16size=''
1057 i16type=''
1058 i32size=''
1059 i32type=''
1060 i64size=''
1061 i64type=''
1062 i8size=''
1063 i8type=''
1064 ivsize=''
1065 ivtype=''
1066 nv_overflows_integers_at=''
1067 nv_preserves_uv_bits=''
1068 nvsize=''
1069 nvtype=''
1070 u16size=''
1071 u16type=''
1072 u32size=''
1073 u32type=''
1074 u64size=''
1075 u64type=''
1076 u8size=''
1077 u8type=''
1078 uvsize=''
1079 uvtype=''
1080 ivdformat=''
1081 nvEUformat=''
1082 nvFUformat=''
1083 nvGUformat=''
1084 nveformat=''
1085 nvfformat=''
1086 nvgformat=''
1087 uvXUformat=''
1088 uvoformat=''
1089 uvuformat=''
1090 uvxformat=''
1091 pidtype=''
1092 prefix=''
1093 prefixexp=''
1094 installprivlib=''
1095 privlib=''
1096 privlibexp=''
1097 prototype=''
1098 ptrsize=''
1099 d_PRIXU64=''
1100 d_PRId64=''
1101 d_PRIi64=''
1102 d_PRIo64=''
1103 d_PRIu64=''
1104 d_PRIx64=''
1105 sPRIXU64=''
1106 sPRId64=''
1107 sPRIi64=''
1108 sPRIo64=''
1109 sPRIu64=''
1110 sPRIx64=''
1111 d_quad=''
1112 quadkind=''
1113 quadtype=''
1114 uquadtype=''
1115 drand01=''
1116 randbits=''
1117 randfunc=''
1118 randseedtype=''
1119 seedfunc=''
1120 installscript=''
1121 scriptdir=''
1122 scriptdirexp=''
1123 selectminbits=''
1124 selecttype=''
1125 sh=''
1126 sig_count=''
1127 sig_name=''
1128 sig_name_init=''
1129 sig_num=''
1130 sig_num_init=''
1131 sig_size=''
1132 d_sitearch=''
1133 installsitearch=''
1134 sitearch=''
1135 sitearchexp=''
1136 installsitebin=''
1137 sitebin=''
1138 sitebinexp=''
1139 installsitehtml1dir=''
1140 sitehtml1dir=''
1141 sitehtml1direxp=''
1142 installsitehtml3dir=''
1143 sitehtml3dir=''
1144 sitehtml3direxp=''
1145 installsitelib=''
1146 sitelib=''
1147 sitelib_stem=''
1148 sitelibexp=''
1149 installsiteman1dir=''
1150 siteman1dir=''
1151 siteman1direxp=''
1152 installsiteman3dir=''
1153 siteman3dir=''
1154 siteman3direxp=''
1155 siteprefix=''
1156 siteprefixexp=''
1157 installsitescript=''
1158 sitescript=''
1159 sitescriptexp=''
1160 sizesize=''
1161 sizetype=''
1162 so=''
1163 socksizetype=''
1164 sharpbang=''
1165 shsharp=''
1166 spitshell=''
1167 src=''
1168 ssizetype=''
1169 startperl=''
1170 startsh=''
1171 stdchar=''
1172 d_stdio_stream_array=''
1173 stdio_stream_array=''
1174 sysman=''
1175 sGMTIME_max=''
1176 sGMTIME_min=''
1177 sLOCALTIME_max=''
1178 sLOCALTIME_min=''
1179 trnl=''
1180 uidformat=''
1181 uidsign=''
1182 uidsize=''
1183 uidtype=''
1184 archname64=''
1185 use64bitall=''
1186 use64bitint=''
1187 dtrace=''
1188 usedtrace=''
1189 usefaststdio=''
1190 ccflags_uselargefiles=''
1191 ldflags_uselargefiles=''
1192 libswanted_uselargefiles=''
1193 uselargefiles=''
1194 uselongdouble=''
1195 usemorebits=''
1196 usemultiplicity=''
1197 nm_opt=''
1198 nm_so_opt=''
1199 runnm=''
1200 usenm=''
1201 useperlio=''
1202 usesocks=''
1203 d_oldpthreads=''
1204 use5005threads=''
1205 useithreads=''
1206 usereentrant=''
1207 usethreads=''
1208 incpath=''
1209 mips_type=''
1210 usrinc=''
1211 d_vendorarch=''
1212 installvendorarch=''
1213 vendorarch=''
1214 vendorarchexp=''
1215 d_vendorbin=''
1216 installvendorbin=''
1217 vendorbin=''
1218 vendorbinexp=''
1219 installvendorhtml1dir=''
1220 vendorhtml1dir=''
1221 vendorhtml1direxp=''
1222 installvendorhtml3dir=''
1223 vendorhtml3dir=''
1224 vendorhtml3direxp=''
1225 d_vendorlib=''
1226 installvendorlib=''
1227 vendorlib=''
1228 vendorlib_stem=''
1229 vendorlibexp=''
1230 installvendorman1dir=''
1231 vendorman1dir=''
1232 vendorman1direxp=''
1233 installvendorman3dir=''
1234 vendorman3dir=''
1235 vendorman3direxp=''
1236 usevendorprefix=''
1237 vendorprefix=''
1238 vendorprefixexp=''
1239 d_vendorscript=''
1240 installvendorscript=''
1241 vendorscript=''
1242 vendorscriptexp=''
1243 versiononly=''
1244 defvoidused=''
1245 voidflags=''
1246 yacc=''
1247 yaccflags=''
1248 CONFIG=''
1249
1250 : Detect odd OSs
1251 define='define'
1252 undef='undef'
1253 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1254 rmlist=''
1255
1256 : We must find out about Eunice early
1257 eunicefix=':'
1258 if test -f /etc/unixtovms; then
1259         eunicefix=/etc/unixtovms
1260 fi
1261 if test -f /etc/unixtovms.exe; then
1262         eunicefix=/etc/unixtovms.exe
1263 fi
1264
1265 : Set executable suffix now -- needed before hints available
1266 if test -f "/libs/version.library"; then
1267 : Amiga OS
1268     _exe=""
1269 elif test -f "/system/gnu_library/bin/ar.pm"; then
1270 : Stratus VOS
1271     _exe=".pm"
1272 elif test -n "$DJGPP"; then
1273 : DOS DJGPP
1274     _exe=".exe"
1275 elif test -d c:/. -o -n "$is_os2" ; then
1276 : OS/2 or cygwin
1277     _exe=".exe"
1278 fi
1279
1280 groupstype=''
1281 i_whoami=''
1282 : Trailing extension.  Override this in a hint file, if needed.
1283 : Extra object files, if any, needed on this platform.
1284 archobjs=''
1285 archname=''
1286 libnames=''
1287 : change the next line if compiling for Xenix/286 on Xenix/386
1288 xlibpth='/usr/lib/386 /lib/386'
1289 : Possible local library directories to search.
1290 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1291 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1292
1293 : general looking path for locating libraries
1294 glibpth="/lib /usr/lib $xlibpth"
1295 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1296 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1297 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1298 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1299
1300 : Private path used by Configure to find libraries.  Its value
1301 : is prepended to libpth. This variable takes care of special
1302 : machines, like the mips.  Usually, it should be empty.
1303 plibpth=''
1304
1305 : default library list
1306 libswanted=''
1307 : some systems want to use only the non-versioned libso:s
1308 ignore_versioned_solibs=''
1309 : set usethreads on the Configure command line to enable threads.
1310 usereentrant='undef'
1311 : full support for void wanted by default
1312 defvoidused=15
1313
1314 : Possible local include directories to search.
1315 : Set locincpth to "" in a hint file to defeat local include searches.
1316 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1317 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1318 :
1319 : no include file wanted by default
1320 inclwanted=''
1321
1322 : Enable -DEBUGGING and -DDEBUGGING from the command line
1323 EBUGGING=''
1324 DEBUGGING=old
1325
1326 ccname=''
1327 ccversion=''
1328 perllibs=''
1329 : set useposix=false in your hint file to disable the POSIX extension.
1330 useposix=true
1331 : set useopcode=false in your hint file to disable the Opcode extension.
1332 useopcode=true
1333 archname64=''
1334 ccflags_uselargefiles=''
1335 ldflags_uselargefiles=''
1336 libswanted_uselargefiles=''
1337 : set usemultiplicity on the Configure command line to enable multiplicity.
1338 : set usesocks on the Configure command line to enable socks.
1339 : List of libraries we want.
1340 : If anyone needs extra -lxxx, put those in a hint file.
1341 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1342 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1343 : We probably want to search /usr/shlib before most other libraries.
1344 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1345 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1346 glibpth="/usr/shlib $glibpth"
1347 : Do not use vfork unless overridden by a hint file.
1348 usevfork=false
1349
1350 : Find the basic shell for Bourne shell scripts
1351 case "$sh" in
1352 '')
1353         case "$SYSTYPE" in
1354         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1355         *) xxx='/bin/sh';;
1356         esac
1357         if test -f "$xxx"; then
1358                 sh="$xxx"
1359         else
1360                 : Build up a list and do a single loop so we can 'break' out.
1361                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1362                 for xxx in sh bash ksh pdksh ash; do
1363                         for p in $pth; do
1364                                 try="$try ${p}/${xxx}"
1365                         done
1366                 done
1367                 for xxx in $try; do
1368                         if test -f "$xxx"; then
1369                                 sh="$xxx";
1370                                 break
1371                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1372                                 sh="$xxx";
1373                                 break
1374                         elif test -f "$xxx.exe"; then
1375                                 sh="$xxx";
1376                                 break
1377                         fi
1378                 done
1379         fi
1380         ;;
1381 esac
1382
1383 case "$sh" in
1384 '')     cat >&2 <<EOM
1385 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1386
1387 Usually it's in /bin/sh.  How did you even get this far?
1388 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1389 we'll try to straighten this all out.
1390 EOM
1391         exit 1
1392         ;;
1393 esac
1394
1395 : see if sh knows # comments
1396 if `$sh -c '#' >/dev/null 2>&1`; then
1397         shsharp=true
1398         spitshell=cat
1399         xcat=/bin/cat
1400         test -f $xcat$_exe || xcat=/usr/bin/cat
1401         if test ! -f $xcat$_exe; then
1402                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1403                         if test -f $p/cat$_exe; then
1404                                 xcat=$p/cat
1405                                 break
1406                         fi
1407                 done
1408                 if test ! -f $xcat$_exe; then
1409                         echo "Can't find cat anywhere!"
1410                         exit 1
1411                 fi
1412         fi
1413         echo "#!$xcat" >sharp
1414         $eunicefix sharp
1415         chmod +x sharp
1416         ./sharp > today 2>/dev/null
1417         if test -s today; then
1418                 sharpbang='#!'
1419         else
1420                 echo "#! $xcat" > sharp
1421                 $eunicefix sharp
1422                 chmod +x sharp
1423                 ./sharp > today 2>/dev/null
1424                 if test -s today; then
1425                         sharpbang='#! '
1426                 else
1427                         sharpbang=': use '
1428                 fi
1429         fi
1430 else
1431         echo " "
1432         echo "Your $sh doesn't grok # comments--I will strip them later on."
1433         shsharp=false
1434         cd ..
1435         echo "exec grep -v '^[  ]*#'" >spitshell
1436         chmod +x spitshell
1437         $eunicefix spitshell
1438         spitshell=`pwd`/spitshell
1439         cd UU
1440         echo "I presume that if # doesn't work, #! won't work either!"
1441         sharpbang=': use '
1442 fi
1443 rm -f sharp today
1444
1445 : figure out how to guarantee sh startup
1446 case "$startsh" in
1447 '') startsh=${sharpbang}${sh} ;;
1448 *)
1449 esac
1450 cat >sharp <<EOSS
1451 $startsh
1452 set abc
1453 test "$?abc" != 1
1454 EOSS
1455
1456 chmod +x sharp
1457 $eunicefix sharp
1458 if ./sharp; then
1459         : echo "Yup, it does."
1460 else
1461         echo "Hmm... '$startsh' does not guarantee sh startup..."
1462         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1463 fi
1464 rm -f sharp
1465
1466 : Save command line options in file UU/cmdline.opt for later use in
1467 : generating config.sh.
1468 cat > cmdline.opt <<EOSH
1469 : Configure command line arguments.
1470 config_arg0='$0'
1471 config_args='$*'
1472 config_argc=$#
1473 EOSH
1474 argn=1
1475 args_exp=''
1476 args_sep=''
1477 for arg in "$@"; do
1478         cat >>cmdline.opt <<EOSH
1479 config_arg$argn='$arg'
1480 EOSH
1481         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1482 $arg
1483 EOC
1484         arg_exp=`cat cmdl.opt`
1485         args_exp="$args_exp$args_sep'$arg_exp'"
1486         argn=`expr $argn + 1`
1487         args_sep=' '
1488 done
1489 rm -f cmdl.opt
1490
1491 : produce awk script to parse command line options
1492 cat >options.awk <<'EOF'
1493 BEGIN {
1494         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1495
1496         len = length(optstr);
1497         for (i = 1; i <= len; i++) {
1498                 c = substr(optstr, i, 1);
1499                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1500                 if (a == ":") {
1501                         arg[c] = 1;
1502                         i++;
1503                 }
1504                 opt[c] = 1;
1505         }
1506 }
1507 {
1508         expect = 0;
1509         str = $0;
1510         if (substr(str, 1, 1) != "-") {
1511                 printf("'%s'\n", str);
1512                 next;
1513         }
1514         len = length($0);
1515         for (i = 2; i <= len; i++) {
1516                 c = substr(str, i, 1);
1517                 if (!opt[c]) {
1518                         printf("-%s\n", substr(str, i));
1519                         next;
1520                 }
1521                 printf("-%s\n", c);
1522                 if (arg[c]) {
1523                         if (i < len)
1524                                 printf("'%s'\n", substr(str, i + 1));
1525                         else
1526                                 expect = 1;
1527                         next;
1528                 }
1529         }
1530 }
1531 END {
1532         if (expect)
1533                 print "?";
1534 }
1535 EOF
1536
1537 : process the command line options
1538 set X `for arg in "$@"; do echo "X$arg"; done |
1539         sed -e s/X// | awk -f options.awk`
1540 eval "set $*"
1541 shift
1542 rm -f options.awk
1543
1544 : set up default values
1545 fastread=''
1546 reuseval=false
1547 config_sh=''
1548 alldone=''
1549 error=''
1550 silent=''
1551 extractsh=''
1552 override=''
1553 knowitall=''
1554 rm -f optdef.sh posthint.sh
1555 cat >optdef.sh <<EOS
1556 $startsh
1557 EOS
1558
1559
1560 : option parsing
1561 while test $# -gt 0; do
1562         case "$1" in
1563         -d) shift; fastread=yes;;
1564         -e) shift; alldone=cont;;
1565         -f)
1566                 shift
1567                 cd ..
1568                 if test -r "$1"; then
1569                         config_sh="$1"
1570                 else
1571                         echo "$me: cannot read config file $1." >&2
1572                         error=true
1573                 fi
1574                 cd UU
1575                 shift;;
1576         --help|\
1577         -h) shift; error=true;;
1578         -r) shift; reuseval=true;;
1579         -s) shift; silent=true; realsilent=true;;
1580         -E) shift; alldone=exit;;
1581         -K) shift; knowitall=true;;
1582         -O) shift; override=true;;
1583         -S) shift; silent=true; extractsh=true;;
1584         -D)
1585                 shift
1586                 case "$1" in
1587                 *=)
1588                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1589                         echo "$me: ignoring -D $1" >&2
1590                         ;;
1591                 *=*) echo "$1" | \
1592                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1593                 *) echo "$1='define'" >> optdef.sh;;
1594                 esac
1595                 shift
1596                 ;;
1597         -U)
1598                 shift
1599                 case "$1" in
1600                 *=) echo "$1" >> optdef.sh;;
1601                 *=*)
1602                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1603                         echo "$me: ignoring -U $1" >&2
1604                         ;;
1605                 *) echo "$1='undef'" >> optdef.sh;;
1606                 esac
1607                 shift
1608                 ;;
1609         -A)
1610             shift
1611             xxx=''
1612             yyy="$1"
1613             zzz=''
1614             uuu=undef
1615             case "$yyy" in
1616             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1617                  case "$zzz" in
1618                  *:*) zzz='' ;;
1619                  *)   xxx=append
1620                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1621                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1622                  esac
1623                  ;;
1624             esac
1625             case "$xxx" in
1626             '')  case "$yyy" in
1627                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1628                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1629                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1630                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1631                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1632                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1633                  esac
1634                  ;;
1635             esac
1636             case "$xxx" in
1637             append)
1638                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1639             clear)
1640                 echo "$yyy=''"                  >> posthint.sh ;;
1641             define)
1642                 case "$zzz" in
1643                 '') zzz=define ;;
1644                 esac
1645                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1646             eval)
1647                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1648             prepend)
1649                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1650             undef)
1651                 case "$zzz" in
1652                 '') zzz="$uuu" ;;
1653                 esac
1654                 echo "$yyy=$zzz"                >> posthint.sh ;;
1655             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1656             esac
1657             shift
1658             ;;
1659         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1660             exit 0;;
1661         --) break;;
1662         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1663         *) break;;
1664         esac
1665 done
1666
1667 case "$error" in
1668 true)
1669         cat >&2 <<EOM
1670 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1671                  [-U symbol] [-U symbol=] [-A command:symbol...]
1672   -d : use defaults for all answers.
1673   -e : go on without questioning past the production of config.sh.
1674   -f : specify an alternate default configuration file.
1675   -h : print this help message and exit (with an error status).
1676   -r : reuse C symbols value if possible (skips costly nm extraction).
1677   -s : silent mode, only echoes questions and essential information.
1678   -D : define symbol to have some value:
1679          -D symbol         symbol gets the value 'define'
1680          -D symbol=value   symbol gets the value 'value'
1681        common used examples (see INSTALL for more info):
1682          -Duse64bitint            use 64bit integers
1683          -Duse64bitall            use 64bit integers and pointers
1684          -Dusethreads             use thread support
1685          -Dinc_version_list=none  do not include older perl trees in @INC
1686          -DEBUGGING=none          DEBUGGING options
1687          -Dcc=gcc                 choose your compiler
1688          -Dprefix=/opt/perl5      choose your destination
1689   -E : stop at the end of questions, after having produced config.sh.
1690   -K : do not use unless you know what you are doing.
1691   -O : let -D and -U override definitions from loaded configuration file.
1692   -S : perform variable substitutions on all .SH files (can mix with -f)
1693   -U : undefine symbol:
1694          -U symbol    symbol gets the value 'undef'
1695          -U symbol=   symbol gets completely empty
1696        e.g.:  -Uversiononly
1697   -A : manipulate symbol after the platform specific hints have been applied:
1698          -A append:symbol=value   append value to symbol
1699          -A symbol=value          like append:, but with a separating space
1700          -A define:symbol=value   define symbol to have value
1701          -A clear:symbol          define symbol to be ''
1702          -A define:symbol         define symbol to be 'define'
1703          -A eval:symbol=value     define symbol to be eval of value
1704          -A prepend:symbol=value  prepend value to symbol
1705          -A undef:symbol          define symbol to be 'undef'
1706          -A undef:symbol=         define symbol to be ''
1707        e.g.:  -A prepend:libswanted='cl pthread '
1708               -A ccflags=-DSOME_MACRO
1709   -V : print version number and exit (with a zero status).
1710 EOM
1711         exit 1
1712         ;;
1713 esac
1714
1715 : Sanity checks
1716 case "$fastread$alldone" in
1717 yescont|yesexit) ;;
1718 *)
1719         case "$extractsh" in
1720         true) ;;
1721         *)
1722                 if test ! -t 0; then
1723                         echo "Say 'sh Configure', not 'sh <Configure'"
1724                         exit 1
1725                 fi
1726                 ;;
1727         esac
1728         ;;
1729 esac
1730
1731 exec 4>&1
1732 case "$silent" in
1733 true) exec 1>/dev/null;;
1734 esac
1735
1736 : run the defines and the undefines, if any, but leave the file out there...
1737 touch optdef.sh
1738 . ./optdef.sh
1739 : create the posthint manipulation script and leave the file out there...
1740 touch posthint.sh
1741
1742 : set package name
1743 package='perl5'
1744 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1745 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1746 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1747 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1748 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1749 esac
1750
1751 : Some greps do not return status, grrr.
1752 echo "grimblepritz" >grimble
1753 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1754         contains=contains
1755 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1756         contains=grep
1757 else
1758         contains=contains
1759 fi
1760 rm -f grimble
1761 : the following should work in any shell
1762 case "$contains" in
1763 contains*)
1764         echo " "
1765         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1766         cat >contains <<'EOSS'
1767 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1768 EOSS
1769 chmod +x contains
1770 esac
1771
1772 : Find the path to the source tree
1773 case "$src" in
1774 '') case "$0" in
1775     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1776          case "$src" in
1777          /*)    ;;
1778          .)     ;;
1779          *)     src=`cd ../$src && pwd` ;;
1780          esac
1781          ;;
1782     *)   src='.';;
1783     esac;;
1784 esac
1785 case "$src" in
1786 '')     src=/
1787         rsrc=/
1788         ;;
1789 /*)     rsrc="$src";;
1790 *)      rsrc="../$src";;
1791 esac
1792 if test -f $rsrc/Configure && \
1793         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1794 then
1795    : found it, so we are ok.
1796 else
1797         rsrc=''
1798         for src in . .. ../.. ../../.. ../../../..; do
1799                 if test -f ../$src/Configure && \
1800                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1801                 then
1802                         rsrc=../$src
1803                         break
1804                 fi
1805         done
1806 fi
1807 case "$rsrc" in
1808 '')
1809         cat <<EOM >&4
1810
1811 Sorry, I can't seem to locate the source dir for $package.  Please start
1812 Configure with an explicit path -- i.e. /some/path/Configure.
1813
1814 EOM
1815         exit 1
1816         ;;
1817 ../.)   rsrc='..';;
1818 *)
1819         echo " "
1820         echo "Sources for $package found in \"$src\"." >&4
1821         ;;
1822 esac
1823
1824 : script used to extract .SH files with variable substitutions
1825 cat >extract <<'EOS'
1826 PERL_CONFIG_SH=true
1827 echo "Doing variable substitutions on .SH files..."
1828 if test -f MANIFEST; then
1829         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1830 else
1831         echo "(Looking for .SH files under the source directory.)"
1832         set x `(cd "$src"; find . -name "*.SH" -print)`
1833 fi
1834 shift
1835 case $# in
1836 0) set x `(cd "$src"; echo *.SH)`; shift;;
1837 esac
1838 if test ! -f "$src/$1"; then
1839         shift
1840 fi
1841 mkdir_p='
1842 name=$1;
1843 create="";
1844 while test $name; do
1845         if test ! -d "$name"; then
1846                 create="$name $create";
1847                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1848                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1849         else
1850                 name="";
1851         fi;
1852 done;
1853 for file in $create; do
1854         mkdir $file;
1855 done
1856 '
1857 for file in $*; do
1858         case "$src" in
1859         ".")
1860                 case "$file" in
1861                 */*)
1862                         dir=`expr X$file : 'X\(.*\)/'`
1863                         file=`expr X$file : 'X.*/\(.*\)'`
1864                         (cd "$dir" && . ./$file)
1865                         ;;
1866                 *)
1867                         . ./$file
1868                         ;;
1869                 esac
1870                 ;;
1871         *)
1872                 case "$file" in
1873                 */*)
1874                         dir=`expr X$file : 'X\(.*\)/'`
1875                         file=`expr X$file : 'X.*/\(.*\)'`
1876                         (set x $dir; shift; eval $mkdir_p)
1877                         sh <"$src/$dir/$file"
1878                         ;;
1879                 *)
1880                         sh <"$src/$file"
1881                         ;;
1882                 esac
1883                 ;;
1884         esac
1885 done
1886 if test -f "$src/config_h.SH"; then
1887         if test ! -f config.h; then
1888         : oops, they left it out of MANIFEST, probably, so do it anyway.
1889         . "$src/config_h.SH"
1890         fi
1891 fi
1892 EOS
1893
1894 : extract files and exit if asked to do so
1895 case "$extractsh" in
1896 true)
1897         case "$realsilent" in
1898         true) ;;
1899         *) exec 1>&4;;
1900         esac
1901         case "$config_sh" in
1902         '') config_sh='config.sh';;
1903         esac
1904         echo " "
1905         echo "Fetching answers from $config_sh..."
1906         cd ..
1907         . $config_sh
1908         test "$override" && . ./optdef.sh
1909         echo " "
1910         . UU/extract
1911         rm -rf UU
1912         echo "Extraction done."
1913         exit 0
1914         ;;
1915 esac
1916
1917 : Eunice requires " " instead of "", can you believe it
1918 echo " "
1919 : Here we go...
1920 echo "Beginning of configuration questions for $package."
1921
1922 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1923
1924 : first determine how to suppress newline on echo command
1925 echo " "
1926 echo "Checking echo to see how to suppress newlines..."
1927 (echo "hi there\c" ; echo " ") >.echotmp
1928 if $contains c .echotmp >/dev/null 2>&1 ; then
1929         echo "...using -n."
1930         n='-n'
1931         c=''
1932 else
1933         cat <<'EOM'
1934 ...using \c
1935 EOM
1936         n=''
1937         c='\c'
1938 fi
1939 echo $n "The star should be here-->$c"
1940 echo '*'
1941 rm -f .echotmp
1942
1943 : Now test for existence of everything in MANIFEST
1944 echo " "
1945 if test -f "$rsrc/MANIFEST"; then
1946         echo "First let's make sure your kit is complete.  Checking..." >&4
1947         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
1948                 (split -l 50 2>/dev/null || split -50)
1949         rm -f missing
1950         tmppwd=`pwd`
1951         for filelist in x??; do
1952                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1953                         >/dev/null 2>>"$tmppwd/missing")
1954         done
1955         if test -s missing; then
1956                 cat missing >&4
1957                 cat >&4 <<'EOM'
1958
1959 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1960
1961 You have the option of continuing the configuration process, despite the
1962 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1963 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1964 and contact the author (perlbug@perl.org).
1965
1966 EOM
1967                 echo $n "Continue? [n] $c" >&4
1968                 read ans
1969                 case "$ans" in
1970                 y*)
1971                         echo "Continuing..." >&4
1972                         rm -f missing
1973                         ;;
1974                 *)
1975                         echo "ABORTING..." >&4
1976                         kill $$
1977                         ;;
1978                 esac
1979         else
1980                 echo "Looks good..."
1981         fi
1982 else
1983         echo "There is no MANIFEST file.  I hope your kit is complete !"
1984 fi
1985 rm -f missing x??
1986
1987 : Find the appropriate value for a newline for tr
1988 echo " "
1989 if test -n "$DJGPP"; then
1990        trnl='\012'
1991 fi
1992 if test X"$trnl" = X; then
1993         case "`echo foo|tr '\n' x 2>/dev/null`" in
1994         foox) trnl='\n' ;;
1995         esac
1996 fi
1997 if test X"$trnl" = X; then
1998         case "`echo foo|tr '\012' x 2>/dev/null`" in
1999         foox) trnl='\012' ;;
2000         esac
2001 fi
2002 if test X"$trnl" = X; then
2003        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2004        fooxy) trnl='\n\r' ;;
2005        esac
2006 fi
2007 if test X"$trnl" = X; then
2008         cat <<EOM >&2
2009
2010 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2011
2012 EOM
2013         exit 1
2014 fi
2015
2016 : compute the number of columns on the terminal for proper question formatting
2017 case "$COLUMNS" in
2018 '') COLUMNS='80';;
2019 esac
2020
2021 : set up the echo used in my read
2022 myecho="case \"\$xxxm\" in
2023 '') echo $n \"\$rp $c\" >&4;;
2024 *) case \"\$rp\" in
2025         '') echo $n \"[\$xxxm] $c\";;
2026         *)
2027                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2028                         echo \"\$rp\" >&4
2029                         echo $n \"[\$xxxm] $c\" >&4
2030                 else
2031                         echo $n \"\$rp [\$xxxm] $c\" >&4
2032                 fi
2033                 ;;
2034         esac;;
2035 esac"
2036
2037 : now set up to do reads with possible shell escape and default assignment
2038 cat <<EOSC >myread
2039 $startsh
2040 xxxm=\$dflt
2041 $myecho
2042 ans='!'
2043 case "\$fastread" in
2044 yes) case "\$dflt" in
2045         '') ;;
2046         *) ans='';
2047                 case "\$silent-\$rp" in
2048                 true-) ;;
2049                 *) echo " " >&4;;
2050                 esac;;
2051         esac;;
2052 *) case "\$silent" in
2053         true) case "\$rp" in
2054                 '') ans='';;
2055                 esac;;
2056         esac;;
2057 esac
2058 while expr "X\$ans" : "X!" >/dev/null; do
2059         read answ
2060         set x \$xxxm
2061         shift
2062         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2063         case  "\$answ" in
2064         "!")
2065                 sh 1>&4
2066                 echo " "
2067                 $myecho
2068                 ;;
2069         !*)
2070                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2071                 shift
2072                 sh 1>&4 -c "\$*"
2073                 echo " "
2074                 $myecho
2075                 ;;
2076         "\$ans")
2077                 case "\$ans" in
2078                 \\&*)
2079                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2080                         shift
2081                         case "\$1" in
2082                         -d)
2083                                 fastread=yes
2084                                 echo "(OK, I'll run with -d after this question.)" >&4
2085                                 ;;
2086                         -*)
2087                                 echo "*** Sorry, \$1 not supported yet." >&4
2088                                 ;;
2089                         esac
2090                         $myecho
2091                         ans=!
2092                         ;;
2093                 esac;;
2094         *)
2095                 case "\$aok" in
2096                 y)
2097                         echo "*** Substitution done -- please confirm."
2098                         xxxm="\$ans"
2099                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2100                         xxxm="\$ans"
2101                         ans=!
2102                         ;;
2103                 *)
2104                         echo "*** Error -- try again."
2105                         ans=!
2106                         ;;
2107                 esac
2108                 $myecho
2109                 ;;
2110         esac
2111         case "\$ans\$xxxm\$nostick" in
2112         '')
2113                 ans=!
2114                 $myecho
2115                 ;;
2116         esac
2117 done
2118 case "\$ans" in
2119 '') ans="\$xxxm";;
2120 esac
2121 EOSC
2122
2123 : create .config dir to save info across Configure sessions
2124 test -d ../.config || mkdir ../.config
2125 cat >../.config/README <<EOF
2126 This directory created by Configure to save information that should
2127 persist across sessions for $package.
2128
2129 You may safely delete it if you wish.
2130 EOF
2131
2132 : See if we are using a devel version and want that
2133 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2134 case "$usedevel" in
2135 $define|true|[yY]*) ;;
2136 *) case "$xversion" in
2137    *[13579])
2138         cat >&4 <<EOH
2139 *** WHOA THERE!!! ***
2140
2141     This is an UNSTABLE DEVELOPMENT release.
2142     The version of this $package distribution is $xversion, that is, odd,
2143     (as opposed to even) and that signifies a development release.
2144     If you want a maintenance release, you want an even-numbered version.
2145
2146     Do ***NOT*** install this into production use.
2147     Data corruption and crashes are possible.
2148
2149     It is most seriously suggested that you do not continue any further
2150     unless you want to help in developing and debugging Perl.
2151
2152     If you *still* want to build perl, you can answer 'y' now,
2153     or pass -Dusedevel to Configure.
2154
2155 EOH
2156         rp='Do you really want to continue?'
2157         dflt='n'
2158         . ./myread
2159         case "$ans" in
2160         [yY]) echo >&4 "Okay, continuing."
2161               usedevel="$define" ;;
2162         *) echo >&4 "Okay, bye."
2163            exit 1
2164            ;;
2165         esac
2166         ;;
2167     esac
2168     ;;
2169 esac
2170 case "$usedevel" in
2171 $define|true|[yY]*)
2172         case "$versiononly" in
2173         '') versiononly="$define" ;;
2174         esac
2175         case "$installusrbinperl" in
2176         '') installusrbinperl="$undef" ;;
2177         esac
2178         ;;
2179 esac
2180
2181 : general instructions
2182 needman=true
2183 firsttime=true
2184 user=`(logname) 2>/dev/null`
2185 case "$user" in
2186 '') user=`whoami 2>&1`;;
2187 esac
2188 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2189         firsttime=false
2190         echo " "
2191         rp='Would you like to see the instructions?'
2192         dflt=n
2193         . ./myread
2194         case "$ans" in
2195         [yY]*) ;;
2196         *) needman=false;;
2197         esac
2198 fi
2199 if $needman; then
2200         cat <<EOH
2201
2202 This installation shell script will examine your system and ask you questions
2203 to determine how the perl5 package should be installed. If you get
2204 stuck on a question, you may use a ! shell escape to start a subshell or
2205 execute a command.  Many of the questions will have default answers in square
2206 brackets; typing carriage return will give you the default.
2207
2208 On some of the questions which ask for file or directory names you are allowed
2209 to use the ~name construct to specify the login directory belonging to "name",
2210 even if you don't have a shell which knows about that.  Questions where this is
2211 allowed will be marked "(~name ok)".
2212
2213 EOH
2214         rp=''
2215         dflt='Type carriage return to continue'
2216         . ./myread
2217         cat <<'EOH'
2218
2219 The prompter used in this script allows you to use shell variables and
2220 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2221 in the default answer, as if the default line was a set of arguments given to a
2222 script shell.  This means you may also use $* to repeat the whole default line,
2223 so you do not have to re-type everything to add something to the default.
2224
2225 Everytime there is a substitution, you will have to confirm.  If there is an
2226 error (e.g. an unmatched backtick), the default answer will remain unchanged
2227 and you will be prompted again.
2228
2229 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2230 the questions and use the computed defaults (or the previous answers if there
2231 was already a config.sh file). Type 'Configure -h' for a list of options.
2232 You may also start interactively and then answer '& -d' at any prompt to turn
2233 on the non-interactive behaviour for the remainder of the execution.
2234
2235 EOH
2236         . ./myread
2237         cat <<EOH
2238
2239 Much effort has been expended to ensure that this shell script will run on any
2240 Unix system.  If despite that it blows up on yours, your best bet is to edit
2241 Configure and run it again.  If you can't run Configure for some reason,
2242 you'll have to generate a config.sh file by hand.  Whatever problems you
2243 have, let me (perlbug@perl.org) know how I blew it.
2244
2245 This installation script affects things in two ways:
2246
2247 1) it may do direct variable substitutions on some of the files included
2248    in this kit.
2249 2) it builds a config.h file for inclusion in C programs.  You may edit
2250    any of these files as the need arises after running this script.
2251
2252 If you make a mistake on a question, there is no easy way to back up to it
2253 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2254 files.  Configure will offer to let you do this before it runs the SH files.
2255
2256 EOH
2257         dflt='Type carriage return to continue'
2258         . ./myread
2259         case "$firsttime" in
2260         true) echo $user >>../.config/instruct;;
2261         esac
2262 fi
2263
2264 : find out where common programs are
2265 echo " "
2266 echo "Locating common programs..." >&4
2267 cat <<EOSC >loc
2268 $startsh
2269 case \$# in
2270 0) exit 1;;
2271 esac
2272 thing=\$1
2273 shift
2274 dflt=\$1
2275 shift
2276 for dir in \$*; do
2277         case "\$thing" in
2278         .)
2279         if test -d \$dir/\$thing; then
2280                 echo \$dir
2281                 exit 0
2282         fi
2283         ;;
2284         *)
2285         for thisthing in \$dir/\$thing; do
2286                 : just loop through to pick last item
2287         done
2288         if test -f \$thisthing; then
2289                 echo \$thisthing
2290                 exit 0
2291         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2292                 echo \$thisthing
2293                 exit 0
2294         elif test -f \$dir/\$thing.exe; then
2295                 if test -n "$DJGPP"; then
2296                         echo \$dir/\$thing.exe
2297                 elif test "$eunicefix" != ":"; then
2298                         : on Eunice apparently
2299                         echo \$dir/\$thing
2300                 fi
2301                 exit 0
2302         fi
2303         ;;
2304         esac
2305 done
2306 echo \$dflt
2307 exit 1
2308 EOSC
2309 chmod +x loc
2310 $eunicefix loc
2311 loclist="
2312 awk
2313 cat
2314 chmod
2315 comm
2316 cp
2317 echo
2318 expr
2319 grep
2320 ls
2321 mkdir
2322 rm
2323 sed
2324 sort
2325 touch
2326 tr
2327 uniq
2328 "
2329 trylist="
2330 ar
2331 bison
2332 byacc
2333 cpp
2334 csh
2335 date
2336 egrep
2337 gmake
2338 gzip
2339 less
2340 ln
2341 make
2342 more
2343 nm
2344 nroff
2345 pg
2346 test
2347 uname
2348 zip
2349 "
2350 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2351 pth="$pth /lib /usr/lib"
2352 for file in $loclist; do
2353         eval xxx=\$$file
2354         case "$xxx" in
2355         /*|?:[\\/]*)
2356                 if test -f "$xxx"; then
2357                         : ok
2358                 else
2359                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2360                         xxx=`./loc $file $file $pth`
2361                 fi
2362                 ;;
2363         '') xxx=`./loc $file $file $pth`;;
2364         *) xxx=`./loc $xxx $xxx $pth`;;
2365         esac
2366         eval $file=$xxx$_exe
2367         eval _$file=$xxx
2368         case "$xxx" in
2369         /*)
2370                 echo $file is in $xxx.
2371                 ;;
2372         ?:[\\/]*)
2373                 echo $file is in $xxx.
2374                 ;;
2375         *)
2376                 echo "I don't know where '$file' is, and my life depends on it." >&4
2377                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2378                 exit 1
2379                 ;;
2380         esac
2381 done
2382 echo " "
2383 echo "Don't worry if any of the following aren't found..."
2384 say=offhand
2385 for file in $trylist; do
2386         eval xxx=\$$file
2387         case "$xxx" in
2388         /*|?:[\\/]*)
2389                 if test -f "$xxx"; then
2390                         : ok
2391                 else
2392                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2393                         xxx=`./loc $file $file $pth`
2394                 fi
2395                 ;;
2396         '') xxx=`./loc $file $file $pth`;;
2397         *) xxx=`./loc $xxx $xxx $pth`;;
2398         esac
2399         eval $file=$xxx$_exe
2400         eval _$file=$xxx
2401         case "$xxx" in
2402         /*)
2403                 echo $file is in $xxx.
2404                 ;;
2405         ?:[\\/]*)
2406                 echo $file is in $xxx.
2407                 ;;
2408         *)
2409                 echo "I don't see $file out there, $say."
2410                 say=either
2411                 ;;
2412         esac
2413 done
2414 case "$egrep" in
2415 egrep)
2416         echo "Substituting grep for egrep."
2417         egrep=$grep
2418         _egrep=$grep
2419         ;;
2420 esac
2421 case "$ln" in
2422 ln)
2423         echo "Substituting cp for ln."
2424         ln=$cp
2425         _ln=$cp
2426         ;;
2427 esac
2428 case "$make" in
2429 make)
2430         case "$gmake" in
2431         gmake)
2432         echo "I can't find make or gmake, and my life depends on it." >&4
2433         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2434         exit 1
2435         ;;
2436         esac
2437         ;;
2438 esac
2439 case "$gmake" in
2440 gmake)  ;;
2441 *)      # We can't have osname yet.
2442         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2443                 # Assume that gmake, if found, is definitely GNU make
2444                 # and prefer it over the system make.
2445                 echo "Substituting gmake for make."
2446                 make=$gmake
2447                 _make=$gmake
2448         fi
2449         ;;
2450 esac
2451 case "$test" in
2452 test)
2453         echo "Hopefully test is built into your sh."
2454         ;;
2455 *)
2456         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2457                 echo "Using the test built into your sh."
2458                 test=test
2459                 _test=test
2460         fi
2461         ;;
2462 esac
2463 case "$echo" in
2464 echo)
2465         echo "Hopefully echo is built into your sh."
2466         ;;
2467 '') ;;
2468 *)
2469         echo " "
2470 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2471         $echo $n "hi there$c" >foo1
2472         echo $n "hi there$c" >foo2
2473         if cmp foo1 foo2 >/dev/null 2>&1; then
2474                 echo "They are compatible.  In fact, they may be identical."
2475         else
2476                 case "$n" in
2477                 '-n') n='' c='\c';;
2478                 *) n='-n' c='';;
2479                 esac
2480                 cat <<FOO
2481 They are not compatible!  You are probably running ksh on a non-USG system.
2482 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2483 have echo built in and we may have to run some Bourne shell scripts.  That
2484 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2485
2486 FOO
2487                 $echo $n "The star should be here-->$c"
2488                 $echo "*"
2489         fi
2490         $rm -f foo1 foo2
2491         ;;
2492 esac
2493
2494 # This question was auctioned at YAPC::Europe-2007 in Vienna
2495 # I never promised you could answer it. I only auctioned the question.
2496 cat <<FOO
2497 The following message is sponsored by
2498
2499   Dresden.pm<--The stars should be here.
2500
2501 Dear Perl user, system administrator or package
2502 maintainer, the Perl community sends greetings to
2503 you. Do you (emblematical) greet back [Y/n]? n
2504
2505 FOO
2506
2507 : Check what type of C compiler we use
2508 cat <<EOS >trygcc
2509 $startsh
2510 EOS
2511 cat <<'EOSC' >>trygcc
2512 case "$cc" in
2513 '') ;;
2514 *)  $rm -f try try.*
2515     $cat >try.c <<EOM
2516 int main(int argc, char *argv[]) {
2517   return 0;
2518 }
2519 EOM
2520     if $cc -o try $ccflags $ldflags try.c; then
2521        :
2522     else
2523         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2524         despair=yes
2525         trygcc=yes
2526         case "$cc" in
2527         *gcc*) trygcc=no ;;
2528         esac
2529         # Skip this test because it gives a false match on output like:
2530         #    ./trygcc: line 23: cc: command not found
2531         # case "`$cc -v -c try.c 2>&1`" in
2532         # *gcc*) trygcc=no ;;
2533         # esac
2534         if $test X"$trygcc" = Xyes; then
2535             if gcc -o try -c try.c; then
2536                 echo " "
2537                 echo "You seem to have a working gcc, though." >&4
2538                 # Switching compilers may undo the work of hints files.
2539                 # The most common problem is -D_REENTRANT for threads.
2540                 # This heuristic catches that case, but gets false positives
2541                 # if -Dusethreads was not actually specified.  Better to
2542                 # bail out here with a useful message than fail 
2543                 # mysteriously later. Should we perhaps just try to
2544                 # re-invoke Configure -Dcc=gcc config_args ?
2545                 if $test -f usethreads.cbu; then
2546                         $cat >&4 <<EOM 
2547
2548 *** However, any setting of the C compiler flags (e.g. for thread support)
2549 *** will be lost.  It may be necessary for you to restart Configure and
2550 *** add -Dcc=gcc to your Configure command line.
2551
2552 EOM
2553                         rp="Would you like to go ahead and try gcc anyway?"
2554                         dflt=n
2555                 else
2556                         rp="Would you like to use it?"
2557                         dflt=y
2558                 fi
2559                 if $test -f myread; then
2560                     . ./myread
2561                 else
2562                     if $test -f UU/myread; then
2563                         . ./UU/myread
2564                     else
2565                         echo "Cannot find myread, sorry.  Aborting." >&2
2566                         exit 1
2567                     fi
2568                 fi  
2569                 case "$ans" in
2570                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2571                 esac
2572             fi
2573         fi
2574     fi
2575     $rm -f try try.*
2576     ;;
2577 esac
2578 EOSC
2579
2580 cat <<EOS >checkcc
2581 $startsh
2582 EOS
2583 cat <<'EOSC' >>checkcc
2584 case "$cc" in        
2585 '') ;;
2586 *)  $rm -f try try.*              
2587     $cat >try.c <<EOM
2588 int main(int argc, char *argv[]) {
2589   return 0;
2590 }
2591 EOM
2592     if $cc -o try $ccflags $ldflags try.c; then
2593        :
2594     else
2595         if $test X"$despair" = Xyes; then
2596            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2597         fi
2598         $cat >&4 <<EOM         
2599 You need to find a working C compiler.
2600 Either (purchase and) install the C compiler supplied by your OS vendor,
2601 or for a free C compiler try http://gcc.gnu.org/
2602 I cannot continue any further, aborting.
2603 EOM
2604         exit 1
2605     fi
2606     $rm -f try try.*
2607     ;;
2608 esac
2609 EOSC
2610
2611 : determine whether symbolic links are supported
2612 echo " "
2613 $touch blurfl
2614 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2615         echo "Symbolic links are supported." >&4
2616         lns="$ln -s"
2617 else
2618         echo "Symbolic links are NOT supported." >&4
2619         lns="$ln"
2620 fi
2621 $rm -f blurfl sym
2622
2623 : determine whether symbolic links are supported
2624 echo " "
2625 case "$lns" in
2626 *"ln"*" -s")
2627         echo "Checking how to test for symbolic links..." >&4
2628         $lns blurfl sym
2629         if $test "X$issymlink" = X; then
2630                 case "$newsh" in
2631                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2632                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2633                 esac
2634                 if test $? = 0; then
2635                         issymlink="test -h"
2636                 else
2637                         echo "Your builtin 'test -h' may be broken." >&4
2638                         case "$test" in
2639                         /*)     ;;
2640                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2641                                 for p in $pth
2642                                 do
2643                                         if test -f "$p/$test"; then
2644                                                 test="$p/$test"
2645                                                 break
2646                                         fi
2647                                 done
2648                                 ;;
2649                         esac
2650                         case "$test" in
2651                         /*)
2652                                 echo "Trying external '$test -h'." >&4
2653                                 issymlink="$test -h"
2654                                 if $test ! -h sym >/dev/null 2>&1; then
2655                                         echo "External '$test -h' is broken, too." >&4
2656                                         issymlink=''
2657                                 fi
2658                                 ;;
2659                         *)      issymlink='' ;;
2660                         esac
2661                 fi              
2662         fi
2663         if $test "X$issymlink" = X; then
2664                 if $test -L sym 2>/dev/null; then
2665                         issymlink="$test -L"
2666                         echo "The builtin '$test -L' worked." >&4
2667                 fi
2668         fi
2669         if $test "X$issymlink" != X; then
2670                 echo "You can test for symbolic links with '$issymlink'." >&4
2671         else
2672                 echo "I do not know how you can test for symbolic links." >&4
2673         fi
2674         $rm -f blurfl sym
2675         ;;
2676 *)      echo "No symbolic links, so not testing for their testing..." >&4
2677         ;;
2678 esac
2679 echo " "
2680
2681 : Make symlinks util
2682 case "$mksymlinks" in
2683 $define|true|[yY]*)
2684         case "$src" in
2685         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2686                 exit 1
2687                 ;;
2688         *)      case "$lns:$issymlink" in
2689                 *"ln"*" -s:"*"test -"?)
2690                         echo "Creating the symbolic links..." >&4
2691                         echo "(First creating the subdirectories...)" >&4
2692                         cd ..
2693                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2694                                 read directory
2695                                 test -z "$directory" && break
2696                                 mkdir -p $directory
2697                         done
2698                         # Sanity check 1.
2699                         if test ! -d t/base; then
2700                                 echo "Failed to create the subdirectories.  Aborting." >&4
2701                                 exit 1
2702                         fi
2703                         echo "(Then creating the symlinks...)" >&4
2704                         awk '{print $1}' $src/MANIFEST | while true; do
2705                                 read filename
2706                                 test -z "$filename" && break
2707                                 if test -f $filename; then
2708                                         if $issymlink $filename; then
2709                                                 rm -f $filename
2710                                         fi
2711                                 fi
2712                                 if test -f $filename; then
2713                                         echo "$filename already exists, not symlinking."
2714                                 else
2715                                         ln -s $src/$filename $filename
2716                                 fi
2717                         done
2718                         # Sanity check 2.
2719                         if test ! -f t/base/lex.t; then
2720                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2721                                 exit 1
2722                         fi
2723                         cd UU
2724                         ;;
2725                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2726                         ;;
2727                 esac
2728                 ;;
2729         esac
2730         ;;
2731 esac
2732
2733 : Check for Cross-Compilation
2734 case "$usecrosscompile" in
2735 $define|true|[yY]*)
2736         $echo "Cross-compiling..."
2737         croak=''
2738         case "$cc" in
2739         *-*-gcc) # A cross-compiling gcc, probably.
2740             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2741             ar=$targetarch-ar
2742             # leave out ld, choosing it is more complex
2743             nm=$targetarch-nm
2744             ranlib=$targetarch-ranlib
2745             $echo 'extern int foo;' > try.c
2746             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2747             shift
2748             if $test $# -gt 0; then
2749                 incpth="$incpth $*"
2750                 incpth="`$echo $incpth|$sed 's/^ //'`"
2751                 echo "Guessing incpth '$incpth'." >&4
2752                 for i in $*; do
2753                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2754                     if $test -d $j; then
2755                         libpth="$libpth $j"
2756                     fi
2757                 done   
2758                 libpth="`$echo $libpth|$sed 's/^ //'`"
2759                 echo "Guessing libpth '$libpth'." >&4
2760             fi
2761             $rm -f try.c
2762             ;;
2763         esac
2764         case "$targetarch" in
2765         '') echo "Targetarch not defined." >&4; croak=y ;;
2766         *)  echo "Using targetarch $targetarch." >&4 ;;
2767         esac
2768         case "$incpth" in
2769         '') echo "Incpth not defined." >&4; croak=y ;;
2770         *)  echo "Using incpth '$incpth'." >&4 ;;
2771         esac
2772         case "$libpth" in
2773         '') echo "Libpth not defined." >&4; croak=y ;;
2774         *)  echo "Using libpth '$libpth'." >&4 ;;
2775         esac
2776         case "$usrinc" in
2777         '') for i in $incpth; do
2778                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2779                     usrinc=$i
2780                     echo "Guessing usrinc $usrinc." >&4
2781                     break
2782                 fi
2783             done
2784             case "$usrinc" in
2785             '') echo "Usrinc not defined." >&4; croak=y ;;
2786             esac
2787             ;;
2788         *)  echo "Using usrinc $usrinc." >&4 ;;
2789         esac
2790         case "$targethost" in
2791         '') echo "Targethost not defined." >&4; croak=y ;;
2792         *)  echo "Using targethost $targethost." >&4
2793         esac
2794         locincpth=' '
2795         loclibpth=' '
2796         case "$croak" in
2797         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2798         esac
2799         case "$src" in
2800         /*) run=$src/Cross/run
2801             targetmkdir=$src/Cross/mkdir
2802             to=$src/Cross/to
2803             from=$src/Cross/from
2804             ;;
2805         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2806             run=$pwd/Cross/run
2807             targetmkdir=$pwd/Cross/mkdir
2808             to=$pwd/Cross/to
2809             from=$pwd/Cross/from
2810             ;;
2811         esac
2812         case "$targetrun" in
2813         '') targetrun=ssh ;;
2814         esac
2815         case "$targetto" in
2816         '') targetto=scp ;;
2817         esac
2818         case "$targetfrom" in
2819         '') targetfrom=scp ;;
2820         esac
2821         run=$run-$targetrun
2822         to=$to-$targetto
2823         from=$from-$targetfrom
2824         case "$targetdir" in
2825         '')  targetdir=/tmp
2826              echo "Guessing targetdir $targetdir." >&4
2827              ;;
2828         esac
2829         case "$targetuser" in
2830         '')  targetuser=root
2831              echo "Guessing targetuser $targetuser." >&4
2832              ;;
2833         esac
2834         case "$targetfrom" in
2835         scp)    q=-q ;;
2836         *)      q='' ;;
2837         esac
2838         case "$targetrun" in
2839         ssh|rsh)
2840             cat >$run <<EOF
2841 #!/bin/sh
2842 case "\$1" in
2843 -cwd)
2844   shift
2845   cwd=\$1
2846   shift
2847   ;;
2848 esac
2849 case "\$cwd" in
2850 '') cwd=$targetdir ;;
2851 esac
2852 exe=\$1
2853 shift
2854 if $test ! -f \$exe.xok; then
2855   $to \$exe
2856   $touch \$exe.xok
2857 fi
2858 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2859 EOF
2860             ;;
2861         *)  echo "Unknown targetrun '$targetrun'" >&4
2862             exit 1
2863             ;;
2864         esac
2865         case "$targetmkdir" in
2866         */Cross/mkdir)
2867             cat >$targetmkdir <<EOF
2868 #!/bin/sh
2869 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2870 EOF
2871             $chmod a+rx $targetmkdir
2872             ;;
2873         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2874             exit 1
2875             ;;
2876         esac
2877         case "$targetto" in
2878         scp|rcp)
2879             cat >$to <<EOF
2880 #!/bin/sh
2881 for f in \$@
2882 do
2883   case "\$f" in
2884   /*)
2885     $targetmkdir \`dirname \$f\`
2886     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2887     ;;
2888   *)
2889     $targetmkdir $targetdir/\`dirname \$f\`
2890     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2891     ;;
2892   esac
2893 done
2894 exit 0
2895 EOF
2896             ;;
2897         cp) cat >$to <<EOF
2898 #!/bin/sh
2899 for f in \$@
2900 do
2901   case "\$f" in
2902   /*)
2903     $mkdir -p $targetdir/\`dirname \$f\`
2904     $cp \$f $targetdir/\$f || exit 1
2905     ;;
2906   *)
2907     $targetmkdir $targetdir/\`dirname \$f\`
2908     $cp \$f $targetdir/\$f || exit 1
2909     ;;
2910   esac
2911 done
2912 exit 0
2913 EOF
2914             ;;
2915         *)  echo "Unknown targetto '$targetto'" >&4
2916             exit 1
2917             ;;
2918         esac
2919         case "$targetfrom" in
2920         scp|rcp)
2921           cat >$from <<EOF
2922 #!/bin/sh
2923 for f in \$@
2924 do
2925   $rm -f \$f
2926   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2927 done
2928 exit 0
2929 EOF
2930             ;;
2931         cp) cat >$from <<EOF
2932 #!/bin/sh
2933 for f in \$@
2934 do
2935   $rm -f \$f
2936   cp $targetdir/\$f . || exit 1
2937 done
2938 exit 0
2939 EOF
2940             ;;
2941         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2942             exit 1
2943             ;;
2944         esac
2945         if $test ! -f $run; then
2946             echo "Target 'run' script '$run' not found." >&4
2947         else
2948             $chmod a+rx $run
2949         fi
2950         if $test ! -f $to; then
2951             echo "Target 'to' script '$to' not found." >&4
2952         else
2953             $chmod a+rx $to
2954         fi
2955         if $test ! -f $from; then
2956             echo "Target 'from' script '$from' not found." >&4
2957         else
2958             $chmod a+rx $from
2959         fi
2960         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2961             exit 1
2962         fi
2963         cat >&4 <<EOF
2964 Using '$run' for remote execution,
2965 and '$from' and '$to'
2966 for remote file transfer.
2967 EOF
2968         ;;
2969 *)      run=''
2970         to=:
2971         from=:
2972         usecrosscompile='undef'
2973         targetarch=''
2974         ;;
2975 esac
2976
2977 : see whether [:lower:] and [:upper:] are supported character classes
2978 echo " "
2979 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2980 ABYZ)
2981         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2982         up='[:upper:]'
2983         low='[:lower:]'
2984         ;;
2985 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2986         # (0xd9 and 0xe2), therefore that is a nice testing point.
2987         if test "X$up" = X -o "X$low" = X; then
2988             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2989             rs) up='[A-Z]'
2990                 low='[a-z]'
2991                 ;;
2992             esac
2993         fi
2994         if test "X$up" = X -o "X$low" = X; then
2995             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2996             rs) up='A-Z'
2997                 low='a-z'
2998                 ;;
2999             esac
3000         fi
3001         if test "X$up" = X -o "X$low" = X; then
3002             case "`echo RS | od -x 2>/dev/null`" in
3003             *D9E2*|*d9e2*)
3004                 echo "Hey, this might be EBCDIC." >&4
3005                 if test "X$up" = X -o "X$low" = X; then
3006                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3007                     rs) up='[A-IJ-RS-Z]'
3008                         low='[a-ij-rs-z]'
3009                         ;;
3010                     esac
3011                 fi
3012                 if test "X$up" = X -o "X$low" = X; then
3013                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3014                     rs) up='A-IJ-RS-Z'
3015                         low='a-ij-rs-z'
3016                         ;;
3017                     esac
3018                 fi
3019                 ;;
3020             esac
3021         fi
3022 esac
3023 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3024 rs)
3025     echo "Using $up and $low to convert case." >&4
3026     ;;
3027 *)
3028     echo "I don't know how to translate letters from upper to lower case." >&4
3029     echo "Your tr is not acting any way I know of." >&4
3030     exit 1
3031     ;;
3032 esac
3033 : set up the translation script tr, must be called with ./tr of course
3034 cat >tr <<EOSC
3035 $startsh
3036 case "\$1\$2" in
3037 '[A-Z][a-z]') exec $tr '$up' '$low';;
3038 '[a-z][A-Z]') exec $tr '$low' '$up';;
3039 esac
3040 exec $tr "\$@"
3041 EOSC
3042 chmod +x tr
3043 $eunicefix tr
3044
3045 : Try to determine whether config.sh was made on this system
3046 case "$config_sh" in
3047 '')
3048 myuname=`$uname -a 2>/dev/null`
3049 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3050 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3051 # because the A-Z/a-z are not consecutive.
3052 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3053         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3054 newmyuname="$myuname"
3055 dflt=n
3056 case "$knowitall" in
3057 '')
3058         if test -f ../config.sh; then
3059                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3060                         eval "`grep myuname= ../config.sh`"
3061                 fi
3062                 if test "X$myuname" = "X$newmyuname"; then
3063                         dflt=y
3064                 fi
3065         fi
3066         ;;
3067 *) dflt=y;;
3068 esac
3069
3070 : Get old answers from old config file if Configure was run on the
3071 : same system, otherwise use the hints.
3072 hint=default
3073 cd ..
3074 if test -f config.sh; then
3075         echo " "
3076         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3077         . UU/myread
3078         case "$ans" in
3079         n*|N*) echo "OK, I'll ignore it."
3080                 mv config.sh config.sh.old
3081                 myuname="$newmyuname"
3082                 ;;
3083         *)  echo "Fetching default answers from your old config.sh file..." >&4
3084                 tmp_n="$n"
3085                 tmp_c="$c"
3086                 tmp_sh="$sh"
3087                 . ./config.sh
3088                 cp config.sh UU
3089                 n="$tmp_n"
3090                 c="$tmp_c"
3091                 : Older versions did not always set $sh.  Catch re-use of such
3092                 : an old config.sh.
3093                 case "$sh" in
3094                 '') sh="$tmp_sh" ;;
3095                 esac
3096                 hint=previous
3097                 ;;
3098         esac
3099 fi
3100 . ./UU/checkcc
3101 if test ! -f config.sh; then
3102         $cat <<EOM
3103
3104 First time through, eh?  I have some defaults handy for some systems
3105 that need some extra help getting the Configure answers right:
3106
3107 EOM
3108         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3109         dflt=''
3110         : Half the following guesses are probably wrong... If you have better
3111         : tests or hints, please send them to perlbug@perl.org
3112         : The metaconfig authors would also appreciate a copy...
3113         $test -f /irix && osname=irix
3114         $test -f /xenix && osname=sco_xenix
3115         $test -f /dynix && osname=dynix
3116         $test -f /dnix && osname=dnix
3117         $test -f /lynx.os && osname=lynxos
3118         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3119         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3120         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3121         $test -f /bin/mips && /bin/mips && osname=mips
3122         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3123                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3124         $test -d /usr/apollo/bin && osname=apollo
3125         $test -f /etc/saf/_sactab && osname=svr4
3126         $test -d /usr/include/minix && osname=minix
3127         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3128         if $test -d /MachTen -o -d /MachTen_Folder; then
3129                 osname=machten
3130                 if $test -x /sbin/version; then
3131                         osvers=`/sbin/version | $awk '{print $2}' |
3132                         $sed -e 's/[A-Za-z]$//'`
3133                 elif $test -x /usr/etc/version; then
3134                         osvers=`/usr/etc/version | $awk '{print $2}' |
3135                         $sed -e 's/[A-Za-z]$//'`
3136                 else
3137                         osvers="$2.$3"
3138                 fi
3139         fi
3140
3141         $test -f /sys/posix.dll &&
3142                 $test -f /usr/bin/what &&
3143                 set X `/usr/bin/what /sys/posix.dll` &&
3144                 $test "$3" = UWIN &&
3145                 osname=uwin &&
3146                 osvers="$5"
3147
3148         if $test -f $uname; then
3149                 set X $myuname
3150                 shift
3151
3152                 case "$5" in
3153                 fps*) osname=fps ;;
3154                 mips*)
3155                         case "$4" in
3156                         umips) osname=umips ;;
3157                         *) osname=mips ;;
3158                         esac;;
3159                 [23]100) osname=mips ;;
3160                 next*) osname=next ;;
3161                 i386*)
3162                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3163                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3164                                 osname='sco'
3165                                 osvers=$tmp
3166                         elif $test -f /etc/kconfig; then
3167                                 osname=isc
3168                                 if test "$lns" = "$ln -s"; then
3169                                         osvers=4
3170                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3171                                         osvers=3
3172                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3173                                         osvers=2
3174                                 fi
3175                         fi
3176                         tmp=''
3177                         ;;
3178                 pc*)
3179                         if test -n "$DJGPP"; then
3180                                 osname=dos
3181                                 osvers=djgpp
3182                         fi
3183                         ;;
3184                 esac
3185
3186                 case "$1" in
3187                 aix) osname=aix
3188                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3189                         case "$tmp" in
3190                         # oslevel can fail with:
3191                         # oslevel: Unable to acquire lock.
3192                         *not\ found) osvers="$4"."$3" ;;
3193                         '<3240'|'<>3240') osvers=3.2.0 ;;
3194                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3195                         '=3250'|'>3250') osvers=3.2.5 ;;
3196                         *) osvers=$tmp;;
3197                         esac
3198                         ;;
3199                 bsd386) osname=bsd386
3200                         osvers=`$uname -r`
3201                         ;;
3202                 cygwin*) osname=cygwin
3203                         osvers="$3"
3204                         ;;
3205                 *dc.osx) osname=dcosx
3206                         osvers="$3"
3207                         ;;
3208                 dnix) osname=dnix
3209                         osvers="$3"
3210                         ;;
3211                 domainos) osname=apollo
3212                         osvers="$3"
3213                         ;;
3214                 dgux)   osname=dgux
3215                         osvers="$3"
3216                         ;;
3217                 dragonfly) osname=dragonfly
3218                         osvers="$3"
3219                         ;;
3220                 dynixptx*) osname=dynixptx
3221                         osvers=`echo "$4"|sed 's/^v//'`
3222                         ;;
3223                 freebsd) osname=freebsd
3224                         osvers="$3" ;;
3225                 genix)  osname=genix ;;
3226                 gnu)    osname=gnu
3227                         osvers="$3" ;;
3228                 hp*)    osname=hpux
3229                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3230                         ;;
3231                 irix*)  osname=irix
3232                         case "$3" in
3233                         4*) osvers=4 ;;
3234                         5*) osvers=5 ;;
3235                         *)      osvers="$3" ;;
3236                         esac
3237                         ;;
3238                 linux)  osname=linux
3239                         case "$3" in
3240                         *)      osvers="$3" ;;
3241                         esac
3242                         ;;
3243                 MiNT)   osname=mint
3244                         ;;
3245                 netbsd*) osname=netbsd
3246                         osvers="$3"
3247                         ;;
3248                 news-os) osvers="$3"
3249                         case "$3" in
3250                         4*) osname=newsos4 ;;
3251                         *) osname=newsos ;;
3252                         esac
3253                         ;;
3254                 next*) osname=next ;;
3255                 nonstop-ux) osname=nonstopux ;;
3256                 openbsd) osname=openbsd
3257                         osvers="$3"
3258                         ;;
3259                 os2)    osname=os2
3260                         osvers="$4"
3261                         ;;
3262                 POSIX-BC | posix-bc ) osname=posix-bc
3263                         osvers="$3"
3264                         ;;
3265                 powerux | power_ux | powermax_os | powermaxos | \
3266                 powerunix | power_unix) osname=powerux
3267                         osvers="$3"
3268                         ;;
3269                 qnx) osname=qnx
3270                         osvers="$4"
3271                         ;;
3272                 solaris) osname=solaris
3273                         case "$3" in
3274                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3275                         *)      osvers="$3" ;;
3276                         esac
3277                         ;;
3278                 sunos) osname=sunos
3279                         case "$3" in
3280                         5*) osname=solaris
3281                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3282                         *)      osvers="$3" ;;
3283                         esac
3284                         ;;
3285                 titanos) osname=titanos
3286                         case "$3" in
3287                         1*) osvers=1 ;;
3288                         2*) osvers=2 ;;
3289                         3*) osvers=3 ;;
3290                         4*) osvers=4 ;;
3291                         *)      osvers="$3" ;;
3292                         esac
3293                         ;;
3294                 ultrix) osname=ultrix
3295                         osvers="$3"
3296                         ;;
3297                 osf1|mls+)      case "$5" in
3298                                 alpha)
3299                                         osname=dec_osf
3300                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3301                                         case "$osvers" in
3302                                         [1-9].[0-9]*) ;;
3303                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3304                                         esac
3305                                         ;;
3306                         hp*)    osname=hp_osf1  ;;
3307                         mips)   osname=mips_osf1 ;;
3308                         esac
3309                         ;;
3310                 # UnixWare 7.1.2 is known as Open UNIX 8
3311                 openunix|unixware) osname=svr5
3312                         osvers="$4"
3313                         ;;
3314                 uts)    osname=uts
3315                         osvers="$3"
3316                         ;;
3317                 vos) osvers="$3"
3318                         ;;
3319                 $2) case "$osname" in
3320                         *isc*) ;;
3321                         *freebsd*) ;;
3322                         svr*)
3323                                 : svr4.x or possibly later
3324                                 case "svr$3" in
3325                                 ${osname}*)
3326                                         osname=svr$3
3327                                         osvers=$4
3328                                         ;;
3329                                 esac
3330                                 case "$osname" in
3331                                 svr4.0)
3332                                         : Check for ESIX
3333                                         if test -f /stand/boot ; then
3334                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3335                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3336                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3337                                                         if test -n "$isesix"; then
3338                                                                 osname=esix4
3339                                                         fi
3340                                                 fi
3341                                         fi
3342                                         ;;
3343                                 esac
3344                                 ;;
3345                         *)      if test -f /etc/systemid; then
3346                                         osname=sco
3347                                         set `echo $3 | $sed 's/\./ /g'` $4
3348                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3349                                                 osvers=$1.$2.$3
3350                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3351                                                 osvers=$1.$2
3352                                         elif $test -f $src/hints/sco_$1.sh; then
3353                                                 osvers=$1
3354                                         fi
3355                                 else
3356                                         case "$osname" in
3357                                         '') : Still unknown.  Probably a generic Sys V.
3358                                                 osname="sysv"
3359                                                 osvers="$3"
3360                                                 ;;
3361                                         esac
3362                                 fi
3363                                 ;;
3364                         esac
3365                         ;;
3366                 *)      case "$osname" in
3367                         '') : Still unknown.  Probably a generic BSD.
3368                                 osname="$1"
3369                                 osvers="$3"
3370                                 ;;
3371                         esac
3372                         ;;
3373                 esac
3374         else
3375                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3376                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3377                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3378                                 osname=news_os
3379                         fi
3380                         $rm -f UU/kernel.what
3381                 elif test -d c:/. -o -n "$is_os2" ; then
3382                         set X $myuname
3383                         osname=os2
3384                         osvers="$5"
3385                 fi
3386         fi
3387
3388         case "$targetarch" in
3389         '') ;;
3390         *)  hostarch=$osname
3391             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3392             osvers=''
3393             ;;
3394         esac
3395
3396         : Now look for a hint file osname_osvers, unless one has been
3397         : specified already.
3398         case "$hintfile" in
3399         ''|' ')
3400                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3401                 : Also try without trailing minor version numbers.
3402                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3403                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3404                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3405                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3406                 case "$file" in
3407                 '') dflt=none ;;
3408                 *)  case "$osvers" in
3409                         '') dflt=$file
3410                                 ;;
3411                         *)  if $test -f $src/hints/$file.sh ; then
3412                                         dflt=$file
3413                                 elif $test -f $src/hints/$xfile.sh ; then
3414                                         dflt=$xfile
3415                                 elif $test -f $src/hints/$xxfile.sh ; then
3416                                         dflt=$xxfile
3417                                 elif $test -f $src/hints/$xxxfile.sh ; then
3418                                         dflt=$xxxfile
3419                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3420                                         dflt=$xxxxfile
3421                                 elif $test -f "$src/hints/${osname}.sh" ; then
3422                                         dflt="${osname}"
3423                                 else
3424                                         dflt=none
3425                                 fi
3426                                 ;;
3427                         esac
3428                         ;;
3429                 esac
3430                 if $test -f Policy.sh ; then
3431                         case "$dflt" in
3432                         *Policy*) ;;
3433                         none) dflt="Policy" ;;
3434                         *) dflt="Policy $dflt" ;;
3435                         esac
3436                 fi
3437                 ;;
3438         *)
3439                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3440                 ;;
3441         esac
3442
3443         if $test -f Policy.sh ; then
3444                 $cat <<EOM
3445
3446 There's also a Policy hint file available, which should make the
3447 site-specific (policy) questions easier to answer.
3448 EOM
3449
3450         fi
3451
3452         $cat <<EOM
3453
3454 You may give one or more space-separated answers, or "none" if appropriate.
3455 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3456 previous run of Configure, you may specify it as well as or instead of
3457 OS-specific hints.  If hints are provided for your OS, you should use them:
3458 although Perl can probably be built without hints on many platforms, using
3459 hints often improve performance and may enable features that Configure can't
3460 set up on its own. If there are no hints that match your OS, specify "none";
3461 DO NOT give a wrong version or a wrong OS.
3462
3463 EOM
3464
3465         rp="Which of these apply, if any?"
3466         . UU/myread
3467         tans=$ans
3468         for file in $tans; do
3469                 if $test X$file = XPolicy -a -f Policy.sh; then
3470                         . Policy.sh
3471                         $cat Policy.sh >> UU/config.sh
3472                 elif $test -f $src/hints/$file.sh; then
3473                         . $src/hints/$file.sh
3474                         $cat $src/hints/$file.sh >> UU/config.sh
3475                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3476                         : nothing
3477                 else
3478                         : Give one chance to correct a possible typo.
3479                         echo "$file.sh does not exist"
3480                         dflt=$file
3481                         rp="hint to use instead?"
3482                         . UU/myread
3483                         for file in $ans; do
3484                                 if $test -f "$src/hints/$file.sh"; then
3485                                         . $src/hints/$file.sh
3486                                         $cat $src/hints/$file.sh >> UU/config.sh
3487                                 elif $test X$ans = X -o X$ans = Xnone ; then
3488                                         : nothing
3489                                 else
3490                                         echo "$file.sh does not exist -- ignored."
3491                                 fi
3492                         done
3493                 fi
3494         done
3495
3496         hint=recommended
3497         : Remember our hint file for later.
3498         if $test -f "$src/hints/$file.sh" ; then
3499                 hintfile="$file"
3500         else
3501                 hintfile=''
3502         fi
3503 fi
3504 cd UU
3505 ;;
3506 *)
3507         echo " "
3508         echo "Fetching default answers from $config_sh..." >&4
3509         tmp_n="$n"
3510         tmp_c="$c"
3511         cd ..
3512         cp $config_sh config.sh 2>/dev/null
3513         chmod +w config.sh
3514         . ./config.sh
3515         cd UU
3516         cp ../config.sh .
3517         n="$tmp_n"
3518         c="$tmp_c"
3519         hint=previous
3520         ;;
3521 esac
3522 test "$override" && . ./optdef.sh
3523
3524 : Restore computed paths
3525 for file in $loclist $trylist; do
3526         eval $file="\$_$file"
3527 done
3528
3529 cat << EOM
3530
3531 Configure uses the operating system name and version to set some defaults.
3532 The default value is probably right if the name rings a bell. Otherwise,
3533 since spelling matters for me, either accept the default or answer "none"
3534 to leave it blank.
3535
3536 EOM
3537 case "$osname" in
3538         ''|' ')
3539                 case "$hintfile" in
3540                 ''|' '|none) dflt=none ;;
3541                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3542                 esac
3543                 ;;
3544         *) dflt="$osname" ;;
3545 esac
3546 rp="Operating system name?"
3547 . ./myread
3548 case "$ans" in
3549 none)  osname='' ;;
3550 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3551 esac
3552 echo " "
3553 case "$osvers" in
3554         ''|' ')
3555                 case "$hintfile" in
3556                 ''|' '|none) dflt=none ;;
3557                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3558                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3559                         case "$dflt" in
3560                         ''|' ') dflt=none ;;
3561                         esac
3562                         ;;
3563                 esac
3564                 ;;
3565         *) dflt="$osvers" ;;
3566 esac
3567 rp="Operating system version?"
3568 . ./myread
3569 case "$ans" in
3570 none)  osvers='' ;;
3571 *) osvers="$ans" ;;
3572 esac
3573
3574
3575 . ./posthint.sh
3576
3577 : who configured the system
3578 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3579 case "$cf_by" in
3580 "")
3581         cf_by=`(logname) 2>/dev/null`
3582         case "$cf_by" in
3583         "")
3584                 cf_by=`(whoami) 2>/dev/null`
3585                 case "$cf_by" in
3586                 "") cf_by=unknown ;;
3587                 esac ;;
3588         esac ;;
3589 esac
3590
3591 : decide how portable to be.  Allow command line overrides.
3592 case "$d_portable" in
3593 "$undef") ;;
3594 *)      d_portable="$define" ;;
3595 esac
3596
3597 : set up shell script to do ~ expansion
3598 cat >filexp <<EOSS
3599 $startsh
3600 : expand filename
3601 case "\$1" in
3602  \~/*|\~)
3603         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3604         ;;
3605  \~*)
3606         if $test -f /bin/csh; then
3607                 /bin/csh -f -c "glob \$1"
3608                 failed=\$?
3609                 echo ""
3610                 exit \$failed
3611         else
3612                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3613                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3614                 if $test ! -d "\$dir"; then
3615                         me=\`basename \$0\`
3616                         echo "\$me: can't locate home directory for: \$name" >&2
3617                         exit 1
3618                 fi
3619                 case "\$1" in
3620                 */*)
3621                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3622                         ;;
3623                 *)
3624                         echo \$dir
3625                         ;;
3626                 esac
3627         fi
3628         ;;
3629 *)
3630         echo \$1
3631         ;;
3632 esac
3633 EOSS
3634 chmod +x filexp
3635 $eunicefix filexp
3636
3637 : now set up to get a file name
3638 cat <<EOS >getfile
3639 $startsh
3640 EOS
3641 cat <<'EOSC' >>getfile
3642 tilde=''
3643 fullpath=''
3644 already=''
3645 skip=''
3646 none_ok=''
3647 exp_file=''
3648 nopath_ok=''
3649 orig_rp="$rp"
3650 orig_dflt="$dflt"
3651 case "$gfpth" in
3652 '') gfpth='.' ;;
3653 esac
3654
3655 case "$fn" in
3656 *\(*)
3657         : getfile will accept an answer from the comma-separated list
3658         : enclosed in parentheses even if it does not meet other criteria.
3659         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3660         fn=`echo $fn | sed 's/(.*)//'`
3661         ;;
3662 esac
3663
3664 case "$fn" in
3665 *:*)
3666         loc_file=`expr $fn : '.*:\(.*\)'`
3667         fn=`expr $fn : '\(.*\):.*'`
3668         ;;
3669 esac
3670
3671 case "$fn" in
3672 *~*) tilde=true;;
3673 esac
3674 case "$fn" in
3675 */*) fullpath=true;;
3676 esac
3677 case "$fn" in
3678 *+*) skip=true;;
3679 esac
3680 case "$fn" in
3681 *n*) none_ok=true;;
3682 esac
3683 case "$fn" in
3684 *e*) exp_file=true;;
3685 esac
3686 case "$fn" in
3687 *p*) nopath_ok=true;;
3688 esac
3689
3690 case "$fn" in
3691 *f*) type='File';;
3692 *d*) type='Directory';;
3693 *l*) type='Locate';;
3694 esac
3695
3696 what="$type"
3697 case "$what" in
3698 Locate) what='File';;
3699 esac
3700
3701 case "$exp_file" in
3702 '')
3703         case "$d_portable" in
3704         "$define") ;;
3705         *) exp_file=true;;
3706         esac
3707         ;;
3708 esac
3709
3710 cd ..
3711 while test "$type"; do
3712         redo=''
3713         rp="$orig_rp"
3714         dflt="$orig_dflt"
3715         case "$tilde" in
3716         true) rp="$rp (~name ok)";;
3717         esac
3718         . UU/myread
3719         if test -f UU/getfile.ok && \
3720                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3721         then
3722                 value="$ans"
3723                 ansexp="$ans"
3724                 break
3725         fi
3726         case "$ans" in
3727         none)
3728                 value=''
3729                 ansexp=''
3730                 case "$none_ok" in
3731                 true) type='';;
3732                 esac
3733                 ;;
3734         *)
3735                 case "$tilde" in
3736                 '') value="$ans"
3737                         ansexp="$ans";;
3738                 *)
3739                         value=`UU/filexp $ans`
3740                         case $? in
3741                         0)
3742                                 if test "$ans" != "$value"; then
3743                                         echo "(That expands to $value on this system.)"
3744                                 fi
3745                                 ;;
3746                         *) value="$ans";;
3747                         esac
3748                         ansexp="$value"
3749                         case "$exp_file" in
3750                         '') value="$ans";;
3751                         esac
3752                         ;;
3753                 esac
3754                 case "$fullpath" in
3755                 true)
3756                         case "$ansexp" in
3757                         /*) value="$ansexp" ;;
3758                         [a-zA-Z]:/*) value="$ansexp" ;;
3759                         *)
3760                                 redo=true
3761                                 case "$already" in
3762                                 true)
3763                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3764                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3765                                         ;;
3766                                 *)
3767                                 echo "Please give a full path name, starting with slash." >&4
3768                                         case "$tilde" in
3769                                         true)
3770                                 echo "Note that using ~name is ok provided it expands well." >&4
3771                                                 already=true
3772                                                 ;;
3773                                         esac
3774                                 esac
3775                                 ;;
3776                         esac
3777                         ;;
3778                 esac
3779                 case "$redo" in
3780                 '')
3781                         case "$type" in
3782                         File)
3783                                 for fp in $gfpth; do
3784                                         if test "X$fp" = X.; then
3785                                             pf="$ansexp"
3786                                         else    
3787                                             pf="$fp/$ansexp"
3788                                         fi
3789                                         if test -f "$pf"; then
3790                                                 type=''
3791                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3792                                         then
3793                                                 echo "($value is not a plain file, but that's ok.)"
3794                                                 type=''
3795                                         fi
3796                                         if test X"$type" = X; then
3797                                             value="$pf"
3798                                             break
3799                                         fi
3800                                 done
3801                                 ;;
3802                         Directory)
3803                                 for fp in $gfpth; do
3804                                         if test "X$fp" = X.; then
3805                                             dir="$ans"
3806                                             direxp="$ansexp"
3807                                         else    
3808                                             dir="$fp/$ansexp"
3809                                             direxp="$fp/$ansexp"
3810                                         fi
3811                                         if test -d "$direxp"; then
3812                                                 type=''
3813                                                 value="$dir"
3814                                                 break
3815                                         fi
3816                                 done
3817                                 ;;
3818                         Locate)
3819                                 if test -d "$ansexp"; then
3820                                         echo "(Looking for $loc_file in directory $value.)"
3821                                         value="$value/$loc_file"
3822                                         ansexp="$ansexp/$loc_file"
3823                                 fi
3824                                 if test -f "$ansexp"; then
3825                                         type=''
3826                                 fi
3827                                 case "$nopath_ok" in
3828                                 true)   case "$value" in
3829                                         */*) ;;
3830                                         *)      echo "Assuming $value will be in people's path."
3831                                                 type=''
3832                                                 ;;
3833                                         esac
3834                                         ;;
3835                                 esac
3836                                 ;;
3837                         esac
3838
3839                         case "$skip" in
3840                         true) type='';
3841                         esac
3842
3843                         case "$type" in
3844                         '') ;;
3845                         *)
3846                                 if test "$fastread" = yes; then
3847                                         dflt=y
3848                                 else
3849                                         dflt=n
3850                                 fi
3851                                 rp="$what $value doesn't exist.  Use that name anyway?"
3852                                 . UU/myread
3853                                 dflt=''
3854                                 case "$ans" in
3855                                 y*) type='';;
3856                                 *) echo " ";;
3857                                 esac
3858                                 ;;
3859                         esac
3860                         ;;
3861                 esac
3862                 ;;
3863         esac
3864 done
3865 cd UU
3866 ans="$value"
3867 rp="$orig_rp"
3868 dflt="$orig_dflt"
3869 rm -f getfile.ok
3870 test "X$gfpthkeep" != Xy && gfpth=""
3871 EOSC
3872
3873 : determine root of directory hierarchy where package will be installed.
3874 case "$prefix" in
3875 '')
3876         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3877         ;;
3878 *?/)
3879         dflt=`echo "$prefix" | sed 's/.$//'`
3880         ;;
3881 *)
3882         dflt="$prefix"
3883         ;;
3884 esac
3885 $cat <<EOM
3886
3887 By default, $package will be installed in $dflt/bin, manual pages
3888 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3889 installation directories. Typically this is something like /usr/local.
3890 If you wish to have binaries under /usr/bin but other parts of the
3891 installation under /usr/local, that's ok: you will be prompted
3892 separately for each of the installation directories, the prefix being
3893 only used to set the defaults.
3894
3895 EOM
3896 fn=d~
3897 rp='Installation prefix to use?'
3898 . ./getfile
3899 oldprefix=''
3900 case "$prefix" in
3901 '') ;;
3902 *)
3903         case "$ans" in
3904         "$prefix") ;;
3905         *) oldprefix="$prefix";;
3906         esac
3907         ;;
3908 esac
3909 prefix="$ans"
3910 prefixexp="$ansexp"
3911
3912 : allow them to override the AFS root
3913 case "$afsroot" in
3914 '')     afsroot=/afs ;;
3915 *)      afsroot=$afsroot ;;
3916 esac
3917
3918 : is AFS running?
3919 echo " "
3920 case "$afs" in
3921 $define|true)   afs=true ;;
3922 $undef|false)   afs=false ;;
3923 *)      if $test -d $afsroot; then
3924                 afs=true
3925         else
3926                 afs=false
3927         fi
3928         ;;
3929 esac
3930 if $afs; then
3931         echo "AFS may be running... I'll be extra cautious then..." >&4
3932 else
3933         echo "AFS does not seem to be running..." >&4
3934 fi
3935
3936 : determine installation prefix for where package is to be installed.
3937 if $afs; then 
3938 $cat <<EOM
3939
3940 Since you are running AFS, I need to distinguish the directory in which
3941 files will reside from the directory in which they are installed (and from
3942 which they are presumably copied to the former directory by occult means).
3943
3944 EOM
3945         case "$installprefix" in
3946         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3947         *) dflt="$installprefix";;
3948         esac
3949 else
3950 $cat <<EOM
3951
3952 In some special cases, particularly when building $package for distribution,
3953 it is convenient to distinguish the directory in which files should be
3954 installed from the directory ($prefix) in which they will
3955 eventually reside.  For most users, these two directories are the same.
3956
3957 EOM
3958         case "$installprefix" in
3959         '') dflt=$prefix ;;
3960         *) dflt=$installprefix;;
3961         esac
3962 fi
3963 fn=d~
3964 rp='What installation prefix should I use for installing files?'
3965 . ./getfile
3966 installprefix="$ans"
3967 installprefixexp="$ansexp"
3968
3969 : Perform the prefixexp/installprefixexp correction if necessary
3970 cat <<EOS >installprefix
3971 $startsh
3972 EOS
3973 cat <<'EOSC' >>installprefix
3974 : Change installation prefix, if necessary.
3975 if $test X"$prefix" != X"$installprefix"; then
3976     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3977 else
3978     eval "install${prefixvar}=\"\$${prefixvar}exp\""
3979 fi
3980 EOSC
3981 chmod +x installprefix
3982 $eunicefix installprefix
3983
3984 : Set variables such as privlib and privlibexp from the output of ./getfile
3985 : performing the prefixexp/installprefixexp correction if necessary.
3986 cat <<EOS >setprefixvar
3987 $startsh
3988 EOS
3989 cat <<'EOSC' >>setprefixvar
3990 eval "${prefixvar}=\"\$ans\""
3991 eval "${prefixvar}exp=\"\$ansexp\""
3992 . ./installprefix
3993 EOSC
3994 chmod +x setprefixvar
3995 $eunicefix setprefixvar
3996
3997 : set up the script used to warn in case of inconsistency
3998 cat <<EOS >whoa
3999 $startsh
4000 EOS
4001 cat <<'EOSC' >>whoa
4002 dflt=y
4003 case "$hint" in
4004     recommended)
4005         case "$hintfile" in
4006         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4007                 ;;
4008         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4009                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4010                 ;;
4011         esac
4012         ;;
4013     *)  echo " "
4014         echo "*** WHOA THERE!!! ***" >&4
4015         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4016         ;;
4017 esac
4018 rp="    Keep the $hint value?"
4019 . ./myread
4020 case "$ans" in
4021 y) td=$was; tu=$was;;
4022 esac
4023 EOSC
4024
4025 : function used to set '$1' to '$val'
4026 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4027 case "$val$was" in
4028 $define$undef) . ./whoa; eval "$var=\$td";;
4029 $undef$define) . ./whoa; eval "$var=\$tu";;
4030 *) eval "$var=$val";;
4031 esac'
4032
4033 : Check is we will use socks
4034 case "$usesocks" in
4035 $define|true|[yY]*)     dflt='y';;
4036 *) dflt='n';;
4037 esac
4038 cat <<EOM
4039
4040 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4041 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4042 to use the PerlIO abstraction layer, this will be implicitly selected.
4043
4044 If this doesn't make any sense to you, just accept the default '$dflt'.
4045 EOM
4046 rp='Build Perl for SOCKS?'
4047 . ./myread
4048 case "$ans" in
4049 y|Y)    val="$define" ;;
4050 *)      val="$undef" ;;
4051 esac
4052 set usesocks
4053 eval $setvar
4054
4055 case "$usesocks" in
4056 $define|true|[yY]*) useperlio="$define";;
4057 esac
4058
4059 : Check if we want perlio
4060 case "$useperlio" in
4061 $define|true|[yY]*|'')  dflt='y';;
4062 *) dflt='n';;
4063 esac
4064 cat <<EOM
4065
4066 Previous version of $package used the standard IO mechanisms as
4067 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4068 alternate IO mechanisms via the PerlIO abstraction layer, but the
4069 stdio mechanism is still available if needed.  The abstraction layer
4070 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4071 Using PerlIO with sfio may cause problems with some extension modules.
4072
4073 If this doesn't make any sense to you, just accept the default '$dflt'.
4074 EOM
4075 rp='Use the PerlIO abstraction layer?'
4076 . ./myread
4077 case "$ans" in
4078 y|Y)
4079         val="$define"
4080         ;;
4081 *)
4082         echo "Ok, doing things the stdio way."
4083         val="$undef"
4084         ;;
4085 esac
4086 set useperlio
4087 eval $setvar
4088
4089 case "$usesocks" in
4090 $define|true|[yY]*)
4091         case "$useperlio" in
4092         $define|true|[yY]*) ;;
4093         *)      cat >&4 <<EOM
4094
4095 You are using the SOCKS proxy protocol library which means that you
4096 should also use the PerlIO layer.  You may be headed for trouble.
4097
4098 EOM
4099                 ;;
4100         esac
4101         ;;
4102 esac
4103
4104 : get the patchlevel
4105 echo " "
4106 echo "Getting the current patchlevel..." >&4
4107 if $test -r $rsrc/patchlevel.h;then
4108         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4109         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4110         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4111         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4112         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4113         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4114         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4115 else
4116         revision=0
4117         patchlevel=0
4118         subversion=0
4119         api_revision=0
4120         api_version=0
4121         api_subversion=0
4122         perl_patchlevel=0
4123         $echo "(You do not have patchlevel.h.  Eek.)"
4124 fi
4125 if $test -r $rsrc/.patch ; then
4126         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4127                 perl_patchlevel=`cat $rsrc/.patch`
4128         fi
4129 fi
4130 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4131 version_patchlevel_string="version $patchlevel subversion $subversion"
4132 case "$perl_patchlevel" in
4133 0|'') ;;
4134 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
4135 esac
4136
4137 $echo "(You have $package $version_patchlevel_string.)"
4138
4139 case "$osname" in
4140 dos|vms)
4141         : XXX Should be a Configure test for double-dots in filenames.
4142         version=`echo $revision $patchlevel $subversion | \
4143                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4144         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4145                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4146         ;;
4147 *)
4148         version=`echo $revision $patchlevel $subversion | \
4149                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4150         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4151                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4152         ;;
4153 esac
4154 : Special case the 5.005_xx maintenance series, which used 5.005
4155 : without any subversion label as a subdirectory in $sitelib
4156 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4157         api_versionstring='5.005'
4158 fi
4159
4160 : Do we want threads support and if so, what type
4161 case "$usethreads" in
4162 $define|true|[yY]*)     dflt='y';;
4163 *)     # Catch case where user specified ithreads or 5005threads but
4164        # forgot -Dusethreads (A.D. 4/2002)
4165        case "$useithreads$use5005threads" in
4166        *$define*)
4167                 case "$useperlio" in
4168                 "$define")      dflt='y' ;;
4169                 *)              dflt='n' ;;
4170                 esac
4171                 ;;
4172        *)       dflt='n';;
4173        esac
4174        ;;
4175 esac
4176 cat <<EOM
4177
4178 Perl can be built to take advantage of threads on some systems.
4179 To do so, Configure can be run with -Dusethreads.
4180
4181 Note that Perl built with threading support runs slightly slower
4182 and uses more memory than plain Perl. The current implementation
4183 is believed to be stable, but it is fairly new, and so should be
4184 treated with caution.
4185
4186 If this doesn't make any sense to you, just accept the default '$dflt'.
4187 EOM
4188 rp='Build a threading Perl?'
4189 . ./myread
4190 case "$ans" in
4191 y|Y)    val="$define" ;;
4192 *)      val="$undef" ;;
4193 esac
4194 set usethreads
4195 eval $setvar
4196
4197 if $test $patchlevel -lt 9; then
4198     case "$usethreads" in
4199     $define)
4200         $cat <<EOM
4201
4202 Since release 5.6, Perl has had two different threading implementations,
4203 the newer interpreter-based version (ithreads) with one interpreter per
4204 thread, and the older 5.005 version (5005threads).
4205 The 5005threads version is effectively unmaintained and will probably be
4206 removed in Perl 5.10, so there should be no need to build a Perl using it
4207 unless needed for backwards compatibility with some existing 5.005threads
4208 code.
4209
4210 EOM
4211         : Default to ithreads unless overridden on command line or with
4212         : old config.sh
4213         dflt='y'
4214         case "$use5005threads" in
4215                 $define|true|[yY]*) dflt='n';;
4216         esac
4217         case "$useithreads" in
4218                 $undef|false|[nN]*) dflt='n';;
4219         esac
4220         rp='Use the newer interpreter-based ithreads?'
4221         . ./myread
4222         case "$ans" in
4223         y|Y)    val="$define" ;;
4224         *)      val="$undef" ;;
4225         esac
4226         set useithreads
4227         eval $setvar
4228         : Now set use5005threads to the opposite value.
4229         case "$useithreads" in
4230         $define) val="$undef" ;;
4231         *) val="$define" ;;
4232         esac
4233         set use5005threads
4234         eval $setvar
4235         ;;
4236     *)
4237         useithreads="$undef"
4238         use5005threads="$undef"
4239         ;;
4240     esac
4241
4242     case "$useithreads$use5005threads" in
4243     "$define$define")
4244         $cat >&4 <<EOM
4245
4246 You cannot have both the ithreads and the 5.005 threads enabled
4247 at the same time.  Disabling the 5.005 threads since they are
4248 much less stable than the ithreads.
4249
4250 EOM
4251         use5005threads="$undef"
4252         ;;
4253     esac
4254
4255 else
4256 : perl-5.9.x and later
4257
4258     if test X"$usethreads" = "X$define"; then
4259         case "$use5005threads" in
4260             $define|true|[yY]*)
4261                 $cat >&4 <<EOM
4262
4263 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4264
4265 EOM
4266             ;;
4267         esac
4268     fi
4269
4270     use5005threads="$undef"
4271     useithreads="$usethreads"
4272 fi
4273
4274 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4275         cat >&4 <<EOF
4276 ***
4277 *** To build with ithreads you must also use the PerlIO layer.
4278 *** Cannot continue, aborting.
4279 ***
4280 EOF
4281         exit 1
4282 fi
4283
4284 case "$d_oldpthreads" in
4285 '')     : Configure tests would be welcome here.  For now, assume undef.
4286         val="$undef" ;;
4287 *)      val="$d_oldpthreads" ;;
4288 esac
4289 set d_oldpthreads
4290 eval $setvar
4291
4292
4293 : Look for a hint-file generated 'call-back-unit'.  If the
4294 : user has specified that a threading perl is to be built,
4295 : we may need to set or change some other defaults.
4296 if $test -f usethreads.cbu; then
4297     echo "Your platform has some specific hints regarding threaded builds, using them..."
4298     . ./usethreads.cbu
4299 else
4300     case "$usethreads" in
4301         "$define"|true|[yY]*)
4302                 $cat <<EOM
4303 (Your platform does not have any specific hints for threaded builds.
4304  Assuming POSIX threads, then.)
4305 EOM
4306         ;;
4307     esac
4308 fi
4309
4310 : Check if multiplicity is required
4311 cat <<EOM
4312
4313 Perl can be built so that multiple Perl interpreters can coexist
4314 within the same Perl executable.
4315 EOM
4316
4317 case "$useithreads" in
4318 $define)
4319         cat <<EOM
4320 This multiple interpreter support is required for interpreter-based threads.
4321 EOM
4322         val="$define"
4323         ;;
4324 *)      case "$usemultiplicity" in
4325         $define|true|[yY]*)     dflt='y';;
4326         *) dflt='n';;
4327         esac
4328         echo " "
4329         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4330         rp='Build Perl for multiplicity?'
4331         . ./myread
4332         case "$ans" in
4333         y|Y)    val="$define" ;;
4334         *)      val="$undef" ;;
4335         esac
4336         ;;
4337 esac
4338 set usemultiplicity
4339 eval $setvar
4340
4341 : Check if morebits is requested
4342 case "$usemorebits" in
4343 "$define"|true|[yY]*)
4344         use64bitint="$define"
4345         uselongdouble="$define"
4346         usemorebits="$define"
4347         ;;
4348 *)      usemorebits="$undef"
4349         ;;
4350 esac
4351
4352 : Determine the C compiler to be used
4353 echo " "
4354 case "$cc" in
4355 '') dflt=cc;;
4356 *) dflt="$cc";;
4357 esac
4358 rp="Use which C compiler?"
4359 . ./myread
4360 cc="$ans"
4361
4362 : See whether they have no cc but they do have gcc
4363 . ./trygcc
4364 if $test -f cc.cbu; then
4365     . ./cc.cbu
4366 fi
4367 . ./checkcc
4368
4369 : make some quick guesses about what we are up against
4370 echo " "
4371 $echo $n "Hmm...  $c"
4372 echo exit 1 >bsd
4373 echo exit 1 >usg
4374 echo exit 1 >v7
4375 echo exit 1 >osf1
4376 echo exit 1 >eunice
4377 echo exit 1 >xenix
4378 echo exit 1 >venix
4379 echo exit 1 >os2
4380 d_bsd="$undef"
4381 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4382 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4383 then
4384         echo "Looks kind of like an OSF/1 system, but we'll see..."
4385         echo exit 0 >osf1
4386 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4387         xxx=`./loc addbib blurfl $pth`
4388         if $test -f $xxx; then
4389         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4390                 echo exit 0 >bsd
4391                 echo exit 0 >usg
4392         else
4393                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4394                         echo "Looks kind of like an extended USG system, but we'll see..."
4395                 else
4396                         echo "Looks kind of like a USG system, but we'll see..."
4397                 fi
4398                 echo exit 0 >usg
4399         fi
4400 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4401         echo "Looks kind of like a BSD system, but we'll see..."
4402         d_bsd="$define"
4403         echo exit 0 >bsd
4404 else
4405         echo "Looks kind of like a Version 7 system, but we'll see..."
4406         echo exit 0 >v7
4407 fi
4408 case "$eunicefix" in
4409 *unixtovms*)
4410         $cat <<'EOI'
4411 There is, however, a strange, musty smell in the air that reminds me of
4412 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4413 EOI
4414         echo exit 0 >eunice
4415         d_eunice="$define"
4416 : it so happens the Eunice I know will not run shell scripts in Unix format
4417         ;;
4418 *)
4419         echo " "
4420         echo "Congratulations.  You aren't running Eunice."
4421         d_eunice="$undef"
4422         ;;
4423 esac
4424 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4425 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4426 : semicolon as a patch separator
4427 case "$p_" in
4428 :) ;;
4429 *)
4430         $cat <<'EOI'
4431 I have the feeling something is not exactly right, however...don't tell me...
4432 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4433 (Or you may be running DOS with DJGPP.)
4434 EOI
4435         echo exit 0 >os2
4436         ;;
4437 esac
4438 if test -f /xenix; then
4439         echo "Actually, this looks more like a XENIX system..."
4440         echo exit 0 >xenix
4441         d_xenix="$define"
4442 else
4443         echo " "
4444         echo "It's not Xenix..."
4445         d_xenix="$undef"
4446 fi
4447 chmod +x xenix
4448 $eunicefix xenix
4449 if test -f /venix; then
4450         echo "Actually, this looks more like a VENIX system..."
4451         echo exit 0 >venix
4452 else
4453         echo " "
4454         if ./xenix; then
4455                 : null
4456         else
4457                 echo "Nor is it Venix..."
4458         fi
4459 fi
4460 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4461 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4462 $rm -f foo
4463
4464 : Check if we are using GNU gcc and what its version is
4465 echo " "
4466 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4467 $cat >try.c <<EOM
4468 #include <stdio.h>
4469 int main() {
4470 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4471 #ifdef __VERSION__
4472         printf("%s\n", __VERSION__);
4473 #else
4474         printf("%s\n", "1");
4475 #endif
4476 #endif
4477         return(0);
4478 }
4479 EOM
4480 if $cc -o try $ccflags $ldflags try.c; then
4481         gccversion=`$run ./try`
4482         case "$gccversion" in
4483         '') echo "You are not using GNU cc." ;;
4484         *)  echo "You are using GNU cc $gccversion."
4485             ccname=gcc
4486             ;;
4487         esac
4488 else
4489         echo " "
4490         echo "*** WHOA THERE!!! ***" >&4
4491         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4492         case "$knowitall" in
4493         '')
4494         echo "    You'd better start hunting for one and let me know about it." >&4
4495                 exit 1
4496                 ;;
4497         esac
4498 fi
4499 $rm -f try try.*
4500 case "$gccversion" in
4501 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4502 esac
4503 case "$gccversion" in
4504 '') gccosandvers='' ;;
4505 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4506    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4507    gccshortvers=''
4508    case "$gccosandvers" in
4509    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4510    $osname$osvers) ;; # looking good
4511    $osname*) cat <<EOM >&4
4512
4513 *** WHOA THERE!!! ***
4514
4515     Your gcc has not been compiled for the exact release of
4516     your operating system ($gccosandvers versus $osname$osvers).
4517
4518     In general it is a good idea to keep gcc synchronized with
4519     the operating system because otherwise serious problems
4520     may ensue when trying to compile software, like Perl.
4521
4522     I'm trying to be optimistic here, though, and will continue.
4523     If later during the configuration and build icky compilation
4524     problems appear (headerfile conflicts being the most common
4525     manifestation), I suggest reinstalling the gcc to match
4526     your operating system release.
4527
4528 EOM
4529       ;;
4530    *) gccosandvers='' ;; # failed to parse, better be silent
4531    esac
4532    ;;
4533 esac
4534 case "$ccname" in
4535 '') ccname="$cc" ;;
4536 esac
4537
4538 # gcc 3.* complain about adding -Idirectories that they already know about,
4539 # so we will take those off from locincpth.
4540 case "$gccversion" in
4541 3*)
4542     echo "main(){}">try.c
4543     for incdir in $locincpth; do
4544        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4545              grep '^c[cp]p*[01]: warning: changing search order '`
4546        if test "X$warn" != X; then
4547            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4548        fi
4549     done
4550     $rm -f try try.*
4551 esac
4552
4553 : What should the include directory be ?
4554 echo " "
4555 $echo $n "Hmm...  $c"
4556 dflt='/usr/include'
4557 incpath=''
4558 mips_type=''
4559 if $test -f /bin/mips && /bin/mips; then
4560         echo "Looks like a MIPS system..."
4561         $cat >usr.c <<'EOCP'
4562 #ifdef SYSTYPE_BSD43
4563 /bsd43
4564 #endif
4565 EOCP
4566         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4567                 dflt='/bsd43/usr/include'
4568                 incpath='/bsd43'
4569                 mips_type='BSD 4.3'
4570         else
4571                 mips_type='System V'
4572         fi
4573         $rm -f usr.c usr.out
4574         echo "and you're compiling with the $mips_type compiler and libraries."
4575         xxx_prompt=y
4576         echo "exit 0" >mips
4577 else
4578         echo "Doesn't look like a MIPS system."
4579         xxx_prompt=n
4580         echo "exit 1" >mips
4581 fi
4582 chmod +x mips
4583 $eunicefix mips
4584 case "$usrinc" in
4585 '') ;;
4586 *) dflt="$usrinc";;
4587 esac
4588 case "$xxx_prompt" in
4589 y)      fn=d/
4590         echo " "
4591         rp='Where are the include files you want to use?'
4592         . ./getfile
4593         usrinc="$ans"
4594         ;;
4595 *)      usrinc="$dflt"
4596         ;;
4597 esac
4598
4599 : see how we invoke the C preprocessor
4600 echo " "
4601 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4602 cat <<'EOT' >testcpp.c
4603 #define ABC abc
4604 #define XYZ xyz
4605 ABC.XYZ
4606 EOT
4607 cd ..
4608 if test ! -f cppstdin; then
4609         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4610                 # AIX cc -E doesn't show the absolute headerfile
4611                 # locations but we'll cheat by using the -M flag.
4612                 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
4613         else
4614                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4615         fi
4616 else
4617         echo "Keeping your $hint cppstdin wrapper."
4618 fi
4619 chmod 755 cppstdin
4620 wrapper=`pwd`/cppstdin
4621 ok='false'
4622 cd UU
4623
4624 if $test "X$cppstdin" != "X" && \
4625         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4626         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4627 then
4628         echo "You used to use $cppstdin $cppminus so we'll use that again."
4629         case "$cpprun" in
4630         '') echo "But let's see if we can live without a wrapper..." ;;
4631         *)
4632                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4633                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4634                 then
4635                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4636                         ok='true'
4637                 else
4638                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4639                 fi
4640                 ;;
4641         esac
4642 else
4643         case "$cppstdin" in
4644         '') ;;
4645         *)
4646                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4647                 ;;
4648         esac
4649 fi
4650
4651 if $ok; then
4652         : nothing
4653 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4654         $cc -E <testcpp.c >testcpp.out 2>&1; \
4655         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4656         echo "Yup, it does."
4657         x_cpp="$cc -E"
4658         x_minus='';
4659 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4660         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4661         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4662         echo "Yup, it does."
4663         x_cpp="$cc -E"
4664         x_minus='-';
4665 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4666         $cc -P <testcpp.c >testcpp.out 2>&1; \
4667         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4668         echo "Yipee, that works!"
4669         x_cpp="$cc -P"
4670         x_minus='';
4671 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4672         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4673         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4674         echo "At long last!"
4675         x_cpp="$cc -P"
4676         x_minus='-';
4677 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4678         $cpp <testcpp.c >testcpp.out 2>&1; \
4679         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4680         echo "It works!"
4681         x_cpp="$cpp"
4682         x_minus='';
4683 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4684         $cpp - <testcpp.c >testcpp.out 2>&1; \
4685         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4686         echo "Hooray, it works!  I was beginning to wonder."
4687         x_cpp="$cpp"
4688         x_minus='-';
4689 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4690         $wrapper <testcpp.c >testcpp.out 2>&1; \
4691         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4692         x_cpp="$wrapper"
4693         x_minus=''
4694         echo "Eureka!"
4695 else
4696         dflt=''
4697         rp="No dice.  I can't find a C preprocessor.  Name one:"
4698         . ./myread
4699         x_cpp="$ans"
4700         x_minus=''
4701         $x_cpp <testcpp.c >testcpp.out 2>&1
4702         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4703                 echo "OK, that will do." >&4
4704         else
4705 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4706                 exit 1
4707         fi
4708 fi
4709
4710 case "$ok" in
4711 false)
4712         cppstdin="$x_cpp"
4713         cppminus="$x_minus"
4714         cpprun="$x_cpp"
4715         cpplast="$x_minus"
4716         set X $x_cpp
4717         shift
4718         case "$1" in
4719         "$cpp")
4720                 echo "Perhaps can we force $cc -E using a wrapper..."
4721                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4722                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4723                 then
4724                         echo "Yup, we can."
4725                         cppstdin="$wrapper"
4726                         cppminus='';
4727                 else
4728                         echo "Nope, we'll have to live without it..."
4729                 fi
4730                 ;;
4731         esac
4732         case "$cpprun" in
4733         "$wrapper")
4734                 cpprun=''
4735                 cpplast=''
4736                 ;;
4737         esac
4738         ;;
4739 esac
4740
4741 case "$cppstdin" in
4742 "$wrapper"|'cppstdin') ;;
4743 *) $rm -f $wrapper;;
4744 esac
4745 $rm -f testcpp.c testcpp.out
4746
4747 : Set private lib path
4748 case "$plibpth" in
4749 '') if ./mips; then
4750                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4751         fi;;
4752 esac
4753 case "$libpth" in
4754 ' ') dlist='';;
4755 '') dlist="$loclibpth $plibpth $glibpth";;
4756 *) dlist="$libpth";;
4757 esac
4758
4759 : Now check and see which directories actually exist, avoiding duplicates
4760 libpth=''
4761 for xxx in $dlist
4762 do
4763     if $test -d $xxx; then
4764                 case " $libpth " in
4765                 *" $xxx "*) ;;
4766                 *) libpth="$libpth $xxx";;
4767                 esac
4768     fi
4769 done
4770 $cat <<'EOM'
4771
4772 Some systems have incompatible or broken versions of libraries.  Among
4773 the directories listed in the question below, please remove any you
4774 know not to be holding relevant libraries, and add any that are needed.
4775 Say "none" for none.
4776
4777 EOM
4778 case "$libpth" in
4779 '') dflt='none';;
4780 *)
4781         set X $libpth
4782         shift
4783         dflt=${1+"$@"}
4784         ;;
4785 esac
4786 rp="Directories to use for library searches?"
4787 . ./myread
4788 case "$ans" in
4789 none) libpth=' ';;
4790 *) libpth="$ans";;
4791 esac
4792
4793 : compute shared library extension
4794 case "$so" in
4795 '')
4796         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4797                 dflt='sl'
4798         else
4799                 dflt='so'
4800         fi
4801         ;;
4802 *) dflt="$so";;
4803 esac
4804 $cat <<EOM
4805
4806 On some systems, shared libraries may be available.  Answer 'none' if
4807 you want to suppress searching of shared libraries for the remainder
4808 of this configuration.
4809
4810 EOM
4811 rp='What is the file extension used for shared libraries?'
4812 . ./myread
4813 so="$ans"
4814
4815 : Define several unixisms.
4816 : Hints files or command line option can be used to override them.
4817 : The convoluted testing is in case hints files set either the old
4818 : or the new name.
4819 case "$_exe" in
4820 '')     case "$exe_ext" in
4821         '')     ;;
4822         *)      _exe="$exe_ext" ;;
4823         esac
4824         ;;
4825 esac
4826 case "$_a" in
4827 '')     case "$lib_ext" in
4828     '') _a='.a';;
4829         *)      _a="$lib_ext" ;;
4830         esac
4831         ;;
4832 esac
4833 case "$_o" in
4834 '') case "$obj_ext" in
4835         '')     _o='.o';;
4836         *)      _o="$obj_ext";;
4837         esac
4838         ;;
4839 esac
4840 case "$p_" in
4841 '') case "$path_sep" in
4842         '')     p_=':';;
4843         *)      p_="$path_sep";;
4844         esac
4845         ;;
4846 esac
4847 exe_ext=$_exe
4848 lib_ext=$_a
4849 obj_ext=$_o
4850 path_sep=$p_
4851
4852 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4853
4854 : Which makefile gets called first.  This is used by make depend.
4855 case "$firstmakefile" in
4856 '') firstmakefile='makefile';;
4857 esac
4858
4859 : Check for uselongdouble support
4860 case "$ccflags" in
4861 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4862 esac
4863
4864 case "$uselongdouble" in
4865 $define|true|[yY]*)     dflt='y';;
4866 *) dflt='n';;
4867 esac
4868 cat <<EOM
4869
4870 Perl can be built to take advantage of long doubles which
4871 (if available) may give more accuracy and range for floating point numbers.
4872
4873 If this doesn't make any sense to you, just accept the default '$dflt'.
4874 EOM
4875 rp='Try to use long doubles if available?'
4876 . ./myread
4877 case "$ans" in
4878 y|Y)    val="$define"   ;;
4879 *)      val="$undef"    ;;
4880 esac
4881 set uselongdouble
4882 eval $setvar
4883
4884 case "$uselongdouble" in
4885 true|[yY]*) uselongdouble="$define" ;;
4886 esac
4887
4888 : Look for a hint-file generated 'call-back-unit'.  If the
4889 : user has specified that long doubles should be used,
4890 : we may need to set or change some other defaults.
4891 if $test -f uselongdouble.cbu; then
4892     echo "Your platform has some specific hints regarding long doubles, using them..."
4893     . ./uselongdouble.cbu
4894 else
4895     case "$uselongdouble" in
4896         $define)
4897                 $cat <<EOM
4898 (Your platform does not have any specific hints for long doubles.)
4899 EOM
4900         ;;
4901     esac
4902 fi
4903
4904 : Looking for optional libraries
4905 echo " "
4906 echo "Checking for optional libraries..." >&4
4907 case "$libs" in
4908 ' '|'') dflt='';;
4909 *) dflt="$libs";;
4910 esac
4911 case "$libswanted" in
4912 '') libswanted='c_s';;
4913 esac
4914 case "$usesocks" in
4915 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4916 esac
4917 libsfound=''
4918 libsfiles=''
4919 libsdirs=''
4920 libspath=''
4921 for thisdir in $libpth $xlibpth; do
4922   test -d $thisdir && libspath="$libspath $thisdir"
4923 done
4924 for thislib in $libswanted; do
4925         for thisdir in $libspath; do
4926             xxx=''
4927             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4928                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4929                 $test -f "$xxx" && eval $libscheck
4930                 $test -f "$xxx" && libstyle=shared
4931             fi
4932             if test ! -f "$xxx"; then
4933                 xxx=$thisdir/lib$thislib.$so
4934                 $test -f "$xxx" && eval $libscheck
4935                 $test -f "$xxx" && libstyle=shared
4936             fi
4937             if test ! -f "$xxx"; then
4938                 xxx=$thisdir/lib$thislib$_a
4939                 $test -f "$xxx" && eval $libscheck
4940                 $test -f "$xxx" && libstyle=static
4941             fi
4942             if test ! -f "$xxx"; then
4943                 xxx=$thisdir/$thislib$_a
4944                 $test -f "$xxx" && eval $libscheck
4945                 $test -f "$xxx" && libstyle=static
4946             fi
4947             if test ! -f "$xxx"; then
4948                 xxx=$thisdir/lib${thislib}_s$_a
4949                 $test -f "$xxx" && eval $libscheck
4950                 $test -f "$xxx" && libstyle=static
4951                 $test -f "$xxx" && thislib=${thislib}_s
4952             fi
4953             if test ! -f "$xxx"; then
4954                 xxx=$thisdir/Slib$thislib$_a
4955                 $test -f "$xxx" && eval $libscheck
4956                 $test -f "$xxx" && libstyle=static
4957             fi
4958             if $test -f "$xxx"; then
4959                 case "$libstyle" in
4960                 shared) echo "Found -l$thislib (shared)." ;;
4961                 static) echo "Found -l$thislib." ;;
4962                 *)      echo "Found -l$thislib ($libstyle)." ;;
4963                 esac
4964                 case " $dflt " in
4965                 *"-l$thislib "*);;
4966                 *) dflt="$dflt -l$thislib"
4967                    libsfound="$libsfound $xxx"
4968                    yyy=`basename $xxx`
4969                    libsfiles="$libsfiles $yyy"
4970                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4971                    case " $libsdirs " in
4972                    *" $yyy "*) ;;
4973                    *) libsdirs="$libsdirs $yyy" ;;
4974                    esac
4975                    ;;
4976                 esac
4977                 break
4978             fi
4979         done
4980         if $test ! -f "$xxx"; then
4981             echo "No -l$thislib."
4982         fi
4983 done
4984 set X $dflt
4985 shift
4986 dflt="$*"
4987 case "$libs" in
4988 '') dflt="$dflt";;
4989 *) dflt="$libs";;
4990 esac
4991 case "$dflt" in
4992 ' '|'') dflt='none';;
4993 esac
4994
4995 $cat <<EOM
4996
4997 In order to compile $package on your machine, a number of libraries
4998 are usually needed.  Include any other special libraries here as well.
4999 Say "none" for none.  The default list is almost always right.
5000 EOM
5001
5002 echo " "
5003 rp="What libraries to use?"
5004 . ./myread
5005 case "$ans" in
5006 none) libs=' ';;
5007 *) libs="$ans";;
5008 esac
5009
5010 : determine optimization, if desired, or use for debug flag also
5011 case "$optimize" in
5012 ' '|$undef) dflt='none';;
5013 '') dflt='-O';;
5014 *) dflt="$optimize";;
5015 esac
5016 $cat <<EOH
5017
5018 By default, $package compiles with the -O flag to use the optimizer.
5019 Alternately, you might want to use the symbolic debugger, which uses
5020 the -g flag (on traditional Unix systems).  Either flag can be
5021 specified here.  To use neither flag, specify the word "none".
5022
5023 EOH
5024 rp="What optimizer/debugger flag should be used?"
5025 . ./myread
5026 optimize="$ans"
5027 case "$optimize" in
5028 'none') optimize=" ";;
5029 esac
5030
5031 : Check what DEBUGGING is required from the command line
5032 : -DEBUGGING      or -DDEBUGGING or
5033 : -DEBUGGING=both                       = -g + -DDEBUGGING
5034 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5035 : -DEBUGGING=none or -UDEBUGGING        =
5036 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5037 case "$EBUGGING" in
5038 '')     ;;
5039 *)      DEBUGGING=$EBUGGING ;;
5040 esac
5041
5042 case "$DEBUGGING" in
5043 -g|both|$define)
5044     case "$optimize" in
5045         *-g*) ;;
5046         *)    optimize="$optimize -g" ;;
5047     esac ;;
5048 none|$undef)
5049     case "$optimize" in
5050         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5051                 shift
5052                 optimize="$*"
5053                 ;;
5054     esac ;;
5055 esac
5056
5057 dflt=''
5058 case "$DEBUGGING" in
5059 both|$define) dflt='-DDEBUGGING'
5060 esac
5061
5062 : argument order is deliberate, as the flag will start with - which set could
5063 : think is an option
5064 checkccflag='check=$1; flag=$2; callback=$3;
5065 echo " ";
5066 echo "Checking if your compiler accepts $flag" 2>&1;
5067 echo "int main(void) { return 0; }" > gcctest.c;
5068 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5069     echo "Yes, it does." 2>&1;
5070     if $test -s gcctest.out ; then
5071         echo "But your platform does not like it:";
5072         cat gcctest.out;
5073     else
5074         case "$ccflags" in
5075         *$check*)
5076             echo "Leaving current flags $ccflags alone." 2>&1
5077             ;;
5078         *) dflt="$dflt $flag";
5079             eval $callback
5080             ;;
5081         esac
5082     fi
5083 else
5084     echo "Nope, it does not, but that is ok." 2>&1;
5085 fi
5086 '
5087
5088 : We will not override a previous value, but we might want to
5089 : augment a hint file
5090 case "$hint" in
5091 default|recommended)
5092         case "$gccversion" in
5093         1*) dflt="$dflt -fpcc-struct-return" ;;
5094         esac
5095         case "$optimize:$DEBUGGING" in
5096         *-g*:old) dflt="$dflt -DDEBUGGING";;
5097         esac
5098         case "$gccversion" in
5099         2*) if $test -d /etc/conf/kconfig.d &&
5100                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5101                 then
5102                         # Interactive Systems (ISC) POSIX mode.
5103                         dflt="$dflt -posix"
5104                 fi
5105                 ;;
5106         esac
5107         case "$gccversion" in
5108         1*) ;;
5109         2.[0-8]*) ;;
5110         ?*)     set strict-aliasing -fno-strict-aliasing
5111                 eval $checkccflag
5112                 ;;
5113         esac
5114         # For gcc, adding -pipe speeds up compilations for some, but apparently
5115         # some assemblers can't read from stdin.  (It also slows down compilations
5116         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5117         case "$gccversion" in
5118         ?*)     set pipe -pipe
5119                 eval $checkccflag
5120                 ;;
5121         esac
5122
5123         # on x86_64 (at least) we require an extra library (libssp) in the
5124         # link command line. This library is not named, so I infer that it is
5125         # an implementation detail that may change. Hence the safest approach
5126         # is to add the flag to the flags passed to the compiler at link time,
5127         # as that way the compiler can do the right implementation dependant
5128         # thing. (NWC)
5129         case "$gccversion" in
5130         ?*)     set stack-protector -fstack-protector
5131                 eval $checkccflag
5132                 ;;
5133         esac
5134         ;;
5135 esac
5136
5137 case "$mips_type" in
5138 *BSD*|'') inclwanted="$locincpth $usrinc";;
5139 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5140 esac
5141 for thisincl in $inclwanted; do
5142         if $test -d $thisincl; then
5143                 if $test x$thisincl != x$usrinc; then
5144                         case "$dflt" in
5145                         *" -I$thisincl "*);;
5146                         *) dflt="$dflt -I$thisincl ";;
5147                         esac
5148                 fi
5149         fi
5150 done
5151
5152 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5153         xxx=true;
5154 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5155         xxx=true;
5156 else
5157         xxx=false;
5158 fi;
5159 if $xxx; then
5160         case "$dflt" in
5161         *$2*);;
5162         *) dflt="$dflt -D$2";;
5163         esac;
5164 fi'
5165
5166 set signal.h LANGUAGE_C; eval $inctest
5167
5168 case "$usesocks" in
5169 $define)
5170         ccflags="$ccflags -DSOCKS"
5171         ;;
5172 esac
5173
5174 case "$hint" in
5175 default|recommended) dflt="$ccflags $dflt" ;;
5176 *) dflt="$ccflags";;
5177 esac
5178
5179 case "$dflt" in
5180 ''|' ') dflt=none;;
5181 esac
5182
5183 $cat <<EOH
5184
5185 Your C compiler may want other flags.  For this question you should include
5186 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5187 but you should NOT include libraries or ld flags like -lwhatever.  If you
5188 want $package to honor its debug switch, you should include -DDEBUGGING here.
5189 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5190
5191 To use no flags, specify the word "none".
5192
5193 EOH
5194 set X $dflt
5195 shift
5196 dflt=${1+"$@"}
5197 rp="Any additional cc flags?"
5198 . ./myread
5199 case "$ans" in
5200 none) ccflags='';;
5201 *) ccflags="$ans";;
5202 esac
5203
5204 : the following weeds options from ccflags that are of no interest to cpp
5205 case "$cppflags" in
5206 '') cppflags="$ccflags" ;;
5207 *)  cppflags="$cppflags $ccflags" ;;
5208 esac
5209 case "$gccversion" in
5210 1*) cppflags="$cppflags -D__GNUC__"
5211 esac
5212 case "$mips_type" in
5213 '');;
5214 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5215 esac
5216 case "$cppflags" in
5217 '');;
5218 *)
5219         echo " "
5220         echo "Let me guess what the preprocessor flags are..." >&4
5221         set X $cppflags
5222         shift
5223         cppflags=''
5224         $cat >cpp.c <<'EOM'
5225 #define BLURFL foo
5226
5227 BLURFL xx LFRULB
5228 EOM
5229         previous=''
5230         for flag in $*
5231         do
5232                 case "$flag" in
5233                 -*) ftry="$flag";;
5234                 *) ftry="$previous $flag";;
5235                 esac
5236                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5237                         >cpp1.out 2>/dev/null && \
5238                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5239                         >cpp2.out 2>/dev/null && \
5240                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5241                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5242                 then
5243                         cppflags="$cppflags $ftry"
5244                         previous=''
5245                 else
5246                         previous="$flag"
5247                 fi
5248         done
5249         set X $cppflags
5250         shift
5251         cppflags=${1+"$@"}
5252         case "$cppflags" in
5253         *-*)  echo "They appear to be: $cppflags";;
5254         esac
5255         $rm -f cpp.c cpp?.out
5256         ;;
5257 esac
5258
5259 : flags used in final linking phase
5260 case "$ldflags" in
5261 '') if ./venix; then
5262                 dflt='-i -z'
5263         else
5264                 dflt=''
5265         fi
5266         case "$ccflags" in
5267         *-posix*) dflt="$dflt -posix" ;;
5268         esac
5269         ;;
5270 *) dflt="$ldflags";;
5271 esac
5272 # See note above about -fstack-protector
5273 case "$ccflags" in
5274 *-fstack-protector*) 
5275         case "$dflt" in
5276         *-fstack-protector*) ;; # Don't add it again
5277         *) dflt="$dflt -fstack-protector" ;; 
5278         esac
5279         ;;
5280 esac
5281
5282 : Try to guess additional flags to pick up local libraries.
5283 for thislibdir in $libpth; do
5284         case " $loclibpth " in
5285         *" $thislibdir "*)
5286                 case "$dflt " in
5287                 *"-L$thislibdir "*) ;;
5288                 *)  dflt="$dflt -L$thislibdir" ;;
5289                 esac
5290                 ;;
5291         esac
5292 done
5293
5294 case "$dflt" in
5295 '') dflt='none' ;;
5296 esac
5297
5298 $cat <<EOH
5299
5300 Your C linker may need flags.  For this question you should
5301 include -L/whatever and any other flags used by the C linker, but you
5302 should NOT include libraries like -lwhatever.
5303
5304 Make sure you include the appropriate -L/path flags if your C linker
5305 does not normally search all of the directories you specified above,
5306 namely
5307         $libpth
5308 To use no flags, specify the word "none".
5309
5310 EOH
5311
5312 rp="Any additional ld flags (NOT including libraries)?"
5313 . ./myread
5314 case "$ans" in
5315 none) ldflags='';;
5316 *) ldflags="$ans";;
5317 esac
5318 rmlist="$rmlist pdp11"
5319
5320 : coherency check
5321 echo " "
5322 echo "Checking your choice of C compiler and flags for coherency..." >&4
5323 $cat > try.c <<'EOF'
5324 #include <stdio.h>
5325 int main() { printf("Ok\n"); return(0); }
5326 EOF
5327 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5328 shift
5329 $cat >try.msg <<'EOM'
5330 I've tried to compile and run the following simple program:
5331
5332 EOM
5333 $cat try.c >> try.msg
5334
5335 $cat >> try.msg <<EOM
5336
5337 I used the command:
5338
5339         $*
5340         $run ./try
5341
5342 and I got the following output:
5343
5344 EOM
5345 dflt=y
5346 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5347         if $sh -c "$run ./try " >>try.msg 2>&1; then
5348                 xxx=`$run ./try`
5349                 case "$xxx" in
5350                 "Ok") dflt=n ;;
5351                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5352                         case " $libs " in
5353                         *" -lsfio "*)
5354                                 cat >> try.msg <<'EOQS'
5355 If $libs contains -lsfio, and sfio is mis-configured, then it
5356 sometimes (apparently) runs and exits with a 0 status, but with no
5357 output!  It may have to do with sfio's use of _exit vs. exit.
5358
5359 EOQS
5360                                 rp="You have a big problem.  Shall I abort Configure"
5361                                 dflt=y
5362                                 ;;
5363                         esac
5364                         ;;
5365                 esac
5366         else
5367                 echo "The program compiled OK, but exited with status $?." >>try.msg
5368                 rp="You have a problem.  Shall I abort Configure"
5369                 dflt=y
5370         fi
5371 else
5372         echo "I can't compile the test program." >>try.msg
5373         rp="You have a BIG problem.  Shall I abort Configure"
5374         dflt=y
5375 fi
5376 case "$dflt" in
5377 y)
5378         $cat try.msg >&4
5379         case "$knowitall" in
5380         '')
5381                 echo "(The supplied flags or libraries might be incorrect.)"
5382                 ;;
5383         *) dflt=n;;
5384         esac
5385         echo " "
5386         . ./myread
5387         case "$ans" in
5388         n*|N*) ;;
5389         *)      echo "Ok.  Stopping Configure." >&4
5390                 exit 1
5391                 ;;
5392         esac
5393         ;;
5394 n) echo "OK, that should do.";;
5395 esac
5396 $rm_try gcctest gcctest.out
5397
5398 : define a shorthand compile call
5399 compile='
5400 mc_file=$1;
5401 shift;
5402 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5403 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5404 exit 1;
5405 fi;
5406 esac;
5407 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5408 : define a shorthand compile call for compilations that should be ok.
5409 compile_ok='
5410 mc_file=$1;
5411 shift;
5412 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5413
5414 : determine filename position in cpp output
5415 echo " "
5416 echo "Computing filename position in cpp output for #include directives..." >&4
5417 case "$osname" in
5418 vos) testaccess=-e ;;
5419 *)   testaccess=-r ;;
5420 esac
5421 echo '#include <stdio.h>' > foo.c
5422 $cat >fieldn <<EOF
5423 $startsh
5424 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5425 $grep '^[       ]*#.*stdio\.h' | \
5426 while read cline; do
5427         pos=1
5428         set \$cline
5429         while $test \$# -gt 0; do
5430                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5431                         echo "\$pos"
5432                         exit 0
5433                 fi
5434                 shift
5435                 pos=\`expr \$pos + 1\`
5436         done
5437 done
5438 EOF
5439 chmod +x fieldn
5440 fieldn=`./fieldn`
5441 $rm -f foo.c fieldn
5442 case $fieldn in
5443 '') pos='???';;
5444 1) pos=first;;
5445 2) pos=second;;
5446 3) pos=third;;
5447 *) pos="${fieldn}th";;
5448 esac
5449 echo "Your cpp writes the filename in the $pos field of the line."
5450
5451 case "$osname" in
5452 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5453 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5454 *)   cppfilter='' ;;
5455 esac
5456 : locate header file
5457 $cat >findhdr <<EOF
5458 $startsh
5459 wanted=\$1
5460 name=''
5461 for usrincdir in $usrinc
5462 do
5463         if test -f \$usrincdir/\$wanted; then
5464                 echo "\$usrincdir/\$wanted"
5465                 exit 0
5466         fi
5467 done
5468 awkprg='{ print \$$fieldn }'
5469 echo "#include <\$wanted>" > foo\$\$.c
5470 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5471 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5472 while read cline; do
5473         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5474         case "\$name" in
5475         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5476         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5477         *) exit 2;;
5478         esac;
5479 done;
5480 #
5481 # status = 0: grep returned 0 lines, case statement not executed
5482 # status = 1: headerfile found
5483 # status = 2: while loop executed, no headerfile found
5484 #
5485 status=\$?
5486 $rm -f foo\$\$.c;
5487 if test \$status -eq 1; then
5488         exit 0;
5489 fi
5490 exit 1
5491 EOF
5492 chmod +x findhdr
5493
5494 : define an alternate in-header-list? function
5495 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5496 cont=true; xxf="echo \"<\$1> found.\" >&4";
5497 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5498 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5499 esac;
5500 case $# in 4) instead=instead;; *) instead="at last";; esac;
5501 while $test "$cont"; do
5502         xxx=`./findhdr $1`
5503         var=$2; eval "was=\$$2";
5504         if $test "$xxx" && $test -r "$xxx";
5505         then eval $xxf;
5506         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5507                 cont="";
5508         else eval $xxnf;
5509         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5510         set $yyy; shift; shift; yyy=$@;
5511         case $# in 0) cont="";;
5512         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5513                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5514         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5515                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5516         esac;
5517 done;
5518 while $test "$yyy";
5519 do set $yyy; var=$2; eval "was=\$$2";
5520         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5521         set $yyy; shift; shift; yyy=$@;
5522 done'
5523
5524 : see if stdlib is available
5525 set stdlib.h i_stdlib
5526 eval $inhdr
5527
5528 : check for lengths of integral types
5529 echo " "
5530 case "$intsize" in
5531 '')
5532         echo "Checking to see how big your integers are..." >&4
5533         $cat >try.c <<EOCP
5534 #include <stdio.h>
5535 #$i_stdlib I_STDLIB
5536 #ifdef I_STDLIB
5537 #include <stdlib.h>
5538 #endif
5539 int main()
5540 {
5541         printf("intsize=%d;\n", (int)sizeof(int));
5542         printf("longsize=%d;\n", (int)sizeof(long));
5543         printf("shortsize=%d;\n", (int)sizeof(short));
5544         exit(0);
5545 }
5546 EOCP
5547         set try
5548         if eval $compile_ok && $run ./try > /dev/null; then
5549                 eval `$run ./try`
5550                 echo "Your integers are $intsize bytes long."
5551                 echo "Your long integers are $longsize bytes long."
5552                 echo "Your short integers are $shortsize bytes long."
5553         else
5554                 $cat >&4 <<EOM
5555 !
5556 Help! I can't compile and run the intsize test program: please enlighten me!
5557 (This is probably a misconfiguration in your system or libraries, and
5558 you really ought to fix it.  Still, I'll try anyway.)
5559 !
5560 EOM
5561                 dflt=4
5562                 rp="What is the size of an integer (in bytes)?"
5563                 . ./myread
5564                 intsize="$ans"
5565                 dflt=$intsize
5566                 rp="What is the size of a long integer (in bytes)?"
5567                 . ./myread
5568                 longsize="$ans"
5569                 dflt=2
5570                 rp="What is the size of a short integer (in bytes)?"
5571                 . ./myread
5572                 shortsize="$ans"
5573         fi
5574         ;;
5575 esac
5576 $rm_try
5577
5578 : check for long long
5579 echo " "
5580 echo "Checking to see if you have long long..." >&4
5581 echo 'int main() { long long x = 7; return 0; }' > try.c
5582 set try
5583 if eval $compile; then
5584         val="$define"
5585         echo "You have long long."
5586 else
5587         val="$undef"
5588         echo "You do not have long long."
5589 fi
5590 $rm_try
5591 set d_longlong
5592 eval $setvar
5593
5594 : check for length of long long
5595 case "${d_longlong}${longlongsize}" in
5596 $define)
5597         echo " "
5598         echo "Checking to see how big your long longs are..." >&4
5599         $cat >try.c <<'EOCP'
5600 #include <stdio.h>
5601 int main()
5602 {
5603     printf("%d\n", (int)sizeof(long long));
5604     return(0);
5605 }
5606 EOCP
5607         set try
5608         if eval $compile_ok; then
5609                 longlongsize=`$run ./try`
5610                 echo "Your long longs are $longlongsize bytes long."
5611         else
5612                 dflt='8'
5613                 echo " "
5614                 echo "(I can't seem to compile the test program.  Guessing...)"
5615                 rp="What is the size of a long long (in bytes)?"
5616                 . ./myread
5617                 longlongsize="$ans"
5618         fi
5619         if $test "X$longsize" = "X$longlongsize"; then
5620                 echo "(That isn't any different from an ordinary long.)"
5621         fi
5622         ;;
5623 esac
5624 $rm_try
5625
5626 : see if inttypes.h is available
5627 : we want a real compile instead of Inhdr because some systems
5628 : have an inttypes.h which includes non-existent headers
5629 echo " "
5630 $cat >try.c <<EOCP
5631 #include <inttypes.h>
5632 int main() {
5633         static int32_t foo32 = 0x12345678;
5634 }
5635 EOCP
5636 set try
5637 if eval $compile; then
5638         echo "<inttypes.h> found." >&4
5639         val="$define"
5640 else
5641         echo "<inttypes.h> NOT found." >&4
5642         val="$undef"
5643 fi
5644 $rm_try
5645 set i_inttypes
5646 eval $setvar
5647
5648 : check for int64_t
5649 echo " "
5650 echo "Checking to see if you have int64_t..." >&4
5651 $cat >try.c <<EOCP
5652 #include <sys/types.h>
5653 #$i_inttypes I_INTTYPES
5654 #ifdef I_INTTYPES
5655 #include <inttypes.h>
5656 #endif
5657 int main() { int64_t x = 7; }
5658 EOCP
5659 set try
5660 if eval $compile; then
5661         val="$define"
5662         echo "You have int64_t."
5663 else
5664         val="$undef"
5665         echo "You do not have int64_t."
5666 fi
5667 $rm_try
5668 set d_int64_t
5669 eval $setvar
5670
5671 : Check if 64bit ints have a quad type
5672 echo " "
5673 echo "Checking which 64-bit integer type we could use..." >&4
5674
5675 case "$intsize" in
5676 8) val=int
5677    set quadtype
5678    eval $setvar
5679    val='"unsigned int"'
5680    set uquadtype
5681    eval $setvar
5682    quadkind=1
5683    ;;
5684 *) case "$longsize" in
5685    8) val=long
5686       set quadtype
5687       eval $setvar
5688       val='"unsigned long"'
5689       set uquadtype
5690       eval $setvar
5691       quadkind=2
5692       ;;
5693    *) case "$d_longlong:$longlongsize" in
5694       define:8)
5695         val='"long long"'
5696         set quadtype
5697         eval $setvar
5698         val='"unsigned long long"'
5699         set uquadtype
5700         eval $setvar
5701         quadkind=3
5702         ;;
5703       *) case "$d_int64_t" in
5704          define)
5705            val=int64_t
5706            set quadtype
5707            eval $setvar
5708            val=uint64_t
5709            set uquadtype
5710            eval $setvar
5711            quadkind=4
5712            ;;
5713          esac
5714          ;;
5715       esac
5716       ;;
5717    esac
5718    ;;
5719 esac
5720
5721 case "$quadtype" in
5722 '')     echo "Alas, no 64-bit integer types in sight." >&4
5723         d_quad="$undef"
5724         ;;
5725 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5726         d_quad="$define"
5727         ;;
5728 esac
5729
5730 : Do we want 64bit support
5731 case "$uselonglong" in
5732 "$define"|true|[yY]*)
5733         cat <<EOM >&4
5734
5735 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5736 EOM
5737         use64bitint="$define"
5738         ;;
5739 esac
5740 case "$use64bits" in
5741 "$define"|true|[yY]*)
5742         cat <<EOM >&4
5743
5744 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5745 EOM
5746         use64bitint="$define"
5747         ;;
5748 esac
5749 case "$use64bitints" in
5750 "$define"|true|[yY]*)
5751         cat <<EOM >&4
5752
5753 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5754 EOM
5755         use64bitint="$define"
5756         ;;
5757 esac
5758 case "$use64bitsint" in
5759 "$define"|true|[yY]*)
5760         cat <<EOM >&4
5761
5762 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5763 EOM
5764         use64bitint="$define"
5765         ;;
5766 esac
5767 case "$uselonglongs" in
5768 "$define"|true|[yY]*)
5769         cat <<EOM >&4
5770
5771 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5772 EOM
5773         use64bitint="$define"
5774         ;;
5775 esac
5776 case "$use64bitsall" in
5777 "$define"|true|[yY]*)
5778         cat <<EOM >&4
5779
5780 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5781 EOM
5782         use64bitall="$define"
5783         ;;
5784 esac
5785
5786 case "$ccflags" in
5787 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5788 esac
5789 case "$use64bitall" in
5790 "$define"|true|[yY]*) use64bitint="$define" ;;
5791 esac
5792
5793 case "$longsize" in
5794 8) cat <<EOM
5795
5796 You have natively 64-bit long integers.
5797 EOM
5798    val="$define"
5799    ;;
5800 *) case "$use64bitint" in
5801    "$define"|true|[yY]*) dflt='y';;
5802    *) dflt='n';;
5803    esac
5804    case "$d_quad" in
5805    "$define") ;;
5806    *) dflt='n' ;;
5807    esac
5808    cat <<EOM
5809
5810 Perl can be built to take advantage of 64-bit integer types
5811 on some systems.  To do so, Configure can be run with -Duse64bitint.
5812 Choosing this option will most probably introduce binary incompatibilities.
5813
5814 If this doesn't make any sense to you, just accept the default '$dflt'.
5815 (The default has been chosen based on your configuration.)
5816 EOM
5817    rp='Try to use 64-bit integers, if available?'
5818    . ./myread
5819    case "$ans" in
5820    [yY]*) val="$define" ;;
5821    *)     val="$undef"  ;;
5822    esac
5823    ;;
5824 esac
5825 set use64bitint
5826 eval $setvar
5827
5828 case "$use64bitall" in
5829 "$define"|true|[yY]*) dflt='y' ;;
5830 *) case "$longsize" in
5831    8) dflt='y' ;;
5832    *) dflt='n' ;;
5833    esac
5834    ;;
5835 esac
5836 cat <<EOM
5837
5838 You may also choose to try maximal 64-bitness.  It means using as much
5839 64-bitness as possible on the platform.  This in turn means even more
5840 binary incompatibilities.  On the other hand, your platform may not
5841 have any more 64-bitness available than what you already have chosen.
5842
5843 If this doesn't make any sense to you, just accept the default '$dflt'.
5844 (The default has been chosen based on your configuration.)
5845 EOM
5846 rp='Try to use maximal 64-bit support, if available?'
5847 . ./myread
5848 case "$ans" in
5849 [yY]*) val="$define" ;;
5850 *)     val="$undef"  ;;
5851 esac
5852 set use64bitall
5853 eval $setvar
5854 case "$use64bitall" in
5855 "$define")
5856         case "$use64bitint" in
5857         "$undef")
5858                 cat <<EOM
5859
5860 Since you have chosen a maximally 64-bit build, I'm also turning on
5861 the use of 64-bit integers.
5862 EOM
5863                 use64bitint="$define" ;;
5864         esac
5865         ;;
5866 esac
5867
5868 : Look for a hint-file generated 'call-back-unit'.  If the
5869 : user has specified that a 64-bit perl is to be built,
5870 : we may need to set or change some other defaults.
5871 if $test -f use64bitint.cbu; then
5872         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5873         . ./use64bitint.cbu
5874 fi
5875 case "$use64bitint" in
5876 "$define"|true|[yY]*)
5877         case "$longsize" in
5878         4) case "$archname64" in
5879            '') archname64=64int ;;
5880            esac
5881            ;;
5882         esac
5883         ;;
5884 esac
5885
5886 : Look for a hint-file generated 'call-back-unit'.  If the
5887 : user has specified that a maximally 64-bit perl is to be built,
5888 : we may need to set or change some other defaults.
5889 if $test -f use64bitall.cbu; then
5890         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5891         . ./use64bitall.cbu
5892 fi
5893 case "$use64bitall" in
5894 "$define"|true|[yY]*)
5895         case "$longsize" in
5896         4) case "$archname64" in
5897            ''|64int) archname64=64all ;;
5898            esac
5899            ;;
5900         esac
5901         ;;
5902 esac
5903
5904 case "$d_quad:$use64bitint" in
5905 $undef:$define)
5906         cat >&4 <<EOF
5907
5908 *** You have chosen to use 64-bit integers,
5909 *** but none can be found.
5910 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5911 *** Cannot continue, aborting.
5912
5913 EOF
5914         exit 1
5915         ;;
5916 esac
5917
5918 : check for length of double
5919 echo " "
5920 case "$doublesize" in
5921 '')
5922         echo "Checking to see how big your double precision numbers are..." >&4
5923         $cat >try.c <<EOCP
5924 #include <stdio.h>
5925 #$i_stdlib I_STDLIB
5926 #ifdef I_STDLIB
5927 #include <stdlib.h>
5928 #endif
5929 int main()
5930 {
5931     printf("%d\n", (int)sizeof(double));
5932     exit(0);
5933 }
5934 EOCP
5935         set try
5936         if eval $compile_ok; then
5937                 doublesize=`$run ./try`
5938                 echo "Your double is $doublesize bytes long."
5939         else
5940                 dflt='8'
5941                 echo "(I can't seem to compile the test program.  Guessing...)"
5942                 rp="What is the size of a double precision number (in bytes)?"
5943                 . ./myread
5944                 doublesize="$ans"
5945         fi
5946         ;;
5947 esac
5948 $rm_try
5949
5950 : check for long doubles
5951 echo " "
5952 echo "Checking to see if you have long double..." >&4
5953 echo 'int main() { long double x = 7.0; }' > try.c
5954 set try
5955 if eval $compile; then
5956         val="$define"
5957         echo "You have long double."
5958 else
5959         val="$undef"
5960         echo "You do not have long double."
5961 fi
5962 $rm_try
5963 set d_longdbl
5964 eval $setvar
5965
5966 : check for length of long double
5967 case "${d_longdbl}${longdblsize}" in
5968 $define)
5969         echo " "
5970         echo "Checking to see how big your long doubles are..." >&4
5971         $cat >try.c <<'EOCP'
5972 #include <stdio.h>
5973 int main()
5974 {
5975         printf("%d\n", sizeof(long double));
5976 }
5977 EOCP
5978         set try
5979         set try
5980         if eval $compile; then
5981                 longdblsize=`$run ./try`
5982                 echo "Your long doubles are $longdblsize bytes long."
5983         else
5984                 dflt='8'
5985                 echo " "
5986                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5987                 rp="What is the size of a long double (in bytes)?"
5988                 . ./myread
5989                 longdblsize="$ans"
5990         fi
5991         if $test "X$doublesize" = "X$longdblsize"; then
5992                 echo "That isn't any different from an ordinary double."
5993                 echo "I'll keep your setting anyway, but you may see some"
5994                 echo "harmless compilation warnings."
5995         fi
5996         ;;
5997 esac
5998 $rm_try
5999
6000 : determine the architecture name
6001 echo " "
6002 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6003         tarch=`arch`"-$osname"
6004 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6005         if uname -m > tmparch 2>&1 ; then
6006                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6007                         -e 's/$/'"-$osname/" tmparch`
6008         else
6009                 tarch="$osname"
6010         fi
6011         $rm -f tmparch
6012 else
6013         tarch="$osname"
6014 fi
6015 case "$myarchname" in
6016 ''|"$tarch") ;;
6017 *)
6018         echo "(Your architecture name used to be $myarchname.)"
6019         archname=''
6020         ;;
6021 esac
6022 case "$targetarch" in
6023 '') ;;
6024 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6025 esac
6026 myarchname="$tarch"
6027 case "$archname" in
6028 '') dflt="$tarch";;
6029 *) dflt="$archname";;
6030 esac
6031 rp='What is your architecture name'
6032 . ./myread
6033 archname="$ans"
6034 case "$usethreads" in
6035 $define)
6036         echo "Threads selected." >&4
6037         case "$archname" in
6038         *-thread*) echo "...and architecture name already has -thread." >&4
6039                 ;;
6040         *)      archname="$archname-thread"
6041                 echo "...setting architecture name to $archname." >&4
6042                 ;;
6043         esac
6044         ;;
6045 esac
6046 case "$usemultiplicity" in
6047 $define)
6048         echo "Multiplicity selected." >&4
6049         case "$archname" in
6050         *-multi*) echo "...and architecture name already has -multi." >&4
6051                 ;;
6052         *)      archname="$archname-multi"
6053                 echo "...setting architecture name to $archname." >&4
6054                 ;;
6055         esac
6056         ;;
6057 esac
6058 case "$use64bitint$use64bitall" in
6059 *"$define"*)
6060         case "$archname64" in
6061         '')
6062                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6063                 ;;
6064         *)
6065                 case "$use64bitint" in
6066                 "$define") echo "64 bit integers selected." >&4 ;;
6067                 esac
6068                 case "$use64bitall" in
6069                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6070                 esac
6071                 case "$archname" in
6072                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6073                         ;;
6074                 *)      archname="$archname-$archname64"
6075                         echo "...setting architecture name to $archname." >&4
6076                         ;;
6077                 esac
6078                 ;;
6079         esac
6080 esac
6081 case "$uselongdouble" in
6082 $define)
6083         echo "Long doubles selected." >&4
6084         case "$longdblsize" in
6085         $doublesize)
6086                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6087                 ;;
6088         *)
6089                 case "$archname" in
6090                 *-ld*) echo "...and architecture name already has -ld." >&4
6091                         ;;
6092                 *)      archname="$archname-ld"
6093                         echo "...setting architecture name to $archname." >&4
6094                         ;;
6095                 esac
6096                 ;;
6097         esac
6098         ;;
6099 esac
6100 case "$useperlio" in
6101 $define)
6102         echo "Perlio selected." >&4
6103         ;;
6104 *)
6105         echo "Perlio not selected, using stdio." >&4
6106         case "$archname" in
6107         *-stdio*) echo "...and architecture name already has -stdio." >&4
6108                 ;;
6109         *)      archname="$archname-stdio"
6110                 echo "...setting architecture name to $archname." >&4
6111                 ;;
6112         esac
6113         ;;
6114 esac
6115 if $test -f archname.cbu; then
6116         echo "Your platform has some specific hints for architecture name, using them..."
6117         . ./archname.cbu
6118 fi
6119
6120 : set the prefixit variable, to compute a suitable default value
6121 prefixit='case "$3" in
6122 ""|none)
6123         case "$oldprefix" in
6124         "") eval "$1=\"\$$2\"";;
6125         *)
6126                 case "$3" in
6127                 "") eval "$1=";;
6128                 none)
6129                         eval "tp=\"\$$2\"";
6130                         case "$tp" in
6131                         ""|" ") eval "$1=\"\$$2\"";;
6132                         *) eval "$1=";;
6133                         esac;;
6134                 esac;;
6135         esac;;
6136 *)
6137         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6138         case "$tp" in
6139         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6140         /*-$oldprefix/*|\~*-$oldprefix/*)
6141                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6142         *) eval "$1=\"\$$2\"";;
6143         esac;;
6144 esac'
6145
6146 : determine installation style
6147 : For now, try to deduce it from prefix unless it is already set.
6148 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6149 case "$installstyle" in
6150 '')     case "$prefix" in
6151                 *perl*) dflt='lib';;
6152                 *) dflt='lib/perl5' ;;
6153         esac
6154         ;;
6155 *)      dflt="$installstyle" ;;
6156 esac
6157 : Probably not worth prompting for this since we prompt for all
6158 : the directories individually, and the prompt would be too long and
6159 : confusing anyway.
6160 installstyle=$dflt
6161
6162 : determine where public executables go
6163 echo " "
6164 set dflt bin bin
6165 eval $prefixit
6166 fn=d~
6167 rp='Pathname where the public executables will reside?'
6168 . ./getfile
6169 if $test "X$ansexp" != "X$binexp"; then
6170         installbin=''
6171 fi
6172 prefixvar=bin
6173 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6174 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6175 :     this via initialinstalllocation
6176 . ./setprefixvar
6177
6178 case "$userelocatableinc" in
6179 $define|true|[yY]*)     dflt='y' ;;
6180 *)                      dflt='n' ;;
6181 esac
6182 cat <<EOM
6183
6184 Would you like to build Perl so that the installation is relocatable, so that
6185 library paths in @INC are determined relative to the path of the perl binary?
6186 This is not advised for system Perl installs, or if you need to run setid
6187 scripts or scripts under taint mode.
6188
6189 If this doesn't make any sense to you, just accept the default '$dflt'.
6190 EOM
6191 rp='Use relocatable @INC?'
6192 . ./myread
6193 case "$ans" in
6194 y|Y)    val="$define" ;;
6195 *)      val="$undef"  ;;
6196 esac
6197 set userelocatableinc
6198 eval $setvar
6199
6200 initialinstalllocation="$binexp"
6201 : Default prefix is now "up one level from where the binaries are"
6202 case "$userelocatableinc" in
6203 $define|true|[yY]*)
6204     bin=".../"
6205     binexp=".../"
6206     prefix=".../.."
6207     prefixexp=".../.."
6208     installprefixexp=".../.."
6209     ;;
6210 esac
6211
6212 : determine where private library files go
6213 : Usual default is /usr/local/lib/perl5/$version.
6214 : Also allow things like /opt/perl/lib/$version, since
6215 : /opt/perl/lib/perl5... would be redundant.
6216 : The default "style" setting is made in installstyle.U
6217 case "$installstyle" in
6218 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6219 *)       set dflt privlib lib/$version ;;
6220 esac
6221 eval $prefixit
6222 $cat <<EOM
6223
6224 There are some auxiliary files for $package that need to be put into a
6225 private library directory that is accessible by everyone.
6226
6227 EOM
6228 fn=$binexp
6229 fn=d~+
6230 rp='Pathname where the private library files will reside?'
6231 . ./getfile
6232 prefixvar=privlib
6233 . ./setprefixvar
6234
6235 : set the prefixup variable, to restore leading tilda escape
6236 prefixup='case "$prefixexp" in
6237 "$prefix") ;;
6238 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6239 esac'
6240
6241 : determine where public architecture dependent libraries go
6242 set archlib archlib
6243 eval $prefixit
6244 : privlib default is /usr/local/lib/$package/$version
6245 : archlib default is /usr/local/lib/$package/$version/$archname
6246 : privlib may have an optional trailing /share.
6247 tdflt=`echo $privlib | $sed 's,/share$,,'`
6248 tdflt=$tdflt/$archname
6249 case "$archlib" in
6250 '')     dflt=$tdflt
6251         ;;
6252 *)      dflt="$archlib"
6253     ;;
6254 esac
6255 $cat <<EOM
6256
6257 $spackage contains architecture-dependent library files.  If you are
6258 sharing libraries in a heterogeneous environment, you might store
6259 these files in a separate location.  Otherwise, you can just include
6260 them with the rest of the public library files.
6261
6262 EOM
6263 fn=$binexp
6264 fn=d+~
6265 rp='Where do you want to put the public architecture-dependent libraries?'
6266 . ./getfile
6267 prefixvar=archlib
6268 . ./setprefixvar
6269 if $test X"$archlib" = X"$privlib"; then
6270         d_archlib="$undef"
6271 else
6272         d_archlib="$define"
6273 fi
6274
6275 : see if setuid scripts can be secure
6276 $cat <<EOM
6277
6278 Some kernels have a bug that prevents setuid #! scripts from being
6279 secure.  Some sites have disabled setuid #! scripts because of this.
6280
6281 First let's decide if your kernel supports secure setuid #! scripts.
6282 (If setuid #! scripts would be secure but have been disabled anyway,
6283 don't say that they are secure if asked.)
6284
6285 EOM
6286
6287 val="$undef"
6288 if $test -d /dev/fd; then
6289         echo "#!$ls" >reflect
6290         chmod +x,u+s reflect
6291         ./reflect >flect 2>&1
6292         if $contains "/dev/fd" flect >/dev/null; then
6293                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6294                 val="$define"
6295         else
6296                 $cat <<EOM
6297 If you are not sure if they are secure, I can check but I'll need a
6298 username and password different from the one you are using right now.
6299 If you don't have such a username or don't want me to test, simply
6300 enter 'none'.
6301
6302 EOM
6303                 rp='Other username to test security of setuid scripts with?'
6304                 dflt='none'
6305                 . ./myread
6306                 case "$ans" in
6307                 n|none)
6308                         case "$d_suidsafe" in
6309                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6310                                 dflt=n;;
6311                         "$undef")
6312                                 echo "Well, the $hint value is *not* secure." >&4
6313                                 dflt=n;;
6314                         *)      echo "Well, the $hint value *is* secure." >&4
6315                                 dflt=y;;
6316                         esac
6317                         ;;
6318                 *)
6319                         $rm -f reflect flect
6320                         echo "#!$ls" >reflect
6321                         chmod +x,u+s reflect
6322                         echo >flect
6323                         chmod a+w flect
6324                         echo '"su" will (probably) prompt you for '"$ans's password."
6325                         su $ans -c './reflect >flect'
6326                         if $contains "/dev/fd" flect >/dev/null; then
6327                                 echo "Okay, it looks like setuid scripts are secure." >&4
6328                                 dflt=y
6329                         else
6330                                 echo "I don't think setuid scripts are secure." >&4
6331                                 dflt=n
6332                         fi
6333                         ;;
6334                 esac
6335                 rp='Does your kernel have *secure* setuid scripts?'
6336                 . ./myread
6337                 case "$ans" in
6338                 [yY]*)  val="$define";;
6339                 *)      val="$undef";;
6340                 esac
6341         fi
6342 else
6343         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6344         echo "(That's for file descriptors, not floppy disks.)"
6345         val="$undef"
6346 fi
6347 set d_suidsafe
6348 eval $setvar
6349
6350 $rm -f reflect flect
6351
6352 : now see if they want to do setuid emulation
6353 echo " "
6354 val="$undef"
6355 case "$d_suidsafe" in
6356 "$define")
6357         val="$undef"
6358         echo "No need to emulate SUID scripts since they are secure here." >&4
6359         ;;
6360 *)
6361         $cat <<EOM
6362 Some systems have disabled setuid scripts, especially systems where
6363 setuid scripts cannot be secure.  On systems where setuid scripts have
6364 been disabled, the setuid/setgid bits on scripts are currently
6365 useless.  It is possible for $package to detect those bits and emulate
6366 setuid/setgid in a secure fashion.  This emulation will only work if
6367 setuid scripts have been disabled in your kernel.
6368
6369 EOM
6370         case "$d_dosuid" in
6371         "$define") dflt=y ;;
6372         *) dflt=n ;;
6373         esac
6374         rp="Do you want to do setuid/setgid emulation?"
6375         . ./myread
6376         case "$ans" in
6377         [yY]*)  val="$define";;
6378         *)      val="$undef";;
6379         esac
6380         ;;
6381 esac
6382 set d_dosuid
6383 eval $setvar
6384
6385 : Find perl5.005 or later.
6386 echo "Looking for a previously installed perl5.005 or later... "
6387 case "$perl5" in
6388 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6389                 : Check if this perl is recent and can load a simple module
6390                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6391                         perl5=$tdir/perl
6392                         break;
6393                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6394                         perl5=$tdir/perl5
6395                         break;
6396                 fi
6397         done
6398         ;;
6399 *)      perl5="$perl5"
6400         ;;
6401 esac
6402 case "$perl5" in
6403 '')     echo "None found.  That's ok.";;
6404 *)      echo "Using $perl5." ;;
6405 esac
6406
6407 : Set the siteprefix variables
6408 $cat <<EOM
6409
6410 After $package is installed, you may wish to install various
6411 add-on modules and utilities.  Typically, these add-ons will
6412 be installed under $prefix with the rest
6413 of this package.  However, you may wish to install such add-ons
6414 elsewhere under a different prefix.
6415
6416 If you do not wish to put everything under a single prefix, that's
6417 ok.  You will be prompted for the individual locations; this siteprefix
6418 is only used to suggest the defaults.
6419
6420 The default should be fine for most people.
6421
6422 EOM
6423 fn=d~+
6424 rp='Installation prefix to use for add-on modules and utilities?'
6425 : XXX Here might be another good place for an installstyle setting.
6426 case "$siteprefix" in
6427 '') dflt=$prefix ;;
6428 *)  dflt=$siteprefix ;;
6429 esac
6430 . ./getfile
6431 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6432 oldsiteprefix=''
6433 case "$siteprefix" in
6434 '') ;;
6435 *)      case "$ans" in
6436         "$prefix") ;;
6437         *) oldsiteprefix="$prefix";;
6438         esac
6439         ;;
6440 esac
6441 siteprefix="$ans"
6442 siteprefixexp="$ansexp"
6443
6444 : determine where site specific libraries go.
6445 : Usual default is /usr/local/lib/perl5/site_perl/$version
6446 : The default "style" setting is made in installstyle.U
6447 : XXX No longer works with Prefixit stuff.
6448 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6449 case "$sitelib" in
6450 '') case "$installstyle" in
6451         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6452         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6453         esac
6454         ;;
6455 *)      dflt="$sitelib"
6456         ;;
6457 esac
6458 $cat <<EOM
6459
6460 The installation process will create a directory for
6461 site-specific extensions and modules.  Most users find it convenient
6462 to place all site-specific files in this directory rather than in the
6463 main distribution directory.
6464
6465 EOM
6466 fn=d~+
6467 rp='Pathname for the site-specific library files?'
6468 . ./getfile
6469 prefixvar=sitelib
6470 . ./setprefixvar
6471 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6472
6473 : Determine list of previous versions to include in @INC
6474 $cat > getverlist <<EOPL
6475 #!$perl5 -w
6476 use File::Basename;
6477 \$api_versionstring = "$api_versionstring";
6478 \$version = "$version";
6479 \$stem = "$sitelib_stem";
6480 \$archname = "$archname";
6481 EOPL
6482         $cat >> getverlist <<'EOPL'
6483 # The list found is store twice for each entry: the original name, and
6484 # the binary broken down version as pack "sss", so sorting is easy and
6485 # unambiguous. This will work for all versions that have a maximum of
6486 # three digit groups, separate by '.'s or '_'s. Names are extended with
6487 # ".0.0" to ensure at least three elements for the pack.
6488 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6489
6490 # Can't have leading @ because metaconfig interprets it as a command!
6491 ;@inc_version_list=();
6492 # XXX Redo to do opendir/readdir?
6493 if (-d $stem) {
6494     chdir($stem);
6495     ;@candidates = map {
6496         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6497 }
6498 else {
6499     ;@candidates = ();
6500 }
6501
6502 ($pversion, $aversion, $vsn5005) = map {
6503     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6504 foreach $d (@candidates) {
6505     if ($d->[1] lt $pversion) {
6506         if ($d->[1] ge $aversion) {
6507             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6508         }
6509         elsif ($d->[1] ge $vsn5005) {
6510             unshift(@inc_version_list, grep { -d } $d->[0]);
6511         }
6512     }
6513     else {
6514         # Skip newer version.  I.e. don't look in
6515         # 5.7.0 if we're installing 5.6.1.
6516     }
6517 }
6518
6519 if (@inc_version_list) {
6520     print join(' ', @inc_version_list);
6521 }
6522 else {
6523     # Blank space to preserve value for next Configure run.
6524     print " ";
6525 }
6526 EOPL
6527 chmod +x getverlist
6528 case "$inc_version_list" in
6529 '')     if test -x "$perl5$exe_ext"; then
6530                 dflt=`$perl5 getverlist`
6531         else
6532                 dflt='none'
6533         fi
6534         ;;
6535 $undef) dflt='none' ;;
6536 *)  eval dflt=\"$inc_version_list\" ;;
6537 esac
6538 case "$dflt" in
6539 ''|' ') dflt=none ;;
6540 esac
6541 case "$dflt" in
6542 5.005) dflt=none ;;
6543 esac
6544 $cat <<EOM
6545
6546 In order to ease the process of upgrading, this version of perl
6547 can be configured to use modules built and installed with earlier
6548 versions of perl that were installed under $prefix.  Specify here
6549 the list of earlier versions that this version of perl should check.
6550 If Configure detected no earlier versions of perl installed under
6551 $prefix, then the list will be empty.  Answer 'none' to tell perl
6552 to not search earlier versions.
6553
6554 The default should almost always be sensible, so if you're not sure,
6555 just accept the default.
6556 EOM
6557
6558 rp='List of earlier versions to include in @INC?'
6559 . ./myread
6560 case "$ans" in
6561 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6562 *) inc_version_list="$ans" ;;
6563 esac
6564 case "$inc_version_list" in
6565 ''|' ')
6566         inc_version_list_init='0'
6567         d_inc_version_list="$undef"
6568         ;;
6569 *)      inc_version_list_init=`echo $inc_version_list |
6570                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6571         d_inc_version_list="$define"
6572         ;;
6573 esac
6574 $rm -f getverlist
6575
6576 : see if malloc/malloc.h has to be included
6577 set malloc/malloc.h i_mallocmalloc
6578 eval $inhdr
6579
6580 : see if this is a malloc.h system
6581 : we want a real compile instead of Inhdr because some systems have a
6582 : malloc.h that just gives a compile error saying to use stdlib.h instead
6583 echo " "
6584 $cat >try.c <<EOCP
6585 #include <stdlib.h>
6586 #include <malloc.h>
6587 #$i_mallocmalloc I_MALLOCMALLOC
6588 #ifdef I_MALLOCMALLOC
6589 # include <malloc/malloc.h>
6590 #endif
6591
6592 int main () { return 0; }
6593 EOCP
6594 set try
6595 if eval $compile; then
6596     echo "<malloc.h> found." >&4
6597     val="$define"
6598 else
6599     echo "<malloc.h> NOT found." >&4
6600     val="$undef"
6601 fi
6602 $rm_try
6603 set i_malloc
6604 eval $setvar
6605
6606 : check for void type
6607 echo " "
6608 echo "Checking to see how well your C compiler groks the void type..." >&4
6609 case "$voidflags" in
6610 '')
6611         $cat >try.c <<EOCP
6612 #$i_stdlib I_STDLIB
6613 #ifdef I_STDLIB
6614 #include <stdlib.h>
6615 #endif
6616 #if TRY & 1
6617 void sub() {
6618 #else
6619 sub() {
6620 #endif
6621         extern void moo();      /* function returning void */
6622         void (*goo)();          /* ptr to func returning void */
6623 #if TRY & 8
6624         void *hue;              /* generic ptr */
6625 #endif
6626 #if TRY & 2
6627         void (*foo[10])();
6628 #endif
6629
6630 #if TRY & 4
6631         if(goo == moo) {
6632                 exit(0);
6633         }
6634 #endif
6635         exit(0);
6636 }
6637 int main() { sub(); }
6638 EOCP
6639         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6640                 voidflags=$defvoidused
6641         echo "Good.  It appears to support void to the level $package wants.">&4
6642                 if $contains warning .out >/dev/null 2>&1; then
6643                         echo "However, you might get some warnings that look like this:"
6644                         $cat .out
6645                 fi
6646         else
6647 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6648                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6649                         echo "It supports 1..."
6650                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6651                                 echo "It also supports 2..."
6652                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6653                                         voidflags=7
6654                                         echo "And it supports 4 but not 8 definitely."
6655                                 else
6656                                         echo "It doesn't support 4..."
6657                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6658                                                 voidflags=11
6659                                                 echo "But it supports 8."
6660                                         else
6661                                                 voidflags=3
6662                                                 echo "Neither does it support 8."
6663                                         fi
6664                                 fi
6665                         else
6666                                 echo "It does not support 2..."
6667                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6668                                         voidflags=13
6669                                         echo "But it supports 4 and 8."
6670                                 else
6671                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6672                                                 voidflags=5
6673                                                 echo "And it supports 4 but has not heard about 8."
6674                                         else
6675                                                 echo "However it supports 8 but not 4."
6676                                         fi
6677                                 fi
6678                         fi
6679                 else
6680                         echo "There is no support at all for void."
6681                         voidflags=0
6682                 fi
6683         fi
6684 esac
6685 case "$voidflags" in
6686 "$defvoidused") ;;
6687 *)      $cat >&4 <<'EOM'
6688   Support flag bits are:
6689     1: basic void declarations.
6690     2: arrays of pointers to functions returning void.
6691     4: operations between pointers to and addresses of void functions.
6692     8: generic void pointers.
6693 EOM
6694         dflt="$voidflags";
6695         rp="Your void support flags add up to what?"
6696         . ./myread
6697         voidflags="$ans"
6698         ;;
6699 esac
6700 $rm_try
6701
6702 : check for length of pointer
6703 echo " "
6704 case "$ptrsize" in
6705 '')
6706         echo "Checking to see how big your pointers are..." >&4
6707         if test "$voidflags" -gt 7; then
6708                 echo '#define VOID_PTR char *' > try.c
6709         else
6710                 echo '#define VOID_PTR void *' > try.c
6711         fi
6712         $cat >>try.c <<EOCP
6713 #include <stdio.h>
6714 #$i_stdlib I_STDLIB
6715 #ifdef I_STDLIB
6716 #include <stdlib.h>
6717 #endif
6718 int main()
6719 {
6720     printf("%d\n", (int)sizeof(VOID_PTR));
6721     exit(0);
6722 }
6723 EOCP
6724         set try
6725         if eval $compile_ok; then
6726                 ptrsize=`$run ./try`
6727                 echo "Your pointers are $ptrsize bytes long."
6728         else
6729                 dflt='4'
6730                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6731                 rp="What is the size of a pointer (in bytes)?"
6732                 . ./myread
6733                 ptrsize="$ans"
6734         fi
6735         ;;
6736 esac
6737 $rm_try
6738 case "$use64bitall" in
6739 "$define"|true|[yY]*)
6740         case "$ptrsize" in
6741         4)      cat <<EOM >&4
6742
6743 *** You have chosen a maximally 64-bit build,
6744 *** but your pointers are only 4 bytes wide.
6745 *** Please rerun Configure without -Duse64bitall.
6746 EOM
6747                 case "$d_quad" in
6748                 define)
6749                         cat <<EOM >&4
6750 *** Since you have quads, you could possibly try with -Duse64bitint.
6751 EOM
6752                         ;;
6753                 esac
6754                 cat <<EOM >&4
6755 *** Cannot continue, aborting.
6756
6757 EOM
6758
6759                 exit 1
6760                 ;;
6761         esac
6762         ;;
6763 esac
6764
6765
6766 : determine whether to use malloc wrapping
6767 echo " "
6768 case "$usemallocwrap" in
6769 [yY]*|true|$define)     dflt='y' ;;
6770 [nN]*|false|$undef)     dflt='n' ;;
6771 *)      case "$usedevel" in
6772         [yY]*|true|$define)     dflt='y' ;;
6773         *) dflt='n' ;;
6774         esac
6775         ;;
6776 esac
6777 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6778 . ./myread
6779 usemallocwrap="$ans"
6780 case "$ans" in
6781 y*|true)
6782         usemallocwrap="$define" ;;
6783 *)
6784         usemallocwrap="$undef" ;;
6785 esac
6786
6787 : determine which malloc to compile in
6788 echo " "
6789 case "$usemymalloc" in
6790 [yY]*|true|$define)     dflt='y' ;;
6791 [nN]*|false|$undef)     dflt='n' ;;
6792 *)      case "$ptrsize" in
6793         4) dflt='y' ;;
6794         *) dflt='n' ;;
6795         esac
6796         ;;
6797 esac
6798 rp="Do you wish to attempt to use the malloc that comes with $package?"
6799 . ./myread
6800 usemymalloc="$ans"
6801 case "$ans" in
6802 y*|true)
6803         usemymalloc='y'
6804         mallocsrc='malloc.c'
6805         mallocobj="malloc$_o"
6806         d_mymalloc="$define"
6807         case "$libs" in
6808         *-lmalloc*)
6809                 : Remove malloc from list of libraries to use
6810                 echo "Removing unneeded -lmalloc from library list" >&4
6811                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6812                 shift
6813                 libs="$*"
6814                 echo "libs = $libs" >&4
6815                 ;;
6816         esac
6817         ;;
6818 *)
6819         usemymalloc='n'
6820         mallocsrc=''
6821         mallocobj=''
6822         d_mymalloc="$undef"
6823         ;;
6824 esac
6825
6826 : compute the return types of malloc and free
6827 echo " "
6828 $cat >malloc.c <<END
6829 #$i_malloc I_MALLOC
6830 #$i_stdlib I_STDLIB
6831 #include <stdio.h>
6832 #include <sys/types.h>
6833 #ifdef I_MALLOC
6834 #include <malloc.h>
6835 #endif
6836 #ifdef I_STDLIB
6837 #include <stdlib.h>
6838 #endif
6839 #ifdef TRY_MALLOC
6840 void *malloc();
6841 #endif
6842 #ifdef TRY_FREE
6843 void free();
6844 #endif
6845 END
6846 case "$malloctype" in
6847 '')
6848         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6849                 malloctype='void *'
6850         else
6851                 malloctype='char *'
6852         fi
6853         ;;
6854 esac
6855 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6856
6857 case "$freetype" in
6858 '')
6859         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6860                 freetype='void'
6861         else
6862                 freetype='int'
6863         fi
6864         ;;
6865 esac
6866 echo "Your system uses $freetype free(), it would seem." >&4
6867 $rm -f malloc.[co]
6868 : determine where site specific architecture-dependent libraries go.
6869 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6870 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6871 : sitelib may have an optional trailing /share.
6872 case "$sitearch" in
6873 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6874         dflt="$dflt/$archname"
6875         ;;
6876 *)      dflt="$sitearch"
6877         ;;
6878 esac
6879 set sitearch sitearch none
6880 eval $prefixit
6881 $cat <<EOM
6882
6883 The installation process will also create a directory for
6884 architecture-dependent site-specific extensions and modules.
6885
6886 EOM
6887 fn=d~+
6888 rp='Pathname for the site-specific architecture-dependent library files?'
6889 . ./getfile
6890 prefixvar=sitearch
6891 . ./setprefixvar
6892 if $test X"$sitearch" = X"$sitelib"; then
6893         d_sitearch="$undef"
6894 else
6895         d_sitearch="$define"
6896 fi
6897
6898 : Set the vendorprefix variables
6899 $cat <<EOM
6900
6901 The installation process will also create a directory for
6902 vendor-supplied add-ons.  Vendors who supply perl with their system
6903 may find it convenient to place all vendor-supplied files in this
6904 directory rather than in the main distribution directory.  This will
6905 ease upgrades between binary-compatible maintenance versions of perl.
6906
6907 Of course you may also use these directories in whatever way you see
6908 fit.  For example, you might use them to access modules shared over a
6909 company-wide network.
6910
6911 The default answer should be fine for most people.
6912 This causes further questions about vendor add-ons to be skipped
6913 and no vendor-specific directories will be configured for perl.
6914
6915 EOM
6916 rp='Do you want to configure vendor-specific add-on directories?'
6917 case "$usevendorprefix" in
6918 define|true|[yY]*) dflt=y ;;
6919 *)      : User may have set vendorprefix directly on Configure command line.
6920         case "$vendorprefix" in
6921         ''|' ') dflt=n ;;
6922         *)      dflt=y ;;
6923         esac
6924         ;;
6925 esac
6926 . ./myread
6927 case "$ans" in
6928 [yY]*)  fn=d~+
6929         rp='Installation prefix to use for vendor-supplied add-ons?'
6930         case "$vendorprefix" in
6931         '') dflt='' ;;
6932         *)  dflt=$vendorprefix ;;
6933         esac
6934         . ./getfile
6935         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6936         oldvendorprefix=''
6937         case "$vendorprefix" in
6938         '') ;;
6939         *)      case "$ans" in
6940                 "$prefix") ;;
6941                 *) oldvendorprefix="$prefix";;
6942                 esac
6943                 ;;
6944         esac
6945         usevendorprefix="$define"
6946         vendorprefix="$ans"
6947         vendorprefixexp="$ansexp"
6948         ;;
6949 *)      usevendorprefix="$undef"
6950         vendorprefix=''
6951         vendorprefixexp=''
6952         ;;
6953 esac
6954
6955 : Set the vendorlib variables
6956 case "$vendorprefix" in
6957 '')     d_vendorlib="$undef"
6958         vendorlib=''
6959         vendorlibexp=''
6960         ;;
6961 *)      d_vendorlib="$define"
6962         : determine where vendor-supplied modules go.
6963         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6964         case "$vendorlib" in
6965         '')
6966                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6967                 case "$installstyle" in
6968                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6969                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6970                 esac
6971                 ;;
6972         *)      dflt="$vendorlib"
6973                 ;;
6974         esac
6975         fn=d~+
6976         rp='Pathname for the vendor-supplied library files?'
6977         . ./getfile
6978         vendorlib="$ans"
6979         vendorlibexp="$ansexp"
6980         ;;
6981 esac
6982 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6983 prefixvar=vendorlib
6984 . ./installprefix
6985
6986 : Set the vendorarch variables
6987 case "$vendorprefix" in
6988 '')     d_vendorarch="$undef"
6989         vendorarch=''
6990         vendorarchexp=''
6991         ;;
6992 *)      d_vendorarch="$define"
6993         : determine where vendor-supplied architecture-dependent libraries go.
6994         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6995         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6996         : vendorlib may have an optional trailing /share.
6997         case "$vendorarch" in
6998         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6999                 dflt="$dflt/$archname"
7000                 ;;
7001         *)      dflt="$vendorarch" ;;
7002         esac
7003         fn=d~+
7004         rp='Pathname for vendor-supplied architecture-dependent files?'
7005         . ./getfile
7006         vendorarch="$ans"
7007         vendorarchexp="$ansexp"
7008         ;;
7009 esac
7010 prefixvar=vendorarch
7011 . ./installprefix
7012
7013 : Final catch-all directories to search
7014 $cat <<EOM
7015
7016 Lastly, you can have perl look in other directories for extensions and
7017 modules in addition to those already specified.
7018 These directories will be searched after 
7019         $sitearch 
7020         $sitelib 
7021 EOM
7022 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7023 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7024 echo ' '
7025 case "$otherlibdirs" in
7026 ''|' ') dflt='none' ;;
7027 *)      dflt="$otherlibdirs" ;;
7028 esac
7029 $cat <<EOM
7030 Enter a colon-separated set of extra paths to include in perl's @INC
7031 search path, or enter 'none' for no extra paths.
7032
7033 EOM
7034
7035 rp='Colon-separated list of additional directories for perl to search?'
7036 . ./myread
7037 case "$ans" in
7038 ' '|''|none)    otherlibdirs=' ' ;;     
7039 *)      otherlibdirs="$ans" ;;
7040 esac
7041 case "$otherlibdirs" in
7042 ' ') val=$undef ;;
7043 *)      val=$define ;;
7044 esac
7045 set d_perl_otherlibdirs
7046 eval $setvar
7047
7048 : Cruising for prototypes
7049 echo " "
7050 echo "Checking out function prototypes..." >&4
7051 $cat >prototype.c <<EOCP
7052 #$i_stdlib I_STDLIB
7053 #ifdef I_STDLIB
7054 #include <stdlib.h>
7055 #endif
7056 int main(int argc, char *argv[]) {
7057         exit(0);}
7058 EOCP
7059 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7060         echo "Your C compiler appears to support function prototypes."
7061         val="$define"
7062 else
7063         echo "Your C compiler doesn't seem to understand function prototypes."
7064         val="$undef"
7065 fi
7066 set prototype
7067 eval $setvar
7068 $rm -f prototype*
7069
7070 : Check if ansi2knr is required
7071 case "$prototype" in
7072 "$define") ;;
7073 *)      ansi2knr='ansi2knr'
7074         echo " "
7075         cat <<EOM >&4
7076
7077 $me:  FATAL ERROR:
7078 This version of $package can only be compiled by a compiler that 
7079 understands function prototypes.  Unfortunately, your C compiler 
7080         $cc $ccflags
7081 doesn't seem to understand them.  Sorry about that.
7082
7083 If GNU cc is available for your system, perhaps you could try that instead.  
7084
7085 Eventually, we hope to support building Perl with pre-ANSI compilers.
7086 If you would like to help in that effort, please contact <perlbug@perl.org>.
7087
7088 Aborting Configure now.
7089 EOM
7090         exit 2
7091         ;;
7092 esac
7093
7094 : DTrace support
7095 dflt_dtrace='/usr/sbin/dtrace'
7096 cat <<EOM
7097
7098 Perl can be built to support DTrace on platforms that support it.
7099 DTrace is a diagnosis and performance analysis tool from Sun.
7100
7101 If this doesn't make any sense to you, just accept the default '$dflt'.
7102 EOM
7103
7104 while $test 1 ; do
7105         case "$usedtrace" in
7106         $define|true|[yY]*)
7107                 dflt='y'
7108                 ;;
7109         ?*)
7110                 dflt='y'
7111                 dflt_dtrace=$usedtrace
7112                 ;;
7113         *)
7114                 dflt='n'
7115                 ;;
7116         esac
7117
7118         rp='Support DTrace if available?'
7119         . ./myread
7120         case "$ans" in
7121         y|Y)    val="$define" ;;
7122         *)      val="$undef" ;;
7123         esac
7124         set usedtrace
7125         eval $setvar
7126
7127         test "X$usedtrace" != "X$define" && break
7128
7129         echo " "
7130         rp='Where is the dtrace executable?'
7131         dflt=$dflt_dtrace
7132         . ./getfile
7133         val="$ans"
7134         set dtrace
7135         eval $setvar
7136
7137         if $test -f $dtrace
7138         then
7139                 if $dtrace -h -s ../perldtrace.d \
7140                         -o perldtrace.tmp >/dev/null 2>&1 \
7141                         && rm -f perldtrace.tmp
7142                 then
7143                         echo " "
7144                         echo "Good: your $dtrace knows about the -h flag."
7145                 else
7146                         cat >&2 <<EOM
7147
7148 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7149 ***
7150 *** Your installed dtrace doesn't support the -h switch to compile a D
7151 *** program into a C header. Can't continue.
7152
7153 EOM
7154                         exit 1
7155                 fi
7156                 break;
7157         fi
7158
7159         case "$fastread" in
7160         yes)
7161                 cat >&2 <<EOM
7162
7163 *** $me:  Fatal Error:  $dtrace not found.
7164 *** Can't continue.
7165
7166 EOM
7167                 exit 1
7168                 ;;
7169         *)
7170                 echo "*** $dtrace was not found."
7171                 echo " "
7172                 ;;
7173         esac
7174 done
7175
7176 : See if we want extra modules installed
7177 echo " "
7178 case "$extras" in
7179 '') dflt='n';;
7180 *) dflt='y';;
7181 esac
7182 cat <<EOM
7183 Perl can be built with extra modules or bundles of modules which
7184 will be fetched from the CPAN and installed alongside Perl.
7185
7186 Notice that you will need access to the CPAN; either via the Internet,
7187 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7188 be asked later to configure the CPAN.pm module which will in turn do
7189 the installation of the rest of the extra modules or bundles.)
7190
7191 Notice also that if the modules require any external software such as
7192 libraries and headers (the libz library and the zlib.h header for the
7193 Compress::Zlib module, for example) you MUST have any such software
7194 already installed, this configuration process will NOT install such
7195 things for you.
7196
7197 If this doesn't make any sense to you, just accept the default '$dflt'.
7198 EOM
7199 rp='Install any extra modules (y or n)?'
7200 . ./myread
7201 case "$ans" in
7202 y|Y)
7203         cat <<EOM
7204
7205 Please list any extra modules or bundles to be installed from CPAN,
7206 with spaces between the names.  The names can be in any format the
7207 'install' command of CPAN.pm will understand.  (Answer 'none',
7208 without the quotes, to install no extra modules or bundles.)
7209 EOM
7210         rp='Extras?'
7211         dflt="$extras"
7212         . ./myread
7213         extras="$ans"
7214 esac
7215 case "$extras" in
7216 ''|'none')
7217         val=''
7218         $rm -f ../extras.lst
7219         ;;
7220 *)      echo "(Saving the list of extras for later...)"
7221         echo "$extras" > ../extras.lst
7222         val="'$extras'"
7223         ;;
7224 esac
7225 set extras
7226 eval $setvar
7227 echo " "
7228
7229 : determine where html pages for programs go
7230 set html1dir html1dir none
7231 eval $prefixit
7232 $cat <<EOM
7233
7234 If you wish to install html files for programs in $spackage, indicate
7235 the appropriate directory here.  To skip installing html files,
7236 answer "none".
7237 EOM
7238 case "$html1dir" in
7239 ''|none|$undef|' ') dflt=none ;;
7240 *) dflt=$html1dir ;;
7241 esac
7242 fn=dn+~
7243 rp="Directory for the main $spackage html pages?"
7244 . ./getfile
7245 prefixvar=html1dir
7246 . ./setprefixvar
7247 : Use ' ' for none so value is preserved next time through Configure
7248 $test X"$html1dir" = "X" && html1dir=' '
7249
7250 : determine where html pages for libraries and modules go
7251 set html3dir html3dir none
7252 eval $prefixit
7253 $cat <<EOM
7254
7255 If you wish to install html files for modules associated with $spackage,
7256 indicate the appropriate directory here.  To skip installing html files,
7257 answer "none".
7258 EOM
7259 : There is no obvious default.  If they have specified html1dir, then
7260 : try to key off that, possibly changing .../html1 into .../html3.
7261 case "$html3dir" in
7262 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7263 *) dflt=$html3dir ;;
7264 esac
7265 fn=dn+~
7266 rp="Directory for the $spackage module html pages?"
7267 . ./getfile
7268 prefixvar=html3dir
7269 . ./setprefixvar
7270 : Use ' ' for none so value is preserved next time through Configure
7271 $test X"$html3dir" = "X" && html3dir=' '
7272
7273 : determine whether to install perl also as /usr/bin/perl
7274
7275 echo " "
7276 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7277         $cat <<EOM
7278 Many scripts expect perl to be installed as /usr/bin/perl.
7279
7280 If you want to, I can install the perl you are about to compile
7281 as /usr/bin/perl (in addition to $bin/perl).
7282 EOM
7283         if test -f /usr/bin/perl; then
7284             $cat <<EOM
7285
7286 However, please note that because you already have a /usr/bin/perl,
7287 overwriting that with a new Perl would very probably cause problems.
7288 Therefore I'm assuming you don't want to do that (unless you insist).
7289
7290 EOM
7291             case "$installusrbinperl" in
7292             "$define"|[yY]*)    dflt='y';;
7293             *)                  dflt='n';;
7294             esac
7295         else
7296             $cat <<EOM
7297
7298 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7299
7300 EOM
7301             case "$installusrbinperl" in
7302             "$undef"|[nN]*)     dflt='n';;
7303             *)                  dflt='y';;
7304             esac
7305         fi
7306         rp="Do you want to install perl as /usr/bin/perl?"
7307         . ./myread
7308         case "$ans" in
7309         [yY]*)  val="$define";;
7310         *)      val="$undef" ;;
7311         esac
7312 else
7313         val="$undef"
7314 fi
7315 set installusrbinperl
7316 eval $setvar
7317
7318 : Check if we are using the GNU C library
7319 echo " "
7320 echo "Checking for GNU C Library..." >&4
7321 cat >try.c <<'EOCP'
7322 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7323    alone are insufficient to distinguish different versions, such as
7324    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7325    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7326 */
7327 #include <stdio.h>
7328 int main(void)
7329 {
7330 #ifdef __GLIBC__
7331 #   ifdef __GLIBC_MINOR__
7332 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7333 #           include <gnu/libc-version.h>
7334             printf("%s\n",  gnu_get_libc_version());
7335 #       else
7336             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7337 #       endif
7338 #   else
7339         printf("%d\n",  __GLIBC__);
7340 #   endif
7341     return 0;
7342 #else
7343     return 1;
7344 #endif
7345 }
7346 EOCP
7347 set try
7348 if eval $compile_ok && $run ./try > glibc.ver; then
7349         val="$define"
7350         gnulibc_version=`$cat glibc.ver`
7351         echo "You are using the GNU C Library version $gnulibc_version"
7352 else
7353         val="$undef"
7354         gnulibc_version=''
7355         echo "You are not using the GNU C Library"
7356 fi
7357 $rm_try glibc.ver
7358 set d_gnulibc
7359 eval $setvar
7360
7361 : see if nm is to be used to determine whether a symbol is defined or not
7362 case "$usenm" in
7363 '')
7364         dflt=''
7365         case "$d_gnulibc" in
7366         "$define")
7367                 echo " "
7368                 echo "nm probably won't work on the GNU C Library." >&4
7369                 dflt=n
7370                 ;;
7371         esac
7372         case "$dflt" in
7373         '') 
7374                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7375                         echo " "
7376                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7377                         echo "'nm' won't be sufficient on this sytem." >&4
7378                         dflt=n
7379                 fi
7380                 ;;
7381         esac
7382         case "$dflt" in
7383         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7384                 if $test $dflt -gt 20; then
7385                         dflt=y
7386                 else
7387                         dflt=n
7388                 fi
7389                 ;;
7390         esac
7391         ;;
7392 *)
7393         case "$usenm" in
7394         true|$define) dflt=y;;
7395         *) dflt=n;;
7396         esac
7397         ;;
7398 esac
7399 $cat <<EOM
7400
7401 I can use $nm to extract the symbols from your C libraries. This
7402 is a time consuming task which may generate huge output on the disk (up
7403 to 3 megabytes) but that should make the symbols extraction faster. The
7404 alternative is to skip the 'nm' extraction part and to compile a small
7405 test program instead to determine whether each symbol is present. If
7406 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7407 this may be the best solution.
7408
7409 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7410
7411 EOM
7412 rp="Shall I use $nm to extract C symbols from the libraries?"
7413 . ./myread
7414 case "$ans" in
7415 [Nn]*) usenm=false;;
7416 *) usenm=true;;
7417 esac
7418
7419 runnm=$usenm
7420 case "$reuseval" in
7421 true) runnm=false;;
7422 esac
7423
7424 : nm options which may be necessary
7425 case "$nm_opt" in
7426 '') if $test -f /mach_boot; then
7427                 nm_opt=''       # Mach
7428         elif $test -d /usr/ccs/lib; then
7429                 nm_opt='-p'     # Solaris (and SunOS?)
7430         elif $test -f /dgux; then
7431                 nm_opt='-p'     # DG-UX
7432         elif $test -f /lib64/rld; then
7433                 nm_opt='-p'     # 64-bit Irix
7434         else
7435                 nm_opt=''
7436         fi;;
7437 esac
7438
7439 : nm options which may be necessary for shared libraries but illegal
7440 : for archive libraries.  Thank you, Linux.
7441 case "$nm_so_opt" in
7442 '')     case "$myuname" in
7443         *linux*|gnu*)
7444                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7445                         nm_so_opt='--dynamic'
7446                 fi
7447                 ;;
7448         esac
7449         ;;
7450 esac
7451
7452 : Figure out where the libc is located
7453 case "$runnm" in
7454 true)
7455 : get list of predefined functions in a handy place
7456 echo " "
7457 case "$libc" in
7458 '') libc=unknown
7459         case "$libs" in
7460         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7461         esac
7462         ;;
7463 esac
7464 case "$libs" in
7465 '') ;;
7466 *)  for thislib in $libs; do
7467         case "$thislib" in
7468         -lc|-lc_s)
7469                 : Handle C library specially below.
7470                 ;;
7471         -l*)
7472                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7473                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7474                         :
7475                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7476                         :
7477                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7478                         :
7479                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7480                         :
7481                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7482                         :
7483                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7484                         :
7485                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7486                         :
7487                 else
7488                         try=''
7489                 fi
7490                 libnames="$libnames $try"
7491                 ;;
7492         *) libnames="$libnames $thislib" ;;
7493         esac
7494         done
7495         ;;
7496 esac
7497 xxx=normal
7498 case "$libc" in
7499 unknown)
7500         set /lib/libc.$so
7501         for xxx in $libpth; do
7502                 $test -r $1 || set $xxx/libc.$so
7503                 : The messy sed command sorts on library version numbers.
7504                 $test -r $1 || \
7505                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7506                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7507                                 h
7508                                 s/[0-9][0-9]*/0000&/g
7509                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7510                                 G
7511                                 s/\n/ /' | \
7512                          $sort | $sed -e 's/^.* //'`
7513                 eval set \$$#
7514         done
7515         $test -r $1 || set /usr/ccs/lib/libc.$so
7516         $test -r $1 || set /lib/libsys_s$_a
7517         ;;
7518 *)
7519         set blurfl
7520         ;;
7521 esac
7522 if $test -r "$1"; then
7523         echo "Your (shared) C library seems to be in $1."
7524         libc="$1"
7525 elif $test -r /lib/libc && $test -r /lib/clib; then
7526         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7527         xxx=apollo
7528         libc='/lib/clib /lib/libc'
7529         if $test -r /lib/syslib; then
7530                 echo "(Your math library is in /lib/syslib.)"
7531                 libc="$libc /lib/syslib"
7532         fi
7533 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7534         echo "Your C library seems to be in $libc, as you said before."
7535 elif $test -r $incpath/usr/lib/libc$_a; then
7536         libc=$incpath/usr/lib/libc$_a;
7537         echo "Your C library seems to be in $libc.  That's fine."
7538 elif $test -r /lib/libc$_a; then
7539         libc=/lib/libc$_a;
7540         echo "Your C library seems to be in $libc.  You're normal."
7541 else
7542         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7543                 :
7544         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7545                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7546         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7547                 :
7548         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7549                 :
7550         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7551                 :
7552         else
7553                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7554         fi
7555         if $test -r "$tans"; then
7556                 echo "Your C library seems to be in $tans, of all places."
7557                 libc=$tans
7558         else
7559                 libc='blurfl'
7560         fi
7561 fi
7562 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7563         dflt="$libc"
7564         cat <<EOM
7565
7566 If the guess above is wrong (which it might be if you're using a strange
7567 compiler, or your machine supports multiple models), you can override it here.
7568
7569 EOM
7570 else
7571         dflt=''
7572         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7573         cat >&4 <<EOM
7574 I can't seem to find your C library.  I've looked in the following places:
7575
7576 EOM
7577         $sed 's/^/      /' libpath
7578         cat <<EOM
7579
7580 None of these seems to contain your C library. I need to get its name...
7581
7582 EOM
7583 fi
7584 fn=f
7585 rp='Where is your C library?'
7586 . ./getfile
7587 libc="$ans"
7588
7589 echo " "
7590 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7591 set X `cat libnames`
7592 shift
7593 xxx=files
7594 case $# in 1) xxx=file; esac
7595 echo "Extracting names from the following $xxx for later perusal:" >&4
7596 echo " "
7597 $sed 's/^/      /' libnames >&4
7598 echo " "
7599 $echo $n "This may take a while...$c" >&4
7600
7601 for file in $*; do
7602         case $file in
7603         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7604         *) $nm $nm_opt $file 2>/dev/null;;
7605         esac
7606 done >libc.tmp
7607
7608 $echo $n ".$c"
7609 $grep fprintf libc.tmp > libc.ptf
7610 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7611 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7612 xxx='[ADTSIW]'
7613 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7614         eval $xscan;\
7615         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7616                 eval $xrun
7617 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7618         eval $xscan;\
7619         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7620                 eval $xrun
7621 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7622         eval $xscan;\
7623         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7624                 eval $xrun
7625 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7626         eval $xscan;\
7627         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7628                 eval $xrun
7629 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7630         eval $xscan;\
7631         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7632                 eval $xrun
7633 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7634         eval $xscan;\
7635         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7636                 eval $xrun
7637 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7638                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7639         eval $xscan;\
7640         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7641                 eval $xrun
7642 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7643         eval $xscan;\
7644         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7645                 eval $xrun
7646 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7647         eval $xscan;\
7648         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7649                 eval $xrun
7650 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7651         eval $xscan;\
7652         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7653                 eval $xrun
7654 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7655         eval $xscan;\
7656         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7657                 eval $xrun
7658 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7659         eval $xscan;\
7660         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7661                 eval $xrun
7662 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7663         eval $xscan;\
7664         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7665                 eval $xrun
7666 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7667         eval $xscan;\
7668         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7669                 eval $xrun
7670 else
7671         $nm -p $* 2>/dev/null >libc.tmp
7672         $grep fprintf libc.tmp > libc.ptf
7673         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7674                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7675         then
7676                 nm_opt='-p'
7677                 eval $xrun
7678         else
7679                 echo " "
7680                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7681                 com=''
7682                 if $ar t $libc > libc.tmp && \
7683                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7684                 then
7685                         for thisname in $libnames $libc; do
7686                                 $ar t $thisname >>libc.tmp
7687                         done
7688                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7689                         echo "Ok." >&4
7690                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7691                         for thisname in $libnames $libc; do
7692                                 $ar tv $thisname >>libc.tmp
7693                                 emximp -o tmp.imp $thisname \
7694                                     2>/dev/null && \
7695                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7696                                     < tmp.imp >>libc.tmp
7697                                 $rm -f tmp.imp
7698                         done
7699                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7700                         echo "Ok." >&4
7701                 else
7702                         echo "$ar didn't seem to work right." >&4
7703                         echo "Maybe this is a Cray...trying bld instead..." >&4
7704                         if  bld t $libc | \
7705                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7706                                 $test -s libc.list
7707                         then
7708                                 for thisname in $libnames; do
7709                                         bld t $libnames | \
7710                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7711                                         $ar t $thisname >>libc.tmp
7712                                 done
7713                                 echo "Ok." >&4
7714                         else
7715                                 echo "That didn't work either.  Giving up." >&4
7716                                 exit 1
7717                         fi
7718                 fi
7719         fi
7720 fi
7721 nm_extract="$com"
7722 case "$PASE" in
7723 define)
7724     echo " "
7725     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7726     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7727     ;;
7728 *)  if $test -f /lib/syscalls.exp; then
7729         echo " "
7730         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7731         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7732                 /lib/syscalls.exp >>libc.list
7733     fi
7734     ;;
7735 esac
7736 ;;
7737 esac
7738 $rm -f libnames libpath
7739
7740 : see if dld is available
7741 set dld.h i_dld
7742 eval $inhdr
7743
7744 : Check if we are using C++
7745 echo " "
7746 echo "Checking for C++..." >&4
7747 $cat >try.c <<'EOCP'
7748 #include <stdio.h>
7749 int main(void)
7750 {
7751 #ifdef __cplusplus
7752     return 0;
7753 #else
7754     return 1;
7755 #endif
7756 }
7757 EOCP
7758 set try
7759 if eval $compile_ok && $run ./try; then
7760         val="$define"
7761         echo "You are using a C++ compiler."
7762 else
7763         val="$undef"
7764         echo "You are not using a C++ compiler."
7765 fi
7766 $rm_try cplusplus$$
7767 set d_cplusplus
7768 eval $setvar
7769
7770 : is a C symbol defined?
7771 csym='tlook=$1;
7772 case "$3" in
7773 -v) tf=libc.tmp; tdc="";;
7774 -a) tf=libc.tmp; tdc="[]";;
7775 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7776 esac;
7777 tx=yes;
7778 case "$reuseval-$4" in
7779 true-) ;;
7780 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7781 esac;
7782 case "$tx" in
7783 yes)
7784         tval=false;
7785         case "$d_cplusplus" in
7786                 $define) extern_C=\"C\";;
7787         esac;
7788         if $test "$runnm" = true; then
7789                 if $contains $tlook $tf >/dev/null 2>&1; then
7790                         tval=true;
7791                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7792                         echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7793                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7794                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7795                         $rm_try;
7796                 fi;
7797         else
7798                 echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7799                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7800                 $rm_try;
7801         fi;
7802         ;;
7803 *)
7804         case "$tval" in
7805         $define) tval=true;;
7806         *) tval=false;;
7807         esac;
7808         ;;
7809 esac;
7810 eval "$2=$tval"'
7811
7812 : define an is-in-libc? function
7813 inlibc='echo " "; td=$define; tu=$undef;
7814 sym=$1; var=$2; eval "was=\$$2";
7815 tx=yes;
7816 case "$reuseval$was" in
7817 true) ;;
7818 true*) tx=no;;
7819 esac;
7820 case "$tx" in
7821 yes)
7822         set $sym tres -f;
7823         eval $csym;
7824         case "$tres" in
7825         true)
7826                 echo "$sym() found." >&4;
7827                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7828         *)
7829                 echo "$sym() NOT found." >&4;
7830                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7831         esac;;
7832 *)
7833         case "$was" in
7834         $define) echo "$sym() found." >&4;;
7835         *) echo "$sym() NOT found." >&4;;
7836         esac;;
7837 esac'
7838
7839 : see if dlopen exists
7840 xxx_runnm="$runnm"
7841 xxx_ccflags="$ccflags"
7842 runnm=false
7843 : with g++ one needs -shared to get is-in-libc to work for dlopen
7844 case "$gccversion" in
7845 '')     ;;
7846 *)      case "$d_cplusplus" in
7847         "$define") ccflags="$ccflags -shared" ;;
7848         esac
7849         ;;
7850 esac
7851 set dlopen d_dlopen
7852 eval $inlibc
7853 runnm="$xxx_runnm"
7854 ccflags="$xxx_ccflags"
7855
7856 : see if this is a unistd.h system
7857 set unistd.h i_unistd
7858 eval $inhdr
7859
7860 : determine which dynamic loading, if any, to compile in
7861 echo " "
7862 dldir="ext/DynaLoader"
7863 case "$usedl" in
7864 $define|y|true)
7865         dflt='y'
7866         usedl="$define"
7867         ;;
7868 $undef|n|false)
7869         dflt='n'
7870         usedl="$undef"
7871         ;;
7872 *)
7873         dflt='n'
7874         case "$d_dlopen" in
7875             $define) dflt='y' ;;
7876         esac
7877         case "$i_dld" in
7878             $define) dflt='y' ;;
7879         esac
7880         : Does a dl_xxx.xs file exist for this operating system
7881         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7882         ;;
7883 esac
7884 rp="Do you wish to use dynamic loading?"
7885 . ./myread
7886 usedl="$ans"
7887 case "$ans" in
7888 y*) usedl="$define"
7889         case "$dlsrc" in
7890         '')
7891                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7892                         dflt="$dldir/dl_${osname}.xs"
7893                 elif $test "$d_dlopen" = "$define" ; then
7894                         dflt="$dldir/dl_dlopen.xs"
7895                 elif $test "$i_dld" = "$define" ; then
7896                         dflt="$dldir/dl_dld.xs"
7897                 else
7898                         dflt=''
7899                 fi
7900                 ;;
7901         *)      dflt="$dldir/$dlsrc"
7902                 ;;
7903         esac
7904     echo "The following dynamic loading files are available:"
7905         : Can not go over to $dldir because getfile has path hard-coded in.
7906         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7907         rp="Source file to use for dynamic loading"
7908         fn="fne"
7909         gfpth="$src"
7910         . ./getfile
7911         usedl="$define"
7912         : emulate basename
7913         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7914
7915         $cat << EOM
7916
7917 Some systems may require passing special flags to $cc -c to
7918 compile modules that will be used to create a shared library.
7919 To use no flags, say "none".
7920
7921 EOM
7922     case "$cccdlflags" in
7923     '') case "$gccversion" in
7924                 '') case "$osname" in
7925                         hpux)   dflt='+z' ;;
7926                         next)   dflt='none' ;;
7927                         irix*)  dflt='-KPIC' ;;
7928                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7929                         sunos)  dflt='-pic' ;;
7930                         *)      dflt='none' ;;
7931                     esac
7932                         ;;
7933                 *)  case "$osname" in
7934                         darwin) dflt='none' ;;
7935                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7936                         *)      dflt='-fpic' ;;
7937                     esac ;;
7938             esac ;;
7939         ' ') dflt='none' ;;
7940     *)  dflt="$cccdlflags" ;;
7941     esac
7942     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7943     . ./myread
7944     case "$ans" in
7945     none) cccdlflags=' ' ;;
7946     *) cccdlflags="$ans" ;;
7947     esac
7948
7949     cat << EOM
7950
7951 Some systems use ld to create libraries that can be dynamically loaded,
7952 while other systems (such as those using ELF) use $cc.
7953
7954 EOM
7955         case "$ld" in
7956         '')     $cat >try.c <<EOM
7957 /* Test for whether ELF binaries are produced */
7958 #include <fcntl.h>
7959 #$i_stdlib I_STDLIB
7960 #ifdef I_STDLIB
7961 #include <stdlib.h>
7962 #endif
7963 #$i_unistd I_UNISTD
7964 #ifdef I_UNISTD
7965 #include <unistd.h>
7966 #endif
7967 int main() {
7968         char b[4];
7969         int i = open("a.out",O_RDONLY);
7970         if(i == -1)
7971                 exit(1); /* fail */
7972         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7973                 exit(0); /* succeed (yes, it's ELF) */
7974         else
7975                 exit(1); /* fail */
7976 }
7977 EOM
7978                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7979                         cat <<EOM
7980 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7981 EOM
7982                         dflt="$cc"
7983                 else
7984                         echo "I'll use ld to build dynamic libraries."
7985                         dflt='ld'
7986                 fi
7987                 $rm_try
7988                 ;;
7989         *)      dflt="$ld"
7990                 ;;
7991         esac
7992
7993     rp="What command should be used to create dynamic libraries?"
7994     . ./myread
7995         ld="$ans"
7996
7997     cat << EOM
7998
7999 Some systems may require passing special flags to $ld to create a
8000 library that can be dynamically loaded.  If your ld flags include
8001 -L/other/path options to locate libraries outside your loader's normal
8002 search path, you may need to specify those -L options here as well.  To
8003 use no flags, say "none".
8004
8005 EOM
8006     case "$lddlflags" in
8007     '') case "$osname" in
8008                         beos) dflt='-nostart' ;;
8009                         hpux) dflt='-b';
8010                               case "$gccversion" in
8011                               '') dflt="$dflt +vnocompatwarnings" ;;
8012                               esac
8013                               ;;
8014                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
8015                         next)  dflt='none' ;;
8016                         solaris) dflt='-G' ;;
8017                         sunos) dflt='-assert nodefinitions' ;;
8018                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8019                 *)     dflt='none' ;;
8020                         esac
8021                         ;;
8022     *) dflt="$lddlflags" ;;
8023     esac
8024
8025         : Try to guess additional flags to pick up local libraries.
8026         : Be careful not to append to a plain 'none'
8027         case "$dflt" in
8028         none) dflt='' ;;
8029         esac
8030         for thisflag in $ldflags; do
8031                 case "$thisflag" in
8032                 -L*|-R*|-Wl,-R*)
8033                         case " $dflt " in
8034                         *" $thisflag "*) ;;
8035                         *) dflt="$dflt $thisflag" ;;
8036                         esac
8037                         ;;
8038                 esac
8039         done
8040
8041         case "$dflt" in
8042         ''|' ') dflt='none' ;;
8043         esac
8044
8045         case "$ldflags" in
8046         *-fstack-protector*)
8047             case "$dflt" in
8048                         *-fstack-protector*) ;; # Don't add it again
8049                         *) dflt="$dflt -fstack-protector" ;; 
8050                 esac
8051                 ;;
8052         esac
8053
8054
8055     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8056     . ./myread
8057     case "$ans" in
8058     none) lddlflags=' ' ;;
8059     *) lddlflags="$ans" ;;
8060     esac
8061
8062         cat <<EOM
8063
8064 Some systems may require passing special flags to $cc to indicate that
8065 the resulting executable will use dynamic linking.  To use no flags,
8066 say "none".
8067
8068 EOM
8069     case "$ccdlflags" in
8070     '') case "$osname" in
8071             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8072             next|sunos) dflt='none' ;;
8073             *)          dflt='none' ;;
8074             esac ;;
8075     ' ')  dflt='none' ;;
8076     *)  dflt="$ccdlflags" ;;
8077     esac
8078     rp="Any special flags to pass to $cc to use dynamic linking?"
8079     . ./myread
8080     case "$ans" in
8081     none) ccdlflags=' ' ;;
8082     *) ccdlflags="$ans" ;;
8083     esac
8084     ;;
8085 *)  usedl="$undef"
8086         ld='ld'
8087     dlsrc='dl_none.xs'
8088     lddlflags=''
8089     ccdlflags=''
8090     ;;
8091 esac
8092
8093 : Do we want a shared libperl?
8094 also=''
8095 case "$usedl" in
8096 $undef)
8097         # No dynamic loading being used, so don't bother even to prompt.
8098         useshrplib='false'
8099         ;;
8100 *)      case "$useshrplib" in
8101         '')     case "$osname" in
8102                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
8103                         dflt=y
8104                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8105                         ;;
8106                 next*)
8107                         case "$osvers" in
8108                         4*)     dflt=y
8109                                 also='Building a shared libperl is needed for MAB support.'
8110                                 ;;
8111                         *)      dflt=n
8112                                 ;;
8113                         esac
8114                         ;;
8115                 *)      dflt=n
8116                         ;;
8117                 esac
8118                 ;;
8119         $define|true|[Yy]*)
8120                 dflt=y
8121                 ;;
8122         *)      dflt=n
8123                 ;;
8124         esac
8125         $cat << EOM
8126
8127 The perl executable is normally obtained by linking perlmain.c with
8128 libperl${_a}, any static extensions (usually just DynaLoader), and
8129 any other libraries needed on this system (such as -lm, etc.).  Since
8130 your system supports dynamic loading, it is probably possible to build
8131 a shared libperl.$so.  If you will have more than one executable linked
8132 to libperl.$so, this will significantly reduce the size of each
8133 executable, but it may have a noticeable effect on performance.  The
8134 default is probably sensible for your system.
8135 $also
8136
8137 EOM
8138         rp="Build a shared libperl.$so (y/n)"
8139         . ./myread
8140         case "$ans" in
8141         true|$define|[Yy]*)
8142                 useshrplib='true'  ;;
8143         *)      useshrplib='false' ;;
8144         esac
8145         ;;
8146 esac
8147
8148 case "$useshrplib" in
8149 true)
8150         case "$libperl" in
8151         '')
8152                 # Figure out a good name for libperl.so.  Since it gets stored in
8153                 # a version-specific architecture-dependent library, the version
8154                 # number isn't really that important, except for making cc/ld happy.
8155                 #
8156                 # A name such as libperl.so.10.1
8157                 majmin="libperl.$so.$patchlevel.$subversion"
8158                 # A name such as libperl.so.100
8159                 majonly=`echo $patchlevel $subversion |
8160                         $awk '{printf "%d%02d", $1, $2}'`
8161                 majonly=libperl.$so.$majonly
8162                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8163                 # rely on figuring it out from the naming of libc.
8164                 case "${osname}${osvers}" in
8165                 next4*)
8166                         dflt=libperl.5.$so
8167                         # XXX How handle the --version stuff for MAB?
8168                         ;;
8169                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8170                         dflt=libperl.$so
8171                         ;;
8172                 cygwin*) # ld links now against the dll directly
8173                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8174                         majonly=`echo $patchlevel $subversion |
8175                                 $awk '{printf "%03d%03d", $1, $2}'`
8176                         majonly=cygperl5.$majonly.$so
8177                         dflt=$majmin
8178                         ;;
8179                 *)      # Try to guess based on whether libc has major.minor.
8180                         case "$libc" in
8181                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8182                         *libc.$so.[0-9]*) dflt=$majonly ;;
8183                         *)      dflt=libperl.$so ;;
8184                         esac
8185                         ;;
8186                 esac
8187                 ;;
8188         *)      dflt=$libperl
8189                 ;;
8190         esac
8191         cat << EOM
8192
8193 I need to select a good name for the shared libperl.  If your system uses
8194 library names with major and minor numbers, then you might want something
8195 like $majmin.  Alternatively, if your system uses a single version
8196 number for shared libraries, then you might want to use $majonly.
8197 Or, your system might be quite happy with a simple libperl.$so.
8198
8199 Since the shared libperl will get installed into a version-specific
8200 architecture-dependent directory, the version number of the shared perl
8201 library probably isn't important, so the default should be o.k.
8202
8203 EOM
8204         rp='What name do you want to give to the shared libperl?'
8205         . ./myread
8206         libperl=$ans
8207         echo "Ok, I'll use $libperl"
8208         ;;
8209 *)
8210         libperl="libperl${_a}"
8211         ;;
8212 esac
8213
8214 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8215 case "$shrpdir" in
8216 '') ;;
8217 *)      $cat >&4 <<EOM
8218 WARNING:  Use of the shrpdir variable for the installation location of
8219 the shared $libperl is not supported.  It was never documented and
8220 will not work in this version.  Let me (perlbug@perl.org)
8221 know of any problems this may cause.
8222
8223 EOM
8224         case "$shrpdir" in
8225         "$archlibexp/CORE")
8226                 $cat >&4 <<EOM
8227 But your current setting of $shrpdir is
8228 the default anyway, so it's harmless.
8229 EOM
8230                 ;;
8231         *)
8232                 $cat >&4 <<EOM
8233 Further, your current attempted setting of $shrpdir
8234 conflicts with the value of $archlibexp/CORE
8235 that installperl will use.
8236 EOM
8237                 ;;
8238         esac
8239         ;;
8240 esac
8241
8242 # How will the perl executable find the installed shared $libperl?
8243 # Add $xxx to ccdlflags.
8244 # If we can't figure out a command-line option, use $shrpenv to
8245 # set env LD_RUN_PATH.  The main perl makefile uses this.
8246 shrpdir=$archlibexp/CORE
8247 xxx=''
8248 tmp_shrpenv=''
8249 if "$useshrplib"; then
8250     case "$osname" in
8251         aix)
8252                 # We'll set it in Makefile.SH...
8253                 ;;
8254         solaris)
8255                 xxx="-R $shrpdir"
8256                 ;;
8257         freebsd|netbsd|openbsd|interix|dragonfly)
8258                 xxx="-Wl,-R$shrpdir"
8259                 ;;
8260         bsdos|linux|irix*|dec_osf|gnu*)
8261                 xxx="-Wl,-rpath,$shrpdir"
8262                 ;;
8263         next)
8264                 # next doesn't like the default...
8265                 ;;
8266         beos)
8267                 # beos doesn't like the default, either.
8268                 ;;
8269         hpux*)
8270                 # hpux doesn't like the default, either.
8271                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8272                 ;;
8273         cygwin)
8274                 # cygwin needs only ldlibpth
8275                 ;;
8276         *)
8277                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8278                 ;;
8279         esac
8280         case "$xxx" in
8281         '') ;;
8282         *)
8283                 # Only add $xxx if it isn't already in ccdlflags.
8284                 case " $ccdlflags " in
8285                 *" $xxx "*)     ;;
8286                 *)      ccdlflags="$ccdlflags $xxx"
8287                         cat <<EOM >&4
8288
8289 Adding $xxx to the flags
8290 passed to $ld so that the perl executable will find the
8291 installed shared $libperl.
8292
8293 EOM
8294                         ;;
8295                 esac
8296                 ;;
8297         esac
8298 fi
8299 # Fix ccdlflags in AIX for building external extensions.
8300 # (For building Perl itself bare -bE:perl.exp is needed,
8301 #  Makefile.SH takes care of this.)
8302 case "$osname" in
8303 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8304 esac
8305 # Respect a hint or command-line value.
8306 case "$shrpenv" in
8307 '') shrpenv="$tmp_shrpenv" ;;
8308 esac
8309 case "$ldlibpthname" in
8310 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8311 none)   ldlibpthname='' ;;
8312 esac
8313
8314 : determine where manual pages are on this system
8315 echo " "
8316 case "$sysman" in
8317 '') 
8318         syspath='/usr/share/man/man1 /usr/man/man1'
8319         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8320         syspath="$syspath /usr/man/u_man/man1"
8321         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8322         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8323         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8324         sysman=`./loc . /usr/man/man1 $syspath`
8325         ;;
8326 esac
8327 if $test -d "$sysman"; then
8328         echo "System manual is in $sysman." >&4
8329 else
8330         echo "Could not find manual pages in source form." >&4
8331 fi
8332
8333 : determine where manual pages go
8334 set man1dir man1dir none
8335 eval $prefixit
8336 $cat <<EOM
8337
8338 $spackage has manual pages available in source form.
8339 EOM
8340 case "$nroff" in
8341 nroff)
8342         echo "However, you don't have nroff, so they're probably useless to you."
8343         case "$man1dir" in
8344         '') man1dir="none";;
8345         esac;;
8346 esac
8347 echo "If you don't want the manual sources installed, answer 'none'."
8348 case "$man1dir" in
8349 ' ') dflt=none
8350         ;;
8351 '')
8352         lookpath="$prefixexp/share/man/man1"
8353         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8354         lookpath="$lookpath $prefixexp/man/p_man/man1"
8355         lookpath="$lookpath $prefixexp/man/u_man/man1"
8356         lookpath="$lookpath $prefixexp/man/man.1"
8357         case "$sysman" in
8358         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8359         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8360         esac
8361         set dflt
8362         eval $prefixup
8363         ;;
8364 *)  dflt="$man1dir"
8365         ;;
8366 esac
8367 echo " "
8368 fn=dn+~
8369 rp="Where do the main $spackage manual pages (source) go?"
8370 . ./getfile
8371 if $test "X$man1direxp" != "X$ansexp"; then
8372         installman1dir=''
8373 fi
8374 prefixvar=man1dir
8375 . ./setprefixvar
8376
8377 case "$man1dir" in
8378 '')     man1dir=' '
8379         installman1dir='';;
8380 esac
8381
8382 : What suffix to use on installed man pages
8383
8384 case "$man1dir" in
8385 ' ')
8386         man1ext='0'
8387         ;;
8388 *)
8389         rp="What suffix should be used for the main $spackage man pages?"
8390         case "$man1ext" in
8391         '')     case "$man1dir" in
8392                 *1)  dflt=1 ;;
8393                 *1p) dflt=1p ;;
8394                 *1pm) dflt=1pm ;;
8395                 *l) dflt=l;;
8396                 *n) dflt=n;;
8397                 *o) dflt=o;;
8398                 *p) dflt=p;;
8399                 *C) dflt=C;;
8400                 *L) dflt=L;;
8401                 *L1) dflt=L1;;
8402                 *) dflt=1;;
8403                 esac
8404                 ;;
8405         *)      dflt="$man1ext";;
8406         esac
8407         . ./myread
8408         man1ext="$ans"
8409         ;;
8410 esac
8411
8412 : see if we can have long filenames
8413 echo " "
8414 first=123456789abcdef
8415 $rm -f $first
8416 if (echo hi >$first) 2>/dev/null; then
8417         if $test -f 123456789abcde; then
8418                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8419                 val="$undef"
8420         else
8421                 echo 'You can have filenames longer than 14 characters.'>&4
8422                 val="$define"
8423         fi
8424 else
8425         $cat <<'EOM'
8426 You can't have filenames longer than 14 chars.
8427 You can't even think about them!
8428 EOM
8429         val="$undef"
8430 fi
8431 set d_flexfnam
8432 eval $setvar
8433 $rm -rf 123456789abcde*
8434
8435 : determine where library module manual pages go
8436 set man3dir man3dir none
8437 eval $prefixit
8438 $cat <<EOM
8439
8440 $spackage has manual pages for many of the library modules.
8441 EOM
8442
8443 case "$nroff" in
8444 nroff)
8445         $cat <<'EOM'
8446 However, you don't have nroff, so they're probably useless to you.
8447 EOM
8448         case "$man3dir" in
8449         '') man3dir="none";;
8450         esac;;
8451 esac
8452
8453 case "$d_flexfnam" in
8454 undef)
8455         $cat <<'EOM'
8456 However, your system can't handle the long file names like File::Basename.3.
8457 EOM
8458         case "$man3dir" in
8459         '') man3dir="none";;
8460         esac;;
8461 esac
8462
8463 echo "If you don't want the manual sources installed, answer 'none'."
8464 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8465 case "$man3dir" in
8466 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8467         if $test -d "$privlib/man/man3"; then
8468                 cat <<EOM >&4
8469
8470 WARNING:  Previous versions of perl installed man3 pages into
8471 $privlib/man/man3.  This version will suggest a
8472 new default of $dflt.
8473 EOM
8474                 tdflt=$dflt
8475                 dflt='n'
8476                 rp='Do you wish to preserve the old behavior?(y/n)'
8477                 . ./myread
8478                 case "$ans" in
8479                 y*) dflt="$privlib/man/man3" ;;
8480                 *)  dflt=$tdflt ;;
8481                 esac
8482     fi
8483         ;;
8484 *)      dflt="$man3dir" ;;
8485 esac
8486 case "$dflt" in
8487 ' ') dflt=none ;;
8488 esac
8489 echo " "
8490 fn=dn+~
8491 rp="Where do the $package library man pages (source) go?"
8492 . ./getfile
8493 prefixvar=man3dir
8494 . ./setprefixvar
8495
8496 case "$man3dir" in
8497 '')     man3dir=' '
8498         installman3dir='';;
8499 esac
8500
8501 : What suffix to use on installed man pages
8502 case "$man3dir" in
8503 ' ')
8504         man3ext='0'
8505         ;;
8506 *)
8507         rp="What suffix should be used for the $package library man pages?"
8508         case "$man3ext" in
8509         '')     case "$man3dir" in
8510                 *3)  dflt=3 ;;
8511                 *3p) dflt=3p ;;
8512                 *3pm) dflt=3pm ;;
8513                 *l) dflt=l;;
8514                 *n) dflt=n;;
8515                 *o) dflt=o;;
8516                 *p) dflt=p;;
8517                 *C) dflt=C;;
8518                 *L) dflt=L;;
8519                 *L3) dflt=L3;;
8520                 *) dflt=3;;
8521                 esac
8522                 ;;
8523         *)      dflt="$man3ext";;
8524         esac
8525         . ./myread
8526         man3ext="$ans"
8527         ;;
8528 esac
8529
8530 : see if we have to deal with yellow pages, now NIS.
8531 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8532         if $test -f /usr/etc/nibindd; then
8533                 echo " "
8534                 echo "I'm fairly confident you're on a NeXT."
8535                 echo " "
8536                 rp='Do you get the hosts file via NetInfo?'
8537                 dflt=y
8538                 case "$hostcat" in
8539                 nidump*) ;;
8540                 '') ;;
8541                 *) dflt=n;;
8542                 esac
8543                 . ./myread
8544                 case "$ans" in
8545                 y*) hostcat='nidump hosts .';;
8546                 *)      case "$hostcat" in
8547                         nidump*) hostcat='';;
8548                         esac
8549                         ;;
8550                 esac
8551         fi
8552         case "$hostcat" in
8553         nidump*) ;;
8554         *)
8555                 case "$hostcat" in
8556                 *ypcat*) dflt=y;;
8557                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8558                                 dflt=y
8559                         else
8560                                 dflt=n
8561                         fi;;
8562                 *) dflt=n;;
8563                 esac
8564                 echo " "
8565                 rp='Are you getting the hosts file via yellow pages?'
8566                 . ./myread
8567                 case "$ans" in
8568                 y*) hostcat='ypcat hosts';;
8569                 *) hostcat='cat /etc/hosts';;
8570                 esac
8571                 ;;
8572         esac
8573 fi
8574 case "$hostcat" in
8575 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8576 esac
8577 case "$groupcat" in
8578 '') test -f /etc/group && groupcat='cat /etc/group';;
8579 esac
8580 case "$passcat" in
8581 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8582 esac
8583
8584 : now get the host name
8585 echo " "
8586 echo "Figuring out host name..." >&4
8587 case "$myhostname" in
8588 '') cont=true
8589         echo 'Maybe "hostname" will work...'
8590         if tans=`sh -c hostname 2>&1` ; then
8591                 myhostname=$tans
8592                 phostname=hostname
8593                 cont=''
8594         fi
8595         ;;
8596 *) cont='';;
8597 esac
8598 if $test "$cont"; then
8599         if ./xenix; then
8600                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8601                 if tans=`cat /etc/systemid 2>&1` ; then
8602                         myhostname=$tans
8603                         phostname='cat /etc/systemid'
8604                         echo "Whadyaknow.  Xenix always was a bit strange..."
8605                         cont=''
8606                 fi
8607         elif $test -r /etc/systemid; then
8608                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8609         fi
8610 fi
8611 if $test "$cont"; then
8612         echo 'No, maybe "uuname -l" will work...'
8613         if tans=`sh -c 'uuname -l' 2>&1` ; then
8614                 myhostname=$tans
8615                 phostname='uuname -l'
8616         else
8617                 echo 'Strange.  Maybe "uname -n" will work...'
8618                 if tans=`sh -c 'uname -n' 2>&1` ; then
8619                         myhostname=$tans
8620                         phostname='uname -n'
8621                 else
8622                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8623                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8624                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8625                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8626                         else
8627                                 case "$myhostname" in
8628                                 '') echo "Does this machine have an identity crisis or something?"
8629                                         phostname='';;
8630                                 *)
8631                                         echo "Well, you said $myhostname before..."
8632                                         phostname='echo $myhostname';;
8633                                 esac
8634                         fi
8635                 fi
8636         fi
8637 fi
8638 case "$myhostname" in
8639 '') myhostname=noname ;;
8640 esac
8641 : you do not want to know about this
8642 set $myhostname
8643 myhostname=$1
8644
8645 : verify guess
8646 if $test "$myhostname" ; then
8647         dflt=y
8648         rp='Your host name appears to be "'$myhostname'".'" Right?"
8649         . ./myread
8650         case "$ans" in
8651         y*) ;;
8652         *) myhostname='';;
8653         esac
8654 fi
8655
8656 : bad guess or no guess
8657 while $test "X$myhostname" = X ; do
8658         dflt=''
8659         rp="Please type the (one word) name of your host:"
8660         . ./myread
8661         myhostname="$ans"
8662 done
8663
8664 : translate upper to lower if necessary
8665 case "$myhostname" in
8666 *[A-Z]*)
8667         echo "(Normalizing case in your host name)"
8668         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8669         ;;
8670 esac
8671
8672 case "$myhostname" in
8673 *.*)
8674         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8675         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8676         echo "(Trimming domain name from host name--host name is now $myhostname)"
8677         ;;
8678 *) case "$mydomain" in
8679         '')
8680                 {
8681                         test "X$hostcat" = "Xypcat hosts" &&
8682                         ypmatch "$myhostname" hosts 2>/dev/null |\
8683                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8684                         $test -s hosts
8685                 } || {
8686                         test "X$hostcat" != "X" &&
8687                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8688                                         /[       ]$myhostname[  . ]/p" > hosts
8689                 }
8690                 tmp_re="[       . ]"
8691                 if $test -f hosts; then
8692                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8693                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8694                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8695                                 hosts | $sort | $uniq | \
8696                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8697                         case `$echo X$dflt` in
8698                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8699                                 dflt=.
8700                                 ;;
8701                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8702                                 ;;
8703                         esac
8704                 else
8705                         echo "(I cannot locate a hosts database anywhere)"
8706                         dflt=.
8707                 fi
8708                 case "$dflt" in
8709                 .)
8710                         tans=`./loc resolv.conf X /etc /usr/etc`
8711                         if $test -f "$tans"; then
8712                                 echo "(Attempting domain name extraction from $tans)"
8713                                 dflt=.`$sed -n -e 's/   / /g' \
8714                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8715                                   -e 1q 2>/dev/null`
8716                                 case "$dflt" in
8717                                 .) dflt=.`$sed -n -e 's/        / /g' \
8718                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8719                                      -e 1q 2>/dev/null`
8720                                         ;;
8721                                 esac
8722                         fi
8723                         ;;
8724                 esac
8725                 case "$dflt" in
8726                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8727                         dflt=.`sh -c domainname 2>/dev/null`
8728                         case "$dflt" in
8729                         '') dflt='.';;
8730                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8731                         esac
8732                         ;;
8733                 esac
8734                 case "$dflt$osname" in
8735                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8736                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8737                         ;;
8738                 esac
8739                 case "$dflt" in
8740                 .) echo "(Lost all hope -- silly guess then)"
8741                         dflt='.nonet'
8742                         ;;
8743                 esac
8744                 $rm -f hosts
8745                 ;;
8746         *) dflt="$mydomain";;
8747         esac;;
8748 esac
8749 echo " "
8750 rp="What is your domain name?"
8751 . ./myread
8752 tans="$ans"
8753 case "$ans" in
8754 '') ;;
8755 .*) ;;
8756 *) tans=".$tans";;
8757 esac
8758 mydomain="$tans"
8759
8760 : translate upper to lower if necessary
8761 case "$mydomain" in
8762 *[A-Z]*)
8763         echo "(Normalizing case in your domain name)"
8764         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8765         ;;
8766 esac
8767
8768 : a little sanity check here
8769 case "$phostname" in
8770 '') ;;
8771 *)
8772         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8773         $myhostname$mydomain|$myhostname) ;;
8774         *)
8775                 case "$phostname" in
8776                 sed*)
8777                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8778                         ;;
8779                 *)
8780                         echo "(That doesn't agree with your $phostname command, by the way.)"
8781                         ;;
8782                 esac
8783         ;;
8784         esac
8785         ;;
8786 esac
8787
8788 : determine the e-mail address of the user who is running us
8789 $cat <<EOM
8790
8791 I need to get your e-mail address in Internet format if possible, i.e.
8792 something like user@host.domain. Please answer accurately since I have
8793 no easy means to double check it. The default value provided below
8794 is most probably close to reality but may not be valid from outside
8795 your organization...
8796
8797 EOM
8798 cont=x
8799 while test "$cont"; do
8800         case "$cf_email" in
8801         '') dflt="$cf_by@$myhostname$mydomain";;
8802         *) dflt="$cf_email";;
8803         esac
8804         rp='What is your e-mail address?'
8805         . ./myread
8806         cf_email="$ans"
8807         case "$cf_email" in
8808         *@*.*) cont='' ;;
8809         *)
8810                 rp='Address does not look like an Internet one.  Use it anyway?'
8811                 case "$fastread" in
8812                 yes) dflt=y ;;
8813                 *) dflt=n ;;
8814                 esac
8815                 . ./myread
8816                 case "$ans" in
8817                 y*) cont='' ;;
8818                 *) echo " " ;;
8819                 esac
8820                 ;;
8821         esac
8822 done
8823
8824 : Ask e-mail of administrator
8825 $cat <<EOM
8826
8827 If you or somebody else will be maintaining perl at your site, please
8828 fill in the correct e-mail address here so that they may be contacted
8829 if necessary. Currently, the "perlbug" program included with perl
8830 will send mail to this address in addition to perlbug@perl.org. You may
8831 enter "none" for no administrator.
8832
8833 EOM
8834 case "$perladmin" in
8835 '') dflt="$cf_email";;
8836 *) dflt="$perladmin";;
8837 esac
8838 rp='Perl administrator e-mail address'
8839 . ./myread
8840 perladmin="$ans"
8841
8842 : determine whether to only install version-specific parts.
8843 echo " "
8844 $cat <<EOM
8845 Do you want to install only the version-specific parts of the perl
8846 distribution?  Usually you do *not* want to do this.
8847 EOM
8848 case "$versiononly" in
8849 "$define"|[Yy]*|true) dflt='y' ;;
8850 *) dflt='n';
8851 esac
8852 rp="Do you want to install only the version-specific parts of perl?"
8853 . ./myread
8854 case "$ans" in
8855 [yY]*)  val="$define";;
8856 *)      val="$undef" ;;
8857 esac
8858 set versiononly
8859 eval $setvar
8860
8861 case "$versiononly" in
8862 "$define") inc_version_list=''
8863            inc_version_list_init=0
8864            ;;
8865 esac
8866
8867 : figure out how to guarantee perl startup
8868 : XXX Note that this currently takes advantage of the bug that binexp ignores
8869 :     the Configure -Dinstallprefix setting, which in turn means that under
8870 :     relocatable @INC, initialinstalllocation is what binexp started as.
8871 case "$startperl" in
8872 '')
8873         case "$sharpbang" in
8874         *!)
8875                 $cat <<EOH
8876
8877 I can use the #! construct to start perl on your system. This will
8878 make startup of perl scripts faster, but may cause problems if you
8879 want to share those scripts and perl is not in a standard place
8880 ($initialinstalllocation/perl) on all your platforms. The alternative
8881 is to force a shell by starting the script with a single ':' character.
8882
8883 EOH
8884                 case "$versiononly" in
8885                 "$define")      dflt="$initialinstalllocation/perl$version";;
8886                 *)              dflt="$initialinstalllocation/perl";;
8887                 esac
8888                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8889                 . ./myread
8890                 case "$ans" in
8891                 none)   startperl=": # use perl";;
8892                 *)      startperl="#!$ans"
8893                         if $test 30 -lt `echo "$ans" | wc -c`; then
8894                                 $cat >&4 <<EOM
8895
8896 WARNING:  Some systems limit the #! command to 32 characters.
8897 If you experience difficulty running Perl scripts with #!, try
8898 installing Perl in a directory with a shorter pathname.
8899
8900 EOM
8901                         fi ;;
8902                 esac
8903                 ;;
8904         *) startperl=": # use perl"
8905                 ;;
8906         esac
8907         ;;
8908 esac
8909 echo "I'll use $startperl to start perl scripts."
8910
8911 : figure best path for perl in scripts
8912 case "$perlpath" in
8913 '')
8914         case "$versiononly" in
8915         "$define")      perlpath="$initialinstalllocation/perl$version";;
8916         *)              perlpath="$initialinstalllocation/perl";;
8917         esac
8918         case "$startperl" in
8919         *!*) ;;
8920         *)
8921                 $cat <<EOH
8922
8923 I will use the "eval 'exec'" idiom to start Perl on your system.
8924 I can use the full path of your Perl binary for this purpose, but
8925 doing so may cause problems if you want to share those scripts and
8926 Perl is not always in a standard place ($initialinstalllocation/perl).
8927
8928 EOH
8929                 dflt="$initialinstalllocation/perl"
8930                 rp="What path shall I use in \"eval 'exec'\"?"
8931                 . ./myread
8932                 perlpath="$ans"
8933                 ;;
8934         esac
8935         ;;
8936 esac
8937 case "$startperl" in
8938 *!*)    ;;
8939 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8940 esac
8941
8942 : determine where public executable scripts go
8943 set scriptdir scriptdir
8944 eval $prefixit
8945 case "$scriptdir" in
8946 '')
8947         dflt="$bin"
8948         : guess some guesses
8949         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8950         $test -d /usr/share/bin     && dflt=/usr/share/bin
8951         $test -d /usr/local/script  && dflt=/usr/local/script
8952         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8953         $test -d $prefixexp/script  && dflt=$prefixexp/script
8954         set dflt
8955         eval $prefixup
8956         ;;
8957 *)  dflt="$scriptdir"
8958         ;;
8959 esac
8960 $cat <<EOM
8961
8962 Some installations have a separate directory just for executable scripts so
8963 that they can mount it across multiple architectures but keep the scripts in
8964 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8965 Or you might just lump your scripts in with all your other executables.
8966
8967 EOM
8968 fn=d~
8969 rp='Where do you keep publicly executable scripts?'
8970 . ./getfile
8971 if $test "X$ansexp" != "X$scriptdirexp"; then
8972         installscript=''
8973 fi
8974 installscriptdir=''
8975 prefixvar=scriptdir
8976 . ./setprefixvar
8977 : A little fix up for an irregularly named variable.
8978 installscript="$installscriptdir"
8979
8980 : determine where add-on public executables go
8981 case "$sitebin" in
8982 '')     dflt=$siteprefix/bin ;;
8983 *)      dflt=$sitebin ;;
8984 esac
8985 fn=d~
8986 rp='Pathname where the add-on public executables should be installed?'
8987 . ./getfile
8988 prefixvar=sitebin
8989 . ./setprefixvar
8990
8991 : determine where add-on html pages go
8992 : There is no standard location, so try to copy the previously-selected
8993 : directory structure for the core html pages.
8994 case "$sitehtml1dir" in
8995 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8996 *)     dflt=$sitehtml1dir ;;
8997 esac
8998 case "$dflt" in
8999 ''|' ') dflt=none ;;
9000 esac
9001 fn=dn+~
9002 rp='Pathname where the site-specific html pages should be installed?'
9003 . ./getfile
9004 prefixvar=sitehtml1dir
9005 . ./setprefixvar
9006
9007 : determine where add-on library html pages go
9008 : There is no standard location, so try to copy the previously-selected
9009 : directory structure for the core html pages.
9010 case "$sitehtml3dir" in
9011 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9012 *)     dflt=$sitehtml3dir ;;
9013 esac
9014 case "$dflt" in
9015 ''|' ') dflt=none ;;
9016 esac
9017 fn=dn+~
9018 rp='Pathname where the site-specific library html pages should be installed?'
9019 . ./getfile
9020 prefixvar=sitehtml3dir
9021 . ./setprefixvar
9022
9023 : determine where add-on manual pages go
9024 case "$siteman1dir" in
9025 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9026 *)      dflt=$siteman1dir ;;
9027 esac
9028 case "$dflt" in
9029 ''|' ') dflt=none ;;
9030 esac
9031 fn=dn+~
9032 rp='Pathname where the site-specific manual pages should be installed?'
9033 . ./getfile
9034 prefixvar=siteman1dir
9035 . ./setprefixvar
9036
9037 : determine where add-on library man pages go
9038 case "$siteman3dir" in
9039 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9040 *)      dflt=$siteman3dir ;;
9041 esac
9042 case "$dflt" in
9043 ''|' ') dflt=none ;;
9044 esac
9045 fn=dn+~
9046 rp='Pathname where the site-specific library manual pages should be installed?'
9047 . ./getfile
9048 prefixvar=siteman3dir
9049 . ./setprefixvar
9050
9051 : determine where add-on public executable scripts go
9052 case "$sitescript" in
9053 '')     dflt=$siteprefix/script
9054         $test -d $dflt || dflt=$sitebin ;;
9055 *)  dflt="$sitescript" ;;
9056 esac
9057 fn=d~+
9058 rp='Pathname where add-on public executable scripts should be installed?'
9059 . ./getfile
9060 prefixvar=sitescript
9061 . ./setprefixvar
9062
9063 : Check if faststdio is requested and available
9064 case "$usefaststdio" in
9065 $define|true|[yY]*|'')
9066         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9067         case "$xversion" in
9068         [68])   dflt='y' ;;
9069         *)      dflt='n' ;;
9070         esac
9071         ;;
9072 *) dflt='n';;
9073 esac
9074 cat <<EOM
9075
9076 Perl can be built to use 'fast stdio', which means using the stdio
9077 library but also directly manipulating the stdio buffers to enable
9078 faster I/O.  Using stdio is better for backward compatibility (especially
9079 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9080 interface has been preferred instead of stdio.
9081
9082 If this doesn't make any sense to you, just accept the default '$dflt'.
9083 EOM
9084 rp='Use the "fast stdio" if available?'
9085 . ./myread
9086 case "$ans" in
9087 y|Y)    val="$define" ;;
9088 *)      val="$undef" ;;
9089 esac
9090 set usefaststdio
9091 eval $setvar
9092
9093
9094 : define an is-a-typedef? function
9095 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9096 case "$inclist" in
9097 "") inclist="sys/types.h";;
9098 esac;
9099 eval "varval=\$$var";
9100 case "$varval" in
9101 "")
9102         $rm -f temp.c;
9103         for inc in $inclist; do
9104                 echo "#include <$inc>" >>temp.c;
9105         done;
9106         echo "#ifdef $type" >> temp.c;
9107         echo "printf(\"We have $type\");" >> temp.c;
9108         echo "#endif" >> temp.c;
9109         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9110         if $contains $type temp.E >/dev/null 2>&1; then
9111                 eval "$var=\$type";
9112         else
9113                 eval "$var=\$def";
9114         fi;
9115         $rm -f temp.?;;
9116 *) eval "$var=\$varval";;
9117 esac'
9118
9119 : define an is-a-typedef? function that prompts if the type is not available.
9120 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9121 case "$inclist" in
9122 "") inclist="sys/types.h";;
9123 esac;
9124 eval "varval=\$$var";
9125 case "$varval" in
9126 "")
9127         $rm -f temp.c;
9128         for inc in $inclist; do
9129                 echo "#include <$inc>" >>temp.c;
9130         done;
9131         echo "#ifdef $type" >> temp.c;
9132         echo "printf(\"We have $type\");" >> temp.c;
9133         echo "#endif" >> temp.c;
9134         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9135         echo " " ;
9136         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9137         if $contains $type temp.E >/dev/null 2>&1; then
9138                 echo "$type found." >&4;
9139                 eval "$var=\$type";
9140         else
9141                 echo "$type NOT found." >&4;
9142                 dflt="$def";
9143                 . ./myread ;
9144                 eval "$var=\$ans";
9145         fi;
9146         $rm -f temp.?;;
9147 *) eval "$var=\$varval";;
9148 esac'
9149
9150 : see what type lseek is declared as in the kernel
9151 rp="What is the type used for lseek's offset on this system?"
9152 set off_t lseektype long stdio.h sys/types.h
9153 eval $typedef_ask
9154
9155 echo " "
9156 echo "Checking to see how big your file offsets are..." >&4
9157 $cat >try.c <<EOCP
9158 #include <sys/types.h>
9159 #include <stdio.h>
9160 int main()
9161 {
9162     printf("%d\n", (int)sizeof($lseektype));
9163     return(0);
9164 }
9165 EOCP
9166 set try
9167 if eval $compile_ok; then
9168         lseeksize=`$run ./try`
9169         echo "Your file offsets are $lseeksize bytes long."
9170 else
9171         dflt=$longsize
9172         echo " "
9173         echo "(I can't seem to compile the test program.  Guessing...)"
9174         rp="What is the size of your file offsets (in bytes)?"
9175         . ./myread
9176         lseeksize="$ans"
9177 fi
9178 $rm_try
9179
9180 : see what type file positions are declared as in the library
9181 rp="What is the type for file position used by fsetpos()?"
9182 set fpos_t fpostype long stdio.h sys/types.h
9183 eval $typedef_ask
9184
9185 : Check size for Fpos_t
9186 echo " "
9187 case "$fpostype" in
9188 *_t) zzz="$fpostype"    ;;
9189 *)   zzz="fpos_t"       ;;
9190 esac
9191 echo "Checking the size of $zzz..." >&4
9192 cat > try.c <<EOCP
9193 #include <sys/types.h>
9194 #include <stdio.h>
9195 #$i_stdlib I_STDLIB
9196 #ifdef I_STDLIB
9197 #include <stdlib.h>
9198 #endif
9199 int main() {
9200     printf("%d\n", (int)sizeof($fpostype));
9201     exit(0);
9202 }
9203 EOCP
9204 set try
9205 if eval $compile_ok; then
9206         yyy=`$run ./try`
9207         case "$yyy" in
9208         '')     fpossize=4
9209                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9210                 ;;
9211         *)      fpossize=$yyy
9212                 echo "Your $zzz is $fpossize bytes long."
9213                 ;;
9214         esac
9215 else
9216         dflt="$longsize"
9217         echo " " >&4
9218         echo "(I can't compile the test program.  Guessing...)" >&4
9219         rp="What is the size of your file positions (in bytes)?"
9220         . ./myread
9221         fpossize="$ans"
9222 fi
9223
9224 : Check for large file support
9225 # Backward compatibility (uselfs is deprecated).
9226 case "$uselfs" in
9227 "$define"|true|[yY]*)
9228         cat <<EOM >&4
9229
9230 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9231 EOM
9232         uselargefiles="$define"
9233         ;;
9234 esac
9235
9236 case "$lseeksize:$fpossize" in
9237 8:8) cat <<EOM
9238
9239 You can have files larger than 2 gigabytes.
9240 EOM
9241    val="$define" ;;
9242 *)    case "$uselargefiles" in
9243    "$undef"|false|[nN]*) dflt='n' ;;
9244    *)   dflt='y' ;;
9245    esac
9246    cat <<EOM
9247
9248 Perl can be built to understand large files (files larger than 2 gigabytes)
9249 on some systems.  To do so, Configure can be run with -Duselargefiles.
9250
9251 If this doesn't make any sense to you, just accept the default '$dflt'.
9252 EOM
9253    rp='Try to understand large files, if available?'
9254    . ./myread
9255    case "$ans" in
9256    y|Y)         val="$define" ;;
9257    *)           val="$undef"  ;;
9258    esac
9259    ;;
9260 esac
9261 set uselargefiles
9262 eval $setvar
9263 : Look for a hint-file generated 'call-back-unit'.  If the
9264 : user has specified that a large files perl is to be built,
9265 : we may need to set or change some other defaults.
9266 if $test -f uselargefiles.cbu; then
9267         echo "Your platform has some specific hints regarding large file builds, using them..."
9268         . ./uselargefiles.cbu
9269 fi
9270 case "$uselargefiles" in
9271 "$define")
9272         if $test -f uselargefiles.cbu; then
9273                 echo " "
9274                 echo "Rechecking to see how big your file offsets are..." >&4
9275                 $cat >try.c <<EOCP
9276 #include <sys/types.h>
9277 #include <stdio.h>
9278 int main()
9279 {
9280     printf("%d\n", (int)sizeof($lseektype));
9281     return(0);
9282 }
9283 EOCP
9284                 set try
9285                 if eval $compile_ok; then
9286                         lseeksize=`$run ./try`
9287                         $echo "Your file offsets are now $lseeksize bytes long."
9288                 else
9289                         dflt="$lseeksize"
9290                         echo " "
9291                         echo "(I can't seem to compile the test program.  Guessing...)"
9292                         rp="What is the size of your file offsets (in bytes)?"
9293                         . ./myread
9294                         lseeksize="$ans"
9295                 fi
9296                 case "$fpostype" in
9297                 *_t) zzz="$fpostype"    ;;
9298                 *)   zzz="fpos_t"       ;;
9299                 esac
9300                 $echo $n "Rechecking the size of $zzz...$c" >&4
9301                 $cat > try.c <<EOCP
9302 #include <sys/types.h>
9303 #include <stdio.h>
9304 #$i_stdlib I_STDLIB
9305 #ifdef I_STDLIB
9306 #include <stdlib.h>
9307 #endif
9308 int main() {
9309     printf("%d\n", (int)sizeof($fpostype));
9310     return(0);
9311 }
9312 EOCP
9313                 set try
9314                 if eval $compile_ok; then
9315                         yyy=`$run ./try`
9316                         dflt="$lseeksize"
9317                         case "$yyy" in
9318                         '')     echo " "
9319                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9320                                 ;;
9321                         *)      fpossize=$yyy
9322                                 echo " $fpossize bytes." >&4
9323                                 ;;
9324                         esac
9325                 else
9326                         dflt="$fpossize"
9327                         echo " "
9328                         echo "(I can't compile the test program.  Guessing...)" >&4
9329                         rp="What is the size of your file positions (in bytes)?"
9330                         . ./myread
9331                         fpossize="$ans"
9332                 fi
9333                 $rm_try
9334         fi
9335         ;;
9336 esac
9337
9338 : Set the vendorbin variables
9339 case "$vendorprefix" in
9340 '')     d_vendorbin="$undef"
9341         vendorbin=''
9342         vendorbinexp=''
9343         ;;
9344 *)      d_vendorbin="$define"
9345         : determine where vendor-supplied executables go.
9346         case "$vendorbin" in
9347         '') dflt=$vendorprefix/bin ;;
9348         *)      dflt="$vendorbin" ;;
9349         esac
9350         fn=d~+
9351         rp='Pathname for the vendor-supplied executables directory?'
9352         . ./getfile
9353         vendorbin="$ans"
9354         vendorbinexp="$ansexp"
9355         ;;
9356 esac
9357 prefixvar=vendorbin
9358 . ./installprefix
9359
9360 : Set the vendorhtml1dir variables
9361 case "$vendorprefix" in
9362 '')     vendorhtml1dir=''
9363         vendorhtml1direxp=''
9364         ;;
9365 *)      : determine where vendor-supplied html pages go.
9366         : There is no standard location, so try to copy the previously-selected
9367         : directory structure for the core html pages.
9368         : XXX Better default suggestions would be welcome.
9369         case "$vendorhtml1dir" in
9370         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9371         *)      dflt=$vendorhtml1dir ;;
9372         esac
9373         case "$dflt" in
9374         ''|' ') dflt=none ;;
9375         esac
9376         fn=dn+~
9377         rp='Pathname for the vendor-supplied html pages?'
9378         . ./getfile
9379         vendorhtml1dir="$ans"
9380         vendorhtml1direxp="$ansexp"
9381         ;;
9382 esac
9383 : Use ' ' for none so value is preserved next time through Configure
9384 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9385 prefixvar=vendorhtml1dir
9386 . ./installprefix
9387
9388 : Set the vendorhtml3dir variables
9389 case "$vendorprefix" in
9390 '')     vendorhtml3dir=''
9391         vendorhtml3direxp=''
9392         ;;
9393 *)      : determine where vendor-supplied module html pages go.
9394         : There is no standard location, so try to copy the previously-selected
9395         : directory structure for the core html pages.
9396         : XXX Better default suggestions would be welcome.
9397         case "$vendorhtml3dir" in
9398         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9399         *)      dflt=$vendorhtml3dir ;;
9400         esac
9401         case "$dflt" in
9402         ''|' ') dflt=none ;;
9403         esac
9404         fn=dn+~
9405         rp='Pathname for the vendor-supplied html pages?'
9406         . ./getfile
9407         vendorhtml3dir="$ans"
9408         vendorhtml3direxp="$ansexp"
9409         ;;
9410 esac
9411 : Use ' ' for none so value is preserved next time through Configure
9412 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9413 prefixvar=vendorhtml3dir
9414 . ./installprefix
9415
9416 : Set the vendorman1dir variables
9417 case "$vendorprefix" in
9418 '')     vendorman1dir=''
9419         vendorman1direxp=''
9420         ;;
9421 *)      : determine where vendor-supplied manual pages go.
9422         case "$vendorman1dir" in
9423         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9424         *)      dflt=$vendorman1dir ;;
9425         esac
9426         case "$dflt" in
9427         ''|' ') dflt=none ;;
9428         esac
9429         fn=nd~+
9430         rp='Pathname for the vendor-supplied manual section 1 pages?'
9431         . ./getfile
9432         vendorman1dir="$ans"
9433         vendorman1direxp="$ansexp"
9434         ;;
9435 esac
9436 : Use ' ' for none so value is preserved next time through Configure
9437 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9438 prefixvar=vendorman1dir
9439 . ./installprefix
9440
9441 : Set the vendorman3dir variables
9442 case "$vendorprefix" in
9443 '')     vendorman3dir=''
9444         vendorman3direxp=''
9445         ;;
9446 *)      : determine where vendor-supplied module manual pages go.
9447         case "$vendorman3dir" in
9448         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9449         *)      dflt=$vendorman3dir ;;
9450         esac
9451         case "$dflt" in
9452         ''|' ') dflt=none ;;
9453         esac
9454         fn=nd~+
9455         rp='Pathname for the vendor-supplied manual section 3 pages?'
9456         . ./getfile
9457         vendorman3dir="$ans"
9458         vendorman3direxp="$ansexp"
9459         ;;
9460 esac
9461 : Use ' ' for none so value is preserved next time through Configure
9462 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9463 prefixvar=vendorman3dir
9464 . ./installprefix
9465
9466 : Set the vendorscript variables
9467 case "$vendorprefix" in
9468 '')     d_vendorscript="$undef"
9469         vendorscript=''
9470         vendorscriptexp=''
9471         ;;
9472 *)      d_vendorscript="$define"
9473         : determine where vendor-supplied scripts go.
9474         case "$vendorscript" in
9475         '')     dflt=$vendorprefix/script
9476                 $test -d $dflt || dflt=$vendorbin ;;
9477         *)  dflt="$vendorscript" ;;
9478         esac
9479         $cat <<EOM
9480
9481 The installation process will create a directory for
9482 vendor-supplied scripts.
9483
9484 EOM
9485         fn=d~+
9486         rp='Pathname for the vendor-supplied scripts directory?'
9487         . ./getfile
9488         vendorscript="$ans"
9489         vendorscriptexp="$ansexp"
9490         ;;
9491 esac
9492 prefixvar=vendorscript
9493 . ./installprefix
9494
9495 : see if qgcvt exists
9496 set qgcvt d_qgcvt
9497 eval $inlibc
9498
9499 : Check print/scan long double stuff
9500 echo " "
9501
9502 if $test X"$d_longdbl" = X"$define"; then
9503
9504 echo "Checking how to print long doubles..." >&4
9505
9506 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9507         $cat >try.c <<'EOCP'
9508 #include <sys/types.h>
9509 #include <stdio.h>
9510 int main() {
9511   double d = 123.456;
9512   printf("%.3f\n", d);
9513 }
9514 EOCP
9515         set try
9516         if eval $compile; then
9517                 yyy=`$run ./try`
9518                 case "$yyy" in
9519                 123.456)
9520                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9521                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9522                         echo "We will use %f."
9523                         ;;
9524                 esac
9525         fi
9526 fi
9527
9528 if $test X"$sPRIfldbl" = X; then
9529         $cat >try.c <<'EOCP'
9530 #include <sys/types.h>
9531 #include <stdio.h>
9532 int main() {
9533   long double d = 123.456;
9534   printf("%.3Lf\n", d);
9535 }
9536 EOCP
9537         set try
9538         if eval $compile; then
9539                 yyy=`$run ./try`
9540                 case "$yyy" in
9541                 123.456)
9542                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9543                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9544                         echo "We will use %Lf."
9545                         ;;
9546                 esac
9547         fi
9548 fi
9549
9550 if $test X"$sPRIfldbl" = X; then
9551         $cat >try.c <<'EOCP'
9552 #include <sys/types.h>
9553 #include <stdio.h>
9554 int main() {
9555   long double d = 123.456;
9556   printf("%.3llf\n", d);
9557 }
9558 EOCP
9559         set try
9560         if eval $compile; then
9561                 yyy=`$run ./try`
9562                 case "$yyy" in
9563                 123.456)
9564                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9565                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9566                         echo "We will use %llf."
9567                         ;;
9568                 esac
9569         fi
9570 fi
9571
9572 if $test X"$sPRIfldbl" = X; then
9573         $cat >try.c <<'EOCP'
9574 #include <sys/types.h>
9575 #include <stdio.h>
9576 int main() {
9577   long double d = 123.456;
9578   printf("%.3lf\n", d);
9579 }
9580 EOCP
9581         set try
9582         if eval $compile; then
9583                 yyy=`$run ./try`
9584                 case "$yyy" in
9585                 123.456)
9586                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9587                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9588                         echo "We will use %lf."
9589                         ;;
9590                 esac
9591         fi
9592 fi
9593
9594 if $test X"$sPRIfldbl" = X; then
9595         echo "Cannot figure out how to print long doubles." >&4
9596 else
9597         sSCNfldbl=$sPRIfldbl    # expect consistency
9598 fi
9599
9600 $rm_try
9601
9602 fi # d_longdbl
9603
9604 case "$sPRIfldbl" in
9605 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9606         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9607         d_SCNfldbl="$undef";
9608         ;;
9609 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9610         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9611         d_SCNfldbl="$define";
9612         ;;
9613 esac
9614
9615 : Check how to convert floats to strings.
9616
9617 if test "X$d_Gconvert" = X; then
9618
9619 echo " "
9620 echo "Checking for an efficient way to convert floats to strings."
9621 echo " " > try.c
9622 case "$uselongdouble" in
9623 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9624 esac
9625 case "$d_longdbl" in
9626 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9627 esac
9628 case "$d_PRIgldbl" in
9629 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9630 esac
9631 $cat >>try.c <<EOP
9632 #ifdef TRY_gconvert
9633 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9634 char *myname = "gconvert";
9635 #endif
9636 #ifdef TRY_gcvt
9637 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9638 char *myname = "gcvt";
9639 #endif
9640 #ifdef TRY_qgcvt
9641 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9642 char *myname = "qgcvt";
9643 #define DOUBLETYPE long double
9644 #endif
9645 #ifdef TRY_sprintf
9646 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9647 #ifdef HAS_PRIgldbl
9648 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9649 #else
9650 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9651 #endif
9652 #else
9653 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9654 #endif
9655 char *myname = "sprintf";
9656 #endif
9657
9658 #ifndef DOUBLETYPE
9659 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9660 #define DOUBLETYPE long double
9661 #else
9662 #define DOUBLETYPE double
9663 #endif
9664 #endif
9665
9666 #include <stdio.h>
9667
9668 #define I_STDLIB $i_stdlib
9669 #ifdef I_STDLIB
9670 #include <stdlib.h>
9671 #endif
9672
9673 int
9674 checkit(expect, got)
9675 char *expect;
9676 char *got;
9677 {
9678     if (strcmp(expect, got)) {
9679                 printf("%s oddity:  Expected %s, got %s\n",
9680                         myname, expect, got);
9681                 exit(1);
9682         }
9683 }
9684
9685 int main()
9686 {
9687         char buf[64];
9688         buf[63] = '\0';
9689
9690         /* This must be 1st test on (which?) platform */
9691         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9692         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9693         checkit("0.1", buf);
9694
9695         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9696         checkit("0.01", buf);
9697
9698         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9699         checkit("0.001", buf);
9700
9701         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9702         checkit("0.0001", buf);
9703
9704         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9705         if (strlen(buf) > 5)
9706             checkit("9e-005", buf); /* for Microsoft ?? */
9707         else
9708             checkit("9e-05", buf);
9709
9710         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9711         checkit("1", buf);
9712
9713         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9714         checkit("1.1", buf);
9715
9716         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9717         checkit("1.01", buf);
9718
9719         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9720         checkit("1.001", buf);
9721
9722         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9723         checkit("1.0001", buf);
9724
9725         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9726         checkit("1.00001", buf);
9727
9728         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9729         checkit("1.000001", buf);
9730
9731         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9732         checkit("0", buf);
9733
9734         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9735         checkit("-1", buf);
9736
9737         /* Some Linux gcvt's give 1.e+5 here. */
9738         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9739         checkit("100000", buf);
9740
9741         /* Some Linux gcvt's give -1.e+5 here. */
9742         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9743         checkit("-100000", buf);
9744
9745         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9746         checkit("123.456", buf);
9747
9748         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9749         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9750         /* 34 should be enough to scare even long double
9751          * places into using the e notation. */
9752         if (strlen(buf) > 5)
9753             checkit("1e+034", buf); /* for Microsoft */
9754         else
9755             checkit("1e+34", buf);
9756
9757         /* For Perl, if you add additional tests here, also add them to
9758          * t/base/num.t for benefit of platforms not using Configure or
9759          * overriding d_Gconvert */
9760
9761         exit(0);
9762 }
9763 EOP
9764 : first add preferred functions to our list
9765 xxx_list=""
9766 for xxx_convert in $gconvert_preference; do
9767     case $xxx_convert in
9768     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9769     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9770     esac
9771 done
9772 : then add any others
9773 for xxx_convert in gconvert gcvt sprintf; do
9774     case "$xxx_list" in
9775     *$xxx_convert*) ;;
9776     *) xxx_list="$xxx_list $xxx_convert" ;;
9777     esac
9778 done
9779
9780 case "$d_longdbl$uselongdouble" in
9781 "$define$define")
9782     : again, add prefered functions to our list first
9783     xxx_ld_list=""
9784     for xxx_convert in $gconvert_ld_preference; do
9785         case $xxx_convert in
9786         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9787         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9788         esac
9789     done
9790     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9791     for xxx_convert in qgcvt sprintf $xxx_list; do
9792         case "$xxx_ld_list" in
9793         $xxx_convert*|*" $xxx_convert"*) ;;
9794         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9795         esac
9796     done
9797     : if sprintf cannot do long doubles, move it to the end
9798     if test "$d_PRIgldbl" != "$define"; then
9799         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9800     fi
9801     : if no qgcvt, remove it
9802     if test "$d_qgcvt" != "$define"; then
9803         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9804     fi
9805     : use the ld_list
9806     xxx_list="$xxx_ld_list"
9807     ;;
9808 esac
9809
9810 for xxx_convert in $xxx_list; do
9811         echo "Trying $xxx_convert..."
9812         $rm -f try try$_o core
9813         set try -DTRY_$xxx_convert
9814         if eval $compile; then
9815                 echo "$xxx_convert() found." >&4
9816                 if $run ./try; then
9817                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9818                         break;
9819                 else
9820                         echo "...But $xxx_convert didn't work as I expected."
9821                         xxx_convert=''
9822                 fi
9823         else
9824                 echo "$xxx_convert NOT found." >&4
9825         fi
9826 done
9827
9828 if test X$xxx_convert = X; then
9829     echo "*** WHOA THERE!!! ***" >&4
9830     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9831     xxx_convert=sprintf
9832 fi
9833
9834 case "$xxx_convert" in
9835 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9836 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9837 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9838 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9839    "$define$define$define")
9840       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9841    "$define$define$undef")
9842       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9843    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9844    esac
9845    ;;
9846 esac
9847
9848 fi
9849 $rm_try
9850
9851 : see if _fwalk exists
9852 set fwalk d__fwalk
9853 eval $inlibc
9854
9855 : Initialize h_fcntl
9856 h_fcntl=false
9857
9858 : Initialize h_sysfile
9859 h_sysfile=false
9860
9861 : access call always available on UNIX
9862 set access d_access
9863 eval $inlibc
9864
9865 : locate the flags for 'access()'
9866 case "$d_access" in
9867 "$define")
9868         echo " "
9869         $cat >access.c <<EOCP
9870 #include <sys/types.h>
9871 #ifdef I_FCNTL
9872 #include <fcntl.h>
9873 #endif
9874 #ifdef I_SYS_FILE
9875 #include <sys/file.h>
9876 #endif
9877 #ifdef I_UNISTD
9878 #include <unistd.h>
9879 #endif
9880 #$i_stdlib I_STDLIB
9881 #ifdef I_STDLIB
9882 #include <stdlib.h>
9883 #endif
9884 int main() {
9885         exit(R_OK);
9886 }
9887 EOCP
9888         : check sys/file.h first, no particular reason here
9889         if $test `./findhdr sys/file.h` && \
9890                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9891                 h_sysfile=true;
9892                 echo "<sys/file.h> defines the *_OK access constants." >&4
9893         elif $test `./findhdr fcntl.h` && \
9894                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9895                 h_fcntl=true;
9896                 echo "<fcntl.h> defines the *_OK access constants." >&4
9897         elif $test `./findhdr unistd.h` && \
9898                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9899                 echo "<unistd.h> defines the *_OK access constants." >&4
9900         else
9901                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9902         fi
9903         ;;
9904 esac
9905 $rm -f access*
9906
9907 : see if accessx exists
9908 set accessx d_accessx
9909 eval $inlibc
9910
9911 : see if aintl exists
9912 set aintl d_aintl
9913 eval $inlibc
9914
9915 : see if alarm exists
9916 set alarm d_alarm
9917 eval $inlibc
9918
9919 : see if POSIX threads are available
9920 set pthread.h i_pthread
9921 eval $inhdr
9922
9923 : define a fucntion to check prototypes
9924 $cat > protochk <<EOSH
9925 $startsh
9926 cc="$cc"
9927 optimize="$optimize"
9928 ccflags="$ccflags"
9929 prototype="$prototype"
9930 define="$define"
9931 rm_try="$rm_try"
9932 usethreads=$usethreads
9933 i_pthread=$i_pthread
9934 pthread_h_first=$pthread_h_first
9935 EOSH
9936
9937 $cat >> protochk <<'EOSH'
9938
9939 $rm_try
9940 foo="$1"
9941 shift
9942 while test $# -ge 2; do
9943         case "$1" in
9944                 $define) echo "#include <$2>" >> try.c ;;
9945                 literal) echo "$2" >> try.c ;;
9946         esac
9947     # Extra magic for the benefit of systems that need pthread.h
9948     # to be included early to correctly detect threadsafe functions.
9949     # Such functions must guarantee themselves, though, that the usethreads
9950     # and i_pthread have been defined, before calling protochk.
9951     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9952         echo "#include <pthread.h>" >> try.c
9953         pthread_h_done=yes
9954     fi
9955     shift 2
9956 done
9957 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9958 cat >> try.c <<'EOCP'
9959 #ifdef CAN_PROTOTYPE
9960 #define _(args) args
9961 #else
9962 #define _(args) ()
9963 #endif
9964 EOCP
9965 echo "$foo" >> try.c
9966 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9967 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9968 status=$?
9969 $rm_try
9970 exit $status
9971 EOSH
9972 chmod +x protochk
9973 $eunicefix protochk
9974
9975 : Define hasproto macro for Configure internal use
9976 hasproto='varname=$1; func=$2; shift; shift;
9977 while $test $# -ge 2; do
9978         case "$1" in
9979         $define) echo "#include <$2>";;
9980         esac ;
9981     shift 2;
9982 done > try.c;
9983 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9984 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9985         echo "$func() prototype found.";
9986         val="$define";
9987 else
9988         echo "$func() prototype NOT found.";
9989         val="$undef";
9990 fi;
9991 set $varname;
9992 eval $setvar;
9993 $rm_try tryout.c'
9994
9995 : see if sys/types.h has to be included
9996 set sys/types.h i_systypes
9997 eval $inhdr
9998
9999 : see if sys/select.h has to be included
10000 set sys/select.h i_sysselct
10001 eval $inhdr
10002
10003 : Define hasfield macro for Configure internal use
10004 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10005 while $test $# -ge 2; do
10006         case "$1" in
10007         $define) echo "#include <$2>";;
10008         esac ;
10009     shift 2;
10010 done > try.c;
10011 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10012 set try;
10013 if eval $compile; then
10014         val="$define";
10015 else
10016         val="$undef";
10017 fi;
10018 set $varname;
10019 eval $setvar;
10020 $rm_try'
10021
10022 : see if we should include time.h, sys/time.h, or both
10023 echo " "
10024 if test "X$timeincl" = X; then
10025         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10026         $echo $n "I'm now running the test program...$c"
10027         $cat >try.c <<EOCP
10028 #include <sys/types.h>
10029 #ifdef I_TIME
10030 #include <time.h>
10031 #endif
10032 #ifdef I_SYSTIME
10033 #ifdef SYSTIMEKERNEL
10034 #define KERNEL
10035 #endif
10036 #include <sys/time.h>
10037 #endif
10038 #ifdef I_SYSSELECT
10039 #include <sys/select.h>
10040 #endif
10041 #$i_stdlib I_STDLIB
10042 #ifdef I_STDLIB
10043 #include <stdlib.h>
10044 #endif
10045 int main()
10046 {
10047         struct tm foo;
10048 #ifdef S_TIMEVAL
10049         struct timeval bar;
10050 #endif
10051 #ifdef S_TIMEZONE
10052         struct timezone tzp;
10053 #endif
10054         if (foo.tm_sec == foo.tm_sec)
10055                 exit(0);
10056 #ifdef S_TIMEVAL
10057         if (bar.tv_sec == bar.tv_sec)
10058                 exit(0);
10059 #endif
10060         exit(1);
10061 }
10062 EOCP
10063         flags=''
10064         for s_timezone in '-DS_TIMEZONE' ''; do
10065         sysselect=''
10066         for s_timeval in '-DS_TIMEVAL' ''; do
10067         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10068         for i_time in '' '-DI_TIME'; do
10069         for i_systime in '-DI_SYSTIME' ''; do
10070                 case "$flags" in
10071                 '') $echo $n ".$c"
10072                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10073                         if eval $compile; then
10074                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10075                                 shift
10076                                 flags="$*"
10077                                 echo " "
10078                                 $echo $n "Succeeded with $flags$c"
10079                         fi
10080                         ;;
10081                 esac
10082         done
10083         done
10084         done
10085         done
10086         done
10087         timeincl=''
10088         echo " "
10089         case "$flags" in
10090         *SYSTIMEKERNEL*) i_systimek="$define"
10091                 timeincl=`./findhdr sys/time.h`
10092                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10093         *) i_systimek="$undef";;
10094         esac
10095         case "$flags" in
10096         *I_TIME*) i_time="$define"
10097                 timeincl=`./findhdr time.h`" $timeincl"
10098                 echo "We'll include <time.h>." >&4;;
10099         *) i_time="$undef";;
10100         esac
10101         case "$flags" in
10102         *I_SYSTIME*) i_systime="$define"
10103                 timeincl=`./findhdr sys/time.h`" $timeincl"
10104                 echo "We'll include <sys/time.h>." >&4;;
10105         *) i_systime="$undef";;
10106         esac
10107         $rm_try
10108 fi
10109 : see if struct tm knows about tm_zone
10110 case "$i_systime$i_time" in
10111 *$define*)
10112         echo " "
10113         echo "Checking to see if your struct tm has tm_zone field..." >&4
10114         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10115         eval $hasfield
10116         ;;
10117 *)      val="$undef"
10118         set d_tm_tm_zone
10119         eval $setvar
10120         ;;
10121 esac
10122 case "$d_tm_tm_zone" in
10123 "$define")      echo "Yes, it does."   ;;
10124 *)              echo "No, it doesn't." ;;
10125 esac
10126 : see if struct tm knows about tm_gmtoff
10127 case "$i_systime$i_time" in
10128 *$define*)
10129         echo " "
10130         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10131         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10132         eval $hasfield
10133         ;;
10134 *)      val="$undef"
10135         set d_tm_tm_gmtoff
10136         eval $setvar
10137         ;;
10138 esac
10139 case "$d_tm_tm_gmtoff" in
10140 "$define")      echo "Yes, it does."   ;;
10141 *)              echo "No, it doesn't." ;;
10142 esac
10143
10144 : see if asctime_r exists
10145 set asctime_r d_asctime_r
10146 eval $inlibc
10147 case "$d_asctime_r" in
10148 "$define")
10149         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10150         case "$d_asctime_r_proto:$usethreads" in
10151         ":define")      d_asctime_r_proto=define
10152                 set d_asctime_r_proto asctime_r $hdrs
10153                 eval $hasproto ;;
10154         *)      ;;
10155         esac
10156         case "$d_asctime_r_proto" in
10157         define)
10158         case "$asctime_r_proto" in
10159         ''|0) try='char* asctime_r(const struct tm*, char*);'
10160         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
10161         esac
10162         case "$asctime_r_proto" in
10163         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10164         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
10165         esac
10166         case "$asctime_r_proto" in
10167         ''|0) try='int asctime_r(const struct tm*, char*);'
10168         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
10169         esac
10170         case "$asctime_r_proto" in
10171         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10172         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
10173         esac
10174         case "$asctime_r_proto" in
10175         ''|0)   d_asctime_r=undef
10176                 asctime_r_proto=0
10177                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10178         * )     case "$asctime_r_proto" in
10179                 REENTRANT_PROTO*) ;;
10180                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10181                 esac
10182                 echo "Prototype: $try" ;;
10183         esac
10184         ;;
10185         *)      case "$usethreads" in
10186                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10187                 esac
10188                 d_asctime_r=undef
10189                 asctime_r_proto=0
10190                 ;;
10191         esac
10192         ;;
10193 *)      asctime_r_proto=0
10194         ;;
10195 esac
10196
10197 : see if atolf exists
10198 set atolf d_atolf
10199 eval $inlibc
10200
10201 : see if atoll exists
10202 set atoll d_atoll
10203 eval $inlibc
10204
10205 : Look for GCC-style attribute format
10206 case "$d_attribute_format" in
10207 '')
10208 echo " "
10209 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10210 $cat >attrib.c <<'EOCP'
10211 #include <stdio.h>
10212 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10213 EOCP
10214 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10215         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10216                 echo "Your C compiler doesn't support __attribute__((format))."
10217                 val="$undef"
10218         else
10219                 echo "Your C compiler supports __attribute__((format))."
10220                 val="$define"
10221         fi
10222 else
10223         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10224         val="$undef"
10225 fi
10226 ;;
10227 *) val="$d_attribute_format" ;;
10228 esac
10229 set d_attribute_format
10230 eval $setvar
10231 $rm -f attrib*
10232
10233 : Look for GCC-style attribute format with null format allowed
10234 case "$d_printf_format_null" in
10235 '') case "$d_attribute_format" in
10236     $define)
10237         echo " "
10238         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10239 $cat >attrib.c <<EOCP
10240 #include <stdio.h>
10241 #$i_stdlib I_STDLIB
10242 #ifdef I_STDLIB
10243 #include <stdlib.h>
10244 #endif
10245 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10246 int null_printf (char* pat,...) { return (int)pat; }
10247 int main () { exit(null_printf(NULL)); }
10248 EOCP
10249         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10250             : run the executable in case it produces a run-time warning
10251             if $run ./attrib >>attrib.out 2>&1; then
10252                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10253                     echo "Your C compiler doesn't allow __printf__ format to be null."
10254                     val="$undef"
10255                 else
10256                     echo "Your C compiler allows __printf__ format to be null."
10257                     val="$define"
10258                 fi
10259             else
10260             echo "Your C compiler executable failed with __printf__ format null."
10261             val="$undef"
10262         fi
10263     else
10264         echo "Your C compiler fails with __printf__ format null."
10265         val="$undef"
10266     fi
10267     ;;
10268     *)  val="$undef" ;;
10269     esac
10270 ;;
10271 *)  val="$d_printf_format_null" ;;
10272 esac
10273 set d_printf_format_null
10274 eval $setvar
10275 $rm -f attrib*
10276
10277 : Look for GCC-style attribute malloc
10278 case "$d_attribute_malloc" in
10279 '')
10280 echo " "
10281 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10282 $cat >attrib.c <<'EOCP'
10283 #include <stdio.h>
10284 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10285 EOCP
10286 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10287         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10288                 echo "Your C compiler doesn't support __attribute__((malloc))."
10289                 val="$undef"
10290         else
10291                 echo "Your C compiler supports __attribute__((malloc))."
10292                 val="$define"
10293         fi
10294 else
10295         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10296         val="$undef"
10297 fi
10298 ;;
10299 *) val="$d_attribute_malloc" ;;
10300 esac
10301 set d_attribute_malloc
10302 eval $setvar
10303 $rm -f attrib*
10304
10305 : Look for GCC-style attribute nonnull
10306 case "$d_attribute_nonnull" in
10307 '')
10308 echo " "
10309 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10310 $cat >attrib.c <<'EOCP'
10311 #include <stdio.h>
10312 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10313 EOCP
10314 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10315         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10316                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10317                 val="$undef"
10318         else
10319                 echo "Your C compiler supports __attribute__((nonnull))."
10320                 val="$define"
10321         fi
10322 else
10323         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10324         val="$undef"
10325 fi
10326 ;;
10327 *) val="$d_attribute_nonnull" ;;
10328 esac
10329 set d_attribute_nonnull
10330 eval $setvar
10331 $rm -f attrib*
10332
10333 : Look for GCC-style attribute noreturn
10334 case "$d_attribute_noreturn" in
10335 '')
10336 echo " "
10337 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10338 $cat >attrib.c <<'EOCP'
10339 #include <stdio.h>
10340 void fall_over_dead( void ) __attribute__((noreturn));
10341 EOCP
10342 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10343         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10344                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10345                 val="$undef"
10346         else
10347                 echo "Your C compiler supports __attribute__((noreturn))."
10348                 val="$define"
10349         fi
10350 else
10351         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10352         val="$undef"
10353 fi
10354 ;;
10355 *) val="$d_attribute_noreturn" ;;
10356 esac
10357 set d_attribute_noreturn
10358 eval $setvar
10359 $rm -f attrib*
10360
10361 : Look for GCC-style attribute pure
10362 case "$d_attribute_pure" in
10363 '')
10364 echo " "
10365 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10366 $cat >attrib.c <<'EOCP'
10367 #include <stdio.h>
10368 int square( int n ) __attribute__((pure));
10369 EOCP
10370 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10371         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10372                 echo "Your C compiler doesn't support __attribute__((pure))."
10373                 val="$undef"
10374         else
10375                 echo "Your C compiler supports __attribute__((pure))."
10376                 val="$define"
10377         fi
10378 else
10379         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10380         val="$undef"
10381 fi
10382 ;;
10383 *) val="$d_attribute_pure" ;;
10384 esac
10385 set d_attribute_pure
10386 eval $setvar
10387 $rm -f attrib*
10388
10389 : Look for GCC-style attribute unused
10390 case "$d_attribute_unused" in
10391 '')
10392 echo " "
10393 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10394 $cat >attrib.c <<'EOCP'
10395 #include <stdio.h>
10396 int do_something( int dummy __attribute__((unused)), int n );
10397 EOCP
10398 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10399         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10400                 echo "Your C compiler doesn't support __attribute__((unused))."
10401                 val="$undef"
10402         else
10403                 echo "Your C compiler supports __attribute__((unused))."
10404                 val="$define"
10405         fi
10406 else
10407         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10408         val="$undef"
10409 fi
10410 ;;
10411 *) val="$d_attribute_unused" ;;
10412 esac
10413 set d_attribute_unused
10414 eval $setvar
10415 $rm -f attrib*
10416
10417 : Look for GCC-style attribute warn_unused_result
10418 case "$d_attribute_warn_unused_result" in
10419 '')
10420 echo " "
10421 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10422 $cat >attrib.c <<'EOCP'
10423 #include <stdio.h>
10424 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10425 EOCP
10426 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10427         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10428                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10429                 val="$undef"
10430         else
10431                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10432                 val="$define"
10433         fi
10434 else
10435         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10436         val="$undef"
10437 fi
10438 ;;
10439 *) val="$d_attribute_warn_unused_result" ;;
10440 esac
10441 set d_attribute_warn_unused_result
10442 eval $setvar
10443 $rm -f attrib*
10444
10445 : see if bcmp exists
10446 set bcmp d_bcmp
10447 eval $inlibc
10448
10449 : see if bcopy exists
10450 set bcopy d_bcopy
10451 eval $inlibc
10452
10453 : see if getpgrp exists
10454 set getpgrp d_getpgrp
10455 eval $inlibc
10456
10457 case "$d_getpgrp" in
10458 "$define")
10459         echo " "
10460         echo "Checking to see which flavor of getpgrp is in use..."
10461         $cat >try.c <<EOP
10462 #$i_unistd I_UNISTD
10463 #include <sys/types.h>
10464 #ifdef I_UNISTD
10465 #  include <unistd.h>
10466 #endif
10467 #$i_stdlib I_STDLIB
10468 #ifdef I_STDLIB
10469 #include <stdlib.h>
10470 #endif
10471 int main()
10472 {
10473         if (getuid() == 0) {
10474                 printf("(I see you are running Configure as super-user...)\n");
10475                 setuid(1);
10476         }
10477 #ifdef TRY_BSD_PGRP
10478         if (getpgrp(1) == 0)
10479                 exit(0);
10480 #else
10481         if (getpgrp() > 0)
10482                 exit(0);
10483 #endif
10484         exit(1);
10485 }
10486 EOP
10487         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10488                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10489                 val="$define"
10490         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10491                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10492                 val="$undef"
10493         else
10494                 echo "I can't seem to compile and run the test program."
10495                 if ./usg; then
10496                         xxx="a USG one, i.e. you use getpgrp()."
10497                 else
10498                         # SVR4 systems can appear rather BSD-ish.
10499                         case "$i_unistd" in
10500                         $undef)
10501                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10502                                 val="$define"
10503                                 ;;
10504                         $define)
10505                                 xxx="probably a USG one, i.e. you use getpgrp()."
10506                                 val="$undef"
10507                                 ;;
10508                         esac
10509                 fi
10510                 echo "Assuming your getpgrp is $xxx" >&4
10511         fi
10512         ;;
10513 *) val="$undef";;
10514 esac
10515 set d_bsdgetpgrp
10516 eval $setvar
10517 $rm_try
10518
10519 : see if setpgrp exists
10520 set setpgrp d_setpgrp
10521 eval $inlibc
10522
10523 case "$d_setpgrp" in
10524 "$define")
10525         echo " "
10526         echo "Checking to see which flavor of setpgrp is in use..."
10527         $cat >try.c <<EOP
10528 #$i_unistd I_UNISTD
10529 #include <sys/types.h>
10530 #ifdef I_UNISTD
10531 #  include <unistd.h>
10532 #endif
10533 #$i_stdlib I_STDLIB
10534 #ifdef I_STDLIB
10535 #include <stdlib.h>
10536 #endif
10537 int main()
10538 {
10539         if (getuid() == 0) {
10540                 printf("(I see you are running Configure as super-user...)\n");
10541                 setuid(1);
10542         }
10543 #ifdef TRY_BSD_PGRP
10544         if (-1 == setpgrp(1, 1))
10545                 exit(0);
10546 #else
10547         if (setpgrp() != -1)
10548                 exit(0);
10549 #endif
10550         exit(1);
10551 }
10552 EOP
10553         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10554                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10555                 val="$define"
10556         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10557                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10558                 val="$undef"
10559         else
10560                 echo "(I can't seem to compile and run the test program.)"
10561                 if ./usg; then
10562                         xxx="a USG one, i.e. you use setpgrp()."
10563                 else
10564                         # SVR4 systems can appear rather BSD-ish.
10565                         case "$i_unistd" in
10566                         $undef)
10567                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10568                                 val="$define"
10569                                 ;;
10570                         $define)
10571                                 xxx="probably a USG one, i.e. you use setpgrp()."
10572                                 val="$undef"
10573                                 ;;
10574                         esac
10575                 fi
10576                 echo "Assuming your setpgrp is $xxx" >&4
10577         fi
10578         ;;
10579 *) val="$undef";;
10580 esac
10581 set d_bsdsetpgrp
10582 eval $setvar
10583 $rm_try
10584
10585 : Look for GCC-style __builtin_choose_expr
10586 case "$d_builtin_choose_expr" in
10587 '')
10588     echo " "
10589     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10590     $cat >try.c <<'EOCP'
10591 #include <assert.h>
10592 #include <stdlib.h>
10593 #include <stdio.h>
10594
10595 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10596
10597 int main(void) {
10598     assert( SYRINX(1) == 2112 );
10599     assert( SYRINX(1) != 5150 );
10600     assert( SYRINX(0) == 5150 );
10601     assert( SYRINX(0) != 2112 );
10602     puts( "All good!" );
10603     exit(0);
10604 }
10605
10606 EOCP
10607     set try
10608     if eval $compile && $run ./try; then
10609         echo "Your C compiler supports __builtin_choose_expr."
10610         val="$define"
10611     else
10612         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10613         val="$undef"
10614     fi
10615 ;;
10616 *) val="$d_builtin_choose_expr" ;;
10617 esac
10618
10619 set d_builtin_choose_expr
10620 eval $setvar
10621 $rm_try
10622
10623 : Look for GCC-style __builtin_expect
10624 case "$d_builtin_expect" in
10625 '')
10626     echo " "
10627     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10628     $cat >try.c <<'EOCP'
10629 int main(void) {
10630     int n = 50;
10631     if ( __builtin_expect(n, 0) ) n = 1;
10632     /* Remember shell exit code truth is 0, C truth is non-zero */
10633     return !(n == 1);
10634 }
10635 EOCP
10636     set try
10637     if eval $compile && $run ./try; then
10638         echo "Your C compiler supports __builtin_expect."
10639         val="$define"
10640     else
10641         echo "Your C compiler doesn't seem to understand __builtin_expect."
10642         val="$undef"
10643     fi
10644     ;;
10645 *) val="$d_builtin_expect" ;;
10646 esac
10647
10648 set d_builtin_expect
10649 eval $setvar
10650 $rm_try
10651
10652 : see if bzero exists
10653 set bzero d_bzero
10654 eval $inlibc
10655
10656 : see if stdarg is available
10657 echo " "
10658 if $test `./findhdr stdarg.h`; then
10659         echo "<stdarg.h> found." >&4
10660         valstd="$define"
10661 else
10662         echo "<stdarg.h> NOT found." >&4
10663         valstd="$undef"
10664 fi
10665
10666 : see if varags is available
10667 echo " "
10668 if $test `./findhdr varargs.h`; then
10669         echo "<varargs.h> found." >&4
10670 else
10671         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10672 fi
10673
10674 : set up the varargs testing programs
10675 $cat > varargs.c <<EOP
10676 #ifdef I_STDARG
10677 #include <stdarg.h>
10678 #endif
10679 #ifdef I_VARARGS
10680 #include <varargs.h>
10681 #endif
10682
10683 #ifdef I_STDARG
10684 int f(char *p, ...)
10685 #else
10686 int f(va_alist)
10687 va_dcl
10688 #endif
10689 {
10690         va_list ap;
10691 #ifndef I_STDARG
10692         char *p;
10693 #endif
10694 #ifdef I_STDARG
10695         va_start(ap,p);
10696 #else
10697         va_start(ap);
10698         p = va_arg(ap, char *);
10699 #endif
10700         va_end(ap);
10701         return 0;
10702 }
10703 EOP
10704 $cat > varargs <<EOP
10705 $startsh
10706 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10707         echo "true"
10708 else
10709         echo "false"
10710 fi
10711 $rm -f varargs$_o
10712 EOP
10713 chmod +x varargs
10714
10715 : now check which varargs header should be included
10716 echo " "
10717 i_varhdr=''
10718 case "$valstd" in
10719 "$define")
10720         if `./varargs I_STDARG`; then
10721                 val='stdarg.h'
10722         elif `./varargs I_VARARGS`; then
10723                 val='varargs.h'
10724         fi
10725         ;;
10726 *)
10727         if `./varargs I_VARARGS`; then
10728                 val='varargs.h'
10729         fi
10730         ;;
10731 esac
10732 case "$val" in
10733 '')
10734 echo "I could not find the definition for va_dcl... You have problems..." >&4
10735         val="$undef"; set i_stdarg; eval $setvar
10736         val="$undef"; set i_varargs; eval $setvar
10737         ;;
10738 *)
10739         set i_varhdr
10740         eval $setvar
10741         case "$i_varhdr" in
10742         stdarg.h)
10743                 val="$define"; set i_stdarg; eval $setvar
10744                 val="$undef"; set i_varargs; eval $setvar
10745                 ;;
10746         varargs.h)
10747                 val="$undef"; set i_stdarg; eval $setvar
10748                 val="$define"; set i_varargs; eval $setvar
10749                 ;;
10750         esac
10751         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10752 esac
10753 $rm -f varargs*
10754
10755 : see if the Compiler supports C99 variadic macros
10756 case "$i_stdarg$i_stdlib" in
10757     "$define$define")
10758     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10759     $cat >try.c <<EOCP
10760 #include <stdio.h>
10761 #include <stdarg.h>
10762
10763 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10764
10765 int main() {
10766   char buf[20];
10767   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10768   puts(buf);
10769   return 0;
10770 }
10771 EOCP
10772     set try
10773     if eval $compile && $run ./try 2>&1 >/dev/null; then
10774         case "`$run ./try`" in
10775             "123 456 789")
10776             echo "You have C99 variadic macros." >&4
10777             d_c99_variadic_macros="$define"
10778             ;;
10779             *)
10780             echo "You don't have functional C99 variadic macros." >&4
10781             d_c99_variadic_macros="$undef"
10782             ;;
10783         esac
10784     else
10785         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10786         d_c99_variadic_macros="$undef"
10787     fi
10788     $rm_try
10789     ;;
10790     *)
10791     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10792     d_c99_variadic_macros="$undef"
10793     ;;
10794 esac
10795
10796 : see if signal is declared as pointer to function returning int or void
10797 echo " "
10798 xxx=`./findhdr signal.h`
10799 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10800 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10801         echo "You have int (*signal())() instead of void." >&4
10802         val="$undef"
10803 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10804         echo "You have void (*signal())()." >&4
10805         val="$define"
10806 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10807         echo "You have int (*signal())() instead of void." >&4
10808         val="$undef"
10809 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10810         echo "You have void (*signal())()." >&4
10811         val="$define"
10812 else
10813         case "$d_voidsig" in
10814         '')
10815         echo "I can't determine whether signal handler returns void or int..." >&4
10816                 dflt=void
10817                 rp="What type does your signal handler return?"
10818                 . ./myread
10819                 case "$ans" in
10820                 v*) val="$define";;
10821                 *) val="$undef";;
10822                 esac;;
10823         "$define")
10824                 echo "As you already told me, signal handler returns void." >&4
10825                 val="$define"
10826                 ;;
10827         *)      echo "As you already told me, signal handler returns int." >&4
10828                 val="$undef"
10829                 ;;
10830         esac
10831 fi
10832 set d_voidsig
10833 eval $setvar
10834 case "$d_voidsig" in
10835 "$define") signal_t="void";;
10836 *) signal_t="int";;
10837 esac
10838 $rm -f $$.tmp
10839
10840 : check for ability to cast large floats to 32-bit ints.
10841 echo " "
10842 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10843 if $test "$intsize" -ge 4; then
10844         xxx=int
10845 else
10846         xxx=long
10847 fi
10848 $cat >try.c <<EOCP
10849 #include <stdio.h>
10850 #$i_stdlib I_STDLIB
10851 #ifdef I_STDLIB
10852 #include <stdlib.h>
10853 #endif
10854 #include <sys/types.h>
10855 #include <signal.h>
10856 $signal_t blech(int s) { exit(3); }
10857 int main()
10858 {
10859         $xxx i32;
10860         double f, g;
10861         int result = 0;
10862         char str[16];
10863         signal(SIGFPE, blech);
10864
10865         /* Don't let compiler optimize the test away.  Store the number
10866            in a writable string for gcc to pass to sscanf under HP/UX.
10867         */
10868         sprintf(str, "2147483647");
10869         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10870         g = 10 * f;
10871         i32  = ($xxx) g;
10872
10873         /* x86 processors will probably give 0x8000 0000, which is a
10874            sign change.  We don't want that.  We want to mimic SPARC
10875            behavior here, which is to preserve the sign and give
10876            back 0x7fff ffff.
10877         */
10878         if (i32 != ($xxx) f)
10879                 result |= 1;
10880         exit(result);
10881 }
10882 EOCP
10883 set try
10884 if eval $compile_ok; then
10885         $run ./try
10886         yyy=$?
10887 else
10888         echo "(I can't seem to compile the test program--assuming it can't)"
10889         yyy=1
10890 fi
10891 case "$yyy" in
10892 0)      val="$define"
10893         echo "Yup, it can."
10894         ;;
10895 *)      val="$undef"
10896         echo "Nope, it can't."
10897         ;;
10898 esac
10899 set d_casti32
10900 eval $setvar
10901 $rm_try
10902
10903 : check for ability to cast negative floats to unsigned
10904 echo " "
10905 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10906 $cat >try.c <<EOCP
10907 #include <stdio.h>
10908 #$i_stdlib I_STDLIB
10909 #ifdef I_STDLIB
10910 #include <stdlib.h>
10911 #endif
10912 #include <sys/types.h>
10913 #include <signal.h>
10914 $signal_t blech(int s) { exit(7); }
10915 $signal_t blech_in_list(int s) { exit(4); }
10916 unsigned long dummy_long(unsigned long p) { return p; }
10917 unsigned int dummy_int(unsigned int p) { return p; }
10918 unsigned short dummy_short(unsigned short p) { return p; }
10919 int main()
10920 {
10921         double f;
10922         unsigned long along;
10923         unsigned int aint;
10924         unsigned short ashort;
10925         int result = 0;
10926         char str[16];
10927
10928         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10929            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10930            optimized the whole file away
10931         */
10932         /* Store the number in a writable string for gcc to pass to
10933            sscanf under HP/UX.
10934         */
10935         sprintf(str, "-123");
10936         sscanf(str, "%lf", &f);  /* f = -123.; */
10937
10938         signal(SIGFPE, blech);
10939         along = (unsigned long)f;
10940         aint = (unsigned int)f;
10941         ashort = (unsigned short)f;
10942         if (along != (unsigned long)-123)
10943                 result |= 1;
10944         if (aint != (unsigned int)-123)
10945                 result |= 1;
10946         if (ashort != (unsigned short)-123)
10947                 result |= 1;
10948         sprintf(str, "1073741824.");
10949         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10950         f = f + f;
10951         along = 0;
10952         along = (unsigned long)f;
10953         if (along != 0x80000000)
10954                 result |= 2;
10955         f -= 1.;
10956         along = 0;
10957         along = (unsigned long)f;
10958         if (along != 0x7fffffff)
10959                 result |= 1;
10960         f += 2.;
10961         along = 0;
10962         along = (unsigned long)f;
10963         if (along != 0x80000001)
10964                 result |= 2;
10965         if (result)
10966                 exit(result);
10967         signal(SIGFPE, blech_in_list);
10968         sprintf(str, "123.");
10969         sscanf(str, "%lf", &f);  /* f = 123.; */
10970         along = dummy_long((unsigned long)f);
10971         aint = dummy_int((unsigned int)f);
10972         ashort = dummy_short((unsigned short)f);
10973         if (along != (unsigned long)123)
10974                 result |= 4;
10975         if (aint != (unsigned int)123)
10976                 result |= 4;
10977         if (ashort != (unsigned short)123)
10978                 result |= 4;
10979         exit(result);
10980
10981 }
10982 EOCP
10983 set try
10984 if eval $compile_ok; then
10985         $run ./try
10986         castflags=$?
10987 else
10988         echo "(I can't seem to compile the test program--assuming it can't)"
10989         castflags=7
10990 fi
10991 case "$castflags" in
10992 0)      val="$define"
10993         echo "Yup, it can."
10994         ;;
10995 *)      val="$undef"
10996         echo "Nope, it can't."
10997         ;;
10998 esac
10999 set d_castneg
11000 eval $setvar
11001 $rm_try
11002
11003 : see if vprintf exists
11004 echo " "
11005 if set vprintf val -f d_vprintf; eval $csym; $val; then
11006         echo 'vprintf() found.' >&4
11007         val="$define"
11008         $cat >try.c <<EOF
11009 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11010 #$i_varargs I_VARARGS
11011
11012 #$i_stdlib I_STDLIB
11013 #$i_unistd I_UNISTD
11014
11015 #ifdef I_STDARG
11016 #  include <stdarg.h>
11017 #else /* I_VARARGS */
11018 #  include <varargs.h>
11019 #endif
11020
11021 #ifdef I_UNISTD
11022 #  include <unistd.h>
11023 #endif
11024
11025 #ifdef I_STDLIB
11026 #  include <stdlib.h>
11027 #endif
11028
11029 #include <stdio.h> /* vsprintf prototype */
11030
11031 #ifdef I_STDARG
11032 void xxx(int n, ...)
11033 {
11034     va_list args;
11035     char buf[10];
11036     va_start(args, n);
11037     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11038 }
11039 int main() { xxx(1, "foo"); }
11040
11041 #else /* I_VARARGS */
11042
11043 xxx(va_alist)
11044 va_dcl
11045 {
11046     va_list args;
11047     char buf[10];
11048     va_start(args);
11049     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11050 }
11051 int main() { xxx("foo"); }
11052
11053 #endif
11054
11055 EOF
11056         set try
11057         if eval $compile_ok; then
11058                 if $run ./try; then
11059                         echo "Your vsprintf() returns (int)." >&4
11060                         val2="$undef"
11061                 else
11062                         echo "Your vsprintf() returns (char*)." >&4
11063                         val2="$define"
11064                 fi
11065         else
11066                 echo 'I am unable to compile the vsprintf() test program.' >&4
11067                 # We shouldn't get here.  If we do, assume the standard signature,
11068                 # not the old BSD one.
11069                 echo 'Guessing that vsprintf() returns (int).' >&4
11070                 val2="$undef"
11071         fi
11072 else
11073         echo 'vprintf() NOT found.' >&4
11074         val="$undef"
11075         val2="$undef"
11076 fi
11077 $rm_try
11078 set d_vprintf
11079 eval $setvar
11080 val=$val2
11081 set d_charvspr
11082 eval $setvar
11083
11084 : see if chown exists
11085 set chown d_chown
11086 eval $inlibc
11087
11088 : see if chroot exists
11089 set chroot d_chroot
11090 eval $inlibc
11091
11092 : see if chsize exists
11093 set chsize d_chsize
11094 eval $inlibc
11095
11096 : see if class exists
11097 set class d_class
11098 eval $inlibc
11099
11100 : see if clearenv exists
11101 set clearenv d_clearenv
11102 eval $inlibc
11103
11104 : Define hasstruct macro for Configure internal use
11105 hasstruct='varname=$1; struct=$2; shift; shift;
11106 while $test $# -ge 2; do
11107         case "$1" in
11108         $define) echo "#include <$2>";;
11109         esac ;
11110     shift 2;
11111 done > try.c;
11112 echo "int main () { struct $struct foo; }" >> try.c;
11113 set try;
11114 if eval $compile; then
11115         val="$define";
11116 else
11117         val="$undef";
11118 fi;
11119 set $varname;
11120 eval $setvar;
11121 $rm_try'
11122
11123 : see whether socket exists
11124 socketlib=''
11125 sockethdr=''
11126 echo " "
11127 $echo $n "Hmm... $c" >&4
11128 if set socket val -f d_socket; eval $csym; $val; then
11129         echo "Looks like you have Berkeley networking support." >&4
11130         d_socket="$define"
11131         if set setsockopt val -f; eval $csym; $val; then
11132                 d_oldsock="$undef"
11133         else
11134                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11135                 d_oldsock="$define"
11136         fi
11137 else
11138         if $contains socklib libc.list >/dev/null 2>&1; then
11139                 echo "Looks like you have Berkeley networking support." >&4
11140                 d_socket="$define"
11141                 : we will have to assume that it supports the 4.2 BSD interface
11142                 d_oldsock="$undef"
11143         else
11144                 echo "You don't have Berkeley networking in libc$_a..." >&4
11145                 if test "X$d_socket" = "X$define"; then
11146                    echo "...but you seem to believe that you have sockets." >&4
11147                 else
11148                         for net in net socket
11149                         do
11150                                 if test -f /usr/lib/lib$net$_a; then
11151                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11152                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11153                                         if $contains socket libc.list >/dev/null 2>&1; then
11154                                                 d_socket="$define"
11155                                                 socketlib="-l$net"
11156                                                 case "$net" in
11157                                                 net)
11158                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11159                                                         sockethdr="-I/usr/netinclude"
11160                                                         ;;
11161                                                 esac
11162                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11163                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11164                                                         d_oldsock="$undef"
11165                                                 else
11166                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11167                                                         d_oldsock="$define"
11168                                                 fi
11169                                                 break
11170                                         fi
11171                                 fi
11172                         done
11173                         if test "X$d_socket" != "X$define"; then
11174                            echo "or anywhere else I see." >&4
11175                            d_socket="$undef"
11176                            d_oldsock="$undef"
11177                         fi
11178                 fi
11179         fi
11180 fi
11181
11182 : see if socketpair exists
11183 set socketpair d_sockpair
11184 eval $inlibc
11185
11186
11187 echo " "
11188 echo "Checking the availability of certain socket constants..." >&4
11189 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11190         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11191         $cat >try.c <<EOF
11192 #include <sys/types.h>
11193 #include <sys/socket.h>
11194 int main() {
11195     int i = $ENUM;
11196 }
11197 EOF
11198         val="$undef"
11199         set try; if eval $compile; then
11200                 val="$define"
11201         fi
11202         set d_${enum}; eval $setvar
11203         $rm_try
11204 done
11205
11206 : see if this is a sys/uio.h system
11207 set sys/uio.h i_sysuio
11208 eval $inhdr
11209
11210 : Check for cmsghdr support
11211 echo " "
11212 echo "Checking to see if your system supports struct cmsghdr..." >&4
11213 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11214 eval $hasstruct
11215 case "$d_cmsghdr_s" in
11216 "$define")      echo "Yes, it does."   ;;
11217 *)              echo "No, it doesn't." ;;
11218 esac
11219
11220
11221 : check for const keyword
11222 echo " "
11223 echo 'Checking to see if your C compiler knows about "const"...' >&4
11224 $cat >const.c <<'EOCP'
11225 typedef struct spug { int drokk; } spug;
11226 int main()
11227 {
11228         const char *foo;
11229         const spug y = { 0 };
11230 }
11231 EOCP
11232 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11233         val="$define"
11234         echo "Yup, it does."
11235 else
11236         val="$undef"
11237         echo "Nope, it doesn't."
11238 fi
11239 set d_const
11240 eval $setvar
11241
11242 : see if copysignl exists
11243 set copysignl d_copysignl
11244 eval $inlibc
11245
11246 : see if crypt exists
11247 echo " "
11248 set crypt d_crypt
11249 eval $inlibc
11250 case "$d_crypt" in
11251 $define) cryptlib='' ;;
11252 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11253                 echo 'crypt() found.' >&4
11254                 val="$define"
11255                 cryptlib=''
11256         else
11257                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11258                 if $test -z "$cryptlib"; then
11259                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11260                 else
11261                         cryptlib=-lcrypt
11262                 fi
11263                 if $test -z "$cryptlib"; then
11264                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11265                 else
11266                         cryptlib=-lcrypt
11267                 fi
11268                 if $test -z "$cryptlib"; then
11269                         cryptlib=`./loc libcrypt$_a "" $libpth`
11270                 else
11271                         cryptlib=-lcrypt
11272                 fi
11273                 if $test -z "$cryptlib"; then
11274                         echo 'crypt() NOT found.' >&4
11275                         val="$undef"
11276                 else
11277                         val="$define"
11278                 fi
11279         fi
11280         set d_crypt
11281         eval $setvar
11282         ;;
11283 esac
11284
11285 : see if this is a crypt.h system
11286 set crypt.h i_crypt
11287 eval $inhdr
11288
11289 : see if crypt_r exists
11290 set crypt_r d_crypt_r
11291 eval $inlibc
11292 case "$d_crypt_r" in
11293 "$define")
11294         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11295         case "$d_crypt_r_proto:$usethreads" in
11296         ":define")      d_crypt_r_proto=define
11297                 set d_crypt_r_proto crypt_r $hdrs
11298                 eval $hasproto ;;
11299         *)      ;;
11300         esac
11301         case "$d_crypt_r_proto" in
11302         define)
11303         case "$crypt_r_proto" in
11304         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11305         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
11306         esac
11307         case "$crypt_r_proto" in
11308         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11309         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
11310         esac
11311         case "$crypt_r_proto" in
11312         ''|0)   d_crypt_r=undef
11313                 crypt_r_proto=0
11314                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11315         * )     case "$crypt_r_proto" in
11316                 REENTRANT_PROTO*) ;;
11317                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11318                 esac
11319                 echo "Prototype: $try" ;;
11320         esac
11321         ;;
11322         *)      case "$usethreads" in
11323                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11324                 esac
11325                 d_crypt_r=undef
11326                 crypt_r_proto=0
11327                 ;;
11328         esac
11329         ;;
11330 *)      crypt_r_proto=0
11331         ;;
11332 esac
11333
11334 : get csh whereabouts
11335 case "$csh" in
11336 'csh') val="$undef" ;;
11337 *) val="$define" ;;
11338 esac
11339 set d_csh
11340 eval $setvar
11341 : Respect a hint or command line value for full_csh.
11342 case "$full_csh" in
11343 '') full_csh=$csh ;;
11344 esac
11345
11346 : see if ctermid exists
11347 set ctermid d_ctermid
11348 eval $inlibc
11349
11350 : see if ctermid_r exists
11351 set ctermid_r d_ctermid_r
11352 eval $inlibc
11353 case "$d_ctermid_r" in
11354 "$define")
11355         hdrs="$i_systypes sys/types.h define stdio.h "
11356         case "$d_ctermid_r_proto:$usethreads" in
11357         ":define")      d_ctermid_r_proto=define
11358                 set d_ctermid_r_proto ctermid_r $hdrs
11359                 eval $hasproto ;;
11360         *)      ;;
11361         esac
11362         case "$d_ctermid_r_proto" in
11363         define)
11364         case "$ctermid_r_proto" in
11365         ''|0) try='char* ctermid_r(char*);'
11366         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
11367         esac
11368         case "$ctermid_r_proto" in
11369         ''|0)   d_ctermid_r=undef
11370                 ctermid_r_proto=0
11371                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11372         * )     case "$ctermid_r_proto" in
11373                 REENTRANT_PROTO*) ;;
11374                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11375                 esac
11376                 echo "Prototype: $try" ;;
11377         esac
11378         ;;
11379         *)      case "$usethreads" in
11380                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11381                 esac
11382                 d_ctermid_r=undef
11383                 ctermid_r_proto=0
11384                 ;;
11385         esac
11386         ;;
11387 *)      ctermid_r_proto=0
11388         ;;
11389 esac
11390
11391 : see if ctime_r exists
11392 set ctime_r d_ctime_r
11393 eval $inlibc
11394 case "$d_ctime_r" in
11395 "$define")
11396         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11397         case "$d_ctime_r_proto:$usethreads" in
11398         ":define")      d_ctime_r_proto=define
11399                 set d_ctime_r_proto ctime_r $hdrs
11400                 eval $hasproto ;;
11401         *)      ;;
11402         esac
11403         case "$d_ctime_r_proto" in
11404         define)
11405         case "$ctime_r_proto" in
11406         ''|0) try='char* ctime_r(const time_t*, char*);'
11407         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
11408         esac
11409         case "$ctime_r_proto" in
11410         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11411         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
11412         esac
11413         case "$ctime_r_proto" in
11414         ''|0) try='int ctime_r(const time_t*, char*);'
11415         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
11416         esac
11417         case "$ctime_r_proto" in
11418         ''|0) try='int ctime_r(const time_t*, char*, int);'
11419         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
11420         esac
11421         case "$ctime_r_proto" in
11422         ''|0)   d_ctime_r=undef
11423                 ctime_r_proto=0
11424                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11425         * )     case "$ctime_r_proto" in
11426                 REENTRANT_PROTO*) ;;
11427                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11428                 esac
11429                 echo "Prototype: $try" ;;
11430         esac
11431         ;;
11432         *)      case "$usethreads" in
11433                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11434                 esac
11435                 d_ctime_r=undef
11436                 ctime_r_proto=0
11437                 ;;
11438         esac
11439         ;;
11440 *)      ctime_r_proto=0
11441         ;;
11442 esac
11443
11444 : see if cuserid exists
11445 set cuserid d_cuserid
11446 eval $inlibc
11447
11448 : see if this is a limits.h system
11449 set limits.h i_limits
11450 eval $inhdr
11451
11452 : see if this is a float.h system
11453 set float.h i_float
11454 eval $inhdr
11455
11456 : See if number of significant digits in a double precision number is known
11457 echo " "
11458 $cat >dbl_dig.c <<EOM
11459 #$i_limits I_LIMITS
11460 #$i_float I_FLOAT
11461 #ifdef I_LIMITS
11462 #include <limits.h>
11463 #endif
11464 #ifdef I_FLOAT
11465 #include <float.h>
11466 #endif
11467 #ifdef DBL_DIG
11468 printf("Contains DBL_DIG");
11469 #endif
11470 EOM
11471 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11472 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11473         echo "DBL_DIG found." >&4
11474         val="$define"
11475 else
11476         echo "DBL_DIG NOT found." >&4
11477         val="$undef"
11478 fi
11479 $rm -f dbl_dig.?
11480 set d_dbl_dig
11481 eval $setvar
11482
11483 : see if dbm.h is available
11484 : see if dbmclose exists
11485 set dbmclose d_dbmclose
11486 eval $inlibc
11487
11488 case "$d_dbmclose" in
11489 $define)
11490         set dbm.h i_dbm
11491         eval $inhdr
11492         case "$i_dbm" in
11493         $define)
11494                 val="$undef"
11495                 set i_rpcsvcdbm
11496                 eval $setvar
11497                 ;;
11498         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11499                 eval $inhdr
11500                 ;;
11501         esac
11502         ;;
11503 *)      echo "We won't be including <dbm.h>"
11504         val="$undef"
11505         set i_dbm
11506         eval $setvar
11507         val="$undef"
11508         set i_rpcsvcdbm
11509         eval $setvar
11510         ;;
11511 esac
11512
11513 : see if prototype for dbminit is available
11514 echo " "
11515 set d_dbminitproto dbminit $i_dbm dbm.h
11516 eval $hasproto
11517
11518 : see if difftime exists
11519 set difftime d_difftime
11520 eval $inlibc
11521
11522 : see if this is a dirent system
11523 echo " "
11524 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11525         val="$define"
11526         echo "<dirent.h> found." >&4
11527 else
11528         val="$undef"
11529         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11530                 echo "<sys/dir.h> found." >&4
11531                 echo " "
11532         else
11533                 xinc=`./findhdr sys/ndir.h`
11534         fi
11535         echo "<dirent.h> NOT found." >&4
11536 fi
11537 set i_dirent
11538 eval $setvar
11539
11540 : Look for type of directory structure.
11541 echo " "
11542 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11543
11544 case "$direntrytype" in
11545 ''|' ')
11546         case "$i_dirent" in
11547         $define) guess1='struct dirent' ;;
11548         *) guess1='struct direct'  ;;
11549         esac
11550         ;;
11551 *)      guess1="$direntrytype"
11552         ;;
11553 esac
11554
11555 case "$guess1" in
11556 'struct dirent') guess2='struct direct' ;;
11557 *) guess2='struct dirent' ;;
11558 esac
11559
11560 if $contains "$guess1" try.c >/dev/null 2>&1; then
11561         direntrytype="$guess1"
11562         echo "Your directory entries are $direntrytype." >&4
11563 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11564         direntrytype="$guess2"
11565         echo "Your directory entries seem to be $direntrytype." >&4
11566 else
11567         echo "I don't recognize your system's directory entries." >&4
11568         rp="What type is used for directory entries on this system?"
11569         dflt="$guess1"
11570         . ./myread
11571         direntrytype="$ans"
11572 fi
11573 $rm_try
11574
11575 : see if the directory entry stores field length
11576 echo " "
11577 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11578 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11579         echo "Good, your directory entry keeps length information in d_namlen." >&4
11580         val="$define"
11581 else
11582         echo "Your directory entry does not know about the d_namlen field." >&4
11583         val="$undef"
11584 fi
11585 set d_dirnamlen
11586 eval $setvar
11587 $rm_try
11588
11589 : Look for DIR.dd_fd
11590 case "$i_dirent" in
11591 "$define")
11592     echo "Checking to see if DIR has a dd_fd member variable" >&4
11593     $cat >try.c <<EOCP
11594 #$i_stdlib I_STDLIB
11595 #ifdef I_STDLIB
11596 #include <stdlib.h>
11597 #endif
11598 #include <dirent.h>
11599
11600 int main() {
11601     DIR dir;
11602     dir.dd_fd = 1;
11603     return 0;
11604 }
11605 EOCP
11606     val=$undef
11607     set try
11608     if eval $compile; then
11609         echo "Yes, it does."
11610         val="$define"
11611     else
11612         echo "No, it does not."
11613         val="$undef"
11614     fi
11615     ;;
11616 *)
11617     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11618     val="$undef"
11619     ;;
11620 esac
11621 set d_dir_dd_fd
11622 eval $setvar
11623 $rm_try
11624
11625 : see if this is an sysdir system
11626 set sys/dir.h i_sysdir
11627 eval $inhdr
11628
11629 : see if this is an sysndir system
11630 set sys/ndir.h i_sysndir
11631 eval $inhdr
11632
11633 : Look for dirfd
11634 echo " "
11635 $cat >dirfd.c <<EOM
11636 #include <stdio.h>
11637 #$i_stdlib I_STDLIB
11638 #ifdef I_STDLIB
11639 #include <stdlib.h>
11640 #endif
11641 #$i_dirent I_DIRENT             /**/
11642 #$i_sysdir I_SYS_DIR            /**/
11643 #$i_sysndir I_SYS_NDIR          /**/
11644 #$i_systypes I_SYS_TYPES        /**/
11645 #if defined(I_SYS_TYPES)
11646 #include <sys/types.h>
11647 #endif
11648 #if defined(I_DIRENT)
11649 #include <dirent.h>
11650 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11651 #include <sys/dir.h>
11652 #endif
11653 #else
11654 #ifdef I_SYS_NDIR
11655 #include <sys/ndir.h>
11656 #else
11657 #ifdef I_SYS_DIR
11658 #ifdef hp9000s500
11659 #include <ndir.h>       /* may be wrong in the future */
11660 #else
11661 #include <sys/dir.h>
11662 #endif
11663 #endif
11664 #endif
11665 #endif 
11666 int main() {
11667         DIR *dirp = opendir(".");
11668         if (dirfd(dirp) >= 0)
11669                 exit(0);
11670         else
11671                 exit(1);
11672 }
11673 EOM
11674 val=$undef
11675 set dirfd
11676 if eval $compile; then
11677         val="$define"
11678 fi
11679 case "$val" in
11680 $define)        echo "dirfd() found." >&4       ;;
11681 *)              echo "dirfd() NOT found." >&4   ;;
11682 esac
11683 set d_dirfd
11684 eval $setvar
11685 $rm -f dirfd*
11686
11687 : see if dlerror exists
11688 xxx_runnm="$runnm"
11689 runnm=false
11690 set dlerror d_dlerror
11691 eval $inlibc
11692 runnm="$xxx_runnm"
11693
11694 : see if dlfcn is available
11695 set dlfcn.h i_dlfcn
11696 eval $inhdr
11697
11698 : Check what extension to use for shared libs
11699 case "$usedl" in
11700 $define|y|true)
11701         $cat << EOM
11702
11703 On a few systems, the dynamically loaded modules that perl generates and uses
11704 will need a different extension than shared libs. The default will probably
11705 be appropriate.
11706
11707 EOM
11708         case "$dlext" in
11709         '')     dflt="$so" ;;
11710         *)      dflt="$dlext" ;;
11711         esac
11712         rp='What is the extension of dynamically loaded modules'
11713         . ./myread
11714         dlext="$ans"
11715         ;;
11716 *)
11717         dlext="none"
11718         ;;
11719 esac
11720
11721 : Check if dlsym need a leading underscore
11722 echo " "
11723 val="$undef"
11724
11725 case "$dlsrc" in
11726 dl_dlopen.xs)
11727         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11728         $cat >dyna.c <<'EOM'
11729 fred () { }
11730 EOM
11731
11732 $cat >fred.c<<EOM
11733
11734 #include <stdio.h>
11735 #$i_stdlib I_STDLIB
11736 #ifdef I_STDLIB
11737 #include <stdlib.h>
11738 #endif
11739 #$i_dlfcn I_DLFCN
11740 #ifdef I_DLFCN
11741 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11742 #else
11743 #include <sys/types.h>
11744 #include <nlist.h>
11745 #include <link.h>
11746 #endif
11747
11748 extern int fred() ;
11749
11750 int main()
11751 {
11752     void * handle ;
11753     void * symbol ;
11754 #ifndef RTLD_LAZY
11755     int mode = 1 ;
11756 #else
11757     int mode = RTLD_LAZY ;
11758 #endif
11759     handle = dlopen("./dyna.$dlext", mode) ;
11760     if (handle == NULL) {
11761         printf ("1\n") ;
11762         fflush (stdout) ;
11763         exit(0);
11764     }
11765     symbol = dlsym(handle, "fred") ;
11766     if (symbol == NULL) {
11767         /* try putting a leading underscore */
11768         symbol = dlsym(handle, "_fred") ;
11769         if (symbol == NULL) {
11770             printf ("2\n") ;
11771             fflush (stdout) ;
11772             exit(0);
11773         }
11774         printf ("3\n") ;
11775     }
11776     else
11777         printf ("4\n") ;
11778     fflush (stdout) ;
11779     exit(0);
11780 }
11781 EOM
11782         : Call the object file tmp-dyna.o in case dlext=o.
11783         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11784                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11785                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
11786                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11787                 xxx=`$run ./fred`
11788                 case $xxx in
11789                 1)      echo "Test program failed using dlopen." >&4
11790                         echo "Perhaps you should not use dynamic loading." >&4;;
11791                 2)      echo "Test program failed using dlsym." >&4
11792                         echo "Perhaps you should not use dynamic loading." >&4;;
11793                 3)      echo "dlsym needs a leading underscore" >&4
11794                         val="$define" ;;
11795                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11796                 esac
11797         else
11798                 echo "I can't compile and run the test program." >&4
11799                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11800         fi
11801         ;;
11802 esac
11803
11804 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11805
11806 set d_dlsymun
11807 eval $setvar
11808
11809 : see if drand48_r exists
11810 set drand48_r d_drand48_r
11811 eval $inlibc
11812 case "$d_drand48_r" in
11813 "$define")
11814         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11815         case "$d_drand48_r_proto:$usethreads" in
11816         ":define")      d_drand48_r_proto=define
11817                 set d_drand48_r_proto drand48_r $hdrs
11818                 eval $hasproto ;;
11819         *)      ;;
11820         esac
11821         case "$d_drand48_r_proto" in
11822         define)
11823         case "$drand48_r_proto" in
11824         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11825         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11826         esac
11827         case "$drand48_r_proto" in
11828         ''|0)   d_drand48_r=undef
11829                 drand48_r_proto=0
11830                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11831         * )     case "$drand48_r_proto" in
11832                 REENTRANT_PROTO*) ;;
11833                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11834                 esac
11835                 echo "Prototype: $try" ;;
11836         esac
11837         ;;
11838         *)      case "$usethreads" in
11839                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11840                 esac
11841                 d_drand48_r=undef
11842                 drand48_r_proto=0
11843                 ;;
11844         esac
11845         ;;
11846 *)      drand48_r_proto=0
11847         ;;
11848 esac
11849
11850 : see if prototype for drand48 is available
11851 echo " "
11852 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11853 eval $hasproto
11854
11855 : see if dup2 exists
11856 set dup2 d_dup2
11857 eval $inlibc
11858
11859 : see if eaccess exists
11860 set eaccess d_eaccess
11861 eval $inlibc
11862
11863 : see if endgrent exists
11864 set endgrent d_endgrent
11865 eval $inlibc
11866
11867 : see if this is an grp system
11868 set grp.h i_grp
11869 eval $inhdr
11870
11871 case "$i_grp" in
11872 $define)
11873         xxx=`./findhdr grp.h`
11874         $cppstdin $cppflags $cppminus < $xxx >$$.h
11875
11876         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11877                 val="$define"
11878         else
11879                 val="$undef"
11880         fi
11881         set d_grpasswd
11882         eval $setvar
11883
11884         $rm -f $$.h
11885         ;;
11886 *)
11887         val="$undef";
11888         set d_grpasswd; eval $setvar
11889         ;;
11890 esac
11891
11892 : see if endgrent_r exists
11893 set endgrent_r d_endgrent_r
11894 eval $inlibc
11895 case "$d_endgrent_r" in
11896 "$define")
11897         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11898         case "$d_endgrent_r_proto:$usethreads" in
11899         ":define")      d_endgrent_r_proto=define
11900                 set d_endgrent_r_proto endgrent_r $hdrs
11901                 eval $hasproto ;;
11902         *)      ;;
11903         esac
11904         case "$d_endgrent_r_proto" in
11905         define)
11906         case "$endgrent_r_proto" in
11907         ''|0) try='int endgrent_r(FILE**);'
11908         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11909         esac
11910         case "$endgrent_r_proto" in
11911         ''|0) try='void endgrent_r(FILE**);'
11912         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11913         esac
11914         case "$endgrent_r_proto" in
11915         ''|0)   d_endgrent_r=undef
11916                 endgrent_r_proto=0
11917                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11918         * )     case "$endgrent_r_proto" in
11919                 REENTRANT_PROTO*) ;;
11920                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11921                 esac
11922                 echo "Prototype: $try" ;;
11923         esac
11924         ;;
11925         *)      case "$usethreads" in
11926                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11927                 esac
11928                 d_endgrent_r=undef
11929                 endgrent_r_proto=0
11930                 ;;
11931         esac
11932         ;;
11933 *)      endgrent_r_proto=0
11934         ;;
11935 esac
11936
11937 : see if endhostent exists
11938 set endhostent d_endhent
11939 eval $inlibc
11940
11941 : see if this is a netdb.h system
11942 set netdb.h i_netdb
11943 eval $inhdr
11944
11945 : see if endhostent_r exists
11946 set endhostent_r d_endhostent_r
11947 eval $inlibc
11948 case "$d_endhostent_r" in
11949 "$define")
11950         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11951         case "$d_endhostent_r_proto:$usethreads" in
11952         ":define")      d_endhostent_r_proto=define
11953                 set d_endhostent_r_proto endhostent_r $hdrs
11954                 eval $hasproto ;;
11955         *)      ;;
11956         esac
11957         case "$d_endhostent_r_proto" in
11958         define)
11959         case "$endhostent_r_proto" in
11960         ''|0) try='int endhostent_r(struct hostent_data*);'
11961         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11962         esac
11963         case "$endhostent_r_proto" in
11964         ''|0) try='void endhostent_r(struct hostent_data*);'
11965         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11966         esac
11967         case "$endhostent_r_proto" in
11968         ''|0)   d_endhostent_r=undef
11969                 endhostent_r_proto=0
11970                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11971         * )     case "$endhostent_r_proto" in
11972                 REENTRANT_PROTO*) ;;
11973                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11974                 esac
11975                 echo "Prototype: $try" ;;
11976         esac
11977         ;;
11978         *)      case "$usethreads" in
11979                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11980                 esac
11981                 d_endhostent_r=undef
11982                 endhostent_r_proto=0
11983                 ;;
11984         esac
11985         ;;
11986 *)      endhostent_r_proto=0
11987         ;;
11988 esac
11989
11990 : see if endnetent exists
11991 set endnetent d_endnent
11992 eval $inlibc
11993
11994 : see if endnetent_r exists
11995 set endnetent_r d_endnetent_r
11996 eval $inlibc
11997 case "$d_endnetent_r" in
11998 "$define")
11999         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12000         case "$d_endnetent_r_proto:$usethreads" in
12001         ":define")      d_endnetent_r_proto=define
12002                 set d_endnetent_r_proto endnetent_r $hdrs
12003                 eval $hasproto ;;
12004         *)      ;;
12005         esac
12006         case "$d_endnetent_r_proto" in
12007         define)
12008         case "$endnetent_r_proto" in
12009         ''|0) try='int endnetent_r(struct netent_data*);'
12010         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
12011         esac
12012         case "$endnetent_r_proto" in
12013         ''|0) try='void endnetent_r(struct netent_data*);'
12014         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
12015         esac
12016         case "$endnetent_r_proto" in
12017         ''|0)   d_endnetent_r=undef
12018                 endnetent_r_proto=0
12019                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12020         * )     case "$endnetent_r_proto" in
12021                 REENTRANT_PROTO*) ;;
12022                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12023                 esac
12024                 echo "Prototype: $try" ;;
12025         esac
12026         ;;
12027         *)      case "$usethreads" in
12028                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12029                 esac
12030                 d_endnetent_r=undef
12031                 endnetent_r_proto=0
12032                 ;;
12033         esac
12034         ;;
12035 *)      endnetent_r_proto=0
12036         ;;
12037 esac
12038
12039 : see if endprotoent exists
12040 set endprotoent d_endpent
12041 eval $inlibc
12042
12043 : see if endprotoent_r exists
12044 set endprotoent_r d_endprotoent_r
12045 eval $inlibc
12046 case "$d_endprotoent_r" in
12047 "$define")
12048         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12049         case "$d_endprotoent_r_proto:$usethreads" in
12050         ":define")      d_endprotoent_r_proto=define
12051                 set d_endprotoent_r_proto endprotoent_r $hdrs
12052                 eval $hasproto ;;
12053         *)      ;;
12054         esac
12055         case "$d_endprotoent_r_proto" in
12056         define)
12057         case "$endprotoent_r_proto" in
12058         ''|0) try='int endprotoent_r(struct protoent_data*);'
12059         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
12060         esac
12061         case "$endprotoent_r_proto" in
12062         ''|0) try='void endprotoent_r(struct protoent_data*);'
12063         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
12064         esac
12065         case "$endprotoent_r_proto" in
12066         ''|0)   d_endprotoent_r=undef
12067                 endprotoent_r_proto=0
12068                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12069         * )     case "$endprotoent_r_proto" in
12070                 REENTRANT_PROTO*) ;;
12071                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12072                 esac
12073                 echo "Prototype: $try" ;;
12074         esac
12075         ;;
12076         *)      case "$usethreads" in
12077                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12078                 esac
12079                 d_endprotoent_r=undef
12080                 endprotoent_r_proto=0
12081                 ;;
12082         esac
12083         ;;
12084 *)      endprotoent_r_proto=0
12085         ;;
12086 esac
12087
12088 : see if endpwent exists
12089 set endpwent d_endpwent
12090 eval $inlibc
12091
12092 : see if this is a pwd.h system
12093 set pwd.h i_pwd
12094 eval $inhdr
12095
12096 case "$i_pwd" in
12097 $define)
12098         xxx=`./findhdr pwd.h`
12099         $cppstdin $cppflags $cppminus < $xxx >$$.h
12100
12101         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12102                 val="$define"
12103         else
12104                 val="$undef"
12105         fi
12106         set d_pwquota
12107         eval $setvar
12108
12109         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12110                 val="$define"
12111         else
12112                 val="$undef"
12113         fi
12114         set d_pwage
12115         eval $setvar
12116
12117         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12118                 val="$define"
12119         else
12120                 val="$undef"
12121         fi
12122         set d_pwchange
12123         eval $setvar
12124
12125         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12126                 val="$define"
12127         else
12128                 val="$undef"
12129         fi
12130         set d_pwclass
12131         eval $setvar
12132
12133         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12134                 val="$define"
12135         else
12136                 val="$undef"
12137         fi
12138         set d_pwexpire
12139         eval $setvar
12140
12141         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12142                 val="$define"
12143         else
12144                 val="$undef"
12145         fi
12146         set d_pwcomment
12147         eval $setvar
12148
12149         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12150                 val="$define"
12151         else
12152                 val="$undef"
12153         fi
12154         set d_pwgecos
12155         eval $setvar
12156
12157         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12158                 val="$define"
12159         else
12160                 val="$undef"
12161         fi
12162         set d_pwpasswd
12163         eval $setvar
12164
12165         $rm -f $$.h
12166         ;;
12167 *)
12168         val="$undef"; 
12169         set d_pwquota; eval $setvar
12170         set d_pwage; eval $setvar
12171         set d_pwchange; eval $setvar
12172         set d_pwclass; eval $setvar
12173         set d_pwexpire; eval $setvar
12174         set d_pwcomment; eval $setvar
12175         set d_pwgecos; eval $setvar
12176         set d_pwpasswd; eval $setvar
12177         ;;
12178 esac
12179
12180 : see if endpwent_r exists
12181 set endpwent_r d_endpwent_r
12182 eval $inlibc
12183 case "$d_endpwent_r" in
12184 "$define")
12185         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12186         case "$d_endpwent_r_proto:$usethreads" in
12187         ":define")      d_endpwent_r_proto=define
12188                 set d_endpwent_r_proto endpwent_r $hdrs
12189                 eval $hasproto ;;
12190         *)      ;;
12191         esac
12192         case "$d_endpwent_r_proto" in
12193         define)
12194         case "$endpwent_r_proto" in
12195         ''|0) try='int endpwent_r(FILE**);'
12196         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
12197         esac
12198         case "$endpwent_r_proto" in
12199         ''|0) try='void endpwent_r(FILE**);'
12200         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
12201         esac
12202         case "$endpwent_r_proto" in
12203         ''|0)   d_endpwent_r=undef
12204                 endpwent_r_proto=0
12205                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12206         * )     case "$endpwent_r_proto" in
12207                 REENTRANT_PROTO*) ;;
12208                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12209                 esac
12210                 echo "Prototype: $try" ;;
12211         esac
12212         ;;
12213         *)      case "$usethreads" in
12214                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12215                 esac
12216                 d_endpwent_r=undef
12217                 endpwent_r_proto=0
12218                 ;;
12219         esac
12220         ;;
12221 *)      endpwent_r_proto=0
12222         ;;
12223 esac
12224
12225 : see if endservent exists
12226 set endservent d_endsent
12227 eval $inlibc
12228
12229 : see if endservent_r exists
12230 set endservent_r d_endservent_r
12231 eval $inlibc
12232 case "$d_endservent_r" in
12233 "$define")
12234         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12235         case "$d_endservent_r_proto:$usethreads" in
12236         ":define")      d_endservent_r_proto=define
12237                 set d_endservent_r_proto endservent_r $hdrs
12238                 eval $hasproto ;;
12239         *)      ;;
12240         esac
12241         case "$d_endservent_r_proto" in
12242         define)
12243         case "$endservent_r_proto" in
12244         ''|0) try='int endservent_r(struct servent_data*);'
12245         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
12246         esac
12247         case "$endservent_r_proto" in
12248         ''|0) try='void endservent_r(struct servent_data*);'
12249         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
12250         esac
12251         case "$endservent_r_proto" in
12252         ''|0)   d_endservent_r=undef
12253                 endservent_r_proto=0
12254                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12255         * )     case "$endservent_r_proto" in
12256                 REENTRANT_PROTO*) ;;
12257                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12258                 esac
12259                 echo "Prototype: $try" ;;
12260         esac
12261         ;;
12262         *)      case "$usethreads" in
12263                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12264                 esac
12265                 d_endservent_r=undef
12266                 endservent_r_proto=0
12267                 ;;
12268         esac
12269         ;;
12270 *)      endservent_r_proto=0
12271         ;;
12272 esac
12273
12274 : Locate the flags for 'open()'
12275 echo " "
12276 $cat >try.c <<EOCP
12277 #include <sys/types.h>
12278 #ifdef I_FCNTL
12279 #include <fcntl.h>
12280 #endif
12281 #ifdef I_SYS_FILE
12282 #include <sys/file.h>
12283 #endif
12284 #$i_stdlib I_STDLIB
12285 #ifdef I_STDLIB
12286 #include <stdlib.h>
12287 #endif
12288 int main() {
12289         if(O_RDONLY);
12290 #ifdef O_TRUNC
12291         exit(0);
12292 #else
12293         exit(1);
12294 #endif
12295 }
12296 EOCP
12297 : check sys/file.h first to get FREAD on Sun
12298 if $test `./findhdr sys/file.h` && \
12299                 set try -DI_SYS_FILE && eval $compile; then
12300         h_sysfile=true;
12301         echo "<sys/file.h> defines the O_* constants..." >&4
12302         if $run ./try; then
12303                 echo "and you have the 3 argument form of open()." >&4
12304                 val="$define"
12305         else
12306                 echo "but not the 3 argument form of open().  Oh, well." >&4
12307                 val="$undef"
12308         fi
12309 elif $test `./findhdr fcntl.h` && \
12310                 set try -DI_FCNTL && eval $compile; then
12311         h_fcntl=true;
12312         echo "<fcntl.h> defines the O_* constants..." >&4
12313         if $run ./try; then
12314                 echo "and you have the 3 argument form of open()." >&4
12315                 val="$define"
12316         else
12317                 echo "but not the 3 argument form of open().  Oh, well." >&4
12318                 val="$undef"
12319         fi
12320 else
12321         val="$undef"
12322         echo "I can't find the O_* constant definitions!  You got problems." >&4
12323 fi
12324 set d_open3
12325 eval $setvar
12326 $rm_try
12327
12328 : script used to emit important warnings
12329 cat >warn <<EOS
12330 $startsh
12331 if test \$# -gt 0; then
12332         echo "\$@" >msg
12333 else
12334         cat >msg
12335 fi
12336 echo "*** WARNING:" >&4
12337 sed -e 's/^/*** /' <msg >&4
12338 echo "*** " >&4
12339 cat msg >>config.msg
12340 echo " " >>config.msg
12341 rm -f msg
12342 EOS
12343 chmod +x warn
12344 $eunicefix warn
12345
12346 : see which of string.h or strings.h is needed
12347 echo " "
12348 strings=`./findhdr string.h`
12349 if $test "$strings" && $test -r "$strings"; then
12350         echo "Using <string.h> instead of <strings.h>." >&4
12351         val="$define"
12352 else
12353         val="$undef"
12354         strings=`./findhdr strings.h`
12355         if $test "$strings" && $test -r "$strings"; then
12356                 echo "Using <strings.h> instead of <string.h>." >&4
12357         else
12358                 ./warn "No string header found -- You'll surely have problems."
12359         fi
12360 fi
12361 set i_string
12362 eval $setvar
12363 case "$i_string" in
12364 "$undef") strings=`./findhdr strings.h`;;
12365 *)        strings=`./findhdr string.h`;;
12366 esac
12367
12368 : see if this is a sys/file.h system
12369 val=''
12370 set sys/file.h val
12371 eval $inhdr
12372
12373 : do we need to include sys/file.h ?
12374 case "$val" in
12375 "$define")
12376         echo " "
12377         if $h_sysfile; then
12378                 val="$define"
12379                 echo "We'll be including <sys/file.h>." >&4
12380         else
12381                 val="$undef"
12382                 echo "We won't be including <sys/file.h>." >&4
12383         fi
12384         ;;
12385 *)
12386         h_sysfile=false
12387         ;;
12388 esac
12389 set i_sysfile
12390 eval $setvar
12391
12392 : see if fcntl.h is there
12393 val=''
12394 set fcntl.h val
12395 eval $inhdr
12396
12397 : see if we can include fcntl.h
12398 case "$val" in
12399 "$define")
12400         echo " "
12401         if $h_fcntl; then
12402                 val="$define"
12403                 echo "We'll be including <fcntl.h>." >&4
12404         else
12405                 val="$undef"
12406                 if $h_sysfile; then
12407         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12408                 else
12409                         echo "We won't be including <fcntl.h>." >&4
12410                 fi
12411         fi
12412         ;;
12413 *)
12414         h_fcntl=false
12415         val="$undef"
12416         ;;
12417 esac
12418 set i_fcntl
12419 eval $setvar
12420
12421 : see if fork exists
12422 set fork d_fork
12423 eval $inlibc
12424
12425 : see if pipe exists
12426 set pipe d_pipe
12427 eval $inlibc
12428
12429 : check for non-blocking I/O stuff
12430 case "$h_sysfile" in
12431 true) echo "#include <sys/file.h>" > head.c;;
12432 *)
12433        case "$h_fcntl" in
12434        true) echo "#include <fcntl.h>" > head.c;;
12435        *) echo "#include <sys/fcntl.h>" > head.c;;
12436        esac
12437        ;;
12438 esac
12439 echo " "
12440 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12441 case "$o_nonblock" in
12442 '')
12443         $cat head.c > try.c
12444         $cat >>try.c <<EOCP
12445 #include <stdio.h>
12446 #$i_stdlib I_STDLIB
12447 #ifdef I_STDLIB
12448 #include <stdlib.h>
12449 #endif
12450 #$i_fcntl I_FCNTL
12451 #ifdef I_FCNTL
12452 #include <fcntl.h>
12453 #endif
12454 int main() {
12455 #ifdef O_NONBLOCK
12456         printf("O_NONBLOCK\n");
12457         exit(0);
12458 #endif
12459 #ifdef O_NDELAY
12460         printf("O_NDELAY\n");
12461         exit(0);
12462 #endif
12463 #ifdef FNDELAY
12464         printf("FNDELAY\n");
12465         exit(0);
12466 #endif
12467         exit(0);
12468 }
12469 EOCP
12470         set try
12471         if eval $compile_ok; then
12472                 o_nonblock=`$run ./try`
12473                 case "$o_nonblock" in
12474                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12475                 *) echo "Seems like we can use $o_nonblock.";;
12476                 esac
12477         else
12478                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12479         fi
12480         ;;
12481 *) echo "Using $hint value $o_nonblock.";;
12482 esac
12483 $rm_try
12484
12485 echo " "
12486 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12487 case "$eagain" in
12488 '')
12489         case "$d_fork:$d_pipe" in
12490         define:define)
12491         $cat head.c > try.c
12492         $cat >>try.c <<EOCP
12493 #include <errno.h>
12494 #include <sys/types.h>
12495 #include <signal.h>
12496 #include <stdio.h>
12497 #$i_stdlib I_STDLIB
12498 #ifdef I_STDLIB
12499 #include <stdlib.h>
12500 #endif
12501 #$i_fcntl I_FCNTL
12502 #ifdef I_FCNTL
12503 #include <fcntl.h>
12504 #endif
12505 #define MY_O_NONBLOCK $o_nonblock
12506 #ifndef errno  /* XXX need better Configure test */
12507 extern int errno;
12508 #endif
12509 #$i_unistd I_UNISTD
12510 #ifdef I_UNISTD
12511 #include <unistd.h>
12512 #endif
12513 #$i_string I_STRING
12514 #ifdef I_STRING
12515 #include <string.h>
12516 #else
12517 #include <strings.h>
12518 #endif
12519 $signal_t blech(int x) { exit(3); }
12520 EOCP
12521         $cat >> try.c <<'EOCP'
12522 int main()
12523 {
12524         int pd[2];
12525         int pu[2];
12526         char buf[1];
12527         char string[100];
12528
12529         pipe(pd);       /* Down: child -> parent */
12530         pipe(pu);       /* Up: parent -> child */
12531         if (0 != fork()) {
12532                 int ret;
12533                 close(pd[1]);   /* Parent reads from pd[0] */
12534                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12535 #ifdef F_SETFL
12536                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12537                         exit(1);
12538 #else
12539                 exit(4);
12540 #endif
12541                 signal(SIGALRM, blech);
12542                 alarm(5);
12543                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12544                         exit(2);
12545                 sprintf(string, "%d\n", ret);
12546                 write(2, string, strlen(string));
12547                 alarm(0);
12548 #ifdef EAGAIN
12549                 if (errno == EAGAIN) {
12550                         printf("EAGAIN\n");
12551                         goto ok;
12552                 }
12553 #endif
12554 #ifdef EWOULDBLOCK
12555                 if (errno == EWOULDBLOCK)
12556                         printf("EWOULDBLOCK\n");
12557 #endif
12558         ok:
12559                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12560                 sleep(2);                               /* Give it time to close our pipe */
12561                 alarm(5);
12562                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12563                 alarm(0);
12564                 sprintf(string, "%d\n", ret);
12565                 write(4, string, strlen(string));
12566                 exit(0);
12567         }
12568
12569         close(pd[0]);                   /* We write to pd[1] */
12570         close(pu[1]);                   /* We read from pu[0] */
12571         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12572         close(pd[1]);                   /* Pipe pd is now fully closed! */
12573         exit(0);                                /* Bye bye, thank you for playing! */
12574 }
12575 EOCP
12576         set try
12577         if eval $compile_ok; then
12578                 echo "$startsh" >mtry
12579                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12580                 chmod +x mtry
12581                 ./mtry >/dev/null 2>&1
12582                 case $? in
12583                 0) eagain=`$cat try.out`;;
12584                 1) echo "Could not perform non-blocking setting!";;
12585                 2) echo "I did a successful read() for something that was not there!";;
12586                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12587                 4) echo "Could not find F_SETFL!";;
12588                 *) echo "Something terribly wrong happened during testing.";;
12589                 esac
12590                 rd_nodata=`$cat try.ret`
12591                 echo "A read() system call with no data present returns $rd_nodata."
12592                 case "$rd_nodata" in
12593                 0|-1) ;;
12594                 *)
12595                         echo "(That's peculiar, fixing that to be -1.)"
12596                         rd_nodata=-1
12597                         ;;
12598                 esac
12599                 case "$eagain" in
12600                 '')
12601                         echo "Forcing errno EAGAIN on read() with no data available."
12602                         eagain=EAGAIN
12603                         ;;
12604                 *)
12605                         echo "Your read() sets errno to $eagain when no data is available."
12606                         ;;
12607                 esac
12608                 status=`$cat try.err`
12609                 case "$status" in
12610                 0) echo "And it correctly returns 0 to signal EOF.";;
12611                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12612                 *) echo "However, your read() returns '$status' on EOF??";;
12613                 esac
12614                 val="$define"
12615                 if test "$status" = "$rd_nodata"; then
12616                         echo "WARNING: you can't distinguish between EOF and no data!"
12617                         val="$undef"
12618                 fi
12619         else
12620                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12621                 eagain=EAGAIN
12622         fi
12623         ;;
12624         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12625                 eagain=EAGAIN
12626                 val="$define"
12627                 ;;
12628         esac
12629         set d_eofnblk
12630         eval $setvar
12631         ;;
12632 *)
12633         echo "Using $hint value $eagain."
12634         echo "Your read() returns $rd_nodata when no data is present."
12635         case "$d_eofnblk" in
12636         "$define") echo "And you can see EOF because read() returns 0.";;
12637         "$undef") echo "But you can't see EOF status from read() returned value.";;
12638         *)
12639                 echo "(Assuming you can't see EOF status from read anyway.)"
12640                 d_eofnblk=$undef
12641                 ;;
12642         esac
12643         ;;
12644 esac
12645 $rm_try head.c mtry
12646
12647 : see if _ptr and _cnt from stdio act std
12648 echo " "
12649
12650 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12651         echo "(Looks like you have stdio.h from BSD.)"
12652         case "$stdio_ptr" in
12653         '') stdio_ptr='((fp)->_p)'
12654                 ptr_lval=$define
12655                 ;;
12656         *)      ptr_lval=$d_stdio_ptr_lval;;
12657         esac
12658         case "$stdio_cnt" in
12659         '') stdio_cnt='((fp)->_r)'
12660                 cnt_lval=$define
12661                 ;;
12662         *)      cnt_lval=$d_stdio_cnt_lval;;
12663         esac
12664         case "$stdio_base" in
12665         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12666         esac
12667         case "$stdio_bufsiz" in
12668         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12669         esac
12670 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12671         echo "(Looks like you have stdio.h from Linux.)"
12672         case "$stdio_ptr" in
12673         '') stdio_ptr='((fp)->_IO_read_ptr)'
12674                 ptr_lval=$define
12675                 ;;
12676         *)      ptr_lval=$d_stdio_ptr_lval;;
12677         esac
12678         case "$stdio_cnt" in
12679         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12680                 cnt_lval=$undef
12681                 ;;
12682         *)      cnt_lval=$d_stdio_cnt_lval;;
12683         esac
12684         case "$stdio_base" in
12685         '') stdio_base='((fp)->_IO_read_base)';;
12686         esac
12687         case "$stdio_bufsiz" in
12688         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12689         esac
12690 else
12691         case "$stdio_ptr" in
12692         '') stdio_ptr='((fp)->_ptr)'
12693                 ptr_lval=$define
12694                 ;;
12695         *)      ptr_lval=$d_stdio_ptr_lval;;
12696         esac
12697         case "$stdio_cnt" in
12698         '') stdio_cnt='((fp)->_cnt)'
12699                 cnt_lval=$define
12700                 ;;
12701         *)      cnt_lval=$d_stdio_cnt_lval;;
12702         esac
12703         case "$stdio_base" in
12704         '') stdio_base='((fp)->_base)';;
12705         esac
12706         case "$stdio_bufsiz" in
12707         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12708         esac
12709 fi
12710
12711 : test whether _ptr and _cnt really work
12712 echo "Checking how std your stdio is..." >&4
12713 $cat >try.c <<EOP
12714 #include <stdio.h>
12715 #$i_stdlib I_STDLIB
12716 #ifdef I_STDLIB
12717 #include <stdlib.h>
12718 #endif
12719 #define FILE_ptr(fp)    $stdio_ptr
12720 #define FILE_cnt(fp)    $stdio_cnt
12721 int main() {
12722         FILE *fp = fopen("try.c", "r");
12723         char c = getc(fp);
12724         if (
12725                 18 <= FILE_cnt(fp) &&
12726                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12727         )
12728                 exit(0);
12729         exit(1);
12730 }
12731 EOP
12732 val="$undef"
12733 set try
12734 if eval $compile && $to try.c; then
12735         if $run ./try; then
12736                 echo "Your stdio acts pretty std."
12737                 val="$define"
12738         else
12739                 echo "Your stdio isn't very std."
12740         fi
12741 else
12742         echo "Your stdio doesn't appear very std."
12743 fi
12744 $rm_try
12745
12746 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12747 # direct buffer manipulation no longer works.  The Configure tests
12748 # should be changed to correctly detect this, but until then,
12749 # the following check should at least let perl compile and run.
12750 # (This quick fix should be updated before 5.8.1.)
12751 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12752 # A. Dougherty, June 3, 2002.
12753 case "$d_gnulibc" in
12754 $define)
12755         case "$gnulibc_version" in
12756         2.[01]*)  ;;
12757         2.2) ;;
12758         2.2.[0-9]) ;;
12759         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12760                 val="$undef"
12761                 ;;
12762         esac
12763         ;;
12764 esac
12765 set d_stdstdio
12766 eval $setvar
12767
12768 : Can _ptr be used as an lvalue?
12769 case "$d_stdstdio$ptr_lval" in
12770 $define$define) val=$define ;;
12771 *) val=$undef ;;
12772 esac
12773 set d_stdio_ptr_lval
12774 eval $setvar
12775
12776 : Can _cnt be used as an lvalue?
12777 case "$d_stdstdio$cnt_lval" in
12778 $define$define) val=$define ;;
12779 *) val=$undef ;;
12780 esac
12781 set d_stdio_cnt_lval
12782 eval $setvar
12783
12784
12785 : test whether setting _ptr sets _cnt as a side effect
12786 d_stdio_ptr_lval_sets_cnt="$undef"
12787 d_stdio_ptr_lval_nochange_cnt="$undef"
12788 case "$d_stdio_ptr_lval$d_stdstdio" in
12789 $define$define)
12790         echo "Checking to see what happens if we set the stdio ptr..." >&4
12791 $cat >try.c <<EOP
12792 #include <stdio.h>
12793 /* Can we scream? */
12794 /* Eat dust sed :-) */
12795 /* In the buffer space, no one can hear you scream. */
12796 #$i_stdlib I_STDLIB
12797 #ifdef I_STDLIB
12798 #include <stdlib.h>
12799 #endif
12800 #define FILE_ptr(fp)    $stdio_ptr
12801 #define FILE_cnt(fp)    $stdio_cnt
12802 #include <sys/types.h>
12803 int main() {
12804         FILE *fp = fopen("try.c", "r");
12805         int c;
12806         char *ptr;
12807         size_t cnt;
12808         if (!fp) {
12809             puts("Fail even to read");
12810             exit(1);
12811         }
12812         c = getc(fp); /* Read away the first # */
12813         if (c == EOF) {
12814             puts("Fail even to read");
12815             exit(1);
12816         }
12817         if (!(
12818                 18 <= FILE_cnt(fp) &&
12819                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12820         )) {
12821                 puts("Fail even to read");
12822                 exit (1);
12823         }
12824         ptr = (char*) FILE_ptr(fp);
12825         cnt = (size_t)FILE_cnt(fp);
12826
12827         FILE_ptr(fp) += 42;
12828
12829         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12830                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12831                 exit (1);
12832         }
12833         if (FILE_cnt(fp) <= 20) {
12834                 printf ("Fail (<20 chars to test)");
12835                 exit (1);
12836         }
12837         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12838                 puts("Fail compare");
12839                 exit (1);
12840         }
12841         if (cnt == FILE_cnt(fp)) {
12842                 puts("Pass_unchanged");
12843                 exit (0);
12844         }
12845         if (FILE_cnt(fp) == (cnt - 42)) {
12846                 puts("Pass_changed");
12847                 exit (0);
12848         }
12849         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12850         return 1;
12851
12852 }
12853 EOP
12854         set try
12855         if eval $compile && $to try.c; then
12856                 case `$run ./try` in
12857                 Pass_changed)
12858                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12859                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12860                 Pass_unchanged)
12861                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12862                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12863                 Fail*)
12864                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12865                 *)
12866                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12867         esac
12868         else
12869                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12870         fi
12871         $rm_try
12872         ;;
12873 esac
12874
12875 : see if _base is also standard
12876 val="$undef"
12877 case "$d_stdstdio" in
12878 $define)
12879         $cat >try.c <<EOP
12880 #include <stdio.h>
12881 #$i_stdlib I_STDLIB
12882 #ifdef I_STDLIB
12883 #include <stdlib.h>
12884 #endif
12885 #define FILE_base(fp)   $stdio_base
12886 #define FILE_bufsiz(fp) $stdio_bufsiz
12887 int main() {
12888         FILE *fp = fopen("try.c", "r");
12889         char c = getc(fp);
12890         if (
12891                 19 <= FILE_bufsiz(fp) &&
12892                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12893         )
12894                 exit(0);
12895         exit(1);
12896 }
12897 EOP
12898         set try
12899         if eval $compile && $to try.c; then
12900                 if $run ./try; then
12901                         echo "And its _base field acts std."
12902                         val="$define"
12903                 else
12904                         echo "But its _base field isn't std."
12905                 fi
12906         else
12907                 echo "However, it seems to be lacking the _base field."
12908         fi
12909         $rm_try
12910         ;;
12911 esac
12912 set d_stdiobase
12913 eval $setvar
12914
12915 : see if fast_stdio exists
12916 val="$undef"
12917 case "$d_stdstdio:$d_stdio_ptr_lval" in
12918 "$define:$define")
12919         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12920         *$define*)
12921                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12922                 val="$define"
12923                 ;;
12924         esac
12925         ;;
12926 esac
12927 set d_faststdio
12928 eval $setvar
12929
12930
12931
12932 : see if fchdir exists
12933 set fchdir d_fchdir
12934 eval $inlibc
12935
12936 : see if fchmod exists
12937 set fchmod d_fchmod
12938 eval $inlibc
12939
12940 : see if fchown exists
12941 set fchown d_fchown
12942 eval $inlibc
12943
12944 : see if this is an fcntl system
12945 set fcntl d_fcntl
12946 eval $inlibc
12947
12948 : See if fcntl-based locking works.
12949 echo " "
12950 $cat >try.c <<EOCP
12951 #$i_stdlib I_STDLIB
12952 #ifdef I_STDLIB
12953 #include <stdlib.h>
12954 #endif
12955 #include <unistd.h>
12956 #include <fcntl.h>
12957 #include <signal.h>
12958 $signal_t blech(int x) { exit(3); }
12959 int main() {
12960 #if defined(F_SETLK) && defined(F_SETLKW)
12961      struct flock flock;
12962      int retval, fd;
12963      fd = open("try.c", O_RDONLY);
12964      flock.l_type = F_RDLCK;
12965      flock.l_whence = SEEK_SET;
12966      flock.l_start = flock.l_len = 0;
12967      signal(SIGALRM, blech);
12968      alarm(10);
12969      retval = fcntl(fd, F_SETLK, &flock);
12970      close(fd);
12971      (retval < 0 ? exit(2) : exit(0));
12972 #else
12973      exit(2);
12974 #endif
12975 }
12976 EOCP
12977 echo "Checking if fcntl-based file locking works... "
12978 case "$d_fcntl" in
12979 "$define")
12980         set try
12981         if eval $compile_ok; then
12982                 if $run ./try; then
12983                         echo "Yes, it seems to work."
12984                         val="$define"
12985                 else
12986                         echo "Nope, it didn't work."
12987                         val="$undef"
12988                         case "$?" in
12989                         3) $cat >&4 <<EOM
12990 ***
12991 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12992 *** This is (almost) impossible.
12993 *** If your NFS lock daemons are not feeling well, something like
12994 *** this may happen, please investigate.  Cannot continue, aborting.
12995 ***
12996 EOM
12997                                 exit 1
12998                                 ;;
12999                         esac
13000                 fi
13001         else
13002                 echo "I'm unable to compile the test program, so I'll assume not."
13003                 val="$undef"
13004         fi
13005         ;;
13006 *) val="$undef";
13007         echo "Nope, since you don't even have fcntl()."
13008         ;;
13009 esac
13010 set d_fcntl_can_lock
13011 eval $setvar
13012 $rm_try
13013
13014 : check for fd_set items
13015 $cat <<EOM
13016
13017 Checking to see how well your C compiler handles fd_set and friends ...
13018 EOM
13019 $cat >try.c <<EOCP
13020 #$i_stdlib I_STDLIB
13021 #ifdef I_STDLIB
13022 #include <stdlib.h>
13023 #endif
13024 #$i_systime I_SYS_TIME
13025 #$i_sysselct I_SYS_SELECT
13026 #$d_socket HAS_SOCKET
13027 #include <sys/types.h>
13028 #ifdef HAS_SOCKET
13029 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13030 #endif
13031 #ifdef I_SYS_TIME
13032 #include <sys/time.h>
13033 #endif
13034 #ifdef I_SYS_SELECT
13035 #include <sys/select.h>
13036 #endif
13037 int main() {
13038         fd_set fds;
13039
13040 #ifdef TRYBITS
13041         if(fds.fds_bits);
13042 #endif
13043
13044 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13045         exit(0);
13046 #else
13047         exit(1);
13048 #endif
13049 }
13050 EOCP
13051 set try -DTRYBITS
13052 if eval $compile; then
13053         d_fds_bits="$define"
13054         d_fd_set="$define"
13055         echo "Well, your system knows about the normal fd_set typedef..." >&4
13056         if $run ./try; then
13057                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13058                 d_fd_macros="$define"
13059         else
13060                 $cat >&4 <<'EOM'
13061 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13062 EOM
13063                 d_fd_macros="$undef"
13064         fi
13065 else
13066         $cat <<'EOM'
13067 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13068 EOM
13069         set try
13070         if eval $compile; then
13071                 d_fds_bits="$undef"
13072                 d_fd_set="$define"
13073                 echo "Well, your system has some sort of fd_set available..." >&4
13074                 if $run ./try; then
13075                         echo "and you have the normal fd_set macros." >&4
13076                         d_fd_macros="$define"
13077                 else
13078                         $cat <<'EOM'
13079 but not the normal fd_set macros!  Gross!  More work for me...
13080 EOM
13081                         d_fd_macros="$undef"
13082                 fi
13083         else
13084         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13085                 d_fd_set="$undef"
13086                 d_fds_bits="$undef"
13087                 d_fd_macros="$undef"
13088         fi
13089 fi
13090 $rm_try
13091
13092 : see if fgetpos exists
13093 set fgetpos d_fgetpos
13094 eval $inlibc
13095
13096 : see if finite exists
13097 set finite d_finite
13098 eval $inlibc
13099
13100 : see if finitel exists
13101 set finitel d_finitel
13102 eval $inlibc
13103
13104 : see if flock exists
13105 set flock d_flock
13106 eval $inlibc
13107
13108 : see if prototype for flock is available
13109 echo " "
13110 set d_flockproto flock $i_sysfile sys/file.h
13111 eval $hasproto
13112
13113 : see if fp_class exists
13114 set fp_class d_fp_class
13115 eval $inlibc
13116
13117 : see if pathconf exists
13118 set pathconf d_pathconf
13119 eval $inlibc
13120
13121 : see if fpathconf exists
13122 set fpathconf d_fpathconf
13123 eval $inlibc
13124
13125 : see if fpclass exists
13126 set fpclass d_fpclass
13127 eval $inlibc
13128
13129 : see if fpclassify exists
13130 set fpclassify d_fpclassify
13131 eval $inlibc
13132
13133 : see if fpclassl exists
13134 set fpclassl d_fpclassl
13135 eval $inlibc
13136
13137 : check for fpos64_t
13138 echo " "
13139 echo "Checking to see if you have fpos64_t..." >&4
13140 $cat >try.c <<EOCP
13141 #include <stdio.h>
13142 int main() { fpos64_t x = 7; }
13143 EOCP
13144 set try
13145 if eval $compile; then
13146         val="$define"
13147         echo "You have fpos64_t."
13148 else
13149         val="$undef"
13150         echo "You do not have fpos64_t."
13151         case "$fpossize" in
13152         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13153         esac
13154 fi
13155 $rm_try
13156 set d_fpos64_t
13157 eval $setvar
13158
13159 : see if frexpl exists
13160 set frexpl d_frexpl
13161 eval $inlibc
13162
13163 : see if this is a sys/param system
13164 set sys/param.h i_sysparam
13165 eval $inhdr
13166
13167 : see if this is a sys/mount.h system
13168 set sys/mount.h i_sysmount
13169 eval $inhdr
13170
13171 : Check for fs_data_s
13172 echo " "
13173 echo "Checking to see if your system supports struct fs_data..." >&4
13174 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13175 eval $hasstruct
13176 case "$d_fs_data_s" in
13177 "$define")      echo "Yes, it does."   ;;
13178 *)              echo "No, it doesn't." ;;
13179 esac
13180
13181 : see if fseeko exists
13182 set fseeko d_fseeko
13183 eval $inlibc
13184 case "$longsize" in
13185 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13186 esac
13187
13188 : see if fsetpos exists
13189 set fsetpos d_fsetpos
13190 eval $inlibc
13191
13192 : see if fstatfs exists
13193 set fstatfs d_fstatfs
13194 eval $inlibc
13195
13196 : see if statvfs exists
13197 set statvfs d_statvfs
13198 eval $inlibc
13199
13200 : see if fstatvfs exists
13201 set fstatvfs d_fstatvfs
13202 eval $inlibc
13203
13204
13205 : see if fsync exists
13206 set fsync d_fsync
13207 eval $inlibc
13208
13209 : see if ftello exists
13210 set ftello d_ftello
13211 eval $inlibc
13212 case "$longsize" in
13213 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13214 esac
13215
13216 : check for a working futimes
13217 d_futimes="$undef"
13218 echo " "
13219 echo "Checking if you have a working futimes()" >&4
13220 $cat >try.c <<EOCP
13221 #include <stdio.h>
13222 #include <sys/time.h>
13223 #include <errno.h>
13224 #include <fcntl.h>
13225
13226 int main ()
13227 {
13228     int fd, rv;
13229     fd = open ("try.c", O_RDWR);
13230     if (-1 == fd) exit (1);
13231     rv = futimes (fd, NULL);
13232     exit (rv == -1 ? errno : 0);
13233 }
13234 EOCP
13235 set try
13236 if eval $compile; then
13237     `$run ./try`
13238     rc=$?
13239     case "$rc" in
13240         0)  echo "Yes, you have" >&4
13241             d_futimes="$define"
13242             ;;
13243         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13244             ;;
13245     esac
13246 else
13247     echo "No, it does not (probably harmless)" >&4
13248 fi
13249 $rm_try
13250
13251 : see if getcwd exists
13252 set getcwd d_getcwd
13253 eval $inlibc
13254
13255 : see if getespwnam exists
13256 set getespwnam d_getespwnam
13257 eval $inlibc
13258
13259 : see if getfsstat exists
13260 set getfsstat d_getfsstat
13261 eval $inlibc
13262
13263 : see if getgrent exists
13264 set getgrent d_getgrent
13265 eval $inlibc
13266
13267 : see if getgrent_r exists
13268 set getgrent_r d_getgrent_r
13269 eval $inlibc
13270 case "$d_getgrent_r" in
13271 "$define")
13272         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13273         case "$d_getgrent_r_proto:$usethreads" in
13274         ":define")      d_getgrent_r_proto=define
13275                 set d_getgrent_r_proto getgrent_r $hdrs
13276                 eval $hasproto ;;
13277         *)      ;;
13278         esac
13279         case "$d_getgrent_r_proto" in
13280         define)
13281         case "$getgrent_r_proto" in
13282         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13283         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13284         esac
13285         case "$getgrent_r_proto" in
13286         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13287         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13288         esac
13289         case "$getgrent_r_proto" in
13290         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13291         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
13292         esac
13293         case "$getgrent_r_proto" in
13294         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13295         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
13296         esac
13297         case "$getgrent_r_proto" in
13298         ''|0) try='int getgrent_r(struct group*, char*, int);'
13299         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
13300         esac
13301         case "$getgrent_r_proto" in
13302         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13303         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13304         esac
13305         case "$getgrent_r_proto" in
13306         ''|0)   d_getgrent_r=undef
13307                 getgrent_r_proto=0
13308                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13309         * )     case "$getgrent_r_proto" in
13310                 REENTRANT_PROTO*) ;;
13311                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13312                 esac
13313                 echo "Prototype: $try" ;;
13314         esac
13315         ;;
13316         *)      case "$usethreads" in
13317                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13318                 esac
13319                 d_getgrent_r=undef
13320                 getgrent_r_proto=0
13321                 ;;
13322         esac
13323         ;;
13324 *)      getgrent_r_proto=0
13325         ;;
13326 esac
13327
13328 : see if getgrgid_r exists
13329 set getgrgid_r d_getgrgid_r
13330 eval $inlibc
13331 case "$d_getgrgid_r" in
13332 "$define")
13333         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13334         case "$d_getgrgid_r_proto:$usethreads" in
13335         ":define")      d_getgrgid_r_proto=define
13336                 set d_getgrgid_r_proto getgrgid_r $hdrs
13337                 eval $hasproto ;;
13338         *)      ;;
13339         esac
13340         case "$d_getgrgid_r_proto" in
13341         define)
13342         case "$getgrgid_r_proto" in
13343         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13344         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13345         esac
13346         case "$getgrgid_r_proto" in
13347         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13348         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13349         esac
13350         case "$getgrgid_r_proto" in
13351         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13352         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13353         esac
13354         case "$getgrgid_r_proto" in
13355         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13356         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13357         esac
13358         case "$getgrgid_r_proto" in
13359         ''|0)   d_getgrgid_r=undef
13360                 getgrgid_r_proto=0
13361                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13362         * )     case "$getgrgid_r_proto" in
13363                 REENTRANT_PROTO*) ;;
13364                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13365                 esac
13366                 echo "Prototype: $try" ;;
13367         esac
13368         ;;
13369         *)      case "$usethreads" in
13370                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13371                 esac
13372                 d_getgrgid_r=undef
13373                 getgrgid_r_proto=0
13374                 ;;
13375         esac
13376         ;;
13377 *)      getgrgid_r_proto=0
13378         ;;
13379 esac
13380
13381 : see if getgrnam_r exists
13382 set getgrnam_r d_getgrnam_r
13383 eval $inlibc
13384 case "$d_getgrnam_r" in
13385 "$define")
13386         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13387         case "$d_getgrnam_r_proto:$usethreads" in
13388         ":define")      d_getgrnam_r_proto=define
13389                 set d_getgrnam_r_proto getgrnam_r $hdrs
13390                 eval $hasproto ;;
13391         *)      ;;
13392         esac
13393         case "$d_getgrnam_r_proto" in
13394         define)
13395         case "$getgrnam_r_proto" in
13396         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13397         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13398         esac
13399         case "$getgrnam_r_proto" in
13400         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13401         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13402         esac
13403         case "$getgrnam_r_proto" in
13404         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13405         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13406         esac
13407         case "$getgrnam_r_proto" in
13408         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13409         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13410         esac
13411         case "$getgrnam_r_proto" in
13412         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13413         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13414         esac
13415         case "$getgrnam_r_proto" in
13416         ''|0)   d_getgrnam_r=undef
13417                 getgrnam_r_proto=0
13418                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13419         * )     case "$getgrnam_r_proto" in
13420                 REENTRANT_PROTO*) ;;
13421                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13422                 esac
13423                 echo "Prototype: $try" ;;
13424         esac
13425         ;;
13426         *)      case "$usethreads" in
13427                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13428                 esac
13429                 d_getgrnam_r=undef
13430                 getgrnam_r_proto=0
13431                 ;;
13432         esac
13433         ;;
13434 *)      getgrnam_r_proto=0
13435         ;;
13436 esac
13437
13438 : see if gethostbyaddr exists
13439 set gethostbyaddr d_gethbyaddr
13440 eval $inlibc
13441
13442 : see if gethostbyname exists
13443 set gethostbyname d_gethbyname
13444 eval $inlibc
13445
13446 : see if gethostent exists
13447 set gethostent d_gethent
13448 eval $inlibc
13449
13450 : see how we will look up host name
13451 echo " "
13452 call=''
13453 if set gethostname val -f d_gethname; eval $csym; $val; then
13454         echo 'gethostname() found.' >&4
13455         d_gethname="$define"
13456         call=gethostname
13457 fi
13458 if set uname val -f d_uname; eval $csym; $val; then
13459         if ./xenix; then
13460                 $cat <<'EOM'
13461 uname() was found, but you're running xenix, and older versions of xenix
13462 have a broken uname(). If you don't really know whether your xenix is old
13463 enough to have a broken system call, use the default answer.
13464
13465 EOM
13466                 dflt=y
13467                 case "$d_uname" in
13468                 "$define") dflt=n;;
13469                 esac
13470                 rp='Is your uname() broken?'
13471                 . ./myread
13472                 case "$ans" in
13473                 n*) d_uname="$define"; call=uname;;
13474                 esac
13475         else
13476                 echo 'uname() found.' >&4
13477                 d_uname="$define"
13478                 case "$call" in
13479                 '') call=uname ;;
13480                 esac
13481         fi
13482 fi
13483 case "$d_gethname" in
13484 '') d_gethname="$undef";;
13485 esac
13486 case "$d_uname" in
13487 '') d_uname="$undef";;
13488 esac
13489 case "$d_uname$d_gethname" in
13490 *define*)
13491         dflt=n
13492         cat <<EOM
13493
13494 Every now and then someone has a $call() that lies about the hostname
13495 but can't be fixed for political or economic reasons.  If you wish, I can
13496 pretend $call() isn't there and maybe compute hostname at run-time
13497 thanks to the '$phostname' command.
13498
13499 EOM
13500         rp="Shall I ignore $call() from now on?"
13501         . ./myread
13502         case "$ans" in
13503         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13504         esac;;
13505 esac
13506 case "$phostname" in
13507 '') aphostname='';;
13508 *) case "$aphostname" in
13509         /*) ;;
13510         *) set X $phostname
13511                 shift
13512                 file=$1
13513                 shift
13514                 file=`./loc $file $file $pth`
13515                 aphostname=`echo $file $*`
13516                 ;;
13517         esac
13518         ;;
13519 esac
13520 case "$d_uname$d_gethname" in
13521 *define*) ;;
13522 *)
13523         case "$phostname" in
13524         '')
13525                 echo "There will be no way for $package to get your hostname." >&4;;
13526         *)
13527         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13528                 ;;
13529         esac;;
13530 esac
13531 case "$d_phostname" in
13532 '') d_phostname="$undef";;
13533 esac
13534
13535 : see if gethostbyaddr_r exists
13536 set gethostbyaddr_r d_gethostbyaddr_r
13537 eval $inlibc
13538 case "$d_gethostbyaddr_r" in
13539 "$define")
13540         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13541         case "$d_gethostbyaddr_r_proto:$usethreads" in
13542         ":define")      d_gethostbyaddr_r_proto=define
13543                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13544                 eval $hasproto ;;
13545         *)      ;;
13546         esac
13547         case "$d_gethostbyaddr_r_proto" in
13548         define)
13549         case "$gethostbyaddr_r_proto" in
13550         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13551         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13552         esac
13553         case "$gethostbyaddr_r_proto" in
13554         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13555         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13556         esac
13557         case "$gethostbyaddr_r_proto" in
13558         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13559         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13560         esac
13561         case "$gethostbyaddr_r_proto" in
13562         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13563         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13564         esac
13565         case "$gethostbyaddr_r_proto" in
13566         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13567         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13568         esac
13569         case "$gethostbyaddr_r_proto" in
13570         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13571         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13572         esac
13573         case "$gethostbyaddr_r_proto" in
13574         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13575         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13576         esac
13577         case "$gethostbyaddr_r_proto" in
13578         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13579         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13580         esac
13581         case "$gethostbyaddr_r_proto" in
13582         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13583         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13584         esac
13585         case "$gethostbyaddr_r_proto" in
13586         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13587         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13588         esac
13589         case "$gethostbyaddr_r_proto" in
13590         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13591         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13592         esac
13593         case "$gethostbyaddr_r_proto" in
13594         ''|0)   d_gethostbyaddr_r=undef
13595                 gethostbyaddr_r_proto=0
13596                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13597         * )     case "$gethostbyaddr_r_proto" in
13598                 REENTRANT_PROTO*) ;;
13599                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13600                 esac
13601                 echo "Prototype: $try" ;;
13602         esac
13603         ;;
13604         *)      case "$usethreads" in
13605                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13606                 esac
13607                 d_gethostbyaddr_r=undef
13608                 gethostbyaddr_r_proto=0
13609                 ;;
13610         esac
13611         ;;
13612 *)      gethostbyaddr_r_proto=0
13613         ;;
13614 esac
13615
13616 : see if gethostbyname_r exists
13617 set gethostbyname_r d_gethostbyname_r
13618 eval $inlibc
13619 case "$d_gethostbyname_r" in
13620 "$define")
13621         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13622         case "$d_gethostbyname_r_proto:$usethreads" in
13623         ":define")      d_gethostbyname_r_proto=define
13624                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13625                 eval $hasproto ;;
13626         *)      ;;
13627         esac
13628         case "$d_gethostbyname_r_proto" in
13629         define)
13630         case "$gethostbyname_r_proto" in
13631         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13632         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13633         esac
13634         case "$gethostbyname_r_proto" in
13635         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13636         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13637         esac
13638         case "$gethostbyname_r_proto" in
13639         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13640         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13641         esac
13642         case "$gethostbyname_r_proto" in
13643         ''|0)   d_gethostbyname_r=undef
13644                 gethostbyname_r_proto=0
13645                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13646         * )     case "$gethostbyname_r_proto" in
13647                 REENTRANT_PROTO*) ;;
13648                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13649                 esac
13650                 echo "Prototype: $try" ;;
13651         esac
13652         ;;
13653         *)      case "$usethreads" in
13654                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13655                 esac
13656                 d_gethostbyname_r=undef
13657                 gethostbyname_r_proto=0
13658                 ;;
13659         esac
13660         ;;
13661 *)      gethostbyname_r_proto=0
13662         ;;
13663 esac
13664
13665 : see if gethostent_r exists
13666 set gethostent_r d_gethostent_r
13667 eval $inlibc
13668 case "$d_gethostent_r" in
13669 "$define")
13670         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13671         case "$d_gethostent_r_proto:$usethreads" in
13672         ":define")      d_gethostent_r_proto=define
13673                 set d_gethostent_r_proto gethostent_r $hdrs
13674                 eval $hasproto ;;
13675         *)      ;;
13676         esac
13677         case "$d_gethostent_r_proto" in
13678         define)
13679         case "$gethostent_r_proto" in
13680         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13681         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13682         esac
13683         case "$gethostent_r_proto" in
13684         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13685         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13686         esac
13687         case "$gethostent_r_proto" in
13688         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13689         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13690         esac
13691         case "$gethostent_r_proto" in
13692         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13693         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13694         esac
13695         case "$gethostent_r_proto" in
13696         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13697         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13698         esac
13699         case "$gethostent_r_proto" in
13700         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13701         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13702         esac
13703         case "$gethostent_r_proto" in
13704         ''|0)   d_gethostent_r=undef
13705                 gethostent_r_proto=0
13706                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13707         * )     case "$gethostent_r_proto" in
13708                 REENTRANT_PROTO*) ;;
13709                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13710                 esac
13711                 echo "Prototype: $try" ;;
13712         esac
13713         ;;
13714         *)      case "$usethreads" in
13715                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13716                 esac
13717                 d_gethostent_r=undef
13718                 gethostent_r_proto=0
13719                 ;;
13720         esac
13721         ;;
13722 *)      gethostent_r_proto=0
13723         ;;
13724 esac
13725
13726 : see if prototypes for various gethostxxx netdb.h functions are available
13727 echo " "
13728 set d_gethostprotos gethostent $i_netdb netdb.h
13729 eval $hasproto
13730
13731 : see if getitimer exists
13732 set getitimer d_getitimer
13733 eval $inlibc
13734
13735 : see if getlogin exists
13736 set getlogin d_getlogin
13737 eval $inlibc
13738
13739 : see if getlogin_r exists
13740 set getlogin_r d_getlogin_r
13741 eval $inlibc
13742 case "$d_getlogin_r" in
13743 "$define")
13744         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13745         case "$d_getlogin_r_proto:$usethreads" in
13746         ":define")      d_getlogin_r_proto=define
13747                 set d_getlogin_r_proto getlogin_r $hdrs
13748                 eval $hasproto ;;
13749         *)      ;;
13750         esac
13751         case "$d_getlogin_r_proto" in
13752         define)
13753         case "$getlogin_r_proto" in
13754         ''|0) try='int getlogin_r(char*, size_t);'
13755         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13756         esac
13757         case "$getlogin_r_proto" in
13758         ''|0) try='int getlogin_r(char*, int);'
13759         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13760         esac
13761         case "$getlogin_r_proto" in
13762         ''|0) try='char* getlogin_r(char*, size_t);'
13763         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13764         esac
13765         case "$getlogin_r_proto" in
13766         ''|0) try='char* getlogin_r(char*, int);'
13767         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13768         esac
13769         case "$getlogin_r_proto" in
13770         ''|0)   d_getlogin_r=undef
13771                 getlogin_r_proto=0
13772                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13773         * )     case "$getlogin_r_proto" in
13774                 REENTRANT_PROTO*) ;;
13775                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13776                 esac
13777                 echo "Prototype: $try" ;;
13778         esac
13779         ;;
13780         *)      case "$usethreads" in
13781                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13782                 esac
13783                 d_getlogin_r=undef
13784                 getlogin_r_proto=0
13785                 ;;
13786         esac
13787         ;;
13788 *)      getlogin_r_proto=0
13789         ;;
13790 esac
13791
13792 : see if getmnt exists
13793 set getmnt d_getmnt
13794 eval $inlibc
13795
13796 : see if getmntent exists
13797 set getmntent d_getmntent
13798 eval $inlibc
13799
13800 : see if getnetbyaddr exists
13801 set getnetbyaddr d_getnbyaddr
13802 eval $inlibc
13803
13804 : see if getnetbyname exists
13805 set getnetbyname d_getnbyname
13806 eval $inlibc
13807
13808 : see if getnetent exists
13809 set getnetent d_getnent
13810 eval $inlibc
13811
13812 : see if getnetbyaddr_r exists
13813 set getnetbyaddr_r d_getnetbyaddr_r
13814 eval $inlibc
13815 case "$d_getnetbyaddr_r" in
13816 "$define")
13817         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13818         case "$d_getnetbyaddr_r_proto:$usethreads" in
13819         ":define")      d_getnetbyaddr_r_proto=define
13820                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13821                 eval $hasproto ;;
13822         *)      ;;
13823         esac
13824         case "$d_getnetbyaddr_r_proto" in
13825         define)
13826         case "$getnetbyaddr_r_proto" in
13827         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13828         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13829         esac
13830         case "$getnetbyaddr_r_proto" in
13831         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13832         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13833         esac
13834         case "$getnetbyaddr_r_proto" in
13835         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13836         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13837         esac
13838         case "$getnetbyaddr_r_proto" in
13839         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13840         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13841         esac
13842         case "$getnetbyaddr_r_proto" in
13843         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13844         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13845         esac
13846         case "$getnetbyaddr_r_proto" in
13847         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13848         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13849         esac
13850         case "$getnetbyaddr_r_proto" in
13851         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13852         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13853         esac
13854         case "$getnetbyaddr_r_proto" in
13855         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13856         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13857         esac
13858         case "$getnetbyaddr_r_proto" in
13859         ''|0)   d_getnetbyaddr_r=undef
13860                 getnetbyaddr_r_proto=0
13861                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13862         * )     case "$getnetbyaddr_r_proto" in
13863                 REENTRANT_PROTO*) ;;
13864                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13865                 esac
13866                 echo "Prototype: $try" ;;
13867         esac
13868         ;;
13869         *)      case "$usethreads" in
13870                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13871                 esac
13872                 d_getnetbyaddr_r=undef
13873                 getnetbyaddr_r_proto=0
13874                 ;;
13875         esac
13876         ;;
13877 *)      getnetbyaddr_r_proto=0
13878         ;;
13879 esac
13880
13881 : see if getnetbyname_r exists
13882 set getnetbyname_r d_getnetbyname_r
13883 eval $inlibc
13884 case "$d_getnetbyname_r" in
13885 "$define")
13886         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13887         case "$d_getnetbyname_r_proto:$usethreads" in
13888         ":define")      d_getnetbyname_r_proto=define
13889                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13890                 eval $hasproto ;;
13891         *)      ;;
13892         esac
13893         case "$d_getnetbyname_r_proto" in
13894         define)
13895         case "$getnetbyname_r_proto" in
13896         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13897         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13898         esac
13899         case "$getnetbyname_r_proto" in
13900         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13901         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13902         esac
13903         case "$getnetbyname_r_proto" in
13904         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13905         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13906         esac
13907         case "$getnetbyname_r_proto" in
13908         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13909         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13910         esac
13911         case "$getnetbyname_r_proto" in
13912         ''|0)   d_getnetbyname_r=undef
13913                 getnetbyname_r_proto=0
13914                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13915         * )     case "$getnetbyname_r_proto" in
13916                 REENTRANT_PROTO*) ;;
13917                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13918                 esac
13919                 echo "Prototype: $try" ;;
13920         esac
13921         ;;
13922         *)      case "$usethreads" in
13923                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13924                 esac
13925                 d_getnetbyname_r=undef
13926                 getnetbyname_r_proto=0
13927                 ;;
13928         esac
13929         ;;
13930 *)      getnetbyname_r_proto=0
13931         ;;
13932 esac
13933
13934 : see if getnetent_r exists
13935 set getnetent_r d_getnetent_r
13936 eval $inlibc
13937 case "$d_getnetent_r" in
13938 "$define")
13939         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13940         case "$d_getnetent_r_proto:$usethreads" in
13941         ":define")      d_getnetent_r_proto=define
13942                 set d_getnetent_r_proto getnetent_r $hdrs
13943                 eval $hasproto ;;
13944         *)      ;;
13945         esac
13946         case "$d_getnetent_r_proto" in
13947         define)
13948         case "$getnetent_r_proto" in
13949         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13950         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13951         esac
13952         case "$getnetent_r_proto" in
13953         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13954         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13955         esac
13956         case "$getnetent_r_proto" in
13957         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13958         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13959         esac
13960         case "$getnetent_r_proto" in
13961         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13962         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13963         esac
13964         case "$getnetent_r_proto" in
13965         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13966         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13967         esac
13968         case "$getnetent_r_proto" in
13969         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13970         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13971         esac
13972         case "$getnetent_r_proto" in
13973         ''|0)   d_getnetent_r=undef
13974                 getnetent_r_proto=0
13975                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13976         * )     case "$getnetent_r_proto" in
13977                 REENTRANT_PROTO*) ;;
13978                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13979                 esac
13980                 echo "Prototype: $try" ;;
13981         esac
13982         ;;
13983         *)      case "$usethreads" in
13984                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13985                 esac
13986                 d_getnetent_r=undef
13987                 getnetent_r_proto=0
13988                 ;;
13989         esac
13990         ;;
13991 *)      getnetent_r_proto=0
13992         ;;
13993 esac
13994
13995 : see if prototypes for various getnetxxx netdb.h functions are available
13996 echo " "
13997 set d_getnetprotos getnetent $i_netdb netdb.h
13998 eval $hasproto
13999
14000 : see if getpagesize exists
14001 set getpagesize d_getpagsz
14002 eval $inlibc
14003
14004 : Optional checks for getprotobyname and getprotobynumber
14005
14006 : see if getprotobyname exists
14007 set getprotobyname d_getpbyname
14008 eval $inlibc
14009
14010 : see if getprotobynumber exists
14011 set getprotobynumber d_getpbynumber
14012 eval $inlibc
14013
14014 : see if getprotoent exists
14015 set getprotoent d_getpent
14016 eval $inlibc
14017
14018 : see if getpgid exists
14019 set getpgid d_getpgid
14020 eval $inlibc
14021
14022 : see if getpgrp2 exists
14023 set getpgrp2 d_getpgrp2
14024 eval $inlibc
14025
14026 : see if getppid exists
14027 set getppid d_getppid
14028 eval $inlibc
14029
14030 : see if getpriority exists
14031 set getpriority d_getprior
14032 eval $inlibc
14033
14034 : see if getprotobyname_r exists
14035 set getprotobyname_r d_getprotobyname_r
14036 eval $inlibc
14037 case "$d_getprotobyname_r" in
14038 "$define")
14039         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14040         case "$d_getprotobyname_r_proto:$usethreads" in
14041         ":define")      d_getprotobyname_r_proto=define
14042                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14043                 eval $hasproto ;;
14044         *)      ;;
14045         esac
14046         case "$d_getprotobyname_r_proto" in
14047         define)
14048         case "$getprotobyname_r_proto" in
14049         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14050         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14051         esac
14052         case "$getprotobyname_r_proto" in
14053         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14054         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14055         esac
14056         case "$getprotobyname_r_proto" in
14057         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14058         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14059         esac
14060         case "$getprotobyname_r_proto" in
14061         ''|0)   d_getprotobyname_r=undef
14062                 getprotobyname_r_proto=0
14063                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14064         * )     case "$getprotobyname_r_proto" in
14065                 REENTRANT_PROTO*) ;;
14066                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14067                 esac
14068                 echo "Prototype: $try" ;;
14069         esac
14070         ;;
14071         *)      case "$usethreads" in
14072                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14073                 esac
14074                 d_getprotobyname_r=undef
14075                 getprotobyname_r_proto=0
14076                 ;;
14077         esac
14078         ;;
14079 *)      getprotobyname_r_proto=0
14080         ;;
14081 esac
14082
14083 : see if getprotobynumber_r exists
14084 set getprotobynumber_r d_getprotobynumber_r
14085 eval $inlibc
14086 case "$d_getprotobynumber_r" in
14087 "$define")
14088         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14089         case "$d_getprotobynumber_r_proto:$usethreads" in
14090         ":define")      d_getprotobynumber_r_proto=define
14091                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14092                 eval $hasproto ;;
14093         *)      ;;
14094         esac
14095         case "$d_getprotobynumber_r_proto" in
14096         define)
14097         case "$getprotobynumber_r_proto" in
14098         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14099         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14100         esac
14101         case "$getprotobynumber_r_proto" in
14102         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14103         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14104         esac
14105         case "$getprotobynumber_r_proto" in
14106         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14107         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14108         esac
14109         case "$getprotobynumber_r_proto" in
14110         ''|0)   d_getprotobynumber_r=undef
14111                 getprotobynumber_r_proto=0
14112                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14113         * )     case "$getprotobynumber_r_proto" in
14114                 REENTRANT_PROTO*) ;;
14115                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14116                 esac
14117                 echo "Prototype: $try" ;;
14118         esac
14119         ;;
14120         *)      case "$usethreads" in
14121                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14122                 esac
14123                 d_getprotobynumber_r=undef
14124                 getprotobynumber_r_proto=0
14125                 ;;
14126         esac
14127         ;;
14128 *)      getprotobynumber_r_proto=0
14129         ;;
14130 esac
14131
14132 : see if getprotoent_r exists
14133 set getprotoent_r d_getprotoent_r
14134 eval $inlibc
14135 case "$d_getprotoent_r" in
14136 "$define")
14137         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14138         case "$d_getprotoent_r_proto:$usethreads" in
14139         ":define")      d_getprotoent_r_proto=define
14140                 set d_getprotoent_r_proto getprotoent_r $hdrs
14141                 eval $hasproto ;;
14142         *)      ;;
14143         esac
14144         case "$d_getprotoent_r_proto" in
14145         define)
14146         case "$getprotoent_r_proto" in
14147         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14148         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14149         esac
14150         case "$getprotoent_r_proto" in
14151         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14152         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14153         esac
14154         case "$getprotoent_r_proto" in
14155         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14156         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14157         esac
14158         case "$getprotoent_r_proto" in
14159         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14160         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
14161         esac
14162         case "$getprotoent_r_proto" in
14163         ''|0)   d_getprotoent_r=undef
14164                 getprotoent_r_proto=0
14165                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14166         * )     case "$getprotoent_r_proto" in
14167                 REENTRANT_PROTO*) ;;
14168                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14169                 esac
14170                 echo "Prototype: $try" ;;
14171         esac
14172         ;;
14173         *)      case "$usethreads" in
14174                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14175                 esac
14176                 d_getprotoent_r=undef
14177                 getprotoent_r_proto=0
14178                 ;;
14179         esac
14180         ;;
14181 *)      getprotoent_r_proto=0
14182         ;;
14183 esac
14184
14185 : see if prototypes for various getprotoxxx netdb.h functions are available
14186 echo " "
14187 set d_getprotoprotos getprotoent $i_netdb netdb.h
14188 eval $hasproto
14189
14190 : see if getprpwnam exists
14191 set getprpwnam d_getprpwnam
14192 eval $inlibc
14193
14194 : see if getpwent exists
14195 set getpwent d_getpwent
14196 eval $inlibc
14197
14198 : see if getpwent_r exists
14199 set getpwent_r d_getpwent_r
14200 eval $inlibc
14201 case "$d_getpwent_r" in
14202 "$define")
14203         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14204         case "$d_getpwent_r_proto:$usethreads" in
14205         ":define")      d_getpwent_r_proto=define
14206                 set d_getpwent_r_proto getpwent_r $hdrs
14207                 eval $hasproto ;;
14208         *)      ;;
14209         esac
14210         case "$d_getpwent_r_proto" in
14211         define)
14212         case "$getpwent_r_proto" in
14213         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14214         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14215         esac
14216         case "$getpwent_r_proto" in
14217         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14218         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14219         esac
14220         case "$getpwent_r_proto" in
14221         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14222         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
14223         esac
14224         case "$getpwent_r_proto" in
14225         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14226         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
14227         esac
14228         case "$getpwent_r_proto" in
14229         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14230         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
14231         esac
14232         case "$getpwent_r_proto" in
14233         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14234         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14235         esac
14236         case "$getpwent_r_proto" in
14237         ''|0)   d_getpwent_r=undef
14238                 getpwent_r_proto=0
14239                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14240         * )     case "$getpwent_r_proto" in
14241                 REENTRANT_PROTO*) ;;
14242                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14243                 esac
14244                 echo "Prototype: $try" ;;
14245         esac
14246         ;;
14247         *)      case "$usethreads" in
14248                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14249                 esac
14250                 d_getpwent_r=undef
14251                 getpwent_r_proto=0
14252                 ;;
14253         esac
14254         ;;
14255 *)      getpwent_r_proto=0
14256         ;;
14257 esac
14258
14259 : see if getpwnam_r exists
14260 set getpwnam_r d_getpwnam_r
14261 eval $inlibc
14262 case "$d_getpwnam_r" in
14263 "$define")
14264         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14265         case "$d_getpwnam_r_proto:$usethreads" in
14266         ":define")      d_getpwnam_r_proto=define
14267                 set d_getpwnam_r_proto getpwnam_r $hdrs
14268                 eval $hasproto ;;
14269         *)      ;;
14270         esac
14271         case "$d_getpwnam_r_proto" in
14272         define)
14273         case "$getpwnam_r_proto" in
14274         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14275         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14276         esac
14277         case "$getpwnam_r_proto" in
14278         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14279         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14280         esac
14281         case "$getpwnam_r_proto" in
14282         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14283         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14284         esac
14285         case "$getpwnam_r_proto" in
14286         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14287         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14288         esac
14289         case "$getpwnam_r_proto" in
14290         ''|0)   d_getpwnam_r=undef
14291                 getpwnam_r_proto=0
14292                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14293         * )     case "$getpwnam_r_proto" in
14294                 REENTRANT_PROTO*) ;;
14295                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14296                 esac
14297                 echo "Prototype: $try" ;;
14298         esac
14299         ;;
14300         *)      case "$usethreads" in
14301                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14302                 esac
14303                 d_getpwnam_r=undef
14304                 getpwnam_r_proto=0
14305                 ;;
14306         esac
14307         ;;
14308 *)      getpwnam_r_proto=0
14309         ;;
14310 esac
14311
14312 : see if getpwuid_r exists
14313 set getpwuid_r d_getpwuid_r
14314 eval $inlibc
14315 case "$d_getpwuid_r" in
14316 "$define")
14317         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14318         case "$d_getpwuid_r_proto:$usethreads" in
14319         ":define")      d_getpwuid_r_proto=define
14320                 set d_getpwuid_r_proto getpwuid_r $hdrs
14321                 eval $hasproto ;;
14322         *)      ;;
14323         esac
14324         case "$d_getpwuid_r_proto" in
14325         define)
14326         case "$getpwuid_r_proto" in
14327         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14328         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14329         esac
14330         case "$getpwuid_r_proto" in
14331         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14332         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14333         esac
14334         case "$getpwuid_r_proto" in
14335         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14336         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14337         esac
14338         case "$getpwuid_r_proto" in
14339         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14340         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14341         esac
14342         case "$getpwuid_r_proto" in
14343         ''|0)   d_getpwuid_r=undef
14344                 getpwuid_r_proto=0
14345                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14346         * )     case "$getpwuid_r_proto" in
14347                 REENTRANT_PROTO*) ;;
14348                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14349                 esac
14350                 echo "Prototype: $try" ;;
14351         esac
14352         ;;
14353         *)      case "$usethreads" in
14354                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14355                 esac
14356                 d_getpwuid_r=undef
14357                 getpwuid_r_proto=0
14358                 ;;
14359         esac
14360         ;;
14361 *)      getpwuid_r_proto=0
14362         ;;
14363 esac
14364
14365 : Optional checks for getsbyname and getsbyport
14366
14367 : see if getservbyname exists
14368 set getservbyname d_getsbyname
14369 eval $inlibc
14370
14371 : see if getservbyport exists
14372 set getservbyport d_getsbyport
14373 eval $inlibc
14374
14375 : see if getservent exists
14376 set getservent d_getsent
14377 eval $inlibc
14378
14379 : see if getservbyname_r exists
14380 set getservbyname_r d_getservbyname_r
14381 eval $inlibc
14382 case "$d_getservbyname_r" in
14383 "$define")
14384         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14385         case "$d_getservbyname_r_proto:$usethreads" in
14386         ":define")      d_getservbyname_r_proto=define
14387                 set d_getservbyname_r_proto getservbyname_r $hdrs
14388                 eval $hasproto ;;
14389         *)      ;;
14390         esac
14391         case "$d_getservbyname_r_proto" in
14392         define)
14393         case "$getservbyname_r_proto" in
14394         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14395         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14396         esac
14397         case "$getservbyname_r_proto" in
14398         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14399         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14400         esac
14401         case "$getservbyname_r_proto" in
14402         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14403         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14404         esac
14405         case "$getservbyname_r_proto" in
14406         ''|0)   d_getservbyname_r=undef
14407                 getservbyname_r_proto=0
14408                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14409         * )     case "$getservbyname_r_proto" in
14410                 REENTRANT_PROTO*) ;;
14411                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14412                 esac
14413                 echo "Prototype: $try" ;;
14414         esac
14415         ;;
14416         *)      case "$usethreads" in
14417                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14418                 esac
14419                 d_getservbyname_r=undef
14420                 getservbyname_r_proto=0
14421                 ;;
14422         esac
14423         ;;
14424 *)      getservbyname_r_proto=0
14425         ;;
14426 esac
14427
14428 : see if getservbyport_r exists
14429 set getservbyport_r d_getservbyport_r
14430 eval $inlibc
14431 case "$d_getservbyport_r" in
14432 "$define")
14433         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14434         case "$d_getservbyport_r_proto:$usethreads" in
14435         ":define")      d_getservbyport_r_proto=define
14436                 set d_getservbyport_r_proto getservbyport_r $hdrs
14437                 eval $hasproto ;;
14438         *)      ;;
14439         esac
14440         case "$d_getservbyport_r_proto" in
14441         define)
14442         case "$getservbyport_r_proto" in
14443         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14444         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14445         esac
14446         case "$getservbyport_r_proto" in
14447         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14448         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14449         esac
14450         case "$getservbyport_r_proto" in
14451         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14452         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14453         esac
14454         case "$getservbyport_r_proto" in
14455         ''|0)   d_getservbyport_r=undef
14456                 getservbyport_r_proto=0
14457                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14458         * )     case "$getservbyport_r_proto" in
14459                 REENTRANT_PROTO*) ;;
14460                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14461                 esac
14462                 echo "Prototype: $try" ;;
14463         esac
14464         ;;
14465         *)      case "$usethreads" in
14466                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14467                 esac
14468                 d_getservbyport_r=undef
14469                 getservbyport_r_proto=0
14470                 ;;
14471         esac
14472         ;;
14473 *)      getservbyport_r_proto=0
14474         ;;
14475 esac
14476
14477 : see if getservent_r exists
14478 set getservent_r d_getservent_r
14479 eval $inlibc
14480 case "$d_getservent_r" in
14481 "$define")
14482         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14483         case "$d_getservent_r_proto:$usethreads" in
14484         ":define")      d_getservent_r_proto=define
14485                 set d_getservent_r_proto getservent_r $hdrs
14486                 eval $hasproto ;;
14487         *)      ;;
14488         esac
14489         case "$d_getservent_r_proto" in
14490         define)
14491         case "$getservent_r_proto" in
14492         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14493         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
14494         esac
14495         case "$getservent_r_proto" in
14496         ''|0) try='int getservent_r(struct servent*, char*, int);'
14497         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
14498         esac
14499         case "$getservent_r_proto" in
14500         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14501         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
14502         esac
14503         case "$getservent_r_proto" in
14504         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14505         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
14506         esac
14507         case "$getservent_r_proto" in
14508         ''|0)   d_getservent_r=undef
14509                 getservent_r_proto=0
14510                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14511         * )     case "$getservent_r_proto" in
14512                 REENTRANT_PROTO*) ;;
14513                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14514                 esac
14515                 echo "Prototype: $try" ;;
14516         esac
14517         ;;
14518         *)      case "$usethreads" in
14519                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14520                 esac
14521                 d_getservent_r=undef
14522                 getservent_r_proto=0
14523                 ;;
14524         esac
14525         ;;
14526 *)      getservent_r_proto=0
14527         ;;
14528 esac
14529
14530 : see if prototypes for various getservxxx netdb.h functions are available
14531 echo " "
14532 set d_getservprotos getservent $i_netdb netdb.h
14533 eval $hasproto
14534
14535 : see if getspnam exists
14536 set getspnam d_getspnam
14537 eval $inlibc
14538
14539 : see if this is a shadow.h system
14540 set shadow.h i_shadow
14541 eval $inhdr
14542
14543 : see if getspnam_r exists
14544 set getspnam_r d_getspnam_r
14545 eval $inlibc
14546 case "$d_getspnam_r" in
14547 "$define")
14548         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14549         case "$d_getspnam_r_proto:$usethreads" in
14550         ":define")      d_getspnam_r_proto=define
14551                 set d_getspnam_r_proto getspnam_r $hdrs
14552                 eval $hasproto ;;
14553         *)      ;;
14554         esac
14555         case "$d_getspnam_r_proto" in
14556         define)
14557         case "$getspnam_r_proto" in
14558         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14559         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14560         esac
14561         case "$getspnam_r_proto" in
14562         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14563         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14564         esac
14565         case "$getspnam_r_proto" in
14566         ''|0)   d_getspnam_r=undef
14567                 getspnam_r_proto=0
14568                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14569         * )     case "$getspnam_r_proto" in
14570                 REENTRANT_PROTO*) ;;
14571                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14572                 esac
14573                 echo "Prototype: $try" ;;
14574         esac
14575         ;;
14576         *)      case "$usethreads" in
14577                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14578                 esac
14579                 d_getspnam_r=undef
14580                 getspnam_r_proto=0
14581                 ;;
14582         esac
14583         ;;
14584 *)      getspnam_r_proto=0
14585         ;;
14586 esac
14587
14588 : see if gettimeofday or ftime exists
14589 set gettimeofday d_gettimeod
14590 eval $inlibc
14591 case "$d_gettimeod" in
14592 "$undef")
14593         set ftime d_ftime 
14594         eval $inlibc
14595         ;;
14596 *)
14597         val="$undef"; set d_ftime; eval $setvar
14598         ;;
14599 esac
14600 case "$d_gettimeod$d_ftime" in
14601 "$undef$undef")
14602         echo " "
14603         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14604         ;;
14605 esac
14606
14607 : see if gmtime_r exists
14608 set gmtime_r d_gmtime_r
14609 eval $inlibc
14610 case "$d_gmtime_r" in
14611 "$define")
14612         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14613         case "$d_gmtime_r_proto:$usethreads" in
14614         ":define")      d_gmtime_r_proto=define
14615                 set d_gmtime_r_proto gmtime_r $hdrs
14616                 eval $hasproto ;;
14617         *)      ;;
14618         esac
14619         case "$d_gmtime_r_proto" in
14620         define)
14621         case "$gmtime_r_proto" in
14622         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14623         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14624         esac
14625         case "$gmtime_r_proto" in
14626         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14627         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14628         esac
14629         case "$gmtime_r_proto" in
14630         ''|0)   d_gmtime_r=undef
14631                 gmtime_r_proto=0
14632                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14633         * )     case "$gmtime_r_proto" in
14634                 REENTRANT_PROTO*) ;;
14635                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14636                 esac
14637                 echo "Prototype: $try" ;;
14638         esac
14639         ;;
14640         *)      case "$usethreads" in
14641                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14642                 esac
14643                 d_gmtime_r=undef
14644                 gmtime_r_proto=0
14645                 ;;
14646         esac
14647         ;;
14648 *)      gmtime_r_proto=0
14649         ;;
14650 esac
14651
14652 : see if hasmntopt exists
14653 set hasmntopt d_hasmntopt
14654 eval $inlibc
14655
14656 : see if this is a netinet/in.h or sys/in.h system
14657 set netinet/in.h i_niin sys/in.h i_sysin
14658 eval $inhdr
14659
14660 : see if arpa/inet.h has to be included
14661 set arpa/inet.h i_arpainet
14662 eval $inhdr
14663
14664 : see if htonl --and friends-- exists
14665 val=''
14666 set htonl val
14667 eval $inlibc
14668
14669 : Maybe they are macros.
14670 case "$val" in
14671 $undef)
14672         $cat >htonl.c <<EOM
14673 #include <stdio.h>
14674 #include <sys/types.h>
14675 #$i_niin I_NETINET_IN
14676 #$i_sysin I_SYS_IN
14677 #$i_arpainet I_ARPA_INET
14678 #ifdef I_NETINET_IN
14679 #include <netinet/in.h>
14680 #endif
14681 #ifdef I_SYS_IN
14682 #include <sys/in.h>
14683 #endif
14684 #ifdef I_ARPA_INET
14685 #include <arpa/inet.h>
14686 #endif
14687 #ifdef htonl
14688 printf("Defined as a macro.");
14689 #endif
14690 EOM
14691         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14692         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14693                 val="$define"
14694                 echo "But it seems to be defined as a macro." >&4
14695         fi
14696         $rm -f htonl.?
14697         ;;
14698 esac
14699 set d_htonl
14700 eval $setvar
14701
14702 : see if ilogbl exists
14703 set ilogbl d_ilogbl
14704 eval $inlibc
14705
14706 : index or strchr
14707 echo " "
14708 if set index val -f; eval $csym; $val; then
14709         if set strchr val -f d_strchr; eval $csym; $val; then
14710                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14711                         val="$define"
14712                         vali="$undef"
14713                         echo "strchr() found." >&4
14714                 else
14715                         val="$undef"
14716                         vali="$define"
14717                         echo "index() found." >&4
14718                 fi
14719         else
14720                 val="$undef"
14721                 vali="$define"
14722                 echo "index() found." >&4
14723         fi
14724 else
14725         if set strchr val -f d_strchr; eval $csym; $val; then
14726                 val="$define"
14727                 vali="$undef"
14728                 echo "strchr() found." >&4
14729         else
14730                 echo "No index() or strchr() found!" >&4
14731                 val="$undef"
14732                 vali="$undef"
14733         fi
14734 fi
14735 set d_strchr; eval $setvar
14736 val="$vali"
14737 set d_index; eval $setvar
14738
14739 : check whether inet_aton exists
14740 set inet_aton d_inetaton
14741 eval $inlibc
14742
14743 : Look for isascii
14744 echo " "
14745 $cat >isascii.c <<EOCP
14746 #include <stdio.h>
14747 #include <ctype.h>
14748 #$i_stdlib I_STDLIB
14749 #ifdef I_STDLIB
14750 #include <stdlib.h>
14751 #endif
14752 int main() {
14753         int c = 'A';
14754         if (isascii(c))
14755                 exit(0);
14756         else
14757                 exit(1);
14758 }
14759 EOCP
14760 set isascii
14761 if eval $compile; then
14762         echo "isascii() found." >&4
14763         val="$define"
14764 else
14765         echo "isascii() NOT found." >&4
14766         val="$undef"
14767 fi
14768 set d_isascii
14769 eval $setvar
14770 $rm -f isascii*
14771
14772 : see if isfinite exists
14773 set isfinite d_isfinite
14774 eval $inlibc
14775
14776 : see if isinf exists
14777 set isinf d_isinf
14778 eval $inlibc
14779
14780 : see if isnan exists
14781 set isnan d_isnan
14782 eval $inlibc
14783
14784 : see if isnanl exists
14785 set isnanl d_isnanl
14786 eval $inlibc
14787
14788 : see if killpg exists
14789 set killpg d_killpg
14790 eval $inlibc
14791
14792 : see if lchown exists
14793 echo " "
14794 $cat > try.c <<'EOCP'
14795 /* System header to define __stub macros and hopefully few prototypes,
14796     which can conflict with char lchown(); below.  */
14797 #include <assert.h>
14798 /* Override any gcc2 internal prototype to avoid an error.  */
14799 /* We use char because int might match the return type of a gcc2
14800    builtin and then its argument prototype would still apply.  */
14801 char lchown();
14802 int main() {
14803     /*  The GNU C library defines this for functions which it implements
14804         to always fail with ENOSYS.  Some functions are actually named
14805         something starting with __ and the normal name is an alias.  */
14806 #if defined (__stub_lchown) || defined (__stub___lchown)
14807 choke me
14808 #else
14809 lchown();
14810 #endif
14811 ; return 0; }
14812 EOCP
14813 set try
14814 if eval $compile; then
14815     $echo "lchown() found." >&4
14816     val="$define"
14817 else
14818     $echo "lchown() NOT found." >&4
14819     val="$undef"
14820 fi
14821 set d_lchown
14822 eval $setvar
14823
14824 : See if number of significant digits in a double precision number is known
14825 echo " "
14826 $cat >ldbl_dig.c <<EOM
14827 #$i_limits I_LIMITS
14828 #$i_float I_FLOAT
14829 #ifdef I_LIMITS
14830 #include <limits.h>
14831 #endif
14832 #ifdef I_FLOAT
14833 #include <float.h>
14834 #endif
14835 #ifdef LDBL_DIG
14836 printf("Contains LDBL_DIG");
14837 #endif
14838 EOM
14839 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14840 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14841         echo "LDBL_DIG found." >&4
14842         val="$define"
14843 else
14844         echo "LDBL_DIG NOT found." >&4
14845         val="$undef"
14846 fi
14847 $rm -f ldbl_dig.?
14848 set d_ldbl_dig
14849 eval $setvar
14850
14851 : see if this is a math.h system
14852 set math.h i_math
14853 eval $inhdr
14854
14855 : check to see if math.h defines _LIB_VERSION
14856 d_libm_lib_version="$undef"
14857 case $i_math in
14858     $define)
14859         echo " "
14860         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14861         $cat >try.c <<EOCP
14862 #include <unistd.h>
14863 #include <math.h>
14864 int main (int argc, char *argv[])
14865 {
14866     printf ("%d\n", _LIB_VERSION);
14867     return (0);
14868     } /* main */
14869 EOCP
14870         set try
14871         if eval $compile; then
14872             foo=`$run ./try`
14873             echo "Yes, it does ($foo)" >&4
14874             d_libm_lib_version="$define"
14875         else
14876             echo "No, it does not (probably harmless)" >&4
14877             fi
14878         $rm_try
14879         ;;
14880
14881     esac
14882
14883 : see if link exists
14884 set link d_link
14885 eval $inlibc
14886
14887 : see if localtime_r exists
14888 set localtime_r d_localtime_r
14889 eval $inlibc
14890 case "$d_localtime_r" in
14891 "$define")
14892         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14893         case "$d_localtime_r_proto:$usethreads" in
14894         ":define")      d_localtime_r_proto=define
14895                 set d_localtime_r_proto localtime_r $hdrs
14896                 eval $hasproto ;;
14897         *)      ;;
14898         esac
14899         case "$d_localtime_r_proto" in
14900         define)
14901         case "$localtime_r_proto" in
14902         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14903         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14904         esac
14905         case "$localtime_r_proto" in
14906         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14907         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14908         esac
14909         case "$localtime_r_proto" in
14910         ''|0)   d_localtime_r=undef
14911                 localtime_r_proto=0
14912                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14913         * )     case "$localtime_r_proto" in
14914                 REENTRANT_PROTO*) ;;
14915                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14916                 esac
14917                 echo "Prototype: $try" ;;
14918         esac
14919         ;;
14920         *)      case "$usethreads" in
14921                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14922                 esac
14923                 d_localtime_r=undef
14924                 localtime_r_proto=0
14925                 ;;
14926         esac
14927         ;;
14928 *)      localtime_r_proto=0
14929         ;;
14930 esac
14931
14932 : see if localtime_r calls tzset
14933 case "$localtime_r_proto" in
14934 REENTRANT_PROTO*)
14935         $cat >try.c <<EOCP
14936 /*  Does our libc's localtime_r call tzset ?
14937  *  return 0 if so, 1 otherwise.
14938  */
14939 #include <sys/types.h>
14940 #include <unistd.h>
14941 #include <time.h>
14942 #include <string.h>
14943 #include <malloc.h>
14944 int main()
14945 {
14946     time_t t = time(0L);
14947     char w_tz[]="TZ" "=GMT+5",
14948          e_tz[]="TZ" "=GMT-5",
14949         *tz_e = (char*)malloc(16),
14950         *tz_w = (char*)malloc(16);
14951     struct tm tm_e, tm_w;
14952     memset(&tm_e,'\0',sizeof(struct tm));
14953     memset(&tm_w,'\0',sizeof(struct tm));
14954     strcpy(tz_e,e_tz);
14955     strcpy(tz_w,w_tz);
14956
14957     putenv(tz_e);
14958     localtime_r(&t, &tm_e);
14959
14960     putenv(tz_w);
14961     localtime_r(&t, &tm_w);
14962
14963     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
14964         return 1;
14965     return 0;
14966 }
14967 EOCP
14968         set try
14969         if eval $compile; then
14970             if $run ./try; then
14971                 d_localtime_r_needs_tzset=undef;
14972             else
14973                 d_localtime_r_needs_tzset=define;
14974             fi;
14975         else
14976             d_localtime_r_needs_tzset=undef;
14977         fi;
14978      ;;
14979   *)
14980      d_localtime_r_needs_tzset=undef;
14981      ;;
14982 esac
14983 $rm_try
14984
14985 : see if localeconv exists
14986 set localeconv d_locconv
14987 eval $inlibc
14988
14989 : see if lockf exists
14990 set lockf d_lockf
14991 eval $inlibc
14992
14993 : see if prototype for lseek is available
14994 echo " "
14995 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14996 eval $hasproto
14997
14998 : see if lstat exists
14999 set lstat d_lstat
15000 eval $inlibc
15001
15002 : see if madvise exists
15003 set madvise d_madvise
15004 eval $inlibc
15005
15006 : see if malloc_size exists
15007 set malloc_size d_malloc_size
15008 eval $inlibc
15009
15010 : see if malloc_size_good exists
15011 set malloc_good_size d_malloc_good_size
15012 eval $inlibc
15013
15014 : see if mblen exists
15015 set mblen d_mblen
15016 eval $inlibc
15017
15018 : see if mbstowcs exists
15019 set mbstowcs d_mbstowcs
15020 eval $inlibc
15021
15022 : see if mbtowc exists
15023 set mbtowc d_mbtowc
15024 eval $inlibc
15025
15026 : see if memchr exists
15027 set memchr d_memchr
15028 eval $inlibc
15029
15030 : see if memcmp exists
15031 set memcmp d_memcmp
15032 eval $inlibc
15033
15034 : see if memcpy exists
15035 set memcpy d_memcpy
15036 eval $inlibc
15037
15038 : see if memmove exists
15039 set memmove d_memmove
15040 eval $inlibc
15041
15042 : see if memset exists
15043 set memset d_memset
15044 eval $inlibc
15045
15046 : see if mkdir exists
15047 set mkdir d_mkdir
15048 eval $inlibc
15049
15050 : see if mkdtemp exists
15051 set mkdtemp d_mkdtemp
15052 eval $inlibc
15053
15054 : see if mkfifo exists
15055 set mkfifo d_mkfifo
15056 eval $inlibc
15057
15058 : see if mkstemp exists
15059 set mkstemp d_mkstemp
15060 eval $inlibc
15061
15062 : see if mkstemps exists
15063 set mkstemps d_mkstemps
15064 eval $inlibc
15065
15066 : see if mktime exists
15067 set mktime d_mktime
15068 eval $inlibc
15069
15070 : see if this is a sys/mman.h system
15071 set sys/mman.h i_sysmman
15072 eval $inhdr
15073
15074 : see if mmap exists
15075 set mmap d_mmap
15076 eval $inlibc
15077 : see what shmat returns
15078 : default to something harmless
15079 mmaptype='void *'
15080 case "$i_sysmman$d_mmap" in
15081 "$define$define")
15082         $cat >mmap.c <<'END'
15083 #include <sys/mman.h>
15084 void *mmap();
15085 END
15086         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15087                 mmaptype='void *'
15088         else
15089                 mmaptype='caddr_t'
15090         fi
15091         echo "and it returns ($mmaptype)." >&4
15092         ;;
15093 esac
15094
15095
15096
15097 : see if sqrtl exists
15098 set sqrtl d_sqrtl
15099 eval $inlibc
15100
15101 : see if scalbnl exists
15102 set scalbnl d_scalbnl
15103 eval $inlibc
15104
15105 : see if modfl exists
15106 set modfl d_modfl
15107 eval $inlibc
15108
15109 : see if prototype for modfl is available
15110 echo " "
15111 set d_modflproto modfl $i_math math.h
15112 eval $hasproto
15113
15114 d_modfl_pow32_bug="$undef"
15115
15116 case "$d_longdbl$d_modfl" in
15117 $define$define)
15118         $cat <<EOM
15119 Checking to see whether your modfl() is okay for large values...
15120 EOM
15121 $cat >try.c <<EOCP
15122 #include <math.h>
15123 #include <stdio.h>
15124 EOCP
15125 if $test "X$d_modflproto" != "X$define"; then
15126         $cat >>try.c <<EOCP
15127 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15128 long double modfl (long double, long double *);
15129 EOCP
15130 fi
15131 $cat >>try.c <<EOCP
15132 int main() {
15133     long double nv = 4294967303.15;
15134     long double v, w;
15135     v = modfl(nv, &w);
15136 #ifdef __GLIBC__
15137     printf("glibc");
15138 #endif
15139     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15140     return 0;
15141 }
15142 EOCP
15143         case "$osname:$gccversion" in
15144         aix:)   saveccflags="$ccflags"
15145                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15146         esac
15147         set try
15148         if eval $compile; then
15149                 foo=`$run ./try`
15150                 case "$foo" in
15151                 *" 4294967303.150000 1.150000 4294967302.000000")
15152                         echo >&4 "Your modfl() is broken for large values."
15153                         d_modfl_pow32_bug="$define"
15154                         case "$foo" in
15155                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15156                         ;;
15157                         esac
15158                         ;;
15159                 *" 4294967303.150000 0.150000 4294967303.000000")
15160                         echo >&4 "Your modfl() seems okay for large values."
15161                         ;;
15162                 *)      echo >&4 "I don't understand your modfl() at all."
15163                         d_modfl="$undef"
15164                         ;;
15165                 esac
15166                 $rm_try
15167         else
15168                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15169                 d_modfl="$undef"
15170         fi
15171         case "$osname:$gccversion" in
15172         aix:)   ccflags="$saveccflags" ;; # restore
15173         esac
15174         ;;
15175 esac
15176
15177 if $test "$uselongdouble" = "$define"; then
15178     message=""
15179     if $test "$d_sqrtl" != "$define"; then
15180         message="$message sqrtl"
15181     fi
15182     if $test "$d_modfl" != "$define"; then
15183         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15184             echo "You have both aintl and copysignl, so I can emulate modfl."
15185         else
15186             message="$message modfl"
15187         fi
15188     fi
15189     if $test "$d_frexpl" != "$define"; then
15190         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15191             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15192         else
15193             message="$message frexpl"
15194         fi
15195     fi
15196
15197     if $test "$message" != ""; then
15198         $cat <<EOM >&4
15199
15200 *** You requested the use of long doubles but you do not seem to have
15201 *** the following mathematical functions needed for long double support:
15202 ***    $message
15203 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15204 *** Cannot continue, aborting.
15205
15206 EOM
15207
15208         exit 1
15209     fi
15210 fi
15211
15212 : see if mprotect exists
15213 set mprotect d_mprotect
15214 eval $inlibc
15215
15216 : see if msgctl exists
15217 set msgctl d_msgctl
15218 eval $inlibc
15219
15220 : see if msgget exists
15221 set msgget d_msgget
15222 eval $inlibc
15223
15224 : see if msgsnd exists
15225 set msgsnd d_msgsnd
15226 eval $inlibc
15227
15228 : see if msgrcv exists
15229 set msgrcv d_msgrcv
15230 eval $inlibc
15231
15232 : see how much of the 'msg*(2)' library is present.
15233 h_msg=true
15234 echo " "
15235 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15236 *"$undef"*) h_msg=false;;
15237 esac
15238 case "$osname" in
15239 freebsd)
15240     case "`ipcs 2>&1`" in
15241     "SVID messages"*"not configured"*)
15242         echo "Your $osname does not have the msg*(2) configured." >&4
15243         h_msg=false
15244         val="$undef"
15245         set msgctl d_msgctl
15246         eval $setvar
15247         set msgget d_msgget
15248         eval $setvar
15249         set msgsnd d_msgsnd
15250         eval $setvar
15251         set msgrcv d_msgrcv
15252         eval $setvar
15253         ;;
15254     esac
15255     ;;
15256 esac
15257 : we could also check for sys/ipc.h ...
15258 if $h_msg && $test `./findhdr sys/msg.h`; then
15259         echo "You have the full msg*(2) library." >&4
15260         val="$define"
15261 else
15262         echo "You don't have the full msg*(2) library." >&4
15263         val="$undef"
15264 fi
15265 set d_msg
15266 eval $setvar
15267
15268 : Check for msghdr_s
15269 echo " "
15270 echo "Checking to see if your system supports struct msghdr..." >&4
15271 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15272 eval $hasstruct
15273 case "$d_msghdr_s" in
15274 "$define")      echo "Yes, it does."   ;;
15275 *)              echo "No, it doesn't." ;;
15276 esac
15277
15278
15279 : see if msync exists
15280 set msync d_msync
15281 eval $inlibc
15282
15283 : see if munmap exists
15284 set munmap d_munmap
15285 eval $inlibc
15286
15287 : see if nice exists
15288 set nice d_nice
15289 eval $inlibc
15290
15291 : see if this is a langinfo.h system
15292 set langinfo.h i_langinfo
15293 eval $inhdr
15294
15295 : see if nl_langinfo exists
15296 set nl_langinfo d_nl_langinfo
15297 eval $inlibc
15298
15299 : check for volatile keyword
15300 echo " "
15301 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15302 $cat >try.c <<'EOCP'
15303 int main()
15304 {
15305         typedef struct _goo_struct goo_struct;
15306         goo_struct * volatile goo = ((goo_struct *)0);
15307         struct _goo_struct {
15308                 long long_int;
15309                 int reg_int;
15310                 char char_var;
15311         };
15312         typedef unsigned short foo_t;
15313         char *volatile foo;
15314         volatile int bar;
15315         volatile foo_t blech;
15316         foo = foo;
15317 }
15318 EOCP
15319 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15320         val="$define"
15321         echo "Yup, it does."
15322 else
15323         val="$undef"
15324         echo "Nope, it doesn't."
15325 fi
15326 set d_volatile
15327 eval $setvar
15328 $rm_try
15329
15330 : Check basic sizes
15331 echo " "
15332 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15333
15334 case "$use64bitint:$d_quad:$quadtype" in
15335 define:define:?*)
15336         ivtype="$quadtype"
15337         uvtype="$uquadtype"
15338         ivsize=8
15339         uvsize=8
15340         ;;
15341 *)      ivtype="long"
15342         uvtype="unsigned long"
15343         ivsize=$longsize
15344         uvsize=$longsize
15345         ;;
15346 esac
15347
15348 case "$uselongdouble:$d_longdbl" in
15349 define:define)
15350         nvtype="long double"
15351         nvsize=$longdblsize
15352         ;;
15353 *)      nvtype=double
15354         nvsize=$doublesize
15355         ;;
15356 esac
15357
15358 $echo "(IV will be "$ivtype", $ivsize bytes)"
15359 $echo "(UV will be "$uvtype", $uvsize bytes)"
15360 $echo "(NV will be "$nvtype", $nvsize bytes)"
15361
15362 $cat >try.c <<EOCP
15363 #$i_inttypes I_INTTYPES
15364 #ifdef I_INTTYPES
15365 #include <inttypes.h>
15366 #endif
15367 #include <stdio.h>
15368 int main() {
15369 #ifdef INT8
15370    int8_t i =  INT8_MAX;
15371   uint8_t u = UINT8_MAX;
15372   printf("int8_t\n");
15373 #endif
15374 #ifdef INT16
15375    int16_t i =  INT16_MAX;
15376   uint16_t i = UINT16_MAX;
15377   printf("int16_t\n");
15378 #endif
15379 #ifdef INT32
15380    int32_t i =  INT32_MAX;
15381   uint32_t u = UINT32_MAX;
15382   printf("int32_t\n");
15383 #endif
15384 }
15385 EOCP
15386
15387 i8type="signed char"
15388 u8type="unsigned char"
15389 i8size=1
15390 u8size=1
15391
15392 case "$i16type" in
15393 '')     case "$shortsize" in
15394         2)      i16type=short
15395                 u16type="unsigned short"
15396                 i16size=$shortsize
15397                 u16size=$shortsize
15398                 ;;
15399         esac
15400         ;;
15401 esac
15402 case "$i16type" in
15403 '')     set try -DINT16
15404         if eval $compile; then
15405                 case "`$run ./try`" in
15406                 int16_t)
15407                         i16type=int16_t
15408                         u16type=uint16_t
15409                         i16size=2
15410                         u16size=2
15411                         ;;
15412                 esac
15413         fi
15414         ;;
15415 esac
15416 case "$i16type" in
15417 '')     if $test $shortsize -ge 2; then
15418                 i16type=short
15419                 u16type="unsigned short"
15420                 i16size=$shortsize
15421                 u16size=$shortsize
15422         fi
15423         ;;
15424 esac
15425
15426 case "$i32type" in
15427 '')     case "$longsize" in
15428         4)      i32type=long
15429                 u32type="unsigned long"
15430                 i32size=$longsize
15431                 u32size=$longsize
15432                 ;;
15433         *)      case "$intsize" in
15434                 4)      i32type=int
15435                         u32type="unsigned int"
15436                         i32size=$intsize
15437                         u32size=$intsize
15438                         ;;
15439                 esac
15440                 ;;
15441         esac
15442         ;;
15443 esac
15444 case "$i32type" in
15445 '')     set try -DINT32
15446         if eval $compile; then
15447                 case "`$run ./try`" in
15448                 int32_t)
15449                         i32type=int32_t
15450                         u32type=uint32_t
15451                         i32size=4
15452                         u32size=4
15453                         ;;
15454                 esac
15455         fi
15456         ;;
15457 esac
15458 case "$i32type" in
15459 '')     if $test $intsize -ge 4; then
15460                 i32type=int
15461                 u32type="unsigned int"
15462                 i32size=$intsize
15463                 u32size=$intsize
15464         fi
15465         ;;
15466 esac
15467
15468 case "$i64type" in
15469 '')     case "$d_quad:$quadtype" in
15470         define:?*)
15471                 i64type="$quadtype"
15472                 u64type="$uquadtype"
15473                 i64size=8
15474                 u64size=8
15475                 ;;
15476         esac
15477         ;;
15478 esac
15479
15480 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15481 : volatile so that the compiler has to store it out to memory.
15482 if test X"$d_volatile" = X"$define"; then
15483         volatile=volatile
15484 fi
15485 $cat <<EOP >try.c
15486 #include <stdio.h>
15487 #$i_stdlib I_STDLIB
15488 #ifdef I_STDLIB
15489 #include <stdlib.h>
15490 #endif
15491 #include <sys/types.h>
15492 #include <signal.h>
15493 #ifdef SIGFPE
15494 $volatile int bletched = 0;
15495 $signal_t blech(int s) { bletched = 1; }
15496 #endif
15497 int main() {
15498     $uvtype u = 0;
15499     $nvtype d;
15500     int     n = 8 * $uvsize;
15501     int     i;
15502 #ifdef SIGFPE
15503     signal(SIGFPE, blech);
15504 #endif
15505
15506     for (i = 0; i < n; i++) {
15507       u = u << 1 | ($uvtype)1;
15508       d = ($nvtype)u;
15509       if (($uvtype)d != u)
15510         break;
15511       if (d <= 0)
15512         break;
15513       d = ($nvtype)(u - 1);
15514       if (($uvtype)d != (u - 1))
15515         break;
15516 #ifdef SIGFPE
15517       if (bletched)
15518         break;
15519 #endif
15520     }
15521     printf("%d\n", ((i == n) ? -n : i));
15522     exit(0);
15523 }
15524 EOP
15525 set try
15526
15527 d_nv_preserves_uv="$undef"
15528 if eval $compile; then
15529         nv_preserves_uv_bits="`$run ./try`"
15530 fi
15531 case "$nv_preserves_uv_bits" in
15532 \-[1-9]*)
15533         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15534         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15535         d_nv_preserves_uv="$define"
15536         ;;
15537 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15538         d_nv_preserves_uv="$undef" ;;
15539 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15540         nv_preserves_uv_bits="0" ;;
15541 esac
15542 $rm_try
15543
15544 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15545 : volatile so that the compiler has to store it out to memory.
15546 if test X"$d_volatile" = X"$define"; then
15547         volatile=volatile
15548 fi
15549 $cat <<EOP >try.c
15550 #include <stdio.h>
15551
15552 typedef $nvtype NV;
15553
15554 int
15555 main() {
15556   NV value = 2;
15557   int count = 1;
15558
15559   while(count < 256) {
15560     $volatile NV up = value + 1.0;
15561     $volatile NV negated = -value;
15562     $volatile NV down = negated - 1.0;
15563     $volatile NV got_up = up - value;
15564     int up_good = got_up == 1.0;
15565     int got_down = down - negated;
15566     int down_good = got_down == -1.0;
15567
15568     if (down_good != up_good) {
15569       fprintf(stderr,
15570               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15571               up_good, (double) got_up, down_good, (double) got_down,
15572               count, (double) value);
15573       return 1;
15574     }
15575     if (!up_good) {
15576       while (1) {
15577         if (count > 8) {
15578           count -= 8;
15579           fputs("256.0", stdout);
15580         } else {
15581           count--;
15582           fputs("2.0", stdout);
15583         }
15584         if (!count) {
15585           puts("");
15586           return 0;
15587         }
15588         fputs("*", stdout);
15589       }
15590     }
15591     value *= 2;
15592     ++count;
15593   }
15594   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15595           count, (double) value);
15596   return 1;
15597 }
15598 EOP
15599 set try
15600
15601 nv_overflows_integers_at='0'
15602 if eval $compile; then
15603     xxx="`$run ./try`"
15604     case "$?" in
15605         0)
15606             case "$xxx" in
15607                 2*)  cat >&4 <<EOM
15608 The largest integer your NVs can preserve is equal to $xxx
15609 EOM
15610                     nv_overflows_integers_at="$xxx"
15611                     ;;
15612                 *)  cat >&4 <<EOM
15613 Cannot determine the largest integer value your NVs can hold, unexpected output
15614 '$xxx'
15615 EOM
15616                     ;;
15617             esac
15618             ;;
15619         *)  cat >&4 <<EOM
15620 Cannot determine the largest integer value your NVs can hold
15621 EOM
15622             ;;
15623     esac
15624 fi
15625 $rm_try
15626
15627 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15628 : volatile so that the compiler has to store it out to memory.
15629 if test X"$d_volatile" = X"$define"; then
15630         volatile=volatile
15631 fi
15632 $cat <<EOP >try.c
15633 #include <stdio.h>
15634 #$i_stdlib I_STDLIB
15635 #ifdef I_STDLIB
15636 #include <stdlib.h>
15637 #endif
15638 #$i_string I_STRING
15639 #ifdef I_STRING
15640 #  include <string.h>
15641 #else
15642 #  include <strings.h>
15643 #endif
15644 #include <sys/types.h>
15645 #include <signal.h>
15646 #ifdef SIGFPE
15647 $volatile int bletched = 0;
15648 $signal_t blech(int s) { bletched = 1; }
15649 #endif
15650
15651 int checkit($nvtype d, char *where) {
15652     unsigned char *p = (char *)&d;
15653     unsigned char *end = p + sizeof(d);
15654     int fail = 0;
15655
15656     while (p < end)
15657         fail += *p++;
15658
15659     if (!fail)
15660         return 0;
15661
15662     p = (char *)&d;
15663     printf("No - %s: 0x", where);
15664     while (p < end)
15665         printf ("%02X", *p++);
15666     printf("\n");
15667     return 1;
15668 }
15669
15670 int main(int argc, char **argv) {
15671     $nvtype d = 0.0;
15672     int fail = 0;
15673     fail += checkit(d, "0.0");
15674
15675     /* The compiler shouldn't be assuming that bletched is 0  */
15676     d = bletched;
15677
15678     fail += checkit(d, "bleched");
15679
15680 #ifdef SIGFPE
15681     signal(SIGFPE, blech);
15682 #endif
15683
15684     /* Paranoia - the compiler should have no way of knowing that ANSI says
15685        that argv[argc] will always be NULL.  Actually, if it did assume this it
15686        would be buggy, as this is C and main() can be called from elsewhere in
15687        the program.  */
15688     d = argv[argc] ? 1 : 0;
15689
15690     if (d) {
15691         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15692     }
15693
15694     fail += checkit(d, "ternary");
15695
15696     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15697
15698     if (d != 0.0) {
15699         printf("No - memset doesn't give 0.0\n");
15700         /* This might just blow up:  */
15701         printf("(gives %g)\n", d);
15702         return 1;
15703     }
15704
15705 #ifdef SIGFPE
15706     if (bletched) {
15707         printf("No - something bleched\n");
15708         return 1;
15709     }
15710 #endif
15711     if (fail) {
15712       printf("No - %d fail(s)\n", fail);
15713       return 1;
15714     }
15715     printf("Yes\n");
15716     return 0;
15717 }
15718 EOP
15719 set try
15720
15721 d_nv_zero_is_allbits_zero="$undef"
15722 if eval $compile; then
15723     xxx="`$run ./try`"
15724     case "$?" in
15725         0)
15726             case "$xxx" in
15727                 Yes)  cat >&4 <<EOM
15728 0.0 is represented as all bits zero in memory
15729 EOM
15730                     d_nv_zero_is_allbits_zero="$define"
15731                     ;;
15732                 *)  cat >&4 <<EOM
15733 0.0 is not represented as all bits zero in memory
15734 EOM
15735                     d_nv_zero_is_allbits_zero="$undef"
15736                     ;;
15737             esac
15738             ;;
15739         *)  cat >&4 <<EOM
15740 0.0 is not represented as all bits zero in memory
15741 EOM
15742             d_nv_zero_is_allbits_zero="$undef"
15743             ;;
15744     esac
15745 fi
15746 $rm_try
15747
15748 : check for off64_t
15749 echo " "
15750 echo "Checking to see if you have off64_t..." >&4
15751 $cat >try.c <<EOCP
15752 #include <sys/types.h>
15753 #include <unistd.h>
15754 int main() { off64_t x = 7; }
15755 EOCP
15756 set try
15757 if eval $compile; then
15758         val="$define"
15759         echo "You have off64_t."
15760 else
15761         val="$undef"
15762         echo "You do not have off64_t."
15763         case "$lseeksize" in
15764         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15765         esac
15766 fi
15767 $rm_try
15768 set d_off64_t
15769 eval $setvar
15770
15771 : how to create joinable pthreads
15772 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15773         echo " "
15774         echo "Checking what constant to use for creating joinable pthreads..." >&4
15775         $cat >try.c <<'EOCP'
15776 #include <pthread.h>
15777 int main() {
15778     int detachstate = JOINABLE;
15779 }
15780 EOCP
15781         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15782         if eval $compile; then
15783                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15784                 val="$undef" # Yes, undef.
15785                 set d_old_pthread_create_joinable
15786                 eval $setvar
15787                 val=""
15788                 set old_pthread_create_joinable
15789                 eval $setvar
15790         else
15791                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15792                 if eval $compile; then
15793                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15794                         val="$define"
15795                         set d_old_pthread_create_joinable
15796                         eval $setvar
15797                         val=PTHREAD_CREATE_UNDETACHED
15798                         set old_pthread_create_joinable
15799                         eval $setvar
15800                 else
15801                         set try -DJOINABLE=__UNDETACHED
15802                         if eval $compile; then
15803                                 echo "You seem to use __UNDETACHED." >&4
15804                                 val="$define"
15805                                 set d_old_pthread_create_joinable
15806                                 eval $setvar
15807                                 val=__UNDETACHED
15808                                 set old_pthread_create_joinable
15809                                 eval $setvar
15810                         else
15811                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15812                                 val="$define"
15813                                 set d_old_pthread_create_joinable
15814                                 eval $setvar
15815                                 val=0
15816                                 set old_pthread_create_joinable
15817                                 eval $setvar
15818                         fi
15819                 fi
15820         fi
15821         $rm_try
15822 else
15823     d_old_pthread_create_joinable="$undef"
15824     old_pthread_create_joinable=""
15825 fi
15826
15827 : see if pause exists
15828 set pause d_pause
15829 eval $inlibc
15830
15831 : see if poll exists
15832 set poll d_poll
15833 eval $inlibc
15834
15835 : see if readlink exists
15836 set readlink d_readlink
15837 eval $inlibc
15838
15839 : Check if exe is symlink to abs path of executing program
15840 echo " "
15841 procselfexe=''
15842 val="$undef"
15843 case "$d_readlink" in
15844 "$define")
15845         if $issymlink /proc/self/exe ; then
15846                 $ls -l /proc/self/exe > reflect
15847                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15848                         echo "You have Linux-like /proc/self/exe."
15849                         procselfexe='"/proc/self/exe"'
15850                         val="$define"
15851                 fi
15852         fi
15853         if $issymlink /proc/curproc/file ; then
15854                 $ls -l /proc/curproc/file > reflect
15855                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15856                         echo "You have BSD-like /proc/curproc/file."
15857                         procselfexe='"/proc/curproc/file"'
15858                         val="$define"
15859                 fi
15860         fi
15861         ;;
15862 esac
15863 $rm -f reflect
15864 set d_procselfexe
15865 eval $setvar
15866
15867 : backward compatibility for d_hvfork
15868 if test X$d_hvfork != X; then
15869         d_vfork="$d_hvfork"
15870         d_hvfork=''
15871 fi
15872 : see if there is a vfork
15873 val=''
15874 set vfork val
15875 eval $inlibc
15876
15877 d_pseudofork=$undef
15878
15879 : Ok, but do we want to use it. vfork is reportedly unreliable in
15880 : perl on Solaris 2.x, and probably elsewhere.
15881 case "$val" in
15882 $define)
15883         echo " "
15884         case "$usevfork" in
15885         false) dflt='n';;
15886         *) dflt='y';;
15887         esac
15888         cat <<'EOM'
15889
15890 Perl can only use a vfork() that doesn't suffer from strict
15891 restrictions on calling functions or modifying global data in
15892 the child.  For example, glibc-2.1 contains such a vfork()
15893 that is unsuitable.  If your system provides a proper fork()
15894 call, chances are that you do NOT want perl to use vfork().
15895
15896 EOM
15897         rp="Do you still want to use vfork()?"
15898         . ./myread
15899         case "$ans" in
15900         y|Y) ;;
15901         *)
15902                 echo "Ok, we won't use vfork()."
15903                 val="$undef"
15904                 ;;
15905         esac
15906         ;;
15907 esac
15908 set d_vfork
15909 eval $setvar
15910 case "$d_vfork" in
15911 $define) usevfork='true';;
15912 *) usevfork='false';;
15913 esac
15914
15915 : see whether the pthread_atfork exists
15916 $cat >try.c <<EOP
15917 #include <pthread.h>
15918 #include <stdio.h>
15919 int main() {
15920 #ifdef  PTHREAD_ATFORK
15921         pthread_atfork(NULL,NULL,NULL);
15922 #endif
15923 }
15924 EOP
15925
15926 : see if pthread_atfork exists
15927 set try -DPTHREAD_ATFORK
15928 if eval $compile; then
15929     val="$define"
15930 else
15931     val="$undef"
15932 fi
15933 case "$usethreads" in
15934 $define)
15935         case "$val" in
15936         $define) echo 'pthread_atfork found.' >&4        ;;
15937         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15938         esac
15939 esac
15940 set d_pthread_atfork
15941 eval $setvar
15942
15943 : see if pthread_attr_setscope exists
15944 set pthread_attr_setscope d_pthread_attr_setscope
15945 eval $inlibc
15946
15947 : see whether the various POSIXish _yields exist
15948 $cat >try.c <<EOP
15949 #include <pthread.h>
15950 #include <stdio.h>
15951 int main() {
15952 #ifdef SCHED_YIELD
15953         sched_yield();
15954 #else
15955 #ifdef PTHREAD_YIELD
15956         pthread_yield();
15957 #else
15958 #ifdef PTHREAD_YIELD_NULL
15959         pthread_yield(NULL);
15960 #endif
15961 #endif
15962 #endif
15963 }
15964 EOP
15965 : see if sched_yield exists
15966 set try -DSCHED_YIELD
15967 if eval $compile; then
15968     val="$define"
15969     sched_yield='sched_yield()'
15970 else
15971     val="$undef"
15972 fi
15973 case "$usethreads" in
15974 $define)
15975         case "$val" in
15976         $define) echo 'sched_yield() found.' >&4        ;;
15977         *)       echo 'sched_yield() NOT found.' >&4    ;;
15978         esac
15979 esac
15980 set d_sched_yield
15981 eval $setvar
15982
15983 : see if pthread_yield exists
15984 set try -DPTHREAD_YIELD
15985 if eval $compile; then
15986     val="$define"
15987     case "$sched_yield" in
15988     '') sched_yield='pthread_yield()' ;;
15989     esac
15990 else
15991     set try -DPTHREAD_YIELD_NULL
15992     if eval $compile; then
15993         val="$define"
15994         case "$sched_yield" in
15995         '') sched_yield='pthread_yield(NULL)' ;;
15996         esac
15997     else
15998         val="$undef"
15999     fi
16000 fi
16001 case "$usethreads" in
16002 $define)
16003         case "$val" in
16004         $define) echo 'pthread_yield() found.' >&4      ;;
16005         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16006         esac
16007         ;;
16008 esac
16009 set d_pthread_yield
16010 eval $setvar
16011 case "$sched_yield" in
16012 '') sched_yield=undef ;;
16013 esac
16014 $rm_try
16015
16016 : see if random_r exists
16017 set random_r d_random_r
16018 eval $inlibc
16019 case "$d_random_r" in
16020 "$define")
16021         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16022         case "$d_random_r_proto:$usethreads" in
16023         ":define")      d_random_r_proto=define
16024                 set d_random_r_proto random_r $hdrs
16025                 eval $hasproto ;;
16026         *)      ;;
16027         esac
16028         case "$d_random_r_proto" in
16029         define)
16030         case "$random_r_proto" in
16031         ''|0) try='int random_r(int*, struct random_data*);'
16032         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
16033         esac
16034         case "$random_r_proto" in
16035         ''|0) try='int random_r(long*, struct random_data*);'
16036         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
16037         esac
16038         case "$random_r_proto" in
16039         ''|0) try='int random_r(struct random_data*, int32_t*);'
16040         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
16041         esac
16042         case "$random_r_proto" in
16043         ''|0)   d_random_r=undef
16044                 random_r_proto=0
16045                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16046         * )     case "$random_r_proto" in
16047                 REENTRANT_PROTO*) ;;
16048                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16049                 esac
16050                 echo "Prototype: $try" ;;
16051         esac
16052         ;;
16053         *)      case "$usethreads" in
16054                 define) echo "random_r has no prototype, not using it." >&4 ;;
16055                 esac
16056                 d_random_r=undef
16057                 random_r_proto=0
16058                 ;;
16059         esac
16060         ;;
16061 *)      random_r_proto=0
16062         ;;
16063 esac
16064
16065 : see if readdir and friends exist
16066 set readdir d_readdir
16067 eval $inlibc
16068 set seekdir d_seekdir
16069 eval $inlibc
16070 set telldir d_telldir
16071 eval $inlibc
16072 set rewinddir d_rewinddir
16073 eval $inlibc
16074
16075 : see if readdir64_r exists
16076 set readdir64_r d_readdir64_r
16077 eval $inlibc
16078 case "$d_readdir64_r" in
16079 "$define")
16080         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16081         case "$d_readdir64_r_proto:$usethreads" in
16082         ":define")      d_readdir64_r_proto=define
16083                 set d_readdir64_r_proto readdir64_r $hdrs
16084                 eval $hasproto ;;
16085         *)      ;;
16086         esac
16087         case "$d_readdir64_r_proto" in
16088         define)
16089         case "$readdir64_r_proto" in
16090         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16091         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
16092         esac
16093         case "$readdir64_r_proto" in
16094         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16095         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
16096         esac
16097         case "$readdir64_r_proto" in
16098         ''|0)   d_readdir64_r=undef
16099                 readdir64_r_proto=0
16100                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16101         * )     case "$readdir64_r_proto" in
16102                 REENTRANT_PROTO*) ;;
16103                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16104                 esac
16105                 echo "Prototype: $try" ;;
16106         esac
16107         ;;
16108         *)      case "$usethreads" in
16109                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16110                 esac
16111                 d_readdir64_r=undef
16112                 readdir64_r_proto=0
16113                 ;;
16114         esac
16115         ;;
16116 *)      readdir64_r_proto=0
16117         ;;
16118 esac
16119
16120 : see if readdir_r exists
16121 set readdir_r d_readdir_r
16122 eval $inlibc
16123 case "$d_readdir_r" in
16124 "$define")
16125         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16126         case "$d_readdir_r_proto:$usethreads" in
16127         ":define")      d_readdir_r_proto=define
16128                 set d_readdir_r_proto readdir_r $hdrs
16129                 eval $hasproto ;;
16130         *)      ;;
16131         esac
16132         case "$d_readdir_r_proto" in
16133         define)
16134         case "$readdir_r_proto" in
16135         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16136         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
16137         esac
16138         case "$readdir_r_proto" in
16139         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16140         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
16141         esac
16142         case "$readdir_r_proto" in
16143         ''|0)   d_readdir_r=undef
16144                 readdir_r_proto=0
16145                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16146         * )     case "$readdir_r_proto" in
16147                 REENTRANT_PROTO*) ;;
16148                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16149                 esac
16150                 echo "Prototype: $try" ;;
16151         esac
16152         ;;
16153         *)      case "$usethreads" in
16154                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16155                 esac
16156                 d_readdir_r=undef
16157                 readdir_r_proto=0
16158                 ;;
16159         esac
16160         ;;
16161 *)      readdir_r_proto=0
16162         ;;
16163 esac
16164
16165 : see if readv exists
16166 set readv d_readv
16167 eval $inlibc
16168
16169 : see if recvmsg exists
16170 set recvmsg d_recvmsg
16171 eval $inlibc
16172
16173 : see if rename exists
16174 set rename d_rename
16175 eval $inlibc
16176
16177 : see if rmdir exists
16178 set rmdir d_rmdir
16179 eval $inlibc
16180
16181 : see if memory.h is available.
16182 val=''
16183 set memory.h val
16184 eval $inhdr
16185
16186 : See if it conflicts with string.h
16187 case "$val" in
16188 $define)
16189         case "$strings" in
16190         '') ;;
16191         *)
16192                 $cppstdin $cppflags $cppminus < $strings > mem.h
16193                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16194                         echo " "
16195                         echo "We won't be including <memory.h>."
16196                         val="$undef"
16197                 fi
16198                 $rm -f mem.h
16199                 ;;
16200         esac
16201 esac
16202 set i_memory
16203 eval $setvar
16204
16205 : can bcopy handle overlapping blocks?
16206 echo " "
16207 val="$undef"
16208 case "$d_memmove" in
16209 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16210 *)      case "$d_bcopy" in
16211         "$define")
16212                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16213                 $cat >try.c <<EOCP
16214 #$i_memory I_MEMORY
16215 #$i_stdlib I_STDLIB
16216 #$i_string I_STRING
16217 #$i_unistd I_UNISTD
16218 EOCP
16219         $cat >>try.c <<'EOCP'
16220 #include <stdio.h>
16221 #ifdef I_MEMORY
16222 #  include <memory.h>
16223 #endif
16224 #ifdef I_STDLIB
16225 #  include <stdlib.h>
16226 #endif
16227 #ifdef I_STRING
16228 #  include <string.h>
16229 #else
16230 #  include <strings.h>
16231 #endif
16232 #ifdef I_UNISTD
16233 #  include <unistd.h>  /* Needed for NetBSD */
16234 #endif
16235 int main()
16236 {
16237 char buf[128], abc[128];
16238 char *b;
16239 int len;
16240 int off;
16241 int align;
16242
16243 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16244    try to store the string in read-only memory. */
16245 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16246
16247 for (align = 7; align >= 0; align--) {
16248         for (len = 36; len; len--) {
16249                 b = buf+align;
16250                 bcopy(abc, b, len);
16251                 for (off = 1; off <= len; off++) {
16252                         bcopy(b, b+off, len);
16253                         bcopy(b+off, b, len);
16254                         if (bcmp(b, abc, len))
16255                                 exit(1);
16256                 }
16257         }
16258 }
16259 exit(0);
16260 }
16261 EOCP
16262                 set try
16263                 if eval $compile_ok; then
16264                         if $run ./try 2>/dev/null; then
16265                                 echo "Yes, it can."
16266                                 val="$define"
16267                         else
16268                                 echo "It can't, sorry."
16269                         fi
16270                 else
16271                         echo "(I can't compile the test program, so we'll assume not...)"
16272                 fi
16273                 ;;
16274         esac
16275         $rm_try
16276         ;;
16277 esac
16278 set d_safebcpy
16279 eval $setvar
16280
16281 : can memcpy handle overlapping blocks?
16282 echo " "
16283 val="$undef"
16284 case "$d_memmove" in
16285 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16286 *)      case "$d_memcpy" in
16287         "$define")
16288                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16289                 $cat >try.c <<EOCP
16290 #$i_memory I_MEMORY
16291 #$i_stdlib I_STDLIB
16292 #$i_string I_STRING
16293 #$i_unistd I_UNISTD
16294 EOCP
16295         $cat >>try.c <<'EOCP'
16296 #include <stdio.h>
16297 #ifdef I_MEMORY
16298 #  include <memory.h>
16299 #endif
16300 #ifdef I_STDLIB
16301 #  include <stdlib.h>
16302 #endif
16303 #ifdef I_STRING
16304 #  include <string.h>
16305 #else
16306 #  include <strings.h>
16307 #endif
16308 #ifdef I_UNISTD
16309 #  include <unistd.h>  /* Needed for NetBSD */
16310 #endif
16311 int main()
16312 {
16313 char buf[128], abc[128];
16314 char *b;
16315 int len;
16316 int off;
16317 int align;
16318
16319 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16320    try to store the string in read-only memory. */
16321 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16322
16323 for (align = 7; align >= 0; align--) {
16324         for (len = 36; len; len--) {
16325                 b = buf+align;
16326                 memcpy(b, abc, len);
16327                 for (off = 1; off <= len; off++) {
16328                         memcpy(b+off, b, len);
16329                         memcpy(b, b+off, len);
16330                         if (memcmp(b, abc, len))
16331                                 exit(1);
16332                 }
16333         }
16334 }
16335 exit(0);
16336 }
16337 EOCP
16338                 set try
16339                 if eval $compile_ok; then
16340                         if $run ./try 2>/dev/null; then
16341                                 echo "Yes, it can."
16342                                 val="$define"
16343                         else
16344                                 echo "It can't, sorry."
16345                         fi
16346                 else
16347                         echo "(I can't compile the test program, so we'll assume not...)"
16348                 fi
16349                 ;;
16350         esac
16351         $rm_try
16352         ;;
16353 esac
16354 set d_safemcpy
16355 eval $setvar
16356
16357 : can memcmp be trusted to compare relative magnitude?
16358 val="$undef"
16359 case "$d_memcmp" in
16360 "$define")
16361         echo " "
16362         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16363         $cat >try.c <<EOCP
16364 #$i_memory I_MEMORY
16365 #$i_stdlib I_STDLIB
16366 #$i_string I_STRING
16367 #$i_unistd I_UNISTD
16368 EOCP
16369         $cat >>try.c <<'EOCP'
16370 #include <stdio.h>
16371 #ifdef I_MEMORY
16372 #  include <memory.h>
16373 #endif
16374 #ifdef I_STDLIB
16375 #  include <stdlib.h>
16376 #endif
16377 #ifdef I_STRING
16378 #  include <string.h>
16379 #else
16380 #  include <strings.h>
16381 #endif
16382 #ifdef I_UNISTD
16383 #  include <unistd.h>  /* Needed for NetBSD */
16384 #endif
16385 int main()
16386 {
16387 char a = -1;
16388 char b = 0;
16389 if ((a < b) && memcmp(&a, &b, 1) < 0)
16390         exit(1);
16391 exit(0);
16392 }
16393 EOCP
16394         set try
16395         if eval $compile_ok; then
16396                 if $run ./try 2>/dev/null; then
16397                         echo "Yes, it can."
16398                         val="$define"
16399                 else
16400                         echo "No, it can't (it uses signed chars)."
16401                 fi
16402         else
16403                 echo "(I can't compile the test program, so we'll assume not...)"
16404         fi
16405         ;;
16406 esac
16407 $rm_try
16408 set d_sanemcmp
16409 eval $setvar
16410
16411 : see if prototype for sbrk is available
16412 echo " "
16413 set d_sbrkproto sbrk $i_unistd unistd.h
16414 eval $hasproto
16415
16416 : see if select exists
16417 set select d_select
16418 eval $inlibc
16419
16420 : see if semctl exists
16421 set semctl d_semctl
16422 eval $inlibc
16423
16424 : see if semget exists
16425 set semget d_semget
16426 eval $inlibc
16427
16428 : see if semop exists
16429 set semop d_semop
16430 eval $inlibc
16431
16432 : see how much of the 'sem*(2)' library is present.
16433 h_sem=true
16434 echo " "
16435 case "$d_semctl$d_semget$d_semop" in
16436 *"$undef"*) h_sem=false;;
16437 esac
16438 case "$osname" in
16439 freebsd)
16440     case "`ipcs 2>&1`" in
16441     "SVID messages"*"not configured"*)
16442         echo "Your $osname does not have the sem*(2) configured." >&4
16443         h_sem=false
16444         val="$undef"
16445         set semctl d_semctl
16446         eval $setvar
16447         set semget d_semget
16448         eval $setvar
16449         set semop d_semop
16450         eval $setvar
16451         ;;
16452     esac
16453     ;;
16454 esac
16455 : we could also check for sys/ipc.h ...
16456 if $h_sem && $test `./findhdr sys/sem.h`; then
16457         echo "You have the full sem*(2) library." >&4
16458         val="$define"
16459 else
16460         echo "You don't have the full sem*(2) library." >&4
16461         val="$undef"
16462 fi
16463 set d_sem
16464 eval $setvar
16465
16466 : see whether sys/sem.h defines union semun
16467 echo " "
16468 $cat > try.c <<'END'
16469 #include <sys/types.h>
16470 #include <sys/ipc.h>
16471 #include <sys/sem.h>
16472 int main () { union semun semun; semun.buf = 0; }
16473 END
16474 set try
16475 if eval $compile; then
16476     echo "You have union semun in <sys/sem.h>." >&4
16477     val="$define"
16478 else
16479     echo "You do not have union semun in <sys/sem.h>." >&4
16480     val="$undef"
16481 fi
16482 $rm_try
16483 set d_union_semun
16484 eval $setvar
16485
16486 : see how to do semctl IPC_STAT
16487 case "$d_sem" in
16488 $define)
16489     echo " "
16490     $cat > tryh.h <<END
16491 #ifndef S_IRUSR
16492 #   ifdef S_IREAD
16493 #       define S_IRUSR S_IREAD
16494 #       define S_IWUSR S_IWRITE
16495 #       define S_IXUSR S_IEXEC
16496 #   else
16497 #       define S_IRUSR 0400
16498 #       define S_IWUSR 0200
16499 #       define S_IXUSR 0100
16500 #   endif
16501 #   define S_IRGRP (S_IRUSR>>3)
16502 #   define S_IWGRP (S_IWUSR>>3)
16503 #   define S_IXGRP (S_IXUSR>>3)
16504 #   define S_IROTH (S_IRUSR>>6)
16505 #   define S_IWOTH (S_IWUSR>>6)
16506 #   define S_IXOTH (S_IXUSR>>6)
16507 #endif
16508 #ifndef S_IRWXU
16509 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16510 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16511 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16512 #endif
16513 END
16514     : see whether semctl IPC_STAT can use union semun
16515     case "$d_semctl_semun" in
16516     '')
16517       val="$undef"
16518       $cat > try.c <<END
16519 #include <sys/types.h>
16520 #include <sys/ipc.h>
16521 #include <sys/sem.h>
16522 #include <sys/stat.h>
16523 #include <stdio.h>
16524 #include <errno.h>
16525 #include "tryh.h"
16526 #ifndef errno
16527 extern int errno;
16528 #endif
16529 #$d_union_semun HAS_UNION_SEMUN
16530 int main() {
16531     union semun
16532 #ifndef HAS_UNION_SEMUN
16533     {
16534         int val;
16535         struct semid_ds *buf;
16536         unsigned short *array;
16537     }
16538 #endif
16539     arg;
16540     int sem, st;
16541
16542 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16543     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16544     if (sem > -1) {
16545         struct semid_ds argbuf;
16546         arg.buf = &argbuf;
16547 #       ifdef IPC_STAT
16548         st = semctl(sem, 0, IPC_STAT, arg);
16549         if (st == 0)
16550             printf("semun\n");
16551         else
16552 #       endif /* IPC_STAT */
16553             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16554 #       ifdef IPC_RMID
16555         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16556 #       endif /* IPC_RMID */
16557             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16558     } else
16559 #endif /* IPC_PRIVATE && ... */
16560         printf("semget failed: errno = %d\n", errno);
16561   return 0;
16562 }
16563 END
16564       set try
16565       if eval $compile; then
16566           xxx=`$run ./try`
16567           case "$xxx" in
16568           semun) val="$define" ;;
16569           esac
16570       fi
16571       $rm_try
16572       set d_semctl_semun
16573       eval $setvar
16574       ;;
16575     esac
16576     case "$d_semctl_semun" in
16577     $define)
16578         echo "You can use union semun for semctl IPC_STAT." >&4
16579         also='also'
16580         ;;
16581     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16582         also=''
16583         ;;
16584     esac
16585
16586     : see whether semctl IPC_STAT can use struct semid_ds pointer
16587     case "$d_semctl_semid_ds" in
16588     '')
16589       val="$undef"
16590       $cat > try.c <<'END'
16591 #include <sys/types.h>
16592 #include <sys/ipc.h>
16593 #include <sys/sem.h>
16594 #include <sys/stat.h>
16595 #include "tryh.h"
16596 #include <stdio.h>
16597 #include <errno.h>
16598 #ifndef errno
16599 extern int errno;
16600 #endif
16601 int main() {
16602     struct semid_ds arg;
16603     int sem, st;
16604
16605 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16606     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16607     if (sem > -1) {
16608 #       ifdef IPC_STAT
16609         st = semctl(sem, 0, IPC_STAT, &arg);
16610         if (st == 0)
16611             printf("semid_ds\n");
16612         else
16613 #       endif /* IPC_STAT */
16614             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16615 #       ifdef IPC_RMID
16616         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16617 #       endif /* IPC_RMID */
16618             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16619     } else
16620 #endif /* IPC_PRIVATE && ... */
16621         printf("semget failed: errno = %d\n", errno);
16622
16623     return 0;
16624 }
16625 END
16626       set try
16627       if eval $compile; then
16628           xxx=`$run ./try`
16629           case "$xxx" in
16630           semid_ds) val="$define" ;;
16631           esac
16632       fi
16633       $rm_try
16634       set d_semctl_semid_ds
16635       eval $setvar
16636       ;;
16637     esac
16638     case "$d_semctl_semid_ds" in
16639     $define)
16640         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16641         ;;
16642     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16643         ;;
16644     esac
16645     ;;
16646 *)  val="$undef"
16647
16648     # We do not have the full sem*(2) library, so assume we can not
16649     # use either.
16650
16651     set d_semctl_semun
16652     eval $setvar
16653
16654     set d_semctl_semid_ds
16655     eval $setvar
16656     ;;
16657 esac
16658 $rm_try tryh.h
16659
16660 : see if sendmsg exists
16661 set sendmsg d_sendmsg
16662 eval $inlibc
16663
16664 : see if setegid exists
16665 set setegid d_setegid
16666 eval $inlibc
16667
16668 : see if seteuid exists
16669 set seteuid d_seteuid
16670 eval $inlibc
16671
16672 : see if setgrent exists
16673 set setgrent d_setgrent
16674 eval $inlibc
16675
16676 : see if setgrent_r exists
16677 set setgrent_r d_setgrent_r
16678 eval $inlibc
16679 case "$d_setgrent_r" in
16680 "$define")
16681         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16682         case "$d_setgrent_r_proto:$usethreads" in
16683         ":define")      d_setgrent_r_proto=define
16684                 set d_setgrent_r_proto setgrent_r $hdrs
16685                 eval $hasproto ;;
16686         *)      ;;
16687         esac
16688         case "$d_setgrent_r_proto" in
16689         define)
16690         case "$setgrent_r_proto" in
16691         ''|0) try='int setgrent_r(FILE**);'
16692         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
16693         esac
16694         case "$setgrent_r_proto" in
16695         ''|0) try='void setgrent_r(FILE**);'
16696         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
16697         esac
16698         case "$setgrent_r_proto" in
16699         ''|0)   d_setgrent_r=undef
16700                 setgrent_r_proto=0
16701                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16702         * )     case "$setgrent_r_proto" in
16703                 REENTRANT_PROTO*) ;;
16704                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16705                 esac
16706                 echo "Prototype: $try" ;;
16707         esac
16708         ;;
16709         *)      case "$usethreads" in
16710                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16711                 esac
16712                 d_setgrent_r=undef
16713                 setgrent_r_proto=0
16714                 ;;
16715         esac
16716         ;;
16717 *)      setgrent_r_proto=0
16718         ;;
16719 esac
16720
16721 : see if sethostent exists
16722 set sethostent d_sethent
16723 eval $inlibc
16724
16725 : see if sethostent_r exists
16726 set sethostent_r d_sethostent_r
16727 eval $inlibc
16728 case "$d_sethostent_r" in
16729 "$define")
16730         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16731         case "$d_sethostent_r_proto:$usethreads" in
16732         ":define")      d_sethostent_r_proto=define
16733                 set d_sethostent_r_proto sethostent_r $hdrs
16734                 eval $hasproto ;;
16735         *)      ;;
16736         esac
16737         case "$d_sethostent_r_proto" in
16738         define)
16739         case "$sethostent_r_proto" in
16740         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16741         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16742         esac
16743         case "$sethostent_r_proto" in
16744         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16745         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16746         esac
16747         case "$sethostent_r_proto" in
16748         ''|0)   d_sethostent_r=undef
16749                 sethostent_r_proto=0
16750                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16751         * )     case "$sethostent_r_proto" in
16752                 REENTRANT_PROTO*) ;;
16753                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16754                 esac
16755                 echo "Prototype: $try" ;;
16756         esac
16757         ;;
16758         *)      case "$usethreads" in
16759                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16760                 esac
16761                 d_sethostent_r=undef
16762                 sethostent_r_proto=0
16763                 ;;
16764         esac
16765         ;;
16766 *)      sethostent_r_proto=0
16767         ;;
16768 esac
16769
16770 : see if setitimer exists
16771 set setitimer d_setitimer
16772 eval $inlibc
16773
16774 : see if setlinebuf exists
16775 set setlinebuf d_setlinebuf
16776 eval $inlibc
16777
16778 : see if setlocale exists
16779 set setlocale d_setlocale
16780 eval $inlibc
16781
16782 : see if locale.h is available
16783 set locale.h i_locale
16784 eval $inhdr
16785
16786 : see if setlocale_r exists
16787 set setlocale_r d_setlocale_r
16788 eval $inlibc
16789 case "$d_setlocale_r" in
16790 "$define")
16791         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16792         case "$d_setlocale_r_proto:$usethreads" in
16793         ":define")      d_setlocale_r_proto=define
16794                 set d_setlocale_r_proto setlocale_r $hdrs
16795                 eval $hasproto ;;
16796         *)      ;;
16797         esac
16798         case "$d_setlocale_r_proto" in
16799         define)
16800         case "$setlocale_r_proto" in
16801         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16802         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16803         esac
16804         case "$setlocale_r_proto" in
16805         ''|0)   d_setlocale_r=undef
16806                 setlocale_r_proto=0
16807                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16808         * )     case "$setlocale_r_proto" in
16809                 REENTRANT_PROTO*) ;;
16810                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16811                 esac
16812                 echo "Prototype: $try" ;;
16813         esac
16814         ;;
16815         *)      case "$usethreads" in
16816                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16817                 esac
16818                 d_setlocale_r=undef
16819                 setlocale_r_proto=0
16820                 ;;
16821         esac
16822         ;;
16823 *)      setlocale_r_proto=0
16824         ;;
16825 esac
16826
16827 : see if setnetent exists
16828 set setnetent d_setnent
16829 eval $inlibc
16830
16831 : see if setnetent_r exists
16832 set setnetent_r d_setnetent_r
16833 eval $inlibc
16834 case "$d_setnetent_r" in
16835 "$define")
16836         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16837         case "$d_setnetent_r_proto:$usethreads" in
16838         ":define")      d_setnetent_r_proto=define
16839                 set d_setnetent_r_proto setnetent_r $hdrs
16840                 eval $hasproto ;;
16841         *)      ;;
16842         esac
16843         case "$d_setnetent_r_proto" in
16844         define)
16845         case "$setnetent_r_proto" in
16846         ''|0) try='int setnetent_r(int, struct netent_data*);'
16847         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16848         esac
16849         case "$setnetent_r_proto" in
16850         ''|0) try='void setnetent_r(int, struct netent_data*);'
16851         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16852         esac
16853         case "$setnetent_r_proto" in
16854         ''|0)   d_setnetent_r=undef
16855                 setnetent_r_proto=0
16856                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16857         * )     case "$setnetent_r_proto" in
16858                 REENTRANT_PROTO*) ;;
16859                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16860                 esac
16861                 echo "Prototype: $try" ;;
16862         esac
16863         ;;
16864         *)      case "$usethreads" in
16865                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16866                 esac
16867                 d_setnetent_r=undef
16868                 setnetent_r_proto=0
16869                 ;;
16870         esac
16871         ;;
16872 *)      setnetent_r_proto=0
16873         ;;
16874 esac
16875
16876 : see if setprotoent exists
16877 set setprotoent d_setpent
16878 eval $inlibc
16879
16880 : see if setpgid exists
16881 set setpgid d_setpgid
16882 eval $inlibc
16883
16884 : see if setpgrp2 exists
16885 set setpgrp2 d_setpgrp2
16886 eval $inlibc
16887
16888 : see if setpriority exists
16889 set setpriority d_setprior
16890 eval $inlibc
16891
16892 : see if setproctitle exists
16893 set setproctitle d_setproctitle
16894 eval $inlibc
16895
16896 : see if setprotoent_r exists
16897 set setprotoent_r d_setprotoent_r
16898 eval $inlibc
16899 case "$d_setprotoent_r" in
16900 "$define")
16901         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16902         case "$d_setprotoent_r_proto:$usethreads" in
16903         ":define")      d_setprotoent_r_proto=define
16904                 set d_setprotoent_r_proto setprotoent_r $hdrs
16905                 eval $hasproto ;;
16906         *)      ;;
16907         esac
16908         case "$d_setprotoent_r_proto" in
16909         define)
16910         case "$setprotoent_r_proto" in
16911         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16912         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16913         esac
16914         case "$setprotoent_r_proto" in
16915         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16916         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16917         esac
16918         case "$setprotoent_r_proto" in
16919         ''|0)   d_setprotoent_r=undef
16920                 setprotoent_r_proto=0
16921                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16922         * )     case "$setprotoent_r_proto" in
16923                 REENTRANT_PROTO*) ;;
16924                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16925                 esac
16926                 echo "Prototype: $try" ;;
16927         esac
16928         ;;
16929         *)      case "$usethreads" in
16930                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16931                 esac
16932                 d_setprotoent_r=undef
16933                 setprotoent_r_proto=0
16934                 ;;
16935         esac
16936         ;;
16937 *)      setprotoent_r_proto=0
16938         ;;
16939 esac
16940
16941 : see if setpwent exists
16942 set setpwent d_setpwent
16943 eval $inlibc
16944
16945 : see if setpwent_r exists
16946 set setpwent_r d_setpwent_r
16947 eval $inlibc
16948 case "$d_setpwent_r" in
16949 "$define")
16950         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16951         case "$d_setpwent_r_proto:$usethreads" in
16952         ":define")      d_setpwent_r_proto=define
16953                 set d_setpwent_r_proto setpwent_r $hdrs
16954                 eval $hasproto ;;
16955         *)      ;;
16956         esac
16957         case "$d_setpwent_r_proto" in
16958         define)
16959         case "$setpwent_r_proto" in
16960         ''|0) try='int setpwent_r(FILE**);'
16961         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16962         esac
16963         case "$setpwent_r_proto" in
16964         ''|0) try='void setpwent_r(FILE**);'
16965         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16966         esac
16967         case "$setpwent_r_proto" in
16968         ''|0)   d_setpwent_r=undef
16969                 setpwent_r_proto=0
16970                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16971         * )     case "$setpwent_r_proto" in
16972                 REENTRANT_PROTO*) ;;
16973                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16974                 esac
16975                 echo "Prototype: $try" ;;
16976         esac
16977         ;;
16978         *)      case "$usethreads" in
16979                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16980                 esac
16981                 d_setpwent_r=undef
16982                 setpwent_r_proto=0
16983                 ;;
16984         esac
16985         ;;
16986 *)      setpwent_r_proto=0
16987         ;;
16988 esac
16989
16990 : see if setregid exists
16991 set setregid d_setregid
16992 eval $inlibc
16993 set setresgid d_setresgid
16994 eval $inlibc
16995
16996 : see if setreuid exists
16997 set setreuid d_setreuid
16998 eval $inlibc
16999 set setresuid d_setresuid
17000 eval $inlibc
17001
17002 : see if setrgid exists
17003 set setrgid d_setrgid
17004 eval $inlibc
17005
17006 : see if setruid exists
17007 set setruid d_setruid
17008 eval $inlibc
17009
17010 : see if setservent exists
17011 set setservent d_setsent
17012 eval $inlibc
17013
17014 : see if setservent_r exists
17015 set setservent_r d_setservent_r
17016 eval $inlibc
17017 case "$d_setservent_r" in
17018 "$define")
17019         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17020         case "$d_setservent_r_proto:$usethreads" in
17021         ":define")      d_setservent_r_proto=define
17022                 set d_setservent_r_proto setservent_r $hdrs
17023                 eval $hasproto ;;
17024         *)      ;;
17025         esac
17026         case "$d_setservent_r_proto" in
17027         define)
17028         case "$setservent_r_proto" in
17029         ''|0) try='int setservent_r(int, struct servent_data*);'
17030         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
17031         esac
17032         case "$setservent_r_proto" in
17033         ''|0) try='void setservent_r(int, struct servent_data*);'
17034         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
17035         esac
17036         case "$setservent_r_proto" in
17037         ''|0)   d_setservent_r=undef
17038                 setservent_r_proto=0
17039                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17040         * )     case "$setservent_r_proto" in
17041                 REENTRANT_PROTO*) ;;
17042                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17043                 esac
17044                 echo "Prototype: $try" ;;
17045         esac
17046         ;;
17047         *)      case "$usethreads" in
17048                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17049                 esac
17050                 d_setservent_r=undef
17051                 setservent_r_proto=0
17052                 ;;
17053         esac
17054         ;;
17055 *)      setservent_r_proto=0
17056         ;;
17057 esac
17058
17059 : see if setsid exists
17060 set setsid d_setsid
17061 eval $inlibc
17062
17063 : see if setvbuf exists
17064 set setvbuf d_setvbuf
17065 eval $inlibc
17066
17067 : see if sfio.h is available
17068 set sfio.h i_sfio
17069 eval $inhdr
17070
17071 : see if sfio library is available
17072 case "$i_sfio" in
17073 $define)
17074         val=''
17075         set sfreserve val
17076         eval $inlibc
17077         ;;
17078 *)
17079         val="$undef"
17080         ;;
17081 esac
17082 : Ok, but do we want to use it.
17083 case "$val" in
17084 $define)
17085         case "$usesfio" in
17086         true|$define|[yY]*) dflt='y';;
17087         *) dflt='n';;
17088         esac
17089         echo "$package can use the sfio library, but it is experimental."
17090         case "$useperlio" in
17091         "$undef")
17092             echo "For sfio also the PerlIO abstraction layer is needed."
17093             echo "Earlier you said you wouldn't want that."
17094             ;;
17095         esac
17096         rp="You seem to have sfio available, do you want to try using it?"
17097         . ./myread
17098         case "$ans" in
17099         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
17100                 useperlio="$define"
17101                 val="$define"
17102                 ;;
17103         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17104                 val="$undef"
17105                 ;;
17106         esac
17107         ;;
17108 *)      case "$usesfio" in
17109         true|$define|[yY]*)
17110                 echo "Sorry, cannot find sfio on this machine." >&4
17111                 echo "Ignoring your setting of usesfio=$usesfio." >&4
17112                 val="$undef"
17113                 ;;
17114         esac
17115         ;;
17116 esac
17117 set d_sfio
17118 eval $setvar
17119 case "$d_sfio" in
17120 $define) usesfio='true';;
17121 *) usesfio='false';;
17122 esac
17123 case "$d_sfio" in
17124 $define) ;;
17125 *)      : Remove sfio from list of libraries to use
17126         case "$libs" in
17127         *-lsfio*)
17128                 echo "Removing unneeded -lsfio from library list" >&4
17129                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17130                 shift
17131                 libs="$*"
17132                 echo "libs = $libs" >&4
17133                 ;;
17134         esac
17135 ;;
17136 esac
17137
17138
17139 : see if shmctl exists
17140 set shmctl d_shmctl
17141 eval $inlibc
17142
17143 : see if shmget exists
17144 set shmget d_shmget
17145 eval $inlibc
17146
17147 : see if shmat exists
17148 set shmat d_shmat
17149 eval $inlibc
17150 : see what shmat returns
17151 case "$d_shmat" in
17152 "$define")
17153         $cat >shmat.c <<'END'
17154 #include <sys/shm.h>
17155 void *shmat();
17156 END
17157         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17158                 shmattype='void *'
17159         else
17160                 shmattype='char *'
17161         fi
17162         echo "and it returns ($shmattype)." >&4
17163         : see if a prototype for shmat is available
17164         xxx=`./findhdr sys/shm.h`
17165         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17166         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17167                 val="$define"
17168         else
17169                 val="$undef"
17170         fi
17171         $rm -f shmat.[co]
17172         ;;
17173 *)
17174         val="$undef"
17175         ;;
17176 esac
17177 set d_shmatprototype
17178 eval $setvar
17179
17180 : see if shmdt exists
17181 set shmdt d_shmdt
17182 eval $inlibc
17183
17184 : see how much of the 'shm*(2)' library is present.
17185 h_shm=true
17186 echo " "
17187 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17188 *"$undef"*) h_shm=false;;
17189 esac
17190 case "$osname" in
17191 freebsd)
17192     case "`ipcs 2>&1`" in
17193     "SVID shared memory"*"not configured"*)
17194         echo "Your $osname does not have the shm*(2) configured." >&4
17195         h_shm=false
17196         val="$undef"
17197         set shmctl d_shmctl
17198         evat $setvar
17199         set shmget d_shmget
17200         evat $setvar
17201         set shmat d_shmat
17202         evat $setvar
17203         set shmdt d_shmdt
17204         evat $setvar
17205         ;;
17206     esac
17207     ;;
17208 esac
17209 : we could also check for sys/ipc.h ...
17210 if $h_shm && $test `./findhdr sys/shm.h`; then
17211         echo "You have the full shm*(2) library." >&4
17212         val="$define"
17213 else
17214         echo "You don't have the full shm*(2) library." >&4
17215         val="$undef"
17216 fi
17217 set d_shm
17218 eval $setvar
17219
17220 : see if we have sigaction
17221 echo " "
17222 if set sigaction val -f d_sigaction; eval $csym; $val; then
17223         echo 'sigaction() found.' >&4
17224         $cat > try.c <<EOP
17225 #include <stdio.h>
17226 #include <sys/types.h>
17227 #include <signal.h>
17228 #$i_stdlib I_STDLIB
17229 #ifdef I_STDLIB
17230 #include <stdlib.h>
17231 #endif
17232 int main()
17233 {
17234     struct sigaction act, oact;
17235     act.sa_flags = 0;
17236     oact.sa_handler = 0;
17237     /* so that act and oact are used */
17238     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17239 }
17240 EOP
17241         set try
17242         if eval $compile_ok; then
17243                 val="$define"
17244         else
17245                 echo "But you don't seem to have a useable struct sigaction." >&4
17246                 val="$undef"
17247         fi
17248 else
17249         echo 'sigaction NOT found.' >&4
17250         val="$undef"
17251 fi
17252 set d_sigaction; eval $setvar
17253 $rm_try
17254
17255 : see if this is a sunmath.h system
17256 set sunmath.h i_sunmath
17257 eval $inhdr
17258
17259 : see if signbit exists
17260 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17261 $cat >try.c <<EOCP
17262 #$i_math I_MATH
17263 #$i_sunmath I_SUNMATH
17264 #ifdef I_MATH
17265 #  include <math.h>
17266 #endif
17267 #ifdef I_SUNMATH  /* Solaris special math library */
17268 #  include <sunmath.h>
17269 #endif
17270 #define NV $nvtype
17271 int main(int argc, char **argv)
17272 {
17273     NV x = 0.0;
17274     NV y = -0.0;
17275     if ((signbit(x) == 0) && (signbit(y) != 0))
17276         return 0;
17277     else
17278         return 1;
17279 }
17280 EOCP
17281 val="$undef"
17282 set try
17283 if eval $compile; then
17284     if $run ./try; then
17285         $echo "Yes." >&4
17286         val="$define"
17287     else
17288         $echo "Signbit seems to be available, but doesn't work as I expected."
17289         $echo "I won't use it." >&4
17290         val="$undef"
17291     fi
17292 else
17293     $echo "Nope." >&4
17294     dflt="$undef"
17295 fi
17296 set d_signbit
17297 eval $setvar
17298 $rm_try
17299
17300 : see if sigprocmask exists
17301 set sigprocmask d_sigprocmask
17302 eval $inlibc
17303
17304 : see if sigsetjmp exists
17305 echo " "
17306 case "$d_sigsetjmp" in
17307 '')
17308         $cat >try.c <<EOP
17309 #include <setjmp.h>
17310 #$i_stdlib I_STDLIB
17311 #ifdef I_STDLIB
17312 #include <stdlib.h>
17313 #endif
17314 sigjmp_buf env;
17315 int set = 1;
17316 int main()
17317 {
17318         if (sigsetjmp(env,1))
17319                 exit(set);
17320         set = 0;
17321         siglongjmp(env, 1);
17322         exit(1);
17323 }
17324 EOP
17325         set try
17326         if eval $compile; then
17327                 if $run ./try >/dev/null 2>&1; then
17328                         echo "POSIX sigsetjmp found." >&4
17329                         val="$define"
17330                 else
17331                         $cat >&4 <<EOM
17332 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17333 I'll ignore them.
17334 EOM
17335                         val="$undef"
17336                 fi
17337         else
17338                 echo "sigsetjmp not found." >&4
17339                 val="$undef"
17340         fi
17341         ;;
17342 *) val="$d_sigsetjmp"
17343         case "$d_sigsetjmp" in
17344         $define) echo "POSIX sigsetjmp found." >&4;;
17345         $undef) echo "sigsetjmp not found." >&4;;
17346         esac
17347         ;;
17348 esac
17349 set d_sigsetjmp
17350 eval $setvar
17351 $rm_try
17352
17353 : see if snprintf exists
17354 set snprintf d_snprintf
17355 eval $inlibc
17356
17357 : see if vsnprintf exists
17358 set vsnprintf d_vsnprintf
17359 eval $inlibc
17360
17361 case "$d_snprintf-$d_vsnprintf" in
17362 "$define-$define")
17363     $cat <<EOM
17364 Checking whether your snprintf() and vsnprintf() work okay...
17365 EOM
17366     $cat >try.c <<'EOCP'
17367 /* v?snprintf testing logic courtesy of Russ Allbery.
17368  * According to C99:
17369  * - if the buffer is too short it still must be \0-terminated
17370  * - if the buffer is too short the potentially required length
17371  *   must be returned and not -1
17372  * - if the buffer is NULL the potentially required length
17373  *   must be returned and not -1 or core dump
17374  */
17375 #include <stdio.h>
17376 #include <stdarg.h>
17377
17378 char buf[2];
17379
17380 int test (char *format, ...)
17381 {
17382     va_list args;
17383     int count;
17384
17385     va_start (args, format);
17386     count = vsnprintf (buf, sizeof buf, format, args);
17387     va_end (args);
17388     return count;
17389 }
17390
17391 int main ()
17392 {
17393     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17394              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17395 }
17396 EOCP
17397     set try
17398     if eval $compile; then
17399         `$run ./try`
17400         case "$?" in
17401         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17402         *) cat <<EOM >&4
17403 Your snprintf() and snprintf() don't seem to be working okay.
17404 EOM
17405            d_snprintf="$undef"
17406            d_vsnprintf="$undef"
17407            ;;
17408         esac
17409     else
17410         echo "(I can't seem to compile the test program--assuming they don't)"
17411         d_snprintf="$undef"
17412         d_vsnprintf="$undef"
17413     fi
17414     $rm_try
17415     ;;
17416 esac
17417
17418 : see if sockatmark exists
17419 set sockatmark d_sockatmark
17420 eval $inlibc
17421
17422 : see if prototype for sockatmark is available
17423 echo " "
17424 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17425 eval $hasproto
17426
17427 : see if socks5_init exists
17428 set socks5_init d_socks5_init
17429 eval $inlibc
17430
17431 : see if sprintf returns the length of the string in the buffer as per ANSI
17432 $echo "Checking whether sprintf returns the length of the string..." >&4
17433 $cat <<EOP >try.c
17434 #include <stdio.h>
17435 #$i_stdlib I_STDLIB
17436 #ifdef I_STDLIB
17437 #include <stdlib.h>
17438 #endif
17439 #$i_string I_STRING
17440 #ifdef I_STRING
17441 #  include <string.h>
17442 #else
17443 #  include <strings.h>
17444 #endif
17445 #$i_math I_MATH
17446 #ifdef I_MATH
17447 #include <math.h>
17448 #endif
17449
17450 char buffer[256];
17451
17452 int check (size_t expect, int test) {
17453   size_t got = strlen(buffer);
17454   if (expect == got)
17455     return 0;
17456
17457   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17458        test, buffer);
17459   exit (test);
17460 }
17461
17462 int main(int argc, char **argv) {
17463   int test = 0;
17464
17465   check(sprintf(buffer, ""), ++test);
17466   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17467   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17468
17469   return 0;
17470 }
17471 EOP
17472 set try
17473
17474 if eval $compile; then
17475     xxx="`$run ./try`"
17476     case "$?" in
17477         0) cat >&4 <<EOM
17478 sprintf returns the length of the string (as ANSI says it should)
17479 EOM
17480         d_sprintf_returns_strlen="$define"
17481         ;;
17482         *) cat >&4 <<EOM
17483 sprintf does not return the length of the string (how old is this system?)
17484 EOM
17485         d_sprintf_returns_strlen="$undef"
17486         ;;
17487     esac
17488 else
17489     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17490     d_sprintf_returns_strlen="$undef"
17491 fi
17492 $rm_try
17493
17494 : see if srand48_r exists
17495 set srand48_r d_srand48_r
17496 eval $inlibc
17497 case "$d_srand48_r" in
17498 "$define")
17499         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17500         case "$d_srand48_r_proto:$usethreads" in
17501         ":define")      d_srand48_r_proto=define
17502                 set d_srand48_r_proto srand48_r $hdrs
17503                 eval $hasproto ;;
17504         *)      ;;
17505         esac
17506         case "$d_srand48_r_proto" in
17507         define)
17508         case "$srand48_r_proto" in
17509         ''|0) try='int srand48_r(long, struct drand48_data*);'
17510         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
17511         esac
17512         case "$srand48_r_proto" in
17513         ''|0)   d_srand48_r=undef
17514                 srand48_r_proto=0
17515                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17516         * )     case "$srand48_r_proto" in
17517                 REENTRANT_PROTO*) ;;
17518                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17519                 esac
17520                 echo "Prototype: $try" ;;
17521         esac
17522         ;;
17523         *)      case "$usethreads" in
17524                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17525                 esac
17526                 d_srand48_r=undef
17527                 srand48_r_proto=0
17528                 ;;
17529         esac
17530         ;;
17531 *)      srand48_r_proto=0
17532         ;;
17533 esac
17534
17535 : see if srandom_r exists
17536 set srandom_r d_srandom_r
17537 eval $inlibc
17538 case "$d_srandom_r" in
17539 "$define")
17540         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17541         case "$d_srandom_r_proto:$usethreads" in
17542         ":define")      d_srandom_r_proto=define
17543                 set d_srandom_r_proto srandom_r $hdrs
17544                 eval $hasproto ;;
17545         *)      ;;
17546         esac
17547         case "$d_srandom_r_proto" in
17548         define)
17549         case "$srandom_r_proto" in
17550         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17551         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
17552         esac
17553         case "$srandom_r_proto" in
17554         ''|0)   d_srandom_r=undef
17555                 srandom_r_proto=0
17556                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17557         * )     case "$srandom_r_proto" in
17558                 REENTRANT_PROTO*) ;;
17559                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17560                 esac
17561                 echo "Prototype: $try" ;;
17562         esac
17563         ;;
17564         *)      case "$usethreads" in
17565                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17566                 esac
17567                 d_srandom_r=undef
17568                 srandom_r_proto=0
17569                 ;;
17570         esac
17571         ;;
17572 *)      srandom_r_proto=0
17573         ;;
17574 esac
17575
17576 : see if prototype for setresgid is available
17577 echo " "
17578 set d_sresgproto setresgid $i_unistd unistd.h
17579 eval $hasproto
17580
17581 : see if prototype for setresuid is available
17582 echo " "
17583 set d_sresuproto setresuid $i_unistd unistd.h
17584 eval $hasproto
17585
17586 : see if sys/stat.h is available
17587 set sys/stat.h i_sysstat
17588 eval $inhdr
17589
17590 : see if stat knows about block sizes
17591 echo " "
17592 echo "Checking to see if your struct stat has st_blocks field..." >&4
17593 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17594 eval $hasfield
17595
17596 : see if this is a sys/vfs.h system
17597 set sys/vfs.h i_sysvfs
17598 eval $inhdr
17599
17600 : see if this is a sys/statfs.h system
17601 set sys/statfs.h i_sysstatfs
17602 eval $inhdr
17603
17604 : Check for statfs_s
17605 echo " "
17606 echo "Checking to see if your system supports struct statfs..." >&4
17607 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
17608 eval $hasstruct
17609 case "$d_statfs_s" in
17610 "$define")      echo "Yes, it does."   ;;
17611 *)              echo "No, it doesn't." ;;
17612 esac
17613
17614
17615 : see if struct statfs knows about f_flags
17616 case "$d_statfs_s" in
17617 define)
17618         echo " "
17619         echo "Checking to see if your struct statfs has f_flags field..." >&4
17620         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
17621         eval $hasfield
17622         ;;
17623 *)      val="$undef"
17624         set d_statfs_f_flags
17625         eval $setvar
17626         ;;
17627 esac
17628 case "$d_statfs_f_flags" in
17629 "$define")      echo "Yes, it does."   ;;
17630 *)              echo "No, it doesn't." ;;
17631 esac
17632
17633 : Check stream access
17634 $cat >&4 <<EOM
17635 Checking how to access stdio streams by file descriptor number...
17636 EOM
17637 case "$stdio_stream_array" in
17638 '')     $cat >try.c <<EOCP
17639 #include <stdio.h>
17640 int main() {
17641   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17642     printf("yes\n");
17643 }
17644 EOCP
17645         for s in _iob __iob __sF
17646         do
17647                 set try -DSTDIO_STREAM_ARRAY=$s
17648                 if eval $compile; then
17649                         case "`$run ./try`" in
17650                         yes)    stdio_stream_array=$s; break ;;
17651                         esac
17652                 fi
17653         done
17654         $rm_try
17655 esac
17656 case "$stdio_stream_array" in
17657 '')     $cat >&4 <<EOM
17658 I can't figure out how to access stdio streams by file descriptor number.
17659 EOM
17660         d_stdio_stream_array="$undef"
17661         ;;
17662 *)      $cat >&4 <<EOM
17663 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17664 EOM
17665         d_stdio_stream_array="$define"
17666         ;;
17667 esac
17668
17669 : see if strcoll exists
17670 set strcoll d_strcoll
17671 eval $inlibc
17672
17673 : check for structure copying
17674 echo " "
17675 echo "Checking to see if your C compiler can copy structs..." >&4
17676 $cat >try.c <<'EOCP'
17677 int main()
17678 {
17679         struct blurfl {
17680                 int dyick;
17681         } foo, bar;
17682
17683         foo = bar;
17684 }
17685 EOCP
17686 if $cc -c try.c >/dev/null 2>&1 ; then
17687         val="$define"
17688         echo "Yup, it can."
17689 else
17690         val="$undef"
17691         echo "Nope, it can't."
17692 fi
17693 set d_strctcpy
17694 eval $setvar
17695 $rm_try
17696
17697 : see if strerror and/or sys_errlist[] exist
17698 echo " "
17699 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17700     if set strerror val -f d_strerror; eval $csym; $val; then
17701                 echo 'strerror() found.' >&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 "(You also have sys_errlist[], so we could roll our own strerror.)" 
17706                         d_syserrlst="$define"
17707                 else
17708                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17709                         d_syserrlst="$undef"
17710                 fi
17711     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17712                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17713                 echo 'strerror() found in string header.' >&4
17714                 d_strerror="$define"
17715                 d_strerrm='strerror(e)'
17716                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17717                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17718                                 d_syserrlst="$define"
17719                 else
17720                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17721                         d_syserrlst="$undef"
17722                 fi
17723     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17724                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17725                 d_strerror="$undef"
17726                 d_syserrlst="$define"
17727                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17728     else
17729                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17730                 d_strerror="$undef"
17731                 d_syserrlst="$undef"
17732                 d_strerrm='"unknown"'
17733     fi
17734 fi
17735
17736 : see if strerror_r exists
17737 set strerror_r d_strerror_r
17738 eval $inlibc
17739 case "$d_strerror_r" in
17740 "$define")
17741         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17742         case "$d_strerror_r_proto:$usethreads" in
17743         ":define")      d_strerror_r_proto=define
17744                 set d_strerror_r_proto strerror_r $hdrs
17745                 eval $hasproto ;;
17746         *)      ;;
17747         esac
17748         case "$d_strerror_r_proto" in
17749         define)
17750         case "$strerror_r_proto" in
17751         ''|0) try='int strerror_r(int, char*, size_t);'
17752         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17753         esac
17754         case "$strerror_r_proto" in
17755         ''|0) try='int strerror_r(int, char*, int);'
17756         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17757         esac
17758         case "$strerror_r_proto" in
17759         ''|0) try='char* strerror_r(int, char*, size_t);'
17760         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17761         esac
17762         case "$strerror_r_proto" in
17763         ''|0)   d_strerror_r=undef
17764                 strerror_r_proto=0
17765                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17766         * )     case "$strerror_r_proto" in
17767                 REENTRANT_PROTO*) ;;
17768                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17769                 esac
17770                 echo "Prototype: $try" ;;
17771         esac
17772         ;;
17773         *)      case "$usethreads" in
17774                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17775                 esac
17776                 d_strerror_r=undef
17777                 strerror_r_proto=0
17778                 ;;
17779         esac
17780         ;;
17781 *)      strerror_r_proto=0
17782         ;;
17783 esac
17784
17785 : see if strftime exists
17786 set strftime d_strftime
17787 eval $inlibc
17788
17789 : see if strlcat exists
17790 set strlcat d_strlcat
17791 eval $inlibc
17792
17793 : see if strlcpy exists
17794 set strlcpy d_strlcpy
17795 eval $inlibc
17796
17797 : see if strtod exists
17798 set strtod d_strtod
17799 eval $inlibc
17800
17801 : see if strtol exists
17802 set strtol d_strtol
17803 eval $inlibc
17804
17805 : see if strtold exists
17806 set strtold d_strtold
17807 eval $inlibc
17808
17809 : see if strtoll exists
17810 set strtoll d_strtoll
17811 eval $inlibc
17812
17813 case "$d_longlong-$d_strtoll" in
17814 "$define-$define")
17815         $cat <<EOM
17816 Checking whether your strtoll() works okay...
17817 EOM
17818         $cat >try.c <<'EOCP'
17819 #include <errno.h>
17820 #ifdef __hpux
17821 #define strtoll __strtoll
17822 #endif
17823 #ifdef __EMX__
17824 #define strtoll _strtoll
17825 #endif
17826 #include <stdio.h>
17827 extern long long int strtoll(char *s, char **, int);
17828 static int bad = 0;
17829 int check(char *s, long long ell, int een) {
17830         long long gll;
17831         errno = 0;
17832         gll = strtoll(s, 0, 10);
17833         if (!((gll == ell) && (errno == een)))
17834                 bad++;
17835 }
17836 int main() {
17837         check(" 1",                                      1LL, 0);
17838         check(" 0",                                      0LL, 0);
17839         check("-1",                                     -1LL, 0);
17840         check("-9223372036854775808", -9223372036854775808LL, 0);
17841         check("-9223372036854775808", -9223372036854775808LL, 0);
17842         check(" 9223372036854775807",  9223372036854775807LL, 0);
17843         check("-9223372036854775808", -9223372036854775808LL, 0);
17844         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17845         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17846         if (!bad)
17847                 printf("ok\n");
17848 }
17849 EOCP
17850         set try
17851         if eval $compile; then
17852                 yyy=`$run ./try`
17853                 case "$yyy" in
17854                 ok) echo "Your strtoll() seems to be working okay." ;;
17855                 *) cat <<EOM >&4
17856 Your strtoll() doesn't seem to be working okay.
17857 EOM
17858                    d_strtoll="$undef"
17859                    ;;
17860                 esac
17861         else
17862                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17863                 d_strtoll="$undef"
17864         fi
17865         ;;
17866 esac
17867
17868 : see if strtoq exists
17869 set strtoq d_strtoq
17870 eval $inlibc
17871
17872 : see if strtoul exists
17873 set strtoul d_strtoul
17874 eval $inlibc
17875
17876 case "$d_strtoul" in
17877 "$define")
17878         $cat <<EOM
17879 Checking whether your strtoul() works okay...
17880 EOM
17881         $cat >try.c <<'EOCP'
17882 #include <errno.h>
17883 #include <stdio.h>
17884 extern unsigned long int strtoul(char *s, char **, int);
17885 static int bad = 0;
17886 void check(char *s, unsigned long eul, int een) {
17887         unsigned long gul;
17888         errno = 0;
17889         gul = strtoul(s, 0, 10);
17890         if (!((gul == eul) && (errno == een)))
17891                 bad++;
17892 }
17893 int main() {
17894         check(" 1", 1L, 0);
17895         check(" 0", 0L, 0);
17896 EOCP
17897         case "$longsize" in
17898         8)
17899             $cat >>try.c <<'EOCP'
17900         check("18446744073709551615", 18446744073709551615UL, 0);
17901         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17902 #if 0 /* strtoul() for /^-/ strings is undefined. */
17903         check("-1", 18446744073709551615UL, 0);
17904         check("-18446744073709551614", 2, 0);
17905         check("-18446744073709551615", 1, 0);
17906         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17907         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17908 #endif
17909 EOCP
17910                 ;;
17911         4)
17912                     $cat >>try.c <<'EOCP'
17913         check("4294967295", 4294967295UL, 0);
17914         check("4294967296", 4294967295UL, ERANGE);
17915 #if 0 /* strtoul() for /^-/ strings is undefined. */
17916         check("-1", 4294967295UL, 0);
17917         check("-4294967294", 2, 0);
17918         check("-4294967295", 1, 0);
17919         check("-4294967296", 4294967295UL, ERANGE);
17920         check("-4294967297", 4294967295UL, ERANGE);
17921 #endif
17922 EOCP
17923                 ;;
17924         *)
17925 : Should we write these tests to be more portable by sprintf-ing
17926 : ~0 and then manipulating that char string as input for strtol?
17927                 ;;
17928         esac
17929         $cat >>try.c <<'EOCP'
17930         if (!bad)
17931                 printf("ok\n");
17932         return 0;
17933 }
17934 EOCP
17935         set try
17936         if eval $compile; then
17937                 case "`$run ./try`" in
17938                 ok) echo "Your strtoul() seems to be working okay." ;;
17939                 *) cat <<EOM >&4
17940 Your strtoul() doesn't seem to be working okay.
17941 EOM
17942                    d_strtoul="$undef"
17943                    ;;
17944                 esac
17945         else
17946                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17947                 d_strtoul="$undef"
17948         fi
17949         ;;
17950 esac
17951
17952 : see if strtoull exists
17953 set strtoull d_strtoull
17954 eval $inlibc
17955
17956 case "$d_longlong-$d_strtoull" in
17957 "$define-$define")
17958         $cat <<EOM
17959 Checking whether your strtoull() works okay...
17960 EOM
17961         $cat >try.c <<'EOCP'
17962 #include <errno.h>
17963 #ifdef __hpux
17964 #define strtoull __strtoull
17965 #endif
17966 #include <stdio.h>
17967 extern unsigned long long int strtoull(char *s, char **, int);
17968 static int bad = 0;
17969 int check(char *s, long long eull, int een) {
17970         long long gull;
17971         errno = 0;
17972         gull = strtoull(s, 0, 10);
17973         if (!((gull == eull) && (errno == een)))
17974                 bad++;
17975 }
17976 int main() {
17977         check(" 1",                                        1LL, 0);
17978         check(" 0",                                        0LL, 0);
17979         check("18446744073709551615",  18446744073709551615ULL, 0);
17980         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17981 #if 0 /* strtoull() for /^-/ strings is undefined. */
17982         check("-1",                    18446744073709551615ULL, 0);
17983         check("-18446744073709551614",                     2LL, 0);
17984         check("-18446744073709551615",                     1LL, 0);
17985         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17986         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17987 #endif
17988         if (!bad)
17989                 printf("ok\n");
17990 }
17991 EOCP
17992         set try
17993         if eval $compile; then
17994                 case "`$run ./try`" in
17995                 ok) echo "Your strtoull() seems to be working okay." ;;
17996                 *) cat <<EOM >&4
17997 Your strtoull() doesn't seem to be working okay.
17998 EOM
17999                    d_strtoull="$undef"
18000                    ;;
18001                 esac
18002         else
18003                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18004                 d_strtoull="$undef"
18005         fi
18006         ;;
18007 esac
18008
18009 : see if strtouq exists
18010 set strtouq d_strtouq
18011 eval $inlibc
18012
18013 case "$d_strtouq" in
18014 "$define")
18015         $cat <<EOM
18016 Checking whether your strtouq() works okay...
18017 EOM
18018         $cat >try.c <<'EOCP'
18019 #include <errno.h>
18020 #include <stdio.h>
18021 extern unsigned long long int strtouq(char *s, char **, int);
18022 static int bad = 0;
18023 void check(char *s, unsigned long long eull, int een) {
18024         unsigned long long gull;
18025         errno = 0;
18026         gull = strtouq(s, 0, 10);
18027         if (!((gull == eull) && (errno == een)))
18028                 bad++;
18029 }
18030 int main() {
18031         check(" 1",                                        1LL, 0);
18032         check(" 0",                                        0LL, 0);
18033         check("18446744073709551615",  18446744073709551615ULL, 0);
18034         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18035 #if 0 /* strtouq() for /^-/ strings is undefined. */
18036         check("-1",                    18446744073709551615ULL, 0);
18037         check("-18446744073709551614",                     2LL, 0);
18038         check("-18446744073709551615",                     1LL, 0);
18039         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18040         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18041 #endif
18042         if (!bad)
18043                 printf("ok\n");
18044         return 0;
18045 }
18046 EOCP
18047         set try
18048         if eval $compile; then
18049                 case "`$run ./try`" in
18050                 ok) echo "Your strtouq() seems to be working okay." ;;
18051                 *) cat <<EOM >&4
18052 Your strtouq() doesn't seem to be working okay.
18053 EOM
18054                    d_strtouq="$undef"
18055                    ;;
18056                 esac
18057         else
18058                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18059                 d_strtouq="$undef"
18060         fi
18061         ;;
18062 esac
18063
18064 : see if strxfrm exists
18065 set strxfrm d_strxfrm
18066 eval $inlibc
18067
18068 : see if symlink exists
18069 set symlink d_symlink
18070 eval $inlibc
18071
18072 : see if syscall exists
18073 set syscall d_syscall
18074 eval $inlibc
18075
18076 : see if prototype for syscall is available
18077 echo " "
18078 set d_syscallproto syscall $i_unistd unistd.h
18079 eval $hasproto
18080
18081 : see if sysconf exists
18082 set sysconf d_sysconf
18083 eval $inlibc
18084
18085 : see if system exists
18086 set system d_system
18087 eval $inlibc
18088
18089 : see if tcgetpgrp exists
18090 set tcgetpgrp d_tcgetpgrp
18091 eval $inlibc
18092
18093 : see if tcsetpgrp exists
18094 set tcsetpgrp d_tcsetpgrp
18095 eval $inlibc
18096
18097 : see if prototype for telldir is available
18098 echo " "
18099 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18100 eval $hasproto
18101
18102 : see if time exists
18103 echo " "
18104 if test "X$d_time" = X -o X"$timetype" = X; then
18105     if set time val -f d_time; eval $csym; $val; then
18106                 echo 'time() found.' >&4
18107                 val="$define"
18108                 rp="What is the type returned by time() on this system?"
18109                 set time_t timetype long stdio.h sys/types.h
18110                 eval $typedef_ask
18111     else
18112                 echo 'time() not found, hope that will do.' >&4
18113                 val="$undef"
18114                 timetype='int';
18115     fi
18116     set d_time
18117     eval $setvar
18118 fi
18119
18120 : see if timegm exists
18121 set timegm d_timegm
18122 eval $inlibc
18123
18124 : see if this is a sys/times.h system
18125 set sys/times.h i_systimes
18126 eval $inhdr
18127
18128 : see if times exists
18129 echo " "
18130 if set times val -f d_times; eval $csym; $val; then
18131         echo 'times() found.' >&4
18132         d_times="$define"
18133         inc=''
18134         case "$i_systimes" in
18135         "$define") inc='sys/times.h';;
18136         esac
18137         rp="What is the type returned by times() on this system?"
18138         set clock_t clocktype long stdio.h sys/types.h $inc
18139         eval $typedef_ask
18140 else
18141         echo 'times() NOT found, hope that will do.' >&4
18142         d_times="$undef"
18143         clocktype='int'
18144 fi
18145
18146 : see if tmpnam_r exists
18147 set tmpnam_r d_tmpnam_r
18148 eval $inlibc
18149 case "$d_tmpnam_r" in
18150 "$define")
18151         hdrs="$i_systypes sys/types.h define stdio.h "
18152         case "$d_tmpnam_r_proto:$usethreads" in
18153         ":define")      d_tmpnam_r_proto=define
18154                 set d_tmpnam_r_proto tmpnam_r $hdrs
18155                 eval $hasproto ;;
18156         *)      ;;
18157         esac
18158         case "$d_tmpnam_r_proto" in
18159         define)
18160         case "$tmpnam_r_proto" in
18161         ''|0) try='char* tmpnam_r(char*);'
18162         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
18163         esac
18164         case "$tmpnam_r_proto" in
18165         ''|0)   d_tmpnam_r=undef
18166                 tmpnam_r_proto=0
18167                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18168         * )     case "$tmpnam_r_proto" in
18169                 REENTRANT_PROTO*) ;;
18170                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18171                 esac
18172                 echo "Prototype: $try" ;;
18173         esac
18174         ;;
18175         *)      case "$usethreads" in
18176                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18177                 esac
18178                 d_tmpnam_r=undef
18179                 tmpnam_r_proto=0
18180                 ;;
18181         esac
18182         ;;
18183 *)      tmpnam_r_proto=0
18184         ;;
18185 esac
18186
18187 : see if truncate exists
18188 set truncate d_truncate
18189 eval $inlibc
18190
18191 : see if ttyname_r exists
18192 set ttyname_r d_ttyname_r
18193 eval $inlibc
18194 case "$d_ttyname_r" in
18195 "$define")
18196         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18197         case "$d_ttyname_r_proto:$usethreads" in
18198         ":define")      d_ttyname_r_proto=define
18199                 set d_ttyname_r_proto ttyname_r $hdrs
18200                 eval $hasproto ;;
18201         *)      ;;
18202         esac
18203         case "$d_ttyname_r_proto" in
18204         define)
18205         case "$ttyname_r_proto" in
18206         ''|0) try='int ttyname_r(int, char*, size_t);'
18207         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
18208         esac
18209         case "$ttyname_r_proto" in
18210         ''|0) try='int ttyname_r(int, char*, int);'
18211         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
18212         esac
18213         case "$ttyname_r_proto" in
18214         ''|0) try='char* ttyname_r(int, char*, int);'
18215         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
18216         esac
18217         case "$ttyname_r_proto" in
18218         ''|0)   d_ttyname_r=undef
18219                 ttyname_r_proto=0
18220                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18221         * )     case "$ttyname_r_proto" in
18222                 REENTRANT_PROTO*) ;;
18223                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18224                 esac
18225                 echo "Prototype: $try" ;;
18226         esac
18227         ;;
18228         *)      case "$usethreads" in
18229                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18230                 esac
18231                 d_ttyname_r=undef
18232                 ttyname_r_proto=0
18233                 ;;
18234         esac
18235         ;;
18236 *)      ttyname_r_proto=0
18237         ;;
18238 esac
18239
18240 : see if tzname[] exists
18241 echo " "
18242 if set tzname val -a d_tzname; eval $csym; $val; then
18243         val="$define"
18244         echo 'tzname[] found.' >&4
18245 else
18246         val="$undef"
18247         echo 'tzname[] NOT found.' >&4
18248 fi
18249 set d_tzname
18250 eval $setvar
18251
18252 : Check if is a multiplatform env
18253 case "$osname" in
18254 next|rhapsody|darwin) multiarch="$define" ;;
18255 esac
18256 case "$multiarch" in
18257 ''|[nN]*) multiarch="$undef" ;;
18258 esac
18259
18260 : check for ordering of bytes in a UV
18261 echo " "
18262 case "$usecrosscompile$multiarch" in
18263 *$define*)
18264         $cat <<EOM
18265 You seem to be either cross-compiling or doing a multiarchitecture build,
18266 skipping the byteorder check.
18267
18268 EOM
18269         byteorder='ffff'
18270         ;;
18271 *)
18272         case "$byteorder" in
18273         '')
18274                 $cat <<'EOM'
18275 In the following, larger digits indicate more significance.  A big-endian
18276 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18277 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18278 machines may have weird orders like 3412.  A Cray will report 87654321,
18279 an Alpha will report 12345678. If the test program works the default is
18280 probably right.
18281 I'm now running the test program...
18282 EOM
18283                 $cat >try.c <<EOCP
18284 #include <stdio.h>
18285 #$i_stdlib I_STDLIB
18286 #ifdef I_STDLIB
18287 #include <stdlib.h>
18288 #endif
18289 #include <sys/types.h>
18290 typedef $uvtype UV;
18291 int main()
18292 {
18293         int i;
18294         union {
18295                 UV l;
18296                 char c[$uvsize];
18297         } u;
18298
18299         if ($uvsize > 4)
18300                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18301         else
18302                 u.l = (UV)0x04030201;
18303         for (i = 0; i < $uvsize; i++)
18304                 printf("%c", u.c[i]+'0');
18305         printf("\n");
18306         exit(0);
18307 }
18308 EOCP
18309                 xxx_prompt=y
18310                 set try
18311                 if eval $compile && $run ./try > /dev/null; then
18312                         dflt=`$run ./try`
18313                         case "$dflt" in
18314                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18315                                 echo "(The test program ran ok.)"
18316                                 echo "byteorder=$dflt"
18317                                 xxx_prompt=n
18318                         ;;
18319                         ????|????????) echo "(The test program ran ok.)" ;;
18320                         *) echo "(The test program didn't run right for some reason.)" ;;
18321                         esac
18322                 else
18323                         dflt='4321'
18324                         cat <<'EOM'
18325 (I can't seem to compile the test program.  Guessing big-endian...)
18326 EOM
18327                 fi
18328                 case "$xxx_prompt" in
18329                 y)
18330                         rp="What is the order of bytes in $uvtype?"
18331                         . ./myread
18332                         byteorder="$ans"
18333                         ;;
18334                 *)      byteorder=$dflt
18335                         ;;
18336                 esac
18337                 ;;
18338         esac
18339         $rm_try
18340         ;;
18341 esac
18342
18343 : Checking 32bit aligndness
18344 $cat <<EOM
18345
18346 Checking to see whether you can access character data unalignedly...
18347 EOM
18348 case "$d_u32align" in
18349 '')   $cat >try.c <<EOCP
18350 #include <stdio.h>
18351 #$i_stdlib I_STDLIB
18352 #ifdef I_STDLIB
18353 #include <stdlib.h>
18354 #endif
18355 #define U32 $u32type
18356 #define BYTEORDER 0x$byteorder
18357 #define U8 $u8type
18358 #include <signal.h>
18359 #ifdef SIGBUS
18360 $signal_t bletch(int s) { exit(4); }
18361 #endif
18362 int main() {
18363 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18364     U8 buf[8];
18365     U32 *up;
18366     int i;
18367
18368     if (sizeof(U32) != 4) {
18369         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18370         exit(1);
18371     }
18372
18373     fflush(stdout);
18374
18375 #ifdef SIGBUS
18376     signal(SIGBUS, bletch);
18377 #endif
18378
18379     buf[0] = 0;
18380     buf[1] = 0;
18381     buf[2] = 0;
18382     buf[3] = 1;
18383     buf[4] = 0;
18384     buf[5] = 0;
18385     buf[6] = 0;
18386     buf[7] = 1;
18387
18388     for (i = 0; i < 4; i++) {
18389         up = (U32*)(buf + i);
18390         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18391                (*up == 1 << (8*(3-i)))  /* little-endian */
18392               )
18393            )
18394         {
18395             printf("read failed (%x)\n", *up);
18396             exit(2);
18397         }
18398     }
18399
18400     /* write test */
18401     for (i = 0; i < 4; i++) {
18402         up = (U32*)(buf + i);
18403         *up = 0xBeef;
18404         if (*up != 0xBeef) {
18405             printf("write failed (%x)\n", *up);
18406             exit(3);
18407         }
18408     }
18409
18410     exit(0);
18411 #else
18412     printf("1\n");
18413     exit(1);
18414 #endif
18415     return 0;
18416 }
18417 EOCP
18418 set try
18419 if eval $compile_ok; then
18420         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18421         $run ./try 2>&1 >/dev/null
18422         case "$?" in
18423         0)      cat >&4 <<EOM
18424 You can access character data pretty unalignedly.
18425 EOM
18426                 d_u32align="$undef"
18427                 ;;
18428         *)      cat >&4 <<EOM
18429 It seems that you must access character data in an aligned manner.
18430 EOM
18431                 d_u32align="$define"
18432                 ;;
18433         esac
18434 else
18435         rp='Can you access character data at unaligned addresses?'
18436         dflt='n'
18437         . ./myread
18438         case "$ans" in
18439         [yY]*)  d_u32align="$undef"  ;;
18440         *)      d_u32align="$define" ;;
18441         esac
18442 fi
18443 $rm_try
18444 ;;
18445 esac
18446
18447 : see if ualarm exists
18448 set ualarm d_ualarm
18449 eval $inlibc
18450
18451 : see if umask exists
18452 set umask d_umask
18453 eval $inlibc
18454
18455 : see if unordered exists
18456 set unordered d_unordered
18457 eval $inlibc
18458
18459 : see if unsetenv exists
18460 set unsetenv d_unsetenv
18461 eval $inlibc
18462
18463 : see if usleep exists
18464 set usleep d_usleep
18465 eval $inlibc
18466
18467 : see if prototype for usleep is available
18468 echo " "
18469 set d_usleepproto usleep $i_unistd unistd.h
18470 eval $hasproto
18471
18472 : see if ustat exists
18473 set ustat d_ustat
18474 eval $inlibc
18475
18476 : see if closedir exists
18477 set closedir d_closedir
18478 eval $inlibc
18479
18480 case "$d_closedir" in
18481 "$define")
18482         echo " "
18483         echo "Checking whether closedir() returns a status..." >&4
18484         cat > try.c <<EOM
18485 #$i_dirent I_DIRENT             /**/
18486 #$i_sysdir I_SYS_DIR            /**/
18487 #$i_sysndir I_SYS_NDIR          /**/
18488 #$i_systypes I_SYS_TYPES        /**/
18489
18490 #if defined(I_SYS_TYPES)
18491 #include <sys/types.h>
18492 #endif
18493 #if defined(I_DIRENT)
18494 #include <dirent.h>
18495 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18496 #include <sys/dir.h>
18497 #endif
18498 #else
18499 #ifdef I_SYS_NDIR
18500 #include <sys/ndir.h>
18501 #else
18502 #ifdef I_SYS_DIR
18503 #ifdef hp9000s500
18504 #include <ndir.h>       /* may be wrong in the future */
18505 #else
18506 #include <sys/dir.h>
18507 #endif
18508 #endif
18509 #endif
18510 #endif
18511 int main() { return closedir(opendir(".")); }
18512 EOM
18513         set try
18514         if eval $compile_ok; then
18515                 if $run ./try > /dev/null 2>&1 ; then
18516                         echo "Yes, it does."
18517                         val="$undef"
18518                 else
18519                         echo "No, it doesn't."
18520                         val="$define"
18521                 fi
18522         else
18523                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18524                 val="$define"
18525         fi
18526         ;;
18527 *)
18528         val="$undef";
18529         ;;
18530 esac
18531 set d_void_closedir
18532 eval $setvar
18533 $rm_try
18534
18535 : see if there is a wait4
18536 set wait4 d_wait4
18537 eval $inlibc
18538
18539 : see if waitpid exists
18540 set waitpid d_waitpid
18541 eval $inlibc
18542
18543 : see if wcstombs exists
18544 set wcstombs d_wcstombs
18545 eval $inlibc
18546
18547 : see if wctomb exists
18548 set wctomb d_wctomb
18549 eval $inlibc
18550
18551 : see if writev exists
18552 set writev d_writev
18553 eval $inlibc
18554
18555 : preserve RCS keywords in files with variable substitution, grrr
18556 Date='$Date'
18557 Id='$Id'
18558 Log='$Log'
18559 RCSfile='$RCSfile'
18560 Revision='$Revision'
18561
18562 : check for alignment requirements
18563 echo " "
18564 case "$usecrosscompile$multiarch" in
18565 *$define*)
18566         $cat <<EOM
18567 You seem to be either cross-compiling or doing a multiarchitecture build,
18568 skipping the memory alignment check.
18569
18570 EOM
18571         case "$alignbytes" in
18572         '') alignbytes=8 ;;
18573         esac
18574         ;;
18575 *)
18576         case "$alignbytes" in
18577         '') echo "Checking alignment constraints..." >&4
18578                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18579                         $cat >try.c <<'EOCP'
18580 typedef long double NV;
18581 EOCP
18582                 else
18583                         $cat >try.c <<'EOCP'
18584 typedef double NV;
18585 EOCP
18586                 fi
18587                 $cat >>try.c <<'EOCP'
18588 #include <stdio.h>
18589 struct foobar {
18590         char foo;
18591         NV bar;
18592 } try_algn;
18593 int main()
18594 {
18595     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18596     return(0);
18597 }
18598 EOCP
18599                 set try
18600                 if eval $compile_ok; then
18601                         dflt=`$run ./try`
18602                 else
18603                         dflt='8'
18604                         echo "(I can't seem to compile the test program...)"
18605                 fi
18606                 ;;
18607         *) dflt="$alignbytes"
18608                 ;;
18609         esac
18610         rp="Doubles must be aligned on a how-many-byte boundary?"
18611         . ./myread
18612         alignbytes="$ans"
18613         $rm_try
18614         ;;
18615 esac
18616
18617
18618 : set the base revision
18619 baserev=5.0
18620
18621 : how do we concatenate cpp tokens here?
18622 echo " "
18623 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18624 $cat >cpp_stuff.c <<'EOCP'
18625 #define RCAT(a,b)a/**/b
18626 #define ACAT(a,b)a ## b
18627 RCAT(Rei,ser)
18628 ACAT(Cir,cus)
18629 EOCP
18630 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18631 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18632         echo "Oh!  Smells like ANSI's been here." >&4
18633         echo "We can catify or stringify, separately or together!"
18634         cpp_stuff=42
18635 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18636         echo "Ah, yes!  The good old days!" >&4
18637         echo "However, in the good old days we don't know how to stringify and"
18638         echo "catify at the same time."
18639         cpp_stuff=1
18640 else
18641         $cat >&4 <<EOM
18642 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18643 You're going to have to edit the values of CAT[2-5] in config.h...
18644 EOM
18645         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18646 fi
18647 $rm -f cpp_stuff.*
18648
18649 : see if this is a db.h system
18650 set db.h i_db
18651 eval $inhdr
18652
18653 case "$i_db" in
18654 $define)
18655         : Check db version.
18656         echo " "
18657         echo "Checking Berkeley DB version ..." >&4
18658         $cat >try.c <<EOCP
18659 #$d_const HASCONST
18660 #ifndef HASCONST
18661 #define const
18662 #endif
18663 #include <sys/types.h>
18664 #include <stdio.h>
18665 #$i_stdlib I_STDLIB
18666 #ifdef I_STDLIB
18667 #include <stdlib.h>
18668 #endif
18669 #include <db.h>
18670 int main(int argc, char *argv[])
18671 {
18672 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18673     int Major, Minor, Patch ;
18674     unsigned long Version ;
18675     (void)db_version(&Major, &Minor, &Patch) ;
18676     if (argc == 2) {
18677         printf("%d %d %d %d %d %d\n",
18678                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18679                Major, Minor, Patch);
18680         exit(0);
18681     }
18682     printf("You have Berkeley DB Version 2 or greater.\n");
18683
18684     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18685                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18686     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18687                 Major, Minor, Patch) ;
18688
18689     /* check that db.h & libdb are compatible */
18690     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18691         printf("db.h and libdb are incompatible.\n") ;
18692         exit(3);
18693     }
18694
18695     printf("db.h and libdb are compatible.\n") ;
18696
18697     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18698                 + DB_VERSION_PATCH ;
18699
18700     /* needs to be >= 2.3.4 */
18701     if (Version < 2003004) {
18702     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18703         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18704         exit(2);
18705     }
18706
18707     exit(0);
18708 #else
18709 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18710     if (argc == 2) {
18711         printf("1 0 0\n");
18712         exit(0);
18713     }
18714     printf("You have Berkeley DB Version 1.\n");
18715     exit(0);    /* DB version < 2: the coast is clear. */
18716 #else
18717     exit(1);    /* <db.h> not Berkeley DB? */
18718 #endif
18719 #endif
18720 }
18721 EOCP
18722         set try
18723         if eval $compile_ok && $run ./try; then
18724                 echo 'Looks OK.' >&4
18725                 set `$run ./try 1`
18726                 db_version_major=$1
18727                 db_version_minor=$2
18728                 db_version_patch=$3
18729         else
18730                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18731                 i_db=$undef
18732                 case " $libs " in
18733                 *"-ldb "*)
18734                         : Remove db from list of libraries to use
18735                         echo "Removing unusable -ldb from library list" >&4
18736                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18737                         shift
18738                         libs="$*"
18739                         echo "libs = $libs" >&4
18740                         ;;
18741                 esac
18742         fi
18743         $rm_try
18744         ;;
18745 esac
18746
18747 case "$i_db" in
18748 define)
18749         : Check the return type needed for hash
18750         echo " "
18751         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18752         $cat >try.c <<EOCP
18753 #$d_const HASCONST
18754 #ifndef HASCONST
18755 #define const
18756 #endif
18757 #include <sys/types.h>
18758 #include <db.h>
18759
18760 #ifndef DB_VERSION_MAJOR
18761 u_int32_t hash_cb (ptr, size)
18762 const void *ptr;
18763 size_t size;
18764 {
18765 }
18766 HASHINFO info;
18767 int main()
18768 {
18769         info.hash = hash_cb;
18770 }
18771 #endif
18772 EOCP
18773         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18774                 if $contains warning try.out >>/dev/null 2>&1 ; then
18775                         db_hashtype='int'
18776                 else
18777                         db_hashtype='u_int32_t'
18778                 fi
18779         else
18780                 : XXX Maybe we should just give up here.
18781                 db_hashtype=u_int32_t
18782                 $cat try.out >&4
18783                 echo "Help:  I can't seem to compile the db test program." >&4
18784                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18785         fi
18786         $rm_try
18787         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18788         ;;
18789 *)      db_hashtype=u_int32_t
18790         ;;
18791 esac
18792 case "$i_db" in
18793 define)
18794         : Check the return type needed for prefix
18795         echo " "
18796         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18797         cat >try.c <<EOCP
18798 #$d_const HASCONST
18799 #ifndef HASCONST
18800 #define const
18801 #endif
18802 #include <sys/types.h>
18803 #include <db.h>
18804
18805 #ifndef DB_VERSION_MAJOR
18806 size_t prefix_cb (key1, key2)
18807 const DBT *key1;
18808 const DBT *key2;
18809 {
18810 }
18811 BTREEINFO info;
18812 int main()
18813 {
18814         info.prefix = prefix_cb;
18815 }
18816 #endif
18817 EOCP
18818         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18819                 if $contains warning try.out >>/dev/null 2>&1 ; then
18820                         db_prefixtype='int'
18821                 else
18822                         db_prefixtype='size_t'
18823                 fi
18824         else
18825                 db_prefixtype='size_t'
18826                 : XXX Maybe we should just give up here.
18827                 $cat try.out >&4
18828                 echo "Help:  I can't seem to compile the db test program." >&4
18829                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18830         fi
18831         $rm_try
18832         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18833         ;;
18834 *)      db_prefixtype='size_t'
18835         ;;
18836 esac
18837
18838 : How can we generate normalized random numbers ?
18839 echo " "
18840 echo "Looking for a random number function..." >&4
18841 case "$randfunc" in
18842 '')
18843         if set drand48 val -f; eval $csym; $val; then
18844                 dflt="drand48"
18845                 echo "Good, found drand48()." >&4
18846         elif set random val -f; eval $csym; $val; then
18847                 dflt="random"
18848                 echo "OK, found random()." >&4
18849         else
18850                 dflt="rand"
18851                 echo "Yick, looks like I have to use rand()." >&4
18852         fi
18853         echo " "
18854         ;;
18855 *)
18856         dflt="$randfunc"
18857         ;;
18858 esac
18859 cont=true
18860
18861 case "$ccflags" in
18862 *-Dmy_rand=*|*-Dmy_srand=*)
18863         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18864         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18865         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18866         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18867         ;;
18868 esac
18869
18870 while $test "$cont"; do
18871         rp="Use which function to generate random numbers?"
18872         . ./myread
18873         if $test "$ans" = "$dflt"; then
18874                 : null
18875         else
18876                 randbits=''
18877         fi
18878         randfunc="$ans"
18879         if set $ans val -f; eval $csym; $val; then
18880                 cont=''
18881         else
18882                 dflt=y
18883                 rp="I cannot find function $ans. Use that name anyway?"
18884                 . ./myread
18885                 dflt=rand
18886                 case "$ans" in
18887                         [yY]*) cont='';;
18888                 esac
18889         fi
18890         case "$cont" in
18891         '')
18892                 case "$randfunc" in
18893                 drand48)
18894                         drand01="drand48()"
18895                         seedfunc="srand48"
18896                         randbits=48
18897                         randseedtype=long
18898                         ;;
18899                 rand|random)
18900                         case "$randbits" in
18901                         '')
18902 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18903                                 $cat >try.c <<EOCP
18904 #$i_unistd I_UNISTD
18905 #$i_stdlib I_STDLIB
18906 #include <stdio.h>
18907 #ifdef I_UNISTD
18908 #  include <unistd.h>
18909 #endif
18910 #ifdef I_STDLIB
18911 #  include <stdlib.h>
18912 #endif
18913 int main()
18914 {
18915         register int i;
18916         register unsigned long tmp;
18917         register unsigned long max = 0L;
18918
18919         for (i = 1000; i; i--) {
18920                 tmp = (unsigned long) $randfunc();
18921                 if (tmp > max) max = tmp;
18922         }
18923         for (i = 0; max; i++)
18924                 max /= 2;
18925         printf("%d\n",i);
18926 }
18927 EOCP
18928                                 set try
18929                                 if eval $compile_ok; then
18930                                         dflt=`try`
18931                                 else
18932                                         dflt='?'
18933                                         echo "(I can't seem to compile the test program...)"
18934                                 fi
18935                                 ;;
18936                         *)
18937                                 dflt="$randbits"
18938                                 ;;
18939                         esac
18940                         rp="How many bits does your $randfunc() function produce?"
18941                         . ./myread
18942                         randbits="$ans"
18943                         $rm_try
18944                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18945                         seedfunc="s$randfunc"
18946                         randseedtype=unsigned
18947                         ;;
18948                 *)
18949                         dflt="31"
18950                         rp="How many bits does your $randfunc() function produce?"
18951                         . ./myread
18952                         randbits="$ans"
18953                         seedfunc="s$randfunc"
18954                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18955                         if set $seedfunc val -f; eval $csym; $val; then
18956                                 echo "(Using $seedfunc() to seed random generator)"
18957                         else
18958                                 echo "(Warning: no $seedfunc() to seed random generator)"
18959                                 seedfunc=rand
18960                         fi
18961                         randseedtype=unsigned
18962                         ;;
18963                 esac
18964                 ;;
18965         esac
18966 done
18967
18968 : Determine if this is an EBCDIC system
18969 echo " "
18970 echo "Determining whether or not we are on an EBCDIC system..." >&4
18971 $cat >try.c <<'EOM'
18972 int main()
18973 {
18974   if ('M'==0xd4) return 0;
18975   return 1;
18976 }
18977 EOM
18978
18979 val=$undef
18980 set try
18981 if eval $compile_ok; then
18982         if $run ./try; then
18983                 echo "You seem to speak EBCDIC." >&4
18984                 val="$define"
18985         else
18986                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18987         fi
18988 else
18989         echo "I'm unable to compile the test program." >&4
18990         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18991 fi
18992 $rm_try
18993 set ebcdic
18994 eval $setvar
18995
18996 : Check how to flush
18997 echo " "
18998 $cat >&4 <<EOM
18999 Checking how to flush all pending stdio output...
19000 EOM
19001 # I only know how to find the first 32 possibly open files on SunOS.
19002 # See also hints/sunos_4_1.sh and util.c  --AD
19003 case "$osname" in
19004 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19005 esac
19006 $cat >>try.c <<EOCP
19007 #include <stdio.h>
19008 #$i_stdlib I_STDLIB
19009 #ifdef I_STDLIB
19010 #include <stdlib.h>
19011 #endif
19012 #$i_unistd I_UNISTD
19013 #ifdef I_UNISTD
19014 # include <unistd.h>
19015 #endif
19016 #$d_sysconf HAS_SYSCONF
19017 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19018 #ifdef HAS_STDIO_STREAM_ARRAY
19019 # define STDIO_STREAM_ARRAY $stdio_stream_array
19020 #endif
19021 int main() {
19022   FILE* p;
19023   unlink("try.out");
19024   p = fopen("try.out", "w");
19025 #ifdef TRY_FPUTC
19026   fputc('x', p);
19027 #else
19028 # ifdef TRY_FPRINTF
19029   fprintf(p, "x");
19030 # endif
19031 #endif
19032 #ifdef TRY_FFLUSH_NULL
19033   fflush(NULL);
19034 #endif
19035 #ifdef TRY_FFLUSH_ALL
19036   {
19037     long open_max = -1;
19038 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19039     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19040 # else
19041 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19042     open_max = sysconf(_SC_OPEN_MAX);
19043 #  else
19044 #   ifdef FOPEN_MAX
19045     open_max = FOPEN_MAX;
19046 #   else
19047 #    ifdef OPEN_MAX
19048     open_max = OPEN_MAX;
19049 #    else
19050 #     ifdef _NFILE
19051     open_max = _NFILE;
19052 #     endif
19053 #    endif
19054 #   endif
19055 #  endif
19056 # endif
19057 # ifdef HAS_STDIO_STREAM_ARRAY
19058     if (open_max > 0) {
19059       long i;
19060       for (i = 0; i < open_max; i++)
19061             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19062                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19063                 STDIO_STREAM_ARRAY[i]._flag)
19064                 fflush(&STDIO_STREAM_ARRAY[i]);
19065     }
19066   }
19067 # endif
19068 #endif
19069   _exit(42);
19070 }
19071 EOCP
19072 : first we have to find out how _not_ to flush
19073 $to try.c
19074 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19075     output=''
19076     set try -DTRY_FPUTC
19077     if eval $compile; then
19078             $run ./try 2>/dev/null
19079             code="$?"
19080             $from try.out
19081             if $test ! -s try.out -a "X$code" = X42; then
19082                 output=-DTRY_FPUTC
19083             fi
19084     fi
19085     case "$output" in
19086     '')
19087             set try -DTRY_FPRINTF
19088             if eval $compile; then
19089                     $run ./try 2>/dev/null
19090                     code="$?"
19091                     $from try.out
19092                     if $test ! -s try.out -a "X$code" = X42; then
19093                         output=-DTRY_FPRINTF
19094                     fi
19095             fi
19096         ;;
19097     esac
19098 fi
19099 : check for fflush NULL behaviour
19100 case "$fflushNULL" in
19101 '')     set try -DTRY_FFLUSH_NULL $output
19102         if eval $compile; then
19103                 $run ./try 2>/dev/null
19104                 code="$?"
19105                 $from try.out
19106                 if $test -s try.out -a "X$code" = X42; then
19107                         fflushNULL="`$cat try.out`"
19108                 else
19109                         if $test "X$code" != X42; then
19110                                 $cat >&4 <<EOM
19111 (If this test failed, don't worry, we'll try another method shortly.)
19112 EOM
19113                         fi
19114                 fi
19115         fi
19116         $rm -f core try.core core.try.*
19117         case "$fflushNULL" in
19118         x)      $cat >&4 <<EOM
19119 Your fflush(NULL) works okay for output streams.
19120 Let's see if it clobbers input pipes...
19121 EOM
19122 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19123 # bug that improperly flushes the input end of pipes.  So we avoid the
19124 # autoflush on fork/system/exec support for now. :-(
19125 $cat >tryp.c <<EOCP
19126 #include <stdio.h>
19127 int
19128 main(int argc, char **argv)
19129 {
19130     char buf[1024];
19131     int i;
19132     char *bp = buf;
19133     while (1) {
19134         while ((i = getc(stdin)) != -1
19135                && (*bp++ = i) != '\n'
19136                && bp < &buf[1024])
19137         /* DO NOTHING */ ;
19138         *bp = '\0';
19139         fprintf(stdout, "%s", buf);
19140         fflush(NULL);
19141         if (i == -1)
19142             return 0;
19143         bp = buf;
19144     }
19145 }
19146 EOCP
19147                 fflushNULL="$define"
19148                 set tryp
19149                 if eval $compile; then
19150                     $rm -f tryp.out
19151                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19152                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19153                        $cat >&4 <<EOM
19154 fflush(NULL) seems to behave okay with input streams.
19155 EOM
19156                         fflushNULL="$define"
19157                     else
19158                         $cat >&4 <<EOM
19159 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19160 EOM
19161                         fflushNULL="$undef"
19162                     fi
19163                 fi
19164                 $rm -f core tryp.c tryp.core core.tryp.*
19165                 ;;
19166         '')     $cat >&4 <<EOM
19167 Your fflush(NULL) isn't working (contrary to ANSI C).
19168 EOM
19169                 fflushNULL="$undef"
19170                 ;;
19171         *)      $cat >&4 <<EOM
19172 Cannot figure out whether your fflush(NULL) works or not.
19173 I'm assuming it doesn't (contrary to ANSI C).
19174 EOM
19175                 fflushNULL="$undef"
19176                 ;;
19177         esac
19178         ;;
19179 $define|true|[yY]*)
19180         fflushNULL="$define"
19181         ;;
19182 *)
19183         fflushNULL="$undef"
19184         ;;
19185 esac
19186 : check explicit looping only if NULL did not work, and if the pipe
19187 : bug does not show up on an explicit flush too
19188 case "$fflushNULL" in
19189 "$undef")
19190         $cat >tryp.c <<EOCP
19191 #include <stdio.h>
19192 int
19193 main(int argc, char **argv)
19194 {
19195     char buf[1024];
19196     int i;
19197     char *bp = buf;
19198     while (1) {
19199         while ((i = getc(stdin)) != -1
19200                && (*bp++ = i) != '\n'
19201                && bp < &buf[1024])
19202         /* DO NOTHING */ ;
19203         *bp = '\0';
19204         fprintf(stdout, "%s", buf);
19205         fflush(stdin);
19206         if (i == -1)
19207             return 0;
19208         bp = buf;
19209     }
19210 }
19211 EOCP
19212         set tryp
19213         if eval $compile; then
19214             $rm -f tryp.out
19215             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19216             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19217                $cat >&4 <<EOM
19218 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19219 EOM
19220                 : now check for fflushall behaviour
19221                 case "$fflushall" in
19222                 '')     set try -DTRY_FFLUSH_ALL $output
19223                         if eval $compile; then
19224                                 $cat >&4 <<EOM
19225 (Now testing the other method--but note that this also may fail.)
19226 EOM
19227                                 $run ./try 2>/dev/null
19228                                 code=$?
19229                                 $from try.out
19230                                 if $test -s try.out -a "X$code" = X42; then
19231                                         fflushall="`$cat try.out`"
19232                                 fi
19233                         fi
19234                         $rm_try
19235                         case "$fflushall" in
19236                         x)      $cat >&4 <<EOM
19237 Whew. Flushing explicitly all the stdio streams works.
19238 EOM
19239                                 fflushall="$define"
19240                                 ;;
19241                         '')     $cat >&4 <<EOM
19242 Sigh. Flushing explicitly all the stdio streams doesn't work.
19243 EOM
19244                                 fflushall="$undef"
19245                                 ;;
19246                         *)      $cat >&4 <<EOM
19247 Cannot figure out whether flushing stdio streams explicitly works or not.
19248 I'm assuming it doesn't.
19249 EOM
19250                                 fflushall="$undef"
19251                                 ;;
19252                         esac
19253                         ;;
19254                 "$define"|true|[yY]*)
19255                         fflushall="$define"
19256                         ;;
19257                 *)
19258                         fflushall="$undef"
19259                         ;;
19260                 esac
19261             else
19262                 $cat >&4 <<EOM
19263 All is futile.  Even fflush(stdin) clobbers input pipes!
19264 EOM
19265                 fflushall="$undef"
19266             fi
19267         else
19268             fflushall="$undef"
19269         fi
19270         $rm -f core tryp.c tryp.core core.tryp.*
19271         ;;
19272 *)      fflushall="$undef"
19273         ;;
19274 esac
19275
19276 case "$fflushNULL$fflushall" in
19277 undefundef)
19278         $cat <<EOM
19279 OK, I give up.  I cannot figure out how to flush pending stdio output.
19280 We won't be flushing handles at all before fork/exec/popen.
19281 EOM
19282         ;;
19283 esac
19284 $rm_try tryp
19285
19286 : Store the full pathname to the ar program for use in the C program
19287 : Respect a hint or command line value for full_ar.
19288 case "$full_ar" in
19289 '') full_ar=$ar ;;
19290 esac
19291
19292 : Store the full pathname to the sed program for use in the C program
19293 full_sed=$sed
19294
19295 : see what type gids are declared as in the kernel
19296 echo " "
19297 echo "Looking for the type for group ids returned by getgid()."
19298 set gid_t gidtype xxx stdio.h sys/types.h
19299 eval $typedef
19300 case "$gidtype" in
19301 xxx)
19302         xxx=`./findhdr sys/user.h`
19303         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19304         case $1 in
19305         unsigned) dflt="$1 $2" ;;
19306         *) dflt="$1" ;;
19307         esac
19308         ;;
19309 *) dflt="$gidtype";;
19310 esac
19311 case "$gidtype" in
19312 gid_t) echo "gid_t found." ;;
19313 *)      rp="What is the type for group ids returned by getgid()?"
19314         . ./myread
19315         gidtype="$ans"
19316         ;;
19317 esac
19318
19319 : Check the size of GID
19320 echo " "
19321 case "$gidtype" in
19322 *_t) zzz="$gidtype"     ;;
19323 *)   zzz="gid"          ;;
19324 esac
19325 echo "Checking the size of $zzz..." >&4
19326 cat > try.c <<EOCP
19327 #include <sys/types.h>
19328 #include <stdio.h>
19329 #$i_stdlib I_STDLIB
19330 #ifdef I_STDLIB
19331 #include <stdlib.h>
19332 #endif
19333 int main() {
19334     printf("%d\n", (int)sizeof($gidtype));
19335     exit(0);
19336 }
19337 EOCP
19338 set try
19339 if eval $compile_ok; then
19340         yyy=`$run ./try`
19341         case "$yyy" in
19342         '')     gidsize=4
19343                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19344                 ;;
19345         *)      gidsize=$yyy
19346                 echo "Your $zzz is $gidsize bytes long."
19347                 ;;
19348         esac
19349 else
19350         gidsize=4
19351         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19352 fi
19353
19354
19355 : Check if GID is signed
19356 echo " "
19357 case "$gidtype" in
19358 *_t) zzz="$gidtype"     ;;
19359 *)   zzz="gid"          ;;
19360 esac
19361 echo "Checking the sign of $zzz..." >&4
19362 cat > try.c <<EOCP
19363 #include <sys/types.h>
19364 #include <stdio.h>
19365 int main() {
19366         $gidtype foo = -1;
19367         if (foo < 0)
19368                 printf("-1\n");
19369         else
19370                 printf("1\n");
19371 }
19372 EOCP
19373 set try
19374 if eval $compile; then
19375         yyy=`$run ./try`
19376         case "$yyy" in
19377         '')     gidsign=1
19378                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19379                 ;;
19380         *)      gidsign=$yyy
19381                 case "$gidsign" in
19382                  1) echo "Your $zzz is unsigned." ;;
19383                 -1) echo "Your $zzz is signed."   ;;
19384                 esac
19385                 ;;
19386         esac
19387 else
19388         gidsign=1
19389         echo "(I can't compile the test program--guessing unsigned.)" >&4
19390 fi
19391
19392
19393 : Check 64bit sizes
19394 echo " "
19395
19396 if $test X"$quadtype" != X; then
19397
19398 echo "Checking how to print 64-bit integers..." >&4
19399
19400 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19401         $cat >try.c <<'EOCP'
19402 #include <sys/types.h>
19403 #include <stdio.h>
19404 int main() {
19405   int q = 12345678901;
19406   printf("%ld\n", q);
19407 }
19408 EOCP
19409         set try
19410         if eval $compile; then
19411                 yyy=`$run ./try`
19412                 case "$yyy" in
19413                 12345678901)
19414                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19415                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19416                         echo "We will use %d."
19417                         ;;
19418                 esac
19419         fi
19420 fi
19421
19422 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19423         $cat >try.c <<'EOCP'
19424 #include <sys/types.h>
19425 #include <stdio.h>
19426 int main() {
19427   long q = 12345678901;
19428   printf("%ld\n", q);
19429 }
19430 EOCP
19431         set try
19432         if eval $compile; then
19433                 yyy=`$run ./try`
19434                 case "$yyy" in
19435                 12345678901)
19436                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19437                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19438                         echo "We will use %ld."
19439                         ;;
19440                 esac
19441         fi
19442 fi
19443
19444 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19445         $cat >try.c <<'EOCP'
19446 #include <sys/types.h>
19447 #include <inttypes.h>
19448 #include <stdio.h>
19449 int main() {
19450   int64_t q = 12345678901;
19451   printf("%" PRId64 "\n", q);
19452 }
19453 EOCP
19454         set try
19455         if eval $compile; then
19456                 yyy=`$run ./try`
19457                 case "$yyy" in
19458                 12345678901)
19459                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19460                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19461                         echo "We will use the C9X style."
19462                         ;;
19463                 esac
19464         fi
19465 fi
19466
19467 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19468         $cat >try.c <<EOCP
19469 #include <sys/types.h>
19470 #include <stdio.h>
19471 int main() {
19472   $quadtype q = 12345678901;
19473   printf("%Ld\n", q);
19474 }
19475 EOCP
19476         set try
19477         if eval $compile; then
19478                 yyy=`$run ./try`
19479                 case "$yyy" in
19480                 12345678901)
19481                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19482                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19483                         echo "We will use %Ld."
19484                         ;;
19485                 esac
19486         fi
19487 fi
19488
19489 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19490         $cat >try.c <<'EOCP'
19491 #include <sys/types.h>
19492 #include <stdio.h>
19493 int main() {
19494   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19495   printf("%lld\n", q);
19496 }
19497 EOCP
19498         set try
19499         if eval $compile; then
19500                 yyy=`$run ./try`
19501                 case "$yyy" in
19502                 12345678901)
19503                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19504                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19505                         echo "We will use the %lld style."
19506                         ;;
19507                 esac
19508         fi
19509 fi
19510
19511 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19512         $cat >try.c <<EOCP
19513 #include <sys/types.h>
19514 #include <stdio.h>
19515 int main() {
19516   $quadtype q = 12345678901;
19517   printf("%qd\n", q);
19518 }
19519 EOCP
19520         set try
19521         if eval $compile; then
19522                 yyy=`$run ./try`
19523                 case "$yyy" in
19524                 12345678901)
19525                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19526                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19527                         echo "We will use %qd."
19528                         ;;
19529                 esac
19530         fi
19531 fi
19532
19533 if $test X"$sPRId64" = X; then
19534         echo "Cannot figure out how to print 64-bit integers." >&4
19535 fi
19536 $rm_try
19537
19538 fi
19539
19540 case "$sPRId64" in
19541 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19542         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19543         ;;
19544 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19545         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19546         ;;
19547 esac
19548
19549 : Check format strings for internal types
19550 echo " "
19551 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19552
19553 if $test X"$ivsize" = X8; then
19554         ivdformat="$sPRId64"
19555         uvuformat="$sPRIu64"
19556         uvoformat="$sPRIo64"
19557         uvxformat="$sPRIx64"
19558         uvXUformat="$sPRIXU64"
19559 else
19560         if $test X"$ivsize" = X"$longsize"; then
19561                 ivdformat='"ld"'
19562                 uvuformat='"lu"'
19563                 uvoformat='"lo"'
19564                 uvxformat='"lx"'
19565                 uvXUformat='"lX"'
19566         else
19567                 if $test X"$ivsize" = X"$intsize"; then
19568                         ivdformat='"d"'
19569                         uvuformat='"u"'
19570                         uvoformat='"o"'
19571                         uvxformat='"x"'
19572                         uvXUformat='"X"'
19573                 else
19574                         : far out
19575                         if $test X"$ivsize" = X"$shortsize"; then
19576                                 ivdformat='"hd"'
19577                                 uvuformat='"hu"'
19578                                 uvoformat='"ho"'
19579                                 uvxformat='"hx"'
19580                                 uvXUformat='"hX"'
19581                         fi
19582                 fi
19583         fi
19584 fi
19585
19586 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19587         nveformat="$sPRIeldbl"
19588         nvfformat="$sPRIfldbl"
19589         nvgformat="$sPRIgldbl"
19590         nvEUformat="$sPRIEUldbl"
19591         nvFUformat="$sPRIFUldbl"
19592         nvGUformat="$sPRIGUldbl"
19593 else
19594         nveformat='"e"'
19595         nvfformat='"f"'
19596         nvgformat='"g"'
19597         nvEUformat='"E"'
19598         nvFUformat='"F"'
19599         nvGUformat='"G"'
19600 fi
19601
19602 case "$ivdformat" in
19603 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19604     exit 1
19605     ;;
19606 esac
19607
19608 : Check format string for GID
19609
19610 echo " "
19611 $echo "Checking the format string to be used for gids..." >&4
19612
19613 case "$gidsign" in
19614 -1)     if $test X"$gidsize" = X"$ivsize"; then
19615                 gidformat="$ivdformat"
19616         else
19617                 if $test X"$gidsize" = X"$longsize"; then
19618                         gidformat='"ld"'
19619                 else
19620                         if $test X"$gidsize" = X"$intsize"; then
19621                                 gidformat='"d"'
19622                         else
19623                                 if $test X"$gidsize" = X"$shortsize"; then
19624                                         gidformat='"hd"'
19625                                 fi
19626                         fi
19627                 fi
19628         fi
19629         ;;
19630 *)      if $test X"$gidsize" = X"$uvsize"; then
19631                 gidformat="$uvuformat"
19632         else
19633                 if $test X"$gidsize" = X"$longsize"; then
19634                         gidformat='"lu"'
19635                 else
19636                         if $test X"$gidsize" = X"$intsize"; then
19637                                 gidformat='"u"'
19638                         else
19639                                 if $test X"$gidsize" = X"$shortsize"; then
19640                                         gidformat='"hu"'
19641                                 fi
19642                         fi
19643                 fi
19644         fi
19645         ;;
19646 esac
19647
19648 : see if getgroups exists
19649 set getgroups d_getgrps
19650 eval $inlibc
19651
19652 : see if setgroups exists
19653 set setgroups d_setgrps
19654 eval $inlibc
19655
19656 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19657 echo " "
19658 case "$d_getgrps$d_setgrps" in
19659 *define*)
19660         case "$groupstype" in
19661         '') dflt="$gidtype" ;;
19662         *)  dflt="$groupstype" ;;
19663         esac
19664         $cat <<EOM
19665 What type of pointer is the second argument to getgroups() and setgroups()?
19666 Usually this is the same as group ids, $gidtype, but not always.
19667
19668 EOM
19669         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19670         . ./myread
19671         groupstype="$ans"
19672         ;;
19673 *)  groupstype="$gidtype";;
19674 esac
19675
19676 : MAD = Misc Attribute Definition
19677
19678 if $test $patchlevel -lt 9; then
19679 : MAD is not available in 5.8.x or earlier.
19680     ans=n;
19681 else
19682     case "$mad" in
19683     $define|true|[yY]*) dflt='y' ;;
19684     *)                  dflt='n' ;;
19685     esac
19686     cat <<EOM
19687
19688 Would you like to build with Misc Attribute Decoration? This is development
19689 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19690 overhead on the interpreter.
19691
19692 If this doesn't make any sense to you, just accept the default '$dflt'.
19693 EOM
19694     rp='Build Perl with MAD?'
19695     . ./myread
19696 fi
19697 case "$ans" in
19698 y|Y)    val="$define"
19699         madlyh='madly.h madly.act madly.tab'
19700         madlysrc='madly.c'
19701         madlyobj="madly$_o" ;;
19702 *)      val="$undef"
19703         madlyh=''
19704         madlysrc=''
19705         madlyobj='' ;;
19706 esac
19707 set mad
19708 eval $setvar
19709
19710 : check whether make sets MAKE
19711 echo " "
19712 echo "Checking if your $make program sets \$(MAKE)..." >&4
19713 case "$make_set_make" in
19714 '')
19715         $sed 's/^X //' > testmake.mak << 'EOF'
19716 Xall:
19717 X       @echo 'maketemp="$(MAKE)"'
19718 EOF
19719         case "`$make -f testmake.mak 2>/dev/null`" in
19720         *maketemp=*) make_set_make='#' ;;
19721         *)      make_set_make="MAKE=$make" ;;
19722         esac
19723         $rm -f testmake.mak
19724         ;;
19725 esac
19726 case "$make_set_make" in
19727 '#') echo "Yup, it does.";;
19728 *) echo "Nope, it doesn't.";;
19729 esac
19730
19731 : see what type is used for mode_t
19732 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19733 set mode_t modetype int stdio.h sys/types.h
19734 eval $typedef_ask
19735
19736 : see if we need va_copy
19737 echo " "
19738 case "$i_stdarg" in
19739 "$define")
19740         $cat >try.c <<EOCP
19741 #include <stdarg.h>
19742 #include <stdio.h>
19743 #$i_stdlib I_STDLIB
19744 #ifdef I_STDLIB
19745 #include <stdlib.h>
19746 #endif
19747 #include <signal.h>
19748
19749 int
19750 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19751 {
19752   return vfprintf(f, fmt, *valp);
19753 }
19754
19755 int
19756 myvfprintf(FILE *f, const  char *fmt, va_list val)
19757 {
19758   return ivfprintf(f, fmt, &val);
19759 }
19760
19761 int
19762 myprintf(char *fmt, ...)
19763 {
19764   va_list val;
19765   va_start(val, fmt);
19766   return myvfprintf(stdout, fmt, val);
19767 }
19768
19769 int
19770 main(int ac, char **av)
19771 {
19772   signal(SIGSEGV, exit);
19773
19774   myprintf("%s%cs all right, then\n", "that", '\'');
19775   exit(0);
19776 }
19777 EOCP
19778         set try
19779         if eval $compile && $run ./try 2>&1 >/dev/null; then
19780                 case "`$run ./try`" in
19781                 "that's all right, then")
19782                         okay=yes
19783                         ;;
19784                 esac
19785         fi
19786         case "$okay" in
19787         yes)    echo "It seems that you don't need va_copy()." >&4
19788                 need_va_copy="$undef"
19789                 ;;
19790         *)      echo "It seems that va_copy() or similar will be needed." >&4
19791                 need_va_copy="$define"
19792                 ;;
19793         esac
19794         $rm_try
19795         ;;
19796 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19797         ;;
19798 esac
19799
19800 : see what type is used for size_t
19801 rp="What is the type used for the length parameter for string functions?"
19802 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19803 eval $typedef_ask
19804
19805 : check for type of arguments to gethostbyaddr. 
19806 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19807         case "$d_gethbyaddr" in
19808         $define)
19809                 $cat <<EOM
19810
19811 Checking to see what type of arguments are accepted by gethostbyaddr().
19812 EOM
19813                 hdrs="$define sys/types.h
19814                         $d_socket sys/socket.h 
19815                         $i_niin netinet/in.h 
19816                         $i_netdb netdb.h
19817                         $i_unistd unistd.h"
19818                 : The first arg can 'char *' or 'void *'
19819                 : The second arg is some of integral type
19820                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19821                         for yyy in size_t long int; do
19822                                 case "$netdb_host_type" in
19823                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19824                                         if ./protochk "$try" $hdrs; then
19825                                                 echo "Your system accepts $xxx for the first arg."
19826                                                 echo "...and $yyy for the second arg."
19827                                                 netdb_host_type="$xxx"
19828                                                 netdb_hlen_type="$yyy"
19829                                         fi
19830                                         ;;
19831                                 esac
19832                         done
19833                 done
19834                 : In case none of those worked, prompt the user.
19835                 case "$netdb_host_type" in
19836                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19837                         dflt='char *'
19838                         . ./myread
19839                         netdb_host_type=$ans
19840                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19841                         dflt="$sizetype"
19842                         . ./myread
19843                         netdb_hlen_type=$ans
19844                         ;;
19845                 esac
19846                 ;;
19847         *)      : no gethostbyaddr, so pick harmless defaults
19848                 netdb_host_type='char *'
19849                 netdb_hlen_type="$sizetype"
19850                 ;;
19851         esac
19852         # Remove the "const" if needed. -- but then we'll have a 
19853         # prototype clash!
19854         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19855 fi
19856
19857 : check for type of argument to gethostbyname. 
19858 if test "X$netdb_name_type" = X ; then
19859         case "$d_gethbyname" in
19860         $define)
19861                 $cat <<EOM
19862
19863 Checking to see what type of argument is accepted by gethostbyname().
19864 EOM
19865                 hdrs="$define sys/types.h
19866                         $d_socket sys/socket.h 
19867                         $i_niin netinet/in.h 
19868                         $i_netdb netdb.h
19869                         $i_unistd unistd.h"
19870                 for xxx in "const char *" "char *"; do
19871                         case "$netdb_name_type" in
19872                         '')     try="extern struct hostent *gethostbyname($xxx);"
19873                                 if ./protochk "$try" $hdrs; then
19874                                         echo "Your system accepts $xxx."
19875                                         netdb_name_type="$xxx"
19876                                 fi
19877                                 ;;
19878                         esac
19879                 done
19880                 : In case none of those worked, prompt the user.
19881                 case "$netdb_name_type" in
19882                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19883                         dflt='char *'
19884                         . ./myread
19885                         netdb_name_type=$ans
19886                         ;;
19887                 esac
19888                 ;;
19889         *)      : no gethostbyname, so pick harmless default
19890                 netdb_name_type='char *'
19891                 ;;
19892         esac
19893 fi
19894
19895 : check for type of 1st argument to getnetbyaddr. 
19896 if test "X$netdb_net_type" = X ; then
19897         case "$d_getnbyaddr" in
19898         $define)
19899                 $cat <<EOM
19900
19901 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19902 EOM
19903                 hdrs="$define sys/types.h
19904                         $d_socket sys/socket.h 
19905                         $i_niin netinet/in.h 
19906                         $i_netdb netdb.h
19907                         $i_unistd unistd.h"
19908                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19909                         case "$netdb_net_type" in
19910                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19911                                 if ./protochk "$try" $hdrs; then
19912                                         echo "Your system accepts $xxx."
19913                                         netdb_net_type="$xxx"
19914                                 fi
19915                                 ;;
19916                         esac
19917                 done
19918                 : In case none of those worked, prompt the user.
19919                 case "$netdb_net_type" in
19920                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19921                         dflt='long'
19922                         . ./myread
19923                         netdb_net_type=$ans
19924                         ;;
19925                 esac
19926                 ;;
19927         *)      : no getnetbyaddr, so pick harmless default
19928                 netdb_net_type='long'
19929                 ;;
19930         esac
19931 fi
19932 : locate the preferred pager for this system
19933 fn=f/
19934 case "$pager" in
19935 '')
19936         dflt=''
19937         case "$pg" in
19938         /*) dflt=$pg;;
19939         [a-zA-Z]:/*) dflt=$pg;;
19940         esac
19941         case "$more" in
19942         /*) dflt=$more;;
19943         [a-zA-Z]:/*) dflt=$more;;
19944         esac
19945         case "$less" in
19946         /*) dflt=$less;;
19947         [a-zA-Z]:/*) dflt=$less;;
19948         esac
19949         case "$dflt" in
19950         '') dflt=/usr/ucb/more;;
19951         esac
19952         ;;
19953 *)      dflt="$pager"
19954         fn="f/($pager)"
19955         ;;
19956 esac
19957 echo " "
19958 rp='What pager is used on your system?'
19959 . ./getfile
19960 pager="$ans"
19961
19962 : see what type pids are declared as in the kernel
19963 rp="What is the type of process ids on this system?"
19964 set pid_t pidtype int stdio.h sys/types.h
19965 eval $typedef_ask
19966
19967 : see if ar generates random libraries by itself
19968 echo " "
19969 echo "Checking how to generate random libraries on your machine..." >&4
19970 echo 'int bar1() { return bar2(); }' > bar1.c
19971 echo 'int bar2() { return 2; }' > bar2.c
19972 $cat > foo.c <<EOP
19973 #$i_stdlib I_STDLIB
19974 #ifdef I_STDLIB
19975 #include <stdlib.h>
19976 #endif
19977 int main() { printf("%d\n", bar1()); exit(0); }
19978 EOP
19979 $cc $ccflags -c bar1.c >/dev/null 2>&1
19980 $cc $ccflags -c bar2.c >/dev/null 2>&1
19981 $cc $ccflags -c foo.c >/dev/null 2>&1
19982 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19983 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19984         $run ./foobar >/dev/null 2>&1; then
19985         echo "$ar appears to generate random libraries itself."
19986         orderlib=false
19987         if [ "X$ranlib" = "X" ]; then
19988             ranlib=":"
19989         fi
19990 elif $ar s bar$_a >/dev/null 2>&1 &&
19991         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19992         $run ./foobar >/dev/null 2>&1; then
19993                 echo "a table of contents needs to be added with '$ar s'."
19994                 orderlib=false
19995                 ranlib="$ar s"
19996 elif $ar ts bar$_a >/dev/null 2>&1 &&
19997         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19998         $run ./foobar >/dev/null 2>&1; then
19999                 echo "a table of contents needs to be added with '$ar ts'."
20000                 orderlib=false
20001                 ranlib="$ar ts"
20002 else
20003         case "$ranlib" in
20004         :) ranlib='';;
20005         '')
20006                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20007                 $test -f $ranlib || ranlib=''
20008                 ;;
20009         esac
20010         if $test -n "$ranlib"; then
20011                 echo "your system has '$ranlib'; we'll use that."
20012                 orderlib=false
20013         else
20014                 echo "your system doesn't seem to support random libraries"
20015                 echo "so we'll use lorder and tsort to order the libraries."
20016                 orderlib=true
20017                 ranlib=":"
20018         fi
20019 fi
20020 $rm -f foo* bar*
20021
20022 : see if this is a values.h system
20023 set values.h i_values
20024 eval $inhdr
20025
20026 : Check the max offset that gmtime and localtime accept
20027 echo "Checking max offsets that gmtime () accepts"
20028
20029 case $i_values in
20030     define) yyy="#include <values.h>" ;;
20031     *)      yyy="" ;;
20032     esac
20033
20034 $cat >try.c <<EOCP
20035 #include <sys/types.h>
20036 #include <stdio.h>
20037 #include <time.h>
20038 $yyy
20039
20040 int i;
20041 struct tm *tmp;
20042 time_t pt;
20043
20044 void gm_check (time_t t)
20045 {
20046     tmp = gmtime (&t);
20047     if (tmp == NULL || tmp->tm_year < -1900)
20048         tmp = NULL;
20049     else
20050         pt = t;
20051     } /* gm_check */
20052
20053 int check_max ()
20054 {
20055     tmp = NULL;
20056     pt  = 0;
20057 #ifdef MAXLONG
20058     gm_check (MAXLONG);
20059 #endif
20060     if (tmp == NULL || tmp->tm_year < 0) {
20061         for (i = 63; i >= 0; i--) {
20062             time_t x = pt | ((time_t)1 << i);
20063             if (x < 0) continue;
20064             gm_check (x);
20065             }
20066         }
20067     printf ("sGMTIME_max=%ld\n", pt);
20068     return (0);
20069   } /* check_max */
20070
20071 int check_min ()
20072 {
20073     tmp = NULL;
20074     pt  = 0;
20075 #ifdef MINLONG
20076     gm_check (MINLONG);
20077 #endif
20078     if (tmp == NULL) {
20079         for (i = 36; i >= 0; i--) {
20080             time_t x = pt - ((time_t)1 << i);
20081             if (x > 0) continue;
20082             gm_check (x);
20083             }
20084         }
20085     printf ("sGMTIME_min=%ld\n", pt);
20086     return (0);
20087     } /* check_min */
20088
20089 int main (int argc, char *argv[])
20090 {
20091     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20092     check_max ();
20093     check_min ();
20094     return (0);
20095     } /* main */
20096 EOCP
20097 set try
20098 if eval $compile; then
20099     eval `$run ./try`
20100 else
20101     echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20102     fi
20103 $rm_try
20104
20105 echo "Checking max offsets that localtime () accepts"
20106
20107 $cat >try.c <<EOCP
20108 #include <sys/types.h>
20109 #include <stdio.h>
20110 #include <time.h>
20111 $yyy
20112
20113 int i;
20114 struct tm *tmp;
20115 time_t pt;
20116
20117 void local_check (time_t t)
20118 {
20119     tmp = localtime (&t);
20120     if (tmp == NULL || tmp->tm_year < -1900)
20121         tmp = NULL;
20122     else
20123         pt = t;
20124     } /* local_check */
20125
20126 int check_max ()
20127 {
20128     tmp = NULL;
20129     pt  = 0;
20130 #ifdef MAXLONG
20131     local_check (MAXLONG);
20132 #endif
20133     if (tmp == NULL || tmp->tm_year < 0) {
20134         for (i = 63; i >= 0; i--) {
20135             time_t x = pt | ((time_t)1 << i);
20136             if (x < 0) continue;
20137             local_check (x);
20138             }
20139         }
20140     printf ("sLOCALTIME_max=%ld\n", pt);
20141     return (0);
20142   } /* check_max */
20143
20144 int check_min ()
20145 {
20146     tmp = NULL;
20147     pt  = 0;
20148 #ifdef MINLONG
20149     local_check (MINLONG);
20150 #endif
20151     if (tmp == NULL) {
20152         for (i = 36; i >= 0; i--) {
20153             time_t x = pt - ((time_t)1 << i);
20154             if (x > 0) continue;
20155             local_check (x);
20156             }
20157         }
20158     printf ("sLOCALTIME_min=%ld\n", pt);
20159     return (0);
20160     } /* check_min */
20161
20162 int main (int argc, char *argv[])
20163 {
20164     check_max ();
20165     check_min ();
20166     return (0);
20167     } /* main */
20168 EOCP
20169 set try
20170 if eval $compile; then
20171     eval `$run ./try`
20172 else
20173     echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20174     fi
20175 $rm_try
20176
20177 : check for type of arguments to select.
20178 case "$selecttype" in
20179 '') case "$d_select" in
20180         $define)
20181                 echo " "
20182                 $cat <<EOM
20183 Checking to see what type of arguments are accepted by select().
20184 EOM
20185                 hdrs="$define sys/types.h
20186                         $i_systime sys/time.h
20187                         $i_sysselct sys/select.h
20188                         $d_socket sys/socket.h"
20189                 : The first arg can be int, unsigned, or size_t
20190                 : The last arg may or may not be 'const'
20191                 val=''
20192                 : void pointer has been seen but using that
20193                 : breaks the selectminbits test
20194                 for xxx in 'fd_set *' 'int *'; do
20195                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20196                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20197                                         case "$val" in
20198                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20199                                                 if ./protochk "$try" $hdrs; then
20200                                                         echo "Your system accepts $xxx."
20201                                                         val="$xxx"
20202                                                 fi
20203                                                 ;;
20204                                         esac
20205                                 done
20206                         done
20207                 done
20208                 case "$val" in
20209                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20210                         case "$d_fd_set" in
20211                                 $define) dflt="fd_set *" ;;
20212                                 *)              dflt="int *" ;;
20213                         esac
20214                         . ./myread
20215                         val=$ans
20216                         ;;
20217                 esac
20218                 selecttype="$val"
20219                 ;;
20220         *)      : no select, so pick a harmless default
20221                 selecttype='int *'
20222                 ;;
20223         esac
20224         ;;
20225 esac
20226
20227 : check for the select 'width'
20228 case "$selectminbits" in
20229 '') safebits=`expr $ptrsize \* 8`
20230     case "$d_select" in
20231         $define)
20232                 $cat <<EOM
20233
20234 Checking to see on how many bits at a time your select() operates...
20235 EOM
20236                 $cat >try.c <<EOCP
20237 #include <sys/types.h>
20238 #$i_time I_TIME
20239 #$i_systime I_SYS_TIME
20240 #$i_systimek I_SYS_TIME_KERNEL
20241 #ifdef I_TIME
20242 #   include <time.h>
20243 #endif
20244 #ifdef I_SYS_TIME
20245 #   ifdef I_SYS_TIME_KERNEL
20246 #       define KERNEL
20247 #   endif
20248 #   include <sys/time.h>
20249 #   ifdef I_SYS_TIME_KERNEL
20250 #       undef KERNEL
20251 #   endif
20252 #endif
20253 #$i_sysselct I_SYS_SELECT
20254 #ifdef I_SYS_SELECT
20255 #include <sys/select.h>
20256 #endif
20257 #$d_socket HAS_SOCKET
20258 #ifdef HAS_SOCKET
20259 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20260 #endif
20261 #include <stdio.h>
20262 #$i_stdlib I_STDLIB
20263 #ifdef I_STDLIB
20264 #include <stdlib.h>
20265 #endif
20266 $selecttype b;
20267 #define S sizeof(*(b))
20268 #define MINBITS 64
20269 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20270 #define NBITS  (NBYTES * 8)
20271 int main() {
20272     char *s = (char *)malloc(NBYTES);
20273     struct timeval t;
20274     int i;
20275     FILE* fp;
20276     int fd;
20277
20278     if (!s)
20279         exit(1);
20280     fclose(stdin);
20281     fp = fopen("try.c", "r");
20282     if (fp == 0)
20283       exit(2);
20284     fd = fileno(fp);
20285     if (fd < 0)
20286       exit(3);
20287     b = ($selecttype)s;
20288     for (i = 0; i < NBITS; i++)
20289         FD_SET(i, b);
20290     t.tv_sec  = 0;
20291     t.tv_usec = 0;
20292     select(fd + 1, b, 0, 0, &t);
20293     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20294     free(s);
20295     printf("%d\n", i + 1);
20296     return 0;
20297 }
20298 EOCP
20299                 set try
20300                 if eval $compile_ok; then
20301                         selectminbits=`$run ./try`
20302                         case "$selectminbits" in
20303                         '')     cat >&4 <<EOM
20304 Cannot figure out on how many bits at a time your select() operates.
20305 I'll play safe and guess it is $safebits bits.
20306 EOM
20307                                 selectminbits=$safebits
20308                                 bits="$safebits bits"
20309                                 ;;
20310                         1)      bits="1 bit" ;;
20311                         *)      bits="$selectminbits bits" ;;
20312                         esac
20313                         echo "Your select() operates on $bits at a time." >&4
20314                 else
20315                         rp='What is the minimum number of bits your select() operates on?'
20316                         case "$byteorder" in
20317                         12345678)       dflt=64 ;;
20318                         1234)           dflt=32 ;;
20319                         *)              dflt=1  ;;
20320                         esac
20321                         . ./myread
20322                         val=$ans
20323                         selectminbits="$val"
20324                 fi
20325                 $rm_try
20326                 ;;
20327         *)      : no select, so pick a harmless default
20328                 selectminbits=$safebits
20329                 ;;
20330         esac
20331         ;;
20332 esac
20333
20334 : Trace out the files included by signal.h, then look for SIGxxx names.
20335 if [ "X$fieldn" = X ]; then
20336         : Just make some guesses.  We check them later.
20337         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20338 else
20339         xxx=`echo '#include <signal.h>' |
20340         $cppstdin $cppminus $cppflags 2>/dev/null |
20341         $grep '^[       ]*#.*include' |
20342         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20343                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20344 fi
20345 xxxfiles=''
20346 for xx in $xxx /dev/null ; do
20347         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20348 done
20349 case "$xxxfiles" in
20350 '')     xxxfiles=`./findhdr signal.h` ;;
20351 esac
20352 xxx=`awk '
20353 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20354         print substr($2, 4, 20)
20355 }
20356 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20357         print substr($3, 4, 20)
20358 }' $xxxfiles`
20359 : Append some common names just in case the awk scan failed.
20360 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20361 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20362 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20363 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20364 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20365
20366 : generate a few handy files for later
20367 $cat > signal.c <<EOCP
20368 #include <sys/types.h>
20369 #include <signal.h>
20370 #$i_stdlib I_STDLIB
20371 #ifdef I_STDLIB
20372 #include <stdlib.h>
20373 #endif
20374 #include <stdio.h>
20375 int main() {
20376
20377 /* Strange style to avoid deeply-nested #if/#else/#endif */
20378 #ifndef NSIG
20379 #  ifdef _NSIG
20380 #    define NSIG (_NSIG)
20381 #  endif
20382 #endif
20383
20384 #ifndef NSIG
20385 #  ifdef SIGMAX
20386 #    define NSIG (SIGMAX+1)
20387 #  endif
20388 #endif
20389
20390 #ifndef NSIG
20391 #  ifdef SIG_MAX
20392 #    define NSIG (SIG_MAX+1)
20393 #  endif
20394 #endif
20395
20396 #ifndef NSIG
20397 #  ifdef _SIG_MAX
20398 #    define NSIG (_SIG_MAX+1)
20399 #  endif
20400 #endif
20401
20402 #ifndef NSIG
20403 #  ifdef MAXSIG
20404 #    define NSIG (MAXSIG+1)
20405 #  endif
20406 #endif
20407
20408 #ifndef NSIG
20409 #  ifdef MAX_SIG
20410 #    define NSIG (MAX_SIG+1)
20411 #  endif
20412 #endif
20413
20414 #ifndef NSIG
20415 #  ifdef SIGARRAYSIZE
20416 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20417 #  endif
20418 #endif
20419
20420 #ifndef NSIG
20421 #  ifdef _sys_nsig
20422 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20423 #  endif
20424 #endif
20425
20426 /* Default to some arbitrary number that's big enough to get most
20427    of the common signals.
20428 */
20429 #ifndef NSIG
20430 #    define NSIG 50
20431 #endif
20432
20433 printf("NSIG %d\n", NSIG);
20434
20435 #ifndef JUST_NSIG
20436
20437 EOCP
20438
20439 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20440 {
20441         printf "#ifdef SIG"; printf $1; printf "\n"
20442         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20443         printf $1; printf ");\n"
20444         printf "#endif\n"
20445 }
20446 END {
20447         printf "#endif /* JUST_NSIG */\n";
20448         printf "exit(0);\n}\n";
20449 }
20450 ' >>signal.c
20451 $cat >signal.awk <<'EOP'
20452 BEGIN { ndups = 0 }
20453 $1 ~ /^NSIG$/ { nsig = $2 }
20454 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20455     if ($2 > maxsig) { maxsig = $2 }
20456     if (sig_name[$2]) {
20457         dup_name[ndups] = $1
20458         dup_num[ndups] = $2
20459         ndups++
20460     }
20461     else {
20462         sig_name[$2] = $1
20463         sig_num[$2] = $2
20464     }
20465 }
20466 END {
20467     if (nsig == 0) {
20468         nsig = maxsig + 1
20469     }
20470     printf("NSIG %d\n", nsig);
20471     for (n = 1; n < nsig; n++) {
20472         if (sig_name[n]) {
20473             printf("%s %d\n", sig_name[n], sig_num[n])
20474         }
20475         else {
20476             printf("NUM%d %d\n", n, n)
20477         }
20478     }
20479     for (n = 0; n < ndups; n++) {
20480         printf("%s %d\n", dup_name[n], dup_num[n])
20481     }
20482 }
20483 EOP
20484 $cat >signal_cmd <<EOS
20485 $startsh
20486 if $test -s signal.lst; then
20487     echo "Using your existing signal.lst file"
20488         exit 0
20489 fi
20490 xxx="$xxx"
20491 EOS
20492 $cat >>signal_cmd <<'EOS'
20493
20494 set signal
20495 if eval $compile_ok; then
20496         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20497                 $uniq | $awk -f signal.awk >signal.lst
20498 else
20499         echo "(I can't seem be able to compile the whole test program)" >&4
20500         echo "(I'll try it in little pieces.)" >&4
20501         set signal -DJUST_NSIG
20502         if eval $compile_ok; then
20503                 $run ./signal$_exe > signal.nsg
20504                 $cat signal.nsg
20505         else
20506                 echo "I can't seem to figure out how many signals you have." >&4
20507                 echo "Guessing 50." >&4
20508                 echo 'NSIG 50' > signal.nsg
20509         fi
20510         : Now look at all the signal names, one at a time.
20511         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20512                 $cat > signal.c <<EOCP
20513 #include <sys/types.h>
20514 #include <signal.h>
20515 #include <stdio.h>
20516 int main() {
20517 printf("$xx %d\n", SIG${xx});
20518 return 0;
20519 }
20520 EOCP
20521                 set signal
20522                 if eval $compile; then
20523                         echo "SIG${xx} found."
20524                         $run ./signal$_exe  >> signal.ls1
20525                 else
20526                         echo "SIG${xx} NOT found."
20527                 fi
20528         done
20529         if $test -s signal.ls1; then
20530                 $cat signal.nsg signal.ls1 |
20531                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20532         fi
20533
20534 fi
20535 if $test -s signal.lst; then
20536         :
20537 else
20538         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20539         echo 'kill -l' >signal
20540         set X `csh -f <signal`
20541         $rm -f signal
20542         shift
20543         case $# in
20544         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20545         esac
20546         echo $@ | $tr ' ' $trnl | \
20547             $awk '{ printf "%s %d\n", $1, ++s; }
20548                   END { printf "NSIG %d\n", ++s }' >signal.lst
20549 fi
20550 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20551 EOS
20552 chmod a+x signal_cmd
20553 $eunicefix signal_cmd
20554
20555 : generate list of signal names
20556 echo " "
20557 case "$sig_name_init" in
20558 '') doinit=yes ;;
20559 *)  case "$sig_num_init" in
20560     ''|*,*) doinit=yes ;;
20561     esac ;;
20562 esac
20563 case "$doinit" in
20564 yes)
20565         echo "Generating a list of signal names and numbers..." >&4
20566         . ./signal_cmd
20567         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20568         sig_name=`$awk 'BEGIN { printf "ZERO " }
20569                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20570         sig_num=`$awk  'BEGIN { printf "0 " }
20571                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20572         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20573                              !/^NSIG/   { printf "\"%s\", ", $1 }
20574                              END        { printf "0\n" }' signal.lst`
20575         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20576                              !/^NSIG/   { printf "%d, ", $2}
20577                              END        { printf "0\n"}' signal.lst`
20578         ;;
20579 esac
20580 echo "The following $sig_count signals are available:"
20581 echo " "
20582 echo $sig_name | $awk \
20583 'BEGIN { linelen = 0 }
20584 {
20585         for (i = 1; i <= NF; i++) {
20586                 name = "SIG" $i " "
20587                 linelen = linelen + length(name)
20588                 if (linelen > 70) {
20589                         printf "\n"
20590                         linelen = length(name)
20591                 }
20592                 printf "%s", name
20593         }
20594         printf "\n"
20595 }'
20596 sig_size=`echo $sig_name | awk '{print NF}'`
20597 $rm -f signal signal.c signal.awk signal.lst signal_cmd
20598
20599 : Check size of size
20600 echo " "
20601 case "$sizetype" in
20602 *_t) zzz="$sizetype"    ;;
20603 *)   zzz="filesize"     ;;
20604 esac
20605 echo "Checking the size of $zzz..." >&4
20606 cat > try.c <<EOCP
20607 #include <sys/types.h>
20608 #include <stdio.h>
20609 #$i_stdlib I_STDLIB
20610 #ifdef I_STDLIB
20611 #include <stdlib.h>
20612 #endif
20613 int main() {
20614     printf("%d\n", (int)sizeof($sizetype));
20615     exit(0);
20616 }
20617 EOCP
20618 set try
20619 if eval $compile_ok; then
20620         yyy=`$run ./try`
20621         case "$yyy" in
20622         '')     sizesize=4
20623                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20624                 ;;
20625         *)      sizesize=$yyy
20626                 echo "Your $zzz size is $sizesize bytes."
20627                 ;;
20628         esac
20629 else
20630         sizesize=4
20631         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20632 fi
20633
20634
20635 : check for socklen_t
20636 echo " "
20637 echo "Checking to see if you have socklen_t..." >&4
20638 $cat >try.c <<EOCP
20639 #include <sys/types.h>
20640 #$d_socket HAS_SOCKET
20641 #ifdef HAS_SOCKET
20642 #include <sys/socket.h>
20643 #endif
20644 int main() { socklen_t x = 16; }
20645 EOCP
20646 set try
20647 if eval $compile; then
20648         val="$define"
20649         echo "You have socklen_t."
20650 else
20651         val="$undef"
20652         echo "You do not have socklen_t."
20653         case "$sizetype" in
20654         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20655         esac
20656 fi
20657 $rm_try
20658 set d_socklen_t
20659 eval $setvar
20660
20661 : see if this is a socks.h system
20662 set socks.h i_socks
20663 eval $inhdr
20664
20665 : check for type of the size argument to socket calls
20666 case "$d_socket" in
20667 "$define")
20668         $cat <<EOM
20669
20670 Checking to see what type is the last argument of accept().
20671 EOM
20672         yyy=''
20673         case "$d_socklen_t" in
20674         "$define") yyy="$yyy socklen_t"
20675         esac
20676         yyy="$yyy $sizetype int long unsigned"
20677         for xxx in $yyy; do
20678                 case "$socksizetype" in
20679                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
20680                         case "$usesocks" in
20681                         "$define")
20682                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20683                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20684                                         socksizetype="$xxx"
20685                                 fi
20686                                 ;;
20687                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20688                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20689                                         socksizetype="$xxx"
20690                                 fi
20691                                 ;;
20692                         esac
20693                         ;;
20694                 esac
20695         done
20696 : In case none of those worked, prompt the user.
20697         case "$socksizetype" in
20698         '')     rp='What is the type for socket address structure sizes?'
20699                 dflt='int'
20700                 . ./myread
20701                 socksizetype=$ans
20702                 ;;
20703         esac
20704         ;;
20705 *)      : no sockets, so pick relatively harmless default
20706         socksizetype='int'
20707         ;;
20708 esac
20709
20710 : see what type is used for signed size_t
20711 set ssize_t ssizetype int stdio.h sys/types.h
20712 eval $typedef
20713 dflt="$ssizetype"
20714 $cat > try.c <<EOM
20715 #include <stdio.h>
20716 #$i_stdlib I_STDLIB
20717 #ifdef I_STDLIB
20718 #include <stdlib.h>
20719 #endif
20720 #include <sys/types.h>
20721 #define Size_t $sizetype
20722 #define SSize_t $dflt
20723 int main()
20724 {
20725         if (sizeof(Size_t) == sizeof(SSize_t))
20726                 printf("$dflt\n");
20727         else if (sizeof(Size_t) == sizeof(int))
20728                 printf("int\n");
20729         else
20730                 printf("long\n");
20731         exit(0);
20732 }
20733 EOM
20734 echo " "
20735 set try
20736 if eval $compile_ok && $run ./try > /dev/null; then
20737         ssizetype=`$run ./try`
20738         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20739 else
20740         $cat >&4 <<EOM
20741 Help! I can't compile and run the ssize_t test program: please enlighten me!
20742 (This is probably a misconfiguration in your system or libraries, and
20743 you really ought to fix it.  Still, I'll try anyway.)
20744
20745 I need a type that is the same size as $sizetype, but is guaranteed to
20746 be signed.  Common values are ssize_t, int and long.
20747
20748 EOM
20749         rp="What signed type is the same size as $sizetype?"
20750         . ./myread
20751         ssizetype="$ans"
20752 fi
20753 $rm_try
20754
20755 : see what type of char stdio uses.
20756 echo " "
20757 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
20758 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20759         echo "Your stdio uses unsigned chars." >&4
20760         stdchar="unsigned char"
20761 else
20762         echo "Your stdio uses signed chars." >&4
20763         stdchar="char"
20764 fi
20765 $rm -f stdioh
20766
20767 : see what type uids are declared as in the kernel
20768 echo " "
20769 echo "Looking for the type for user ids returned by getuid()."
20770 set uid_t uidtype xxx stdio.h sys/types.h
20771 eval $typedef
20772 case "$uidtype" in
20773 xxx)
20774         xxx=`./findhdr sys/user.h`
20775         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20776         case $1 in
20777         unsigned) dflt="$1 $2" ;;
20778         *) dflt="$1" ;;
20779         esac
20780         ;;
20781 *) dflt="$uidtype";;
20782 esac
20783 case "$uidtype" in
20784 uid_t)  echo "uid_t found." ;;
20785 *)      rp="What is the type for user ids returned by getuid()?"
20786         . ./myread
20787         uidtype="$ans"
20788         ;;
20789 esac
20790
20791 : Check size of UID
20792 echo " "
20793 case "$uidtype" in
20794 *_t) zzz="$uidtype"     ;;
20795 *)   zzz="uid"          ;;
20796 esac
20797 echo "Checking the size of $zzz..." >&4
20798 cat > try.c <<EOCP
20799 #include <sys/types.h>
20800 #include <stdio.h>
20801 #$i_stdlib I_STDLIB
20802 #ifdef I_STDLIB
20803 #include <stdlib.h>
20804 #endif
20805 int main() {
20806     printf("%d\n", (int)sizeof($uidtype));
20807     exit(0);
20808 }
20809 EOCP
20810 set try
20811 if eval $compile_ok; then
20812         yyy=`$run ./try`
20813         case "$yyy" in
20814         '')     uidsize=4
20815                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20816                 ;;
20817         *)      uidsize=$yyy
20818                 echo "Your $zzz is $uidsize bytes long."
20819                 ;;
20820         esac
20821 else
20822         uidsize=4
20823         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20824 fi
20825
20826 : Check if UID is signed
20827 echo " "
20828 case "$uidtype" in
20829 *_t) zzz="$uidtype"     ;;
20830 *)   zzz="uid"          ;;
20831 esac
20832 echo "Checking the sign of $zzz..." >&4
20833 cat > try.c <<EOCP
20834 #include <sys/types.h>
20835 #include <stdio.h>
20836 int main() {
20837         $uidtype foo = -1;
20838         if (foo < 0)
20839                 printf("-1\n");
20840         else
20841                 printf("1\n");
20842 }
20843 EOCP
20844 set try
20845 if eval $compile; then
20846         yyy=`$run ./try`
20847         case "$yyy" in
20848         '')     uidsign=1
20849                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20850                 ;;
20851         *)      uidsign=$yyy
20852                 case "$uidsign" in
20853                  1) echo "Your $zzz is unsigned." ;;
20854                 -1) echo "Your $zzz is signed."   ;;
20855                 esac
20856                 ;;
20857         esac
20858 else
20859         uidsign=1
20860         echo "(I can't compile the test program--guessing unsigned.)" >&4
20861 fi
20862
20863
20864 : Check format string for UID
20865 echo " "
20866 $echo "Checking the format string to be used for uids..." >&4
20867
20868 case "$uidsign" in
20869 -1)     if $test X"$uidsize" = X"$ivsize"; then
20870                 uidformat="$ivdformat"
20871         else
20872                 if $test X"$uidsize" = X"$longsize"; then
20873                         uidformat='"ld"'
20874                 else
20875                         if $test X"$uidsize" = X"$intsize"; then
20876                                 uidformat='"d"'
20877                         else
20878                                 if $test X"$uidsize" = X"$shortsize"; then
20879                                         uidformat='"hd"'
20880                                 fi
20881                         fi
20882                 fi
20883         fi
20884         ;;
20885 *)      if $test X"$uidsize" = X"$uvsize"; then
20886                 uidformat="$uvuformat"
20887         else
20888                 if $test X"$uidsize" = X"$longsize"; then
20889                         uidformat='"lu"'
20890                 else
20891                         if $test X"$uidsize" = X"$intsize"; then
20892                                 uidformat='"u"'
20893                         else
20894                                 if $test X"$uidsize" = X"$shortsize"; then
20895                                         uidformat='"hu"'
20896                                 fi
20897                         fi
20898                 fi
20899         fi
20900         ;;
20901 esac
20902
20903 : Check if site customization support was requested
20904 case "$usesitecustomize" in
20905     $define|true|[Yy]*)
20906         usesitecustomize="$define"
20907         ;;
20908     *)
20909         usesitecustomize="$undef"
20910         ;;
20911     esac
20912
20913 : determine compiler compiler
20914 case "$yacc" in
20915 '')
20916         dflt=yacc;;
20917 *)
20918         dflt="$yacc";;
20919 esac
20920 echo " "
20921 comp='yacc'
20922 if $test -f "$byacc$_exe"; then
20923         dflt="$byacc"
20924         comp="byacc or $comp"
20925 fi
20926 if $test -f "$bison$_exe"; then
20927         comp="$comp or bison -y"
20928 fi
20929 rp="Which compiler compiler ($comp) shall I use?"
20930 . ./myread
20931 yacc="$ans"
20932 case "$yacc" in
20933 *bis*)
20934         case "$yacc" in
20935         *-y*) ;;
20936         *)
20937                 yacc="$yacc -y"
20938                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20939                 ;;
20940         esac
20941         ;;
20942 esac
20943
20944 : see if this is a assert.h system
20945 set assert.h i_assert
20946 eval $inhdr
20947
20948 : see if this is a fp.h system
20949 set fp.h i_fp
20950 eval $inhdr
20951
20952 : see if this is a fp_class.h system
20953 set fp_class.h i_fp_class
20954 eval $inhdr
20955
20956 : see if gdbm.h is available
20957 set gdbm.h t_gdbm
20958 eval $inhdr
20959 case "$t_gdbm" in
20960 $define)
20961         : see if gdbm_open exists
20962         set gdbm_open d_gdbm_open
20963         eval $inlibc
20964         case "$d_gdbm_open" in
20965         $undef)
20966                 t_gdbm="$undef"
20967                 echo "We won't be including <gdbm.h>"
20968                 ;;
20969         esac
20970         ;;
20971 esac
20972 val="$t_gdbm"
20973 set i_gdbm
20974 eval $setvar
20975
20976 : see if ndbm.h is available
20977 set ndbm.h i_ndbm
20978 eval $inhdr
20979 : Compatibility location for RedHat 7.1
20980 set gdbm/ndbm.h i_gdbmndbm
20981 eval $inhdr
20982 : Compatibility location for Debian 4.0
20983 set gdbm-ndbm.h i_gdbm_ndbm
20984 eval $inhdr
20985
20986 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
20987         : see if dbm_open exists
20988         set dbm_open d_dbm_open
20989         eval $inlibc
20990         case "$d_dbm_open" in
20991         $undef)
20992                 i_ndbm="$undef"
20993                 i_gdbmndbm="$undef"
20994                 i_gdbm_ndbm="$undef"
20995                 echo "We won't be including <ndbm.h>"
20996             val="$undef"
20997                 ;;
20998         *) val="$define"
20999            ;;
21000         esac
21001 fi
21002 set d_ndbm
21003 eval $setvar
21004
21005 : see if this is a ieeefp.h system
21006 case "$i_ieeefp" in
21007 '' ) set ieeefp.h i_ieeefp
21008      eval $inhdr
21009      ;;
21010 esac
21011
21012 : see if this is a libutil.h system
21013 set libutil.h i_libutil
21014 eval $inhdr
21015
21016 : see if mach cthreads are available
21017 if test "X$usethreads" = "X$define"; then
21018         set mach/cthreads.h i_machcthr
21019         eval $inhdr
21020 else
21021         i_machcthr="$undef"
21022 fi
21023
21024 : see if this is a mntent.h system
21025 set mntent.h i_mntent
21026 eval $inhdr
21027
21028 : see if net/errno.h is available
21029 val=''
21030 set net/errno.h val
21031 eval $inhdr
21032
21033 : Unfortunately, it causes problems on some systems.  Arrgh.
21034 case "$val" in
21035 $define)
21036         cat > try.c <<'EOM'
21037 #include <stdio.h>
21038 #include <errno.h>
21039 #include <net/errno.h>
21040 int func()
21041 {
21042         return ENOTSOCK;
21043 }
21044 EOM
21045         if $cc $ccflags -c try.c >/dev/null 2>&1; then
21046                 echo "We'll be including <net/errno.h>." >&4
21047         else
21048                 echo "We won't be including <net/errno.h>." >&4
21049                 val="$undef"
21050         fi
21051         $rm_try
21052         ;;
21053 esac
21054 set i_neterrno
21055 eval $setvar
21056
21057 : see if netinet/tcp.h is available
21058 set netinet/tcp.h i_netinettcp
21059 eval $inhdr
21060
21061 : see if this is a poll.h system
21062 set poll.h i_poll
21063 eval $inhdr
21064
21065 : see if this is a prot.h system
21066 set prot.h i_prot
21067 eval $inhdr
21068
21069 : Preprocessor symbols
21070 echo " "
21071 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21072 $cat <<'EOSH' > Cppsym.know
21073 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21074 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21075 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21076 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21077 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21078 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21079 bull c cadmus clipper CMU COFF COMPILER_VERSION
21080 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21081 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21082 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21083 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21084 GLIBC GLIBC_MINOR
21085 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21086 H3050R H3050RX hbullx20 hcx host_mips
21087 hp200 hp300 hp700 HP700 hp800 hp9000
21088 hp9000s200 hp9000s300 hp9000s400 hp9000s500
21089 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21090 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21091 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21092 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21093 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21094 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21095 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21096 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21097 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21098 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21099 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21100 MATH_HAS_NO_SIDE_EFFECTS
21101 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21102 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21103 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21104 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21105 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21106 NetBSD news1500 news1700 news1800 news1900 news3700
21107 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21108 ns32016 ns32332 ns32k nsc32000
21109 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21110 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21111 pc532 pdp11 PGC PIC plexus PORTAR posix
21112 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21113 POSIX_C_SOURCE POSIX_SOURCE POWER
21114 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21115 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21116 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21117 sony sony_news sonyrisc sparc sparclite spectrum
21118 stardent stdc STDC_EXT stratos sun sun3 sun386
21119 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21120 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21121 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21122 sysV68 sysV88 Tek4132 Tek4300 titan
21123 TM3200 TM5400 TM5600
21124 tower tower32 tower32_200 tower32_600 tower32_700
21125 tower32_800 tower32_850 tss
21126 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21127 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
21128 unix UNIX95 UNIX99 unixpc unos
21129 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21130 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21131 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21132 USGr4 USGr4_2
21133 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
21134 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21135 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21136 z8000
21137 EOSH
21138 # Maybe put other stuff here too.
21139 cat <<EOSH >>Cppsym.know
21140 $osname
21141 EOSH
21142 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21143 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21144 $cat Cppsym.know > Cppsym.c
21145 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
21146 $rm -f Cppsym.a Cppsym.b Cppsym.c
21147 cat <<EOSH > Cppsym
21148 $startsh
21149 if $test \$# -gt 0; then
21150     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21151     if $test -s Cppsym.got; then
21152         $rm -f Cppsym.got
21153         exit 0
21154     fi
21155     $rm -f Cppsym.got
21156     exit 1
21157 else
21158     $tr " " "$trnl" | ./Cppsym.try
21159     exit 0
21160 fi
21161 EOSH
21162 chmod +x Cppsym
21163 $eunicefix Cppsym
21164 cat <<EOSH > Cppsym.try
21165 $startsh
21166 cat <<'EOCP' > try.c
21167 #include <stdio.h>
21168 #if cpp_stuff == 1
21169 #define STRINGIFY(a)    "a"
21170 #endif
21171 #if cpp_stuff == 42
21172 #define StGiFy(a)  #a
21173 #define STRINGIFY(a)    StGiFy(a)
21174 #endif
21175 #if $cpp_stuff != 1 && $cpp_stuff != 42
21176 #   include "Bletch: How does this C preprocessor stringify macros?"
21177 #endif
21178 int main() {
21179 EOCP
21180 $awk \\
21181 EOSH
21182 cat <<'EOSH' >> Cppsym.try
21183 'length($1) > 0 {
21184     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21185     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21186     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21187     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
21188 }'       >> try.c
21189 echo 'return 0;}' >> try.c
21190 EOSH
21191 cat <<EOSH >> Cppsym.try
21192 ccflags="$ccflags"
21193 case "$osname-$gccversion" in
21194 irix-) ccflags="\$ccflags -woff 1178" ;;
21195 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21196 esac
21197 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
21198 EOSH
21199 chmod +x Cppsym.try
21200 $eunicefix Cppsym.try
21201 ./Cppsym < Cppsym.know > Cppsym.true
21202 : Add in any linux cpp "predefined macros":
21203 case "$osname::$gccversion" in
21204   *linux*::*.*)
21205     tHdrH=_tmpHdr
21206     rm -f $tHdrH'.h' $tHdrH
21207     touch $tHdrH'.h'
21208     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
21209        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21210        if [ -s $tHdrH'_cppsym.real' ]; then
21211           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21212        fi
21213     fi
21214     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21215   ;;
21216 esac
21217 : now check the C compiler for additional symbols
21218 postprocess_cc_v=''
21219 case "$osname" in
21220 aix) postprocess_cc_v="|$tr , ' '" ;;
21221 esac
21222 $cat >ccsym <<EOS
21223 $startsh
21224 $cat >tmp.c <<EOF
21225 extern int foo;
21226 EOF
21227 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21228 do
21229         case "\$i" in
21230         -D*) echo "\$i" | $sed 's/^-D//';;
21231         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
21232         esac
21233 done
21234 $rm_try
21235 EOS
21236 postprocess_cc_v=''
21237 chmod +x ccsym
21238 $eunicefix ccsym
21239 ./ccsym > ccsym1.raw
21240 if $test -s ccsym1.raw; then
21241        $sort ccsym1.raw | $uniq >ccsym.raw
21242 else
21243        mv ccsym1.raw ccsym.raw
21244 fi
21245
21246 $awk '/\=/ { print $0; next }
21247         { print $0"=1" }' ccsym.raw >ccsym.list
21248 $comm -13 Cppsym.true ccsym.list >ccsym.own
21249 $comm -12 Cppsym.true ccsym.list >ccsym.com
21250 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
21251 also=''
21252 if $test -z ccsym.raw; then
21253         echo "Your C compiler doesn't seem to define any symbols!" >&4
21254         echo " "
21255         echo "However, your C preprocessor defines the following symbols:"
21256         $cat Cppsym.true
21257         ccsymbols=''
21258         cppsymbols=`$cat Cppsym.true`
21259         cppsymbols=`echo $cppsymbols`
21260         cppccsymbols="$cppsymbols"
21261 else
21262         if $test -s ccsym.com; then
21263                 echo "Your C compiler and pre-processor define these symbols:"
21264                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21265                 also='also '
21266                 symbols='ones'
21267                 cppccsymbols=`$cat ccsym.com`
21268                 cppccsymbols=`echo $cppccsymbols`
21269                 $test "$silent" || sleep 1
21270         fi
21271         if $test -s ccsym.cpp; then
21272                 $test "$also" && echo " "
21273                 echo "Your C pre-processor ${also}defines the following symbols:"
21274                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21275                 also='further '
21276                 cppsymbols=`$cat ccsym.cpp`
21277                 cppsymbols=`echo $cppsymbols`
21278                 $test "$silent" || sleep 1
21279         fi
21280         if $test -s ccsym.own; then
21281                 $test "$also" && echo " "
21282                 echo "Your C compiler ${also}defines the following cpp symbols:"
21283                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21284                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21285                 ccsymbols=`$cat ccsym.own`
21286                 ccsymbols=`echo $ccsymbols`
21287                 $test "$silent" || sleep 1
21288         fi
21289 fi
21290
21291 : see if this is a termio system
21292 val="$undef"
21293 val2="$undef"
21294 val3="$undef"
21295 if $test `./findhdr termios.h`; then
21296         set tcsetattr i_termios
21297         eval $inlibc
21298         val3="$i_termios"
21299 fi
21300 echo " "
21301 case "$val3" in
21302 "$define") echo "You have POSIX termios.h... good!" >&4;;
21303 *) if ./Cppsym pyr; then
21304                 case "`/bin/universe`" in
21305                 ucb) if $test `./findhdr sgtty.h`; then
21306                                 val2="$define"
21307                                 echo "<sgtty.h> found." >&4
21308                         else
21309                                 echo "System is pyramid with BSD universe."
21310                                 ./warn "<sgtty.h> not found--you could have problems."
21311                         fi;;
21312                 *) if $test `./findhdr termio.h`; then
21313                                 val="$define"
21314                                 echo "<termio.h> found." >&4
21315                         else
21316                                 echo "System is pyramid with USG universe."
21317                                 ./warn "<termio.h> not found--you could have problems."
21318                         fi;;
21319                 esac
21320         elif ./usg; then
21321                 if $test `./findhdr termio.h`; then
21322                         echo "<termio.h> found." >&4
21323                         val="$define"
21324                 elif $test `./findhdr sgtty.h`; then
21325                         echo "<sgtty.h> found." >&4
21326                         val2="$define"
21327                 else
21328                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
21329                 fi
21330         else
21331                 if $test `./findhdr sgtty.h`; then
21332                         echo "<sgtty.h> found." >&4
21333                         val2="$define"
21334                 elif $test `./findhdr termio.h`; then
21335                         echo "<termio.h> found." >&4
21336                         val="$define"
21337                 else
21338                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
21339                 fi
21340         fi;;
21341 esac
21342 set i_termio; eval $setvar
21343 val=$val2; set i_sgtty; eval $setvar
21344 val=$val3; set i_termios; eval $setvar
21345
21346 : see if stddef is available
21347 set stddef.h i_stddef
21348 eval $inhdr
21349
21350 : see if sys/access.h is available
21351 set sys/access.h i_sysaccess
21352 eval $inhdr
21353
21354 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
21355 set sys/filio.h i_sysfilio
21356 eval $inhdr
21357 echo " "
21358 if $test `./findhdr sys/ioctl.h`; then
21359         val="$define"
21360         echo '<sys/ioctl.h> found.' >&4
21361 else
21362         val="$undef"
21363         if $test $i_sysfilio = "$define"; then
21364             echo '<sys/ioctl.h> NOT found.' >&4
21365         else
21366                 $test $i_sgtty = "$define" && xxx="sgtty.h"
21367                 $test $i_termio = "$define" && xxx="termio.h"
21368                 $test $i_termios = "$define" && xxx="termios.h"
21369 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
21370         fi
21371 fi
21372 set i_sysioctl
21373 eval $setvar
21374
21375 : see if socket ioctl defs are in sys/sockio.h
21376 echo " "
21377 xxx=`./findhdr sys/sockio.h`
21378 if $test "$xxx"; then
21379         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
21380                 val="$define"
21381                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
21382         else
21383                 val="$undef"
21384                 echo "No socket ioctls found in <sys/sockio.h>." >&4
21385         fi
21386 else
21387         val="$undef"
21388         $cat <<EOM
21389 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
21390 EOM
21391 fi
21392 set i_syssockio
21393 eval $setvar
21394
21395 : see if this is a syslog.h system
21396 set syslog.h i_syslog
21397 eval $inhdr
21398
21399 : see if this is a sys/mode.h system
21400 set sys/mode.h i_sysmode
21401 eval $inhdr
21402
21403 : see if there is a sys/poll.h file
21404 set sys/poll.h i_syspoll
21405 eval $inhdr
21406
21407 : see if sys/resource.h has to be included
21408 set sys/resource.h i_sysresrc
21409 eval $inhdr
21410
21411 : see if sys/security.h is available
21412 set sys/security.h i_syssecrt
21413 eval $inhdr
21414
21415 : see if this is a sys/statvfs.h system
21416 set sys/statvfs.h i_sysstatvfs
21417 eval $inhdr
21418
21419 : see if this is a sys/un.h system
21420 set sys/un.h i_sysun
21421 eval $inhdr
21422
21423 : see if this is a sys/utsname.h system
21424 set sys/utsname.h i_sysutsname
21425 eval $inhdr
21426
21427 : see if this is a syswait system
21428 set sys/wait.h i_syswait
21429 eval $inhdr
21430
21431 : see if this is a ustat.h system
21432 set ustat.h i_ustat
21433 eval $inhdr
21434
21435 : see if this is an utime system
21436 set utime.h i_utime
21437 eval $inhdr
21438
21439 : see if this is a vfork system
21440 case "$d_vfork" in
21441 "$define")
21442         set vfork.h i_vfork
21443         eval $inhdr
21444         ;;
21445 *)
21446         i_vfork="$undef"
21447         ;;
21448 esac
21449
21450 : Check extensions
21451 echo " "
21452 echo "Looking for extensions..." >&4
21453 : If we are using the old config.sh, known_extensions may contain
21454 : old or inaccurate or duplicate values.
21455 known_extensions=''
21456 nonxs_extensions=''
21457 : We do not use find because it might not be available.
21458 : We do not just use MANIFEST because the user may have dropped
21459 : some additional extensions into the source tree and expect them
21460 : to be built.
21461
21462 : Function to recursively find available extensions, ignoring DynaLoader
21463 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21464 find_extensions='
21465     for xxx in *; do
21466         case "$xxx" in
21467             DynaLoader|dynaload) ;;
21468             *)
21469             if $test -f $xxx/$xxx.xs -o -f $xxx/$xxx.c; then
21470                 known_extensions="$known_extensions $1$xxx";
21471             elif $test -f $xxx/Makefile.PL; then
21472                 nonxs_extensions="$nonxs_extensions $1$xxx";
21473             else
21474                 if $test -d $xxx -a $# -lt 10; then
21475                     set $1$xxx/ $*;
21476                     cd "$xxx";
21477                     eval $find_extensions;
21478                     cd ..;
21479                     shift;
21480                 fi;
21481             fi
21482             ;;
21483         esac;
21484     done'
21485 tdir=`pwd`
21486 cd "$rsrc/ext"
21487 set X
21488 shift
21489 eval $find_extensions
21490 # Special case:  Add in modules that nest beyond the first level.
21491 # Currently threads/shared and Hash/Util/FieldHash, since they are
21492 # not picked up by the recursive find above (and adding in general
21493 # recursive finding breaks SDBM_File/sdbm).
21494 # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21495 known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
21496 set X $known_extensions
21497 shift
21498 known_extensions="$*"
21499 set X $nonxs_extensions
21500 shift
21501 nonxs_extensions="$*"
21502 cd "$tdir"
21503
21504 : Now see which are supported on this system.
21505 avail_ext=''
21506 for xxx in $known_extensions ; do
21507         case "$xxx" in
21508         DB_File|db_file)
21509                 case "$i_db" in
21510                 $define) avail_ext="$avail_ext $xxx" ;;
21511                 esac
21512                 ;;
21513         GDBM_File|gdbm_fil)
21514                 case "$i_gdbm" in
21515                 $define) avail_ext="$avail_ext $xxx" ;;
21516                 esac
21517                 ;;
21518         I18N/Langinfo|i18n_lan)
21519                 case "$i_langinfo$d_nl_langinfo" in
21520                 $define$define) avail_ext="$avail_ext $xxx" ;;
21521                 esac
21522                 ;;
21523         IPC/SysV|ipc/sysv)
21524                 : XXX Do we need a useipcsysv variable here
21525                 case "${d_msg}${d_sem}${d_shm}" in
21526                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21527                 esac
21528                 ;;
21529         NDBM_File|ndbm_fil)
21530                 case "$i_ndbm" in
21531                 $define)
21532                     case "$osname-$use64bitint" in
21533                     hpux-define)
21534                         case "$libs" in
21535                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21536                         esac
21537                         ;;
21538                     *) avail_ext="$avail_ext $xxx" ;;
21539                     esac
21540                     ;;
21541                 esac
21542                 ;;
21543         ODBM_File|odbm_fil)
21544                 case "${i_dbm}${i_rpcsvcdbm}" in
21545                 *"${define}"*)
21546                     case "$d_cplusplus" in
21547                     define) ;; # delete as a function name will not work
21548                     *)  case "$osname-$use64bitint" in
21549                         hpux-define)
21550                             case "$libs" in
21551                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21552                             esac
21553                             ;;
21554                         *) avail_ext="$avail_ext $xxx" ;;
21555                         esac
21556                         ;;
21557                     esac
21558                     ;;
21559                 esac
21560                 ;;
21561         Opcode|opcode)
21562                 case "$useopcode" in
21563                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21564                 esac
21565                 ;;
21566         POSIX|posix)
21567                 case "$useposix" in
21568                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21569                 esac
21570                 ;;
21571         Socket|socket)
21572                 case "$d_socket" in
21573                 true|$define|y)
21574                     case "$osname" in
21575                     beos) ;; # not unless BONE
21576                     *) avail_ext="$avail_ext $xxx" ;;
21577                     esac
21578                     ;;
21579                 esac
21580                 ;;
21581         Sys/Syslog|sys/syslog)
21582                 : XXX syslog requires socket
21583                 case "$d_socket" in
21584                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21585                 esac
21586                 ;;
21587         Thread|thread)
21588                 case "$usethreads" in
21589                 true|$define|y)
21590                         case "$use5005threads" in
21591                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
21592                         esac
21593                 esac
21594                 ;;
21595         threads|threads/shared)
21596                 # threads and threads::shared are special cases.
21597                 # To stop people from asking "Perl 5.8.0 was supposed
21598                 # to have this new fancy threads implementation but my
21599                 # perl doesn't have it" and from people trying to
21600                 # (re)install the threads module using CPAN.pm and
21601                 # CPAN.pm then offering to reinstall Perl 5.8.0,
21602                 # the threads.pm and threads/shared.pm will always be
21603                 # there, croaking informatively ("you need to rebuild
21604                 # all of Perl with threads, sorry") when threads haven't
21605                 # been compiled in.
21606                 # --jhi
21607                 avail_ext="$avail_ext $xxx"
21608                 ;;
21609         Win32*)
21610                 case "$osname" in
21611                 cygwin) avail_ext="$avail_ext $xxx" ;;
21612                 esac
21613                 ;;
21614         XS/APItest|xs/apitest)
21615                 # This is just for testing.  Skip it unless we have dynamic loading.
21616
21617                 case "$usedl" in
21618                 $define) avail_ext="$avail_ext $xxx" ;;
21619                 esac
21620                 ;;
21621         XS/Typemap|xs/typemap)
21622                 # This is just for testing.  Skip it unless we have dynamic loading.
21623                 case "$usedl" in
21624                 $define) avail_ext="$avail_ext $xxx" ;;
21625                 esac
21626                 ;;
21627         *)      avail_ext="$avail_ext $xxx"
21628                 ;;
21629         esac
21630 done
21631
21632 set X $avail_ext
21633 shift
21634 avail_ext="$*"
21635
21636 case "$onlyextensions" in
21637 '') ;;
21638 *)  keepextensions=''
21639     echo "You have requested that only certains extensions be included..." >&4
21640     for i in $onlyextensions; do
21641         case " $avail_ext " in
21642         *" $i "*)
21643             echo "Keeping extension $i."
21644             keepextensions="$keepextensions $i"
21645             ;;
21646         *) echo "Ignoring extension $i." ;;
21647         esac
21648     done
21649     avail_ext="$keepextensions"
21650     ;;
21651 esac
21652
21653 case "$noextensions" in
21654 '') ;;
21655 *)  keepextensions=''
21656     echo "You have requested that certain extensions be ignored..." >&4
21657     for i in $avail_ext; do
21658         case " $noextensions " in
21659         *" $i "*) echo "Ignoring extension $i." ;;
21660         *) echo "Keeping extension $i.";
21661            keepextensions="$keepextensions $i"
21662            ;;
21663         esac
21664     done
21665     avail_ext="$keepextensions"
21666     ;;
21667 esac
21668
21669 : Now see which nonxs extensions are supported on this system.
21670 : For now assume all are.
21671 nonxs_ext=''
21672 for xxx in $nonxs_extensions ; do
21673         case "$xxx" in
21674         *)      nonxs_ext="$nonxs_ext $xxx"
21675                 ;;
21676         esac
21677 done
21678
21679 set X $nonxs_ext
21680 shift
21681 nonxs_ext="$*"
21682
21683 case $usedl in
21684 $define)
21685         $cat <<EOM
21686 A number of extensions are supplied with $package.  You may choose to
21687 compile these extensions for dynamic loading (the default), compile
21688 them into the $package executable (static loading), or not include
21689 them at all.  Answer "none" to include no extensions.
21690 Note that DynaLoader is always built and need not be mentioned here.
21691
21692 EOM
21693         case "$dynamic_ext" in
21694         '')
21695                 : Exclude those listed in static_ext
21696                 dflt=''
21697                 for xxx in $avail_ext; do
21698                         case " $static_ext " in
21699                         *" $xxx "*) ;;
21700                         *) dflt="$dflt $xxx" ;;
21701                         esac
21702                 done
21703                 set X $dflt
21704                 shift
21705                 dflt="$*"
21706                 ;;
21707         *)      dflt="$dynamic_ext"
21708                 # Perhaps we are reusing an old out-of-date config.sh.
21709                 case "$hint" in
21710                 previous)
21711                         if test X"$dynamic_ext" != X"$avail_ext"; then
21712                                 $cat <<EOM
21713 NOTICE:  Your previous config.sh list may be incorrect.
21714 The extensions now available to you are
21715         ${avail_ext}
21716 but the default list from your previous config.sh is
21717         ${dynamic_ext}
21718
21719 EOM
21720                         fi
21721                         ;;
21722                 esac
21723                 ;;
21724         esac
21725         case "$dflt" in
21726         '')     dflt=none;;
21727         esac
21728         rp="What extensions do you wish to load dynamically?"
21729         . ./myread
21730         case "$ans" in
21731         none) dynamic_ext=' ' ;;
21732         *) dynamic_ext="$ans" ;;
21733         esac
21734
21735         case "$static_ext" in
21736         '')
21737                 : Exclude those already listed in dynamic linking
21738                 dflt=''
21739                 for xxx in $avail_ext; do
21740                         case " $dynamic_ext " in
21741                         *" $xxx "*) ;;
21742                         *) dflt="$dflt $xxx" ;;
21743                         esac
21744                 done
21745                 set X $dflt
21746                 shift
21747                 dflt="$*"
21748                 ;;
21749         *)  dflt="$static_ext"
21750                 ;;
21751         esac
21752
21753         case "$dflt" in
21754         '')     dflt=none;;
21755         esac
21756         rp="What extensions do you wish to load statically?"
21757         . ./myread
21758         case "$ans" in
21759         none) static_ext=' ' ;;
21760         *) static_ext="$ans" ;;
21761         esac
21762         ;;
21763 *)
21764         $cat <<EOM
21765 A number of extensions are supplied with $package.  Answer "none"
21766 to include no extensions.
21767 Note that DynaLoader is always built and need not be mentioned here.
21768
21769 EOM
21770         case "$static_ext" in
21771         '') dflt="$avail_ext" ;;
21772         *)      dflt="$static_ext"
21773                 # Perhaps we are reusing an old out-of-date config.sh.
21774                 case "$hint" in
21775                 previous)
21776                         if test X"$static_ext" != X"$avail_ext"; then
21777                                 $cat <<EOM
21778 NOTICE:  Your previous config.sh list may be incorrect.
21779 The extensions now available to you are
21780         ${avail_ext}
21781 but the default list from your previous config.sh is
21782         ${static_ext}
21783
21784 EOM
21785                         fi
21786                         ;;
21787                 esac
21788                 ;;
21789         esac
21790         : Exclude those that are not xs extensions
21791         case "$dflt" in
21792         '')     dflt=none;;
21793         esac
21794         rp="What extensions do you wish to include?"
21795         . ./myread
21796         case "$ans" in
21797         none) static_ext=' ' ;;
21798         *) static_ext="$ans" ;;
21799         esac
21800         ;;
21801 esac
21802 #
21803 # Encode is a special case.  If we are building Encode as a static
21804 # extension, we need to explicitly list its subextensions as well.
21805 # For other nested extensions, this is handled automatically by
21806 # the appropriate Makefile.PL.
21807 case " $static_ext " in
21808         *" Encode "*) # Add the subextensions of Encode
21809         cd "$rsrc/ext"
21810         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21811                 static_ext="$static_ext Encode/$xxx"
21812         done
21813         cd "$tdir"
21814         ;;
21815 esac
21816
21817 set X $dynamic_ext $static_ext $nonxs_ext
21818 shift
21819 extensions="$*"
21820
21821 # Sanity check:  We require an extension suitable for use with
21822 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21823 # should show up as failures in the test suite, but it's helpful to
21824 # catch them now.) The 'extensions' list is normally sorted
21825 # alphabetically, so we need to accept either
21826 #    DB_File ... Fcntl ... IO  ....
21827 # or something like
21828 #    Fcntl ... NDBM_File ... IO  ....
21829 case " $extensions"  in
21830 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21831 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21832 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21833 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21834    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21835    ;;
21836 esac
21837
21838 : Remove libraries needed only for extensions
21839 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21840 : The exception is SunOS 4.x, which needs them.
21841 case "${osname}X${osvers}" in
21842 sunos*X4*)
21843     perllibs="$libs"
21844     ;;
21845 *) case "$usedl" in
21846     $define|true|[yY]*)
21847             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21848             shift
21849             perllibs="$*"
21850             ;;
21851     *)  perllibs="$libs"
21852             ;;
21853     esac
21854     ;;
21855 esac
21856
21857 : Remove build directory name from cppstdin so it can be used from
21858 : either the present location or the final installed location.
21859 echo " "
21860 : Get out of the UU directory to get correct path name.
21861 cd ..
21862 case "$cppstdin" in
21863 `pwd`/cppstdin)
21864         echo "Stripping down cppstdin path name"
21865         cppstdin=cppstdin
21866         ;;
21867 esac
21868 cd UU
21869
21870 : end of configuration questions
21871 echo " "
21872 echo "End of configuration questions."
21873 echo " "
21874
21875 : back to where it started
21876 if test -d ../UU; then
21877         cd ..
21878 fi
21879
21880 : configuration may be unconditionally patched via a 'config.arch' file
21881 if $test -f config.arch; then
21882         echo "I see a config.arch file, loading it." >&4
21883         . ./config.arch
21884 fi
21885
21886 : configuration may be patched via a 'config.over' file
21887 if $test -f config.over; then
21888         echo " "
21889         dflt=y
21890         rp='I see a config.over file.  Do you wish to load it?'
21891         . UU/myread
21892         case "$ans" in
21893         n*) echo "OK, I'll ignore it.";;
21894         *)      . ./config.over
21895                 echo "Configuration override changes have been loaded."
21896                 ;;
21897         esac
21898 fi
21899
21900 : in case they want portability, strip down executable paths
21901 case "$d_portable" in
21902 "$define")
21903         echo " "
21904         echo "Stripping down executable paths..." >&4
21905         for file in $loclist $trylist; do
21906                 eval temp=\$$file
21907                 eval $file=`basename $temp`
21908         done
21909         ;;
21910 esac
21911
21912 : create config.sh file
21913 echo " "
21914 echo "Creating config.sh..." >&4
21915 $spitshell <<EOT >config.sh
21916 $startsh
21917 #
21918 # This file was produced by running the Configure script. It holds all the
21919 # definitions figured out by Configure. Should you modify one of these values,
21920 # do not forget to propagate your changes by running "Configure -der". You may
21921 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21922 #
21923
21924 # Package name      : $package
21925 # Source directory  : $src
21926 # Configuration time: $cf_time
21927 # Configured by     : $cf_by
21928 # Target system     : $myuname
21929
21930 EOT
21931 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
21932 $spitshell <<EOT >>config.sh
21933
21934 Author='$Author'
21935 Date='$Date'
21936 Header='$Header'
21937 Id='$Id'
21938 Locker='$Locker'
21939 Log='$Log'
21940 RCSfile='$RCSfile'
21941 Revision='$Revision'
21942 Source='$Source'
21943 State='$State'
21944 _a='$_a'
21945 _exe='$_exe'
21946 _o='$_o'
21947 afs='$afs'
21948 afsroot='$afsroot'
21949 alignbytes='$alignbytes'
21950 ansi2knr='$ansi2knr'
21951 aphostname='$aphostname'
21952 api_revision='$api_revision'
21953 api_subversion='$api_subversion'
21954 api_version='$api_version'
21955 api_versionstring='$api_versionstring'
21956 ar='$ar'
21957 archlib='$archlib'
21958 archlibexp='$archlibexp'
21959 archname64='$archname64'
21960 archname='$archname'
21961 archobjs='$archobjs'
21962 asctime_r_proto='$asctime_r_proto'
21963 awk='$awk'
21964 baserev='$baserev'
21965 bash='$bash'
21966 bin='$bin'
21967 binexp='$binexp'
21968 bison='$bison'
21969 byacc='$byacc'
21970 byteorder='$byteorder'
21971 c='$c'
21972 castflags='$castflags'
21973 cat='$cat'
21974 cc='$cc'
21975 cccdlflags='$cccdlflags'
21976 ccdlflags='$ccdlflags'
21977 ccflags='$ccflags'
21978 ccflags_uselargefiles='$ccflags_uselargefiles'
21979 ccname='$ccname'
21980 ccsymbols='$ccsymbols'
21981 ccversion='$ccversion'
21982 cf_by='$cf_by'
21983 cf_email='$cf_email'
21984 cf_time='$cf_time'
21985 chgrp='$chgrp'
21986 chmod='$chmod'
21987 chown='$chown'
21988 clocktype='$clocktype'
21989 comm='$comm'
21990 compress='$compress'
21991 contains='$contains'
21992 cp='$cp'
21993 cpio='$cpio'
21994 cpp='$cpp'
21995 cpp_stuff='$cpp_stuff'
21996 cppccsymbols='$cppccsymbols'
21997 cppflags='$cppflags'
21998 cpplast='$cpplast'
21999 cppminus='$cppminus'
22000 cpprun='$cpprun'
22001 cppstdin='$cppstdin'
22002 cppsymbols='$cppsymbols'
22003 crypt_r_proto='$crypt_r_proto'
22004 cryptlib='$cryptlib'
22005 csh='$csh'
22006 ctermid_r_proto='$ctermid_r_proto'
22007 ctime_r_proto='$ctime_r_proto'
22008 d_Gconvert='$d_Gconvert'
22009 d_PRIEUldbl='$d_PRIEUldbl'
22010 d_PRIFUldbl='$d_PRIFUldbl'
22011 d_PRIGUldbl='$d_PRIGUldbl'
22012 d_PRIXU64='$d_PRIXU64'
22013 d_PRId64='$d_PRId64'
22014 d_PRIeldbl='$d_PRIeldbl'
22015 d_PRIfldbl='$d_PRIfldbl'
22016 d_PRIgldbl='$d_PRIgldbl'
22017 d_PRIi64='$d_PRIi64'
22018 d_PRIo64='$d_PRIo64'
22019 d_PRIu64='$d_PRIu64'
22020 d_PRIx64='$d_PRIx64'
22021 d_SCNfldbl='$d_SCNfldbl'
22022 d__fwalk='$d__fwalk'
22023 d_access='$d_access'
22024 d_accessx='$d_accessx'
22025 d_aintl='$d_aintl'
22026 d_alarm='$d_alarm'
22027 d_archlib='$d_archlib'
22028 d_asctime_r='$d_asctime_r'
22029 d_atolf='$d_atolf'
22030 d_atoll='$d_atoll'
22031 d_attribute_format='$d_attribute_format'
22032 d_attribute_malloc='$d_attribute_malloc'
22033 d_attribute_nonnull='$d_attribute_nonnull'
22034 d_attribute_noreturn='$d_attribute_noreturn'
22035 d_attribute_pure='$d_attribute_pure'
22036 d_attribute_unused='$d_attribute_unused'
22037 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
22038 d_bcmp='$d_bcmp'
22039 d_bcopy='$d_bcopy'
22040 d_bsd='$d_bsd'
22041 d_bsdgetpgrp='$d_bsdgetpgrp'
22042 d_bsdsetpgrp='$d_bsdsetpgrp'
22043 d_builtin_choose_expr='$d_builtin_choose_expr'
22044 d_builtin_expect='$d_builtin_expect'
22045 d_bzero='$d_bzero'
22046 d_c99_variadic_macros='$d_c99_variadic_macros'
22047 d_casti32='$d_casti32'
22048 d_castneg='$d_castneg'
22049 d_charvspr='$d_charvspr'
22050 d_chown='$d_chown'
22051 d_chroot='$d_chroot'
22052 d_chsize='$d_chsize'
22053 d_class='$d_class'
22054 d_clearenv='$d_clearenv'
22055 d_closedir='$d_closedir'
22056 d_cmsghdr_s='$d_cmsghdr_s'
22057 d_const='$d_const'
22058 d_copysignl='$d_copysignl'
22059 d_cplusplus='$d_cplusplus'
22060 d_crypt='$d_crypt'
22061 d_crypt_r='$d_crypt_r'
22062 d_csh='$d_csh'
22063 d_ctermid='$d_ctermid'
22064 d_ctermid_r='$d_ctermid_r'
22065 d_ctime_r='$d_ctime_r'
22066 d_cuserid='$d_cuserid'
22067 d_dbl_dig='$d_dbl_dig'
22068 d_dbminitproto='$d_dbminitproto'
22069 d_difftime='$d_difftime'
22070 d_dir_dd_fd='$d_dir_dd_fd'
22071 d_dirfd='$d_dirfd'
22072 d_dirnamlen='$d_dirnamlen'
22073 d_dlerror='$d_dlerror'
22074 d_dlopen='$d_dlopen'
22075 d_dlsymun='$d_dlsymun'
22076 d_dosuid='$d_dosuid'
22077 d_drand48_r='$d_drand48_r'
22078 d_drand48proto='$d_drand48proto'
22079 d_dup2='$d_dup2'
22080 d_eaccess='$d_eaccess'
22081 d_endgrent='$d_endgrent'
22082 d_endgrent_r='$d_endgrent_r'
22083 d_endhent='$d_endhent'
22084 d_endhostent_r='$d_endhostent_r'
22085 d_endnent='$d_endnent'
22086 d_endnetent_r='$d_endnetent_r'
22087 d_endpent='$d_endpent'
22088 d_endprotoent_r='$d_endprotoent_r'
22089 d_endpwent='$d_endpwent'
22090 d_endpwent_r='$d_endpwent_r'
22091 d_endsent='$d_endsent'
22092 d_endservent_r='$d_endservent_r'
22093 d_eofnblk='$d_eofnblk'
22094 d_eunice='$d_eunice'
22095 d_faststdio='$d_faststdio'
22096 d_fchdir='$d_fchdir'
22097 d_fchmod='$d_fchmod'
22098 d_fchown='$d_fchown'
22099 d_fcntl='$d_fcntl'
22100 d_fcntl_can_lock='$d_fcntl_can_lock'
22101 d_fd_macros='$d_fd_macros'
22102 d_fd_set='$d_fd_set'
22103 d_fds_bits='$d_fds_bits'
22104 d_fgetpos='$d_fgetpos'
22105 d_finite='$d_finite'
22106 d_finitel='$d_finitel'
22107 d_flexfnam='$d_flexfnam'
22108 d_flock='$d_flock'
22109 d_flockproto='$d_flockproto'
22110 d_fork='$d_fork'
22111 d_fp_class='$d_fp_class'
22112 d_fpathconf='$d_fpathconf'
22113 d_fpclass='$d_fpclass'
22114 d_fpclassify='$d_fpclassify'
22115 d_fpclassl='$d_fpclassl'
22116 d_fpos64_t='$d_fpos64_t'
22117 d_frexpl='$d_frexpl'
22118 d_fs_data_s='$d_fs_data_s'
22119 d_fseeko='$d_fseeko'
22120 d_fsetpos='$d_fsetpos'
22121 d_fstatfs='$d_fstatfs'
22122 d_fstatvfs='$d_fstatvfs'
22123 d_fsync='$d_fsync'
22124 d_ftello='$d_ftello'
22125 d_ftime='$d_ftime'
22126 d_futimes='$d_futimes'
22127 d_getcwd='$d_getcwd'
22128 d_getespwnam='$d_getespwnam'
22129 d_getfsstat='$d_getfsstat'
22130 d_getgrent='$d_getgrent'
22131 d_getgrent_r='$d_getgrent_r'
22132 d_getgrgid_r='$d_getgrgid_r'
22133 d_getgrnam_r='$d_getgrnam_r'
22134 d_getgrps='$d_getgrps'
22135 d_gethbyaddr='$d_gethbyaddr'
22136 d_gethbyname='$d_gethbyname'
22137 d_gethent='$d_gethent'
22138 d_gethname='$d_gethname'
22139 d_gethostbyaddr_r='$d_gethostbyaddr_r'
22140 d_gethostbyname_r='$d_gethostbyname_r'
22141 d_gethostent_r='$d_gethostent_r'
22142 d_gethostprotos='$d_gethostprotos'
22143 d_getitimer='$d_getitimer'
22144 d_getlogin='$d_getlogin'
22145 d_getlogin_r='$d_getlogin_r'
22146 d_getmnt='$d_getmnt'
22147 d_getmntent='$d_getmntent'
22148 d_getnbyaddr='$d_getnbyaddr'
22149 d_getnbyname='$d_getnbyname'
22150 d_getnent='$d_getnent'
22151 d_getnetbyaddr_r='$d_getnetbyaddr_r'
22152 d_getnetbyname_r='$d_getnetbyname_r'
22153 d_getnetent_r='$d_getnetent_r'
22154 d_getnetprotos='$d_getnetprotos'
22155 d_getpagsz='$d_getpagsz'
22156 d_getpbyname='$d_getpbyname'
22157 d_getpbynumber='$d_getpbynumber'
22158 d_getpent='$d_getpent'
22159 d_getpgid='$d_getpgid'
22160 d_getpgrp2='$d_getpgrp2'
22161 d_getpgrp='$d_getpgrp'
22162 d_getppid='$d_getppid'
22163 d_getprior='$d_getprior'
22164 d_getprotobyname_r='$d_getprotobyname_r'
22165 d_getprotobynumber_r='$d_getprotobynumber_r'
22166 d_getprotoent_r='$d_getprotoent_r'
22167 d_getprotoprotos='$d_getprotoprotos'
22168 d_getprpwnam='$d_getprpwnam'
22169 d_getpwent='$d_getpwent'
22170 d_getpwent_r='$d_getpwent_r'
22171 d_getpwnam_r='$d_getpwnam_r'
22172 d_getpwuid_r='$d_getpwuid_r'
22173 d_getsbyname='$d_getsbyname'
22174 d_getsbyport='$d_getsbyport'
22175 d_getsent='$d_getsent'
22176 d_getservbyname_r='$d_getservbyname_r'
22177 d_getservbyport_r='$d_getservbyport_r'
22178 d_getservent_r='$d_getservent_r'
22179 d_getservprotos='$d_getservprotos'
22180 d_getspnam='$d_getspnam'
22181 d_getspnam_r='$d_getspnam_r'
22182 d_gettimeod='$d_gettimeod'
22183 d_gmtime_r='$d_gmtime_r'
22184 d_gnulibc='$d_gnulibc'
22185 d_grpasswd='$d_grpasswd'
22186 d_hasmntopt='$d_hasmntopt'
22187 d_htonl='$d_htonl'
22188 d_ilogbl='$d_ilogbl'
22189 d_inc_version_list='$d_inc_version_list'
22190 d_index='$d_index'
22191 d_inetaton='$d_inetaton'
22192 d_int64_t='$d_int64_t'
22193 d_isascii='$d_isascii'
22194 d_isfinite='$d_isfinite'
22195 d_isinf='$d_isinf'
22196 d_isnan='$d_isnan'
22197 d_isnanl='$d_isnanl'
22198 d_killpg='$d_killpg'
22199 d_lchown='$d_lchown'
22200 d_ldbl_dig='$d_ldbl_dig'
22201 d_libm_lib_version='$d_libm_lib_version'
22202 d_link='$d_link'
22203 d_localtime_r='$d_localtime_r'
22204 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
22205 d_locconv='$d_locconv'
22206 d_lockf='$d_lockf'
22207 d_longdbl='$d_longdbl'
22208 d_longlong='$d_longlong'
22209 d_lseekproto='$d_lseekproto'
22210 d_lstat='$d_lstat'
22211 d_madvise='$d_madvise'
22212 d_malloc_good_size='$d_malloc_good_size'
22213 d_malloc_size='$d_malloc_size'
22214 d_mblen='$d_mblen'
22215 d_mbstowcs='$d_mbstowcs'
22216 d_mbtowc='$d_mbtowc'
22217 d_memchr='$d_memchr'
22218 d_memcmp='$d_memcmp'
22219 d_memcpy='$d_memcpy'
22220 d_memmove='$d_memmove'
22221 d_memset='$d_memset'
22222 d_mkdir='$d_mkdir'
22223 d_mkdtemp='$d_mkdtemp'
22224 d_mkfifo='$d_mkfifo'
22225 d_mkstemp='$d_mkstemp'
22226 d_mkstemps='$d_mkstemps'
22227 d_mktime='$d_mktime'
22228 d_mmap='$d_mmap'
22229 d_modfl='$d_modfl'
22230 d_modfl_pow32_bug='$d_modfl_pow32_bug'
22231 d_modflproto='$d_modflproto'
22232 d_mprotect='$d_mprotect'
22233 d_msg='$d_msg'
22234 d_msg_ctrunc='$d_msg_ctrunc'
22235 d_msg_dontroute='$d_msg_dontroute'
22236 d_msg_oob='$d_msg_oob'
22237 d_msg_peek='$d_msg_peek'
22238 d_msg_proxy='$d_msg_proxy'
22239 d_msgctl='$d_msgctl'
22240 d_msgget='$d_msgget'
22241 d_msghdr_s='$d_msghdr_s'
22242 d_msgrcv='$d_msgrcv'
22243 d_msgsnd='$d_msgsnd'
22244 d_msync='$d_msync'
22245 d_munmap='$d_munmap'
22246 d_mymalloc='$d_mymalloc'
22247 d_ndbm='$d_ndbm'
22248 d_nice='$d_nice'
22249 d_nl_langinfo='$d_nl_langinfo'
22250 d_nv_preserves_uv='$d_nv_preserves_uv'
22251 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
22252 d_off64_t='$d_off64_t'
22253 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
22254 d_oldpthreads='$d_oldpthreads'
22255 d_oldsock='$d_oldsock'
22256 d_open3='$d_open3'
22257 d_pathconf='$d_pathconf'
22258 d_pause='$d_pause'
22259 d_perl_otherlibdirs='$d_perl_otherlibdirs'
22260 d_phostname='$d_phostname'
22261 d_pipe='$d_pipe'
22262 d_poll='$d_poll'
22263 d_portable='$d_portable'
22264 d_printf_format_null='$d_printf_format_null'
22265 d_procselfexe='$d_procselfexe'
22266 d_pseudofork='$d_pseudofork'
22267 d_pthread_atfork='$d_pthread_atfork'
22268 d_pthread_attr_setscope='$d_pthread_attr_setscope'
22269 d_pthread_yield='$d_pthread_yield'
22270 d_pwage='$d_pwage'
22271 d_pwchange='$d_pwchange'
22272 d_pwclass='$d_pwclass'
22273 d_pwcomment='$d_pwcomment'
22274 d_pwexpire='$d_pwexpire'
22275 d_pwgecos='$d_pwgecos'
22276 d_pwpasswd='$d_pwpasswd'
22277 d_pwquota='$d_pwquota'
22278 d_qgcvt='$d_qgcvt'
22279 d_quad='$d_quad'
22280 d_random_r='$d_random_r'
22281 d_readdir64_r='$d_readdir64_r'
22282 d_readdir='$d_readdir'
22283 d_readdir_r='$d_readdir_r'
22284 d_readlink='$d_readlink'
22285 d_readv='$d_readv'
22286 d_recvmsg='$d_recvmsg'
22287 d_rename='$d_rename'
22288 d_rewinddir='$d_rewinddir'
22289 d_rmdir='$d_rmdir'
22290 d_safebcpy='$d_safebcpy'
22291 d_safemcpy='$d_safemcpy'
22292 d_sanemcmp='$d_sanemcmp'
22293 d_sbrkproto='$d_sbrkproto'
22294 d_scalbnl='$d_scalbnl'
22295 d_sched_yield='$d_sched_yield'
22296 d_scm_rights='$d_scm_rights'
22297 d_seekdir='$d_seekdir'
22298 d_select='$d_select'
22299 d_sem='$d_sem'
22300 d_semctl='$d_semctl'
22301 d_semctl_semid_ds='$d_semctl_semid_ds'
22302 d_semctl_semun='$d_semctl_semun'
22303 d_semget='$d_semget'
22304 d_semop='$d_semop'
22305 d_sendmsg='$d_sendmsg'
22306 d_setegid='$d_setegid'
22307 d_seteuid='$d_seteuid'
22308 d_setgrent='$d_setgrent'
22309 d_setgrent_r='$d_setgrent_r'
22310 d_setgrps='$d_setgrps'
22311 d_sethent='$d_sethent'
22312 d_sethostent_r='$d_sethostent_r'
22313 d_setitimer='$d_setitimer'
22314 d_setlinebuf='$d_setlinebuf'
22315 d_setlocale='$d_setlocale'
22316 d_setlocale_r='$d_setlocale_r'
22317 d_setnent='$d_setnent'
22318 d_setnetent_r='$d_setnetent_r'
22319 d_setpent='$d_setpent'
22320 d_setpgid='$d_setpgid'
22321 d_setpgrp2='$d_setpgrp2'
22322 d_setpgrp='$d_setpgrp'
22323 d_setprior='$d_setprior'
22324 d_setproctitle='$d_setproctitle'
22325 d_setprotoent_r='$d_setprotoent_r'
22326 d_setpwent='$d_setpwent'
22327 d_setpwent_r='$d_setpwent_r'
22328 d_setregid='$d_setregid'
22329 d_setresgid='$d_setresgid'
22330 d_setresuid='$d_setresuid'
22331 d_setreuid='$d_setreuid'
22332 d_setrgid='$d_setrgid'
22333 d_setruid='$d_setruid'
22334 d_setsent='$d_setsent'
22335 d_setservent_r='$d_setservent_r'
22336 d_setsid='$d_setsid'
22337 d_setvbuf='$d_setvbuf'
22338 d_sfio='$d_sfio'
22339 d_shm='$d_shm'
22340 d_shmat='$d_shmat'
22341 d_shmatprototype='$d_shmatprototype'
22342 d_shmctl='$d_shmctl'
22343 d_shmdt='$d_shmdt'
22344 d_shmget='$d_shmget'
22345 d_sigaction='$d_sigaction'
22346 d_signbit='$d_signbit'
22347 d_sigprocmask='$d_sigprocmask'
22348 d_sigsetjmp='$d_sigsetjmp'
22349 d_sitearch='$d_sitearch'
22350 d_snprintf='$d_snprintf'
22351 d_sockatmark='$d_sockatmark'
22352 d_sockatmarkproto='$d_sockatmarkproto'
22353 d_socket='$d_socket'
22354 d_socklen_t='$d_socklen_t'
22355 d_sockpair='$d_sockpair'
22356 d_socks5_init='$d_socks5_init'
22357 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
22358 d_sqrtl='$d_sqrtl'
22359 d_srand48_r='$d_srand48_r'
22360 d_srandom_r='$d_srandom_r'
22361 d_sresgproto='$d_sresgproto'
22362 d_sresuproto='$d_sresuproto'
22363 d_statblks='$d_statblks'
22364 d_statfs_f_flags='$d_statfs_f_flags'
22365 d_statfs_s='$d_statfs_s'
22366 d_statvfs='$d_statvfs'
22367 d_stdio_cnt_lval='$d_stdio_cnt_lval'
22368 d_stdio_ptr_lval='$d_stdio_ptr_lval'
22369 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
22370 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
22371 d_stdio_stream_array='$d_stdio_stream_array'
22372 d_stdiobase='$d_stdiobase'
22373 d_stdstdio='$d_stdstdio'
22374 d_strchr='$d_strchr'
22375 d_strcoll='$d_strcoll'
22376 d_strctcpy='$d_strctcpy'
22377 d_strerrm='$d_strerrm'
22378 d_strerror='$d_strerror'
22379 d_strerror_r='$d_strerror_r'
22380 d_strftime='$d_strftime'
22381 d_strlcat='$d_strlcat'
22382 d_strlcpy='$d_strlcpy'
22383 d_strtod='$d_strtod'
22384 d_strtol='$d_strtol'
22385 d_strtold='$d_strtold'
22386 d_strtoll='$d_strtoll'
22387 d_strtoq='$d_strtoq'
22388 d_strtoul='$d_strtoul'
22389 d_strtoull='$d_strtoull'
22390 d_strtouq='$d_strtouq'
22391 d_strxfrm='$d_strxfrm'
22392 d_suidsafe='$d_suidsafe'
22393 d_symlink='$d_symlink'
22394 d_syscall='$d_syscall'
22395 d_syscallproto='$d_syscallproto'
22396 d_sysconf='$d_sysconf'
22397 d_sysernlst='$d_sysernlst'
22398 d_syserrlst='$d_syserrlst'
22399 d_system='$d_system'
22400 d_tcgetpgrp='$d_tcgetpgrp'
22401 d_tcsetpgrp='$d_tcsetpgrp'
22402 d_telldir='$d_telldir'
22403 d_telldirproto='$d_telldirproto'
22404 d_time='$d_time'
22405 d_timegm='$d_timegm'
22406 d_times='$d_times'
22407 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
22408 d_tm_tm_zone='$d_tm_tm_zone'
22409 d_tmpnam_r='$d_tmpnam_r'
22410 d_truncate='$d_truncate'
22411 d_ttyname_r='$d_ttyname_r'
22412 d_tzname='$d_tzname'
22413 d_u32align='$d_u32align'
22414 d_ualarm='$d_ualarm'
22415 d_umask='$d_umask'
22416 d_uname='$d_uname'
22417 d_union_semun='$d_union_semun'
22418 d_unordered='$d_unordered'
22419 d_unsetenv='$d_unsetenv'
22420 d_usleep='$d_usleep'
22421 d_usleepproto='$d_usleepproto'
22422 d_ustat='$d_ustat'
22423 d_vendorarch='$d_vendorarch'
22424 d_vendorbin='$d_vendorbin'
22425 d_vendorlib='$d_vendorlib'
22426 d_vendorscript='$d_vendorscript'
22427 d_vfork='$d_vfork'
22428 d_void_closedir='$d_void_closedir'
22429 d_voidsig='$d_voidsig'
22430 d_voidtty='$d_voidtty'
22431 d_volatile='$d_volatile'
22432 d_vprintf='$d_vprintf'
22433 d_vsnprintf='$d_vsnprintf'
22434 d_wait4='$d_wait4'
22435 d_waitpid='$d_waitpid'
22436 d_wcstombs='$d_wcstombs'
22437 d_wctomb='$d_wctomb'
22438 d_writev='$d_writev'
22439 d_xenix='$d_xenix'
22440 date='$date'
22441 db_hashtype='$db_hashtype'
22442 db_prefixtype='$db_prefixtype'
22443 db_version_major='$db_version_major'
22444 db_version_minor='$db_version_minor'
22445 db_version_patch='$db_version_patch'
22446 defvoidused='$defvoidused'
22447 direntrytype='$direntrytype'
22448 dlext='$dlext'
22449 dlsrc='$dlsrc'
22450 doublesize='$doublesize'
22451 drand01='$drand01'
22452 drand48_r_proto='$drand48_r_proto'
22453 dtrace='$dtrace'
22454 dynamic_ext='$dynamic_ext'
22455 eagain='$eagain'
22456 ebcdic='$ebcdic'
22457 echo='$echo'
22458 egrep='$egrep'
22459 emacs='$emacs'
22460 endgrent_r_proto='$endgrent_r_proto'
22461 endhostent_r_proto='$endhostent_r_proto'
22462 endnetent_r_proto='$endnetent_r_proto'
22463 endprotoent_r_proto='$endprotoent_r_proto'
22464 endpwent_r_proto='$endpwent_r_proto'
22465 endservent_r_proto='$endservent_r_proto'
22466 eunicefix='$eunicefix'
22467 exe_ext='$exe_ext'
22468 expr='$expr'
22469 extensions='$extensions'
22470 extras='$extras'
22471 fflushNULL='$fflushNULL'
22472 fflushall='$fflushall'
22473 find='$find'
22474 firstmakefile='$firstmakefile'
22475 flex='$flex'
22476 fpossize='$fpossize'
22477 fpostype='$fpostype'
22478 freetype='$freetype'
22479 from='$from'
22480 full_ar='$full_ar'
22481 full_csh='$full_csh'
22482 full_sed='$full_sed'
22483 gccansipedantic='$gccansipedantic'
22484 gccosandvers='$gccosandvers'
22485 gccversion='$gccversion'
22486 getgrent_r_proto='$getgrent_r_proto'
22487 getgrgid_r_proto='$getgrgid_r_proto'
22488 getgrnam_r_proto='$getgrnam_r_proto'
22489 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22490 gethostbyname_r_proto='$gethostbyname_r_proto'
22491 gethostent_r_proto='$gethostent_r_proto'
22492 getlogin_r_proto='$getlogin_r_proto'
22493 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22494 getnetbyname_r_proto='$getnetbyname_r_proto'
22495 getnetent_r_proto='$getnetent_r_proto'
22496 getprotobyname_r_proto='$getprotobyname_r_proto'
22497 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22498 getprotoent_r_proto='$getprotoent_r_proto'
22499 getpwent_r_proto='$getpwent_r_proto'
22500 getpwnam_r_proto='$getpwnam_r_proto'
22501 getpwuid_r_proto='$getpwuid_r_proto'
22502 getservbyname_r_proto='$getservbyname_r_proto'
22503 getservbyport_r_proto='$getservbyport_r_proto'
22504 getservent_r_proto='$getservent_r_proto'
22505 getspnam_r_proto='$getspnam_r_proto'
22506 gidformat='$gidformat'
22507 gidsign='$gidsign'
22508 gidsize='$gidsize'
22509 gidtype='$gidtype'
22510 glibpth='$glibpth'
22511 gmake='$gmake'
22512 gmtime_r_proto='$gmtime_r_proto'
22513 gnulibc_version='$gnulibc_version'
22514 grep='$grep'
22515 groupcat='$groupcat'
22516 groupstype='$groupstype'
22517 gzip='$gzip'
22518 h_fcntl='$h_fcntl'
22519 h_sysfile='$h_sysfile'
22520 hint='$hint'
22521 hostcat='$hostcat'
22522 html1dir='$html1dir'
22523 html1direxp='$html1direxp'
22524 html3dir='$html3dir'
22525 html3direxp='$html3direxp'
22526 i16size='$i16size'
22527 i16type='$i16type'
22528 i32size='$i32size'
22529 i32type='$i32type'
22530 i64size='$i64size'
22531 i64type='$i64type'
22532 i8size='$i8size'
22533 i8type='$i8type'
22534 i_arpainet='$i_arpainet'
22535 i_assert='$i_assert'
22536 i_bsdioctl='$i_bsdioctl'
22537 i_crypt='$i_crypt'
22538 i_db='$i_db'
22539 i_dbm='$i_dbm'
22540 i_dirent='$i_dirent'
22541 i_dld='$i_dld'
22542 i_dlfcn='$i_dlfcn'
22543 i_fcntl='$i_fcntl'
22544 i_float='$i_float'
22545 i_fp='$i_fp'
22546 i_fp_class='$i_fp_class'
22547 i_gdbm='$i_gdbm'
22548 i_gdbm_ndbm='$i_gdbm_ndbm'
22549 i_gdbmndbm='$i_gdbmndbm'
22550 i_grp='$i_grp'
22551 i_ieeefp='$i_ieeefp'
22552 i_inttypes='$i_inttypes'
22553 i_langinfo='$i_langinfo'
22554 i_libutil='$i_libutil'
22555 i_limits='$i_limits'
22556 i_locale='$i_locale'
22557 i_machcthr='$i_machcthr'
22558 i_malloc='$i_malloc'
22559 i_mallocmalloc='$i_mallocmalloc'
22560 i_math='$i_math'
22561 i_memory='$i_memory'
22562 i_mntent='$i_mntent'
22563 i_ndbm='$i_ndbm'
22564 i_netdb='$i_netdb'
22565 i_neterrno='$i_neterrno'
22566 i_netinettcp='$i_netinettcp'
22567 i_niin='$i_niin'
22568 i_poll='$i_poll'
22569 i_prot='$i_prot'
22570 i_pthread='$i_pthread'
22571 i_pwd='$i_pwd'
22572 i_rpcsvcdbm='$i_rpcsvcdbm'
22573 i_sfio='$i_sfio'
22574 i_sgtty='$i_sgtty'
22575 i_shadow='$i_shadow'
22576 i_socks='$i_socks'
22577 i_stdarg='$i_stdarg'
22578 i_stddef='$i_stddef'
22579 i_stdlib='$i_stdlib'
22580 i_string='$i_string'
22581 i_sunmath='$i_sunmath'
22582 i_sysaccess='$i_sysaccess'
22583 i_sysdir='$i_sysdir'
22584 i_sysfile='$i_sysfile'
22585 i_sysfilio='$i_sysfilio'
22586 i_sysin='$i_sysin'
22587 i_sysioctl='$i_sysioctl'
22588 i_syslog='$i_syslog'
22589 i_sysmman='$i_sysmman'
22590 i_sysmode='$i_sysmode'
22591 i_sysmount='$i_sysmount'
22592 i_sysndir='$i_sysndir'
22593 i_sysparam='$i_sysparam'
22594 i_syspoll='$i_syspoll'
22595 i_sysresrc='$i_sysresrc'
22596 i_syssecrt='$i_syssecrt'
22597 i_sysselct='$i_sysselct'
22598 i_syssockio='$i_syssockio'
22599 i_sysstat='$i_sysstat'
22600 i_sysstatfs='$i_sysstatfs'
22601 i_sysstatvfs='$i_sysstatvfs'
22602 i_systime='$i_systime'
22603 i_systimek='$i_systimek'
22604 i_systimes='$i_systimes'
22605 i_systypes='$i_systypes'
22606 i_sysuio='$i_sysuio'
22607 i_sysun='$i_sysun'
22608 i_sysutsname='$i_sysutsname'
22609 i_sysvfs='$i_sysvfs'
22610 i_syswait='$i_syswait'
22611 i_termio='$i_termio'
22612 i_termios='$i_termios'
22613 i_time='$i_time'
22614 i_unistd='$i_unistd'
22615 i_ustat='$i_ustat'
22616 i_utime='$i_utime'
22617 i_values='$i_values'
22618 i_varargs='$i_varargs'
22619 i_varhdr='$i_varhdr'
22620 i_vfork='$i_vfork'
22621 ignore_versioned_solibs='$ignore_versioned_solibs'
22622 inc_version_list='$inc_version_list'
22623 inc_version_list_init='$inc_version_list_init'
22624 incpath='$incpath'
22625 inews='$inews'
22626 initialinstalllocation='$initialinstalllocation'
22627 installarchlib='$installarchlib'
22628 installbin='$installbin'
22629 installhtml1dir='$installhtml1dir'
22630 installhtml3dir='$installhtml3dir'
22631 installman1dir='$installman1dir'
22632 installman3dir='$installman3dir'
22633 installprefix='$installprefix'
22634 installprefixexp='$installprefixexp'
22635 installprivlib='$installprivlib'
22636 installscript='$installscript'
22637 installsitearch='$installsitearch'
22638 installsitebin='$installsitebin'
22639 installsitehtml1dir='$installsitehtml1dir'
22640 installsitehtml3dir='$installsitehtml3dir'
22641 installsitelib='$installsitelib'
22642 installsiteman1dir='$installsiteman1dir'
22643 installsiteman3dir='$installsiteman3dir'
22644 installsitescript='$installsitescript'
22645 installstyle='$installstyle'
22646 installusrbinperl='$installusrbinperl'
22647 installvendorarch='$installvendorarch'
22648 installvendorbin='$installvendorbin'
22649 installvendorhtml1dir='$installvendorhtml1dir'
22650 installvendorhtml3dir='$installvendorhtml3dir'
22651 installvendorlib='$installvendorlib'
22652 installvendorman1dir='$installvendorman1dir'
22653 installvendorman3dir='$installvendorman3dir'
22654 installvendorscript='$installvendorscript'
22655 intsize='$intsize'
22656 issymlink='$issymlink'
22657 ivdformat='$ivdformat'
22658 ivsize='$ivsize'
22659 ivtype='$ivtype'
22660 known_extensions='$known_extensions'
22661 ksh='$ksh'
22662 ld='$ld'
22663 lddlflags='$lddlflags'
22664 ldflags='$ldflags'
22665 ldflags_uselargefiles='$ldflags_uselargefiles'
22666 ldlibpthname='$ldlibpthname'
22667 less='$less'
22668 lib_ext='$lib_ext'
22669 libc='$libc'
22670 libperl='$libperl'
22671 libpth='$libpth'
22672 libs='$libs'
22673 libsdirs='$libsdirs'
22674 libsfiles='$libsfiles'
22675 libsfound='$libsfound'
22676 libspath='$libspath'
22677 libswanted='$libswanted'
22678 libswanted_uselargefiles='$libswanted_uselargefiles'
22679 line='$line'
22680 lint='$lint'
22681 lkflags='$lkflags'
22682 ln='$ln'
22683 lns='$lns'
22684 localtime_r_proto='$localtime_r_proto'
22685 locincpth='$locincpth'
22686 loclibpth='$loclibpth'
22687 longdblsize='$longdblsize'
22688 longlongsize='$longlongsize'
22689 longsize='$longsize'
22690 lp='$lp'
22691 lpr='$lpr'
22692 ls='$ls'
22693 lseeksize='$lseeksize'
22694 lseektype='$lseektype'
22695 mad='$mad'
22696 madlyh='$madlyh'
22697 madlyobj='$madlyobj'
22698 madlysrc='$madlysrc'
22699 mail='$mail'
22700 mailx='$mailx'
22701 make='$make'
22702 make_set_make='$make_set_make'
22703 mallocobj='$mallocobj'
22704 mallocsrc='$mallocsrc'
22705 malloctype='$malloctype'
22706 man1dir='$man1dir'
22707 man1direxp='$man1direxp'
22708 man1ext='$man1ext'
22709 man3dir='$man3dir'
22710 man3direxp='$man3direxp'
22711 man3ext='$man3ext'
22712 mips_type='$mips_type'
22713 mistrustnm='$mistrustnm'
22714 mkdir='$mkdir'
22715 mmaptype='$mmaptype'
22716 modetype='$modetype'
22717 more='$more'
22718 multiarch='$multiarch'
22719 mv='$mv'
22720 myarchname='$myarchname'
22721 mydomain='$mydomain'
22722 myhostname='$myhostname'
22723 myuname='$myuname'
22724 n='$n'
22725 need_va_copy='$need_va_copy'
22726 netdb_hlen_type='$netdb_hlen_type'
22727 netdb_host_type='$netdb_host_type'
22728 netdb_name_type='$netdb_name_type'
22729 netdb_net_type='$netdb_net_type'
22730 nm='$nm'
22731 nm_opt='$nm_opt'
22732 nm_so_opt='$nm_so_opt'
22733 nonxs_ext='$nonxs_ext'
22734 nroff='$nroff'
22735 nvEUformat='$nvEUformat'
22736 nvFUformat='$nvFUformat'
22737 nvGUformat='$nvGUformat'
22738 nv_overflows_integers_at='$nv_overflows_integers_at'
22739 nv_preserves_uv_bits='$nv_preserves_uv_bits'
22740 nveformat='$nveformat'
22741 nvfformat='$nvfformat'
22742 nvgformat='$nvgformat'
22743 nvsize='$nvsize'
22744 nvtype='$nvtype'
22745 o_nonblock='$o_nonblock'
22746 obj_ext='$obj_ext'
22747 old_pthread_create_joinable='$old_pthread_create_joinable'
22748 optimize='$optimize'
22749 orderlib='$orderlib'
22750 osname='$osname'
22751 osvers='$osvers'
22752 otherlibdirs='$otherlibdirs'
22753 package='$package'
22754 pager='$pager'
22755 passcat='$passcat'
22756 patchlevel='$patchlevel'
22757 path_sep='$path_sep'
22758 perl5='$perl5'
22759 perl='$perl'
22760 perl_patchlevel='$perl_patchlevel'
22761 perladmin='$perladmin'
22762 perllibs='$perllibs'
22763 perlpath='$perlpath'
22764 pg='$pg'
22765 phostname='$phostname'
22766 pidtype='$pidtype'
22767 plibpth='$plibpth'
22768 pmake='$pmake'
22769 pr='$pr'
22770 prefix='$prefix'
22771 prefixexp='$prefixexp'
22772 privlib='$privlib'
22773 privlibexp='$privlibexp'
22774 procselfexe='$procselfexe'
22775 prototype='$prototype'
22776 ptrsize='$ptrsize'
22777 quadkind='$quadkind'
22778 quadtype='$quadtype'
22779 randbits='$randbits'
22780 randfunc='$randfunc'
22781 random_r_proto='$random_r_proto'
22782 randseedtype='$randseedtype'
22783 ranlib='$ranlib'
22784 rd_nodata='$rd_nodata'
22785 readdir64_r_proto='$readdir64_r_proto'
22786 readdir_r_proto='$readdir_r_proto'
22787 revision='$revision'
22788 rm='$rm'
22789 rm_try='$rm_try'
22790 rmail='$rmail'
22791 run='$run'
22792 runnm='$runnm'
22793 sGMTIME_max='$sGMTIME_max'
22794 sGMTIME_min='$sGMTIME_min'
22795 sLOCALTIME_max='$sLOCALTIME_max'
22796 sLOCALTIME_min='$sLOCALTIME_min'
22797 sPRIEUldbl='$sPRIEUldbl'
22798 sPRIFUldbl='$sPRIFUldbl'
22799 sPRIGUldbl='$sPRIGUldbl'
22800 sPRIXU64='$sPRIXU64'
22801 sPRId64='$sPRId64'
22802 sPRIeldbl='$sPRIeldbl'
22803 sPRIfldbl='$sPRIfldbl'
22804 sPRIgldbl='$sPRIgldbl'
22805 sPRIi64='$sPRIi64'
22806 sPRIo64='$sPRIo64'
22807 sPRIu64='$sPRIu64'
22808 sPRIx64='$sPRIx64'
22809 sSCNfldbl='$sSCNfldbl'
22810 sched_yield='$sched_yield'
22811 scriptdir='$scriptdir'
22812 scriptdirexp='$scriptdirexp'
22813 sed='$sed'
22814 seedfunc='$seedfunc'
22815 selectminbits='$selectminbits'
22816 selecttype='$selecttype'
22817 sendmail='$sendmail'
22818 setgrent_r_proto='$setgrent_r_proto'
22819 sethostent_r_proto='$sethostent_r_proto'
22820 setlocale_r_proto='$setlocale_r_proto'
22821 setnetent_r_proto='$setnetent_r_proto'
22822 setprotoent_r_proto='$setprotoent_r_proto'
22823 setpwent_r_proto='$setpwent_r_proto'
22824 setservent_r_proto='$setservent_r_proto'
22825 sh='$sh'
22826 shar='$shar'
22827 sharpbang='$sharpbang'
22828 shmattype='$shmattype'
22829 shortsize='$shortsize'
22830 shrpenv='$shrpenv'
22831 shsharp='$shsharp'
22832 sig_count='$sig_count'
22833 sig_name='$sig_name'
22834 sig_name_init='$sig_name_init'
22835 sig_num='$sig_num'
22836 sig_num_init='$sig_num_init'
22837 sig_size='$sig_size'
22838 signal_t='$signal_t'
22839 sitearch='$sitearch'
22840 sitearchexp='$sitearchexp'
22841 sitebin='$sitebin'
22842 sitebinexp='$sitebinexp'
22843 sitehtml1dir='$sitehtml1dir'
22844 sitehtml1direxp='$sitehtml1direxp'
22845 sitehtml3dir='$sitehtml3dir'
22846 sitehtml3direxp='$sitehtml3direxp'
22847 sitelib='$sitelib'
22848 sitelib_stem='$sitelib_stem'
22849 sitelibexp='$sitelibexp'
22850 siteman1dir='$siteman1dir'
22851 siteman1direxp='$siteman1direxp'
22852 siteman3dir='$siteman3dir'
22853 siteman3direxp='$siteman3direxp'
22854 siteprefix='$siteprefix'
22855 siteprefixexp='$siteprefixexp'
22856 sitescript='$sitescript'
22857 sitescriptexp='$sitescriptexp'
22858 sizesize='$sizesize'
22859 sizetype='$sizetype'
22860 sleep='$sleep'
22861 smail='$smail'
22862 so='$so'
22863 sockethdr='$sockethdr'
22864 socketlib='$socketlib'
22865 socksizetype='$socksizetype'
22866 sort='$sort'
22867 spackage='$spackage'
22868 spitshell='$spitshell'
22869 srand48_r_proto='$srand48_r_proto'
22870 srandom_r_proto='$srandom_r_proto'
22871 src='$src'
22872 ssizetype='$ssizetype'
22873 startperl='$startperl'
22874 startsh='$startsh'
22875 static_ext='$static_ext'
22876 stdchar='$stdchar'
22877 stdio_base='$stdio_base'
22878 stdio_bufsiz='$stdio_bufsiz'
22879 stdio_cnt='$stdio_cnt'
22880 stdio_filbuf='$stdio_filbuf'
22881 stdio_ptr='$stdio_ptr'
22882 stdio_stream_array='$stdio_stream_array'
22883 strerror_r_proto='$strerror_r_proto'
22884 strings='$strings'
22885 submit='$submit'
22886 subversion='$subversion'
22887 sysman='$sysman'
22888 tail='$tail'
22889 tar='$tar'
22890 targetarch='$targetarch'
22891 tbl='$tbl'
22892 tee='$tee'
22893 test='$test'
22894 timeincl='$timeincl'
22895 timetype='$timetype'
22896 tmpnam_r_proto='$tmpnam_r_proto'
22897 to='$to'
22898 touch='$touch'
22899 tr='$tr'
22900 trnl='$trnl'
22901 troff='$troff'
22902 ttyname_r_proto='$ttyname_r_proto'
22903 u16size='$u16size'
22904 u16type='$u16type'
22905 u32size='$u32size'
22906 u32type='$u32type'
22907 u64size='$u64size'
22908 u64type='$u64type'
22909 u8size='$u8size'
22910 u8type='$u8type'
22911 uidformat='$uidformat'
22912 uidsign='$uidsign'
22913 uidsize='$uidsize'
22914 uidtype='$uidtype'
22915 uname='$uname'
22916 uniq='$uniq'
22917 uquadtype='$uquadtype'
22918 use5005threads='$use5005threads'
22919 use64bitall='$use64bitall'
22920 use64bitint='$use64bitint'
22921 usecrosscompile='$usecrosscompile'
22922 usedl='$usedl'
22923 usedtrace='$usedtrace'
22924 usefaststdio='$usefaststdio'
22925 useithreads='$useithreads'
22926 uselargefiles='$uselargefiles'
22927 uselongdouble='$uselongdouble'
22928 usemallocwrap='$usemallocwrap'
22929 usemorebits='$usemorebits'
22930 usemultiplicity='$usemultiplicity'
22931 usemymalloc='$usemymalloc'
22932 usenm='$usenm'
22933 useopcode='$useopcode'
22934 useperlio='$useperlio'
22935 useposix='$useposix'
22936 usereentrant='$usereentrant'
22937 userelocatableinc='$userelocatableinc'
22938 usesfio='$usesfio'
22939 useshrplib='$useshrplib'
22940 usesitecustomize='$usesitecustomize'
22941 usesocks='$usesocks'
22942 usethreads='$usethreads'
22943 usevendorprefix='$usevendorprefix'
22944 usevfork='$usevfork'
22945 usrinc='$usrinc'
22946 uuname='$uuname'
22947 uvXUformat='$uvXUformat'
22948 uvoformat='$uvoformat'
22949 uvsize='$uvsize'
22950 uvtype='$uvtype'
22951 uvuformat='$uvuformat'
22952 uvxformat='$uvxformat'
22953 vendorarch='$vendorarch'
22954 vendorarchexp='$vendorarchexp'
22955 vendorbin='$vendorbin'
22956 vendorbinexp='$vendorbinexp'
22957 vendorhtml1dir='$vendorhtml1dir'
22958 vendorhtml1direxp='$vendorhtml1direxp'
22959 vendorhtml3dir='$vendorhtml3dir'
22960 vendorhtml3direxp='$vendorhtml3direxp'
22961 vendorlib='$vendorlib'
22962 vendorlib_stem='$vendorlib_stem'
22963 vendorlibexp='$vendorlibexp'
22964 vendorman1dir='$vendorman1dir'
22965 vendorman1direxp='$vendorman1direxp'
22966 vendorman3dir='$vendorman3dir'
22967 vendorman3direxp='$vendorman3direxp'
22968 vendorprefix='$vendorprefix'
22969 vendorprefixexp='$vendorprefixexp'
22970 vendorscript='$vendorscript'
22971 vendorscriptexp='$vendorscriptexp'
22972 version='$version'
22973 version_patchlevel_string='$version_patchlevel_string'
22974 versiononly='$versiononly'
22975 vi='$vi'
22976 voidflags='$voidflags'
22977 xlibpth='$xlibpth'
22978 yacc='$yacc'
22979 yaccflags='$yaccflags'
22980 zcat='$zcat'
22981 zip='$zip'
22982 EOT
22983
22984 : Add in command line options if available
22985 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22986
22987 : add special variables
22988 $test -f $src/patchlevel.h && \
22989 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22990 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22991 echo "PERL_CONFIG_SH=true" >>config.sh
22992
22993 : propagate old symbols
22994 if $test -f UU/config.sh; then
22995         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22996         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
22997                 config.sh config.sh UU/oldconfig.sh |\
22998                 $sort | $uniq -u >UU/oldsyms
22999         set X `cat UU/oldsyms`
23000         shift
23001         case $# in
23002         0) ;;
23003         *)
23004                 cat <<EOM
23005 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23006 EOM
23007                 echo ": Variables propagated from previous config.sh file." >>config.sh
23008                 for sym in `cat UU/oldsyms`; do
23009                         echo "    Propagating $hint variable "'$'"$sym..."
23010                         eval 'tmp="$'"${sym}"'"'
23011                         echo "$tmp" | \
23012                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23013                 done
23014                 ;;
23015         esac
23016 fi
23017
23018 : Finish up by extracting the .SH files
23019 case "$alldone" in
23020 exit)
23021         $rm -rf UU
23022         echo "Extraction done."
23023         exit 0
23024         ;;
23025 cont)
23026         ;;
23027 '')
23028         dflt=''
23029         nostick=true
23030         $cat <<EOM
23031
23032 If you'd like to make any changes to the config.sh file before I begin
23033 to configure things, do it as a shell escape now (e.g. !vi config.sh).
23034
23035 EOM
23036         rp="Press return or use a shell escape to edit config.sh:"
23037         . UU/myread
23038         nostick=''
23039         case "$ans" in
23040         '') ;;
23041         *) : in case they cannot read
23042                 sh 1>&4 -c "$ans";;
23043         esac
23044         ;;
23045 esac
23046
23047 : if this fails, just run all the .SH files by hand
23048 . ./config.sh
23049
23050 echo " "
23051 exec 1>&4
23052 pwd=`pwd`
23053 . ./UU/extract
23054 cd "$pwd"
23055
23056 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
23057         dflt=y
23058         case "$silent" in
23059         true) ;;
23060         *)
23061                 $cat <<EOM
23062
23063 Now you need to generate make dependencies by running "$make depend".
23064 You might prefer to run it in background: "$make depend > makedepend.out &"
23065 It can take a while, so you might not want to run it right now.
23066
23067 EOM
23068                 ;;
23069         esac
23070         rp="Run $make depend now?"
23071         . UU/myread
23072         case "$ans" in
23073         y*)
23074                 $make depend && echo "Now you must run '$make'."
23075                 ;;
23076         *)
23077                 echo "You must run '$make depend' then '$make'."
23078                 ;;
23079         esac
23080 elif test -f [Mm]akefile; then
23081         echo " "
23082         echo "Now you must run a $make."
23083 else
23084         echo "Configure done."
23085 fi
23086
23087 if $test -f Policy.sh; then
23088     $cat <<EOM
23089
23090 If you compile $package on a different machine or from a different object
23091 directory, copy the Policy.sh file from this object directory to the
23092 new one before you run Configure -- this will help you with most of
23093 the policy defaults.
23094
23095 EOM
23096 fi
23097 if $test -f config.msg; then
23098     echo "Hmm.  I also noted the following information while running:"
23099     echo " "
23100     $cat config.msg >&4
23101     $rm -f config.msg
23102 fi
23103 $rm -f kit*isdone ark*isdone
23104 $rm -rf UU
23105
23106 : End of Configure
23107