2cebb0cc4992c04627558655bc9d71cbac4d54d2
[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-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20 #
21 # Though this script was generated by metaconfig, it is OK to send
22 # patches against it. It's up to the Configure pumpkin to backport
23 # the patch to the metaunits if it is accepted.
24 # See Porting/pumpkin.pod for more information on metaconfig.
25 #
26
27 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
28 #
29 # Generated on Wed Mar  8 09:08:03 CET 2006 [metaconfig 3.0 PL70]
30 # (with additional metaconfig patches by perlbug@perl.org)
31
32 cat >c1$$ <<EOF
33 ARGGGHHHH!!!!!
34
35 SCO csh still thinks true is false.  Write to SCO today and tell them that next
36 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
37
38 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
39 we'd have to do is go in and swap the && and || tokens, wherever they are.)
40
41 [End of diatribe. We now return you to your regularly scheduled programming...]
42 EOF
43 cat >c2$$ <<EOF
44
45 OOPS!  You naughty creature!  You didn't run Configure with sh!
46 I will attempt to remedy the situation by running sh for you...
47 EOF
48
49 true || cat c1$$ c2$$
50 true || exec sh $0 $argv:q
51
52 (exit $?0) || cat c2$$
53 (exit $?0) || exec sh $0 $argv:q
54 rm -f c1$$ c2$$
55
56 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
57         cat >&4 <<EOF
58 ***
59 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
60 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
61 *** Please read the README.plan9 for further instructions.
62 *** Cannot continue, aborting.
63 ***
64 EOF
65         exit 1
66 fi
67
68 : compute my invocation name
69 me=$0
70 case "$0" in
71 */*)
72         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
73         test "$me" || me=$0
74         ;;
75 esac
76
77 : Proper separator for the PATH environment variable
78 p_=:
79 : On OS/2 this directory should exist if this is not floppy only system :-]
80 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
81     if test -n "$OS2_SHELL"; then
82                 p_=\;
83                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
84                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
85                 is_os2=yes
86         elif test -n "$DJGPP"; then
87                 case "X${MACHTYPE:-nonesuchmach}" in
88                 *cygwin) ;;
89                 *) p_=\; ;;
90                 esac
91         fi
92 fi
93
94 : Proper PATH setting
95 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
96 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
97 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
98 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
99 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
100 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
101 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
102 paths="$paths /sbin /usr/sbin /usr/libexec"
103 paths="$paths /system/gnu_library/bin"
104
105 for p in $paths
106 do
107         case "$p_$PATH$p_" in
108         *$p_$p$p_*) ;;
109         *) test -d $p && PATH=$PATH$p_$p ;;
110         esac
111 done
112
113 PATH=.$p_$PATH
114 export PATH
115
116 : shall we be using ksh?
117 inksh=''
118 needksh=''
119 avoidksh=''
120 newsh=/bin/ksh
121 changesh=''
122 if (PATH=.; alias -x) >/dev/null 2>&1; then
123                 inksh=true
124 fi
125 if test -f /hp-ux -a -f /bin/ksh; then
126         needksh='to avoid sh bug in "here document" expansion'
127 fi
128 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
129         if test X`/usr/bin/uname -v` = X4; then
130                 avoidksh="to avoid AIX 4's /bin/sh"
131                 newsh=/usr/bin/bsh
132         fi
133 fi
134 if test -f /osf_boot -a -f /usr/sbin/setld; then
135         if test X`/usr/bin/uname -s` = XOSF1; then
136                 avoidksh="to avoid Digital UNIX' ksh"
137                 newsh=/bin/sh
138                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
139         fi
140 fi
141 case "$inksh/$needksh" in
142 /[a-z]*)
143                 ENV=''
144                 changesh=true
145                 reason="$needksh"
146         ;;
147 esac
148 case "$inksh/$avoidksh" in
149 true/[a-z]*)
150         changesh=true
151         reason="$avoidksh"
152         ;;
153 esac
154 case "$inksh/$needksh-$avoidksh-" in
155 true/--)
156                 cat <<EOM
157 (I see you are using the Korn shell.  Some ksh's blow up on $me,
158 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
159 EOM
160         ;;
161 esac
162 case "$changesh" in
163 true)
164         export newsh
165         echo "(Feeding myself to $newsh $reason.)"
166         case "$0" in
167         Configure|*/Configure) exec $newsh $0 "$@";;
168         *) exec $newsh Configure "$@";;
169         esac
170         ;;
171 esac
172
173 : if needed set CDPATH to a harmless value that is not chatty
174 : avoid bash 2.02 problems with empty CDPATH.
175 case "$CDPATH" in
176 '')     ;;
177 *)      case "$SHELL" in
178         *bash*) CDPATH='.' ;;
179         *)              CDPATH='' ;;
180         esac
181         ;;
182 esac
183 : Configure runs within the UU subdirectory
184 test -d UU || mkdir UU
185 cd UU && rm -f ./*
186
187 ccname=''
188 ccversion=''
189 ccsymbols=''
190 cppccsymbols=''
191 cppsymbols=''
192 from=''
193 run=''
194 targetarch=''
195 to=''
196 usecrosscompile=''
197 mistrustnm=''
198 perllibs=''
199 dynamic_ext=''
200 extensions=''
201 known_extensions=''
202 nonxs_ext=''
203 static_ext=''
204 useopcode=''
205 useposix=''
206 extras=''
207 d_bsd=''
208 d_eunice=''
209 d_xenix=''
210 eunicefix=''
211 Mcc=''
212 ar=''
213 awk=''
214 bash=''
215 bison=''
216 byacc=''
217 cat=''
218 chgrp=''
219 chmod=''
220 chown=''
221 comm=''
222 compress=''
223 cp=''
224 cpio=''
225 cpp=''
226 csh=''
227 date=''
228 echo=''
229 egrep=''
230 emacs=''
231 expr=''
232 find=''
233 flex=''
234 gmake=''
235 grep=''
236 gzip=''
237 inews=''
238 ksh=''
239 less=''
240 line=''
241 lint=''
242 ln=''
243 lp=''
244 lpr=''
245 ls=''
246 mail=''
247 mailx=''
248 make=''
249 mkdir=''
250 more=''
251 mv=''
252 nm=''
253 nroff=''
254 perl=''
255 pg=''
256 pmake=''
257 pr=''
258 rm=''
259 rmail=''
260 sed=''
261 sendmail=''
262 shar=''
263 sleep=''
264 smail=''
265 sort=''
266 submit=''
267 tail=''
268 tar=''
269 tbl=''
270 tee=''
271 test=''
272 touch=''
273 tr=''
274 troff=''
275 uname=''
276 uniq=''
277 uuname=''
278 vi=''
279 zcat=''
280 zip=''
281 full_ar=''
282 full_sed=''
283 libswanted=''
284 hint=''
285 myuname=''
286 osname=''
287 osvers=''
288 Author=''
289 Date=''
290 Header=''
291 Id=''
292 Locker=''
293 Log=''
294 RCSfile=''
295 Revision=''
296 Source=''
297 State=''
298 _a=''
299 _exe=''
300 _o=''
301 archobjs=''
302 exe_ext=''
303 firstmakefile=''
304 lib_ext=''
305 obj_ext=''
306 path_sep=''
307 afs=''
308 afsroot=''
309 alignbytes=''
310 ansi2knr=''
311 archlib=''
312 archlibexp=''
313 d_archlib=''
314 installarchlib=''
315 archname=''
316 myarchname=''
317 d_atolf=''
318 d_atoll=''
319 baserev=''
320 bin=''
321 binexp=''
322 installbin=''
323 byteorder=''
324 cc=''
325 ccflags=''
326 cppflags=''
327 ldflags=''
328 lkflags=''
329 locincpth=''
330 optimize=''
331 cf_email=''
332 cf_by=''
333 cf_time=''
334 charsize=''
335 contains=''
336 cpp_stuff=''
337 cpplast=''
338 cppminus=''
339 cpprun=''
340 cppstdin=''
341 d__fwalk=''
342 d_access=''
343 d_accessx=''
344 d_aintl=''
345 d_alarm=''
346 asctime_r_proto=''
347 d_asctime_r=''
348 d_attribute_format=''
349 d_attribute_malloc=''
350 d_attribute_nonnull=''
351 d_attribute_noreturn=''
352 d_attribute_pure=''
353 d_attribute_unused=''
354 d_attribute_warn_unused_result=''
355 d_bcmp=''
356 d_bcopy=''
357 d_builtin_choose_expr=''
358 d_builtin_expect=''
359 d_bzero=''
360 d_casti32=''
361 castflags=''
362 d_castneg=''
363 d_chown=''
364 d_chroot=''
365 d_chsize=''
366 d_class=''
367 d_clearenv=''
368 d_closedir=''
369 d_void_closedir=''
370 d_cmsghdr_s=''
371 d_const=''
372 d_copysignl=''
373 cryptlib=''
374 d_crypt=''
375 crypt_r_proto=''
376 d_crypt_r=''
377 d_csh=''
378 full_csh=''
379 ctermid_r_proto=''
380 d_ctermid_r=''
381 ctime_r_proto=''
382 d_ctime_r=''
383 d_cuserid=''
384 d_dbl_dig=''
385 d_dbminitproto=''
386 d_difftime=''
387 d_dirfd=''
388 d_dlerror=''
389 d_dlopen=''
390 d_dlsymun=''
391 d_dosuid=''
392 d_suidsafe=''
393 d_drand48_r=''
394 drand48_r_proto=''
395 d_drand48proto=''
396 d_dup2=''
397 d_eaccess=''
398 d_endgrent=''
399 d_endgrent_r=''
400 endgrent_r_proto=''
401 d_endhent=''
402 d_endhostent_r=''
403 endhostent_r_proto=''
404 d_endnent=''
405 d_endnetent_r=''
406 endnetent_r_proto=''
407 d_endpent=''
408 d_endprotoent_r=''
409 endprotoent_r_proto=''
410 d_endpwent=''
411 d_endpwent_r=''
412 endpwent_r_proto=''
413 d_endsent=''
414 d_endservent_r=''
415 endservent_r_proto=''
416 d_faststdio=''
417 d_fchdir=''
418 d_fchmod=''
419 d_fchown=''
420 d_fcntl=''
421 d_fcntl_can_lock=''
422 d_fd_macros=''
423 d_fd_set=''
424 d_fds_bits=''
425 d_fgetpos=''
426 d_finite=''
427 d_finitel=''
428 d_flexfnam=''
429 d_flock=''
430 d_flockproto=''
431 d_fork=''
432 d_fp_class=''
433 d_fpclass=''
434 d_fpclassify=''
435 d_fpclassl=''
436 d_fpos64_t=''
437 d_frexpl=''
438 d_fs_data_s=''
439 d_fseeko=''
440 d_fsetpos=''
441 d_fstatfs=''
442 d_fsync=''
443 d_ftello=''
444 d_ftime=''
445 d_gettimeod=''
446 d_futimes=''
447 d_Gconvert=''
448 d_getcwd=''
449 d_getespwnam=''
450 d_getfsstat=''
451 d_getgrent=''
452 d_getgrent_r=''
453 getgrent_r_proto=''
454 d_getgrgid_r=''
455 getgrgid_r_proto=''
456 d_getgrnam_r=''
457 getgrnam_r_proto=''
458 d_getgrps=''
459 d_gethbyaddr=''
460 d_gethbyname=''
461 d_gethent=''
462 aphostname=''
463 d_gethname=''
464 d_phostname=''
465 d_uname=''
466 d_gethostbyaddr_r=''
467 gethostbyaddr_r_proto=''
468 d_gethostbyname_r=''
469 gethostbyname_r_proto=''
470 d_gethostent_r=''
471 gethostent_r_proto=''
472 d_gethostprotos=''
473 d_getitimer=''
474 d_getlogin=''
475 d_getlogin_r=''
476 getlogin_r_proto=''
477 d_getmnt=''
478 d_getmntent=''
479 d_getnbyaddr=''
480 d_getnbyname=''
481 d_getnent=''
482 d_getnetbyaddr_r=''
483 getnetbyaddr_r_proto=''
484 d_getnetbyname_r=''
485 getnetbyname_r_proto=''
486 d_getnetent_r=''
487 getnetent_r_proto=''
488 d_getnetprotos=''
489 d_getpagsz=''
490 d_getpent=''
491 d_getpgid=''
492 d_getpgrp2=''
493 d_bsdgetpgrp=''
494 d_getpgrp=''
495 d_getppid=''
496 d_getprior=''
497 d_getpbyname=''
498 d_getpbynumber=''
499 d_getprotobyname_r=''
500 getprotobyname_r_proto=''
501 d_getprotobynumber_r=''
502 getprotobynumber_r_proto=''
503 d_getprotoent_r=''
504 getprotoent_r_proto=''
505 d_getprotoprotos=''
506 d_getprpwnam=''
507 d_getpwent=''
508 d_getpwent_r=''
509 getpwent_r_proto=''
510 d_getpwnam_r=''
511 getpwnam_r_proto=''
512 d_getpwuid_r=''
513 getpwuid_r_proto=''
514 d_getsent=''
515 d_getservbyname_r=''
516 getservbyname_r_proto=''
517 d_getservbyport_r=''
518 getservbyport_r_proto=''
519 d_getservent_r=''
520 getservent_r_proto=''
521 d_getservprotos=''
522 d_getspnam=''
523 d_getspnam_r=''
524 getspnam_r_proto=''
525 d_getsbyname=''
526 d_getsbyport=''
527 d_gmtime_r=''
528 gmtime_r_proto=''
529 d_gnulibc=''
530 gnulibc_version=''
531 d_hasmntopt=''
532 d_htonl=''
533 d_ilogbl=''
534 d_inetaton=''
535 d_int64_t=''
536 d_isascii=''
537 d_isfinite=''
538 d_isinf=''
539 d_isnan=''
540 d_isnanl=''
541 d_killpg=''
542 d_lchown=''
543 d_ldbl_dig=''
544 d_libm_lib_version=''
545 d_link=''
546 d_localtime_r=''
547 localtime_r_proto=''
548 d_locconv=''
549 d_lockf=''
550 d_longdbl=''
551 longdblsize=''
552 d_longlong=''
553 longlongsize=''
554 d_lseekproto=''
555 d_lstat=''
556 d_madvise=''
557 d_malloc_good_size=''
558 d_malloc_size=''
559 d_mblen=''
560 d_mbstowcs=''
561 d_mbtowc=''
562 d_memchr=''
563 d_memcmp=''
564 d_memcpy=''
565 d_memmove=''
566 d_memset=''
567 d_mkdir=''
568 d_mkdtemp=''
569 d_mkfifo=''
570 d_mkstemp=''
571 d_mkstemps=''
572 d_mktime=''
573 d_mmap=''
574 mmaptype=''
575 d_modfl=''
576 d_modfl_pow32_bug=''
577 d_modflproto=''
578 d_mprotect=''
579 d_msg=''
580 d_msgctl=''
581 d_msgget=''
582 d_msghdr_s=''
583 d_msgrcv=''
584 d_msgsnd=''
585 d_msync=''
586 d_munmap=''
587 d_nice=''
588 d_nl_langinfo=''
589 d_off64_t=''
590 d_open3=''
591 d_fpathconf=''
592 d_pathconf=''
593 d_pause=''
594 d_pipe=''
595 d_poll=''
596 d_portable=''
597 d_procselfexe=''
598 procselfexe=''
599 d_old_pthread_create_joinable=''
600 old_pthread_create_joinable=''
601 d_pthread_atfork=''
602 d_pthread_attr_setscope=''
603 d_pthread_yield=''
604 d_sched_yield=''
605 sched_yield=''
606 d_qgcvt=''
607 d_random_r=''
608 random_r_proto=''
609 d_readdir64_r=''
610 readdir64_r_proto=''
611 d_readdir=''
612 d_rewinddir=''
613 d_seekdir=''
614 d_telldir=''
615 d_readdir_r=''
616 readdir_r_proto=''
617 d_readlink=''
618 d_readv=''
619 d_recvmsg=''
620 d_rename=''
621 d_rmdir=''
622 d_safebcpy=''
623 d_safemcpy=''
624 d_sanemcmp=''
625 d_sbrkproto=''
626 d_scalbnl=''
627 d_select=''
628 d_sem=''
629 d_semctl=''
630 d_semget=''
631 d_semop=''
632 d_sendmsg=''
633 d_setegid=''
634 d_seteuid=''
635 d_setgrent=''
636 d_setgrent_r=''
637 setgrent_r_proto=''
638 d_setgrps=''
639 d_sethent=''
640 d_sethostent_r=''
641 sethostent_r_proto=''
642 d_setitimer=''
643 d_setlinebuf=''
644 d_setlocale=''
645 d_setlocale_r=''
646 setlocale_r_proto=''
647 d_setnent=''
648 d_setnetent_r=''
649 setnetent_r_proto=''
650 d_setpent=''
651 d_setpgid=''
652 d_setpgrp2=''
653 d_bsdsetpgrp=''
654 d_setpgrp=''
655 d_setprior=''
656 d_setproctitle=''
657 d_setprotoent_r=''
658 setprotoent_r_proto=''
659 d_setpwent=''
660 d_setpwent_r=''
661 setpwent_r_proto=''
662 d_setregid=''
663 d_setresgid=''
664 d_setresuid=''
665 d_setreuid=''
666 d_setrgid=''
667 d_setruid=''
668 d_setsent=''
669 d_setservent_r=''
670 setservent_r_proto=''
671 d_setsid=''
672 d_setvbuf=''
673 d_sfio=''
674 usesfio=''
675 d_shm=''
676 d_shmat=''
677 d_shmatprototype=''
678 shmattype=''
679 d_shmctl=''
680 d_shmdt=''
681 d_shmget=''
682 d_sigaction=''
683 d_sigprocmask=''
684 d_sigsetjmp=''
685 usesitecustomize=''
686 d_snprintf=''
687 d_vsnprintf=''
688 d_sockatmark=''
689 d_sockatmarkproto=''
690 d_msg_ctrunc=''
691 d_msg_dontroute=''
692 d_msg_oob=''
693 d_msg_peek=''
694 d_msg_proxy=''
695 d_oldsock=''
696 d_scm_rights=''
697 d_socket=''
698 d_sockpair=''
699 sockethdr=''
700 socketlib=''
701 d_socklen_t=''
702 d_socks5_init=''
703 d_sprintf_returns_strlen=''
704 d_sqrtl=''
705 d_srand48_r=''
706 srand48_r_proto=''
707 d_srandom_r=''
708 srandom_r_proto=''
709 d_sresgproto=''
710 d_sresuproto=''
711 d_statblks=''
712 d_statfs_f_flags=''
713 d_statfs_s=''
714 d_fstatvfs=''
715 d_statvfs=''
716 d_stdio_cnt_lval=''
717 d_stdio_ptr_lval=''
718 d_stdio_ptr_lval_nochange_cnt=''
719 d_stdio_ptr_lval_sets_cnt=''
720 d_stdiobase=''
721 d_stdstdio=''
722 stdio_base=''
723 stdio_bufsiz=''
724 stdio_cnt=''
725 stdio_filbuf=''
726 stdio_ptr=''
727 d_index=''
728 d_strchr=''
729 d_strcoll=''
730 d_strctcpy=''
731 d_strerrm=''
732 d_strerror=''
733 d_sysernlst=''
734 d_syserrlst=''
735 d_strerror_r=''
736 strerror_r_proto=''
737 d_strftime=''
738 d_strlcat=''
739 d_strlcpy=''
740 d_strtod=''
741 d_strtol=''
742 d_strtold=''
743 d_strtoll=''
744 d_strtoq=''
745 d_strtoul=''
746 d_strtoull=''
747 d_strtouq=''
748 d_strxfrm=''
749 d_symlink=''
750 d_syscall=''
751 d_syscallproto=''
752 d_sysconf=''
753 d_system=''
754 d_tcgetpgrp=''
755 d_tcsetpgrp=''
756 d_telldirproto=''
757 d_time=''
758 timetype=''
759 clocktype=''
760 d_times=''
761 d_tmpnam_r=''
762 tmpnam_r_proto=''
763 d_truncate=''
764 d_ttyname_r=''
765 ttyname_r_proto=''
766 d_tzname=''
767 d_u32align=''
768 d_ualarm=''
769 d_umask=''
770 d_semctl_semid_ds=''
771 d_semctl_semun=''
772 d_union_semun=''
773 d_unordered=''
774 d_unsetenv=''
775 d_usleep=''
776 d_usleepproto=''
777 d_ustat=''
778 d_vfork=''
779 usevfork=''
780 d_voidsig=''
781 signal_t=''
782 d_volatile=''
783 d_charvspr=''
784 d_vprintf=''
785 d_wait4=''
786 d_waitpid=''
787 d_wcstombs=''
788 d_wctomb=''
789 d_writev=''
790 dlext=''
791 cccdlflags=''
792 ccdlflags=''
793 dlsrc=''
794 ld=''
795 lddlflags=''
796 usedl=''
797 doublesize=''
798 ebcdic=''
799 fflushNULL=''
800 fflushall=''
801 fpossize=''
802 fpostype=''
803 gccansipedantic=''
804 gccosandvers=''
805 gccversion=''
806 gidformat=''
807 gidsign=''
808 gidsize=''
809 gidtype=''
810 groupstype=''
811 h_fcntl=''
812 h_sysfile=''
813 html1dir=''
814 html1direxp=''
815 installhtml1dir=''
816 html3dir=''
817 html3direxp=''
818 installhtml3dir=''
819 i_arpainet=''
820 i_crypt=''
821 db_hashtype=''
822 db_prefixtype=''
823 db_version_major=''
824 db_version_minor=''
825 db_version_patch=''
826 i_db=''
827 i_dbm=''
828 i_rpcsvcdbm=''
829 d_dirnamlen=''
830 direntrytype=''
831 i_dirent=''
832 i_dld=''
833 i_dlfcn=''
834 i_fcntl=''
835 i_float=''
836 i_fp=''
837 i_fp_class=''
838 i_gdbm=''
839 d_grpasswd=''
840 i_grp=''
841 i_ieeefp=''
842 i_inttypes=''
843 i_langinfo=''
844 i_libutil=''
845 i_limits=''
846 i_locale=''
847 i_machcthr=''
848 i_malloc=''
849 i_math=''
850 i_memory=''
851 i_mntent=''
852 i_ndbm=''
853 i_netdb=''
854 i_neterrno=''
855 i_netinettcp=''
856 i_niin=''
857 i_sysin=''
858 i_poll=''
859 i_prot=''
860 i_pthread=''
861 d_pwage=''
862 d_pwchange=''
863 d_pwclass=''
864 d_pwcomment=''
865 d_pwexpire=''
866 d_pwgecos=''
867 d_pwpasswd=''
868 d_pwquota=''
869 i_pwd=''
870 i_sfio=''
871 i_shadow=''
872 i_socks=''
873 i_stddef=''
874 i_stdlib=''
875 i_string=''
876 strings=''
877 i_sunmath=''
878 i_sysaccess=''
879 i_sysdir=''
880 i_sysfile=''
881 d_voidtty=''
882 i_bsdioctl=''
883 i_sysfilio=''
884 i_sysioctl=''
885 i_syssockio=''
886 i_syslog=''
887 i_sysmman=''
888 i_sysmode=''
889 i_sysmount=''
890 i_sysndir=''
891 i_sysparam=''
892 i_sysresrc=''
893 i_syssecrt=''
894 i_sysselct=''
895 i_sysstat=''
896 i_sysstatfs=''
897 i_sysstatvfs=''
898 i_systimes=''
899 i_systypes=''
900 i_sysuio=''
901 i_sysun=''
902 i_sysutsname=''
903 i_sysvfs=''
904 i_syswait=''
905 i_sgtty=''
906 i_termio=''
907 i_termios=''
908 d_tm_tm_gmtoff=''
909 d_tm_tm_zone=''
910 i_systime=''
911 i_systimek=''
912 i_time=''
913 timeincl=''
914 i_unistd=''
915 i_ustat=''
916 i_utime=''
917 i_values=''
918 i_stdarg=''
919 i_varargs=''
920 i_varhdr=''
921 i_vfork=''
922 inc_version_list=''
923 inc_version_list_init=''
924 installprefix=''
925 installprefixexp=''
926 installstyle=''
927 installusrbinperl=''
928 intsize=''
929 longsize=''
930 shortsize=''
931 issymlink=''
932 libc=''
933 ldlibpthname=''
934 libperl=''
935 shrpenv=''
936 useshrplib=''
937 glibpth=''
938 libpth=''
939 loclibpth=''
940 plibpth=''
941 xlibpth=''
942 ignore_versioned_solibs=''
943 libs=''
944 libsdirs=''
945 libsfiles=''
946 libsfound=''
947 libspath=''
948 lns=''
949 d_PRIEUldbl=''
950 d_PRIFUldbl=''
951 d_PRIGUldbl=''
952 d_PRIeldbl=''
953 d_PRIfldbl=''
954 d_PRIgldbl=''
955 d_SCNfldbl=''
956 sPRIEUldbl=''
957 sPRIFUldbl=''
958 sPRIGUldbl=''
959 sPRIeldbl=''
960 sPRIfldbl=''
961 sPRIgldbl=''
962 sSCNfldbl=''
963 lseeksize=''
964 lseektype=''
965 mad=''
966 make_set_make=''
967 d_mymalloc=''
968 freetype=''
969 madlyh=''
970 madlyobj=''
971 madlysrc=''
972 mallocobj=''
973 mallocsrc=''
974 malloctype=''
975 usemallocwrap=''
976 usemymalloc=''
977 installman1dir=''
978 man1dir=''
979 man1direxp=''
980 man1ext=''
981 installman3dir=''
982 man3dir=''
983 man3direxp=''
984 man3ext=''
985 modetype=''
986 multiarch=''
987 mydomain=''
988 myhostname=''
989 phostname=''
990 c=''
991 n=''
992 d_eofnblk=''
993 eagain=''
994 o_nonblock=''
995 rd_nodata=''
996 need_va_copy=''
997 netdb_hlen_type=''
998 netdb_host_type=''
999 netdb_name_type=''
1000 netdb_net_type=''
1001 groupcat=''
1002 hostcat=''
1003 passcat=''
1004 orderlib=''
1005 ranlib=''
1006 d_perl_otherlibdirs=''
1007 otherlibdirs=''
1008 package=''
1009 spackage=''
1010 pager=''
1011 api_revision=''
1012 api_subversion=''
1013 api_version=''
1014 api_versionstring=''
1015 patchlevel=''
1016 perl_patchlevel=''
1017 revision=''
1018 subversion=''
1019 version=''
1020 version_patchlevel_string=''
1021 perl5=''
1022 perladmin=''
1023 perlpath=''
1024 d_nv_preserves_uv=''
1025 d_nv_zero_is_allbits_zero=''
1026 i16size=''
1027 i16type=''
1028 i32size=''
1029 i32type=''
1030 i64size=''
1031 i64type=''
1032 i8size=''
1033 i8type=''
1034 ivsize=''
1035 ivtype=''
1036 nv_preserves_uv_bits=''
1037 nvsize=''
1038 nvtype=''
1039 u16size=''
1040 u16type=''
1041 u32size=''
1042 u32type=''
1043 u64size=''
1044 u64type=''
1045 u8size=''
1046 u8type=''
1047 uvsize=''
1048 uvtype=''
1049 ivdformat=''
1050 nvEUformat=''
1051 nvFUformat=''
1052 nvGUformat=''
1053 nveformat=''
1054 nvfformat=''
1055 nvgformat=''
1056 uvXUformat=''
1057 uvoformat=''
1058 uvuformat=''
1059 uvxformat=''
1060 pidtype=''
1061 prefix=''
1062 prefixexp=''
1063 installprivlib=''
1064 privlib=''
1065 privlibexp=''
1066 prototype=''
1067 ptrsize=''
1068 d_PRIXU64=''
1069 d_PRId64=''
1070 d_PRIi64=''
1071 d_PRIo64=''
1072 d_PRIu64=''
1073 d_PRIx64=''
1074 sPRIXU64=''
1075 sPRId64=''
1076 sPRIi64=''
1077 sPRIo64=''
1078 sPRIu64=''
1079 sPRIx64=''
1080 d_quad=''
1081 quadkind=''
1082 quadtype=''
1083 uquadtype=''
1084 drand01=''
1085 randbits=''
1086 randfunc=''
1087 randseedtype=''
1088 seedfunc=''
1089 installscript=''
1090 scriptdir=''
1091 scriptdirexp=''
1092 selectminbits=''
1093 selecttype=''
1094 sh=''
1095 sig_count=''
1096 sig_name=''
1097 sig_name_init=''
1098 sig_num=''
1099 sig_num_init=''
1100 sig_size=''
1101 installsitearch=''
1102 sitearch=''
1103 sitearchexp=''
1104 installsitebin=''
1105 sitebin=''
1106 sitebinexp=''
1107 installsitehtml1dir=''
1108 sitehtml1dir=''
1109 sitehtml1direxp=''
1110 installsitehtml3dir=''
1111 sitehtml3dir=''
1112 sitehtml3direxp=''
1113 installsitelib=''
1114 sitelib=''
1115 sitelib_stem=''
1116 sitelibexp=''
1117 installsiteman1dir=''
1118 siteman1dir=''
1119 siteman1direxp=''
1120 installsiteman3dir=''
1121 siteman3dir=''
1122 siteman3direxp=''
1123 siteprefix=''
1124 siteprefixexp=''
1125 installsitescript=''
1126 sitescript=''
1127 sitescriptexp=''
1128 sizesize=''
1129 sizetype=''
1130 so=''
1131 socksizetype=''
1132 sharpbang=''
1133 shsharp=''
1134 spitshell=''
1135 src=''
1136 ssizetype=''
1137 startperl=''
1138 startsh=''
1139 stdchar=''
1140 d_stdio_stream_array=''
1141 stdio_stream_array=''
1142 sysman=''
1143 trnl=''
1144 uidformat=''
1145 uidsign=''
1146 uidsize=''
1147 uidtype=''
1148 archname64=''
1149 use64bitall=''
1150 use64bitint=''
1151 usefaststdio=''
1152 ccflags_uselargefiles=''
1153 ldflags_uselargefiles=''
1154 libswanted_uselargefiles=''
1155 uselargefiles=''
1156 uselongdouble=''
1157 usemorebits=''
1158 usemultiplicity=''
1159 nm_opt=''
1160 nm_so_opt=''
1161 runnm=''
1162 usenm=''
1163 useperlio=''
1164 userelocatableinc=''
1165 usesocks=''
1166 d_oldpthreads=''
1167 use5005threads=''
1168 useithreads=''
1169 usereentrant=''
1170 usethreads=''
1171 incpath=''
1172 mips_type=''
1173 usrinc=''
1174 d_vendorarch=''
1175 installvendorarch=''
1176 vendorarch=''
1177 vendorarchexp=''
1178 d_vendorbin=''
1179 installvendorbin=''
1180 vendorbin=''
1181 vendorbinexp=''
1182 installvendorhtml1dir=''
1183 vendorhtml1dir=''
1184 vendorhtml1direxp=''
1185 installvendorhtml3dir=''
1186 vendorhtml3dir=''
1187 vendorhtml3direxp=''
1188 d_vendorlib=''
1189 installvendorlib=''
1190 vendorlib=''
1191 vendorlib_stem=''
1192 vendorlibexp=''
1193 installvendorman1dir=''
1194 vendorman1dir=''
1195 vendorman1direxp=''
1196 installvendorman3dir=''
1197 vendorman3dir=''
1198 vendorman3direxp=''
1199 usevendorprefix=''
1200 vendorprefix=''
1201 vendorprefixexp=''
1202 d_vendorscript=''
1203 installvendorscript=''
1204 vendorscript=''
1205 vendorscriptexp=''
1206 versiononly=''
1207 defvoidused=''
1208 voidflags=''
1209 yacc=''
1210 yaccflags=''
1211 CONFIG=''
1212
1213 define='define'
1214 undef='undef'
1215 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1216 rmlist=''
1217
1218 : We must find out about Eunice early
1219 eunicefix=':'
1220 if test -f /etc/unixtovms; then
1221         eunicefix=/etc/unixtovms
1222 fi
1223 if test -f /etc/unixtovms.exe; then
1224         eunicefix=/etc/unixtovms.exe
1225 fi
1226
1227 : Set executable suffix now -- needed before hints available
1228 if test -f "/libs/version.library"; then
1229 : Amiga OS
1230     _exe=""
1231 elif test -f "/system/gnu_library/bin/ar.pm"; then
1232 : Stratus VOS
1233     _exe=".pm"
1234 elif test -n "$DJGPP"; then
1235 : DOS DJGPP
1236     _exe=".exe"
1237 elif test -d c:/. -o -n "$is_os2" ; then
1238 : OS/2 or cygwin
1239     _exe=".exe"
1240 fi
1241
1242 i_whoami=''
1243 ccname=''
1244 ccversion=''
1245 perllibs=''
1246 : set useposix=false in your hint file to disable the POSIX extension.
1247 useposix=true
1248 : set useopcode=false in your hint file to disable the Opcode extension.
1249 useopcode=true
1250 : Trailing extension.  Override this in a hint file, if needed.
1251 : Extra object files, if any, needed on this platform.
1252 archobjs=''
1253 archname=''
1254 : Possible local include directories to search.
1255 : Set locincpth to "" in a hint file to defeat local include searches.
1256 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1257 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1258 :
1259 : no include file wanted by default
1260 inclwanted=''
1261
1262 groupstype=''
1263 libnames=''
1264 : change the next line if compiling for Xenix/286 on Xenix/386
1265 xlibpth='/usr/lib/386 /lib/386'
1266 : Possible local library directories to search.
1267 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1268 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1269
1270 : general looking path for locating libraries
1271 glibpth="/lib /usr/lib $xlibpth"
1272 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1273 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1274 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1275
1276 : Private path used by Configure to find libraries.  Its value
1277 : is prepended to libpth. This variable takes care of special
1278 : machines, like the mips.  Usually, it should be empty.
1279 plibpth=''
1280
1281 : default library list
1282 libswanted=''
1283 : some systems want to use only the non-versioned libso:s
1284 ignore_versioned_solibs=''
1285 siteman1dir=''
1286 siteman3dir=''
1287 sitescript=''
1288 archname64=''
1289 ccflags_uselargefiles=''
1290 ldflags_uselargefiles=''
1291 libswanted_uselargefiles=''
1292 : set usemultiplicity on the Configure command line to enable multiplicity.
1293 : set usesocks on the Configure command line to enable socks.
1294 : set usethreads on the Configure command line to enable threads.
1295 usereentrant='undef'
1296 : full support for void wanted by default
1297 defvoidused=15
1298
1299 : List of libraries we want.
1300 : If anyone needs extra -lxxx, put those in a hint file.
1301 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1302 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1303 : We probably want to search /usr/shlib before most other libraries.
1304 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1305 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1306 glibpth="/usr/shlib $glibpth"
1307 : Do not use vfork unless overridden by a hint file.
1308 usevfork=false
1309
1310 : Find the basic shell for Bourne shell scripts
1311 case "$sh" in
1312 '')
1313         case "$SYSTYPE" in
1314         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1315         *) xxx='/bin/sh';;
1316         esac
1317         if test -f "$xxx"; then
1318                 sh="$xxx"
1319         else
1320                 : Build up a list and do a single loop so we can 'break' out.
1321                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1322                 for xxx in sh bash ksh pdksh ash; do
1323                         for p in $pth; do
1324                                 try="$try ${p}/${xxx}"
1325                         done
1326                 done
1327                 for xxx in $try; do
1328                         if test -f "$xxx"; then
1329                                 sh="$xxx";
1330                                 break
1331                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1332                                 sh="$xxx";
1333                                 break
1334                         elif test -f "$xxx.exe"; then
1335                                 sh="$xxx";
1336                                 break
1337                         fi
1338                 done
1339         fi
1340         ;;
1341 esac
1342
1343 case "$sh" in
1344 '')     cat >&2 <<EOM
1345 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1346
1347 Usually it's in /bin/sh.  How did you even get this far?
1348 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1349 we'll try to straighten this all out.
1350 EOM
1351         exit 1
1352         ;;
1353 esac
1354
1355 : see if sh knows # comments
1356 if `$sh -c '#' >/dev/null 2>&1`; then
1357         shsharp=true
1358         spitshell=cat
1359         xcat=/bin/cat
1360         test -f $xcat$_exe || xcat=/usr/bin/cat
1361         if test ! -f $xcat$_exe; then
1362                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1363                         if test -f $p/cat$_exe; then
1364                                 xcat=$p/cat
1365                                 break
1366                         fi
1367                 done
1368                 if test ! -f $xcat$_exe; then
1369                         echo "Can't find cat anywhere!"
1370                         exit 1
1371                 fi
1372         fi
1373         echo "#!$xcat" >sharp
1374         $eunicefix sharp
1375         chmod +x sharp
1376         ./sharp > today
1377         if test -s today; then
1378                 sharpbang='#!'
1379         else
1380                 echo "#! $xcat" > sharp
1381                 $eunicefix sharp
1382                 chmod +x sharp
1383                 ./sharp > today
1384                 if test -s today; then
1385                         sharpbang='#! '
1386                 else
1387                         sharpbang=': use '
1388                 fi
1389         fi
1390 else
1391         echo " "
1392         echo "Your $sh doesn't grok # comments--I will strip them later on."
1393         shsharp=false
1394         cd ..
1395         echo "exec grep -v '^[  ]*#'" >spitshell
1396         chmod +x spitshell
1397         $eunicefix spitshell
1398         spitshell=`pwd`/spitshell
1399         cd UU
1400         echo "I presume that if # doesn't work, #! won't work either!"
1401         sharpbang=': use '
1402 fi
1403 rm -f sharp today
1404
1405 : figure out how to guarantee sh startup
1406 case "$startsh" in
1407 '') startsh=${sharpbang}${sh} ;;
1408 *)
1409 esac
1410 cat >sharp <<EOSS
1411 $startsh
1412 set abc
1413 test "$?abc" != 1
1414 EOSS
1415
1416 chmod +x sharp
1417 $eunicefix sharp
1418 if ./sharp; then
1419         : echo "Yup, it does."
1420 else
1421         echo "Hmm... '$startsh' does not guarantee sh startup..."
1422         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1423 fi
1424 rm -f sharp
1425
1426
1427 : Save command line options in file UU/cmdline.opt for later use in
1428 : generating config.sh.
1429 cat > cmdline.opt <<EOSH
1430 # Configure command line arguments.
1431 config_arg0='$0'
1432 config_args='$*'
1433 config_argc=$#
1434 EOSH
1435 argn=1
1436 args_exp=''
1437 args_sep=''
1438 for arg in "$@"; do
1439         cat >>cmdline.opt <<EOSH
1440 config_arg$argn='$arg'
1441 EOSH
1442         # Extreme backslashitis: replace each ' by '"'"'
1443         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1444 $arg
1445 EOC
1446         arg_exp=`cat cmdl.opt`
1447         args_exp="$args_exp$args_sep'$arg_exp'"
1448         argn=`expr $argn + 1`
1449         args_sep=' '
1450 done
1451 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1452 # used by ./hints/os2.sh
1453 rm -f cmdl.opt
1454
1455 : produce awk script to parse command line options
1456 cat >options.awk <<'EOF'
1457 BEGIN {
1458         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1459
1460         len = length(optstr);
1461         for (i = 1; i <= len; i++) {
1462                 c = substr(optstr, i, 1);
1463                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1464                 if (a == ":") {
1465                         arg[c] = 1;
1466                         i++;
1467                 }
1468                 opt[c] = 1;
1469         }
1470 }
1471 {
1472         expect = 0;
1473         str = $0;
1474         if (substr(str, 1, 1) != "-") {
1475                 printf("'%s'\n", str);
1476                 next;
1477         }
1478         len = length($0);
1479         for (i = 2; i <= len; i++) {
1480                 c = substr(str, i, 1);
1481                 if (!opt[c]) {
1482                         printf("-%s\n", substr(str, i));
1483                         next;
1484                 }
1485                 printf("-%s\n", c);
1486                 if (arg[c]) {
1487                         if (i < len)
1488                                 printf("'%s'\n", substr(str, i + 1));
1489                         else
1490                                 expect = 1;
1491                         next;
1492                 }
1493         }
1494 }
1495 END {
1496         if (expect)
1497                 print "?";
1498 }
1499 EOF
1500
1501 : process the command line options
1502 set X `for arg in "$@"; do echo "X$arg"; done |
1503         sed -e s/X// | awk -f options.awk`
1504 eval "set $*"
1505 shift
1506 rm -f options.awk
1507
1508 : set up default values
1509 fastread=''
1510 reuseval=false
1511 config_sh=''
1512 alldone=''
1513 error=''
1514 silent=''
1515 extractsh=''
1516 override=''
1517 knowitall=''
1518 rm -f optdef.sh posthint.sh
1519 cat >optdef.sh <<EOS
1520 $startsh
1521 EOS
1522
1523
1524 : option parsing
1525 while test $# -gt 0; do
1526         case "$1" in
1527         -d) shift; fastread=yes;;
1528         -e) shift; alldone=cont;;
1529         -f)
1530                 shift
1531                 cd ..
1532                 if test -r "$1"; then
1533                         config_sh="$1"
1534                 else
1535                         echo "$me: cannot read config file $1." >&2
1536                         error=true
1537                 fi
1538                 cd UU
1539                 shift;;
1540         -h) shift; error=true;;
1541         -r) shift; reuseval=true;;
1542         -s) shift; silent=true; realsilent=true;;
1543         -E) shift; alldone=exit;;
1544         -K) shift; knowitall=true;;
1545         -O) shift; override=true;;
1546         -S) shift; silent=true; extractsh=true;;
1547         -D)
1548                 shift
1549                 case "$1" in
1550                 *=)
1551                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1552                         echo "$me: ignoring -D $1" >&2
1553                         ;;
1554                 *=*) echo "$1" | \
1555                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1556                 *) echo "$1='define'" >> optdef.sh;;
1557                 esac
1558                 shift
1559                 ;;
1560         -U)
1561                 shift
1562                 case "$1" in
1563                 *=) echo "$1" >> optdef.sh;;
1564                 *=*)
1565                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1566                         echo "$me: ignoring -U $1" >&2
1567                         ;;
1568                 *) echo "$1='undef'" >> optdef.sh;;
1569                 esac
1570                 shift
1571                 ;;
1572         -A)
1573             shift
1574             xxx=''
1575             yyy="$1"
1576             zzz=''
1577             uuu=undef
1578             case "$yyy" in
1579             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1580                  case "$zzz" in
1581                  *:*) zzz='' ;;
1582                  *)   xxx=append
1583                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1584                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1585                  esac
1586                  ;;
1587             esac
1588             case "$xxx" in
1589             '')  case "$yyy" in
1590                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1591                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1592                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1593                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1594                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1595                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1596                  esac
1597                  ;;       
1598             esac
1599             case "$xxx" in
1600             append)
1601                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1602             clear)
1603                 echo "$yyy=''"                  >> posthint.sh ;;
1604             define)
1605                 case "$zzz" in
1606                 '') zzz=define ;;
1607                 esac
1608                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1609             eval)
1610                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1611             prepend)
1612                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1613             undef)
1614                 case "$zzz" in
1615                 '') zzz="$uuu" ;;
1616                 esac
1617                 echo "$yyy=$zzz"                >> posthint.sh ;;
1618             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1619             esac
1620             shift
1621             ;;
1622         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1623             exit 0;;
1624         --) break;;
1625         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1626         *) break;;
1627         esac
1628 done
1629
1630 case "$error" in
1631 true)
1632         cat >&2 <<EOM
1633 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1634                  [-U symbol] [-U symbol=] [-A command:symbol...]
1635   -d : use defaults for all answers.
1636   -e : go on without questioning past the production of config.sh.
1637   -f : specify an alternate default configuration file.
1638   -h : print this help message and exit (with an error status).
1639   -r : reuse C symbols value if possible (skips costly nm extraction).
1640   -s : silent mode, only echoes questions and essential information.
1641   -D : define symbol to have some value:
1642          -D symbol         symbol gets the value 'define'
1643          -D symbol=value   symbol gets the value 'value'
1644   -E : stop at the end of questions, after having produced config.sh.
1645   -K : do not use unless you know what you are doing.
1646   -O : let -D and -U override definitions from loaded configuration file.
1647   -S : perform variable substitutions on all .SH files (can mix with -f)
1648   -U : undefine symbol:
1649          -U symbol    symbol gets the value 'undef'
1650          -U symbol=   symbol gets completely empty
1651   -A : manipulate symbol after the platform specific hints have been applied:
1652          -A symbol=value                append " "value to symbol
1653          -A append:symbol=value         append value to symbol
1654          -A define:symbol=value         define symbol to have value
1655          -A clear:symbol                define symbol to be ''
1656          -A define:symbol               define symbol to be 'define'
1657          -A eval:symbol=value           define symbol to be eval of value
1658          -A prepend:symbol=value        prepend value to symbol
1659          -A undef:symbol                define symbol to be 'undef'
1660          -A undef:symbol=               define symbol to be ''
1661   -V : print version number and exit (with a zero status).
1662 EOM
1663         exit 1
1664         ;;
1665 esac
1666
1667 : Sanity checks
1668 case "$fastread$alldone" in
1669 yescont|yesexit) ;;
1670 *)
1671         case "$extractsh" in
1672         true) ;;
1673         *)
1674                 if test ! -t 0; then
1675                         echo "Say 'sh Configure', not 'sh <Configure'"
1676                         exit 1
1677                 fi
1678                 ;;
1679         esac
1680         ;;
1681 esac
1682
1683 exec 4>&1
1684 case "$silent" in
1685 true) exec 1>/dev/null;;
1686 esac
1687
1688 : run the defines and the undefines, if any, but leave the file out there...
1689 touch optdef.sh
1690 . ./optdef.sh
1691 : create the posthint manipulation script and leave the file out there...
1692 touch posthint.sh
1693
1694 : set package name
1695 package=perl5
1696 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1697 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1698 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1699 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1700 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1701 esac
1702
1703 : Some greps do not return status, grrr.
1704 echo "grimblepritz" >grimble
1705 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1706         contains=contains
1707 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1708         contains=grep
1709 else
1710         contains=contains
1711 fi
1712 rm -f grimble
1713 : the following should work in any shell
1714 case "$contains" in
1715 contains*)
1716         echo " "
1717         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1718         cat >contains <<'EOSS'
1719 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1720 EOSS
1721 chmod +x contains
1722 esac
1723
1724 : Find the path to the source tree
1725 case "$src" in
1726 '') case "$0" in
1727     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1728          case "$src" in
1729          /*)    ;;
1730          .)     ;;
1731          *)     src=`cd ../$src && pwd` ;;
1732          esac
1733          ;;
1734     *)   src='.';;
1735     esac;;
1736 esac
1737 case "$src" in
1738 '')     src=/
1739         rsrc=/
1740         ;;
1741 /*) rsrc="$src";;
1742 *) rsrc="../$src";;
1743 esac
1744 if test -f $rsrc/Configure && \
1745         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1746 then
1747    : found it, so we are ok.
1748 else
1749         rsrc=''
1750         for src in . .. ../.. ../../.. ../../../..; do
1751                 if test -f ../$src/Configure && \
1752                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1753                 then
1754                         rsrc=../$src
1755                         break
1756                 fi
1757         done
1758 fi
1759 case "$rsrc" in
1760 '')
1761         cat <<EOM >&4
1762
1763 Sorry, I can't seem to locate the source dir for $package.  Please start
1764 Configure with an explicit path -- i.e. /some/path/Configure.
1765
1766 EOM
1767         exit 1
1768         ;;
1769 ../.)   rsrc='..';;
1770 *)
1771         echo " "
1772         echo "Sources for $package found in \"$src\"." >&4
1773         ;;
1774 esac
1775
1776 : script used to extract .SH files with variable substitutions
1777 cat >extract <<'EOS'
1778 PERL_CONFIG_SH=true
1779 echo "Doing variable substitutions on .SH files..."
1780 if test -f MANIFEST; then
1781         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1782 else
1783         echo "(Looking for .SH files under the source directory.)"
1784         set x `(cd "$src"; find . -name "*.SH" -print)`
1785 fi
1786 shift
1787 case $# in
1788 0) set x `(cd "$src"; echo *.SH)`; shift;;
1789 esac
1790 if test ! -f "$src/$1"; then
1791         shift
1792 fi
1793 mkdir_p='
1794 name=$1;
1795 create="";
1796 while test $name; do
1797         if test ! -d "$name"; then
1798                 create="$name $create";
1799                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1800                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1801         else
1802                 name="";
1803         fi;
1804 done;
1805 for file in $create; do
1806         mkdir $file;
1807 done
1808 '
1809 for file in $*; do
1810         case "$src" in
1811         ".")
1812                 case "$file" in
1813                 */*)
1814                         dir=`expr X$file : 'X\(.*\)/'`
1815                         file=`expr X$file : 'X.*/\(.*\)'`
1816                         (cd "$dir" && . ./$file)
1817                         ;;
1818                 *)
1819                         . ./$file
1820                         ;;
1821                 esac
1822                 ;;
1823         *)
1824                 case "$file" in
1825                 */*)
1826                         dir=`expr X$file : 'X\(.*\)/'`
1827                         file=`expr X$file : 'X.*/\(.*\)'`
1828                         (set x $dir; shift; eval $mkdir_p)
1829                         sh <"$src/$dir/$file"
1830                         ;;
1831                 *)
1832                         sh <"$src/$file"
1833                         ;;
1834                 esac
1835                 ;;
1836         esac
1837 done
1838 if test -f "$src/config_h.SH"; then
1839         if test ! -f config.h; then
1840         : oops, they left it out of MANIFEST, probably, so do it anyway.
1841         . "$src/config_h.SH"
1842         fi
1843 fi
1844 EOS
1845
1846 : extract files and exit if asked to do so
1847 case "$extractsh" in
1848 true)
1849         case "$realsilent" in
1850         true) ;;
1851         *) exec 1>&4;;
1852         esac
1853         case "$config_sh" in
1854         '') config_sh='config.sh';;
1855         esac
1856         echo " "
1857         echo "Fetching answers from $config_sh..."
1858         cd ..
1859         . $config_sh
1860         test "$override" && . ./optdef.sh
1861         echo " "
1862         . UU/extract
1863         rm -rf UU
1864         echo "Extraction done."
1865         exit 0
1866         ;;
1867 esac
1868
1869 : Eunice requires " " instead of "", can you believe it
1870 echo " "
1871 : Here we go...
1872 echo "Beginning of configuration questions for $package."
1873
1874 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1875
1876 : first determine how to suppress newline on echo command
1877 echo " "
1878 echo "Checking echo to see how to suppress newlines..."
1879 (echo "hi there\c" ; echo " ") >.echotmp
1880 if $contains c .echotmp >/dev/null 2>&1 ; then
1881         echo "...using -n."
1882         n='-n'
1883         c=''
1884 else
1885         cat <<'EOM'
1886 ...using \c
1887 EOM
1888         n=''
1889         c='\c'
1890 fi
1891 echo $n "The star should be here-->$c"
1892 echo '*'
1893 rm -f .echotmp
1894
1895 : Now test for existence of everything in MANIFEST
1896 echo " "
1897 if test -f "$rsrc/MANIFEST"; then
1898         echo "First let's make sure your kit is complete.  Checking..." >&4
1899         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1900         rm -f missing
1901         tmppwd=`pwd`
1902         for filelist in x??; do
1903                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1904         done
1905         if test -s missing; then
1906                 cat missing >&4
1907                 cat >&4 <<'EOM'
1908
1909 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1910
1911 You have the option of continuing the configuration process, despite the
1912 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1913 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1914 and contact the author (perlbug@perl.org).
1915
1916 EOM
1917                 echo $n "Continue? [n] $c" >&4
1918                 read ans
1919                 case "$ans" in
1920                 y*)
1921                         echo "Continuing..." >&4
1922                         rm -f missing
1923                         ;;
1924                 *)
1925                         echo "ABORTING..." >&4
1926                         kill $$
1927                         ;;
1928                 esac
1929         else
1930                 echo "Looks good..."
1931         fi
1932 else
1933         echo "There is no MANIFEST file.  I hope your kit is complete !"
1934 fi
1935 rm -f missing x??
1936
1937 echo " "
1938 : Find the appropriate value for a newline for tr
1939 if test -n "$DJGPP"; then
1940        trnl='\012'
1941 fi
1942 if test X"$trnl" = X; then
1943         case "`echo foo|tr '\n' x 2>/dev/null`" in
1944         foox) trnl='\n' ;;
1945         esac
1946 fi
1947 if test X"$trnl" = X; then
1948         case "`echo foo|tr '\012' x 2>/dev/null`" in
1949         foox) trnl='\012' ;;
1950         esac
1951 fi
1952 if test X"$trnl" = X; then
1953        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1954        fooxy) trnl='\n\r' ;;
1955        esac
1956 fi
1957 if test X"$trnl" = X; then
1958         cat <<EOM >&2
1959
1960 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1961
1962 EOM
1963         exit 1
1964 fi
1965
1966 : compute the number of columns on the terminal for proper question formatting
1967 case "$COLUMNS" in
1968 '') COLUMNS='80';;
1969 esac
1970
1971 : set up the echo used in my read
1972 myecho="case \"\$xxxm\" in
1973 '') echo $n \"\$rp $c\" >&4;;
1974 *) case \"\$rp\" in
1975         '') echo $n \"[\$xxxm] $c\";;
1976         *)
1977                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1978                         echo \"\$rp\" >&4
1979                         echo $n \"[\$xxxm] $c\" >&4
1980                 else
1981                         echo $n \"\$rp [\$xxxm] $c\" >&4
1982                 fi
1983                 ;;
1984         esac;;
1985 esac"
1986
1987 : now set up to do reads with possible shell escape and default assignment
1988 cat <<EOSC >myread
1989 $startsh
1990 xxxm=\$dflt
1991 $myecho
1992 ans='!'
1993 case "\$fastread" in
1994 yes) case "\$dflt" in
1995         '') ;;
1996         *) ans='';
1997                 case "\$silent-\$rp" in
1998                 true-) ;;
1999                 *) echo " " >&4;;
2000                 esac;;
2001         esac;;
2002 *) case "\$silent" in
2003         true) case "\$rp" in
2004                 '') ans='';;
2005                 esac;;
2006         esac;;
2007 esac
2008 while expr "X\$ans" : "X!" >/dev/null; do
2009         read answ
2010         set x \$xxxm
2011         shift
2012         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2013         case  "\$answ" in
2014         "!")
2015                 sh 1>&4
2016                 echo " "
2017                 $myecho
2018                 ;;
2019         !*)
2020                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2021                 shift
2022                 sh 1>&4 -c "\$*"
2023                 echo " "
2024                 $myecho
2025                 ;;
2026         "\$ans")
2027                 case "\$ans" in
2028                 \\&*)
2029                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2030                         shift
2031                         case "\$1" in
2032                         -d)
2033                                 fastread=yes
2034                                 echo "(OK, I'll run with -d after this question.)" >&4
2035                                 ;;
2036                         -*)
2037                                 echo "*** Sorry, \$1 not supported yet." >&4
2038                                 ;;
2039                         esac
2040                         $myecho
2041                         ans=!
2042                         ;;
2043                 esac;;
2044         *)
2045                 case "\$aok" in
2046                 y)
2047                         echo "*** Substitution done -- please confirm."
2048                         xxxm="\$ans"
2049                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2050                         xxxm="\$ans"
2051                         ans=!
2052                         ;;
2053                 *)
2054                         echo "*** Error -- try again."
2055                         ans=!
2056                         ;;
2057                 esac
2058                 $myecho
2059                 ;;
2060         esac
2061         case "\$ans\$xxxm\$nostick" in
2062         '')
2063                 ans=!
2064                 $myecho
2065                 ;;
2066         esac
2067 done
2068 case "\$ans" in
2069 '') ans="\$xxxm";;
2070 esac
2071 EOSC
2072
2073 : create .config dir to save info across Configure sessions
2074 test -d ../.config || mkdir ../.config
2075 cat >../.config/README <<EOF
2076 This directory created by Configure to save information that should
2077 persist across sessions for $package.
2078
2079 You may safely delete it if you wish.
2080 EOF
2081
2082 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2083 case "$usedevel" in
2084 $define|true|[yY]*) ;;
2085 *) case "$xversion" in
2086    *[13579])
2087         cat >&4 <<EOH
2088 *** WHOA THERE!!! ***
2089
2090     This is an UNSTABLE DEVELOPMENT release.
2091     The version of this $package distribution is $xversion, that is, odd,
2092     (as opposed to even) and that signifies a development release.
2093     If you want a maintenance release, you want an even-numbered version.
2094
2095     Do ***NOT*** install this into production use.
2096     Data corruption and crashes are possible.
2097
2098     It is most seriously suggested that you do not continue any further
2099     unless you want to help in developing and debugging Perl.
2100
2101     If you *still* want to build perl, you can answer 'y' now,
2102     or pass -Dusedevel to Configure.
2103
2104 EOH
2105         rp='Do you really want to continue?'
2106         dflt='n'
2107         . ./myread
2108         case "$ans" in
2109         [yY]) echo >&4 "Okay, continuing."
2110               usedevel="$define" ;;
2111         *) echo >&4 "Okay, bye."
2112            exit 1
2113            ;;
2114         esac
2115         ;;
2116     esac
2117     ;;
2118 esac
2119 case "$usedevel" in
2120 $define|true|[yY]*)
2121         case "$versiononly" in
2122         '') versiononly="$define" ;;
2123         esac
2124         case "$installusrbinperl" in
2125         '') installusrbinperl="$undef" ;;
2126         esac
2127         ;;
2128 esac
2129
2130 : general instructions
2131 needman=true
2132 firsttime=true
2133 user=`(logname) 2>/dev/null`
2134 case "$user" in
2135 '') user=`whoami 2>&1`;;
2136 esac
2137 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2138         firsttime=false
2139         echo " "
2140         rp='Would you like to see the instructions?'
2141         dflt=n
2142         . ./myread
2143         case "$ans" in
2144         [yY]*) ;;
2145         *) needman=false;;
2146         esac
2147 fi
2148 if $needman; then
2149         cat <<EOH
2150
2151 This installation shell script will examine your system and ask you questions
2152 to determine how the perl5 package should be installed. If you get
2153 stuck on a question, you may use a ! shell escape to start a subshell or
2154 execute a command.  Many of the questions will have default answers in square
2155 brackets; typing carriage return will give you the default.
2156
2157 On some of the questions which ask for file or directory names you are allowed
2158 to use the ~name construct to specify the login directory belonging to "name",
2159 even if you don't have a shell which knows about that.  Questions where this is
2160 allowed will be marked "(~name ok)".
2161
2162 EOH
2163         rp=''
2164         dflt='Type carriage return to continue'
2165         . ./myread
2166         cat <<'EOH'
2167
2168 The prompter used in this script allows you to use shell variables and
2169 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2170 in the default answer, as if the default line was a set of arguments given to a
2171 script shell.  This means you may also use $* to repeat the whole default line,
2172 so you do not have to re-type everything to add something to the default.
2173
2174 Everytime there is a substitution, you will have to confirm.  If there is an
2175 error (e.g. an unmatched backtick), the default answer will remain unchanged
2176 and you will be prompted again.
2177
2178 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2179 the questions and use the computed defaults (or the previous answers if there
2180 was already a config.sh file). Type 'Configure -h' for a list of options.
2181 You may also start interactively and then answer '& -d' at any prompt to turn
2182 on the non-interactive behaviour for the remainder of the execution.
2183
2184 EOH
2185         . ./myread
2186         cat <<EOH
2187
2188 Much effort has been expended to ensure that this shell script will run on any
2189 Unix system.  If despite that it blows up on yours, your best bet is to edit
2190 Configure and run it again.  If you can't run Configure for some reason,
2191 you'll have to generate a config.sh file by hand.  Whatever problems you
2192 have, let me (perlbug@perl.org) know how I blew it.
2193
2194 This installation script affects things in two ways:
2195
2196 1) it may do direct variable substitutions on some of the files included
2197    in this kit.
2198 2) it builds a config.h file for inclusion in C programs.  You may edit
2199    any of these files as the need arises after running this script.
2200
2201 If you make a mistake on a question, there is no easy way to back up to it
2202 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2203 files.  Configure will offer to let you do this before it runs the SH files.
2204
2205 EOH
2206         dflt='Type carriage return to continue'
2207         . ./myread
2208         case "$firsttime" in
2209         true) echo $user >>../.config/instruct;;
2210         esac
2211 fi
2212
2213 : find out where common programs are
2214 echo " "
2215 echo "Locating common programs..." >&4
2216 cat <<EOSC >loc
2217 $startsh
2218 case \$# in
2219 0) exit 1;;
2220 esac
2221 thing=\$1
2222 shift
2223 dflt=\$1
2224 shift
2225 for dir in \$*; do
2226         case "\$thing" in
2227         .)
2228         if test -d \$dir/\$thing; then
2229                 echo \$dir
2230                 exit 0
2231         fi
2232         ;;
2233         *)
2234         for thisthing in \$dir/\$thing; do
2235                 : just loop through to pick last item
2236         done
2237         if test -f \$thisthing; then
2238                 echo \$thisthing
2239                 exit 0
2240         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2241                 echo \$thisthing
2242                 exit 0
2243         elif test -f \$dir/\$thing.exe; then
2244                 if test -n "$DJGPP"; then
2245                         echo \$dir/\$thing.exe
2246                 elif test "$eunicefix" != ":"; then
2247                         : on Eunice apparently
2248                         echo \$dir/\$thing
2249                         exit 0
2250                 fi
2251                 exit 0
2252         fi
2253         ;;
2254         esac
2255 done
2256 echo \$dflt
2257 exit 1
2258 EOSC
2259 chmod +x loc
2260 $eunicefix loc
2261 loclist="
2262 awk
2263 cat
2264 chmod
2265 comm
2266 cp
2267 echo
2268 expr
2269 grep
2270 ls
2271 mkdir
2272 rm
2273 sed
2274 sort
2275 touch
2276 tr
2277 uniq
2278 "
2279 trylist="
2280 Mcc
2281 ar
2282 bison
2283 byacc
2284 cpp
2285 csh
2286 date
2287 egrep
2288 gmake
2289 gzip
2290 less
2291 ln
2292 make
2293 more
2294 nm
2295 nroff
2296 pg
2297 test
2298 uname
2299 zip
2300 "
2301 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2302 pth="$pth /lib /usr/lib"
2303 for file in $loclist; do
2304         eval xxx=\$$file
2305         case "$xxx" in
2306         /*|?:[\\/]*)
2307                 if test -f "$xxx"; then
2308                         : ok
2309                 else
2310                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2311                         xxx=`./loc $file $file $pth`
2312                 fi
2313                 ;;
2314         '') xxx=`./loc $file $file $pth`;;
2315         *) xxx=`./loc $xxx $xxx $pth`;;
2316         esac
2317         eval $file=$xxx$_exe
2318         eval _$file=$xxx
2319         case "$xxx" in
2320         /*)
2321                 echo $file is in $xxx.
2322                 ;;
2323         ?:[\\/]*)
2324                 echo $file is in $xxx.
2325                 ;;
2326         *)
2327                 echo "I don't know where '$file' is, and my life depends on it." >&4
2328                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2329                 exit 1
2330                 ;;
2331         esac
2332 done
2333 echo " "
2334 echo "Don't worry if any of the following aren't found..."
2335 say=offhand
2336 for file in $trylist; do
2337         eval xxx=\$$file
2338         case "$xxx" in
2339         /*|?:[\\/]*)
2340                 if test -f "$xxx"; then
2341                         : ok
2342                 else
2343                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2344                         xxx=`./loc $file $file $pth`
2345                 fi
2346                 ;;
2347         '') xxx=`./loc $file $file $pth`;;
2348         *) xxx=`./loc $xxx $xxx $pth`;;
2349         esac
2350         eval $file=$xxx$_exe
2351         eval _$file=$xxx
2352         case "$xxx" in
2353         /*)
2354                 echo $file is in $xxx.
2355                 ;;
2356         ?:[\\/]*)
2357                 echo $file is in $xxx.
2358                 ;;
2359         *)
2360                 echo "I don't see $file out there, $say."
2361                 say=either
2362                 ;;
2363         esac
2364 done
2365 case "$egrep" in
2366 egrep)
2367         echo "Substituting grep for egrep."
2368         egrep=$grep
2369         _egrep=$grep
2370         ;;
2371 esac
2372 case "$ln" in
2373 ln)
2374         echo "Substituting cp for ln."
2375         ln=$cp
2376         _ln=$cp
2377         ;;
2378 esac
2379 case "$make" in
2380 make)   
2381         case "$gmake" in
2382         gmake)
2383         echo "I can't find make or gmake, and my life depends on it." >&4
2384         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2385         exit 1
2386         ;;
2387         esac
2388         ;;
2389 esac    
2390 case "$gmake" in
2391 gmake)  ;;
2392 *)      # We can't have osname yet.
2393         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2394                 # Assume that gmake, if found, is definitely GNU make
2395                 # and prefer it over the system make.
2396                 echo "Substituting gmake for make."
2397                 make=$gmake
2398                 _make=$gmake
2399         fi
2400         ;;
2401 esac
2402 case "$test" in
2403 test)
2404         echo "Hopefully test is built into your sh."
2405         ;;
2406 *)
2407         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2408                 echo "Using the test built into your sh."
2409                 test=test
2410                 _test=test
2411         fi
2412         ;;
2413 esac
2414 case "$echo" in
2415 echo)
2416         echo "Hopefully echo is built into your sh."
2417         ;;
2418 '') ;;
2419 *)
2420         echo " "
2421 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2422         $echo $n "hi there$c" >foo1
2423         echo $n "hi there$c" >foo2
2424         if cmp foo1 foo2 >/dev/null 2>&1; then
2425                 echo "They are compatible.  In fact, they may be identical."
2426         else
2427                 case "$n" in
2428                 '-n') n='' c='\c';;
2429                 *) n='-n' c='';;
2430                 esac
2431                 cat <<FOO
2432 They are not compatible!  You are probably running ksh on a non-USG system.
2433 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2434 have echo built in and we may have to run some Bourne shell scripts.  That
2435 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2436
2437 FOO
2438                 $echo $n "The star should be here-->$c"
2439                 $echo "*"
2440         fi
2441         $rm -f foo1 foo2
2442         ;;
2443 esac
2444
2445 cat <<EOS >trygcc
2446 $startsh
2447 EOS
2448 cat <<'EOSC' >>trygcc
2449 case "$cc" in
2450 '') ;;
2451 *)  $rm -f try try.*
2452     $cat >try.c <<EOM
2453 int main(int argc, char *argv[]) {
2454   return 0;
2455 }
2456 EOM
2457     if $cc -o try $ccflags $ldflags try.c; then
2458        :
2459     else
2460         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2461         despair=yes
2462         trygcc=yes
2463         case "$cc" in
2464         *gcc*) trygcc=no ;;
2465         esac
2466         case "`$cc -v -c try.c 2>&1`" in
2467         *gcc*) trygcc=no ;;
2468         esac
2469         if $test X"$trygcc" = Xyes; then
2470             if gcc -o try -c try.c; then
2471                 echo " "
2472                 echo "You seem to have a working gcc, though." >&4
2473                 rp="Would you like to use it?"
2474                 dflt=y
2475                 if $test -f myread; then
2476                     . ./myread
2477                 else
2478                     if $test -f UU/myread; then
2479                         . ./UU/myread
2480                     else
2481                         echo "Cannot find myread, sorry.  Aborting." >&2
2482                         exit 1
2483                     fi
2484                 fi  
2485                 case "$ans" in
2486                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2487                        if $test -f usethreads.cbu; then
2488                            $cat >&4 <<EOM 
2489
2490 *** However, any setting of the C compiler flags (e.g. for thread support)
2491 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2492 *** (together with e.g. -Dusethreads).
2493
2494 EOM
2495                        fi;;
2496                 esac
2497             fi
2498         fi
2499     fi
2500     $rm -f try try.*
2501     ;;
2502 esac
2503 EOSC
2504
2505 cat <<EOS >checkcc
2506 $startsh
2507 EOS
2508 cat <<'EOSC' >>checkcc
2509 case "$cc" in        
2510 '') ;;
2511 *)  $rm -f try try.*              
2512     $cat >try.c <<EOM
2513 int main(int argc, char *argv[]) {
2514   return 0;
2515 }
2516 EOM
2517     if $cc -o try $ccflags $ldflags try.c; then
2518        :
2519     else
2520         if $test X"$despair" = Xyes; then
2521            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2522         fi
2523         $cat >&4 <<EOM         
2524 You need to find a working C compiler.
2525 Either (purchase and) install the C compiler supplied by your OS vendor,
2526 or for a free C compiler try http://gcc.gnu.org/
2527 I cannot continue any further, aborting.
2528 EOM
2529         exit 1
2530     fi
2531     $rm -f try try.*
2532     ;;
2533 esac
2534 EOSC
2535
2536 : determine whether symbolic links are supported
2537 echo " "
2538 $touch blurfl
2539 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2540         echo "Symbolic links are supported." >&4
2541         lns="$ln -s"
2542 else
2543         echo "Symbolic links are NOT supported." >&4
2544         lns="$ln"
2545 fi
2546 $rm -f blurfl sym
2547
2548 : determine whether symbolic links are supported
2549 echo " "
2550 case "$lns" in
2551 *"ln"*" -s")
2552         echo "Checking how to test for symbolic links..." >&4
2553         $lns blurfl sym
2554         if $test "X$issymlink" = X; then
2555                 case "$newsh" in
2556                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2557                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2558                 esac
2559                 if test $? = 0; then
2560                         issymlink="test -h"
2561                 else
2562                         echo "Your builtin 'test -h' may be broken." >&4
2563                         case "$test" in
2564                         /*)     ;;
2565                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2566                                 for p in $pth
2567                                 do
2568                                         if test -f "$p/$test"; then
2569                                                 test="$p/$test"
2570                                                 break
2571                                         fi
2572                                 done
2573                                 ;;
2574                         esac
2575                         case "$test" in
2576                         /*)
2577                                 echo "Trying external '$test -h'." >&4
2578                                 issymlink="$test -h"
2579                                 if $test ! -h sym >/dev/null 2>&1; then
2580                                         echo "External '$test -h' is broken, too." >&4
2581                                         issymlink=''
2582                                 fi
2583                                 ;;
2584                         *)      issymlink='' ;;
2585                         esac
2586                 fi              
2587         fi
2588         if $test "X$issymlink" = X; then
2589                 if $test -L sym 2>/dev/null; then
2590                         issymlink="$test -L"
2591                         echo "The builtin '$test -L' worked." >&4
2592                 fi
2593         fi
2594         if $test "X$issymlink" != X; then
2595                 echo "You can test for symbolic links with '$issymlink'." >&4
2596         else
2597                 echo "I do not know how you can test for symbolic links." >&4
2598         fi
2599         $rm -f blurfl sym
2600         ;;
2601 *)      echo "No symbolic links, so not testing for their testing..." >&4
2602         ;;
2603 esac
2604 echo " "
2605
2606
2607 case "$mksymlinks" in
2608 $define|true|[yY]*)
2609         case "$src" in
2610         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2611                 exit 1
2612                 ;;
2613         *)      case "$lns:$issymlink" in
2614                 *"ln"*" -s:"*"test -"?)
2615                         echo "Creating the symbolic links..." >&4
2616                         echo "(First creating the subdirectories...)" >&4
2617                         cd ..
2618                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2619                                 read directory
2620                                 test -z "$directory" && break
2621                                 mkdir -p $directory
2622                         done
2623                         # Sanity check 1.
2624                         if test ! -d t/base; then
2625                                 echo "Failed to create the subdirectories.  Aborting." >&4
2626                                 exit 1
2627                         fi
2628                         echo "(Then creating the symlinks...)" >&4
2629                         awk '{print $1}' $src/MANIFEST | while true; do
2630                                 read filename
2631                                 test -z "$filename" && break
2632                                 if test -f $filename; then
2633                                         if $issymlink $filename; then
2634                                                 rm -f $filename
2635                                         fi
2636                                 fi
2637                                 if test -f $filename; then
2638                                         echo "$filename already exists, not symlinking."
2639                                 else
2640                                         ln -s $src/$filename $filename
2641                                 fi
2642                         done
2643                         # Sanity check 2.
2644                         if test ! -f t/base/lex.t; then
2645                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2646                                 exit 1
2647                         fi
2648                         cd UU
2649                         ;;
2650                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2651                         ;;
2652                 esac
2653                 ;;
2654         esac
2655         ;;
2656 esac
2657
2658
2659 case "$usecrosscompile" in
2660 $define|true|[yY]*)
2661         $echo "Cross-compiling..."
2662         croak=''
2663         case "$cc" in
2664         *-*-gcc) # A cross-compiling gcc, probably.
2665             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2666             ar=$targetarch-ar
2667             # leave out ld, choosing it is more complex
2668             nm=$targetarch-nm
2669             ranlib=$targetarch-ranlib
2670             $echo 'extern int foo;' > try.c
2671             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2672             shift
2673             if $test $# -gt 0; then
2674                 incpth="$incpth $*"
2675                 incpth="`$echo $incpth|$sed 's/^ //'`"
2676                 echo "Guessing incpth '$incpth'." >&4
2677                 for i in $*; do
2678                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2679                     if $test -d $j; then
2680                         libpth="$libpth $j"
2681                     fi
2682                 done   
2683                 libpth="`$echo $libpth|$sed 's/^ //'`"
2684                 echo "Guessing libpth '$libpth'." >&4
2685             fi
2686             $rm -f try.c
2687             ;;
2688         esac
2689         case "$targetarch" in
2690         '') echo "Targetarch not defined." >&4; croak=y ;;
2691         *)  echo "Using targetarch $targetarch." >&4 ;;
2692         esac
2693         case "$incpth" in
2694         '') echo "Incpth not defined." >&4; croak=y ;;
2695         *)  echo "Using incpth '$incpth'." >&4 ;;
2696         esac
2697         case "$libpth" in
2698         '') echo "Libpth not defined." >&4; croak=y ;;
2699         *)  echo "Using libpth '$libpth'." >&4 ;;
2700         esac
2701         case "$usrinc" in
2702         '') for i in $incpth; do
2703                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2704                     usrinc=$i
2705                     echo "Guessing usrinc $usrinc." >&4
2706                     break
2707                 fi
2708             done
2709             case "$usrinc" in
2710             '') echo "Usrinc not defined." >&4; croak=y ;;
2711             esac
2712             ;;
2713         *)  echo "Using usrinc $usrinc." >&4 ;;
2714         esac
2715         case "$targethost" in
2716         '') echo "Targethost not defined." >&4; croak=y ;;
2717         *)  echo "Using targethost $targethost." >&4
2718         esac
2719         locincpth=' '
2720         loclibpth=' '
2721         case "$croak" in
2722         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2723         esac
2724         case "$src" in
2725         /*) run=$src/Cross/run
2726             targetmkdir=$src/Cross/mkdir
2727             to=$src/Cross/to
2728             from=$src/Cross/from
2729             ;;
2730         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2731             run=$pwd/Cross/run
2732             targetmkdir=$pwd/Cross/mkdir
2733             to=$pwd/Cross/to
2734             from=$pwd/Cross/from
2735             ;;
2736         esac
2737         case "$targetrun" in
2738         '') targetrun=ssh ;;
2739         esac
2740         case "$targetto" in
2741         '') targetto=scp ;;
2742         esac
2743         case "$targetfrom" in
2744         '') targetfrom=scp ;;
2745         esac
2746         run=$run-$targetrun
2747         to=$to-$targetto
2748         from=$from-$targetfrom
2749         case "$targetdir" in
2750         '')  targetdir=/tmp
2751              echo "Guessing targetdir $targetdir." >&4
2752              ;;
2753         esac
2754         case "$targetuser" in
2755         '')  targetuser=root
2756              echo "Guessing targetuser $targetuser." >&4
2757              ;;
2758         esac
2759         case "$targetfrom" in
2760         scp)    q=-q ;;
2761         *)      q='' ;;
2762         esac
2763         case "$targetrun" in
2764         ssh|rsh)
2765             cat >$run <<EOF
2766 #!/bin/sh
2767 case "\$1" in
2768 -cwd)
2769   shift
2770   cwd=\$1
2771   shift
2772   ;;
2773 esac
2774 case "\$cwd" in
2775 '') cwd=$targetdir ;;
2776 esac
2777 exe=\$1
2778 shift
2779 if $test ! -f \$exe.xok; then
2780   $to \$exe
2781   $touch \$exe.xok
2782 fi
2783 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2784 EOF
2785             ;;
2786         *)  echo "Unknown targetrun '$targetrun'" >&4
2787             exit 1
2788             ;;
2789         esac
2790         case "$targetmkdir" in
2791         */Cross/mkdir)
2792             cat >$targetmkdir <<EOF
2793 #!/bin/sh
2794 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2795 EOF
2796             $chmod a+rx $targetmkdir
2797             ;;
2798         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2799             exit 1
2800             ;;
2801         esac
2802         case "$targetto" in
2803         scp|rcp)
2804             cat >$to <<EOF
2805 #!/bin/sh
2806 for f in \$@
2807 do
2808   case "\$f" in
2809   /*)
2810     $targetmkdir \`dirname \$f\`
2811     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2812     ;;
2813   *)
2814     $targetmkdir $targetdir/\`dirname \$f\`
2815     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2816     ;;
2817   esac
2818 done
2819 exit 0
2820 EOF
2821             ;;
2822         cp) cat >$to <<EOF
2823 #!/bin/sh
2824 for f in \$@
2825 do
2826   case "\$f" in
2827   /*)
2828     $mkdir -p $targetdir/\`dirname \$f\`
2829     $cp \$f $targetdir/\$f || exit 1
2830     ;;
2831   *)
2832     $targetmkdir $targetdir/\`dirname \$f\`
2833     $cp \$f $targetdir/\$f || exit 1
2834     ;;
2835   esac
2836 done
2837 exit 0
2838 EOF
2839             ;;
2840         *)  echo "Unknown targetto '$targetto'" >&4
2841             exit 1
2842             ;;
2843         esac
2844         case "$targetfrom" in
2845         scp|rcp)
2846           cat >$from <<EOF
2847 #!/bin/sh
2848 for f in \$@
2849 do
2850   $rm -f \$f
2851   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2852 done
2853 exit 0
2854 EOF
2855             ;;
2856         cp) cat >$from <<EOF
2857 #!/bin/sh
2858 for f in \$@
2859 do
2860   $rm -f \$f
2861   cp $targetdir/\$f . || exit 1
2862 done
2863 exit 0
2864 EOF
2865             ;;
2866         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2867             exit 1
2868             ;;
2869         esac
2870         if $test ! -f $run; then
2871             echo "Target 'run' script '$run' not found." >&4
2872         else
2873             $chmod a+rx $run
2874         fi
2875         if $test ! -f $to; then
2876             echo "Target 'to' script '$to' not found." >&4
2877         else
2878             $chmod a+rx $to
2879         fi
2880         if $test ! -f $from; then
2881             echo "Target 'from' script '$from' not found." >&4
2882         else
2883             $chmod a+rx $from
2884         fi
2885         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2886             exit 1
2887         fi
2888         cat >&4 <<EOF
2889 Using '$run' for remote execution,
2890 and '$from' and '$to'
2891 for remote file transfer.
2892 EOF
2893         ;;
2894 *)      run=''
2895         to=:
2896         from=:
2897         usecrosscompile='undef'
2898         targetarch=''
2899         ;;
2900 esac
2901
2902 : see whether [:lower:] and [:upper:] are supported character classes
2903 echo " "
2904 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2905 ABYZ)
2906         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2907         up='[:upper:]'
2908         low='[:lower:]'
2909         ;;
2910 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2911         # (0xd9 and 0xe2), therefore that is a nice testing point.
2912         if test "X$up" = X -o "X$low" = X; then
2913             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2914             rs) up='[A-Z]'
2915                 low='[a-z]'
2916                 ;;
2917             esac
2918         fi
2919         if test "X$up" = X -o "X$low" = X; then
2920             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2921             rs) up='A-Z'
2922                 low='a-z'
2923                 ;;
2924             esac
2925         fi
2926         if test "X$up" = X -o "X$low" = X; then
2927             case "`echo RS | od -x 2>/dev/null`" in
2928             *D9E2*|*d9e2*)
2929                 echo "Hey, this might be EBCDIC." >&4
2930                 if test "X$up" = X -o "X$low" = X; then
2931                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2932                     rs) up='[A-IJ-RS-Z]'
2933                         low='[a-ij-rs-z]'
2934                         ;;
2935                     esac
2936                 fi
2937                 if test "X$up" = X -o "X$low" = X; then
2938                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2939                     rs) up='A-IJ-RS-Z'
2940                         low='a-ij-rs-z'
2941                         ;;
2942                     esac
2943                 fi
2944                 ;;
2945             esac
2946         fi
2947 esac
2948 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2949 rs)
2950     echo "Using $up and $low to convert case." >&4
2951     ;;
2952 *)
2953     echo "I don't know how to translate letters from upper to lower case." >&4
2954     echo "Your tr is not acting any way I know of." >&4
2955     exit 1
2956     ;;
2957 esac
2958 : set up the translation script tr, must be called with ./tr of course
2959 cat >tr <<EOSC
2960 $startsh
2961 case "\$1\$2" in
2962 '[A-Z][a-z]') exec $tr '$up' '$low';;
2963 '[a-z][A-Z]') exec $tr '$low' '$up';;
2964 esac
2965 exec $tr "\$@"
2966 EOSC
2967 chmod +x tr
2968 $eunicefix tr
2969
2970 : Try to determine whether config.sh was made on this system
2971 case "$config_sh" in
2972 '')
2973 myuname=`$uname -a 2>/dev/null`
2974 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2975 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2976 # because the A-Z/a-z are not consecutive.
2977 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2978         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2979 newmyuname="$myuname"
2980 dflt=n
2981 case "$knowitall" in
2982 '')
2983         if test -f ../config.sh; then
2984                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2985                         eval "`grep myuname= ../config.sh`"
2986                 fi
2987                 if test "X$myuname" = "X$newmyuname"; then
2988                         dflt=y
2989                 fi
2990         fi
2991         ;;
2992 *) dflt=y;;
2993 esac
2994
2995 : Get old answers from old config file if Configure was run on the
2996 : same system, otherwise use the hints.
2997 hint=default
2998 cd ..
2999 if test -f config.sh; then
3000         echo " "
3001         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3002         . UU/myread
3003         case "$ans" in
3004         n*|N*) echo "OK, I'll ignore it."
3005                 mv config.sh config.sh.old
3006                 myuname="$newmyuname"
3007                 ;;
3008         *)  echo "Fetching default answers from your old config.sh file..." >&4
3009                 tmp_n="$n"
3010                 tmp_c="$c"
3011                 tmp_sh="$sh"
3012                 . ./config.sh
3013                 cp config.sh UU
3014                 n="$tmp_n"
3015                 c="$tmp_c"
3016                 : Older versions did not always set $sh.  Catch re-use of such
3017                 : an old config.sh.
3018                 case "$sh" in
3019                 '') sh="$tmp_sh" ;;
3020                 esac
3021                 hint=previous
3022                 ;;
3023         esac
3024 fi
3025 . ./UU/checkcc
3026 if test ! -f config.sh; then
3027         $cat <<EOM
3028
3029 First time through, eh?  I have some defaults handy for some systems
3030 that need some extra help getting the Configure answers right:
3031
3032 EOM
3033         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3034         dflt=''
3035         : Half the following guesses are probably wrong... If you have better
3036         : tests or hints, please send them to perlbug@perl.org
3037         : The metaconfig authors would also appreciate a copy...
3038         $test -f /irix && osname=irix
3039         $test -f /xenix && osname=sco_xenix
3040         $test -f /dynix && osname=dynix
3041         $test -f /dnix && osname=dnix
3042         $test -f /lynx.os && osname=lynxos
3043         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3044         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3045         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3046         $test -f /bin/mips && /bin/mips && osname=mips
3047         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3048                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3049         $test -d /usr/apollo/bin && osname=apollo
3050         $test -f /etc/saf/_sactab && osname=svr4
3051         $test -d /usr/include/minix && osname=minix
3052         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3053         if $test -d /MachTen -o -d /MachTen_Folder; then
3054                 osname=machten
3055                 if $test -x /sbin/version; then
3056                         osvers=`/sbin/version | $awk '{print $2}' |
3057                         $sed -e 's/[A-Za-z]$//'`
3058                 elif $test -x /usr/etc/version; then
3059                         osvers=`/usr/etc/version | $awk '{print $2}' |
3060                         $sed -e 's/[A-Za-z]$//'`
3061                 else
3062                         osvers="$2.$3"
3063                 fi
3064         fi
3065
3066         $test -f /sys/posix.dll &&
3067                 $test -f /usr/bin/what &&
3068                 set X `/usr/bin/what /sys/posix.dll` &&
3069                 $test "$3" = UWIN &&
3070                 osname=uwin &&
3071                 osvers="$5"
3072
3073         if $test -f $uname; then
3074                 set X $myuname
3075                 shift
3076
3077                 case "$5" in
3078                 fps*) osname=fps ;;
3079                 mips*)
3080                         case "$4" in
3081                         umips) osname=umips ;;
3082                         *) osname=mips ;;
3083                         esac;;
3084                 [23]100) osname=mips ;;
3085                 next*) osname=next ;;
3086                 i386*)
3087                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3088                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3089                                 osname='sco'
3090                                 osvers=$tmp
3091                         elif $test -f /etc/kconfig; then
3092                                 osname=isc
3093                                 if test "$lns" = "$ln -s"; then
3094                                         osvers=4
3095                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3096                                         osvers=3
3097                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3098                                         osvers=2
3099                                 fi
3100                         fi
3101                         tmp=''
3102                         ;;
3103                 pc*)
3104                         if test -n "$DJGPP"; then
3105                                 osname=dos
3106                                 osvers=djgpp
3107                         fi
3108                         ;;
3109                 esac
3110
3111                 case "$1" in
3112                 aix) osname=aix
3113                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3114                         case "$tmp" in
3115                         # oslevel can fail with:
3116                         # oslevel: Unable to acquire lock.
3117                         *not\ found) osvers="$4"."$3" ;;
3118                         '<3240'|'<>3240') osvers=3.2.0 ;;
3119                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3120                         '=3250'|'>3250') osvers=3.2.5 ;;
3121                         *) osvers=$tmp;;
3122                         esac
3123                         ;;
3124                 bsd386) osname=bsd386
3125                         osvers=`$uname -r`
3126                         ;;
3127                 cygwin*) osname=cygwin
3128                         osvers="$3"
3129                         ;;
3130                 *dc.osx) osname=dcosx
3131                         osvers="$3"
3132                         ;;
3133                 dnix) osname=dnix
3134                         osvers="$3"
3135                         ;;
3136                 domainos) osname=apollo
3137                         osvers="$3"
3138                         ;;
3139                 dgux)   osname=dgux
3140                         osvers="$3"
3141                         ;;
3142                 dragonfly) osname=dragonfly
3143                         osvers="$3"
3144                         ;;
3145                 dynixptx*) osname=dynixptx
3146                         osvers=`echo "$4"|sed 's/^v//'`
3147                         ;;
3148                 freebsd) osname=freebsd
3149                         osvers="$3" ;;
3150                 genix)  osname=genix ;;
3151                 gnu)    osname=gnu
3152                         osvers="$3" ;;
3153                 hp*)    osname=hpux
3154                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3155                         ;;
3156                 irix*)  osname=irix
3157                         case "$3" in
3158                         4*) osvers=4 ;;
3159                         5*) osvers=5 ;;
3160                         *)      osvers="$3" ;;
3161                         esac
3162                         ;;
3163                 linux)  osname=linux
3164                         case "$3" in
3165                         *)      osvers="$3" ;;
3166                         esac
3167                         ;;
3168                 MiNT)   osname=mint
3169                         ;;
3170                 netbsd*) osname=netbsd
3171                         osvers="$3"
3172                         ;;
3173                 news-os) osvers="$3"
3174                         case "$3" in
3175                         4*) osname=newsos4 ;;
3176                         *) osname=newsos ;;
3177                         esac
3178                         ;;
3179                 next*) osname=next ;;
3180                 nonstop-ux) osname=nonstopux ;;
3181                 openbsd) osname=openbsd
3182                         osvers="$3"
3183                         ;;
3184                 os2)    osname=os2
3185                         osvers="$4"
3186                         ;;
3187                 POSIX-BC | posix-bc ) osname=posix-bc
3188                         osvers="$3"
3189                         ;;
3190                 powerux | power_ux | powermax_os | powermaxos | \
3191                 powerunix | power_unix) osname=powerux
3192                         osvers="$3"
3193                         ;;
3194                 qnx) osname=qnx
3195                         osvers="$4"
3196                         ;;
3197                 solaris) osname=solaris
3198                         case "$3" in
3199                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3200                         *)      osvers="$3" ;;
3201                         esac
3202                         ;;
3203                 sunos) osname=sunos
3204                         case "$3" in
3205                         5*) osname=solaris
3206                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3207                         *)      osvers="$3" ;;
3208                         esac
3209                         ;;
3210                 titanos) osname=titanos
3211                         case "$3" in
3212                         1*) osvers=1 ;;
3213                         2*) osvers=2 ;;
3214                         3*) osvers=3 ;;
3215                         4*) osvers=4 ;;
3216                         *)      osvers="$3" ;;
3217                         esac
3218                         ;;
3219                 ultrix) osname=ultrix
3220                         osvers="$3"
3221                         ;;
3222                 osf1|mls+)      case "$5" in
3223                                 alpha)
3224                                         osname=dec_osf
3225                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3226                                         case "$osvers" in
3227                                         [1-9].[0-9]*) ;;
3228                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3229                                         esac
3230                                         ;;
3231                         hp*)    osname=hp_osf1  ;;
3232                         mips)   osname=mips_osf1 ;;
3233                         esac
3234                         ;;
3235                 # UnixWare 7.1.2 is known as Open UNIX 8
3236                 openunix|unixware) osname=svr5
3237                         osvers="$4"
3238                         ;;
3239                 uts)    osname=uts
3240                         osvers="$3"
3241                         ;;
3242                 vos) osvers="$3"
3243                         ;;
3244                 $2) case "$osname" in
3245                         *isc*) ;;
3246                         *freebsd*) ;;
3247                         svr*)
3248                                 : svr4.x or possibly later
3249                                 case "svr$3" in
3250                                 ${osname}*)
3251                                         osname=svr$3
3252                                         osvers=$4
3253                                         ;;
3254                                 esac
3255                                 case "$osname" in
3256                                 svr4.0)
3257                                         : Check for ESIX
3258                                         if test -f /stand/boot ; then
3259                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3260                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3261                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3262                                                         if test -n "$isesix"; then
3263                                                                 osname=esix4
3264                                                         fi
3265                                                 fi
3266                                         fi
3267                                         ;;
3268                                 esac
3269                                 ;;
3270                         *)      if test -f /etc/systemid; then
3271                                         osname=sco
3272                                         set `echo $3 | $sed 's/\./ /g'` $4
3273                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3274                                                 osvers=$1.$2.$3
3275                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3276                                                 osvers=$1.$2
3277                                         elif $test -f $src/hints/sco_$1.sh; then
3278                                                 osvers=$1
3279                                         fi
3280                                 else
3281                                         case "$osname" in
3282                                         '') : Still unknown.  Probably a generic Sys V.
3283                                                 osname="sysv"
3284                                                 osvers="$3"
3285                                                 ;;
3286                                         esac
3287                                 fi
3288                                 ;;
3289                         esac
3290                         ;;
3291                 *)      case "$osname" in
3292                         '') : Still unknown.  Probably a generic BSD.
3293                                 osname="$1"
3294                                 osvers="$3"
3295                                 ;;
3296                         esac
3297                         ;;
3298                 esac
3299         else
3300                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3301                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3302                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3303                                 osname=news_os
3304                         fi
3305                         $rm -f UU/kernel.what
3306                 elif test -d c:/. -o -n "$is_os2" ; then
3307                         set X $myuname
3308                         osname=os2
3309                         osvers="$5"
3310                 fi
3311         fi
3312
3313         case "$targetarch" in
3314         '') ;;
3315         *)  hostarch=$osname
3316             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3317             osvers=''
3318             ;;
3319         esac
3320
3321         : Now look for a hint file osname_osvers, unless one has been
3322         : specified already.
3323         case "$hintfile" in
3324         ''|' ')
3325                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3326                 : Also try without trailing minor version numbers.
3327                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3328                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3329                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3330                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3331                 case "$file" in
3332                 '') dflt=none ;;
3333                 *)  case "$osvers" in
3334                         '') dflt=$file
3335                                 ;;
3336                         *)  if $test -f $src/hints/$file.sh ; then
3337                                         dflt=$file
3338                                 elif $test -f $src/hints/$xfile.sh ; then
3339                                         dflt=$xfile
3340                                 elif $test -f $src/hints/$xxfile.sh ; then
3341                                         dflt=$xxfile
3342                                 elif $test -f $src/hints/$xxxfile.sh ; then
3343                                         dflt=$xxxfile
3344                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3345                                         dflt=$xxxxfile
3346                                 elif $test -f "$src/hints/${osname}.sh" ; then
3347                                         dflt="${osname}"
3348                                 else
3349                                         dflt=none
3350                                 fi
3351                                 ;;
3352                         esac
3353                         ;;
3354                 esac
3355                 if $test -f Policy.sh ; then
3356                         case "$dflt" in
3357                         *Policy*) ;;
3358                         none) dflt="Policy" ;;
3359                         *) dflt="Policy $dflt" ;;
3360                         esac
3361                 fi
3362                 ;;
3363         *)
3364                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3365                 ;;
3366         esac
3367
3368         if $test -f Policy.sh ; then
3369                 $cat <<EOM
3370
3371 There's also a Policy hint file available, which should make the
3372 site-specific (policy) questions easier to answer.
3373 EOM
3374
3375         fi
3376
3377         $cat <<EOM
3378
3379 You may give one or more space-separated answers, or "none" if appropriate.
3380 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3381 is a good thing.  DO NOT give a wrong version or a wrong OS.
3382
3383 EOM
3384
3385         rp="Which of these apply, if any?"
3386         . UU/myread
3387         tans=$ans
3388         for file in $tans; do
3389                 if $test X$file = XPolicy -a -f Policy.sh; then
3390                         . Policy.sh
3391                         $cat Policy.sh >> UU/config.sh
3392                 elif $test -f $src/hints/$file.sh; then
3393                         . $src/hints/$file.sh
3394                         $cat $src/hints/$file.sh >> UU/config.sh
3395                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3396                         : nothing
3397                 else
3398                         : Give one chance to correct a possible typo.
3399                         echo "$file.sh does not exist"
3400                         dflt=$file
3401                         rp="hint to use instead?"
3402                         . UU/myread
3403                         for file in $ans; do
3404                                 if $test -f "$src/hints/$file.sh"; then
3405                                         . $src/hints/$file.sh
3406                                         $cat $src/hints/$file.sh >> UU/config.sh
3407                                 elif $test X$ans = X -o X$ans = Xnone ; then
3408                                         : nothing
3409                                 else
3410                                         echo "$file.sh does not exist -- ignored."
3411                                 fi
3412                         done
3413                 fi
3414         done
3415
3416         hint=recommended
3417         : Remember our hint file for later.
3418         if $test -f "$src/hints/$file.sh" ; then
3419                 hintfile="$file"
3420         else
3421                 hintfile=''
3422         fi
3423 fi
3424 cd UU
3425 ;;
3426 *)
3427         echo " "
3428         echo "Fetching default answers from $config_sh..." >&4
3429         tmp_n="$n"
3430         tmp_c="$c"
3431         cd ..
3432         cp $config_sh config.sh 2>/dev/null
3433         chmod +w config.sh
3434         . ./config.sh
3435         cd UU
3436         cp ../config.sh .
3437         n="$tmp_n"
3438         c="$tmp_c"
3439         hint=previous
3440         ;;
3441 esac
3442 test "$override" && . ./optdef.sh
3443
3444 : Restore computed paths
3445 for file in $loclist $trylist; do
3446         eval $file="\$_$file"
3447 done
3448
3449 cat << EOM
3450
3451 Configure uses the operating system name and version to set some defaults.
3452 The default value is probably right if the name rings a bell. Otherwise,
3453 since spelling matters for me, either accept the default or answer "none"
3454 to leave it blank.
3455
3456 EOM
3457 case "$osname" in
3458         ''|' ')
3459                 case "$hintfile" in
3460                 ''|' '|none) dflt=none ;;
3461                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3462                 esac
3463                 ;;
3464         *) dflt="$osname" ;;
3465 esac
3466 rp="Operating system name?"
3467 . ./myread
3468 case "$ans" in
3469 none)  osname='' ;;
3470 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3471 esac
3472 echo " "
3473 case "$osvers" in
3474         ''|' ')
3475                 case "$hintfile" in
3476                 ''|' '|none) dflt=none ;;
3477                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3478                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3479                         case "$dflt" in
3480                         ''|' ') dflt=none ;;
3481                         esac
3482                         ;;
3483                 esac
3484                 ;;
3485         *) dflt="$osvers" ;;
3486 esac
3487 rp="Operating system version?"
3488 . ./myread
3489 case "$ans" in
3490 none)  osvers='' ;;
3491 *) osvers="$ans" ;;
3492 esac
3493
3494
3495 . ./posthint.sh
3496
3497 : who configured the system
3498 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3499 case "$cf_by" in
3500 "")
3501         cf_by=`(logname) 2>/dev/null`
3502         case "$cf_by" in
3503         "")
3504                 cf_by=`(whoami) 2>/dev/null`
3505                 case "$cf_by" in
3506                 "") cf_by=unknown ;;
3507                 esac ;;
3508         esac ;;
3509 esac
3510
3511 : set up the script used to warn in case of inconsistency
3512 cat <<EOS >whoa
3513 $startsh
3514 EOS
3515 cat <<'EOSC' >>whoa
3516 dflt=y
3517 echo " "
3518 echo "*** WHOA THERE!!! ***" >&4
3519 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3520 rp="    Keep the $hint value?"
3521 . ./myread
3522 case "$ans" in
3523 y) td=$was; tu=$was;;
3524 esac
3525 EOSC
3526
3527 : function used to set $1 to $val
3528 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3529 case "$val$was" in
3530 $define$undef) . ./whoa; eval "$var=\$td";;
3531 $undef$define) . ./whoa; eval "$var=\$tu";;
3532 *) eval "$var=$val";;
3533 esac'
3534
3535 case "$usesocks" in
3536 $define|true|[yY]*)     dflt='y';;
3537 *) dflt='n';;
3538 esac
3539 cat <<EOM
3540
3541 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3542 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3543 to use the PerlIO abstraction layer, this will be implicitly selected.
3544
3545 If this doesn't make any sense to you, just accept the default '$dflt'.
3546 EOM
3547 rp='Build Perl for SOCKS?'
3548 . ./myread
3549 case "$ans" in
3550 y|Y)    val="$define" ;;     
3551 *)      val="$undef" ;;
3552 esac
3553 set usesocks
3554 eval $setvar
3555
3556 case "$usesocks" in
3557 $define|true|[yY]*) useperlio="$define";;
3558 esac
3559
3560 case "$useperlio" in
3561 $define|true|[yY]*|'')  dflt='y';;
3562 *) dflt='n';;
3563 esac
3564 cat <<EOM
3565
3566 Previous version of $package used the standard IO mechanisms as
3567 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
3568 alternate IO mechanisms via the PerlIO abstraction layer, but the
3569 stdio mechanism is still available if needed.  The abstraction layer
3570 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3571 Using PerlIO with sfio may cause problems with some extension modules.
3572
3573 If this doesn't make any sense to you, just accept the default '$dflt'.
3574 EOM
3575 rp='Use the PerlIO abstraction layer?'
3576 . ./myread
3577 case "$ans" in
3578 y|Y) 
3579         val="$define"
3580         ;;
3581 *)      
3582         echo "Ok, doing things the stdio way."
3583         val="$undef"
3584         ;;
3585 esac
3586 set useperlio
3587 eval $setvar 
3588
3589 case "$usesocks" in
3590 $define|true|[yY]*)
3591         case "$useperlio" in
3592         $define|true|[yY]*) ;;
3593         *)      cat >&4 <<EOM
3594
3595 You are using the SOCKS proxy protocol library which means that you
3596 should also use the PerlIO layer.  You may be headed for trouble.
3597
3598 EOM
3599                 ;;
3600         esac
3601         ;;
3602 esac
3603
3604         
3605 case "$usethreads" in
3606 $define|true|[yY]*)     dflt='y';;
3607 *)     # Catch case where user specified ithreads or 5005threads but
3608        # forgot -Dusethreads (A.D. 4/2002)
3609        case "$useithreads$use5005threads" in
3610        *$define*)      
3611                 case "$useperlio" in
3612                 "$define")      dflt='y' ;;
3613                 *)              dflt='n' ;;
3614                 esac
3615                 ;;
3616        *)       dflt='n';;
3617        esac
3618        ;;
3619 esac
3620 cat <<EOM
3621
3622 Perl can be built to take advantage of threads on some systems.
3623 To do so, Configure can be run with -Dusethreads.
3624
3625 Note that Perl built with threading support runs slightly slower
3626 and uses more memory than plain Perl. The current implementation
3627 is believed to be stable, but it is fairly new, and so should be
3628 treated with caution.
3629
3630 If this doesn't make any sense to you, just accept the default '$dflt'.
3631 EOM
3632 rp='Build a threading Perl?'
3633 . ./myread
3634 case "$ans" in
3635 y|Y)    val="$define" ;;
3636 *)      val="$undef" ;;
3637 esac
3638 set usethreads
3639 eval $setvar
3640
3641 case "$usethreads" in
3642 $define)
3643         $cat <<EOM
3644
3645 Since release 5.6, Perl has had two different threading implementations,
3646 the newer interpreter-based version (ithreads) with one interpreter per
3647 thread, and the older 5.005 version (5005threads).
3648 The 5005threads version is effectively unmaintained and will probably be
3649 removed in Perl 5.10, so there should be no need to build a Perl using it
3650 unless needed for backwards compatibility with some existing 5.005threads
3651 code.
3652
3653 EOM
3654         : Default to ithreads unless overridden on command line or with
3655         : old config.sh
3656         dflt='y'
3657         case "$use5005threads" in
3658                 $define|true|[yY]*) dflt='n';;
3659         esac
3660         case "$useithreads" in
3661                 $undef|false|[nN]*) dflt='n';;
3662         esac
3663         rp='Use the newer interpreter-based ithreads?'
3664         . ./myread
3665         case "$ans" in
3666         y|Y)    val="$define" ;;
3667         *)      val="$undef" ;;
3668         esac
3669         set useithreads
3670         eval $setvar
3671         : Now set use5005threads to the opposite value.
3672         case "$useithreads" in
3673         $define) val="$undef" ;;
3674         *) val="$define" ;;
3675         esac
3676         set use5005threads
3677         eval $setvar
3678         ;;
3679 *)
3680         useithreads="$undef"
3681         use5005threads="$undef"
3682         ;;
3683 esac
3684
3685 case "$useithreads$use5005threads" in
3686 "$define$define")
3687         $cat >&4 <<EOM
3688
3689 You cannot have both the ithreads and the 5.005 threads enabled
3690 at the same time.  Disabling the 5.005 threads since they are
3691 much less stable than the ithreads.
3692
3693 EOM
3694         use5005threads="$undef"
3695         ;;
3696 esac
3697
3698 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
3699         cat >&4 <<EOF
3700 ***
3701 *** To build with ithreads you must also use the PerlIO layer.
3702 *** Cannot continue, aborting.
3703 ***
3704 EOF
3705         exit 1
3706 fi
3707
3708 case "$d_oldpthreads" in
3709 '')     : Configure tests would be welcome here.  For now, assume undef.
3710         val="$undef" ;;
3711 *)      val="$d_oldpthreads" ;;
3712 esac
3713 set d_oldpthreads
3714 eval $setvar
3715
3716
3717 : Look for a hint-file generated 'call-back-unit'.  If the
3718 : user has specified that a threading perl is to be built,
3719 : we may need to set or change some other defaults.
3720 if $test -f usethreads.cbu; then
3721     echo "Your platform has some specific hints regarding threaded builds, using them..."
3722     . ./usethreads.cbu
3723 else
3724     case "$usethreads" in
3725         "$define"|true|[yY]*)
3726                 $cat <<EOM
3727 (Your platform does not have any specific hints for threaded builds.
3728  Assuming POSIX threads, then.)
3729 EOM
3730         ;;
3731     esac
3732 fi
3733
3734 cat <<EOM
3735
3736 Perl can be built so that multiple Perl interpreters can coexist
3737 within the same Perl executable.
3738 EOM
3739
3740 case "$useithreads" in
3741 $define)
3742         cat <<EOM
3743 This multiple interpreter support is required for interpreter-based threads.
3744 EOM
3745         val="$define"
3746         ;;
3747 *)      case "$usemultiplicity" in
3748         $define|true|[yY]*)     dflt='y';;
3749         *) dflt='n';;
3750         esac
3751         echo " "
3752         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3753         rp='Build Perl for multiplicity?'
3754         . ./myread
3755         case "$ans" in
3756         y|Y)    val="$define" ;;
3757         *)      val="$undef" ;;
3758         esac
3759         ;;
3760 esac
3761 set usemultiplicity
3762 eval $setvar
3763
3764
3765 case "$usemorebits" in
3766 "$define"|true|[yY]*)
3767         use64bitint="$define"
3768         uselongdouble="$define"
3769         usemorebits="$define"
3770         ;;
3771 *)      usemorebits="$undef"
3772         ;;
3773 esac
3774
3775 : make some quick guesses about what we are up against
3776 echo " "
3777 $echo $n "Hmm...  $c"
3778 echo exit 1 >bsd
3779 echo exit 1 >usg
3780 echo exit 1 >v7
3781 echo exit 1 >osf1
3782 echo exit 1 >eunice
3783 echo exit 1 >xenix
3784 echo exit 1 >venix
3785 echo exit 1 >os2
3786 d_bsd="$undef"
3787 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3788 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3789 then
3790         echo "Looks kind of like an OSF/1 system, but we'll see..."
3791         echo exit 0 >osf1
3792 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3793         xxx=`./loc addbib blurfl $pth`
3794         if $test -f $xxx; then
3795         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3796                 echo exit 0 >bsd
3797                 echo exit 0 >usg
3798         else
3799                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3800                         echo "Looks kind of like an extended USG system, but we'll see..."
3801                 else
3802                         echo "Looks kind of like a USG system, but we'll see..."
3803                 fi
3804                 echo exit 0 >usg
3805         fi
3806 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3807         echo "Looks kind of like a BSD system, but we'll see..."
3808         d_bsd="$define"
3809         echo exit 0 >bsd
3810 else
3811         echo "Looks kind of like a Version 7 system, but we'll see..."
3812         echo exit 0 >v7
3813 fi
3814 case "$eunicefix" in
3815 *unixtovms*)
3816         $cat <<'EOI'
3817 There is, however, a strange, musty smell in the air that reminds me of
3818 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3819 EOI
3820         echo exit 0 >eunice
3821         d_eunice="$define"
3822 : it so happens the Eunice I know will not run shell scripts in Unix format
3823         ;;
3824 *)
3825         echo " "
3826         echo "Congratulations.  You aren't running Eunice."
3827         d_eunice="$undef"
3828         ;;
3829 esac
3830 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3831 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3832 : semicolon as a patch separator
3833 case "$p_" in
3834 :) ;;
3835 *)
3836         $cat <<'EOI'
3837 I have the feeling something is not exactly right, however...don't tell me...
3838 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3839 (Or you may be running DOS with DJGPP.)
3840 EOI
3841         echo exit 0 >os2
3842         ;;
3843 esac
3844 if test -f /xenix; then
3845         echo "Actually, this looks more like a XENIX system..."
3846         echo exit 0 >xenix
3847         d_xenix="$define"
3848 else
3849         echo " "
3850         echo "It's not Xenix..."
3851         d_xenix="$undef"
3852 fi
3853 chmod +x xenix
3854 $eunicefix xenix
3855 if test -f /venix; then
3856         echo "Actually, this looks more like a VENIX system..."
3857         echo exit 0 >venix
3858 else
3859         echo " "
3860         if ./xenix; then
3861                 : null
3862         else
3863                 echo "Nor is it Venix..."
3864         fi
3865 fi
3866 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3867 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3868 $rm -f foo
3869
3870 case "$cc" in
3871 '') dflt=cc;;
3872 *) dflt="$cc";;
3873 esac
3874 rp="Use which C compiler?"
3875 . ./myread
3876 cc="$ans"
3877
3878 : See if they have not cc but they do have gcc
3879 . ./trygcc
3880 : Look for a hint-file generated 'call-back-unit'.  Now that the
3881 : user has specified the compiler, we may need to set or change some
3882 : other defaults.
3883 if $test -f cc.cbu; then
3884     . ./cc.cbu
3885 fi
3886 . ./checkcc
3887
3888 echo " "
3889 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3890 $cat >try.c <<EOM
3891 #include <stdio.h>
3892 int main() {
3893 #ifdef __GNUC__
3894 #ifdef __VERSION__
3895         printf("%s\n", __VERSION__);
3896 #else
3897         printf("%s\n", "1");
3898 #endif
3899 #endif
3900         return(0);
3901 }
3902 EOM
3903 if $cc -o try $ccflags $ldflags try.c; then
3904         gccversion=`$run ./try`
3905         case "$gccversion" in
3906         '') echo "You are not using GNU cc." ;;
3907         *)  echo "You are using GNU cc $gccversion."
3908             ccname=gcc
3909             ;;
3910         esac
3911 else
3912         echo " "
3913         echo "*** WHOA THERE!!! ***" >&4
3914         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3915         case "$knowitall" in
3916         '')
3917         echo "    You'd better start hunting for one and let me know about it." >&4
3918                 exit 1
3919                 ;;
3920         esac
3921 fi
3922 $rm -f try try.*
3923 case "$gccversion" in
3924 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3925 esac
3926 case "$gccversion" in
3927 '') gccosandvers='' ;;
3928 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3929    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3930    gccshortvers=''
3931    case "$gccosandvers" in
3932    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3933    $osname$osvers) ;; # looking good
3934    $osname*) cat <<EOM >&4
3935
3936 *** WHOA THERE!!! ***
3937
3938     Your gcc has not been compiled for the exact release of
3939     your operating system ($gccosandvers versus $osname$osvers).
3940
3941     In general it is a good idea to keep gcc synchronized with
3942     the operating system because otherwise serious problems
3943     may ensue when trying to compile software, like Perl.
3944
3945     I'm trying to be optimistic here, though, and will continue.
3946     If later during the configuration and build icky compilation
3947     problems appear (headerfile conflicts being the most common
3948     manifestation), I suggest reinstalling the gcc to match
3949     your operating system release.
3950
3951 EOM
3952       ;;
3953    *) gccosandvers='' ;; # failed to parse, better be silent
3954    esac
3955    ;;
3956 esac
3957 case "$ccname" in
3958 '') ccname="$cc" ;;
3959 esac
3960
3961 # gcc 3.* complain about adding -Idirectories that they already know about,
3962 # so we will take those off from locincpth.
3963 case "$gccversion" in
3964 3*)
3965     echo "main(){}">try.c
3966     for incdir in $locincpth; do
3967        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
3968              grep '^c[cp]p*[01]: warning: changing search order '`
3969        if test "X$warn" != X; then
3970            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
3971        fi
3972     done
3973     $rm -f try try.*
3974 esac
3975
3976 : decide how portable to be.  Allow command line overrides.
3977 case "$d_portable" in
3978 "$undef") ;;
3979 *)      d_portable="$define" ;;
3980 esac
3981
3982 : set up shell script to do ~ expansion
3983 cat >filexp <<EOSS
3984 $startsh
3985 : expand filename
3986 case "\$1" in
3987  ~/*|~)
3988         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3989         ;;
3990  ~*)
3991         if $test -f /bin/csh; then
3992                 /bin/csh -f -c "glob \$1"
3993                 failed=\$?
3994                 echo ""
3995                 exit \$failed
3996         else
3997                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3998                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3999                 if $test ! -d "\$dir"; then
4000                         me=\`basename \$0\`
4001                         echo "\$me: can't locate home directory for: \$name" >&2
4002                         exit 1
4003                 fi
4004                 case "\$1" in
4005                 */*)
4006                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
4007                         ;;
4008                 *)
4009                         echo \$dir
4010                         ;;
4011                 esac
4012         fi
4013         ;;
4014 *)
4015         echo \$1
4016         ;;
4017 esac
4018 EOSS
4019 chmod +x filexp
4020 $eunicefix filexp
4021
4022 : now set up to get a file name
4023 cat <<EOS >getfile
4024 $startsh
4025 EOS
4026 cat <<'EOSC' >>getfile
4027 tilde=''
4028 fullpath=''
4029 already=''
4030 skip=''
4031 none_ok=''
4032 exp_file=''
4033 nopath_ok=''
4034 orig_rp="$rp"
4035 orig_dflt="$dflt"
4036 case "$gfpth" in
4037 '') gfpth='.' ;;
4038 esac
4039
4040 case "$fn" in
4041 *\(*)
4042         : getfile will accept an answer from the comma-separated list
4043         : enclosed in parentheses even if it does not meet other criteria.
4044         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
4045         fn=`echo $fn | sed 's/(.*)//'`
4046         ;;
4047 esac
4048
4049 case "$fn" in
4050 *:*)
4051         loc_file=`expr $fn : '.*:\(.*\)'`
4052         fn=`expr $fn : '\(.*\):.*'`
4053         ;;
4054 esac
4055
4056 case "$fn" in
4057 *~*) tilde=true;;
4058 esac
4059 case "$fn" in
4060 */*) fullpath=true;;
4061 esac
4062 case "$fn" in
4063 *+*) skip=true;;
4064 esac
4065 case "$fn" in
4066 *n*) none_ok=true;;
4067 esac
4068 case "$fn" in
4069 *e*) exp_file=true;;
4070 esac
4071 case "$fn" in
4072 *p*) nopath_ok=true;;
4073 esac
4074
4075 case "$fn" in
4076 *f*) type='File';;
4077 *d*) type='Directory';;
4078 *l*) type='Locate';;
4079 esac
4080
4081 what="$type"
4082 case "$what" in
4083 Locate) what='File';;
4084 esac
4085
4086 case "$exp_file" in
4087 '')
4088         case "$d_portable" in
4089         "$define") ;;
4090         *) exp_file=true;;
4091         esac
4092         ;;
4093 esac
4094
4095 cd ..
4096 while test "$type"; do
4097         redo=''
4098         rp="$orig_rp"
4099         dflt="$orig_dflt"
4100         case "$tilde" in
4101         true) rp="$rp (~name ok)";;
4102         esac
4103         . UU/myread
4104         if test -f UU/getfile.ok && \
4105                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4106         then
4107                 value="$ans"
4108                 ansexp="$ans"
4109                 break
4110         fi
4111         case "$ans" in
4112         none)
4113                 value=''
4114                 ansexp=''
4115                 case "$none_ok" in
4116                 true) type='';;
4117                 esac
4118                 ;;
4119         *)
4120                 case "$tilde" in
4121                 '') value="$ans"
4122                         ansexp="$ans";;
4123                 *)
4124                         value=`UU/filexp $ans`
4125                         case $? in
4126                         0)
4127                                 if test "$ans" != "$value"; then
4128                                         echo "(That expands to $value on this system.)"
4129                                 fi
4130                                 ;;
4131                         *) value="$ans";;
4132                         esac
4133                         ansexp="$value"
4134                         case "$exp_file" in
4135                         '') value="$ans";;
4136                         esac
4137                         ;;
4138                 esac
4139                 case "$fullpath" in
4140                 true)
4141                         case "$ansexp" in
4142                         /*) value="$ansexp" ;;
4143                         [a-zA-Z]:/*) value="$ansexp" ;;
4144                         *)
4145                                 redo=true
4146                                 case "$already" in
4147                                 true)
4148                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4149                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4150                                         ;;
4151                                 *)
4152                                 echo "Please give a full path name, starting with slash." >&4
4153                                         case "$tilde" in
4154                                         true)
4155                                 echo "Note that using ~name is ok provided it expands well." >&4
4156                                                 already=true
4157                                                 ;;
4158                                         esac
4159                                 esac
4160                                 ;;
4161                         esac
4162                         ;;
4163                 esac
4164                 case "$redo" in
4165                 '')
4166                         case "$type" in
4167                         File)
4168                                 for fp in $gfpth; do
4169                                         if test "X$fp" = X.; then
4170                                             pf="$ansexp"
4171                                         else    
4172                                             pf="$fp/$ansexp"
4173                                         fi
4174                                         if test -f "$pf"; then
4175                                                 type=''
4176                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4177                                         then
4178                                                 echo "($value is not a plain file, but that's ok.)"
4179                                                 type=''
4180                                         fi
4181                                         if test X"$type" = X; then
4182                                             value="$pf"
4183                                             break
4184                                         fi
4185                                 done
4186                                 ;;
4187                         Directory)
4188                                 for fp in $gfpth; do
4189                                         if test "X$fp" = X.; then
4190                                             dir="$ans"
4191                                             direxp="$ansexp"
4192                                         else    
4193                                             dir="$fp/$ansexp"
4194                                             direxp="$fp/$ansexp"
4195                                         fi
4196                                         if test -d "$direxp"; then
4197                                                 type=''
4198                                                 value="$dir"
4199                                                 break
4200                                         fi
4201                                 done
4202                                 ;;
4203                         Locate)
4204                                 if test -d "$ansexp"; then
4205                                         echo "(Looking for $loc_file in directory $value.)"
4206                                         value="$value/$loc_file"
4207                                         ansexp="$ansexp/$loc_file"
4208                                 fi
4209                                 if test -f "$ansexp"; then
4210                                         type=''
4211                                 fi
4212                                 case "$nopath_ok" in
4213                                 true)   case "$value" in
4214                                         */*) ;;
4215                                         *)      echo "Assuming $value will be in people's path."
4216                                                 type=''
4217                                                 ;;
4218                                         esac
4219                                         ;;
4220                                 esac
4221                                 ;;
4222                         esac
4223
4224                         case "$skip" in
4225                         true) type='';
4226                         esac
4227
4228                         case "$type" in
4229                         '') ;;
4230                         *)
4231                                 if test "$fastread" = yes; then
4232                                         dflt=y
4233                                 else
4234                                         dflt=n
4235                                 fi
4236                                 rp="$what $value doesn't exist.  Use that name anyway?"
4237                                 . UU/myread
4238                                 dflt=''
4239                                 case "$ans" in
4240                                 y*) type='';;
4241                                 *) echo " ";;
4242                                 esac
4243                                 ;;
4244                         esac
4245                         ;;
4246                 esac
4247                 ;;
4248         esac
4249 done
4250 cd UU
4251 ans="$value"
4252 rp="$orig_rp"
4253 dflt="$orig_dflt"
4254 rm -f getfile.ok
4255 test "X$gfpthkeep" != Xy && gfpth=""
4256 EOSC
4257
4258 : What should the include directory be ?
4259 echo " "
4260 $echo $n "Hmm...  $c"
4261 dflt='/usr/include'
4262 incpath=''
4263 mips_type=''
4264 if $test -f /bin/mips && /bin/mips; then
4265         echo "Looks like a MIPS system..."
4266         $cat >usr.c <<'EOCP'
4267 #ifdef SYSTYPE_BSD43
4268 /bsd43
4269 #endif
4270 EOCP
4271         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4272                 dflt='/bsd43/usr/include'
4273                 incpath='/bsd43'
4274                 mips_type='BSD 4.3'
4275         else
4276                 mips_type='System V'
4277         fi
4278         $rm -f usr.c usr.out
4279         echo "and you're compiling with the $mips_type compiler and libraries."
4280         xxx_prompt=y
4281         echo "exit 0" >mips
4282 else
4283         echo "Doesn't look like a MIPS system."
4284         xxx_prompt=n
4285         echo "exit 1" >mips
4286 fi
4287 chmod +x mips
4288 $eunicefix mips
4289 case "$usrinc" in
4290 '') ;;
4291 *) dflt="$usrinc";;
4292 esac
4293 case "$xxx_prompt" in
4294 y)      fn=d/
4295         echo " "
4296         rp='Where are the include files you want to use?'
4297         . ./getfile
4298         usrinc="$ans"
4299         ;;
4300 *)      usrinc="$dflt"
4301         ;;
4302 esac
4303
4304 : see how we invoke the C preprocessor
4305 echo " "
4306 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4307 cat <<'EOT' >testcpp.c
4308 #define ABC abc
4309 #define XYZ xyz
4310 ABC.XYZ
4311 EOT
4312 cd ..
4313 if test ! -f cppstdin; then
4314         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4315                 # AIX cc -E doesn't show the absolute headerfile
4316                 # locations but we'll cheat by using the -M flag.
4317                 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
4318         else
4319                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4320         fi
4321 else
4322         echo "Keeping your $hint cppstdin wrapper."
4323 fi
4324 chmod 755 cppstdin
4325 wrapper=`pwd`/cppstdin
4326 ok='false'
4327 cd UU
4328
4329 if $test "X$cppstdin" != "X" && \
4330         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4331         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4332 then
4333         echo "You used to use $cppstdin $cppminus so we'll use that again."
4334         case "$cpprun" in
4335         '') echo "But let's see if we can live without a wrapper..." ;;
4336         *)
4337                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4338                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4339                 then
4340                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4341                         ok='true'
4342                 else
4343                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4344                 fi
4345                 ;;
4346         esac
4347 else
4348         case "$cppstdin" in
4349         '') ;;
4350         *)
4351                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4352                 ;;
4353         esac
4354 fi
4355
4356 if $ok; then
4357         : nothing
4358 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4359         $cc -E <testcpp.c >testcpp.out 2>&1; \
4360         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4361         echo "Yup, it does."
4362         x_cpp="$cc -E"
4363         x_minus='';
4364 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4365         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4366         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4367         echo "Yup, it does."
4368         x_cpp="$cc -E"
4369         x_minus='-';
4370 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4371         $cc -P <testcpp.c >testcpp.out 2>&1; \
4372         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4373         echo "Yipee, that works!"
4374         x_cpp="$cc -P"
4375         x_minus='';
4376 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4377         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4378         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4379         echo "At long last!"
4380         x_cpp="$cc -P"
4381         x_minus='-';
4382 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4383         $cpp <testcpp.c >testcpp.out 2>&1; \
4384         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4385         echo "It works!"
4386         x_cpp="$cpp"
4387         x_minus='';
4388 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4389         $cpp - <testcpp.c >testcpp.out 2>&1; \
4390         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4391         echo "Hooray, it works!  I was beginning to wonder."
4392         x_cpp="$cpp"
4393         x_minus='-';
4394 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4395         $wrapper <testcpp.c >testcpp.out 2>&1; \
4396         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4397         x_cpp="$wrapper"
4398         x_minus=''
4399         echo "Eureka!"
4400 else
4401         dflt=''
4402         rp="No dice.  I can't find a C preprocessor.  Name one:"
4403         . ./myread
4404         x_cpp="$ans"
4405         x_minus=''
4406         $x_cpp <testcpp.c >testcpp.out 2>&1
4407         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4408                 echo "OK, that will do." >&4
4409         else
4410 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4411                 exit 1
4412         fi
4413 fi
4414
4415 case "$ok" in
4416 false)
4417         cppstdin="$x_cpp"
4418         cppminus="$x_minus"
4419         cpprun="$x_cpp"
4420         cpplast="$x_minus"
4421         set X $x_cpp
4422         shift
4423         case "$1" in
4424         "$cpp")
4425                 echo "Perhaps can we force $cc -E using a wrapper..."
4426                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4427                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4428                 then
4429                         echo "Yup, we can."
4430                         cppstdin="$wrapper"
4431                         cppminus='';
4432                 else
4433                         echo "Nope, we'll have to live without it..."
4434                 fi
4435                 ;;
4436         esac
4437         case "$cpprun" in
4438         "$wrapper")
4439                 cpprun=''
4440                 cpplast=''
4441                 ;;
4442         esac
4443         ;;
4444 esac
4445
4446 case "$cppstdin" in
4447 "$wrapper"|'cppstdin') ;;
4448 *) $rm -f $wrapper;;
4449 esac
4450 $rm -f testcpp.c testcpp.out
4451
4452 : Set private lib path
4453 case "$plibpth" in
4454 '') if ./mips; then
4455                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4456         fi;;
4457 esac
4458 case "$libpth" in
4459 ' ') dlist='';;
4460 '') dlist="$loclibpth $plibpth $glibpth";;
4461 *) dlist="$libpth";;
4462 esac
4463
4464 : Now check and see which directories actually exist, avoiding duplicates
4465 libpth=''
4466 for xxx in $dlist
4467 do
4468     if $test -d $xxx; then
4469                 case " $libpth " in
4470                 *" $xxx "*) ;;
4471                 *) libpth="$libpth $xxx";;
4472                 esac
4473     fi
4474 done
4475 $cat <<'EOM'
4476
4477 Some systems have incompatible or broken versions of libraries.  Among
4478 the directories listed in the question below, please remove any you
4479 know not to be holding relevant libraries, and add any that are needed.
4480 Say "none" for none.
4481
4482 EOM
4483 case "$libpth" in
4484 '') dflt='none';;
4485 *)
4486         set X $libpth
4487         shift
4488         dflt=${1+"$@"}
4489         ;;
4490 esac
4491 rp="Directories to use for library searches?"
4492 . ./myread
4493 case "$ans" in
4494 none) libpth=' ';;
4495 *) libpth="$ans";;
4496 esac
4497
4498 : compute shared library extension
4499 case "$so" in
4500 '')
4501         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4502                 dflt='sl'
4503         else
4504                 dflt='so'
4505         fi
4506         ;;
4507 *) dflt="$so";;
4508 esac
4509 $cat <<EOM
4510
4511 On some systems, shared libraries may be available.  Answer 'none' if
4512 you want to suppress searching of shared libraries for the remainder
4513 of this configuration.
4514
4515 EOM
4516 rp='What is the file extension used for shared libraries?'
4517 . ./myread
4518 so="$ans"
4519
4520 : Define several unixisms.
4521 : Hints files or command line option can be used to override them.
4522 : The convoluted testing is in case hints files set either the old
4523 : or the new name.
4524 case "$_exe" in
4525 '')     case "$exe_ext" in
4526         '')     ;;
4527         *)      _exe="$exe_ext" ;;
4528         esac
4529         ;;
4530 esac
4531 case "$_a" in
4532 '')     case "$lib_ext" in
4533     '') _a='.a';;
4534         *)      _a="$lib_ext" ;;
4535         esac
4536         ;;
4537 esac
4538 case "$_o" in
4539 '') case "$obj_ext" in
4540         '')     _o='.o';;
4541         *)      _o="$obj_ext";;
4542         esac
4543         ;;
4544 esac
4545 case "$p_" in
4546 '') case "$path_sep" in
4547         '')     p_=':';;
4548         *)      p_="$path_sep";;
4549         esac
4550         ;;
4551 esac
4552 exe_ext=$_exe
4553 lib_ext=$_a
4554 obj_ext=$_o
4555 path_sep=$p_
4556
4557 : Which makefile gets called first.  This is used by make depend.
4558 case "$firstmakefile" in
4559 '') firstmakefile='makefile';;
4560 esac
4561
4562 case "$ccflags" in
4563 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4564 esac
4565
4566 case "$uselongdouble" in
4567 $define|true|[yY]*)     dflt='y';;
4568 *) dflt='n';;
4569 esac
4570 cat <<EOM
4571
4572 Perl can be built to take advantage of long doubles which
4573 (if available) may give more accuracy and range for floating point numbers.
4574
4575 If this doesn't make any sense to you, just accept the default '$dflt'.
4576 EOM
4577 rp='Try to use long doubles if available?'
4578 . ./myread
4579 case "$ans" in
4580 y|Y)    val="$define"   ;;
4581 *)      val="$undef"    ;;
4582 esac
4583 set uselongdouble
4584 eval $setvar
4585
4586 case "$uselongdouble" in
4587 true|[yY]*) uselongdouble="$define" ;;
4588 esac
4589
4590 : Look for a hint-file generated 'call-back-unit'.  If the
4591 : user has specified that long doubles should be used,
4592 : we may need to set or change some other defaults.
4593 if $test -f uselongdouble.cbu; then
4594     echo "Your platform has some specific hints regarding long doubles, using them..."
4595     . ./uselongdouble.cbu
4596 else
4597     case "$uselongdouble" in
4598         $define)
4599                 $cat <<EOM
4600 (Your platform does not have any specific hints for long doubles.)
4601 EOM
4602         ;;
4603     esac
4604 fi
4605
4606 : Looking for optional libraries
4607 echo " "
4608 echo "Checking for optional libraries..." >&4
4609 case "$libs" in
4610 ' '|'') dflt='';;
4611 *) dflt="$libs";;
4612 esac
4613 case "$libswanted" in
4614 '') libswanted='c_s';;
4615 esac
4616 case "$usesocks" in
4617 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4618 esac
4619 libsfound=''
4620 libsfiles=''
4621 libsdirs=''
4622 libspath=''
4623 for thisdir in $libpth $xlibpth; do
4624   test -d $thisdir && libspath="$libspath $thisdir"
4625 done
4626 for thislib in $libswanted; do
4627         for thisdir in $libspath; do
4628             xxx=''
4629             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4630                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4631                 $test -f "$xxx" && eval $libscheck
4632                 $test -f "$xxx" && libstyle=shared
4633             fi
4634             if test ! -f "$xxx"; then
4635                 xxx=$thisdir/lib$thislib.$so
4636                 $test -f "$xxx" && eval $libscheck
4637                 $test -f "$xxx" && libstyle=shared
4638             fi  
4639             if test ! -f "$xxx"; then
4640                 xxx=$thisdir/lib$thislib$_a
4641                 $test -f "$xxx" && eval $libscheck
4642                 $test -f "$xxx" && libstyle=static
4643             fi
4644             if test ! -f "$xxx"; then
4645                 xxx=$thisdir/$thislib$_a
4646                 $test -f "$xxx" && eval $libscheck
4647                 $test -f "$xxx" && libstyle=static
4648             fi
4649             if test ! -f "$xxx"; then
4650                 xxx=$thisdir/lib${thislib}_s$_a
4651                 $test -f "$xxx" && eval $libscheck
4652                 $test -f "$xxx" && libstyle=static
4653                 $test -f "$xxx" && thislib=${thislib}_s
4654             fi
4655             if test ! -f "$xxx"; then
4656                 xxx=$thisdir/Slib$thislib$_a
4657                 $test -f "$xxx" && eval $libscheck
4658                 $test -f "$xxx" && libstyle=static
4659             fi
4660             if $test -f "$xxx"; then
4661                 case "$libstyle" in
4662                 shared) echo "Found -l$thislib (shared)." ;;
4663                 static) echo "Found -l$thislib." ;;
4664                 *)      echo "Found -l$thislib ($libstyle)." ;;
4665                 esac
4666                 case " $dflt " in
4667                 *"-l$thislib "*);;
4668                 *) dflt="$dflt -l$thislib"
4669                    libsfound="$libsfound $xxx"
4670                    yyy=`basename $xxx`
4671                    libsfiles="$libsfiles $yyy"
4672                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4673                    case " $libsdirs " in
4674                    *" $yyy "*) ;;
4675                    *) libsdirs="$libsdirs $yyy" ;;
4676                    esac
4677                    ;;
4678                 esac
4679                 break
4680             fi  
4681         done
4682         if $test ! -f "$xxx"; then
4683             echo "No -l$thislib."
4684         fi
4685 done
4686 set X $dflt
4687 shift
4688 dflt="$*"
4689 case "$libs" in
4690 '') dflt="$dflt";;
4691 *) dflt="$libs";;
4692 esac
4693 case "$dflt" in
4694 ' '|'') dflt='none';;
4695 esac
4696
4697 $cat <<EOM
4698
4699 In order to compile $package on your machine, a number of libraries
4700 are usually needed.  Include any other special libraries here as well.
4701 Say "none" for none.  The default list is almost always right.
4702 EOM
4703
4704 echo " "
4705 rp="What libraries to use?"
4706 . ./myread
4707 case "$ans" in
4708 none) libs=' ';;
4709 *) libs="$ans";;
4710 esac
4711
4712 : determine optimization, if desired, or use for debug flag also
4713 case "$optimize" in
4714 ' '|$undef) dflt='none';;
4715 '') dflt='-O';;
4716 *) dflt="$optimize";;
4717 esac
4718 $cat <<EOH
4719
4720 By default, $package compiles with the -O flag to use the optimizer.
4721 Alternately, you might want to use the symbolic debugger, which uses
4722 the -g flag (on traditional Unix systems).  Either flag can be
4723 specified here.  To use neither flag, specify the word "none".
4724
4725 EOH
4726 rp="What optimizer/debugger flag should be used?"
4727 . ./myread
4728 optimize="$ans"
4729 case "$optimize" in
4730 'none') optimize=" ";;
4731 esac
4732
4733 dflt=''
4734 : We will not override a previous value, but we might want to
4735 : augment a hint file
4736 case "$hint" in
4737 default|recommended)
4738         case "$gccversion" in
4739         1*) dflt='-fpcc-struct-return' ;;
4740         esac
4741         case "$optimize" in
4742         *-g*) dflt="$dflt -DDEBUGGING";;
4743         esac
4744         case "$gccversion" in
4745         2*) if test -d /etc/conf/kconfig.d &&
4746                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4747                 then
4748                         # Interactive Systems (ISC) POSIX mode.
4749                         dflt="$dflt -posix"
4750                 fi
4751                 ;;
4752         esac
4753         case "$gccversion" in
4754         1*) ;;
4755         2.[0-8]*) ;;
4756         ?*)     echo " "
4757                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4758                 echo 'int main(void) { return 0; }' > gcctest.c
4759                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4760                         echo "Yes, it does." 2>&1
4761                         case "$ccflags" in
4762                         *strict-aliasing*)
4763                                 echo "Leaving current flags $ccflags alone." 2>&1
4764                                 ;;
4765                         *) dflt="$dflt -fno-strict-aliasing" ;;
4766                         esac
4767                 else
4768                         echo "Nope, it doesn't, but that's ok." 2>&1
4769                 fi
4770                 ;;
4771         esac
4772         # For gcc, adding -pipe speeds up compilations for some, but apparently
4773         # some assemblers can't read from stdin.  (It also slows down compilations
4774         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
4775         case "$gccversion" in
4776         ?*)     echo " "
4777                 echo "Checking if your compiler accepts -pipe" 2>&1
4778                 echo 'int main(void) { return 0; }' > gcctest.c
4779                 if $cc -pipe -o gcctest gcctest.c; then
4780                         echo "Yes, it does." 2>&1
4781                         case "$ccflags" in
4782                         *-pipe*)
4783                                 echo "Leaving current flags $ccflags alone." 2>&1
4784                                 ;;
4785                         *) dflt="$dflt -pipe" ;;
4786                         esac
4787                 else
4788                         echo "Nope, it doesn't, but that's ok." 2>&1
4789                 fi
4790
4791                 echo "Checking if your compiler accepts -Wdeclaration-after-statement" 2>&1
4792                 echo 'int main(void) { return 0; }' > gcctest.c
4793                 if $cc -Wdeclaration-after-statement -o gcctest gcctest.c; then
4794                         echo "Yes, it does." 2>&1
4795                         case "$ccflags" in
4796                         *-Wdeclaration-after-statement*)
4797                                 echo "Leaving current flags $ccflags alone." 2>&1
4798                                 ;;
4799                         *) dflt="$dflt -Wdeclaration-after-statement" ;;
4800                         esac
4801                 else
4802                         echo "Nope, it doesn't, but that's ok." 2>&1
4803                 fi
4804                 ;;
4805         esac
4806         ;;
4807 esac
4808
4809 case "$mips_type" in
4810 *BSD*|'') inclwanted="$locincpth $usrinc";;
4811 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4812 esac
4813 for thisincl in $inclwanted; do
4814         if $test -d $thisincl; then
4815                 if $test x$thisincl != x$usrinc; then
4816                         case "$dflt" in
4817                         *" -I$thisincl "*);;
4818                         *) dflt="$dflt -I$thisincl ";;
4819                         esac
4820                 fi
4821         fi
4822 done
4823
4824 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4825         xxx=true;
4826 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4827         xxx=true;
4828 else
4829         xxx=false;
4830 fi;
4831 if $xxx; then
4832         case "$dflt" in
4833         *$2*);;
4834         *) dflt="$dflt -D$2";;
4835         esac;
4836 fi'
4837
4838 set signal.h LANGUAGE_C; eval $inctest
4839
4840 case "$usesocks" in
4841 $define)
4842         ccflags="$ccflags -DSOCKS"
4843         ;;
4844 esac
4845
4846 case "$hint" in
4847 default|recommended) dflt="$ccflags $dflt" ;;
4848 *) dflt="$ccflags";;
4849 esac
4850
4851 case "$dflt" in
4852 ''|' ') dflt=none;;
4853 esac
4854
4855 $cat <<EOH
4856
4857 Your C compiler may want other flags.  For this question you should include
4858 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4859 but you should NOT include libraries or ld flags like -lwhatever.  If you
4860 want $package to honor its debug switch, you should include -DDEBUGGING here.
4861 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4862
4863 To use no flags, specify the word "none".
4864
4865 EOH
4866 set X $dflt
4867 shift
4868 dflt=${1+"$@"}
4869 rp="Any additional cc flags?"
4870 . ./myread
4871 case "$ans" in
4872 none) ccflags='';;
4873 *) ccflags="$ans";;
4874 esac
4875
4876 : the following weeds options from ccflags that are of no interest to cpp
4877 case "$cppflags" in
4878 '') cppflags="$ccflags" ;;
4879 *)  cppflags="$cppflags $ccflags" ;;
4880 esac
4881 case "$gccversion" in
4882 1*) cppflags="$cppflags -D__GNUC__"
4883 esac
4884 case "$mips_type" in
4885 '');;
4886 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4887 esac
4888 case "$cppflags" in
4889 '');;
4890 *)
4891         echo " "
4892         echo "Let me guess what the preprocessor flags are..." >&4
4893         set X $cppflags
4894         shift
4895         cppflags=''
4896         $cat >cpp.c <<'EOM'
4897 #define BLURFL foo
4898
4899 BLURFL xx LFRULB
4900 EOM
4901         previous=''
4902         for flag in $*
4903         do
4904                 case "$flag" in
4905                 -*) ftry="$flag";;
4906                 *) ftry="$previous $flag";;
4907                 esac
4908                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4909                         >cpp1.out 2>/dev/null && \
4910                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4911                         >cpp2.out 2>/dev/null && \
4912                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4913                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4914                 then
4915                         cppflags="$cppflags $ftry"
4916                         previous=''
4917                 else
4918                         previous="$flag"
4919                 fi
4920         done
4921         set X $cppflags
4922         shift
4923         cppflags=${1+"$@"}
4924         case "$cppflags" in
4925         *-*)  echo "They appear to be: $cppflags";;
4926         esac
4927         $rm -f cpp.c cpp?.out
4928         ;;
4929 esac
4930
4931 : flags used in final linking phase
4932 case "$ldflags" in
4933 '') if ./venix; then
4934                 dflt='-i -z'
4935         else
4936                 dflt=''
4937         fi
4938         case "$ccflags" in
4939         *-posix*) dflt="$dflt -posix" ;;
4940         esac
4941         ;;
4942 *) dflt="$ldflags";;
4943 esac
4944
4945 : Try to guess additional flags to pick up local libraries.
4946 for thislibdir in $libpth; do
4947         case " $loclibpth " in
4948         *" $thislibdir "*)
4949                 case "$dflt " in
4950                 *"-L$thislibdir "*) ;;
4951                 *)  dflt="$dflt -L$thislibdir" ;;
4952                 esac
4953                 ;;
4954         esac
4955 done
4956
4957 case "$dflt" in
4958 '') dflt='none' ;;
4959 esac
4960
4961 $cat <<EOH
4962
4963 Your C linker may need flags.  For this question you should
4964 include -L/whatever and any other flags used by the C linker, but you
4965 should NOT include libraries like -lwhatever.
4966
4967 Make sure you include the appropriate -L/path flags if your C linker
4968 does not normally search all of the directories you specified above,
4969 namely
4970         $libpth
4971 To use no flags, specify the word "none".
4972
4973 EOH
4974
4975 rp="Any additional ld flags (NOT including libraries)?"
4976 . ./myread
4977 case "$ans" in
4978 none) ldflags='';;
4979 *) ldflags="$ans";;
4980 esac
4981 rmlist="$rmlist pdp11"
4982
4983 : coherency check
4984 echo " "
4985 echo "Checking your choice of C compiler and flags for coherency..." >&4
4986 $cat > try.c <<'EOF'
4987 #include <stdio.h>
4988 int main() { printf("Ok\n"); return(0); }
4989 EOF
4990 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4991 shift
4992 $cat >try.msg <<'EOM'
4993 I've tried to compile and run the following simple program:
4994
4995 EOM
4996 $cat try.c >> try.msg
4997
4998 $cat >> try.msg <<EOM
4999
5000 I used the command:
5001
5002         $*
5003         $run ./try
5004
5005 and I got the following output:
5006
5007 EOM
5008 dflt=y
5009 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5010         if $sh -c "$run ./try" >>try.msg 2>&1; then
5011                 xxx=`$run ./try`
5012                 case "$xxx" in
5013                 "Ok") dflt=n ;;
5014                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5015                         case " $libs " in
5016                         *" -lsfio "*)
5017                                 cat >> try.msg <<'EOQS'
5018 If $libs contains -lsfio, and sfio is mis-configured, then it
5019 sometimes (apparently) runs and exits with a 0 status, but with no
5020 output!  It may have to do with sfio's use of _exit vs. exit.
5021
5022 EOQS
5023                                 rp="You have a big problem.  Shall I abort Configure"
5024                                 dflt=y
5025                                 ;;
5026                         esac
5027                         ;;
5028                 esac
5029         else
5030                 echo "The program compiled OK, but exited with status $?." >>try.msg
5031                 rp="You have a problem.  Shall I abort Configure"
5032                 dflt=y
5033         fi
5034 else
5035         echo "I can't compile the test program." >>try.msg
5036         rp="You have a BIG problem.  Shall I abort Configure"
5037         dflt=y
5038 fi
5039 case "$dflt" in
5040 y)
5041         $cat try.msg >&4
5042         case "$knowitall" in
5043         '')
5044                 echo "(The supplied flags or libraries might be incorrect.)"
5045                 ;;
5046         *) dflt=n;;
5047         esac
5048         echo " "
5049         . ./myread
5050         case "$ans" in
5051         n*|N*) ;;
5052         *)      echo "Ok.  Stopping Configure." >&4
5053                 exit 1
5054                 ;;
5055         esac
5056         ;;
5057 n) echo "OK, that should do.";;
5058 esac
5059 $rm -f try try.* core
5060
5061 : define a shorthand compile call
5062 compile='
5063 mc_file=$1;
5064 shift;
5065 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5066 : define a shorthand compile call for compilations that should be ok.
5067 compile_ok='
5068 mc_file=$1;
5069 shift;
5070 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5071
5072 : determine filename position in cpp output
5073 echo " "
5074 echo "Computing filename position in cpp output for #include directives..." >&4
5075 case "$osname" in
5076 vos) testaccess=-e ;;
5077 *)   testaccess=-r ;;
5078 esac
5079 echo '#include <stdio.h>' > foo.c
5080 $cat >fieldn <<EOF
5081 $startsh
5082 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5083 $grep '^[       ]*#.*stdio\.h' | \
5084 while read cline; do
5085         pos=1
5086         set \$cline
5087         while $test \$# -gt 0; do
5088                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5089                         echo "\$pos"
5090                         exit 0
5091                 fi
5092                 shift
5093                 pos=\`expr \$pos + 1\`
5094         done
5095 done
5096 EOF
5097 chmod +x fieldn
5098 fieldn=`./fieldn`
5099 $rm -f foo.c fieldn
5100 case $fieldn in
5101 '') pos='???';;
5102 1) pos=first;;
5103 2) pos=second;;
5104 3) pos=third;;
5105 *) pos="${fieldn}th";;
5106 esac
5107 echo "Your cpp writes the filename in the $pos field of the line."
5108
5109 case "$osname" in
5110 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5111 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5112 *)   cppfilter='' ;;
5113 esac
5114 : locate header file
5115 $cat >findhdr <<EOF
5116 $startsh
5117 wanted=\$1
5118 name=''
5119 for usrincdir in $usrinc
5120 do
5121         if test -f \$usrincdir/\$wanted; then
5122                 echo "\$usrincdir/\$wanted"
5123                 exit 0
5124         fi
5125 done
5126 awkprg='{ print \$$fieldn }'
5127 echo "#include <\$wanted>" > foo\$\$.c
5128 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5129 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5130 while read cline; do
5131         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5132         case "\$name" in
5133         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5134         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5135         *) exit 2;;
5136         esac;
5137 done;
5138 #
5139 # status = 0: grep returned 0 lines, case statement not executed
5140 # status = 1: headerfile found
5141 # status = 2: while loop executed, no headerfile found
5142 #
5143 status=\$?
5144 $rm -f foo\$\$.c;
5145 if test \$status -eq 1; then
5146         exit 0;
5147 fi
5148 exit 1
5149 EOF
5150 chmod +x findhdr
5151
5152 : define an alternate in-header-list? function
5153 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5154 cont=true; xxf="echo \"<\$1> found.\" >&4";
5155 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5156 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5157 esac;
5158 case $# in 4) instead=instead;; *) instead="at last";; esac;
5159 while $test "$cont"; do
5160         xxx=`./findhdr $1`
5161         var=$2; eval "was=\$$2";
5162         if $test "$xxx" && $test -r "$xxx";
5163         then eval $xxf;
5164         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5165                 cont="";
5166         else eval $xxnf;
5167         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5168         set $yyy; shift; shift; yyy=$@;
5169         case $# in 0) cont="";;
5170         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5171                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5172         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5173                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5174         esac;
5175 done;
5176 while $test "$yyy";
5177 do set $yyy; var=$2; eval "was=\$$2";
5178         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5179         set $yyy; shift; shift; yyy=$@;
5180 done'
5181
5182 : see if stdlib is available
5183 set stdlib.h i_stdlib
5184 eval $inhdr
5185
5186 : check for lengths of integral types
5187 echo " "
5188 case "$intsize" in
5189 '')
5190         echo "Checking to see how big your integers are..." >&4
5191         $cat >try.c <<EOCP
5192 #include <stdio.h>
5193 #$i_stdlib I_STDLIB
5194 #ifdef I_STDLIB
5195 #include <stdlib.h>
5196 #endif
5197 int main()
5198 {
5199         printf("intsize=%d;\n", (int)sizeof(int));
5200         printf("longsize=%d;\n", (int)sizeof(long));
5201         printf("shortsize=%d;\n", (int)sizeof(short));
5202         exit(0);
5203 }
5204 EOCP
5205         set try
5206         if eval $compile_ok && $run ./try > /dev/null; then
5207                 eval `$run ./try`
5208                 echo "Your integers are $intsize bytes long."
5209                 echo "Your long integers are $longsize bytes long."
5210                 echo "Your short integers are $shortsize bytes long."
5211         else
5212                 $cat >&4 <<EOM
5213 !
5214 Help! I can't compile and run the intsize test program: please enlighten me!
5215 (This is probably a misconfiguration in your system or libraries, and
5216 you really ought to fix it.  Still, I'll try anyway.)
5217 !
5218 EOM
5219                 dflt=4
5220                 rp="What is the size of an integer (in bytes)?"
5221                 . ./myread
5222                 intsize="$ans"
5223                 dflt=$intsize
5224                 rp="What is the size of a long integer (in bytes)?"
5225                 . ./myread
5226                 longsize="$ans"
5227                 dflt=2
5228                 rp="What is the size of a short integer (in bytes)?"
5229                 . ./myread
5230                 shortsize="$ans"
5231         fi
5232         ;;
5233 esac
5234 $rm -f try try.*
5235
5236 : check for long long
5237 echo " "
5238 echo "Checking to see if you have long long..." >&4
5239 echo 'int main() { long long x = 7; return 0; }' > try.c
5240 set try
5241 if eval $compile; then
5242         val="$define"
5243         echo "You have long long."
5244 else
5245         val="$undef"
5246         echo "You do not have long long."
5247 fi
5248 $rm try.*
5249 set d_longlong
5250 eval $setvar
5251
5252 : check for length of long long
5253 case "${d_longlong}${longlongsize}" in
5254 $define)
5255         echo " "
5256         echo "Checking to see how big your long longs are..." >&4
5257         $cat >try.c <<'EOCP'
5258 #include <stdio.h>
5259 int main()
5260 {
5261     printf("%d\n", (int)sizeof(long long));
5262     return(0);
5263 }
5264 EOCP
5265         set try
5266         if eval $compile_ok; then
5267                 longlongsize=`$run ./try`
5268                 echo "Your long longs are $longlongsize bytes long."
5269         else
5270                 dflt='8'
5271                 echo " "
5272                 echo "(I can't seem to compile the test program.  Guessing...)"
5273                 rp="What is the size of a long long (in bytes)?"
5274                 . ./myread
5275                 longlongsize="$ans"
5276         fi
5277         if $test "X$longsize" = "X$longlongsize"; then
5278                 echo "(That isn't any different from an ordinary long.)"
5279         fi      
5280         ;;
5281 esac
5282 $rm -f try.* try
5283
5284 : see if inttypes.h is available
5285 : we want a real compile instead of Inhdr because some systems
5286 : have an inttypes.h which includes non-existent headers
5287 echo " "
5288 $cat >try.c <<EOCP
5289 #include <inttypes.h>
5290 int main() {
5291         static int32_t foo32 = 0x12345678;
5292 }
5293 EOCP
5294 set try
5295 if eval $compile; then
5296         echo "<inttypes.h> found." >&4
5297         val="$define"
5298 else
5299         echo "<inttypes.h> NOT found." >&4
5300         val="$undef"
5301 fi
5302 $rm -f try.c try
5303 set i_inttypes
5304 eval $setvar
5305
5306 : check for int64_t
5307 echo " "
5308 echo "Checking to see if you have int64_t..." >&4
5309 $cat >try.c <<EOCP
5310 #include <sys/types.h>
5311 #$i_inttypes I_INTTYPES
5312 #ifdef I_INTTYPES
5313 #include <inttypes.h>
5314 #endif
5315 int main() { int64_t x = 7; }
5316 EOCP
5317 set try
5318 if eval $compile; then
5319         val="$define"
5320         echo "You have int64_t."
5321 else
5322         val="$undef"
5323         echo "You do not have int64_t."
5324 fi
5325 $rm -f try try.*
5326 set d_int64_t
5327 eval $setvar
5328
5329
5330 echo " "
5331 echo "Checking which 64-bit integer type we could use..." >&4
5332
5333 case "$intsize" in
5334 8) val=int
5335    set quadtype
5336    eval $setvar
5337    val='"unsigned int"'
5338    set uquadtype
5339    eval $setvar
5340    quadkind=1
5341    ;;
5342 *) case "$longsize" in
5343    8) val=long
5344       set quadtype
5345       eval $setvar
5346       val='"unsigned long"'
5347       set uquadtype
5348       eval $setvar
5349       quadkind=2
5350       ;;
5351    *) case "$d_longlong:$longlongsize" in
5352       define:8)
5353         val='"long long"'
5354         set quadtype
5355         eval $setvar
5356         val='"unsigned long long"'
5357         set uquadtype
5358         eval $setvar
5359         quadkind=3
5360         ;;
5361       *) case "$d_int64_t" in
5362          define)
5363            val=int64_t
5364            set quadtype
5365            eval $setvar
5366            val=uint64_t
5367            set uquadtype
5368            eval $setvar
5369            quadkind=4
5370            ;;
5371          esac
5372          ;;
5373       esac
5374       ;;
5375    esac
5376    ;;
5377 esac
5378
5379 case "$quadtype" in
5380 '')     echo "Alas, no 64-bit integer types in sight." >&4
5381         d_quad="$undef"
5382         ;;
5383 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5384         d_quad="$define"
5385         ;;
5386 esac
5387
5388
5389 case "$uselonglong" in
5390 "$define"|true|[yY]*)
5391         cat <<EOM >&4
5392
5393 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5394 EOM
5395         use64bitint="$define"
5396         ;;
5397 esac                          
5398 case "$use64bits" in
5399 "$define"|true|[yY]*)
5400         cat <<EOM >&4
5401
5402 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5403 EOM
5404         use64bitint="$define"
5405         ;;
5406 esac                          
5407 case "$use64bitints" in
5408 "$define"|true|[yY]*)
5409         cat <<EOM >&4
5410
5411 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5412 EOM
5413         use64bitint="$define"
5414         ;;
5415 esac                          
5416 case "$use64bitsint" in
5417 "$define"|true|[yY]*)
5418         cat <<EOM >&4
5419
5420 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5421 EOM
5422         use64bitint="$define"
5423         ;;
5424 esac                          
5425 case "$uselonglongs" in
5426 "$define"|true|[yY]*)
5427         cat <<EOM >&4
5428
5429 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5430 EOM
5431         use64bitint="$define"
5432         ;;
5433 esac                          
5434 case "$use64bitsall" in
5435 "$define"|true|[yY]*)
5436         cat <<EOM >&4
5437
5438 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5439 EOM
5440         use64bitall="$define"
5441         ;;
5442 esac                          
5443
5444 case "$ccflags" in
5445 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5446 esac
5447 case "$use64bitall" in
5448 "$define"|true|[yY]*) use64bitint="$define" ;;
5449 esac
5450
5451 case "$longsize" in
5452 8) cat <<EOM
5453
5454 You have natively 64-bit long integers.
5455 EOM
5456    val="$define"
5457    ;;
5458 *) case "$use64bitint" in
5459    "$define"|true|[yY]*) dflt='y';;
5460    *) dflt='n';;
5461    esac
5462    case "$d_quad" in
5463    "$define") ;;
5464    *) dflt='n' ;;
5465    esac
5466    cat <<EOM
5467
5468 Perl can be built to take advantage of 64-bit integer types
5469 on some systems.  To do so, Configure can be run with -Duse64bitint.
5470 Choosing this option will most probably introduce binary incompatibilities.
5471
5472 If this doesn't make any sense to you, just accept the default '$dflt'.
5473 (The default has been chosen based on your configuration.)
5474 EOM
5475    rp='Try to use 64-bit integers, if available?'
5476    . ./myread
5477    case "$ans" in
5478    [yY]*) val="$define" ;;
5479    *)     val="$undef"  ;;
5480    esac
5481    ;;
5482 esac
5483 set use64bitint
5484 eval $setvar
5485
5486 case "$use64bitall" in
5487 "$define"|true|[yY]*) dflt='y' ;;
5488 *) case "$longsize" in
5489    8) dflt='y' ;;
5490    *) dflt='n' ;;
5491    esac
5492    ;;
5493 esac    
5494 cat <<EOM
5495
5496 You may also choose to try maximal 64-bitness.  It means using as much
5497 64-bitness as possible on the platform.  This in turn means even more
5498 binary incompatibilities.  On the other hand, your platform may not
5499 have any more 64-bitness available than what you already have chosen.
5500
5501 If this doesn't make any sense to you, just accept the default '$dflt'.
5502 (The default has been chosen based on your configuration.)
5503 EOM
5504 rp='Try to use maximal 64-bit support, if available?'
5505 . ./myread
5506 case "$ans" in
5507 [yY]*) val="$define" ;;
5508 *)     val="$undef"  ;;
5509 esac
5510 set use64bitall
5511 eval $setvar
5512 case "$use64bitall" in
5513 "$define")
5514         case "$use64bitint" in
5515         "$undef")
5516                 cat <<EOM
5517
5518 Since you have chosen a maximally 64-bit build, I'm also turning on
5519 the use of 64-bit integers.
5520 EOM
5521                 use64bitint="$define" ;;
5522         esac
5523         ;;
5524 esac
5525
5526 : Look for a hint-file generated 'call-back-unit'.  If the
5527 : user has specified that a 64-bit perl is to be built,
5528 : we may need to set or change some other defaults.
5529 if $test -f use64bitint.cbu; then
5530         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5531         . ./use64bitint.cbu
5532 fi
5533 case "$use64bitint" in
5534 "$define"|true|[yY]*)
5535         case "$longsize" in
5536         4) case "$archname64" in
5537            '') archname64=64int ;;
5538            esac
5539            ;;
5540         esac
5541         ;;
5542 esac
5543
5544 : Look for a hint-file generated 'call-back-unit'.  If the
5545 : user has specified that a maximally 64-bit perl is to be built,
5546 : we may need to set or change some other defaults.
5547 if $test -f use64bitall.cbu; then
5548         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5549         . ./use64bitall.cbu
5550 fi
5551 case "$use64bitall" in
5552 "$define"|true|[yY]*)
5553         case "$longsize" in
5554         4) case "$archname64" in
5555            ''|64int) archname64=64all ;;
5556            esac
5557            ;;
5558         esac
5559         ;;
5560 esac
5561
5562 case "$d_quad:$use64bitint" in
5563 $undef:$define)
5564         cat >&4 <<EOF
5565
5566 *** You have chosen to use 64-bit integers,
5567 *** but none can be found.
5568 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5569 *** Cannot continue, aborting.
5570
5571 EOF
5572         exit 1
5573         ;;
5574 esac
5575
5576 : check for length of double
5577 echo " "
5578 case "$doublesize" in
5579 '')
5580         echo "Checking to see how big your double precision numbers are..." >&4
5581         $cat >try.c <<EOCP
5582 #include <stdio.h>
5583 #$i_stdlib I_STDLIB
5584 #ifdef I_STDLIB
5585 #include <stdlib.h>
5586 #endif
5587 int main()
5588 {
5589     printf("%d\n", (int)sizeof(double));
5590     exit(0);
5591 }
5592 EOCP
5593         set try
5594         if eval $compile_ok; then
5595                 doublesize=`$run ./try`
5596                 echo "Your double is $doublesize bytes long."
5597         else
5598                 dflt='8'
5599                 echo "(I can't seem to compile the test program.  Guessing...)"
5600                 rp="What is the size of a double precision number (in bytes)?"
5601                 . ./myread
5602                 doublesize="$ans"
5603         fi
5604         ;;
5605 esac
5606 $rm -f try.c try
5607
5608 : check for long doubles
5609 echo " "
5610 echo "Checking to see if you have long double..." >&4
5611 echo 'int main() { long double x = 7.0; }' > try.c
5612 set try
5613 if eval $compile; then
5614         val="$define"
5615         echo "You have long double."
5616 else
5617         val="$undef"
5618         echo "You do not have long double."
5619 fi
5620 $rm try.*
5621 set d_longdbl
5622 eval $setvar
5623
5624 : check for length of long double
5625 case "${d_longdbl}${longdblsize}" in
5626 $define)
5627         echo " "
5628         echo "Checking to see how big your long doubles are..." >&4
5629         $cat >try.c <<'EOCP'
5630 #include <stdio.h>
5631 int main()
5632 {
5633         printf("%d\n", sizeof(long double));
5634 }
5635 EOCP
5636         set try
5637         set try
5638         if eval $compile; then
5639                 longdblsize=`$run ./try`
5640                 echo "Your long doubles are $longdblsize bytes long."
5641         else
5642                 dflt='8'
5643                 echo " "
5644                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5645                 rp="What is the size of a long double (in bytes)?"
5646                 . ./myread
5647                 longdblsize="$ans"
5648         fi
5649         if $test "X$doublesize" = "X$longdblsize"; then
5650                 echo "That isn't any different from an ordinary double."
5651                 echo "I'll keep your setting anyway, but you may see some"
5652                 echo "harmless compilation warnings."
5653         fi      
5654         ;;
5655 esac
5656 $rm -f try.* try
5657
5658 : determine the architecture name
5659 echo " "
5660 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5661         tarch=`arch`"-$osname"
5662 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5663         if uname -m > tmparch 2>&1 ; then
5664                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5665                         -e 's/$/'"-$osname/" tmparch`
5666         else
5667                 tarch="$osname"
5668         fi
5669         $rm -f tmparch
5670 else
5671         tarch="$osname"
5672 fi
5673 case "$myarchname" in
5674 ''|"$tarch") ;;
5675 *)
5676         echo "(Your architecture name used to be $myarchname.)"
5677         archname=''
5678         ;;
5679 esac
5680 case "$targetarch" in
5681 '') ;;
5682 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5683 esac
5684 myarchname="$tarch"
5685 case "$archname" in
5686 '') dflt="$tarch";;
5687 *) dflt="$archname";;
5688 esac
5689 rp='What is your architecture name'
5690 . ./myread
5691 archname="$ans"
5692 case "$usethreads" in
5693 $define)
5694         echo "Threads selected." >&4
5695         case "$archname" in
5696         *-thread*) echo "...and architecture name already has -thread." >&4
5697                 ;;
5698         *)      archname="$archname-thread"
5699                 echo "...setting architecture name to $archname." >&4
5700                 ;;
5701         esac
5702         ;;
5703 esac
5704 case "$usemultiplicity" in
5705 $define)
5706         echo "Multiplicity selected." >&4
5707         case "$archname" in
5708         *-multi*) echo "...and architecture name already has -multi." >&4
5709                 ;;
5710         *)      archname="$archname-multi"
5711                 echo "...setting architecture name to $archname." >&4
5712                 ;;
5713         esac
5714         ;;
5715 esac
5716 case "$use64bitint$use64bitall" in
5717 *"$define"*)
5718         case "$archname64" in
5719         '')
5720                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5721                 ;;
5722         *)
5723                 case "$use64bitint" in
5724                 "$define") echo "64 bit integers selected." >&4 ;;
5725                 esac
5726                 case "$use64bitall" in
5727                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5728                 esac
5729                 case "$archname" in
5730                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5731                         ;;
5732                 *)      archname="$archname-$archname64"
5733                         echo "...setting architecture name to $archname." >&4
5734                         ;;
5735                 esac
5736                 ;;
5737         esac
5738 esac
5739 case "$uselongdouble" in
5740 $define)
5741         echo "Long doubles selected." >&4
5742         case "$longdblsize" in
5743         $doublesize)
5744                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
5745                 ;;
5746         *)
5747                 case "$archname" in
5748                 *-ld*) echo "...and architecture name already has -ld." >&4
5749                         ;;
5750                 *)      archname="$archname-ld"
5751                         echo "...setting architecture name to $archname." >&4
5752                         ;;
5753                 esac
5754                 ;;
5755         esac
5756         ;;
5757 esac
5758 case "$useperlio" in
5759 $define)
5760         echo "Perlio selected." >&4
5761         ;;
5762 *)
5763         echo "Perlio not selected, using stdio." >&4
5764         case "$archname" in
5765         *-stdio*) echo "...and architecture name already has -stdio." >&4
5766                 ;;
5767         *)      archname="$archname-stdio"
5768                 echo "...setting architecture name to $archname." >&4
5769                 ;;
5770         esac
5771         ;;
5772 esac
5773 if $test -f archname.cbu; then
5774         echo "Your platform has some specific hints for architecture name, using them..."
5775         . ./archname.cbu
5776 fi
5777
5778 : determine root of directory hierarchy where package will be installed.
5779 case "$prefix" in
5780 '')
5781         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5782         ;;
5783 *?/)
5784         dflt=`echo "$prefix" | sed 's/.$//'`
5785         ;;
5786 *)
5787         dflt="$prefix"
5788         ;;
5789 esac
5790 $cat <<EOM
5791
5792 By default, $package will be installed in $dflt/bin, manual pages
5793 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5794 installation directories. Typically this is something like /usr/local.
5795 If you wish to have binaries under /usr/bin but other parts of the
5796 installation under /usr/local, that's ok: you will be prompted
5797 separately for each of the installation directories, the prefix being
5798 only used to set the defaults.
5799
5800 EOM
5801 fn=d~
5802 rp='Installation prefix to use?'
5803 . ./getfile
5804 oldprefix=''
5805 case "$prefix" in
5806 '') ;;
5807 *)
5808         case "$ans" in
5809         "$prefix") ;;
5810         *) oldprefix="$prefix";;
5811         esac
5812         ;;
5813 esac
5814 prefix="$ans"
5815 prefixexp="$ansexp"
5816
5817 case "$afsroot" in
5818 '')     afsroot=/afs ;;
5819 *)      afsroot=$afsroot ;;
5820 esac
5821
5822 : is AFS running?
5823 echo " "
5824 case "$afs" in
5825 $define|true)   afs=true ;;
5826 $undef|false)   afs=false ;;
5827 *)      if test -d $afsroot; then
5828                 afs=true
5829         else
5830                 afs=false
5831         fi
5832         ;;
5833 esac
5834 if $afs; then
5835         echo "AFS may be running... I'll be extra cautious then..." >&4
5836 else
5837         echo "AFS does not seem to be running..." >&4
5838 fi
5839
5840 : determine installation prefix for where package is to be installed.
5841 if $afs; then 
5842 $cat <<EOM
5843
5844 Since you are running AFS, I need to distinguish the directory in which
5845 files will reside from the directory in which they are installed (and from
5846 which they are presumably copied to the former directory by occult means).
5847
5848 EOM
5849         case "$installprefix" in
5850         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5851         *) dflt="$installprefix";;
5852         esac
5853 else
5854 $cat <<EOM
5855
5856 In some special cases, particularly when building $package for distribution,
5857 it is convenient to distinguish the directory in which files should be
5858 installed from the directory ($prefix) in which they will
5859 eventually reside.  For most users, these two directories are the same.
5860
5861 EOM
5862         case "$installprefix" in
5863         '') dflt=$prefix ;;
5864         *) dflt=$installprefix;;
5865         esac
5866 fi
5867 fn=d~
5868 rp='What installation prefix should I use for installing files?'
5869 . ./getfile
5870 installprefix="$ans"
5871 installprefixexp="$ansexp"
5872
5873 : set the prefixit variable, to compute a suitable default value
5874 prefixit='case "$3" in
5875 ""|none)
5876         case "$oldprefix" in
5877         "") eval "$1=\"\$$2\"";;
5878         *)
5879                 case "$3" in
5880                 "") eval "$1=";;
5881                 none)
5882                         eval "tp=\"\$$2\"";
5883                         case "$tp" in
5884                         ""|" ") eval "$1=\"\$$2\"";;
5885                         *) eval "$1=";;
5886                         esac;;
5887                 esac;;
5888         esac;;
5889 *)
5890         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5891         case "$tp" in
5892         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5893         /*-$oldprefix/*|\~*-$oldprefix/*)
5894                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5895         *) eval "$1=\"\$$2\"";;
5896         esac;;
5897 esac'
5898
5899 : get the patchlevel
5900 echo " "
5901 echo "Getting the current patchlevel..." >&4
5902 if $test -r $rsrc/patchlevel.h;then
5903         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5904         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5905         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5906         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5907         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5908         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5909         perl_patchlevel=`egrep 'define PERL_PATCHNUM [0-9][0-9]|,"MAINT[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
5910 else
5911         revision=0
5912         patchlevel=0
5913         subversion=0
5914         api_revision=0
5915         api_version=0
5916         api_subversion=0
5917         perl_patchlevel=0
5918         $echo "(You do not have patchlevel.h.  Eek.)"
5919 fi
5920 if $test -r $rsrc/.patch ; then
5921         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
5922                 perl_patchlevel=`cat $rsrc/.patch`
5923         fi
5924 fi
5925 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
5926 version_patchlevel_string="version $patchlevel subversion $subversion"
5927 case "$perl_patchlevel" in
5928 0|'') ;;
5929 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
5930 esac
5931
5932 $echo "(You have $package $version_patchlevel_string.)"
5933
5934 case "$osname" in
5935 dos|vms)
5936         : XXX Should be a Configure test for double-dots in filenames.
5937         version=`echo $revision $patchlevel $subversion | \
5938                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5939         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5940                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5941         ;;
5942 *)
5943         version=`echo $revision $patchlevel $subversion | \
5944                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5945         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5946                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5947         ;;
5948 esac
5949 : Special case the 5.005_xx maintenance series, which used 5.005
5950 : without any subversion label as a subdirectory in $sitelib
5951 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5952         api_versionstring='5.005'
5953 fi
5954
5955 : determine installation style
5956 : For now, try to deduce it from prefix unless it is already set.
5957 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5958 case "$installstyle" in
5959 '')     case "$prefix" in
5960                 *perl*) dflt='lib';;
5961                 *) dflt='lib/perl5' ;;
5962         esac
5963         ;;
5964 *)      dflt="$installstyle" ;;
5965 esac
5966 : Probably not worth prompting for this since we prompt for all
5967 : the directories individually, and the prompt would be too long and
5968 : confusing anyway.
5969 installstyle=$dflt
5970
5971 : determine where private library files go
5972 : Usual default is /usr/local/lib/perl5/$version.
5973 : Also allow things like /opt/perl/lib/$version, since 
5974 : /opt/perl/lib/perl5... would be redundant.
5975 : The default "style" setting is made in installstyle.U
5976 case "$installstyle" in
5977 *lib/perl5*) set dflt privlib lib/$package/$version ;;
5978 *)       set dflt privlib lib/$version ;;
5979 esac
5980 eval $prefixit
5981 $cat <<EOM
5982
5983 There are some auxiliary files for $package that need to be put into a
5984 private library directory that is accessible by everyone.
5985
5986 EOM
5987 fn=d~+
5988 rp='Pathname where the private library files will reside?'
5989 . ./getfile
5990 privlib="$ans"
5991 privlibexp="$ansexp"
5992 : Change installation prefix, if necessary.
5993 if $test X"$prefix" != X"$installprefix"; then
5994         installprivlib=`echo $privlibexp | sed "s#^$prefixexp#$installprefixexp#"`
5995 else
5996         installprivlib="$privlibexp"
5997 fi
5998
5999 : set the prefixup variable, to restore leading tilda escape
6000 prefixup='case "$prefixexp" in
6001 "$prefix") ;;
6002 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6003 esac'
6004
6005 : determine where public architecture dependent libraries go
6006 set archlib archlib
6007 eval $prefixit
6008 : privlib default is /usr/local/lib/$package/$version
6009 : archlib default is /usr/local/lib/$package/$version/$archname
6010 : privlib may have an optional trailing /share.
6011 tdflt=`echo $privlib | $sed 's,/share$,,'`
6012 tdflt=$tdflt/$archname
6013 case "$archlib" in
6014 '')     dflt=$tdflt
6015         ;;
6016 *)      dflt="$archlib"
6017     ;;
6018 esac
6019 $cat <<EOM
6020
6021 $spackage contains architecture-dependent library files.  If you are
6022 sharing libraries in a heterogeneous environment, you might store
6023 these files in a separate location.  Otherwise, you can just include
6024 them with the rest of the public library files.
6025
6026 EOM
6027 fn=d+~
6028 rp='Where do you want to put the public architecture-dependent libraries?'
6029 . ./getfile
6030 archlib="$ans"
6031 archlibexp="$ansexp"
6032 if $test X"$archlib" = X"$privlib"; then
6033         d_archlib="$undef"
6034 else
6035         d_archlib="$define"
6036 fi
6037 : Change installation prefix, if necessary.
6038 if $test X"$prefix" != X"$installprefix"; then
6039         installarchlib=`echo $archlibexp | sed "s#^$prefixexp#$installprefixexp#"`
6040 else
6041         installarchlib="$archlibexp"
6042 fi
6043
6044 : see if setuid scripts can be secure
6045 $cat <<EOM
6046
6047 Some kernels have a bug that prevents setuid #! scripts from being
6048 secure.  Some sites have disabled setuid #! scripts because of this.
6049
6050 First let's decide if your kernel supports secure setuid #! scripts.
6051 (If setuid #! scripts would be secure but have been disabled anyway,
6052 don't say that they are secure if asked.)
6053
6054 EOM
6055
6056 val="$undef"
6057 if $test -d /dev/fd; then
6058         echo "#!$ls" >reflect
6059         chmod +x,u+s reflect
6060         ./reflect >flect 2>&1
6061         if $contains "/dev/fd" flect >/dev/null; then
6062                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6063                 val="$define"
6064         else
6065                 $cat <<EOM
6066 If you are not sure if they are secure, I can check but I'll need a
6067 username and password different from the one you are using right now.
6068 If you don't have such a username or don't want me to test, simply
6069 enter 'none'.
6070
6071 EOM
6072                 rp='Other username to test security of setuid scripts with?'
6073                 dflt='none'
6074                 . ./myread
6075                 case "$ans" in
6076                 n|none)
6077                         case "$d_suidsafe" in
6078                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6079                                 dflt=n;;
6080                         "$undef")
6081                                 echo "Well, the $hint value is *not* secure." >&4
6082                                 dflt=n;;
6083                         *)      echo "Well, the $hint value *is* secure." >&4
6084                                 dflt=y;;
6085                         esac
6086                         ;;
6087                 *)
6088                         $rm -f reflect flect
6089                         echo "#!$ls" >reflect
6090                         chmod +x,u+s reflect
6091                         echo >flect
6092                         chmod a+w flect
6093                         echo '"su" will (probably) prompt you for '"$ans's password."
6094                         su $ans -c './reflect >flect'
6095                         if $contains "/dev/fd" flect >/dev/null; then
6096                                 echo "Okay, it looks like setuid scripts are secure." >&4
6097                                 dflt=y
6098                         else
6099                                 echo "I don't think setuid scripts are secure." >&4
6100                                 dflt=n
6101                         fi
6102                         ;;
6103                 esac
6104                 rp='Does your kernel have *secure* setuid scripts?'
6105                 . ./myread
6106                 case "$ans" in
6107                 [yY]*)  val="$define";;
6108                 *)      val="$undef";;
6109                 esac
6110         fi
6111 else
6112         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6113         echo "(That's for file descriptors, not floppy disks.)"
6114         val="$undef"
6115 fi
6116 set d_suidsafe
6117 eval $setvar
6118
6119 $rm -f reflect flect
6120
6121 : now see if they want to do setuid emulation
6122 echo " "
6123 val="$undef"
6124 case "$d_suidsafe" in
6125 "$define")
6126         val="$undef"
6127         echo "No need to emulate SUID scripts since they are secure here." >&4
6128         ;;
6129 *)
6130         $cat <<EOM
6131 Some systems have disabled setuid scripts, especially systems where
6132 setuid scripts cannot be secure.  On systems where setuid scripts have
6133 been disabled, the setuid/setgid bits on scripts are currently
6134 useless.  It is possible for $package to detect those bits and emulate
6135 setuid/setgid in a secure fashion.  This emulation will only work if
6136 setuid scripts have been disabled in your kernel.
6137
6138 EOM
6139         case "$d_dosuid" in
6140         "$define") dflt=y ;;
6141         *) dflt=n ;;
6142         esac
6143         rp="Do you want to do setuid/setgid emulation?"
6144         . ./myread
6145         case "$ans" in
6146         [yY]*)  val="$define";;
6147         *)      val="$undef";;
6148         esac
6149         ;;
6150 esac
6151 set d_dosuid
6152 eval $setvar
6153
6154 : see if this is a malloc.h system
6155 : we want a real compile instead of Inhdr because some systems have a
6156 : malloc.h that just gives a compile error saying to use stdlib.h instead
6157 echo " "
6158 $cat >try.c <<EOCP
6159 #include <stdlib.h>
6160 #include <malloc.h>
6161 int main () { return 0; }
6162 EOCP
6163 set try
6164 if eval $compile; then
6165     echo "<malloc.h> found." >&4
6166     val="$define"
6167 else
6168     echo "<malloc.h> NOT found." >&4
6169     val="$undef"
6170 fi
6171 $rm -f try.c try
6172 set i_malloc
6173 eval $setvar
6174
6175 : check for void type
6176 echo " "
6177 echo "Checking to see how well your C compiler groks the void type..." >&4
6178 case "$voidflags" in
6179 '')
6180         $cat >try.c <<EOCP
6181 #$i_stdlib I_STDLIB
6182 #ifdef I_STDLIB
6183 #include <stdlib.h>
6184 #endif
6185 #if TRY & 1
6186 void sub() {
6187 #else
6188 sub() {
6189 #endif
6190         extern void moo();      /* function returning void */
6191         void (*goo)();          /* ptr to func returning void */
6192 #if TRY & 8
6193         void *hue;              /* generic ptr */
6194 #endif
6195 #if TRY & 2
6196         void (*foo[10])();
6197 #endif
6198
6199 #if TRY & 4
6200         if(goo == moo) {
6201                 exit(0);
6202         }
6203 #endif
6204         exit(0);
6205 }
6206 int main() { sub(); }
6207 EOCP
6208         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6209                 voidflags=$defvoidused
6210         echo "Good.  It appears to support void to the level $package wants.">&4
6211                 if $contains warning .out >/dev/null 2>&1; then
6212                         echo "However, you might get some warnings that look like this:"
6213                         $cat .out
6214                 fi
6215         else
6216 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6217                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6218                         echo "It supports 1..."
6219                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6220                                 echo "It also supports 2..."
6221                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6222                                         voidflags=7
6223                                         echo "And it supports 4 but not 8 definitely."
6224                                 else
6225                                         echo "It doesn't support 4..."
6226                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6227                                                 voidflags=11
6228                                                 echo "But it supports 8."
6229                                         else
6230                                                 voidflags=3
6231                                                 echo "Neither does it support 8."
6232                                         fi
6233                                 fi
6234                         else
6235                                 echo "It does not support 2..."
6236                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6237                                         voidflags=13
6238                                         echo "But it supports 4 and 8."
6239                                 else
6240                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6241                                                 voidflags=5
6242                                                 echo "And it supports 4 but has not heard about 8."
6243                                         else
6244                                                 echo "However it supports 8 but not 4."
6245                                         fi
6246                                 fi
6247                         fi
6248                 else
6249                         echo "There is no support at all for void."
6250                         voidflags=0
6251                 fi
6252         fi
6253 esac
6254 case "$voidflags" in
6255 "$defvoidused") ;;
6256 *)      $cat >&4 <<'EOM'
6257   Support flag bits are:
6258     1: basic void declarations.
6259     2: arrays of pointers to functions returning void.
6260     4: operations between pointers to and addresses of void functions.
6261     8: generic void pointers.
6262 EOM
6263         dflt="$voidflags";
6264         rp="Your void support flags add up to what?"
6265         . ./myread
6266         voidflags="$ans"
6267         ;;
6268 esac
6269 $rm -f try.* .out
6270
6271 : check for length of pointer
6272 echo " "
6273 case "$ptrsize" in
6274 '')
6275         echo "Checking to see how big your pointers are..." >&4
6276         if test "$voidflags" -gt 7; then
6277                 echo '#define VOID_PTR char *' > try.c
6278         else
6279                 echo '#define VOID_PTR void *' > try.c
6280         fi
6281         $cat >>try.c <<EOCP
6282 #include <stdio.h>
6283 #$i_stdlib I_STDLIB
6284 #ifdef I_STDLIB
6285 #include <stdlib.h>
6286 #endif
6287 int main()
6288 {
6289     printf("%d\n", (int)sizeof(VOID_PTR));
6290     exit(0);
6291 }
6292 EOCP
6293         set try
6294         if eval $compile_ok; then
6295                 ptrsize=`$run ./try`
6296                 echo "Your pointers are $ptrsize bytes long."
6297         else
6298                 dflt='4'
6299                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6300                 rp="What is the size of a pointer (in bytes)?"
6301                 . ./myread
6302                 ptrsize="$ans"
6303         fi
6304         ;;
6305 esac
6306 $rm -f try.c try
6307 case "$use64bitall" in
6308 "$define"|true|[yY]*)
6309         case "$ptrsize" in
6310         4)      cat <<EOM >&4
6311
6312 *** You have chosen a maximally 64-bit build,
6313 *** but your pointers are only 4 bytes wide.
6314 *** Please rerun Configure without -Duse64bitall.
6315 EOM
6316                 case "$d_quad" in
6317                 define)
6318                         cat <<EOM >&4
6319 *** Since you have quads, you could possibly try with -Duse64bitint.
6320 EOM
6321                         ;;
6322                 esac
6323                 cat <<EOM >&4
6324 *** Cannot continue, aborting.
6325
6326 EOM
6327
6328                 exit 1
6329                 ;;
6330         esac
6331         ;;
6332 esac
6333
6334
6335 : determine whether to use malloc wrapping
6336 echo " "
6337 case "$usemallocwrap" in
6338 [yY]*|true|$define)     dflt='y' ;;
6339 [nN]*|false|$undef)     dflt='n' ;;
6340 *)      case "$usedevel" in
6341         [yY]*|true|$define)     dflt='y' ;;
6342         *) dflt='n' ;;
6343         esac
6344         ;;
6345 esac
6346 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6347 . ./myread
6348 usemallocwrap="$ans"
6349 case "$ans" in
6350 y*|true)
6351         usemallocwrap="$define" ;;
6352 *)
6353         usemallocwrap="$undef" ;;
6354 esac
6355
6356 : determine which malloc to compile in
6357 echo " "
6358 case "$usemymalloc" in
6359 [yY]*|true|$define)     dflt='y' ;;
6360 [nN]*|false|$undef)     dflt='n' ;;
6361 *)      case "$ptrsize" in
6362         4) dflt='y' ;;
6363         *) dflt='n' ;;
6364         esac
6365         ;;
6366 esac
6367 rp="Do you wish to attempt to use the malloc that comes with $package?"
6368 . ./myread
6369 usemymalloc="$ans"
6370 case "$ans" in
6371 y*|true)
6372         usemymalloc='y'
6373         mallocsrc='malloc.c'
6374         mallocobj="malloc$_o"
6375         d_mymalloc="$define"
6376         case "$libs" in
6377         *-lmalloc*)
6378                 : Remove malloc from list of libraries to use
6379                 echo "Removing unneeded -lmalloc from library list" >&4
6380                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6381                 shift
6382                 libs="$*"
6383                 echo "libs = $libs" >&4
6384                 ;;
6385         esac
6386         ;;
6387 *)
6388         usemymalloc='n'
6389         mallocsrc=''
6390         mallocobj=''
6391         d_mymalloc="$undef"
6392         ;;
6393 esac
6394
6395 : compute the return types of malloc and free
6396 echo " "
6397 $cat >malloc.c <<END
6398 #$i_malloc I_MALLOC
6399 #$i_stdlib I_STDLIB
6400 #include <stdio.h>
6401 #include <sys/types.h>
6402 #ifdef I_MALLOC
6403 #include <malloc.h>
6404 #endif
6405 #ifdef I_STDLIB
6406 #include <stdlib.h>
6407 #endif
6408 #ifdef TRY_MALLOC
6409 void *malloc();
6410 #endif
6411 #ifdef TRY_FREE
6412 void free();
6413 #endif
6414 END
6415 case "$malloctype" in
6416 '')
6417         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6418                 malloctype='void *'
6419         else
6420                 malloctype='char *'
6421         fi
6422         ;;
6423 esac
6424 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6425
6426 case "$freetype" in
6427 '')
6428         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6429                 freetype='void'
6430         else
6431                 freetype='int'
6432         fi
6433         ;;
6434 esac
6435 echo "Your system uses $freetype free(), it would seem." >&4
6436 $rm -f malloc.[co]
6437 $cat <<EOM
6438
6439 After $package is installed, you may wish to install various
6440 add-on modules and utilities.  Typically, these add-ons will
6441 be installed under $prefix with the rest
6442 of this package.  However, you may wish to install such add-ons
6443 elsewhere under a different prefix.
6444
6445 If you do not wish to put everything under a single prefix, that's
6446 ok.  You will be prompted for the individual locations; this siteprefix
6447 is only used to suggest the defaults.
6448
6449 The default should be fine for most people.
6450
6451 EOM
6452 fn=d~+
6453 rp='Installation prefix to use for add-on modules and utilities?'
6454 : XXX Here might be another good place for an installstyle setting.
6455 case "$siteprefix" in
6456 '') dflt=$prefix ;;
6457 *)  dflt=$siteprefix ;;
6458 esac
6459 . ./getfile
6460 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6461 oldsiteprefix=''
6462 case "$siteprefix" in
6463 '') ;;
6464 *)      case "$ans" in
6465         "$prefix") ;;
6466         *) oldsiteprefix="$prefix";;
6467         esac
6468         ;;
6469 esac
6470 siteprefix="$ans"
6471 siteprefixexp="$ansexp"
6472
6473 : determine where site specific libraries go.
6474 : Usual default is /usr/local/lib/perl5/site_perl/$version
6475 : The default "style" setting is made in installstyle.U
6476 : XXX No longer works with Prefixit stuff.
6477 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6478 case "$sitelib" in
6479 '') case "$installstyle" in
6480         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6481         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6482         esac
6483         ;;
6484 *)      dflt="$sitelib"
6485         ;;
6486 esac
6487 $cat <<EOM
6488
6489 The installation process will create a directory for
6490 site-specific extensions and modules.  Most users find it convenient
6491 to place all site-specific files in this directory rather than in the
6492 main distribution directory.
6493
6494 EOM
6495 fn=d~+
6496 rp='Pathname for the site-specific library files?'
6497 . ./getfile
6498 sitelib="$ans"
6499 sitelibexp="$ansexp"
6500 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6501 : Change installation prefix, if necessary.
6502 if $test X"$prefix" != X"$installprefix"; then
6503         installsitelib=`echo $sitelibexp | $sed "s#^$prefixexp#$installprefixexp#"`
6504 else
6505         installsitelib="$sitelibexp"
6506 fi
6507
6508 : determine where site specific architecture-dependent libraries go.
6509 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6510 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6511 : sitelib may have an optional trailing /share.
6512 case "$sitearch" in
6513 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6514         dflt="$dflt/$archname"
6515         ;;
6516 *)      dflt="$sitearch"
6517         ;;
6518 esac
6519 set sitearch sitearch none
6520 eval $prefixit
6521 $cat <<EOM
6522
6523 The installation process will also create a directory for
6524 architecture-dependent site-specific extensions and modules.
6525
6526 EOM
6527 fn=d~+
6528 rp='Pathname for the site-specific architecture-dependent library files?'
6529 . ./getfile
6530 sitearch="$ans"
6531 sitearchexp="$ansexp"
6532 : Change installation prefix, if necessary.
6533 if $test X"$prefix" != X"$installprefix"; then
6534         installsitearch=`echo $sitearchexp | sed "s#^$prefixexp#$installprefixexp#"`
6535 else
6536         installsitearch="$sitearchexp"
6537 fi
6538
6539 $cat <<EOM
6540
6541 The installation process will also create a directory for
6542 vendor-supplied add-ons.  Vendors who supply perl with their system
6543 may find it convenient to place all vendor-supplied files in this
6544 directory rather than in the main distribution directory.  This will
6545 ease upgrades between binary-compatible maintenance versions of perl.
6546
6547 Of course you may also use these directories in whatever way you see
6548 fit.  For example, you might use them to access modules shared over a
6549 company-wide network.
6550
6551 The default answer should be fine for most people.
6552 This causes further questions about vendor add-ons to be skipped
6553 and no vendor-specific directories will be configured for perl.
6554
6555 EOM
6556 rp='Do you want to configure vendor-specific add-on directories?'
6557 case "$usevendorprefix" in
6558 define|true|[yY]*) dflt=y ;;
6559 *)      : User may have set vendorprefix directly on Configure command line.
6560         case "$vendorprefix" in
6561         ''|' ') dflt=n ;;
6562         *)      dflt=y ;;
6563         esac
6564         ;;
6565 esac
6566 . ./myread
6567 case "$ans" in
6568 [yY]*)  fn=d~+
6569         rp='Installation prefix to use for vendor-supplied add-ons?'
6570         case "$vendorprefix" in
6571         '') dflt='' ;;
6572         *)  dflt=$vendorprefix ;;
6573         esac
6574         . ./getfile
6575         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6576         oldvendorprefix=''
6577         case "$vendorprefix" in
6578         '') ;;
6579         *)      case "$ans" in
6580                 "$prefix") ;;
6581                 *) oldvendorprefix="$prefix";;
6582                 esac
6583                 ;;
6584         esac
6585         usevendorprefix="$define"
6586         vendorprefix="$ans"
6587         vendorprefixexp="$ansexp"
6588         ;;
6589 *)      usevendorprefix="$undef"
6590         vendorprefix=''
6591         vendorprefixexp=''
6592         ;;
6593 esac
6594
6595 case "$vendorprefix" in
6596 '')     d_vendorlib="$undef"
6597         vendorlib=''
6598         vendorlibexp=''
6599         ;;
6600 *)      d_vendorlib="$define"
6601         : determine where vendor-supplied modules go.
6602         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6603         case "$vendorlib" in
6604         '')
6605                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6606                 case "$installstyle" in
6607                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6608                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6609                 esac
6610                 ;;
6611         *)      dflt="$vendorlib"
6612                 ;;
6613         esac
6614         fn=d~+
6615         rp='Pathname for the vendor-supplied library files?'
6616         . ./getfile
6617         vendorlib="$ans"
6618         vendorlibexp="$ansexp"
6619         ;;
6620 esac
6621 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6622 : Change installation prefix, if necessary.
6623 if $test X"$prefix" != X"$installprefix"; then
6624         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefixexp#$installprefixexp#"`
6625 else
6626         installvendorlib="$vendorlibexp"
6627 fi
6628
6629 case "$vendorprefix" in
6630 '')     d_vendorarch="$undef"
6631         vendorarch=''
6632         vendorarchexp=''
6633         ;;
6634 *)      d_vendorarch="$define"
6635         : determine where vendor-supplied architecture-dependent libraries go.
6636         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6637         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6638         : vendorlib may have an optional trailing /share.
6639         case "$vendorarch" in
6640         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6641                 dflt="$dflt/$archname"
6642                 ;;
6643         *)      dflt="$vendorarch" ;;
6644         esac
6645         fn=d~+
6646         rp='Pathname for vendor-supplied architecture-dependent files?'
6647         . ./getfile
6648         vendorarch="$ans"
6649         vendorarchexp="$ansexp"
6650         ;;
6651 esac
6652 : Change installation prefix, if necessary.
6653 if $test X"$prefix" != X"$installprefix"; then
6654         installvendorarch=`echo $vendorarchexp | sed "s#^$prefixexp#$installprefixexp#"`
6655 else
6656         installvendorarch="$vendorarchexp"
6657 fi
6658
6659 : Final catch-all directories to search
6660 $cat <<EOM
6661
6662 Lastly, you can have perl look in other directories for extensions and
6663 modules in addition to those already specified.
6664 These directories will be searched after 
6665         $sitearch 
6666         $sitelib 
6667 EOM
6668 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6669 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6670 echo ' '
6671 case "$otherlibdirs" in
6672 ''|' ') dflt='none' ;;
6673 *)      dflt="$otherlibdirs" ;;
6674 esac
6675 $cat <<EOM
6676 Enter a colon-separated set of extra paths to include in perl's @INC
6677 search path, or enter 'none' for no extra paths.
6678
6679 EOM
6680
6681 rp='Colon-separated list of additional directories for perl to search?'
6682 . ./myread
6683 case "$ans" in
6684 ' '|''|none)    otherlibdirs=' ' ;;     
6685 *)      otherlibdirs="$ans" ;;
6686 esac
6687 case "$otherlibdirs" in
6688 ' ') val=$undef ;;
6689 *)      val=$define ;;
6690 esac
6691 set d_perl_otherlibdirs
6692 eval $setvar
6693
6694 : Cruising for prototypes
6695 echo " "
6696 echo "Checking out function prototypes..." >&4
6697 $cat >prototype.c <<EOCP
6698 #$i_stdlib I_STDLIB
6699 #ifdef I_STDLIB
6700 #include <stdlib.h>
6701 #endif
6702 int main(int argc, char *argv[]) {
6703         exit(0);}
6704 EOCP
6705 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6706         echo "Your C compiler appears to support function prototypes."
6707         val="$define"
6708 else
6709         echo "Your C compiler doesn't seem to understand function prototypes."
6710         val="$undef"
6711 fi
6712 set prototype
6713 eval $setvar
6714 $rm -f prototype*
6715
6716 case "$prototype" in
6717 "$define") ;;
6718 *)      ansi2knr='ansi2knr'
6719         echo " "
6720         cat <<EOM >&4
6721
6722 $me:  FATAL ERROR:
6723 This version of $package can only be compiled by a compiler that 
6724 understands function prototypes.  Unfortunately, your C compiler 
6725         $cc $ccflags
6726 doesn't seem to understand them.  Sorry about that.
6727
6728 If GNU cc is available for your system, perhaps you could try that instead.  
6729
6730 Eventually, we hope to support building Perl with pre-ANSI compilers.
6731 If you would like to help in that effort, please contact <perlbug@perl.org>.
6732
6733 Aborting Configure now.
6734 EOM
6735         exit 2
6736         ;;
6737 esac
6738
6739 : determine where public executables go
6740 echo " "
6741 set dflt bin bin
6742 eval $prefixit
6743 fn=d~
6744 rp='Pathname where the public executables will reside?'
6745 . ./getfile
6746 if $test "X$ansexp" != "X$binexp"; then
6747         installbin=''
6748 fi
6749 bin="$ans"
6750 binexp="$ansexp"
6751 : Change installation prefix, if necessary.
6752 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6753 if $test X"$prefix" != X"$installprefix"; then
6754         installbin=`echo $binexp | sed "s#^$prefixexp#$installprefixexp#"`
6755 else
6756         installbin="$binexp"
6757 fi
6758
6759 echo " "
6760 case "$extras" in
6761 '') dflt='n';;
6762 *) dflt='y';;
6763 esac
6764 cat <<EOM
6765 Perl can be built with extra modules or bundles of modules which
6766 will be fetched from the CPAN and installed alongside Perl.
6767
6768 Notice that you will need access to the CPAN; either via the Internet,
6769 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
6770 be asked later to configure the CPAN.pm module which will in turn do
6771 the installation of the rest of the extra modules or bundles.)
6772
6773 Notice also that if the modules require any external software such as
6774 libraries and headers (the libz library and the zlib.h header for the
6775 Compress::Zlib module, for example) you MUST have any such software
6776 already installed, this configuration process will NOT install such
6777 things for you.
6778
6779 If this doesn't make any sense to you, just accept the default '$dflt'.
6780 EOM
6781 rp='Install any extra modules (y or n)?'
6782 . ./myread
6783 case "$ans" in
6784 y|Y)
6785         cat <<EOM
6786
6787 Please list any extra modules or bundles to be installed from CPAN,
6788 with spaces between the names.  The names can be in any format the
6789 'install' command of CPAN.pm will understand.  (Answer 'none',
6790 without the quotes, to install no extra modules or bundles.)
6791 EOM
6792         rp='Extras?'
6793         dflt="$extras"
6794         . ./myread
6795         extras="$ans"
6796 esac
6797 case "$extras" in
6798 ''|'none')
6799         val=''
6800         $rm -f ../extras.lst
6801         ;;
6802 *)      echo "(Saving the list of extras for later...)"
6803         echo "$extras" > ../extras.lst
6804         val="'$extras'"
6805         ;;
6806 esac
6807 set extras
6808 eval $setvar
6809 echo " "
6810
6811 : determine where html pages for programs go
6812 set html1dir html1dir none
6813 eval $prefixit
6814 $cat <<EOM
6815
6816 If you wish to install html files for programs in $spackage, indicate 
6817 the appropriate directory here.  To skip installing html files,
6818 answer "none".
6819 EOM
6820 case "$html1dir" in
6821 ''|none|$undef|' ') dflt=none ;;
6822 *) dflt=$html1dir ;;
6823 esac
6824 fn=dn+~
6825 rp="Directory for the main $spackage html pages?"
6826 . ./getfile
6827 html1dir="$ans"
6828 html1direxp="$ansexp"
6829 : Use ' ' for none so value is preserved next time through Configure
6830 $test X"$html1dir" = "X" && html1dir=' '
6831 : Change installation prefix, if necessary.
6832 if $test X"$prefix" != X"$installprefix"; then
6833         installhtml1dir=`echo $html1direxp | sed "s#^$prefixexp#$installprefixexp#"`
6834 else
6835         installhtml1dir="$html1direxp"
6836 fi
6837
6838 : determine where html pages for libraries and modules go
6839 set html3dir html3dir none
6840 eval $prefixit
6841 $cat <<EOM
6842
6843 If you wish to install html files for modules associated with $spackage,
6844 indicate the appropriate directory here.  To skip installing html files,
6845 answer "none".
6846 EOM
6847 : There is no obvious default.  If they have specified html1dir, then
6848 : try to key off that, possibly changing .../html1 into .../html3.
6849 case "$html3dir" in
6850 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
6851 *) dflt=$html3dir ;;
6852 esac
6853 fn=dn+~
6854 rp="Directory for the $spackage module html pages?"
6855 . ./getfile
6856 html3dir="$ans"
6857 html3direxp="$ansexp"
6858 : Use ' ' for none so value is preserved next time through Configure
6859 $test X"$html3dir" = "X" && html3dir=' '
6860 : Change installation prefix, if necessary.
6861 if $test X"$prefix" != X"$installprefix"; then
6862         installhtml3dir=`echo $html3direxp | sed "s#^$prefixexp#$installprefixexp#"`
6863 else
6864         installhtml3dir="$html3direxp"
6865 fi
6866
6867 : Find perl5.005 or later.
6868 echo "Looking for a previously installed perl5.005 or later... "
6869 case "$perl5" in
6870 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6871                 : Check if this perl is recent and can load a simple module
6872                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6873                         perl5=$tdir/perl
6874                         break;
6875                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6876                         perl5=$tdir/perl5
6877                         break;
6878                 fi
6879         done
6880         ;;
6881 *)      perl5="$perl5"
6882         ;;
6883 esac
6884 case "$perl5" in
6885 '')     echo "None found.  That's ok.";;
6886 *)      echo "Using $perl5." ;;
6887 esac
6888
6889 : Determine list of previous versions to include in @INC
6890 $cat > getverlist <<EOPL
6891 #!$perl5 -w
6892 use File::Basename;
6893 \$api_versionstring = "$api_versionstring";
6894 \$version = "$version";
6895 \$stem = "$sitelib_stem";
6896 \$archname = "$archname";
6897 EOPL
6898         $cat >> getverlist <<'EOPL'
6899 # Can't have leading @ because metaconfig interprets it as a command!
6900 ;@inc_version_list=();
6901 # XXX Redo to do opendir/readdir? 
6902 if (-d $stem) {
6903     chdir($stem);
6904     ;@candidates = glob("5.*");
6905 }
6906 else {
6907     ;@candidates = ();
6908 }
6909
6910 # XXX ToDo:  These comparisons must be reworked when two-digit
6911 # subversions come along, so that 5.7.10 compares as greater than
6912 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6913 # widespread that we can use the built-in version vectors rather
6914 # than reinventing them here.  For 5.6.0, however, we must
6915 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6916 foreach $d (@candidates) {
6917     if ($d lt $version) {
6918         if ($d ge $api_versionstring) {
6919             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6920         }
6921         elsif ($d ge "5.005") {
6922             unshift(@inc_version_list, grep { -d } $d);
6923         }
6924     }
6925     else {
6926         # Skip newer version.  I.e. don't look in
6927         # 5.7.0 if we're installing 5.6.1.
6928     }
6929 }
6930
6931 if (@inc_version_list) {
6932     print join(' ', @inc_version_list);
6933 }
6934 else {
6935     # Blank space to preserve value for next Configure run.
6936     print " ";
6937 }
6938 EOPL
6939 chmod +x getverlist
6940 case "$inc_version_list" in
6941 '')     if test -x "$perl5$exe_ext"; then
6942                 dflt=`$perl5 getverlist`
6943         else
6944                 dflt='none'
6945         fi
6946         ;;
6947 $undef) dflt='none' ;;
6948 *)  eval dflt=\"$inc_version_list\" ;;
6949 esac
6950 case "$dflt" in
6951 ''|' ') dflt=none ;;
6952 esac
6953 case "$dflt" in
6954 5.005) dflt=none ;;
6955 esac
6956 $cat <<EOM
6957
6958 In order to ease the process of upgrading, this version of perl 
6959 can be configured to use modules built and installed with earlier 
6960 versions of perl that were installed under $prefix.  Specify here
6961 the list of earlier versions that this version of perl should check.
6962 If Configure detected no earlier versions of perl installed under
6963 $prefix, then the list will be empty.  Answer 'none' to tell perl
6964 to not search earlier versions.
6965
6966 The default should almost always be sensible, so if you're not sure,
6967 just accept the default.
6968 EOM
6969
6970 rp='List of earlier versions to include in @INC?'
6971 . ./myread
6972 case "$ans" in
6973 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6974 *) inc_version_list="$ans" ;;
6975 esac
6976 case "$inc_version_list" in
6977 ''|' ') 
6978         inc_version_list_init='0';;
6979 *)      inc_version_list_init=`echo $inc_version_list |
6980                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6981         ;;
6982 esac
6983 $rm -f getverlist
6984
6985 : determine whether to install perl also as /usr/bin/perl
6986
6987 echo " "
6988 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6989         $cat <<EOM
6990 Many scripts expect perl to be installed as /usr/bin/perl.
6991
6992 If you want to, I can install the perl you are about to compile
6993 as /usr/bin/perl (in addition to $bin/perl).
6994 EOM
6995         if test -f /usr/bin/perl; then
6996             $cat <<EOM
6997
6998 However, please note that because you already have a /usr/bin/perl,
6999 overwriting that with a new Perl would very probably cause problems.
7000 Therefore I'm assuming you don't want to do that (unless you insist).
7001
7002 EOM
7003             case "$installusrbinperl" in
7004             "$define"|[yY]*)    dflt='y';;
7005             *)                  dflt='n';;
7006             esac
7007         else
7008             $cat <<EOM
7009
7010 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7011
7012 EOM
7013             case "$installusrbinperl" in
7014             "$undef"|[nN]*)     dflt='n';;
7015             *)                  dflt='y';;
7016             esac
7017         fi
7018         rp="Do you want to install perl as /usr/bin/perl?"
7019         . ./myread
7020         case "$ans" in
7021         [yY]*)  val="$define";;
7022         *)      val="$undef" ;;
7023         esac
7024 else
7025         val="$undef"
7026 fi
7027 set installusrbinperl
7028 eval $setvar
7029
7030 echo " "
7031 echo "Checking for GNU C Library..." >&4
7032 cat >try.c <<'EOCP'
7033 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7034    alone are insufficient to distinguish different versions, such as
7035    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7036    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7037 */
7038 #include <stdio.h>
7039 int main(void)
7040 {
7041 #ifdef __GLIBC__
7042 #   ifdef __GLIBC_MINOR__
7043 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
7044 #           include <gnu/libc-version.h>
7045             printf("%s\n",  gnu_get_libc_version());
7046 #       else
7047             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7048 #       endif
7049 #   else
7050         printf("%d\n",  __GLIBC__);
7051 #   endif
7052     return 0;
7053 #else
7054     return 1;
7055 #endif
7056 }
7057 EOCP
7058 set try
7059 if eval $compile_ok && $run ./try > glibc.ver; then
7060         val="$define"
7061         gnulibc_version=`$cat glibc.ver`
7062         echo "You are using the GNU C Library version $gnulibc_version"
7063 else
7064         val="$undef"
7065         gnulibc_version=''
7066         echo "You are not using the GNU C Library"
7067 fi
7068 $rm -f try try.* glibc.ver
7069 set d_gnulibc
7070 eval $setvar
7071
7072 : see if nm is to be used to determine whether a symbol is defined or not
7073 case "$usenm" in
7074 '')
7075         dflt=''
7076         case "$d_gnulibc" in
7077         "$define")
7078                 echo " "
7079                 echo "nm probably won't work on the GNU C Library." >&4
7080                 dflt=n
7081                 ;;
7082         esac
7083         case "$dflt" in
7084         '') 
7085                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7086                         echo " "
7087                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7088                         echo "'nm' won't be sufficient on this sytem." >&4
7089                         dflt=n
7090                 fi
7091                 ;;
7092         esac
7093         case "$dflt" in
7094         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7095                 if $test $dflt -gt 20; then
7096                         dflt=y
7097                 else
7098                         dflt=n
7099                 fi
7100                 ;;
7101         esac
7102         ;;
7103 *)
7104         case "$usenm" in
7105         true|$define) dflt=y;;
7106         *) dflt=n;;
7107         esac
7108         ;;
7109 esac
7110 $cat <<EOM
7111
7112 I can use $nm to extract the symbols from your C libraries. This
7113 is a time consuming task which may generate huge output on the disk (up
7114 to 3 megabytes) but that should make the symbols extraction faster. The
7115 alternative is to skip the 'nm' extraction part and to compile a small
7116 test program instead to determine whether each symbol is present. If
7117 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7118 this may be the best solution.
7119
7120 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7121
7122 EOM
7123 rp="Shall I use $nm to extract C symbols from the libraries?"
7124 . ./myread
7125 case "$ans" in
7126 [Nn]*) usenm=false;;
7127 *) usenm=true;;
7128 esac
7129
7130 runnm=$usenm
7131 case "$reuseval" in
7132 true) runnm=false;;
7133 esac
7134
7135 : nm options which may be necessary
7136 case "$nm_opt" in
7137 '') if $test -f /mach_boot; then
7138                 nm_opt=''       # Mach
7139         elif $test -d /usr/ccs/lib; then
7140                 nm_opt='-p'     # Solaris (and SunOS?)
7141         elif $test -f /dgux; then
7142                 nm_opt='-p'     # DG-UX
7143         elif $test -f /lib64/rld; then
7144                 nm_opt='-p'     # 64-bit Irix
7145         else
7146                 nm_opt=''
7147         fi;;
7148 esac
7149
7150 : nm options which may be necessary for shared libraries but illegal
7151 : for archive libraries.  Thank you, Linux.
7152 case "$nm_so_opt" in
7153 '')     case "$myuname" in
7154         *linux*|gnu*)
7155                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7156                         nm_so_opt='--dynamic'
7157                 fi
7158                 ;;
7159         esac
7160         ;;
7161 esac
7162
7163 case "$runnm" in
7164 true)
7165 : get list of predefined functions in a handy place
7166 echo " "
7167 case "$libc" in
7168 '') libc=unknown
7169         case "$libs" in
7170         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7171         esac
7172         ;;
7173 esac
7174 case "$libs" in
7175 '') ;;
7176 *)  for thislib in $libs; do
7177         case "$thislib" in
7178         -lc|-lc_s)
7179                 : Handle C library specially below.
7180                 ;;
7181         -l*)
7182                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7183                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7184                         :
7185                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7186                         :
7187                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7188                         :
7189                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7190                         :
7191                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7192                         :
7193                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7194                         :
7195                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7196                         :
7197                 else
7198                         try=''
7199                 fi
7200                 libnames="$libnames $try"
7201                 ;;
7202         *) libnames="$libnames $thislib" ;;
7203         esac
7204         done
7205         ;;
7206 esac
7207 xxx=normal
7208 case "$libc" in
7209 unknown)
7210         set /lib/libc.$so
7211         for xxx in $libpth; do
7212                 $test -r $1 || set $xxx/libc.$so
7213                 : The messy sed command sorts on library version numbers.
7214                 $test -r $1 || \
7215                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7216                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7217                                 h
7218                                 s/[0-9][0-9]*/0000&/g
7219                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7220                                 G
7221                                 s/\n/ /' | \
7222                          $sort | $sed -e 's/^.* //'`
7223                 eval set \$$#
7224         done
7225         $test -r $1 || set /usr/ccs/lib/libc.$so
7226         $test -r $1 || set /lib/libsys_s$_a
7227         ;;
7228 *)
7229         set blurfl
7230         ;;
7231 esac
7232 if $test -r "$1"; then
7233         echo "Your (shared) C library seems to be in $1."
7234         libc="$1"
7235 elif $test -r /lib/libc && $test -r /lib/clib; then
7236         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7237         xxx=apollo
7238         libc='/lib/clib /lib/libc'
7239         if $test -r /lib/syslib; then
7240                 echo "(Your math library is in /lib/syslib.)"
7241                 libc="$libc /lib/syslib"
7242         fi
7243 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7244         echo "Your C library seems to be in $libc, as you said before."
7245 elif $test -r $incpath/usr/lib/libc$_a; then
7246         libc=$incpath/usr/lib/libc$_a;
7247         echo "Your C library seems to be in $libc.  That's fine."
7248 elif $test -r /lib/libc$_a; then
7249         libc=/lib/libc$_a;
7250         echo "Your C library seems to be in $libc.  You're normal."
7251 else
7252         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7253                 :
7254         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7255                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7256         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7257                 :
7258         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7259                 :
7260         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7261                 :
7262         else
7263                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7264         fi
7265         if $test -r "$tans"; then
7266                 echo "Your C library seems to be in $tans, of all places."
7267                 libc=$tans
7268         else
7269                 libc='blurfl'
7270         fi
7271 fi
7272 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7273         dflt="$libc"
7274         cat <<EOM
7275
7276 If the guess above is wrong (which it might be if you're using a strange
7277 compiler, or your machine supports multiple models), you can override it here.
7278
7279 EOM
7280 else
7281         dflt=''
7282         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7283         cat >&4 <<EOM
7284 I can't seem to find your C library.  I've looked in the following places:
7285
7286 EOM
7287         $sed 's/^/      /' libpath
7288         cat <<EOM
7289
7290 None of these seems to contain your C library. I need to get its name...
7291
7292 EOM
7293 fi
7294 fn=f
7295 rp='Where is your C library?'
7296 . ./getfile
7297 libc="$ans"
7298
7299 echo " "
7300 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7301 set X `cat libnames`
7302 shift
7303 xxx=files
7304 case $# in 1) xxx=file; esac
7305 echo "Extracting names from the following $xxx for later perusal:" >&4
7306 echo " "
7307 $sed 's/^/      /' libnames >&4
7308 echo " "
7309 $echo $n "This may take a while...$c" >&4
7310
7311 for file in $*; do
7312         case $file in
7313         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7314         *) $nm $nm_opt $file 2>/dev/null;;
7315         esac
7316 done >libc.tmp
7317
7318 $echo $n ".$c"
7319 $grep fprintf libc.tmp > libc.ptf
7320 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7321 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7322 xxx='[ADTSIW]'
7323 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7324         eval $xscan;\
7325         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7326                 eval $xrun
7327 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7328         eval $xscan;\
7329         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7330                 eval $xrun
7331 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7332         eval $xscan;\
7333         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7334                 eval $xrun
7335 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7336         eval $xscan;\
7337         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7338                 eval $xrun
7339 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7340         eval $xscan;\
7341         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7342                 eval $xrun
7343 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7344         eval $xscan;\
7345         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7346                 eval $xrun
7347 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7348                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7349         eval $xscan;\
7350         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7351                 eval $xrun
7352 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7353         eval $xscan;\
7354         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7355                 eval $xrun
7356 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7357         eval $xscan;\
7358         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7359                 eval $xrun
7360 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7361         eval $xscan;\
7362         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7363                 eval $xrun
7364 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7365         eval $xscan;\
7366         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7367                 eval $xrun
7368 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7369         eval $xscan;\
7370         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7371                 eval $xrun
7372 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7373         eval $xscan;\
7374         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7375                 eval $xrun
7376 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7377         eval $xscan;\
7378         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7379                 eval $xrun
7380 else
7381         $nm -p $* 2>/dev/null >libc.tmp
7382         $grep fprintf libc.tmp > libc.ptf
7383         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7384                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7385         then
7386                 nm_opt='-p'
7387                 eval $xrun
7388         else
7389                 echo " "
7390                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7391                 com=''
7392                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7393                         for thisname in $libnames $libc; do
7394                                 $ar t $thisname >>libc.tmp
7395                         done
7396                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7397                         echo "Ok." >&4
7398                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7399                         # Repeat libc to extract forwarders to DLL entries too
7400                         for thisname in $libnames $libc; do
7401                                 $ar tv $thisname >>libc.tmp
7402                                 # Revision 50 of EMX has bug in $ar.
7403                                 # it will not extract forwarders to DLL entries
7404                                 # Use emximp which will extract exactly them.
7405                                 emximp -o tmp.imp $thisname \
7406                                     2>/dev/null && \
7407                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7408                                     < tmp.imp >>libc.tmp
7409                                 $rm tmp.imp
7410                         done
7411                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7412                         echo "Ok." >&4
7413                 else
7414                         echo "$ar didn't seem to work right." >&4
7415                         echo "Maybe this is a Cray...trying bld instead..." >&4
7416                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7417                         then
7418                                 for thisname in $libnames; do
7419                                         bld t $libnames | \
7420                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7421                                         $ar t $thisname >>libc.tmp
7422                                 done
7423                                 echo "Ok." >&4
7424                         else
7425                                 echo "That didn't work either.  Giving up." >&4
7426                                 exit 1
7427                         fi
7428                 fi
7429         fi
7430 fi
7431 nm_extract="$com"
7432 case "$PASE" in
7433 define)
7434     echo " "
7435     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7436     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7437     ;;
7438 *)  if $test -f /lib/syscalls.exp; then
7439         echo " "
7440         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7441         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7442     fi
7443     ;;
7444 esac
7445 ;;
7446 esac
7447 $rm -f libnames libpath
7448
7449 : see if dld is available
7450 set dld.h i_dld
7451 eval $inhdr
7452
7453 : is a C symbol defined?
7454 csym='tlook=$1;
7455 case "$3" in
7456 -v) tf=libc.tmp; tdc="";;
7457 -a) tf=libc.tmp; tdc="[]";;
7458 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7459 esac;
7460 tx=yes;
7461 case "$reuseval-$4" in
7462 true-) ;;
7463 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7464 esac;
7465 case "$tx" in
7466 yes)
7467         tval=false;
7468         if $test "$runnm" = true; then
7469                 if $contains $tlook $tf >/dev/null 2>&1; then
7470                         tval=true;
7471                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7472                         echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7473                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7474                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7475                         $rm -f try$_exe try.c core core.* try.core;
7476                 fi;
7477         else
7478                 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7479                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7480                 $rm -f try$_exe try.c;
7481         fi;
7482         ;;
7483 *)
7484         case "$tval" in
7485         $define) tval=true;;
7486         *) tval=false;;
7487         esac;
7488         ;;
7489 esac;
7490 eval "$2=$tval"'
7491
7492 : define an is-in-libc? function
7493 inlibc='echo " "; td=$define; tu=$undef;
7494 sym=$1; var=$2; eval "was=\$$2";
7495 tx=yes;
7496 case "$reuseval$was" in
7497 true) ;;
7498 true*) tx=no;;
7499 esac;
7500 case "$tx" in
7501 yes)
7502         set $sym tres -f;
7503         eval $csym;
7504         case "$tres" in
7505         true)
7506                 echo "$sym() found." >&4;
7507                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7508         *)
7509                 echo "$sym() NOT found." >&4;
7510                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7511         esac;;
7512 *)
7513         case "$was" in
7514         $define) echo "$sym() found." >&4;;
7515         *) echo "$sym() NOT found." >&4;;
7516         esac;;
7517 esac'
7518
7519 : see if dlopen exists
7520 xxx_runnm="$runnm"
7521 runnm=false
7522 set dlopen d_dlopen
7523 eval $inlibc
7524 runnm="$xxx_runnm"
7525
7526 : determine which dynamic loading, if any, to compile in
7527 echo " "
7528 dldir="ext/DynaLoader"
7529 case "$usedl" in
7530 $define|y|true)
7531         dflt='y'
7532         usedl="$define"
7533         ;;
7534 $undef|n|false)
7535         dflt='n'
7536         usedl="$undef"
7537         ;;
7538 *) 
7539         dflt='n'
7540         case "$d_dlopen" in
7541             $define) dflt='y' ;;
7542         esac
7543         case "$i_dld" in
7544             $define) dflt='y' ;;
7545         esac
7546         : Does a dl_xxx.xs file exist for this operating system
7547         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7548         ;;
7549 esac
7550 rp="Do you wish to use dynamic loading?"
7551 . ./myread
7552 usedl="$ans"
7553 case "$ans" in
7554 y*) usedl="$define"
7555         case "$dlsrc" in
7556         '')
7557                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7558                         dflt="$dldir/dl_${osname}.xs"
7559                 elif $test "$d_dlopen" = "$define" ; then
7560                         dflt="$dldir/dl_dlopen.xs"
7561                 elif $test "$i_dld" = "$define" ; then
7562                         dflt="$dldir/dl_dld.xs"
7563                 else
7564                         dflt=''
7565                 fi
7566                 ;;
7567         *)      dflt="$dldir/$dlsrc"
7568                 ;;
7569         esac
7570     echo "The following dynamic loading files are available:"
7571         : Can not go over to $dldir because getfile has path hard-coded in.
7572         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7573         rp="Source file to use for dynamic loading"
7574         fn="fne"
7575         gfpth="$src"
7576         . ./getfile
7577         usedl="$define"
7578         : emulate basename
7579         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7580
7581         $cat << EOM
7582
7583 Some systems may require passing special flags to $cc -c to
7584 compile modules that will be used to create a shared library.
7585 To use no flags, say "none".
7586
7587 EOM
7588     case "$cccdlflags" in
7589     '') case "$gccversion" in
7590                 '') case "$osname" in
7591                         hpux)   dflt='+z' ;;
7592                         next)   dflt='none' ;;
7593                         irix*)  dflt='-KPIC' ;;
7594                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7595                         sunos)  dflt='-pic' ;;
7596                         *)      dflt='none' ;;
7597                     esac
7598                         ;;
7599                 *)  case "$osname" in
7600                         darwin) dflt='none' ;;
7601                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7602                         *)      dflt='-fpic' ;;
7603                     esac ;;
7604             esac ;;
7605         ' ') dflt='none' ;;
7606     *)  dflt="$cccdlflags" ;;
7607     esac
7608     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7609     . ./myread
7610     case "$ans" in
7611     none) cccdlflags=' ' ;;
7612     *) cccdlflags="$ans" ;;
7613     esac
7614
7615     cat << EOM
7616
7617 Some systems use ld to create libraries that can be dynamically loaded,
7618 while other systems (such as those using ELF) use $cc.
7619
7620 EOM
7621         case "$ld" in
7622         '')     $cat >try.c <<EOM
7623 /* Test for whether ELF binaries are produced */
7624 #include <fcntl.h>
7625 #$i_stdlib I_STDLIB
7626 #ifdef I_STDLIB
7627 #include <stdlib.h>
7628 #endif
7629 int main() {
7630         char b[4];
7631         int i = open("a.out",O_RDONLY);
7632         if(i == -1) 
7633                 exit(1); /* fail */
7634         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7635                 exit(0); /* succeed (yes, it's ELF) */
7636         else
7637                 exit(1); /* fail */
7638 }
7639 EOM
7640                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7641                         cat <<EOM
7642 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7643 EOM
7644                         dflt="$cc"
7645                 else
7646                         echo "I'll use ld to build dynamic libraries."
7647                         dflt='ld'
7648                 fi
7649                 rm -f try.c a.out
7650                 ;;
7651         *)      dflt="$ld"
7652                 ;;
7653         esac
7654
7655     rp="What command should be used to create dynamic libraries?"
7656     . ./myread
7657         ld="$ans"
7658
7659     cat << EOM
7660
7661 Some systems may require passing special flags to $ld to create a
7662 library that can be dynamically loaded.  If your ld flags include
7663 -L/other/path options to locate libraries outside your loader's normal
7664 search path, you may need to specify those -L options here as well.  To
7665 use no flags, say "none".
7666
7667 EOM
7668     case "$lddlflags" in
7669     '') case "$osname" in
7670                         beos) dflt='-nostart' ;;
7671                         hpux) dflt='-b';
7672                               case "$gccversion" in
7673                               '') dflt="$dflt +vnocompatwarnings" ;;
7674                               esac
7675                               ;;        
7676                         linux|irix*|gnu*)       dflt='-shared' ;;
7677                         next)  dflt='none' ;;
7678                         solaris) dflt='-G' ;;
7679                         sunos) dflt='-assert nodefinitions' ;;
7680                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7681                 *)     dflt='none' ;;
7682                         esac
7683                         ;;
7684     *) dflt="$lddlflags" ;;
7685     esac
7686
7687         : Try to guess additional flags to pick up local libraries.
7688         : Be careful not to append to a plain 'none'
7689         case "$dflt" in
7690         none) dflt='' ;;
7691         esac
7692         for thisflag in $ldflags; do
7693                 case "$thisflag" in
7694                 -L*|-R*|-Wl,-R*)
7695                         case " $dflt " in
7696                         *" $thisflag "*) ;;
7697                         *) dflt="$dflt $thisflag" ;;
7698                         esac
7699                         ;;
7700                 esac
7701         done
7702
7703         case "$dflt" in
7704         ''|' ') dflt='none' ;;
7705         esac
7706
7707     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7708     . ./myread
7709     case "$ans" in
7710     none) lddlflags=' ' ;;
7711     *) lddlflags="$ans" ;;
7712     esac
7713
7714         cat <<EOM
7715
7716 Some systems may require passing special flags to $cc to indicate that
7717 the resulting executable will use dynamic linking.  To use no flags,
7718 say "none".
7719
7720 EOM
7721     case "$ccdlflags" in
7722     '') case "$osname" in
7723             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
7724             next|sunos) dflt='none' ;;
7725             *)          dflt='none' ;;
7726             esac ;;
7727     ' ')  dflt='none' ;;
7728     *)  dflt="$ccdlflags" ;;
7729     esac
7730     rp="Any special flags to pass to $cc to use dynamic linking?"
7731     . ./myread
7732     case "$ans" in
7733     none) ccdlflags=' ' ;;
7734     *) ccdlflags="$ans" ;;
7735     esac
7736     ;;
7737 *)  usedl="$undef"
7738         ld='ld'
7739     dlsrc='dl_none.xs'
7740     lddlflags=''
7741     ccdlflags=''
7742     ;;
7743 esac
7744
7745 also=''
7746 case "$usedl" in
7747 $undef)
7748         # No dynamic loading being used, so don't bother even to prompt.
7749         useshrplib='false'
7750         ;;
7751 *)      case "$useshrplib" in
7752         '')     case "$osname" in
7753                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7754                         dflt=y
7755                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7756                         ;;
7757                 next*)
7758                         case "$osvers" in
7759                         4*)     dflt=y
7760                                 also='Building a shared libperl is needed for MAB support.'
7761                                 ;;
7762                         *)      dflt=n
7763                                 ;;
7764                         esac
7765                         ;;
7766                 *)      dflt=n
7767                         ;;
7768                 esac
7769                 ;;
7770         $define|true|[Yy]*)
7771                 dflt=y
7772                 ;;
7773         *)      dflt=n
7774                 ;;
7775         esac
7776         $cat << EOM
7777
7778 The perl executable is normally obtained by linking perlmain.c with
7779 libperl${_a}, any static extensions (usually just DynaLoader), and
7780 any other libraries needed on this system (such as -lm, etc.).  Since
7781 your system supports dynamic loading, it is probably possible to build
7782 a shared libperl.$so.  If you will have more than one executable linked
7783 to libperl.$so, this will significantly reduce the size of each
7784 executable, but it may have a noticeable effect on performance.  The
7785 default is probably sensible for your system.
7786 $also
7787
7788 EOM
7789         rp="Build a shared libperl.$so (y/n)"
7790         . ./myread
7791         case "$ans" in
7792         true|$define|[Yy]*)
7793                 useshrplib='true'  ;;
7794         *)      useshrplib='false' ;;
7795         esac
7796         ;;
7797 esac
7798
7799 case "$useshrplib" in
7800 true)
7801         case "$libperl" in
7802         '')
7803                 # Figure out a good name for libperl.so.  Since it gets stored in
7804                 # a version-specific architecture-dependent library, the version
7805                 # number isn't really that important, except for making cc/ld happy.
7806                 #
7807                 # A name such as libperl.so.3.1
7808                 majmin="libperl.$so.$patchlevel.$subversion"
7809                 # A name such as libperl.so.301
7810                 majonly=`echo $patchlevel $subversion |
7811                         $awk '{printf "%d%02d", $1, $2}'`
7812                 majonly=libperl.$so.$majonly
7813                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7814                 # rely on figuring it out from the naming of libc.
7815                 case "${osname}${osvers}" in
7816                 next4*)
7817                         dflt=libperl.5.$so
7818                         # XXX How handle the --version stuff for MAB?
7819                         ;;
7820                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
7821                         dflt=libperl.$so
7822                         ;;
7823                 cygwin*) # ld links against an importlib
7824                         dflt=libperl$lib_ext
7825                         ;;
7826                 *)      # Try to guess based on whether libc has major.minor.
7827                         case "$libc" in
7828                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7829                         *libc.$so.[0-9]*) dflt=$majonly ;;
7830                         *)      dflt=libperl.$so ;;
7831                         esac
7832                         ;;
7833                 esac
7834                 ;;
7835         *)      dflt=$libperl
7836                 ;;
7837         esac
7838         cat << EOM
7839
7840 I need to select a good name for the shared libperl.  If your system uses
7841 library names with major and minor numbers, then you might want something
7842 like $majmin.  Alternatively, if your system uses a single version
7843 number for shared libraries, then you might want to use $majonly.
7844 Or, your system might be quite happy with a simple libperl.$so.
7845
7846 Since the shared libperl will get installed into a version-specific
7847 architecture-dependent directory, the version number of the shared perl
7848 library probably isn't important, so the default should be o.k.
7849
7850 EOM
7851         rp='What name do you want to give to the shared libperl?'
7852         . ./myread
7853         libperl=$ans
7854         echo "Ok, I'll use $libperl"
7855         ;;
7856 *)
7857         libperl="libperl${_a}"
7858         ;;
7859 esac
7860
7861 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7862 case "$shrpdir" in
7863 '') ;;
7864 *)      $cat >&4 <<EOM
7865 WARNING:  Use of the shrpdir variable for the installation location of
7866 the shared $libperl is not supported.  It was never documented and
7867 will not work in this version.  Let me (perlbug@perl.org)
7868 know of any problems this may cause.
7869
7870 EOM
7871         case "$shrpdir" in
7872         "$archlibexp/CORE")
7873                 $cat >&4 <<EOM
7874 But your current setting of $shrpdir is
7875 the default anyway, so it's harmless.
7876 EOM
7877                 ;;
7878         *)
7879                 $cat >&4 <<EOM
7880 Further, your current attempted setting of $shrpdir
7881 conflicts with the value of $archlibexp/CORE
7882 that installperl will use.
7883 EOM
7884                 ;;
7885         esac
7886         ;;
7887 esac
7888
7889 # How will the perl executable find the installed shared $libperl?
7890 # Add $xxx to ccdlflags.
7891 # If we can't figure out a command-line option, use $shrpenv to
7892 # set env LD_RUN_PATH.  The main perl makefile uses this.
7893 shrpdir=$archlibexp/CORE
7894 xxx=''
7895 tmp_shrpenv=''
7896 if "$useshrplib"; then
7897     case "$osname" in 
7898         aix)
7899                 # We'll set it in Makefile.SH...
7900                 ;;
7901         solaris)
7902                 xxx="-R $shrpdir"
7903                 ;;
7904         freebsd|netbsd|openbsd|interix|dragonfly)
7905                 xxx="-Wl,-R$shrpdir"
7906                 ;;
7907         bsdos|linux|irix*|dec_osf|gnu*)
7908                 xxx="-Wl,-rpath,$shrpdir"
7909                 ;;
7910         next)
7911                 # next doesn't like the default...
7912                 ;;
7913         beos)
7914                 # beos doesn't like the default, either.
7915                 ;;
7916         hpux*)
7917                 # hpux doesn't like the default, either.
7918                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7919                 ;;
7920         *)
7921                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7922                 ;;
7923         esac
7924         case "$xxx" in
7925         '') ;;
7926         *)      
7927                 # Only add $xxx if it isn't already in ccdlflags.
7928                 case " $ccdlflags " in
7929                 *" $xxx "*)     ;;
7930                 *)      ccdlflags="$ccdlflags $xxx"
7931                         cat <<EOM >&4
7932
7933 Adding $xxx to the flags
7934 passed to $ld so that the perl executable will find the 
7935 installed shared $libperl.
7936
7937 EOM
7938                         ;;
7939                 esac
7940                 ;;
7941         esac
7942 fi
7943 # Fix ccdlflags in AIX for building external extensions.
7944 # (For building Perl itself bare -bE:perl.exp is needed,
7945 #  Makefile.SH takes care of this.)
7946 case "$osname" in
7947 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7948 esac
7949 # Respect a hint or command-line value.
7950 case "$shrpenv" in
7951 '') shrpenv="$tmp_shrpenv" ;;
7952 esac
7953 case "$ldlibpthname" in
7954 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7955 none)   ldlibpthname='' ;;
7956 esac
7957
7958 : determine where manual pages are on this system
7959 echo " "
7960 case "$sysman" in
7961 '') 
7962         syspath='/usr/share/man/man1 /usr/man/man1'
7963         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7964         syspath="$syspath /usr/man/u_man/man1"
7965         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7966         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7967         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7968         sysman=`./loc . /usr/man/man1 $syspath`
7969         ;;
7970 esac
7971 if $test -d "$sysman"; then
7972         echo "System manual is in $sysman." >&4
7973 else
7974         echo "Could not find manual pages in source form." >&4
7975 fi
7976
7977 : determine where manual pages go
7978 set man1dir man1dir none
7979 eval $prefixit
7980 $cat <<EOM
7981
7982 $spackage has manual pages available in source form.
7983 EOM
7984 case "$nroff" in
7985 nroff)
7986         echo "However, you don't have nroff, so they're probably useless to you."
7987         case "$man1dir" in
7988         '') man1dir="none";;
7989         esac;;
7990 esac
7991 echo "If you don't want the manual sources installed, answer 'none'."
7992 case "$man1dir" in
7993 ' ') dflt=none
7994         ;;
7995 '')
7996         lookpath="$prefixexp/share/man/man1"
7997         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
7998         lookpath="$lookpath $prefixexp/man/p_man/man1"
7999         lookpath="$lookpath $prefixexp/man/u_man/man1"
8000         lookpath="$lookpath $prefixexp/man/man.1"
8001         case "$sysman" in
8002         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8003         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8004         esac
8005         set dflt
8006         eval $prefixup
8007         ;;
8008 *)  dflt="$man1dir"
8009         ;;
8010 esac
8011 echo " "
8012 fn=dn+~
8013 rp="Where do the main $spackage manual pages (source) go?"
8014 . ./getfile
8015 if $test "X$man1direxp" != "X$ansexp"; then
8016         installman1dir=''
8017 fi
8018 man1dir="$ans"
8019 man1direxp="$ansexp"
8020 : Change installation prefix, if necessary.
8021 if $test X"$prefix" != X"$installprefix"; then
8022         installman1dir=`echo $man1direxp | $sed "s#^$prefixexp#$installprefixexp#"`
8023 else
8024         installman1dir="$man1direxp"
8025 fi
8026 case "$man1dir" in
8027 '')     man1dir=' '
8028         installman1dir='';;
8029 esac
8030
8031 : What suffix to use on installed man pages
8032
8033 case "$man1dir" in
8034 ' ')
8035         man1ext='0'
8036         ;;
8037 *)
8038         rp="What suffix should be used for the main $spackage man pages?"
8039         case "$man1ext" in
8040         '')     case "$man1dir" in
8041                 *1)  dflt=1 ;;
8042                 *1p) dflt=1p ;;
8043                 *1pm) dflt=1pm ;;
8044                 *l) dflt=l;;
8045                 *n) dflt=n;;
8046                 *o) dflt=o;;
8047                 *p) dflt=p;;
8048                 *C) dflt=C;;
8049                 *L) dflt=L;;
8050                 *L1) dflt=L1;;
8051                 *) dflt=1;;
8052                 esac
8053                 ;;
8054         *)      dflt="$man1ext";;
8055         esac
8056         . ./myread
8057         man1ext="$ans"
8058         ;;
8059 esac
8060
8061 : see if we can have long filenames
8062 echo " "
8063 first=123456789abcdef
8064 $rm -f $first
8065 if (echo hi >$first) 2>/dev/null; then
8066         if $test -f 123456789abcde; then
8067                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8068                 val="$undef"
8069         else
8070                 echo 'You can have filenames longer than 14 characters.'>&4
8071                 val="$define"
8072         fi
8073 else
8074         $cat <<'EOM'
8075 You can't have filenames longer than 14 chars.
8076 You can't even think about them!
8077 EOM
8078         val="$undef"
8079 fi 
8080 set d_flexfnam
8081 eval $setvar
8082 $rm -rf 123456789abcde*
8083
8084 : determine where library module manual pages go
8085 set man3dir man3dir none
8086 eval $prefixit
8087 $cat <<EOM
8088
8089 $spackage has manual pages for many of the library modules.
8090 EOM
8091
8092 case "$nroff" in
8093 nroff)
8094         $cat <<'EOM'
8095 However, you don't have nroff, so they're probably useless to you.
8096 EOM
8097         case "$man3dir" in
8098         '') man3dir="none";;
8099         esac;;
8100 esac
8101
8102 case "$d_flexfnam" in
8103 undef)
8104         $cat <<'EOM'
8105 However, your system can't handle the long file names like File::Basename.3. 
8106 EOM
8107         case "$man3dir" in
8108         '') man3dir="none";;
8109         esac;;
8110 esac
8111
8112 echo "If you don't want the manual sources installed, answer 'none'."
8113 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8114 case "$man3dir" in
8115 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8116         if $test -d "$privlib/man/man3"; then
8117                 cat <<EOM >&4
8118
8119 WARNING:  Previous versions of perl installed man3 pages into
8120 $privlib/man/man3.  This version will suggest a 
8121 new default of $dflt.  
8122 EOM
8123                 tdflt=$dflt
8124                 dflt='n'
8125                 rp='Do you wish to preserve the old behavior?(y/n)'
8126                 . ./myread
8127                 case "$ans" in
8128                 y*) dflt="$privlib/man/man3" ;;
8129                 *)  dflt=$tdflt ;;
8130                 esac
8131     fi
8132         ;;
8133 *)      dflt="$man3dir" ;;
8134 esac
8135 case "$dflt" in
8136 ' ') dflt=none ;;
8137 esac
8138 echo " "
8139 fn=dn+~
8140 rp="Where do the $package library man pages (source) go?"
8141 . ./getfile
8142 man3dir="$ans"
8143 man3direxp="$ansexp"
8144 : Change installation prefix, if necessary.
8145 if $test X"$prefix" != X"$installprefix"; then
8146         installman3dir=`echo $man3direxp | $sed "s#^$prefixexp#$installprefixexp#"`
8147 else
8148         installman3dir="$man3direxp"
8149 fi
8150 case "$man3dir" in
8151 '')     man3dir=' '
8152         installman3dir='';;
8153 esac
8154
8155 : What suffix to use on installed man pages
8156 case "$man3dir" in
8157 ' ')
8158         man3ext='0'
8159         ;;
8160 *)
8161         rp="What suffix should be used for the $package library man pages?"
8162         case "$man3ext" in
8163         '')     case "$man3dir" in
8164                 *3)  dflt=3 ;;
8165                 *3p) dflt=3p ;;
8166                 *3pm) dflt=3pm ;;
8167                 *l) dflt=l;;
8168                 *n) dflt=n;;
8169                 *o) dflt=o;;
8170                 *p) dflt=p;;
8171                 *C) dflt=C;;
8172                 *L) dflt=L;;
8173                 *L3) dflt=L3;;
8174                 *) dflt=3;;
8175                 esac
8176                 ;;
8177         *)      dflt="$man3ext";;
8178         esac
8179         . ./myread
8180         man3ext="$ans"
8181         ;;
8182 esac
8183
8184 : see if we have to deal with yellow pages, now NIS.
8185 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8186         if $test -f /usr/etc/nibindd; then
8187                 echo " "
8188                 echo "I'm fairly confident you're on a NeXT."
8189                 echo " "
8190                 rp='Do you get the hosts file via NetInfo?'
8191                 dflt=y
8192                 case "$hostcat" in
8193                 nidump*) ;;
8194                 '') ;;
8195                 *) dflt=n;;
8196                 esac
8197                 . ./myread
8198                 case "$ans" in
8199                 y*) hostcat='nidump hosts .';;
8200                 *)      case "$hostcat" in
8201                         nidump*) hostcat='';;
8202                         esac
8203                         ;;
8204                 esac
8205         fi
8206         case "$hostcat" in
8207         nidump*) ;;
8208         *)
8209                 case "$hostcat" in
8210                 *ypcat*) dflt=y;;
8211                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8212                                 dflt=y
8213                         else
8214                                 dflt=n
8215                         fi;;
8216                 *) dflt=n;;
8217                 esac
8218                 echo " "
8219                 rp='Are you getting the hosts file via yellow pages?'
8220                 . ./myread
8221                 case "$ans" in
8222                 y*) hostcat='ypcat hosts';;
8223                 *) hostcat='cat /etc/hosts';;
8224                 esac
8225                 ;;
8226         esac
8227 fi
8228 case "$hostcat" in
8229 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8230 esac
8231 case "$groupcat" in
8232 '') test -f /etc/group && groupcat='cat /etc/group';;
8233 esac
8234 case "$passcat" in
8235 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8236 esac
8237
8238 : now get the host name
8239 echo " "
8240 echo "Figuring out host name..." >&4
8241 case "$myhostname" in
8242 '') cont=true
8243         echo 'Maybe "hostname" will work...'
8244         if tans=`sh -c hostname 2>&1` ; then
8245                 myhostname=$tans
8246                 phostname=hostname
8247                 cont=''
8248         fi
8249         ;;
8250 *) cont='';;
8251 esac
8252 if $test "$cont"; then
8253         if ./xenix; then
8254                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8255                 if tans=`cat /etc/systemid 2>&1` ; then
8256                         myhostname=$tans
8257                         phostname='cat /etc/systemid'
8258                         echo "Whadyaknow.  Xenix always was a bit strange..."
8259                         cont=''
8260                 fi
8261         elif $test -r /etc/systemid; then
8262                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8263         fi
8264 fi
8265 if $test "$cont"; then
8266         echo 'No, maybe "uuname -l" will work...'
8267         if tans=`sh -c 'uuname -l' 2>&1` ; then
8268                 myhostname=$tans
8269                 phostname='uuname -l'
8270         else
8271                 echo 'Strange.  Maybe "uname -n" will work...'
8272                 if tans=`sh -c 'uname -n' 2>&1` ; then
8273                         myhostname=$tans
8274                         phostname='uname -n'
8275                 else
8276                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8277                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8278                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8279                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8280                         else
8281                                 case "$myhostname" in
8282                                 '') echo "Does this machine have an identity crisis or something?"
8283                                         phostname='';;
8284                                 *)
8285                                         echo "Well, you said $myhostname before..."
8286                                         phostname='echo $myhostname';;
8287                                 esac
8288                         fi
8289                 fi
8290         fi
8291 fi
8292 case "$myhostname" in
8293 '') myhostname=noname ;;
8294 esac
8295 : you do not want to know about this
8296 set $myhostname
8297 myhostname=$1
8298
8299 : verify guess
8300 if $test "$myhostname" ; then
8301         dflt=y
8302         rp='Your host name appears to be "'$myhostname'".'" Right?"
8303         . ./myread
8304         case "$ans" in
8305         y*) ;;
8306         *) myhostname='';;
8307         esac
8308 fi
8309
8310 : bad guess or no guess
8311 while $test "X$myhostname" = X ; do
8312         dflt=''
8313         rp="Please type the (one word) name of your host:"
8314         . ./myread
8315         myhostname="$ans"
8316 done
8317
8318 : translate upper to lower if necessary
8319 case "$myhostname" in
8320 *[A-Z]*)
8321         echo "(Normalizing case in your host name)"
8322         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8323         ;;
8324 esac
8325
8326 case "$myhostname" in
8327 *.*)
8328         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8329         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8330         echo "(Trimming domain name from host name--host name is now $myhostname)"
8331         ;;
8332 *) case "$mydomain" in
8333         '')
8334                 {
8335                         test "X$hostcat" = "Xypcat hosts" &&
8336                         ypmatch "$myhostname" hosts 2>/dev/null |\
8337                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8338                         $test -s hosts
8339                 } || {
8340                         test "X$hostcat" != "X" &&
8341                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8342                                         /[       ]$myhostname[  . ]/p" > hosts
8343                 }
8344                 tmp_re="[       . ]"
8345                 if $test -f hosts; then
8346                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8347                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8348                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8349                                 hosts | $sort | $uniq | \
8350                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8351                         case `$echo X$dflt` in
8352                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8353                                 dflt=.
8354                                 ;;
8355                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8356                                 ;;
8357                         esac
8358                 else
8359                         echo "(I cannot locate a hosts database anywhere)"
8360                         dflt=.
8361                 fi
8362                 case "$dflt" in
8363                 .)
8364                         tans=`./loc resolv.conf X /etc /usr/etc`
8365                         if $test -f "$tans"; then
8366                                 echo "(Attempting domain name extraction from $tans)"
8367                                 dflt=.`$sed -n -e 's/   / /g' \
8368                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8369                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8370                                 case "$dflt" in
8371                                 .) dflt=.`$sed -n -e 's/        / /g' \
8372                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8373                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8374                                         ;;
8375                                 esac
8376                         fi
8377                         ;;
8378                 esac
8379                 case "$dflt" in
8380                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8381                         dflt=.`sh -c domainname 2>/dev/null`
8382                         case "$dflt" in
8383                         '') dflt='.';;
8384                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8385                         esac
8386                         ;;
8387                 esac
8388                 case "$dflt$osname" in
8389                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8390                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8391                         ;;
8392                 esac
8393                 case "$dflt" in
8394                 .) echo "(Lost all hope -- silly guess then)"
8395                         dflt='.nonet'
8396                         ;;
8397                 esac
8398                 $rm -f hosts
8399                 ;;
8400         *) dflt="$mydomain";;
8401         esac;;
8402 esac
8403 echo " "
8404 rp="What is your domain name?"
8405 . ./myread
8406 tans="$ans"
8407 case "$ans" in
8408 '') ;;
8409 .*) ;;
8410 *) tans=".$tans";;
8411 esac
8412 mydomain="$tans"
8413
8414 : translate upper to lower if necessary
8415 case "$mydomain" in
8416 *[A-Z]*)
8417         echo "(Normalizing case in your domain name)"
8418         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8419         ;;
8420 esac
8421
8422 : a little sanity check here
8423 case "$phostname" in
8424 '') ;;
8425 *)
8426         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8427         $myhostname$mydomain|$myhostname) ;;
8428         *)
8429                 case "$phostname" in
8430                 sed*)
8431                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8432                         ;;
8433                 *)
8434                         echo "(That doesn't agree with your $phostname command, by the way.)"
8435                         ;;
8436                 esac
8437         ;;
8438         esac
8439         ;;
8440 esac
8441
8442 $cat <<EOM
8443
8444 I need to get your e-mail address in Internet format if possible, i.e.
8445 something like user@host.domain. Please answer accurately since I have
8446 no easy means to double check it. The default value provided below
8447 is most probably close to reality but may not be valid from outside
8448 your organization...
8449
8450 EOM
8451 cont=x
8452 while test "$cont"; do
8453         case "$cf_email" in
8454         '') dflt="$cf_by@$myhostname$mydomain";;
8455         *) dflt="$cf_email";;
8456         esac
8457         rp='What is your e-mail address?'
8458         . ./myread
8459         cf_email="$ans"
8460         case "$cf_email" in
8461         *@*.*) cont='' ;;
8462         *)
8463                 rp='Address does not look like an Internet one.  Use it anyway?'
8464                 case "$fastread" in
8465                 yes) dflt=y ;;
8466                 *) dflt=n ;;
8467                 esac
8468                 . ./myread
8469                 case "$ans" in
8470                 y*) cont='' ;;
8471                 *) echo " " ;;
8472                 esac
8473                 ;;
8474         esac
8475 done
8476
8477 $cat <<EOM
8478
8479 If you or somebody else will be maintaining perl at your site, please
8480 fill in the correct e-mail address here so that they may be contacted
8481 if necessary. Currently, the "perlbug" program included with perl
8482 will send mail to this address in addition to perlbug@perl.org. You may
8483 enter "none" for no administrator.
8484
8485 EOM
8486 case "$perladmin" in
8487 '') dflt="$cf_email";;
8488 *) dflt="$perladmin";;
8489 esac
8490 rp='Perl administrator e-mail address'
8491 . ./myread
8492 perladmin="$ans"
8493
8494 : determine whether to only install version-specific parts.
8495 echo " "
8496 $cat <<EOM
8497 Do you want to install only the version-specific parts of the perl
8498 distribution?  Usually you do *not* want to do this.
8499 EOM
8500 case "$versiononly" in
8501 "$define"|[Yy]*|true) dflt='y' ;;
8502 *) dflt='n';
8503 esac
8504 rp="Do you want to install only the version-specific parts of perl?"
8505 . ./myread
8506 case "$ans" in
8507 [yY]*)  val="$define";;
8508 *)      val="$undef" ;;
8509 esac
8510 set versiononly
8511 eval $setvar
8512
8513 case "$versiononly" in
8514 "$define") inc_version_list=''
8515            inc_version_list_init=0
8516            ;;
8517 esac
8518
8519 : figure out how to guarantee perl startup
8520 case "$startperl" in
8521 '')
8522         case "$sharpbang" in
8523         *!)
8524                 $cat <<EOH
8525
8526 I can use the #! construct to start perl on your system. This will
8527 make startup of perl scripts faster, but may cause problems if you
8528 want to share those scripts and perl is not in a standard place
8529 ($binexp/perl) on all your platforms. The alternative is to force
8530 a shell by starting the script with a single ':' character.
8531
8532 EOH
8533                 case "$versiononly" in
8534                 "$define")      dflt="$binexp/perl$version";;  
8535                 *)              dflt="$binexp/perl";;
8536                 esac
8537                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8538                 . ./myread
8539                 case "$ans" in
8540                 none)   startperl=": # use perl";;
8541                 *)      startperl="#!$ans"
8542                         if $test 30 -lt `echo "$ans" | wc -c`; then
8543                                 $cat >&4 <<EOM
8544
8545 WARNING:  Some systems limit the #! command to 32 characters.
8546 If you experience difficulty running Perl scripts with #!, try
8547 installing Perl in a directory with a shorter pathname.
8548
8549 EOM
8550                         fi ;;
8551                 esac
8552                 ;;
8553         *) startperl=": # use perl"
8554                 ;;
8555         esac
8556         ;;
8557 esac
8558 echo "I'll use $startperl to start perl scripts."
8559
8560 : figure best path for perl in scripts
8561 case "$perlpath" in
8562 '')
8563         case "$versiononly" in
8564         "$define")      perlpath="$binexp/perl$version";;
8565         *)              perlpath="$binexp/perl";;
8566         esac
8567         case "$startperl" in
8568         *!*) ;;
8569         *)
8570                 $cat <<EOH
8571
8572 I will use the "eval 'exec'" idiom to start Perl on your system.
8573 I can use the full path of your Perl binary for this purpose, but
8574 doing so may cause problems if you want to share those scripts and
8575 Perl is not always in a standard place ($binexp/perl).
8576
8577 EOH
8578                 dflt="$binexp/perl"
8579                 rp="What path shall I use in \"eval 'exec'\"?"
8580                 . ./myread
8581                 perlpath="$ans"
8582                 ;;
8583         esac
8584         ;;
8585 esac
8586 case "$startperl" in
8587 *!*)    ;;
8588 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8589 esac
8590
8591 : determine where public executable scripts go
8592 set scriptdir scriptdir
8593 eval $prefixit
8594 case "$scriptdir" in
8595 '')
8596         dflt="$bin"
8597         : guess some guesses
8598         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8599         $test -d /usr/share/bin     && dflt=/usr/share/bin
8600         $test -d /usr/local/script  && dflt=/usr/local/script
8601         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8602         $test -d $prefixexp/script  && dflt=$prefixexp/script
8603         set dflt
8604         eval $prefixup
8605         ;;
8606 *)  dflt="$scriptdir"
8607         ;;
8608 esac
8609 $cat <<EOM
8610  
8611 Some installations have a separate directory just for executable scripts so
8612 that they can mount it across multiple architectures but keep the scripts in
8613 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8614 Or you might just lump your scripts in with all your other executables.
8615  
8616 EOM
8617 fn=d~
8618 rp='Where do you keep publicly executable scripts?'
8619 . ./getfile
8620 if $test "X$ansexp" != "X$scriptdirexp"; then
8621         installscript=''
8622 fi
8623 scriptdir="$ans"
8624 scriptdirexp="$ansexp"
8625 : Change installation prefix, if necessary.
8626 if $test X"$prefix" != X"$installprefix"; then
8627         installscript=`echo $scriptdirexp | sed "s#^$prefixexp#$installprefixexp#"`
8628 else
8629         installscript="$scriptdirexp"
8630 fi
8631
8632 : determine where add-on public executables go
8633 case "$sitebin" in
8634 '')     dflt=$siteprefix/bin ;;
8635 *)      dflt=$sitebin ;;
8636 esac
8637 fn=d~
8638 rp='Pathname where the add-on public executables should be installed?'
8639 . ./getfile
8640 sitebin="$ans"
8641 sitebinexp="$ansexp"
8642 : Change installation prefix, if necessary.
8643 if $test X"$prefix" != X"$installprefix"; then
8644         installsitebin=`echo $sitebinexp | sed "s#^$prefixexp#$installprefixexp#"`
8645 else
8646         installsitebin="$sitebinexp"
8647 fi
8648
8649 : determine where add-on html pages go
8650 : There is no standard location, so try to copy the previously-selected
8651 : directory structure for the core html pages.
8652 case "$sitehtml1dir" in
8653 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8654 *)     dflt=$sitehtml1dir ;;
8655 esac
8656 case "$dflt" in
8657 ''|' ') dflt=none ;;
8658 esac
8659 fn=dn+~
8660 rp='Pathname where the site-specific html pages should be installed?'
8661 . ./getfile
8662 sitehtml1dir="$ans"
8663 sitehtml1direxp="$ansexp"
8664 : Change installation prefix, if necessary.
8665 if $test X"$prefix" != X"$installprefix"; then
8666         installsitehtml1dir=`echo $sitehtml1direxp | $sed "s#^$prefixexp#$installprefixexp#"`
8667 else
8668         installsitehtml1dir="$sitehtml1direxp"
8669 fi
8670
8671 : determine where add-on library html pages go
8672 : There is no standard location, so try to copy the previously-selected
8673 : directory structure for the core html pages.
8674 case "$sitehtml3dir" in
8675 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8676 *)     dflt=$sitehtml3dir ;;
8677 esac
8678 case "$dflt" in
8679 ''|' ') dflt=none ;;
8680 esac
8681 fn=dn+~
8682 rp='Pathname where the site-specific library html pages should be installed?'
8683 . ./getfile
8684 sitehtml3dir="$ans"
8685 sitehtml3direxp="$ansexp"
8686 : Change installation prefix, if necessary.
8687 if $test X"$prefix" != X"$installprefix"; then
8688         installsitehtml3dir=`echo $sitehtml3direxp | $sed "s#^$prefixexp#$installprefixexp#"`
8689 else
8690         installsitehtml3dir="$sitehtml3direxp"
8691 fi
8692
8693 : determine where add-on manual pages go
8694 case "$siteman1dir" in
8695 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8696 *)      dflt=$siteman1dir ;;
8697 esac
8698 case "$dflt" in
8699 ''|' ') dflt=none ;;
8700 esac
8701 fn=dn+~
8702 rp='Pathname where the site-specific manual pages should be installed?'
8703 . ./getfile
8704 siteman1dir="$ans"
8705 siteman1direxp="$ansexp"
8706 : Change installation prefix, if necessary.
8707 if $test X"$prefix" != X"$installprefix"; then
8708         installsiteman1dir=`echo $siteman1direxp | $sed "s#^$prefixexp#$installprefixexp#"`
8709 else
8710         installsiteman1dir="$siteman1direxp"
8711 fi
8712
8713 : determine where add-on library man pages go
8714 case "$siteman3dir" in
8715 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8716 *)      dflt=$siteman3dir ;;
8717 esac
8718 case "$dflt" in
8719 ''|' ') dflt=none ;;
8720 esac
8721 fn=dn+~
8722 rp='Pathname where the site-specific library manual pages should be installed?'
8723 . ./getfile
8724 siteman3dir="$ans"
8725 siteman3direxp="$ansexp"
8726 : Change installation prefix, if necessary.
8727 if $test X"$prefix" != X"$installprefix"; then
8728         installsiteman3dir=`echo $siteman3direxp | $sed "s#^$prefixexp#$installprefixexp#"`
8729 else
8730         installsiteman3dir="$siteman3direxp"
8731 fi
8732
8733 : determine where add-on public executable scripts go
8734 case "$sitescript" in
8735 '')     dflt=$siteprefix/script
8736         $test -d $dflt || dflt=$sitebin ;;
8737 *)  dflt="$sitescript" ;;
8738 esac
8739 fn=d~+
8740 rp='Pathname where add-on public executable scripts should be installed?'
8741 . ./getfile
8742 sitescript="$ans"
8743 sitescriptexp="$ansexp"
8744 : Change installation prefix, if necessary.
8745 if $test X"$prefix" != X"$installprefix"; then
8746         installsitescript=`echo $sitescriptexp | sed "s#^$prefixexp#$installprefixexp#"`
8747 else
8748         installsitescript="$sitescriptexp"
8749 fi
8750
8751 case "$usefaststdio" in
8752 $define|true|[yY]*|'')
8753         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8754         case "$xversion" in
8755         [68])   dflt='y' ;;
8756         *)      dflt='n' ;;
8757         esac
8758         ;;
8759 *) dflt='n';;
8760 esac
8761 cat <<EOM
8762
8763 Perl can be built to use 'fast stdio', which means using the stdio
8764 library but also directly manipulating the stdio buffers to enable
8765 faster I/O.  Using stdio is better for backward compatibility (especially
8766 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8767 interface has been preferred instead of stdio.
8768
8769 If this doesn't make any sense to you, just accept the default '$dflt'.
8770 EOM
8771 rp='Use the "fast stdio" if available?'
8772 . ./myread
8773 case "$ans" in
8774 y|Y)    val="$define" ;;     
8775 *)      val="$undef" ;;
8776 esac
8777 set usefaststdio
8778 eval $setvar
8779
8780
8781 : define an is-a-typedef? function
8782 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8783 case "$inclist" in
8784 "") inclist="sys/types.h";;
8785 esac;
8786 eval "varval=\$$var";
8787 case "$varval" in
8788 "")
8789         $rm -f temp.c;
8790         for inc in $inclist; do
8791                 echo "#include <$inc>" >>temp.c;
8792         done;
8793         echo "#ifdef $type" >> temp.c;
8794         echo "printf(\"We have $type\");" >> temp.c;
8795         echo "#endif" >> temp.c;
8796         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8797         if $contains $type temp.E >/dev/null 2>&1; then
8798                 eval "$var=\$type";
8799         else
8800                 eval "$var=\$def";
8801         fi;
8802         $rm -f temp.?;;
8803 *) eval "$var=\$varval";;
8804 esac'
8805
8806 : define an is-a-typedef? function that prompts if the type is not available.
8807 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8808 case "$inclist" in
8809 "") inclist="sys/types.h";;
8810 esac;
8811 eval "varval=\$$var";
8812 case "$varval" in
8813 "")
8814         $rm -f temp.c;
8815         for inc in $inclist; do
8816                 echo "#include <$inc>" >>temp.c;
8817         done;
8818         echo "#ifdef $type" >> temp.c;
8819         echo "printf(\"We have $type\");" >> temp.c;
8820         echo "#endif" >> temp.c;
8821         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8822         echo " " ;
8823         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8824         if $contains $type temp.E >/dev/null 2>&1; then
8825                 echo "$type found." >&4;
8826                 eval "$var=\$type";
8827         else
8828                 echo "$type NOT found." >&4;
8829                 dflt="$def";
8830                 . ./myread ;
8831                 eval "$var=\$ans";
8832         fi;
8833         $rm -f temp.?;;
8834 *) eval "$var=\$varval";;
8835 esac'
8836
8837 : see what type lseek is declared as in the kernel
8838 rp="What is the type used for lseek's offset on this system?"
8839 set off_t lseektype long stdio.h sys/types.h
8840 eval $typedef_ask
8841
8842 echo " "
8843 echo "Checking to see how big your file offsets are..." >&4
8844 $cat >try.c <<EOCP
8845 #include <sys/types.h>
8846 #include <stdio.h>
8847 int main()
8848 {
8849     printf("%d\n", (int)sizeof($lseektype));
8850     return(0); 
8851 }
8852 EOCP
8853 set try
8854 if eval $compile_ok; then
8855         lseeksize=`$run ./try`
8856         echo "Your file offsets are $lseeksize bytes long."
8857 else
8858         dflt=$longsize
8859         echo " "
8860         echo "(I can't seem to compile the test program.  Guessing...)"
8861         rp="What is the size of your file offsets (in bytes)?"
8862         . ./myread
8863         lseeksize="$ans"
8864 fi
8865 $rm -f try.c try
8866
8867 : see what type file positions are declared as in the library
8868 rp="What is the type for file position used by fsetpos()?"
8869 set fpos_t fpostype long stdio.h sys/types.h
8870 eval $typedef_ask
8871
8872 echo " "
8873 case "$fpostype" in
8874 *_t) zzz="$fpostype"    ;;
8875 *)   zzz="fpos_t"       ;;
8876 esac
8877 echo "Checking the size of $zzz..." >&4 
8878 cat > try.c <<EOCP
8879 #include <sys/types.h>
8880 #include <stdio.h>
8881 #$i_stdlib I_STDLIB
8882 #ifdef I_STDLIB
8883 #include <stdlib.h>
8884 #endif
8885 int main() {
8886     printf("%d\n", (int)sizeof($fpostype));
8887     exit(0);
8888 }
8889 EOCP
8890 set try
8891 if eval $compile_ok; then
8892         yyy=`$run ./try`
8893         case "$yyy" in
8894         '')     fpossize=4
8895                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8896                 ;;
8897         *)      fpossize=$yyy
8898                 echo "Your $zzz is $fpossize bytes long."
8899                 ;;
8900         esac
8901 else
8902         dflt="$longsize"
8903         echo " " >&4
8904         echo "(I can't compile the test program.  Guessing...)" >&4
8905         rp="What is the size of your file positions (in bytes)?"
8906         . ./myread
8907         fpossize="$ans"
8908 fi
8909
8910 # Backward compatibility (uselfs is deprecated).
8911 case "$uselfs" in
8912 "$define"|true|[yY]*)
8913         cat <<EOM >&4
8914
8915 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8916 EOM
8917         uselargefiles="$define"
8918         ;;
8919 esac                          
8920
8921 case "$lseeksize:$fpossize" in
8922 8:8) cat <<EOM
8923
8924 You can have files larger than 2 gigabytes.
8925 EOM
8926    val="$define" ;;
8927 *)    case "$uselargefiles" in
8928    "$undef"|false|[nN]*) dflt='n' ;;
8929    *)   dflt='y' ;;
8930    esac
8931    cat <<EOM
8932
8933 Perl can be built to understand large files (files larger than 2 gigabytes)
8934 on some systems.  To do so, Configure can be run with -Duselargefiles.
8935
8936 If this doesn't make any sense to you, just accept the default '$dflt'.
8937 EOM
8938    rp='Try to understand large files, if available?'
8939    . ./myread
8940    case "$ans" in
8941    y|Y)         val="$define" ;;
8942    *)           val="$undef"  ;;
8943    esac
8944    ;;
8945 esac
8946 set uselargefiles
8947 eval $setvar
8948 : Look for a hint-file generated 'call-back-unit'.  If the
8949 : user has specified that a large files perl is to be built,
8950 : we may need to set or change some other defaults.
8951 if $test -f uselargefiles.cbu; then
8952         echo "Your platform has some specific hints regarding large file builds, using them..."
8953         . ./uselargefiles.cbu
8954 fi
8955 case "$uselargefiles" in
8956 "$define")
8957         if $test -f uselargefiles.cbu; then
8958                 echo " "
8959                 echo "Rechecking to see how big your file offsets are..." >&4
8960                 $cat >try.c <<EOCP
8961 #include <sys/types.h>
8962 #include <stdio.h>
8963 int main()
8964 {
8965     printf("%d\n", (int)sizeof($lseektype));
8966     return(0); 
8967 }
8968 EOCP
8969                 set try
8970                 if eval $compile_ok; then
8971                         lseeksize=`$run ./try`
8972                         $echo "Your file offsets are now $lseeksize bytes long."
8973                 else
8974                         dflt="$lseeksize"
8975                         echo " "
8976                         echo "(I can't seem to compile the test program.  Guessing...)"
8977                         rp="What is the size of your file offsets (in bytes)?"
8978                         . ./myread
8979                         lseeksize="$ans"
8980                 fi
8981                 case "$fpostype" in
8982                 *_t) zzz="$fpostype"    ;;
8983                 *)   zzz="fpos_t"       ;;
8984                 esac
8985                 $echo $n "Rechecking the size of $zzz...$c" >&4 
8986                 $cat > try.c <<EOCP
8987 #include <sys/types.h>
8988 #include <stdio.h>
8989 #$i_stdlib I_STDLIB
8990 #ifdef I_STDLIB
8991 #include <stdlib.h>
8992 #endif
8993 int main() {
8994     printf("%d\n", (int)sizeof($fpostype));
8995     return(0);
8996 }
8997 EOCP
8998                 set try
8999                 if eval $compile_ok; then
9000                         yyy=`$run ./try`
9001                         dflt="$lseeksize"
9002                         case "$yyy" in
9003                         '')     echo " "
9004                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9005                                 ;;
9006                         *)      fpossize=$yyy
9007                                 echo " $fpossize bytes." >&4
9008                                 ;;
9009                         esac
9010                 else
9011                         dflt="$fpossize"
9012                         echo " "
9013                         echo "(I can't compile the test program.  Guessing...)" >&4
9014                         rp="What is the size of your file positions (in bytes)?"
9015                         . ./myread
9016                         fpossize="$ans"
9017                 fi
9018                 $rm -f try.c try
9019         fi
9020         ;;
9021 esac
9022
9023 # probably will refer to
9024 #   $archlib $privlib $sitearch $sitelib $vendorarch $vendorlib
9025 need_relocation=0
9026 userelocatableinc=undef
9027
9028 case "$vendorprefix" in
9029 '')     d_vendorbin="$undef"
9030         vendorbin=''
9031         vendorbinexp=''
9032         ;;
9033 *)      d_vendorbin="$define"
9034         : determine where vendor-supplied executables go.
9035         case "$vendorbin" in
9036         '') dflt=$vendorprefix/bin ;;
9037         *)      dflt="$vendorbin" ;;
9038         esac
9039         fn=d~+
9040         rp='Pathname for the vendor-supplied executables directory?'
9041         . ./getfile
9042         vendorbin="$ans"
9043         vendorbinexp="$ansexp"
9044         ;;
9045 esac
9046 : Change installation prefix, if necessary.
9047 if $test X"$prefix" != X"$installprefix"; then
9048         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefixexp#$installprefixexp#"`
9049 else
9050         installvendorbin="$vendorbinexp"
9051 fi
9052
9053 case "$vendorprefix" in
9054 '')     vendorhtml1dir=''
9055         vendorhtml1direxp=''
9056         ;;
9057 *)      : determine where vendor-supplied html pages go.
9058         : There is no standard location, so try to copy the previously-selected
9059         : directory structure for the core html pages.
9060         : XXX Better default suggestions would be welcome.
9061         case "$vendorhtml1dir" in
9062         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9063         *)      dflt=$vendorhtml1dir ;;
9064         esac
9065         case "$dflt" in
9066         ''|' ') dflt=none ;;
9067         esac
9068         fn=dn+~
9069         rp='Pathname for the vendor-supplied html pages?'
9070         . ./getfile
9071         vendorhtml1dir="$ans"
9072         vendorhtml1direxp="$ansexp"
9073         ;;
9074 esac
9075 : Use ' ' for none so value is preserved next time through Configure
9076 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9077 : Change installation prefix, if necessary.
9078 if $test X"$prefix" != X"$installprefix"; then
9079         installvendorhtml1dir=`echo $vendorhtml1direxp | $sed "s#^$prefixexp#$installprefixexp#"`
9080 else
9081         installvendorhtml1dir="$vendorhtml1direxp"
9082 fi
9083
9084 case "$vendorprefix" in
9085 '')     vendorhtml3dir=''
9086         vendorhtml3direxp=''
9087         ;;
9088 *)      : determine where vendor-supplied module html pages go.
9089         : There is no standard location, so try to copy the previously-selected
9090         : directory structure for the core html pages.
9091         : XXX Better default suggestions would be welcome.
9092         case "$vendorhtml3dir" in
9093         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9094         *)      dflt=$vendorhtml3dir ;;
9095         esac
9096         case "$dflt" in
9097         ''|' ') dflt=none ;;
9098         esac
9099         fn=dn+~
9100         rp='Pathname for the vendor-supplied html pages?'
9101         . ./getfile
9102         vendorhtml3dir="$ans"
9103         vendorhtml3direxp="$ansexp"
9104         ;;
9105 esac
9106 : Use ' ' for none so value is preserved next time through Configure
9107 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9108 : Change installation prefix, if necessary.
9109 if $test X"$prefix" != X"$installprefix"; then
9110         installvendorhtml3dir=`echo $vendorhtml3direxp | $sed "s#^$prefixexp#$installprefixexp#"`
9111 else
9112         installvendorhtml3dir="$vendorhtml3direxp"
9113 fi
9114
9115 case "$vendorprefix" in
9116 '')     vendorman1dir=''
9117         vendorman1direxp=''
9118         ;;
9119 *)      : determine where vendor-supplied manual pages go.
9120         case "$vendorman1dir" in
9121         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9122         *)      dflt=$vendorman1dir ;;
9123         esac
9124         case "$dflt" in
9125         ''|' ') dflt=none ;;
9126         esac
9127         fn=nd~+
9128         rp='Pathname for the vendor-supplied manual section 1 pages?'
9129         . ./getfile
9130         vendorman1dir="$ans"
9131         vendorman1direxp="$ansexp"
9132         ;;
9133 esac
9134 : Use ' ' for none so value is preserved next time through Configure
9135 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9136 : Change installation prefix, if necessary.
9137 if $test X"$prefix" != X"$installprefix"; then
9138         installvendorman1dir=`echo "$vendorman1direxp" | $sed "s#^$prefixexp#$installprefixexp#"`
9139 else
9140         installvendorman1dir="$vendorman1direxp"
9141 fi
9142
9143 case "$vendorprefix" in
9144 '')     vendorman3dir=''
9145         vendorman3direxp=''
9146         ;;
9147 *)      : determine where vendor-supplied module manual pages go.
9148         case "$vendorman3dir" in
9149         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9150         *)      dflt=$vendorman3dir ;;
9151         esac
9152         case "$dflt" in
9153         ''|' ') dflt=none ;;
9154         esac
9155         fn=nd~+
9156         rp='Pathname for the vendor-supplied manual section 3 pages?'
9157         . ./getfile
9158         vendorman3dir="$ans"
9159         vendorman3direxp="$ansexp"
9160         ;;
9161 esac
9162 : Use ' ' for none so value is preserved next time through Configure
9163 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9164 : Change installation prefix, if necessary.
9165 if $test X"$prefix" != X"$installprefix"; then
9166         installvendorman3dir=`echo "$vendorman3direxp" | $sed "s#^$prefixexp#$installprefixexp#"`
9167 else
9168         installvendorman3dir="$vendorman3direxp"
9169 fi
9170
9171 case "$vendorprefix" in
9172 '')     d_vendorscript="$undef"
9173         vendorscript=''
9174         vendorscriptexp=''
9175         ;;
9176 *)      d_vendorscript="$define"
9177         : determine where vendor-supplied scripts go.
9178         case "$vendorscript" in
9179         '')     dflt=$vendorprefix/script
9180                 $test -d $dflt || dflt=$vendorbin ;;
9181         *)  dflt="$vendorscript" ;;
9182         esac
9183         $cat <<EOM
9184
9185 The installation process will create a directory for 
9186 vendor-supplied scripts.
9187
9188 EOM
9189         fn=d~+
9190         rp='Pathname for the vendor-supplied scripts directory?'
9191         . ./getfile
9192         vendorscript="$ans"
9193         vendorscriptexp="$ansexp"
9194         ;;
9195 esac
9196 : Change installation prefix, if necessary.
9197 if $test X"$prefix" != X"$installprefix"; then
9198         installvendorscript=`echo $vendorscriptexp | $sed "s#^$prefixexp#$installprefixexp#"`
9199 else
9200         installvendorscript="$vendorscriptexp"
9201 fi
9202
9203 : see if qgcvt exists
9204 set qgcvt d_qgcvt
9205 eval $inlibc
9206
9207 echo " "
9208
9209 if $test X"$d_longdbl" = X"$define"; then
9210
9211 echo "Checking how to print long doubles..." >&4
9212
9213 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9214         $cat >try.c <<'EOCP'
9215 #include <sys/types.h>
9216 #include <stdio.h>
9217 int main() {
9218   double d = 123.456;
9219   printf("%.3f\n", d);
9220 }
9221 EOCP
9222         set try
9223         if eval $compile; then
9224                 yyy=`$run ./try`
9225                 case "$yyy" in
9226                 123.456)
9227                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9228                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9229                         echo "We will use %f."
9230                         ;;
9231                 esac
9232         fi
9233 fi
9234
9235 if $test X"$sPRIfldbl" = X; then
9236         $cat >try.c <<'EOCP'
9237 #include <sys/types.h>
9238 #include <stdio.h>
9239 int main() {
9240   long double d = 123.456;
9241   printf("%.3Lf\n", d);
9242 }
9243 EOCP
9244         set try
9245         if eval $compile; then
9246                 yyy=`$run ./try`
9247                 case "$yyy" in
9248                 123.456)
9249                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9250                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9251                         echo "We will use %Lf."
9252                         ;;
9253                 esac
9254         fi
9255 fi
9256
9257 if $test X"$sPRIfldbl" = X; then
9258         $cat >try.c <<'EOCP'
9259 #include <sys/types.h>
9260 #include <stdio.h>
9261 int main() {
9262   long double d = 123.456;
9263   printf("%.3llf\n", d);
9264 }
9265 EOCP
9266         set try
9267         if eval $compile; then
9268                 yyy=`$run ./try`
9269                 case "$yyy" in
9270                 123.456)
9271                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9272                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9273                         echo "We will use %llf."
9274                         ;;
9275                 esac
9276         fi
9277 fi
9278
9279 if $test X"$sPRIfldbl" = X; then
9280         $cat >try.c <<'EOCP'
9281 #include <sys/types.h>
9282 #include <stdio.h>
9283 int main() {
9284   long double d = 123.456;
9285   printf("%.3lf\n", d);
9286 }
9287 EOCP
9288         set try
9289         if eval $compile; then
9290                 yyy=`$run ./try`
9291                 case "$yyy" in
9292                 123.456)
9293                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9294                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9295                         echo "We will use %lf."
9296                         ;;
9297                 esac
9298         fi
9299 fi
9300
9301 if $test X"$sPRIfldbl" = X; then
9302         echo "Cannot figure out how to print long doubles." >&4
9303 else
9304         sSCNfldbl=$sPRIfldbl    # expect consistency
9305 fi
9306
9307 $rm -f try try.*
9308
9309 fi # d_longdbl
9310
9311 case "$sPRIfldbl" in
9312 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
9313         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
9314         d_SCNfldbl="$undef";
9315         ;;
9316 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
9317         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
9318         d_SCNfldbl="$define";
9319         ;;
9320 esac
9321
9322 : Check how to convert floats to strings.
9323
9324 if test "X$d_Gconvert" = X; then
9325
9326 echo " "
9327 echo "Checking for an efficient way to convert floats to strings."
9328 echo " " > try.c
9329 case "$uselongdouble" in
9330 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9331 esac
9332 case "$d_longdbl" in
9333 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9334 esac
9335 case "$d_PRIgldbl" in
9336 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9337 esac
9338 $cat >>try.c <<EOP
9339 #ifdef TRY_gconvert
9340 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9341 char *myname = "gconvert";
9342 #endif
9343 #ifdef TRY_gcvt
9344 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9345 char *myname = "gcvt";
9346 #endif
9347 #ifdef TRY_qgcvt
9348 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9349 char *myname = "qgcvt";
9350 #define DOUBLETYPE long double
9351 #endif
9352 #ifdef TRY_sprintf
9353 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9354 #ifdef HAS_PRIgldbl
9355 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9356 #else
9357 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9358 #endif
9359 #else
9360 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9361 #endif
9362 char *myname = "sprintf";
9363 #endif
9364
9365 #ifndef DOUBLETYPE
9366 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9367 #define DOUBLETYPE long double
9368 #else
9369 #define DOUBLETYPE double
9370 #endif
9371 #endif
9372
9373 #include <stdio.h>
9374
9375 #define I_STDLIB $i_stdlib
9376 #ifdef I_STDLIB
9377 #include <stdlib.h>
9378 #endif
9379
9380 int
9381 checkit(expect, got)
9382 char *expect;
9383 char *got;
9384 {
9385     if (strcmp(expect, got)) {
9386                 printf("%s oddity:  Expected %s, got %s\n",
9387                         myname, expect, got);
9388                 exit(1);
9389         }
9390 }
9391
9392 int main()
9393
9394         char buf[64]; 
9395         buf[63] = '\0';
9396
9397         /* This must be 1st test on (which?) platform */
9398         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9399         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9400         checkit("0.1", buf);
9401
9402         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
9403         checkit("0.01", buf);
9404
9405         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
9406         checkit("0.001", buf);
9407
9408         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
9409         checkit("0.0001", buf);
9410
9411         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9412         if (strlen(buf) > 5)
9413             checkit("9e-005", buf); /* for Microsoft ?? */
9414         else
9415             checkit("9e-05", buf);
9416
9417         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
9418         checkit("1", buf);
9419
9420         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
9421         checkit("1.1", buf);
9422
9423         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
9424         checkit("1.01", buf);
9425
9426         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
9427         checkit("1.001", buf);
9428
9429         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
9430         checkit("1.0001", buf);
9431
9432         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
9433         checkit("1.00001", buf);
9434
9435         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
9436         checkit("1.000001", buf);
9437
9438         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
9439         checkit("0", buf);
9440
9441         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
9442         checkit("-1", buf);
9443
9444         /* Some Linux gcvt's give 1.e+5 here. */
9445         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
9446         checkit("100000", buf);
9447         
9448         /* Some Linux gcvt's give -1.e+5 here. */
9449         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
9450         checkit("-100000", buf);
9451
9452         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
9453         checkit("123.456", buf);
9454
9455         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9456         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9457         /* 34 should be enough to scare even long double
9458          * places into using the e notation. */
9459         if (strlen(buf) > 5)
9460             checkit("1e+034", buf); /* for Microsoft */
9461         else
9462             checkit("1e+34", buf);
9463
9464         /* For Perl, if you add additional tests here, also add them to
9465          * t/base/num.t for benefit of platforms not using Configure or
9466          * overriding d_Gconvert */
9467
9468         exit(0);
9469 }
9470 EOP
9471 : first add preferred functions to our list
9472 xxx_list=""
9473 for xxx_convert in $gconvert_preference; do
9474     case $xxx_convert in
9475     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9476     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9477     esac 
9478 done
9479 : then add any others
9480 for xxx_convert in gconvert gcvt sprintf; do
9481     case "$xxx_list" in
9482     *$xxx_convert*) ;;
9483     *) xxx_list="$xxx_list $xxx_convert" ;;
9484     esac 
9485 done
9486
9487 case "$d_longdbl$uselongdouble" in
9488 "$define$define")
9489     : again, add prefered functions to our list first
9490     xxx_ld_list=""
9491     for xxx_convert in $gconvert_ld_preference; do
9492         case $xxx_convert in
9493         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9494         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9495         esac
9496     done
9497     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9498     for xxx_convert in qgcvt sprintf $xxx_list; do
9499         case "$xxx_ld_list" in
9500         $xxx_convert*|*" $xxx_convert"*) ;;
9501         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9502         esac
9503     done
9504     : if sprintf cannot do long doubles, move it to the end
9505     if test "$d_PRIgldbl" != "$define"; then
9506         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9507     fi
9508     : if no qgcvt, remove it
9509     if test "$d_qgcvt" != "$define"; then
9510         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9511     fi
9512     : use the ld_list
9513     xxx_list="$xxx_ld_list"
9514     ;;
9515 esac
9516
9517 for xxx_convert in $xxx_list; do
9518         echo "Trying $xxx_convert..."
9519         $rm -f try try$_o
9520         set try -DTRY_$xxx_convert
9521         if eval $compile; then
9522                 echo "$xxx_convert() found." >&4
9523                 if $run ./try; then
9524                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9525                         break;
9526                 else
9527                         echo "...But $xxx_convert didn't work as I expected."
9528                         xxx_convert=''
9529                 fi
9530         else
9531                 echo "$xxx_convert NOT found." >&4
9532         fi
9533 done
9534
9535 if test X$xxx_convert = X; then
9536     echo "*** WHOA THERE!!! ***" >&4
9537     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9538     xxx_convert=sprintf
9539 fi
9540
9541 case "$xxx_convert" in
9542 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9543 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9544 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9545 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9546    "$define$define$define")
9547       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9548    "$define$define$undef")
9549       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9550    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9551    esac
9552    ;;  
9553 esac
9554
9555 fi
9556
9557 : see if _fwalk exists
9558 set fwalk d__fwalk
9559 eval $inlibc
9560
9561 : Initialize h_fcntl
9562 h_fcntl=false
9563
9564 : Initialize h_sysfile
9565 h_sysfile=false
9566
9567 : access call always available on UNIX
9568 set access d_access
9569 eval $inlibc
9570
9571 : locate the flags for 'access()'
9572 case "$d_access" in
9573 "$define")
9574         echo " "
9575         $cat >access.c <<EOCP
9576 #include <sys/types.h>
9577 #ifdef I_FCNTL
9578 #include <fcntl.h>
9579 #endif
9580 #ifdef I_SYS_FILE
9581 #include <sys/file.h>
9582 #endif
9583 #ifdef I_UNISTD
9584 #include <unistd.h>
9585 #endif
9586 #$i_stdlib I_STDLIB
9587 #ifdef I_STDLIB
9588 #include <stdlib.h>
9589 #endif
9590 int main() {
9591         exit(R_OK);
9592 }
9593 EOCP
9594         : check sys/file.h first, no particular reason here
9595         if $test `./findhdr sys/file.h` && \
9596                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9597                 h_sysfile=true;
9598                 echo "<sys/file.h> defines the *_OK access constants." >&4
9599         elif $test `./findhdr fcntl.h` && \
9600                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9601                 h_fcntl=true;
9602                 echo "<fcntl.h> defines the *_OK access constants." >&4
9603         elif $test `./findhdr unistd.h` && \
9604                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9605                 echo "<unistd.h> defines the *_OK access constants." >&4
9606         else
9607                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9608         fi
9609         ;;
9610 esac
9611 $rm -f access*
9612
9613 : see if accessx exists
9614 set accessx d_accessx
9615 eval $inlibc
9616
9617 : see if aintl exists
9618 set aintl d_aintl
9619 eval $inlibc
9620
9621 : see if alarm exists
9622 set alarm d_alarm
9623 eval $inlibc
9624
9625 : see if POSIX threads are available
9626 set pthread.h i_pthread
9627 eval $inhdr
9628
9629 : define a fucntion to check prototypes
9630 $cat > protochk <<EOSH
9631 $startsh
9632 cc="$cc"
9633 optimize="$optimize"
9634 ccflags="$ccflags"
9635 prototype="$prototype"
9636 define="$define"
9637 rm=$rm
9638 usethreads=$usethreads
9639 i_pthread=$i_pthread
9640 pthread_h_first=$pthread_h_first
9641 EOSH
9642
9643 $cat >> protochk <<'EOSH'
9644
9645 $rm -f try.c
9646 foo="$1"
9647 shift
9648 while test $# -ge 2; do
9649         case "$1" in
9650                 $define) echo "#include <$2>" >> try.c ;;
9651                 literal) echo "$2" >> try.c ;;
9652         esac
9653     # Extra magic for the benefit of systems that need pthread.h
9654     # to be included early to correctly detect threadsafe functions.
9655     # Such functions must guarantee themselves, though, that the usethreads
9656     # and i_pthread have been defined, before calling protochk.
9657     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9658         echo "#include <pthread.h>" >> try.c
9659         pthread_h_done=yes
9660     fi
9661     shift 2
9662 done
9663 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9664 cat >> try.c <<'EOCP'
9665 #ifdef CAN_PROTOTYPE
9666 #define _(args) args
9667 #else
9668 #define _(args) ()
9669 #endif
9670 EOCP
9671 echo "$foo" >> try.c
9672 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9673 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9674 status=$?
9675 $rm -f try.[co]
9676 exit $status
9677 EOSH
9678 chmod +x protochk
9679 $eunicefix protochk
9680
9681 hasproto='varname=$1; func=$2; shift; shift;
9682 while $test $# -ge 2; do
9683         case "$1" in
9684         $define) echo "#include <$2>";;
9685         esac ;
9686     shift 2;
9687 done > try.c;
9688 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9689 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9690         echo "$func() prototype found.";
9691         val="$define";
9692 else
9693         echo "$func() prototype NOT found.";
9694         val="$undef";
9695 fi;
9696 set $varname;
9697 eval $setvar;
9698 $rm -f try.c tryout.c'
9699
9700 : see if sys/types.h has to be included
9701 set sys/types.h i_systypes
9702 eval $inhdr
9703
9704 : see if sys/select.h has to be included
9705 set sys/select.h i_sysselct
9706 eval $inhdr
9707
9708 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9709 while $test $# -ge 2; do
9710         case "$1" in
9711         $define) echo "#include <$2>";;
9712         esac ;
9713     shift 2;
9714 done > try.c;
9715 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9716 set try;
9717 if eval $compile; then
9718         val="$define";
9719 else
9720         val="$undef";
9721 fi;
9722 set $varname;
9723 eval $setvar;
9724 $rm -f try.c try.o'
9725
9726 : see if we should include time.h, sys/time.h, or both
9727 echo " "
9728 if test "X$timeincl" = X; then
9729         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9730         $echo $n "I'm now running the test program...$c"
9731         $cat >try.c <<EOCP
9732 #include <sys/types.h>
9733 #ifdef I_TIME
9734 #include <time.h>
9735 #endif
9736 #ifdef I_SYSTIME
9737 #ifdef SYSTIMEKERNEL
9738 #define KERNEL
9739 #endif
9740 #include <sys/time.h>
9741 #endif
9742 #ifdef I_SYSSELECT
9743 #include <sys/select.h>
9744 #endif
9745 #$i_stdlib I_STDLIB
9746 #ifdef I_STDLIB
9747 #include <stdlib.h>
9748 #endif
9749 int main()
9750 {
9751         struct tm foo;
9752 #ifdef S_TIMEVAL
9753         struct timeval bar;
9754 #endif
9755 #ifdef S_TIMEZONE
9756         struct timezone tzp;
9757 #endif
9758         if (foo.tm_sec == foo.tm_sec)
9759                 exit(0);
9760 #ifdef S_TIMEVAL
9761         if (bar.tv_sec == bar.tv_sec)
9762                 exit(0);
9763 #endif
9764         exit(1);
9765 }
9766 EOCP
9767         flags=''
9768         for s_timezone in '-DS_TIMEZONE' ''; do
9769         sysselect=''
9770         for s_timeval in '-DS_TIMEVAL' ''; do
9771         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9772         for i_time in '' '-DI_TIME'; do
9773         for i_systime in '-DI_SYSTIME' ''; do
9774                 case "$flags" in
9775                 '') $echo $n ".$c"
9776                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9777                         if eval $compile; then
9778                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9779                                 shift
9780                                 flags="$*"
9781                                 echo " "
9782                                 $echo $n "Succeeded with $flags$c"
9783                         fi
9784                         ;;
9785                 esac
9786         done
9787         done
9788         done
9789         done
9790         done
9791         timeincl=''
9792         echo " "
9793         case "$flags" in
9794         *SYSTIMEKERNEL*) i_systimek="$define"
9795                 timeincl=`./findhdr sys/time.h`
9796                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9797         *) i_systimek="$undef";;
9798         esac
9799         case "$flags" in
9800         *I_TIME*) i_time="$define"
9801                 timeincl=`./findhdr time.h`" $timeincl"
9802                 echo "We'll include <time.h>." >&4;;
9803         *) i_time="$undef";;
9804         esac
9805         case "$flags" in
9806         *I_SYSTIME*) i_systime="$define"
9807                 timeincl=`./findhdr sys/time.h`" $timeincl"
9808                 echo "We'll include <sys/time.h>." >&4;;
9809         *) i_systime="$undef";;
9810         esac
9811         $rm -f try.c try
9812 fi
9813 : see if struct tm knows about tm_zone
9814 case "$i_systime$i_time" in
9815 *$define*) 
9816         echo " "
9817         echo "Checking to see if your struct tm has tm_zone field..." >&4
9818         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9819         eval $hasfield
9820         ;;
9821 *)      val="$undef"
9822         set d_tm_tm_zone
9823         eval $setvar
9824         ;;
9825 esac
9826 case "$d_tm_tm_zone" in
9827 "$define")      echo "Yes, it does."   ;;
9828 *)              echo "No, it doesn't." ;;
9829 esac
9830 : see if struct tm knows about tm_gmtoff
9831 case "$i_systime$i_time" in
9832 *$define*) 
9833         echo " "
9834         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9835         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9836         eval $hasfield
9837         ;;
9838 *)      val="$undef"
9839         set d_tm_tm_gmtoff
9840         eval $setvar
9841         ;;
9842 esac
9843 case "$d_tm_tm_gmtoff" in
9844 "$define")      echo "Yes, it does."   ;;
9845 *)              echo "No, it doesn't." ;;
9846 esac
9847
9848 : see if asctime_r exists
9849 set asctime_r d_asctime_r
9850 eval $inlibc
9851 case "$d_asctime_r" in
9852 "$define")
9853         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9854         case "$d_asctime_r_proto:$usethreads" in
9855         ":define")      d_asctime_r_proto=define
9856                 set d_asctime_r_proto asctime_r $hdrs
9857                 eval $hasproto ;;
9858         *)      ;;
9859         esac
9860         case "$d_asctime_r_proto" in
9861         define)
9862         case "$asctime_r_proto" in
9863         ''|0) try='char* asctime_r(const struct tm*, char*);'
9864         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9865         esac
9866         case "$asctime_r_proto" in
9867         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9868         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9869         esac
9870         case "$asctime_r_proto" in
9871         ''|0) try='int asctime_r(const struct tm*, char*);'
9872         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9873         esac
9874         case "$asctime_r_proto" in
9875         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9876         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9877         esac
9878         case "$asctime_r_proto" in
9879         ''|0)   d_asctime_r=undef
9880                 asctime_r_proto=0
9881                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9882         * )     case "$asctime_r_proto" in
9883                 REENTRANT_PROTO*) ;;
9884                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9885                 esac
9886                 echo "Prototype: $try" ;;
9887         esac
9888         ;;
9889         *)      case "$usethreads" in
9890                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9891                 esac
9892                 d_asctime_r=undef
9893                 asctime_r_proto=0
9894                 ;;
9895         esac
9896         ;;
9897 *)      asctime_r_proto=0
9898         ;;
9899 esac
9900
9901 : see if atolf exists
9902 set atolf d_atolf
9903 eval $inlibc
9904
9905 : see if atoll exists
9906 set atoll d_atoll
9907 eval $inlibc
9908
9909 : Look for GCC-style attribute format
9910 case "$d_attribute_format" in
9911 '')
9912 echo " "
9913 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
9914 $cat >attrib.c <<'EOCP'
9915 #include <stdio.h>
9916 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
9917 EOCP
9918 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9919         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9920                 echo "Your C compiler doesn't support __attribute__((format))."
9921                 val="$undef"
9922         else
9923                 echo "Your C compiler supports __attribute__((format))."
9924                 val="$define"
9925         fi
9926 else
9927         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9928         val="$undef"
9929 fi
9930 ;;
9931 *) val="$d_attribute_format" ;;
9932 esac
9933 set d_attribute_format
9934 eval $setvar
9935 $rm -f attrib*
9936
9937 : Look for GCC-style attribute malloc
9938 case "$d_attribute_malloc" in
9939 '')
9940 echo " "
9941 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
9942 $cat >attrib.c <<'EOCP'
9943 #include <stdio.h>
9944 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
9945 EOCP
9946 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9947         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9948                 echo "Your C compiler doesn't support __attribute__((malloc))."
9949                 val="$undef"
9950         else
9951                 echo "Your C compiler supports __attribute__((malloc))."
9952                 val="$define"
9953         fi
9954 else
9955         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9956         val="$undef"
9957 fi
9958 ;;
9959 *) val="$d_attribute_malloc" ;;
9960 esac
9961 set d_attribute_malloc
9962 eval $setvar
9963 $rm -f attrib*
9964
9965 : Look for GCC-style attribute nonnull
9966 case "$d_attribute_nonnull" in
9967 '')
9968 echo " "
9969 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
9970 $cat >attrib.c <<'EOCP'
9971 #include <stdio.h>
9972 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
9973 EOCP
9974 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9975         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9976                 echo "Your C compiler doesn't support __attribute__((nonnull))."
9977                 val="$undef"
9978         else
9979                 echo "Your C compiler supports __attribute__((nonnull))."
9980                 val="$define"
9981         fi
9982 else
9983         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9984         val="$undef"
9985 fi
9986 ;;
9987 *) val="$d_attribute_nonnull" ;;
9988 esac
9989 set d_attribute_nonnull
9990 eval $setvar
9991 $rm -f attrib*
9992
9993 : Look for GCC-style attribute noreturn
9994 case "$d_attribute_noreturn" in
9995 '')
9996 echo " "
9997 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
9998 $cat >attrib.c <<'EOCP'
9999 #include <stdio.h>
10000 void fall_over_dead( void ) __attribute__((noreturn));
10001 EOCP
10002 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10003         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10004                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10005                 val="$undef"
10006         else
10007                 echo "Your C compiler supports __attribute__((noreturn))."
10008                 val="$define"
10009         fi
10010 else
10011         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10012         val="$undef"
10013 fi
10014 ;;
10015 *) val="$d_attribute_noreturn" ;;
10016 esac
10017 set d_attribute_noreturn
10018 eval $setvar
10019 $rm -f attrib*
10020
10021 : Look for GCC-style attribute pure
10022 case "$d_attribute_pure" in
10023 '')
10024 echo " "
10025 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10026 $cat >attrib.c <<'EOCP'
10027 #include <stdio.h>
10028 int square( int n ) __attribute__((pure));
10029 EOCP
10030 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10031         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10032                 echo "Your C compiler doesn't support __attribute__((pure))."
10033                 val="$undef"
10034         else
10035                 echo "Your C compiler supports __attribute__((pure))."
10036                 val="$define"
10037         fi
10038 else
10039         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10040         val="$undef"
10041 fi
10042 ;;
10043 *) val="$d_attribute_pure" ;;
10044 esac
10045 set d_attribute_pure
10046 eval $setvar
10047 $rm -f attrib*
10048
10049 : Look for GCC-style attribute unused
10050 case "$d_attribute_unused" in
10051 '')
10052 echo " "
10053 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10054 $cat >attrib.c <<'EOCP'
10055 #include <stdio.h>
10056 int do_something( int dummy __attribute__((unused)), int n );
10057 EOCP
10058 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10059         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10060                 echo "Your C compiler doesn't support __attribute__((unused))."
10061                 val="$undef"
10062         else
10063                 echo "Your C compiler supports __attribute__((unused))."
10064                 val="$define"
10065         fi
10066 else
10067         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10068         val="$undef"
10069 fi
10070 ;;
10071 *) val="$d_attribute_unused" ;;
10072 esac
10073 set d_attribute_unused
10074 eval $setvar
10075 $rm -f attrib*
10076
10077 : Look for GCC-style attribute warn_unused_result
10078 case "$d_attribute_warn_unused_result" in
10079 '')
10080 echo " "
10081 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10082 $cat >attrib.c <<'EOCP'
10083 #include <stdio.h>
10084 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10085 EOCP
10086 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10087         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10088                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10089                 val="$undef"
10090         else
10091                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10092                 val="$define"
10093         fi
10094 else
10095         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10096         val="$undef"
10097 fi
10098 ;;
10099 *) val="$d_attribute_warn_unused_result" ;;
10100 esac
10101 set d_attribute_warn_unused_result
10102 eval $setvar
10103 $rm -f attrib*
10104
10105 : see if bcmp exists
10106 set bcmp d_bcmp
10107 eval $inlibc
10108
10109 : see if bcopy exists
10110 set bcopy d_bcopy
10111 eval $inlibc
10112
10113 : see if this is a unistd.h system
10114 set unistd.h i_unistd
10115 eval $inhdr
10116
10117 : see if getpgrp exists
10118 set getpgrp d_getpgrp
10119 eval $inlibc
10120
10121 case "$d_getpgrp" in
10122 "$define")
10123         echo " "
10124         echo "Checking to see which flavor of getpgrp is in use..."
10125         $cat >try.c <<EOP
10126 #$i_unistd I_UNISTD
10127 #include <sys/types.h>
10128 #ifdef I_UNISTD
10129 #  include <unistd.h>
10130 #endif
10131 #$i_stdlib I_STDLIB
10132 #ifdef I_STDLIB
10133 #include <stdlib.h>
10134 #endif
10135 int main()
10136 {
10137         if (getuid() == 0) {
10138                 printf("(I see you are running Configure as super-user...)\n");
10139                 setuid(1);
10140         }
10141 #ifdef TRY_BSD_PGRP
10142         if (getpgrp(1) == 0)
10143                 exit(0);
10144 #else
10145         if (getpgrp() > 0)
10146                 exit(0);
10147 #endif
10148         exit(1);
10149 }
10150 EOP
10151         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10152                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10153                 val="$define"
10154         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10155                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10156                 val="$undef"
10157         else
10158                 echo "I can't seem to compile and run the test program."
10159                 if ./usg; then
10160                         xxx="a USG one, i.e. you use getpgrp()."
10161                 else
10162                         # SVR4 systems can appear rather BSD-ish.
10163                         case "$i_unistd" in
10164                         $undef)
10165                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10166                                 val="$define"
10167                                 ;;
10168                         $define)
10169                                 xxx="probably a USG one, i.e. you use getpgrp()."
10170                                 val="$undef"
10171                                 ;;
10172                         esac
10173                 fi
10174                 echo "Assuming your getpgrp is $xxx" >&4
10175         fi
10176         ;;
10177 *) val="$undef";;
10178 esac
10179 set d_bsdgetpgrp
10180 eval $setvar
10181 $rm -f try try.*
10182
10183 : see if setpgrp exists
10184 set setpgrp d_setpgrp
10185 eval $inlibc
10186
10187 case "$d_setpgrp" in
10188 "$define")
10189         echo " "
10190         echo "Checking to see which flavor of setpgrp is in use..."
10191         $cat >try.c <<EOP
10192 #$i_unistd I_UNISTD
10193 #include <sys/types.h>
10194 #ifdef I_UNISTD
10195 #  include <unistd.h>
10196 #endif
10197 #$i_stdlib I_STDLIB
10198 #ifdef I_STDLIB
10199 #include <stdlib.h>
10200 #endif
10201 int main()
10202 {
10203         if (getuid() == 0) {
10204                 printf("(I see you are running Configure as super-user...)\n");
10205                 setuid(1);
10206         }
10207 #ifdef TRY_BSD_PGRP
10208         if (-1 == setpgrp(1, 1))
10209                 exit(0);
10210 #else
10211         if (setpgrp() != -1)
10212                 exit(0);
10213 #endif
10214         exit(1);
10215 }
10216 EOP
10217         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10218                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10219                 val="$define"
10220         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10221                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10222                 val="$undef"
10223         else
10224                 echo "(I can't seem to compile and run the test program.)"
10225                 if ./usg; then
10226                         xxx="a USG one, i.e. you use setpgrp()."
10227                 else
10228                         # SVR4 systems can appear rather BSD-ish.
10229                         case "$i_unistd" in
10230                         $undef)
10231                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10232                                 val="$define"
10233                                 ;;
10234                         $define)
10235                                 xxx="probably a USG one, i.e. you use setpgrp()."
10236                                 val="$undef"
10237                                 ;;
10238                         esac
10239                 fi
10240                 echo "Assuming your setpgrp is $xxx" >&4
10241         fi
10242         ;;
10243 *) val="$undef";;
10244 esac
10245 set d_bsdsetpgrp
10246 eval $setvar
10247 $rm -f try try.*
10248 : Look for GCC-style __builtin_choose_expr
10249 case "$d_builtin_choose_expr" in
10250 '')
10251     echo " "
10252     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10253     $cat >try.c <<'EOCP'
10254 #include <assert.h>
10255 #include <stdlib.h>
10256 #include <stdio.h>
10257
10258 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10259
10260 int main(void) {
10261     assert( SYRINX(1) == 2112 );
10262     assert( SYRINX(1) != 5150 );
10263     assert( SYRINX(0) == 5150 );
10264     assert( SYRINX(0) != 2112 );
10265     puts( "All good!" );
10266     exit(0);
10267 }
10268
10269 EOCP
10270     set try
10271     if eval $compile; then
10272         echo "Your C compiler supports __builtin_choose_expr."
10273         val="$define"
10274     else
10275         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10276         val="$undef"
10277     fi
10278 ;;
10279 *) val="$d_builtin_choose_expr" ;;
10280 esac
10281
10282 set d_builtin_choose_expr
10283 eval $setvar
10284 $rm -f try.* try core core.try.*
10285
10286 : Look for GCC-style __builtin_expect
10287 case "$d_builtin_expect" in
10288 '')
10289     echo " "
10290     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10291     $cat >builtin.c <<'EOCP'
10292 int main(void) {
10293     int n = 50;
10294     if ( __builtin_expect(n, 0) ) n = 1;
10295 }
10296 EOCP
10297     set try
10298     if eval $compile; then
10299         echo "Your C compiler supports __builtin_choose_expr."
10300         val="$define"
10301     else
10302         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10303         val="$undef"
10304     fi
10305     ;;
10306 *) val="$d_builtin_expect" ;;
10307 esac
10308
10309 set d_builtin_expect
10310 eval $setvar
10311 $rm -f try.* try core core.try.*
10312
10313 : see if bzero exists
10314 set bzero d_bzero
10315 eval $inlibc
10316
10317 : see if signal is declared as pointer to function returning int or void
10318 echo " "
10319 xxx=`./findhdr signal.h`
10320 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10321 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10322         echo "You have int (*signal())() instead of void." >&4
10323         val="$undef"
10324 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10325         echo "You have void (*signal())()." >&4
10326         val="$define"
10327 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10328         echo "You have int (*signal())() instead of void." >&4
10329         val="$undef"
10330 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10331         echo "You have void (*signal())()." >&4
10332         val="$define"
10333 else
10334         case "$d_voidsig" in
10335         '')
10336         echo "I can't determine whether signal handler returns void or int..." >&4
10337                 dflt=void
10338                 rp="What type does your signal handler return?"
10339                 . ./myread
10340                 case "$ans" in
10341                 v*) val="$define";;
10342                 *) val="$undef";;
10343                 esac;;
10344         "$define")
10345                 echo "As you already told me, signal handler returns void." >&4
10346                 val="$define"
10347                 ;;
10348         *)      echo "As you already told me, signal handler returns int." >&4
10349                 val="$undef"
10350                 ;;
10351         esac
10352 fi
10353 set d_voidsig
10354 eval $setvar
10355 case "$d_voidsig" in
10356 "$define") signal_t="void";;
10357 *) signal_t="int";;
10358 esac
10359 $rm -f $$.tmp
10360
10361 : check for ability to cast large floats to 32-bit ints.
10362 echo " "
10363 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10364 if $test "$intsize" -ge 4; then
10365         xxx=int
10366 else
10367         xxx=long
10368 fi
10369 $cat >try.c <<EOCP
10370 #include <stdio.h>
10371 #$i_stdlib I_STDLIB
10372 #ifdef I_STDLIB
10373 #include <stdlib.h>
10374 #endif
10375 #include <sys/types.h>
10376 #include <signal.h>
10377 $signal_t blech(s) int s; { exit(3); }
10378 int main()
10379 {
10380         $xxx i32;
10381         double f, g;
10382         int result = 0;
10383         char str[16];
10384         signal(SIGFPE, blech);
10385
10386         /* Don't let compiler optimize the test away.  Store the number 
10387            in a writable string for gcc to pass to sscanf under HP/UX.
10388         */
10389         sprintf(str, "2147483647");
10390         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10391         g = 10 * f;
10392         i32  = ($xxx) g;
10393
10394         /* x86 processors will probably give 0x8000 0000, which is a
10395            sign change.  We don't want that.  We want to mimic SPARC
10396            behavior here, which is to preserve the sign and give
10397            back 0x7fff ffff.
10398         */
10399         if (i32 != ($xxx) f)
10400                 result |= 1;
10401         exit(result);
10402 }
10403 EOCP
10404 set try
10405 if eval $compile_ok; then
10406         $run ./try
10407         yyy=$?
10408 else
10409         echo "(I can't seem to compile the test program--assuming it can't)"
10410         yyy=1
10411 fi
10412 case "$yyy" in
10413 0)      val="$define"
10414         echo "Yup, it can."
10415         ;;
10416 *)      val="$undef"
10417         echo "Nope, it can't."
10418         ;;
10419 esac
10420 set d_casti32
10421 eval $setvar
10422 $rm -f try try.*
10423
10424 : check for ability to cast negative floats to unsigned
10425 echo " "
10426 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10427 $cat >try.c <<EOCP
10428 #include <stdio.h>
10429 #$i_stdlib I_STDLIB
10430 #ifdef I_STDLIB
10431 #include <stdlib.h>
10432 #endif
10433 #include <sys/types.h>
10434 #include <signal.h>
10435 $signal_t blech(s) int s; { exit(7); }
10436 $signal_t blech_in_list(s) int s; { exit(4); }
10437 unsigned long dummy_long(p) unsigned long p; { return p; }
10438 unsigned int dummy_int(p) unsigned int p; { return p; }
10439 unsigned short dummy_short(p) unsigned short p; { return p; }
10440 int main()
10441 {
10442         double f;
10443         unsigned long along;
10444         unsigned int aint;
10445         unsigned short ashort;
10446         int result = 0;
10447         char str[16];
10448         
10449         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10450            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10451            optimized the whole file away
10452         */
10453         /* Store the number in a writable string for gcc to pass to 
10454            sscanf under HP/UX.
10455         */
10456         sprintf(str, "-123");
10457         sscanf(str, "%lf", &f);  /* f = -123.; */
10458
10459         signal(SIGFPE, blech);
10460         along = (unsigned long)f;
10461         aint = (unsigned int)f;
10462         ashort = (unsigned short)f;
10463         if (along != (unsigned long)-123)
10464                 result |= 1;
10465         if (aint != (unsigned int)-123)
10466                 result |= 1;
10467         if (ashort != (unsigned short)-123)
10468                 result |= 1;
10469         sprintf(str, "1073741824.");
10470         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10471         f = f + f;
10472         along = 0;
10473         along = (unsigned long)f;
10474         if (along != 0x80000000)
10475                 result |= 2;
10476         f -= 1.;
10477         along = 0;
10478         along = (unsigned long)f;
10479         if (along != 0x7fffffff)
10480                 result |= 1;
10481         f += 2.;
10482         along = 0;
10483         along = (unsigned long)f;
10484         if (along != 0x80000001)
10485                 result |= 2;
10486         if (result)
10487                 exit(result);
10488         signal(SIGFPE, blech_in_list);
10489         sprintf(str, "123.");
10490         sscanf(str, "%lf", &f);  /* f = 123.; */
10491         along = dummy_long((unsigned long)f);
10492         aint = dummy_int((unsigned int)f);
10493         ashort = dummy_short((unsigned short)f);
10494         if (along != (unsigned long)123)
10495                 result |= 4;
10496         if (aint != (unsigned int)123)
10497                 result |= 4;
10498         if (ashort != (unsigned short)123)
10499                 result |= 4;
10500         exit(result);
10501
10502 }
10503 EOCP
10504 set try
10505 if eval $compile_ok; then
10506         $run ./try
10507         castflags=$?
10508 else
10509         echo "(I can't seem to compile the test program--assuming it can't)"
10510         castflags=7
10511 fi
10512 case "$castflags" in
10513 0)      val="$define"
10514         echo "Yup, it can."
10515         ;;
10516 *)      val="$undef"
10517         echo "Nope, it can't."
10518         ;;
10519 esac
10520 set d_castneg
10521 eval $setvar
10522 $rm -f try.*
10523
10524 : see if vprintf exists
10525 echo " "
10526 if set vprintf val -f d_vprintf; eval $csym; $val; then
10527         echo 'vprintf() found.' >&4
10528         val="$define"
10529         $cat >try.c <<EOF
10530 #include <varargs.h>
10531 #$i_stdlib I_STDLIB
10532 #ifdef I_STDLIB
10533 #include <stdlib.h>
10534 #endif
10535
10536 int main() { xxx("foo"); }
10537
10538 xxx(va_alist)
10539 va_dcl
10540 {
10541         va_list args;
10542         char buf[10];
10543
10544         va_start(args);
10545         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10546 }
10547 EOF
10548         set try
10549         if eval $compile && $run ./try; then
10550                 echo "Your vsprintf() returns (int)." >&4
10551                 val2="$undef"
10552         else
10553                 echo "Your vsprintf() returns (char*)." >&4
10554                 val2="$define"
10555         fi
10556 else
10557         echo 'vprintf() NOT found.' >&4
10558                 val="$undef"
10559                 val2="$undef"
10560 fi
10561 $rm -f try try.*
10562 set d_vprintf
10563 eval $setvar
10564 val=$val2
10565 set d_charvspr
10566 eval $setvar
10567
10568 : see if chown exists
10569 set chown d_chown
10570 eval $inlibc
10571
10572 : see if chroot exists
10573 set chroot d_chroot
10574 eval $inlibc
10575
10576 : see if chsize exists
10577 set chsize d_chsize
10578 eval $inlibc
10579
10580 : see if class exists
10581 set class d_class
10582 eval $inlibc
10583
10584 : see if clearenv exists
10585 set clearenv d_clearenv
10586 eval $inlibc
10587
10588 hasstruct='varname=$1; struct=$2; shift; shift;
10589 while $test $# -ge 2; do
10590         case "$1" in
10591         $define) echo "#include <$2>";;
10592         esac ;
10593     shift 2;
10594 done > try.c;
10595 echo "int main () { struct $struct foo; }" >> try.c;
10596 set try;
10597 if eval $compile; then
10598         val="$define";
10599 else
10600         val="$undef";
10601 fi;
10602 set $varname;
10603 eval $setvar;
10604 $rm -f try.c try.o'
10605
10606 socketlib=''
10607 sockethdr=''
10608 : see whether socket exists
10609 echo " "
10610 $echo $n "Hmm... $c" >&4
10611 if set socket val -f d_socket; eval $csym; $val; then
10612         echo "Looks like you have Berkeley networking support." >&4
10613         d_socket="$define"
10614         if set setsockopt val -f; eval $csym; $val; then
10615                 d_oldsock="$undef"
10616         else
10617                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10618                 d_oldsock="$define"
10619         fi
10620 else
10621         if $contains socklib libc.list >/dev/null 2>&1; then
10622                 echo "Looks like you have Berkeley networking support." >&4
10623                 d_socket="$define"
10624                 : we will have to assume that it supports the 4.2 BSD interface
10625                 d_oldsock="$undef"
10626         else
10627                 echo "You don't have Berkeley networking in libc$_a..." >&4
10628                 if test "X$d_socket" = "X$define"; then
10629                    echo "...but you seem to believe that you have sockets." >&4
10630                 else
10631                         for net in net socket
10632                         do
10633                                 if test -f /usr/lib/lib$net$_a; then
10634                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10635                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10636                                         if $contains socket libc.list >/dev/null 2>&1; then
10637                                                 d_socket="$define"
10638                                                 socketlib="-l$net"
10639                                                 case "$net" in
10640                                                 net)
10641                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10642                                                         sockethdr="-I/usr/netinclude"
10643                                                         ;;
10644                                                 esac
10645                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
10646                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10647                                                         d_oldsock="$undef"
10648                                                 else
10649                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10650                                                         d_oldsock="$define"
10651                                                 fi
10652                                                 break
10653                                         fi
10654                                 fi
10655                         done
10656                         if test "X$d_socket" != "X$define"; then
10657                            echo "or anywhere else I see." >&4
10658                            d_socket="$undef"
10659                            d_oldsock="$undef"
10660                         fi
10661                 fi
10662         fi
10663 fi
10664
10665 : see if socketpair exists
10666 set socketpair d_sockpair
10667 eval $inlibc
10668
10669
10670 echo " "
10671 echo "Checking the availability of certain socket constants..." >&4
10672 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10673         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10674         $cat >try.c <<EOF
10675 #include <sys/types.h>
10676 #include <sys/socket.h>
10677 int main() {
10678     int i = $ENUM;
10679 }
10680 EOF
10681         val="$undef"
10682         set try; if eval $compile; then
10683                 val="$define"
10684         fi
10685         set d_${enum}; eval $setvar
10686         $rm -f try.c try
10687 done
10688
10689 : see if this is a sys/uio.h system
10690 set sys/uio.h i_sysuio
10691 eval $inhdr
10692
10693
10694 echo " "
10695 echo "Checking to see if your system supports struct cmsghdr..." >&4
10696 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10697 eval $hasstruct
10698 case "$d_cmsghdr_s" in
10699 "$define")      echo "Yes, it does."   ;;
10700 *)              echo "No, it doesn't." ;;
10701 esac
10702
10703
10704 : check for const keyword
10705 echo " "
10706 echo 'Checking to see if your C compiler knows about "const"...' >&4
10707 $cat >const.c <<'EOCP'
10708 typedef struct spug { int drokk; } spug;
10709 int main()
10710 {
10711         const char *foo;
10712         const spug y;
10713 }
10714 EOCP
10715 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10716         val="$define"
10717         echo "Yup, it does."
10718 else
10719         val="$undef"
10720         echo "Nope, it doesn't."
10721 fi
10722 set d_const
10723 eval $setvar
10724
10725 : see if copysignl exists
10726 set copysignl d_copysignl
10727 eval $inlibc
10728
10729 : see if crypt exists
10730 echo " "
10731 set crypt d_crypt
10732 eval $inlibc
10733 case "$d_crypt" in
10734 $define) cryptlib='' ;;
10735 *)      if set crypt val -f d_crypt; eval $csym; $val; then
10736                 echo 'crypt() found.' >&4
10737                 val="$define"
10738                 cryptlib=''
10739         else
10740                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10741                 if $test -z "$cryptlib"; then
10742                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10743                 else
10744                         cryptlib=-lcrypt
10745                 fi
10746                 if $test -z "$cryptlib"; then
10747                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10748                 else
10749                         cryptlib=-lcrypt
10750                 fi
10751                 if $test -z "$cryptlib"; then
10752                         cryptlib=`./loc libcrypt$_a "" $libpth`
10753                 else
10754                         cryptlib=-lcrypt
10755                 fi
10756                 if $test -z "$cryptlib"; then
10757                         echo 'crypt() NOT found.' >&4
10758                         val="$undef"
10759                 else
10760                         val="$define"
10761                 fi
10762         fi
10763         set d_crypt
10764         eval $setvar
10765         ;;
10766 esac
10767
10768 : see if this is a crypt.h system
10769 set crypt.h i_crypt
10770 eval $inhdr
10771
10772 : see if crypt_r exists
10773 set crypt_r d_crypt_r
10774 eval $inlibc
10775 case "$d_crypt_r" in
10776 "$define")
10777         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
10778         case "$d_crypt_r_proto:$usethreads" in
10779         ":define")      d_crypt_r_proto=define
10780                 set d_crypt_r_proto crypt_r $hdrs
10781                 eval $hasproto ;;
10782         *)      ;;
10783         esac
10784         case "$d_crypt_r_proto" in
10785         define)
10786         case "$crypt_r_proto" in
10787         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10788         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10789         esac
10790         case "$crypt_r_proto" in
10791         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10792         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10793         esac
10794         case "$crypt_r_proto" in
10795         ''|0)   d_crypt_r=undef
10796                 crypt_r_proto=0
10797                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10798         * )     case "$crypt_r_proto" in
10799                 REENTRANT_PROTO*) ;;
10800                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10801                 esac
10802                 echo "Prototype: $try" ;;
10803         esac
10804         ;;
10805         *)      case "$usethreads" in
10806                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10807                 esac
10808                 d_crypt_r=undef
10809                 crypt_r_proto=0
10810                 ;;
10811         esac
10812         ;;
10813 *)      crypt_r_proto=0
10814         ;;
10815 esac
10816
10817 : get csh whereabouts
10818 case "$csh" in
10819 'csh') val="$undef" ;;
10820 *) val="$define" ;;
10821 esac
10822 set d_csh
10823 eval $setvar
10824 : Respect a hint or command line value for full_csh.
10825 case "$full_csh" in
10826 '') full_csh=$csh ;;
10827 esac
10828
10829 : see if ctermid_r exists
10830 set ctermid_r d_ctermid_r
10831 eval $inlibc
10832 case "$d_ctermid_r" in
10833 "$define")
10834         hdrs="$i_systypes sys/types.h define stdio.h "
10835         case "$d_ctermid_r_proto:$usethreads" in
10836         ":define")      d_ctermid_r_proto=define
10837                 set d_ctermid_r_proto ctermid_r $hdrs
10838                 eval $hasproto ;;
10839         *)      ;;
10840         esac
10841         case "$d_ctermid_r_proto" in
10842         define)
10843         case "$ctermid_r_proto" in
10844         ''|0) try='char* ctermid_r(char*);'
10845         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10846         esac
10847         case "$ctermid_r_proto" in
10848         ''|0)   d_ctermid_r=undef
10849                 ctermid_r_proto=0
10850                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10851         * )     case "$ctermid_r_proto" in
10852                 REENTRANT_PROTO*) ;;
10853                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10854                 esac
10855                 echo "Prototype: $try" ;;
10856         esac
10857         ;;
10858         *)      case "$usethreads" in
10859                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10860                 esac
10861                 d_ctermid_r=undef
10862                 ctermid_r_proto=0
10863                 ;;
10864         esac
10865         ;;
10866 *)      ctermid_r_proto=0
10867         ;;
10868 esac
10869
10870 : see if ctime_r exists
10871 set ctime_r d_ctime_r
10872 eval $inlibc
10873 case "$d_ctime_r" in
10874 "$define")
10875         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10876         case "$d_ctime_r_proto:$usethreads" in
10877         ":define")      d_ctime_r_proto=define
10878                 set d_ctime_r_proto ctime_r $hdrs
10879                 eval $hasproto ;;
10880         *)      ;;
10881         esac
10882         case "$d_ctime_r_proto" in
10883         define)
10884         case "$ctime_r_proto" in
10885         ''|0) try='char* ctime_r(const time_t*, char*);'
10886         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10887         esac
10888         case "$ctime_r_proto" in
10889         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10890         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10891         esac
10892         case "$ctime_r_proto" in
10893         ''|0) try='int ctime_r(const time_t*, char*);'
10894         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10895         esac
10896         case "$ctime_r_proto" in
10897         ''|0) try='int ctime_r(const time_t*, char*, int);'
10898         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10899         esac
10900         case "$ctime_r_proto" in
10901         ''|0)   d_ctime_r=undef
10902                 ctime_r_proto=0
10903                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10904         * )     case "$ctime_r_proto" in
10905                 REENTRANT_PROTO*) ;;
10906                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10907                 esac
10908                 echo "Prototype: $try" ;;
10909         esac
10910         ;;
10911         *)      case "$usethreads" in
10912                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10913                 esac
10914                 d_ctime_r=undef
10915                 ctime_r_proto=0
10916                 ;;
10917         esac
10918         ;;
10919 *)      ctime_r_proto=0
10920         ;;
10921 esac
10922
10923 : see if cuserid exists
10924 set cuserid d_cuserid
10925 eval $inlibc
10926
10927 : see if this is a limits.h system
10928 set limits.h i_limits
10929 eval $inhdr
10930
10931 : see if this is a float.h system
10932 set float.h i_float
10933 eval $inhdr
10934
10935 : See if number of significant digits in a double precision number is known
10936 echo " "
10937 $cat >dbl_dig.c <<EOM
10938 #$i_limits I_LIMITS
10939 #$i_float I_FLOAT
10940 #ifdef I_LIMITS
10941 #include <limits.h>
10942 #endif
10943 #ifdef I_FLOAT
10944 #include <float.h>
10945 #endif
10946 #ifdef DBL_DIG
10947 printf("Contains DBL_DIG");
10948 #endif
10949 EOM
10950 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10951 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10952         echo "DBL_DIG found." >&4
10953         val="$define"
10954 else
10955         echo "DBL_DIG NOT found." >&4
10956         val="$undef"
10957 fi
10958 $rm -f dbl_dig.?
10959 set d_dbl_dig
10960 eval $setvar
10961
10962 : see if dbm.h is available
10963 : see if dbmclose exists
10964 set dbmclose d_dbmclose
10965 eval $inlibc
10966
10967 case "$d_dbmclose" in
10968 $define)
10969         set dbm.h i_dbm
10970         eval $inhdr
10971         case "$i_dbm" in
10972         $define)
10973                 val="$undef"
10974                 set i_rpcsvcdbm
10975                 eval $setvar
10976                 ;;
10977         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10978                 eval $inhdr
10979                 ;;
10980         esac
10981         ;;
10982 *)      echo "We won't be including <dbm.h>"
10983         val="$undef"
10984         set i_dbm
10985         eval $setvar
10986         val="$undef"
10987         set i_rpcsvcdbm
10988         eval $setvar
10989         ;;
10990 esac
10991
10992 : see if prototype for dbminit is available
10993 echo " "
10994 set d_dbminitproto dbminit $i_dbm dbm.h
10995 eval $hasproto
10996
10997 : see if difftime exists
10998 set difftime d_difftime
10999 eval $inlibc
11000
11001 : see if this is a dirent system
11002 echo " "
11003 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11004         val="$define"
11005         echo "<dirent.h> found." >&4
11006 else
11007         val="$undef"
11008         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11009                 echo "<sys/dir.h> found." >&4
11010                 echo " "
11011         else
11012                 xinc=`./findhdr sys/ndir.h`
11013         fi
11014         echo "<dirent.h> NOT found." >&4
11015 fi
11016 set i_dirent
11017 eval $setvar
11018
11019 : Look for type of directory structure.
11020 echo " "
11021 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11022
11023 case "$direntrytype" in
11024 ''|' ')
11025         case "$i_dirent" in
11026         $define) guess1='struct dirent' ;;
11027         *) guess1='struct direct'  ;;
11028         esac
11029         ;;
11030 *)      guess1="$direntrytype"
11031         ;;
11032 esac
11033
11034 case "$guess1" in
11035 'struct dirent') guess2='struct direct' ;;
11036 *) guess2='struct dirent' ;;
11037 esac
11038                 
11039 if $contains "$guess1" try.c >/dev/null 2>&1; then
11040         direntrytype="$guess1"
11041         echo "Your directory entries are $direntrytype." >&4
11042 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11043         direntrytype="$guess2"
11044         echo "Your directory entries seem to be $direntrytype." >&4
11045 else
11046         echo "I don't recognize your system's directory entries." >&4
11047         rp="What type is used for directory entries on this system?"
11048         dflt="$guess1"
11049         . ./myread
11050         direntrytype="$ans"
11051 fi
11052 $rm -f try.c
11053
11054
11055 : see if the directory entry stores field length
11056 echo " "
11057 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11058 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11059         echo "Good, your directory entry keeps length information in d_namlen." >&4
11060         val="$define"
11061 else
11062         echo "Your directory entry does not know about the d_namlen field." >&4
11063         val="$undef"
11064 fi
11065 set d_dirnamlen
11066 eval $setvar
11067 $rm -f try.c
11068
11069 : see if this is an sysdir system
11070 set sys/dir.h i_sysdir
11071 eval $inhdr
11072
11073 : see if this is an sysndir system
11074 set sys/ndir.h i_sysndir
11075 eval $inhdr
11076
11077 : Look for dirfd
11078 echo " "
11079 $cat >dirfd.c <<EOM
11080 #include <stdio.h>
11081 #$i_stdlib I_STDLIB
11082 #ifdef I_STDLIB
11083 #include <stdlib.h>
11084 #endif
11085 #$i_dirent I_DIRENT             /**/
11086 #$i_sysdir I_SYS_DIR            /**/
11087 #$i_sysndir I_SYS_NDIR          /**/
11088 #$i_systypes I_SYS_TYPES        /**/
11089 #if defined(I_SYS_TYPES)
11090 #include <sys/types.h>
11091 #endif
11092 #if defined(I_DIRENT)
11093 #include <dirent.h>
11094 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11095 #include <sys/dir.h>
11096 #endif
11097 #else
11098 #ifdef I_SYS_NDIR
11099 #include <sys/ndir.h>
11100 #else
11101 #ifdef I_SYS_DIR
11102 #ifdef hp9000s500
11103 #include <ndir.h>       /* may be wrong in the future */
11104 #else
11105 #include <sys/dir.h>
11106 #endif
11107 #endif
11108 #endif
11109 #endif 
11110 int main() {
11111         DIR *dirp = opendir(".");
11112         if (dirfd(dirp) >= 0)
11113                 exit(0);
11114         else
11115                 exit(1);
11116 }
11117 EOM
11118 val=$undef
11119 set dirfd
11120 if eval $compile; then
11121         val="$define"
11122 fi
11123 case "$val" in
11124 $define)        echo "dirfd() found." >&4       ;;
11125 *)              echo "dirfd() NOT found." >&4   ;;
11126 esac
11127 set d_dirfd
11128 eval $setvar
11129 $rm -f dirfd*
11130
11131 : see if dlerror exists
11132 xxx_runnm="$runnm"
11133 runnm=false
11134 set dlerror d_dlerror
11135 eval $inlibc
11136 runnm="$xxx_runnm"
11137
11138 : see if dlfcn is available
11139 set dlfcn.h i_dlfcn
11140 eval $inhdr
11141
11142 case "$usedl" in
11143 $define|y|true)
11144         $cat << EOM
11145
11146 On a few systems, the dynamically loaded modules that perl generates and uses
11147 will need a different extension than shared libs. The default will probably
11148 be appropriate.
11149
11150 EOM
11151         case "$dlext" in
11152         '')     dflt="$so" ;;
11153         *)      dflt="$dlext" ;;
11154         esac
11155         rp='What is the extension of dynamically loaded modules'
11156         . ./myread
11157         dlext="$ans"
11158         ;;
11159 *)
11160         dlext="none"
11161         ;;
11162 esac
11163
11164 : Check if dlsym need a leading underscore
11165 echo " "
11166 val="$undef"
11167
11168 case "$dlsrc" in
11169 dl_dlopen.xs)
11170         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11171         $cat >dyna.c <<'EOM'
11172 fred () { }
11173 EOM
11174
11175 $cat >fred.c<<EOM
11176
11177 #include <stdio.h>
11178 #$i_stdlib I_STDLIB
11179 #ifdef I_STDLIB
11180 #include <stdlib.h>
11181 #endif
11182 #$i_dlfcn I_DLFCN
11183 #ifdef I_DLFCN
11184 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11185 #else
11186 #include <sys/types.h>
11187 #include <nlist.h>
11188 #include <link.h>
11189 #endif
11190
11191 extern int fred() ;
11192
11193 int main()
11194 {
11195     void * handle ;
11196     void * symbol ;
11197 #ifndef RTLD_LAZY
11198     int mode = 1 ;
11199 #else
11200     int mode = RTLD_LAZY ;
11201 #endif
11202     handle = dlopen("./dyna.$dlext", mode) ;
11203     if (handle == NULL) {
11204         printf ("1\n") ;
11205         fflush (stdout) ;
11206         exit(0);
11207     }
11208     symbol = dlsym(handle, "fred") ;
11209     if (symbol == NULL) {
11210         /* try putting a leading underscore */
11211         symbol = dlsym(handle, "_fred") ;
11212         if (symbol == NULL) {
11213             printf ("2\n") ;
11214             fflush (stdout) ;
11215             exit(0);
11216         }
11217         printf ("3\n") ;
11218     }
11219     else
11220         printf ("4\n") ;
11221     fflush (stdout) ;
11222     exit(0);
11223 }
11224 EOM
11225         : Call the object file tmp-dyna.o in case dlext=o.
11226         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
11227                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
11228                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
11229                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11230                 xxx=`$run ./fred`
11231                 case $xxx in
11232                 1)      echo "Test program failed using dlopen." >&4
11233                         echo "Perhaps you should not use dynamic loading." >&4;;
11234                 2)      echo "Test program failed using dlsym." >&4
11235                         echo "Perhaps you should not use dynamic loading." >&4;;
11236                 3)      echo "dlsym needs a leading underscore" >&4
11237                         val="$define" ;;
11238                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11239                 esac
11240         else
11241                 echo "I can't compile and run the test program." >&4
11242                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11243         fi
11244         ;;
11245 esac
11246                 
11247 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11248
11249 set d_dlsymun
11250 eval $setvar
11251
11252 : see if drand48_r exists
11253 set drand48_r d_drand48_r
11254 eval $inlibc
11255 case "$d_drand48_r" in
11256 "$define")
11257         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11258         case "$d_drand48_r_proto:$usethreads" in
11259         ":define")      d_drand48_r_proto=define
11260                 set d_drand48_r_proto drand48_r $hdrs
11261                 eval $hasproto ;;
11262         *)      ;;
11263         esac
11264         case "$d_drand48_r_proto" in
11265         define)
11266         case "$drand48_r_proto" in
11267         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11268         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11269         esac
11270         case "$drand48_r_proto" in
11271         ''|0)   d_drand48_r=undef
11272                 drand48_r_proto=0
11273                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11274         * )     case "$drand48_r_proto" in
11275                 REENTRANT_PROTO*) ;;
11276                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11277                 esac
11278                 echo "Prototype: $try" ;;
11279         esac
11280         ;;
11281         *)      case "$usethreads" in
11282                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11283                 esac
11284                 d_drand48_r=undef
11285                 drand48_r_proto=0
11286                 ;;
11287         esac
11288         ;;
11289 *)      drand48_r_proto=0
11290         ;;
11291 esac
11292
11293 : see if prototype for drand48 is available
11294 echo " "
11295 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11296 eval $hasproto
11297
11298 : see if dup2 exists
11299 set dup2 d_dup2
11300 eval $inlibc
11301
11302 : see if eaccess exists
11303 set eaccess d_eaccess
11304 eval $inlibc
11305
11306 : see if endgrent exists
11307 set endgrent d_endgrent
11308 eval $inlibc
11309
11310 : see if this is an grp system
11311 set grp.h i_grp
11312 eval $inhdr
11313
11314 case "$i_grp" in
11315 $define)
11316         xxx=`./findhdr grp.h`
11317         $cppstdin $cppflags $cppminus < $xxx >$$.h
11318
11319         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11320                 val="$define"
11321         else
11322                 val="$undef"
11323         fi
11324         set d_grpasswd
11325         eval $setvar
11326
11327         $rm -f $$.h
11328         ;;
11329 *)
11330         val="$undef";
11331         set d_grpasswd; eval $setvar
11332         ;;
11333 esac
11334
11335 : see if endgrent_r exists
11336 set endgrent_r d_endgrent_r
11337 eval $inlibc
11338 case "$d_endgrent_r" in
11339 "$define")
11340         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11341         case "$d_endgrent_r_proto:$usethreads" in
11342         ":define")      d_endgrent_r_proto=define
11343                 set d_endgrent_r_proto endgrent_r $hdrs
11344                 eval $hasproto ;;
11345         *)      ;;
11346         esac
11347         case "$d_endgrent_r_proto" in
11348         define)
11349         case "$endgrent_r_proto" in
11350         ''|0) try='int endgrent_r(FILE**);'
11351         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11352         esac
11353         case "$endgrent_r_proto" in
11354         ''|0) try='void endgrent_r(FILE**);'
11355         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11356         esac
11357         case "$endgrent_r_proto" in
11358         ''|0)   d_endgrent_r=undef
11359                 endgrent_r_proto=0
11360                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11361         * )     case "$endgrent_r_proto" in
11362                 REENTRANT_PROTO*) ;;
11363                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11364                 esac
11365                 echo "Prototype: $try" ;;
11366         esac
11367         ;;
11368         *)      case "$usethreads" in
11369                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11370                 esac
11371                 d_endgrent_r=undef
11372                 endgrent_r_proto=0
11373                 ;;
11374         esac
11375         ;;
11376 *)      endgrent_r_proto=0
11377         ;;
11378 esac
11379
11380 : see if endhostent exists
11381 set endhostent d_endhent
11382 eval $inlibc
11383
11384 : see if this is a netdb.h system
11385 set netdb.h i_netdb
11386 eval $inhdr
11387
11388 : see if endhostent_r exists
11389 set endhostent_r d_endhostent_r
11390 eval $inlibc
11391 case "$d_endhostent_r" in
11392 "$define")
11393         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11394         case "$d_endhostent_r_proto:$usethreads" in
11395         ":define")      d_endhostent_r_proto=define
11396                 set d_endhostent_r_proto endhostent_r $hdrs
11397                 eval $hasproto ;;
11398         *)      ;;
11399         esac
11400         case "$d_endhostent_r_proto" in
11401         define)
11402         case "$endhostent_r_proto" in
11403         ''|0) try='int endhostent_r(struct hostent_data*);'
11404         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11405         esac
11406         case "$endhostent_r_proto" in
11407         ''|0) try='void endhostent_r(struct hostent_data*);'
11408         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11409         esac
11410         case "$endhostent_r_proto" in
11411         ''|0)   d_endhostent_r=undef
11412                 endhostent_r_proto=0
11413                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11414         * )     case "$endhostent_r_proto" in
11415                 REENTRANT_PROTO*) ;;
11416                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11417                 esac
11418                 echo "Prototype: $try" ;;
11419         esac
11420         ;;
11421         *)      case "$usethreads" in
11422                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11423                 esac
11424                 d_endhostent_r=undef
11425                 endhostent_r_proto=0
11426                 ;;
11427         esac
11428         ;;
11429 *)      endhostent_r_proto=0
11430         ;;
11431 esac
11432
11433 : see if endnetent exists
11434 set endnetent d_endnent
11435 eval $inlibc
11436
11437 : see if endnetent_r exists
11438 set endnetent_r d_endnetent_r
11439 eval $inlibc
11440 case "$d_endnetent_r" in
11441 "$define")
11442         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11443         case "$d_endnetent_r_proto:$usethreads" in
11444         ":define")      d_endnetent_r_proto=define
11445                 set d_endnetent_r_proto endnetent_r $hdrs
11446                 eval $hasproto ;;
11447         *)      ;;
11448         esac
11449         case "$d_endnetent_r_proto" in
11450         define)
11451         case "$endnetent_r_proto" in
11452         ''|0) try='int endnetent_r(struct netent_data*);'
11453         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11454         esac
11455         case "$endnetent_r_proto" in
11456         ''|0) try='void endnetent_r(struct netent_data*);'
11457         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11458         esac
11459         case "$endnetent_r_proto" in
11460         ''|0)   d_endnetent_r=undef
11461                 endnetent_r_proto=0
11462                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11463         * )     case "$endnetent_r_proto" in
11464                 REENTRANT_PROTO*) ;;
11465                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11466                 esac
11467                 echo "Prototype: $try" ;;
11468         esac
11469         ;;
11470         *)      case "$usethreads" in
11471                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11472                 esac
11473                 d_endnetent_r=undef
11474                 endnetent_r_proto=0
11475                 ;;
11476         esac
11477         ;;
11478 *)      endnetent_r_proto=0
11479         ;;
11480 esac
11481
11482 : see if endprotoent exists
11483 set endprotoent d_endpent
11484 eval $inlibc
11485
11486 : see if endprotoent_r exists
11487 set endprotoent_r d_endprotoent_r
11488 eval $inlibc
11489 case "$d_endprotoent_r" in
11490 "$define")
11491         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11492         case "$d_endprotoent_r_proto:$usethreads" in
11493         ":define")      d_endprotoent_r_proto=define
11494                 set d_endprotoent_r_proto endprotoent_r $hdrs
11495                 eval $hasproto ;;
11496         *)      ;;
11497         esac
11498         case "$d_endprotoent_r_proto" in
11499         define)
11500         case "$endprotoent_r_proto" in
11501         ''|0) try='int endprotoent_r(struct protoent_data*);'
11502         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11503         esac
11504         case "$endprotoent_r_proto" in
11505         ''|0) try='void endprotoent_r(struct protoent_data*);'
11506         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11507         esac
11508         case "$endprotoent_r_proto" in
11509         ''|0)   d_endprotoent_r=undef
11510                 endprotoent_r_proto=0
11511                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11512         * )     case "$endprotoent_r_proto" in
11513                 REENTRANT_PROTO*) ;;
11514                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11515                 esac
11516                 echo "Prototype: $try" ;;
11517         esac
11518         ;;
11519         *)      case "$usethreads" in
11520                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11521                 esac
11522                 d_endprotoent_r=undef
11523                 endprotoent_r_proto=0
11524                 ;;
11525         esac
11526         ;;
11527 *)      endprotoent_r_proto=0
11528         ;;
11529 esac
11530
11531 : see if endpwent exists
11532 set endpwent d_endpwent
11533 eval $inlibc
11534
11535 : see if this is a pwd.h system
11536 set pwd.h i_pwd
11537 eval $inhdr
11538
11539 case "$i_pwd" in
11540 $define)
11541         xxx=`./findhdr pwd.h`
11542         $cppstdin $cppflags $cppminus < $xxx >$$.h
11543
11544         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11545                 val="$define"
11546         else
11547                 val="$undef"
11548         fi
11549         set d_pwquota
11550         eval $setvar
11551
11552         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11553                 val="$define"
11554         else
11555                 val="$undef"
11556         fi
11557         set d_pwage
11558         eval $setvar
11559
11560         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11561                 val="$define"
11562         else
11563                 val="$undef"
11564         fi
11565         set d_pwchange
11566         eval $setvar
11567
11568         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11569                 val="$define"
11570         else
11571                 val="$undef"
11572         fi
11573         set d_pwclass
11574         eval $setvar
11575
11576         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11577                 val="$define"
11578         else
11579                 val="$undef"
11580         fi
11581         set d_pwexpire
11582         eval $setvar
11583
11584         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11585                 val="$define"
11586         else
11587                 val="$undef"
11588         fi
11589         set d_pwcomment
11590         eval $setvar
11591
11592         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11593                 val="$define"
11594         else
11595                 val="$undef"
11596         fi
11597         set d_pwgecos
11598         eval $setvar
11599
11600         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11601                 val="$define"
11602         else
11603                 val="$undef"
11604         fi
11605         set d_pwpasswd
11606         eval $setvar
11607
11608         $rm -f $$.h
11609         ;;
11610 *)
11611         val="$undef"; 
11612         set d_pwquota; eval $setvar
11613         set d_pwage; eval $setvar
11614         set d_pwchange; eval $setvar
11615         set d_pwclass; eval $setvar
11616         set d_pwexpire; eval $setvar
11617         set d_pwcomment; eval $setvar
11618         set d_pwgecos; eval $setvar
11619         set d_pwpasswd; eval $setvar
11620         ;;
11621 esac
11622
11623 : see if endpwent_r exists
11624 set endpwent_r d_endpwent_r
11625 eval $inlibc
11626 case "$d_endpwent_r" in
11627 "$define")
11628         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11629         case "$d_endpwent_r_proto:$usethreads" in
11630         ":define")      d_endpwent_r_proto=define
11631                 set d_endpwent_r_proto endpwent_r $hdrs
11632                 eval $hasproto ;;
11633         *)      ;;
11634         esac
11635         case "$d_endpwent_r_proto" in
11636         define)
11637         case "$endpwent_r_proto" in
11638         ''|0) try='int endpwent_r(FILE**);'
11639         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11640         esac
11641         case "$endpwent_r_proto" in
11642         ''|0) try='void endpwent_r(FILE**);'
11643         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11644         esac
11645         case "$endpwent_r_proto" in
11646         ''|0)   d_endpwent_r=undef
11647                 endpwent_r_proto=0
11648                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
11649         * )     case "$endpwent_r_proto" in
11650                 REENTRANT_PROTO*) ;;
11651                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11652                 esac
11653                 echo "Prototype: $try" ;;
11654         esac
11655         ;;
11656         *)      case "$usethreads" in
11657                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11658                 esac
11659                 d_endpwent_r=undef
11660                 endpwent_r_proto=0
11661                 ;;
11662         esac
11663         ;;
11664 *)      endpwent_r_proto=0
11665         ;;
11666 esac
11667
11668 : see if endservent exists
11669 set endservent d_endsent
11670 eval $inlibc
11671
11672 : see if endservent_r exists
11673 set endservent_r d_endservent_r
11674 eval $inlibc
11675 case "$d_endservent_r" in
11676 "$define")
11677         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11678         case "$d_endservent_r_proto:$usethreads" in
11679         ":define")      d_endservent_r_proto=define
11680                 set d_endservent_r_proto endservent_r $hdrs
11681                 eval $hasproto ;;
11682         *)      ;;
11683         esac
11684         case "$d_endservent_r_proto" in
11685         define)
11686         case "$endservent_r_proto" in
11687         ''|0) try='int endservent_r(struct servent_data*);'
11688         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
11689         esac
11690         case "$endservent_r_proto" in
11691         ''|0) try='void endservent_r(struct servent_data*);'
11692         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
11693         esac
11694         case "$endservent_r_proto" in
11695         ''|0)   d_endservent_r=undef
11696                 endservent_r_proto=0
11697                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
11698         * )     case "$endservent_r_proto" in
11699                 REENTRANT_PROTO*) ;;
11700                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11701                 esac
11702                 echo "Prototype: $try" ;;
11703         esac
11704         ;;
11705         *)      case "$usethreads" in
11706                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11707                 esac
11708                 d_endservent_r=undef
11709                 endservent_r_proto=0
11710                 ;;
11711         esac
11712         ;;
11713 *)      endservent_r_proto=0
11714         ;;
11715 esac
11716
11717 : Locate the flags for 'open()'
11718 echo " "
11719 $cat >try.c <<EOCP
11720 #include <sys/types.h>
11721 #ifdef I_FCNTL
11722 #include <fcntl.h>
11723 #endif
11724 #ifdef I_SYS_FILE
11725 #include <sys/file.h>
11726 #endif
11727 #$i_stdlib I_STDLIB
11728 #ifdef I_STDLIB
11729 #include <stdlib.h>
11730 #endif
11731 int main() {
11732         if(O_RDONLY);
11733 #ifdef O_TRUNC
11734         exit(0);
11735 #else
11736         exit(1);
11737 #endif
11738 }
11739 EOCP
11740 : check sys/file.h first to get FREAD on Sun
11741 if $test `./findhdr sys/file.h` && \
11742                 set try -DI_SYS_FILE && eval $compile; then
11743         h_sysfile=true;
11744         echo "<sys/file.h> defines the O_* constants..." >&4
11745         if $run ./try; then
11746                 echo "and you have the 3 argument form of open()." >&4
11747                 val="$define"
11748         else
11749                 echo "but not the 3 argument form of open().  Oh, well." >&4
11750                 val="$undef"
11751         fi
11752 elif $test `./findhdr fcntl.h` && \
11753                 set try -DI_FCNTL && eval $compile; then
11754         h_fcntl=true;
11755         echo "<fcntl.h> defines the O_* constants..." >&4
11756         if $run ./try; then
11757                 echo "and you have the 3 argument form of open()." >&4
11758                 val="$define"
11759         else
11760                 echo "but not the 3 argument form of open().  Oh, well." >&4
11761                 val="$undef"
11762         fi
11763 else
11764         val="$undef"
11765         echo "I can't find the O_* constant definitions!  You got problems." >&4
11766 fi
11767 set d_open3
11768 eval $setvar
11769 $rm -f try try.*
11770
11771 : see which of string.h or strings.h is needed
11772 echo " "
11773 strings=`./findhdr string.h`
11774 if $test "$strings" && $test -r "$strings"; then
11775         echo "Using <string.h> instead of <strings.h>." >&4
11776         val="$define"
11777 else
11778         val="$undef"
11779         strings=`./findhdr strings.h`
11780         if $test "$strings" && $test -r "$strings"; then
11781                 echo "Using <strings.h> instead of <string.h>." >&4
11782         else
11783                 echo "No string header found -- You'll surely have problems." >&4
11784         fi
11785 fi
11786 set i_string
11787 eval $setvar
11788 case "$i_string" in
11789 "$undef") strings=`./findhdr strings.h`;;
11790 *)        strings=`./findhdr string.h`;;
11791 esac
11792
11793 : see if this is a sys/file.h system
11794 val=''
11795 set sys/file.h val
11796 eval $inhdr
11797
11798 : do we need to include sys/file.h ?
11799 case "$val" in
11800 "$define")
11801         echo " "
11802         if $h_sysfile; then
11803                 val="$define"
11804                 echo "We'll be including <sys/file.h>." >&4
11805         else
11806                 val="$undef"
11807                 echo "We won't be including <sys/file.h>." >&4
11808         fi
11809         ;;
11810 *)
11811         h_sysfile=false
11812         ;;
11813 esac
11814 set i_sysfile
11815 eval $setvar
11816
11817 : see if fcntl.h is there
11818 val=''
11819 set fcntl.h val
11820 eval $inhdr
11821
11822 : see if we can include fcntl.h
11823 case "$val" in
11824 "$define")
11825         echo " "
11826         if $h_fcntl; then
11827                 val="$define"
11828                 echo "We'll be including <fcntl.h>." >&4
11829         else
11830                 val="$undef"
11831                 if $h_sysfile; then
11832         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11833                 else
11834                         echo "We won't be including <fcntl.h>." >&4
11835                 fi
11836         fi
11837         ;;
11838 *)
11839         h_fcntl=false
11840         val="$undef"
11841         ;;
11842 esac
11843 set i_fcntl
11844 eval $setvar
11845
11846 : check for non-blocking I/O stuff
11847 case "$h_sysfile" in
11848 true) echo "#include <sys/file.h>" > head.c;;
11849 *)
11850        case "$h_fcntl" in
11851        true) echo "#include <fcntl.h>" > head.c;;
11852        *) echo "#include <sys/fcntl.h>" > head.c;;
11853        esac
11854        ;;
11855 esac
11856 echo " "
11857 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11858 case "$o_nonblock" in
11859 '')
11860         $cat head.c > try.c
11861         $cat >>try.c <<EOCP
11862 #include <stdio.h>
11863 #$i_stdlib I_STDLIB
11864 #ifdef I_STDLIB
11865 #include <stdlib.h>
11866 #endif
11867 #$i_fcntl I_FCNTL
11868 #ifdef I_FCNTL
11869 #include <fcntl.h>
11870 #endif
11871 int main() {
11872 #ifdef O_NONBLOCK
11873         printf("O_NONBLOCK\n");
11874         exit(0);
11875 #endif
11876 #ifdef O_NDELAY
11877         printf("O_NDELAY\n");
11878         exit(0);
11879 #endif
11880 #ifdef FNDELAY
11881         printf("FNDELAY\n");
11882         exit(0);
11883 #endif
11884         exit(0);
11885 }
11886 EOCP
11887         set try
11888         if eval $compile_ok; then
11889                 o_nonblock=`$run ./try`
11890                 case "$o_nonblock" in
11891                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11892                 *) echo "Seems like we can use $o_nonblock.";;
11893                 esac
11894         else
11895                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11896         fi
11897         ;;
11898 *) echo "Using $hint value $o_nonblock.";;
11899 esac
11900 $rm -f try try.* .out core
11901
11902 echo " "
11903 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11904 case "$eagain" in
11905 '')
11906         $cat head.c > try.c
11907         $cat >>try.c <<EOCP
11908 #include <errno.h>
11909 #include <sys/types.h>
11910 #include <signal.h>
11911 #include <stdio.h> 
11912 #$i_stdlib I_STDLIB
11913 #ifdef I_STDLIB
11914 #include <stdlib.h>
11915 #endif
11916 #$i_fcntl I_FCNTL
11917 #ifdef I_FCNTL
11918 #include <fcntl.h>
11919 #endif
11920 #define MY_O_NONBLOCK $o_nonblock
11921 #ifndef errno  /* XXX need better Configure test */
11922 extern int errno;
11923 #endif
11924 #$i_unistd I_UNISTD
11925 #ifdef I_UNISTD
11926 #include <unistd.h>
11927 #endif
11928 #$i_string I_STRING
11929 #ifdef I_STRING
11930 #include <string.h>
11931 #else
11932 #include <strings.h>
11933 #endif
11934 $signal_t blech(x) int x; { exit(3); }
11935 EOCP
11936         $cat >> try.c <<'EOCP'
11937 int main()
11938 {
11939         int pd[2];
11940         int pu[2];
11941         char buf[1];
11942         char string[100];
11943
11944         pipe(pd);       /* Down: child -> parent */
11945         pipe(pu);       /* Up: parent -> child */
11946         if (0 != fork()) {
11947                 int ret;
11948                 close(pd[1]);   /* Parent reads from pd[0] */
11949                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11950 #ifdef F_SETFL
11951                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11952                         exit(1);
11953 #else
11954                 exit(4);
11955 #endif
11956                 signal(SIGALRM, blech);
11957                 alarm(5);
11958                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11959                         exit(2);
11960                 sprintf(string, "%d\n", ret);
11961                 write(2, string, strlen(string));
11962                 alarm(0);
11963 #ifdef EAGAIN
11964                 if (errno == EAGAIN) {
11965                         printf("EAGAIN\n");
11966                         goto ok;
11967                 }
11968 #endif
11969 #ifdef EWOULDBLOCK
11970                 if (errno == EWOULDBLOCK)
11971                         printf("EWOULDBLOCK\n");
11972 #endif
11973         ok:
11974                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11975                 sleep(2);                               /* Give it time to close our pipe */
11976                 alarm(5);
11977                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11978                 alarm(0);
11979                 sprintf(string, "%d\n", ret);
11980                 write(4, string, strlen(string));
11981                 exit(0);
11982         }
11983
11984         close(pd[0]);                   /* We write to pd[1] */
11985         close(pu[1]);                   /* We read from pu[0] */
11986         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11987         close(pd[1]);                   /* Pipe pd is now fully closed! */
11988         exit(0);                                /* Bye bye, thank you for playing! */
11989 }
11990 EOCP
11991         set try
11992         if eval $compile_ok; then
11993                 echo "$startsh" >mtry
11994                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11995                 chmod +x mtry
11996                 ./mtry >/dev/null 2>&1
11997                 case $? in
11998                 0) eagain=`$cat try.out`;;
11999                 1) echo "Could not perform non-blocking setting!";;
12000                 2) echo "I did a successful read() for something that was not there!";;
12001                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12002                 4) echo "Could not find F_SETFL!";;
12003                 *) echo "Something terribly wrong happened during testing.";;
12004                 esac
12005                 rd_nodata=`$cat try.ret`
12006                 echo "A read() system call with no data present returns $rd_nodata."
12007                 case "$rd_nodata" in
12008                 0|-1) ;;
12009                 *)
12010                         echo "(That's peculiar, fixing that to be -1.)"
12011                         rd_nodata=-1
12012                         ;;
12013                 esac
12014                 case "$eagain" in
12015                 '')
12016                         echo "Forcing errno EAGAIN on read() with no data available."
12017                         eagain=EAGAIN
12018                         ;;
12019                 *)
12020                         echo "Your read() sets errno to $eagain when no data is available."
12021                         ;;
12022                 esac
12023                 status=`$cat try.err`
12024                 case "$status" in
12025                 0) echo "And it correctly returns 0 to signal EOF.";;
12026                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12027                 *) echo "However, your read() returns '$status' on EOF??";;
12028                 esac
12029                 val="$define"
12030                 if test "$status" = "$rd_nodata"; then
12031                         echo "WARNING: you can't distinguish between EOF and no data!"
12032                         val="$undef"
12033                 fi
12034         else
12035                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12036                 eagain=EAGAIN
12037         fi
12038         set d_eofnblk
12039         eval $setvar
12040         ;;
12041 *)
12042         echo "Using $hint value $eagain."
12043         echo "Your read() returns $rd_nodata when no data is present."
12044         case "$d_eofnblk" in
12045         "$define") echo "And you can see EOF because read() returns 0.";;
12046         "$undef") echo "But you can't see EOF status from read() returned value.";;
12047         *)
12048                 echo "(Assuming you can't see EOF status from read anyway.)"
12049                 d_eofnblk=$undef
12050                 ;;
12051         esac
12052         ;;
12053 esac
12054 $rm -f try try.* .out core head.c mtry
12055
12056 : see if _ptr and _cnt from stdio act std
12057 echo " "
12058
12059 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12060         echo "(Looks like you have stdio.h from BSD.)"
12061         case "$stdio_ptr" in
12062         '') stdio_ptr='((fp)->_p)'
12063                 ptr_lval=$define
12064                 ;;
12065         *)      ptr_lval=$d_stdio_ptr_lval;;
12066         esac
12067         case "$stdio_cnt" in
12068         '') stdio_cnt='((fp)->_r)'
12069                 cnt_lval=$define
12070                 ;;
12071         *)      cnt_lval=$d_stdio_cnt_lval;;
12072         esac
12073         case "$stdio_base" in
12074         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12075         esac
12076         case "$stdio_bufsiz" in
12077         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12078         esac
12079 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12080         echo "(Looks like you have stdio.h from Linux.)"
12081         case "$stdio_ptr" in
12082         '') stdio_ptr='((fp)->_IO_read_ptr)'
12083                 ptr_lval=$define
12084                 ;;
12085         *)      ptr_lval=$d_stdio_ptr_lval;;
12086         esac
12087         case "$stdio_cnt" in
12088         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12089                 cnt_lval=$undef
12090                 ;;
12091         *)      cnt_lval=$d_stdio_cnt_lval;;
12092         esac
12093         case "$stdio_base" in
12094         '') stdio_base='((fp)->_IO_read_base)';;
12095         esac
12096         case "$stdio_bufsiz" in
12097         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12098         esac
12099 else
12100         case "$stdio_ptr" in
12101         '') stdio_ptr='((fp)->_ptr)'
12102                 ptr_lval=$define
12103                 ;;
12104         *)      ptr_lval=$d_stdio_ptr_lval;;
12105         esac
12106         case "$stdio_cnt" in
12107         '') stdio_cnt='((fp)->_cnt)'
12108                 cnt_lval=$define
12109                 ;;
12110         *)      cnt_lval=$d_stdio_cnt_lval;;
12111         esac
12112         case "$stdio_base" in
12113         '') stdio_base='((fp)->_base)';;
12114         esac
12115         case "$stdio_bufsiz" in
12116         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12117         esac
12118 fi
12119
12120 : test whether _ptr and _cnt really work
12121 echo "Checking how std your stdio is..." >&4
12122 $cat >try.c <<EOP
12123 #include <stdio.h>
12124 #$i_stdlib I_STDLIB
12125 #ifdef I_STDLIB
12126 #include <stdlib.h>
12127 #endif
12128 #define FILE_ptr(fp)    $stdio_ptr
12129 #define FILE_cnt(fp)    $stdio_cnt
12130 int main() {
12131         FILE *fp = fopen("try.c", "r");
12132         char c = getc(fp);
12133         if (
12134                 18 <= FILE_cnt(fp) &&
12135                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12136         )
12137                 exit(0);
12138         exit(1);
12139 }
12140 EOP
12141 val="$undef"
12142 set try
12143 if eval $compile && $to try.c; then
12144         if $run ./try; then
12145                 echo "Your stdio acts pretty std."
12146                 val="$define"
12147         else
12148                 echo "Your stdio isn't very std."
12149         fi
12150 else
12151         echo "Your stdio doesn't appear very std."
12152 fi
12153 $rm -f try.c try
12154
12155 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12156 # direct buffer manipulation no longer works.  The Configure tests
12157 # should be changed to correctly detect this, but until then,
12158 # the following check should at least let perl compile and run.
12159 # (This quick fix should be updated before 5.8.1.)
12160 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12161 # A. Dougherty, June 3, 2002.
12162 case "$d_gnulibc" in
12163 $define)
12164         case "$gnulibc_version" in
12165         2.[01]*)  ;;
12166         2.2) ;;
12167         2.2.[0-9]) ;;
12168         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12169                 val="$undef"
12170                 ;;
12171         esac
12172         ;;
12173 esac
12174 set d_stdstdio
12175 eval $setvar
12176
12177 : Can _ptr be used as an lvalue?
12178 case "$d_stdstdio$ptr_lval" in
12179 $define$define) val=$define ;;
12180 *) val=$undef ;;
12181 esac
12182 set d_stdio_ptr_lval
12183 eval $setvar
12184
12185 : Can _cnt be used as an lvalue?
12186 case "$d_stdstdio$cnt_lval" in
12187 $define$define) val=$define ;;
12188 *) val=$undef ;;
12189 esac
12190 set d_stdio_cnt_lval
12191 eval $setvar
12192
12193
12194 : test whether setting _ptr sets _cnt as a side effect
12195 d_stdio_ptr_lval_sets_cnt="$undef"
12196 d_stdio_ptr_lval_nochange_cnt="$undef"
12197 case "$d_stdio_ptr_lval$d_stdstdio" in
12198 $define$define)
12199         echo "Checking to see what happens if we set the stdio ptr..." >&4
12200 $cat >try.c <<EOP
12201 #include <stdio.h>
12202 /* Can we scream? */
12203 /* Eat dust sed :-) */
12204 /* In the buffer space, no one can hear you scream. */
12205 #$i_stdlib I_STDLIB
12206 #ifdef I_STDLIB
12207 #include <stdlib.h>
12208 #endif
12209 #define FILE_ptr(fp)    $stdio_ptr
12210 #define FILE_cnt(fp)    $stdio_cnt
12211 #include <sys/types.h>
12212 int main() {
12213         FILE *fp = fopen("try.c", "r");
12214         int c;
12215         char *ptr;
12216         size_t cnt;
12217         if (!fp) {
12218             puts("Fail even to read");
12219             exit(1);
12220         }
12221         c = getc(fp); /* Read away the first # */
12222         if (c == EOF) {
12223             puts("Fail even to read");
12224             exit(1);
12225         }
12226         if (!(
12227                 18 <= FILE_cnt(fp) &&
12228                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12229         )) {
12230                 puts("Fail even to read");
12231                 exit (1);
12232         }
12233         ptr = (char*) FILE_ptr(fp);
12234         cnt = (size_t)FILE_cnt(fp);
12235
12236         FILE_ptr(fp) += 42;
12237
12238         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12239                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12240                 exit (1);
12241         }
12242         if (FILE_cnt(fp) <= 20) {
12243                 printf ("Fail (<20 chars to test)");
12244                 exit (1);
12245         }
12246         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12247                 puts("Fail compare");
12248                 exit (1);
12249         }
12250         if (cnt == FILE_cnt(fp)) {
12251                 puts("Pass_unchanged");
12252                 exit (0);
12253         }       
12254         if (FILE_cnt(fp) == (cnt - 42)) {
12255                 puts("Pass_changed");
12256                 exit (0);
12257         }
12258         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12259         return 1;
12260
12261 }
12262 EOP
12263         set try
12264         if eval $compile && $to try.c; then
12265                 case `$run ./try` in
12266                 Pass_changed)
12267                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12268                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12269                 Pass_unchanged)
12270                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12271                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12272                 Fail*)
12273                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12274                 *)
12275                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12276         esac
12277         else
12278                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12279         fi
12280         $rm -f try.c try
12281         ;;
12282 esac
12283
12284 : see if _base is also standard
12285 val="$undef"
12286 case "$d_stdstdio" in
12287 $define)
12288         $cat >try.c <<EOP
12289 #include <stdio.h>
12290 #$i_stdlib I_STDLIB
12291 #ifdef I_STDLIB
12292 #include <stdlib.h>
12293 #endif
12294 #define FILE_base(fp)   $stdio_base
12295 #define FILE_bufsiz(fp) $stdio_bufsiz
12296 int main() {
12297         FILE *fp = fopen("try.c", "r");
12298         char c = getc(fp);
12299         if (
12300                 19 <= FILE_bufsiz(fp) &&
12301                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12302         )
12303                 exit(0);
12304         exit(1);
12305 }
12306 EOP
12307         set try
12308         if eval $compile && $to try.c; then
12309                 if $run ./try; then
12310                         echo "And its _base field acts std."
12311                         val="$define"
12312                 else
12313                         echo "But its _base field isn't std."
12314                 fi
12315         else
12316                 echo "However, it seems to be lacking the _base field."
12317         fi
12318         $rm -f try.c try
12319         ;;
12320 esac
12321 set d_stdiobase
12322 eval $setvar
12323
12324 : see if fast_stdio exists
12325 val="$undef"
12326 case "$d_stdstdio:$d_stdio_ptr_lval" in
12327 "$define:$define")
12328         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12329         *$define*)
12330                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12331                 val="$define"
12332                 ;;
12333         esac
12334         ;;
12335 esac
12336 set d_faststdio
12337 eval $setvar
12338
12339
12340
12341 : see if fchdir exists
12342 set fchdir d_fchdir
12343 eval $inlibc
12344
12345 : see if fchmod exists
12346 set fchmod d_fchmod
12347 eval $inlibc
12348
12349 : see if fchown exists
12350 set fchown d_fchown
12351 eval $inlibc
12352
12353 : see if this is an fcntl system
12354 set fcntl d_fcntl
12355 eval $inlibc
12356
12357 echo " "
12358 : See if fcntl-based locking works.
12359 $cat >try.c <<EOCP
12360 #$i_stdlib I_STDLIB
12361 #ifdef I_STDLIB
12362 #include <stdlib.h>
12363 #endif
12364 #include <unistd.h>
12365 #include <fcntl.h>
12366 #include <signal.h>
12367 $signal_t blech(x) int x; { exit(3); }
12368 int main() {
12369 #if defined(F_SETLK) && defined(F_SETLKW)
12370      struct flock flock;
12371      int retval, fd;
12372      fd = open("try.c", O_RDONLY);
12373      flock.l_type = F_RDLCK;
12374      flock.l_whence = SEEK_SET;
12375      flock.l_start = flock.l_len = 0;
12376      signal(SIGALRM, blech);
12377      alarm(10);
12378      retval = fcntl(fd, F_SETLK, &flock);
12379      close(fd);
12380      (retval < 0 ? exit(2) : exit(0));
12381 #else
12382      exit(2);
12383 #endif
12384 }
12385 EOCP
12386 echo "Checking if fcntl-based file locking works... "
12387 case "$d_fcntl" in
12388 "$define")
12389         set try
12390         if eval $compile_ok; then
12391                 if $run ./try; then
12392                         echo "Yes, it seems to work."
12393                         val="$define"
12394                 else
12395                         echo "Nope, it didn't work."
12396                         val="$undef"
12397                         case "$?" in
12398                         3) $cat >&4 <<EOM
12399 ***
12400 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12401 *** This is (almost) impossible.
12402 *** If your NFS lock daemons are not feeling well, something like
12403 *** this may happen, please investigate.  Cannot continue, aborting.
12404 ***
12405 EOM
12406                                 exit 1
12407                                 ;;
12408                         esac
12409                 fi
12410         else
12411                 echo "I'm unable to compile the test program, so I'll assume not."
12412                 val="$undef"
12413         fi
12414         ;;
12415 *) val="$undef";
12416         echo "Nope, since you don't even have fcntl()."
12417         ;;
12418 esac
12419 set d_fcntl_can_lock
12420 eval $setvar
12421 $rm -f try*
12422
12423
12424 : check for fd_set items
12425 $cat <<EOM
12426
12427 Checking to see how well your C compiler handles fd_set and friends ...
12428 EOM
12429 $cat >try.c <<EOCP
12430 #$i_stdlib I_STDLIB
12431 #ifdef I_STDLIB
12432 #include <stdlib.h>
12433 #endif
12434 #$i_systime I_SYS_TIME
12435 #$i_sysselct I_SYS_SELECT
12436 #$d_socket HAS_SOCKET
12437 #include <sys/types.h>
12438 #ifdef HAS_SOCKET
12439 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12440 #endif
12441 #ifdef I_SYS_TIME
12442 #include <sys/time.h>
12443 #endif
12444 #ifdef I_SYS_SELECT
12445 #include <sys/select.h>
12446 #endif
12447 int main() {
12448         fd_set fds;
12449
12450 #ifdef TRYBITS
12451         if(fds.fds_bits);
12452 #endif
12453
12454 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12455         exit(0);
12456 #else
12457         exit(1);
12458 #endif
12459 }
12460 EOCP
12461 set try -DTRYBITS
12462 if eval $compile; then
12463         d_fds_bits="$define"
12464         d_fd_set="$define"
12465         echo "Well, your system knows about the normal fd_set typedef..." >&4
12466         if $run ./try; then
12467                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12468                 d_fd_macros="$define"
12469         else
12470                 $cat >&4 <<'EOM'
12471 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12472 EOM
12473                 d_fd_macros="$undef"
12474         fi
12475 else
12476         $cat <<'EOM'
12477 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12478 EOM
12479         set try
12480         if eval $compile; then
12481                 d_fds_bits="$undef"
12482                 d_fd_set="$define"
12483                 echo "Well, your system has some sort of fd_set available..." >&4
12484                 if $run ./try; then
12485                         echo "and you have the normal fd_set macros." >&4
12486                         d_fd_macros="$define"
12487                 else
12488                         $cat <<'EOM'
12489 but not the normal fd_set macros!  Gross!  More work for me...
12490 EOM
12491                         d_fd_macros="$undef"
12492                 fi
12493         else
12494         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
12495                 d_fd_set="$undef"
12496                 d_fds_bits="$undef"
12497                 d_fd_macros="$undef"
12498         fi
12499 fi
12500 $rm -f try try.*
12501
12502 : see if fgetpos exists
12503 set fgetpos d_fgetpos
12504 eval $inlibc
12505
12506 : see if finite exists
12507 set finite d_finite
12508 eval $inlibc
12509
12510 : see if finitel exists
12511 set finitel d_finitel
12512 eval $inlibc
12513
12514 : see if flock exists
12515 set flock d_flock
12516 eval $inlibc
12517
12518 : see if prototype for flock is available
12519 echo " "
12520 set d_flockproto flock $i_sysfile sys/file.h
12521 eval $hasproto
12522
12523 : see if fork exists
12524 set fork d_fork
12525 eval $inlibc
12526
12527 : see if fp_class exists
12528 set fp_class d_fp_class
12529 eval $inlibc
12530
12531 : see if pathconf exists
12532 set pathconf d_pathconf
12533 eval $inlibc
12534
12535 : see if fpathconf exists
12536 set fpathconf d_fpathconf
12537 eval $inlibc
12538
12539 : see if fpclass exists
12540 set fpclass d_fpclass
12541 eval $inlibc
12542
12543 : see if fpclassify exists
12544 set fpclassify d_fpclassify
12545 eval $inlibc
12546
12547 : see if fpclassl exists
12548 set fpclassl d_fpclassl
12549 eval $inlibc
12550
12551
12552 : check for fpos64_t
12553 echo " "
12554 echo "Checking to see if you have fpos64_t..." >&4
12555 $cat >try.c <<EOCP
12556 #include <stdio.h>
12557 int main() { fpos64_t x = 7; }
12558 EOCP
12559 set try
12560 if eval $compile; then
12561         val="$define"
12562         echo "You have fpos64_t."
12563 else
12564         val="$undef"
12565         echo "You do not have fpos64_t."
12566         case "$fpossize" in
12567         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12568         esac
12569 fi
12570 $rm -f try.* try
12571 set d_fpos64_t
12572 eval $setvar
12573
12574 : see if frexpl exists
12575 set frexpl d_frexpl
12576 eval $inlibc
12577
12578 : see if this is a sys/param system
12579 set sys/param.h i_sysparam
12580 eval $inhdr
12581
12582 : see if this is a sys/mount.h system
12583 set sys/mount.h i_sysmount
12584 eval $inhdr
12585
12586
12587 echo " "
12588 echo "Checking to see if your system supports struct fs_data..." >&4
12589 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12590 eval $hasstruct
12591 case "$d_fs_data_s" in
12592 "$define")      echo "Yes, it does."   ;;
12593 *)              echo "No, it doesn't." ;;
12594 esac
12595
12596 : see if fseeko exists
12597 set fseeko d_fseeko
12598 eval $inlibc
12599 case "$longsize" in
12600 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12601 esac
12602
12603 : see if fsetpos exists
12604 set fsetpos d_fsetpos
12605 eval $inlibc
12606
12607
12608 : see if fstatfs exists
12609 set fstatfs d_fstatfs
12610 eval $inlibc
12611
12612
12613 : see if statvfs exists
12614 set statvfs d_statvfs
12615 eval $inlibc
12616
12617 : see if fstatvfs exists
12618 set fstatvfs d_fstatvfs
12619 eval $inlibc
12620
12621
12622 : see if fsync exists
12623 set fsync d_fsync
12624 eval $inlibc
12625
12626 : see if ftello exists
12627 set ftello d_ftello
12628 eval $inlibc
12629 case "$longsize" in
12630 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12631 esac
12632
12633 d_futimes="$undef"
12634 : check for a working futimes
12635 echo " "
12636 echo "Checking for a working futimes()" >&4
12637 $cat >try.c <<EOCP
12638 #include <stdio.h>
12639 #include <sys/time.h>
12640 #include <errno.h>
12641 #include <fcntl.h>
12642
12643 int main ()
12644 {
12645     int fd, rv;
12646     fd = open ("try.c", O_RDWR);
12647     if (-1 == fd) exit (1);
12648     rv = futimes (fd, NULL);
12649     exit (rv == -1 ? errno : 0);
12650 }
12651 EOCP
12652 set try
12653 if eval $compile; then
12654     `$run ./try`
12655     rc=$?
12656     case "$rc" in
12657         0)  echo "Yes, it does" >&4
12658             d_futimes="$define"
12659             ;;
12660         *)  echo "No, it has futimes, but it isn't working ($rc) (probably harmless)\n" >&4
12661             ;;
12662     esac
12663 else
12664     echo "No, it does not (probably harmless)\n" >&4
12665 fi
12666 $rm -f try.* try core core.try.*
12667
12668 : see if getcwd exists
12669 set getcwd d_getcwd
12670 eval $inlibc
12671
12672 : see if getespwnam exists
12673 set getespwnam d_getespwnam
12674 eval $inlibc
12675
12676
12677 : see if getfsstat exists
12678 set getfsstat d_getfsstat
12679 eval $inlibc
12680
12681 : see if getgrent exists
12682 set getgrent d_getgrent
12683 eval $inlibc
12684
12685 : see if getgrent_r exists
12686 set getgrent_r d_getgrent_r
12687 eval $inlibc
12688 case "$d_getgrent_r" in
12689 "$define")
12690         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12691         case "$d_getgrent_r_proto:$usethreads" in
12692         ":define")      d_getgrent_r_proto=define
12693                 set d_getgrent_r_proto getgrent_r $hdrs
12694                 eval $hasproto ;;
12695         *)      ;;
12696         esac
12697         case "$d_getgrent_r_proto" in
12698         define)
12699         case "$getgrent_r_proto" in
12700         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
12701         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
12702         esac
12703         case "$getgrent_r_proto" in
12704         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
12705         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
12706         esac
12707         case "$getgrent_r_proto" in
12708         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12709         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12710         esac
12711         case "$getgrent_r_proto" in
12712         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12713         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12714         esac
12715         case "$getgrent_r_proto" in
12716         ''|0) try='int getgrent_r(struct group*, char*, int);'
12717         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12718         esac
12719         case "$getgrent_r_proto" in
12720         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12721         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12722         esac
12723         case "$getgrent_r_proto" in
12724         ''|0)   d_getgrent_r=undef
12725                 getgrent_r_proto=0
12726                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
12727         * )     case "$getgrent_r_proto" in
12728                 REENTRANT_PROTO*) ;;
12729                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12730                 esac
12731                 echo "Prototype: $try" ;;
12732         esac
12733         ;;
12734         *)      case "$usethreads" in
12735                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12736                 esac
12737                 d_getgrent_r=undef
12738                 getgrent_r_proto=0
12739                 ;;
12740         esac
12741         ;;
12742 *)      getgrent_r_proto=0
12743         ;;
12744 esac
12745
12746 : see if getgrgid_r exists
12747 set getgrgid_r d_getgrgid_r
12748 eval $inlibc
12749 case "$d_getgrgid_r" in
12750 "$define")
12751         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12752         case "$d_getgrgid_r_proto:$usethreads" in
12753         ":define")      d_getgrgid_r_proto=define
12754                 set d_getgrgid_r_proto getgrgid_r $hdrs
12755                 eval $hasproto ;;
12756         *)      ;;
12757         esac
12758         case "$d_getgrgid_r_proto" in
12759         define)
12760         case "$getgrgid_r_proto" in
12761         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12762         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12763         esac
12764         case "$getgrgid_r_proto" in
12765         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12766         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12767         esac
12768         case "$getgrgid_r_proto" in
12769         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12770         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12771         esac
12772         case "$getgrgid_r_proto" in
12773         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12774         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12775         esac
12776         case "$getgrgid_r_proto" in
12777         ''|0)   d_getgrgid_r=undef
12778                 getgrgid_r_proto=0
12779                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
12780         * )     case "$getgrgid_r_proto" in
12781                 REENTRANT_PROTO*) ;;
12782                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12783                 esac
12784                 echo "Prototype: $try" ;;
12785         esac
12786         ;;
12787         *)      case "$usethreads" in
12788                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12789                 esac
12790                 d_getgrgid_r=undef
12791                 getgrgid_r_proto=0
12792                 ;;
12793         esac
12794         ;;
12795 *)      getgrgid_r_proto=0
12796         ;;
12797 esac
12798
12799 : see if getgrnam_r exists
12800 set getgrnam_r d_getgrnam_r
12801 eval $inlibc
12802 case "$d_getgrnam_r" in
12803 "$define")
12804         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12805         case "$d_getgrnam_r_proto:$usethreads" in
12806         ":define")      d_getgrnam_r_proto=define
12807                 set d_getgrnam_r_proto getgrnam_r $hdrs
12808                 eval $hasproto ;;
12809         *)      ;;
12810         esac
12811         case "$d_getgrnam_r_proto" in
12812         define)
12813         case "$getgrnam_r_proto" in
12814         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12815         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12816         esac
12817         case "$getgrnam_r_proto" in
12818         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12819         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12820         esac
12821         case "$getgrnam_r_proto" in
12822         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12823         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12824         esac
12825         case "$getgrnam_r_proto" in
12826         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
12827         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
12828         esac
12829         case "$getgrnam_r_proto" in
12830         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
12831         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
12832         esac
12833         case "$getgrnam_r_proto" in
12834         ''|0)   d_getgrnam_r=undef
12835                 getgrnam_r_proto=0
12836                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
12837         * )     case "$getgrnam_r_proto" in
12838                 REENTRANT_PROTO*) ;;
12839                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
12840                 esac
12841                 echo "Prototype: $try" ;;
12842         esac
12843         ;;
12844         *)      case "$usethreads" in
12845                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
12846                 esac
12847                 d_getgrnam_r=undef
12848                 getgrnam_r_proto=0
12849                 ;;
12850         esac
12851         ;;
12852 *)      getgrnam_r_proto=0
12853         ;;
12854 esac
12855
12856 : see if gethostbyaddr exists
12857 set gethostbyaddr d_gethbyaddr
12858 eval $inlibc
12859
12860 : see if gethostbyname exists
12861 set gethostbyname d_gethbyname
12862 eval $inlibc
12863
12864 : see if gethostent exists
12865 set gethostent d_gethent
12866 eval $inlibc
12867
12868 : see how we will look up host name
12869 echo " "
12870 call=''
12871 if set gethostname val -f d_gethname; eval $csym; $val; then
12872         echo 'gethostname() found.' >&4
12873         d_gethname="$define"
12874         call=gethostname
12875 fi
12876 if set uname val -f d_uname; eval $csym; $val; then
12877         if ./xenix; then
12878                 $cat <<'EOM'
12879 uname() was found, but you're running xenix, and older versions of xenix
12880 have a broken uname(). If you don't really know whether your xenix is old
12881 enough to have a broken system call, use the default answer.
12882
12883 EOM
12884                 dflt=y
12885                 case "$d_uname" in
12886                 "$define") dflt=n;;
12887                 esac
12888                 rp='Is your uname() broken?'
12889                 . ./myread
12890                 case "$ans" in
12891                 n*) d_uname="$define"; call=uname;;
12892                 esac
12893         else
12894                 echo 'uname() found.' >&4
12895                 d_uname="$define"
12896                 case "$call" in
12897                 '') call=uname ;;
12898                 esac
12899         fi
12900 fi
12901 case "$d_gethname" in
12902 '') d_gethname="$undef";;
12903 esac
12904 case "$d_uname" in
12905 '') d_uname="$undef";;
12906 esac
12907 case "$d_uname$d_gethname" in
12908 *define*)
12909         dflt=n
12910         cat <<EOM
12911  
12912 Every now and then someone has a $call() that lies about the hostname
12913 but can't be fixed for political or economic reasons.  If you wish, I can
12914 pretend $call() isn't there and maybe compute hostname at run-time
12915 thanks to the '$phostname' command.
12916
12917 EOM
12918         rp="Shall I ignore $call() from now on?"
12919         . ./myread
12920         case "$ans" in
12921         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
12922         esac;;
12923 esac
12924 case "$phostname" in
12925 '') aphostname='';;
12926 *) case "$aphostname" in
12927         /*) ;;
12928         *) set X $phostname
12929                 shift
12930                 file=$1
12931                 shift
12932                 file=`./loc $file $file $pth`
12933                 aphostname=`echo $file $*`
12934                 ;;
12935         esac
12936         ;;
12937 esac
12938 case "$d_uname$d_gethname" in
12939 *define*) ;;
12940 *)
12941         case "$phostname" in
12942         '')
12943                 echo "There will be no way for $package to get your hostname." >&4;;
12944         *)
12945         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
12946                 ;;
12947         esac;;
12948 esac
12949 case "$d_phostname" in
12950 '') d_phostname="$undef";;
12951 esac
12952
12953 : see if gethostbyaddr_r exists
12954 set gethostbyaddr_r d_gethostbyaddr_r
12955 eval $inlibc
12956 case "$d_gethostbyaddr_r" in
12957 "$define")
12958         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12959         case "$d_gethostbyaddr_r_proto:$usethreads" in
12960         ":define")      d_gethostbyaddr_r_proto=define
12961                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
12962                 eval $hasproto ;;
12963         *)      ;;
12964         esac
12965         case "$d_gethostbyaddr_r_proto" in
12966         define)
12967         case "$gethostbyaddr_r_proto" in
12968         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12969         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
12970         esac
12971         case "$gethostbyaddr_r_proto" in
12972         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
12973         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
12974         esac
12975         case "$gethostbyaddr_r_proto" in
12976         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
12977         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
12978         esac
12979         case "$gethostbyaddr_r_proto" in
12980         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
12981         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
12982         esac
12983         case "$gethostbyaddr_r_proto" in
12984         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
12985         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
12986         esac
12987         case "$gethostbyaddr_r_proto" in
12988         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
12989         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
12990         esac
12991         case "$gethostbyaddr_r_proto" in
12992         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
12993         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
12994         esac
12995         case "$gethostbyaddr_r_proto" in
12996         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
12997         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
12998         esac
12999         case "$gethostbyaddr_r_proto" in
13000         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13001         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13002         esac
13003         case "$gethostbyaddr_r_proto" in
13004         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13005         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13006         esac
13007         case "$gethostbyaddr_r_proto" in
13008         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13009         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13010         esac
13011         case "$gethostbyaddr_r_proto" in
13012         ''|0)   d_gethostbyaddr_r=undef
13013                 gethostbyaddr_r_proto=0
13014                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13015         * )     case "$gethostbyaddr_r_proto" in
13016                 REENTRANT_PROTO*) ;;
13017                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13018                 esac
13019                 echo "Prototype: $try" ;;
13020         esac
13021         ;;
13022         *)      case "$usethreads" in
13023                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13024                 esac
13025                 d_gethostbyaddr_r=undef
13026                 gethostbyaddr_r_proto=0
13027                 ;;
13028         esac
13029         ;;
13030 *)      gethostbyaddr_r_proto=0
13031         ;;
13032 esac
13033
13034 : see if gethostbyname_r exists
13035 set gethostbyname_r d_gethostbyname_r
13036 eval $inlibc
13037 case "$d_gethostbyname_r" in
13038 "$define")
13039         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13040         case "$d_gethostbyname_r_proto:$usethreads" in
13041         ":define")      d_gethostbyname_r_proto=define
13042                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13043                 eval $hasproto ;;
13044         *)      ;;
13045         esac
13046         case "$d_gethostbyname_r_proto" in
13047         define)
13048         case "$gethostbyname_r_proto" in
13049         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13050         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13051         esac
13052         case "$gethostbyname_r_proto" in
13053         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13054         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13055         esac
13056         case "$gethostbyname_r_proto" in
13057         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13058         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13059         esac
13060         case "$gethostbyname_r_proto" in
13061         ''|0)   d_gethostbyname_r=undef
13062                 gethostbyname_r_proto=0
13063                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13064         * )     case "$gethostbyname_r_proto" in
13065                 REENTRANT_PROTO*) ;;
13066                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13067                 esac
13068                 echo "Prototype: $try" ;;
13069         esac
13070         ;;
13071         *)      case "$usethreads" in
13072                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13073                 esac
13074                 d_gethostbyname_r=undef
13075                 gethostbyname_r_proto=0
13076                 ;;
13077         esac
13078         ;;
13079 *)      gethostbyname_r_proto=0
13080         ;;
13081 esac
13082
13083 : see if gethostent_r exists
13084 set gethostent_r d_gethostent_r
13085 eval $inlibc
13086 case "$d_gethostent_r" in
13087 "$define")
13088         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13089         case "$d_gethostent_r_proto:$usethreads" in
13090         ":define")      d_gethostent_r_proto=define
13091                 set d_gethostent_r_proto gethostent_r $hdrs
13092                 eval $hasproto ;;
13093         *)      ;;
13094         esac
13095         case "$d_gethostent_r_proto" in
13096         define)
13097         case "$gethostent_r_proto" in
13098         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13099         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13100         esac
13101         case "$gethostent_r_proto" in
13102         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13103         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13104         esac
13105         case "$gethostent_r_proto" in
13106         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13107         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13108         esac
13109         case "$gethostent_r_proto" in
13110         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13111         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13112         esac
13113         case "$gethostent_r_proto" in
13114         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13115         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13116         esac
13117         case "$gethostent_r_proto" in
13118         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13119         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13120         esac
13121         case "$gethostent_r_proto" in
13122         ''|0)   d_gethostent_r=undef
13123                 gethostent_r_proto=0
13124                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13125         * )     case "$gethostent_r_proto" in
13126                 REENTRANT_PROTO*) ;;
13127                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13128                 esac
13129                 echo "Prototype: $try" ;;
13130         esac
13131         ;;
13132         *)      case "$usethreads" in
13133                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13134                 esac
13135                 d_gethostent_r=undef
13136                 gethostent_r_proto=0
13137                 ;;
13138         esac
13139         ;;
13140 *)      gethostent_r_proto=0
13141         ;;
13142 esac
13143
13144 : see if prototypes for various gethostxxx netdb.h functions are available
13145 echo " "
13146 set d_gethostprotos gethostent $i_netdb netdb.h
13147 eval $hasproto
13148
13149 : see if getitimer exists
13150 set getitimer d_getitimer
13151 eval $inlibc
13152
13153 : see if getlogin exists
13154 set getlogin d_getlogin
13155 eval $inlibc
13156
13157 : see if getlogin_r exists
13158 set getlogin_r d_getlogin_r
13159 eval $inlibc
13160 case "$d_getlogin_r" in
13161 "$define")
13162         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13163         case "$d_getlogin_r_proto:$usethreads" in
13164         ":define")      d_getlogin_r_proto=define
13165                 set d_getlogin_r_proto getlogin_r $hdrs
13166                 eval $hasproto ;;
13167         *)      ;;
13168         esac
13169         case "$d_getlogin_r_proto" in
13170         define)
13171         case "$getlogin_r_proto" in
13172         ''|0) try='int getlogin_r(char*, size_t);'
13173         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13174         esac
13175         case "$getlogin_r_proto" in
13176         ''|0) try='int getlogin_r(char*, int);'
13177         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13178         esac
13179         case "$getlogin_r_proto" in
13180         ''|0) try='char* getlogin_r(char*, size_t);'
13181         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13182         esac
13183         case "$getlogin_r_proto" in
13184         ''|0) try='char* getlogin_r(char*, int);'
13185         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13186         esac
13187         case "$getlogin_r_proto" in
13188         ''|0)   d_getlogin_r=undef
13189                 getlogin_r_proto=0
13190                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13191         * )     case "$getlogin_r_proto" in
13192                 REENTRANT_PROTO*) ;;
13193                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13194                 esac
13195                 echo "Prototype: $try" ;;
13196         esac
13197         ;;
13198         *)      case "$usethreads" in
13199                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13200                 esac
13201                 d_getlogin_r=undef
13202                 getlogin_r_proto=0
13203                 ;;
13204         esac
13205         ;;
13206 *)      getlogin_r_proto=0
13207         ;;
13208 esac
13209
13210 : see if getmnt exists
13211 set getmnt d_getmnt
13212 eval $inlibc
13213
13214 : see if getmntent exists
13215 set getmntent d_getmntent
13216 eval $inlibc
13217
13218 : see if getnetbyaddr exists
13219 set getnetbyaddr d_getnbyaddr
13220 eval $inlibc
13221
13222 : see if getnetbyname exists
13223 set getnetbyname d_getnbyname
13224 eval $inlibc
13225
13226 : see if getnetent exists
13227 set getnetent d_getnent
13228 eval $inlibc
13229
13230 : see if getnetbyaddr_r exists
13231 set getnetbyaddr_r d_getnetbyaddr_r
13232 eval $inlibc
13233 case "$d_getnetbyaddr_r" in
13234 "$define")
13235         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13236         case "$d_getnetbyaddr_r_proto:$usethreads" in
13237         ":define")      d_getnetbyaddr_r_proto=define
13238                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13239                 eval $hasproto ;;
13240         *)      ;;
13241         esac
13242         case "$d_getnetbyaddr_r_proto" in
13243         define)
13244         case "$getnetbyaddr_r_proto" in
13245         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13246         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13247         esac
13248         case "$getnetbyaddr_r_proto" in
13249         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13250         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13251         esac
13252         case "$getnetbyaddr_r_proto" in
13253         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13254         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13255         esac
13256         case "$getnetbyaddr_r_proto" in
13257         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13258         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13259         esac
13260         case "$getnetbyaddr_r_proto" in
13261         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13262         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13263         esac
13264         case "$getnetbyaddr_r_proto" in
13265         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13266         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13267         esac
13268         case "$getnetbyaddr_r_proto" in
13269         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13270         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13271         esac
13272         case "$getnetbyaddr_r_proto" in
13273         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13274         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13275         esac
13276         case "$getnetbyaddr_r_proto" in
13277         ''|0)   d_getnetbyaddr_r=undef
13278                 getnetbyaddr_r_proto=0
13279                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13280         * )     case "$getnetbyaddr_r_proto" in
13281                 REENTRANT_PROTO*) ;;
13282                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13283                 esac
13284                 echo "Prototype: $try" ;;
13285         esac
13286         ;;
13287         *)      case "$usethreads" in
13288                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13289                 esac
13290                 d_getnetbyaddr_r=undef
13291                 getnetbyaddr_r_proto=0
13292                 ;;
13293         esac
13294         ;;
13295 *)      getnetbyaddr_r_proto=0
13296         ;;
13297 esac
13298
13299 : see if getnetbyname_r exists
13300 set getnetbyname_r d_getnetbyname_r
13301 eval $inlibc
13302 case "$d_getnetbyname_r" in
13303 "$define")
13304         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13305         case "$d_getnetbyname_r_proto:$usethreads" in
13306         ":define")      d_getnetbyname_r_proto=define
13307                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13308                 eval $hasproto ;;
13309         *)      ;;
13310         esac
13311         case "$d_getnetbyname_r_proto" in
13312         define)
13313         case "$getnetbyname_r_proto" in
13314         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13315         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13316         esac
13317         case "$getnetbyname_r_proto" in
13318         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13319         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13320         esac
13321         case "$getnetbyname_r_proto" in
13322         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13323         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13324         esac
13325         case "$getnetbyname_r_proto" in
13326         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13327         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13328         esac
13329         case "$getnetbyname_r_proto" in
13330         ''|0)   d_getnetbyname_r=undef
13331                 getnetbyname_r_proto=0
13332                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13333         * )     case "$getnetbyname_r_proto" in
13334                 REENTRANT_PROTO*) ;;
13335                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13336                 esac
13337                 echo "Prototype: $try" ;;
13338         esac
13339         ;;
13340         *)      case "$usethreads" in
13341                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13342                 esac
13343                 d_getnetbyname_r=undef
13344                 getnetbyname_r_proto=0
13345                 ;;
13346         esac
13347         ;;
13348 *)      getnetbyname_r_proto=0
13349         ;;
13350 esac
13351
13352 : see if getnetent_r exists
13353 set getnetent_r d_getnetent_r
13354 eval $inlibc
13355 case "$d_getnetent_r" in
13356 "$define")
13357         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13358         case "$d_getnetent_r_proto:$usethreads" in
13359         ":define")      d_getnetent_r_proto=define
13360                 set d_getnetent_r_proto getnetent_r $hdrs
13361                 eval $hasproto ;;
13362         *)      ;;
13363         esac
13364         case "$d_getnetent_r_proto" in
13365         define)
13366         case "$getnetent_r_proto" in
13367         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13368         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13369         esac
13370         case "$getnetent_r_proto" in
13371         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13372         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13373         esac
13374         case "$getnetent_r_proto" in
13375         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13376         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13377         esac
13378         case "$getnetent_r_proto" in
13379         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13380         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13381         esac
13382         case "$getnetent_r_proto" in
13383         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13384         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13385         esac
13386         case "$getnetent_r_proto" in
13387         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13388         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13389         esac
13390         case "$getnetent_r_proto" in
13391         ''|0)   d_getnetent_r=undef
13392                 getnetent_r_proto=0
13393                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13394         * )     case "$getnetent_r_proto" in
13395                 REENTRANT_PROTO*) ;;
13396                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13397                 esac
13398                 echo "Prototype: $try" ;;
13399         esac
13400         ;;
13401         *)      case "$usethreads" in
13402                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13403                 esac
13404                 d_getnetent_r=undef
13405                 getnetent_r_proto=0
13406                 ;;
13407         esac
13408         ;;
13409 *)      getnetent_r_proto=0
13410         ;;
13411 esac
13412
13413 : see if prototypes for various getnetxxx netdb.h functions are available
13414 echo " "
13415 set d_getnetprotos getnetent $i_netdb netdb.h
13416 eval $hasproto
13417
13418 : see if getpagesize exists
13419 set getpagesize d_getpagsz
13420 eval $inlibc
13421
13422
13423 : see if getprotobyname exists
13424 set getprotobyname d_getpbyname
13425 eval $inlibc
13426
13427 : see if getprotobynumber exists
13428 set getprotobynumber d_getpbynumber
13429 eval $inlibc
13430
13431 : see if getprotoent exists
13432 set getprotoent d_getpent
13433 eval $inlibc
13434
13435 : see if getpgid exists
13436 set getpgid d_getpgid
13437 eval $inlibc
13438
13439 : see if getpgrp2 exists
13440 set getpgrp2 d_getpgrp2
13441 eval $inlibc
13442
13443 : see if getppid exists
13444 set getppid d_getppid
13445 eval $inlibc
13446
13447 : see if getpriority exists
13448 set getpriority d_getprior
13449 eval $inlibc
13450
13451 : see if getprotobyname_r exists
13452 set getprotobyname_r d_getprotobyname_r
13453 eval $inlibc
13454 case "$d_getprotobyname_r" in
13455 "$define")
13456         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13457         case "$d_getprotobyname_r_proto:$usethreads" in
13458         ":define")      d_getprotobyname_r_proto=define
13459                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13460                 eval $hasproto ;;
13461         *)      ;;
13462         esac
13463         case "$d_getprotobyname_r_proto" in
13464         define)
13465         case "$getprotobyname_r_proto" in
13466         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13467         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13468         esac
13469         case "$getprotobyname_r_proto" in
13470         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13471         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13472         esac
13473         case "$getprotobyname_r_proto" in
13474         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13475         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13476         esac
13477         case "$getprotobyname_r_proto" in
13478         ''|0)   d_getprotobyname_r=undef
13479                 getprotobyname_r_proto=0
13480                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13481         * )     case "$getprotobyname_r_proto" in
13482                 REENTRANT_PROTO*) ;;
13483                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13484                 esac
13485                 echo "Prototype: $try" ;;
13486         esac
13487         ;;
13488         *)      case "$usethreads" in
13489                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13490                 esac
13491                 d_getprotobyname_r=undef
13492                 getprotobyname_r_proto=0
13493                 ;;
13494         esac
13495         ;;
13496 *)      getprotobyname_r_proto=0
13497         ;;
13498 esac
13499
13500 : see if getprotobynumber_r exists
13501 set getprotobynumber_r d_getprotobynumber_r
13502 eval $inlibc
13503 case "$d_getprotobynumber_r" in
13504 "$define")
13505         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13506         case "$d_getprotobynumber_r_proto:$usethreads" in
13507         ":define")      d_getprotobynumber_r_proto=define
13508                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13509                 eval $hasproto ;;
13510         *)      ;;
13511         esac
13512         case "$d_getprotobynumber_r_proto" in
13513         define)
13514         case "$getprotobynumber_r_proto" in
13515         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13516         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13517         esac
13518         case "$getprotobynumber_r_proto" in
13519         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13520         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13521         esac
13522         case "$getprotobynumber_r_proto" in
13523         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13524         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13525         esac
13526         case "$getprotobynumber_r_proto" in
13527         ''|0)   d_getprotobynumber_r=undef
13528                 getprotobynumber_r_proto=0
13529                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
13530         * )     case "$getprotobynumber_r_proto" in
13531                 REENTRANT_PROTO*) ;;
13532                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13533                 esac
13534                 echo "Prototype: $try" ;;
13535         esac
13536         ;;
13537         *)      case "$usethreads" in
13538                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13539                 esac
13540                 d_getprotobynumber_r=undef
13541                 getprotobynumber_r_proto=0
13542                 ;;
13543         esac
13544         ;;
13545 *)      getprotobynumber_r_proto=0
13546         ;;
13547 esac
13548
13549 : see if getprotoent_r exists
13550 set getprotoent_r d_getprotoent_r
13551 eval $inlibc
13552 case "$d_getprotoent_r" in
13553 "$define")
13554         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13555         case "$d_getprotoent_r_proto:$usethreads" in
13556         ":define")      d_getprotoent_r_proto=define
13557                 set d_getprotoent_r_proto getprotoent_r $hdrs
13558                 eval $hasproto ;;
13559         *)      ;;
13560         esac
13561         case "$d_getprotoent_r_proto" in
13562         define)
13563         case "$getprotoent_r_proto" in
13564         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13565         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13566         esac
13567         case "$getprotoent_r_proto" in
13568         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13569         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13570         esac
13571         case "$getprotoent_r_proto" in
13572         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13573         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13574         esac
13575         case "$getprotoent_r_proto" in
13576         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13577         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13578         esac
13579         case "$getprotoent_r_proto" in
13580         ''|0)   d_getprotoent_r=undef
13581                 getprotoent_r_proto=0
13582                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
13583         * )     case "$getprotoent_r_proto" in
13584                 REENTRANT_PROTO*) ;;
13585                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13586                 esac
13587                 echo "Prototype: $try" ;;
13588         esac
13589         ;;
13590         *)      case "$usethreads" in
13591                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13592                 esac
13593                 d_getprotoent_r=undef
13594                 getprotoent_r_proto=0
13595                 ;;
13596         esac
13597         ;;
13598 *)      getprotoent_r_proto=0
13599         ;;
13600 esac
13601
13602 : see if prototypes for various getprotoxxx netdb.h functions are available
13603 echo " "
13604 set d_getprotoprotos getprotoent $i_netdb netdb.h
13605 eval $hasproto
13606
13607 : see if getprpwnam exists
13608 set getprpwnam d_getprpwnam
13609 eval $inlibc
13610
13611 : see if getpwent exists
13612 set getpwent d_getpwent
13613 eval $inlibc
13614
13615 : see if getpwent_r exists
13616 set getpwent_r d_getpwent_r
13617 eval $inlibc
13618 case "$d_getpwent_r" in
13619 "$define")
13620         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13621         case "$d_getpwent_r_proto:$usethreads" in
13622         ":define")      d_getpwent_r_proto=define
13623                 set d_getpwent_r_proto getpwent_r $hdrs
13624                 eval $hasproto ;;
13625         *)      ;;
13626         esac
13627         case "$d_getpwent_r_proto" in
13628         define)
13629         case "$getpwent_r_proto" in
13630         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13631         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13632         esac
13633         case "$getpwent_r_proto" in
13634         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13635         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13636         esac
13637         case "$getpwent_r_proto" in
13638         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13639         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13640         esac
13641         case "$getpwent_r_proto" in
13642         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13643         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13644         esac
13645         case "$getpwent_r_proto" in
13646         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13647         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13648         esac
13649         case "$getpwent_r_proto" in
13650         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13651         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13652         esac
13653         case "$getpwent_r_proto" in
13654         ''|0)   d_getpwent_r=undef
13655                 getpwent_r_proto=0
13656                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
13657         * )     case "$getpwent_r_proto" in
13658                 REENTRANT_PROTO*) ;;
13659                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13660                 esac
13661                 echo "Prototype: $try" ;;
13662         esac
13663         ;;
13664         *)      case "$usethreads" in
13665                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13666                 esac
13667                 d_getpwent_r=undef
13668                 getpwent_r_proto=0
13669                 ;;
13670         esac
13671         ;;
13672 *)      getpwent_r_proto=0
13673         ;;
13674 esac
13675
13676 : see if getpwnam_r exists
13677 set getpwnam_r d_getpwnam_r
13678 eval $inlibc
13679 case "$d_getpwnam_r" in
13680 "$define")
13681         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13682         case "$d_getpwnam_r_proto:$usethreads" in
13683         ":define")      d_getpwnam_r_proto=define
13684                 set d_getpwnam_r_proto getpwnam_r $hdrs
13685                 eval $hasproto ;;
13686         *)      ;;
13687         esac
13688         case "$d_getpwnam_r_proto" in
13689         define)
13690         case "$getpwnam_r_proto" in
13691         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13692         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
13693         esac
13694         case "$getpwnam_r_proto" in
13695         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
13696         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
13697         esac
13698         case "$getpwnam_r_proto" in
13699         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
13700         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
13701         esac
13702         case "$getpwnam_r_proto" in
13703         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
13704         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
13705         esac
13706         case "$getpwnam_r_proto" in
13707         ''|0)   d_getpwnam_r=undef
13708                 getpwnam_r_proto=0
13709                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
13710         * )     case "$getpwnam_r_proto" in
13711                 REENTRANT_PROTO*) ;;
13712                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
13713                 esac
13714                 echo "Prototype: $try" ;;
13715         esac
13716         ;;
13717         *)      case "$usethreads" in
13718                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13719                 esac
13720                 d_getpwnam_r=undef
13721                 getpwnam_r_proto=0
13722                 ;;
13723         esac
13724         ;;
13725 *)      getpwnam_r_proto=0
13726         ;;
13727 esac
13728
13729 : see if getpwuid_r exists
13730 set getpwuid_r d_getpwuid_r
13731 eval $inlibc
13732 case "$d_getpwuid_r" in
13733 "$define")
13734         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13735         case "$d_getpwuid_r_proto:$usethreads" in
13736         ":define")      d_getpwuid_r_proto=define
13737                 set d_getpwuid_r_proto getpwuid_r $hdrs
13738                 eval $hasproto ;;
13739         *)      ;;
13740         esac
13741         case "$d_getpwuid_r_proto" in
13742         define)
13743         case "$getpwuid_r_proto" in
13744         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13745         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13746         esac
13747         case "$getpwuid_r_proto" in
13748         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13749         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13750         esac
13751         case "$getpwuid_r_proto" in
13752         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13753         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13754         esac
13755         case "$getpwuid_r_proto" in
13756         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13757         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13758         esac
13759         case "$getpwuid_r_proto" in
13760         ''|0)   d_getpwuid_r=undef
13761                 getpwuid_r_proto=0
13762                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
13763         * )     case "$getpwuid_r_proto" in
13764                 REENTRANT_PROTO*) ;;
13765                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13766                 esac
13767                 echo "Prototype: $try" ;;
13768         esac
13769         ;;
13770         *)      case "$usethreads" in
13771                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13772                 esac
13773                 d_getpwuid_r=undef
13774                 getpwuid_r_proto=0
13775                 ;;
13776         esac
13777         ;;
13778 *)      getpwuid_r_proto=0
13779         ;;
13780 esac
13781
13782
13783 : see if getservbyname exists
13784 set getservbyname d_getsbyname
13785 eval $inlibc
13786
13787 : see if getservbyport exists
13788 set getservbyport d_getsbyport
13789 eval $inlibc
13790
13791 : see if getservent exists
13792 set getservent d_getsent
13793 eval $inlibc
13794
13795 : see if getservbyname_r exists
13796 set getservbyname_r d_getservbyname_r
13797 eval $inlibc
13798 case "$d_getservbyname_r" in
13799 "$define")
13800         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13801         case "$d_getservbyname_r_proto:$usethreads" in
13802         ":define")      d_getservbyname_r_proto=define
13803                 set d_getservbyname_r_proto getservbyname_r $hdrs
13804                 eval $hasproto ;;
13805         *)      ;;
13806         esac
13807         case "$d_getservbyname_r_proto" in
13808         define)
13809         case "$getservbyname_r_proto" in
13810         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13811         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13812         esac
13813         case "$getservbyname_r_proto" in
13814         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13815         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13816         esac
13817         case "$getservbyname_r_proto" in
13818         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13819         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13820         esac
13821         case "$getservbyname_r_proto" in
13822         ''|0)   d_getservbyname_r=undef
13823                 getservbyname_r_proto=0
13824                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
13825         * )     case "$getservbyname_r_proto" in
13826                 REENTRANT_PROTO*) ;;
13827                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
13828                 esac
13829                 echo "Prototype: $try" ;;
13830         esac
13831         ;;
13832         *)      case "$usethreads" in
13833                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
13834                 esac
13835                 d_getservbyname_r=undef
13836                 getservbyname_r_proto=0
13837                 ;;
13838         esac
13839         ;;
13840 *)      getservbyname_r_proto=0
13841         ;;
13842 esac
13843
13844 : see if getservbyport_r exists
13845 set getservbyport_r d_getservbyport_r
13846 eval $inlibc
13847 case "$d_getservbyport_r" in
13848 "$define")
13849         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13850         case "$d_getservbyport_r_proto:$usethreads" in
13851         ":define")      d_getservbyport_r_proto=define
13852                 set d_getservbyport_r_proto getservbyport_r $hdrs
13853                 eval $hasproto ;;
13854         *)      ;;
13855         esac
13856         case "$d_getservbyport_r_proto" in
13857         define)
13858         case "$getservbyport_r_proto" in
13859         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
13860         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
13861         esac
13862         case "$getservbyport_r_proto" in
13863         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
13864         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
13865         esac
13866         case "$getservbyport_r_proto" in
13867         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
13868         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
13869         esac
13870         case "$getservbyport_r_proto" in
13871         ''|0)   d_getservbyport_r=undef
13872                 getservbyport_r_proto=0
13873                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
13874         * )     case "$getservbyport_r_proto" in
13875                 REENTRANT_PROTO*) ;;
13876                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
13877                 esac
13878                 echo "Prototype: $try" ;;
13879         esac
13880         ;;
13881         *)      case "$usethreads" in
13882                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
13883                 esac
13884                 d_getservbyport_r=undef
13885                 getservbyport_r_proto=0
13886                 ;;
13887         esac
13888         ;;
13889 *)      getservbyport_r_proto=0
13890         ;;
13891 esac
13892
13893 : see if getservent_r exists
13894 set getservent_r d_getservent_r
13895 eval $inlibc
13896 case "$d_getservent_r" in
13897 "$define")
13898         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13899         case "$d_getservent_r_proto:$usethreads" in
13900         ":define")      d_getservent_r_proto=define
13901                 set d_getservent_r_proto getservent_r $hdrs
13902                 eval $hasproto ;;
13903         *)      ;;
13904         esac
13905         case "$d_getservent_r_proto" in
13906         define)
13907         case "$getservent_r_proto" in
13908         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
13909         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
13910         esac
13911         case "$getservent_r_proto" in
13912         ''|0) try='int getservent_r(struct servent*, char*, int);'
13913         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
13914         esac
13915         case "$getservent_r_proto" in
13916         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
13917         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
13918         esac
13919         case "$getservent_r_proto" in
13920         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
13921         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
13922         esac
13923         case "$getservent_r_proto" in
13924         ''|0)   d_getservent_r=undef
13925                 getservent_r_proto=0
13926                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
13927         * )     case "$getservent_r_proto" in
13928                 REENTRANT_PROTO*) ;;
13929                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
13930                 esac
13931                 echo "Prototype: $try" ;;
13932         esac
13933         ;;
13934         *)      case "$usethreads" in
13935                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
13936                 esac
13937                 d_getservent_r=undef
13938                 getservent_r_proto=0
13939                 ;;
13940         esac
13941         ;;
13942 *)      getservent_r_proto=0
13943         ;;
13944 esac
13945
13946 : see if prototypes for various getservxxx netdb.h functions are available
13947 echo " "
13948 set d_getservprotos getservent $i_netdb netdb.h
13949 eval $hasproto
13950
13951 : see if getspnam exists
13952 set getspnam d_getspnam
13953 eval $inlibc
13954
13955 : see if this is a shadow.h system
13956 set shadow.h i_shadow
13957 eval $inhdr
13958
13959 : see if getspnam_r exists
13960 set getspnam_r d_getspnam_r
13961 eval $inlibc
13962 case "$d_getspnam_r" in
13963 "$define")
13964         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
13965         case "$d_getspnam_r_proto:$usethreads" in
13966         ":define")      d_getspnam_r_proto=define
13967                 set d_getspnam_r_proto getspnam_r $hdrs
13968                 eval $hasproto ;;
13969         *)      ;;
13970         esac
13971         case "$d_getspnam_r_proto" in
13972         define)
13973         case "$getspnam_r_proto" in
13974         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
13975         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
13976         esac
13977         case "$getspnam_r_proto" in
13978         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
13979         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
13980         esac
13981         case "$getspnam_r_proto" in
13982         ''|0)   d_getspnam_r=undef
13983                 getspnam_r_proto=0
13984                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
13985         * )     case "$getspnam_r_proto" in
13986                 REENTRANT_PROTO*) ;;
13987                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
13988                 esac
13989                 echo "Prototype: $try" ;;
13990         esac
13991         ;;
13992         *)      case "$usethreads" in
13993                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
13994                 esac
13995                 d_getspnam_r=undef
13996                 getspnam_r_proto=0
13997                 ;;
13998         esac
13999         ;;
14000 *)      getspnam_r_proto=0
14001         ;;
14002 esac
14003
14004 : see if gettimeofday or ftime exists
14005 set gettimeofday d_gettimeod
14006 eval $inlibc
14007 case "$d_gettimeod" in
14008 "$undef")
14009         set ftime d_ftime 
14010         eval $inlibc
14011         ;;
14012 *)
14013         val="$undef"; set d_ftime; eval $setvar
14014         ;;
14015 esac
14016 case "$d_gettimeod$d_ftime" in
14017 "$undef$undef")
14018         echo " "
14019         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14020         ;;
14021 esac
14022
14023 : see if gmtime_r exists
14024 set gmtime_r d_gmtime_r
14025 eval $inlibc
14026 case "$d_gmtime_r" in
14027 "$define")
14028         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14029         case "$d_gmtime_r_proto:$usethreads" in
14030         ":define")      d_gmtime_r_proto=define
14031                 set d_gmtime_r_proto gmtime_r $hdrs
14032                 eval $hasproto ;;
14033         *)      ;;
14034         esac
14035         case "$d_gmtime_r_proto" in
14036         define)
14037         case "$gmtime_r_proto" in
14038         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14039         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14040         esac
14041         case "$gmtime_r_proto" in
14042         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14043         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14044         esac
14045         case "$gmtime_r_proto" in
14046         ''|0)   d_gmtime_r=undef
14047                 gmtime_r_proto=0
14048                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14049         * )     case "$gmtime_r_proto" in
14050                 REENTRANT_PROTO*) ;;
14051                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14052                 esac
14053                 echo "Prototype: $try" ;;
14054         esac
14055         ;;
14056         *)      case "$usethreads" in
14057                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14058                 esac
14059                 d_gmtime_r=undef
14060                 gmtime_r_proto=0
14061                 ;;
14062         esac
14063         ;;
14064 *)      gmtime_r_proto=0
14065         ;;
14066 esac
14067
14068 : see if hasmntopt exists
14069 set hasmntopt d_hasmntopt
14070 eval $inlibc
14071
14072 : see if this is a netinet/in.h or sys/in.h system
14073 set netinet/in.h i_niin sys/in.h i_sysin
14074 eval $inhdr
14075
14076 : see if arpa/inet.h has to be included
14077 set arpa/inet.h i_arpainet
14078 eval $inhdr
14079
14080 : see if htonl --and friends-- exists
14081 val=''
14082 set htonl val
14083 eval $inlibc
14084
14085 : Maybe they are macros.
14086 case "$val" in
14087 $undef)
14088         $cat >htonl.c <<EOM
14089 #include <stdio.h>
14090 #include <sys/types.h>
14091 #$i_niin I_NETINET_IN
14092 #$i_sysin I_SYS_IN
14093 #$i_arpainet I_ARPA_INET
14094 #ifdef I_NETINET_IN
14095 #include <netinet/in.h>
14096 #endif
14097 #ifdef I_SYS_IN
14098 #include <sys/in.h>
14099 #endif
14100 #ifdef I_ARPA_INET
14101 #include <arpa/inet.h>
14102 #endif
14103 #ifdef htonl
14104 printf("Defined as a macro.");
14105 #endif
14106 EOM
14107         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14108         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14109                 val="$define"
14110                 echo "But it seems to be defined as a macro." >&4
14111         fi
14112         $rm -f htonl.?
14113         ;;
14114 esac
14115 set d_htonl
14116 eval $setvar
14117
14118 : see if ilogbl exists
14119 set ilogbl d_ilogbl
14120 eval $inlibc
14121
14122 : index or strchr
14123 echo " "
14124 if set index val -f; eval $csym; $val; then
14125         if set strchr val -f d_strchr; eval $csym; $val; then
14126                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14127                         val="$define"
14128                         vali="$undef"
14129                         echo "strchr() found." >&4
14130                 else
14131                         val="$undef"
14132                         vali="$define"
14133                         echo "index() found." >&4
14134                 fi
14135         else
14136                 val="$undef"
14137                 vali="$define"
14138                 echo "index() found." >&4
14139         fi
14140 else
14141         if set strchr val -f d_strchr; eval $csym; $val; then
14142                 val="$define"
14143                 vali="$undef"
14144                 echo "strchr() found." >&4
14145         else
14146                 echo "No index() or strchr() found!" >&4
14147                 val="$undef"
14148                 vali="$undef"
14149         fi
14150 fi
14151 set d_strchr; eval $setvar
14152 val="$vali"
14153 set d_index; eval $setvar
14154
14155 : check whether inet_aton exists
14156 set inet_aton d_inetaton
14157 eval $inlibc
14158
14159 : Look for isascii
14160 echo " "
14161 $cat >isascii.c <<EOCP
14162 #include <stdio.h>
14163 #include <ctype.h>
14164 #$i_stdlib I_STDLIB
14165 #ifdef I_STDLIB
14166 #include <stdlib.h>
14167 #endif
14168 int main() {
14169         int c = 'A';
14170         if (isascii(c))
14171                 exit(0);
14172         else
14173                 exit(1);
14174 }
14175 EOCP
14176 set isascii
14177 if eval $compile; then
14178         echo "isascii() found." >&4
14179         val="$define"
14180 else
14181         echo "isascii() NOT found." >&4
14182         val="$undef"
14183 fi
14184 set d_isascii
14185 eval $setvar
14186 $rm -f isascii*
14187
14188 : see if isfinite exists
14189 set isfinite d_isfinite
14190 eval $inlibc
14191
14192 : see if isinf exists
14193 set isinf d_isinf
14194 eval $inlibc
14195
14196 : see if isnan exists
14197 set isnan d_isnan
14198 eval $inlibc
14199
14200 : see if isnanl exists
14201 set isnanl d_isnanl
14202 eval $inlibc
14203
14204 : see if killpg exists
14205 set killpg d_killpg
14206 eval $inlibc
14207
14208 : see if lchown exists
14209 echo " "
14210 $cat > try.c <<'EOCP'
14211 /* System header to define __stub macros and hopefully few prototypes,
14212     which can conflict with char lchown(); below.  */
14213 #include <assert.h>
14214 /* Override any gcc2 internal prototype to avoid an error.  */
14215 /* We use char because int might match the return type of a gcc2
14216    builtin and then its argument prototype would still apply.  */
14217 char lchown();
14218 int main() {
14219     /*  The GNU C library defines this for functions which it implements
14220         to always fail with ENOSYS.  Some functions are actually named
14221         something starting with __ and the normal name is an alias.  */
14222 #if defined (__stub_lchown) || defined (__stub___lchown)
14223 choke me
14224 #else
14225 lchown();
14226 #endif
14227 ; return 0; }
14228 EOCP
14229 set try
14230 if eval $compile; then
14231     $echo "lchown() found." >&4
14232     val="$define"
14233 else
14234     $echo "lchown() NOT found." >&4
14235     val="$undef"
14236 fi
14237 set d_lchown
14238 eval $setvar
14239
14240 : See if number of significant digits in a double precision number is known
14241 echo " "
14242 $cat >ldbl_dig.c <<EOM
14243 #$i_limits I_LIMITS
14244 #$i_float I_FLOAT
14245 #ifdef I_LIMITS
14246 #include <limits.h>
14247 #endif
14248 #ifdef I_FLOAT
14249 #include <float.h>
14250 #endif
14251 #ifdef LDBL_DIG
14252 printf("Contains LDBL_DIG");
14253 #endif
14254 EOM
14255 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14256 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14257         echo "LDBL_DIG found." >&4
14258         val="$define"
14259 else
14260         echo "LDBL_DIG NOT found." >&4
14261         val="$undef"
14262 fi
14263 $rm -f ldbl_dig.?
14264 set d_ldbl_dig
14265 eval $setvar
14266
14267 : see if this is a math.h system
14268 set math.h i_math
14269 eval $inhdr
14270
14271 d_libm_lib_version="$undef"
14272 case $i_math in
14273     $define)
14274         : check to see if math.h defines _LIB_VERSION
14275         echo " "
14276         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14277         $cat >try.c <<EOCP
14278 #include <unistd.h>
14279 #include <math.h>
14280 int main (int argc, char *argv[])
14281 {
14282     printf ("%d\n", _LIB_VERSION);
14283     return (0);
14284     } /* main */
14285 EOCP
14286         set try
14287         if eval $compile; then
14288             foo=`$run ./try`
14289             echo "Yes, it does ($foo)" >&4
14290             d_libm_lib_version="$define"
14291         else
14292             echo "No, it does not (probably harmless)\n" >&4
14293             fi
14294         $rm -f try.* try core core.try.*
14295         ;;
14296
14297     esac
14298
14299 : see if link exists
14300 set link d_link
14301 eval $inlibc
14302
14303 : see if localtime_r exists
14304 set localtime_r d_localtime_r
14305 eval $inlibc
14306 case "$d_localtime_r" in
14307 "$define")
14308         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14309         case "$d_localtime_r_proto:$usethreads" in
14310         ":define")      d_localtime_r_proto=define
14311                 set d_localtime_r_proto localtime_r $hdrs
14312                 eval $hasproto ;;
14313         *)      ;;
14314         esac
14315         case "$d_localtime_r_proto" in
14316         define)
14317         case "$localtime_r_proto" in
14318         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14319         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14320         esac
14321         case "$localtime_r_proto" in
14322         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14323         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14324         esac
14325         case "$localtime_r_proto" in
14326         ''|0)   d_localtime_r=undef
14327                 localtime_r_proto=0
14328                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14329         * )     case "$localtime_r_proto" in
14330                 REENTRANT_PROTO*) ;;
14331                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14332                 esac
14333                 echo "Prototype: $try" ;;
14334         esac
14335         ;;
14336         *)      case "$usethreads" in
14337                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14338                 esac
14339                 d_localtime_r=undef
14340                 localtime_r_proto=0
14341                 ;;
14342         esac
14343         ;;
14344 *)      localtime_r_proto=0
14345         ;;
14346 esac
14347
14348 : see if localeconv exists
14349 set localeconv d_locconv
14350 eval $inlibc
14351
14352 : see if lockf exists
14353 set lockf d_lockf
14354 eval $inlibc
14355
14356 : see if prototype for lseek is available
14357 echo " "
14358 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14359 eval $hasproto
14360
14361 : see if lstat exists
14362 set lstat d_lstat
14363 eval $inlibc
14364
14365 : see if madvise exists
14366 set madvise d_madvise
14367 eval $inlibc
14368
14369 : see if malloc_size exists
14370 set malloc_size d_malloc_size
14371 eval $inlibc
14372
14373 : see if malloc_size_good exists
14374 set malloc_good_size d_malloc_good_size
14375 eval $inlibc
14376
14377 : see if mblen exists
14378 set mblen d_mblen
14379 eval $inlibc
14380
14381 : see if mbstowcs exists
14382 set mbstowcs d_mbstowcs
14383 eval $inlibc
14384
14385 : see if mbtowc exists
14386 set mbtowc d_mbtowc
14387 eval $inlibc
14388
14389 : see if memchr exists
14390 set memchr d_memchr
14391 eval $inlibc
14392
14393 : see if memcmp exists
14394 set memcmp d_memcmp
14395 eval $inlibc
14396
14397 : see if memcpy exists
14398 set memcpy d_memcpy
14399 eval $inlibc
14400
14401 : see if memmove exists
14402 set memmove d_memmove
14403 eval $inlibc
14404
14405 : see if memset exists
14406 set memset d_memset
14407 eval $inlibc
14408
14409 : see if mkdir exists
14410 set mkdir d_mkdir
14411 eval $inlibc
14412
14413 : see if mkdtemp exists
14414 set mkdtemp d_mkdtemp
14415 eval $inlibc
14416
14417 : see if mkfifo exists
14418 set mkfifo d_mkfifo
14419 eval $inlibc
14420
14421 : see if mkstemp exists
14422 set mkstemp d_mkstemp
14423 eval $inlibc
14424
14425 : see if mkstemps exists
14426 set mkstemps d_mkstemps
14427 eval $inlibc
14428
14429 : see if mktime exists
14430 set mktime d_mktime
14431 eval $inlibc
14432
14433 : see if this is a sys/mman.h system
14434 set sys/mman.h i_sysmman
14435 eval $inhdr
14436
14437 : see if mmap exists
14438 set mmap d_mmap
14439 eval $inlibc
14440 : see what shmat returns
14441 : default to something harmless
14442 mmaptype='void *'
14443 case "$i_sysmman$d_mmap" in
14444 "$define$define")
14445         $cat >mmap.c <<'END'
14446 #include <sys/mman.h>
14447 void *mmap();
14448 END
14449         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14450                 mmaptype='void *'
14451         else
14452                 mmaptype='caddr_t'
14453         fi
14454         echo "and it returns ($mmaptype)." >&4
14455         ;;
14456 esac
14457
14458
14459
14460 : see if sqrtl exists
14461 set sqrtl d_sqrtl
14462 eval $inlibc
14463
14464 : see if scalbnl exists
14465 set scalbnl d_scalbnl
14466 eval $inlibc
14467
14468 : see if modfl exists
14469 set modfl d_modfl
14470 eval $inlibc
14471
14472 : see if prototype for modfl is available
14473 echo " "
14474 set d_modflproto modfl $i_math math.h
14475 eval $hasproto
14476
14477 d_modfl_pow32_bug="$undef"
14478
14479 case "$d_longdbl$d_modfl" in
14480 $define$define)
14481         $cat <<EOM
14482 Checking to see whether your modfl() is okay for large values...
14483 EOM
14484 $cat >try.c <<EOCP
14485 #include <math.h> 
14486 #include <stdio.h>
14487 EOCP
14488 if $test "X$d_modflproto" != "X$define"; then
14489         $cat >>try.c <<EOCP
14490 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
14491 long double modfl (long double, long double *);
14492 EOCP
14493 fi
14494 $cat >>try.c <<EOCP
14495 int main() {
14496     long double nv = 4294967303.15;
14497     long double v, w;
14498     v = modfl(nv, &w);         
14499 #ifdef __GLIBC__
14500     printf("glibc");
14501 #endif
14502     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14503     return 0;
14504 }
14505 EOCP
14506         case "$osname:$gccversion" in
14507         aix:)   saveccflags="$ccflags"
14508                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14509         esac
14510         set try
14511         if eval $compile; then
14512                 foo=`$run ./try`
14513                 case "$foo" in
14514                 *" 4294967303.150000 1.150000 4294967302.000000")
14515                         echo >&4 "Your modfl() is broken for large values."
14516                         d_modfl_pow32_bug="$define"
14517                         case "$foo" in
14518                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14519                         ;;
14520                         esac
14521                         ;;
14522                 *" 4294967303.150000 0.150000 4294967303.000000")
14523                         echo >&4 "Your modfl() seems okay for large values."
14524                         ;;
14525                 *)      echo >&4 "I don't understand your modfl() at all."
14526                         d_modfl="$undef"
14527                         ;;
14528                 esac
14529                 $rm -f try.* try core core.try.*
14530         else
14531                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14532                 d_modfl="$undef"
14533         fi
14534         case "$osname:$gccversion" in
14535         aix:)   ccflags="$saveccflags" ;; # restore
14536         esac
14537         ;;
14538 esac
14539
14540 if $test "$uselongdouble" = "$define"; then
14541     message=""
14542     if $test "$d_sqrtl" != "$define"; then
14543         message="$message sqrtl"
14544     fi
14545     if $test "$d_modfl" != "$define"; then
14546         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14547             echo "You have both aintl and copysignl, so I can emulate modfl."
14548         else
14549             message="$message modfl"
14550         fi
14551     fi
14552     if $test "$d_frexpl" != "$define"; then
14553         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14554             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14555         else
14556             message="$message frexpl"
14557         fi
14558     fi
14559
14560     if $test "$message" != ""; then
14561         $cat <<EOM >&4
14562
14563 *** You requested the use of long doubles but you do not seem to have
14564 *** the following mathematical functions needed for long double support:
14565 ***    $message
14566 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14567 *** Cannot continue, aborting.
14568
14569 EOM
14570
14571         exit 1
14572     fi
14573 fi
14574
14575 : see if mprotect exists
14576 set mprotect d_mprotect
14577 eval $inlibc
14578
14579 : see if msgctl exists
14580 set msgctl d_msgctl
14581 eval $inlibc
14582
14583 : see if msgget exists
14584 set msgget d_msgget
14585 eval $inlibc
14586
14587 : see if msgsnd exists
14588 set msgsnd d_msgsnd
14589 eval $inlibc
14590
14591 : see if msgrcv exists
14592 set msgrcv d_msgrcv
14593 eval $inlibc
14594
14595 : see how much of the 'msg*(2)' library is present.
14596 h_msg=true
14597 echo " "
14598 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14599 *"$undef"*) h_msg=false;;
14600 esac
14601 case "$osname" in
14602 freebsd)
14603     case "`ipcs 2>&1`" in
14604     "SVID messages"*"not configured"*)
14605         echo "Your $osname does not have the msg*(2) configured." >&4
14606         h_msg=false
14607         val="$undef"
14608         set msgctl d_msgctl
14609         eval $setvar
14610         set msgget d_msgget
14611         eval $setvar
14612         set msgsnd d_msgsnd
14613         eval $setvar
14614         set msgrcv d_msgrcv
14615         eval $setvar
14616         ;;
14617     esac
14618     ;;
14619 esac
14620 : we could also check for sys/ipc.h ...
14621 if $h_msg && $test `./findhdr sys/msg.h`; then
14622         echo "You have the full msg*(2) library." >&4
14623         val="$define"
14624 else
14625         echo "You don't have the full msg*(2) library." >&4
14626         val="$undef"
14627 fi
14628 set d_msg
14629 eval $setvar
14630
14631
14632 echo " "
14633 echo "Checking to see if your system supports struct msghdr..." >&4
14634 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14635 eval $hasstruct
14636 case "$d_msghdr_s" in
14637 "$define")      echo "Yes, it does."   ;;
14638 *)              echo "No, it doesn't." ;;
14639 esac
14640
14641
14642 : see if msync exists
14643 set msync d_msync
14644 eval $inlibc
14645
14646 : see if munmap exists
14647 set munmap d_munmap
14648 eval $inlibc
14649
14650 : see if nice exists
14651 set nice d_nice
14652 eval $inlibc
14653
14654 : see if this is a langinfo.h system
14655 set langinfo.h i_langinfo
14656 eval $inhdr
14657
14658 : see if nl_langinfo exists
14659 set nl_langinfo d_nl_langinfo
14660 eval $inlibc
14661
14662 : check for length of character
14663 echo " "
14664 case "$charsize" in
14665 '')
14666         echo "Checking to see how big your characters are (hey, you never know)..." >&4
14667         $cat >try.c <<EOCP
14668 #include <stdio.h>
14669 #$i_stdlib I_STDLIB
14670 #ifdef I_STDLIB
14671 #include <stdlib.h>
14672 #endif
14673 int main()
14674 {
14675     printf("%d\n", (int)sizeof(char));
14676     exit(0);
14677 }
14678 EOCP
14679         set try
14680         if eval $compile_ok; then
14681                 dflt=`$run ./try`
14682         else
14683                 dflt='1'
14684                 echo "(I can't seem to compile the test program.  Guessing...)"
14685         fi
14686         ;;
14687 *)
14688         dflt="$charsize"
14689         ;;
14690 esac
14691 rp="What is the size of a character (in bytes)?"
14692 . ./myread
14693 charsize="$ans"
14694 $rm -f try.c try
14695
14696 : check for volatile keyword
14697 echo " "
14698 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
14699 $cat >try.c <<'EOCP'
14700 int main()
14701 {
14702         typedef struct _goo_struct goo_struct;
14703         goo_struct * volatile goo = ((goo_struct *)0);
14704         struct _goo_struct {
14705                 long long_int;
14706                 int reg_int;
14707                 char char_var;
14708         };
14709         typedef unsigned short foo_t;
14710         char *volatile foo;
14711         volatile int bar;
14712         volatile foo_t blech;
14713         foo = foo;
14714 }
14715 EOCP
14716 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
14717         val="$define"
14718         echo "Yup, it does."
14719 else
14720         val="$undef"
14721         echo "Nope, it doesn't."
14722 fi
14723 set d_volatile
14724 eval $setvar
14725 $rm -f try.*
14726
14727
14728 echo " "
14729 $echo "Choosing the C types to be used for Perl's internal types..." >&4
14730
14731 case "$use64bitint:$d_quad:$quadtype" in
14732 define:define:?*)
14733         ivtype="$quadtype"
14734         uvtype="$uquadtype"
14735         ivsize=8
14736         uvsize=8
14737         ;;
14738 *)      ivtype="long"
14739         uvtype="unsigned long"
14740         ivsize=$longsize
14741         uvsize=$longsize
14742         ;;
14743 esac
14744
14745 case "$uselongdouble:$d_longdbl" in
14746 define:define)
14747         nvtype="long double"
14748         nvsize=$longdblsize
14749         ;;
14750 *)      nvtype=double
14751         nvsize=$doublesize
14752         ;;
14753 esac
14754
14755 $echo "(IV will be "$ivtype", $ivsize bytes)"
14756 $echo "(UV will be "$uvtype", $uvsize bytes)"
14757 $echo "(NV will be "$nvtype", $nvsize bytes)"
14758
14759 $cat >try.c <<EOCP
14760 #$i_inttypes I_INTTYPES
14761 #ifdef I_INTTYPES
14762 #include <inttypes.h>
14763 #endif
14764 #include <stdio.h>
14765 int main() {
14766 #ifdef INT8
14767    int8_t i =  INT8_MAX;
14768   uint8_t u = UINT8_MAX;
14769   printf("int8_t\n");
14770 #endif
14771 #ifdef INT16
14772    int16_t i =  INT16_MAX;
14773   uint16_t i = UINT16_MAX;
14774   printf("int16_t\n");
14775 #endif
14776 #ifdef INT32
14777    int32_t i =  INT32_MAX;
14778   uint32_t u = UINT32_MAX;
14779   printf("int32_t\n");
14780 #endif
14781 }
14782 EOCP
14783
14784 case "$i8type" in
14785 '')     case "$charsize" in
14786         1)      i8type=char
14787                 u8type="unsigned char"
14788                 i8size=$charsize
14789                 u8size=$charsize
14790                 ;;
14791         esac
14792         ;;
14793 esac
14794 case "$i8type" in
14795 '')     set try -DINT8
14796         if eval $compile; then
14797                 case "`$run ./try`" in
14798                 int8_t) i8type=int8_t
14799                         u8type=uint8_t
14800                         i8size=1
14801                         u8size=1
14802                         ;;
14803                 esac
14804         fi
14805         ;;
14806 esac
14807 case "$i8type" in
14808 '')     if $test $charsize -ge 1; then
14809                 i8type=char
14810                 u8type="unsigned char"
14811                 i8size=$charsize
14812                 u8size=$charsize
14813         fi
14814         ;;
14815 esac
14816
14817 case "$i16type" in
14818 '')     case "$shortsize" in
14819         2)      i16type=short
14820                 u16type="unsigned short"
14821                 i16size=$shortsize
14822                 u16size=$shortsize
14823                 ;;
14824         esac
14825         ;;
14826 esac
14827 case "$i16type" in
14828 '')     set try -DINT16
14829         if eval $compile; then
14830                 case "`$run ./try`" in
14831                 int16_t)
14832                         i16type=int16_t
14833                         u16type=uint16_t
14834                         i16size=2
14835                         u16size=2
14836                         ;;
14837                 esac
14838         fi
14839         ;;
14840 esac
14841 case "$i16type" in
14842 '')     if $test $shortsize -ge 2; then
14843                 i16type=short
14844                 u16type="unsigned short"
14845                 i16size=$shortsize
14846                 u16size=$shortsize
14847         fi
14848         ;;
14849 esac
14850
14851 case "$i32type" in
14852 '')     case "$longsize" in
14853         4)      i32type=long
14854                 u32type="unsigned long"
14855                 i32size=$longsize
14856                 u32size=$longsize
14857                 ;;
14858         *)      case "$intsize" in
14859                 4)      i32type=int
14860                         u32type="unsigned int"
14861                         i32size=$intsize
14862                         u32size=$intsize
14863                         ;;
14864                 esac
14865                 ;;
14866         esac
14867         ;;
14868 esac
14869 case "$i32type" in
14870 '')     set try -DINT32
14871         if eval $compile; then
14872                 case "`$run ./try`" in
14873                 int32_t)
14874                         i32type=int32_t
14875                         u32type=uint32_t
14876                         i32size=4
14877                         u32size=4
14878                         ;;
14879                 esac
14880         fi
14881         ;;
14882 esac
14883 case "$i32type" in
14884 '')     if $test $intsize -ge 4; then
14885                 i32type=int
14886                 u32type="unsigned int"
14887                 i32size=$intsize
14888                 u32size=$intsize
14889         fi
14890         ;;
14891 esac
14892
14893 case "$i64type" in
14894 '')     case "$d_quad:$quadtype" in
14895         define:?*)
14896                 i64type="$quadtype"
14897                 u64type="$uquadtype"
14898                 i64size=8
14899                 u64size=8
14900                 ;;
14901         esac
14902         ;;
14903 esac
14904
14905 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
14906 : volatile so that the compiler has to store it out to memory.
14907 if test X"$d_volatile" = X"$define"; then
14908         volatile=volatile
14909 fi
14910 $cat <<EOP >try.c
14911 #include <stdio.h>
14912 #$i_stdlib I_STDLIB
14913 #ifdef I_STDLIB
14914 #include <stdlib.h>
14915 #endif
14916 #include <sys/types.h>
14917 #include <signal.h>
14918 #ifdef SIGFPE
14919 $volatile int bletched = 0;
14920 $signal_t blech(s) int s; { bletched = 1; }
14921 #endif
14922 int main() {
14923     $uvtype u = 0;
14924     $nvtype d;
14925     int     n = 8 * $uvsize;
14926     int     i;
14927 #ifdef SIGFPE
14928     signal(SIGFPE, blech);
14929 #endif
14930
14931     for (i = 0; i < n; i++) {
14932       u = u << 1 | ($uvtype)1;
14933       d = ($nvtype)u;
14934       if (($uvtype)d != u)
14935         break;
14936       if (d <= 0)
14937         break;
14938       d = ($nvtype)(u - 1);
14939       if (($uvtype)d != (u - 1))
14940         break;
14941 #ifdef SIGFPE
14942       if (bletched) {
14943         break;
14944 #endif
14945       } 
14946     }
14947     printf("%d\n", ((i == n) ? -n : i));
14948     exit(0);
14949 }
14950 EOP
14951 set try
14952
14953 d_nv_preserves_uv="$undef"
14954 if eval $compile; then
14955         nv_preserves_uv_bits="`$run ./try`"
14956 fi
14957 case "$nv_preserves_uv_bits" in
14958 \-[1-9]*)       
14959         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
14960         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
14961         d_nv_preserves_uv="$define"
14962         ;;
14963 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
14964         d_nv_preserves_uv="$undef" ;;
14965 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
14966         nv_preserves_uv_bits="$undef" ;;
14967 esac
14968
14969 $rm -f try.* try
14970
14971 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
14972 : volatile so that the compiler has to store it out to memory.
14973 if test X"$d_volatile" = X"$define"; then
14974         volatile=volatile
14975 fi
14976 $cat <<EOP >try.c
14977 #include <stdio.h>
14978 #$i_stdlib I_STDLIB
14979 #ifdef I_STDLIB
14980 #include <stdlib.h>
14981 #endif
14982 #$i_string I_STRING
14983 #ifdef I_STRING
14984 #  include <string.h>
14985 #else
14986 #  include <strings.h>
14987 #endif
14988 #include <sys/types.h>
14989 #include <signal.h>
14990 #ifdef SIGFPE
14991 $volatile int bletched = 0;
14992 $signal_t blech(s) int s; { bletched = 1; }
14993 #endif
14994
14995 int checkit($nvtype d, char *where) {
14996     unsigned char *p = (char *)&d;
14997     unsigned char *end = p + sizeof(d);
14998     int fail = 0;
14999
15000     while (p < end)
15001         fail += *p++;
15002
15003     if (!fail)
15004         return 0;
15005
15006     p = (char *)&d;
15007     printf("No - %s: 0x", where);
15008     while (p < end)
15009         printf ("%02X", *p++);
15010     printf("\n");
15011     return 1;
15012 }
15013
15014 int main(int argc, char **argv) {
15015     $nvtype d = 0.0;
15016     int fail = 0;
15017     fail += checkit(d, "0.0");
15018
15019     /* The compiler shouldn't be assuming that bletched is 0  */
15020     d = bletched;
15021
15022     fail += checkit(d, "bleched");
15023
15024 #ifdef SIGFPE
15025     signal(SIGFPE, blech);
15026 #endif
15027
15028     /* Paranoia - the compiler should have no way of knowing that ANSI says
15029        that argv[argc] will always be NULL.  Actually, if it did assume this it
15030        would be buggy, as this is C and main() can be called from elsewhere in
15031        the program.  */
15032     d = argv[argc] ? 1 : 0;
15033
15034     if (d) {
15035         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15036     }
15037
15038     fail += checkit(d, "ternary");
15039
15040     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15041
15042     if (d != 0.0) {
15043         printf("No - memset doesn't give 0.0\n");
15044         /* This might just blow up:  */
15045         printf("(gives %g)\n", d);
15046         return 1;
15047     }
15048     
15049 #ifdef SIGFPE
15050     if (bletched) {
15051         printf("No - something bleched\n");
15052         return 1;
15053     }
15054 #endif
15055     if (fail) {
15056       printf("No - %d fail(s)\n", fail);
15057       return 1;
15058     }
15059     printf("Yes\n");
15060     return 0;
15061 }
15062 EOP
15063 set try
15064
15065 d_nv_zero_is_allbits_zero="$undef"
15066 if eval $compile; then
15067     xxx="`$run ./try`"
15068     case "$?" in
15069         0)
15070             case "$xxx" in
15071                 Yes)  cat >&4 <<EOM
15072 0.0 is represented as all bits zero in memory
15073 EOM
15074                     d_nv_zero_is_allbits_zero="$define"
15075                     ;;
15076                 *)  cat >&4 <<EOM
15077 0.0 is not represented as all bits zero in memory
15078 EOM
15079                     d_nv_zero_is_allbits_zero="$undef"
15080                     ;;
15081             esac
15082             ;;
15083         *)  cat >&4 <<EOM
15084 0.0 is not represented as all bits zero in memory
15085 EOM
15086             d_nv_zero_is_allbits_zero="$undef"
15087             ;;
15088     esac
15089 fi
15090
15091 $rm -f try.* try
15092
15093
15094 : check for off64_t
15095 echo " "
15096 echo "Checking to see if you have off64_t..." >&4
15097 $cat >try.c <<EOCP
15098 #include <sys/types.h>
15099 #include <unistd.h>
15100 int main() { off64_t x = 7; }
15101 EOCP
15102 set try
15103 if eval $compile; then
15104         val="$define"
15105         echo "You have off64_t."
15106 else
15107         val="$undef"
15108         echo "You do not have off64_t."
15109         case "$lseeksize" in
15110         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15111         esac
15112 fi
15113 $rm -f try.* try
15114 set d_off64_t
15115 eval $setvar
15116
15117 : how to create joinable pthreads
15118 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15119         echo " "
15120         echo "Checking what constant to use for creating joinable pthreads..." >&4 
15121         $cat >try.c <<'EOCP'
15122 #include <pthread.h>
15123 int main() {
15124     int detachstate = JOINABLE;
15125 }
15126 EOCP
15127         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15128         if eval $compile; then
15129                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15130                 val="$undef" # Yes, undef.
15131                 set d_old_pthread_create_joinable
15132                 eval $setvar
15133                 val=""
15134                 set old_pthread_create_joinable
15135                 eval $setvar
15136         else
15137                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15138                 if eval $compile; then
15139                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15140                         val="$define"
15141                         set d_old_pthread_create_joinable
15142                         eval $setvar
15143                         val=PTHREAD_CREATE_UNDETACHED
15144                         set old_pthread_create_joinable
15145                         eval $setvar
15146                 else            
15147                         set try -DJOINABLE=__UNDETACHED
15148                         if eval $compile; then
15149                                 echo "You seem to use __UNDETACHED." >&4
15150                                 val="$define"
15151                                 set d_old_pthread_create_joinable
15152                                 eval $setvar
15153                                 val=__UNDETACHED
15154                                 set old_pthread_create_joinable
15155                                 eval $setvar
15156                         else
15157                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15158                                 val="$define"
15159                                 set d_old_pthread_create_joinable
15160                                 eval $setvar
15161                                 val=0
15162                                 set old_pthread_create_joinable
15163                                 eval $setvar
15164                         fi
15165                 fi
15166         fi
15167         $rm -f try try.*
15168 else
15169     d_old_pthread_create_joinable="$undef"
15170     old_pthread_create_joinable=""
15171 fi
15172
15173 : see if pause exists
15174 set pause d_pause
15175 eval $inlibc
15176
15177 : see if pipe exists
15178 set pipe d_pipe
15179 eval $inlibc
15180
15181 : see if poll exists
15182 set poll d_poll
15183 eval $inlibc
15184
15185 : see if readlink exists
15186 set readlink d_readlink
15187 eval $inlibc
15188
15189 echo " "
15190 procselfexe=''
15191 val="$undef"
15192 case "$d_readlink" in
15193 "$define")
15194         if $issymlink /proc/self/exe ; then
15195                 $ls -l /proc/self/exe > reflect
15196                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15197                         echo "You have Linux-like /proc/self/exe."
15198                         procselfexe='"/proc/self/exe"'
15199                         val="$define"
15200                 fi
15201         fi
15202         if $issymlink /proc/curproc/file ; then
15203                 $ls -l /proc/curproc/file > reflect
15204                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15205                         echo "You have BSD-like /proc/curproc/file."
15206                         procselfexe='"/proc/curproc/file"'
15207                         val="$define"
15208                 fi
15209         fi
15210         ;;
15211 esac
15212 $rm -f reflect
15213 set d_procselfexe
15214 eval $setvar
15215
15216 : see whether the pthread_atfork exists
15217 $cat >try.c <<EOP
15218 #include <pthread.h>
15219 #include <stdio.h>
15220 int main() {
15221 #ifdef  PTHREAD_ATFORK
15222         pthread_atfork(NULL,NULL,NULL);
15223 #endif
15224 }
15225 EOP
15226
15227 : see if pthread_atfork exists
15228 set try -DPTHREAD_ATFORK
15229 if eval $compile; then
15230     val="$define"
15231 else
15232     val="$undef"
15233 fi
15234 case "$usethreads" in
15235 $define)
15236         case "$val" in
15237         $define) echo 'pthread_atfork found.' >&4        ;;
15238         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15239         esac
15240 esac
15241 set d_pthread_atfork
15242 eval $setvar
15243
15244 : see if pthread_attr_setscope exists
15245 set pthread_attr_setscope d_pthread_attr_setscope
15246 eval $inlibc
15247
15248
15249 : see whether the various POSIXish _yields exist
15250 $cat >try.c <<EOP
15251 #include <pthread.h>
15252 #include <stdio.h>
15253 int main() {
15254 #ifdef SCHED_YIELD
15255         sched_yield();
15256 #else
15257 #ifdef PTHREAD_YIELD
15258         pthread_yield();
15259 #else
15260 #ifdef PTHREAD_YIELD_NULL
15261         pthread_yield(NULL);
15262 #endif
15263 #endif
15264 #endif
15265 }
15266 EOP
15267 : see if sched_yield exists
15268 set try -DSCHED_YIELD
15269 if eval $compile; then
15270     val="$define"
15271     sched_yield='sched_yield()'
15272 else
15273     val="$undef"
15274 fi
15275 case "$usethreads" in
15276 $define)
15277         case "$val" in
15278         $define) echo 'sched_yield() found.' >&4        ;;
15279         *)       echo 'sched_yield() NOT found.' >&4    ;;
15280         esac
15281 esac
15282 set d_sched_yield
15283 eval $setvar
15284
15285 : see if pthread_yield exists
15286 set try -DPTHREAD_YIELD
15287 if eval $compile; then
15288     val="$define"
15289     case "$sched_yield" in
15290     '') sched_yield='pthread_yield()' ;;
15291     esac
15292 else
15293     set try -DPTHREAD_YIELD_NULL
15294     if eval $compile; then
15295         val="$define"
15296         case "$sched_yield" in
15297         '') sched_yield='pthread_yield(NULL)' ;;
15298         esac
15299     else
15300         val="$undef"
15301     fi
15302 fi
15303 case "$usethreads" in
15304 $define)
15305         case "$val" in
15306         $define) echo 'pthread_yield() found.' >&4      ;;
15307         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15308         esac
15309         ;;
15310 esac
15311 set d_pthread_yield
15312 eval $setvar
15313
15314 case "$sched_yield" in
15315 '') sched_yield=undef ;;
15316 esac
15317
15318 $rm -f try try.*
15319
15320 : see if random_r exists
15321 set random_r d_random_r
15322 eval $inlibc
15323 case "$d_random_r" in
15324 "$define")
15325         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15326         case "$d_random_r_proto:$usethreads" in
15327         ":define")      d_random_r_proto=define
15328                 set d_random_r_proto random_r $hdrs
15329                 eval $hasproto ;;
15330         *)      ;;
15331         esac
15332         case "$d_random_r_proto" in
15333         define)
15334         case "$random_r_proto" in
15335         ''|0) try='int random_r(int*, struct random_data*);'
15336         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15337         esac
15338         case "$random_r_proto" in
15339         ''|0) try='int random_r(long*, struct random_data*);'
15340         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15341         esac
15342         case "$random_r_proto" in
15343         ''|0) try='int random_r(struct random_data*, int32_t*);'
15344         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15345         esac
15346         case "$random_r_proto" in
15347         ''|0)   d_random_r=undef
15348                 random_r_proto=0
15349                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
15350         * )     case "$random_r_proto" in
15351                 REENTRANT_PROTO*) ;;
15352                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15353                 esac
15354                 echo "Prototype: $try" ;;
15355         esac
15356         ;;
15357         *)      case "$usethreads" in
15358                 define) echo "random_r has no prototype, not using it." >&4 ;;
15359                 esac
15360                 d_random_r=undef
15361                 random_r_proto=0
15362                 ;;
15363         esac
15364         ;;
15365 *)      random_r_proto=0
15366         ;;
15367 esac
15368
15369 : see if readdir and friends exist
15370 set readdir d_readdir
15371 eval $inlibc
15372 set seekdir d_seekdir
15373 eval $inlibc
15374 set telldir d_telldir
15375 eval $inlibc
15376 set rewinddir d_rewinddir
15377 eval $inlibc
15378
15379 : see if readdir64_r exists
15380 set readdir64_r d_readdir64_r
15381 eval $inlibc
15382 case "$d_readdir64_r" in
15383 "$define")
15384         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15385         case "$d_readdir64_r_proto:$usethreads" in
15386         ":define")      d_readdir64_r_proto=define
15387                 set d_readdir64_r_proto readdir64_r $hdrs
15388                 eval $hasproto ;;
15389         *)      ;;
15390         esac
15391         case "$d_readdir64_r_proto" in
15392         define)
15393         case "$readdir64_r_proto" in
15394         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15395         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15396         esac
15397         case "$readdir64_r_proto" in
15398         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15399         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15400         esac
15401         case "$readdir64_r_proto" in
15402         ''|0)   d_readdir64_r=undef
15403                 readdir64_r_proto=0
15404                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
15405         * )     case "$readdir64_r_proto" in
15406                 REENTRANT_PROTO*) ;;
15407                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15408                 esac
15409                 echo "Prototype: $try" ;;
15410         esac
15411         ;;
15412         *)      case "$usethreads" in
15413                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15414                 esac
15415                 d_readdir64_r=undef
15416                 readdir64_r_proto=0
15417                 ;;
15418         esac
15419         ;;
15420 *)      readdir64_r_proto=0
15421         ;;
15422 esac
15423
15424 : see if readdir_r exists
15425 set readdir_r d_readdir_r
15426 eval $inlibc
15427 case "$d_readdir_r" in
15428 "$define")
15429         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15430         case "$d_readdir_r_proto:$usethreads" in
15431         ":define")      d_readdir_r_proto=define
15432                 set d_readdir_r_proto readdir_r $hdrs
15433                 eval $hasproto ;;
15434         *)      ;;
15435         esac
15436         case "$d_readdir_r_proto" in
15437         define)
15438         case "$readdir_r_proto" in
15439         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15440         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15441         esac
15442         case "$readdir_r_proto" in
15443         ''|0) try='int readdir_r(DIR*, struct dirent*);'
15444         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15445         esac
15446         case "$readdir_r_proto" in
15447         ''|0)   d_readdir_r=undef
15448                 readdir_r_proto=0
15449                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
15450         * )     case "$readdir_r_proto" in
15451                 REENTRANT_PROTO*) ;;
15452                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15453                 esac
15454                 echo "Prototype: $try" ;;
15455         esac
15456         ;;
15457         *)      case "$usethreads" in
15458                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15459                 esac
15460                 d_readdir_r=undef
15461                 readdir_r_proto=0
15462                 ;;
15463         esac
15464         ;;
15465 *)      readdir_r_proto=0
15466         ;;
15467 esac
15468
15469 : see if readv exists
15470 set readv d_readv
15471 eval $inlibc
15472
15473 : see if recvmsg exists
15474 set recvmsg d_recvmsg
15475 eval $inlibc
15476
15477 : see if rename exists
15478 set rename d_rename
15479 eval $inlibc
15480
15481 : see if rmdir exists
15482 set rmdir d_rmdir
15483 eval $inlibc
15484
15485 : see if memory.h is available.
15486 val=''
15487 set memory.h val
15488 eval $inhdr
15489
15490 : See if it conflicts with string.h
15491 case "$val" in
15492 $define)
15493         case "$strings" in
15494         '') ;;
15495         *)
15496                 $cppstdin $cppflags $cppminus < $strings > mem.h
15497                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15498                         echo " "
15499                         echo "We won't be including <memory.h>."
15500                         val="$undef"
15501                 fi
15502                 $rm -f mem.h
15503                 ;;
15504         esac
15505 esac
15506 set i_memory
15507 eval $setvar
15508
15509 : can bcopy handle overlapping blocks?
15510 echo " "
15511 val="$undef"
15512 case "$d_memmove" in
15513 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15514 *)      case "$d_bcopy" in
15515         "$define")
15516                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15517                 $cat >try.c <<EOCP
15518 #$i_memory I_MEMORY
15519 #$i_stdlib I_STDLIB
15520 #$i_string I_STRING
15521 #$i_unistd I_UNISTD
15522 EOCP
15523         $cat >>try.c <<'EOCP'
15524 #include <stdio.h>
15525 #ifdef I_MEMORY
15526 #  include <memory.h>
15527 #endif
15528 #ifdef I_STDLIB
15529 #  include <stdlib.h>
15530 #endif
15531 #ifdef I_STRING
15532 #  include <string.h>
15533 #else
15534 #  include <strings.h>
15535 #endif
15536 #ifdef I_UNISTD
15537 #  include <unistd.h>  /* Needed for NetBSD */
15538 #endif
15539 int main()
15540 {
15541 char buf[128], abc[128];
15542 char *b;
15543 int len;
15544 int off;
15545 int align;
15546
15547 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15548    try to store the string in read-only memory. */
15549 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15550
15551 for (align = 7; align >= 0; align--) {
15552         for (len = 36; len; len--) {
15553                 b = buf+align;
15554                 bcopy(abc, b, len);
15555                 for (off = 1; off <= len; off++) {
15556                         bcopy(b, b+off, len);
15557                         bcopy(b+off, b, len);
15558                         if (bcmp(b, abc, len))
15559                                 exit(1);
15560                 }
15561         }
15562 }
15563 exit(0);
15564 }
15565 EOCP
15566                 set try
15567                 if eval $compile_ok; then
15568                         if ./try 2>/dev/null; then
15569                                 echo "Yes, it can."
15570                                 val="$define"
15571                         else
15572                                 echo "It can't, sorry."
15573                         fi
15574                 else
15575                         echo "(I can't compile the test program, so we'll assume not...)"
15576                 fi
15577                 ;;
15578         esac
15579         $rm -f try.* try core
15580         ;;
15581 esac
15582 set d_safebcpy
15583 eval $setvar
15584
15585 : can memcpy handle overlapping blocks?
15586 echo " "
15587 val="$undef"
15588 case "$d_memmove" in
15589 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15590 *)      case "$d_memcpy" in
15591         "$define")
15592                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
15593                 $cat >try.c <<EOCP
15594 #$i_memory I_MEMORY
15595 #$i_stdlib I_STDLIB
15596 #$i_string I_STRING
15597 #$i_unistd I_UNISTD
15598 EOCP
15599         $cat >>try.c <<'EOCP'
15600 #include <stdio.h>
15601 #ifdef I_MEMORY
15602 #  include <memory.h>
15603 #endif
15604 #ifdef I_STDLIB
15605 #  include <stdlib.h>
15606 #endif
15607 #ifdef I_STRING
15608 #  include <string.h>
15609 #else
15610 #  include <strings.h>
15611 #endif
15612 #ifdef I_UNISTD
15613 #  include <unistd.h>  /* Needed for NetBSD */
15614 #endif
15615 int main()
15616 {
15617 char buf[128], abc[128];
15618 char *b;
15619 int len;
15620 int off;
15621 int align;
15622
15623 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15624    try to store the string in read-only memory. */
15625 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
15626
15627 for (align = 7; align >= 0; align--) {
15628         for (len = 36; len; len--) {
15629                 b = buf+align;
15630                 memcpy(b, abc, len);
15631                 for (off = 1; off <= len; off++) {
15632                         memcpy(b+off, b, len);
15633                         memcpy(b, b+off, len);
15634                         if (memcmp(b, abc, len))
15635                                 exit(1);
15636                 }
15637         }
15638 }
15639 exit(0);
15640 }
15641 EOCP
15642                 set try
15643                 if eval $compile_ok; then
15644                         if ./try 2>/dev/null; then
15645                                 echo "Yes, it can."
15646                                 val="$define"
15647                         else
15648                                 echo "It can't, sorry."
15649                         fi
15650                 else
15651                         echo "(I can't compile the test program, so we'll assume not...)"
15652                 fi
15653                 ;;
15654         esac
15655         $rm -f try.* try core
15656         ;;
15657 esac
15658 set d_safemcpy
15659 eval $setvar
15660
15661 : can memcmp be trusted to compare relative magnitude?
15662 val="$undef"
15663 case "$d_memcmp" in
15664 "$define")
15665         echo " "
15666         echo "Checking if your memcmp() can compare relative magnitude..." >&4
15667         $cat >try.c <<EOCP
15668 #$i_memory I_MEMORY
15669 #$i_stdlib I_STDLIB
15670 #$i_string I_STRING
15671 #$i_unistd I_UNISTD
15672 EOCP
15673         $cat >>try.c <<'EOCP'
15674 #include <stdio.h>
15675 #ifdef I_MEMORY
15676 #  include <memory.h>
15677 #endif
15678 #ifdef I_STDLIB
15679 #  include <stdlib.h>
15680 #endif
15681 #ifdef I_STRING
15682 #  include <string.h>
15683 #else
15684 #  include <strings.h>
15685 #endif
15686 #ifdef I_UNISTD
15687 #  include <unistd.h>  /* Needed for NetBSD */
15688 #endif
15689 int main()
15690 {
15691 char a = -1;
15692 char b = 0;
15693 if ((a < b) && memcmp(&a, &b, 1) < 0)
15694         exit(1);
15695 exit(0);
15696 }
15697 EOCP
15698         set try
15699         if eval $compile_ok; then
15700                 if $run ./try 2>/dev/null; then
15701                         echo "Yes, it can."
15702                         val="$define"
15703                 else
15704                         echo "No, it can't (it uses signed chars)."
15705                 fi
15706         else
15707                 echo "(I can't compile the test program, so we'll assume not...)"
15708         fi
15709         ;;
15710 esac
15711 $rm -f try.* try core
15712 set d_sanemcmp
15713 eval $setvar
15714
15715 : see if prototype for sbrk is available
15716 echo " "
15717 set d_sbrkproto sbrk $i_unistd unistd.h
15718 eval $hasproto
15719
15720 : see if select exists
15721 set select d_select
15722 eval $inlibc
15723
15724 : see if semctl exists
15725 set semctl d_semctl
15726 eval $inlibc
15727
15728 : see if semget exists
15729 set semget d_semget
15730 eval $inlibc
15731
15732 : see if semop exists
15733 set semop d_semop
15734 eval $inlibc
15735
15736 : see how much of the 'sem*(2)' library is present.
15737 h_sem=true
15738 echo " "
15739 case "$d_semctl$d_semget$d_semop" in
15740 *"$undef"*) h_sem=false;;
15741 esac
15742 case "$osname" in
15743 freebsd)
15744     case "`ipcs 2>&1`" in
15745     "SVID messages"*"not configured"*)
15746         echo "Your $osname does not have the sem*(2) configured." >&4
15747         h_sem=false
15748         val="$undef"
15749         set semctl d_semctl
15750         eval $setvar
15751         set semget d_semget
15752         eval $setvar
15753         set semop d_semop
15754         eval $setvar
15755         ;;
15756     esac
15757     ;;
15758 esac
15759 : we could also check for sys/ipc.h ...
15760 if $h_sem && $test `./findhdr sys/sem.h`; then
15761         echo "You have the full sem*(2) library." >&4
15762         val="$define"
15763 else
15764         echo "You don't have the full sem*(2) library." >&4
15765         val="$undef"
15766 fi
15767 set d_sem
15768 eval $setvar
15769
15770 : see whether sys/sem.h defines union semun
15771 echo " "
15772 $cat > try.c <<'END'
15773 #include <sys/types.h>
15774 #include <sys/ipc.h>
15775 #include <sys/sem.h>
15776 int main () { union semun semun; semun.buf = 0; }
15777 END
15778 set try
15779 if eval $compile; then
15780     echo "You have union semun in <sys/sem.h>." >&4
15781     val="$define"
15782 else
15783     echo "You do not have union semun in <sys/sem.h>." >&4
15784     val="$undef"
15785 fi
15786 $rm -f try try.c
15787 set d_union_semun
15788 eval $setvar
15789
15790 : see how to do semctl IPC_STAT
15791 case "$d_sem" in
15792 $define)
15793     echo " "
15794     $cat > try.h <<END
15795 #ifndef S_IRUSR
15796 #   ifdef S_IREAD
15797 #       define S_IRUSR S_IREAD
15798 #       define S_IWUSR S_IWRITE
15799 #       define S_IXUSR S_IEXEC
15800 #   else
15801 #       define S_IRUSR 0400
15802 #       define S_IWUSR 0200
15803 #       define S_IXUSR 0100
15804 #   endif
15805 #   define S_IRGRP (S_IRUSR>>3)
15806 #   define S_IWGRP (S_IWUSR>>3)
15807 #   define S_IXGRP (S_IXUSR>>3)
15808 #   define S_IROTH (S_IRUSR>>6)
15809 #   define S_IWOTH (S_IWUSR>>6)
15810 #   define S_IXOTH (S_IXUSR>>6)
15811 #endif
15812 #ifndef S_IRWXU
15813 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
15814 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
15815 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
15816 #endif
15817 END
15818     : see whether semctl IPC_STAT can use union semun
15819     case "$d_semctl_semun" in
15820     '')
15821       val="$undef"
15822       $cat > try.c <<END
15823 #include <sys/types.h>
15824 #include <sys/ipc.h>
15825 #include <sys/sem.h>
15826 #include <sys/stat.h>
15827 #include <stdio.h>
15828 #include <errno.h>
15829 #include "try.h"
15830 #ifndef errno
15831 extern int errno;
15832 #endif
15833 #$d_union_semun HAS_UNION_SEMUN
15834 int main() {
15835     union semun
15836 #ifndef HAS_UNION_SEMUN
15837     {
15838         int val;
15839         struct semid_ds *buf;
15840         unsigned short *array;
15841     }
15842 #endif
15843     arg;
15844     int sem, st;
15845
15846 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
15847     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15848     if (sem > -1) {
15849         struct semid_ds argbuf;
15850         arg.buf = &argbuf;
15851 #       ifdef IPC_STAT
15852         st = semctl(sem, 0, IPC_STAT, arg);
15853         if (st == 0)
15854             printf("semun\n");
15855         else
15856 #       endif /* IPC_STAT */
15857             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15858 #       ifdef IPC_RMID
15859         if (semctl(sem, 0, IPC_RMID, arg) != 0)
15860 #       endif /* IPC_RMID */
15861             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15862     } else
15863 #endif /* IPC_PRIVATE && ... */
15864         printf("semget failed: errno = %d\n", errno);
15865   return 0;
15866 }
15867 END
15868       set try
15869       if eval $compile; then
15870           xxx=`$run ./try`
15871           case "$xxx" in
15872           semun) val="$define" ;;
15873           esac
15874       fi
15875       $rm -f try try.c
15876       set d_semctl_semun
15877       eval $setvar
15878       ;;
15879     esac
15880     case "$d_semctl_semun" in
15881     $define)
15882         echo "You can use union semun for semctl IPC_STAT." >&4
15883         also='also'
15884         ;;
15885     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
15886         also=''
15887         ;;
15888     esac
15889
15890     : see whether semctl IPC_STAT can use struct semid_ds pointer
15891     case "$d_semctl_semid_ds" in
15892     '')
15893       val="$undef"
15894       $cat > try.c <<'END'
15895 #include <sys/types.h>
15896 #include <sys/ipc.h>
15897 #include <sys/sem.h>
15898 #include <sys/stat.h>
15899 #include "try.h"
15900 #include <stdio.h>
15901 #include <errno.h>
15902 #ifndef errno
15903 extern int errno;
15904 #endif
15905 int main() {
15906     struct semid_ds arg;
15907     int sem, st;
15908
15909 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
15910     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15911     if (sem > -1) {
15912 #       ifdef IPC_STAT
15913         st = semctl(sem, 0, IPC_STAT, &arg);
15914         if (st == 0)
15915             printf("semid_ds\n");
15916         else
15917 #       endif /* IPC_STAT */
15918             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15919 #       ifdef IPC_RMID
15920         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
15921 #       endif /* IPC_RMID */
15922             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15923     } else
15924 #endif /* IPC_PRIVATE && ... */
15925         printf("semget failed: errno = %d\n", errno);
15926
15927     return 0;
15928 }
15929 END
15930       set try
15931       if eval $compile; then
15932           xxx=`$run ./try`
15933           case "$xxx" in
15934           semid_ds) val="$define" ;;
15935           esac
15936       fi
15937       $rm -f try try.c
15938       set d_semctl_semid_ds
15939       eval $setvar
15940       ;;
15941     esac
15942     case "$d_semctl_semid_ds" in
15943     $define)
15944         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
15945         ;;
15946     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
15947         ;;
15948     esac
15949     $rm -f try.h
15950     ;;
15951 *)  val="$undef"
15952
15953     # We do not have the full sem*(2) library, so assume we can not
15954     # use either.
15955
15956     set d_semctl_semun
15957     eval $setvar
15958
15959     set d_semctl_semid_ds
15960     eval $setvar
15961     ;;
15962 esac
15963
15964 : see if sendmsg exists
15965 set sendmsg d_sendmsg
15966 eval $inlibc
15967
15968 : see if setegid exists
15969 set setegid d_setegid
15970 eval $inlibc
15971
15972 : see if seteuid exists
15973 set seteuid d_seteuid
15974 eval $inlibc
15975
15976 : see if setgrent exists
15977 set setgrent d_setgrent
15978 eval $inlibc
15979
15980 : see if setgrent_r exists
15981 set setgrent_r d_setgrent_r
15982 eval $inlibc
15983 case "$d_setgrent_r" in
15984 "$define")
15985         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
15986         case "$d_setgrent_r_proto:$usethreads" in
15987         ":define")      d_setgrent_r_proto=define
15988                 set d_setgrent_r_proto setgrent_r $hdrs
15989                 eval $hasproto ;;
15990         *)      ;;
15991         esac
15992         case "$d_setgrent_r_proto" in
15993         define)
15994         case "$setgrent_r_proto" in
15995         ''|0) try='int setgrent_r(FILE**);'
15996         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
15997         esac
15998         case "$setgrent_r_proto" in
15999         ''|0) try='void setgrent_r(FILE**);'
16000         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
16001         esac
16002         case "$setgrent_r_proto" in
16003         ''|0)   d_setgrent_r=undef
16004                 setgrent_r_proto=0
16005                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16006         * )     case "$setgrent_r_proto" in
16007                 REENTRANT_PROTO*) ;;
16008                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16009                 esac
16010                 echo "Prototype: $try" ;;
16011         esac
16012         ;;
16013         *)      case "$usethreads" in
16014                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16015                 esac
16016                 d_setgrent_r=undef
16017                 setgrent_r_proto=0
16018                 ;;
16019         esac
16020         ;;
16021 *)      setgrent_r_proto=0
16022         ;;
16023 esac
16024
16025 : see if sethostent exists
16026 set sethostent d_sethent
16027 eval $inlibc
16028
16029 : see if sethostent_r exists
16030 set sethostent_r d_sethostent_r
16031 eval $inlibc
16032 case "$d_sethostent_r" in
16033 "$define")
16034         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16035         case "$d_sethostent_r_proto:$usethreads" in
16036         ":define")      d_sethostent_r_proto=define
16037                 set d_sethostent_r_proto sethostent_r $hdrs
16038                 eval $hasproto ;;
16039         *)      ;;
16040         esac
16041         case "$d_sethostent_r_proto" in
16042         define)
16043         case "$sethostent_r_proto" in
16044         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16045         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16046         esac
16047         case "$sethostent_r_proto" in
16048         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16049         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16050         esac
16051         case "$sethostent_r_proto" in
16052         ''|0)   d_sethostent_r=undef
16053                 sethostent_r_proto=0
16054                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16055         * )     case "$sethostent_r_proto" in
16056                 REENTRANT_PROTO*) ;;
16057                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16058                 esac
16059                 echo "Prototype: $try" ;;
16060         esac
16061         ;;
16062         *)      case "$usethreads" in
16063                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16064                 esac
16065                 d_sethostent_r=undef
16066                 sethostent_r_proto=0
16067                 ;;
16068         esac
16069         ;;
16070 *)      sethostent_r_proto=0
16071         ;;
16072 esac
16073
16074 : see if setitimer exists
16075 set setitimer d_setitimer
16076 eval $inlibc
16077
16078 : see if setlinebuf exists
16079 set setlinebuf d_setlinebuf
16080 eval $inlibc
16081
16082 : see if setlocale exists
16083 set setlocale d_setlocale
16084 eval $inlibc
16085
16086 : see if locale.h is available
16087 set locale.h i_locale
16088 eval $inhdr
16089
16090 : see if setlocale_r exists
16091 set setlocale_r d_setlocale_r
16092 eval $inlibc
16093 case "$d_setlocale_r" in
16094 "$define")
16095         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16096         case "$d_setlocale_r_proto:$usethreads" in
16097         ":define")      d_setlocale_r_proto=define
16098                 set d_setlocale_r_proto setlocale_r $hdrs
16099                 eval $hasproto ;;
16100         *)      ;;
16101         esac
16102         case "$d_setlocale_r_proto" in
16103         define)
16104         case "$setlocale_r_proto" in
16105         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16106         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16107         esac
16108         case "$setlocale_r_proto" in
16109         ''|0)   d_setlocale_r=undef
16110                 setlocale_r_proto=0
16111                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16112         * )     case "$setlocale_r_proto" in
16113                 REENTRANT_PROTO*) ;;
16114                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16115                 esac
16116                 echo "Prototype: $try" ;;
16117         esac
16118         ;;
16119         *)      case "$usethreads" in
16120                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16121                 esac
16122                 d_setlocale_r=undef
16123                 setlocale_r_proto=0
16124                 ;;
16125         esac
16126         ;;
16127 *)      setlocale_r_proto=0
16128         ;;
16129 esac
16130
16131 : see if setnetent exists
16132 set setnetent d_setnent
16133 eval $inlibc
16134
16135 : see if setnetent_r exists
16136 set setnetent_r d_setnetent_r
16137 eval $inlibc
16138 case "$d_setnetent_r" in
16139 "$define")
16140         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16141         case "$d_setnetent_r_proto:$usethreads" in
16142         ":define")      d_setnetent_r_proto=define
16143                 set d_setnetent_r_proto setnetent_r $hdrs
16144                 eval $hasproto ;;
16145         *)      ;;
16146         esac
16147         case "$d_setnetent_r_proto" in
16148         define)
16149         case "$setnetent_r_proto" in
16150         ''|0) try='int setnetent_r(int, struct netent_data*);'
16151         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16152         esac
16153         case "$setnetent_r_proto" in
16154         ''|0) try='void setnetent_r(int, struct netent_data*);'
16155         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16156         esac
16157         case "$setnetent_r_proto" in
16158         ''|0)   d_setnetent_r=undef
16159                 setnetent_r_proto=0
16160                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16161         * )     case "$setnetent_r_proto" in
16162                 REENTRANT_PROTO*) ;;
16163                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16164                 esac
16165                 echo "Prototype: $try" ;;
16166         esac
16167         ;;
16168         *)      case "$usethreads" in
16169                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16170                 esac
16171                 d_setnetent_r=undef
16172                 setnetent_r_proto=0
16173                 ;;
16174         esac
16175         ;;
16176 *)      setnetent_r_proto=0
16177         ;;
16178 esac
16179
16180 : see if setprotoent exists
16181 set setprotoent d_setpent
16182 eval $inlibc
16183
16184 : see if setpgid exists
16185 set setpgid d_setpgid
16186 eval $inlibc
16187
16188 : see if setpgrp2 exists
16189 set setpgrp2 d_setpgrp2
16190 eval $inlibc
16191
16192 : see if setpriority exists
16193 set setpriority d_setprior
16194 eval $inlibc
16195
16196 : see if setproctitle exists
16197 set setproctitle d_setproctitle
16198 eval $inlibc
16199
16200 : see if setprotoent_r exists
16201 set setprotoent_r d_setprotoent_r
16202 eval $inlibc
16203 case "$d_setprotoent_r" in
16204 "$define")
16205         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16206         case "$d_setprotoent_r_proto:$usethreads" in
16207         ":define")      d_setprotoent_r_proto=define
16208                 set d_setprotoent_r_proto setprotoent_r $hdrs
16209                 eval $hasproto ;;
16210         *)      ;;
16211         esac
16212         case "$d_setprotoent_r_proto" in
16213         define)
16214         case "$setprotoent_r_proto" in
16215         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16216         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16217         esac
16218         case "$setprotoent_r_proto" in
16219         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16220         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16221         esac
16222         case "$setprotoent_r_proto" in
16223         ''|0)   d_setprotoent_r=undef
16224                 setprotoent_r_proto=0
16225                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16226         * )     case "$setprotoent_r_proto" in
16227                 REENTRANT_PROTO*) ;;
16228                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16229                 esac
16230                 echo "Prototype: $try" ;;
16231         esac
16232         ;;
16233         *)      case "$usethreads" in
16234                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16235                 esac
16236                 d_setprotoent_r=undef
16237                 setprotoent_r_proto=0
16238                 ;;
16239         esac
16240         ;;
16241 *)      setprotoent_r_proto=0
16242         ;;
16243 esac
16244
16245 : see if setpwent exists
16246 set setpwent d_setpwent
16247 eval $inlibc
16248
16249 : see if setpwent_r exists
16250 set setpwent_r d_setpwent_r
16251 eval $inlibc
16252 case "$d_setpwent_r" in
16253 "$define")
16254         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16255         case "$d_setpwent_r_proto:$usethreads" in
16256         ":define")      d_setpwent_r_proto=define
16257                 set d_setpwent_r_proto setpwent_r $hdrs
16258                 eval $hasproto ;;
16259         *)      ;;
16260         esac
16261         case "$d_setpwent_r_proto" in
16262         define)
16263         case "$setpwent_r_proto" in
16264         ''|0) try='int setpwent_r(FILE**);'
16265         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16266         esac
16267         case "$setpwent_r_proto" in
16268         ''|0) try='void setpwent_r(FILE**);'
16269         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16270         esac
16271         case "$setpwent_r_proto" in
16272         ''|0)   d_setpwent_r=undef
16273                 setpwent_r_proto=0
16274                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16275         * )     case "$setpwent_r_proto" in
16276                 REENTRANT_PROTO*) ;;
16277                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16278                 esac
16279                 echo "Prototype: $try" ;;
16280         esac
16281         ;;
16282         *)      case "$usethreads" in
16283                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16284                 esac
16285                 d_setpwent_r=undef
16286                 setpwent_r_proto=0
16287                 ;;
16288         esac
16289         ;;
16290 *)      setpwent_r_proto=0
16291         ;;
16292 esac
16293
16294 : see if setregid exists
16295 set setregid d_setregid
16296 eval $inlibc
16297 set setresgid d_setresgid
16298 eval $inlibc
16299
16300 : see if setreuid exists
16301 set setreuid d_setreuid
16302 eval $inlibc
16303 set setresuid d_setresuid
16304 eval $inlibc
16305
16306 : see if setrgid exists
16307 set setrgid d_setrgid
16308 eval $inlibc
16309
16310 : see if setruid exists
16311 set setruid d_setruid
16312 eval $inlibc
16313
16314 : see if setservent exists
16315 set setservent d_setsent
16316 eval $inlibc
16317
16318 : see if setservent_r exists
16319 set setservent_r d_setservent_r
16320 eval $inlibc
16321 case "$d_setservent_r" in
16322 "$define")
16323         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16324         case "$d_setservent_r_proto:$usethreads" in
16325         ":define")      d_setservent_r_proto=define
16326                 set d_setservent_r_proto setservent_r $hdrs
16327                 eval $hasproto ;;
16328         *)      ;;
16329         esac
16330         case "$d_setservent_r_proto" in
16331         define)
16332         case "$setservent_r_proto" in
16333         ''|0) try='int setservent_r(int, struct servent_data*);'
16334         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16335         esac
16336         case "$setservent_r_proto" in
16337         ''|0) try='void setservent_r(int, struct servent_data*);'
16338         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16339         esac
16340         case "$setservent_r_proto" in
16341         ''|0)   d_setservent_r=undef
16342                 setservent_r_proto=0
16343                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16344         * )     case "$setservent_r_proto" in
16345                 REENTRANT_PROTO*) ;;
16346                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16347                 esac
16348                 echo "Prototype: $try" ;;
16349         esac
16350         ;;
16351         *)      case "$usethreads" in
16352                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16353                 esac
16354                 d_setservent_r=undef
16355                 setservent_r_proto=0
16356                 ;;
16357         esac
16358         ;;
16359 *)      setservent_r_proto=0
16360         ;;
16361 esac
16362
16363 : see if setsid exists
16364 set setsid d_setsid
16365 eval $inlibc
16366
16367 : see if setvbuf exists
16368 set setvbuf d_setvbuf
16369 eval $inlibc
16370
16371 : see if sfio.h is available
16372 set sfio.h i_sfio
16373 eval $inhdr
16374
16375
16376 : see if sfio library is available
16377 case "$i_sfio" in
16378 $define)
16379         val=''
16380         set sfreserve val
16381         eval $inlibc
16382         ;;
16383 *)
16384         val="$undef"
16385         ;;
16386 esac
16387 : Ok, but do we want to use it.
16388 case "$val" in
16389 $define)
16390         case "$usesfio" in
16391         true|$define|[yY]*) dflt='y';;
16392         *) dflt='n';;
16393         esac
16394         echo "$package can use the sfio library, but it is experimental."
16395         case "$useperlio" in
16396         "$undef")
16397             echo "For sfio also the PerlIO abstraction layer is needed."
16398             echo "Earlier you said you wouldn't want that."
16399             ;;
16400         esac
16401         rp="You seem to have sfio available, do you want to try using it?"
16402         . ./myread
16403         case "$ans" in
16404         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
16405                 useperlio="$define"
16406                 val="$define"
16407                 ;;
16408         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
16409                 val="$undef"
16410                 ;;
16411         esac
16412         ;;
16413 *)      case "$usesfio" in
16414         true|$define|[yY]*)
16415                 echo "Sorry, cannot find sfio on this machine." >&4
16416                 echo "Ignoring your setting of usesfio=$usesfio." >&4
16417                 val="$undef"
16418                 ;;
16419         esac
16420         ;;
16421 esac
16422 set d_sfio
16423 eval $setvar
16424 case "$d_sfio" in
16425 $define) usesfio='true';;
16426 *) usesfio='false';;
16427 esac
16428 case "$d_sfio" in
16429 $define) ;;
16430 *)      : Remove sfio from list of libraries to use
16431         case "$libs" in
16432         *-lsfio*)
16433                 echo "Removing unneeded -lsfio from library list" >&4
16434                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16435                 shift
16436                 libs="$*"
16437                 echo "libs = $libs" >&4
16438                 ;;
16439         esac
16440 ;;
16441 esac
16442
16443
16444 : see if shmctl exists
16445 set shmctl d_shmctl
16446 eval $inlibc
16447
16448 : see if shmget exists
16449 set shmget d_shmget
16450 eval $inlibc
16451
16452 : see if shmat exists
16453 set shmat d_shmat
16454 eval $inlibc
16455 : see what shmat returns
16456 case "$d_shmat" in
16457 "$define")
16458         $cat >shmat.c <<'END'
16459 #include <sys/shm.h>
16460 void *shmat();
16461 END
16462         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16463                 shmattype='void *'
16464         else
16465                 shmattype='char *'
16466         fi
16467         echo "and it returns ($shmattype)." >&4
16468         : see if a prototype for shmat is available
16469         xxx=`./findhdr sys/shm.h`
16470         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16471         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16472                 val="$define"
16473         else
16474                 val="$undef"
16475         fi
16476         $rm -f shmat.[co]
16477         ;;
16478 *)
16479         val="$undef"
16480         ;;
16481 esac
16482 set d_shmatprototype
16483 eval $setvar
16484
16485 : see if shmdt exists
16486 set shmdt d_shmdt
16487 eval $inlibc
16488
16489 : see how much of the 'shm*(2)' library is present.
16490 h_shm=true
16491 echo " "
16492 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16493 *"$undef"*) h_shm=false;;
16494 esac
16495 case "$osname" in
16496 freebsd)
16497     case "`ipcs 2>&1`" in
16498     "SVID shared memory"*"not configured"*)
16499         echo "Your $osname does not have the shm*(2) configured." >&4
16500         h_shm=false
16501         val="$undef"
16502         set shmctl d_shmctl
16503         evat $setvar
16504         set shmget d_shmget
16505         evat $setvar
16506         set shmat d_shmat
16507         evat $setvar
16508         set shmdt d_shmdt
16509         evat $setvar
16510         ;;
16511     esac
16512     ;;
16513 esac
16514 : we could also check for sys/ipc.h ...
16515 if $h_shm && $test `./findhdr sys/shm.h`; then
16516         echo "You have the full shm*(2) library." >&4
16517         val="$define"
16518 else
16519         echo "You don't have the full shm*(2) library." >&4
16520         val="$undef"
16521 fi
16522 set d_shm
16523 eval $setvar
16524
16525 echo " "
16526 : see if we have sigaction
16527 if set sigaction val -f d_sigaction; eval $csym; $val; then
16528         echo 'sigaction() found.' >&4
16529         $cat > try.c <<EOP
16530 #include <stdio.h>
16531 #include <sys/types.h>
16532 #include <signal.h>
16533 #$i_stdlib I_STDLIB
16534 #ifdef I_STDLIB
16535 #include <stdlib.h>
16536 #endif
16537 int main()
16538 {
16539     struct sigaction act, oact;
16540     act.sa_flags = 0;
16541     oact.sa_handler = 0;
16542     /* so that act and oact are used */
16543     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
16544 }
16545 EOP
16546         set try
16547         if eval $compile_ok; then
16548                 val="$define"
16549         else
16550                 echo "But you don't seem to have a useable struct sigaction." >&4
16551                 val="$undef"
16552         fi
16553 else
16554         echo 'sigaction NOT found.' >&4
16555         val="$undef"
16556 fi
16557 set d_sigaction; eval $setvar
16558 $rm -f try try$_o try.c
16559
16560 : see if sigprocmask exists
16561 set sigprocmask d_sigprocmask
16562 eval $inlibc
16563
16564 : see if sigsetjmp exists
16565 echo " "
16566 case "$d_sigsetjmp" in
16567 '')
16568         $cat >try.c <<EOP
16569 #include <setjmp.h>
16570 #$i_stdlib I_STDLIB
16571 #ifdef I_STDLIB
16572 #include <stdlib.h>
16573 #endif
16574 sigjmp_buf env;
16575 int set = 1;
16576 int main()
16577 {
16578         if (sigsetjmp(env,1))
16579                 exit(set);
16580         set = 0;
16581         siglongjmp(env, 1);
16582         exit(1);
16583 }
16584 EOP
16585         set try
16586         if eval $compile; then
16587                 if $run ./try >/dev/null 2>&1; then
16588                         echo "POSIX sigsetjmp found." >&4
16589                         val="$define"
16590                 else
16591                         $cat >&4 <<EOM
16592 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
16593 I'll ignore them.
16594 EOM
16595                         val="$undef"
16596                 fi
16597         else
16598                 echo "sigsetjmp not found." >&4
16599                 val="$undef"
16600         fi
16601         ;;
16602 *) val="$d_sigsetjmp"
16603         case "$d_sigsetjmp" in
16604         $define) echo "POSIX sigsetjmp found." >&4;;
16605         $undef) echo "sigsetjmp not found." >&4;;
16606         esac
16607         ;;
16608 esac
16609 set d_sigsetjmp
16610 eval $setvar
16611 $rm -f try.c try
16612
16613 : see if snprintf exists
16614 set snprintf d_snprintf
16615 eval $inlibc
16616
16617 : see if vsnprintf exists
16618 set vsnprintf d_vsnprintf
16619 eval $inlibc
16620
16621 case "$d_snprintf-$d_vsnprintf" in
16622 "$define-$define")
16623     $cat <<EOM
16624 Checking whether your snprintf() and vsnprintf() work okay...
16625 EOM
16626     $cat >try.c <<'EOCP'
16627 /* v?snprintf testing logic courtesy of Russ Allbery.
16628  * According to C99:
16629  * - if the buffer is too short it still must be \0-terminated
16630  * - if the buffer is too short the potentially required length
16631  *   must be returned and not -1
16632  * - if the buffer is NULL the potentially required length
16633  *   must be returned and not -1 or core dump
16634  */
16635 #include <stdio.h>
16636 #include <stdarg.h>
16637
16638 char buf[2];
16639
16640 int test (char *format, ...)
16641 {
16642     va_list args;
16643     int count;
16644
16645     va_start (args, format);
16646     count = vsnprintf (buf, sizeof buf, format, args);
16647     va_end (args);
16648     return count;
16649 }
16650
16651 int main ()
16652 {
16653     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
16654              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
16655 }
16656 EOCP
16657     set try
16658     if eval $compile; then
16659         `$run ./try`
16660         case "$?" in
16661         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
16662         *) cat <<EOM >&4
16663 Your snprintf() and snprintf() don't seem to be working okay.
16664 EOM
16665            d_snprintf="$undef"
16666            d_vsnprintf="$undef"
16667            ;;
16668         esac
16669     else
16670         echo "(I can't seem to compile the test program--assuming they don't)"
16671         d_snprintf="$undef"
16672         d_vsnprintf="$undef"
16673     fi
16674     $rm -f try.* try core core.try.*
16675     ;;
16676 esac
16677
16678 : see if sockatmark exists
16679 set sockatmark d_sockatmark
16680 eval $inlibc
16681
16682 : see if prototype for sockatmark is available
16683 echo " "
16684 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
16685 eval $hasproto
16686
16687 : see if socks5_init exists
16688 set socks5_init d_socks5_init
16689 eval $inlibc
16690
16691 : see if sprintf returns the length of the string in the buffer as per ANSI
16692 $echo "Checking whether sprintf returns the length of the string..." >&4
16693 $cat <<EOP >try.c
16694 #include <stdio.h>
16695 #$i_stdlib I_STDLIB
16696 #ifdef I_STDLIB
16697 #include <stdlib.h>
16698 #endif
16699 #$i_string I_STRING
16700 #ifdef I_STRING
16701 #  include <string.h>
16702 #else
16703 #  include <strings.h>
16704 #endif
16705 #$i_math I_MATH
16706 #ifdef I_MATH
16707 #include <math.h>
16708 #endif
16709
16710 char buffer[256];
16711
16712 int check (size_t expect, int test) {
16713   size_t got = strlen(buffer);
16714   if (expect == got)
16715     return 0;
16716
16717   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
16718        test, buffer);
16719   exit (test);
16720 }
16721
16722 int main(int argc, char **argv) {
16723   int test = 0;
16724
16725   check(sprintf(buffer, ""), ++test);
16726   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
16727   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
16728
16729   return 0;
16730 }
16731 EOP
16732 set try
16733
16734 d_sprintf_returns_strlen="$undef"
16735 if eval $compile; then
16736     xxx="`$run ./try`"
16737     case "$?" in
16738         0) cat >&4 <<EOM
16739 sprintf returns the length of the string (as ANSI says it should)
16740 EOM
16741         d_sprintf_returns_strlen="$define"
16742         ;;
16743         *) cat >&4 <<EOM
16744 sprintf does not return the length of the string (how old is this system?)
16745 EOM
16746         d_sprintf_returns_strlen="$undef"
16747         ;;
16748     esac
16749 fi
16750
16751 $rm -f try.* try
16752
16753 : see if srand48_r exists
16754 set srand48_r d_srand48_r
16755 eval $inlibc
16756 case "$d_srand48_r" in
16757 "$define")
16758         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16759         case "$d_srand48_r_proto:$usethreads" in
16760         ":define")      d_srand48_r_proto=define
16761                 set d_srand48_r_proto srand48_r $hdrs
16762                 eval $hasproto ;;
16763         *)      ;;
16764         esac
16765         case "$d_srand48_r_proto" in
16766         define)
16767         case "$srand48_r_proto" in
16768         ''|0) try='int srand48_r(long, struct drand48_data*);'
16769         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
16770         esac
16771         case "$srand48_r_proto" in
16772         ''|0)   d_srand48_r=undef
16773                 srand48_r_proto=0
16774                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
16775         * )     case "$srand48_r_proto" in
16776                 REENTRANT_PROTO*) ;;
16777                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
16778                 esac
16779                 echo "Prototype: $try" ;;
16780         esac
16781         ;;
16782         *)      case "$usethreads" in
16783                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
16784                 esac
16785                 d_srand48_r=undef
16786                 srand48_r_proto=0
16787                 ;;
16788         esac
16789         ;;
16790 *)      srand48_r_proto=0
16791         ;;
16792 esac
16793
16794 : see if srandom_r exists
16795 set srandom_r d_srandom_r
16796 eval $inlibc
16797 case "$d_srandom_r" in
16798 "$define")
16799         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16800         case "$d_srandom_r_proto:$usethreads" in
16801         ":define")      d_srandom_r_proto=define
16802                 set d_srandom_r_proto srandom_r $hdrs
16803                 eval $hasproto ;;
16804         *)      ;;
16805         esac
16806         case "$d_srandom_r_proto" in
16807         define)
16808         case "$srandom_r_proto" in
16809         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
16810         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
16811         esac
16812         case "$srandom_r_proto" in
16813         ''|0)   d_srandom_r=undef
16814                 srandom_r_proto=0
16815                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
16816         * )     case "$srandom_r_proto" in
16817                 REENTRANT_PROTO*) ;;
16818                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
16819                 esac
16820                 echo "Prototype: $try" ;;
16821         esac
16822         ;;
16823         *)      case "$usethreads" in
16824                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
16825                 esac
16826                 d_srandom_r=undef
16827                 srandom_r_proto=0
16828                 ;;
16829         esac
16830         ;;
16831 *)      srandom_r_proto=0
16832         ;;
16833 esac
16834
16835 : see if prototype for setresgid is available
16836 echo " "
16837 set d_sresgproto setresgid $i_unistd unistd.h
16838 eval $hasproto
16839
16840 : see if prototype for setresuid is available
16841 echo " "
16842 set d_sresuproto setresuid $i_unistd unistd.h
16843 eval $hasproto
16844
16845 : see if sys/stat.h is available
16846 set sys/stat.h i_sysstat
16847 eval $inhdr
16848
16849
16850 : see if stat knows about block sizes
16851 echo " "
16852 echo "Checking to see if your struct stat has st_blocks field..." >&4
16853 set d_statblks stat st_blocks $i_sysstat sys/stat.h
16854 eval $hasfield
16855
16856
16857 : see if this is a sys/vfs.h system
16858 set sys/vfs.h i_sysvfs
16859 eval $inhdr
16860
16861
16862 : see if this is a sys/statfs.h system
16863 set sys/statfs.h i_sysstatfs
16864 eval $inhdr
16865
16866
16867 echo " "
16868 echo "Checking to see if your system supports struct statfs..." >&4
16869 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
16870 eval $hasstruct
16871 case "$d_statfs_s" in
16872 "$define")      echo "Yes, it does."   ;;
16873 *)              echo "No, it doesn't." ;;
16874 esac
16875
16876
16877
16878 : see if struct statfs knows about f_flags
16879 case "$d_statfs_s" in
16880 define) 
16881         echo " "
16882         echo "Checking to see if your struct statfs has f_flags field..." >&4
16883         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
16884         eval $hasfield
16885         ;;
16886 *)      val="$undef"
16887         set d_statfs_f_flags
16888         eval $setvar
16889         ;;
16890 esac
16891 case "$d_statfs_f_flags" in
16892 "$define")      echo "Yes, it does."   ;;
16893 *)              echo "No, it doesn't." ;;
16894 esac
16895
16896 $cat >&4 <<EOM
16897 Checking how to access stdio streams by file descriptor number...
16898 EOM
16899 case "$stdio_stream_array" in
16900 '')     $cat >try.c <<EOCP
16901 #include <stdio.h>
16902 int main() {
16903   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
16904     printf("yes\n");
16905 }
16906 EOCP
16907         for s in _iob __iob __sF
16908         do
16909                 set try -DSTDIO_STREAM_ARRAY=$s
16910                 if eval $compile; then
16911                         case "`$run ./try`" in
16912                         yes)    stdio_stream_array=$s; break ;;
16913                         esac
16914                 fi
16915         done
16916         $rm -f try.* try$exe_ext
16917 esac
16918 case "$stdio_stream_array" in
16919 '')     $cat >&4 <<EOM
16920 I can't figure out how to access stdio streams by file descriptor number.
16921 EOM
16922         d_stdio_stream_array="$undef"
16923         ;;
16924 *)      $cat >&4 <<EOM
16925 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
16926 EOM
16927         d_stdio_stream_array="$define"
16928         ;;
16929 esac
16930
16931 : see if strcoll exists
16932 set strcoll d_strcoll
16933 eval $inlibc
16934
16935 : check for structure copying
16936 echo " "
16937 echo "Checking to see if your C compiler can copy structs..." >&4
16938 $cat >try.c <<'EOCP'
16939 int main()
16940 {
16941         struct blurfl {
16942                 int dyick;
16943         } foo, bar;
16944
16945         foo = bar;
16946 }
16947 EOCP
16948 if $cc -c try.c >/dev/null 2>&1 ; then
16949         val="$define"
16950         echo "Yup, it can."
16951 else
16952         val="$undef"
16953         echo "Nope, it can't."
16954 fi
16955 set d_strctcpy
16956 eval $setvar
16957 $rm -f try.*
16958
16959 : see if strerror and/or sys_errlist[] exist
16960 echo " "
16961 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
16962     if set strerror val -f d_strerror; eval $csym; $val; then
16963                 echo 'strerror() found.' >&4
16964                 d_strerror="$define"
16965                 d_strerrm='strerror(e)'
16966                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16967                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
16968                         d_syserrlst="$define"
16969                 else
16970                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
16971                         d_syserrlst="$undef"
16972                 fi
16973     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
16974                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
16975                 echo 'strerror() found in string header.' >&4
16976                 d_strerror="$define"
16977                 d_strerrm='strerror(e)'
16978                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16979                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
16980                                 d_syserrlst="$define"
16981                 else
16982                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
16983                         d_syserrlst="$undef"
16984                 fi
16985     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16986                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
16987                 d_strerror="$undef"
16988                 d_syserrlst="$define"
16989                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
16990     else
16991                 echo 'strerror() and sys_errlist[] NOT found.' >&4
16992                 d_strerror="$undef"
16993                 d_syserrlst="$undef"
16994                 d_strerrm='"unknown"'
16995     fi
16996 fi
16997
16998 : see if strerror_r exists
16999 set strerror_r d_strerror_r
17000 eval $inlibc
17001 case "$d_strerror_r" in
17002 "$define")
17003         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17004         case "$d_strerror_r_proto:$usethreads" in
17005         ":define")      d_strerror_r_proto=define
17006                 set d_strerror_r_proto strerror_r $hdrs
17007                 eval $hasproto ;;
17008         *)      ;;
17009         esac
17010         case "$d_strerror_r_proto" in
17011         define)
17012         case "$strerror_r_proto" in
17013         ''|0) try='int strerror_r(int, char*, size_t);'
17014         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17015         esac
17016         case "$strerror_r_proto" in
17017         ''|0) try='int strerror_r(int, char*, int);'
17018         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17019         esac
17020         case "$strerror_r_proto" in
17021         ''|0) try='char* strerror_r(int, char*, size_t);'
17022         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17023         esac
17024         case "$strerror_r_proto" in
17025         ''|0)   d_strerror_r=undef
17026                 strerror_r_proto=0
17027                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17028         * )     case "$strerror_r_proto" in
17029                 REENTRANT_PROTO*) ;;
17030                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17031                 esac
17032                 echo "Prototype: $try" ;;
17033         esac
17034         ;;
17035         *)      case "$usethreads" in
17036                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17037                 esac
17038                 d_strerror_r=undef
17039                 strerror_r_proto=0
17040                 ;;
17041         esac
17042         ;;
17043 *)      strerror_r_proto=0
17044         ;;
17045 esac
17046
17047 : see if strftime exists
17048 set strftime d_strftime
17049 eval $inlibc
17050
17051 : see if strlcat exists
17052 set strlcat d_strlcat
17053 eval $inlibc
17054
17055 : see if strlcpy exists
17056 set strlcpy d_strlcpy
17057 eval $inlibc
17058
17059 : see if strtod exists
17060 set strtod d_strtod
17061 eval $inlibc
17062
17063 : see if strtol exists
17064 set strtol d_strtol
17065 eval $inlibc
17066
17067 : see if strtold exists
17068 set strtold d_strtold
17069 eval $inlibc
17070
17071 : see if strtoll exists
17072 set strtoll d_strtoll
17073 eval $inlibc
17074
17075 case "$d_longlong-$d_strtoll" in
17076 "$define-$define")
17077         $cat <<EOM
17078 Checking whether your strtoll() works okay...
17079 EOM
17080         $cat >try.c <<'EOCP'
17081 #include <errno.h>
17082 #ifdef __hpux
17083 #define strtoll __strtoll
17084 #endif
17085 #ifdef __EMX__
17086 #define strtoll _strtoll
17087 #endif
17088 #include <stdio.h>
17089 extern long long int strtoll(char *s, char **, int); 
17090 static int bad = 0;
17091 int check(char *s, long long ell, int een) {
17092         long long gll;
17093         errno = 0;
17094         gll = strtoll(s, 0, 10);
17095         if (!((gll == ell) && (errno == een)))
17096                 bad++;
17097 }
17098 int main() {
17099         check(" 1",                                      1LL, 0);
17100         check(" 0",                                      0LL, 0);
17101         check("-1",                                     -1LL, 0);
17102         check("-9223372036854775808", -9223372036854775808LL, 0);
17103         check("-9223372036854775808", -9223372036854775808LL, 0);
17104         check(" 9223372036854775807",  9223372036854775807LL, 0);
17105         check("-9223372036854775808", -9223372036854775808LL, 0);
17106         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17107         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17108         if (!bad)
17109                 printf("ok\n");
17110 }
17111 EOCP
17112         set try
17113         if eval $compile; then
17114                 yyy=`$run ./try`
17115                 case "$yyy" in
17116                 ok) echo "Your strtoll() seems to be working okay." ;;
17117                 *) cat <<EOM >&4
17118 Your strtoll() doesn't seem to be working okay.
17119 EOM
17120                    d_strtoll="$undef"
17121                    ;;
17122                 esac
17123         else
17124                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17125                 d_strtoll="$undef"
17126         fi
17127         ;;
17128 esac
17129
17130 : see if strtoq exists
17131 set strtoq d_strtoq
17132 eval $inlibc
17133
17134 : see if strtoul exists
17135 set strtoul d_strtoul
17136 eval $inlibc
17137
17138 case "$d_strtoul" in
17139 "$define")
17140         $cat <<EOM
17141 Checking whether your strtoul() works okay...
17142 EOM
17143         $cat >try.c <<'EOCP'
17144 #include <errno.h>
17145 #include <stdio.h>
17146 extern unsigned long int strtoul(char *s, char **, int); 
17147 static int bad = 0;
17148 void check(char *s, unsigned long eul, int een) {
17149         unsigned long gul;
17150         errno = 0;
17151         gul = strtoul(s, 0, 10);
17152         if (!((gul == eul) && (errno == een)))
17153                 bad++;
17154 }
17155 int main() {
17156         check(" 1", 1L, 0);
17157         check(" 0", 0L, 0);
17158 EOCP
17159         case "$longsize" in
17160         8)
17161             $cat >>try.c <<'EOCP'
17162         check("18446744073709551615", 18446744073709551615UL, 0);
17163         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17164 #if 0 /* strtoul() for /^-/ strings is undefined. */
17165         check("-1", 18446744073709551615UL, 0);
17166         check("-18446744073709551614", 2, 0);
17167         check("-18446744073709551615", 1, 0);
17168         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17169         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17170 #endif
17171 EOCP
17172                 ;;
17173         4)
17174                     $cat >>try.c <<'EOCP'
17175         check("4294967295", 4294967295UL, 0);
17176         check("4294967296", 4294967295UL, ERANGE);
17177 #if 0 /* strtoul() for /^-/ strings is undefined. */
17178         check("-1", 4294967295UL, 0);
17179         check("-4294967294", 2, 0);
17180         check("-4294967295", 1, 0);
17181         check("-4294967296", 4294967295UL, ERANGE);
17182         check("-4294967297", 4294967295UL, ERANGE);
17183 #endif
17184 EOCP
17185                 ;;
17186         *)
17187 : Should we write these tests to be more portable by sprintf-ing
17188 : ~0 and then manipulating that char string as input for strtol?
17189                 ;;
17190         esac
17191         $cat >>try.c <<'EOCP'
17192         if (!bad)
17193                 printf("ok\n");
17194         return 0;
17195 }
17196 EOCP
17197         set try
17198         if eval $compile; then
17199                 case "`$run ./try`" in
17200                 ok) echo "Your strtoul() seems to be working okay." ;;
17201                 *) cat <<EOM >&4
17202 Your strtoul() doesn't seem to be working okay.
17203 EOM
17204                    d_strtoul="$undef"
17205                    ;;
17206                 esac
17207         fi
17208         ;;
17209 esac
17210
17211 : see if strtoull exists
17212 set strtoull d_strtoull
17213 eval $inlibc
17214
17215 case "$d_longlong-$d_strtoull" in
17216 "$define-$define")
17217         $cat <<EOM
17218 Checking whether your strtoull() works okay...
17219 EOM
17220         $cat >try.c <<'EOCP'
17221 #include <errno.h>
17222 #ifdef __hpux
17223 #define strtoull __strtoull
17224 #endif
17225 #include <stdio.h>
17226 extern unsigned long long int strtoull(char *s, char **, int); 
17227 static int bad = 0;
17228 int check(char *s, long long eull, int een) {
17229         long long gull;
17230         errno = 0;
17231         gull = strtoull(s, 0, 10);
17232         if (!((gull == eull) && (errno == een)))
17233                 bad++;
17234 }
17235 int main() {
17236         check(" 1",                                        1LL, 0);
17237         check(" 0",                                        0LL, 0);
17238         check("18446744073709551615",  18446744073709551615ULL, 0);
17239         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17240 #if 0 /* strtoull() for /^-/ strings is undefined. */
17241         check("-1",                    18446744073709551615ULL, 0);
17242         check("-18446744073709551614",                     2LL, 0);
17243         check("-18446744073709551615",                     1LL, 0);
17244         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17245         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17246 #endif
17247         if (!bad)
17248                 printf("ok\n");
17249 }
17250 EOCP
17251         set try
17252         if eval $compile; then
17253                 case "`$run ./try`" in
17254                 ok) echo "Your strtoull() seems to be working okay." ;;
17255                 *) cat <<EOM >&4
17256 Your strtoull() doesn't seem to be working okay.
17257 EOM
17258                    d_strtoull="$undef"
17259                    ;;
17260                 esac
17261         fi
17262         ;;
17263 esac
17264
17265 : see if strtouq exists
17266 set strtouq d_strtouq
17267 eval $inlibc
17268
17269 case "$d_strtouq" in
17270 "$define")
17271         $cat <<EOM
17272 Checking whether your strtouq() works okay...
17273 EOM
17274         $cat >try.c <<'EOCP'
17275 #include <errno.h>
17276 #include <stdio.h>
17277 extern unsigned long long int strtouq(char *s, char **, int); 
17278 static int bad = 0;
17279 void check(char *s, unsigned long long eull, int een) {
17280         unsigned long long gull;
17281         errno = 0;
17282         gull = strtouq(s, 0, 10);
17283         if (!((gull == eull) && (errno == een)))
17284                 bad++;
17285 }
17286 int main() {
17287         check(" 1",                                        1LL, 0);
17288         check(" 0",                                        0LL, 0);
17289         check("18446744073709551615",  18446744073709551615ULL, 0);
17290         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17291 #if 0 /* strtouq() for /^-/ strings is undefined. */
17292         check("-1",                    18446744073709551615ULL, 0);
17293         check("-18446744073709551614",                     2LL, 0);
17294         check("-18446744073709551615",                     1LL, 0);
17295         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17296         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17297 #endif
17298         if (!bad)
17299                 printf("ok\n");
17300         return 0;
17301 }
17302 EOCP
17303         set try
17304         if eval $compile; then
17305                 case "`$run ./try`" in
17306                 ok) echo "Your strtouq() seems to be working okay." ;;
17307                 *) cat <<EOM >&4
17308 Your strtouq() doesn't seem to be working okay.
17309 EOM
17310                    d_strtouq="$undef"
17311                    ;;
17312                 esac
17313         fi
17314         ;;
17315 esac
17316
17317 : see if strxfrm exists
17318 set strxfrm d_strxfrm
17319 eval $inlibc
17320
17321 : see if symlink exists
17322 set symlink d_symlink
17323 eval $inlibc
17324
17325 : see if syscall exists
17326 set syscall d_syscall
17327 eval $inlibc
17328
17329 : see if prototype for syscall is available
17330 echo " "
17331 set d_syscallproto syscall $i_unistd unistd.h
17332 eval $hasproto
17333
17334 : see if sysconf exists
17335 set sysconf d_sysconf
17336 eval $inlibc
17337
17338 : see if system exists
17339 set system d_system
17340 eval $inlibc
17341
17342 : see if tcgetpgrp exists
17343 set tcgetpgrp d_tcgetpgrp
17344 eval $inlibc
17345
17346 : see if tcsetpgrp exists
17347 set tcsetpgrp d_tcsetpgrp
17348 eval $inlibc
17349
17350 : see if prototype for telldir is available
17351 echo " "
17352 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17353 eval $hasproto
17354
17355 : see if time exists
17356 echo " "
17357 if test "X$d_time" = X -o X"$timetype" = X; then
17358     if set time val -f d_time; eval $csym; $val; then
17359                 echo 'time() found.' >&4
17360                 val="$define"
17361                 rp="What is the type returned by time() on this system?"
17362                 set time_t timetype long stdio.h sys/types.h
17363                 eval $typedef_ask
17364     else
17365                 echo 'time() not found, hope that will do.' >&4
17366                 val="$undef"
17367                 timetype='int';
17368     fi
17369     set d_time
17370     eval $setvar
17371 fi
17372
17373 : see if this is a sys/times.h system
17374 set sys/times.h i_systimes
17375 eval $inhdr
17376
17377 : see if times exists
17378 echo " "
17379 if set times val -f d_times; eval $csym; $val; then
17380         echo 'times() found.' >&4
17381         d_times="$define"
17382         inc=''
17383         case "$i_systimes" in
17384         "$define") inc='sys/times.h';;
17385         esac
17386         rp="What is the type returned by times() on this system?"
17387         set clock_t clocktype long stdio.h sys/types.h $inc
17388         eval $typedef_ask
17389 else
17390         echo 'times() NOT found, hope that will do.' >&4
17391         d_times="$undef"
17392         clocktype='int'
17393 fi
17394
17395 : see if tmpnam_r exists
17396 set tmpnam_r d_tmpnam_r
17397 eval $inlibc
17398 case "$d_tmpnam_r" in
17399 "$define")
17400         hdrs="$i_systypes sys/types.h define stdio.h "
17401         case "$d_tmpnam_r_proto:$usethreads" in
17402         ":define")      d_tmpnam_r_proto=define
17403                 set d_tmpnam_r_proto tmpnam_r $hdrs
17404                 eval $hasproto ;;
17405         *)      ;;
17406         esac
17407         case "$d_tmpnam_r_proto" in
17408         define)
17409         case "$tmpnam_r_proto" in
17410         ''|0) try='char* tmpnam_r(char*);'
17411         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17412         esac
17413         case "$tmpnam_r_proto" in
17414         ''|0)   d_tmpnam_r=undef
17415                 tmpnam_r_proto=0
17416                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
17417         * )     case "$tmpnam_r_proto" in
17418                 REENTRANT_PROTO*) ;;
17419                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17420                 esac
17421                 echo "Prototype: $try" ;;
17422         esac
17423         ;;
17424         *)      case "$usethreads" in
17425                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17426                 esac
17427                 d_tmpnam_r=undef
17428                 tmpnam_r_proto=0
17429                 ;;
17430         esac
17431         ;;
17432 *)      tmpnam_r_proto=0
17433         ;;
17434 esac
17435
17436 : see if truncate exists
17437 set truncate d_truncate
17438 eval $inlibc
17439
17440 : see if ttyname_r exists
17441 set ttyname_r d_ttyname_r
17442 eval $inlibc
17443 case "$d_ttyname_r" in
17444 "$define")
17445         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
17446         case "$d_ttyname_r_proto:$usethreads" in
17447         ":define")      d_ttyname_r_proto=define
17448                 set d_ttyname_r_proto ttyname_r $hdrs
17449                 eval $hasproto ;;
17450         *)      ;;
17451         esac
17452         case "$d_ttyname_r_proto" in
17453         define)
17454         case "$ttyname_r_proto" in
17455         ''|0) try='int ttyname_r(int, char*, size_t);'
17456         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17457         esac
17458         case "$ttyname_r_proto" in
17459         ''|0) try='int ttyname_r(int, char*, int);'
17460         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17461         esac
17462         case "$ttyname_r_proto" in
17463         ''|0) try='char* ttyname_r(int, char*, int);'
17464         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17465         esac
17466         case "$ttyname_r_proto" in
17467         ''|0)   d_ttyname_r=undef
17468                 ttyname_r_proto=0
17469                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
17470         * )     case "$ttyname_r_proto" in
17471                 REENTRANT_PROTO*) ;;
17472                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17473                 esac
17474                 echo "Prototype: $try" ;;
17475         esac
17476         ;;
17477         *)      case "$usethreads" in
17478                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17479                 esac
17480                 d_ttyname_r=undef
17481                 ttyname_r_proto=0
17482                 ;;
17483         esac
17484         ;;
17485 *)      ttyname_r_proto=0
17486         ;;
17487 esac
17488
17489 : see if tzname[] exists
17490 echo " "
17491 if set tzname val -a d_tzname; eval $csym; $val; then
17492         val="$define"
17493         echo 'tzname[] found.' >&4
17494 else
17495         val="$undef"
17496         echo 'tzname[] NOT found.' >&4
17497 fi
17498 set d_tzname
17499 eval $setvar
17500
17501 case "$osname" in
17502 next|rhapsody|darwin) multiarch="$define" ;;
17503 esac
17504 case "$multiarch" in
17505 ''|[nN]*) multiarch="$undef" ;;
17506 esac
17507
17508 : check for ordering of bytes in a UV
17509 echo " "
17510 case "$usecrosscompile$multiarch" in
17511 *$define*)
17512         $cat <<EOM
17513 You seem to be either cross-compiling or doing a multiarchitecture build,
17514 skipping the byteorder check.
17515
17516 EOM
17517         byteorder='ffff'
17518         ;;
17519 *)
17520         case "$byteorder" in
17521         '')
17522                 $cat <<'EOM'
17523 In the following, larger digits indicate more significance.  A big-endian
17524 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17525 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17526 machines may have weird orders like 3412.  A Cray will report 87654321,
17527 an Alpha will report 12345678. If the test program works the default is
17528 probably right.
17529 I'm now running the test program...
17530 EOM
17531                 $cat >try.c <<EOCP
17532 #include <stdio.h>
17533 #$i_stdlib I_STDLIB
17534 #ifdef I_STDLIB
17535 #include <stdlib.h>
17536 #endif
17537 #include <sys/types.h>
17538 typedef $uvtype UV;
17539 int main()
17540 {
17541         int i;
17542         union {
17543                 UV l;
17544                 char c[$uvsize];
17545         } u;
17546
17547         if ($uvsize > 4)
17548                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
17549         else
17550                 u.l = (UV)0x04030201;
17551         for (i = 0; i < $uvsize; i++)
17552                 printf("%c", u.c[i]+'0');
17553         printf("\n");
17554         exit(0);
17555 }
17556 EOCP
17557                 xxx_prompt=y
17558                 set try
17559                 if eval $compile && ./try > /dev/null; then
17560                         dflt=`$run ./try`
17561                         case "$dflt" in
17562                         [1-4][1-4][1-4][1-4]|12345678|87654321)
17563                                 echo "(The test program ran ok.)"
17564                                 echo "byteorder=$dflt"
17565                                 xxx_prompt=n
17566                         ;;
17567                         ????|????????) echo "(The test program ran ok.)" ;;
17568                         *) echo "(The test program didn't run right for some reason.)" ;;
17569                         esac
17570                 else
17571                         dflt='4321'
17572                         cat <<'EOM'
17573 (I can't seem to compile the test program.  Guessing big-endian...)
17574 EOM
17575                 fi
17576                 case "$xxx_prompt" in
17577                 y)
17578                         rp="What is the order of bytes in $uvtype?"
17579                         . ./myread
17580                         byteorder="$ans"
17581                         ;;
17582                 *)      byteorder=$dflt
17583                         ;;
17584                 esac
17585                 ;;
17586         esac
17587         $rm -f try.c try
17588         ;;
17589 esac
17590
17591
17592 $cat <<EOM
17593
17594 Checking to see whether you can access character data unalignedly...
17595 EOM
17596 case "$d_u32align" in
17597 '')   $cat >try.c <<EOCP
17598 #include <stdio.h>
17599 #$i_stdlib I_STDLIB
17600 #ifdef I_STDLIB
17601 #include <stdlib.h>
17602 #endif
17603 #define U32 $u32type
17604 #define BYTEORDER 0x$byteorder
17605 #define U8 $u8type
17606 #include <signal.h>
17607 #ifdef SIGBUS
17608 $signal_t bletch(s) int s; { exit(4); }
17609 #endif
17610 int main() {
17611 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
17612     U8 buf[8];
17613     U32 *up;
17614     int i;
17615
17616     if (sizeof(U32) != 4) {
17617         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
17618         exit(1);
17619     }
17620
17621     fflush(stdout);
17622
17623 #ifdef SIGBUS
17624     signal(SIGBUS, bletch);
17625 #endif
17626
17627     buf[0] = 0;
17628     buf[1] = 0;
17629     buf[2] = 0;
17630     buf[3] = 1;
17631     buf[4] = 0;
17632     buf[5] = 0;
17633     buf[6] = 0;
17634     buf[7] = 1;
17635
17636     for (i = 0; i < 4; i++) {
17637         up = (U32*)(buf + i);
17638         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
17639                (*up == 1 << (8*(3-i)))  /* little-endian */
17640               )
17641            )
17642         {
17643             printf("read failed (%x)\n", *up);
17644             exit(2);
17645         }
17646     }
17647
17648     /* write test */
17649     for (i = 0; i < 4; i++) {
17650         up = (U32*)(buf + i);
17651         *up = 0xBeef;
17652         if (*up != 0xBeef) {
17653             printf("write failed (%x)\n", *up);
17654             exit(3);
17655         }
17656     }
17657
17658     exit(0);
17659 #else
17660     printf("1\n");
17661     exit(1);
17662 #endif
17663     return 0;
17664 }
17665 EOCP
17666 set try
17667 if eval $compile_ok; then
17668         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
17669         $run ./try 2>&1 >/dev/null
17670         case "$?" in
17671         0)      cat >&4 <<EOM
17672 You can access character data pretty unalignedly.
17673 EOM
17674                 d_u32align="$undef"
17675                 ;;
17676         *)      cat >&4 <<EOM
17677 It seems that you must access character data in an aligned manner.
17678 EOM
17679                 d_u32align="$define"
17680                 ;;
17681         esac
17682 else
17683         rp='Can you access character data at unaligned addresses?'
17684         dflt='n'
17685         . ./myread
17686         case "$ans" in
17687         [yY]*)  d_u32align="$undef"  ;;
17688         *)      d_u32align="$define" ;;
17689         esac
17690 fi
17691 $rm -f core core.try.* try.core
17692 ;;
17693 esac
17694
17695 : see if ualarm exists
17696 set ualarm d_ualarm
17697 eval $inlibc
17698
17699 : see if umask exists
17700 set umask d_umask
17701 eval $inlibc
17702
17703 : see if unordered exists
17704 set unordered d_unordered
17705 eval $inlibc
17706
17707 : see if unsetenv exists
17708 set unsetenv d_unsetenv
17709 eval $inlibc
17710
17711 : see if usleep exists
17712 set usleep d_usleep
17713 eval $inlibc
17714
17715 : see if prototype for usleep is available
17716 echo " "
17717 set d_usleepproto usleep $i_unistd unistd.h
17718 eval $hasproto
17719
17720 : see if ustat exists
17721 set ustat d_ustat
17722 eval $inlibc
17723
17724 : backward compatibility for d_hvfork
17725 if test X$d_hvfork != X; then
17726         d_vfork="$d_hvfork"
17727         d_hvfork=''
17728 fi
17729 : see if there is a vfork
17730 val=''
17731 set vfork val
17732 eval $inlibc
17733
17734 : Ok, but do we want to use it. vfork is reportedly unreliable in 
17735 : perl on Solaris 2.x, and probably elsewhere.
17736 case "$val" in
17737 $define)
17738         echo " "
17739         case "$usevfork" in
17740         false) dflt='n';;
17741         *) dflt='y';;
17742         esac
17743         cat <<'EOM'
17744  
17745 Perl can only use a vfork() that doesn't suffer from strict
17746 restrictions on calling functions or modifying global data in
17747 the child.  For example, glibc-2.1 contains such a vfork()
17748 that is unsuitable.  If your system provides a proper fork()
17749 call, chances are that you do NOT want perl to use vfork().
17750
17751 EOM
17752         rp="Do you still want to use vfork()?"
17753         . ./myread
17754         case "$ans" in
17755         y|Y) ;;
17756         *)
17757                 echo "Ok, we won't use vfork()."
17758                 val="$undef"
17759                 ;;
17760         esac
17761         ;;
17762 esac
17763 set d_vfork
17764 eval $setvar
17765 case "$d_vfork" in
17766 $define) usevfork='true';;
17767 *) usevfork='false';;
17768 esac
17769
17770 : see if closedir exists
17771 set closedir d_closedir
17772 eval $inlibc
17773
17774 case "$d_closedir" in
17775 "$define")
17776         echo " "
17777         echo "Checking whether closedir() returns a status..." >&4
17778         cat > try.c <<EOM
17779 #$i_dirent I_DIRENT             /**/
17780 #$i_sysdir I_SYS_DIR            /**/
17781 #$i_sysndir I_SYS_NDIR          /**/
17782 #$i_systypes I_SYS_TYPES        /**/
17783
17784 #if defined(I_SYS_TYPES)
17785 #include <sys/types.h>
17786 #endif
17787 #if defined(I_DIRENT)
17788 #include <dirent.h>
17789 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
17790 #include <sys/dir.h>
17791 #endif
17792 #else
17793 #ifdef I_SYS_NDIR
17794 #include <sys/ndir.h>
17795 #else
17796 #ifdef I_SYS_DIR
17797 #ifdef hp9000s500
17798 #include <ndir.h>       /* may be wrong in the future */
17799 #else
17800 #include <sys/dir.h>
17801 #endif
17802 #endif
17803 #endif
17804 #endif 
17805 int main() { return closedir(opendir(".")); }
17806 EOM
17807         set try
17808         if eval $compile_ok; then
17809                 if $run ./try > /dev/null 2>&1 ; then
17810                         echo "Yes, it does."
17811                         val="$undef"
17812                 else
17813                         echo "No, it doesn't."
17814                         val="$define"
17815                 fi
17816         else
17817                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17818                 val="$define"
17819         fi
17820         ;;
17821 *)
17822         val="$undef";
17823         ;;
17824 esac
17825 set d_void_closedir
17826 eval $setvar
17827 $rm -f try try.*
17828 : see if there is a wait4
17829 set wait4 d_wait4
17830 eval $inlibc
17831
17832 : see if waitpid exists
17833 set waitpid d_waitpid
17834 eval $inlibc
17835
17836 : see if wcstombs exists
17837 set wcstombs d_wcstombs
17838 eval $inlibc
17839
17840 : see if wctomb exists
17841 set wctomb d_wctomb
17842 eval $inlibc
17843
17844 : see if writev exists
17845 set writev d_writev
17846 eval $inlibc
17847
17848 : preserve RCS keywords in files with variable substitution, grrr
17849 Date='$Date'
17850 Id='$Id'
17851 Log='$Log'
17852 RCSfile='$RCSfile'
17853 Revision='$Revision'
17854
17855 : check for alignment requirements
17856 echo " "
17857 case "$usecrosscompile$multiarch" in
17858 *$define*)
17859         $cat <<EOM
17860 You seem to be either cross-compiling or doing a multiarchitecture build,
17861 skipping the memory alignment check.
17862
17863 EOM
17864         case "$alignbytes" in
17865         '') alignbytes=8 ;;
17866         esac
17867         ;;
17868 *)
17869         case "$alignbytes" in
17870         '') echo "Checking alignment constraints..." >&4
17871                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
17872                         $cat >try.c <<'EOCP'
17873 typedef long double NV;
17874 EOCP
17875                 else
17876                         $cat >try.c <<'EOCP'
17877 typedef double NV;
17878 EOCP
17879                 fi
17880                 $cat >>try.c <<'EOCP'
17881 #include <stdio.h>
17882 struct foobar {
17883         char foo;
17884         NV bar;
17885 } try_algn;
17886 int main()
17887 {
17888     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
17889     return(0);
17890 }
17891 EOCP
17892                 set try
17893                 if eval $compile_ok; then
17894                         dflt=`$run ./try`
17895                 else
17896                         dflt='8'
17897                         echo "(I can't seem to compile the test program...)"
17898                 fi
17899                 ;;
17900         *) dflt="$alignbytes"
17901                 ;;
17902         esac
17903         rp="Doubles must be aligned on a how-many-byte boundary?"
17904         . ./myread
17905         alignbytes="$ans"
17906         $rm -f try.c try
17907         ;;
17908 esac
17909
17910
17911 : set the base revision
17912 baserev=5.0
17913
17914 : how do we concatenate cpp tokens here?
17915 echo " "
17916 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
17917 $cat >cpp_stuff.c <<'EOCP'
17918 #define RCAT(a,b)a/**/b
17919 #define ACAT(a,b)a ## b
17920 RCAT(Rei,ser)
17921 ACAT(Cir,cus)
17922 EOCP
17923 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
17924 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
17925         echo "Oh!  Smells like ANSI's been here." >&4
17926         echo "We can catify or stringify, separately or together!"
17927         cpp_stuff=42
17928 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
17929         echo "Ah, yes!  The good old days!" >&4
17930         echo "However, in the good old days we don't know how to stringify and"
17931         echo "catify at the same time."
17932         cpp_stuff=1
17933 else
17934         $cat >&4 <<EOM
17935 Hmm, I don't seem to be able to concatenate tokens with your cpp.
17936 You're going to have to edit the values of CAT[2-5] in config.h...
17937 EOM
17938         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
17939 fi
17940 $rm -f cpp_stuff.*
17941
17942 : see if this is a db.h system
17943 set db.h i_db
17944 eval $inhdr
17945
17946 case "$i_db" in
17947 $define)
17948         : Check db version.
17949         echo " "
17950         echo "Checking Berkeley DB version ..." >&4
17951         $cat >try.c <<EOCP
17952 #$d_const HASCONST
17953 #ifndef HASCONST
17954 #define const
17955 #endif
17956 #include <sys/types.h>
17957 #include <stdio.h>
17958 #$i_stdlib I_STDLIB
17959 #ifdef I_STDLIB
17960 #include <stdlib.h>
17961 #endif
17962 #include <db.h>
17963 int main(int argc, char *argv[])
17964 {
17965 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
17966     int Major, Minor, Patch ;
17967     unsigned long Version ;
17968     (void)db_version(&Major, &Minor, &Patch) ;
17969     if (argc == 2) {
17970         printf("%d %d %d %d %d %d\n",
17971                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
17972                Major, Minor, Patch);
17973         exit(0);
17974     }
17975     printf("You have Berkeley DB Version 2 or greater.\n");
17976
17977     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
17978                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
17979     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
17980                 Major, Minor, Patch) ;
17981
17982     /* check that db.h & libdb are compatible */
17983     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
17984         printf("db.h and libdb are incompatible.\n") ;
17985         exit(3);        
17986     }
17987
17988     printf("db.h and libdb are compatible.\n") ;
17989
17990     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
17991                 + DB_VERSION_PATCH ;
17992
17993     /* needs to be >= 2.3.4 */
17994     if (Version < 2003004) {
17995     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
17996         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
17997         exit(2);        
17998     }
17999
18000     exit(0);
18001 #else
18002 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18003     if (argc == 2) {
18004         printf("1 0 0\n");
18005         exit(0);
18006     }
18007     printf("You have Berkeley DB Version 1.\n");
18008     exit(0);    /* DB version < 2: the coast is clear. */
18009 #else
18010     exit(1);    /* <db.h> not Berkeley DB? */
18011 #endif
18012 #endif
18013 }
18014 EOCP
18015         set try
18016         if eval $compile_ok && $run ./try; then
18017                 echo 'Looks OK.' >&4
18018                 set `$run ./try 1`
18019                 db_version_major=$1
18020                 db_version_minor=$2
18021                 db_version_patch=$3
18022         else
18023                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18024                 i_db=$undef
18025                 case " $libs " in
18026                 *"-ldb "*)
18027                         : Remove db from list of libraries to use
18028                         echo "Removing unusable -ldb from library list" >&4
18029                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18030                         shift
18031                         libs="$*"
18032                         echo "libs = $libs" >&4
18033                         ;;
18034                 esac
18035         fi
18036         $rm -f try.*
18037         ;;
18038 esac
18039
18040 case "$i_db" in
18041 define)
18042         : Check the return type needed for hash 
18043         echo " "
18044         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18045         $cat >try.c <<EOCP
18046 #$d_const HASCONST
18047 #ifndef HASCONST
18048 #define const
18049 #endif
18050 #include <sys/types.h>
18051 #include <db.h>
18052
18053 #ifndef DB_VERSION_MAJOR
18054 u_int32_t hash_cb (ptr, size)
18055 const void *ptr;
18056 size_t size;
18057 {
18058 }
18059 HASHINFO info;
18060 int main()
18061 {
18062         info.hash = hash_cb;
18063 }
18064 #endif
18065 EOCP
18066         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18067                 if $contains warning try.out >>/dev/null 2>&1 ; then
18068                         db_hashtype='int'
18069                 else
18070                         db_hashtype='u_int32_t'
18071                 fi
18072         else
18073                 : XXX Maybe we should just give up here.
18074                 db_hashtype=u_int32_t
18075                 $cat try.out >&4
18076                 echo "Help:  I can't seem to compile the db test program." >&4
18077                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18078         fi
18079         $rm -f try.*
18080         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18081         ;;
18082 *)      db_hashtype=u_int32_t
18083         ;;
18084 esac
18085 case "$i_db" in
18086 define)
18087         : Check the return type needed for prefix 
18088         echo " "
18089         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18090         cat >try.c <<EOCP
18091 #$d_const HASCONST
18092 #ifndef HASCONST
18093 #define const
18094 #endif
18095 #include <sys/types.h>
18096 #include <db.h>
18097
18098 #ifndef DB_VERSION_MAJOR
18099 size_t prefix_cb (key1, key2)
18100 const DBT *key1;
18101 const DBT *key2;
18102 {
18103 }
18104 BTREEINFO info;
18105 int main()
18106 {
18107         info.prefix = prefix_cb;
18108 }
18109 #endif
18110 EOCP
18111         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18112                 if $contains warning try.out >>/dev/null 2>&1 ; then
18113                         db_prefixtype='int'
18114                 else
18115                         db_prefixtype='size_t'
18116                 fi
18117         else
18118                 db_prefixtype='size_t'
18119                 : XXX Maybe we should just give up here.
18120                 $cat try.out >&4
18121                 echo "Help:  I can't seem to compile the db test program." >&4
18122                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18123         fi
18124         $rm -f try.*
18125         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18126         ;;
18127 *)      db_prefixtype='size_t'
18128         ;;
18129 esac
18130
18131
18132 : How can we generate normalized random numbers ?
18133 echo " "
18134 echo "Looking for a random number function..." >&4
18135 case "$randfunc" in
18136 '')
18137         if set drand48 val -f; eval $csym; $val; then
18138                 dflt="drand48"
18139                 echo "Good, found drand48()." >&4
18140         elif set random val -f; eval $csym; $val; then
18141                 dflt="random"
18142                 echo "OK, found random()." >&4
18143         else
18144                 dflt="rand"
18145                 echo "Yick, looks like I have to use rand()." >&4
18146         fi
18147         echo " "
18148         ;;
18149 *)
18150         dflt="$randfunc"
18151         ;;
18152 esac
18153 cont=true
18154
18155 case "$ccflags" in
18156 *-Dmy_rand=*|*-Dmy_srand=*)
18157         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18158         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18159         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18160         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18161         ;;
18162 esac
18163
18164 while $test "$cont"; do
18165         rp="Use which function to generate random numbers?"
18166         . ./myread
18167         if $test "$ans" = "$dflt"; then
18168                 : null
18169         else
18170                 randbits=''
18171         fi
18172         randfunc="$ans"
18173         if set $ans val -f; eval $csym; $val; then
18174                 cont=''
18175         else
18176                 dflt=y
18177                 rp="I cannot find function $ans. Use that name anyway?"
18178                 . ./myread
18179                 dflt=rand
18180                 case "$ans" in
18181                         [yY]*) cont='';;
18182                 esac
18183         fi
18184         case "$cont" in
18185         '')
18186                 case "$randfunc" in
18187                 drand48)
18188                         drand01="drand48()"
18189                         seedfunc="srand48"
18190                         randbits=48
18191                         randseedtype=long
18192                         ;;
18193                 rand|random)
18194                         case "$randbits" in
18195                         '')
18196 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18197                                 $cat >try.c <<EOCP
18198 #$i_unistd I_UNISTD
18199 #$i_stdlib I_STDLIB
18200 #include <stdio.h>
18201 #ifdef I_UNISTD
18202 #  include <unistd.h>
18203 #endif
18204 #ifdef I_STDLIB
18205 #  include <stdlib.h>
18206 #endif
18207 int main()
18208 {
18209         register int i;
18210         register unsigned long tmp;
18211         register unsigned long max = 0L;
18212
18213         for (i = 1000; i; i--) {
18214                 tmp = (unsigned long) $randfunc();
18215                 if (tmp > max) max = tmp;
18216         }
18217         for (i = 0; max; i++)
18218                 max /= 2;
18219         printf("%d\n",i);
18220 }
18221 EOCP
18222                                 set try
18223                                 if eval $compile_ok; then
18224                                         dflt=`try`
18225                                 else
18226                                         dflt='?'
18227                                         echo "(I can't seem to compile the test program...)"
18228                                 fi
18229                                 ;;
18230                         *)
18231                                 dflt="$randbits"
18232                                 ;;
18233                         esac
18234                         rp="How many bits does your $randfunc() function produce?"
18235                         . ./myread
18236                         randbits="$ans"
18237                         $rm -f try.c try
18238                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18239                         seedfunc="s$randfunc"
18240                         randseedtype=unsigned
18241                         ;;
18242                 *)
18243                         dflt="31"
18244                         rp="How many bits does your $randfunc() function produce?"
18245                         . ./myread
18246                         randbits="$ans"
18247                         seedfunc="s$randfunc"
18248                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18249                         if set $seedfunc val -f; eval $csym; $val; then
18250                                 echo "(Using $seedfunc() to seed random generator)"
18251                         else
18252                                 echo "(Warning: no $seedfunc() to seed random generator)"
18253                                 seedfunc=rand
18254                         fi
18255                         randseedtype=unsigned
18256                         ;;
18257                 esac
18258                 ;;
18259         esac
18260 done
18261
18262 echo " "
18263 echo "Determining whether or not we are on an EBCDIC system..." >&4
18264 $cat >try.c <<'EOM'
18265 int main()
18266 {
18267   if ('M'==0xd4) return 0;
18268   return 1;
18269 }
18270 EOM
18271
18272 val=$undef
18273 set try
18274 if eval $compile_ok; then
18275         if $run ./try; then
18276                 echo "You seem to speak EBCDIC." >&4
18277                 val="$define"
18278         else
18279                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18280         fi
18281 else
18282         echo "I'm unable to compile the test program." >&4
18283         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18284 fi
18285 $rm -f try try.*
18286 set ebcdic
18287 eval $setvar
18288
18289 echo " "
18290 $cat >&4 <<EOM
18291 Checking how to flush all pending stdio output...
18292 EOM
18293 # I only know how to find the first 32 possibly open files on SunOS.
18294 # See also hints/sunos_4_1.sh and util.c  --AD
18295 case "$osname" in
18296 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18297 esac
18298 $cat >>try.c <<EOCP
18299 #include <stdio.h>
18300 #$i_stdlib I_STDLIB
18301 #ifdef I_STDLIB
18302 #include <stdlib.h>
18303 #endif
18304 #$i_unistd I_UNISTD
18305 #ifdef I_UNISTD
18306 # include <unistd.h>
18307 #endif
18308 #$d_sysconf HAS_SYSCONF
18309 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18310 #ifdef HAS_STDIO_STREAM_ARRAY
18311 # define STDIO_STREAM_ARRAY $stdio_stream_array
18312 #endif
18313 int main() {
18314   FILE* p;
18315   unlink("try.out");
18316   p = fopen("try.out", "w");
18317 #ifdef TRY_FPUTC
18318   fputc('x', p);
18319 #else
18320 # ifdef TRY_FPRINTF
18321   fprintf(p, "x");
18322 # endif
18323 #endif
18324 #ifdef TRY_FFLUSH_NULL
18325   fflush(NULL);
18326 #endif
18327 #ifdef TRY_FFLUSH_ALL
18328   {
18329     long open_max = -1;
18330 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18331     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18332 # else
18333 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18334     open_max = sysconf(_SC_OPEN_MAX);
18335 #  else
18336 #   ifdef FOPEN_MAX
18337     open_max = FOPEN_MAX;
18338 #   else
18339 #    ifdef OPEN_MAX
18340     open_max = OPEN_MAX;
18341 #    else
18342 #     ifdef _NFILE
18343     open_max = _NFILE;
18344 #     endif
18345 #    endif
18346 #   endif
18347 #  endif
18348 # endif 
18349 # ifdef HAS_STDIO_STREAM_ARRAY
18350     if (open_max > 0) {
18351       long i;
18352       for (i = 0; i < open_max; i++)
18353             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18354                 STDIO_STREAM_ARRAY[i]._file < open_max &&
18355                 STDIO_STREAM_ARRAY[i]._flag)
18356                 fflush(&STDIO_STREAM_ARRAY[i]);
18357     }   
18358   }
18359 # endif
18360 #endif
18361   _exit(42);
18362 }
18363 EOCP
18364 : first we have to find out how _not_ to flush
18365 $to try.c
18366 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18367     output=''
18368     set try -DTRY_FPUTC
18369     if eval $compile; then
18370             $run ./try 2>/dev/null
18371             code="$?"
18372             $from try.out
18373             if $test ! -s try.out -a "X$code" = X42; then
18374                 output=-DTRY_FPUTC
18375             fi
18376     fi
18377     case "$output" in
18378     '')
18379             set try -DTRY_FPRINTF
18380             if eval $compile; then
18381                     $run ./try 2>/dev/null
18382                     code="$?"
18383                     $from try.out
18384                     if $test ! -s try.out -a "X$code" = X42; then
18385                         output=-DTRY_FPRINTF
18386                     fi
18387             fi
18388         ;;
18389     esac
18390 fi
18391 : check for fflush NULL behaviour
18392 case "$fflushNULL" in
18393 '')     set try -DTRY_FFLUSH_NULL $output
18394         if eval $compile; then
18395                 $run ./try 2>/dev/null
18396                 code="$?"
18397                 $from try.out
18398                 if $test -s try.out -a "X$code" = X42; then
18399                         fflushNULL="`$cat try.out`"
18400                 else
18401                         if $test "X$code" != X42; then
18402                                 $cat >&4 <<EOM
18403 (If this test failed, don't worry, we'll try another method shortly.)
18404 EOM
18405                         fi
18406                 fi
18407         fi
18408         $rm -f core try.core core.try.*
18409         case "$fflushNULL" in
18410         x)      $cat >&4 <<EOM
18411 Your fflush(NULL) works okay for output streams.
18412 Let's see if it clobbers input pipes...
18413 EOM
18414 # As of mid-March 2000 all versions of Solaris appear to have a stdio
18415 # bug that improperly flushes the input end of pipes.  So we avoid the
18416 # autoflush on fork/system/exec support for now. :-(
18417 $cat >tryp.c <<EOCP
18418 #include <stdio.h>
18419 int
18420 main(int argc, char **argv)
18421 {
18422     char buf[1024];
18423     int i;
18424     char *bp = buf;
18425     while (1) {
18426         while ((i = getc(stdin)) != -1
18427                && (*bp++ = i) != '\n'
18428                && bp < &buf[1024])
18429         /* DO NOTHING */ ;
18430         *bp = '\0';
18431         fprintf(stdout, "%s", buf);
18432         fflush(NULL);
18433         if (i == -1)
18434             return 0;
18435         bp = buf;
18436     }
18437 }
18438 EOCP
18439                 fflushNULL="$define"
18440                 set tryp
18441                 if eval $compile; then
18442                     $rm -f tryp.out
18443                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18444                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
18445                        $cat >&4 <<EOM
18446 fflush(NULL) seems to behave okay with input streams.
18447 EOM
18448                         fflushNULL="$define"
18449                     else
18450                         $cat >&4 <<EOM
18451 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
18452 EOM
18453                         fflushNULL="$undef"
18454                     fi
18455                 fi
18456                 $rm -f core tryp.c tryp.core core.tryp.*
18457                 ;;
18458         '')     $cat >&4 <<EOM
18459 Your fflush(NULL) isn't working (contrary to ANSI C).
18460 EOM
18461                 fflushNULL="$undef"
18462                 ;;
18463         *)      $cat >&4 <<EOM
18464 Cannot figure out whether your fflush(NULL) works or not.
18465 I'm assuming it doesn't (contrary to ANSI C).
18466 EOM
18467                 fflushNULL="$undef"
18468                 ;;
18469         esac
18470         ;;
18471 $define|true|[yY]*)
18472         fflushNULL="$define"
18473         ;;
18474 *)
18475         fflushNULL="$undef"
18476         ;;
18477 esac
18478 : check explicit looping only if NULL did not work, and if the pipe
18479 : bug does not show up on an explicit flush too
18480 case "$fflushNULL" in
18481 "$undef")
18482         $cat >tryp.c <<EOCP
18483 #include <stdio.h>
18484 int
18485 main(int argc, char **argv)
18486 {
18487     char buf[1024];
18488     int i;
18489     char *bp = buf;
18490     while (1) {
18491         while ((i = getc(stdin)) != -1
18492                && (*bp++ = i) != '\n'
18493                && bp < &buf[1024])
18494         /* DO NOTHING */ ;
18495         *bp = '\0';
18496         fprintf(stdout, "%s", buf);
18497         fflush(stdin);
18498         if (i == -1)
18499             return 0;
18500         bp = buf;
18501     }
18502 }
18503 EOCP
18504         set tryp
18505         if eval $compile; then
18506             $rm -f tryp.out
18507             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18508             if cmp tryp.c tryp.out >/dev/null 2>&1; then
18509                $cat >&4 <<EOM
18510 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18511 EOM
18512                 : now check for fflushall behaviour
18513                 case "$fflushall" in
18514                 '')     set try -DTRY_FFLUSH_ALL $output
18515                         if eval $compile; then
18516                                 $cat >&4 <<EOM
18517 (Now testing the other method--but note that this also may fail.)
18518 EOM
18519                                 $run ./try 2>/dev/null
18520                                 code=$?
18521                                 $from try.out
18522                                 if $test -s try.out -a "X$code" = X42; then
18523                                         fflushall="`$cat try.out`"
18524                                 fi
18525                         fi
18526                         $rm -f core try.core core.try.*
18527                         case "$fflushall" in
18528                         x)      $cat >&4 <<EOM
18529 Whew. Flushing explicitly all the stdio streams works.
18530 EOM
18531                                 fflushall="$define"
18532                                 ;;
18533                         '')     $cat >&4 <<EOM
18534 Sigh. Flushing explicitly all the stdio streams doesn't work.
18535 EOM
18536                                 fflushall="$undef"
18537                                 ;;
18538                         *)      $cat >&4 <<EOM
18539 Cannot figure out whether flushing stdio streams explicitly works or not.
18540 I'm assuming it doesn't.
18541 EOM
18542                                 fflushall="$undef"
18543                                 ;;
18544                         esac
18545                         ;;
18546                 "$define"|true|[yY]*)
18547                         fflushall="$define"
18548                         ;;
18549                 *)
18550                         fflushall="$undef"
18551                         ;;
18552                 esac
18553             else
18554                 $cat >&4 <<EOM
18555 All is futile.  Even fflush(stdin) clobbers input pipes!
18556 EOM
18557                 fflushall="$undef"
18558             fi
18559         else
18560             fflushall="$undef"
18561         fi
18562         $rm -f core tryp.c tryp.core core.tryp.*
18563         ;;
18564 *)      fflushall="$undef"
18565         ;;
18566 esac
18567
18568 case "$fflushNULL$fflushall" in
18569 undefundef)
18570         $cat <<EOM
18571 OK, I give up.  I cannot figure out how to flush pending stdio output.
18572 We won't be flushing handles at all before fork/exec/popen.
18573 EOM
18574         ;;
18575 esac
18576 $rm -f try.* try$exe_ext
18577
18578 : Store the full pathname to the ar program for use in the C program
18579 : Respect a hint or command line value for full_ar.
18580 case "$full_ar" in
18581 '') full_ar=$ar ;;
18582 esac
18583
18584 : Store the full pathname to the sed program for use in the C program
18585 full_sed=$sed
18586
18587 : see what type gids are declared as in the kernel
18588 echo " "
18589 echo "Looking for the type for group ids returned by getgid()."
18590 set gid_t gidtype xxx stdio.h sys/types.h
18591 eval $typedef
18592 case "$gidtype" in
18593 xxx)
18594         xxx=`./findhdr sys/user.h`
18595         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
18596         case $1 in
18597         unsigned) dflt="$1 $2" ;;
18598         *) dflt="$1" ;;
18599         esac
18600         ;;
18601 *) dflt="$gidtype";;
18602 esac
18603 case "$gidtype" in
18604 gid_t) echo "gid_t found." ;;
18605 *)      rp="What is the type for group ids returned by getgid()?"
18606         . ./myread
18607         gidtype="$ans"
18608         ;;
18609 esac
18610
18611 echo " "
18612 case "$gidtype" in
18613 *_t) zzz="$gidtype"     ;;
18614 *)   zzz="gid"          ;;
18615 esac
18616 echo "Checking the size of $zzz..." >&4 
18617 cat > try.c <<EOCP
18618 #include <sys/types.h>
18619 #include <stdio.h>
18620 #$i_stdlib I_STDLIB
18621 #ifdef I_STDLIB
18622 #include <stdlib.h>
18623 #endif
18624 int main() {
18625     printf("%d\n", (int)sizeof($gidtype));
18626     exit(0);
18627 }
18628 EOCP
18629 set try
18630 if eval $compile_ok; then
18631         yyy=`$run ./try`
18632         case "$yyy" in
18633         '')     gidsize=4
18634                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
18635                 ;;
18636         *)      gidsize=$yyy
18637                 echo "Your $zzz is $gidsize bytes long."
18638                 ;;
18639         esac
18640 else
18641         gidsize=4
18642         echo "(I can't compile the test program--guessing $gidsize.)" >&4
18643 fi
18644
18645
18646 echo " "
18647 case "$gidtype" in
18648 *_t) zzz="$gidtype"     ;;
18649 *)   zzz="gid"          ;;
18650 esac
18651 echo "Checking the sign of $zzz..." >&4 
18652 cat > try.c <<EOCP
18653 #include <sys/types.h>
18654 #include <stdio.h>
18655 int main() {
18656         $gidtype foo = -1;
18657         if (foo < 0)
18658                 printf("-1\n");
18659         else
18660                 printf("1\n");
18661 }
18662 EOCP
18663 set try
18664 if eval $compile; then
18665         yyy=`$run ./try`
18666         case "$yyy" in
18667         '')     gidsign=1
18668                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18669                 ;;
18670         *)      gidsign=$yyy
18671                 case "$gidsign" in
18672                  1) echo "Your $zzz is unsigned." ;;
18673                 -1) echo "Your $zzz is signed."   ;;
18674                 esac
18675                 ;;
18676         esac
18677 else
18678         gidsign=1
18679         echo "(I can't compile the test program--guessing unsigned.)" >&4
18680 fi
18681
18682
18683 echo " "
18684
18685 if $test X"$quadtype" != X; then
18686
18687 echo "Checking how to print 64-bit integers..." >&4
18688
18689 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
18690         $cat >try.c <<'EOCP'
18691 #include <sys/types.h>
18692 #include <stdio.h>
18693 int main() {
18694   int q = 12345678901;
18695   printf("%ld\n", q);
18696 }
18697 EOCP
18698         set try
18699         if eval $compile; then
18700                 yyy=`$run ./try`
18701                 case "$yyy" in
18702                 12345678901)
18703                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
18704                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
18705                         echo "We will use %d."
18706                         ;;
18707                 esac
18708         fi
18709 fi
18710
18711 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
18712         $cat >try.c <<'EOCP'
18713 #include <sys/types.h>
18714 #include <stdio.h>
18715 int main() {
18716   long q = 12345678901;
18717   printf("%ld\n", q);
18718 }
18719 EOCP
18720         set try
18721         if eval $compile; then
18722                 yyy=`$run ./try`
18723                 case "$yyy" in
18724                 12345678901)
18725                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
18726                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
18727                         echo "We will use %ld."
18728                         ;;
18729                 esac
18730         fi
18731 fi
18732
18733 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
18734         $cat >try.c <<'EOCP'
18735 #include <sys/types.h>
18736 #include <inttypes.h>
18737 #include <stdio.h>
18738 int main() {
18739   int64_t q = 12345678901;
18740   printf("%" PRId64 "\n", q);
18741 }
18742 EOCP
18743         set try
18744         if eval $compile; then
18745                 yyy=`$run ./try`
18746                 case "$yyy" in
18747                 12345678901)
18748                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
18749                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
18750                         echo "We will use the C9X style."
18751                         ;;
18752                 esac
18753         fi
18754 fi
18755
18756 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18757         $cat >try.c <<EOCP
18758 #include <sys/types.h>
18759 #include <stdio.h>
18760 int main() {
18761   $quadtype q = 12345678901;
18762   printf("%Ld\n", q);
18763 }
18764 EOCP
18765         set try
18766         if eval $compile; then
18767                 yyy=`$run ./try`
18768                 case "$yyy" in
18769                 12345678901)
18770                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
18771                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
18772                         echo "We will use %Ld."
18773                         ;;
18774                 esac
18775         fi
18776 fi
18777
18778 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
18779         $cat >try.c <<'EOCP'
18780 #include <sys/types.h>
18781 #include <stdio.h>
18782 int main() {
18783   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
18784   printf("%lld\n", q);
18785 }
18786 EOCP
18787         set try
18788         if eval $compile; then
18789                 yyy=`$run ./try`
18790                 case "$yyy" in
18791                 12345678901)
18792                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
18793                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
18794                         echo "We will use the %lld style."
18795                         ;;
18796                 esac
18797         fi
18798 fi
18799
18800 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18801         $cat >try.c <<EOCP
18802 #include <sys/types.h>
18803 #include <stdio.h>
18804 int main() {
18805   $quadtype q = 12345678901;
18806   printf("%qd\n", q);
18807 }
18808 EOCP
18809         set try
18810         if eval $compile; then
18811                 yyy=`$run ./try`
18812                 case "$yyy" in
18813                 12345678901)
18814                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
18815                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
18816                         echo "We will use %qd."
18817                         ;;
18818                 esac
18819         fi
18820 fi
18821
18822 if $test X"$sPRId64" = X; then
18823         echo "Cannot figure out how to print 64-bit integers." >&4
18824 fi
18825
18826 $rm -f try try.*
18827
18828 fi
18829
18830 case "$sPRId64" in
18831 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
18832         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
18833         ;;
18834 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
18835         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
18836         ;;
18837 esac
18838
18839
18840 echo " "
18841 $echo "Checking the format strings to be used for Perl's internal types..." >&4
18842
18843 if $test X"$ivsize" = X8; then
18844         ivdformat="$sPRId64"
18845         uvuformat="$sPRIu64"
18846         uvoformat="$sPRIo64"
18847         uvxformat="$sPRIx64"
18848         uvXUformat="$sPRIXU64"
18849 else
18850         if $test X"$ivsize" = X"$longsize"; then
18851                 ivdformat='"ld"'
18852                 uvuformat='"lu"'
18853                 uvoformat='"lo"'
18854                 uvxformat='"lx"'
18855                 uvXUformat='"lX"'
18856         else
18857                 if $test X"$ivsize" = X"$intsize"; then
18858                         ivdformat='"d"'
18859                         uvuformat='"u"'
18860                         uvoformat='"o"'
18861                         uvxformat='"x"'
18862                         uvXUformat='"X"'
18863                 else
18864                         : far out
18865                         if $test X"$ivsize" = X"$shortsize"; then
18866                                 ivdformat='"hd"'
18867                                 uvuformat='"hu"'
18868                                 uvoformat='"ho"'
18869                                 uvxformat='"hx"'
18870                                 uvXUformat='"hX"'
18871                         fi
18872                 fi
18873         fi
18874 fi
18875
18876 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
18877         nveformat="$sPRIeldbl"
18878         nvfformat="$sPRIfldbl"
18879         nvgformat="$sPRIgldbl"
18880         nvEUformat="$sPRIEUldbl"
18881         nvFUformat="$sPRIFUldbl"
18882         nvGUformat="$sPRIGUldbl"
18883 else
18884         nveformat='"e"'
18885         nvfformat='"f"'
18886         nvgformat='"g"'
18887         nvEUformat='"E"'
18888         nvFUformat='"F"'
18889         nvGUformat='"G"'
18890 fi
18891
18892 case "$ivdformat" in
18893 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
18894     exit 1
18895     ;;
18896 esac
18897
18898
18899 echo " "
18900 $echo "Checking the format string to be used for gids..." >&4
18901
18902 case "$gidsign" in
18903 -1)     if $test X"$gidsize" = X"$ivsize"; then
18904                 gidformat="$ivdformat"
18905         else
18906                 if $test X"$gidsize" = X"$longsize"; then
18907                         gidformat='"ld"'
18908                 else
18909                         if $test X"$gidsize" = X"$intsize"; then
18910                                 gidformat='"d"'
18911                         else
18912                                 if $test X"$gidsize" = X"$shortsize"; then
18913                                         gidformat='"hd"'
18914                                 fi
18915                         fi
18916                 fi
18917         fi
18918         ;;
18919 *)      if $test X"$gidsize" = X"$uvsize"; then
18920                 gidformat="$uvuformat"
18921         else
18922                 if $test X"$gidsize" = X"$longsize"; then
18923                         gidformat='"lu"'
18924                 else
18925                         if $test X"$gidsize" = X"$intsize"; then
18926                                 gidformat='"u"'
18927                         else
18928                                 if $test X"$gidsize" = X"$shortsize"; then
18929                                         gidformat='"hu"'
18930                                 fi
18931                         fi
18932                 fi
18933         fi
18934         ;;
18935 esac
18936
18937 : see if getgroups exists
18938 set getgroups d_getgrps
18939 eval $inlibc
18940
18941 : see if setgroups exists
18942 set setgroups d_setgrps
18943 eval $inlibc
18944
18945
18946 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
18947 echo " "
18948 case "$d_getgrps$d_setgrps" in
18949 *define*)
18950         case "$groupstype" in
18951         '') dflt="$gidtype" ;;
18952         *)  dflt="$groupstype" ;;
18953         esac
18954         $cat <<EOM
18955 What type of pointer is the second argument to getgroups() and setgroups()?
18956 Usually this is the same as group ids, $gidtype, but not always.
18957
18958 EOM
18959         rp='What type pointer is the second argument to getgroups() and setgroups()?'
18960         . ./myread
18961         groupstype="$ans"
18962         ;;
18963 *)  groupstype="$gidtype";;
18964 esac
18965
18966
18967 case "$mad" in
18968 $define|true|[yY]*)     dflt='y' ;;
18969 *)                      dflt='n' ;;
18970 esac
18971 cat <<EOM
18972
18973 Would you like to build with Misc Attribute Decoration? This is development
18974 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
18975 overhead on the interpreter.
18976
18977 If this doesn't make any sense to you, just accept the default '$dflt'.
18978 EOM
18979 rp='Build Perl with MAD?'
18980 . ./myread
18981 case "$ans" in
18982 y|Y)    val="$define"
18983         madlyh='madly.h madly.act madly.tab'
18984         madlysrc='madly.c'
18985         madlyobj="madly$_o" ;;
18986 *)      val="$undef"
18987         madlyh=''
18988         madlysrc=''
18989         madlyobj='' ;;
18990 esac
18991 set mad
18992 eval $setvar
18993
18994 echo " "
18995 echo "Checking if your $make program sets \$(MAKE)..." >&4
18996 case "$make_set_make" in
18997 '')
18998         $sed 's/^X //' > testmake.mak << 'EOF'
18999 Xall:
19000 X       @echo 'maketemp="$(MAKE)"'
19001 EOF
19002         case "`$make -f testmake.mak 2>/dev/null`" in
19003         *maketemp=*) make_set_make='#' ;;
19004         *)      make_set_make="MAKE=$make" ;;
19005         esac
19006         $rm -f testmake.mak
19007         ;;
19008 esac
19009 case "$make_set_make" in
19010 '#') echo "Yup, it does.";;
19011 *) echo "Nope, it doesn't.";;
19012 esac
19013
19014 : see what type is used for mode_t
19015 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19016 set mode_t modetype int stdio.h sys/types.h
19017 eval $typedef_ask
19018
19019 : see if stdarg is available
19020 echo " "
19021 if $test `./findhdr stdarg.h`; then
19022         echo "<stdarg.h> found." >&4
19023         valstd="$define"
19024 else
19025         echo "<stdarg.h> NOT found." >&4
19026         valstd="$undef"
19027 fi
19028
19029 : see if varags is available
19030 echo " "
19031 if $test `./findhdr varargs.h`; then
19032         echo "<varargs.h> found." >&4
19033 else
19034         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
19035 fi
19036
19037 : set up the varargs testing programs
19038 $cat > varargs.c <<EOP
19039 #ifdef I_STDARG
19040 #include <stdarg.h>
19041 #endif
19042 #ifdef I_VARARGS
19043 #include <varargs.h>
19044 #endif
19045
19046 #ifdef I_STDARG
19047 int f(char *p, ...)
19048 #else
19049 int f(va_alist)
19050 va_dcl
19051 #endif
19052 {
19053         va_list ap;
19054 #ifndef I_STDARG
19055         char *p;
19056 #endif
19057 #ifdef I_STDARG
19058         va_start(ap,p);
19059 #else
19060         va_start(ap);
19061         p = va_arg(ap, char *);
19062 #endif
19063         va_end(ap);
19064 }
19065 EOP
19066 $cat > varargs <<EOP
19067 $startsh
19068 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
19069         echo "true"
19070 else
19071         echo "false"
19072 fi
19073 $rm -f varargs$_o
19074 EOP
19075 chmod +x varargs
19076
19077 : now check which varargs header should be included
19078 echo " "
19079 i_varhdr=''
19080 case "$valstd" in
19081 "$define")
19082         if `./varargs I_STDARG`; then
19083                 val='stdarg.h'
19084         elif `./varargs I_VARARGS`; then
19085                 val='varargs.h'
19086         fi
19087         ;;
19088 *)
19089         if `./varargs I_VARARGS`; then
19090                 val='varargs.h'
19091         fi
19092         ;;
19093 esac
19094 case "$val" in
19095 '')
19096 echo "I could not find the definition for va_dcl... You have problems..." >&4
19097         val="$undef"; set i_stdarg; eval $setvar
19098         val="$undef"; set i_varargs; eval $setvar
19099         ;;
19100 *) 
19101         set i_varhdr
19102         eval $setvar
19103         case "$i_varhdr" in
19104         stdarg.h)
19105                 val="$define"; set i_stdarg; eval $setvar
19106                 val="$undef"; set i_varargs; eval $setvar
19107                 ;;
19108         varargs.h)
19109                 val="$undef"; set i_stdarg; eval $setvar
19110                 val="$define"; set i_varargs; eval $setvar
19111                 ;;
19112         esac
19113         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
19114 esac
19115 $rm -f varargs*
19116
19117 : see if we need va_copy
19118 echo " "
19119 case "$i_stdarg" in
19120 "$define")
19121         $cat >try.c <<EOCP
19122 #include <stdarg.h>
19123 #include <stdio.h>
19124 #$i_stdlib I_STDLIB
19125 #ifdef I_STDLIB
19126 #include <stdlib.h>
19127 #endif
19128 #include <signal.h>
19129
19130 int
19131 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19132 {
19133   return vfprintf(f, fmt, *valp);
19134 }
19135  
19136 int    
19137 myvfprintf(FILE *f, const  char *fmt, va_list val)
19138 {
19139   return ivfprintf(f, fmt, &val);
19140 }
19141       
19142 int
19143 myprintf(char *fmt, ...) 
19144 {
19145   va_list val;
19146   va_start(val, fmt);
19147   return myvfprintf(stdout, fmt, val); 
19148 }         
19149
19150 int
19151 main(int ac, char **av)
19152 {
19153   signal(SIGSEGV, exit);
19154
19155   myprintf("%s%cs all right, then\n", "that", '\'');                            
19156   exit(0);      
19157 }
19158 EOCP
19159         set try
19160         if eval $compile && $run ./try 2>&1 >/dev/null; then
19161                 case "`$run ./try`" in
19162                 "that's all right, then")
19163                         okay=yes
19164                         ;;
19165                 esac
19166         fi
19167         case "$okay" in
19168         yes)    echo "It seems that you don't need va_copy()." >&4
19169                 need_va_copy="$undef"
19170                 ;;
19171         *)      echo "It seems that va_copy() or similar will be needed." >&4
19172                 need_va_copy="$define"
19173                 ;;
19174         esac
19175         $rm -f try.* core core.* *.core *.core.*
19176         ;;
19177 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19178         ;;
19179 esac
19180
19181 : see what type is used for size_t
19182 rp="What is the type used for the length parameter for string functions?"
19183 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19184 eval $typedef_ask
19185
19186 : check for type of arguments to gethostbyaddr. 
19187 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19188         case "$d_gethbyaddr" in
19189         $define)
19190                 $cat <<EOM
19191
19192 Checking to see what type of arguments are accepted by gethostbyaddr().
19193 EOM
19194                 hdrs="$define sys/types.h
19195                         $d_socket sys/socket.h 
19196                         $i_niin netinet/in.h 
19197                         $i_netdb netdb.h
19198                         $i_unistd unistd.h"
19199                 : The first arg can 'char *' or 'void *'
19200                 : The second arg is some of integral type
19201                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19202                         for yyy in size_t long int; do
19203                                 case "$netdb_host_type" in
19204                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19205                                         if ./protochk "$try" $hdrs; then
19206                                                 echo "Your system accepts $xxx for the first arg."
19207                                                 echo "...and $yyy for the second arg."
19208                                                 netdb_host_type="$xxx"
19209                                                 netdb_hlen_type="$yyy"
19210                                         fi
19211                                         ;;
19212                                 esac
19213                         done
19214                 done
19215                 : In case none of those worked, prompt the user.
19216                 case "$netdb_host_type" in
19217                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19218                         dflt='char *'
19219                         . ./myread
19220                         netdb_host_type=$ans
19221                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19222                         dflt="$sizetype"
19223                         . ./myread
19224                         netdb_hlen_type=$ans
19225                         ;;
19226                 esac
19227                 ;;
19228         *)      : no gethostbyaddr, so pick harmless defaults
19229                 netdb_host_type='char *'
19230                 netdb_hlen_type="$sizetype"
19231                 ;;
19232         esac
19233         # Remove the "const" if needed. -- but then we'll have a 
19234         # prototype clash!
19235         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19236 fi
19237
19238 : check for type of argument to gethostbyname. 
19239 if test "X$netdb_name_type" = X ; then
19240         case "$d_gethbyname" in
19241         $define)
19242                 $cat <<EOM
19243
19244 Checking to see what type of argument is accepted by gethostbyname().
19245 EOM
19246                 hdrs="$define sys/types.h
19247                         $d_socket sys/socket.h 
19248                         $i_niin netinet/in.h 
19249                         $i_netdb netdb.h
19250                         $i_unistd unistd.h"
19251                 for xxx in "const char *" "char *"; do
19252                         case "$netdb_name_type" in
19253                         '')     try="extern struct hostent *gethostbyname($xxx);"
19254                                 if ./protochk "$try" $hdrs; then
19255                                         echo "Your system accepts $xxx."
19256                                         netdb_name_type="$xxx"
19257                                 fi
19258                                 ;;
19259                         esac
19260                 done
19261                 : In case none of those worked, prompt the user.
19262                 case "$netdb_name_type" in
19263                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19264                         dflt='char *'
19265                         . ./myread
19266                         netdb_name_type=$ans
19267                         ;;
19268                 esac
19269                 ;;
19270         *)      : no gethostbyname, so pick harmless default
19271                 netdb_name_type='char *'
19272                 ;;
19273         esac
19274 fi
19275
19276 : check for type of 1st argument to getnetbyaddr. 
19277 if test "X$netdb_net_type" = X ; then
19278         case "$d_getnbyaddr" in
19279         $define)
19280                 $cat <<EOM
19281
19282 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19283 EOM
19284                 hdrs="$define sys/types.h
19285                         $d_socket sys/socket.h 
19286                         $i_niin netinet/in.h 
19287                         $i_netdb netdb.h
19288                         $i_unistd unistd.h"
19289                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19290                         case "$netdb_net_type" in
19291                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19292                                 if ./protochk "$try" $hdrs; then
19293                                         echo "Your system accepts $xxx."
19294                                         netdb_net_type="$xxx"
19295                                 fi
19296                                 ;;
19297                         esac
19298                 done
19299                 : In case none of those worked, prompt the user.
19300                 case "$netdb_net_type" in
19301                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19302                         dflt='long'
19303                         . ./myread
19304                         netdb_net_type=$ans
19305                         ;;
19306                 esac
19307                 ;;
19308         *)      : no getnetbyaddr, so pick harmless default
19309                 netdb_net_type='long'
19310                 ;;
19311         esac
19312 fi
19313 : locate the preferred pager for this system
19314 fn=f/
19315 case "$pager" in
19316 '')
19317         dflt=''
19318         case "$pg" in
19319         /*) dflt=$pg;;
19320         [a-zA-Z]:/*) dflt=$pg;;
19321         esac
19322         case "$more" in
19323         /*) dflt=$more;;
19324         [a-zA-Z]:/*) dflt=$more;;
19325         esac
19326         case "$less" in
19327         /*) dflt=$less;;
19328         [a-zA-Z]:/*) dflt=$less;;
19329         esac
19330         case "$dflt" in
19331         '') dflt=/usr/ucb/more;;
19332         esac
19333         ;;
19334 *)      dflt="$pager"
19335         : Instruct ./getfile to trust the hinted or previous pager value,
19336         : even if it does not begin with a slash.  For example, on os2,
19337         : pager might be cmd /c more.  See comments in UU/getfile.
19338         fn="f/($pager)"
19339         ;;
19340 esac
19341 echo " "
19342 rp='What pager is used on your system?'
19343 . ./getfile
19344 pager="$ans"
19345
19346 : see what type pids are declared as in the kernel
19347 rp="What is the type of process ids on this system?"
19348 set pid_t pidtype int stdio.h sys/types.h
19349 eval $typedef_ask
19350
19351 : see if ar generates random libraries by itself
19352 echo " "
19353 echo "Checking how to generate random libraries on your machine..." >&4
19354 echo 'int bar1() { return bar2(); }' > bar1.c
19355 echo 'int bar2() { return 2; }' > bar2.c
19356 $cat > foo.c <<EOP
19357 #$i_stdlib I_STDLIB
19358 #ifdef I_STDLIB
19359 #include <stdlib.h>
19360 #endif
19361 int main() { printf("%d\n", bar1()); exit(0); }
19362 EOP
19363 $cc $ccflags -c bar1.c >/dev/null 2>&1
19364 $cc $ccflags -c bar2.c >/dev/null 2>&1
19365 $cc $ccflags -c foo.c >/dev/null 2>&1
19366 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19367 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19368         $run ./foobar >/dev/null 2>&1; then
19369         echo "$ar appears to generate random libraries itself."
19370         orderlib=false
19371         if [ "X$ranlib" = "X" ]; then
19372             ranlib=":"
19373         fi
19374 elif $ar s bar$_a >/dev/null 2>&1 &&
19375         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19376         $run ./foobar >/dev/null 2>&1; then
19377                 echo "a table of contents needs to be added with '$ar s'."
19378                 orderlib=false
19379                 ranlib="$ar s"
19380 elif $ar ts bar$_a >/dev/null 2>&1 &&
19381         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19382         $run ./foobar >/dev/null 2>&1; then
19383                 echo "a table of contents needs to be added with '$ar ts'."
19384                 orderlib=false
19385                 ranlib="$ar ts"
19386 else
19387         case "$ranlib" in
19388         :) ranlib='';;
19389         '')
19390                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19391                 $test -f $ranlib || ranlib=''
19392                 ;;
19393         esac
19394         if $test -n "$ranlib"; then
19395                 echo "your system has '$ranlib'; we'll use that."
19396                 orderlib=false
19397         else
19398                 echo "your system doesn't seem to support random libraries"
19399                 echo "so we'll use lorder and tsort to order the libraries."
19400                 orderlib=true
19401                 ranlib=":"
19402         fi
19403 fi
19404 $rm -f foo* bar*
19405
19406 : check for type of arguments to select. 
19407 case "$selecttype" in
19408 '') case "$d_select" in
19409         $define)
19410                 echo " "
19411                 $cat <<EOM
19412 Checking to see what type of arguments are accepted by select().
19413 EOM
19414                 hdrs="$define sys/types.h
19415                         $i_systime sys/time.h 
19416                         $i_sysselct sys/select.h
19417                         $d_socket sys/socket.h"
19418                 : The first arg can be int, unsigned, or size_t
19419                 : The last arg may or may not be 'const'
19420                 val=''
19421                 : void pointer has been seen but using that
19422                 : breaks the selectminbits test
19423                 for xxx in 'fd_set *' 'int *'; do
19424                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19425                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
19426                                         case "$val" in
19427                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19428                                                 if ./protochk "$try" $hdrs; then
19429                                                         echo "Your system accepts $xxx."
19430                                                         val="$xxx"
19431                                                 fi
19432                                                 ;;
19433                                         esac
19434                                 done
19435                         done
19436                 done
19437                 case "$val" in
19438                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19439                         case "$d_fd_set" in
19440                                 $define) dflt="fd_set *" ;;
19441                                 *)              dflt="int *" ;;
19442                         esac
19443                         . ./myread
19444                         val=$ans
19445                         ;;
19446                 esac
19447                 selecttype="$val"
19448                 ;;
19449         *)      : no select, so pick a harmless default
19450                 selecttype='int *'
19451                 ;;
19452         esac
19453         ;;
19454 esac
19455
19456 : check for the select 'width'
19457 case "$selectminbits" in
19458 '') safebits=`expr $ptrsize \* 8`
19459     case "$d_select" in
19460         $define)
19461                 $cat <<EOM
19462
19463 Checking to see on how many bits at a time your select() operates...
19464 EOM
19465                 $cat >try.c <<EOCP
19466 #include <sys/types.h>
19467 #$i_time I_TIME
19468 #$i_systime I_SYS_TIME
19469 #$i_systimek I_SYS_TIME_KERNEL
19470 #ifdef I_TIME
19471 #   include <time.h>
19472 #endif
19473 #ifdef I_SYS_TIME
19474 #   ifdef I_SYS_TIME_KERNEL
19475 #       define KERNEL
19476 #   endif
19477 #   include <sys/time.h>
19478 #   ifdef I_SYS_TIME_KERNEL
19479 #       undef KERNEL
19480 #   endif
19481 #endif
19482 #$i_sysselct I_SYS_SELECT
19483 #ifdef I_SYS_SELECT
19484 #include <sys/select.h>
19485 #endif
19486 #$d_socket HAS_SOCKET
19487 #ifdef HAS_SOCKET
19488 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19489 #endif
19490 #include <stdio.h>
19491 #$i_stdlib I_STDLIB
19492 #ifdef I_STDLIB
19493 #include <stdlib.h>
19494 #endif
19495 $selecttype b;
19496 #define S sizeof(*(b))
19497 #define MINBITS 64
19498 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19499 #define NBITS  (NBYTES * 8)
19500 int main() {
19501     char *s = malloc(NBYTES);
19502     struct timeval t;
19503     int i;
19504     FILE* fp;
19505     int fd;
19506
19507     if (!s)
19508         exit(1);
19509     fclose(stdin);
19510     fp = fopen("try.c", "r");
19511     if (fp == 0)
19512       exit(2);
19513     fd = fileno(fp);
19514     if (fd < 0)
19515       exit(3);
19516     b = ($selecttype)s;
19517     for (i = 0; i < NBITS; i++)
19518         FD_SET(i, b);
19519     t.tv_sec  = 0;
19520     t.tv_usec = 0;
19521     select(fd + 1, b, 0, 0, &t);
19522     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
19523     free(s);
19524     printf("%d\n", i + 1);
19525     return 0;
19526 }
19527 EOCP
19528                 set try
19529                 if eval $compile_ok; then
19530                         selectminbits=`$run ./try`
19531                         case "$selectminbits" in
19532                         '')     cat >&4 <<EOM
19533 Cannot figure out on how many bits at a time your select() operates.
19534 I'll play safe and guess it is $safebits bits.
19535 EOM
19536                                 selectminbits=$safebits
19537                                 bits="$safebits bits"
19538                                 ;;
19539                         1)      bits="1 bit" ;;
19540                         *)      bits="$selectminbits bits" ;;
19541                         esac
19542                         echo "Your select() operates on $bits at a time." >&4
19543                 else
19544                         rp='What is the minimum number of bits your select() operates on?'
19545                         case "$byteorder" in
19546                         12345678)       dflt=64 ;;
19547                         1234)           dflt=32 ;;
19548                         *)              dflt=1  ;;
19549                         esac
19550                         . ./myread
19551                         val=$ans
19552                         selectminbits="$val"
19553                 fi
19554                 $rm -f try.* try
19555                 ;;
19556         *)      : no select, so pick a harmless default
19557                 selectminbits=$safebits
19558                 ;;
19559         esac
19560         ;;
19561 esac
19562
19563 : Trace out the files included by signal.h, then look for SIGxxx names.
19564 : Remove SIGARRAYSIZE used by HPUX.
19565 : Remove SIGSTKSIZE used by Linux.
19566 : Remove SIGSTKSZ used by Posix.
19567 : Remove SIGTYP void lines used by OS2.
19568 : Some cpps, like os390, dont give the file name anywhere
19569 if [ "X$fieldn" = X ]; then
19570         : Just make some guesses.  We check them later.
19571         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19572 else
19573         xxx=`echo '#include <signal.h>' |
19574         $cppstdin $cppminus $cppflags 2>/dev/null |
19575         $grep '^[       ]*#.*include' | 
19576         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
19577 fi
19578 : Check this list of files to be sure we have parsed the cpp output ok.
19579 : This will also avoid potentially non-existent files, such 
19580 : as ../foo/bar.h
19581 xxxfiles=''
19582 for xx in $xxx /dev/null ; do
19583         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19584 done
19585 : If we have found no files, at least try signal.h
19586 case "$xxxfiles" in
19587 '')     xxxfiles=`./findhdr signal.h` ;;
19588 esac
19589 xxx=`awk '
19590 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19591         print substr($2, 4, 20)
19592 }
19593 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19594         print substr($3, 4, 20)
19595 }' $xxxfiles`
19596 : Append some common names just in case the awk scan failed.
19597 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19598 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19599 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19600 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19601 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19602
19603 : generate a few handy files for later
19604 $cat > signal.c <<EOCP
19605 #include <sys/types.h>
19606 #include <signal.h>
19607 #$i_stdlib I_STDLIB
19608 #ifdef I_STDLIB
19609 #include <stdlib.h>
19610 #endif
19611 #include <stdio.h>
19612 int main() {
19613
19614 /* Strange style to avoid deeply-nested #if/#else/#endif */
19615 #ifndef NSIG
19616 #  ifdef _NSIG
19617 #    define NSIG (_NSIG)
19618 #  endif
19619 #endif
19620
19621 #ifndef NSIG
19622 #  ifdef SIGMAX
19623 #    define NSIG (SIGMAX+1)
19624 #  endif
19625 #endif
19626
19627 #ifndef NSIG
19628 #  ifdef SIG_MAX
19629 #    define NSIG (SIG_MAX+1)
19630 #  endif
19631 #endif
19632
19633 #ifndef NSIG
19634 #  ifdef _SIG_MAX
19635 #    define NSIG (_SIG_MAX+1)
19636 #  endif
19637 #endif
19638
19639 #ifndef NSIG
19640 #  ifdef MAXSIG
19641 #    define NSIG (MAXSIG+1)
19642 #  endif
19643 #endif
19644
19645 #ifndef NSIG
19646 #  ifdef MAX_SIG
19647 #    define NSIG (MAX_SIG+1)
19648 #  endif
19649 #endif
19650
19651 #ifndef NSIG
19652 #  ifdef SIGARRAYSIZE
19653 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
19654 #  endif
19655 #endif
19656
19657 #ifndef NSIG
19658 #  ifdef _sys_nsig
19659 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
19660 #  endif
19661 #endif
19662
19663 /* Default to some arbitrary number that's big enough to get most
19664    of the common signals.
19665 */
19666 #ifndef NSIG
19667 #    define NSIG 50
19668 #endif
19669
19670 printf("NSIG %d\n", NSIG);
19671
19672 #ifndef JUST_NSIG
19673
19674 EOCP
19675
19676 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19677 {
19678         printf "#ifdef SIG"; printf $1; printf "\n"
19679         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
19680         printf $1; printf ");\n"
19681         printf "#endif\n"
19682 }
19683 END {
19684         printf "#endif /* JUST_NSIG */\n";
19685         printf "exit(0);\n}\n";
19686 }
19687 ' >>signal.c
19688 $cat >signal.awk <<'EOP'
19689 BEGIN { ndups = 0 }
19690 $1 ~ /^NSIG$/ { nsig = $2 }
19691 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
19692     if ($2 > maxsig) { maxsig = $2 }
19693     if (sig_name[$2]) {
19694         dup_name[ndups] = $1
19695         dup_num[ndups] = $2
19696         ndups++ 
19697     }
19698     else {
19699         sig_name[$2] = $1
19700         sig_num[$2] = $2
19701     }
19702 }
19703 END { 
19704     if (nsig == 0) {
19705         nsig = maxsig + 1
19706     }
19707     printf("NSIG %d\n", nsig);
19708     for (n = 1; n < nsig; n++) {
19709         if (sig_name[n]) {
19710             printf("%s %d\n", sig_name[n], sig_num[n])
19711         }
19712         else {
19713             printf("NUM%d %d\n", n, n) 
19714         }
19715     }
19716     for (n = 0; n < ndups; n++) {
19717         printf("%s %d\n", dup_name[n], dup_num[n])
19718     }
19719 }
19720 EOP
19721 $cat >signal_cmd <<EOS
19722 $startsh
19723 if $test -s signal.lst; then
19724     echo "Using your existing signal.lst file"
19725         exit 0
19726 fi
19727 xxx="$xxx"
19728 EOS
19729 $cat >>signal_cmd <<'EOS'
19730
19731 set signal
19732 if eval $compile_ok; then
19733         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
19734 else
19735         echo "(I can't seem be able to compile the whole test program)" >&4
19736         echo "(I'll try it in little pieces.)" >&4
19737         set signal -DJUST_NSIG
19738         if eval $compile_ok; then
19739                 $run ./signal$_exe > signal.nsg
19740                 $cat signal.nsg
19741         else
19742                 echo "I can't seem to figure out how many signals you have." >&4
19743                 echo "Guessing 50." >&4
19744                 echo 'NSIG 50' > signal.nsg
19745         fi
19746         : Now look at all the signal names, one at a time.
19747         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
19748                 $cat > signal.c <<EOCP
19749 #include <sys/types.h>
19750 #include <signal.h>
19751 #include <stdio.h>
19752 int main() {
19753 printf("$xx %d\n", SIG${xx});
19754 return 0;
19755 }
19756 EOCP
19757                 set signal
19758                 if eval $compile; then
19759                         echo "SIG${xx} found."
19760                         $run ./signal$_exe  >> signal.ls1
19761                 else
19762                         echo "SIG${xx} NOT found."
19763                 fi
19764         done
19765         if $test -s signal.ls1; then
19766                 $cat signal.nsg signal.ls1 |
19767                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
19768         fi
19769
19770 fi
19771 if $test -s signal.lst; then
19772         :
19773 else
19774         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
19775         echo 'kill -l' >signal
19776         set X `csh -f <signal`
19777         $rm -f signal
19778         shift
19779         case $# in
19780         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
19781         esac
19782         echo $@ | $tr ' ' $trnl | \
19783             $awk '{ printf "%s %d\n", $1, ++s; }
19784                   END { printf "NSIG %d\n", ++s }' >signal.lst
19785 fi
19786 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
19787 EOS
19788 chmod a+x signal_cmd
19789 $eunicefix signal_cmd
19790
19791 : generate list of signal names
19792 echo " "
19793 case "$sig_name_init" in
19794 '') doinit=yes ;;
19795 *)  case "$sig_num_init" in
19796     ''|*,*) doinit=yes ;;
19797     esac ;;
19798 esac
19799 case "$doinit" in
19800 yes)
19801         echo "Generating a list of signal names and numbers..." >&4
19802         . ./signal_cmd
19803         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
19804         sig_name=`$awk 'BEGIN { printf "ZERO " }
19805                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
19806         sig_num=`$awk  'BEGIN { printf "0 " }
19807                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
19808         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
19809                              !/^NSIG/   { printf "\"%s\", ", $1 }
19810                              END        { printf "0\n" }' signal.lst`
19811         sig_num_init=`$awk  'BEGIN      { printf "0, " }
19812                              !/^NSIG/   { printf "%d, ", $2}
19813                              END        { printf "0\n"}' signal.lst`
19814         ;;
19815 esac
19816 echo "The following $sig_count signals are available:"
19817 echo " "
19818 echo $sig_name | $awk \
19819 'BEGIN { linelen = 0 }
19820 {
19821         for (i = 1; i <= NF; i++) {
19822                 name = "SIG" $i " "
19823                 linelen = linelen + length(name)
19824                 if (linelen > 70) {
19825                         printf "\n"
19826                         linelen = length(name)
19827                 }
19828                 printf "%s", name
19829         }
19830         printf "\n"
19831 }'
19832 sig_size=`echo $sig_name | awk '{print NF}'`
19833 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
19834
19835 echo " "
19836 case "$sizetype" in
19837 *_t) zzz="$sizetype"    ;;
19838 *)   zzz="filesize"     ;;
19839 esac
19840 echo "Checking the size of $zzz..." >&4 
19841 cat > try.c <<EOCP
19842 #include <sys/types.h>
19843 #include <stdio.h>
19844 #$i_stdlib I_STDLIB
19845 #ifdef I_STDLIB
19846 #include <stdlib.h>
19847 #endif
19848 int main() {
19849     printf("%d\n", (int)sizeof($sizetype));
19850     exit(0);
19851 }
19852 EOCP
19853 set try
19854 if eval $compile_ok; then
19855         yyy=`$run ./try`
19856         case "$yyy" in
19857         '')     sizesize=4
19858                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
19859                 ;;
19860         *)      sizesize=$yyy
19861                 echo "Your $zzz size is $sizesize bytes."
19862                 ;;
19863         esac
19864 else
19865         sizesize=4
19866         echo "(I can't compile the test program--guessing $sizesize.)" >&4
19867 fi
19868
19869
19870 : check for socklen_t
19871 echo " "
19872 echo "Checking to see if you have socklen_t..." >&4
19873 $cat >try.c <<EOCP
19874 #include <sys/types.h>
19875 #$d_socket HAS_SOCKET
19876 #ifdef HAS_SOCKET
19877 #include <sys/socket.h>
19878 #endif
19879 int main() { socklen_t x = 16; }
19880 EOCP
19881 set try
19882 if eval $compile; then
19883         val="$define"
19884         echo "You have socklen_t."
19885 else
19886         val="$undef"
19887         echo "You do not have socklen_t."
19888         case "$sizetype" in
19889         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
19890         esac
19891 fi
19892 $rm -f try try.*
19893 set d_socklen_t
19894 eval $setvar
19895
19896 : see if this is a socks.h system
19897 set socks.h i_socks
19898 eval $inhdr
19899
19900 : check for type of the size argument to socket calls
19901 case "$d_socket" in
19902 "$define")
19903         $cat <<EOM
19904
19905 Checking to see what type is the last argument of accept().
19906 EOM
19907         yyy=''
19908         case "$d_socklen_t" in
19909         "$define") yyy="$yyy socklen_t"
19910         esac
19911         yyy="$yyy $sizetype int long unsigned"
19912         for xxx in $yyy; do
19913                 case "$socksizetype" in
19914                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
19915                         case "$usesocks" in
19916                         "$define")
19917                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
19918                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19919                                         socksizetype="$xxx"
19920                                 fi
19921                                 ;;
19922                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
19923                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19924                                         socksizetype="$xxx"
19925                                 fi
19926                                 ;;
19927                         esac
19928                         ;;
19929                 esac
19930         done
19931 : In case none of those worked, prompt the user.
19932         case "$socksizetype" in
19933         '')     rp='What is the type for socket address structure sizes?'
19934                 dflt='int'
19935                 . ./myread
19936                 socksizetype=$ans
19937                 ;;
19938         esac
19939         ;;
19940 *)      : no sockets, so pick relatively harmless default
19941         socksizetype='int'
19942         ;;
19943 esac
19944
19945 : see what type is used for signed size_t
19946 set ssize_t ssizetype int stdio.h sys/types.h
19947 eval $typedef
19948 dflt="$ssizetype"
19949 $cat > try.c <<EOM
19950 #include <stdio.h>
19951 #$i_stdlib I_STDLIB
19952 #ifdef I_STDLIB
19953 #include <stdlib.h>
19954 #endif
19955 #include <sys/types.h>
19956 #define Size_t $sizetype
19957 #define SSize_t $dflt
19958 int main()
19959 {
19960         if (sizeof(Size_t) == sizeof(SSize_t))
19961                 printf("$dflt\n");
19962         else if (sizeof(Size_t) == sizeof(int))
19963                 printf("int\n");
19964         else 
19965                 printf("long\n");
19966         exit(0);
19967 }
19968 EOM
19969 echo " "
19970 set try
19971 if eval $compile_ok && $run ./try > /dev/null; then
19972         ssizetype=`$run ./try`
19973         echo "I'll be using $ssizetype for functions returning a byte count." >&4
19974 else
19975         $cat >&4 <<EOM
19976 Help! I can't compile and run the ssize_t test program: please enlighten me!
19977 (This is probably a misconfiguration in your system or libraries, and
19978 you really ought to fix it.  Still, I'll try anyway.)
19979
19980 I need a type that is the same size as $sizetype, but is guaranteed to
19981 be signed.  Common values are ssize_t, int and long.
19982
19983 EOM
19984         rp="What signed type is the same size as $sizetype?"
19985         . ./myread
19986         ssizetype="$ans"
19987 fi
19988 $rm -f try try.*
19989
19990 : see what type of char stdio uses.
19991 echo " "
19992 echo '#include <stdio.h>' > stdio.c
19993 $cppstdin $cppminus < stdio.c > stdioh
19994 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
19995         echo "Your stdio uses unsigned chars." >&4
19996         stdchar="unsigned char"
19997 else
19998         echo "Your stdio uses signed chars." >&4
19999         stdchar="char"
20000 fi
20001 $rm -f stdio.* stdioh
20002
20003 : see what type uids are declared as in the kernel
20004 echo " "
20005 echo "Looking for the type for user ids returned by getuid()."
20006 set uid_t uidtype xxx stdio.h sys/types.h
20007 eval $typedef
20008 case "$uidtype" in
20009 xxx)
20010         xxx=`./findhdr sys/user.h`
20011         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20012         case $1 in
20013         unsigned) dflt="$1 $2" ;;
20014         *) dflt="$1" ;;
20015         esac
20016         ;;
20017 *) dflt="$uidtype";;
20018 esac
20019 case "$uidtype" in
20020 uid_t)  echo "uid_t found." ;;
20021 *)      rp="What is the type for user ids returned by getuid()?"
20022         . ./myread
20023         uidtype="$ans"
20024         ;;
20025 esac
20026
20027 echo " "
20028 case "$uidtype" in
20029 *_t) zzz="$uidtype"     ;;
20030 *)   zzz="uid"          ;;
20031 esac
20032 echo "Checking the size of $zzz..." >&4 
20033 cat > try.c <<EOCP
20034 #include <sys/types.h>
20035 #include <stdio.h>
20036 #$i_stdlib I_STDLIB
20037 #ifdef I_STDLIB
20038 #include <stdlib.h>
20039 #endif
20040 int main() {
20041     printf("%d\n", (int)sizeof($uidtype));
20042     exit(0);
20043 }
20044 EOCP
20045 set try
20046 if eval $compile_ok; then
20047         yyy=`$run ./try`
20048         case "$yyy" in
20049         '')     uidsize=4
20050                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20051                 ;;
20052         *)      uidsize=$yyy
20053                 echo "Your $zzz is $uidsize bytes long."
20054                 ;;
20055         esac
20056 else
20057         uidsize=4
20058         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20059 fi
20060
20061 echo " "
20062 case "$uidtype" in
20063 *_t) zzz="$uidtype"     ;;
20064 *)   zzz="uid"          ;;
20065 esac
20066 echo "Checking the sign of $zzz..." >&4
20067 cat > try.c <<EOCP
20068 #include <sys/types.h>
20069 #include <stdio.h>
20070 int main() {
20071         $uidtype foo = -1;
20072         if (foo < 0)
20073                 printf("-1\n");
20074         else
20075                 printf("1\n");
20076 }
20077 EOCP
20078 set try
20079 if eval $compile; then
20080         yyy=`$run ./try`
20081         case "$yyy" in
20082         '')     uidsign=1
20083                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20084                 ;;
20085         *)      uidsign=$yyy
20086                 case "$uidsign" in
20087                  1) echo "Your $zzz is unsigned." ;;
20088                 -1) echo "Your $zzz is signed."   ;;
20089                 esac
20090                 ;;
20091         esac
20092 else
20093         uidsign=1
20094         echo "(I can't compile the test program--guessing unsigned.)" >&4
20095 fi
20096
20097
20098
20099 echo " "
20100 $echo "Checking the format string to be used for uids..." >&4
20101
20102 case "$uidsign" in
20103 -1)     if $test X"$uidsize" = X"$ivsize"; then
20104                 uidformat="$ivdformat"
20105         else
20106                 if $test X"$uidsize" = X"$longsize"; then
20107                         uidformat='"ld"'
20108                 else
20109                         if $test X"$uidsize" = X"$intsize"; then
20110                                 uidformat='"d"'
20111                         else
20112                                 if $test X"$uidsize" = X"$shortsize"; then
20113                                         uidformat='"hd"'
20114                                 fi
20115                         fi
20116                 fi
20117         fi
20118         ;;
20119 *)      if $test X"$uidsize" = X"$uvsize"; then
20120                 uidformat="$uvuformat"
20121         else
20122                 if $test X"$uidsize" = X"$longsize"; then
20123                         uidformat='"lu"'
20124                 else
20125                         if $test X"$uidsize" = X"$intsize"; then
20126                                 uidformat='"u"'
20127                         else
20128                                 if $test X"$uidsize" = X"$shortsize"; then
20129                                         uidformat='"hu"'
20130                                 fi
20131                         fi
20132                 fi
20133         fi
20134         ;;
20135 esac
20136
20137
20138 case "$usesitecustomize" in
20139     $define|true|[Yy]*)
20140         usesitecustomize="$define"
20141         ;;
20142     *)
20143         usesitecustomize="$undef"
20144         ;;
20145     esac
20146
20147 : determine compiler compiler
20148 case "$yacc" in
20149 '')
20150         dflt=yacc;;
20151 *)
20152         dflt="$yacc";;
20153 esac
20154 echo " "
20155 comp='yacc'
20156 if $test -f "$byacc$_exe"; then
20157         dflt="$byacc"
20158         comp="byacc or $comp"
20159 fi
20160 if $test -f "$bison$_exe"; then
20161         comp="$comp or bison -y"
20162 fi
20163 rp="Which compiler compiler ($comp) shall I use?"
20164 . ./myread
20165 yacc="$ans"
20166 case "$yacc" in
20167 *bis*)
20168         case "$yacc" in
20169         *-y*) ;;
20170         *)
20171                 yacc="$yacc -y"
20172                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20173                 ;;
20174         esac
20175         ;;
20176 esac
20177
20178 : see if this is a fp.h system
20179 set fp.h i_fp
20180 eval $inhdr
20181
20182 : see if this is a fp_class.h system
20183 set fp_class.h i_fp_class
20184 eval $inhdr
20185
20186 : see if this is a ieeefp.h system
20187 case "$i_ieeefp" in
20188 '' ) set ieeefp.h i_ieeefp
20189      eval $inhdr
20190      ;;
20191 esac
20192
20193 : see if this is a libutil.h system
20194 set libutil.h i_libutil
20195 eval $inhdr
20196
20197 : see if mach cthreads are available
20198 if test "X$usethreads" = "X$define"; then
20199         set mach/cthreads.h i_machcthr
20200         eval $inhdr
20201 else
20202         i_machcthr="$undef"
20203 fi
20204
20205
20206
20207 : see if this is a mntent.h system
20208 set mntent.h i_mntent
20209 eval $inhdr
20210
20211 : see if ndbm.h is available
20212 set ndbm.h t_ndbm
20213 eval $inhdr
20214
20215 case "$t_ndbm" in
20216 $undef)
20217     # Some Linux distributions such as RedHat 7.1 put the
20218     # ndbm.h header in /usr/include/gdbm/ndbm.h.
20219     if $test -f /usr/include/gdbm/ndbm.h; then
20220         echo '<gdbm/ndbm.h> found.'
20221         ccflags="$ccflags -I/usr/include/gdbm"
20222         cppflags="$cppflags -I/usr/include/gdbm"
20223         t_ndbm=$define
20224     fi
20225     ;;
20226 esac
20227
20228 case "$t_ndbm" in
20229 $define)
20230         : see if dbm_open exists
20231         set dbm_open d_dbm_open
20232         eval $inlibc
20233         case "$d_dbm_open" in
20234         $undef)
20235                 t_ndbm="$undef"
20236                 echo "We won't be including <ndbm.h>"
20237                 ;;
20238         esac
20239         ;;
20240 esac
20241 val="$t_ndbm"
20242 set i_ndbm
20243 eval $setvar
20244
20245 : see if net/errno.h is available
20246 val=''
20247 set net/errno.h val
20248 eval $inhdr
20249
20250 : Unfortunately, it causes problems on some systems.  Arrgh.
20251 case "$val" in
20252 $define)
20253         cat > try.c <<'EOM'
20254 #include <stdio.h>
20255 #include <errno.h>
20256 #include <net/errno.h>
20257 int func()
20258 {
20259         return ENOTSOCK;
20260 }
20261 EOM
20262         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20263                 echo "We'll be including <net/errno.h>." >&4
20264         else
20265                 echo "We won't be including <net/errno.h>." >&4
20266                 val="$undef"
20267         fi
20268         $rm -f try.* try
20269         ;;
20270 esac
20271 set i_neterrno
20272 eval $setvar
20273
20274 : see if netinet/tcp.h is available
20275 set netinet/tcp.h i_netinettcp
20276 eval $inhdr
20277
20278 : see if this is a poll.h system
20279 set poll.h i_poll
20280 eval $inhdr
20281
20282 : see if this is a prot.h system
20283 set prot.h i_prot
20284 eval $inhdr
20285
20286 echo " "
20287 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20288 $cat <<'EOSH' > Cppsym.know
20289 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20290 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20291 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20292 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20293 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20294 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20295 bull c cadmus clipper CMU COFF COMPILER_VERSION
20296 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20297 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20298 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20299 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20300 GLIBC GLIBC_MINOR
20301 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20302 H3050R H3050RX hbullx20 hcx host_mips
20303 hp200 hp300 hp700 HP700 hp800 hp9000
20304 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20305 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20306 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20307 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20308 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20309 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20310 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20311 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20312 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20313 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20314 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20315 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20316 MATH_HAS_NO_SIDE_EFFECTS
20317 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20318 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20319 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20320 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20321 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20322 NetBSD news1500 news1700 news1800 news1900 news3700
20323 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20324 ns32016 ns32332 ns32k nsc32000
20325 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20326 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20327 pc532 pdp11 PGC PIC plexus PORTAR posix
20328 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20329 POSIX_C_SOURCE POSIX_SOURCE POWER
20330 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
20331 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20332 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20333 sony sony_news sonyrisc sparc sparclite spectrum
20334 stardent stdc STDC_EXT stratos sun sun3 sun386
20335 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20336 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20337 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20338 sysV68 sysV88 Tek4132 Tek4300 titan
20339 TM3200 TM5400 TM5600
20340 tower tower32 tower32_200 tower32_600 tower32_700
20341 tower32_800 tower32_850 tss
20342 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20343 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20344 unix UNIX95 UNIX99 unixpc unos
20345 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20346 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20347 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20348 USGr4 USGr4_2
20349 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20350 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20351 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20352 z8000
20353 EOSH
20354 # Maybe put other stuff here too.
20355 cat <<EOSH >>Cppsym.know
20356 $osname
20357 EOSH
20358 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20359 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20360 $cat Cppsym.know > Cppsym.c
20361 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20362 $rm -f Cppsym.a Cppsym.b Cppsym.c
20363 cat <<EOSH > Cppsym
20364 $startsh
20365 if $test \$# -gt 0; then
20366     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20367     if $test -s Cppsym.got; then
20368         $rm -f Cppsym.got
20369         exit 0
20370     fi
20371     $rm -f Cppsym.got
20372     exit 1
20373 else
20374     $tr " " "$trnl" | ./Cppsym.try
20375     exit 0
20376 fi
20377 EOSH
20378 chmod +x Cppsym
20379 $eunicefix Cppsym
20380 cat <<EOSH > Cppsym.try
20381 $startsh
20382 cat <<'EOCP' > try.c
20383 #include <stdio.h>
20384 #if cpp_stuff == 1
20385 #define STRINGIFY(a)    "a"
20386 #endif
20387 #if cpp_stuff == 42
20388 #define StGiFy(a)  #a
20389 #define STRINGIFY(a)    StGiFy(a)
20390 #endif
20391 #if $cpp_stuff != 1 && $cpp_stuff != 42
20392 #   include "Bletch: How does this C preprocessor stringify macros?"
20393 #endif
20394 int main() {
20395 EOCP
20396 $awk \\
20397 EOSH
20398 cat <<'EOSH' >> Cppsym.try
20399 'length($1) > 0 {
20400     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20401     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20402     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20403     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
20404 }'       >> try.c
20405 echo 'return 0;}' >> try.c
20406 EOSH
20407 cat <<EOSH >> Cppsym.try
20408 ccflags="$ccflags"
20409 case "$osname-$gccversion" in
20410 irix-) ccflags="\$ccflags -woff 1178" ;;
20411 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20412 esac
20413 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
20414 EOSH
20415 chmod +x Cppsym.try
20416 $eunicefix Cppsym.try
20417 ./Cppsym < Cppsym.know > Cppsym.true
20418 : Add in any linux cpp "predefined macros":
20419 case "$osname::$gccversion" in
20420   *linux*::*.*)
20421     tHdrH=_tmpHdr
20422     rm -f $tHdrH'.h' $tHdrH
20423     touch $tHdrH'.h'
20424     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
20425        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
20426        if [ -s $tHdrH'_cppsym.real' ]; then
20427           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
20428        fi
20429     fi
20430     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
20431   ;;
20432 esac
20433 : now check the C compiler for additional symbols
20434 postprocess_cc_v=''
20435 case "$osname" in
20436 aix) postprocess_cc_v="|$tr , ' '" ;;
20437 esac
20438 $cat >ccsym <<EOS
20439 $startsh
20440 $cat >tmp.c <<EOF
20441 extern int foo;
20442 EOF
20443 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20444 do
20445         case "\$i" in
20446         -D*) echo "\$i" | $sed 's/^-D//';;
20447         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
20448         esac
20449 done
20450 $rm -f try.c
20451 EOS
20452 postprocess_cc_v=''
20453 chmod +x ccsym
20454 $eunicefix ccsym
20455 ./ccsym > ccsym1.raw
20456 if $test -s ccsym1.raw; then
20457        $sort ccsym1.raw | $uniq >ccsym.raw
20458 else
20459        mv ccsym1.raw ccsym.raw
20460 fi
20461
20462 $awk '/\=/ { print $0; next }
20463         { print $0"=1" }' ccsym.raw >ccsym.list
20464 $comm -13 Cppsym.true ccsym.list >ccsym.own
20465 $comm -12 Cppsym.true ccsym.list >ccsym.com
20466 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
20467 also=''
20468 if $test -z ccsym.raw; then
20469         echo "Your C compiler doesn't seem to define any symbols!" >&4
20470         echo " "
20471         echo "However, your C preprocessor defines the following symbols:"
20472         $cat Cppsym.true
20473         ccsymbols=''
20474         cppsymbols=`$cat Cppsym.true`
20475         cppsymbols=`echo $cppsymbols`
20476         cppccsymbols="$cppsymbols"
20477 else
20478         if $test -s ccsym.com; then
20479                 echo "Your C compiler and pre-processor define these symbols:"
20480                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20481                 also='also '
20482                 symbols='ones'
20483                 cppccsymbols=`$cat ccsym.com`
20484                 cppccsymbols=`echo $cppccsymbols`
20485                 $test "$silent" || sleep 1
20486         fi
20487         if $test -s ccsym.cpp; then
20488                 $test "$also" && echo " "
20489                 echo "Your C pre-processor ${also}defines the following symbols:"
20490                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20491                 also='further '
20492                 cppsymbols=`$cat ccsym.cpp`
20493                 cppsymbols=`echo $cppsymbols`
20494                 $test "$silent" || sleep 1
20495         fi
20496         if $test -s ccsym.own; then
20497                 $test "$also" && echo " "
20498                 echo "Your C compiler ${also}defines the following cpp symbols:"
20499                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20500                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20501                 ccsymbols=`$cat ccsym.own`
20502                 ccsymbols=`echo $ccsymbols`
20503                 $test "$silent" || sleep 1
20504         fi
20505 fi
20506
20507 : see if this is a termio system
20508 val="$undef"
20509 val2="$undef"
20510 val3="$undef"
20511 if $test `./findhdr termios.h`; then
20512         set tcsetattr i_termios
20513         eval $inlibc
20514         val3="$i_termios"
20515 fi
20516 echo " "
20517 case "$val3" in
20518 "$define") echo "You have POSIX termios.h... good!" >&4;;
20519 *) if ./Cppsym pyr; then
20520                 case "`/bin/universe`" in
20521                 ucb) if $test `./findhdr sgtty.h`; then
20522                                 val2="$define"
20523                                 echo "<sgtty.h> found." >&4
20524                         else
20525                                 echo "System is pyramid with BSD universe."
20526                                 echo "<sgtty.h> not found--you could have problems." >&4
20527                         fi;;
20528                 *) if $test `./findhdr termio.h`; then
20529                                 val="$define"
20530                                 echo "<termio.h> found." >&4
20531                         else
20532                                 echo "System is pyramid with USG universe."
20533                                 echo "<termio.h> not found--you could have problems." >&4
20534                         fi;;
20535                 esac
20536         elif ./usg; then
20537                 if $test `./findhdr termio.h`; then
20538                         echo "<termio.h> found." >&4
20539                         val="$define"
20540                 elif $test `./findhdr sgtty.h`; then
20541                         echo "<sgtty.h> found." >&4
20542                         val2="$define"
20543                 else
20544 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20545                 fi
20546         else
20547                 if $test `./findhdr sgtty.h`; then
20548                         echo "<sgtty.h> found." >&4
20549                         val2="$define"
20550                 elif $test `./findhdr termio.h`; then
20551                         echo "<termio.h> found." >&4
20552                         val="$define"
20553                 else
20554 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20555                 fi
20556         fi;;
20557 esac
20558 set i_termio; eval $setvar
20559 val=$val2; set i_sgtty; eval $setvar
20560 val=$val3; set i_termios; eval $setvar
20561
20562 : see if stddef is available
20563 set stddef.h i_stddef
20564 eval $inhdr
20565
20566 : see if this is a sunmath.h system
20567 set sunmath.h i_sunmath
20568 eval $inhdr
20569
20570 : see if sys/access.h is available
20571 set sys/access.h i_sysaccess
20572 eval $inhdr
20573
20574 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20575 set sys/filio.h i_sysfilio
20576 eval $inhdr
20577 echo " "
20578 if $test `./findhdr sys/ioctl.h`; then
20579         val="$define"
20580         echo '<sys/ioctl.h> found.' >&4
20581 else
20582         val="$undef"
20583         if $test $i_sysfilio = "$define"; then
20584             echo '<sys/ioctl.h> NOT found.' >&4
20585         else
20586                 $test $i_sgtty = "$define" && xxx="sgtty.h"
20587                 $test $i_termio = "$define" && xxx="termio.h"
20588                 $test $i_termios = "$define" && xxx="termios.h"
20589 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20590         fi
20591 fi
20592 set i_sysioctl
20593 eval $setvar
20594
20595 : see if socket ioctl defs are in sys/sockio.h
20596 echo " "
20597 xxx=`./findhdr sys/sockio.h`
20598 if $test "$xxx"; then
20599         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20600                 val="$define"
20601                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20602         else
20603                 val="$undef"
20604                 echo "No socket ioctls found in <sys/sockio.h>." >&4
20605         fi
20606 else
20607         val="$undef"
20608         $cat <<EOM
20609 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20610 EOM
20611 fi
20612 set i_syssockio
20613 eval $setvar
20614
20615
20616 : see if this is a syslog.h system
20617 set syslog.h i_syslog
20618 eval $inhdr
20619
20620
20621 : see if this is a sys/mode.h system
20622 set sys/mode.h i_sysmode
20623 eval $inhdr
20624
20625 : see if sys/resource.h has to be included
20626 set sys/resource.h i_sysresrc
20627 eval $inhdr
20628
20629 : see if sys/security.h is available
20630 set sys/security.h i_syssecrt
20631 eval $inhdr
20632
20633 : see if this is a sys/statvfs.h system
20634 set sys/statvfs.h i_sysstatvfs
20635 eval $inhdr
20636
20637 : see if this is a sys/un.h system
20638 set sys/un.h i_sysun
20639 eval $inhdr
20640
20641
20642 : see if this is a sys/utsname.h system
20643 set sys/utsname.h i_sysutsname
20644 eval $inhdr
20645
20646 : see if this is a syswait system
20647 set sys/wait.h i_syswait
20648 eval $inhdr
20649
20650 : see if this is a ustat.h system
20651 set ustat.h i_ustat
20652 eval $inhdr
20653
20654 : see if this is an utime system
20655 set utime.h i_utime
20656 eval $inhdr
20657
20658 : see if this is a values.h system
20659 set values.h i_values
20660 eval $inhdr
20661
20662 : see if this is a vfork system
20663 case "$d_vfork" in
20664 "$define")
20665         set vfork.h i_vfork
20666         eval $inhdr
20667         ;;
20668 *)
20669         i_vfork="$undef"
20670         ;;
20671 esac
20672
20673 : see if gdbm.h is available
20674 set gdbm.h t_gdbm
20675 eval $inhdr
20676 case "$t_gdbm" in
20677 $define)
20678         : see if gdbm_open exists
20679         set gdbm_open d_gdbm_open
20680         eval $inlibc
20681         case "$d_gdbm_open" in
20682         $undef)
20683                 t_gdbm="$undef"
20684                 echo "We won't be including <gdbm.h>"
20685                 ;;
20686         esac
20687         ;;
20688 esac
20689 val="$t_gdbm"
20690 set i_gdbm
20691 eval $setvar
20692
20693 echo " "
20694 echo "Looking for extensions..." >&4
20695 : If we are using the old config.sh, known_extensions may contain
20696 : old or inaccurate or duplicate values.
20697 known_extensions=''
20698 nonxs_extensions=''
20699 : We do not use find because it might not be available.
20700 : We do not just use MANIFEST because the user may have dropped
20701 : some additional extensions into the source tree and expect them
20702 : to be built.
20703
20704 : Function to recursively find available extensions, ignoring DynaLoader
20705 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
20706 find_extensions='
20707     for xxx in *; do
20708        case "$xxx" in
20709            DynaLoader|dynaload) ;;
20710            *)
20711            if $test -f $xxx/$xxx.xs; then
20712                known_extensions="$known_extensions $1$xxx";
20713            elif $test -f $xxx/Makefile.PL; then
20714                nonxs_extensions="$nonxs_extensions $1$xxx";
20715            else
20716                if $test -d $xxx -a $# -lt 10; then
20717                    set $1$xxx/ $*;
20718                    cd "$xxx";
20719                    eval $find_extensions;
20720                    cd ..;
20721                    shift;
20722                fi;
20723            fi
20724            ;;
20725        esac;
20726     done'
20727 tdir=`pwd`
20728 cd "$rsrc/ext"
20729 set X
20730 shift
20731 eval $find_extensions
20732 # Special case:  Add in threads/shared since it is not picked up by the
20733 # recursive find above (and adding in general recursive finding breaks
20734 # SDBM_File/sdbm).  A.D.  10/25/2001.
20735 known_extensions="$known_extensions threads/shared"
20736 set X $nonxs_extensions
20737 shift
20738 nonxs_extensions="$*"
20739 set X $known_extensions
20740 shift
20741 known_extensions="$*"
20742 cd "$tdir"
20743
20744 : Now see which are supported on this system.
20745 avail_ext=''
20746 for xxx in $known_extensions ; do
20747         case "$xxx" in
20748         DB_File|db_file)
20749                 case "$i_db" in
20750                 $define) avail_ext="$avail_ext $xxx" ;;
20751                 esac
20752                 ;;
20753         GDBM_File|gdbm_fil)
20754                 case "$i_gdbm" in 
20755                 $define) avail_ext="$avail_ext $xxx" ;;
20756                 esac
20757                 ;;
20758         I18N/Langinfo|i18n_lan)
20759                 case "$i_langinfo$d_nl_langinfo" in 
20760                 $define$define) avail_ext="$avail_ext $xxx" ;;
20761                 esac
20762                 ;;
20763         NDBM_File|ndbm_fil)
20764                 case "$i_ndbm" in
20765                 $define)
20766                     case "$osname-$use64bitint" in
20767                     hpux-define)
20768                         case "$libs" in
20769                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
20770                         esac
20771                         ;;
20772                     *) avail_ext="$avail_ext $xxx" ;;
20773                     esac
20774                     ;;
20775                 esac
20776                 ;;
20777         ODBM_File|odbm_fil) 
20778                 case "${i_dbm}${i_rpcsvcdbm}" in
20779                 *"${define}"*)
20780                     case "$osname-$use64bitint" in
20781                     hpux-define)
20782                         case "$libs" in
20783                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
20784                         esac
20785                         ;;
20786                     *) avail_ext="$avail_ext $xxx" ;;
20787                     esac
20788                     ;;
20789                 esac
20790                 ;;
20791         POSIX|posix)
20792                 case "$useposix" in
20793                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20794                 esac
20795                 ;;
20796         Opcode|opcode)
20797                 case "$useopcode" in
20798                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20799                 esac
20800                 ;;
20801         Socket|socket)
20802                 case "$d_socket" in 
20803                 true|$define|y)
20804                     case "$osname" in
20805                     beos) ;; # not unless BONE
20806                     *) avail_ext="$avail_ext $xxx" ;;
20807                     esac
20808                     ;;
20809                 esac
20810                 ;;
20811         Sys/Syslog|sys/syslog)
20812                 : XXX syslog requires socket
20813                 case "$d_socket" in 
20814                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
20815                 esac
20816                 ;;
20817         Thread|thread)
20818                 case "$usethreads" in
20819                 true|$define|y)
20820                         case "$useithreads" in
20821                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
20822                         esac
20823                 esac
20824                 ;;
20825         XS/APItest|xs/apitest)
20826                 # This is just for testing.  Skip it unless we have dynamic loading.
20827
20828                 case "$usedl" in
20829                 $define) avail_ext="$avail_ext $xxx" ;;
20830                 esac
20831                 ;;
20832         XS/Typemap|xs/typemap)
20833                 # This is just for testing.  Skip it unless we have dynamic loading.
20834                 case "$usedl" in
20835                 $define) avail_ext="$avail_ext $xxx" ;;
20836                 esac
20837                 ;;
20838         threads|threads/shared)
20839                 # threads and threads::shared are special cases.
20840                 # To stop people from asking "Perl 5.8.0 was supposed
20841                 # to have this new fancy threads implementation but my
20842                 # perl doesn't have it" and from people trying to
20843                 # (re)install the threads module using CPAN.pm and
20844                 # CPAN.pm then offering to reinstall Perl 5.8.0,
20845                 # the threads.pm and threads/shared.pm will always be
20846                 # there, croaking informatively ("you need to rebuild
20847                 # all of Perl with threads, sorry") when threads haven't
20848                 # been compiled in.
20849                 # --jhi
20850                 avail_ext="$avail_ext $xxx"
20851                 ;;
20852         IPC/SysV|ipc/sysv)
20853                 : XXX Do we need a useipcsysv variable here
20854                 case "${d_msg}${d_sem}${d_shm}" in 
20855                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
20856                 esac
20857                 ;;
20858         *)      avail_ext="$avail_ext $xxx"
20859                 ;;
20860         esac
20861 done
20862
20863 set X $avail_ext
20864 shift
20865 avail_ext="$*"
20866
20867 case "$onlyextensions" in
20868 '') ;;
20869 *)  keepextensions=''
20870     echo "You have requested that only certains extensions be included..." >&4
20871     for i in $onlyextensions; do
20872         case " $avail_ext " in
20873         *" $i "*)
20874             echo "Keeping extension $i."
20875             keepextensions="$keepextensions $i"
20876             ;;
20877         *) echo "Ignoring extension $i." ;;
20878         esac
20879     done
20880     avail_ext="$keepextensions"
20881     ;;
20882 esac
20883
20884 case "$noextensions" in
20885 '') ;;
20886 *)  keepextensions=''
20887     echo "You have requested that certain extensions be ignored..." >&4
20888     for i in $avail_ext; do
20889         case " $noextensions " in
20890         *" $i "*) echo "Ignoring extension $i." ;;
20891         *) echo "Keeping extension $i.";
20892            keepextensions="$keepextensions $i"
20893            ;;
20894         esac
20895     done
20896     avail_ext="$keepextensions"
20897     ;;
20898 esac
20899
20900 : Now see which nonxs extensions are supported on this system.
20901 : For now assume all are.
20902 nonxs_ext=''
20903 for xxx in $nonxs_extensions ; do
20904         case "$xxx" in
20905         *)      nonxs_ext="$nonxs_ext $xxx"
20906                 ;;
20907         esac
20908 done
20909
20910 set X $nonxs_ext
20911 shift
20912 nonxs_ext="$*"
20913
20914 case $usedl in
20915 $define)
20916         $cat <<EOM
20917 A number of extensions are supplied with $package.  You may choose to
20918 compile these extensions for dynamic loading (the default), compile
20919 them into the $package executable (static loading), or not include
20920 them at all.  Answer "none" to include no extensions.
20921 Note that DynaLoader is always built and need not be mentioned here.
20922
20923 EOM
20924         case "$dynamic_ext" in
20925         '')
20926                 : Exclude those listed in static_ext
20927                 dflt=''
20928                 for xxx in $avail_ext; do
20929                         case " $static_ext " in
20930                         *" $xxx "*) ;;
20931                         *) dflt="$dflt $xxx" ;;
20932                         esac
20933                 done
20934                 set X $dflt
20935                 shift
20936                 dflt="$*"
20937                 ;;
20938         *)      dflt="$dynamic_ext"
20939                 # Perhaps we are reusing an old out-of-date config.sh.
20940                 case "$hint" in
20941                 previous)
20942                         if test X"$dynamic_ext" != X"$avail_ext"; then
20943                                 $cat <<EOM
20944 NOTICE:  Your previous config.sh list may be incorrect. 
20945 The extensions now available to you are 
20946         ${avail_ext}
20947 but the default list from your previous config.sh is
20948         ${dynamic_ext} 
20949
20950 EOM
20951                         fi
20952                         ;;
20953                 esac
20954                 ;;
20955         esac
20956         case "$dflt" in
20957         '')     dflt=none;;
20958         esac
20959         rp="What extensions do you wish to load dynamically?"
20960         . ./myread
20961         case "$ans" in
20962         none) dynamic_ext=' ' ;;
20963         *) dynamic_ext="$ans" ;;
20964         esac
20965
20966         case "$static_ext" in
20967         '')
20968                 : Exclude those already listed in dynamic linking
20969                 dflt=''
20970                 for xxx in $avail_ext; do
20971                         case " $dynamic_ext " in
20972                         *" $xxx "*) ;;
20973                         *) dflt="$dflt $xxx" ;;
20974                         esac
20975                 done
20976                 set X $dflt
20977                 shift
20978                 dflt="$*"
20979                 ;;
20980         *)  dflt="$static_ext" 
20981                 ;;
20982         esac
20983
20984         case "$dflt" in
20985         '')     dflt=none;;
20986         esac
20987         rp="What extensions do you wish to load statically?"
20988         . ./myread
20989         case "$ans" in
20990         none) static_ext=' ' ;;
20991         *) static_ext="$ans" ;;
20992         esac
20993         ;;
20994 *)
20995         $cat <<EOM
20996 A number of extensions are supplied with $package.  Answer "none" 
20997 to include no extensions. 
20998 Note that DynaLoader is always built and need not be mentioned here.
20999
21000 EOM
21001         case "$static_ext" in
21002         '') dflt="$avail_ext" ;;
21003         *)      dflt="$static_ext"
21004                 # Perhaps we are reusing an old out-of-date config.sh.
21005                 case "$hint" in
21006                 previous)
21007                         if test X"$static_ext" != X"$avail_ext"; then
21008                                 $cat <<EOM
21009 NOTICE:  Your previous config.sh list may be incorrect. 
21010 The extensions now available to you are 
21011         ${avail_ext}
21012 but the default list from your previous config.sh is
21013         ${static_ext} 
21014
21015 EOM
21016                         fi
21017                         ;;
21018                 esac
21019                 ;;
21020         esac
21021         : Exclude those that are not xs extensions
21022         case "$dflt" in
21023         '')     dflt=none;;
21024         esac
21025         rp="What extensions do you wish to include?"
21026         . ./myread
21027         case "$ans" in
21028         none) static_ext=' ' ;;
21029         *) static_ext="$ans" ;;
21030         esac
21031         ;;
21032 esac
21033 #        
21034 # Encode is a special case.  If we are building Encode as a static
21035 # extension, we need to explicitly list its subextensions as well.
21036 # For other nested extensions, this is handled automatically by
21037 # the appropriate Makefile.PL.
21038 case " $static_ext " in
21039         *" Encode "*) # Add the subextensions of Encode
21040         cd "$rsrc/ext"
21041         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21042                 static_ext="$static_ext Encode/$xxx"
21043         done
21044         cd "$tdir"
21045         ;;
21046 esac
21047
21048 set X $dynamic_ext $static_ext $nonxs_ext
21049 shift
21050 extensions="$*"
21051
21052 # Sanity check:  We require an extension suitable for use with
21053 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21054 # should show up as failures in the test suite, but it's helpful to
21055 # catch them now.) The 'extensions' list is normally sorted
21056 # alphabetically, so we need to accept either
21057 #    DB_File ... Fcntl ... IO  ....
21058 # or something like
21059 #    Fcntl ... NDBM_File ... IO  ....
21060 case " $extensions"  in
21061 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21062 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21063 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21064 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21065    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21066    ;;
21067 esac
21068
21069 : Remove libraries needed only for extensions
21070 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21071 : The exception is SunOS 4.x, which needs them.
21072 case "${osname}X${osvers}" in
21073 sunos*X4*)
21074     perllibs="$libs"
21075     ;;
21076 *) case "$usedl" in
21077     $define|true|[yY]*)
21078             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21079             shift
21080             perllibs="$*"
21081             ;;
21082     *)  perllibs="$libs"
21083             ;;
21084     esac
21085     ;;
21086 esac
21087
21088 : Remove build directory name from cppstdin so it can be used from
21089 : either the present location or the final installed location.
21090 echo " "
21091 : Get out of the UU directory to get correct path name.
21092 cd ..
21093 case "$cppstdin" in
21094 `pwd`/cppstdin)
21095         echo "Stripping down cppstdin path name"
21096         cppstdin=cppstdin
21097         ;;
21098 esac
21099 cd UU
21100
21101 : end of configuration questions
21102 echo " "
21103 echo "End of configuration questions."
21104 echo " "
21105
21106 : back to where it started
21107 if test -d ../UU; then
21108         cd ..
21109 fi
21110
21111 : configuration may be patched via a 'config.arch' file
21112 if $test -f config.arch; then
21113         echo "I see a config.arch file, loading it."
21114         . ./config.arch
21115 fi
21116
21117 : configuration may be patched via a 'config.over' file
21118 if $test -f config.over; then
21119         echo " "
21120         dflt=y
21121         rp='I see a config.over file.  Do you wish to load it?'
21122         . UU/myread
21123         case "$ans" in
21124         n*) echo "OK, I'll ignore it.";;
21125         *)      . ./config.over
21126                 echo "Configuration override changes have been loaded."
21127                 ;;
21128         esac
21129 fi
21130
21131 : in case they want portability, strip down executable paths
21132 case "$d_portable" in
21133 "$define")
21134         echo " "
21135         echo "Stripping down executable paths..." >&4
21136         for file in $loclist $trylist; do
21137                 eval temp=\$$file
21138                 eval $file=`basename $temp`
21139         done
21140         ;;
21141 esac
21142
21143 : create config.sh file
21144 echo " "
21145 echo "Creating config.sh..." >&4
21146 $spitshell <<EOT >config.sh
21147 $startsh
21148 #
21149 # This file was produced by running the Configure script. It holds all the
21150 # definitions figured out by Configure. Should you modify one of these values,
21151 # do not forget to propagate your changes by running "Configure -der". You may
21152 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21153 #
21154
21155 # Package name      : $package
21156 # Source directory  : $src
21157 # Configuration time: $cf_time
21158 # Configured by     : $cf_by
21159 # Target system     : $myuname
21160
21161 Author='$Author'
21162 Date='$Date'
21163 Header='$Header'
21164 Id='$Id'
21165 Locker='$Locker'
21166 Log='$Log'
21167 Mcc='$Mcc'
21168 RCSfile='$RCSfile'
21169 Revision='$Revision'
21170 Source='$Source'
21171 State='$State'
21172 _a='$_a'
21173 _exe='$_exe'
21174 _o='$_o'
21175 afs='$afs'
21176 afsroot='$afsroot'
21177 alignbytes='$alignbytes'
21178 ansi2knr='$ansi2knr'
21179 aphostname='$aphostname'
21180 api_revision='$api_revision'
21181 api_subversion='$api_subversion'
21182 api_version='$api_version'
21183 api_versionstring='$api_versionstring'
21184 ar='$ar'
21185 archlib='$archlib'
21186 archlibexp='$archlibexp'
21187 archname64='$archname64'
21188 archname='$archname'
21189 archobjs='$archobjs'
21190 asctime_r_proto='$asctime_r_proto'
21191 awk='$awk'
21192 baserev='$baserev'
21193 bash='$bash'
21194 bin='$bin'
21195 binexp='$binexp'
21196 bison='$bison'
21197 byacc='$byacc'
21198 byteorder='$byteorder'
21199 c='$c'
21200 castflags='$castflags'
21201 cat='$cat'
21202 cc='$cc'
21203 cccdlflags='$cccdlflags'
21204 ccdlflags='$ccdlflags'
21205 ccflags='$ccflags'
21206 ccflags_uselargefiles='$ccflags_uselargefiles'
21207 ccname='$ccname'
21208 ccsymbols='$ccsymbols'
21209 ccversion='$ccversion'
21210 cf_by='$cf_by'
21211 cf_email='$cf_email'
21212 cf_time='$cf_time'
21213 charsize='$charsize'
21214 chgrp='$chgrp'
21215 chmod='$chmod'
21216 chown='$chown'
21217 clocktype='$clocktype'
21218 comm='$comm'
21219 compress='$compress'
21220 contains='$contains'
21221 cp='$cp'
21222 cpio='$cpio'
21223 cpp='$cpp'
21224 cpp_stuff='$cpp_stuff'
21225 cppccsymbols='$cppccsymbols'
21226 cppflags='$cppflags'
21227 cpplast='$cpplast'
21228 cppminus='$cppminus'
21229 cpprun='$cpprun'
21230 cppstdin='$cppstdin'
21231 cppsymbols='$cppsymbols'
21232 crypt_r_proto='$crypt_r_proto'
21233 cryptlib='$cryptlib'
21234 csh='$csh'
21235 ctermid_r_proto='$ctermid_r_proto'
21236 ctime_r_proto='$ctime_r_proto'
21237 d_Gconvert='$d_Gconvert'
21238 d_PRIEUldbl='$d_PRIEUldbl'
21239 d_PRIFUldbl='$d_PRIFUldbl'
21240 d_PRIGUldbl='$d_PRIGUldbl'
21241 d_PRIXU64='$d_PRIXU64'
21242 d_PRId64='$d_PRId64'
21243 d_PRIeldbl='$d_PRIeldbl'
21244 d_PRIfldbl='$d_PRIfldbl'
21245 d_PRIgldbl='$d_PRIgldbl'
21246 d_PRIi64='$d_PRIi64'
21247 d_PRIo64='$d_PRIo64'
21248 d_PRIu64='$d_PRIu64'
21249 d_PRIx64='$d_PRIx64'
21250 d_SCNfldbl='$d_SCNfldbl'
21251 d__fwalk='$d__fwalk'
21252 d_access='$d_access'
21253 d_accessx='$d_accessx'
21254 d_aintl='$d_aintl'
21255 d_alarm='$d_alarm'
21256 d_archlib='$d_archlib'
21257 d_asctime_r='$d_asctime_r'
21258 d_atolf='$d_atolf'
21259 d_atoll='$d_atoll'
21260 d_attribute_format='$d_attribute_format'
21261 d_attribute_malloc='$d_attribute_malloc'
21262 d_attribute_nonnull='$d_attribute_nonnull'
21263 d_attribute_noreturn='$d_attribute_noreturn'
21264 d_attribute_pure='$d_attribute_pure'
21265 d_attribute_unused='$d_attribute_unused'
21266 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21267 d_bcmp='$d_bcmp'
21268 d_bcopy='$d_bcopy'
21269 d_bsd='$d_bsd'
21270 d_bsdgetpgrp='$d_bsdgetpgrp'
21271 d_bsdsetpgrp='$d_bsdsetpgrp'
21272 d_builtin_choose_expr='$d_builtin_choose_expr'
21273 d_builtin_expect='$d_builtin_expect'
21274 d_bzero='$d_bzero'
21275 d_casti32='$d_casti32'
21276 d_castneg='$d_castneg'
21277 d_charvspr='$d_charvspr'
21278 d_chown='$d_chown'
21279 d_chroot='$d_chroot'
21280 d_chsize='$d_chsize'
21281 d_class='$d_class'
21282 d_clearenv='$d_clearenv'
21283 d_closedir='$d_closedir'
21284 d_cmsghdr_s='$d_cmsghdr_s'
21285 d_const='$d_const'
21286 d_copysignl='$d_copysignl'
21287 d_crypt='$d_crypt'
21288 d_crypt_r='$d_crypt_r'
21289 d_csh='$d_csh'
21290 d_ctermid_r='$d_ctermid_r'
21291 d_ctime_r='$d_ctime_r'
21292 d_cuserid='$d_cuserid'
21293 d_dbl_dig='$d_dbl_dig'
21294 d_dbminitproto='$d_dbminitproto'
21295 d_difftime='$d_difftime'
21296 d_dirfd='$d_dirfd'
21297 d_dirnamlen='$d_dirnamlen'
21298 d_dlerror='$d_dlerror'
21299 d_dlopen='$d_dlopen'
21300 d_dlsymun='$d_dlsymun'
21301 d_dosuid='$d_dosuid'
21302 d_drand48_r='$d_drand48_r'
21303 d_drand48proto='$d_drand48proto'
21304 d_dup2='$d_dup2'
21305 d_eaccess='$d_eaccess'
21306 d_endgrent='$d_endgrent'
21307 d_endgrent_r='$d_endgrent_r'
21308 d_endhent='$d_endhent'
21309 d_endhostent_r='$d_endhostent_r'
21310 d_endnent='$d_endnent'
21311 d_endnetent_r='$d_endnetent_r'
21312 d_endpent='$d_endpent'
21313 d_endprotoent_r='$d_endprotoent_r'
21314 d_endpwent='$d_endpwent'
21315 d_endpwent_r='$d_endpwent_r'
21316 d_endsent='$d_endsent'
21317 d_endservent_r='$d_endservent_r'
21318 d_eofnblk='$d_eofnblk'
21319 d_eunice='$d_eunice'
21320 d_faststdio='$d_faststdio'
21321 d_fchdir='$d_fchdir'
21322 d_fchmod='$d_fchmod'
21323 d_fchown='$d_fchown'
21324 d_fcntl='$d_fcntl'
21325 d_fcntl_can_lock='$d_fcntl_can_lock'
21326 d_fd_macros='$d_fd_macros'
21327 d_fd_set='$d_fd_set'
21328 d_fds_bits='$d_fds_bits'
21329 d_fgetpos='$d_fgetpos'
21330 d_finite='$d_finite'
21331 d_finitel='$d_finitel'
21332 d_flexfnam='$d_flexfnam'
21333 d_flock='$d_flock'
21334 d_flockproto='$d_flockproto'
21335 d_fork='$d_fork'
21336 d_fp_class='$d_fp_class'
21337 d_fpathconf='$d_fpathconf'
21338 d_fpclass='$d_fpclass'
21339 d_fpclassify='$d_fpclassify'
21340 d_fpclassl='$d_fpclassl'
21341 d_fpos64_t='$d_fpos64_t'
21342 d_frexpl='$d_frexpl'
21343 d_fs_data_s='$d_fs_data_s'
21344 d_fseeko='$d_fseeko'
21345 d_fsetpos='$d_fsetpos'
21346 d_fstatfs='$d_fstatfs'
21347 d_fstatvfs='$d_fstatvfs'
21348 d_fsync='$d_fsync'
21349 d_ftello='$d_ftello'
21350 d_ftime='$d_ftime'
21351 d_futimes='$d_futimes'
21352 d_getcwd='$d_getcwd'
21353 d_getespwnam='$d_getespwnam'
21354 d_getfsstat='$d_getfsstat'
21355 d_getgrent='$d_getgrent'
21356 d_getgrent_r='$d_getgrent_r'
21357 d_getgrgid_r='$d_getgrgid_r'
21358 d_getgrnam_r='$d_getgrnam_r'
21359 d_getgrps='$d_getgrps'
21360 d_gethbyaddr='$d_gethbyaddr'
21361 d_gethbyname='$d_gethbyname'
21362 d_gethent='$d_gethent'
21363 d_gethname='$d_gethname'
21364 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21365 d_gethostbyname_r='$d_gethostbyname_r'
21366 d_gethostent_r='$d_gethostent_r'
21367 d_gethostprotos='$d_gethostprotos'
21368 d_getitimer='$d_getitimer'
21369 d_getlogin='$d_getlogin'
21370 d_getlogin_r='$d_getlogin_r'
21371 d_getmnt='$d_getmnt'
21372 d_getmntent='$d_getmntent'
21373 d_getnbyaddr='$d_getnbyaddr'
21374 d_getnbyname='$d_getnbyname'
21375 d_getnent='$d_getnent'
21376 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21377 d_getnetbyname_r='$d_getnetbyname_r'
21378 d_getnetent_r='$d_getnetent_r'
21379 d_getnetprotos='$d_getnetprotos'
21380 d_getpagsz='$d_getpagsz'
21381 d_getpbyname='$d_getpbyname'
21382 d_getpbynumber='$d_getpbynumber'
21383 d_getpent='$d_getpent'
21384 d_getpgid='$d_getpgid'
21385 d_getpgrp2='$d_getpgrp2'
21386 d_getpgrp='$d_getpgrp'
21387 d_getppid='$d_getppid'
21388 d_getprior='$d_getprior'
21389 d_getprotobyname_r='$d_getprotobyname_r'
21390 d_getprotobynumber_r='$d_getprotobynumber_r'
21391 d_getprotoent_r='$d_getprotoent_r'
21392 d_getprotoprotos='$d_getprotoprotos'
21393 d_getprpwnam='$d_getprpwnam'
21394 d_getpwent='$d_getpwent'
21395 d_getpwent_r='$d_getpwent_r'
21396 d_getpwnam_r='$d_getpwnam_r'
21397 d_getpwuid_r='$d_getpwuid_r'
21398 d_getsbyname='$d_getsbyname'
21399 d_getsbyport='$d_getsbyport'
21400 d_getsent='$d_getsent'
21401 d_getservbyname_r='$d_getservbyname_r'
21402 d_getservbyport_r='$d_getservbyport_r'
21403 d_getservent_r='$d_getservent_r'
21404 d_getservprotos='$d_getservprotos'
21405 d_getspnam='$d_getspnam'
21406 d_getspnam_r='$d_getspnam_r'
21407 d_gettimeod='$d_gettimeod'
21408 d_gmtime_r='$d_gmtime_r'
21409 d_gnulibc='$d_gnulibc'
21410 d_grpasswd='$d_grpasswd'
21411 d_hasmntopt='$d_hasmntopt'
21412 d_htonl='$d_htonl'
21413 d_ilogbl='$d_ilogbl'
21414 d_index='$d_index'
21415 d_inetaton='$d_inetaton'
21416 d_int64_t='$d_int64_t'
21417 d_isascii='$d_isascii'
21418 d_isfinite='$d_isfinite'
21419 d_isinf='$d_isinf'
21420 d_isnan='$d_isnan'
21421 d_isnanl='$d_isnanl'
21422 d_killpg='$d_killpg'
21423 d_lchown='$d_lchown'
21424 d_ldbl_dig='$d_ldbl_dig'
21425 d_libm_lib_version='$d_libm_lib_version'
21426 d_link='$d_link'
21427 d_localtime_r='$d_localtime_r'
21428 d_locconv='$d_locconv'
21429 d_lockf='$d_lockf'
21430 d_longdbl='$d_longdbl'
21431 d_longlong='$d_longlong'
21432 d_lseekproto='$d_lseekproto'
21433 d_lstat='$d_lstat'
21434 d_madvise='$d_madvise'
21435 d_malloc_good_size='$d_malloc_good_size'
21436 d_malloc_size='$d_malloc_size'
21437 d_mblen='$d_mblen'
21438 d_mbstowcs='$d_mbstowcs'
21439 d_mbtowc='$d_mbtowc'
21440 d_memchr='$d_memchr'
21441 d_memcmp='$d_memcmp'
21442 d_memcpy='$d_memcpy'
21443 d_memmove='$d_memmove'
21444 d_memset='$d_memset'
21445 d_mkdir='$d_mkdir'
21446 d_mkdtemp='$d_mkdtemp'
21447 d_mkfifo='$d_mkfifo'
21448 d_mkstemp='$d_mkstemp'
21449 d_mkstemps='$d_mkstemps'
21450 d_mktime='$d_mktime'
21451 d_mmap='$d_mmap'
21452 d_modfl='$d_modfl'
21453 d_modfl_pow32_bug='$d_modfl_pow32_bug'
21454 d_modflproto='$d_modflproto'
21455 d_mprotect='$d_mprotect'
21456 d_msg='$d_msg'
21457 d_msg_ctrunc='$d_msg_ctrunc'
21458 d_msg_dontroute='$d_msg_dontroute'
21459 d_msg_oob='$d_msg_oob'
21460 d_msg_peek='$d_msg_peek'
21461 d_msg_proxy='$d_msg_proxy'
21462 d_msgctl='$d_msgctl'
21463 d_msgget='$d_msgget'
21464 d_msghdr_s='$d_msghdr_s'
21465 d_msgrcv='$d_msgrcv'
21466 d_msgsnd='$d_msgsnd'
21467 d_msync='$d_msync'
21468 d_munmap='$d_munmap'
21469 d_mymalloc='$d_mymalloc'
21470 d_nice='$d_nice'
21471 d_nl_langinfo='$d_nl_langinfo'
21472 d_nv_preserves_uv='$d_nv_preserves_uv'
21473 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
21474 d_off64_t='$d_off64_t'
21475 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21476 d_oldpthreads='$d_oldpthreads'
21477 d_oldsock='$d_oldsock'
21478 d_open3='$d_open3'
21479 d_pathconf='$d_pathconf'
21480 d_pause='$d_pause'
21481 d_perl_otherlibdirs='$d_perl_otherlibdirs'
21482 d_phostname='$d_phostname'
21483 d_pipe='$d_pipe'
21484 d_poll='$d_poll'
21485 d_portable='$d_portable'
21486 d_procselfexe='$d_procselfexe'
21487 d_pthread_atfork='$d_pthread_atfork'
21488 d_pthread_attr_setscope='$d_pthread_attr_setscope'
21489 d_pthread_yield='$d_pthread_yield'
21490 d_pwage='$d_pwage'
21491 d_pwchange='$d_pwchange'
21492 d_pwclass='$d_pwclass'
21493 d_pwcomment='$d_pwcomment'
21494 d_pwexpire='$d_pwexpire'
21495 d_pwgecos='$d_pwgecos'
21496 d_pwpasswd='$d_pwpasswd'
21497 d_pwquota='$d_pwquota'
21498 d_qgcvt='$d_qgcvt'
21499 d_quad='$d_quad'
21500 d_random_r='$d_random_r'
21501 d_readdir64_r='$d_readdir64_r'
21502 d_readdir='$d_readdir'
21503 d_readdir_r='$d_readdir_r'
21504 d_readlink='$d_readlink'
21505 d_readv='$d_readv'
21506 d_recvmsg='$d_recvmsg'
21507 d_rename='$d_rename'
21508 d_rewinddir='$d_rewinddir'
21509 d_rmdir='$d_rmdir'
21510 d_safebcpy='$d_safebcpy'
21511 d_safemcpy='$d_safemcpy'
21512 d_sanemcmp='$d_sanemcmp'
21513 d_sbrkproto='$d_sbrkproto'
21514 d_scalbnl='$d_scalbnl'
21515 d_sched_yield='$d_sched_yield'
21516 d_scm_rights='$d_scm_rights'
21517 d_seekdir='$d_seekdir'
21518 d_select='$d_select'
21519 d_sem='$d_sem'
21520 d_semctl='$d_semctl'
21521 d_semctl_semid_ds='$d_semctl_semid_ds'
21522 d_semctl_semun='$d_semctl_semun'
21523 d_semget='$d_semget'
21524 d_semop='$d_semop'
21525 d_sendmsg='$d_sendmsg'
21526 d_setegid='$d_setegid'
21527 d_seteuid='$d_seteuid'
21528 d_setgrent='$d_setgrent'
21529 d_setgrent_r='$d_setgrent_r'
21530 d_setgrps='$d_setgrps'
21531 d_sethent='$d_sethent'
21532 d_sethostent_r='$d_sethostent_r'
21533 d_setitimer='$d_setitimer'
21534 d_setlinebuf='$d_setlinebuf'
21535 d_setlocale='$d_setlocale'
21536 d_setlocale_r='$d_setlocale_r'
21537 d_setnent='$d_setnent'
21538 d_setnetent_r='$d_setnetent_r'
21539 d_setpent='$d_setpent'
21540 d_setpgid='$d_setpgid'
21541 d_setpgrp2='$d_setpgrp2'
21542 d_setpgrp='$d_setpgrp'
21543 d_setprior='$d_setprior'
21544 d_setproctitle='$d_setproctitle'
21545 d_setprotoent_r='$d_setprotoent_r'
21546 d_setpwent='$d_setpwent'
21547 d_setpwent_r='$d_setpwent_r'
21548 d_setregid='$d_setregid'
21549 d_setresgid='$d_setresgid'
21550 d_setresuid='$d_setresuid'
21551 d_setreuid='$d_setreuid'
21552 d_setrgid='$d_setrgid'
21553 d_setruid='$d_setruid'
21554 d_setsent='$d_setsent'
21555 d_setservent_r='$d_setservent_r'
21556 d_setsid='$d_setsid'
21557 d_setvbuf='$d_setvbuf'
21558 d_sfio='$d_sfio'
21559 d_shm='$d_shm'
21560 d_shmat='$d_shmat'
21561 d_shmatprototype='$d_shmatprototype'
21562 d_shmctl='$d_shmctl'
21563 d_shmdt='$d_shmdt'
21564 d_shmget='$d_shmget'
21565 d_sigaction='$d_sigaction'
21566 d_sigprocmask='$d_sigprocmask'
21567 d_sigsetjmp='$d_sigsetjmp'
21568 d_snprintf='$d_snprintf'
21569 d_sockatmark='$d_sockatmark'
21570 d_sockatmarkproto='$d_sockatmarkproto'
21571 d_socket='$d_socket'
21572 d_socklen_t='$d_socklen_t'
21573 d_sockpair='$d_sockpair'
21574 d_socks5_init='$d_socks5_init'
21575 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
21576 d_sqrtl='$d_sqrtl'
21577 d_srand48_r='$d_srand48_r'
21578 d_srandom_r='$d_srandom_r'
21579 d_sresgproto='$d_sresgproto'
21580 d_sresuproto='$d_sresuproto'
21581 d_statblks='$d_statblks'
21582 d_statfs_f_flags='$d_statfs_f_flags'
21583 d_statfs_s='$d_statfs_s'
21584 d_statvfs='$d_statvfs'
21585 d_stdio_cnt_lval='$d_stdio_cnt_lval'
21586 d_stdio_ptr_lval='$d_stdio_ptr_lval'
21587 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21588 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
21589 d_stdio_stream_array='$d_stdio_stream_array'
21590 d_stdiobase='$d_stdiobase'
21591 d_stdstdio='$d_stdstdio'
21592 d_strchr='$d_strchr'
21593 d_strcoll='$d_strcoll'
21594 d_strctcpy='$d_strctcpy'
21595 d_strerrm='$d_strerrm'
21596 d_strerror='$d_strerror'
21597 d_strerror_r='$d_strerror_r'
21598 d_strftime='$d_strftime'
21599 d_strlcat='$d_strlcat'
21600 d_strlcpy='$d_strlcpy'
21601 d_strtod='$d_strtod'
21602 d_strtol='$d_strtol'
21603 d_strtold='$d_strtold'
21604 d_strtoll='$d_strtoll'
21605 d_strtoq='$d_strtoq'
21606 d_strtoul='$d_strtoul'
21607 d_strtoull='$d_strtoull'
21608 d_strtouq='$d_strtouq'
21609 d_strxfrm='$d_strxfrm'
21610 d_suidsafe='$d_suidsafe'
21611 d_symlink='$d_symlink'
21612 d_syscall='$d_syscall'
21613 d_syscallproto='$d_syscallproto'
21614 d_sysconf='$d_sysconf'
21615 d_sysernlst='$d_sysernlst'
21616 d_syserrlst='$d_syserrlst'
21617 d_system='$d_system'
21618 d_tcgetpgrp='$d_tcgetpgrp'
21619 d_tcsetpgrp='$d_tcsetpgrp'
21620 d_telldir='$d_telldir'
21621 d_telldirproto='$d_telldirproto'
21622 d_time='$d_time'
21623 d_times='$d_times'
21624 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21625 d_tm_tm_zone='$d_tm_tm_zone'
21626 d_tmpnam_r='$d_tmpnam_r'
21627 d_truncate='$d_truncate'
21628 d_ttyname_r='$d_ttyname_r'
21629 d_tzname='$d_tzname'
21630 d_u32align='$d_u32align'
21631 d_ualarm='$d_ualarm'
21632 d_umask='$d_umask'
21633 d_uname='$d_uname'
21634 d_union_semun='$d_union_semun'
21635 d_unordered='$d_unordered'
21636 d_unsetenv='$d_unsetenv'
21637 d_usleep='$d_usleep'
21638 d_usleepproto='$d_usleepproto'
21639 d_ustat='$d_ustat'
21640 d_vendorarch='$d_vendorarch'
21641 d_vendorbin='$d_vendorbin'
21642 d_vendorlib='$d_vendorlib'
21643 d_vendorscript='$d_vendorscript'
21644 d_vfork='$d_vfork'
21645 d_void_closedir='$d_void_closedir'
21646 d_voidsig='$d_voidsig'
21647 d_voidtty='$d_voidtty'
21648 d_volatile='$d_volatile'
21649 d_vprintf='$d_vprintf'
21650 d_vsnprintf='$d_vsnprintf'
21651 d_wait4='$d_wait4'
21652 d_waitpid='$d_waitpid'
21653 d_wcstombs='$d_wcstombs'
21654 d_wctomb='$d_wctomb'
21655 d_writev='$d_writev'
21656 d_xenix='$d_xenix'
21657 date='$date'
21658 db_hashtype='$db_hashtype'
21659 db_prefixtype='$db_prefixtype'
21660 db_version_major='$db_version_major'
21661 db_version_minor='$db_version_minor'
21662 db_version_patch='$db_version_patch'
21663 defvoidused='$defvoidused'
21664 direntrytype='$direntrytype'
21665 dlext='$dlext'
21666 dlsrc='$dlsrc'
21667 doublesize='$doublesize'
21668 drand01='$drand01'
21669 drand48_r_proto='$drand48_r_proto'
21670 dynamic_ext='$dynamic_ext'
21671 eagain='$eagain'
21672 ebcdic='$ebcdic'
21673 echo='$echo'
21674 egrep='$egrep'
21675 emacs='$emacs'
21676 endgrent_r_proto='$endgrent_r_proto'
21677 endhostent_r_proto='$endhostent_r_proto'
21678 endnetent_r_proto='$endnetent_r_proto'
21679 endprotoent_r_proto='$endprotoent_r_proto'
21680 endpwent_r_proto='$endpwent_r_proto'
21681 endservent_r_proto='$endservent_r_proto'
21682 eunicefix='$eunicefix'
21683 exe_ext='$exe_ext'
21684 expr='$expr'
21685 extensions='$extensions'
21686 extras='$extras'
21687 fflushNULL='$fflushNULL'
21688 fflushall='$fflushall'
21689 find='$find'
21690 firstmakefile='$firstmakefile'
21691 flex='$flex'
21692 fpossize='$fpossize'
21693 fpostype='$fpostype'
21694 freetype='$freetype'
21695 from='$from'
21696 full_ar='$full_ar'
21697 full_csh='$full_csh'
21698 full_sed='$full_sed'
21699 gccansipedantic='$gccansipedantic'
21700 gccosandvers='$gccosandvers'
21701 gccversion='$gccversion'
21702 getgrent_r_proto='$getgrent_r_proto'
21703 getgrgid_r_proto='$getgrgid_r_proto'
21704 getgrnam_r_proto='$getgrnam_r_proto'
21705 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
21706 gethostbyname_r_proto='$gethostbyname_r_proto'
21707 gethostent_r_proto='$gethostent_r_proto'
21708 getlogin_r_proto='$getlogin_r_proto'
21709 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
21710 getnetbyname_r_proto='$getnetbyname_r_proto'
21711 getnetent_r_proto='$getnetent_r_proto'
21712 getprotobyname_r_proto='$getprotobyname_r_proto'
21713 getprotobynumber_r_proto='$getprotobynumber_r_proto'
21714 getprotoent_r_proto='$getprotoent_r_proto'
21715 getpwent_r_proto='$getpwent_r_proto'
21716 getpwnam_r_proto='$getpwnam_r_proto'
21717 getpwuid_r_proto='$getpwuid_r_proto'
21718 getservbyname_r_proto='$getservbyname_r_proto'
21719 getservbyport_r_proto='$getservbyport_r_proto'
21720 getservent_r_proto='$getservent_r_proto'
21721 getspnam_r_proto='$getspnam_r_proto'
21722 gidformat='$gidformat'
21723 gidsign='$gidsign'
21724 gidsize='$gidsize'
21725 gidtype='$gidtype'
21726 glibpth='$glibpth'
21727 gmake='$gmake'
21728 gmtime_r_proto='$gmtime_r_proto'
21729 gnulibc_version='$gnulibc_version'
21730 grep='$grep'
21731 groupcat='$groupcat'
21732 groupstype='$groupstype'
21733 gzip='$gzip'
21734 h_fcntl='$h_fcntl'
21735 h_sysfile='$h_sysfile'
21736 hint='$hint'
21737 hostcat='$hostcat'
21738 html1dir='$html1dir'
21739 html1direxp='$html1direxp'
21740 html3dir='$html3dir'
21741 html3direxp='$html3direxp'
21742 i16size='$i16size'
21743 i16type='$i16type'
21744 i32size='$i32size'
21745 i32type='$i32type'
21746 i64size='$i64size'
21747 i64type='$i64type'
21748 i8size='$i8size'
21749 i8type='$i8type'
21750 i_arpainet='$i_arpainet'
21751 i_bsdioctl='$i_bsdioctl'
21752 i_crypt='$i_crypt'
21753 i_db='$i_db'
21754 i_dbm='$i_dbm'
21755 i_dirent='$i_dirent'
21756 i_dld='$i_dld'
21757 i_dlfcn='$i_dlfcn'
21758 i_fcntl='$i_fcntl'
21759 i_float='$i_float'
21760 i_fp='$i_fp'
21761 i_fp_class='$i_fp_class'
21762 i_gdbm='$i_gdbm'
21763 i_grp='$i_grp'
21764 i_ieeefp='$i_ieeefp'
21765 i_inttypes='$i_inttypes'
21766 i_langinfo='$i_langinfo'
21767 i_libutil='$i_libutil'
21768 i_limits='$i_limits'
21769 i_locale='$i_locale'
21770 i_machcthr='$i_machcthr'
21771 i_malloc='$i_malloc'
21772 i_math='$i_math'
21773 i_memory='$i_memory'
21774 i_mntent='$i_mntent'
21775 i_ndbm='$i_ndbm'
21776 i_netdb='$i_netdb'
21777 i_neterrno='$i_neterrno'
21778 i_netinettcp='$i_netinettcp'
21779 i_niin='$i_niin'
21780 i_poll='$i_poll'
21781 i_prot='$i_prot'
21782 i_pthread='$i_pthread'
21783 i_pwd='$i_pwd'
21784 i_rpcsvcdbm='$i_rpcsvcdbm'
21785 i_sfio='$i_sfio'
21786 i_sgtty='$i_sgtty'
21787 i_shadow='$i_shadow'
21788 i_socks='$i_socks'
21789 i_stdarg='$i_stdarg'
21790 i_stddef='$i_stddef'
21791 i_stdlib='$i_stdlib'
21792 i_string='$i_string'
21793 i_sunmath='$i_sunmath'
21794 i_sysaccess='$i_sysaccess'
21795 i_sysdir='$i_sysdir'
21796 i_sysfile='$i_sysfile'
21797 i_sysfilio='$i_sysfilio'
21798 i_sysin='$i_sysin'
21799 i_sysioctl='$i_sysioctl'
21800 i_syslog='$i_syslog'
21801 i_sysmman='$i_sysmman'
21802 i_sysmode='$i_sysmode'
21803 i_sysmount='$i_sysmount'
21804 i_sysndir='$i_sysndir'
21805 i_sysparam='$i_sysparam'
21806 i_sysresrc='$i_sysresrc'
21807 i_syssecrt='$i_syssecrt'
21808 i_sysselct='$i_sysselct'
21809 i_syssockio='$i_syssockio'
21810 i_sysstat='$i_sysstat'
21811 i_sysstatfs='$i_sysstatfs'
21812 i_sysstatvfs='$i_sysstatvfs'
21813 i_systime='$i_systime'
21814 i_systimek='$i_systimek'
21815 i_systimes='$i_systimes'
21816 i_systypes='$i_systypes'
21817 i_sysuio='$i_sysuio'
21818 i_sysun='$i_sysun'
21819 i_sysutsname='$i_sysutsname'
21820 i_sysvfs='$i_sysvfs'
21821 i_syswait='$i_syswait'
21822 i_termio='$i_termio'
21823 i_termios='$i_termios'
21824 i_time='$i_time'
21825 i_unistd='$i_unistd'
21826 i_ustat='$i_ustat'
21827 i_utime='$i_utime'
21828 i_values='$i_values'
21829 i_varargs='$i_varargs'
21830 i_varhdr='$i_varhdr'
21831 i_vfork='$i_vfork'
21832 ignore_versioned_solibs='$ignore_versioned_solibs'
21833 inc_version_list='$inc_version_list'
21834 inc_version_list_init='$inc_version_list_init'
21835 incpath='$incpath'
21836 inews='$inews'
21837 installarchlib='$installarchlib'
21838 installbin='$installbin'
21839 installhtml1dir='$installhtml1dir'
21840 installhtml3dir='$installhtml3dir'
21841 installman1dir='$installman1dir'
21842 installman3dir='$installman3dir'
21843 installprefix='$installprefix'
21844 installprefixexp='$installprefixexp'
21845 installprivlib='$installprivlib'
21846 installscript='$installscript'
21847 installsitearch='$installsitearch'
21848 installsitebin='$installsitebin'
21849 installsitehtml1dir='$installsitehtml1dir'
21850 installsitehtml3dir='$installsitehtml3dir'
21851 installsitelib='$installsitelib'
21852 installsiteman1dir='$installsiteman1dir'
21853 installsiteman3dir='$installsiteman3dir'
21854 installsitescript='$installsitescript'
21855 installstyle='$installstyle'
21856 installusrbinperl='$installusrbinperl'
21857 installvendorarch='$installvendorarch'
21858 installvendorbin='$installvendorbin'
21859 installvendorhtml1dir='$installvendorhtml1dir'
21860 installvendorhtml3dir='$installvendorhtml3dir'
21861 installvendorlib='$installvendorlib'
21862 installvendorman1dir='$installvendorman1dir'
21863 installvendorman3dir='$installvendorman3dir'
21864 installvendorscript='$installvendorscript'
21865 intsize='$intsize'
21866 issymlink='$issymlink'
21867 ivdformat='$ivdformat'
21868 ivsize='$ivsize'
21869 ivtype='$ivtype'
21870 known_extensions='$known_extensions'
21871 ksh='$ksh'
21872 ld='$ld'
21873 lddlflags='$lddlflags'
21874 ldflags='$ldflags'
21875 ldflags_uselargefiles='$ldflags_uselargefiles'
21876 ldlibpthname='$ldlibpthname'
21877 less='$less'
21878 lib_ext='$lib_ext'
21879 libc='$libc'
21880 libperl='$libperl'
21881 libpth='$libpth'
21882 libs='$libs'
21883 libsdirs='$libsdirs'
21884 libsfiles='$libsfiles'
21885 libsfound='$libsfound'
21886 libspath='$libspath'
21887 libswanted='$libswanted'
21888 libswanted_uselargefiles='$libswanted_uselargefiles'
21889 line='$line'
21890 lint='$lint'
21891 lkflags='$lkflags'
21892 ln='$ln'
21893 lns='$lns'
21894 localtime_r_proto='$localtime_r_proto'
21895 locincpth='$locincpth'
21896 loclibpth='$loclibpth'
21897 longdblsize='$longdblsize'
21898 longlongsize='$longlongsize'
21899 longsize='$longsize'
21900 lp='$lp'
21901 lpr='$lpr'
21902 ls='$ls'
21903 lseeksize='$lseeksize'
21904 lseektype='$lseektype'
21905 mad='$mad'
21906 mail='$mail'
21907 mailx='$mailx'
21908 make='$make'
21909 make_set_make='$make_set_make'
21910 mallocobj='$mallocobj'
21911 mallocsrc='$mallocsrc'
21912 madlyh='$madlyh'
21913 madlyobj='$madlyobj'
21914 madlysrc='$madlysrc'
21915 malloctype='$malloctype'
21916 man1dir='$man1dir'
21917 man1direxp='$man1direxp'
21918 man1ext='$man1ext'
21919 man3dir='$man3dir'
21920 man3direxp='$man3direxp'
21921 man3ext='$man3ext'
21922 mips_type='$mips_type'
21923 mistrustnm='$mistrustnm'
21924 mkdir='$mkdir'
21925 mmaptype='$mmaptype'
21926 modetype='$modetype'
21927 more='$more'
21928 multiarch='$multiarch'
21929 mv='$mv'
21930 myarchname='$myarchname'
21931 mydomain='$mydomain'
21932 myhostname='$myhostname'
21933 myuname='$myuname'
21934 n='$n'
21935 need_va_copy='$need_va_copy'
21936 netdb_hlen_type='$netdb_hlen_type'
21937 netdb_host_type='$netdb_host_type'
21938 netdb_name_type='$netdb_name_type'
21939 netdb_net_type='$netdb_net_type'
21940 nm='$nm'
21941 nm_opt='$nm_opt'
21942 nm_so_opt='$nm_so_opt'
21943 nonxs_ext='$nonxs_ext'
21944 nroff='$nroff'
21945 nvEUformat='$nvEUformat'
21946 nvFUformat='$nvFUformat'
21947 nvGUformat='$nvGUformat'
21948 nv_preserves_uv_bits='$nv_preserves_uv_bits'
21949 nveformat='$nveformat'
21950 nvfformat='$nvfformat'
21951 nvgformat='$nvgformat'
21952 nvsize='$nvsize'
21953 nvtype='$nvtype'
21954 o_nonblock='$o_nonblock'
21955 obj_ext='$obj_ext'
21956 old_pthread_create_joinable='$old_pthread_create_joinable'
21957 optimize='$optimize'
21958 orderlib='$orderlib'
21959 osname='$osname'
21960 osvers='$osvers'
21961 otherlibdirs='$otherlibdirs'
21962 package='$package'
21963 pager='$pager'
21964 passcat='$passcat'
21965 patchlevel='$patchlevel'
21966 path_sep='$path_sep'
21967 perl5='$perl5'
21968 perl='$perl'
21969 perl_patchlevel='$perl_patchlevel'
21970 perladmin='$perladmin'
21971 perllibs='$perllibs'
21972 perlpath='$perlpath'
21973 pg='$pg'
21974 phostname='$phostname'
21975 pidtype='$pidtype'
21976 plibpth='$plibpth'
21977 pmake='$pmake'
21978 pr='$pr'
21979 prefix='$prefix'
21980 prefixexp='$prefixexp'
21981 privlib='$privlib'
21982 privlibexp='$privlibexp'
21983 procselfexe='$procselfexe'
21984 prototype='$prototype'
21985 ptrsize='$ptrsize'
21986 quadkind='$quadkind'
21987 quadtype='$quadtype'
21988 randbits='$randbits'
21989 randfunc='$randfunc'
21990 random_r_proto='$random_r_proto'
21991 randseedtype='$randseedtype'
21992 ranlib='$ranlib'
21993 rd_nodata='$rd_nodata'
21994 readdir64_r_proto='$readdir64_r_proto'
21995 readdir_r_proto='$readdir_r_proto'
21996 revision='$revision'
21997 rm='$rm'
21998 rmail='$rmail'
21999 run='$run'
22000 runnm='$runnm'
22001 sPRIEUldbl='$sPRIEUldbl'
22002 sPRIFUldbl='$sPRIFUldbl'
22003 sPRIGUldbl='$sPRIGUldbl'
22004 sPRIXU64='$sPRIXU64'
22005 sPRId64='$sPRId64'
22006 sPRIeldbl='$sPRIeldbl'
22007 sPRIfldbl='$sPRIfldbl'
22008 sPRIgldbl='$sPRIgldbl'
22009 sPRIi64='$sPRIi64'
22010 sPRIo64='$sPRIo64'
22011 sPRIu64='$sPRIu64'
22012 sPRIx64='$sPRIx64'
22013 sSCNfldbl='$sSCNfldbl'
22014 sched_yield='$sched_yield'
22015 scriptdir='$scriptdir'
22016 scriptdirexp='$scriptdirexp'
22017 sed='$sed'
22018 seedfunc='$seedfunc'
22019 selectminbits='$selectminbits'
22020 selecttype='$selecttype'
22021 sendmail='$sendmail'
22022 setgrent_r_proto='$setgrent_r_proto'
22023 sethostent_r_proto='$sethostent_r_proto'
22024 setlocale_r_proto='$setlocale_r_proto'
22025 setnetent_r_proto='$setnetent_r_proto'
22026 setprotoent_r_proto='$setprotoent_r_proto'
22027 setpwent_r_proto='$setpwent_r_proto'
22028 setservent_r_proto='$setservent_r_proto'
22029 sh='$sh'
22030 shar='$shar'
22031 sharpbang='$sharpbang'
22032 shmattype='$shmattype'
22033 shortsize='$shortsize'
22034 shrpenv='$shrpenv'
22035 shsharp='$shsharp'
22036 sig_count='$sig_count'
22037 sig_name='$sig_name'
22038 sig_name_init='$sig_name_init'
22039 sig_num='$sig_num'
22040 sig_num_init='$sig_num_init'
22041 sig_size='$sig_size'
22042 signal_t='$signal_t'
22043 sitearch='$sitearch'
22044 sitearchexp='$sitearchexp'
22045 sitebin='$sitebin'
22046 sitebinexp='$sitebinexp'
22047 sitehtml1dir='$sitehtml1dir'
22048 sitehtml1direxp='$sitehtml1direxp'
22049 sitehtml3dir='$sitehtml3dir'
22050 sitehtml3direxp='$sitehtml3direxp'
22051 sitelib='$sitelib'
22052 sitelib_stem='$sitelib_stem'
22053 sitelibexp='$sitelibexp'
22054 siteman1dir='$siteman1dir'
22055 siteman1direxp='$siteman1direxp'
22056 siteman3dir='$siteman3dir'
22057 siteman3direxp='$siteman3direxp'
22058 siteprefix='$siteprefix'
22059 siteprefixexp='$siteprefixexp'
22060 sitescript='$sitescript'
22061 sitescriptexp='$sitescriptexp'
22062 sizesize='$sizesize'
22063 sizetype='$sizetype'
22064 sleep='$sleep'
22065 smail='$smail'
22066 so='$so'
22067 sockethdr='$sockethdr'
22068 socketlib='$socketlib'
22069 socksizetype='$socksizetype'
22070 sort='$sort'
22071 spackage='$spackage'
22072 spitshell='$spitshell'
22073 srand48_r_proto='$srand48_r_proto'
22074 srandom_r_proto='$srandom_r_proto'
22075 src='$src'
22076 ssizetype='$ssizetype'
22077 startperl='$startperl'
22078 startsh='$startsh'
22079 static_ext='$static_ext'
22080 stdchar='$stdchar'
22081 stdio_base='$stdio_base'
22082 stdio_bufsiz='$stdio_bufsiz'
22083 stdio_cnt='$stdio_cnt'
22084 stdio_filbuf='$stdio_filbuf'
22085 stdio_ptr='$stdio_ptr'
22086 stdio_stream_array='$stdio_stream_array'
22087 strerror_r_proto='$strerror_r_proto'
22088 strings='$strings'
22089 submit='$submit'
22090 subversion='$subversion'
22091 sysman='$sysman'
22092 tail='$tail'
22093 tar='$tar'
22094 targetarch='$targetarch'
22095 tbl='$tbl'
22096 tee='$tee'
22097 test='$test'
22098 timeincl='$timeincl'
22099 timetype='$timetype'
22100 tmpnam_r_proto='$tmpnam_r_proto'
22101 to='$to'
22102 touch='$touch'
22103 tr='$tr'
22104 trnl='$trnl'
22105 troff='$troff'
22106 ttyname_r_proto='$ttyname_r_proto'
22107 u16size='$u16size'
22108 u16type='$u16type'
22109 u32size='$u32size'
22110 u32type='$u32type'
22111 u64size='$u64size'
22112 u64type='$u64type'
22113 u8size='$u8size'
22114 u8type='$u8type'
22115 uidformat='$uidformat'
22116 uidsign='$uidsign'
22117 uidsize='$uidsize'
22118 uidtype='$uidtype'
22119 uname='$uname'
22120 uniq='$uniq'
22121 uquadtype='$uquadtype'
22122 use5005threads='$use5005threads'
22123 use64bitall='$use64bitall'
22124 use64bitint='$use64bitint'
22125 usecrosscompile='$usecrosscompile'
22126 usedl='$usedl'
22127 usefaststdio='$usefaststdio'
22128 useithreads='$useithreads'
22129 uselargefiles='$uselargefiles'
22130 uselongdouble='$uselongdouble'
22131 usemallocwrap='$usemallocwrap'
22132 usemorebits='$usemorebits'
22133 usemultiplicity='$usemultiplicity'
22134 usemymalloc='$usemymalloc'
22135 usenm='$usenm'
22136 useopcode='$useopcode'
22137 useperlio='$useperlio'
22138 useposix='$useposix'
22139 usereentrant='$usereentrant'
22140 userelocatableinc='$userelocatableinc'
22141 usesfio='$usesfio'
22142 useshrplib='$useshrplib'
22143 usesitecustomize='$usesitecustomize'
22144 usesocks='$usesocks'
22145 usethreads='$usethreads'
22146 usevendorprefix='$usevendorprefix'
22147 usevfork='$usevfork'
22148 usrinc='$usrinc'
22149 uuname='$uuname'
22150 uvXUformat='$uvXUformat'
22151 uvoformat='$uvoformat'
22152 uvsize='$uvsize'
22153 uvtype='$uvtype'
22154 uvuformat='$uvuformat'
22155 uvxformat='$uvxformat'
22156 vendorarch='$vendorarch'
22157 vendorarchexp='$vendorarchexp'
22158 vendorbin='$vendorbin'
22159 vendorbinexp='$vendorbinexp'
22160 vendorhtml1dir='$vendorhtml1dir'
22161 vendorhtml1direxp='$vendorhtml1direxp'
22162 vendorhtml3dir='$vendorhtml3dir'
22163 vendorhtml3direxp='$vendorhtml3direxp'
22164 vendorlib='$vendorlib'
22165 vendorlib_stem='$vendorlib_stem'
22166 vendorlibexp='$vendorlibexp'
22167 vendorman1dir='$vendorman1dir'
22168 vendorman1direxp='$vendorman1direxp'
22169 vendorman3dir='$vendorman3dir'
22170 vendorman3direxp='$vendorman3direxp'
22171 vendorprefix='$vendorprefix'
22172 vendorprefixexp='$vendorprefixexp'
22173 vendorscript='$vendorscript'
22174 vendorscriptexp='$vendorscriptexp'
22175 version='$version'
22176 version_patchlevel_string='$version_patchlevel_string'
22177 versiononly='$versiononly'
22178 vi='$vi'
22179 voidflags='$voidflags'
22180 xlibpth='$xlibpth'
22181 yacc='$yacc'
22182 yaccflags='$yaccflags'
22183 zcat='$zcat'
22184 zip='$zip'
22185 EOT
22186
22187 : Add in command line options if available
22188 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22189
22190 : add special variables
22191 $test -f $src/patchlevel.h && \
22192 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22193 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22194 echo "PERL_CONFIG_SH=true" >>config.sh
22195
22196 : propagate old symbols
22197 if $test -f UU/config.sh; then
22198         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22199         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
22200         $sort | $uniq -u >UU/oldsyms
22201         set X `cat UU/oldsyms`
22202         shift
22203         case $# in
22204         0) ;;
22205         *)
22206                 cat <<EOM
22207 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22208 EOM
22209                 echo "# Variables propagated from previous config.sh file." >>config.sh
22210                 for sym in `cat UU/oldsyms`; do
22211                         echo "    Propagating $hint variable "'$'"$sym..."
22212                         eval 'tmp="$'"${sym}"'"'
22213                         echo "$tmp" | \
22214                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22215                 done
22216                 ;;
22217         esac
22218 fi
22219
22220 : Finish up by extracting the .SH files
22221 case "$alldone" in
22222 exit)
22223         $rm -rf UU
22224         echo "Extraction done."
22225         exit 0
22226         ;;
22227 cont)
22228         ;;
22229 '')
22230         dflt=''
22231         nostick=true
22232         $cat <<EOM
22233
22234 If you'd like to make any changes to the config.sh file before I begin
22235 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22236
22237 EOM
22238         rp="Press return or use a shell escape to edit config.sh:"
22239         . UU/myread
22240         nostick=''
22241         case "$ans" in
22242         '') ;;
22243         *) : in case they cannot read
22244                 sh 1>&4 -c "$ans";;
22245         esac
22246         ;;
22247 esac
22248
22249 : if this fails, just run all the .SH files by hand
22250 . ./config.sh
22251
22252 echo " "
22253 exec 1>&4
22254 pwd=`pwd`
22255 . ./UU/extract
22256 cd "$pwd"
22257
22258 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22259         dflt=y
22260         case "$silent" in
22261         true) ;;
22262         *)
22263                 $cat <<EOM
22264
22265 Now you need to generate make dependencies by running "$make depend".
22266 You might prefer to run it in background: "$make depend > makedepend.out &"
22267 It can take a while, so you might not want to run it right now.
22268
22269 EOM
22270                 ;;
22271         esac
22272         rp="Run $make depend now?"
22273         . UU/myread
22274         case "$ans" in
22275         y*)
22276                 $make depend && echo "Now you must run '$make'."
22277                 ;;
22278         *)
22279                 echo "You must run '$make depend' then '$make'."
22280                 ;;
22281         esac
22282 elif test -f [Mm]akefile; then
22283         echo " "
22284         echo "Now you must run a $make."
22285 else
22286         echo "Configure done."
22287 fi
22288
22289 if $test -f Policy.sh; then
22290     $cat <<EOM
22291
22292 If you compile $package on a different machine or from a different object
22293 directory, copy the Policy.sh file from this object directory to the
22294 new one before you run Configure -- this will help you with most of
22295 the policy defaults.
22296
22297 EOM
22298 fi
22299 if $test -f config.msg; then
22300     echo "Hmm.  I also noted the following information while running:"
22301     echo " "
22302     $cat config.msg >&4
22303     $rm -f config.msg
22304 fi
22305 $rm -f kit*isdone ark*isdone
22306 $rm -rf UU
22307
22308 : End of Configure
22309