Add MAD changes to pad code (new function Perl_pad_peg)
[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 mallocobj=''
970 mallocsrc=''
971 malloctype=''
972 usemallocwrap=''
973 usemymalloc=''
974 installman1dir=''
975 man1dir=''
976 man1direxp=''
977 man1ext=''
978 installman3dir=''
979 man3dir=''
980 man3direxp=''
981 man3ext=''
982 modetype=''
983 multiarch=''
984 mydomain=''
985 myhostname=''
986 phostname=''
987 c=''
988 n=''
989 d_eofnblk=''
990 eagain=''
991 o_nonblock=''
992 rd_nodata=''
993 need_va_copy=''
994 netdb_hlen_type=''
995 netdb_host_type=''
996 netdb_name_type=''
997 netdb_net_type=''
998 groupcat=''
999 hostcat=''
1000 passcat=''
1001 orderlib=''
1002 ranlib=''
1003 d_perl_otherlibdirs=''
1004 otherlibdirs=''
1005 package=''
1006 spackage=''
1007 pager=''
1008 api_revision=''
1009 api_subversion=''
1010 api_version=''
1011 api_versionstring=''
1012 patchlevel=''
1013 perl_patchlevel=''
1014 revision=''
1015 subversion=''
1016 version=''
1017 version_patchlevel_string=''
1018 perl5=''
1019 perladmin=''
1020 perlpath=''
1021 d_nv_preserves_uv=''
1022 d_nv_zero_is_allbits_zero=''
1023 i16size=''
1024 i16type=''
1025 i32size=''
1026 i32type=''
1027 i64size=''
1028 i64type=''
1029 i8size=''
1030 i8type=''
1031 ivsize=''
1032 ivtype=''
1033 nv_preserves_uv_bits=''
1034 nvsize=''
1035 nvtype=''
1036 u16size=''
1037 u16type=''
1038 u32size=''
1039 u32type=''
1040 u64size=''
1041 u64type=''
1042 u8size=''
1043 u8type=''
1044 uvsize=''
1045 uvtype=''
1046 ivdformat=''
1047 nvEUformat=''
1048 nvFUformat=''
1049 nvGUformat=''
1050 nveformat=''
1051 nvfformat=''
1052 nvgformat=''
1053 uvXUformat=''
1054 uvoformat=''
1055 uvuformat=''
1056 uvxformat=''
1057 pidtype=''
1058 prefix=''
1059 prefixexp=''
1060 installprivlib=''
1061 privlib=''
1062 privlibexp=''
1063 prototype=''
1064 ptrsize=''
1065 d_PRIXU64=''
1066 d_PRId64=''
1067 d_PRIi64=''
1068 d_PRIo64=''
1069 d_PRIu64=''
1070 d_PRIx64=''
1071 sPRIXU64=''
1072 sPRId64=''
1073 sPRIi64=''
1074 sPRIo64=''
1075 sPRIu64=''
1076 sPRIx64=''
1077 d_quad=''
1078 quadkind=''
1079 quadtype=''
1080 uquadtype=''
1081 drand01=''
1082 randbits=''
1083 randfunc=''
1084 randseedtype=''
1085 seedfunc=''
1086 installscript=''
1087 scriptdir=''
1088 scriptdirexp=''
1089 selectminbits=''
1090 selecttype=''
1091 sh=''
1092 sig_count=''
1093 sig_name=''
1094 sig_name_init=''
1095 sig_num=''
1096 sig_num_init=''
1097 sig_size=''
1098 installsitearch=''
1099 sitearch=''
1100 sitearchexp=''
1101 installsitebin=''
1102 sitebin=''
1103 sitebinexp=''
1104 installsitehtml1dir=''
1105 sitehtml1dir=''
1106 sitehtml1direxp=''
1107 installsitehtml3dir=''
1108 sitehtml3dir=''
1109 sitehtml3direxp=''
1110 installsitelib=''
1111 sitelib=''
1112 sitelib_stem=''
1113 sitelibexp=''
1114 installsiteman1dir=''
1115 siteman1dir=''
1116 siteman1direxp=''
1117 installsiteman3dir=''
1118 siteman3dir=''
1119 siteman3direxp=''
1120 siteprefix=''
1121 siteprefixexp=''
1122 installsitescript=''
1123 sitescript=''
1124 sitescriptexp=''
1125 sizesize=''
1126 sizetype=''
1127 so=''
1128 socksizetype=''
1129 sharpbang=''
1130 shsharp=''
1131 spitshell=''
1132 src=''
1133 ssizetype=''
1134 startperl=''
1135 startsh=''
1136 stdchar=''
1137 d_stdio_stream_array=''
1138 stdio_stream_array=''
1139 sysman=''
1140 trnl=''
1141 uidformat=''
1142 uidsign=''
1143 uidsize=''
1144 uidtype=''
1145 archname64=''
1146 use64bitall=''
1147 use64bitint=''
1148 usefaststdio=''
1149 ccflags_uselargefiles=''
1150 ldflags_uselargefiles=''
1151 libswanted_uselargefiles=''
1152 uselargefiles=''
1153 uselongdouble=''
1154 usemorebits=''
1155 usemultiplicity=''
1156 nm_opt=''
1157 nm_so_opt=''
1158 runnm=''
1159 usenm=''
1160 useperlio=''
1161 userelocatableinc=''
1162 usesocks=''
1163 d_oldpthreads=''
1164 use5005threads=''
1165 useithreads=''
1166 usereentrant=''
1167 usethreads=''
1168 incpath=''
1169 mips_type=''
1170 usrinc=''
1171 d_vendorarch=''
1172 installvendorarch=''
1173 vendorarch=''
1174 vendorarchexp=''
1175 d_vendorbin=''
1176 installvendorbin=''
1177 vendorbin=''
1178 vendorbinexp=''
1179 installvendorhtml1dir=''
1180 vendorhtml1dir=''
1181 vendorhtml1direxp=''
1182 installvendorhtml3dir=''
1183 vendorhtml3dir=''
1184 vendorhtml3direxp=''
1185 d_vendorlib=''
1186 installvendorlib=''
1187 vendorlib=''
1188 vendorlib_stem=''
1189 vendorlibexp=''
1190 installvendorman1dir=''
1191 vendorman1dir=''
1192 vendorman1direxp=''
1193 installvendorman3dir=''
1194 vendorman3dir=''
1195 vendorman3direxp=''
1196 usevendorprefix=''
1197 vendorprefix=''
1198 vendorprefixexp=''
1199 d_vendorscript=''
1200 installvendorscript=''
1201 vendorscript=''
1202 vendorscriptexp=''
1203 versiononly=''
1204 defvoidused=''
1205 voidflags=''
1206 yacc=''
1207 yaccflags=''
1208 CONFIG=''
1209
1210 define='define'
1211 undef='undef'
1212 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1213 rmlist=''
1214
1215 : We must find out about Eunice early
1216 eunicefix=':'
1217 if test -f /etc/unixtovms; then
1218         eunicefix=/etc/unixtovms
1219 fi
1220 if test -f /etc/unixtovms.exe; then
1221         eunicefix=/etc/unixtovms.exe
1222 fi
1223
1224 : Set executable suffix now -- needed before hints available
1225 if test -f "/libs/version.library"; then
1226 : Amiga OS
1227     _exe=""
1228 elif test -f "/system/gnu_library/bin/ar.pm"; then
1229 : Stratus VOS
1230     _exe=".pm"
1231 elif test -n "$DJGPP"; then
1232 : DOS DJGPP
1233     _exe=".exe"
1234 elif test -d c:/. -o -n "$is_os2" ; then
1235 : OS/2 or cygwin
1236     _exe=".exe"
1237 fi
1238
1239 i_whoami=''
1240 ccname=''
1241 ccversion=''
1242 perllibs=''
1243 : set useposix=false in your hint file to disable the POSIX extension.
1244 useposix=true
1245 : set useopcode=false in your hint file to disable the Opcode extension.
1246 useopcode=true
1247 : Trailing extension.  Override this in a hint file, if needed.
1248 : Extra object files, if any, needed on this platform.
1249 archobjs=''
1250 archname=''
1251 : Possible local include directories to search.
1252 : Set locincpth to "" in a hint file to defeat local include searches.
1253 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1254 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1255 :
1256 : no include file wanted by default
1257 inclwanted=''
1258
1259 groupstype=''
1260 libnames=''
1261 : change the next line if compiling for Xenix/286 on Xenix/386
1262 xlibpth='/usr/lib/386 /lib/386'
1263 : Possible local library directories to search.
1264 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1265 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1266
1267 : general looking path for locating libraries
1268 glibpth="/lib /usr/lib $xlibpth"
1269 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1270 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1271 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1272
1273 : Private path used by Configure to find libraries.  Its value
1274 : is prepended to libpth. This variable takes care of special
1275 : machines, like the mips.  Usually, it should be empty.
1276 plibpth=''
1277
1278 : default library list
1279 libswanted=''
1280 : some systems want to use only the non-versioned libso:s
1281 ignore_versioned_solibs=''
1282 siteman1dir=''
1283 siteman3dir=''
1284 sitescript=''
1285 archname64=''
1286 ccflags_uselargefiles=''
1287 ldflags_uselargefiles=''
1288 libswanted_uselargefiles=''
1289 : set usemultiplicity on the Configure command line to enable multiplicity.
1290 : set usesocks on the Configure command line to enable socks.
1291 : set usethreads on the Configure command line to enable threads.
1292 usereentrant='undef'
1293 : full support for void wanted by default
1294 defvoidused=15
1295
1296 : List of libraries we want.
1297 : If anyone needs extra -lxxx, put those in a hint file.
1298 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1299 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1300 : We probably want to search /usr/shlib before most other libraries.
1301 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1302 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1303 glibpth="/usr/shlib $glibpth"
1304 : Do not use vfork unless overridden by a hint file.
1305 usevfork=false
1306
1307 : Find the basic shell for Bourne shell scripts
1308 case "$sh" in
1309 '')
1310         case "$SYSTYPE" in
1311         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1312         *) xxx='/bin/sh';;
1313         esac
1314         if test -f "$xxx"; then
1315                 sh="$xxx"
1316         else
1317                 : Build up a list and do a single loop so we can 'break' out.
1318                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1319                 for xxx in sh bash ksh pdksh ash; do
1320                         for p in $pth; do
1321                                 try="$try ${p}/${xxx}"
1322                         done
1323                 done
1324                 for xxx in $try; do
1325                         if test -f "$xxx"; then
1326                                 sh="$xxx";
1327                                 break
1328                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1329                                 sh="$xxx";
1330                                 break
1331                         elif test -f "$xxx.exe"; then
1332                                 sh="$xxx";
1333                                 break
1334                         fi
1335                 done
1336         fi
1337         ;;
1338 esac
1339
1340 case "$sh" in
1341 '')     cat >&2 <<EOM
1342 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1343
1344 Usually it's in /bin/sh.  How did you even get this far?
1345 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1346 we'll try to straighten this all out.
1347 EOM
1348         exit 1
1349         ;;
1350 esac
1351
1352 : see if sh knows # comments
1353 if `$sh -c '#' >/dev/null 2>&1`; then
1354         shsharp=true
1355         spitshell=cat
1356         xcat=/bin/cat
1357         test -f $xcat$_exe || xcat=/usr/bin/cat
1358         if test ! -f $xcat$_exe; then
1359                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1360                         if test -f $p/cat$_exe; then
1361                                 xcat=$p/cat
1362                                 break
1363                         fi
1364                 done
1365                 if test ! -f $xcat$_exe; then
1366                         echo "Can't find cat anywhere!"
1367                         exit 1
1368                 fi
1369         fi
1370         echo "#!$xcat" >sharp
1371         $eunicefix sharp
1372         chmod +x sharp
1373         ./sharp > today
1374         if test -s today; then
1375                 sharpbang='#!'
1376         else
1377                 echo "#! $xcat" > sharp
1378                 $eunicefix sharp
1379                 chmod +x sharp
1380                 ./sharp > today
1381                 if test -s today; then
1382                         sharpbang='#! '
1383                 else
1384                         sharpbang=': use '
1385                 fi
1386         fi
1387 else
1388         echo " "
1389         echo "Your $sh doesn't grok # comments--I will strip them later on."
1390         shsharp=false
1391         cd ..
1392         echo "exec grep -v '^[  ]*#'" >spitshell
1393         chmod +x spitshell
1394         $eunicefix spitshell
1395         spitshell=`pwd`/spitshell
1396         cd UU
1397         echo "I presume that if # doesn't work, #! won't work either!"
1398         sharpbang=': use '
1399 fi
1400 rm -f sharp today
1401
1402 : figure out how to guarantee sh startup
1403 case "$startsh" in
1404 '') startsh=${sharpbang}${sh} ;;
1405 *)
1406 esac
1407 cat >sharp <<EOSS
1408 $startsh
1409 set abc
1410 test "$?abc" != 1
1411 EOSS
1412
1413 chmod +x sharp
1414 $eunicefix sharp
1415 if ./sharp; then
1416         : echo "Yup, it does."
1417 else
1418         echo "Hmm... '$startsh' does not guarantee sh startup..."
1419         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1420 fi
1421 rm -f sharp
1422
1423
1424 : Save command line options in file UU/cmdline.opt for later use in
1425 : generating config.sh.
1426 cat > cmdline.opt <<EOSH
1427 # Configure command line arguments.
1428 config_arg0='$0'
1429 config_args='$*'
1430 config_argc=$#
1431 EOSH
1432 argn=1
1433 args_exp=''
1434 args_sep=''
1435 for arg in "$@"; do
1436         cat >>cmdline.opt <<EOSH
1437 config_arg$argn='$arg'
1438 EOSH
1439         # Extreme backslashitis: replace each ' by '"'"'
1440         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1441 $arg
1442 EOC
1443         arg_exp=`cat cmdl.opt`
1444         args_exp="$args_exp$args_sep'$arg_exp'"
1445         argn=`expr $argn + 1`
1446         args_sep=' '
1447 done
1448 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1449 # used by ./hints/os2.sh
1450 rm -f cmdl.opt
1451
1452 : produce awk script to parse command line options
1453 cat >options.awk <<'EOF'
1454 BEGIN {
1455         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1456
1457         len = length(optstr);
1458         for (i = 1; i <= len; i++) {
1459                 c = substr(optstr, i, 1);
1460                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1461                 if (a == ":") {
1462                         arg[c] = 1;
1463                         i++;
1464                 }
1465                 opt[c] = 1;
1466         }
1467 }
1468 {
1469         expect = 0;
1470         str = $0;
1471         if (substr(str, 1, 1) != "-") {
1472                 printf("'%s'\n", str);
1473                 next;
1474         }
1475         len = length($0);
1476         for (i = 2; i <= len; i++) {
1477                 c = substr(str, i, 1);
1478                 if (!opt[c]) {
1479                         printf("-%s\n", substr(str, i));
1480                         next;
1481                 }
1482                 printf("-%s\n", c);
1483                 if (arg[c]) {
1484                         if (i < len)
1485                                 printf("'%s'\n", substr(str, i + 1));
1486                         else
1487                                 expect = 1;
1488                         next;
1489                 }
1490         }
1491 }
1492 END {
1493         if (expect)
1494                 print "?";
1495 }
1496 EOF
1497
1498 : process the command line options
1499 set X `for arg in "$@"; do echo "X$arg"; done |
1500         sed -e s/X// | awk -f options.awk`
1501 eval "set $*"
1502 shift
1503 rm -f options.awk
1504
1505 : set up default values
1506 fastread=''
1507 reuseval=false
1508 config_sh=''
1509 alldone=''
1510 error=''
1511 silent=''
1512 extractsh=''
1513 override=''
1514 knowitall=''
1515 rm -f optdef.sh posthint.sh
1516 cat >optdef.sh <<EOS
1517 $startsh
1518 EOS
1519
1520
1521 : option parsing
1522 while test $# -gt 0; do
1523         case "$1" in
1524         -d) shift; fastread=yes;;
1525         -e) shift; alldone=cont;;
1526         -f)
1527                 shift
1528                 cd ..
1529                 if test -r "$1"; then
1530                         config_sh="$1"
1531                 else
1532                         echo "$me: cannot read config file $1." >&2
1533                         error=true
1534                 fi
1535                 cd UU
1536                 shift;;
1537         -h) shift; error=true;;
1538         -r) shift; reuseval=true;;
1539         -s) shift; silent=true; realsilent=true;;
1540         -E) shift; alldone=exit;;
1541         -K) shift; knowitall=true;;
1542         -O) shift; override=true;;
1543         -S) shift; silent=true; extractsh=true;;
1544         -D)
1545                 shift
1546                 case "$1" in
1547                 *=)
1548                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1549                         echo "$me: ignoring -D $1" >&2
1550                         ;;
1551                 *=*) echo "$1" | \
1552                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1553                 *) echo "$1='define'" >> optdef.sh;;
1554                 esac
1555                 shift
1556                 ;;
1557         -U)
1558                 shift
1559                 case "$1" in
1560                 *=) echo "$1" >> optdef.sh;;
1561                 *=*)
1562                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1563                         echo "$me: ignoring -U $1" >&2
1564                         ;;
1565                 *) echo "$1='undef'" >> optdef.sh;;
1566                 esac
1567                 shift
1568                 ;;
1569         -A)
1570             shift
1571             xxx=''
1572             yyy="$1"
1573             zzz=''
1574             uuu=undef
1575             case "$yyy" in
1576             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1577                  case "$zzz" in
1578                  *:*) zzz='' ;;
1579                  *)   xxx=append
1580                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1581                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1582                  esac
1583                  ;;
1584             esac
1585             case "$xxx" in
1586             '')  case "$yyy" in
1587                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1588                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1589                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1590                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1591                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1592                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1593                  esac
1594                  ;;       
1595             esac
1596             case "$xxx" in
1597             append)
1598                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1599             clear)
1600                 echo "$yyy=''"                  >> posthint.sh ;;
1601             define)
1602                 case "$zzz" in
1603                 '') zzz=define ;;
1604                 esac
1605                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1606             eval)
1607                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1608             prepend)
1609                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1610             undef)
1611                 case "$zzz" in
1612                 '') zzz="$uuu" ;;
1613                 esac
1614                 echo "$yyy=$zzz"                >> posthint.sh ;;
1615             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1616             esac
1617             shift
1618             ;;
1619         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1620             exit 0;;
1621         --) break;;
1622         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1623         *) break;;
1624         esac
1625 done
1626
1627 case "$error" in
1628 true)
1629         cat >&2 <<EOM
1630 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1631                  [-U symbol] [-U symbol=] [-A command:symbol...]
1632   -d : use defaults for all answers.
1633   -e : go on without questioning past the production of config.sh.
1634   -f : specify an alternate default configuration file.
1635   -h : print this help message and exit (with an error status).
1636   -r : reuse C symbols value if possible (skips costly nm extraction).
1637   -s : silent mode, only echoes questions and essential information.
1638   -D : define symbol to have some value:
1639          -D symbol         symbol gets the value 'define'
1640          -D symbol=value   symbol gets the value 'value'
1641   -E : stop at the end of questions, after having produced config.sh.
1642   -K : do not use unless you know what you are doing.
1643   -O : let -D and -U override definitions from loaded configuration file.
1644   -S : perform variable substitutions on all .SH files (can mix with -f)
1645   -U : undefine symbol:
1646          -U symbol    symbol gets the value 'undef'
1647          -U symbol=   symbol gets completely empty
1648   -A : manipulate symbol after the platform specific hints have been applied:
1649          -A symbol=value                append " "value to symbol
1650          -A append:symbol=value         append value to symbol
1651          -A define:symbol=value         define symbol to have value
1652          -A clear:symbol                define symbol to be ''
1653          -A define:symbol               define symbol to be 'define'
1654          -A eval:symbol=value           define symbol to be eval of value
1655          -A prepend:symbol=value        prepend value to symbol
1656          -A undef:symbol                define symbol to be 'undef'
1657          -A undef:symbol=               define symbol to be ''
1658   -V : print version number and exit (with a zero status).
1659 EOM
1660         exit 1
1661         ;;
1662 esac
1663
1664 : Sanity checks
1665 case "$fastread$alldone" in
1666 yescont|yesexit) ;;
1667 *)
1668         case "$extractsh" in
1669         true) ;;
1670         *)
1671                 if test ! -t 0; then
1672                         echo "Say 'sh Configure', not 'sh <Configure'"
1673                         exit 1
1674                 fi
1675                 ;;
1676         esac
1677         ;;
1678 esac
1679
1680 exec 4>&1
1681 case "$silent" in
1682 true) exec 1>/dev/null;;
1683 esac
1684
1685 : run the defines and the undefines, if any, but leave the file out there...
1686 touch optdef.sh
1687 . ./optdef.sh
1688 : create the posthint manipulation script and leave the file out there...
1689 touch posthint.sh
1690
1691 : set package name
1692 package=perl5
1693 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1694 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1695 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1696 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1697 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1698 esac
1699
1700 : Some greps do not return status, grrr.
1701 echo "grimblepritz" >grimble
1702 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1703         contains=contains
1704 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1705         contains=grep
1706 else
1707         contains=contains
1708 fi
1709 rm -f grimble
1710 : the following should work in any shell
1711 case "$contains" in
1712 contains*)
1713         echo " "
1714         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1715         cat >contains <<'EOSS'
1716 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1717 EOSS
1718 chmod +x contains
1719 esac
1720
1721 : Find the path to the source tree
1722 case "$src" in
1723 '') case "$0" in
1724     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1725          case "$src" in
1726          /*)    ;;
1727          .)     ;;
1728          *)     src=`cd ../$src && pwd` ;;
1729          esac
1730          ;;
1731     *)   src='.';;
1732     esac;;
1733 esac
1734 case "$src" in
1735 '')     src=/
1736         rsrc=/
1737         ;;
1738 /*) rsrc="$src";;
1739 *) rsrc="../$src";;
1740 esac
1741 if test -f $rsrc/Configure && \
1742         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1743 then
1744    : found it, so we are ok.
1745 else
1746         rsrc=''
1747         for src in . .. ../.. ../../.. ../../../..; do
1748                 if test -f ../$src/Configure && \
1749                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1750                 then
1751                         rsrc=../$src
1752                         break
1753                 fi
1754         done
1755 fi
1756 case "$rsrc" in
1757 '')
1758         cat <<EOM >&4
1759
1760 Sorry, I can't seem to locate the source dir for $package.  Please start
1761 Configure with an explicit path -- i.e. /some/path/Configure.
1762
1763 EOM
1764         exit 1
1765         ;;
1766 ../.)   rsrc='..';;
1767 *)
1768         echo " "
1769         echo "Sources for $package found in \"$src\"." >&4
1770         ;;
1771 esac
1772
1773 : script used to extract .SH files with variable substitutions
1774 cat >extract <<'EOS'
1775 PERL_CONFIG_SH=true
1776 echo "Doing variable substitutions on .SH files..."
1777 if test -f MANIFEST; then
1778         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1779 else
1780         echo "(Looking for .SH files under the source directory.)"
1781         set x `(cd "$src"; find . -name "*.SH" -print)`
1782 fi
1783 shift
1784 case $# in
1785 0) set x `(cd "$src"; echo *.SH)`; shift;;
1786 esac
1787 if test ! -f "$src/$1"; then
1788         shift
1789 fi
1790 mkdir_p='
1791 name=$1;
1792 create="";
1793 while test $name; do
1794         if test ! -d "$name"; then
1795                 create="$name $create";
1796                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1797                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1798         else
1799                 name="";
1800         fi;
1801 done;
1802 for file in $create; do
1803         mkdir $file;
1804 done
1805 '
1806 for file in $*; do
1807         case "$src" in
1808         ".")
1809                 case "$file" in
1810                 */*)
1811                         dir=`expr X$file : 'X\(.*\)/'`
1812                         file=`expr X$file : 'X.*/\(.*\)'`
1813                         (cd "$dir" && . ./$file)
1814                         ;;
1815                 *)
1816                         . ./$file
1817                         ;;
1818                 esac
1819                 ;;
1820         *)
1821                 case "$file" in
1822                 */*)
1823                         dir=`expr X$file : 'X\(.*\)/'`
1824                         file=`expr X$file : 'X.*/\(.*\)'`
1825                         (set x $dir; shift; eval $mkdir_p)
1826                         sh <"$src/$dir/$file"
1827                         ;;
1828                 *)
1829                         sh <"$src/$file"
1830                         ;;
1831                 esac
1832                 ;;
1833         esac
1834 done
1835 if test -f "$src/config_h.SH"; then
1836         if test ! -f config.h; then
1837         : oops, they left it out of MANIFEST, probably, so do it anyway.
1838         . "$src/config_h.SH"
1839         fi
1840 fi
1841 EOS
1842
1843 : extract files and exit if asked to do so
1844 case "$extractsh" in
1845 true)
1846         case "$realsilent" in
1847         true) ;;
1848         *) exec 1>&4;;
1849         esac
1850         case "$config_sh" in
1851         '') config_sh='config.sh';;
1852         esac
1853         echo " "
1854         echo "Fetching answers from $config_sh..."
1855         cd ..
1856         . $config_sh
1857         test "$override" && . ./optdef.sh
1858         echo " "
1859         . UU/extract
1860         rm -rf UU
1861         echo "Extraction done."
1862         exit 0
1863         ;;
1864 esac
1865
1866 : Eunice requires " " instead of "", can you believe it
1867 echo " "
1868 : Here we go...
1869 echo "Beginning of configuration questions for $package."
1870
1871 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1872
1873 : first determine how to suppress newline on echo command
1874 echo " "
1875 echo "Checking echo to see how to suppress newlines..."
1876 (echo "hi there\c" ; echo " ") >.echotmp
1877 if $contains c .echotmp >/dev/null 2>&1 ; then
1878         echo "...using -n."
1879         n='-n'
1880         c=''
1881 else
1882         cat <<'EOM'
1883 ...using \c
1884 EOM
1885         n=''
1886         c='\c'
1887 fi
1888 echo $n "The star should be here-->$c"
1889 echo '*'
1890 rm -f .echotmp
1891
1892 : Now test for existence of everything in MANIFEST
1893 echo " "
1894 if test -f "$rsrc/MANIFEST"; then
1895         echo "First let's make sure your kit is complete.  Checking..." >&4
1896         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1897         rm -f missing
1898         tmppwd=`pwd`
1899         for filelist in x??; do
1900                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1901         done
1902         if test -s missing; then
1903                 cat missing >&4
1904                 cat >&4 <<'EOM'
1905
1906 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1907
1908 You have the option of continuing the configuration process, despite the
1909 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1910 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1911 and contact the author (perlbug@perl.org).
1912
1913 EOM
1914                 echo $n "Continue? [n] $c" >&4
1915                 read ans
1916                 case "$ans" in
1917                 y*)
1918                         echo "Continuing..." >&4
1919                         rm -f missing
1920                         ;;
1921                 *)
1922                         echo "ABORTING..." >&4
1923                         kill $$
1924                         ;;
1925                 esac
1926         else
1927                 echo "Looks good..."
1928         fi
1929 else
1930         echo "There is no MANIFEST file.  I hope your kit is complete !"
1931 fi
1932 rm -f missing x??
1933
1934 echo " "
1935 : Find the appropriate value for a newline for tr
1936 if test -n "$DJGPP"; then
1937        trnl='\012'
1938 fi
1939 if test X"$trnl" = X; then
1940         case "`echo foo|tr '\n' x 2>/dev/null`" in
1941         foox) trnl='\n' ;;
1942         esac
1943 fi
1944 if test X"$trnl" = X; then
1945         case "`echo foo|tr '\012' x 2>/dev/null`" in
1946         foox) trnl='\012' ;;
1947         esac
1948 fi
1949 if test X"$trnl" = X; then
1950        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1951        fooxy) trnl='\n\r' ;;
1952        esac
1953 fi
1954 if test X"$trnl" = X; then
1955         cat <<EOM >&2
1956
1957 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1958
1959 EOM
1960         exit 1
1961 fi
1962
1963 : compute the number of columns on the terminal for proper question formatting
1964 case "$COLUMNS" in
1965 '') COLUMNS='80';;
1966 esac
1967
1968 : set up the echo used in my read
1969 myecho="case \"\$xxxm\" in
1970 '') echo $n \"\$rp $c\" >&4;;
1971 *) case \"\$rp\" in
1972         '') echo $n \"[\$xxxm] $c\";;
1973         *)
1974                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1975                         echo \"\$rp\" >&4
1976                         echo $n \"[\$xxxm] $c\" >&4
1977                 else
1978                         echo $n \"\$rp [\$xxxm] $c\" >&4
1979                 fi
1980                 ;;
1981         esac;;
1982 esac"
1983
1984 : now set up to do reads with possible shell escape and default assignment
1985 cat <<EOSC >myread
1986 $startsh
1987 xxxm=\$dflt
1988 $myecho
1989 ans='!'
1990 case "\$fastread" in
1991 yes) case "\$dflt" in
1992         '') ;;
1993         *) ans='';
1994                 case "\$silent-\$rp" in
1995                 true-) ;;
1996                 *) echo " " >&4;;
1997                 esac;;
1998         esac;;
1999 *) case "\$silent" in
2000         true) case "\$rp" in
2001                 '') ans='';;
2002                 esac;;
2003         esac;;
2004 esac
2005 while expr "X\$ans" : "X!" >/dev/null; do
2006         read answ
2007         set x \$xxxm
2008         shift
2009         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2010         case  "\$answ" in
2011         "!")
2012                 sh 1>&4
2013                 echo " "
2014                 $myecho
2015                 ;;
2016         !*)
2017                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2018                 shift
2019                 sh 1>&4 -c "\$*"
2020                 echo " "
2021                 $myecho
2022                 ;;
2023         "\$ans")
2024                 case "\$ans" in
2025                 \\&*)
2026                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2027                         shift
2028                         case "\$1" in
2029                         -d)
2030                                 fastread=yes
2031                                 echo "(OK, I'll run with -d after this question.)" >&4
2032                                 ;;
2033                         -*)
2034                                 echo "*** Sorry, \$1 not supported yet." >&4
2035                                 ;;
2036                         esac
2037                         $myecho
2038                         ans=!
2039                         ;;
2040                 esac;;
2041         *)
2042                 case "\$aok" in
2043                 y)
2044                         echo "*** Substitution done -- please confirm."
2045                         xxxm="\$ans"
2046                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2047                         xxxm="\$ans"
2048                         ans=!
2049                         ;;
2050                 *)
2051                         echo "*** Error -- try again."
2052                         ans=!
2053                         ;;
2054                 esac
2055                 $myecho
2056                 ;;
2057         esac
2058         case "\$ans\$xxxm\$nostick" in
2059         '')
2060                 ans=!
2061                 $myecho
2062                 ;;
2063         esac
2064 done
2065 case "\$ans" in
2066 '') ans="\$xxxm";;
2067 esac
2068 EOSC
2069
2070 : create .config dir to save info across Configure sessions
2071 test -d ../.config || mkdir ../.config
2072 cat >../.config/README <<EOF
2073 This directory created by Configure to save information that should
2074 persist across sessions for $package.
2075
2076 You may safely delete it if you wish.
2077 EOF
2078
2079 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2080 case "$usedevel" in
2081 $define|true|[yY]*) ;;
2082 *) case "$xversion" in
2083    *[13579])
2084         cat >&4 <<EOH
2085 *** WHOA THERE!!! ***
2086
2087     This is an UNSTABLE DEVELOPMENT release.
2088     The version of this $package distribution is $xversion, that is, odd,
2089     (as opposed to even) and that signifies a development release.
2090     If you want a maintenance release, you want an even-numbered version.
2091
2092     Do ***NOT*** install this into production use.
2093     Data corruption and crashes are possible.
2094
2095     It is most seriously suggested that you do not continue any further
2096     unless you want to help in developing and debugging Perl.
2097
2098     If you *still* want to build perl, you can answer 'y' now,
2099     or pass -Dusedevel to Configure.
2100
2101 EOH
2102         rp='Do you really want to continue?'
2103         dflt='n'
2104         . ./myread
2105         case "$ans" in
2106         [yY]) echo >&4 "Okay, continuing."
2107               usedevel="$define" ;;
2108         *) echo >&4 "Okay, bye."
2109            exit 1
2110            ;;
2111         esac
2112         ;;
2113     esac
2114     ;;
2115 esac
2116 case "$usedevel" in
2117 $define|true|[yY]*)
2118         case "$versiononly" in
2119         '') versiononly="$define" ;;
2120         esac
2121         case "$installusrbinperl" in
2122         '') installusrbinperl="$undef" ;;
2123         esac
2124         ;;
2125 esac
2126
2127 : general instructions
2128 needman=true
2129 firsttime=true
2130 user=`(logname) 2>/dev/null`
2131 case "$user" in
2132 '') user=`whoami 2>&1`;;
2133 esac
2134 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2135         firsttime=false
2136         echo " "
2137         rp='Would you like to see the instructions?'
2138         dflt=n
2139         . ./myread
2140         case "$ans" in
2141         [yY]*) ;;
2142         *) needman=false;;
2143         esac
2144 fi
2145 if $needman; then
2146         cat <<EOH
2147
2148 This installation shell script will examine your system and ask you questions
2149 to determine how the perl5 package should be installed. If you get
2150 stuck on a question, you may use a ! shell escape to start a subshell or
2151 execute a command.  Many of the questions will have default answers in square
2152 brackets; typing carriage return will give you the default.
2153
2154 On some of the questions which ask for file or directory names you are allowed
2155 to use the ~name construct to specify the login directory belonging to "name",
2156 even if you don't have a shell which knows about that.  Questions where this is
2157 allowed will be marked "(~name ok)".
2158
2159 EOH
2160         rp=''
2161         dflt='Type carriage return to continue'
2162         . ./myread
2163         cat <<'EOH'
2164
2165 The prompter used in this script allows you to use shell variables and
2166 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2167 in the default answer, as if the default line was a set of arguments given to a
2168 script shell.  This means you may also use $* to repeat the whole default line,
2169 so you do not have to re-type everything to add something to the default.
2170
2171 Everytime there is a substitution, you will have to confirm.  If there is an
2172 error (e.g. an unmatched backtick), the default answer will remain unchanged
2173 and you will be prompted again.
2174
2175 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2176 the questions and use the computed defaults (or the previous answers if there
2177 was already a config.sh file). Type 'Configure -h' for a list of options.
2178 You may also start interactively and then answer '& -d' at any prompt to turn
2179 on the non-interactive behaviour for the remainder of the execution.
2180
2181 EOH
2182         . ./myread
2183         cat <<EOH
2184
2185 Much effort has been expended to ensure that this shell script will run on any
2186 Unix system.  If despite that it blows up on yours, your best bet is to edit
2187 Configure and run it again.  If you can't run Configure for some reason,
2188 you'll have to generate a config.sh file by hand.  Whatever problems you
2189 have, let me (perlbug@perl.org) know how I blew it.
2190
2191 This installation script affects things in two ways:
2192
2193 1) it may do direct variable substitutions on some of the files included
2194    in this kit.
2195 2) it builds a config.h file for inclusion in C programs.  You may edit
2196    any of these files as the need arises after running this script.
2197
2198 If you make a mistake on a question, there is no easy way to back up to it
2199 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2200 files.  Configure will offer to let you do this before it runs the SH files.
2201
2202 EOH
2203         dflt='Type carriage return to continue'
2204         . ./myread
2205         case "$firsttime" in
2206         true) echo $user >>../.config/instruct;;
2207         esac
2208 fi
2209
2210 : find out where common programs are
2211 echo " "
2212 echo "Locating common programs..." >&4
2213 cat <<EOSC >loc
2214 $startsh
2215 case \$# in
2216 0) exit 1;;
2217 esac
2218 thing=\$1
2219 shift
2220 dflt=\$1
2221 shift
2222 for dir in \$*; do
2223         case "\$thing" in
2224         .)
2225         if test -d \$dir/\$thing; then
2226                 echo \$dir
2227                 exit 0
2228         fi
2229         ;;
2230         *)
2231         for thisthing in \$dir/\$thing; do
2232                 : just loop through to pick last item
2233         done
2234         if test -f \$thisthing; then
2235                 echo \$thisthing
2236                 exit 0
2237         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2238                 echo \$thisthing
2239                 exit 0
2240         elif test -f \$dir/\$thing.exe; then
2241                 if test -n "$DJGPP"; then
2242                         echo \$dir/\$thing.exe
2243                 elif test "$eunicefix" != ":"; then
2244                         : on Eunice apparently
2245                         echo \$dir/\$thing
2246                         exit 0
2247                 fi
2248                 exit 0
2249         fi
2250         ;;
2251         esac
2252 done
2253 echo \$dflt
2254 exit 1
2255 EOSC
2256 chmod +x loc
2257 $eunicefix loc
2258 loclist="
2259 awk
2260 cat
2261 chmod
2262 comm
2263 cp
2264 echo
2265 expr
2266 grep
2267 ls
2268 mkdir
2269 rm
2270 sed
2271 sort
2272 touch
2273 tr
2274 uniq
2275 "
2276 trylist="
2277 Mcc
2278 ar
2279 bison
2280 byacc
2281 cpp
2282 csh
2283 date
2284 egrep
2285 gmake
2286 gzip
2287 less
2288 ln
2289 make
2290 more
2291 nm
2292 nroff
2293 pg
2294 test
2295 uname
2296 zip
2297 "
2298 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2299 pth="$pth /lib /usr/lib"
2300 for file in $loclist; do
2301         eval xxx=\$$file
2302         case "$xxx" in
2303         /*|?:[\\/]*)
2304                 if test -f "$xxx"; then
2305                         : ok
2306                 else
2307                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2308                         xxx=`./loc $file $file $pth`
2309                 fi
2310                 ;;
2311         '') xxx=`./loc $file $file $pth`;;
2312         *) xxx=`./loc $xxx $xxx $pth`;;
2313         esac
2314         eval $file=$xxx$_exe
2315         eval _$file=$xxx
2316         case "$xxx" in
2317         /*)
2318                 echo $file is in $xxx.
2319                 ;;
2320         ?:[\\/]*)
2321                 echo $file is in $xxx.
2322                 ;;
2323         *)
2324                 echo "I don't know where '$file' is, and my life depends on it." >&4
2325                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2326                 exit 1
2327                 ;;
2328         esac
2329 done
2330 echo " "
2331 echo "Don't worry if any of the following aren't found..."
2332 say=offhand
2333 for file in $trylist; do
2334         eval xxx=\$$file
2335         case "$xxx" in
2336         /*|?:[\\/]*)
2337                 if test -f "$xxx"; then
2338                         : ok
2339                 else
2340                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2341                         xxx=`./loc $file $file $pth`
2342                 fi
2343                 ;;
2344         '') xxx=`./loc $file $file $pth`;;
2345         *) xxx=`./loc $xxx $xxx $pth`;;
2346         esac
2347         eval $file=$xxx$_exe
2348         eval _$file=$xxx
2349         case "$xxx" in
2350         /*)
2351                 echo $file is in $xxx.
2352                 ;;
2353         ?:[\\/]*)
2354                 echo $file is in $xxx.
2355                 ;;
2356         *)
2357                 echo "I don't see $file out there, $say."
2358                 say=either
2359                 ;;
2360         esac
2361 done
2362 case "$egrep" in
2363 egrep)
2364         echo "Substituting grep for egrep."
2365         egrep=$grep
2366         _egrep=$grep
2367         ;;
2368 esac
2369 case "$ln" in
2370 ln)
2371         echo "Substituting cp for ln."
2372         ln=$cp
2373         _ln=$cp
2374         ;;
2375 esac
2376 case "$make" in
2377 make)   
2378         case "$gmake" in
2379         gmake)
2380         echo "I can't find make or gmake, and my life depends on it." >&4
2381         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2382         exit 1
2383         ;;
2384         esac
2385         ;;
2386 esac    
2387 case "$gmake" in
2388 gmake)  ;;
2389 *)      # We can't have osname yet.
2390         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2391                 # Assume that gmake, if found, is definitely GNU make
2392                 # and prefer it over the system make.
2393                 echo "Substituting gmake for make."
2394                 make=$gmake
2395                 _make=$gmake
2396         fi
2397         ;;
2398 esac
2399 case "$test" in
2400 test)
2401         echo "Hopefully test is built into your sh."
2402         ;;
2403 *)
2404         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2405                 echo "Using the test built into your sh."
2406                 test=test
2407                 _test=test
2408         fi
2409         ;;
2410 esac
2411 case "$echo" in
2412 echo)
2413         echo "Hopefully echo is built into your sh."
2414         ;;
2415 '') ;;
2416 *)
2417         echo " "
2418 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2419         $echo $n "hi there$c" >foo1
2420         echo $n "hi there$c" >foo2
2421         if cmp foo1 foo2 >/dev/null 2>&1; then
2422                 echo "They are compatible.  In fact, they may be identical."
2423         else
2424                 case "$n" in
2425                 '-n') n='' c='\c';;
2426                 *) n='-n' c='';;
2427                 esac
2428                 cat <<FOO
2429 They are not compatible!  You are probably running ksh on a non-USG system.
2430 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2431 have echo built in and we may have to run some Bourne shell scripts.  That
2432 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2433
2434 FOO
2435                 $echo $n "The star should be here-->$c"
2436                 $echo "*"
2437         fi
2438         $rm -f foo1 foo2
2439         ;;
2440 esac
2441
2442 cat <<EOS >trygcc
2443 $startsh
2444 EOS
2445 cat <<'EOSC' >>trygcc
2446 case "$cc" in
2447 '') ;;
2448 *)  $rm -f try try.*
2449     $cat >try.c <<EOM
2450 int main(int argc, char *argv[]) {
2451   return 0;
2452 }
2453 EOM
2454     if $cc -o try $ccflags $ldflags try.c; then
2455        :
2456     else
2457         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2458         despair=yes
2459         trygcc=yes
2460         case "$cc" in
2461         *gcc*) trygcc=no ;;
2462         esac
2463         case "`$cc -v -c try.c 2>&1`" in
2464         *gcc*) trygcc=no ;;
2465         esac
2466         if $test X"$trygcc" = Xyes; then
2467             if gcc -o try -c try.c; then
2468                 echo " "
2469                 echo "You seem to have a working gcc, though." >&4
2470                 rp="Would you like to use it?"
2471                 dflt=y
2472                 if $test -f myread; then
2473                     . ./myread
2474                 else
2475                     if $test -f UU/myread; then
2476                         . ./UU/myread
2477                     else
2478                         echo "Cannot find myread, sorry.  Aborting." >&2
2479                         exit 1
2480                     fi
2481                 fi  
2482                 case "$ans" in
2483                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2484                        if $test -f usethreads.cbu; then
2485                            $cat >&4 <<EOM 
2486
2487 *** However, any setting of the C compiler flags (e.g. for thread support)
2488 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2489 *** (together with e.g. -Dusethreads).
2490
2491 EOM
2492                        fi;;
2493                 esac
2494             fi
2495         fi
2496     fi
2497     $rm -f try try.*
2498     ;;
2499 esac
2500 EOSC
2501
2502 cat <<EOS >checkcc
2503 $startsh
2504 EOS
2505 cat <<'EOSC' >>checkcc
2506 case "$cc" in        
2507 '') ;;
2508 *)  $rm -f try try.*              
2509     $cat >try.c <<EOM
2510 int main(int argc, char *argv[]) {
2511   return 0;
2512 }
2513 EOM
2514     if $cc -o try $ccflags $ldflags try.c; then
2515        :
2516     else
2517         if $test X"$despair" = Xyes; then
2518            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2519         fi
2520         $cat >&4 <<EOM         
2521 You need to find a working C compiler.
2522 Either (purchase and) install the C compiler supplied by your OS vendor,
2523 or for a free C compiler try http://gcc.gnu.org/
2524 I cannot continue any further, aborting.
2525 EOM
2526         exit 1
2527     fi
2528     $rm -f try try.*
2529     ;;
2530 esac
2531 EOSC
2532
2533 : determine whether symbolic links are supported
2534 echo " "
2535 $touch blurfl
2536 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2537         echo "Symbolic links are supported." >&4
2538         lns="$ln -s"
2539 else
2540         echo "Symbolic links are NOT supported." >&4
2541         lns="$ln"
2542 fi
2543 $rm -f blurfl sym
2544
2545 : determine whether symbolic links are supported
2546 echo " "
2547 case "$lns" in
2548 *"ln"*" -s")
2549         echo "Checking how to test for symbolic links..." >&4
2550         $lns blurfl sym
2551         if $test "X$issymlink" = X; then
2552                 case "$newsh" in
2553                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2554                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2555                 esac
2556                 if test $? = 0; then
2557                         issymlink="test -h"
2558                 else
2559                         echo "Your builtin 'test -h' may be broken." >&4
2560                         case "$test" in
2561                         /*)     ;;
2562                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2563                                 for p in $pth
2564                                 do
2565                                         if test -f "$p/$test"; then
2566                                                 test="$p/$test"
2567                                                 break
2568                                         fi
2569                                 done
2570                                 ;;
2571                         esac
2572                         case "$test" in
2573                         /*)
2574                                 echo "Trying external '$test -h'." >&4
2575                                 issymlink="$test -h"
2576                                 if $test ! -h sym >/dev/null 2>&1; then
2577                                         echo "External '$test -h' is broken, too." >&4
2578                                         issymlink=''
2579                                 fi
2580                                 ;;
2581                         *)      issymlink='' ;;
2582                         esac
2583                 fi              
2584         fi
2585         if $test "X$issymlink" = X; then
2586                 if $test -L sym 2>/dev/null; then
2587                         issymlink="$test -L"
2588                         echo "The builtin '$test -L' worked." >&4
2589                 fi
2590         fi
2591         if $test "X$issymlink" != X; then
2592                 echo "You can test for symbolic links with '$issymlink'." >&4
2593         else
2594                 echo "I do not know how you can test for symbolic links." >&4
2595         fi
2596         $rm -f blurfl sym
2597         ;;
2598 *)      echo "No symbolic links, so not testing for their testing..." >&4
2599         ;;
2600 esac
2601 echo " "
2602
2603
2604 case "$mksymlinks" in
2605 $define|true|[yY]*)
2606         case "$src" in
2607         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2608                 exit 1
2609                 ;;
2610         *)      case "$lns:$issymlink" in
2611                 *"ln"*" -s:"*"test -"?)
2612                         echo "Creating the symbolic links..." >&4
2613                         echo "(First creating the subdirectories...)" >&4
2614                         cd ..
2615                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2616                                 read directory
2617                                 test -z "$directory" && break
2618                                 mkdir -p $directory
2619                         done
2620                         # Sanity check 1.
2621                         if test ! -d t/base; then
2622                                 echo "Failed to create the subdirectories.  Aborting." >&4
2623                                 exit 1
2624                         fi
2625                         echo "(Then creating the symlinks...)" >&4
2626                         awk '{print $1}' $src/MANIFEST | while true; do
2627                                 read filename
2628                                 test -z "$filename" && break
2629                                 if test -f $filename; then
2630                                         if $issymlink $filename; then
2631                                                 rm -f $filename
2632                                         fi
2633                                 fi
2634                                 if test -f $filename; then
2635                                         echo "$filename already exists, not symlinking."
2636                                 else
2637                                         ln -s $src/$filename $filename
2638                                 fi
2639                         done
2640                         # Sanity check 2.
2641                         if test ! -f t/base/lex.t; then
2642                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2643                                 exit 1
2644                         fi
2645                         cd UU
2646                         ;;
2647                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2648                         ;;
2649                 esac
2650                 ;;
2651         esac
2652         ;;
2653 esac
2654
2655
2656 case "$usecrosscompile" in
2657 $define|true|[yY]*)
2658         $echo "Cross-compiling..."
2659         croak=''
2660         case "$cc" in
2661         *-*-gcc) # A cross-compiling gcc, probably.
2662             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2663             ar=$targetarch-ar
2664             # leave out ld, choosing it is more complex
2665             nm=$targetarch-nm
2666             ranlib=$targetarch-ranlib
2667             $echo 'extern int foo;' > try.c
2668             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2669             shift
2670             if $test $# -gt 0; then
2671                 incpth="$incpth $*"
2672                 incpth="`$echo $incpth|$sed 's/^ //'`"
2673                 echo "Guessing incpth '$incpth'." >&4
2674                 for i in $*; do
2675                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2676                     if $test -d $j; then
2677                         libpth="$libpth $j"
2678                     fi
2679                 done   
2680                 libpth="`$echo $libpth|$sed 's/^ //'`"
2681                 echo "Guessing libpth '$libpth'." >&4
2682             fi
2683             $rm -f try.c
2684             ;;
2685         esac
2686         case "$targetarch" in
2687         '') echo "Targetarch not defined." >&4; croak=y ;;
2688         *)  echo "Using targetarch $targetarch." >&4 ;;
2689         esac
2690         case "$incpth" in
2691         '') echo "Incpth not defined." >&4; croak=y ;;
2692         *)  echo "Using incpth '$incpth'." >&4 ;;
2693         esac
2694         case "$libpth" in
2695         '') echo "Libpth not defined." >&4; croak=y ;;
2696         *)  echo "Using libpth '$libpth'." >&4 ;;
2697         esac
2698         case "$usrinc" in
2699         '') for i in $incpth; do
2700                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2701                     usrinc=$i
2702                     echo "Guessing usrinc $usrinc." >&4
2703                     break
2704                 fi
2705             done
2706             case "$usrinc" in
2707             '') echo "Usrinc not defined." >&4; croak=y ;;
2708             esac
2709             ;;
2710         *)  echo "Using usrinc $usrinc." >&4 ;;
2711         esac
2712         case "$targethost" in
2713         '') echo "Targethost not defined." >&4; croak=y ;;
2714         *)  echo "Using targethost $targethost." >&4
2715         esac
2716         locincpth=' '
2717         loclibpth=' '
2718         case "$croak" in
2719         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2720         esac
2721         case "$src" in
2722         /*) run=$src/Cross/run
2723             targetmkdir=$src/Cross/mkdir
2724             to=$src/Cross/to
2725             from=$src/Cross/from
2726             ;;
2727         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2728             run=$pwd/Cross/run
2729             targetmkdir=$pwd/Cross/mkdir
2730             to=$pwd/Cross/to
2731             from=$pwd/Cross/from
2732             ;;
2733         esac
2734         case "$targetrun" in
2735         '') targetrun=ssh ;;
2736         esac
2737         case "$targetto" in
2738         '') targetto=scp ;;
2739         esac
2740         case "$targetfrom" in
2741         '') targetfrom=scp ;;
2742         esac
2743         run=$run-$targetrun
2744         to=$to-$targetto
2745         from=$from-$targetfrom
2746         case "$targetdir" in
2747         '')  targetdir=/tmp
2748              echo "Guessing targetdir $targetdir." >&4
2749              ;;
2750         esac
2751         case "$targetuser" in
2752         '')  targetuser=root
2753              echo "Guessing targetuser $targetuser." >&4
2754              ;;
2755         esac
2756         case "$targetfrom" in
2757         scp)    q=-q ;;
2758         *)      q='' ;;
2759         esac
2760         case "$targetrun" in
2761         ssh|rsh)
2762             cat >$run <<EOF
2763 #!/bin/sh
2764 case "\$1" in
2765 -cwd)
2766   shift
2767   cwd=\$1
2768   shift
2769   ;;
2770 esac
2771 case "\$cwd" in
2772 '') cwd=$targetdir ;;
2773 esac
2774 exe=\$1
2775 shift
2776 if $test ! -f \$exe.xok; then
2777   $to \$exe
2778   $touch \$exe.xok
2779 fi
2780 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2781 EOF
2782             ;;
2783         *)  echo "Unknown targetrun '$targetrun'" >&4
2784             exit 1
2785             ;;
2786         esac
2787         case "$targetmkdir" in
2788         */Cross/mkdir)
2789             cat >$targetmkdir <<EOF
2790 #!/bin/sh
2791 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2792 EOF
2793             $chmod a+rx $targetmkdir
2794             ;;
2795         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2796             exit 1
2797             ;;
2798         esac
2799         case "$targetto" in
2800         scp|rcp)
2801             cat >$to <<EOF
2802 #!/bin/sh
2803 for f in \$@
2804 do
2805   case "\$f" in
2806   /*)
2807     $targetmkdir \`dirname \$f\`
2808     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2809     ;;
2810   *)
2811     $targetmkdir $targetdir/\`dirname \$f\`
2812     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2813     ;;
2814   esac
2815 done
2816 exit 0
2817 EOF
2818             ;;
2819         cp) cat >$to <<EOF
2820 #!/bin/sh
2821 for f in \$@
2822 do
2823   case "\$f" in
2824   /*)
2825     $mkdir -p $targetdir/\`dirname \$f\`
2826     $cp \$f $targetdir/\$f || exit 1
2827     ;;
2828   *)
2829     $targetmkdir $targetdir/\`dirname \$f\`
2830     $cp \$f $targetdir/\$f || exit 1
2831     ;;
2832   esac
2833 done
2834 exit 0
2835 EOF
2836             ;;
2837         *)  echo "Unknown targetto '$targetto'" >&4
2838             exit 1
2839             ;;
2840         esac
2841         case "$targetfrom" in
2842         scp|rcp)
2843           cat >$from <<EOF
2844 #!/bin/sh
2845 for f in \$@
2846 do
2847   $rm -f \$f
2848   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2849 done
2850 exit 0
2851 EOF
2852             ;;
2853         cp) cat >$from <<EOF
2854 #!/bin/sh
2855 for f in \$@
2856 do
2857   $rm -f \$f
2858   cp $targetdir/\$f . || exit 1
2859 done
2860 exit 0
2861 EOF
2862             ;;
2863         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2864             exit 1
2865             ;;
2866         esac
2867         if $test ! -f $run; then
2868             echo "Target 'run' script '$run' not found." >&4
2869         else
2870             $chmod a+rx $run
2871         fi
2872         if $test ! -f $to; then
2873             echo "Target 'to' script '$to' not found." >&4
2874         else
2875             $chmod a+rx $to
2876         fi
2877         if $test ! -f $from; then
2878             echo "Target 'from' script '$from' not found." >&4
2879         else
2880             $chmod a+rx $from
2881         fi
2882         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2883             exit 1
2884         fi
2885         cat >&4 <<EOF
2886 Using '$run' for remote execution,
2887 and '$from' and '$to'
2888 for remote file transfer.
2889 EOF
2890         ;;
2891 *)      run=''
2892         to=:
2893         from=:
2894         usecrosscompile='undef'
2895         targetarch=''
2896         ;;
2897 esac
2898
2899 : see whether [:lower:] and [:upper:] are supported character classes
2900 echo " "
2901 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2902 ABYZ)
2903         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2904         up='[:upper:]'
2905         low='[:lower:]'
2906         ;;
2907 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2908         # (0xd9 and 0xe2), therefore that is a nice testing point.
2909         if test "X$up" = X -o "X$low" = X; then
2910             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2911             rs) up='[A-Z]'
2912                 low='[a-z]'
2913                 ;;
2914             esac
2915         fi
2916         if test "X$up" = X -o "X$low" = X; then
2917             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2918             rs) up='A-Z'
2919                 low='a-z'
2920                 ;;
2921             esac
2922         fi
2923         if test "X$up" = X -o "X$low" = X; then
2924             case "`echo RS | od -x 2>/dev/null`" in
2925             *D9E2*|*d9e2*)
2926                 echo "Hey, this might be EBCDIC." >&4
2927                 if test "X$up" = X -o "X$low" = X; then
2928                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2929                     rs) up='[A-IJ-RS-Z]'
2930                         low='[a-ij-rs-z]'
2931                         ;;
2932                     esac
2933                 fi
2934                 if test "X$up" = X -o "X$low" = X; then
2935                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2936                     rs) up='A-IJ-RS-Z'
2937                         low='a-ij-rs-z'
2938                         ;;
2939                     esac
2940                 fi
2941                 ;;
2942             esac
2943         fi
2944 esac
2945 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2946 rs)
2947     echo "Using $up and $low to convert case." >&4
2948     ;;
2949 *)
2950     echo "I don't know how to translate letters from upper to lower case." >&4
2951     echo "Your tr is not acting any way I know of." >&4
2952     exit 1
2953     ;;
2954 esac
2955 : set up the translation script tr, must be called with ./tr of course
2956 cat >tr <<EOSC
2957 $startsh
2958 case "\$1\$2" in
2959 '[A-Z][a-z]') exec $tr '$up' '$low';;
2960 '[a-z][A-Z]') exec $tr '$low' '$up';;
2961 esac
2962 exec $tr "\$@"
2963 EOSC
2964 chmod +x tr
2965 $eunicefix tr
2966
2967 : Try to determine whether config.sh was made on this system
2968 case "$config_sh" in
2969 '')
2970 myuname=`$uname -a 2>/dev/null`
2971 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2972 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2973 # because the A-Z/a-z are not consecutive.
2974 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2975         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2976 newmyuname="$myuname"
2977 dflt=n
2978 case "$knowitall" in
2979 '')
2980         if test -f ../config.sh; then
2981                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2982                         eval "`grep myuname= ../config.sh`"
2983                 fi
2984                 if test "X$myuname" = "X$newmyuname"; then
2985                         dflt=y
2986                 fi
2987         fi
2988         ;;
2989 *) dflt=y;;
2990 esac
2991
2992 : Get old answers from old config file if Configure was run on the
2993 : same system, otherwise use the hints.
2994 hint=default
2995 cd ..
2996 if test -f config.sh; then
2997         echo " "
2998         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2999         . UU/myread
3000         case "$ans" in
3001         n*|N*) echo "OK, I'll ignore it."
3002                 mv config.sh config.sh.old
3003                 myuname="$newmyuname"
3004                 ;;
3005         *)  echo "Fetching default answers from your old config.sh file..." >&4
3006                 tmp_n="$n"
3007                 tmp_c="$c"
3008                 tmp_sh="$sh"
3009                 . ./config.sh
3010                 cp config.sh UU
3011                 n="$tmp_n"
3012                 c="$tmp_c"
3013                 : Older versions did not always set $sh.  Catch re-use of such
3014                 : an old config.sh.
3015                 case "$sh" in
3016                 '') sh="$tmp_sh" ;;
3017                 esac
3018                 hint=previous
3019                 ;;
3020         esac
3021 fi
3022 . ./UU/checkcc
3023 if test ! -f config.sh; then
3024         $cat <<EOM
3025
3026 First time through, eh?  I have some defaults handy for some systems
3027 that need some extra help getting the Configure answers right:
3028
3029 EOM
3030         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3031         dflt=''
3032         : Half the following guesses are probably wrong... If you have better
3033         : tests or hints, please send them to perlbug@perl.org
3034         : The metaconfig authors would also appreciate a copy...
3035         $test -f /irix && osname=irix
3036         $test -f /xenix && osname=sco_xenix
3037         $test -f /dynix && osname=dynix
3038         $test -f /dnix && osname=dnix
3039         $test -f /lynx.os && osname=lynxos
3040         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3041         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3042         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3043         $test -f /bin/mips && /bin/mips && osname=mips
3044         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3045                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3046         $test -d /usr/apollo/bin && osname=apollo
3047         $test -f /etc/saf/_sactab && osname=svr4
3048         $test -d /usr/include/minix && osname=minix
3049         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3050         if $test -d /MachTen -o -d /MachTen_Folder; then
3051                 osname=machten
3052                 if $test -x /sbin/version; then
3053                         osvers=`/sbin/version | $awk '{print $2}' |
3054                         $sed -e 's/[A-Za-z]$//'`
3055                 elif $test -x /usr/etc/version; then
3056                         osvers=`/usr/etc/version | $awk '{print $2}' |
3057                         $sed -e 's/[A-Za-z]$//'`
3058                 else
3059                         osvers="$2.$3"
3060                 fi
3061         fi
3062
3063         $test -f /sys/posix.dll &&
3064                 $test -f /usr/bin/what &&
3065                 set X `/usr/bin/what /sys/posix.dll` &&
3066                 $test "$3" = UWIN &&
3067                 osname=uwin &&
3068                 osvers="$5"
3069
3070         if $test -f $uname; then
3071                 set X $myuname
3072                 shift
3073
3074                 case "$5" in
3075                 fps*) osname=fps ;;
3076                 mips*)
3077                         case "$4" in
3078                         umips) osname=umips ;;
3079                         *) osname=mips ;;
3080                         esac;;
3081                 [23]100) osname=mips ;;
3082                 next*) osname=next ;;
3083                 i386*)
3084                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3085                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3086                                 osname='sco'
3087                                 osvers=$tmp
3088                         elif $test -f /etc/kconfig; then
3089                                 osname=isc
3090                                 if test "$lns" = "$ln -s"; then
3091                                         osvers=4
3092                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3093                                         osvers=3
3094                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3095                                         osvers=2
3096                                 fi
3097                         fi
3098                         tmp=''
3099                         ;;
3100                 pc*)
3101                         if test -n "$DJGPP"; then
3102                                 osname=dos
3103                                 osvers=djgpp
3104                         fi
3105                         ;;
3106                 esac
3107
3108                 case "$1" in
3109                 aix) osname=aix
3110                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3111                         case "$tmp" in
3112                         # oslevel can fail with:
3113                         # oslevel: Unable to acquire lock.
3114                         *not\ found) osvers="$4"."$3" ;;
3115                         '<3240'|'<>3240') osvers=3.2.0 ;;
3116                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3117                         '=3250'|'>3250') osvers=3.2.5 ;;
3118                         *) osvers=$tmp;;
3119                         esac
3120                         ;;
3121                 bsd386) osname=bsd386
3122                         osvers=`$uname -r`
3123                         ;;
3124                 cygwin*) osname=cygwin
3125                         osvers="$3"
3126                         ;;
3127                 *dc.osx) osname=dcosx
3128                         osvers="$3"
3129                         ;;
3130                 dnix) osname=dnix
3131                         osvers="$3"
3132                         ;;
3133                 domainos) osname=apollo
3134                         osvers="$3"
3135                         ;;
3136                 dgux)   osname=dgux
3137                         osvers="$3"
3138                         ;;
3139                 dragonfly) osname=dragonfly
3140                         osvers="$3"
3141                         ;;
3142                 dynixptx*) osname=dynixptx
3143                         osvers=`echo "$4"|sed 's/^v//'`
3144                         ;;
3145                 freebsd) osname=freebsd
3146                         osvers="$3" ;;
3147                 genix)  osname=genix ;;
3148                 gnu)    osname=gnu
3149                         osvers="$3" ;;
3150                 hp*)    osname=hpux
3151                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3152                         ;;
3153                 irix*)  osname=irix
3154                         case "$3" in
3155                         4*) osvers=4 ;;
3156                         5*) osvers=5 ;;
3157                         *)      osvers="$3" ;;
3158                         esac
3159                         ;;
3160                 linux)  osname=linux
3161                         case "$3" in
3162                         *)      osvers="$3" ;;
3163                         esac
3164                         ;;
3165                 MiNT)   osname=mint
3166                         ;;
3167                 netbsd*) osname=netbsd
3168                         osvers="$3"
3169                         ;;
3170                 news-os) osvers="$3"
3171                         case "$3" in
3172                         4*) osname=newsos4 ;;
3173                         *) osname=newsos ;;
3174                         esac
3175                         ;;
3176                 next*) osname=next ;;
3177                 nonstop-ux) osname=nonstopux ;;
3178                 openbsd) osname=openbsd
3179                         osvers="$3"
3180                         ;;
3181                 os2)    osname=os2
3182                         osvers="$4"
3183                         ;;
3184                 POSIX-BC | posix-bc ) osname=posix-bc
3185                         osvers="$3"
3186                         ;;
3187                 powerux | power_ux | powermax_os | powermaxos | \
3188                 powerunix | power_unix) osname=powerux
3189                         osvers="$3"
3190                         ;;
3191                 qnx) osname=qnx
3192                         osvers="$4"
3193                         ;;
3194                 solaris) osname=solaris
3195                         case "$3" in
3196                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3197                         *)      osvers="$3" ;;
3198                         esac
3199                         ;;
3200                 sunos) osname=sunos
3201                         case "$3" in
3202                         5*) osname=solaris
3203                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3204                         *)      osvers="$3" ;;
3205                         esac
3206                         ;;
3207                 titanos) osname=titanos
3208                         case "$3" in
3209                         1*) osvers=1 ;;
3210                         2*) osvers=2 ;;
3211                         3*) osvers=3 ;;
3212                         4*) osvers=4 ;;
3213                         *)      osvers="$3" ;;
3214                         esac
3215                         ;;
3216                 ultrix) osname=ultrix
3217                         osvers="$3"
3218                         ;;
3219                 osf1|mls+)      case "$5" in
3220                                 alpha)
3221                                         osname=dec_osf
3222                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3223                                         case "$osvers" in
3224                                         [1-9].[0-9]*) ;;
3225                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3226                                         esac
3227                                         ;;
3228                         hp*)    osname=hp_osf1  ;;
3229                         mips)   osname=mips_osf1 ;;
3230                         esac
3231                         ;;
3232                 # UnixWare 7.1.2 is known as Open UNIX 8
3233                 openunix|unixware) osname=svr5
3234                         osvers="$4"
3235                         ;;
3236                 uts)    osname=uts
3237                         osvers="$3"
3238                         ;;
3239                 vos) osvers="$3"
3240                         ;;
3241                 $2) case "$osname" in
3242                         *isc*) ;;
3243                         *freebsd*) ;;
3244                         svr*)
3245                                 : svr4.x or possibly later
3246                                 case "svr$3" in
3247                                 ${osname}*)
3248                                         osname=svr$3
3249                                         osvers=$4
3250                                         ;;
3251                                 esac
3252                                 case "$osname" in
3253                                 svr4.0)
3254                                         : Check for ESIX
3255                                         if test -f /stand/boot ; then
3256                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3257                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3258                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3259                                                         if test -n "$isesix"; then
3260                                                                 osname=esix4
3261                                                         fi
3262                                                 fi
3263                                         fi
3264                                         ;;
3265                                 esac
3266                                 ;;
3267                         *)      if test -f /etc/systemid; then
3268                                         osname=sco
3269                                         set `echo $3 | $sed 's/\./ /g'` $4
3270                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3271                                                 osvers=$1.$2.$3
3272                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3273                                                 osvers=$1.$2
3274                                         elif $test -f $src/hints/sco_$1.sh; then
3275                                                 osvers=$1
3276                                         fi
3277                                 else
3278                                         case "$osname" in
3279                                         '') : Still unknown.  Probably a generic Sys V.
3280                                                 osname="sysv"
3281                                                 osvers="$3"
3282                                                 ;;
3283                                         esac
3284                                 fi
3285                                 ;;
3286                         esac
3287                         ;;
3288                 *)      case "$osname" in
3289                         '') : Still unknown.  Probably a generic BSD.
3290                                 osname="$1"
3291                                 osvers="$3"
3292                                 ;;
3293                         esac
3294                         ;;
3295                 esac
3296         else
3297                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3298                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3299                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3300                                 osname=news_os
3301                         fi
3302                         $rm -f UU/kernel.what
3303                 elif test -d c:/. -o -n "$is_os2" ; then
3304                         set X $myuname
3305                         osname=os2
3306                         osvers="$5"
3307                 fi
3308         fi
3309
3310         case "$targetarch" in
3311         '') ;;
3312         *)  hostarch=$osname
3313             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3314             osvers=''
3315             ;;
3316         esac
3317
3318         : Now look for a hint file osname_osvers, unless one has been
3319         : specified already.
3320         case "$hintfile" in
3321         ''|' ')
3322                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3323                 : Also try without trailing minor version numbers.
3324                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3325                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3326                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3327                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3328                 case "$file" in
3329                 '') dflt=none ;;
3330                 *)  case "$osvers" in
3331                         '') dflt=$file
3332                                 ;;
3333                         *)  if $test -f $src/hints/$file.sh ; then
3334                                         dflt=$file
3335                                 elif $test -f $src/hints/$xfile.sh ; then
3336                                         dflt=$xfile
3337                                 elif $test -f $src/hints/$xxfile.sh ; then
3338                                         dflt=$xxfile
3339                                 elif $test -f $src/hints/$xxxfile.sh ; then
3340                                         dflt=$xxxfile
3341                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3342                                         dflt=$xxxxfile
3343                                 elif $test -f "$src/hints/${osname}.sh" ; then
3344                                         dflt="${osname}"
3345                                 else
3346                                         dflt=none
3347                                 fi
3348                                 ;;
3349                         esac
3350                         ;;
3351                 esac
3352                 if $test -f Policy.sh ; then
3353                         case "$dflt" in
3354                         *Policy*) ;;
3355                         none) dflt="Policy" ;;
3356                         *) dflt="Policy $dflt" ;;
3357                         esac
3358                 fi
3359                 ;;
3360         *)
3361                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3362                 ;;
3363         esac
3364
3365         if $test -f Policy.sh ; then
3366                 $cat <<EOM
3367
3368 There's also a Policy hint file available, which should make the
3369 site-specific (policy) questions easier to answer.
3370 EOM
3371
3372         fi
3373
3374         $cat <<EOM
3375
3376 You may give one or more space-separated answers, or "none" if appropriate.
3377 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3378 is a good thing.  DO NOT give a wrong version or a wrong OS.
3379
3380 EOM
3381
3382         rp="Which of these apply, if any?"
3383         . UU/myread
3384         tans=$ans
3385         for file in $tans; do
3386                 if $test X$file = XPolicy -a -f Policy.sh; then
3387                         . Policy.sh
3388                         $cat Policy.sh >> UU/config.sh
3389                 elif $test -f $src/hints/$file.sh; then
3390                         . $src/hints/$file.sh
3391                         $cat $src/hints/$file.sh >> UU/config.sh
3392                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3393                         : nothing
3394                 else
3395                         : Give one chance to correct a possible typo.
3396                         echo "$file.sh does not exist"
3397                         dflt=$file
3398                         rp="hint to use instead?"
3399                         . UU/myread
3400                         for file in $ans; do
3401                                 if $test -f "$src/hints/$file.sh"; then
3402                                         . $src/hints/$file.sh
3403                                         $cat $src/hints/$file.sh >> UU/config.sh
3404                                 elif $test X$ans = X -o X$ans = Xnone ; then
3405                                         : nothing
3406                                 else
3407                                         echo "$file.sh does not exist -- ignored."
3408                                 fi
3409                         done
3410                 fi
3411         done
3412
3413         hint=recommended
3414         : Remember our hint file for later.
3415         if $test -f "$src/hints/$file.sh" ; then
3416                 hintfile="$file"
3417         else
3418                 hintfile=''
3419         fi
3420 fi
3421 cd UU
3422 ;;
3423 *)
3424         echo " "
3425         echo "Fetching default answers from $config_sh..." >&4
3426         tmp_n="$n"
3427         tmp_c="$c"
3428         cd ..
3429         cp $config_sh config.sh 2>/dev/null
3430         chmod +w config.sh
3431         . ./config.sh
3432         cd UU
3433         cp ../config.sh .
3434         n="$tmp_n"
3435         c="$tmp_c"
3436         hint=previous
3437         ;;
3438 esac
3439 test "$override" && . ./optdef.sh
3440
3441 : Restore computed paths
3442 for file in $loclist $trylist; do
3443         eval $file="\$_$file"
3444 done
3445
3446 cat << EOM
3447
3448 Configure uses the operating system name and version to set some defaults.
3449 The default value is probably right if the name rings a bell. Otherwise,
3450 since spelling matters for me, either accept the default or answer "none"
3451 to leave it blank.
3452
3453 EOM
3454 case "$osname" in
3455         ''|' ')
3456                 case "$hintfile" in
3457                 ''|' '|none) dflt=none ;;
3458                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3459                 esac
3460                 ;;
3461         *) dflt="$osname" ;;
3462 esac
3463 rp="Operating system name?"
3464 . ./myread
3465 case "$ans" in
3466 none)  osname='' ;;
3467 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3468 esac
3469 echo " "
3470 case "$osvers" in
3471         ''|' ')
3472                 case "$hintfile" in
3473                 ''|' '|none) dflt=none ;;
3474                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3475                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3476                         case "$dflt" in
3477                         ''|' ') dflt=none ;;
3478                         esac
3479                         ;;
3480                 esac
3481                 ;;
3482         *) dflt="$osvers" ;;
3483 esac
3484 rp="Operating system version?"
3485 . ./myread
3486 case "$ans" in
3487 none)  osvers='' ;;
3488 *) osvers="$ans" ;;
3489 esac
3490
3491
3492 . ./posthint.sh
3493
3494 : who configured the system
3495 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3496 case "$cf_by" in
3497 "")
3498         cf_by=`(logname) 2>/dev/null`
3499         case "$cf_by" in
3500         "")
3501                 cf_by=`(whoami) 2>/dev/null`
3502                 case "$cf_by" in
3503                 "") cf_by=unknown ;;
3504                 esac ;;
3505         esac ;;
3506 esac
3507
3508 : set up the script used to warn in case of inconsistency
3509 cat <<EOS >whoa
3510 $startsh
3511 EOS
3512 cat <<'EOSC' >>whoa
3513 dflt=y
3514 echo " "
3515 echo "*** WHOA THERE!!! ***" >&4
3516 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3517 rp="    Keep the $hint value?"
3518 . ./myread
3519 case "$ans" in
3520 y) td=$was; tu=$was;;
3521 esac
3522 EOSC
3523
3524 : function used to set $1 to $val
3525 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3526 case "$val$was" in
3527 $define$undef) . ./whoa; eval "$var=\$td";;
3528 $undef$define) . ./whoa; eval "$var=\$tu";;
3529 *) eval "$var=$val";;
3530 esac'
3531
3532 case "$usesocks" in
3533 $define|true|[yY]*)     dflt='y';;
3534 *) dflt='n';;
3535 esac
3536 cat <<EOM
3537
3538 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3539 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3540 to use the PerlIO abstraction layer, this will be implicitly selected.
3541
3542 If this doesn't make any sense to you, just accept the default '$dflt'.
3543 EOM
3544 rp='Build Perl for SOCKS?'
3545 . ./myread
3546 case "$ans" in
3547 y|Y)    val="$define" ;;     
3548 *)      val="$undef" ;;
3549 esac
3550 set usesocks
3551 eval $setvar
3552
3553 case "$usesocks" in
3554 $define|true|[yY]*) useperlio="$define";;
3555 esac
3556
3557 case "$useperlio" in
3558 $define|true|[yY]*|'')  dflt='y';;
3559 *) dflt='n';;
3560 esac
3561 cat <<EOM
3562
3563 Previous version of $package used the standard IO mechanisms as
3564 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
3565 alternate IO mechanisms via the PerlIO abstraction layer, but the
3566 stdio mechanism is still available if needed.  The abstraction layer
3567 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3568 Using PerlIO with sfio may cause problems with some extension modules.
3569
3570 If this doesn't make any sense to you, just accept the default '$dflt'.
3571 EOM
3572 rp='Use the PerlIO abstraction layer?'
3573 . ./myread
3574 case "$ans" in
3575 y|Y) 
3576         val="$define"
3577         ;;
3578 *)      
3579         echo "Ok, doing things the stdio way."
3580         val="$undef"
3581         ;;
3582 esac
3583 set useperlio
3584 eval $setvar 
3585
3586 case "$usesocks" in
3587 $define|true|[yY]*)
3588         case "$useperlio" in
3589         $define|true|[yY]*) ;;
3590         *)      cat >&4 <<EOM
3591
3592 You are using the SOCKS proxy protocol library which means that you
3593 should also use the PerlIO layer.  You may be headed for trouble.
3594
3595 EOM
3596                 ;;
3597         esac
3598         ;;
3599 esac
3600
3601         
3602 case "$usethreads" in
3603 $define|true|[yY]*)     dflt='y';;
3604 *)     # Catch case where user specified ithreads or 5005threads but
3605        # forgot -Dusethreads (A.D. 4/2002)
3606        case "$useithreads$use5005threads" in
3607        *$define*)      
3608                 case "$useperlio" in
3609                 "$define")      dflt='y' ;;
3610                 *)              dflt='n' ;;
3611                 esac
3612                 ;;
3613        *)       dflt='n';;
3614        esac
3615        ;;
3616 esac
3617 cat <<EOM
3618
3619 Perl can be built to take advantage of threads on some systems.
3620 To do so, Configure can be run with -Dusethreads.
3621
3622 Note that Perl built with threading support runs slightly slower
3623 and uses more memory than plain Perl. The current implementation
3624 is believed to be stable, but it is fairly new, and so should be
3625 treated with caution.
3626
3627 If this doesn't make any sense to you, just accept the default '$dflt'.
3628 EOM
3629 rp='Build a threading Perl?'
3630 . ./myread
3631 case "$ans" in
3632 y|Y)    val="$define" ;;
3633 *)      val="$undef" ;;
3634 esac
3635 set usethreads
3636 eval $setvar
3637
3638 case "$usethreads" in
3639 $define)
3640         $cat <<EOM
3641
3642 Since release 5.6, Perl has had two different threading implementations,
3643 the newer interpreter-based version (ithreads) with one interpreter per
3644 thread, and the older 5.005 version (5005threads).
3645 The 5005threads version is effectively unmaintained and will probably be
3646 removed in Perl 5.10, so there should be no need to build a Perl using it
3647 unless needed for backwards compatibility with some existing 5.005threads
3648 code.
3649
3650 EOM
3651         : Default to ithreads unless overridden on command line or with
3652         : old config.sh
3653         dflt='y'
3654         case "$use5005threads" in
3655                 $define|true|[yY]*) dflt='n';;
3656         esac
3657         case "$useithreads" in
3658                 $undef|false|[nN]*) dflt='n';;
3659         esac
3660         rp='Use the newer interpreter-based ithreads?'
3661         . ./myread
3662         case "$ans" in
3663         y|Y)    val="$define" ;;
3664         *)      val="$undef" ;;
3665         esac
3666         set useithreads
3667         eval $setvar
3668         : Now set use5005threads to the opposite value.
3669         case "$useithreads" in
3670         $define) val="$undef" ;;
3671         *) val="$define" ;;
3672         esac
3673         set use5005threads
3674         eval $setvar
3675         ;;
3676 *)
3677         useithreads="$undef"
3678         use5005threads="$undef"
3679         ;;
3680 esac
3681
3682 case "$useithreads$use5005threads" in
3683 "$define$define")
3684         $cat >&4 <<EOM
3685
3686 You cannot have both the ithreads and the 5.005 threads enabled
3687 at the same time.  Disabling the 5.005 threads since they are
3688 much less stable than the ithreads.
3689
3690 EOM
3691         use5005threads="$undef"
3692         ;;
3693 esac
3694
3695 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
3696         cat >&4 <<EOF
3697 ***
3698 *** To build with ithreads you must also use the PerlIO layer.
3699 *** Cannot continue, aborting.
3700 ***
3701 EOF
3702         exit 1
3703 fi
3704
3705 case "$d_oldpthreads" in
3706 '')     : Configure tests would be welcome here.  For now, assume undef.
3707         val="$undef" ;;
3708 *)      val="$d_oldpthreads" ;;
3709 esac
3710 set d_oldpthreads
3711 eval $setvar
3712
3713
3714 : Look for a hint-file generated 'call-back-unit'.  If the
3715 : user has specified that a threading perl is to be built,
3716 : we may need to set or change some other defaults.
3717 if $test -f usethreads.cbu; then
3718     echo "Your platform has some specific hints regarding threaded builds, using them..."
3719     . ./usethreads.cbu
3720 else
3721     case "$usethreads" in
3722         "$define"|true|[yY]*)
3723                 $cat <<EOM
3724 (Your platform does not have any specific hints for threaded builds.
3725  Assuming POSIX threads, then.)
3726 EOM
3727         ;;
3728     esac
3729 fi
3730
3731 cat <<EOM
3732
3733 Perl can be built so that multiple Perl interpreters can coexist
3734 within the same Perl executable.
3735 EOM
3736
3737 case "$useithreads" in
3738 $define)
3739         cat <<EOM
3740 This multiple interpreter support is required for interpreter-based threads.
3741 EOM
3742         val="$define"
3743         ;;
3744 *)      case "$usemultiplicity" in
3745         $define|true|[yY]*)     dflt='y';;
3746         *) dflt='n';;
3747         esac
3748         echo " "
3749         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3750         rp='Build Perl for multiplicity?'
3751         . ./myread
3752         case "$ans" in
3753         y|Y)    val="$define" ;;
3754         *)      val="$undef" ;;
3755         esac
3756         ;;
3757 esac
3758 set usemultiplicity
3759 eval $setvar
3760
3761
3762 case "$usemorebits" in
3763 "$define"|true|[yY]*)
3764         use64bitint="$define"
3765         uselongdouble="$define"
3766         usemorebits="$define"
3767         ;;
3768 *)      usemorebits="$undef"
3769         ;;
3770 esac
3771
3772 : make some quick guesses about what we are up against
3773 echo " "
3774 $echo $n "Hmm...  $c"
3775 echo exit 1 >bsd
3776 echo exit 1 >usg
3777 echo exit 1 >v7
3778 echo exit 1 >osf1
3779 echo exit 1 >eunice
3780 echo exit 1 >xenix
3781 echo exit 1 >venix
3782 echo exit 1 >os2
3783 d_bsd="$undef"
3784 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3785 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3786 then
3787         echo "Looks kind of like an OSF/1 system, but we'll see..."
3788         echo exit 0 >osf1
3789 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3790         xxx=`./loc addbib blurfl $pth`
3791         if $test -f $xxx; then
3792         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3793                 echo exit 0 >bsd
3794                 echo exit 0 >usg
3795         else
3796                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3797                         echo "Looks kind of like an extended USG system, but we'll see..."
3798                 else
3799                         echo "Looks kind of like a USG system, but we'll see..."
3800                 fi
3801                 echo exit 0 >usg
3802         fi
3803 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3804         echo "Looks kind of like a BSD system, but we'll see..."
3805         d_bsd="$define"
3806         echo exit 0 >bsd
3807 else
3808         echo "Looks kind of like a Version 7 system, but we'll see..."
3809         echo exit 0 >v7
3810 fi
3811 case "$eunicefix" in
3812 *unixtovms*)
3813         $cat <<'EOI'
3814 There is, however, a strange, musty smell in the air that reminds me of
3815 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3816 EOI
3817         echo exit 0 >eunice
3818         d_eunice="$define"
3819 : it so happens the Eunice I know will not run shell scripts in Unix format
3820         ;;
3821 *)
3822         echo " "
3823         echo "Congratulations.  You aren't running Eunice."
3824         d_eunice="$undef"
3825         ;;
3826 esac
3827 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3828 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3829 : semicolon as a patch separator
3830 case "$p_" in
3831 :) ;;
3832 *)
3833         $cat <<'EOI'
3834 I have the feeling something is not exactly right, however...don't tell me...
3835 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3836 (Or you may be running DOS with DJGPP.)
3837 EOI
3838         echo exit 0 >os2
3839         ;;
3840 esac
3841 if test -f /xenix; then
3842         echo "Actually, this looks more like a XENIX system..."
3843         echo exit 0 >xenix
3844         d_xenix="$define"
3845 else
3846         echo " "
3847         echo "It's not Xenix..."
3848         d_xenix="$undef"
3849 fi
3850 chmod +x xenix
3851 $eunicefix xenix
3852 if test -f /venix; then
3853         echo "Actually, this looks more like a VENIX system..."
3854         echo exit 0 >venix
3855 else
3856         echo " "
3857         if ./xenix; then
3858                 : null
3859         else
3860                 echo "Nor is it Venix..."
3861         fi
3862 fi
3863 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3864 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3865 $rm -f foo
3866
3867 case "$cc" in
3868 '') dflt=cc;;
3869 *) dflt="$cc";;
3870 esac
3871 rp="Use which C compiler?"
3872 . ./myread
3873 cc="$ans"
3874
3875 : See if they have not cc but they do have gcc
3876 . ./trygcc
3877 : Look for a hint-file generated 'call-back-unit'.  Now that the
3878 : user has specified the compiler, we may need to set or change some
3879 : other defaults.
3880 if $test -f cc.cbu; then
3881     . ./cc.cbu
3882 fi
3883 . ./checkcc
3884
3885 echo " "
3886 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3887 $cat >try.c <<EOM
3888 #include <stdio.h>
3889 int main() {
3890 #ifdef __GNUC__
3891 #ifdef __VERSION__
3892         printf("%s\n", __VERSION__);
3893 #else
3894         printf("%s\n", "1");
3895 #endif
3896 #endif
3897         return(0);
3898 }
3899 EOM
3900 if $cc -o try $ccflags $ldflags try.c; then
3901         gccversion=`$run ./try`
3902         case "$gccversion" in
3903         '') echo "You are not using GNU cc." ;;
3904         *)  echo "You are using GNU cc $gccversion."
3905             ccname=gcc
3906             ;;
3907         esac
3908 else
3909         echo " "
3910         echo "*** WHOA THERE!!! ***" >&4
3911         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3912         case "$knowitall" in
3913         '')
3914         echo "    You'd better start hunting for one and let me know about it." >&4
3915                 exit 1
3916                 ;;
3917         esac
3918 fi
3919 $rm -f try try.*
3920 case "$gccversion" in
3921 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3922 esac
3923 case "$gccversion" in
3924 '') gccosandvers='' ;;
3925 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3926    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3927    gccshortvers=''
3928    case "$gccosandvers" in
3929    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3930    $osname$osvers) ;; # looking good
3931    $osname*) cat <<EOM >&4
3932
3933 *** WHOA THERE!!! ***
3934
3935     Your gcc has not been compiled for the exact release of
3936     your operating system ($gccosandvers versus $osname$osvers).
3937
3938     In general it is a good idea to keep gcc synchronized with
3939     the operating system because otherwise serious problems
3940     may ensue when trying to compile software, like Perl.
3941
3942     I'm trying to be optimistic here, though, and will continue.
3943     If later during the configuration and build icky compilation
3944     problems appear (headerfile conflicts being the most common
3945     manifestation), I suggest reinstalling the gcc to match
3946     your operating system release.
3947
3948 EOM
3949       ;;
3950    *) gccosandvers='' ;; # failed to parse, better be silent
3951    esac
3952    ;;
3953 esac
3954 case "$ccname" in
3955 '') ccname="$cc" ;;
3956 esac
3957
3958 # gcc 3.* complain about adding -Idirectories that they already know about,
3959 # so we will take those off from locincpth.
3960 case "$gccversion" in
3961 3*)
3962     echo "main(){}">try.c
3963     for incdir in $locincpth; do
3964        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
3965              grep '^c[cp]p*[01]: warning: changing search order '`
3966        if test "X$warn" != X; then
3967            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
3968        fi
3969     done
3970     $rm -f try try.*
3971 esac
3972
3973 : decide how portable to be.  Allow command line overrides.
3974 case "$d_portable" in
3975 "$undef") ;;
3976 *)      d_portable="$define" ;;
3977 esac
3978
3979 : set up shell script to do ~ expansion
3980 cat >filexp <<EOSS
3981 $startsh
3982 : expand filename
3983 case "\$1" in
3984  ~/*|~)
3985         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3986         ;;
3987  ~*)
3988         if $test -f /bin/csh; then
3989                 /bin/csh -f -c "glob \$1"
3990                 failed=\$?
3991                 echo ""
3992                 exit \$failed
3993         else
3994                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3995                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3996                 if $test ! -d "\$dir"; then
3997                         me=\`basename \$0\`
3998                         echo "\$me: can't locate home directory for: \$name" >&2
3999                         exit 1
4000                 fi
4001                 case "\$1" in
4002                 */*)
4003                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
4004                         ;;
4005                 *)
4006                         echo \$dir
4007                         ;;
4008                 esac
4009         fi
4010         ;;
4011 *)
4012         echo \$1
4013         ;;
4014 esac
4015 EOSS
4016 chmod +x filexp
4017 $eunicefix filexp
4018
4019 : now set up to get a file name
4020 cat <<EOS >getfile
4021 $startsh
4022 EOS
4023 cat <<'EOSC' >>getfile
4024 tilde=''
4025 fullpath=''
4026 already=''
4027 skip=''
4028 none_ok=''
4029 exp_file=''
4030 nopath_ok=''
4031 orig_rp="$rp"
4032 orig_dflt="$dflt"
4033 case "$gfpth" in
4034 '') gfpth='.' ;;
4035 esac
4036
4037 case "$fn" in
4038 *\(*)
4039         : getfile will accept an answer from the comma-separated list
4040         : enclosed in parentheses even if it does not meet other criteria.
4041         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
4042         fn=`echo $fn | sed 's/(.*)//'`
4043         ;;
4044 esac
4045
4046 case "$fn" in
4047 *:*)
4048         loc_file=`expr $fn : '.*:\(.*\)'`
4049         fn=`expr $fn : '\(.*\):.*'`
4050         ;;
4051 esac
4052
4053 case "$fn" in
4054 *~*) tilde=true;;
4055 esac
4056 case "$fn" in
4057 */*) fullpath=true;;
4058 esac
4059 case "$fn" in
4060 *+*) skip=true;;
4061 esac
4062 case "$fn" in
4063 *n*) none_ok=true;;
4064 esac
4065 case "$fn" in
4066 *e*) exp_file=true;;
4067 esac
4068 case "$fn" in
4069 *p*) nopath_ok=true;;
4070 esac
4071
4072 case "$fn" in
4073 *f*) type='File';;
4074 *d*) type='Directory';;
4075 *l*) type='Locate';;
4076 esac
4077
4078 what="$type"
4079 case "$what" in
4080 Locate) what='File';;
4081 esac
4082
4083 case "$exp_file" in
4084 '')
4085         case "$d_portable" in
4086         "$define") ;;
4087         *) exp_file=true;;
4088         esac
4089         ;;
4090 esac
4091
4092 cd ..
4093 while test "$type"; do
4094         redo=''
4095         rp="$orig_rp"
4096         dflt="$orig_dflt"
4097         case "$tilde" in
4098         true) rp="$rp (~name ok)";;
4099         esac
4100         . UU/myread
4101         if test -f UU/getfile.ok && \
4102                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4103         then
4104                 value="$ans"
4105                 ansexp="$ans"
4106                 break
4107         fi
4108         case "$ans" in
4109         none)
4110                 value=''
4111                 ansexp=''
4112                 case "$none_ok" in
4113                 true) type='';;
4114                 esac
4115                 ;;
4116         *)
4117                 case "$tilde" in
4118                 '') value="$ans"
4119                         ansexp="$ans";;
4120                 *)
4121                         value=`UU/filexp $ans`
4122                         case $? in
4123                         0)
4124                                 if test "$ans" != "$value"; then
4125                                         echo "(That expands to $value on this system.)"
4126                                 fi
4127                                 ;;
4128                         *) value="$ans";;
4129                         esac
4130                         ansexp="$value"
4131                         case "$exp_file" in
4132                         '') value="$ans";;
4133                         esac
4134                         ;;
4135                 esac
4136                 case "$fullpath" in
4137                 true)
4138                         case "$ansexp" in
4139                         /*) value="$ansexp" ;;
4140                         [a-zA-Z]:/*) value="$ansexp" ;;
4141                         *)
4142                                 redo=true
4143                                 case "$already" in
4144                                 true)
4145                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4146                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4147                                         ;;
4148                                 *)
4149                                 echo "Please give a full path name, starting with slash." >&4
4150                                         case "$tilde" in
4151                                         true)
4152                                 echo "Note that using ~name is ok provided it expands well." >&4
4153                                                 already=true
4154                                                 ;;
4155                                         esac
4156                                 esac
4157                                 ;;
4158                         esac
4159                         ;;
4160                 esac
4161                 case "$redo" in
4162                 '')
4163                         case "$type" in
4164                         File)
4165                                 for fp in $gfpth; do
4166                                         if test "X$fp" = X.; then
4167                                             pf="$ansexp"
4168                                         else    
4169                                             pf="$fp/$ansexp"
4170                                         fi
4171                                         if test -f "$pf"; then
4172                                                 type=''
4173                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4174                                         then
4175                                                 echo "($value is not a plain file, but that's ok.)"
4176                                                 type=''
4177                                         fi
4178                                         if test X"$type" = X; then
4179                                             value="$pf"
4180                                             break
4181                                         fi
4182                                 done
4183                                 ;;
4184                         Directory)
4185                                 for fp in $gfpth; do
4186                                         if test "X$fp" = X.; then
4187                                             dir="$ans"
4188                                             direxp="$ansexp"
4189                                         else    
4190                                             dir="$fp/$ansexp"
4191                                             direxp="$fp/$ansexp"
4192                                         fi
4193                                         if test -d "$direxp"; then
4194                                                 type=''
4195                                                 value="$dir"
4196                                                 break
4197                                         fi
4198                                 done
4199                                 ;;
4200                         Locate)
4201                                 if test -d "$ansexp"; then
4202                                         echo "(Looking for $loc_file in directory $value.)"
4203                                         value="$value/$loc_file"
4204                                         ansexp="$ansexp/$loc_file"
4205                                 fi
4206                                 if test -f "$ansexp"; then
4207                                         type=''
4208                                 fi
4209                                 case "$nopath_ok" in
4210                                 true)   case "$value" in
4211                                         */*) ;;
4212                                         *)      echo "Assuming $value will be in people's path."
4213                                                 type=''
4214                                                 ;;
4215                                         esac
4216                                         ;;
4217                                 esac
4218                                 ;;
4219                         esac
4220
4221                         case "$skip" in
4222                         true) type='';
4223                         esac
4224
4225                         case "$type" in
4226                         '') ;;
4227                         *)
4228                                 if test "$fastread" = yes; then
4229                                         dflt=y
4230                                 else
4231                                         dflt=n
4232                                 fi
4233                                 rp="$what $value doesn't exist.  Use that name anyway?"
4234                                 . UU/myread
4235                                 dflt=''
4236                                 case "$ans" in
4237                                 y*) type='';;
4238                                 *) echo " ";;
4239                                 esac
4240                                 ;;
4241                         esac
4242                         ;;
4243                 esac
4244                 ;;
4245         esac
4246 done
4247 cd UU
4248 ans="$value"
4249 rp="$orig_rp"
4250 dflt="$orig_dflt"
4251 rm -f getfile.ok
4252 test "X$gfpthkeep" != Xy && gfpth=""
4253 EOSC
4254
4255 : What should the include directory be ?
4256 echo " "
4257 $echo $n "Hmm...  $c"
4258 dflt='/usr/include'
4259 incpath=''
4260 mips_type=''
4261 if $test -f /bin/mips && /bin/mips; then
4262         echo "Looks like a MIPS system..."
4263         $cat >usr.c <<'EOCP'
4264 #ifdef SYSTYPE_BSD43
4265 /bsd43
4266 #endif
4267 EOCP
4268         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4269                 dflt='/bsd43/usr/include'
4270                 incpath='/bsd43'
4271                 mips_type='BSD 4.3'
4272         else
4273                 mips_type='System V'
4274         fi
4275         $rm -f usr.c usr.out
4276         echo "and you're compiling with the $mips_type compiler and libraries."
4277         xxx_prompt=y
4278         echo "exit 0" >mips
4279 else
4280         echo "Doesn't look like a MIPS system."
4281         xxx_prompt=n
4282         echo "exit 1" >mips
4283 fi
4284 chmod +x mips
4285 $eunicefix mips
4286 case "$usrinc" in
4287 '') ;;
4288 *) dflt="$usrinc";;
4289 esac
4290 case "$xxx_prompt" in
4291 y)      fn=d/
4292         echo " "
4293         rp='Where are the include files you want to use?'
4294         . ./getfile
4295         usrinc="$ans"
4296         ;;
4297 *)      usrinc="$dflt"
4298         ;;
4299 esac
4300
4301 : see how we invoke the C preprocessor
4302 echo " "
4303 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4304 cat <<'EOT' >testcpp.c
4305 #define ABC abc
4306 #define XYZ xyz
4307 ABC.XYZ
4308 EOT
4309 cd ..
4310 if test ! -f cppstdin; then
4311         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4312                 # AIX cc -E doesn't show the absolute headerfile
4313                 # locations but we'll cheat by using the -M flag.
4314                 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
4315         else
4316                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4317         fi
4318 else
4319         echo "Keeping your $hint cppstdin wrapper."
4320 fi
4321 chmod 755 cppstdin
4322 wrapper=`pwd`/cppstdin
4323 ok='false'
4324 cd UU
4325
4326 if $test "X$cppstdin" != "X" && \
4327         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4328         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4329 then
4330         echo "You used to use $cppstdin $cppminus so we'll use that again."
4331         case "$cpprun" in
4332         '') echo "But let's see if we can live without a wrapper..." ;;
4333         *)
4334                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4335                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4336                 then
4337                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4338                         ok='true'
4339                 else
4340                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4341                 fi
4342                 ;;
4343         esac
4344 else
4345         case "$cppstdin" in
4346         '') ;;
4347         *)
4348                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4349                 ;;
4350         esac
4351 fi
4352
4353 if $ok; then
4354         : nothing
4355 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4356         $cc -E <testcpp.c >testcpp.out 2>&1; \
4357         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4358         echo "Yup, it does."
4359         x_cpp="$cc -E"
4360         x_minus='';
4361 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4362         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4363         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4364         echo "Yup, it does."
4365         x_cpp="$cc -E"
4366         x_minus='-';
4367 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4368         $cc -P <testcpp.c >testcpp.out 2>&1; \
4369         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4370         echo "Yipee, that works!"
4371         x_cpp="$cc -P"
4372         x_minus='';
4373 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4374         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4375         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4376         echo "At long last!"
4377         x_cpp="$cc -P"
4378         x_minus='-';
4379 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4380         $cpp <testcpp.c >testcpp.out 2>&1; \
4381         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4382         echo "It works!"
4383         x_cpp="$cpp"
4384         x_minus='';
4385 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4386         $cpp - <testcpp.c >testcpp.out 2>&1; \
4387         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4388         echo "Hooray, it works!  I was beginning to wonder."
4389         x_cpp="$cpp"
4390         x_minus='-';
4391 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4392         $wrapper <testcpp.c >testcpp.out 2>&1; \
4393         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4394         x_cpp="$wrapper"
4395         x_minus=''
4396         echo "Eureka!"
4397 else
4398         dflt=''
4399         rp="No dice.  I can't find a C preprocessor.  Name one:"
4400         . ./myread
4401         x_cpp="$ans"
4402         x_minus=''
4403         $x_cpp <testcpp.c >testcpp.out 2>&1
4404         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4405                 echo "OK, that will do." >&4
4406         else
4407 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4408                 exit 1
4409         fi
4410 fi
4411
4412 case "$ok" in
4413 false)
4414         cppstdin="$x_cpp"
4415         cppminus="$x_minus"
4416         cpprun="$x_cpp"
4417         cpplast="$x_minus"
4418         set X $x_cpp
4419         shift
4420         case "$1" in
4421         "$cpp")
4422                 echo "Perhaps can we force $cc -E using a wrapper..."
4423                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4424                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4425                 then
4426                         echo "Yup, we can."
4427                         cppstdin="$wrapper"
4428                         cppminus='';
4429                 else
4430                         echo "Nope, we'll have to live without it..."
4431                 fi
4432                 ;;
4433         esac
4434         case "$cpprun" in
4435         "$wrapper")
4436                 cpprun=''
4437                 cpplast=''
4438                 ;;
4439         esac
4440         ;;
4441 esac
4442
4443 case "$cppstdin" in
4444 "$wrapper"|'cppstdin') ;;
4445 *) $rm -f $wrapper;;
4446 esac
4447 $rm -f testcpp.c testcpp.out
4448
4449 : Set private lib path
4450 case "$plibpth" in
4451 '') if ./mips; then
4452                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4453         fi;;
4454 esac
4455 case "$libpth" in
4456 ' ') dlist='';;
4457 '') dlist="$loclibpth $plibpth $glibpth";;
4458 *) dlist="$libpth";;
4459 esac
4460
4461 : Now check and see which directories actually exist, avoiding duplicates
4462 libpth=''
4463 for xxx in $dlist
4464 do
4465     if $test -d $xxx; then
4466                 case " $libpth " in
4467                 *" $xxx "*) ;;
4468                 *) libpth="$libpth $xxx";;
4469                 esac
4470     fi
4471 done
4472 $cat <<'EOM'
4473
4474 Some systems have incompatible or broken versions of libraries.  Among
4475 the directories listed in the question below, please remove any you
4476 know not to be holding relevant libraries, and add any that are needed.
4477 Say "none" for none.
4478
4479 EOM
4480 case "$libpth" in
4481 '') dflt='none';;
4482 *)
4483         set X $libpth
4484         shift
4485         dflt=${1+"$@"}
4486         ;;
4487 esac
4488 rp="Directories to use for library searches?"
4489 . ./myread
4490 case "$ans" in
4491 none) libpth=' ';;
4492 *) libpth="$ans";;
4493 esac
4494
4495 : compute shared library extension
4496 case "$so" in
4497 '')
4498         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4499                 dflt='sl'
4500         else
4501                 dflt='so'
4502         fi
4503         ;;
4504 *) dflt="$so";;
4505 esac
4506 $cat <<EOM
4507
4508 On some systems, shared libraries may be available.  Answer 'none' if
4509 you want to suppress searching of shared libraries for the remainder
4510 of this configuration.
4511
4512 EOM
4513 rp='What is the file extension used for shared libraries?'
4514 . ./myread
4515 so="$ans"
4516
4517 : Define several unixisms.
4518 : Hints files or command line option can be used to override them.
4519 : The convoluted testing is in case hints files set either the old
4520 : or the new name.
4521 case "$_exe" in
4522 '')     case "$exe_ext" in
4523         '')     ;;
4524         *)      _exe="$exe_ext" ;;
4525         esac
4526         ;;
4527 esac
4528 case "$_a" in
4529 '')     case "$lib_ext" in
4530     '') _a='.a';;
4531         *)      _a="$lib_ext" ;;
4532         esac
4533         ;;
4534 esac
4535 case "$_o" in
4536 '') case "$obj_ext" in
4537         '')     _o='.o';;
4538         *)      _o="$obj_ext";;
4539         esac
4540         ;;
4541 esac
4542 case "$p_" in
4543 '') case "$path_sep" in
4544         '')     p_=':';;
4545         *)      p_="$path_sep";;
4546         esac
4547         ;;
4548 esac
4549 exe_ext=$_exe
4550 lib_ext=$_a
4551 obj_ext=$_o
4552 path_sep=$p_
4553
4554 : Which makefile gets called first.  This is used by make depend.
4555 case "$firstmakefile" in
4556 '') firstmakefile='makefile';;
4557 esac
4558
4559 case "$ccflags" in
4560 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4561 esac
4562
4563 case "$uselongdouble" in
4564 $define|true|[yY]*)     dflt='y';;
4565 *) dflt='n';;
4566 esac
4567 cat <<EOM
4568
4569 Perl can be built to take advantage of long doubles which
4570 (if available) may give more accuracy and range for floating point numbers.
4571
4572 If this doesn't make any sense to you, just accept the default '$dflt'.
4573 EOM
4574 rp='Try to use long doubles if available?'
4575 . ./myread
4576 case "$ans" in
4577 y|Y)    val="$define"   ;;
4578 *)      val="$undef"    ;;
4579 esac
4580 set uselongdouble
4581 eval $setvar
4582
4583 case "$uselongdouble" in
4584 true|[yY]*) uselongdouble="$define" ;;
4585 esac
4586
4587 : Look for a hint-file generated 'call-back-unit'.  If the
4588 : user has specified that long doubles should be used,
4589 : we may need to set or change some other defaults.
4590 if $test -f uselongdouble.cbu; then
4591     echo "Your platform has some specific hints regarding long doubles, using them..."
4592     . ./uselongdouble.cbu
4593 else
4594     case "$uselongdouble" in
4595         $define)
4596                 $cat <<EOM
4597 (Your platform does not have any specific hints for long doubles.)
4598 EOM
4599         ;;
4600     esac
4601 fi
4602
4603 : Looking for optional libraries
4604 echo " "
4605 echo "Checking for optional libraries..." >&4
4606 case "$libs" in
4607 ' '|'') dflt='';;
4608 *) dflt="$libs";;
4609 esac
4610 case "$libswanted" in
4611 '') libswanted='c_s';;
4612 esac
4613 case "$usesocks" in
4614 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4615 esac
4616 libsfound=''
4617 libsfiles=''
4618 libsdirs=''
4619 libspath=''
4620 for thisdir in $libpth $xlibpth; do
4621   test -d $thisdir && libspath="$libspath $thisdir"
4622 done
4623 for thislib in $libswanted; do
4624         for thisdir in $libspath; do
4625             xxx=''
4626             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4627                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4628                 $test -f "$xxx" && eval $libscheck
4629                 $test -f "$xxx" && libstyle=shared
4630             fi
4631             if test ! -f "$xxx"; then
4632                 xxx=$thisdir/lib$thislib.$so
4633                 $test -f "$xxx" && eval $libscheck
4634                 $test -f "$xxx" && libstyle=shared
4635             fi  
4636             if test ! -f "$xxx"; then
4637                 xxx=$thisdir/lib$thislib$_a
4638                 $test -f "$xxx" && eval $libscheck
4639                 $test -f "$xxx" && libstyle=static
4640             fi
4641             if test ! -f "$xxx"; then
4642                 xxx=$thisdir/$thislib$_a
4643                 $test -f "$xxx" && eval $libscheck
4644                 $test -f "$xxx" && libstyle=static
4645             fi
4646             if test ! -f "$xxx"; then
4647                 xxx=$thisdir/lib${thislib}_s$_a
4648                 $test -f "$xxx" && eval $libscheck
4649                 $test -f "$xxx" && libstyle=static
4650                 $test -f "$xxx" && thislib=${thislib}_s
4651             fi
4652             if test ! -f "$xxx"; then
4653                 xxx=$thisdir/Slib$thislib$_a
4654                 $test -f "$xxx" && eval $libscheck
4655                 $test -f "$xxx" && libstyle=static
4656             fi
4657             if $test -f "$xxx"; then
4658                 case "$libstyle" in
4659                 shared) echo "Found -l$thislib (shared)." ;;
4660                 static) echo "Found -l$thislib." ;;
4661                 *)      echo "Found -l$thislib ($libstyle)." ;;
4662                 esac
4663                 case " $dflt " in
4664                 *"-l$thislib "*);;
4665                 *) dflt="$dflt -l$thislib"
4666                    libsfound="$libsfound $xxx"
4667                    yyy=`basename $xxx`
4668                    libsfiles="$libsfiles $yyy"
4669                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4670                    case " $libsdirs " in
4671                    *" $yyy "*) ;;
4672                    *) libsdirs="$libsdirs $yyy" ;;
4673                    esac
4674                    ;;
4675                 esac
4676                 break
4677             fi  
4678         done
4679         if $test ! -f "$xxx"; then
4680             echo "No -l$thislib."
4681         fi
4682 done
4683 set X $dflt
4684 shift
4685 dflt="$*"
4686 case "$libs" in
4687 '') dflt="$dflt";;
4688 *) dflt="$libs";;
4689 esac
4690 case "$dflt" in
4691 ' '|'') dflt='none';;
4692 esac
4693
4694 $cat <<EOM
4695
4696 In order to compile $package on your machine, a number of libraries
4697 are usually needed.  Include any other special libraries here as well.
4698 Say "none" for none.  The default list is almost always right.
4699 EOM
4700
4701 echo " "
4702 rp="What libraries to use?"
4703 . ./myread
4704 case "$ans" in
4705 none) libs=' ';;
4706 *) libs="$ans";;
4707 esac
4708
4709 : determine optimization, if desired, or use for debug flag also
4710 case "$optimize" in
4711 ' '|$undef) dflt='none';;
4712 '') dflt='-O';;
4713 *) dflt="$optimize";;
4714 esac
4715 $cat <<EOH
4716
4717 By default, $package compiles with the -O flag to use the optimizer.
4718 Alternately, you might want to use the symbolic debugger, which uses
4719 the -g flag (on traditional Unix systems).  Either flag can be
4720 specified here.  To use neither flag, specify the word "none".
4721
4722 EOH
4723 rp="What optimizer/debugger flag should be used?"
4724 . ./myread
4725 optimize="$ans"
4726 case "$optimize" in
4727 'none') optimize=" ";;
4728 esac
4729
4730 dflt=''
4731 : We will not override a previous value, but we might want to
4732 : augment a hint file
4733 case "$hint" in
4734 default|recommended)
4735         case "$gccversion" in
4736         1*) dflt='-fpcc-struct-return' ;;
4737         esac
4738         case "$optimize" in
4739         *-g*) dflt="$dflt -DDEBUGGING";;
4740         esac
4741         case "$gccversion" in
4742         2*) if test -d /etc/conf/kconfig.d &&
4743                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4744                 then
4745                         # Interactive Systems (ISC) POSIX mode.
4746                         dflt="$dflt -posix"
4747                 fi
4748                 ;;
4749         esac
4750         case "$gccversion" in
4751         1*) ;;
4752         2.[0-8]*) ;;
4753         ?*)     echo " "
4754                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4755                 echo 'int main(void) { return 0; }' > gcctest.c
4756                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4757                         echo "Yes, it does." 2>&1
4758                         case "$ccflags" in
4759                         *strict-aliasing*)
4760                                 echo "Leaving current flags $ccflags alone." 2>&1
4761                                 ;;
4762                         *) dflt="$dflt -fno-strict-aliasing" ;;
4763                         esac
4764                 else
4765                         echo "Nope, it doesn't, but that's ok." 2>&1
4766                 fi
4767                 ;;
4768         esac
4769         # For gcc, adding -pipe speeds up compilations for some, but apparently
4770         # some assemblers can't read from stdin.  (It also slows down compilations
4771         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
4772         case "$gccversion" in
4773         ?*)     echo " "
4774                 echo "Checking if your compiler accepts -pipe" 2>&1
4775                 echo 'int main(void) { return 0; }' > gcctest.c
4776                 if $cc -pipe -o gcctest gcctest.c; then
4777                         echo "Yes, it does." 2>&1
4778                         case "$ccflags" in
4779                         *-pipe*)
4780                                 echo "Leaving current flags $ccflags alone." 2>&1
4781                                 ;;
4782                         *) dflt="$dflt -pipe" ;;
4783                         esac
4784                 else
4785                         echo "Nope, it doesn't, but that's ok." 2>&1
4786                 fi
4787
4788                 echo "Checking if your compiler accepts -Wdeclaration-after-statement" 2>&1
4789                 echo 'int main(void) { return 0; }' > gcctest.c
4790                 if $cc -Wdeclaration-after-statement -o gcctest gcctest.c; then
4791                         echo "Yes, it does." 2>&1
4792                         case "$ccflags" in
4793                         *-Wdeclaration-after-statement*)
4794                                 echo "Leaving current flags $ccflags alone." 2>&1
4795                                 ;;
4796                         *) dflt="$dflt -Wdeclaration-after-statement" ;;
4797                         esac
4798                 else
4799                         echo "Nope, it doesn't, but that's ok." 2>&1
4800                 fi
4801                 ;;
4802         esac
4803         ;;
4804 esac
4805
4806 case "$mips_type" in
4807 *BSD*|'') inclwanted="$locincpth $usrinc";;
4808 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4809 esac
4810 for thisincl in $inclwanted; do
4811         if $test -d $thisincl; then
4812                 if $test x$thisincl != x$usrinc; then
4813                         case "$dflt" in
4814                         *" -I$thisincl "*);;
4815                         *) dflt="$dflt -I$thisincl ";;
4816                         esac
4817                 fi
4818         fi
4819 done
4820
4821 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4822         xxx=true;
4823 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4824         xxx=true;
4825 else
4826         xxx=false;
4827 fi;
4828 if $xxx; then
4829         case "$dflt" in
4830         *$2*);;
4831         *) dflt="$dflt -D$2";;
4832         esac;
4833 fi'
4834
4835 set signal.h LANGUAGE_C; eval $inctest
4836
4837 case "$usesocks" in
4838 $define)
4839         ccflags="$ccflags -DSOCKS"
4840         ;;
4841 esac
4842
4843 case "$hint" in
4844 default|recommended) dflt="$ccflags $dflt" ;;
4845 *) dflt="$ccflags";;
4846 esac
4847
4848 case "$dflt" in
4849 ''|' ') dflt=none;;
4850 esac
4851
4852 $cat <<EOH
4853
4854 Your C compiler may want other flags.  For this question you should include
4855 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4856 but you should NOT include libraries or ld flags like -lwhatever.  If you
4857 want $package to honor its debug switch, you should include -DDEBUGGING here.
4858 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4859
4860 To use no flags, specify the word "none".
4861
4862 EOH
4863 set X $dflt
4864 shift
4865 dflt=${1+"$@"}
4866 rp="Any additional cc flags?"
4867 . ./myread
4868 case "$ans" in
4869 none) ccflags='';;
4870 *) ccflags="$ans";;
4871 esac
4872
4873 : the following weeds options from ccflags that are of no interest to cpp
4874 case "$cppflags" in
4875 '') cppflags="$ccflags" ;;
4876 *)  cppflags="$cppflags $ccflags" ;;
4877 esac
4878 case "$gccversion" in
4879 1*) cppflags="$cppflags -D__GNUC__"
4880 esac
4881 case "$mips_type" in
4882 '');;
4883 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4884 esac
4885 case "$cppflags" in
4886 '');;
4887 *)
4888         echo " "
4889         echo "Let me guess what the preprocessor flags are..." >&4
4890         set X $cppflags
4891         shift
4892         cppflags=''
4893         $cat >cpp.c <<'EOM'
4894 #define BLURFL foo
4895
4896 BLURFL xx LFRULB
4897 EOM
4898         previous=''
4899         for flag in $*
4900         do
4901                 case "$flag" in
4902                 -*) ftry="$flag";;
4903                 *) ftry="$previous $flag";;
4904                 esac
4905                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4906                         >cpp1.out 2>/dev/null && \
4907                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4908                         >cpp2.out 2>/dev/null && \
4909                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4910                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4911                 then
4912                         cppflags="$cppflags $ftry"
4913                         previous=''
4914                 else
4915                         previous="$flag"
4916                 fi
4917         done
4918         set X $cppflags
4919         shift
4920         cppflags=${1+"$@"}
4921         case "$cppflags" in
4922         *-*)  echo "They appear to be: $cppflags";;
4923         esac
4924         $rm -f cpp.c cpp?.out
4925         ;;
4926 esac
4927
4928 : flags used in final linking phase
4929 case "$ldflags" in
4930 '') if ./venix; then
4931                 dflt='-i -z'
4932         else
4933                 dflt=''
4934         fi
4935         case "$ccflags" in
4936         *-posix*) dflt="$dflt -posix" ;;
4937         esac
4938         ;;
4939 *) dflt="$ldflags";;
4940 esac
4941
4942 : Try to guess additional flags to pick up local libraries.
4943 for thislibdir in $libpth; do
4944         case " $loclibpth " in
4945         *" $thislibdir "*)
4946                 case "$dflt " in
4947                 *"-L$thislibdir "*) ;;
4948                 *)  dflt="$dflt -L$thislibdir" ;;
4949                 esac
4950                 ;;
4951         esac
4952 done
4953
4954 case "$dflt" in
4955 '') dflt='none' ;;
4956 esac
4957
4958 $cat <<EOH
4959
4960 Your C linker may need flags.  For this question you should
4961 include -L/whatever and any other flags used by the C linker, but you
4962 should NOT include libraries like -lwhatever.
4963
4964 Make sure you include the appropriate -L/path flags if your C linker
4965 does not normally search all of the directories you specified above,
4966 namely
4967         $libpth
4968 To use no flags, specify the word "none".
4969
4970 EOH
4971
4972 rp="Any additional ld flags (NOT including libraries)?"
4973 . ./myread
4974 case "$ans" in
4975 none) ldflags='';;
4976 *) ldflags="$ans";;
4977 esac
4978 rmlist="$rmlist pdp11"
4979
4980 : coherency check
4981 echo " "
4982 echo "Checking your choice of C compiler and flags for coherency..." >&4
4983 $cat > try.c <<'EOF'
4984 #include <stdio.h>
4985 int main() { printf("Ok\n"); return(0); }
4986 EOF
4987 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4988 shift
4989 $cat >try.msg <<'EOM'
4990 I've tried to compile and run the following simple program:
4991
4992 EOM
4993 $cat try.c >> try.msg
4994
4995 $cat >> try.msg <<EOM
4996
4997 I used the command:
4998
4999         $*
5000         $run ./try
5001
5002 and I got the following output:
5003
5004 EOM
5005 dflt=y
5006 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5007         if $sh -c "$run ./try" >>try.msg 2>&1; then
5008                 xxx=`$run ./try`
5009                 case "$xxx" in
5010                 "Ok") dflt=n ;;
5011                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5012                         case " $libs " in
5013                         *" -lsfio "*)
5014                                 cat >> try.msg <<'EOQS'
5015 If $libs contains -lsfio, and sfio is mis-configured, then it
5016 sometimes (apparently) runs and exits with a 0 status, but with no
5017 output!  It may have to do with sfio's use of _exit vs. exit.
5018
5019 EOQS
5020                                 rp="You have a big problem.  Shall I abort Configure"
5021                                 dflt=y
5022                                 ;;
5023                         esac
5024                         ;;
5025                 esac
5026         else
5027                 echo "The program compiled OK, but exited with status $?." >>try.msg
5028                 rp="You have a problem.  Shall I abort Configure"
5029                 dflt=y
5030         fi
5031 else
5032         echo "I can't compile the test program." >>try.msg
5033         rp="You have a BIG problem.  Shall I abort Configure"
5034         dflt=y
5035 fi
5036 case "$dflt" in
5037 y)
5038         $cat try.msg >&4
5039         case "$knowitall" in
5040         '')
5041                 echo "(The supplied flags or libraries might be incorrect.)"
5042                 ;;
5043         *) dflt=n;;
5044         esac
5045         echo " "
5046         . ./myread
5047         case "$ans" in
5048         n*|N*) ;;
5049         *)      echo "Ok.  Stopping Configure." >&4
5050                 exit 1
5051                 ;;
5052         esac
5053         ;;
5054 n) echo "OK, that should do.";;
5055 esac
5056 $rm -f try try.* core
5057
5058 : define a shorthand compile call
5059 compile='
5060 mc_file=$1;
5061 shift;
5062 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5063 : define a shorthand compile call for compilations that should be ok.
5064 compile_ok='
5065 mc_file=$1;
5066 shift;
5067 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5068
5069 : determine filename position in cpp output
5070 echo " "
5071 echo "Computing filename position in cpp output for #include directives..." >&4
5072 case "$osname" in
5073 vos) testaccess=-e ;;
5074 *)   testaccess=-r ;;
5075 esac
5076 echo '#include <stdio.h>' > foo.c
5077 $cat >fieldn <<EOF
5078 $startsh
5079 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5080 $grep '^[       ]*#.*stdio\.h' | \
5081 while read cline; do
5082         pos=1
5083         set \$cline
5084         while $test \$# -gt 0; do
5085                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5086                         echo "\$pos"
5087                         exit 0
5088                 fi
5089                 shift
5090                 pos=\`expr \$pos + 1\`
5091         done
5092 done
5093 EOF
5094 chmod +x fieldn
5095 fieldn=`./fieldn`
5096 $rm -f foo.c fieldn
5097 case $fieldn in
5098 '') pos='???';;
5099 1) pos=first;;
5100 2) pos=second;;
5101 3) pos=third;;
5102 *) pos="${fieldn}th";;
5103 esac
5104 echo "Your cpp writes the filename in the $pos field of the line."
5105
5106 case "$osname" in
5107 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5108 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5109 *)   cppfilter='' ;;
5110 esac
5111 : locate header file
5112 $cat >findhdr <<EOF
5113 $startsh
5114 wanted=\$1
5115 name=''
5116 for usrincdir in $usrinc
5117 do
5118         if test -f \$usrincdir/\$wanted; then
5119                 echo "\$usrincdir/\$wanted"
5120                 exit 0
5121         fi
5122 done
5123 awkprg='{ print \$$fieldn }'
5124 echo "#include <\$wanted>" > foo\$\$.c
5125 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5126 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5127 while read cline; do
5128         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5129         case "\$name" in
5130         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5131         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5132         *) exit 2;;
5133         esac;
5134 done;
5135 #
5136 # status = 0: grep returned 0 lines, case statement not executed
5137 # status = 1: headerfile found
5138 # status = 2: while loop executed, no headerfile found
5139 #
5140 status=\$?
5141 $rm -f foo\$\$.c;
5142 if test \$status -eq 1; then
5143         exit 0;
5144 fi
5145 exit 1
5146 EOF
5147 chmod +x findhdr
5148
5149 : define an alternate in-header-list? function
5150 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5151 cont=true; xxf="echo \"<\$1> found.\" >&4";
5152 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5153 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5154 esac;
5155 case $# in 4) instead=instead;; *) instead="at last";; esac;
5156 while $test "$cont"; do
5157         xxx=`./findhdr $1`
5158         var=$2; eval "was=\$$2";
5159         if $test "$xxx" && $test -r "$xxx";
5160         then eval $xxf;
5161         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5162                 cont="";
5163         else eval $xxnf;
5164         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5165         set $yyy; shift; shift; yyy=$@;
5166         case $# in 0) cont="";;
5167         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5168                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5169         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5170                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5171         esac;
5172 done;
5173 while $test "$yyy";
5174 do set $yyy; var=$2; eval "was=\$$2";
5175         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5176         set $yyy; shift; shift; yyy=$@;
5177 done'
5178
5179 : see if stdlib is available
5180 set stdlib.h i_stdlib
5181 eval $inhdr
5182
5183 : check for lengths of integral types
5184 echo " "
5185 case "$intsize" in
5186 '')
5187         echo "Checking to see how big your integers are..." >&4
5188         $cat >try.c <<EOCP
5189 #include <stdio.h>
5190 #$i_stdlib I_STDLIB
5191 #ifdef I_STDLIB
5192 #include <stdlib.h>
5193 #endif
5194 int main()
5195 {
5196         printf("intsize=%d;\n", (int)sizeof(int));
5197         printf("longsize=%d;\n", (int)sizeof(long));
5198         printf("shortsize=%d;\n", (int)sizeof(short));
5199         exit(0);
5200 }
5201 EOCP
5202         set try
5203         if eval $compile_ok && $run ./try > /dev/null; then
5204                 eval `$run ./try`
5205                 echo "Your integers are $intsize bytes long."
5206                 echo "Your long integers are $longsize bytes long."
5207                 echo "Your short integers are $shortsize bytes long."
5208         else
5209                 $cat >&4 <<EOM
5210 !
5211 Help! I can't compile and run the intsize test program: please enlighten me!
5212 (This is probably a misconfiguration in your system or libraries, and
5213 you really ought to fix it.  Still, I'll try anyway.)
5214 !
5215 EOM
5216                 dflt=4
5217                 rp="What is the size of an integer (in bytes)?"
5218                 . ./myread
5219                 intsize="$ans"
5220                 dflt=$intsize
5221                 rp="What is the size of a long integer (in bytes)?"
5222                 . ./myread
5223                 longsize="$ans"
5224                 dflt=2
5225                 rp="What is the size of a short integer (in bytes)?"
5226                 . ./myread
5227                 shortsize="$ans"
5228         fi
5229         ;;
5230 esac
5231 $rm -f try try.*
5232
5233 : check for long long
5234 echo " "
5235 echo "Checking to see if you have long long..." >&4
5236 echo 'int main() { long long x = 7; return 0; }' > try.c
5237 set try
5238 if eval $compile; then
5239         val="$define"
5240         echo "You have long long."
5241 else
5242         val="$undef"
5243         echo "You do not have long long."
5244 fi
5245 $rm try.*
5246 set d_longlong
5247 eval $setvar
5248
5249 : check for length of long long
5250 case "${d_longlong}${longlongsize}" in
5251 $define)
5252         echo " "
5253         echo "Checking to see how big your long longs are..." >&4
5254         $cat >try.c <<'EOCP'
5255 #include <stdio.h>
5256 int main()
5257 {
5258     printf("%d\n", (int)sizeof(long long));
5259     return(0);
5260 }
5261 EOCP
5262         set try
5263         if eval $compile_ok; then
5264                 longlongsize=`$run ./try`
5265                 echo "Your long longs are $longlongsize bytes long."
5266         else
5267                 dflt='8'
5268                 echo " "
5269                 echo "(I can't seem to compile the test program.  Guessing...)"
5270                 rp="What is the size of a long long (in bytes)?"
5271                 . ./myread
5272                 longlongsize="$ans"
5273         fi
5274         if $test "X$longsize" = "X$longlongsize"; then
5275                 echo "(That isn't any different from an ordinary long.)"
5276         fi      
5277         ;;
5278 esac
5279 $rm -f try.* try
5280
5281 : see if inttypes.h is available
5282 : we want a real compile instead of Inhdr because some systems
5283 : have an inttypes.h which includes non-existent headers
5284 echo " "
5285 $cat >try.c <<EOCP
5286 #include <inttypes.h>
5287 int main() {
5288         static int32_t foo32 = 0x12345678;
5289 }
5290 EOCP
5291 set try
5292 if eval $compile; then
5293         echo "<inttypes.h> found." >&4
5294         val="$define"
5295 else
5296         echo "<inttypes.h> NOT found." >&4
5297         val="$undef"
5298 fi
5299 $rm -f try.c try
5300 set i_inttypes
5301 eval $setvar
5302
5303 : check for int64_t
5304 echo " "
5305 echo "Checking to see if you have int64_t..." >&4
5306 $cat >try.c <<EOCP
5307 #include <sys/types.h>
5308 #$i_inttypes I_INTTYPES
5309 #ifdef I_INTTYPES
5310 #include <inttypes.h>
5311 #endif
5312 int main() { int64_t x = 7; }
5313 EOCP
5314 set try
5315 if eval $compile; then
5316         val="$define"
5317         echo "You have int64_t."
5318 else
5319         val="$undef"
5320         echo "You do not have int64_t."
5321 fi
5322 $rm -f try try.*
5323 set d_int64_t
5324 eval $setvar
5325
5326
5327 echo " "
5328 echo "Checking which 64-bit integer type we could use..." >&4
5329
5330 case "$intsize" in
5331 8) val=int
5332    set quadtype
5333    eval $setvar
5334    val='"unsigned int"'
5335    set uquadtype
5336    eval $setvar
5337    quadkind=1
5338    ;;
5339 *) case "$longsize" in
5340    8) val=long
5341       set quadtype
5342       eval $setvar
5343       val='"unsigned long"'
5344       set uquadtype
5345       eval $setvar
5346       quadkind=2
5347       ;;
5348    *) case "$d_longlong:$longlongsize" in
5349       define:8)
5350         val='"long long"'
5351         set quadtype
5352         eval $setvar
5353         val='"unsigned long long"'
5354         set uquadtype
5355         eval $setvar
5356         quadkind=3
5357         ;;
5358       *) case "$d_int64_t" in
5359          define)
5360            val=int64_t
5361            set quadtype
5362            eval $setvar
5363            val=uint64_t
5364            set uquadtype
5365            eval $setvar
5366            quadkind=4
5367            ;;
5368          esac
5369          ;;
5370       esac
5371       ;;
5372    esac
5373    ;;
5374 esac
5375
5376 case "$quadtype" in
5377 '')     echo "Alas, no 64-bit integer types in sight." >&4
5378         d_quad="$undef"
5379         ;;
5380 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5381         d_quad="$define"
5382         ;;
5383 esac
5384
5385
5386 case "$uselonglong" in
5387 "$define"|true|[yY]*)
5388         cat <<EOM >&4
5389
5390 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5391 EOM
5392         use64bitint="$define"
5393         ;;
5394 esac                          
5395 case "$use64bits" in
5396 "$define"|true|[yY]*)
5397         cat <<EOM >&4
5398
5399 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5400 EOM
5401         use64bitint="$define"
5402         ;;
5403 esac                          
5404 case "$use64bitints" in
5405 "$define"|true|[yY]*)
5406         cat <<EOM >&4
5407
5408 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5409 EOM
5410         use64bitint="$define"
5411         ;;
5412 esac                          
5413 case "$use64bitsint" in
5414 "$define"|true|[yY]*)
5415         cat <<EOM >&4
5416
5417 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5418 EOM
5419         use64bitint="$define"
5420         ;;
5421 esac                          
5422 case "$uselonglongs" in
5423 "$define"|true|[yY]*)
5424         cat <<EOM >&4
5425
5426 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5427 EOM
5428         use64bitint="$define"
5429         ;;
5430 esac                          
5431 case "$use64bitsall" in
5432 "$define"|true|[yY]*)
5433         cat <<EOM >&4
5434
5435 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5436 EOM
5437         use64bitall="$define"
5438         ;;
5439 esac                          
5440
5441 case "$ccflags" in
5442 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5443 esac
5444 case "$use64bitall" in
5445 "$define"|true|[yY]*) use64bitint="$define" ;;
5446 esac
5447
5448 case "$longsize" in
5449 8) cat <<EOM
5450
5451 You have natively 64-bit long integers.
5452 EOM
5453    val="$define"
5454    ;;
5455 *) case "$use64bitint" in
5456    "$define"|true|[yY]*) dflt='y';;
5457    *) dflt='n';;
5458    esac
5459    case "$d_quad" in
5460    "$define") ;;
5461    *) dflt='n' ;;
5462    esac
5463    cat <<EOM
5464
5465 Perl can be built to take advantage of 64-bit integer types
5466 on some systems.  To do so, Configure can be run with -Duse64bitint.
5467 Choosing this option will most probably introduce binary incompatibilities.
5468
5469 If this doesn't make any sense to you, just accept the default '$dflt'.
5470 (The default has been chosen based on your configuration.)
5471 EOM
5472    rp='Try to use 64-bit integers, if available?'
5473    . ./myread
5474    case "$ans" in
5475    [yY]*) val="$define" ;;
5476    *)     val="$undef"  ;;
5477    esac
5478    ;;
5479 esac
5480 set use64bitint
5481 eval $setvar
5482
5483 case "$use64bitall" in
5484 "$define"|true|[yY]*) dflt='y' ;;
5485 *) case "$longsize" in
5486    8) dflt='y' ;;
5487    *) dflt='n' ;;
5488    esac
5489    ;;
5490 esac    
5491 cat <<EOM
5492
5493 You may also choose to try maximal 64-bitness.  It means using as much
5494 64-bitness as possible on the platform.  This in turn means even more
5495 binary incompatibilities.  On the other hand, your platform may not
5496 have any more 64-bitness available than what you already have chosen.
5497
5498 If this doesn't make any sense to you, just accept the default '$dflt'.
5499 (The default has been chosen based on your configuration.)
5500 EOM
5501 rp='Try to use maximal 64-bit support, if available?'
5502 . ./myread
5503 case "$ans" in
5504 [yY]*) val="$define" ;;
5505 *)     val="$undef"  ;;
5506 esac
5507 set use64bitall
5508 eval $setvar
5509 case "$use64bitall" in
5510 "$define")
5511         case "$use64bitint" in
5512         "$undef")
5513                 cat <<EOM
5514
5515 Since you have chosen a maximally 64-bit build, I'm also turning on
5516 the use of 64-bit integers.
5517 EOM
5518                 use64bitint="$define" ;;
5519         esac
5520         ;;
5521 esac
5522
5523 : Look for a hint-file generated 'call-back-unit'.  If the
5524 : user has specified that a 64-bit perl is to be built,
5525 : we may need to set or change some other defaults.
5526 if $test -f use64bitint.cbu; then
5527         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5528         . ./use64bitint.cbu
5529 fi
5530 case "$use64bitint" in
5531 "$define"|true|[yY]*)
5532         case "$longsize" in
5533         4) case "$archname64" in
5534            '') archname64=64int ;;
5535            esac
5536            ;;
5537         esac
5538         ;;
5539 esac
5540
5541 : Look for a hint-file generated 'call-back-unit'.  If the
5542 : user has specified that a maximally 64-bit perl is to be built,
5543 : we may need to set or change some other defaults.
5544 if $test -f use64bitall.cbu; then
5545         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5546         . ./use64bitall.cbu
5547 fi
5548 case "$use64bitall" in
5549 "$define"|true|[yY]*)
5550         case "$longsize" in
5551         4) case "$archname64" in
5552            ''|64int) archname64=64all ;;
5553            esac
5554            ;;
5555         esac
5556         ;;
5557 esac
5558
5559 case "$d_quad:$use64bitint" in
5560 $undef:$define)
5561         cat >&4 <<EOF
5562
5563 *** You have chosen to use 64-bit integers,
5564 *** but none can be found.
5565 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5566 *** Cannot continue, aborting.
5567
5568 EOF
5569         exit 1
5570         ;;
5571 esac
5572
5573 : check for length of double
5574 echo " "
5575 case "$doublesize" in
5576 '')
5577         echo "Checking to see how big your double precision numbers are..." >&4
5578         $cat >try.c <<EOCP
5579 #include <stdio.h>
5580 #$i_stdlib I_STDLIB
5581 #ifdef I_STDLIB
5582 #include <stdlib.h>
5583 #endif
5584 int main()
5585 {
5586     printf("%d\n", (int)sizeof(double));
5587     exit(0);
5588 }
5589 EOCP
5590         set try
5591         if eval $compile_ok; then
5592                 doublesize=`$run ./try`
5593                 echo "Your double is $doublesize bytes long."
5594         else
5595                 dflt='8'
5596                 echo "(I can't seem to compile the test program.  Guessing...)"
5597                 rp="What is the size of a double precision number (in bytes)?"
5598                 . ./myread
5599                 doublesize="$ans"
5600         fi
5601         ;;
5602 esac
5603 $rm -f try.c try
5604
5605 : check for long doubles
5606 echo " "
5607 echo "Checking to see if you have long double..." >&4
5608 echo 'int main() { long double x = 7.0; }' > try.c
5609 set try
5610 if eval $compile; then
5611         val="$define"
5612         echo "You have long double."
5613 else
5614         val="$undef"
5615         echo "You do not have long double."
5616 fi
5617 $rm try.*
5618 set d_longdbl
5619 eval $setvar
5620
5621 : check for length of long double
5622 case "${d_longdbl}${longdblsize}" in
5623 $define)
5624         echo " "
5625         echo "Checking to see how big your long doubles are..." >&4
5626         $cat >try.c <<'EOCP'
5627 #include <stdio.h>
5628 int main()
5629 {
5630         printf("%d\n", sizeof(long double));
5631 }
5632 EOCP
5633         set try
5634         set try
5635         if eval $compile; then
5636                 longdblsize=`$run ./try`
5637                 echo "Your long doubles are $longdblsize bytes long."
5638         else
5639                 dflt='8'
5640                 echo " "
5641                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5642                 rp="What is the size of a long double (in bytes)?"
5643                 . ./myread
5644                 longdblsize="$ans"
5645         fi
5646         if $test "X$doublesize" = "X$longdblsize"; then
5647                 echo "That isn't any different from an ordinary double."
5648                 echo "I'll keep your setting anyway, but you may see some"
5649                 echo "harmless compilation warnings."
5650         fi      
5651         ;;
5652 esac
5653 $rm -f try.* try
5654
5655 : determine the architecture name
5656 echo " "
5657 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5658         tarch=`arch`"-$osname"
5659 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5660         if uname -m > tmparch 2>&1 ; then
5661                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5662                         -e 's/$/'"-$osname/" tmparch`
5663         else
5664                 tarch="$osname"
5665         fi
5666         $rm -f tmparch
5667 else
5668         tarch="$osname"
5669 fi
5670 case "$myarchname" in
5671 ''|"$tarch") ;;
5672 *)
5673         echo "(Your architecture name used to be $myarchname.)"
5674         archname=''
5675         ;;
5676 esac
5677 case "$targetarch" in
5678 '') ;;
5679 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5680 esac
5681 myarchname="$tarch"
5682 case "$archname" in
5683 '') dflt="$tarch";;
5684 *) dflt="$archname";;
5685 esac
5686 rp='What is your architecture name'
5687 . ./myread
5688 archname="$ans"
5689 case "$usethreads" in
5690 $define)
5691         echo "Threads selected." >&4
5692         case "$archname" in
5693         *-thread*) echo "...and architecture name already has -thread." >&4
5694                 ;;
5695         *)      archname="$archname-thread"
5696                 echo "...setting architecture name to $archname." >&4
5697                 ;;
5698         esac
5699         ;;
5700 esac
5701 case "$usemultiplicity" in
5702 $define)
5703         echo "Multiplicity selected." >&4
5704         case "$archname" in
5705         *-multi*) echo "...and architecture name already has -multi." >&4
5706                 ;;
5707         *)      archname="$archname-multi"
5708                 echo "...setting architecture name to $archname." >&4
5709                 ;;
5710         esac
5711         ;;
5712 esac
5713 case "$use64bitint$use64bitall" in
5714 *"$define"*)
5715         case "$archname64" in
5716         '')
5717                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5718                 ;;
5719         *)
5720                 case "$use64bitint" in
5721                 "$define") echo "64 bit integers selected." >&4 ;;
5722                 esac
5723                 case "$use64bitall" in
5724                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5725                 esac
5726                 case "$archname" in
5727                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5728                         ;;
5729                 *)      archname="$archname-$archname64"
5730                         echo "...setting architecture name to $archname." >&4
5731                         ;;
5732                 esac
5733                 ;;
5734         esac
5735 esac
5736 case "$uselongdouble" in
5737 $define)
5738         echo "Long doubles selected." >&4
5739         case "$longdblsize" in
5740         $doublesize)
5741                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
5742                 ;;
5743         *)
5744                 case "$archname" in
5745                 *-ld*) echo "...and architecture name already has -ld." >&4
5746                         ;;
5747                 *)      archname="$archname-ld"
5748                         echo "...setting architecture name to $archname." >&4
5749                         ;;
5750                 esac
5751                 ;;
5752         esac
5753         ;;
5754 esac
5755 case "$useperlio" in
5756 $define)
5757         echo "Perlio selected." >&4
5758         ;;
5759 *)
5760         echo "Perlio not selected, using stdio." >&4
5761         case "$archname" in
5762         *-stdio*) echo "...and architecture name already has -stdio." >&4
5763                 ;;
5764         *)      archname="$archname-stdio"
5765                 echo "...setting architecture name to $archname." >&4
5766                 ;;
5767         esac
5768         ;;
5769 esac
5770 if $test -f archname.cbu; then
5771         echo "Your platform has some specific hints for architecture name, using them..."
5772         . ./archname.cbu
5773 fi
5774
5775 : determine root of directory hierarchy where package will be installed.
5776 case "$prefix" in
5777 '')
5778         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5779         ;;
5780 *?/)
5781         dflt=`echo "$prefix" | sed 's/.$//'`
5782         ;;
5783 *)
5784         dflt="$prefix"
5785         ;;
5786 esac
5787 $cat <<EOM
5788
5789 By default, $package will be installed in $dflt/bin, manual pages
5790 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5791 installation directories. Typically this is something like /usr/local.
5792 If you wish to have binaries under /usr/bin but other parts of the
5793 installation under /usr/local, that's ok: you will be prompted
5794 separately for each of the installation directories, the prefix being
5795 only used to set the defaults.
5796
5797 EOM
5798 fn=d~
5799 rp='Installation prefix to use?'
5800 . ./getfile
5801 oldprefix=''
5802 case "$prefix" in
5803 '') ;;
5804 *)
5805         case "$ans" in
5806         "$prefix") ;;
5807         *) oldprefix="$prefix";;
5808         esac
5809         ;;
5810 esac
5811 prefix="$ans"
5812 prefixexp="$ansexp"
5813
5814 case "$afsroot" in
5815 '')     afsroot=/afs ;;
5816 *)      afsroot=$afsroot ;;
5817 esac
5818
5819 : is AFS running?
5820 echo " "
5821 case "$afs" in
5822 $define|true)   afs=true ;;
5823 $undef|false)   afs=false ;;
5824 *)      if test -d $afsroot; then
5825                 afs=true
5826         else
5827                 afs=false
5828         fi
5829         ;;
5830 esac
5831 if $afs; then
5832         echo "AFS may be running... I'll be extra cautious then..." >&4
5833 else
5834         echo "AFS does not seem to be running..." >&4
5835 fi
5836
5837 : determine installation prefix for where package is to be installed.
5838 if $afs; then 
5839 $cat <<EOM
5840
5841 Since you are running AFS, I need to distinguish the directory in which
5842 files will reside from the directory in which they are installed (and from
5843 which they are presumably copied to the former directory by occult means).
5844
5845 EOM
5846         case "$installprefix" in
5847         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5848         *) dflt="$installprefix";;
5849         esac
5850 else
5851 $cat <<EOM
5852
5853 In some special cases, particularly when building $package for distribution,
5854 it is convenient to distinguish the directory in which files should be
5855 installed from the directory ($prefix) in which they will
5856 eventually reside.  For most users, these two directories are the same.
5857
5858 EOM
5859         case "$installprefix" in
5860         '') dflt=$prefix ;;
5861         *) dflt=$installprefix;;
5862         esac
5863 fi
5864 fn=d~
5865 rp='What installation prefix should I use for installing files?'
5866 . ./getfile
5867 installprefix="$ans"
5868 installprefixexp="$ansexp"
5869
5870 : set the prefixit variable, to compute a suitable default value
5871 prefixit='case "$3" in
5872 ""|none)
5873         case "$oldprefix" in
5874         "") eval "$1=\"\$$2\"";;
5875         *)
5876                 case "$3" in
5877                 "") eval "$1=";;
5878                 none)
5879                         eval "tp=\"\$$2\"";
5880                         case "$tp" in
5881                         ""|" ") eval "$1=\"\$$2\"";;
5882                         *) eval "$1=";;
5883                         esac;;
5884                 esac;;
5885         esac;;
5886 *)
5887         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5888         case "$tp" in
5889         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5890         /*-$oldprefix/*|\~*-$oldprefix/*)
5891                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5892         *) eval "$1=\"\$$2\"";;
5893         esac;;
5894 esac'
5895
5896 : get the patchlevel
5897 echo " "
5898 echo "Getting the current patchlevel..." >&4
5899 if $test -r $rsrc/patchlevel.h;then
5900         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5901         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5902         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5903         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5904         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5905         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5906         perl_patchlevel=`egrep 'define PERL_PATCHNUM [0-9][0-9]|,"MAINT[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
5907 else
5908         revision=0
5909         patchlevel=0
5910         subversion=0
5911         api_revision=0
5912         api_version=0
5913         api_subversion=0
5914         perl_patchlevel=0
5915         $echo "(You do not have patchlevel.h.  Eek.)"
5916 fi
5917 if $test -r $rsrc/.patch ; then
5918         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
5919                 perl_patchlevel=`cat $rsrc/.patch`
5920         fi
5921 fi
5922 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
5923 version_patchlevel_string="version $patchlevel subversion $subversion"
5924 case "$perl_patchlevel" in
5925 0|'') ;;
5926 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
5927 esac
5928
5929 $echo "(You have $package $version_patchlevel_string.)"
5930
5931 case "$osname" in
5932 dos|vms)
5933         : XXX Should be a Configure test for double-dots in filenames.
5934         version=`echo $revision $patchlevel $subversion | \
5935                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5936         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5937                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5938         ;;
5939 *)
5940         version=`echo $revision $patchlevel $subversion | \
5941                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5942         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5943                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5944         ;;
5945 esac
5946 : Special case the 5.005_xx maintenance series, which used 5.005
5947 : without any subversion label as a subdirectory in $sitelib
5948 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5949         api_versionstring='5.005'
5950 fi
5951
5952 : determine installation style
5953 : For now, try to deduce it from prefix unless it is already set.
5954 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5955 case "$installstyle" in
5956 '')     case "$prefix" in
5957                 *perl*) dflt='lib';;
5958                 *) dflt='lib/perl5' ;;
5959         esac
5960         ;;
5961 *)      dflt="$installstyle" ;;
5962 esac
5963 : Probably not worth prompting for this since we prompt for all
5964 : the directories individually, and the prompt would be too long and
5965 : confusing anyway.
5966 installstyle=$dflt
5967
5968 : determine where private library files go
5969 : Usual default is /usr/local/lib/perl5/$version.
5970 : Also allow things like /opt/perl/lib/$version, since 
5971 : /opt/perl/lib/perl5... would be redundant.
5972 : The default "style" setting is made in installstyle.U
5973 case "$installstyle" in
5974 *lib/perl5*) set dflt privlib lib/$package/$version ;;
5975 *)       set dflt privlib lib/$version ;;
5976 esac
5977 eval $prefixit
5978 $cat <<EOM
5979
5980 There are some auxiliary files for $package that need to be put into a
5981 private library directory that is accessible by everyone.
5982
5983 EOM
5984 fn=d~+
5985 rp='Pathname where the private library files will reside?'
5986 . ./getfile
5987 privlib="$ans"
5988 privlibexp="$ansexp"
5989 : Change installation prefix, if necessary.
5990 if $test X"$prefix" != X"$installprefix"; then
5991         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5992 else
5993         installprivlib="$privlibexp"
5994 fi
5995
5996 : set the prefixup variable, to restore leading tilda escape
5997 prefixup='case "$prefixexp" in
5998 "$prefix") ;;
5999 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6000 esac'
6001
6002 : determine where public architecture dependent libraries go
6003 set archlib archlib
6004 eval $prefixit
6005 : privlib default is /usr/local/lib/$package/$version
6006 : archlib default is /usr/local/lib/$package/$version/$archname
6007 : privlib may have an optional trailing /share.
6008 tdflt=`echo $privlib | $sed 's,/share$,,'`
6009 tdflt=$tdflt/$archname
6010 case "$archlib" in
6011 '')     dflt=$tdflt
6012         ;;
6013 *)      dflt="$archlib"
6014     ;;
6015 esac
6016 $cat <<EOM
6017
6018 $spackage contains architecture-dependent library files.  If you are
6019 sharing libraries in a heterogeneous environment, you might store
6020 these files in a separate location.  Otherwise, you can just include
6021 them with the rest of the public library files.
6022
6023 EOM
6024 fn=d+~
6025 rp='Where do you want to put the public architecture-dependent libraries?'
6026 . ./getfile
6027 archlib="$ans"
6028 archlibexp="$ansexp"
6029 if $test X"$archlib" = X"$privlib"; then
6030         d_archlib="$undef"
6031 else
6032         d_archlib="$define"
6033 fi
6034 : Change installation prefix, if necessary.
6035 if $test X"$prefix" != X"$installprefix"; then
6036         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6037 else
6038         installarchlib="$archlibexp"
6039 fi
6040
6041 : see if setuid scripts can be secure
6042 $cat <<EOM
6043
6044 Some kernels have a bug that prevents setuid #! scripts from being
6045 secure.  Some sites have disabled setuid #! scripts because of this.
6046
6047 First let's decide if your kernel supports secure setuid #! scripts.
6048 (If setuid #! scripts would be secure but have been disabled anyway,
6049 don't say that they are secure if asked.)
6050
6051 EOM
6052
6053 val="$undef"
6054 if $test -d /dev/fd; then
6055         echo "#!$ls" >reflect
6056         chmod +x,u+s reflect
6057         ./reflect >flect 2>&1
6058         if $contains "/dev/fd" flect >/dev/null; then
6059                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6060                 val="$define"
6061         else
6062                 $cat <<EOM
6063 If you are not sure if they are secure, I can check but I'll need a
6064 username and password different from the one you are using right now.
6065 If you don't have such a username or don't want me to test, simply
6066 enter 'none'.
6067
6068 EOM
6069                 rp='Other username to test security of setuid scripts with?'
6070                 dflt='none'
6071                 . ./myread
6072                 case "$ans" in
6073                 n|none)
6074                         case "$d_suidsafe" in
6075                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6076                                 dflt=n;;
6077                         "$undef")
6078                                 echo "Well, the $hint value is *not* secure." >&4
6079                                 dflt=n;;
6080                         *)      echo "Well, the $hint value *is* secure." >&4
6081                                 dflt=y;;
6082                         esac
6083                         ;;
6084                 *)
6085                         $rm -f reflect flect
6086                         echo "#!$ls" >reflect
6087                         chmod +x,u+s reflect
6088                         echo >flect
6089                         chmod a+w flect
6090                         echo '"su" will (probably) prompt you for '"$ans's password."
6091                         su $ans -c './reflect >flect'
6092                         if $contains "/dev/fd" flect >/dev/null; then
6093                                 echo "Okay, it looks like setuid scripts are secure." >&4
6094                                 dflt=y
6095                         else
6096                                 echo "I don't think setuid scripts are secure." >&4
6097                                 dflt=n
6098                         fi
6099                         ;;
6100                 esac
6101                 rp='Does your kernel have *secure* setuid scripts?'
6102                 . ./myread
6103                 case "$ans" in
6104                 [yY]*)  val="$define";;
6105                 *)      val="$undef";;
6106                 esac
6107         fi
6108 else
6109         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6110         echo "(That's for file descriptors, not floppy disks.)"
6111         val="$undef"
6112 fi
6113 set d_suidsafe
6114 eval $setvar
6115
6116 $rm -f reflect flect
6117
6118 : now see if they want to do setuid emulation
6119 echo " "
6120 val="$undef"
6121 case "$d_suidsafe" in
6122 "$define")
6123         val="$undef"
6124         echo "No need to emulate SUID scripts since they are secure here." >&4
6125         ;;
6126 *)
6127         $cat <<EOM
6128 Some systems have disabled setuid scripts, especially systems where
6129 setuid scripts cannot be secure.  On systems where setuid scripts have
6130 been disabled, the setuid/setgid bits on scripts are currently
6131 useless.  It is possible for $package to detect those bits and emulate
6132 setuid/setgid in a secure fashion.  This emulation will only work if
6133 setuid scripts have been disabled in your kernel.
6134
6135 EOM
6136         case "$d_dosuid" in
6137         "$define") dflt=y ;;
6138         *) dflt=n ;;
6139         esac
6140         rp="Do you want to do setuid/setgid emulation?"
6141         . ./myread
6142         case "$ans" in
6143         [yY]*)  val="$define";;
6144         *)      val="$undef";;
6145         esac
6146         ;;
6147 esac
6148 set d_dosuid
6149 eval $setvar
6150
6151 : see if this is a malloc.h system
6152 : we want a real compile instead of Inhdr because some systems have a
6153 : malloc.h that just gives a compile error saying to use stdlib.h instead
6154 echo " "
6155 $cat >try.c <<EOCP
6156 #include <stdlib.h>
6157 #include <malloc.h>
6158 int main () { return 0; }
6159 EOCP
6160 set try
6161 if eval $compile; then
6162     echo "<malloc.h> found." >&4
6163     val="$define"
6164 else
6165     echo "<malloc.h> NOT found." >&4
6166     val="$undef"
6167 fi
6168 $rm -f try.c try
6169 set i_malloc
6170 eval $setvar
6171
6172 : check for void type
6173 echo " "
6174 echo "Checking to see how well your C compiler groks the void type..." >&4
6175 case "$voidflags" in
6176 '')
6177         $cat >try.c <<EOCP
6178 #$i_stdlib I_STDLIB
6179 #ifdef I_STDLIB
6180 #include <stdlib.h>
6181 #endif
6182 #if TRY & 1
6183 void sub() {
6184 #else
6185 sub() {
6186 #endif
6187         extern void moo();      /* function returning void */
6188         void (*goo)();          /* ptr to func returning void */
6189 #if TRY & 8
6190         void *hue;              /* generic ptr */
6191 #endif
6192 #if TRY & 2
6193         void (*foo[10])();
6194 #endif
6195
6196 #if TRY & 4
6197         if(goo == moo) {
6198                 exit(0);
6199         }
6200 #endif
6201         exit(0);
6202 }
6203 int main() { sub(); }
6204 EOCP
6205         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6206                 voidflags=$defvoidused
6207         echo "Good.  It appears to support void to the level $package wants.">&4
6208                 if $contains warning .out >/dev/null 2>&1; then
6209                         echo "However, you might get some warnings that look like this:"
6210                         $cat .out
6211                 fi
6212         else
6213 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6214                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6215                         echo "It supports 1..."
6216                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6217                                 echo "It also supports 2..."
6218                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6219                                         voidflags=7
6220                                         echo "And it supports 4 but not 8 definitely."
6221                                 else
6222                                         echo "It doesn't support 4..."
6223                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6224                                                 voidflags=11
6225                                                 echo "But it supports 8."
6226                                         else
6227                                                 voidflags=3
6228                                                 echo "Neither does it support 8."
6229                                         fi
6230                                 fi
6231                         else
6232                                 echo "It does not support 2..."
6233                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6234                                         voidflags=13
6235                                         echo "But it supports 4 and 8."
6236                                 else
6237                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6238                                                 voidflags=5
6239                                                 echo "And it supports 4 but has not heard about 8."
6240                                         else
6241                                                 echo "However it supports 8 but not 4."
6242                                         fi
6243                                 fi
6244                         fi
6245                 else
6246                         echo "There is no support at all for void."
6247                         voidflags=0
6248                 fi
6249         fi
6250 esac
6251 case "$voidflags" in
6252 "$defvoidused") ;;
6253 *)      $cat >&4 <<'EOM'
6254   Support flag bits are:
6255     1: basic void declarations.
6256     2: arrays of pointers to functions returning void.
6257     4: operations between pointers to and addresses of void functions.
6258     8: generic void pointers.
6259 EOM
6260         dflt="$voidflags";
6261         rp="Your void support flags add up to what?"
6262         . ./myread
6263         voidflags="$ans"
6264         ;;
6265 esac
6266 $rm -f try.* .out
6267
6268 : check for length of pointer
6269 echo " "
6270 case "$ptrsize" in
6271 '')
6272         echo "Checking to see how big your pointers are..." >&4
6273         if test "$voidflags" -gt 7; then
6274                 echo '#define VOID_PTR char *' > try.c
6275         else
6276                 echo '#define VOID_PTR void *' > try.c
6277         fi
6278         $cat >>try.c <<EOCP
6279 #include <stdio.h>
6280 #$i_stdlib I_STDLIB
6281 #ifdef I_STDLIB
6282 #include <stdlib.h>
6283 #endif
6284 int main()
6285 {
6286     printf("%d\n", (int)sizeof(VOID_PTR));
6287     exit(0);
6288 }
6289 EOCP
6290         set try
6291         if eval $compile_ok; then
6292                 ptrsize=`$run ./try`
6293                 echo "Your pointers are $ptrsize bytes long."
6294         else
6295                 dflt='4'
6296                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6297                 rp="What is the size of a pointer (in bytes)?"
6298                 . ./myread
6299                 ptrsize="$ans"
6300         fi
6301         ;;
6302 esac
6303 $rm -f try.c try
6304 case "$use64bitall" in
6305 "$define"|true|[yY]*)
6306         case "$ptrsize" in
6307         4)      cat <<EOM >&4
6308
6309 *** You have chosen a maximally 64-bit build,
6310 *** but your pointers are only 4 bytes wide.
6311 *** Please rerun Configure without -Duse64bitall.
6312 EOM
6313                 case "$d_quad" in
6314                 define)
6315                         cat <<EOM >&4
6316 *** Since you have quads, you could possibly try with -Duse64bitint.
6317 EOM
6318                         ;;
6319                 esac
6320                 cat <<EOM >&4
6321 *** Cannot continue, aborting.
6322
6323 EOM
6324
6325                 exit 1
6326                 ;;
6327         esac
6328         ;;
6329 esac
6330
6331
6332 : determine whether to use malloc wrapping
6333 echo " "
6334 case "$usemallocwrap" in
6335 [yY]*|true|$define)     dflt='y' ;;
6336 [nN]*|false|$undef)     dflt='n' ;;
6337 *)      case "$usedevel" in
6338         [yY]*|true|$define)     dflt='y' ;;
6339         *) dflt='n' ;;
6340         esac
6341         ;;
6342 esac
6343 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6344 . ./myread
6345 usemallocwrap="$ans"
6346 case "$ans" in
6347 y*|true)
6348         usemallocwrap="$define" ;;
6349 *)
6350         usemallocwrap="$undef" ;;
6351 esac
6352
6353 : determine which malloc to compile in
6354 echo " "
6355 case "$usemymalloc" in
6356 [yY]*|true|$define)     dflt='y' ;;
6357 [nN]*|false|$undef)     dflt='n' ;;
6358 *)      case "$ptrsize" in
6359         4) dflt='y' ;;
6360         *) dflt='n' ;;
6361         esac
6362         ;;
6363 esac
6364 rp="Do you wish to attempt to use the malloc that comes with $package?"
6365 . ./myread
6366 usemymalloc="$ans"
6367 case "$ans" in
6368 y*|true)
6369         usemymalloc='y'
6370         mallocsrc='malloc.c'
6371         mallocobj="malloc$_o"
6372         d_mymalloc="$define"
6373         case "$libs" in
6374         *-lmalloc*)
6375                 : Remove malloc from list of libraries to use
6376                 echo "Removing unneeded -lmalloc from library list" >&4
6377                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6378                 shift
6379                 libs="$*"
6380                 echo "libs = $libs" >&4
6381                 ;;
6382         esac
6383         ;;
6384 *)
6385         usemymalloc='n'
6386         mallocsrc=''
6387         mallocobj=''
6388         d_mymalloc="$undef"
6389         ;;
6390 esac
6391
6392 : compute the return types of malloc and free
6393 echo " "
6394 $cat >malloc.c <<END
6395 #$i_malloc I_MALLOC
6396 #$i_stdlib I_STDLIB
6397 #include <stdio.h>
6398 #include <sys/types.h>
6399 #ifdef I_MALLOC
6400 #include <malloc.h>
6401 #endif
6402 #ifdef I_STDLIB
6403 #include <stdlib.h>
6404 #endif
6405 #ifdef TRY_MALLOC
6406 void *malloc();
6407 #endif
6408 #ifdef TRY_FREE
6409 void free();
6410 #endif
6411 END
6412 case "$malloctype" in
6413 '')
6414         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6415                 malloctype='void *'
6416         else
6417                 malloctype='char *'
6418         fi
6419         ;;
6420 esac
6421 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6422
6423 case "$freetype" in
6424 '')
6425         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6426                 freetype='void'
6427         else
6428                 freetype='int'
6429         fi
6430         ;;
6431 esac
6432 echo "Your system uses $freetype free(), it would seem." >&4
6433 $rm -f malloc.[co]
6434 $cat <<EOM
6435
6436 After $package is installed, you may wish to install various
6437 add-on modules and utilities.  Typically, these add-ons will
6438 be installed under $prefix with the rest
6439 of this package.  However, you may wish to install such add-ons
6440 elsewhere under a different prefix.
6441
6442 If you do not wish to put everything under a single prefix, that's
6443 ok.  You will be prompted for the individual locations; this siteprefix
6444 is only used to suggest the defaults.
6445
6446 The default should be fine for most people.
6447
6448 EOM
6449 fn=d~+
6450 rp='Installation prefix to use for add-on modules and utilities?'
6451 : XXX Here might be another good place for an installstyle setting.
6452 case "$siteprefix" in
6453 '') dflt=$prefix ;;
6454 *)  dflt=$siteprefix ;;
6455 esac
6456 . ./getfile
6457 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6458 oldsiteprefix=''
6459 case "$siteprefix" in
6460 '') ;;
6461 *)      case "$ans" in
6462         "$prefix") ;;
6463         *) oldsiteprefix="$prefix";;
6464         esac
6465         ;;
6466 esac
6467 siteprefix="$ans"
6468 siteprefixexp="$ansexp"
6469
6470 : determine where site specific libraries go.
6471 : Usual default is /usr/local/lib/perl5/site_perl/$version
6472 : The default "style" setting is made in installstyle.U
6473 : XXX No longer works with Prefixit stuff.
6474 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6475 case "$sitelib" in
6476 '') case "$installstyle" in
6477         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6478         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6479         esac
6480         ;;
6481 *)      dflt="$sitelib"
6482         ;;
6483 esac
6484 $cat <<EOM
6485
6486 The installation process will create a directory for
6487 site-specific extensions and modules.  Most users find it convenient
6488 to place all site-specific files in this directory rather than in the
6489 main distribution directory.
6490
6491 EOM
6492 fn=d~+
6493 rp='Pathname for the site-specific library files?'
6494 . ./getfile
6495 sitelib="$ans"
6496 sitelibexp="$ansexp"
6497 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6498 : Change installation prefix, if necessary.
6499 if $test X"$prefix" != X"$installprefix"; then
6500         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6501 else
6502         installsitelib="$sitelibexp"
6503 fi
6504
6505 : determine where site specific architecture-dependent libraries go.
6506 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6507 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6508 : sitelib may have an optional trailing /share.
6509 case "$sitearch" in
6510 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6511         dflt="$dflt/$archname"
6512         ;;
6513 *)      dflt="$sitearch"
6514         ;;
6515 esac
6516 set sitearch sitearch none
6517 eval $prefixit
6518 $cat <<EOM
6519
6520 The installation process will also create a directory for
6521 architecture-dependent site-specific extensions and modules.
6522
6523 EOM
6524 fn=d~+
6525 rp='Pathname for the site-specific architecture-dependent library files?'
6526 . ./getfile
6527 sitearch="$ans"
6528 sitearchexp="$ansexp"
6529 : Change installation prefix, if necessary.
6530 if $test X"$prefix" != X"$installprefix"; then
6531         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6532 else
6533         installsitearch="$sitearchexp"
6534 fi
6535
6536 $cat <<EOM
6537
6538 The installation process will also create a directory for
6539 vendor-supplied add-ons.  Vendors who supply perl with their system
6540 may find it convenient to place all vendor-supplied files in this
6541 directory rather than in the main distribution directory.  This will
6542 ease upgrades between binary-compatible maintenance versions of perl.
6543
6544 Of course you may also use these directories in whatever way you see
6545 fit.  For example, you might use them to access modules shared over a
6546 company-wide network.
6547
6548 The default answer should be fine for most people.
6549 This causes further questions about vendor add-ons to be skipped
6550 and no vendor-specific directories will be configured for perl.
6551
6552 EOM
6553 rp='Do you want to configure vendor-specific add-on directories?'
6554 case "$usevendorprefix" in
6555 define|true|[yY]*) dflt=y ;;
6556 *)      : User may have set vendorprefix directly on Configure command line.
6557         case "$vendorprefix" in
6558         ''|' ') dflt=n ;;
6559         *)      dflt=y ;;
6560         esac
6561         ;;
6562 esac
6563 . ./myread
6564 case "$ans" in
6565 [yY]*)  fn=d~+
6566         rp='Installation prefix to use for vendor-supplied add-ons?'
6567         case "$vendorprefix" in
6568         '') dflt='' ;;
6569         *)  dflt=$vendorprefix ;;
6570         esac
6571         . ./getfile
6572         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6573         oldvendorprefix=''
6574         case "$vendorprefix" in
6575         '') ;;
6576         *)      case "$ans" in
6577                 "$prefix") ;;
6578                 *) oldvendorprefix="$prefix";;
6579                 esac
6580                 ;;
6581         esac
6582         usevendorprefix="$define"
6583         vendorprefix="$ans"
6584         vendorprefixexp="$ansexp"
6585         ;;
6586 *)      usevendorprefix="$undef"
6587         vendorprefix=''
6588         vendorprefixexp=''
6589         ;;
6590 esac
6591
6592 case "$vendorprefix" in
6593 '')     d_vendorlib="$undef"
6594         vendorlib=''
6595         vendorlibexp=''
6596         ;;
6597 *)      d_vendorlib="$define"
6598         : determine where vendor-supplied modules go.
6599         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6600         case "$vendorlib" in
6601         '')
6602                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6603                 case "$installstyle" in
6604                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6605                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6606                 esac
6607                 ;;
6608         *)      dflt="$vendorlib"
6609                 ;;
6610         esac
6611         fn=d~+
6612         rp='Pathname for the vendor-supplied library files?'
6613         . ./getfile
6614         vendorlib="$ans"
6615         vendorlibexp="$ansexp"
6616         ;;
6617 esac
6618 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6619 : Change installation prefix, if necessary.
6620 if $test X"$prefix" != X"$installprefix"; then
6621         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6622 else
6623         installvendorlib="$vendorlibexp"
6624 fi
6625
6626 case "$vendorprefix" in
6627 '')     d_vendorarch="$undef"
6628         vendorarch=''
6629         vendorarchexp=''
6630         ;;
6631 *)      d_vendorarch="$define"
6632         : determine where vendor-supplied architecture-dependent libraries go.
6633         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6634         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6635         : vendorlib may have an optional trailing /share.
6636         case "$vendorarch" in
6637         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6638                 dflt="$dflt/$archname"
6639                 ;;
6640         *)      dflt="$vendorarch" ;;
6641         esac
6642         fn=d~+
6643         rp='Pathname for vendor-supplied architecture-dependent files?'
6644         . ./getfile
6645         vendorarch="$ans"
6646         vendorarchexp="$ansexp"
6647         ;;
6648 esac
6649 : Change installation prefix, if necessary.
6650 if $test X"$prefix" != X"$installprefix"; then
6651         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6652 else
6653         installvendorarch="$vendorarchexp"
6654 fi
6655
6656 : Final catch-all directories to search
6657 $cat <<EOM
6658
6659 Lastly, you can have perl look in other directories for extensions and
6660 modules in addition to those already specified.
6661 These directories will be searched after 
6662         $sitearch 
6663         $sitelib 
6664 EOM
6665 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6666 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6667 echo ' '
6668 case "$otherlibdirs" in
6669 ''|' ') dflt='none' ;;
6670 *)      dflt="$otherlibdirs" ;;
6671 esac
6672 $cat <<EOM
6673 Enter a colon-separated set of extra paths to include in perl's @INC
6674 search path, or enter 'none' for no extra paths.
6675
6676 EOM
6677
6678 rp='Colon-separated list of additional directories for perl to search?'
6679 . ./myread
6680 case "$ans" in
6681 ' '|''|none)    otherlibdirs=' ' ;;     
6682 *)      otherlibdirs="$ans" ;;
6683 esac
6684 case "$otherlibdirs" in
6685 ' ') val=$undef ;;
6686 *)      val=$define ;;
6687 esac
6688 set d_perl_otherlibdirs
6689 eval $setvar
6690
6691 : Cruising for prototypes
6692 echo " "
6693 echo "Checking out function prototypes..." >&4
6694 $cat >prototype.c <<EOCP
6695 #$i_stdlib I_STDLIB
6696 #ifdef I_STDLIB
6697 #include <stdlib.h>
6698 #endif
6699 int main(int argc, char *argv[]) {
6700         exit(0);}
6701 EOCP
6702 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6703         echo "Your C compiler appears to support function prototypes."
6704         val="$define"
6705 else
6706         echo "Your C compiler doesn't seem to understand function prototypes."
6707         val="$undef"
6708 fi
6709 set prototype
6710 eval $setvar
6711 $rm -f prototype*
6712
6713 case "$prototype" in
6714 "$define") ;;
6715 *)      ansi2knr='ansi2knr'
6716         echo " "
6717         cat <<EOM >&4
6718
6719 $me:  FATAL ERROR:
6720 This version of $package can only be compiled by a compiler that 
6721 understands function prototypes.  Unfortunately, your C compiler 
6722         $cc $ccflags
6723 doesn't seem to understand them.  Sorry about that.
6724
6725 If GNU cc is available for your system, perhaps you could try that instead.  
6726
6727 Eventually, we hope to support building Perl with pre-ANSI compilers.
6728 If you would like to help in that effort, please contact <perlbug@perl.org>.
6729
6730 Aborting Configure now.
6731 EOM
6732         exit 2
6733         ;;
6734 esac
6735
6736 : determine where public executables go
6737 echo " "
6738 set dflt bin bin
6739 eval $prefixit
6740 fn=d~
6741 rp='Pathname where the public executables will reside?'
6742 . ./getfile
6743 if $test "X$ansexp" != "X$binexp"; then
6744         installbin=''
6745 fi
6746 bin="$ans"
6747 binexp="$ansexp"
6748 : Change installation prefix, if necessary.
6749 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6750 if $test X"$prefix" != X"$installprefix"; then
6751         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6752 else
6753         installbin="$binexp"
6754 fi
6755
6756 echo " "
6757 case "$extras" in
6758 '') dflt='n';;
6759 *) dflt='y';;
6760 esac
6761 cat <<EOM
6762 Perl can be built with extra modules or bundles of modules which
6763 will be fetched from the CPAN and installed alongside Perl.
6764
6765 Notice that you will need access to the CPAN; either via the Internet,
6766 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
6767 be asked later to configure the CPAN.pm module which will in turn do
6768 the installation of the rest of the extra modules or bundles.)
6769
6770 Notice also that if the modules require any external software such as
6771 libraries and headers (the libz library and the zlib.h header for the
6772 Compress::Zlib module, for example) you MUST have any such software
6773 already installed, this configuration process will NOT install such
6774 things for you.
6775
6776 If this doesn't make any sense to you, just accept the default '$dflt'.
6777 EOM
6778 rp='Install any extra modules (y or n)?'
6779 . ./myread
6780 case "$ans" in
6781 y|Y)
6782         cat <<EOM
6783
6784 Please list any extra modules or bundles to be installed from CPAN,
6785 with spaces between the names.  The names can be in any format the
6786 'install' command of CPAN.pm will understand.  (Answer 'none',
6787 without the quotes, to install no extra modules or bundles.)
6788 EOM
6789         rp='Extras?'
6790         dflt="$extras"
6791         . ./myread
6792         extras="$ans"
6793 esac
6794 case "$extras" in
6795 ''|'none')
6796         val=''
6797         $rm -f ../extras.lst
6798         ;;
6799 *)      echo "(Saving the list of extras for later...)"
6800         echo "$extras" > ../extras.lst
6801         val="'$extras'"
6802         ;;
6803 esac
6804 set extras
6805 eval $setvar
6806 echo " "
6807
6808 : determine where html pages for programs go
6809 set html1dir html1dir none
6810 eval $prefixit
6811 $cat <<EOM
6812
6813 If you wish to install html files for programs in $spackage, indicate 
6814 the appropriate directory here.  To skip installing html files,
6815 answer "none".
6816 EOM
6817 case "$html1dir" in
6818 ''|none|$undef|' ') dflt=none ;;
6819 *) dflt=$html1dir ;;
6820 esac
6821 fn=dn+~
6822 rp="Directory for the main $spackage html pages?"
6823 . ./getfile
6824 html1dir="$ans"
6825 html1direxp="$ansexp"
6826 : Use ' ' for none so value is preserved next time through Configure
6827 $test X"$html1dir" = "X" && html1dir=' '
6828 : Change installation prefix, if necessary.
6829 if $test X"$prefix" != X"$installprefix"; then
6830         installhtml1dir=`echo $html1direxp | sed "s#^$prefix#$installprefix#"`
6831 else
6832         installhtml1dir="$html1direxp"
6833 fi
6834
6835 : determine where html pages for libraries and modules go
6836 set html3dir html3dir none
6837 eval $prefixit
6838 $cat <<EOM
6839
6840 If you wish to install html files for modules associated with $spackage,
6841 indicate the appropriate directory here.  To skip installing html files,
6842 answer "none".
6843 EOM
6844 : There is no obvious default.  If they have specified html1dir, then
6845 : try to key off that, possibly changing .../html1 into .../html3.
6846 case "$html3dir" in
6847 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
6848 *) dflt=$html3dir ;;
6849 esac
6850 fn=dn+~
6851 rp="Directory for the $spackage module html pages?"
6852 . ./getfile
6853 html3dir="$ans"
6854 html3direxp="$ansexp"
6855 : Use ' ' for none so value is preserved next time through Configure
6856 $test X"$html3dir" = "X" && html3dir=' '
6857 : Change installation prefix, if necessary.
6858 if $test X"$prefix" != X"$installprefix"; then
6859         installhtml3dir=`echo $html3direxp | sed "s#^$prefix#$installprefix#"`
6860 else
6861         installhtml3dir="$html3direxp"
6862 fi
6863
6864 : Find perl5.005 or later.
6865 echo "Looking for a previously installed perl5.005 or later... "
6866 case "$perl5" in
6867 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6868                 : Check if this perl is recent and can load a simple module
6869                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6870                         perl5=$tdir/perl
6871                         break;
6872                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6873                         perl5=$tdir/perl5
6874                         break;
6875                 fi
6876         done
6877         ;;
6878 *)      perl5="$perl5"
6879         ;;
6880 esac
6881 case "$perl5" in
6882 '')     echo "None found.  That's ok.";;
6883 *)      echo "Using $perl5." ;;
6884 esac
6885
6886 : Determine list of previous versions to include in @INC
6887 $cat > getverlist <<EOPL
6888 #!$perl5 -w
6889 use File::Basename;
6890 \$api_versionstring = "$api_versionstring";
6891 \$version = "$version";
6892 \$stem = "$sitelib_stem";
6893 \$archname = "$archname";
6894 EOPL
6895         $cat >> getverlist <<'EOPL'
6896 # Can't have leading @ because metaconfig interprets it as a command!
6897 ;@inc_version_list=();
6898 # XXX Redo to do opendir/readdir? 
6899 if (-d $stem) {
6900     chdir($stem);
6901     ;@candidates = glob("5.*");
6902 }
6903 else {
6904     ;@candidates = ();
6905 }
6906
6907 # XXX ToDo:  These comparisons must be reworked when two-digit
6908 # subversions come along, so that 5.7.10 compares as greater than
6909 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6910 # widespread that we can use the built-in version vectors rather
6911 # than reinventing them here.  For 5.6.0, however, we must
6912 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6913 foreach $d (@candidates) {
6914     if ($d lt $version) {
6915         if ($d ge $api_versionstring) {
6916             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6917         }
6918         elsif ($d ge "5.005") {
6919             unshift(@inc_version_list, grep { -d } $d);
6920         }
6921     }
6922     else {
6923         # Skip newer version.  I.e. don't look in
6924         # 5.7.0 if we're installing 5.6.1.
6925     }
6926 }
6927
6928 if (@inc_version_list) {
6929     print join(' ', @inc_version_list);
6930 }
6931 else {
6932     # Blank space to preserve value for next Configure run.
6933     print " ";
6934 }
6935 EOPL
6936 chmod +x getverlist
6937 case "$inc_version_list" in
6938 '')     if test -x "$perl5$exe_ext"; then
6939                 dflt=`$perl5 getverlist`
6940         else
6941                 dflt='none'
6942         fi
6943         ;;
6944 $undef) dflt='none' ;;
6945 *)  eval dflt=\"$inc_version_list\" ;;
6946 esac
6947 case "$dflt" in
6948 ''|' ') dflt=none ;;
6949 esac
6950 case "$dflt" in
6951 5.005) dflt=none ;;
6952 esac
6953 $cat <<EOM
6954
6955 In order to ease the process of upgrading, this version of perl 
6956 can be configured to use modules built and installed with earlier 
6957 versions of perl that were installed under $prefix.  Specify here
6958 the list of earlier versions that this version of perl should check.
6959 If Configure detected no earlier versions of perl installed under
6960 $prefix, then the list will be empty.  Answer 'none' to tell perl
6961 to not search earlier versions.
6962
6963 The default should almost always be sensible, so if you're not sure,
6964 just accept the default.
6965 EOM
6966
6967 rp='List of earlier versions to include in @INC?'
6968 . ./myread
6969 case "$ans" in
6970 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6971 *) inc_version_list="$ans" ;;
6972 esac
6973 case "$inc_version_list" in
6974 ''|' ') 
6975         inc_version_list_init='0';;
6976 *)      inc_version_list_init=`echo $inc_version_list |
6977                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6978         ;;
6979 esac
6980 $rm -f getverlist
6981
6982 : determine whether to install perl also as /usr/bin/perl
6983
6984 echo " "
6985 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6986         $cat <<EOM
6987 Many scripts expect perl to be installed as /usr/bin/perl.
6988
6989 If you want to, I can install the perl you are about to compile
6990 as /usr/bin/perl (in addition to $bin/perl).
6991 EOM
6992         if test -f /usr/bin/perl; then
6993             $cat <<EOM
6994
6995 However, please note that because you already have a /usr/bin/perl,
6996 overwriting that with a new Perl would very probably cause problems.
6997 Therefore I'm assuming you don't want to do that (unless you insist).
6998
6999 EOM
7000             case "$installusrbinperl" in
7001             "$define"|[yY]*)    dflt='y';;
7002             *)                  dflt='n';;
7003             esac
7004         else
7005             $cat <<EOM
7006
7007 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7008
7009 EOM
7010             case "$installusrbinperl" in
7011             "$undef"|[nN]*)     dflt='n';;
7012             *)                  dflt='y';;
7013             esac
7014         fi
7015         rp="Do you want to install perl as /usr/bin/perl?"
7016         . ./myread
7017         case "$ans" in
7018         [yY]*)  val="$define";;
7019         *)      val="$undef" ;;
7020         esac
7021 else
7022         val="$undef"
7023 fi
7024 set installusrbinperl
7025 eval $setvar
7026
7027 echo " "
7028 echo "Checking for GNU C Library..." >&4
7029 cat >try.c <<'EOCP'
7030 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7031    alone are insufficient to distinguish different versions, such as
7032    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7033    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7034 */
7035 #include <stdio.h>
7036 int main(void)
7037 {
7038 #ifdef __GLIBC__
7039 #   ifdef __GLIBC_MINOR__
7040 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
7041 #           include <gnu/libc-version.h>
7042             printf("%s\n",  gnu_get_libc_version());
7043 #       else
7044             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7045 #       endif
7046 #   else
7047         printf("%d\n",  __GLIBC__);
7048 #   endif
7049     return 0;
7050 #else
7051     return 1;
7052 #endif
7053 }
7054 EOCP
7055 set try
7056 if eval $compile_ok && $run ./try > glibc.ver; then
7057         val="$define"
7058         gnulibc_version=`$cat glibc.ver`
7059         echo "You are using the GNU C Library version $gnulibc_version"
7060 else
7061         val="$undef"
7062         gnulibc_version=''
7063         echo "You are not using the GNU C Library"
7064 fi
7065 $rm -f try try.* glibc.ver
7066 set d_gnulibc
7067 eval $setvar
7068
7069 : see if nm is to be used to determine whether a symbol is defined or not
7070 case "$usenm" in
7071 '')
7072         dflt=''
7073         case "$d_gnulibc" in
7074         "$define")
7075                 echo " "
7076                 echo "nm probably won't work on the GNU C Library." >&4
7077                 dflt=n
7078                 ;;
7079         esac
7080         case "$dflt" in
7081         '') 
7082                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7083                         echo " "
7084                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7085                         echo "'nm' won't be sufficient on this sytem." >&4
7086                         dflt=n
7087                 fi
7088                 ;;
7089         esac
7090         case "$dflt" in
7091         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7092                 if $test $dflt -gt 20; then
7093                         dflt=y
7094                 else
7095                         dflt=n
7096                 fi
7097                 ;;
7098         esac
7099         ;;
7100 *)
7101         case "$usenm" in
7102         true|$define) dflt=y;;
7103         *) dflt=n;;
7104         esac
7105         ;;
7106 esac
7107 $cat <<EOM
7108
7109 I can use $nm to extract the symbols from your C libraries. This
7110 is a time consuming task which may generate huge output on the disk (up
7111 to 3 megabytes) but that should make the symbols extraction faster. The
7112 alternative is to skip the 'nm' extraction part and to compile a small
7113 test program instead to determine whether each symbol is present. If
7114 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7115 this may be the best solution.
7116
7117 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7118
7119 EOM
7120 rp="Shall I use $nm to extract C symbols from the libraries?"
7121 . ./myread
7122 case "$ans" in
7123 [Nn]*) usenm=false;;
7124 *) usenm=true;;
7125 esac
7126
7127 runnm=$usenm
7128 case "$reuseval" in
7129 true) runnm=false;;
7130 esac
7131
7132 : nm options which may be necessary
7133 case "$nm_opt" in
7134 '') if $test -f /mach_boot; then
7135                 nm_opt=''       # Mach
7136         elif $test -d /usr/ccs/lib; then
7137                 nm_opt='-p'     # Solaris (and SunOS?)
7138         elif $test -f /dgux; then
7139                 nm_opt='-p'     # DG-UX
7140         elif $test -f /lib64/rld; then
7141                 nm_opt='-p'     # 64-bit Irix
7142         else
7143                 nm_opt=''
7144         fi;;
7145 esac
7146
7147 : nm options which may be necessary for shared libraries but illegal
7148 : for archive libraries.  Thank you, Linux.
7149 case "$nm_so_opt" in
7150 '')     case "$myuname" in
7151         *linux*|gnu*)
7152                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7153                         nm_so_opt='--dynamic'
7154                 fi
7155                 ;;
7156         esac
7157         ;;
7158 esac
7159
7160 case "$runnm" in
7161 true)
7162 : get list of predefined functions in a handy place
7163 echo " "
7164 case "$libc" in
7165 '') libc=unknown
7166         case "$libs" in
7167         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7168         esac
7169         ;;
7170 esac
7171 case "$libs" in
7172 '') ;;
7173 *)  for thislib in $libs; do
7174         case "$thislib" in
7175         -lc|-lc_s)
7176                 : Handle C library specially below.
7177                 ;;
7178         -l*)
7179                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7180                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7181                         :
7182                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7183                         :
7184                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7185                         :
7186                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7187                         :
7188                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7189                         :
7190                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7191                         :
7192                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7193                         :
7194                 else
7195                         try=''
7196                 fi
7197                 libnames="$libnames $try"
7198                 ;;
7199         *) libnames="$libnames $thislib" ;;
7200         esac
7201         done
7202         ;;
7203 esac
7204 xxx=normal
7205 case "$libc" in
7206 unknown)
7207         set /lib/libc.$so
7208         for xxx in $libpth; do
7209                 $test -r $1 || set $xxx/libc.$so
7210                 : The messy sed command sorts on library version numbers.
7211                 $test -r $1 || \
7212                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7213                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7214                                 h
7215                                 s/[0-9][0-9]*/0000&/g
7216                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7217                                 G
7218                                 s/\n/ /' | \
7219                          $sort | $sed -e 's/^.* //'`
7220                 eval set \$$#
7221         done
7222         $test -r $1 || set /usr/ccs/lib/libc.$so
7223         $test -r $1 || set /lib/libsys_s$_a
7224         ;;
7225 *)
7226         set blurfl
7227         ;;
7228 esac
7229 if $test -r "$1"; then
7230         echo "Your (shared) C library seems to be in $1."
7231         libc="$1"
7232 elif $test -r /lib/libc && $test -r /lib/clib; then
7233         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7234         xxx=apollo
7235         libc='/lib/clib /lib/libc'
7236         if $test -r /lib/syslib; then
7237                 echo "(Your math library is in /lib/syslib.)"
7238                 libc="$libc /lib/syslib"
7239         fi
7240 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7241         echo "Your C library seems to be in $libc, as you said before."
7242 elif $test -r $incpath/usr/lib/libc$_a; then
7243         libc=$incpath/usr/lib/libc$_a;
7244         echo "Your C library seems to be in $libc.  That's fine."
7245 elif $test -r /lib/libc$_a; then
7246         libc=/lib/libc$_a;
7247         echo "Your C library seems to be in $libc.  You're normal."
7248 else
7249         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7250                 :
7251         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7252                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7253         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7254                 :
7255         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7256                 :
7257         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7258                 :
7259         else
7260                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7261         fi
7262         if $test -r "$tans"; then
7263                 echo "Your C library seems to be in $tans, of all places."
7264                 libc=$tans
7265         else
7266                 libc='blurfl'
7267         fi
7268 fi
7269 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7270         dflt="$libc"
7271         cat <<EOM
7272
7273 If the guess above is wrong (which it might be if you're using a strange
7274 compiler, or your machine supports multiple models), you can override it here.
7275
7276 EOM
7277 else
7278         dflt=''
7279         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7280         cat >&4 <<EOM
7281 I can't seem to find your C library.  I've looked in the following places:
7282
7283 EOM
7284         $sed 's/^/      /' libpath
7285         cat <<EOM
7286
7287 None of these seems to contain your C library. I need to get its name...
7288
7289 EOM
7290 fi
7291 fn=f
7292 rp='Where is your C library?'
7293 . ./getfile
7294 libc="$ans"
7295
7296 echo " "
7297 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7298 set X `cat libnames`
7299 shift
7300 xxx=files
7301 case $# in 1) xxx=file; esac
7302 echo "Extracting names from the following $xxx for later perusal:" >&4
7303 echo " "
7304 $sed 's/^/      /' libnames >&4
7305 echo " "
7306 $echo $n "This may take a while...$c" >&4
7307
7308 for file in $*; do
7309         case $file in
7310         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7311         *) $nm $nm_opt $file 2>/dev/null;;
7312         esac
7313 done >libc.tmp
7314
7315 $echo $n ".$c"
7316 $grep fprintf libc.tmp > libc.ptf
7317 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7318 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7319 xxx='[ADTSIW]'
7320 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7321         eval $xscan;\
7322         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7323                 eval $xrun
7324 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7325         eval $xscan;\
7326         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7327                 eval $xrun
7328 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7329         eval $xscan;\
7330         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7331                 eval $xrun
7332 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7333         eval $xscan;\
7334         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7335                 eval $xrun
7336 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7337         eval $xscan;\
7338         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7339                 eval $xrun
7340 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7341         eval $xscan;\
7342         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7343                 eval $xrun
7344 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7345                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7346         eval $xscan;\
7347         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7348                 eval $xrun
7349 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7350         eval $xscan;\
7351         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7352                 eval $xrun
7353 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7354         eval $xscan;\
7355         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7356                 eval $xrun
7357 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7358         eval $xscan;\
7359         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7360                 eval $xrun
7361 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7362         eval $xscan;\
7363         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7364                 eval $xrun
7365 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7366         eval $xscan;\
7367         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7368                 eval $xrun
7369 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7370         eval $xscan;\
7371         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7372                 eval $xrun
7373 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7374         eval $xscan;\
7375         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7376                 eval $xrun
7377 else
7378         $nm -p $* 2>/dev/null >libc.tmp
7379         $grep fprintf libc.tmp > libc.ptf
7380         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7381                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7382         then
7383                 nm_opt='-p'
7384                 eval $xrun
7385         else
7386                 echo " "
7387                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7388                 com=''
7389                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7390                         for thisname in $libnames $libc; do
7391                                 $ar t $thisname >>libc.tmp
7392                         done
7393                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7394                         echo "Ok." >&4
7395                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7396                         # Repeat libc to extract forwarders to DLL entries too
7397                         for thisname in $libnames $libc; do
7398                                 $ar tv $thisname >>libc.tmp
7399                                 # Revision 50 of EMX has bug in $ar.
7400                                 # it will not extract forwarders to DLL entries
7401                                 # Use emximp which will extract exactly them.
7402                                 emximp -o tmp.imp $thisname \
7403                                     2>/dev/null && \
7404                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7405                                     < tmp.imp >>libc.tmp
7406                                 $rm tmp.imp
7407                         done
7408                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7409                         echo "Ok." >&4
7410                 else
7411                         echo "$ar didn't seem to work right." >&4
7412                         echo "Maybe this is a Cray...trying bld instead..." >&4
7413                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7414                         then
7415                                 for thisname in $libnames; do
7416                                         bld t $libnames | \
7417                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7418                                         $ar t $thisname >>libc.tmp
7419                                 done
7420                                 echo "Ok." >&4
7421                         else
7422                                 echo "That didn't work either.  Giving up." >&4
7423                                 exit 1
7424                         fi
7425                 fi
7426         fi
7427 fi
7428 nm_extract="$com"
7429 case "$PASE" in
7430 define)
7431     echo " "
7432     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7433     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7434     ;;
7435 *)  if $test -f /lib/syscalls.exp; then
7436         echo " "
7437         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7438         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7439     fi
7440     ;;
7441 esac
7442 ;;
7443 esac
7444 $rm -f libnames libpath
7445
7446 : see if dld is available
7447 set dld.h i_dld
7448 eval $inhdr
7449
7450 : is a C symbol defined?
7451 csym='tlook=$1;
7452 case "$3" in
7453 -v) tf=libc.tmp; tdc="";;
7454 -a) tf=libc.tmp; tdc="[]";;
7455 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7456 esac;
7457 tx=yes;
7458 case "$reuseval-$4" in
7459 true-) ;;
7460 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7461 esac;
7462 case "$tx" in
7463 yes)
7464         tval=false;
7465         if $test "$runnm" = true; then
7466                 if $contains $tlook $tf >/dev/null 2>&1; then
7467                         tval=true;
7468                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7469                         echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7470                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7471                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7472                         $rm -f try$_exe try.c core core.* try.core;
7473                 fi;
7474         else
7475                 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7476                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7477                 $rm -f try$_exe try.c;
7478         fi;
7479         ;;
7480 *)
7481         case "$tval" in
7482         $define) tval=true;;
7483         *) tval=false;;
7484         esac;
7485         ;;
7486 esac;
7487 eval "$2=$tval"'
7488
7489 : define an is-in-libc? function
7490 inlibc='echo " "; td=$define; tu=$undef;
7491 sym=$1; var=$2; eval "was=\$$2";
7492 tx=yes;
7493 case "$reuseval$was" in
7494 true) ;;
7495 true*) tx=no;;
7496 esac;
7497 case "$tx" in
7498 yes)
7499         set $sym tres -f;
7500         eval $csym;
7501         case "$tres" in
7502         true)
7503                 echo "$sym() found." >&4;
7504                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7505         *)
7506                 echo "$sym() NOT found." >&4;
7507                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7508         esac;;
7509 *)
7510         case "$was" in
7511         $define) echo "$sym() found." >&4;;
7512         *) echo "$sym() NOT found." >&4;;
7513         esac;;
7514 esac'
7515
7516 : see if dlopen exists
7517 xxx_runnm="$runnm"
7518 runnm=false
7519 set dlopen d_dlopen
7520 eval $inlibc
7521 runnm="$xxx_runnm"
7522
7523 : determine which dynamic loading, if any, to compile in
7524 echo " "
7525 dldir="ext/DynaLoader"
7526 case "$usedl" in
7527 $define|y|true)
7528         dflt='y'
7529         usedl="$define"
7530         ;;
7531 $undef|n|false)
7532         dflt='n'
7533         usedl="$undef"
7534         ;;
7535 *) 
7536         dflt='n'
7537         case "$d_dlopen" in
7538             $define) dflt='y' ;;
7539         esac
7540         case "$i_dld" in
7541             $define) dflt='y' ;;
7542         esac
7543         : Does a dl_xxx.xs file exist for this operating system
7544         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7545         ;;
7546 esac
7547 rp="Do you wish to use dynamic loading?"
7548 . ./myread
7549 usedl="$ans"
7550 case "$ans" in
7551 y*) usedl="$define"
7552         case "$dlsrc" in
7553         '')
7554                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7555                         dflt="$dldir/dl_${osname}.xs"
7556                 elif $test "$d_dlopen" = "$define" ; then
7557                         dflt="$dldir/dl_dlopen.xs"
7558                 elif $test "$i_dld" = "$define" ; then
7559                         dflt="$dldir/dl_dld.xs"
7560                 else
7561                         dflt=''
7562                 fi
7563                 ;;
7564         *)      dflt="$dldir/$dlsrc"
7565                 ;;
7566         esac
7567     echo "The following dynamic loading files are available:"
7568         : Can not go over to $dldir because getfile has path hard-coded in.
7569         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7570         rp="Source file to use for dynamic loading"
7571         fn="fne"
7572         gfpth="$src"
7573         . ./getfile
7574         usedl="$define"
7575         : emulate basename
7576         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7577
7578         $cat << EOM
7579
7580 Some systems may require passing special flags to $cc -c to
7581 compile modules that will be used to create a shared library.
7582 To use no flags, say "none".
7583
7584 EOM
7585     case "$cccdlflags" in
7586     '') case "$gccversion" in
7587                 '') case "$osname" in
7588                         hpux)   dflt='+z' ;;
7589                         next)   dflt='none' ;;
7590                         irix*)  dflt='-KPIC' ;;
7591                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7592                         sunos)  dflt='-pic' ;;
7593                         *)      dflt='none' ;;
7594                     esac
7595                         ;;
7596                 *)  case "$osname" in
7597                         darwin) dflt='none' ;;
7598                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7599                         *)      dflt='-fpic' ;;
7600                     esac ;;
7601             esac ;;
7602         ' ') dflt='none' ;;
7603     *)  dflt="$cccdlflags" ;;
7604     esac
7605     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7606     . ./myread
7607     case "$ans" in
7608     none) cccdlflags=' ' ;;
7609     *) cccdlflags="$ans" ;;
7610     esac
7611
7612     cat << EOM
7613
7614 Some systems use ld to create libraries that can be dynamically loaded,
7615 while other systems (such as those using ELF) use $cc.
7616
7617 EOM
7618         case "$ld" in
7619         '')     $cat >try.c <<EOM
7620 /* Test for whether ELF binaries are produced */
7621 #include <fcntl.h>
7622 #$i_stdlib I_STDLIB
7623 #ifdef I_STDLIB
7624 #include <stdlib.h>
7625 #endif
7626 int main() {
7627         char b[4];
7628         int i = open("a.out",O_RDONLY);
7629         if(i == -1) 
7630                 exit(1); /* fail */
7631         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7632                 exit(0); /* succeed (yes, it's ELF) */
7633         else
7634                 exit(1); /* fail */
7635 }
7636 EOM
7637                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7638                         cat <<EOM
7639 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7640 EOM
7641                         dflt="$cc"
7642                 else
7643                         echo "I'll use ld to build dynamic libraries."
7644                         dflt='ld'
7645                 fi
7646                 rm -f try.c a.out
7647                 ;;
7648         *)      dflt="$ld"
7649                 ;;
7650         esac
7651
7652     rp="What command should be used to create dynamic libraries?"
7653     . ./myread
7654         ld="$ans"
7655
7656     cat << EOM
7657
7658 Some systems may require passing special flags to $ld to create a
7659 library that can be dynamically loaded.  If your ld flags include
7660 -L/other/path options to locate libraries outside your loader's normal
7661 search path, you may need to specify those -L options here as well.  To
7662 use no flags, say "none".
7663
7664 EOM
7665     case "$lddlflags" in
7666     '') case "$osname" in
7667                         beos) dflt='-nostart' ;;
7668                         hpux) dflt='-b';
7669                               case "$gccversion" in
7670                               '') dflt="$dflt +vnocompatwarnings" ;;
7671                               esac
7672                               ;;        
7673                         linux|irix*|gnu*)       dflt='-shared' ;;
7674                         next)  dflt='none' ;;
7675                         solaris) dflt='-G' ;;
7676                         sunos) dflt='-assert nodefinitions' ;;
7677                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7678                 *)     dflt='none' ;;
7679                         esac
7680                         ;;
7681     *) dflt="$lddlflags" ;;
7682     esac
7683
7684         : Try to guess additional flags to pick up local libraries.
7685         : Be careful not to append to a plain 'none'
7686         case "$dflt" in
7687         none) dflt='' ;;
7688         esac
7689         for thisflag in $ldflags; do
7690                 case "$thisflag" in
7691                 -L*|-R*|-Wl,-R*)
7692                         case " $dflt " in
7693                         *" $thisflag "*) ;;
7694                         *) dflt="$dflt $thisflag" ;;
7695                         esac
7696                         ;;
7697                 esac
7698         done
7699
7700         case "$dflt" in
7701         ''|' ') dflt='none' ;;
7702         esac
7703
7704     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7705     . ./myread
7706     case "$ans" in
7707     none) lddlflags=' ' ;;
7708     *) lddlflags="$ans" ;;
7709     esac
7710
7711         cat <<EOM
7712
7713 Some systems may require passing special flags to $cc to indicate that
7714 the resulting executable will use dynamic linking.  To use no flags,
7715 say "none".
7716
7717 EOM
7718     case "$ccdlflags" in
7719     '') case "$osname" in
7720             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
7721             next|sunos) dflt='none' ;;
7722             *)          dflt='none' ;;
7723             esac ;;
7724     ' ')  dflt='none' ;;
7725     *)  dflt="$ccdlflags" ;;
7726     esac
7727     rp="Any special flags to pass to $cc to use dynamic linking?"
7728     . ./myread
7729     case "$ans" in
7730     none) ccdlflags=' ' ;;
7731     *) ccdlflags="$ans" ;;
7732     esac
7733     ;;
7734 *)  usedl="$undef"
7735         ld='ld'
7736     dlsrc='dl_none.xs'
7737     lddlflags=''
7738     ccdlflags=''
7739     ;;
7740 esac
7741
7742 also=''
7743 case "$usedl" in
7744 $undef)
7745         # No dynamic loading being used, so don't bother even to prompt.
7746         useshrplib='false'
7747         ;;
7748 *)      case "$useshrplib" in
7749         '')     case "$osname" in
7750                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7751                         dflt=y
7752                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7753                         ;;
7754                 next*)
7755                         case "$osvers" in
7756                         4*)     dflt=y
7757                                 also='Building a shared libperl is needed for MAB support.'
7758                                 ;;
7759                         *)      dflt=n
7760                                 ;;
7761                         esac
7762                         ;;
7763                 *)      dflt=n
7764                         ;;
7765                 esac
7766                 ;;
7767         $define|true|[Yy]*)
7768                 dflt=y
7769                 ;;
7770         *)      dflt=n
7771                 ;;
7772         esac
7773         $cat << EOM
7774
7775 The perl executable is normally obtained by linking perlmain.c with
7776 libperl${_a}, any static extensions (usually just DynaLoader), and
7777 any other libraries needed on this system (such as -lm, etc.).  Since
7778 your system supports dynamic loading, it is probably possible to build
7779 a shared libperl.$so.  If you will have more than one executable linked
7780 to libperl.$so, this will significantly reduce the size of each
7781 executable, but it may have a noticeable effect on performance.  The
7782 default is probably sensible for your system.
7783 $also
7784
7785 EOM
7786         rp="Build a shared libperl.$so (y/n)"
7787         . ./myread
7788         case "$ans" in
7789         true|$define|[Yy]*)
7790                 useshrplib='true'  ;;
7791         *)      useshrplib='false' ;;
7792         esac
7793         ;;
7794 esac
7795
7796 case "$useshrplib" in
7797 true)
7798         case "$libperl" in
7799         '')
7800                 # Figure out a good name for libperl.so.  Since it gets stored in
7801                 # a version-specific architecture-dependent library, the version
7802                 # number isn't really that important, except for making cc/ld happy.
7803                 #
7804                 # A name such as libperl.so.3.1
7805                 majmin="libperl.$so.$patchlevel.$subversion"
7806                 # A name such as libperl.so.301
7807                 majonly=`echo $patchlevel $subversion |
7808                         $awk '{printf "%d%02d", $1, $2}'`
7809                 majonly=libperl.$so.$majonly
7810                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7811                 # rely on figuring it out from the naming of libc.
7812                 case "${osname}${osvers}" in
7813                 next4*)
7814                         dflt=libperl.5.$so
7815                         # XXX How handle the --version stuff for MAB?
7816                         ;;
7817                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
7818                         dflt=libperl.$so
7819                         ;;
7820                 cygwin*) # ld links against an importlib
7821                         dflt=libperl$lib_ext
7822                         ;;
7823                 *)      # Try to guess based on whether libc has major.minor.
7824                         case "$libc" in
7825                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7826                         *libc.$so.[0-9]*) dflt=$majonly ;;
7827                         *)      dflt=libperl.$so ;;
7828                         esac
7829                         ;;
7830                 esac
7831                 ;;
7832         *)      dflt=$libperl
7833                 ;;
7834         esac
7835         cat << EOM
7836
7837 I need to select a good name for the shared libperl.  If your system uses
7838 library names with major and minor numbers, then you might want something
7839 like $majmin.  Alternatively, if your system uses a single version
7840 number for shared libraries, then you might want to use $majonly.
7841 Or, your system might be quite happy with a simple libperl.$so.
7842
7843 Since the shared libperl will get installed into a version-specific
7844 architecture-dependent directory, the version number of the shared perl
7845 library probably isn't important, so the default should be o.k.
7846
7847 EOM
7848         rp='What name do you want to give to the shared libperl?'
7849         . ./myread
7850         libperl=$ans
7851         echo "Ok, I'll use $libperl"
7852         ;;
7853 *)
7854         libperl="libperl${_a}"
7855         ;;
7856 esac
7857
7858 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7859 case "$shrpdir" in
7860 '') ;;
7861 *)      $cat >&4 <<EOM
7862 WARNING:  Use of the shrpdir variable for the installation location of
7863 the shared $libperl is not supported.  It was never documented and
7864 will not work in this version.  Let me (perlbug@perl.org)
7865 know of any problems this may cause.
7866
7867 EOM
7868         case "$shrpdir" in
7869         "$archlibexp/CORE")
7870                 $cat >&4 <<EOM
7871 But your current setting of $shrpdir is
7872 the default anyway, so it's harmless.
7873 EOM
7874                 ;;
7875         *)
7876                 $cat >&4 <<EOM
7877 Further, your current attempted setting of $shrpdir
7878 conflicts with the value of $archlibexp/CORE
7879 that installperl will use.
7880 EOM
7881                 ;;
7882         esac
7883         ;;
7884 esac
7885
7886 # How will the perl executable find the installed shared $libperl?
7887 # Add $xxx to ccdlflags.
7888 # If we can't figure out a command-line option, use $shrpenv to
7889 # set env LD_RUN_PATH.  The main perl makefile uses this.
7890 shrpdir=$archlibexp/CORE
7891 xxx=''
7892 tmp_shrpenv=''
7893 if "$useshrplib"; then
7894     case "$osname" in 
7895         aix)
7896                 # We'll set it in Makefile.SH...
7897                 ;;
7898         solaris)
7899                 xxx="-R $shrpdir"
7900                 ;;
7901         freebsd|netbsd|openbsd|interix|dragonfly)
7902                 xxx="-Wl,-R$shrpdir"
7903                 ;;
7904         bsdos|linux|irix*|dec_osf|gnu*)
7905                 xxx="-Wl,-rpath,$shrpdir"
7906                 ;;
7907         next)
7908                 # next doesn't like the default...
7909                 ;;
7910         beos)
7911                 # beos doesn't like the default, either.
7912                 ;;
7913         hpux*)
7914                 # hpux doesn't like the default, either.
7915                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7916                 ;;
7917         *)
7918                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7919                 ;;
7920         esac
7921         case "$xxx" in
7922         '') ;;
7923         *)      
7924                 # Only add $xxx if it isn't already in ccdlflags.
7925                 case " $ccdlflags " in
7926                 *" $xxx "*)     ;;
7927                 *)      ccdlflags="$ccdlflags $xxx"
7928                         cat <<EOM >&4
7929
7930 Adding $xxx to the flags
7931 passed to $ld so that the perl executable will find the 
7932 installed shared $libperl.
7933
7934 EOM
7935                         ;;
7936                 esac
7937                 ;;
7938         esac
7939 fi
7940 # Fix ccdlflags in AIX for building external extensions.
7941 # (For building Perl itself bare -bE:perl.exp is needed,
7942 #  Makefile.SH takes care of this.)
7943 case "$osname" in
7944 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7945 esac
7946 # Respect a hint or command-line value.
7947 case "$shrpenv" in
7948 '') shrpenv="$tmp_shrpenv" ;;
7949 esac
7950 case "$ldlibpthname" in
7951 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7952 none)   ldlibpthname='' ;;
7953 esac
7954
7955 : determine where manual pages are on this system
7956 echo " "
7957 case "$sysman" in
7958 '') 
7959         syspath='/usr/share/man/man1 /usr/man/man1'
7960         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7961         syspath="$syspath /usr/man/u_man/man1"
7962         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7963         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7964         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7965         sysman=`./loc . /usr/man/man1 $syspath`
7966         ;;
7967 esac
7968 if $test -d "$sysman"; then
7969         echo "System manual is in $sysman." >&4
7970 else
7971         echo "Could not find manual pages in source form." >&4
7972 fi
7973
7974 : determine where manual pages go
7975 set man1dir man1dir none
7976 eval $prefixit
7977 $cat <<EOM
7978
7979 $spackage has manual pages available in source form.
7980 EOM
7981 case "$nroff" in
7982 nroff)
7983         echo "However, you don't have nroff, so they're probably useless to you."
7984         case "$man1dir" in
7985         '') man1dir="none";;
7986         esac;;
7987 esac
7988 echo "If you don't want the manual sources installed, answer 'none'."
7989 case "$man1dir" in
7990 ' ') dflt=none
7991         ;;
7992 '')
7993         lookpath="$prefixexp/share/man/man1"
7994         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
7995         lookpath="$lookpath $prefixexp/man/p_man/man1"
7996         lookpath="$lookpath $prefixexp/man/u_man/man1"
7997         lookpath="$lookpath $prefixexp/man/man.1"
7998         case "$sysman" in
7999         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8000         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8001         esac
8002         set dflt
8003         eval $prefixup
8004         ;;
8005 *)  dflt="$man1dir"
8006         ;;
8007 esac
8008 echo " "
8009 fn=dn+~
8010 rp="Where do the main $spackage manual pages (source) go?"
8011 . ./getfile
8012 if $test "X$man1direxp" != "X$ansexp"; then
8013         installman1dir=''
8014 fi
8015 man1dir="$ans"
8016 man1direxp="$ansexp"
8017 case "$man1dir" in
8018 '')     man1dir=' '
8019         installman1dir='';;
8020 esac
8021
8022 : Change installation prefix, if necessary.
8023 if $test X"$prefix" != X"$installprefix"; then
8024         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
8025 else
8026         installman1dir="$man1direxp"
8027 fi
8028
8029 : What suffix to use on installed man pages
8030
8031 case "$man1dir" in
8032 ' ')
8033         man1ext='0'
8034         ;;
8035 *)
8036         rp="What suffix should be used for the main $spackage man pages?"
8037         case "$man1ext" in
8038         '')     case "$man1dir" in
8039                 *1)  dflt=1 ;;
8040                 *1p) dflt=1p ;;
8041                 *1pm) dflt=1pm ;;
8042                 *l) dflt=l;;
8043                 *n) dflt=n;;
8044                 *o) dflt=o;;
8045                 *p) dflt=p;;
8046                 *C) dflt=C;;
8047                 *L) dflt=L;;
8048                 *L1) dflt=L1;;
8049                 *) dflt=1;;
8050                 esac
8051                 ;;
8052         *)      dflt="$man1ext";;
8053         esac
8054         . ./myread
8055         man1ext="$ans"
8056         ;;
8057 esac
8058
8059 : see if we can have long filenames
8060 echo " "
8061 first=123456789abcdef
8062 $rm -f $first
8063 if (echo hi >$first) 2>/dev/null; then
8064         if $test -f 123456789abcde; then
8065                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8066                 val="$undef"
8067         else
8068                 echo 'You can have filenames longer than 14 characters.'>&4
8069                 val="$define"
8070         fi
8071 else
8072         $cat <<'EOM'
8073 You can't have filenames longer than 14 chars.
8074 You can't even think about them!
8075 EOM
8076         val="$undef"
8077 fi 
8078 set d_flexfnam
8079 eval $setvar
8080 $rm -rf 123456789abcde*
8081
8082 : determine where library module manual pages go
8083 set man3dir man3dir none
8084 eval $prefixit
8085 $cat <<EOM
8086
8087 $spackage has manual pages for many of the library modules.
8088 EOM
8089
8090 case "$nroff" in
8091 nroff)
8092         $cat <<'EOM'
8093 However, you don't have nroff, so they're probably useless to you.
8094 EOM
8095         case "$man3dir" in
8096         '') man3dir="none";;
8097         esac;;
8098 esac
8099
8100 case "$d_flexfnam" in
8101 undef)
8102         $cat <<'EOM'
8103 However, your system can't handle the long file names like File::Basename.3. 
8104 EOM
8105         case "$man3dir" in
8106         '') man3dir="none";;
8107         esac;;
8108 esac
8109
8110 echo "If you don't want the manual sources installed, answer 'none'."
8111 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8112 case "$man3dir" in
8113 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8114         if $test -d "$privlib/man/man3"; then
8115                 cat <<EOM >&4
8116
8117 WARNING:  Previous versions of perl installed man3 pages into
8118 $privlib/man/man3.  This version will suggest a 
8119 new default of $dflt.  
8120 EOM
8121                 tdflt=$dflt
8122                 dflt='n'
8123                 rp='Do you wish to preserve the old behavior?(y/n)'
8124                 . ./myread
8125                 case "$ans" in
8126                 y*) dflt="$privlib/man/man3" ;;
8127                 *)  dflt=$tdflt ;;
8128                 esac
8129     fi
8130         ;;
8131 *)      dflt="$man3dir" ;;
8132 esac
8133 case "$dflt" in
8134 ' ') dflt=none ;;
8135 esac
8136 echo " "
8137 fn=dn+~
8138 rp="Where do the $package library man pages (source) go?"
8139 . ./getfile
8140 man3dir="$ans"
8141 man3direxp="$ansexp"
8142 case "$man3dir" in
8143 '')     man3dir=' '
8144         installman3dir='';;
8145 esac
8146
8147 : Change installation prefix, if necessary.
8148 if $test X"$prefix" != X"$installprefix"; then
8149         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8150 else
8151         installman3dir="$man3direxp"
8152 fi
8153
8154 : What suffix to use on installed man pages
8155 case "$man3dir" in
8156 ' ')
8157         man3ext='0'
8158         ;;
8159 *)
8160         rp="What suffix should be used for the $package library man pages?"
8161         case "$man3ext" in
8162         '')     case "$man3dir" in
8163                 *3)  dflt=3 ;;
8164                 *3p) dflt=3p ;;
8165                 *3pm) dflt=3pm ;;
8166                 *l) dflt=l;;
8167                 *n) dflt=n;;
8168                 *o) dflt=o;;
8169                 *p) dflt=p;;
8170                 *C) dflt=C;;
8171                 *L) dflt=L;;
8172                 *L3) dflt=L3;;
8173                 *) dflt=3;;
8174                 esac
8175                 ;;
8176         *)      dflt="$man3ext";;
8177         esac
8178         . ./myread
8179         man3ext="$ans"
8180         ;;
8181 esac
8182
8183 : see if we have to deal with yellow pages, now NIS.
8184 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8185         if $test -f /usr/etc/nibindd; then
8186                 echo " "
8187                 echo "I'm fairly confident you're on a NeXT."
8188                 echo " "
8189                 rp='Do you get the hosts file via NetInfo?'
8190                 dflt=y
8191                 case "$hostcat" in
8192                 nidump*) ;;
8193                 '') ;;
8194                 *) dflt=n;;
8195                 esac
8196                 . ./myread
8197                 case "$ans" in
8198                 y*) hostcat='nidump hosts .';;
8199                 *)      case "$hostcat" in
8200                         nidump*) hostcat='';;
8201                         esac
8202                         ;;
8203                 esac
8204         fi
8205         case "$hostcat" in
8206         nidump*) ;;
8207         *)
8208                 case "$hostcat" in
8209                 *ypcat*) dflt=y;;
8210                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8211                                 dflt=y
8212                         else
8213                                 dflt=n
8214                         fi;;
8215                 *) dflt=n;;
8216                 esac
8217                 echo " "
8218                 rp='Are you getting the hosts file via yellow pages?'
8219                 . ./myread
8220                 case "$ans" in
8221                 y*) hostcat='ypcat hosts';;
8222                 *) hostcat='cat /etc/hosts';;
8223                 esac
8224                 ;;
8225         esac
8226 fi
8227 case "$hostcat" in
8228 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8229 esac
8230 case "$groupcat" in
8231 '') test -f /etc/group && groupcat='cat /etc/group';;
8232 esac
8233 case "$passcat" in
8234 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8235 esac
8236
8237 : now get the host name
8238 echo " "
8239 echo "Figuring out host name..." >&4
8240 case "$myhostname" in
8241 '') cont=true
8242         echo 'Maybe "hostname" will work...'
8243         if tans=`sh -c hostname 2>&1` ; then
8244                 myhostname=$tans
8245                 phostname=hostname
8246                 cont=''
8247         fi
8248         ;;
8249 *) cont='';;
8250 esac
8251 if $test "$cont"; then
8252         if ./xenix; then
8253                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8254                 if tans=`cat /etc/systemid 2>&1` ; then
8255                         myhostname=$tans
8256                         phostname='cat /etc/systemid'
8257                         echo "Whadyaknow.  Xenix always was a bit strange..."
8258                         cont=''
8259                 fi
8260         elif $test -r /etc/systemid; then
8261                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8262         fi
8263 fi
8264 if $test "$cont"; then
8265         echo 'No, maybe "uuname -l" will work...'
8266         if tans=`sh -c 'uuname -l' 2>&1` ; then
8267                 myhostname=$tans
8268                 phostname='uuname -l'
8269         else
8270                 echo 'Strange.  Maybe "uname -n" will work...'
8271                 if tans=`sh -c 'uname -n' 2>&1` ; then
8272                         myhostname=$tans
8273                         phostname='uname -n'
8274                 else
8275                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8276                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8277                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8278                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8279                         else
8280                                 case "$myhostname" in
8281                                 '') echo "Does this machine have an identity crisis or something?"
8282                                         phostname='';;
8283                                 *)
8284                                         echo "Well, you said $myhostname before..."
8285                                         phostname='echo $myhostname';;
8286                                 esac
8287                         fi
8288                 fi
8289         fi
8290 fi
8291 case "$myhostname" in
8292 '') myhostname=noname ;;
8293 esac
8294 : you do not want to know about this
8295 set $myhostname
8296 myhostname=$1
8297
8298 : verify guess
8299 if $test "$myhostname" ; then
8300         dflt=y
8301         rp='Your host name appears to be "'$myhostname'".'" Right?"
8302         . ./myread
8303         case "$ans" in
8304         y*) ;;
8305         *) myhostname='';;
8306         esac
8307 fi
8308
8309 : bad guess or no guess
8310 while $test "X$myhostname" = X ; do
8311         dflt=''
8312         rp="Please type the (one word) name of your host:"
8313         . ./myread
8314         myhostname="$ans"
8315 done
8316
8317 : translate upper to lower if necessary
8318 case "$myhostname" in
8319 *[A-Z]*)
8320         echo "(Normalizing case in your host name)"
8321         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8322         ;;
8323 esac
8324
8325 case "$myhostname" in
8326 *.*)
8327         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8328         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8329         echo "(Trimming domain name from host name--host name is now $myhostname)"
8330         ;;
8331 *) case "$mydomain" in
8332         '')
8333                 {
8334                         test "X$hostcat" = "Xypcat hosts" &&
8335                         ypmatch "$myhostname" hosts 2>/dev/null |\
8336                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8337                         $test -s hosts
8338                 } || {
8339                         test "X$hostcat" != "X" &&
8340                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8341                                         /[       ]$myhostname[  . ]/p" > hosts
8342                 }
8343                 tmp_re="[       . ]"
8344                 if $test -f hosts; then
8345                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8346                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8347                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8348                                 hosts | $sort | $uniq | \
8349                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8350                         case `$echo X$dflt` in
8351                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8352                                 dflt=.
8353                                 ;;
8354                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8355                                 ;;
8356                         esac
8357                 else
8358                         echo "(I cannot locate a hosts database anywhere)"
8359                         dflt=.
8360                 fi
8361                 case "$dflt" in
8362                 .)
8363                         tans=`./loc resolv.conf X /etc /usr/etc`
8364                         if $test -f "$tans"; then
8365                                 echo "(Attempting domain name extraction from $tans)"
8366                                 dflt=.`$sed -n -e 's/   / /g' \
8367                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8368                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8369                                 case "$dflt" in
8370                                 .) dflt=.`$sed -n -e 's/        / /g' \
8371                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8372                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8373                                         ;;
8374                                 esac
8375                         fi
8376                         ;;
8377                 esac
8378                 case "$dflt" in
8379                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8380                         dflt=.`sh -c domainname 2>/dev/null`
8381                         case "$dflt" in
8382                         '') dflt='.';;
8383                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8384                         esac
8385                         ;;
8386                 esac
8387                 case "$dflt$osname" in
8388                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8389                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8390                         ;;
8391                 esac
8392                 case "$dflt" in
8393                 .) echo "(Lost all hope -- silly guess then)"
8394                         dflt='.nonet'
8395                         ;;
8396                 esac
8397                 $rm -f hosts
8398                 ;;
8399         *) dflt="$mydomain";;
8400         esac;;
8401 esac
8402 echo " "
8403 rp="What is your domain name?"
8404 . ./myread
8405 tans="$ans"
8406 case "$ans" in
8407 '') ;;
8408 .*) ;;
8409 *) tans=".$tans";;
8410 esac
8411 mydomain="$tans"
8412
8413 : translate upper to lower if necessary
8414 case "$mydomain" in
8415 *[A-Z]*)
8416         echo "(Normalizing case in your domain name)"
8417         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8418         ;;
8419 esac
8420
8421 : a little sanity check here
8422 case "$phostname" in
8423 '') ;;
8424 *)
8425         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8426         $myhostname$mydomain|$myhostname) ;;
8427         *)
8428                 case "$phostname" in
8429                 sed*)
8430                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8431                         ;;
8432                 *)
8433                         echo "(That doesn't agree with your $phostname command, by the way.)"
8434                         ;;
8435                 esac
8436         ;;
8437         esac
8438         ;;
8439 esac
8440
8441 $cat <<EOM
8442
8443 I need to get your e-mail address in Internet format if possible, i.e.
8444 something like user@host.domain. Please answer accurately since I have
8445 no easy means to double check it. The default value provided below
8446 is most probably close to reality but may not be valid from outside
8447 your organization...
8448
8449 EOM
8450 cont=x
8451 while test "$cont"; do
8452         case "$cf_email" in
8453         '') dflt="$cf_by@$myhostname$mydomain";;
8454         *) dflt="$cf_email";;
8455         esac
8456         rp='What is your e-mail address?'
8457         . ./myread
8458         cf_email="$ans"
8459         case "$cf_email" in
8460         *@*.*) cont='' ;;
8461         *)
8462                 rp='Address does not look like an Internet one.  Use it anyway?'
8463                 case "$fastread" in
8464                 yes) dflt=y ;;
8465                 *) dflt=n ;;
8466                 esac
8467                 . ./myread
8468                 case "$ans" in
8469                 y*) cont='' ;;
8470                 *) echo " " ;;
8471                 esac
8472                 ;;
8473         esac
8474 done
8475
8476 $cat <<EOM
8477
8478 If you or somebody else will be maintaining perl at your site, please
8479 fill in the correct e-mail address here so that they may be contacted
8480 if necessary. Currently, the "perlbug" program included with perl
8481 will send mail to this address in addition to perlbug@perl.org. You may
8482 enter "none" for no administrator.
8483
8484 EOM
8485 case "$perladmin" in
8486 '') dflt="$cf_email";;
8487 *) dflt="$perladmin";;
8488 esac
8489 rp='Perl administrator e-mail address'
8490 . ./myread
8491 perladmin="$ans"
8492
8493 : determine whether to only install version-specific parts.
8494 echo " "
8495 $cat <<EOM
8496 Do you want to install only the version-specific parts of the perl
8497 distribution?  Usually you do *not* want to do this.
8498 EOM
8499 case "$versiononly" in
8500 "$define"|[Yy]*|true) dflt='y' ;;
8501 *) dflt='n';
8502 esac
8503 rp="Do you want to install only the version-specific parts of perl?"
8504 . ./myread
8505 case "$ans" in
8506 [yY]*)  val="$define";;
8507 *)      val="$undef" ;;
8508 esac
8509 set versiononly
8510 eval $setvar
8511
8512 case "$versiononly" in
8513 "$define") inc_version_list=''
8514            inc_version_list_init=0
8515            ;;
8516 esac
8517
8518 : figure out how to guarantee perl startup
8519 case "$startperl" in
8520 '')
8521         case "$sharpbang" in
8522         *!)
8523                 $cat <<EOH
8524
8525 I can use the #! construct to start perl on your system. This will
8526 make startup of perl scripts faster, but may cause problems if you
8527 want to share those scripts and perl is not in a standard place
8528 ($binexp/perl) on all your platforms. The alternative is to force
8529 a shell by starting the script with a single ':' character.
8530
8531 EOH
8532                 case "$versiononly" in
8533                 "$define")      dflt="$binexp/perl$version";;  
8534                 *)              dflt="$binexp/perl";;
8535                 esac
8536                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8537                 . ./myread
8538                 case "$ans" in
8539                 none)   startperl=": # use perl";;
8540                 *)      startperl="#!$ans"
8541                         if $test 30 -lt `echo "$ans" | wc -c`; then
8542                                 $cat >&4 <<EOM
8543
8544 WARNING:  Some systems limit the #! command to 32 characters.
8545 If you experience difficulty running Perl scripts with #!, try
8546 installing Perl in a directory with a shorter pathname.
8547
8548 EOM
8549                         fi ;;
8550                 esac
8551                 ;;
8552         *) startperl=": # use perl"
8553                 ;;
8554         esac
8555         ;;
8556 esac
8557 echo "I'll use $startperl to start perl scripts."
8558
8559 : figure best path for perl in scripts
8560 case "$perlpath" in
8561 '')
8562         case "$versiononly" in
8563         "$define")      perlpath="$binexp/perl$version";;
8564         *)              perlpath="$binexp/perl";;
8565         esac
8566         case "$startperl" in
8567         *!*) ;;
8568         *)
8569                 $cat <<EOH
8570
8571 I will use the "eval 'exec'" idiom to start Perl on your system.
8572 I can use the full path of your Perl binary for this purpose, but
8573 doing so may cause problems if you want to share those scripts and
8574 Perl is not always in a standard place ($binexp/perl).
8575
8576 EOH
8577                 dflt="$binexp/perl"
8578                 rp="What path shall I use in \"eval 'exec'\"?"
8579                 . ./myread
8580                 perlpath="$ans"
8581                 ;;
8582         esac
8583         ;;
8584 esac
8585 case "$startperl" in
8586 *!*)    ;;
8587 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8588 esac
8589
8590 : determine where public executable scripts go
8591 set scriptdir scriptdir
8592 eval $prefixit
8593 case "$scriptdir" in
8594 '')
8595         dflt="$bin"
8596         : guess some guesses
8597         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8598         $test -d /usr/share/bin     && dflt=/usr/share/bin
8599         $test -d /usr/local/script  && dflt=/usr/local/script
8600         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8601         $test -d $prefixexp/script  && dflt=$prefixexp/script
8602         set dflt
8603         eval $prefixup
8604         ;;
8605 *)  dflt="$scriptdir"
8606         ;;
8607 esac
8608 $cat <<EOM
8609  
8610 Some installations have a separate directory just for executable scripts so
8611 that they can mount it across multiple architectures but keep the scripts in
8612 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8613 Or you might just lump your scripts in with all your other executables.
8614  
8615 EOM
8616 fn=d~
8617 rp='Where do you keep publicly executable scripts?'
8618 . ./getfile
8619 if $test "X$ansexp" != "X$scriptdirexp"; then
8620         installscript=''
8621 fi
8622 scriptdir="$ans"
8623 scriptdirexp="$ansexp"
8624 : Change installation prefix, if necessary.
8625 if $test X"$prefix" != X"$installprefix"; then
8626         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8627 else
8628         installscript="$scriptdirexp"
8629 fi
8630
8631 : determine where add-on public executables go
8632 case "$sitebin" in
8633 '')     dflt=$siteprefix/bin ;;
8634 *)      dflt=$sitebin ;;
8635 esac
8636 fn=d~
8637 rp='Pathname where the add-on public executables should be installed?'
8638 . ./getfile
8639 sitebin="$ans"
8640 sitebinexp="$ansexp"
8641 : Change installation prefix, if necessary.
8642 if $test X"$prefix" != X"$installprefix"; then
8643         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8644 else
8645         installsitebin="$sitebinexp"
8646 fi
8647
8648 : determine where add-on html pages go
8649 : There is no standard location, so try to copy the previously-selected
8650 : directory structure for the core html pages.
8651 case "$sitehtml1dir" in
8652 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8653 *)     dflt=$sitehtml1dir ;;
8654 esac
8655 case "$dflt" in
8656 ''|' ') dflt=none ;;
8657 esac
8658 fn=dn+~
8659 rp='Pathname where the site-specific html pages should be installed?'
8660 . ./getfile
8661 sitehtml1dir="$ans"
8662 sitehtml1direxp="$ansexp"
8663 : Change installation prefix, if necessary.
8664 if $test X"$prefix" != X"$installprefix"; then
8665         installsitehtml1dir=`echo $sitehtml1direxp | $sed "s#^$prefix#$installprefix#"`
8666 else
8667         installsitehtml1dir="$sitehtml1direxp"
8668 fi
8669
8670 : determine where add-on library html pages go
8671 : There is no standard location, so try to copy the previously-selected
8672 : directory structure for the core html pages.
8673 case "$sitehtml3dir" in
8674 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8675 *)     dflt=$sitehtml3dir ;;
8676 esac
8677 case "$dflt" in
8678 ''|' ') dflt=none ;;
8679 esac
8680 fn=dn+~
8681 rp='Pathname where the site-specific library html pages should be installed?'
8682 . ./getfile
8683 sitehtml3dir="$ans"
8684 sitehtml3direxp="$ansexp"
8685 : Change installation prefix, if necessary.
8686 if $test X"$prefix" != X"$installprefix"; then
8687         installsitehtml3dir=`echo $sitehtml3direxp | $sed "s#^$prefix#$installprefix#"`
8688 else
8689         installsitehtml3dir="$sitehtml3direxp"
8690 fi
8691
8692 : determine where add-on manual pages go
8693 case "$siteman1dir" in
8694 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8695 *)      dflt=$siteman1dir ;;
8696 esac
8697 case "$dflt" in
8698 ''|' ') dflt=none ;;
8699 esac
8700 fn=dn+~
8701 rp='Pathname where the site-specific manual pages should be installed?'
8702 . ./getfile
8703 siteman1dir="$ans"
8704 siteman1direxp="$ansexp"
8705 : Change installation prefix, if necessary.
8706 if $test X"$prefix" != X"$installprefix"; then
8707         installsiteman1dir=`echo $siteman1direxp | $sed "s#^$prefix#$installprefix#"`
8708 else
8709         installsiteman1dir="$siteman1direxp"
8710 fi
8711
8712 : determine where add-on library man pages go
8713 case "$siteman3dir" in
8714 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8715 *)      dflt=$siteman3dir ;;
8716 esac
8717 case "$dflt" in
8718 ''|' ') dflt=none ;;
8719 esac
8720 fn=dn+~
8721 rp='Pathname where the site-specific library manual pages should be installed?'
8722 . ./getfile
8723 siteman3dir="$ans"
8724 siteman3direxp="$ansexp"
8725 : Change installation prefix, if necessary.
8726 if $test X"$prefix" != X"$installprefix"; then
8727         installsiteman3dir=`echo $siteman3direxp | $sed "s#^$prefix#$installprefix#"`
8728 else
8729         installsiteman3dir="$siteman3direxp"
8730 fi
8731
8732 : determine where add-on public executable scripts go
8733 case "$sitescript" in
8734 '')     dflt=$siteprefix/script
8735         $test -d $dflt || dflt=$sitebin ;;
8736 *)  dflt="$sitescript" ;;
8737 esac
8738 fn=d~+
8739 rp='Pathname where add-on public executable scripts should be installed?'
8740 . ./getfile
8741 sitescript="$ans"
8742 sitescriptexp="$ansexp"
8743 : Change installation prefix, if necessary.
8744 if $test X"$prefix" != X"$installprefix"; then
8745         installsitescript=`echo $sitescriptexp | sed "s#^$prefix#$installprefix#"`
8746 else
8747         installsitescript="$sitescriptexp"
8748 fi
8749
8750 case "$usefaststdio" in
8751 $define|true|[yY]*|'')
8752         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8753         case "$xversion" in
8754         [68])   dflt='y' ;;
8755         *)      dflt='n' ;;
8756         esac
8757         ;;
8758 *) dflt='n';;
8759 esac
8760 cat <<EOM
8761
8762 Perl can be built to use 'fast stdio', which means using the stdio
8763 library but also directly manipulating the stdio buffers to enable
8764 faster I/O.  Using stdio is better for backward compatibility (especially
8765 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8766 interface has been preferred instead of stdio.
8767
8768 If this doesn't make any sense to you, just accept the default '$dflt'.
8769 EOM
8770 rp='Use the "fast stdio" if available?'
8771 . ./myread
8772 case "$ans" in
8773 y|Y)    val="$define" ;;     
8774 *)      val="$undef" ;;
8775 esac
8776 set usefaststdio
8777 eval $setvar
8778
8779
8780 : define an is-a-typedef? function
8781 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8782 case "$inclist" in
8783 "") inclist="sys/types.h";;
8784 esac;
8785 eval "varval=\$$var";
8786 case "$varval" in
8787 "")
8788         $rm -f temp.c;
8789         for inc in $inclist; do
8790                 echo "#include <$inc>" >>temp.c;
8791         done;
8792         echo "#ifdef $type" >> temp.c;
8793         echo "printf(\"We have $type\");" >> temp.c;
8794         echo "#endif" >> temp.c;
8795         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8796         if $contains $type temp.E >/dev/null 2>&1; then
8797                 eval "$var=\$type";
8798         else
8799                 eval "$var=\$def";
8800         fi;
8801         $rm -f temp.?;;
8802 *) eval "$var=\$varval";;
8803 esac'
8804
8805 : define an is-a-typedef? function that prompts if the type is not available.
8806 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8807 case "$inclist" in
8808 "") inclist="sys/types.h";;
8809 esac;
8810 eval "varval=\$$var";
8811 case "$varval" in
8812 "")
8813         $rm -f temp.c;
8814         for inc in $inclist; do
8815                 echo "#include <$inc>" >>temp.c;
8816         done;
8817         echo "#ifdef $type" >> temp.c;
8818         echo "printf(\"We have $type\");" >> temp.c;
8819         echo "#endif" >> temp.c;
8820         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8821         echo " " ;
8822         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8823         if $contains $type temp.E >/dev/null 2>&1; then
8824                 echo "$type found." >&4;
8825                 eval "$var=\$type";
8826         else
8827                 echo "$type NOT found." >&4;
8828                 dflt="$def";
8829                 . ./myread ;
8830                 eval "$var=\$ans";
8831         fi;
8832         $rm -f temp.?;;
8833 *) eval "$var=\$varval";;
8834 esac'
8835
8836 : see what type lseek is declared as in the kernel
8837 rp="What is the type used for lseek's offset on this system?"
8838 set off_t lseektype long stdio.h sys/types.h
8839 eval $typedef_ask
8840
8841 echo " "
8842 echo "Checking to see how big your file offsets are..." >&4
8843 $cat >try.c <<EOCP
8844 #include <sys/types.h>
8845 #include <stdio.h>
8846 int main()
8847 {
8848     printf("%d\n", (int)sizeof($lseektype));
8849     return(0); 
8850 }
8851 EOCP
8852 set try
8853 if eval $compile_ok; then
8854         lseeksize=`$run ./try`
8855         echo "Your file offsets are $lseeksize bytes long."
8856 else
8857         dflt=$longsize
8858         echo " "
8859         echo "(I can't seem to compile the test program.  Guessing...)"
8860         rp="What is the size of your file offsets (in bytes)?"
8861         . ./myread
8862         lseeksize="$ans"
8863 fi
8864 $rm -f try.c try
8865
8866 : see what type file positions are declared as in the library
8867 rp="What is the type for file position used by fsetpos()?"
8868 set fpos_t fpostype long stdio.h sys/types.h
8869 eval $typedef_ask
8870
8871 echo " "
8872 case "$fpostype" in
8873 *_t) zzz="$fpostype"    ;;
8874 *)   zzz="fpos_t"       ;;
8875 esac
8876 echo "Checking the size of $zzz..." >&4 
8877 cat > try.c <<EOCP
8878 #include <sys/types.h>
8879 #include <stdio.h>
8880 #$i_stdlib I_STDLIB
8881 #ifdef I_STDLIB
8882 #include <stdlib.h>
8883 #endif
8884 int main() {
8885     printf("%d\n", (int)sizeof($fpostype));
8886     exit(0);
8887 }
8888 EOCP
8889 set try
8890 if eval $compile_ok; then
8891         yyy=`$run ./try`
8892         case "$yyy" in
8893         '')     fpossize=4
8894                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8895                 ;;
8896         *)      fpossize=$yyy
8897                 echo "Your $zzz is $fpossize bytes long."
8898                 ;;
8899         esac
8900 else
8901         dflt="$longsize"
8902         echo " " >&4
8903         echo "(I can't compile the test program.  Guessing...)" >&4
8904         rp="What is the size of your file positions (in bytes)?"
8905         . ./myread
8906         fpossize="$ans"
8907 fi
8908
8909 # Backward compatibility (uselfs is deprecated).
8910 case "$uselfs" in
8911 "$define"|true|[yY]*)
8912         cat <<EOM >&4
8913
8914 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8915 EOM
8916         uselargefiles="$define"
8917         ;;
8918 esac                          
8919
8920 case "$lseeksize:$fpossize" in
8921 8:8) cat <<EOM
8922
8923 You can have files larger than 2 gigabytes.
8924 EOM
8925    val="$define" ;;
8926 *)    case "$uselargefiles" in
8927    "$undef"|false|[nN]*) dflt='n' ;;
8928    *)   dflt='y' ;;
8929    esac
8930    cat <<EOM
8931
8932 Perl can be built to understand large files (files larger than 2 gigabytes)
8933 on some systems.  To do so, Configure can be run with -Duselargefiles.
8934
8935 If this doesn't make any sense to you, just accept the default '$dflt'.
8936 EOM
8937    rp='Try to understand large files, if available?'
8938    . ./myread
8939    case "$ans" in
8940    y|Y)         val="$define" ;;
8941    *)           val="$undef"  ;;
8942    esac
8943    ;;
8944 esac
8945 set uselargefiles
8946 eval $setvar
8947 : Look for a hint-file generated 'call-back-unit'.  If the
8948 : user has specified that a large files perl is to be built,
8949 : we may need to set or change some other defaults.
8950 if $test -f uselargefiles.cbu; then
8951         echo "Your platform has some specific hints regarding large file builds, using them..."
8952         . ./uselargefiles.cbu
8953 fi
8954 case "$uselargefiles" in
8955 "$define")
8956         if $test -f uselargefiles.cbu; then
8957                 echo " "
8958                 echo "Rechecking to see how big your file offsets are..." >&4
8959                 $cat >try.c <<EOCP
8960 #include <sys/types.h>
8961 #include <stdio.h>
8962 int main()
8963 {
8964     printf("%d\n", (int)sizeof($lseektype));
8965     return(0); 
8966 }
8967 EOCP
8968                 set try
8969                 if eval $compile_ok; then
8970                         lseeksize=`$run ./try`
8971                         $echo "Your file offsets are now $lseeksize bytes long."
8972                 else
8973                         dflt="$lseeksize"
8974                         echo " "
8975                         echo "(I can't seem to compile the test program.  Guessing...)"
8976                         rp="What is the size of your file offsets (in bytes)?"
8977                         . ./myread
8978                         lseeksize="$ans"
8979                 fi
8980                 case "$fpostype" in
8981                 *_t) zzz="$fpostype"    ;;
8982                 *)   zzz="fpos_t"       ;;
8983                 esac
8984                 $echo $n "Rechecking the size of $zzz...$c" >&4 
8985                 $cat > try.c <<EOCP
8986 #include <sys/types.h>
8987 #include <stdio.h>
8988 #$i_stdlib I_STDLIB
8989 #ifdef I_STDLIB
8990 #include <stdlib.h>
8991 #endif
8992 int main() {
8993     printf("%d\n", (int)sizeof($fpostype));
8994     return(0);
8995 }
8996 EOCP
8997                 set try
8998                 if eval $compile_ok; then
8999                         yyy=`$run ./try`
9000                         dflt="$lseeksize"
9001                         case "$yyy" in
9002                         '')     echo " "
9003                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9004                                 ;;
9005                         *)      fpossize=$yyy
9006                                 echo " $fpossize bytes." >&4
9007                                 ;;
9008                         esac
9009                 else
9010                         dflt="$fpossize"
9011                         echo " "
9012                         echo "(I can't compile the test program.  Guessing...)" >&4
9013                         rp="What is the size of your file positions (in bytes)?"
9014                         . ./myread
9015                         fpossize="$ans"
9016                 fi
9017                 $rm -f try.c try
9018         fi
9019         ;;
9020 esac
9021
9022 # probably will refer to
9023 #   $archlib $privlib $sitearch $sitelib $vendorarch $vendorlib
9024 need_relocation=0
9025 userelocatableinc=undef
9026
9027 case "$vendorprefix" in
9028 '')     d_vendorbin="$undef"
9029         vendorbin=''
9030         vendorbinexp=''
9031         ;;
9032 *)      d_vendorbin="$define"
9033         : determine where vendor-supplied executables go.
9034         case "$vendorbin" in
9035         '') dflt=$vendorprefix/bin ;;
9036         *)      dflt="$vendorbin" ;;
9037         esac
9038         fn=d~+
9039         rp='Pathname for the vendor-supplied executables directory?'
9040         . ./getfile
9041         vendorbin="$ans"
9042         vendorbinexp="$ansexp"
9043         ;;
9044 esac
9045 : Change installation prefix, if necessary.
9046 if $test X"$prefix" != X"$installprefix"; then
9047         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
9048 else
9049         installvendorbin="$vendorbinexp"
9050 fi
9051
9052 case "$vendorprefix" in
9053 '')     vendorhtml1dir=''
9054         vendorhtml1direxp=''
9055         ;;
9056 *)      : determine where vendor-supplied html pages go.
9057         : There is no standard location, so try to copy the previously-selected
9058         : directory structure for the core html pages.
9059         : XXX Better default suggestions would be welcome.
9060         case "$vendorhtml1dir" in
9061         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9062         *)      dflt=$vendorhtml1dir ;;
9063         esac
9064         case "$dflt" in
9065         ''|' ') dflt=none ;;
9066         esac
9067         fn=dn+~
9068         rp='Pathname for the vendor-supplied html pages?'
9069         . ./getfile
9070         vendorhtml1dir="$ans"
9071         vendorhtml1direxp="$ansexp"
9072         ;;
9073 esac
9074 : Use ' ' for none so value is preserved next time through Configure
9075 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9076 : Change installation prefix, if necessary.
9077 if $test X"$prefix" != X"$installprefix"; then
9078         installvendorhtml1dir=`echo $vendorhtml1direxp | $sed "s#^$prefix#$installprefix#"`
9079 else
9080         installvendorhtml1dir="$vendorhtml1direxp"
9081 fi
9082
9083 case "$vendorprefix" in
9084 '')     vendorhtml3dir=''
9085         vendorhtml3direxp=''
9086         ;;
9087 *)      : determine where vendor-supplied module html pages go.
9088         : There is no standard location, so try to copy the previously-selected
9089         : directory structure for the core html pages.
9090         : XXX Better default suggestions would be welcome.
9091         case "$vendorhtml3dir" in
9092         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9093         *)      dflt=$vendorhtml3dir ;;
9094         esac
9095         case "$dflt" in
9096         ''|' ') dflt=none ;;
9097         esac
9098         fn=dn+~
9099         rp='Pathname for the vendor-supplied html pages?'
9100         . ./getfile
9101         vendorhtml3dir="$ans"
9102         vendorhtml3direxp="$ansexp"
9103         ;;
9104 esac
9105 : Use ' ' for none so value is preserved next time through Configure
9106 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9107 : Change installation prefix, if necessary.
9108 if $test X"$prefix" != X"$installprefix"; then
9109         installvendorhtml3dir=`echo $vendorhtml3direxp | $sed "s#^$prefix#$installprefix#"`
9110 else
9111         installvendorhtml3dir="$vendorhtml3direxp"
9112 fi
9113
9114 case "$vendorprefix" in
9115 '')     vendorman1dir=''
9116         vendorman1direxp=''
9117         ;;
9118 *)      : determine where vendor-supplied manual pages go.
9119         case "$vendorman1dir" in
9120         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9121         *)      dflt=$vendorman1dir ;;
9122         esac
9123         case "$dflt" in
9124         ''|' ') dflt=none ;;
9125         esac
9126         fn=nd~+
9127         rp='Pathname for the vendor-supplied manual section 1 pages?'
9128         . ./getfile
9129         vendorman1dir="$ans"
9130         vendorman1direxp="$ansexp"
9131         ;;
9132 esac
9133 : Use ' ' for none so value is preserved next time through Configure
9134 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9135 : Change installation prefix, if necessary.
9136 if $test X"$prefix" != X"$installprefix"; then
9137         installvendorman1dir=`echo "$vendorman1direxp" | $sed "s#^$prefix#$installprefix#"`
9138 else
9139         installvendorman1dir="$vendorman1direxp"
9140 fi
9141
9142 case "$vendorprefix" in
9143 '')     vendorman3dir=''
9144         vendorman3direxp=''
9145         ;;
9146 *)      : determine where vendor-supplied module manual pages go.
9147         case "$vendorman3dir" in
9148         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9149         *)      dflt=$vendorman3dir ;;
9150         esac
9151         case "$dflt" in
9152         ''|' ') dflt=none ;;
9153         esac
9154         fn=nd~+
9155         rp='Pathname for the vendor-supplied manual section 3 pages?'
9156         . ./getfile
9157         vendorman3dir="$ans"
9158         vendorman3direxp="$ansexp"
9159         ;;
9160 esac
9161 : Use ' ' for none so value is preserved next time through Configure
9162 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9163 : Change installation prefix, if necessary.
9164 if $test X"$prefix" != X"$installprefix"; then
9165         installvendorman3dir=`echo "$vendorman3direxp" | $sed "s#^$prefix#$installprefix#"`
9166 else
9167         installvendorman3dir="$vendorman3direxp"
9168 fi
9169
9170 case "$vendorprefix" in
9171 '')     d_vendorscript="$undef"
9172         vendorscript=''
9173         vendorscriptexp=''
9174         ;;
9175 *)      d_vendorscript="$define"
9176         : determine where vendor-supplied scripts go.
9177         case "$vendorscript" in
9178         '')     dflt=$vendorprefix/script
9179                 $test -d $dflt || dflt=$vendorbin ;;
9180         *)  dflt="$vendorscript" ;;
9181         esac
9182         $cat <<EOM
9183
9184 The installation process will create a directory for 
9185 vendor-supplied scripts.
9186
9187 EOM
9188         fn=d~+
9189         rp='Pathname for the vendor-supplied scripts directory?'
9190         . ./getfile
9191         vendorscript="$ans"
9192         vendorscriptexp="$ansexp"
9193         ;;
9194 esac
9195 : Change installation prefix, if necessary.
9196 if $test X"$prefix" != X"$installprefix"; then
9197         installvendorscript=`echo $vendorscriptexp | $sed "s#^$prefix#$installprefix#"`
9198 else
9199         installvendorscript="$vendorscriptexp"
9200 fi
9201
9202 : see if qgcvt exists
9203 set qgcvt d_qgcvt
9204 eval $inlibc
9205
9206 echo " "
9207
9208 if $test X"$d_longdbl" = X"$define"; then
9209
9210 echo "Checking how to print long doubles..." >&4
9211
9212 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9213         $cat >try.c <<'EOCP'
9214 #include <sys/types.h>
9215 #include <stdio.h>
9216 int main() {
9217   double d = 123.456;
9218   printf("%.3f\n", d);
9219 }
9220 EOCP
9221         set try
9222         if eval $compile; then
9223                 yyy=`$run ./try`
9224                 case "$yyy" in
9225                 123.456)
9226                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9227                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9228                         echo "We will use %f."
9229                         ;;
9230                 esac
9231         fi
9232 fi
9233
9234 if $test X"$sPRIfldbl" = X; then
9235         $cat >try.c <<'EOCP'
9236 #include <sys/types.h>
9237 #include <stdio.h>
9238 int main() {
9239   long double d = 123.456;
9240   printf("%.3Lf\n", d);
9241 }
9242 EOCP
9243         set try
9244         if eval $compile; then
9245                 yyy=`$run ./try`
9246                 case "$yyy" in
9247                 123.456)
9248                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9249                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9250                         echo "We will use %Lf."
9251                         ;;
9252                 esac
9253         fi
9254 fi
9255
9256 if $test X"$sPRIfldbl" = X; then
9257         $cat >try.c <<'EOCP'
9258 #include <sys/types.h>
9259 #include <stdio.h>
9260 int main() {
9261   long double d = 123.456;
9262   printf("%.3llf\n", d);
9263 }
9264 EOCP
9265         set try
9266         if eval $compile; then
9267                 yyy=`$run ./try`
9268                 case "$yyy" in
9269                 123.456)
9270                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9271                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9272                         echo "We will use %llf."
9273                         ;;
9274                 esac
9275         fi
9276 fi
9277
9278 if $test X"$sPRIfldbl" = X; then
9279         $cat >try.c <<'EOCP'
9280 #include <sys/types.h>
9281 #include <stdio.h>
9282 int main() {
9283   long double d = 123.456;
9284   printf("%.3lf\n", d);
9285 }
9286 EOCP
9287         set try
9288         if eval $compile; then
9289                 yyy=`$run ./try`
9290                 case "$yyy" in
9291                 123.456)
9292                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9293                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9294                         echo "We will use %lf."
9295                         ;;
9296                 esac
9297         fi
9298 fi
9299
9300 if $test X"$sPRIfldbl" = X; then
9301         echo "Cannot figure out how to print long doubles." >&4
9302 else
9303         sSCNfldbl=$sPRIfldbl    # expect consistency
9304 fi
9305
9306 $rm -f try try.*
9307
9308 fi # d_longdbl
9309
9310 case "$sPRIfldbl" in
9311 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
9312         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
9313         d_SCNfldbl="$undef";
9314         ;;
9315 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
9316         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
9317         d_SCNfldbl="$define";
9318         ;;
9319 esac
9320
9321 : Check how to convert floats to strings.
9322
9323 if test "X$d_Gconvert" = X; then
9324
9325 echo " "
9326 echo "Checking for an efficient way to convert floats to strings."
9327 echo " " > try.c
9328 case "$uselongdouble" in
9329 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9330 esac
9331 case "$d_longdbl" in
9332 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9333 esac
9334 case "$d_PRIgldbl" in
9335 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9336 esac
9337 $cat >>try.c <<EOP
9338 #ifdef TRY_gconvert
9339 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9340 char *myname = "gconvert";
9341 #endif
9342 #ifdef TRY_gcvt
9343 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9344 char *myname = "gcvt";
9345 #endif
9346 #ifdef TRY_qgcvt
9347 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9348 char *myname = "qgcvt";
9349 #define DOUBLETYPE long double
9350 #endif
9351 #ifdef TRY_sprintf
9352 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9353 #ifdef HAS_PRIgldbl
9354 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9355 #else
9356 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9357 #endif
9358 #else
9359 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9360 #endif
9361 char *myname = "sprintf";
9362 #endif
9363
9364 #ifndef DOUBLETYPE
9365 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9366 #define DOUBLETYPE long double
9367 #else
9368 #define DOUBLETYPE double
9369 #endif
9370 #endif
9371
9372 #include <stdio.h>
9373
9374 #define I_STDLIB $i_stdlib
9375 #ifdef I_STDLIB
9376 #include <stdlib.h>
9377 #endif
9378
9379 int
9380 checkit(expect, got)
9381 char *expect;
9382 char *got;
9383 {
9384     if (strcmp(expect, got)) {
9385                 printf("%s oddity:  Expected %s, got %s\n",
9386                         myname, expect, got);
9387                 exit(1);
9388         }
9389 }
9390
9391 int main()
9392
9393         char buf[64]; 
9394         buf[63] = '\0';
9395
9396         /* This must be 1st test on (which?) platform */
9397         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9398         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9399         checkit("0.1", buf);
9400
9401         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
9402         checkit("0.01", buf);
9403
9404         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
9405         checkit("0.001", buf);
9406
9407         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
9408         checkit("0.0001", buf);
9409
9410         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9411         if (strlen(buf) > 5)
9412             checkit("9e-005", buf); /* for Microsoft ?? */
9413         else
9414             checkit("9e-05", buf);
9415
9416         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
9417         checkit("1", buf);
9418
9419         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
9420         checkit("1.1", buf);
9421
9422         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
9423         checkit("1.01", buf);
9424
9425         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
9426         checkit("1.001", buf);
9427
9428         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
9429         checkit("1.0001", buf);
9430
9431         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
9432         checkit("1.00001", buf);
9433
9434         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
9435         checkit("1.000001", buf);
9436
9437         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
9438         checkit("0", buf);
9439
9440         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
9441         checkit("-1", buf);
9442
9443         /* Some Linux gcvt's give 1.e+5 here. */
9444         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
9445         checkit("100000", buf);
9446         
9447         /* Some Linux gcvt's give -1.e+5 here. */
9448         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
9449         checkit("-100000", buf);
9450
9451         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
9452         checkit("123.456", buf);
9453
9454         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9455         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9456         /* 34 should be enough to scare even long double
9457          * places into using the e notation. */
9458         if (strlen(buf) > 5)
9459             checkit("1e+034", buf); /* for Microsoft */
9460         else
9461             checkit("1e+34", buf);
9462
9463         /* For Perl, if you add additional tests here, also add them to
9464          * t/base/num.t for benefit of platforms not using Configure or
9465          * overriding d_Gconvert */
9466
9467         exit(0);
9468 }
9469 EOP
9470 : first add preferred functions to our list
9471 xxx_list=""
9472 for xxx_convert in $gconvert_preference; do
9473     case $xxx_convert in
9474     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9475     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9476     esac 
9477 done
9478 : then add any others
9479 for xxx_convert in gconvert gcvt sprintf; do
9480     case "$xxx_list" in
9481     *$xxx_convert*) ;;
9482     *) xxx_list="$xxx_list $xxx_convert" ;;
9483     esac 
9484 done
9485
9486 case "$d_longdbl$uselongdouble" in
9487 "$define$define")
9488     : again, add prefered functions to our list first
9489     xxx_ld_list=""
9490     for xxx_convert in $gconvert_ld_preference; do
9491         case $xxx_convert in
9492         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9493         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9494         esac
9495     done
9496     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9497     for xxx_convert in qgcvt sprintf $xxx_list; do
9498         case "$xxx_ld_list" in
9499         $xxx_convert*|*" $xxx_convert"*) ;;
9500         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9501         esac
9502     done
9503     : if sprintf cannot do long doubles, move it to the end
9504     if test "$d_PRIgldbl" != "$define"; then
9505         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9506     fi
9507     : if no qgcvt, remove it
9508     if test "$d_qgcvt" != "$define"; then
9509         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9510     fi
9511     : use the ld_list
9512     xxx_list="$xxx_ld_list"
9513     ;;
9514 esac
9515
9516 for xxx_convert in $xxx_list; do
9517         echo "Trying $xxx_convert..."
9518         $rm -f try try$_o
9519         set try -DTRY_$xxx_convert
9520         if eval $compile; then
9521                 echo "$xxx_convert() found." >&4
9522                 if $run ./try; then
9523                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9524                         break;
9525                 else
9526                         echo "...But $xxx_convert didn't work as I expected."
9527                         xxx_convert=''
9528                 fi
9529         else
9530                 echo "$xxx_convert NOT found." >&4
9531         fi
9532 done
9533
9534 if test X$xxx_convert = X; then
9535     echo "*** WHOA THERE!!! ***" >&4
9536     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9537     xxx_convert=sprintf
9538 fi
9539
9540 case "$xxx_convert" in
9541 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9542 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9543 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9544 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9545    "$define$define$define")
9546       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9547    "$define$define$undef")
9548       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9549    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9550    esac
9551    ;;  
9552 esac
9553
9554 fi
9555
9556 : see if _fwalk exists
9557 set fwalk d__fwalk
9558 eval $inlibc
9559
9560 : Initialize h_fcntl
9561 h_fcntl=false
9562
9563 : Initialize h_sysfile
9564 h_sysfile=false
9565
9566 : access call always available on UNIX
9567 set access d_access
9568 eval $inlibc
9569
9570 : locate the flags for 'access()'
9571 case "$d_access" in
9572 "$define")
9573         echo " "
9574         $cat >access.c <<EOCP
9575 #include <sys/types.h>
9576 #ifdef I_FCNTL
9577 #include <fcntl.h>
9578 #endif
9579 #ifdef I_SYS_FILE
9580 #include <sys/file.h>
9581 #endif
9582 #ifdef I_UNISTD
9583 #include <unistd.h>
9584 #endif
9585 #$i_stdlib I_STDLIB
9586 #ifdef I_STDLIB
9587 #include <stdlib.h>
9588 #endif
9589 int main() {
9590         exit(R_OK);
9591 }
9592 EOCP
9593         : check sys/file.h first, no particular reason here
9594         if $test `./findhdr sys/file.h` && \
9595                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9596                 h_sysfile=true;
9597                 echo "<sys/file.h> defines the *_OK access constants." >&4
9598         elif $test `./findhdr fcntl.h` && \
9599                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9600                 h_fcntl=true;
9601                 echo "<fcntl.h> defines the *_OK access constants." >&4
9602         elif $test `./findhdr unistd.h` && \
9603                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9604                 echo "<unistd.h> defines the *_OK access constants." >&4
9605         else
9606                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9607         fi
9608         ;;
9609 esac
9610 $rm -f access*
9611
9612 : see if accessx exists
9613 set accessx d_accessx
9614 eval $inlibc
9615
9616 : see if aintl exists
9617 set aintl d_aintl
9618 eval $inlibc
9619
9620 : see if alarm exists
9621 set alarm d_alarm
9622 eval $inlibc
9623
9624 : see if POSIX threads are available
9625 set pthread.h i_pthread
9626 eval $inhdr
9627
9628 : define a fucntion to check prototypes
9629 $cat > protochk <<EOSH
9630 $startsh
9631 cc="$cc"
9632 optimize="$optimize"
9633 ccflags="$ccflags"
9634 prototype="$prototype"
9635 define="$define"
9636 rm=$rm
9637 usethreads=$usethreads
9638 i_pthread=$i_pthread
9639 pthread_h_first=$pthread_h_first
9640 EOSH
9641
9642 $cat >> protochk <<'EOSH'
9643
9644 $rm -f try.c
9645 foo="$1"
9646 shift
9647 while test $# -ge 2; do
9648         case "$1" in
9649                 $define) echo "#include <$2>" >> try.c ;;
9650                 literal) echo "$2" >> try.c ;;
9651         esac
9652     # Extra magic for the benefit of systems that need pthread.h
9653     # to be included early to correctly detect threadsafe functions.
9654     # Such functions must guarantee themselves, though, that the usethreads
9655     # and i_pthread have been defined, before calling protochk.
9656     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9657         echo "#include <pthread.h>" >> try.c
9658         pthread_h_done=yes
9659     fi
9660     shift 2
9661 done
9662 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9663 cat >> try.c <<'EOCP'
9664 #ifdef CAN_PROTOTYPE
9665 #define _(args) args
9666 #else
9667 #define _(args) ()
9668 #endif
9669 EOCP
9670 echo "$foo" >> try.c
9671 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9672 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9673 status=$?
9674 $rm -f try.[co]
9675 exit $status
9676 EOSH
9677 chmod +x protochk
9678 $eunicefix protochk
9679
9680 hasproto='varname=$1; func=$2; shift; shift;
9681 while $test $# -ge 2; do
9682         case "$1" in
9683         $define) echo "#include <$2>";;
9684         esac ;
9685     shift 2;
9686 done > try.c;
9687 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9688 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9689         echo "$func() prototype found.";
9690         val="$define";
9691 else
9692         echo "$func() prototype NOT found.";
9693         val="$undef";
9694 fi;
9695 set $varname;
9696 eval $setvar;
9697 $rm -f try.c tryout.c'
9698
9699 : see if sys/types.h has to be included
9700 set sys/types.h i_systypes
9701 eval $inhdr
9702
9703 : see if sys/select.h has to be included
9704 set sys/select.h i_sysselct
9705 eval $inhdr
9706
9707 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9708 while $test $# -ge 2; do
9709         case "$1" in
9710         $define) echo "#include <$2>";;
9711         esac ;
9712     shift 2;
9713 done > try.c;
9714 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9715 set try;
9716 if eval $compile; then
9717         val="$define";
9718 else
9719         val="$undef";
9720 fi;
9721 set $varname;
9722 eval $setvar;
9723 $rm -f try.c try.o'
9724
9725 : see if we should include time.h, sys/time.h, or both
9726 echo " "
9727 if test "X$timeincl" = X; then
9728         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9729         $echo $n "I'm now running the test program...$c"
9730         $cat >try.c <<EOCP
9731 #include <sys/types.h>
9732 #ifdef I_TIME
9733 #include <time.h>
9734 #endif
9735 #ifdef I_SYSTIME
9736 #ifdef SYSTIMEKERNEL
9737 #define KERNEL
9738 #endif
9739 #include <sys/time.h>
9740 #endif
9741 #ifdef I_SYSSELECT
9742 #include <sys/select.h>
9743 #endif
9744 #$i_stdlib I_STDLIB
9745 #ifdef I_STDLIB
9746 #include <stdlib.h>
9747 #endif
9748 int main()
9749 {
9750         struct tm foo;
9751 #ifdef S_TIMEVAL
9752         struct timeval bar;
9753 #endif
9754 #ifdef S_TIMEZONE
9755         struct timezone tzp;
9756 #endif
9757         if (foo.tm_sec == foo.tm_sec)
9758                 exit(0);
9759 #ifdef S_TIMEVAL
9760         if (bar.tv_sec == bar.tv_sec)
9761                 exit(0);
9762 #endif
9763         exit(1);
9764 }
9765 EOCP
9766         flags=''
9767         for s_timezone in '-DS_TIMEZONE' ''; do
9768         sysselect=''
9769         for s_timeval in '-DS_TIMEVAL' ''; do
9770         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9771         for i_time in '' '-DI_TIME'; do
9772         for i_systime in '-DI_SYSTIME' ''; do
9773                 case "$flags" in
9774                 '') $echo $n ".$c"
9775                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9776                         if eval $compile; then
9777                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9778                                 shift
9779                                 flags="$*"
9780                                 echo " "
9781                                 $echo $n "Succeeded with $flags$c"
9782                         fi
9783                         ;;
9784                 esac
9785         done
9786         done
9787         done
9788         done
9789         done
9790         timeincl=''
9791         echo " "
9792         case "$flags" in
9793         *SYSTIMEKERNEL*) i_systimek="$define"
9794                 timeincl=`./findhdr sys/time.h`
9795                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9796         *) i_systimek="$undef";;
9797         esac
9798         case "$flags" in
9799         *I_TIME*) i_time="$define"
9800                 timeincl=`./findhdr time.h`" $timeincl"
9801                 echo "We'll include <time.h>." >&4;;
9802         *) i_time="$undef";;
9803         esac
9804         case "$flags" in
9805         *I_SYSTIME*) i_systime="$define"
9806                 timeincl=`./findhdr sys/time.h`" $timeincl"
9807                 echo "We'll include <sys/time.h>." >&4;;
9808         *) i_systime="$undef";;
9809         esac
9810         $rm -f try.c try
9811 fi
9812 : see if struct tm knows about tm_zone
9813 case "$i_systime$i_time" in
9814 *$define*) 
9815         echo " "
9816         echo "Checking to see if your struct tm has tm_zone field..." >&4
9817         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9818         eval $hasfield
9819         ;;
9820 *)      val="$undef"
9821         set d_tm_tm_zone
9822         eval $setvar
9823         ;;
9824 esac
9825 case "$d_tm_tm_zone" in
9826 "$define")      echo "Yes, it does."   ;;
9827 *)              echo "No, it doesn't." ;;
9828 esac
9829 : see if struct tm knows about tm_gmtoff
9830 case "$i_systime$i_time" in
9831 *$define*) 
9832         echo " "
9833         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9834         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9835         eval $hasfield
9836         ;;
9837 *)      val="$undef"
9838         set d_tm_tm_gmtoff
9839         eval $setvar
9840         ;;
9841 esac
9842 case "$d_tm_tm_gmtoff" in
9843 "$define")      echo "Yes, it does."   ;;
9844 *)              echo "No, it doesn't." ;;
9845 esac
9846
9847 : see if asctime_r exists
9848 set asctime_r d_asctime_r
9849 eval $inlibc
9850 case "$d_asctime_r" in
9851 "$define")
9852         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9853         case "$d_asctime_r_proto:$usethreads" in
9854         ":define")      d_asctime_r_proto=define
9855                 set d_asctime_r_proto asctime_r $hdrs
9856                 eval $hasproto ;;
9857         *)      ;;
9858         esac
9859         case "$d_asctime_r_proto" in
9860         define)
9861         case "$asctime_r_proto" in
9862         ''|0) try='char* asctime_r(const struct tm*, char*);'
9863         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9864         esac
9865         case "$asctime_r_proto" in
9866         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9867         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9868         esac
9869         case "$asctime_r_proto" in
9870         ''|0) try='int asctime_r(const struct tm*, char*);'
9871         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9872         esac
9873         case "$asctime_r_proto" in
9874         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9875         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9876         esac
9877         case "$asctime_r_proto" in
9878         ''|0)   d_asctime_r=undef
9879                 asctime_r_proto=0
9880                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9881         * )     case "$asctime_r_proto" in
9882                 REENTRANT_PROTO*) ;;
9883                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9884                 esac
9885                 echo "Prototype: $try" ;;
9886         esac
9887         ;;
9888         *)      case "$usethreads" in
9889                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9890                 esac
9891                 d_asctime_r=undef
9892                 asctime_r_proto=0
9893                 ;;
9894         esac
9895         ;;
9896 *)      asctime_r_proto=0
9897         ;;
9898 esac
9899
9900 : see if atolf exists
9901 set atolf d_atolf
9902 eval $inlibc
9903
9904 : see if atoll exists
9905 set atoll d_atoll
9906 eval $inlibc
9907
9908 : Look for GCC-style attribute format
9909 case "$d_attribute_format" in
9910 '')
9911 echo " "
9912 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
9913 $cat >attrib.c <<'EOCP'
9914 #include <stdio.h>
9915 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
9916 EOCP
9917 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9918         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9919                 echo "Your C compiler doesn't support __attribute__((format))."
9920                 val="$undef"
9921         else
9922                 echo "Your C compiler supports __attribute__((format))."
9923                 val="$define"
9924         fi
9925 else
9926         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9927         val="$undef"
9928 fi
9929 ;;
9930 *) val="$d_attribute_format" ;;
9931 esac
9932 set d_attribute_format
9933 eval $setvar
9934 $rm -f attrib*
9935
9936 : Look for GCC-style attribute malloc
9937 case "$d_attribute_malloc" in
9938 '')
9939 echo " "
9940 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
9941 $cat >attrib.c <<'EOCP'
9942 #include <stdio.h>
9943 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
9944 EOCP
9945 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9946         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9947                 echo "Your C compiler doesn't support __attribute__((malloc))."
9948                 val="$undef"
9949         else
9950                 echo "Your C compiler supports __attribute__((malloc))."
9951                 val="$define"
9952         fi
9953 else
9954         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9955         val="$undef"
9956 fi
9957 ;;
9958 *) val="$d_attribute_malloc" ;;
9959 esac
9960 set d_attribute_malloc
9961 eval $setvar
9962 $rm -f attrib*
9963
9964 : Look for GCC-style attribute nonnull
9965 case "$d_attribute_nonnull" in
9966 '')
9967 echo " "
9968 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
9969 $cat >attrib.c <<'EOCP'
9970 #include <stdio.h>
9971 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
9972 EOCP
9973 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9974         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9975                 echo "Your C compiler doesn't support __attribute__((nonnull))."
9976                 val="$undef"
9977         else
9978                 echo "Your C compiler supports __attribute__((nonnull))."
9979                 val="$define"
9980         fi
9981 else
9982         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9983         val="$undef"
9984 fi
9985 ;;
9986 *) val="$d_attribute_nonnull" ;;
9987 esac
9988 set d_attribute_nonnull
9989 eval $setvar
9990 $rm -f attrib*
9991
9992 : Look for GCC-style attribute noreturn
9993 case "$d_attribute_noreturn" in
9994 '')
9995 echo " "
9996 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
9997 $cat >attrib.c <<'EOCP'
9998 #include <stdio.h>
9999 void fall_over_dead( void ) __attribute__((noreturn));
10000 EOCP
10001 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10002         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10003                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10004                 val="$undef"
10005         else
10006                 echo "Your C compiler supports __attribute__((noreturn))."
10007                 val="$define"
10008         fi
10009 else
10010         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10011         val="$undef"
10012 fi
10013 ;;
10014 *) val="$d_attribute_noreturn" ;;
10015 esac
10016 set d_attribute_noreturn
10017 eval $setvar
10018 $rm -f attrib*
10019
10020 : Look for GCC-style attribute pure
10021 case "$d_attribute_pure" in
10022 '')
10023 echo " "
10024 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10025 $cat >attrib.c <<'EOCP'
10026 #include <stdio.h>
10027 int square( int n ) __attribute__((pure));
10028 EOCP
10029 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10030         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10031                 echo "Your C compiler doesn't support __attribute__((pure))."
10032                 val="$undef"
10033         else
10034                 echo "Your C compiler supports __attribute__((pure))."
10035                 val="$define"
10036         fi
10037 else
10038         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10039         val="$undef"
10040 fi
10041 ;;
10042 *) val="$d_attribute_pure" ;;
10043 esac
10044 set d_attribute_pure
10045 eval $setvar
10046 $rm -f attrib*
10047
10048 : Look for GCC-style attribute unused
10049 case "$d_attribute_unused" in
10050 '')
10051 echo " "
10052 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10053 $cat >attrib.c <<'EOCP'
10054 #include <stdio.h>
10055 int do_something( int dummy __attribute__((unused)), int n );
10056 EOCP
10057 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10058         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10059                 echo "Your C compiler doesn't support __attribute__((unused))."
10060                 val="$undef"
10061         else
10062                 echo "Your C compiler supports __attribute__((unused))."
10063                 val="$define"
10064         fi
10065 else
10066         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10067         val="$undef"
10068 fi
10069 ;;
10070 *) val="$d_attribute_unused" ;;
10071 esac
10072 set d_attribute_unused
10073 eval $setvar
10074 $rm -f attrib*
10075
10076 : Look for GCC-style attribute warn_unused_result
10077 case "$d_attribute_warn_unused_result" in
10078 '')
10079 echo " "
10080 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10081 $cat >attrib.c <<'EOCP'
10082 #include <stdio.h>
10083 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10084 EOCP
10085 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10086         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10087                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10088                 val="$undef"
10089         else
10090                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10091                 val="$define"
10092         fi
10093 else
10094         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10095         val="$undef"
10096 fi
10097 ;;
10098 *) val="$d_attribute_warn_unused_result" ;;
10099 esac
10100 set d_attribute_warn_unused_result
10101 eval $setvar
10102 $rm -f attrib*
10103
10104 : see if bcmp exists
10105 set bcmp d_bcmp
10106 eval $inlibc
10107
10108 : see if bcopy exists
10109 set bcopy d_bcopy
10110 eval $inlibc
10111
10112 : see if this is a unistd.h system
10113 set unistd.h i_unistd
10114 eval $inhdr
10115
10116 : see if getpgrp exists
10117 set getpgrp d_getpgrp
10118 eval $inlibc
10119
10120 case "$d_getpgrp" in
10121 "$define")
10122         echo " "
10123         echo "Checking to see which flavor of getpgrp is in use..."
10124         $cat >try.c <<EOP
10125 #$i_unistd I_UNISTD
10126 #include <sys/types.h>
10127 #ifdef I_UNISTD
10128 #  include <unistd.h>
10129 #endif
10130 #$i_stdlib I_STDLIB
10131 #ifdef I_STDLIB
10132 #include <stdlib.h>
10133 #endif
10134 int main()
10135 {
10136         if (getuid() == 0) {
10137                 printf("(I see you are running Configure as super-user...)\n");
10138                 setuid(1);
10139         }
10140 #ifdef TRY_BSD_PGRP
10141         if (getpgrp(1) == 0)
10142                 exit(0);
10143 #else
10144         if (getpgrp() > 0)
10145                 exit(0);
10146 #endif
10147         exit(1);
10148 }
10149 EOP
10150         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10151                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10152                 val="$define"
10153         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10154                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10155                 val="$undef"
10156         else
10157                 echo "I can't seem to compile and run the test program."
10158                 if ./usg; then
10159                         xxx="a USG one, i.e. you use getpgrp()."
10160                 else
10161                         # SVR4 systems can appear rather BSD-ish.
10162                         case "$i_unistd" in
10163                         $undef)
10164                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10165                                 val="$define"
10166                                 ;;
10167                         $define)
10168                                 xxx="probably a USG one, i.e. you use getpgrp()."
10169                                 val="$undef"
10170                                 ;;
10171                         esac
10172                 fi
10173                 echo "Assuming your getpgrp is $xxx" >&4
10174         fi
10175         ;;
10176 *) val="$undef";;
10177 esac
10178 set d_bsdgetpgrp
10179 eval $setvar
10180 $rm -f try try.*
10181
10182 : see if setpgrp exists
10183 set setpgrp d_setpgrp
10184 eval $inlibc
10185
10186 case "$d_setpgrp" in
10187 "$define")
10188         echo " "
10189         echo "Checking to see which flavor of setpgrp is in use..."
10190         $cat >try.c <<EOP
10191 #$i_unistd I_UNISTD
10192 #include <sys/types.h>
10193 #ifdef I_UNISTD
10194 #  include <unistd.h>
10195 #endif
10196 #$i_stdlib I_STDLIB
10197 #ifdef I_STDLIB
10198 #include <stdlib.h>
10199 #endif
10200 int main()
10201 {
10202         if (getuid() == 0) {
10203                 printf("(I see you are running Configure as super-user...)\n");
10204                 setuid(1);
10205         }
10206 #ifdef TRY_BSD_PGRP
10207         if (-1 == setpgrp(1, 1))
10208                 exit(0);
10209 #else
10210         if (setpgrp() != -1)
10211                 exit(0);
10212 #endif
10213         exit(1);
10214 }
10215 EOP
10216         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10217                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10218                 val="$define"
10219         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10220                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10221                 val="$undef"
10222         else
10223                 echo "(I can't seem to compile and run the test program.)"
10224                 if ./usg; then
10225                         xxx="a USG one, i.e. you use setpgrp()."
10226                 else
10227                         # SVR4 systems can appear rather BSD-ish.
10228                         case "$i_unistd" in
10229                         $undef)
10230                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10231                                 val="$define"
10232                                 ;;
10233                         $define)
10234                                 xxx="probably a USG one, i.e. you use setpgrp()."
10235                                 val="$undef"
10236                                 ;;
10237                         esac
10238                 fi
10239                 echo "Assuming your setpgrp is $xxx" >&4
10240         fi
10241         ;;
10242 *) val="$undef";;
10243 esac
10244 set d_bsdsetpgrp
10245 eval $setvar
10246 $rm -f try try.*
10247 : Look for GCC-style __builtin_choose_expr
10248 case "$d_builtin_choose_expr" in
10249 '')
10250     echo " "
10251     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10252     $cat >try.c <<'EOCP'
10253 #include <assert.h>
10254 #include <stdlib.h>
10255 #include <stdio.h>
10256
10257 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10258
10259 int main(void) {
10260     assert( SYRINX(1) == 2112 );
10261     assert( SYRINX(1) != 5150 );
10262     assert( SYRINX(0) == 5150 );
10263     assert( SYRINX(0) != 2112 );
10264     puts( "All good!" );
10265     exit(0);
10266 }
10267
10268 EOCP
10269     set try
10270     if eval $compile; then
10271         echo "Your C compiler supports __builtin_choose_expr."
10272         val="$define"
10273     else
10274         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10275         val="$undef"
10276     fi
10277 ;;
10278 *) val="$d_builtin_choose_expr" ;;
10279 esac
10280
10281 set d_builtin_choose_expr
10282 eval $setvar
10283 $rm -f try.* try core core.try.*
10284
10285 : Look for GCC-style __builtin_expect
10286 case "$d_builtin_expect" in
10287 '')
10288     echo " "
10289     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10290     $cat >builtin.c <<'EOCP'
10291 int main(void) {
10292     int n = 50;
10293     if ( __builtin_expect(n, 0) ) n = 1;
10294 }
10295 EOCP
10296     set try
10297     if eval $compile; then
10298         echo "Your C compiler supports __builtin_choose_expr."
10299         val="$define"
10300     else
10301         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10302         val="$undef"
10303     fi
10304     ;;
10305 *) val="$d_builtin_expect" ;;
10306 esac
10307
10308 set d_builtin_expect
10309 eval $setvar
10310 $rm -f try.* try core core.try.*
10311
10312 : see if bzero exists
10313 set bzero d_bzero
10314 eval $inlibc
10315
10316 : see if signal is declared as pointer to function returning int or void
10317 echo " "
10318 xxx=`./findhdr signal.h`
10319 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10320 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10321         echo "You have int (*signal())() instead of void." >&4
10322         val="$undef"
10323 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10324         echo "You have void (*signal())()." >&4
10325         val="$define"
10326 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10327         echo "You have int (*signal())() instead of void." >&4
10328         val="$undef"
10329 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10330         echo "You have void (*signal())()." >&4
10331         val="$define"
10332 else
10333         case "$d_voidsig" in
10334         '')
10335         echo "I can't determine whether signal handler returns void or int..." >&4
10336                 dflt=void
10337                 rp="What type does your signal handler return?"
10338                 . ./myread
10339                 case "$ans" in
10340                 v*) val="$define";;
10341                 *) val="$undef";;
10342                 esac;;
10343         "$define")
10344                 echo "As you already told me, signal handler returns void." >&4
10345                 val="$define"
10346                 ;;
10347         *)      echo "As you already told me, signal handler returns int." >&4
10348                 val="$undef"
10349                 ;;
10350         esac
10351 fi
10352 set d_voidsig
10353 eval $setvar
10354 case "$d_voidsig" in
10355 "$define") signal_t="void";;
10356 *) signal_t="int";;
10357 esac
10358 $rm -f $$.tmp
10359
10360 : check for ability to cast large floats to 32-bit ints.
10361 echo " "
10362 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10363 if $test "$intsize" -ge 4; then
10364         xxx=int
10365 else
10366         xxx=long
10367 fi
10368 $cat >try.c <<EOCP
10369 #include <stdio.h>
10370 #$i_stdlib I_STDLIB
10371 #ifdef I_STDLIB
10372 #include <stdlib.h>
10373 #endif
10374 #include <sys/types.h>
10375 #include <signal.h>
10376 $signal_t blech(s) int s; { exit(3); }
10377 int main()
10378 {
10379         $xxx i32;
10380         double f, g;
10381         int result = 0;
10382         char str[16];
10383         signal(SIGFPE, blech);
10384
10385         /* Don't let compiler optimize the test away.  Store the number 
10386            in a writable string for gcc to pass to sscanf under HP/UX.
10387         */
10388         sprintf(str, "2147483647");
10389         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10390         g = 10 * f;
10391         i32  = ($xxx) g;
10392
10393         /* x86 processors will probably give 0x8000 0000, which is a
10394            sign change.  We don't want that.  We want to mimic SPARC
10395            behavior here, which is to preserve the sign and give
10396            back 0x7fff ffff.
10397         */
10398         if (i32 != ($xxx) f)
10399                 result |= 1;
10400         exit(result);
10401 }
10402 EOCP
10403 set try
10404 if eval $compile_ok; then
10405         $run ./try
10406         yyy=$?
10407 else
10408         echo "(I can't seem to compile the test program--assuming it can't)"
10409         yyy=1
10410 fi
10411 case "$yyy" in
10412 0)      val="$define"
10413         echo "Yup, it can."
10414         ;;
10415 *)      val="$undef"
10416         echo "Nope, it can't."
10417         ;;
10418 esac
10419 set d_casti32
10420 eval $setvar
10421 $rm -f try try.*
10422
10423 : check for ability to cast negative floats to unsigned
10424 echo " "
10425 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10426 $cat >try.c <<EOCP
10427 #include <stdio.h>
10428 #$i_stdlib I_STDLIB
10429 #ifdef I_STDLIB
10430 #include <stdlib.h>
10431 #endif
10432 #include <sys/types.h>
10433 #include <signal.h>
10434 $signal_t blech(s) int s; { exit(7); }
10435 $signal_t blech_in_list(s) int s; { exit(4); }
10436 unsigned long dummy_long(p) unsigned long p; { return p; }
10437 unsigned int dummy_int(p) unsigned int p; { return p; }
10438 unsigned short dummy_short(p) unsigned short p; { return p; }
10439 int main()
10440 {
10441         double f;
10442         unsigned long along;
10443         unsigned int aint;
10444         unsigned short ashort;
10445         int result = 0;
10446         char str[16];
10447         
10448         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10449            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10450            optimized the whole file away
10451         */
10452         /* Store the number in a writable string for gcc to pass to 
10453            sscanf under HP/UX.
10454         */
10455         sprintf(str, "-123");
10456         sscanf(str, "%lf", &f);  /* f = -123.; */
10457
10458         signal(SIGFPE, blech);
10459         along = (unsigned long)f;
10460         aint = (unsigned int)f;
10461         ashort = (unsigned short)f;
10462         if (along != (unsigned long)-123)
10463                 result |= 1;
10464         if (aint != (unsigned int)-123)
10465                 result |= 1;
10466         if (ashort != (unsigned short)-123)
10467                 result |= 1;
10468         sprintf(str, "1073741824.");
10469         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10470         f = f + f;
10471         along = 0;
10472         along = (unsigned long)f;
10473         if (along != 0x80000000)
10474                 result |= 2;
10475         f -= 1.;
10476         along = 0;
10477         along = (unsigned long)f;
10478         if (along != 0x7fffffff)
10479                 result |= 1;
10480         f += 2.;
10481         along = 0;
10482         along = (unsigned long)f;
10483         if (along != 0x80000001)
10484                 result |= 2;
10485         if (result)
10486                 exit(result);
10487         signal(SIGFPE, blech_in_list);
10488         sprintf(str, "123.");
10489         sscanf(str, "%lf", &f);  /* f = 123.; */
10490         along = dummy_long((unsigned long)f);
10491         aint = dummy_int((unsigned int)f);
10492         ashort = dummy_short((unsigned short)f);
10493         if (along != (unsigned long)123)
10494                 result |= 4;
10495         if (aint != (unsigned int)123)
10496                 result |= 4;
10497         if (ashort != (unsigned short)123)
10498                 result |= 4;
10499         exit(result);
10500
10501 }
10502 EOCP
10503 set try
10504 if eval $compile_ok; then
10505         $run ./try
10506         castflags=$?
10507 else
10508         echo "(I can't seem to compile the test program--assuming it can't)"
10509         castflags=7
10510 fi
10511 case "$castflags" in
10512 0)      val="$define"
10513         echo "Yup, it can."
10514         ;;
10515 *)      val="$undef"
10516         echo "Nope, it can't."
10517         ;;
10518 esac
10519 set d_castneg
10520 eval $setvar
10521 $rm -f try.*
10522
10523 : see if vprintf exists
10524 echo " "
10525 if set vprintf val -f d_vprintf; eval $csym; $val; then
10526         echo 'vprintf() found.' >&4
10527         val="$define"
10528         $cat >try.c <<EOF
10529 #include <varargs.h>
10530 #$i_stdlib I_STDLIB
10531 #ifdef I_STDLIB
10532 #include <stdlib.h>
10533 #endif
10534
10535 int main() { xxx("foo"); }
10536
10537 xxx(va_alist)
10538 va_dcl
10539 {
10540         va_list args;
10541         char buf[10];
10542
10543         va_start(args);
10544         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10545 }
10546 EOF
10547         set try
10548         if eval $compile && $run ./try; then
10549                 echo "Your vsprintf() returns (int)." >&4
10550                 val2="$undef"
10551         else
10552                 echo "Your vsprintf() returns (char*)." >&4
10553                 val2="$define"
10554         fi
10555 else
10556         echo 'vprintf() NOT found.' >&4
10557                 val="$undef"
10558                 val2="$undef"
10559 fi
10560 $rm -f try try.*
10561 set d_vprintf
10562 eval $setvar
10563 val=$val2
10564 set d_charvspr
10565 eval $setvar
10566
10567 : see if chown exists
10568 set chown d_chown
10569 eval $inlibc
10570
10571 : see if chroot exists
10572 set chroot d_chroot
10573 eval $inlibc
10574
10575 : see if chsize exists
10576 set chsize d_chsize
10577 eval $inlibc
10578
10579 : see if class exists
10580 set class d_class
10581 eval $inlibc
10582
10583 : see if clearenv exists
10584 set clearenv d_clearenv
10585 eval $inlibc
10586
10587 hasstruct='varname=$1; struct=$2; shift; shift;
10588 while $test $# -ge 2; do
10589         case "$1" in
10590         $define) echo "#include <$2>";;
10591         esac ;
10592     shift 2;
10593 done > try.c;
10594 echo "int main () { struct $struct foo; }" >> try.c;
10595 set try;
10596 if eval $compile; then
10597         val="$define";
10598 else
10599         val="$undef";
10600 fi;
10601 set $varname;
10602 eval $setvar;
10603 $rm -f try.c try.o'
10604
10605 socketlib=''
10606 sockethdr=''
10607 : see whether socket exists
10608 echo " "
10609 $echo $n "Hmm... $c" >&4
10610 if set socket val -f d_socket; eval $csym; $val; then
10611         echo "Looks like you have Berkeley networking support." >&4
10612         d_socket="$define"
10613         if set setsockopt val -f; eval $csym; $val; then
10614                 d_oldsock="$undef"
10615         else
10616                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10617                 d_oldsock="$define"
10618         fi
10619 else
10620         if $contains socklib libc.list >/dev/null 2>&1; then
10621                 echo "Looks like you have Berkeley networking support." >&4
10622                 d_socket="$define"
10623                 : we will have to assume that it supports the 4.2 BSD interface
10624                 d_oldsock="$undef"
10625         else
10626                 echo "You don't have Berkeley networking in libc$_a..." >&4
10627                 if test "X$d_socket" = "X$define"; then
10628                    echo "...but you seem to believe that you have sockets." >&4
10629                 else
10630                         for net in net socket
10631                         do
10632                                 if test -f /usr/lib/lib$net$_a; then
10633                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10634                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10635                                         if $contains socket libc.list >/dev/null 2>&1; then
10636                                                 d_socket="$define"
10637                                                 socketlib="-l$net"
10638                                                 case "$net" in
10639                                                 net)
10640                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10641                                                         sockethdr="-I/usr/netinclude"
10642                                                         ;;
10643                                                 esac
10644                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
10645                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10646                                                         d_oldsock="$undef"
10647                                                 else
10648                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10649                                                         d_oldsock="$define"
10650                                                 fi
10651                                                 break
10652                                         fi
10653                                 fi
10654                         done
10655                         if test "X$d_socket" != "X$define"; then
10656                            echo "or anywhere else I see." >&4
10657                            d_socket="$undef"
10658                            d_oldsock="$undef"
10659                         fi
10660                 fi
10661         fi
10662 fi
10663
10664 : see if socketpair exists
10665 set socketpair d_sockpair
10666 eval $inlibc
10667
10668
10669 echo " "
10670 echo "Checking the availability of certain socket constants..." >&4
10671 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10672         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10673         $cat >try.c <<EOF
10674 #include <sys/types.h>
10675 #include <sys/socket.h>
10676 int main() {
10677     int i = $ENUM;
10678 }
10679 EOF
10680         val="$undef"
10681         set try; if eval $compile; then
10682                 val="$define"
10683         fi
10684         set d_${enum}; eval $setvar
10685         $rm -f try.c try
10686 done
10687
10688 : see if this is a sys/uio.h system
10689 set sys/uio.h i_sysuio
10690 eval $inhdr
10691
10692
10693 echo " "
10694 echo "Checking to see if your system supports struct cmsghdr..." >&4
10695 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10696 eval $hasstruct
10697 case "$d_cmsghdr_s" in
10698 "$define")      echo "Yes, it does."   ;;
10699 *)              echo "No, it doesn't." ;;
10700 esac
10701
10702
10703 : check for const keyword
10704 echo " "
10705 echo 'Checking to see if your C compiler knows about "const"...' >&4
10706 $cat >const.c <<'EOCP'
10707 typedef struct spug { int drokk; } spug;
10708 int main()
10709 {
10710         const char *foo;
10711         const spug y;
10712 }
10713 EOCP
10714 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10715         val="$define"
10716         echo "Yup, it does."
10717 else
10718         val="$undef"
10719         echo "Nope, it doesn't."
10720 fi
10721 set d_const
10722 eval $setvar
10723
10724 : see if copysignl exists
10725 set copysignl d_copysignl
10726 eval $inlibc
10727
10728 : see if crypt exists
10729 echo " "
10730 set crypt d_crypt
10731 eval $inlibc
10732 case "$d_crypt" in
10733 $define) cryptlib='' ;;
10734 *)      if set crypt val -f d_crypt; eval $csym; $val; then
10735                 echo 'crypt() found.' >&4
10736                 val="$define"
10737                 cryptlib=''
10738         else
10739                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10740                 if $test -z "$cryptlib"; then
10741                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10742                 else
10743                         cryptlib=-lcrypt
10744                 fi
10745                 if $test -z "$cryptlib"; then
10746                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10747                 else
10748                         cryptlib=-lcrypt
10749                 fi
10750                 if $test -z "$cryptlib"; then
10751                         cryptlib=`./loc libcrypt$_a "" $libpth`
10752                 else
10753                         cryptlib=-lcrypt
10754                 fi
10755                 if $test -z "$cryptlib"; then
10756                         echo 'crypt() NOT found.' >&4
10757                         val="$undef"
10758                 else
10759                         val="$define"
10760                 fi
10761         fi
10762         set d_crypt
10763         eval $setvar
10764         ;;
10765 esac
10766
10767 : see if this is a crypt.h system
10768 set crypt.h i_crypt
10769 eval $inhdr
10770
10771 : see if crypt_r exists
10772 set crypt_r d_crypt_r
10773 eval $inlibc
10774 case "$d_crypt_r" in
10775 "$define")
10776         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
10777         case "$d_crypt_r_proto:$usethreads" in
10778         ":define")      d_crypt_r_proto=define
10779                 set d_crypt_r_proto crypt_r $hdrs
10780                 eval $hasproto ;;
10781         *)      ;;
10782         esac
10783         case "$d_crypt_r_proto" in
10784         define)
10785         case "$crypt_r_proto" in
10786         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10787         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10788         esac
10789         case "$crypt_r_proto" in
10790         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10791         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10792         esac
10793         case "$crypt_r_proto" in
10794         ''|0)   d_crypt_r=undef
10795                 crypt_r_proto=0
10796                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10797         * )     case "$crypt_r_proto" in
10798                 REENTRANT_PROTO*) ;;
10799                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10800                 esac
10801                 echo "Prototype: $try" ;;
10802         esac
10803         ;;
10804         *)      case "$usethreads" in
10805                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10806                 esac
10807                 d_crypt_r=undef
10808                 crypt_r_proto=0
10809                 ;;
10810         esac
10811         ;;
10812 *)      crypt_r_proto=0
10813         ;;
10814 esac
10815
10816 : get csh whereabouts
10817 case "$csh" in
10818 'csh') val="$undef" ;;
10819 *) val="$define" ;;
10820 esac
10821 set d_csh
10822 eval $setvar
10823 : Respect a hint or command line value for full_csh.
10824 case "$full_csh" in
10825 '') full_csh=$csh ;;
10826 esac
10827
10828 : see if ctermid_r exists
10829 set ctermid_r d_ctermid_r
10830 eval $inlibc
10831 case "$d_ctermid_r" in
10832 "$define")
10833         hdrs="$i_systypes sys/types.h define stdio.h "
10834         case "$d_ctermid_r_proto:$usethreads" in
10835         ":define")      d_ctermid_r_proto=define
10836                 set d_ctermid_r_proto ctermid_r $hdrs
10837                 eval $hasproto ;;
10838         *)      ;;
10839         esac
10840         case "$d_ctermid_r_proto" in
10841         define)
10842         case "$ctermid_r_proto" in
10843         ''|0) try='char* ctermid_r(char*);'
10844         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10845         esac
10846         case "$ctermid_r_proto" in
10847         ''|0)   d_ctermid_r=undef
10848                 ctermid_r_proto=0
10849                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10850         * )     case "$ctermid_r_proto" in
10851                 REENTRANT_PROTO*) ;;
10852                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10853                 esac
10854                 echo "Prototype: $try" ;;
10855         esac
10856         ;;
10857         *)      case "$usethreads" in
10858                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10859                 esac
10860                 d_ctermid_r=undef
10861                 ctermid_r_proto=0
10862                 ;;
10863         esac
10864         ;;
10865 *)      ctermid_r_proto=0
10866         ;;
10867 esac
10868
10869 : see if ctime_r exists
10870 set ctime_r d_ctime_r
10871 eval $inlibc
10872 case "$d_ctime_r" in
10873 "$define")
10874         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10875         case "$d_ctime_r_proto:$usethreads" in
10876         ":define")      d_ctime_r_proto=define
10877                 set d_ctime_r_proto ctime_r $hdrs
10878                 eval $hasproto ;;
10879         *)      ;;
10880         esac
10881         case "$d_ctime_r_proto" in
10882         define)
10883         case "$ctime_r_proto" in
10884         ''|0) try='char* ctime_r(const time_t*, char*);'
10885         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10886         esac
10887         case "$ctime_r_proto" in
10888         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10889         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10890         esac
10891         case "$ctime_r_proto" in
10892         ''|0) try='int ctime_r(const time_t*, char*);'
10893         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10894         esac
10895         case "$ctime_r_proto" in
10896         ''|0) try='int ctime_r(const time_t*, char*, int);'
10897         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10898         esac
10899         case "$ctime_r_proto" in
10900         ''|0)   d_ctime_r=undef
10901                 ctime_r_proto=0
10902                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10903         * )     case "$ctime_r_proto" in
10904                 REENTRANT_PROTO*) ;;
10905                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10906                 esac
10907                 echo "Prototype: $try" ;;
10908         esac
10909         ;;
10910         *)      case "$usethreads" in
10911                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10912                 esac
10913                 d_ctime_r=undef
10914                 ctime_r_proto=0
10915                 ;;
10916         esac
10917         ;;
10918 *)      ctime_r_proto=0
10919         ;;
10920 esac
10921
10922 : see if cuserid exists
10923 set cuserid d_cuserid
10924 eval $inlibc
10925
10926 : see if this is a limits.h system
10927 set limits.h i_limits
10928 eval $inhdr
10929
10930 : see if this is a float.h system
10931 set float.h i_float
10932 eval $inhdr
10933
10934 : See if number of significant digits in a double precision number is known
10935 echo " "
10936 $cat >dbl_dig.c <<EOM
10937 #$i_limits I_LIMITS
10938 #$i_float I_FLOAT
10939 #ifdef I_LIMITS
10940 #include <limits.h>
10941 #endif
10942 #ifdef I_FLOAT
10943 #include <float.h>
10944 #endif
10945 #ifdef DBL_DIG
10946 printf("Contains DBL_DIG");
10947 #endif
10948 EOM
10949 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10950 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10951         echo "DBL_DIG found." >&4
10952         val="$define"
10953 else
10954         echo "DBL_DIG NOT found." >&4
10955         val="$undef"
10956 fi
10957 $rm -f dbl_dig.?
10958 set d_dbl_dig
10959 eval $setvar
10960
10961 : see if dbm.h is available
10962 : see if dbmclose exists
10963 set dbmclose d_dbmclose
10964 eval $inlibc
10965
10966 case "$d_dbmclose" in
10967 $define)
10968         set dbm.h i_dbm
10969         eval $inhdr
10970         case "$i_dbm" in
10971         $define)
10972                 val="$undef"
10973                 set i_rpcsvcdbm
10974                 eval $setvar
10975                 ;;
10976         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10977                 eval $inhdr
10978                 ;;
10979         esac
10980         ;;
10981 *)      echo "We won't be including <dbm.h>"
10982         val="$undef"
10983         set i_dbm
10984         eval $setvar
10985         val="$undef"
10986         set i_rpcsvcdbm
10987         eval $setvar
10988         ;;
10989 esac
10990
10991 : see if prototype for dbminit is available
10992 echo " "
10993 set d_dbminitproto dbminit $i_dbm dbm.h
10994 eval $hasproto
10995
10996 : see if difftime exists
10997 set difftime d_difftime
10998 eval $inlibc
10999
11000 : see if this is a dirent system
11001 echo " "
11002 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11003         val="$define"
11004         echo "<dirent.h> found." >&4
11005 else
11006         val="$undef"
11007         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11008                 echo "<sys/dir.h> found." >&4
11009                 echo " "
11010         else
11011                 xinc=`./findhdr sys/ndir.h`
11012         fi
11013         echo "<dirent.h> NOT found." >&4
11014 fi
11015 set i_dirent
11016 eval $setvar
11017
11018 : Look for type of directory structure.
11019 echo " "
11020 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11021
11022 case "$direntrytype" in
11023 ''|' ')
11024         case "$i_dirent" in
11025         $define) guess1='struct dirent' ;;
11026         *) guess1='struct direct'  ;;
11027         esac
11028         ;;
11029 *)      guess1="$direntrytype"
11030         ;;
11031 esac
11032
11033 case "$guess1" in
11034 'struct dirent') guess2='struct direct' ;;
11035 *) guess2='struct dirent' ;;
11036 esac
11037                 
11038 if $contains "$guess1" try.c >/dev/null 2>&1; then
11039         direntrytype="$guess1"
11040         echo "Your directory entries are $direntrytype." >&4
11041 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11042         direntrytype="$guess2"
11043         echo "Your directory entries seem to be $direntrytype." >&4
11044 else
11045         echo "I don't recognize your system's directory entries." >&4
11046         rp="What type is used for directory entries on this system?"
11047         dflt="$guess1"
11048         . ./myread
11049         direntrytype="$ans"
11050 fi
11051 $rm -f try.c
11052
11053
11054 : see if the directory entry stores field length
11055 echo " "
11056 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11057 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11058         echo "Good, your directory entry keeps length information in d_namlen." >&4
11059         val="$define"
11060 else
11061         echo "Your directory entry does not know about the d_namlen field." >&4
11062         val="$undef"
11063 fi
11064 set d_dirnamlen
11065 eval $setvar
11066 $rm -f try.c
11067
11068 : see if this is an sysdir system
11069 set sys/dir.h i_sysdir
11070 eval $inhdr
11071
11072 : see if this is an sysndir system
11073 set sys/ndir.h i_sysndir
11074 eval $inhdr
11075
11076 : Look for dirfd
11077 echo " "
11078 $cat >dirfd.c <<EOM
11079 #include <stdio.h>
11080 #$i_stdlib I_STDLIB
11081 #ifdef I_STDLIB
11082 #include <stdlib.h>
11083 #endif
11084 #$i_dirent I_DIRENT             /**/
11085 #$i_sysdir I_SYS_DIR            /**/
11086 #$i_sysndir I_SYS_NDIR          /**/
11087 #$i_systypes I_SYS_TYPES        /**/
11088 #if defined(I_SYS_TYPES)
11089 #include <sys/types.h>
11090 #endif
11091 #if defined(I_DIRENT)
11092 #include <dirent.h>
11093 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11094 #include <sys/dir.h>
11095 #endif
11096 #else
11097 #ifdef I_SYS_NDIR
11098 #include <sys/ndir.h>
11099 #else
11100 #ifdef I_SYS_DIR
11101 #ifdef hp9000s500
11102 #include <ndir.h>       /* may be wrong in the future */
11103 #else
11104 #include <sys/dir.h>
11105 #endif
11106 #endif
11107 #endif
11108 #endif 
11109 int main() {
11110         DIR *dirp = opendir(".");
11111         if (dirfd(dirp) >= 0)
11112                 exit(0);
11113         else
11114                 exit(1);
11115 }
11116 EOM
11117 val=$undef
11118 set dirfd
11119 if eval $compile; then
11120         val="$define"
11121 fi
11122 case "$val" in
11123 $define)        echo "dirfd() found." >&4       ;;
11124 *)              echo "dirfd() NOT found." >&4   ;;
11125 esac
11126 set d_dirfd
11127 eval $setvar
11128 $rm -f dirfd*
11129
11130 : see if dlerror exists
11131 xxx_runnm="$runnm"
11132 runnm=false
11133 set dlerror d_dlerror
11134 eval $inlibc
11135 runnm="$xxx_runnm"
11136
11137 : see if dlfcn is available
11138 set dlfcn.h i_dlfcn
11139 eval $inhdr
11140
11141 case "$usedl" in
11142 $define|y|true)
11143         $cat << EOM
11144
11145 On a few systems, the dynamically loaded modules that perl generates and uses
11146 will need a different extension than shared libs. The default will probably
11147 be appropriate.
11148
11149 EOM
11150         case "$dlext" in
11151         '')     dflt="$so" ;;
11152         *)      dflt="$dlext" ;;
11153         esac
11154         rp='What is the extension of dynamically loaded modules'
11155         . ./myread
11156         dlext="$ans"
11157         ;;
11158 *)
11159         dlext="none"
11160         ;;
11161 esac
11162
11163 : Check if dlsym need a leading underscore
11164 echo " "
11165 val="$undef"
11166
11167 case "$dlsrc" in
11168 dl_dlopen.xs)
11169         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11170         $cat >dyna.c <<'EOM'
11171 fred () { }
11172 EOM
11173
11174 $cat >fred.c<<EOM
11175
11176 #include <stdio.h>
11177 #$i_stdlib I_STDLIB
11178 #ifdef I_STDLIB
11179 #include <stdlib.h>
11180 #endif
11181 #$i_dlfcn I_DLFCN
11182 #ifdef I_DLFCN
11183 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11184 #else
11185 #include <sys/types.h>
11186 #include <nlist.h>
11187 #include <link.h>
11188 #endif
11189
11190 extern int fred() ;
11191
11192 int main()
11193 {
11194     void * handle ;
11195     void * symbol ;
11196 #ifndef RTLD_LAZY
11197     int mode = 1 ;
11198 #else
11199     int mode = RTLD_LAZY ;
11200 #endif
11201     handle = dlopen("./dyna.$dlext", mode) ;
11202     if (handle == NULL) {
11203         printf ("1\n") ;
11204         fflush (stdout) ;
11205         exit(0);
11206     }
11207     symbol = dlsym(handle, "fred") ;
11208     if (symbol == NULL) {
11209         /* try putting a leading underscore */
11210         symbol = dlsym(handle, "_fred") ;
11211         if (symbol == NULL) {
11212             printf ("2\n") ;
11213             fflush (stdout) ;
11214             exit(0);
11215         }
11216         printf ("3\n") ;
11217     }
11218     else
11219         printf ("4\n") ;
11220     fflush (stdout) ;
11221     exit(0);
11222 }
11223 EOM
11224         : Call the object file tmp-dyna.o in case dlext=o.
11225         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
11226                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
11227                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
11228                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11229                 xxx=`$run ./fred`
11230                 case $xxx in
11231                 1)      echo "Test program failed using dlopen." >&4
11232                         echo "Perhaps you should not use dynamic loading." >&4;;
11233                 2)      echo "Test program failed using dlsym." >&4
11234                         echo "Perhaps you should not use dynamic loading." >&4;;
11235                 3)      echo "dlsym needs a leading underscore" >&4
11236                         val="$define" ;;
11237                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11238                 esac
11239         else
11240                 echo "I can't compile and run the test program." >&4
11241                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11242         fi
11243         ;;
11244 esac
11245                 
11246 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11247
11248 set d_dlsymun
11249 eval $setvar
11250
11251 : see if drand48_r exists
11252 set drand48_r d_drand48_r
11253 eval $inlibc
11254 case "$d_drand48_r" in
11255 "$define")
11256         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11257         case "$d_drand48_r_proto:$usethreads" in
11258         ":define")      d_drand48_r_proto=define
11259                 set d_drand48_r_proto drand48_r $hdrs
11260                 eval $hasproto ;;
11261         *)      ;;
11262         esac
11263         case "$d_drand48_r_proto" in
11264         define)
11265         case "$drand48_r_proto" in
11266         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11267         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11268         esac
11269         case "$drand48_r_proto" in
11270         ''|0)   d_drand48_r=undef
11271                 drand48_r_proto=0
11272                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11273         * )     case "$drand48_r_proto" in
11274                 REENTRANT_PROTO*) ;;
11275                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11276                 esac
11277                 echo "Prototype: $try" ;;
11278         esac
11279         ;;
11280         *)      case "$usethreads" in
11281                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11282                 esac
11283                 d_drand48_r=undef
11284                 drand48_r_proto=0
11285                 ;;
11286         esac
11287         ;;
11288 *)      drand48_r_proto=0
11289         ;;
11290 esac
11291
11292 : see if prototype for drand48 is available
11293 echo " "
11294 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11295 eval $hasproto
11296
11297 : see if dup2 exists
11298 set dup2 d_dup2
11299 eval $inlibc
11300
11301 : see if eaccess exists
11302 set eaccess d_eaccess
11303 eval $inlibc
11304
11305 : see if endgrent exists
11306 set endgrent d_endgrent
11307 eval $inlibc
11308
11309 : see if this is an grp system
11310 set grp.h i_grp
11311 eval $inhdr
11312
11313 case "$i_grp" in
11314 $define)
11315         xxx=`./findhdr grp.h`
11316         $cppstdin $cppflags $cppminus < $xxx >$$.h
11317
11318         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11319                 val="$define"
11320         else
11321                 val="$undef"
11322         fi
11323         set d_grpasswd
11324         eval $setvar
11325
11326         $rm -f $$.h
11327         ;;
11328 *)
11329         val="$undef";
11330         set d_grpasswd; eval $setvar
11331         ;;
11332 esac
11333
11334 : see if endgrent_r exists
11335 set endgrent_r d_endgrent_r
11336 eval $inlibc
11337 case "$d_endgrent_r" in
11338 "$define")
11339         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11340         case "$d_endgrent_r_proto:$usethreads" in
11341         ":define")      d_endgrent_r_proto=define
11342                 set d_endgrent_r_proto endgrent_r $hdrs
11343                 eval $hasproto ;;
11344         *)      ;;
11345         esac
11346         case "$d_endgrent_r_proto" in
11347         define)
11348         case "$endgrent_r_proto" in
11349         ''|0) try='int endgrent_r(FILE**);'
11350         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11351         esac
11352         case "$endgrent_r_proto" in
11353         ''|0) try='void endgrent_r(FILE**);'
11354         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11355         esac
11356         case "$endgrent_r_proto" in
11357         ''|0)   d_endgrent_r=undef
11358                 endgrent_r_proto=0
11359                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11360         * )     case "$endgrent_r_proto" in
11361                 REENTRANT_PROTO*) ;;
11362                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11363                 esac
11364                 echo "Prototype: $try" ;;
11365         esac
11366         ;;
11367         *)      case "$usethreads" in
11368                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11369                 esac
11370                 d_endgrent_r=undef
11371                 endgrent_r_proto=0
11372                 ;;
11373         esac
11374         ;;
11375 *)      endgrent_r_proto=0
11376         ;;
11377 esac
11378
11379 : see if endhostent exists
11380 set endhostent d_endhent
11381 eval $inlibc
11382
11383 : see if this is a netdb.h system
11384 set netdb.h i_netdb
11385 eval $inhdr
11386
11387 : see if endhostent_r exists
11388 set endhostent_r d_endhostent_r
11389 eval $inlibc
11390 case "$d_endhostent_r" in
11391 "$define")
11392         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11393         case "$d_endhostent_r_proto:$usethreads" in
11394         ":define")      d_endhostent_r_proto=define
11395                 set d_endhostent_r_proto endhostent_r $hdrs
11396                 eval $hasproto ;;
11397         *)      ;;
11398         esac
11399         case "$d_endhostent_r_proto" in
11400         define)
11401         case "$endhostent_r_proto" in
11402         ''|0) try='int endhostent_r(struct hostent_data*);'
11403         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11404         esac
11405         case "$endhostent_r_proto" in
11406         ''|0) try='void endhostent_r(struct hostent_data*);'
11407         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11408         esac
11409         case "$endhostent_r_proto" in
11410         ''|0)   d_endhostent_r=undef
11411                 endhostent_r_proto=0
11412                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11413         * )     case "$endhostent_r_proto" in
11414                 REENTRANT_PROTO*) ;;
11415                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11416                 esac
11417                 echo "Prototype: $try" ;;
11418         esac
11419         ;;
11420         *)      case "$usethreads" in
11421                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11422                 esac
11423                 d_endhostent_r=undef
11424                 endhostent_r_proto=0
11425                 ;;
11426         esac
11427         ;;
11428 *)      endhostent_r_proto=0
11429         ;;
11430 esac
11431
11432 : see if endnetent exists
11433 set endnetent d_endnent
11434 eval $inlibc
11435
11436 : see if endnetent_r exists
11437 set endnetent_r d_endnetent_r
11438 eval $inlibc
11439 case "$d_endnetent_r" in
11440 "$define")
11441         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11442         case "$d_endnetent_r_proto:$usethreads" in
11443         ":define")      d_endnetent_r_proto=define
11444                 set d_endnetent_r_proto endnetent_r $hdrs
11445                 eval $hasproto ;;
11446         *)      ;;
11447         esac
11448         case "$d_endnetent_r_proto" in
11449         define)
11450         case "$endnetent_r_proto" in
11451         ''|0) try='int endnetent_r(struct netent_data*);'
11452         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11453         esac
11454         case "$endnetent_r_proto" in
11455         ''|0) try='void endnetent_r(struct netent_data*);'
11456         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11457         esac
11458         case "$endnetent_r_proto" in
11459         ''|0)   d_endnetent_r=undef
11460                 endnetent_r_proto=0
11461                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11462         * )     case "$endnetent_r_proto" in
11463                 REENTRANT_PROTO*) ;;
11464                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11465                 esac
11466                 echo "Prototype: $try" ;;
11467         esac
11468         ;;
11469         *)      case "$usethreads" in
11470                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11471                 esac
11472                 d_endnetent_r=undef
11473                 endnetent_r_proto=0
11474                 ;;
11475         esac
11476         ;;
11477 *)      endnetent_r_proto=0
11478         ;;
11479 esac
11480
11481 : see if endprotoent exists
11482 set endprotoent d_endpent
11483 eval $inlibc
11484
11485 : see if endprotoent_r exists
11486 set endprotoent_r d_endprotoent_r
11487 eval $inlibc
11488 case "$d_endprotoent_r" in
11489 "$define")
11490         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11491         case "$d_endprotoent_r_proto:$usethreads" in
11492         ":define")      d_endprotoent_r_proto=define
11493                 set d_endprotoent_r_proto endprotoent_r $hdrs
11494                 eval $hasproto ;;
11495         *)      ;;
11496         esac
11497         case "$d_endprotoent_r_proto" in
11498         define)
11499         case "$endprotoent_r_proto" in
11500         ''|0) try='int endprotoent_r(struct protoent_data*);'
11501         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11502         esac
11503         case "$endprotoent_r_proto" in
11504         ''|0) try='void endprotoent_r(struct protoent_data*);'
11505         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11506         esac
11507         case "$endprotoent_r_proto" in
11508         ''|0)   d_endprotoent_r=undef
11509                 endprotoent_r_proto=0
11510                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11511         * )     case "$endprotoent_r_proto" in
11512                 REENTRANT_PROTO*) ;;
11513                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11514                 esac
11515                 echo "Prototype: $try" ;;
11516         esac
11517         ;;
11518         *)      case "$usethreads" in
11519                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11520                 esac
11521                 d_endprotoent_r=undef
11522                 endprotoent_r_proto=0
11523                 ;;
11524         esac
11525         ;;
11526 *)      endprotoent_r_proto=0
11527         ;;
11528 esac
11529
11530 : see if endpwent exists
11531 set endpwent d_endpwent
11532 eval $inlibc
11533
11534 : see if this is a pwd.h system
11535 set pwd.h i_pwd
11536 eval $inhdr
11537
11538 case "$i_pwd" in
11539 $define)
11540         xxx=`./findhdr pwd.h`
11541         $cppstdin $cppflags $cppminus < $xxx >$$.h
11542
11543         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11544                 val="$define"
11545         else
11546                 val="$undef"
11547         fi
11548         set d_pwquota
11549         eval $setvar
11550
11551         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11552                 val="$define"
11553         else
11554                 val="$undef"
11555         fi
11556         set d_pwage
11557         eval $setvar
11558
11559         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11560                 val="$define"
11561         else
11562                 val="$undef"
11563         fi
11564         set d_pwchange
11565         eval $setvar
11566
11567         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11568                 val="$define"
11569         else
11570                 val="$undef"
11571         fi
11572         set d_pwclass
11573         eval $setvar
11574
11575         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11576                 val="$define"
11577         else
11578                 val="$undef"
11579         fi
11580         set d_pwexpire
11581         eval $setvar
11582
11583         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11584                 val="$define"
11585         else
11586                 val="$undef"
11587         fi
11588         set d_pwcomment
11589         eval $setvar
11590
11591         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11592                 val="$define"
11593         else
11594                 val="$undef"
11595         fi
11596         set d_pwgecos
11597         eval $setvar
11598
11599         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11600                 val="$define"
11601         else
11602                 val="$undef"
11603         fi
11604         set d_pwpasswd
11605         eval $setvar
11606
11607         $rm -f $$.h
11608         ;;
11609 *)
11610         val="$undef"; 
11611         set d_pwquota; eval $setvar
11612         set d_pwage; eval $setvar
11613         set d_pwchange; eval $setvar
11614         set d_pwclass; eval $setvar
11615         set d_pwexpire; eval $setvar
11616         set d_pwcomment; eval $setvar
11617         set d_pwgecos; eval $setvar
11618         set d_pwpasswd; eval $setvar
11619         ;;
11620 esac
11621
11622 : see if endpwent_r exists
11623 set endpwent_r d_endpwent_r
11624 eval $inlibc
11625 case "$d_endpwent_r" in
11626 "$define")
11627         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11628         case "$d_endpwent_r_proto:$usethreads" in
11629         ":define")      d_endpwent_r_proto=define
11630                 set d_endpwent_r_proto endpwent_r $hdrs
11631                 eval $hasproto ;;
11632         *)      ;;
11633         esac
11634         case "$d_endpwent_r_proto" in
11635         define)
11636         case "$endpwent_r_proto" in
11637         ''|0) try='int endpwent_r(FILE**);'
11638         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11639         esac
11640         case "$endpwent_r_proto" in
11641         ''|0) try='void endpwent_r(FILE**);'
11642         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11643         esac
11644         case "$endpwent_r_proto" in
11645         ''|0)   d_endpwent_r=undef
11646                 endpwent_r_proto=0
11647                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
11648         * )     case "$endpwent_r_proto" in
11649                 REENTRANT_PROTO*) ;;
11650                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11651                 esac
11652                 echo "Prototype: $try" ;;
11653         esac
11654         ;;
11655         *)      case "$usethreads" in
11656                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11657                 esac
11658                 d_endpwent_r=undef
11659                 endpwent_r_proto=0
11660                 ;;
11661         esac
11662         ;;
11663 *)      endpwent_r_proto=0
11664         ;;
11665 esac
11666
11667 : see if endservent exists
11668 set endservent d_endsent
11669 eval $inlibc
11670
11671 : see if endservent_r exists
11672 set endservent_r d_endservent_r
11673 eval $inlibc
11674 case "$d_endservent_r" in
11675 "$define")
11676         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11677         case "$d_endservent_r_proto:$usethreads" in
11678         ":define")      d_endservent_r_proto=define
11679                 set d_endservent_r_proto endservent_r $hdrs
11680                 eval $hasproto ;;
11681         *)      ;;
11682         esac
11683         case "$d_endservent_r_proto" in
11684         define)
11685         case "$endservent_r_proto" in
11686         ''|0) try='int endservent_r(struct servent_data*);'
11687         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
11688         esac
11689         case "$endservent_r_proto" in
11690         ''|0) try='void endservent_r(struct servent_data*);'
11691         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
11692         esac
11693         case "$endservent_r_proto" in
11694         ''|0)   d_endservent_r=undef
11695                 endservent_r_proto=0
11696                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
11697         * )     case "$endservent_r_proto" in
11698                 REENTRANT_PROTO*) ;;
11699                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11700                 esac
11701                 echo "Prototype: $try" ;;
11702         esac
11703         ;;
11704         *)      case "$usethreads" in
11705                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11706                 esac
11707                 d_endservent_r=undef
11708                 endservent_r_proto=0
11709                 ;;
11710         esac
11711         ;;
11712 *)      endservent_r_proto=0
11713         ;;
11714 esac
11715
11716 : Locate the flags for 'open()'
11717 echo " "
11718 $cat >try.c <<EOCP
11719 #include <sys/types.h>
11720 #ifdef I_FCNTL
11721 #include <fcntl.h>
11722 #endif
11723 #ifdef I_SYS_FILE
11724 #include <sys/file.h>
11725 #endif
11726 #$i_stdlib I_STDLIB
11727 #ifdef I_STDLIB
11728 #include <stdlib.h>
11729 #endif
11730 int main() {
11731         if(O_RDONLY);
11732 #ifdef O_TRUNC
11733         exit(0);
11734 #else
11735         exit(1);
11736 #endif
11737 }
11738 EOCP
11739 : check sys/file.h first to get FREAD on Sun
11740 if $test `./findhdr sys/file.h` && \
11741                 set try -DI_SYS_FILE && eval $compile; then
11742         h_sysfile=true;
11743         echo "<sys/file.h> defines the O_* constants..." >&4
11744         if $run ./try; then
11745                 echo "and you have the 3 argument form of open()." >&4
11746                 val="$define"
11747         else
11748                 echo "but not the 3 argument form of open().  Oh, well." >&4
11749                 val="$undef"
11750         fi
11751 elif $test `./findhdr fcntl.h` && \
11752                 set try -DI_FCNTL && eval $compile; then
11753         h_fcntl=true;
11754         echo "<fcntl.h> defines the O_* constants..." >&4
11755         if $run ./try; then
11756                 echo "and you have the 3 argument form of open()." >&4
11757                 val="$define"
11758         else
11759                 echo "but not the 3 argument form of open().  Oh, well." >&4
11760                 val="$undef"
11761         fi
11762 else
11763         val="$undef"
11764         echo "I can't find the O_* constant definitions!  You got problems." >&4
11765 fi
11766 set d_open3
11767 eval $setvar
11768 $rm -f try try.*
11769
11770 : see which of string.h or strings.h is needed
11771 echo " "
11772 strings=`./findhdr string.h`
11773 if $test "$strings" && $test -r "$strings"; then
11774         echo "Using <string.h> instead of <strings.h>." >&4
11775         val="$define"
11776 else
11777         val="$undef"
11778         strings=`./findhdr strings.h`
11779         if $test "$strings" && $test -r "$strings"; then
11780                 echo "Using <strings.h> instead of <string.h>." >&4
11781         else
11782                 echo "No string header found -- You'll surely have problems." >&4
11783         fi
11784 fi
11785 set i_string
11786 eval $setvar
11787 case "$i_string" in
11788 "$undef") strings=`./findhdr strings.h`;;
11789 *)        strings=`./findhdr string.h`;;
11790 esac
11791
11792 : see if this is a sys/file.h system
11793 val=''
11794 set sys/file.h val
11795 eval $inhdr
11796
11797 : do we need to include sys/file.h ?
11798 case "$val" in
11799 "$define")
11800         echo " "
11801         if $h_sysfile; then
11802                 val="$define"
11803                 echo "We'll be including <sys/file.h>." >&4
11804         else
11805                 val="$undef"
11806                 echo "We won't be including <sys/file.h>." >&4
11807         fi
11808         ;;
11809 *)
11810         h_sysfile=false
11811         ;;
11812 esac
11813 set i_sysfile
11814 eval $setvar
11815
11816 : see if fcntl.h is there
11817 val=''
11818 set fcntl.h val
11819 eval $inhdr
11820
11821 : see if we can include fcntl.h
11822 case "$val" in
11823 "$define")
11824         echo " "
11825         if $h_fcntl; then
11826                 val="$define"
11827                 echo "We'll be including <fcntl.h>." >&4
11828         else
11829                 val="$undef"
11830                 if $h_sysfile; then
11831         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11832                 else
11833                         echo "We won't be including <fcntl.h>." >&4
11834                 fi
11835         fi
11836         ;;
11837 *)
11838         h_fcntl=false
11839         val="$undef"
11840         ;;
11841 esac
11842 set i_fcntl
11843 eval $setvar
11844
11845 : check for non-blocking I/O stuff
11846 case "$h_sysfile" in
11847 true) echo "#include <sys/file.h>" > head.c;;
11848 *)
11849        case "$h_fcntl" in
11850        true) echo "#include <fcntl.h>" > head.c;;
11851        *) echo "#include <sys/fcntl.h>" > head.c;;
11852        esac
11853        ;;
11854 esac
11855 echo " "
11856 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11857 case "$o_nonblock" in
11858 '')
11859         $cat head.c > try.c
11860         $cat >>try.c <<EOCP
11861 #include <stdio.h>
11862 #$i_stdlib I_STDLIB
11863 #ifdef I_STDLIB
11864 #include <stdlib.h>
11865 #endif
11866 #$i_fcntl I_FCNTL
11867 #ifdef I_FCNTL
11868 #include <fcntl.h>
11869 #endif
11870 int main() {
11871 #ifdef O_NONBLOCK
11872         printf("O_NONBLOCK\n");
11873         exit(0);
11874 #endif
11875 #ifdef O_NDELAY
11876         printf("O_NDELAY\n");
11877         exit(0);
11878 #endif
11879 #ifdef FNDELAY
11880         printf("FNDELAY\n");
11881         exit(0);
11882 #endif
11883         exit(0);
11884 }
11885 EOCP
11886         set try
11887         if eval $compile_ok; then
11888                 o_nonblock=`$run ./try`
11889                 case "$o_nonblock" in
11890                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11891                 *) echo "Seems like we can use $o_nonblock.";;
11892                 esac
11893         else
11894                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11895         fi
11896         ;;
11897 *) echo "Using $hint value $o_nonblock.";;
11898 esac
11899 $rm -f try try.* .out core
11900
11901 echo " "
11902 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11903 case "$eagain" in
11904 '')
11905         $cat head.c > try.c
11906         $cat >>try.c <<EOCP
11907 #include <errno.h>
11908 #include <sys/types.h>
11909 #include <signal.h>
11910 #include <stdio.h> 
11911 #$i_stdlib I_STDLIB
11912 #ifdef I_STDLIB
11913 #include <stdlib.h>
11914 #endif
11915 #$i_fcntl I_FCNTL
11916 #ifdef I_FCNTL
11917 #include <fcntl.h>
11918 #endif
11919 #define MY_O_NONBLOCK $o_nonblock
11920 #ifndef errno  /* XXX need better Configure test */
11921 extern int errno;
11922 #endif
11923 #$i_unistd I_UNISTD
11924 #ifdef I_UNISTD
11925 #include <unistd.h>
11926 #endif
11927 #$i_string I_STRING
11928 #ifdef I_STRING
11929 #include <string.h>
11930 #else
11931 #include <strings.h>
11932 #endif
11933 $signal_t blech(x) int x; { exit(3); }
11934 EOCP
11935         $cat >> try.c <<'EOCP'
11936 int main()
11937 {
11938         int pd[2];
11939         int pu[2];
11940         char buf[1];
11941         char string[100];
11942
11943         pipe(pd);       /* Down: child -> parent */
11944         pipe(pu);       /* Up: parent -> child */
11945         if (0 != fork()) {
11946                 int ret;
11947                 close(pd[1]);   /* Parent reads from pd[0] */
11948                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11949 #ifdef F_SETFL
11950                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11951                         exit(1);
11952 #else
11953                 exit(4);
11954 #endif
11955                 signal(SIGALRM, blech);
11956                 alarm(5);
11957                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11958                         exit(2);
11959                 sprintf(string, "%d\n", ret);
11960                 write(2, string, strlen(string));
11961                 alarm(0);
11962 #ifdef EAGAIN
11963                 if (errno == EAGAIN) {
11964                         printf("EAGAIN\n");
11965                         goto ok;
11966                 }
11967 #endif
11968 #ifdef EWOULDBLOCK
11969                 if (errno == EWOULDBLOCK)
11970                         printf("EWOULDBLOCK\n");
11971 #endif
11972         ok:
11973                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11974                 sleep(2);                               /* Give it time to close our pipe */
11975                 alarm(5);
11976                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11977                 alarm(0);
11978                 sprintf(string, "%d\n", ret);
11979                 write(4, string, strlen(string));
11980                 exit(0);
11981         }
11982
11983         close(pd[0]);                   /* We write to pd[1] */
11984         close(pu[1]);                   /* We read from pu[0] */
11985         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11986         close(pd[1]);                   /* Pipe pd is now fully closed! */
11987         exit(0);                                /* Bye bye, thank you for playing! */
11988 }
11989 EOCP
11990         set try
11991         if eval $compile_ok; then
11992                 echo "$startsh" >mtry
11993                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11994                 chmod +x mtry
11995                 ./mtry >/dev/null 2>&1
11996                 case $? in
11997                 0) eagain=`$cat try.out`;;
11998                 1) echo "Could not perform non-blocking setting!";;
11999                 2) echo "I did a successful read() for something that was not there!";;
12000                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12001                 4) echo "Could not find F_SETFL!";;
12002                 *) echo "Something terribly wrong happened during testing.";;
12003                 esac
12004                 rd_nodata=`$cat try.ret`
12005                 echo "A read() system call with no data present returns $rd_nodata."
12006                 case "$rd_nodata" in
12007                 0|-1) ;;
12008                 *)
12009                         echo "(That's peculiar, fixing that to be -1.)"
12010                         rd_nodata=-1
12011                         ;;
12012                 esac
12013                 case "$eagain" in
12014                 '')
12015                         echo "Forcing errno EAGAIN on read() with no data available."
12016                         eagain=EAGAIN
12017                         ;;
12018                 *)
12019                         echo "Your read() sets errno to $eagain when no data is available."
12020                         ;;
12021                 esac
12022                 status=`$cat try.err`
12023                 case "$status" in
12024                 0) echo "And it correctly returns 0 to signal EOF.";;
12025                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12026                 *) echo "However, your read() returns '$status' on EOF??";;
12027                 esac
12028                 val="$define"
12029                 if test "$status" = "$rd_nodata"; then
12030                         echo "WARNING: you can't distinguish between EOF and no data!"
12031                         val="$undef"
12032                 fi
12033         else
12034                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12035                 eagain=EAGAIN
12036         fi
12037         set d_eofnblk
12038         eval $setvar
12039         ;;
12040 *)
12041         echo "Using $hint value $eagain."
12042         echo "Your read() returns $rd_nodata when no data is present."
12043         case "$d_eofnblk" in
12044         "$define") echo "And you can see EOF because read() returns 0.";;
12045         "$undef") echo "But you can't see EOF status from read() returned value.";;
12046         *)
12047                 echo "(Assuming you can't see EOF status from read anyway.)"
12048                 d_eofnblk=$undef
12049                 ;;
12050         esac
12051         ;;
12052 esac
12053 $rm -f try try.* .out core head.c mtry
12054
12055 : see if _ptr and _cnt from stdio act std
12056 echo " "
12057
12058 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12059         echo "(Looks like you have stdio.h from BSD.)"
12060         case "$stdio_ptr" in
12061         '') stdio_ptr='((fp)->_p)'
12062                 ptr_lval=$define
12063                 ;;
12064         *)      ptr_lval=$d_stdio_ptr_lval;;
12065         esac
12066         case "$stdio_cnt" in
12067         '') stdio_cnt='((fp)->_r)'
12068                 cnt_lval=$define
12069                 ;;
12070         *)      cnt_lval=$d_stdio_cnt_lval;;
12071         esac
12072         case "$stdio_base" in
12073         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12074         esac
12075         case "$stdio_bufsiz" in
12076         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12077         esac
12078 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12079         echo "(Looks like you have stdio.h from Linux.)"
12080         case "$stdio_ptr" in
12081         '') stdio_ptr='((fp)->_IO_read_ptr)'
12082                 ptr_lval=$define
12083                 ;;
12084         *)      ptr_lval=$d_stdio_ptr_lval;;
12085         esac
12086         case "$stdio_cnt" in
12087         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12088                 cnt_lval=$undef
12089                 ;;
12090         *)      cnt_lval=$d_stdio_cnt_lval;;
12091         esac
12092         case "$stdio_base" in
12093         '') stdio_base='((fp)->_IO_read_base)';;
12094         esac
12095         case "$stdio_bufsiz" in
12096         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12097         esac
12098 else
12099         case "$stdio_ptr" in
12100         '') stdio_ptr='((fp)->_ptr)'
12101                 ptr_lval=$define
12102                 ;;
12103         *)      ptr_lval=$d_stdio_ptr_lval;;
12104         esac
12105         case "$stdio_cnt" in
12106         '') stdio_cnt='((fp)->_cnt)'
12107                 cnt_lval=$define
12108                 ;;
12109         *)      cnt_lval=$d_stdio_cnt_lval;;
12110         esac
12111         case "$stdio_base" in
12112         '') stdio_base='((fp)->_base)';;
12113         esac
12114         case "$stdio_bufsiz" in
12115         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12116         esac
12117 fi
12118
12119 : test whether _ptr and _cnt really work
12120 echo "Checking how std your stdio is..." >&4
12121 $cat >try.c <<EOP
12122 #include <stdio.h>
12123 #$i_stdlib I_STDLIB
12124 #ifdef I_STDLIB
12125 #include <stdlib.h>
12126 #endif
12127 #define FILE_ptr(fp)    $stdio_ptr
12128 #define FILE_cnt(fp)    $stdio_cnt
12129 int main() {
12130         FILE *fp = fopen("try.c", "r");
12131         char c = getc(fp);
12132         if (
12133                 18 <= FILE_cnt(fp) &&
12134                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12135         )
12136                 exit(0);
12137         exit(1);
12138 }
12139 EOP
12140 val="$undef"
12141 set try
12142 if eval $compile && $to try.c; then
12143         if $run ./try; then
12144                 echo "Your stdio acts pretty std."
12145                 val="$define"
12146         else
12147                 echo "Your stdio isn't very std."
12148         fi
12149 else
12150         echo "Your stdio doesn't appear very std."
12151 fi
12152 $rm -f try.c try
12153
12154 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12155 # direct buffer manipulation no longer works.  The Configure tests
12156 # should be changed to correctly detect this, but until then,
12157 # the following check should at least let perl compile and run.
12158 # (This quick fix should be updated before 5.8.1.)
12159 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12160 # A. Dougherty, June 3, 2002.
12161 case "$d_gnulibc" in
12162 $define)
12163         case "$gnulibc_version" in
12164         2.[01]*)  ;;
12165         2.2) ;;
12166         2.2.[0-9]) ;;
12167         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12168                 val="$undef"
12169                 ;;
12170         esac
12171         ;;
12172 esac
12173 set d_stdstdio
12174 eval $setvar
12175
12176 : Can _ptr be used as an lvalue?
12177 case "$d_stdstdio$ptr_lval" in
12178 $define$define) val=$define ;;
12179 *) val=$undef ;;
12180 esac
12181 set d_stdio_ptr_lval
12182 eval $setvar
12183
12184 : Can _cnt be used as an lvalue?
12185 case "$d_stdstdio$cnt_lval" in
12186 $define$define) val=$define ;;
12187 *) val=$undef ;;
12188 esac
12189 set d_stdio_cnt_lval
12190 eval $setvar
12191
12192
12193 : test whether setting _ptr sets _cnt as a side effect
12194 d_stdio_ptr_lval_sets_cnt="$undef"
12195 d_stdio_ptr_lval_nochange_cnt="$undef"
12196 case "$d_stdio_ptr_lval$d_stdstdio" in
12197 $define$define)
12198         echo "Checking to see what happens if we set the stdio ptr..." >&4
12199 $cat >try.c <<EOP
12200 #include <stdio.h>
12201 /* Can we scream? */
12202 /* Eat dust sed :-) */
12203 /* In the buffer space, no one can hear you scream. */
12204 #$i_stdlib I_STDLIB
12205 #ifdef I_STDLIB
12206 #include <stdlib.h>
12207 #endif
12208 #define FILE_ptr(fp)    $stdio_ptr
12209 #define FILE_cnt(fp)    $stdio_cnt
12210 #include <sys/types.h>
12211 int main() {
12212         FILE *fp = fopen("try.c", "r");
12213         int c;
12214         char *ptr;
12215         size_t cnt;
12216         if (!fp) {
12217             puts("Fail even to read");
12218             exit(1);
12219         }
12220         c = getc(fp); /* Read away the first # */
12221         if (c == EOF) {
12222             puts("Fail even to read");
12223             exit(1);
12224         }
12225         if (!(
12226                 18 <= FILE_cnt(fp) &&
12227                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12228         )) {
12229                 puts("Fail even to read");
12230                 exit (1);
12231         }
12232         ptr = (char*) FILE_ptr(fp);
12233         cnt = (size_t)FILE_cnt(fp);
12234
12235         FILE_ptr(fp) += 42;
12236
12237         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12238                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12239                 exit (1);
12240         }
12241         if (FILE_cnt(fp) <= 20) {
12242                 printf ("Fail (<20 chars to test)");
12243                 exit (1);
12244         }
12245         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12246                 puts("Fail compare");
12247                 exit (1);
12248         }
12249         if (cnt == FILE_cnt(fp)) {
12250                 puts("Pass_unchanged");
12251                 exit (0);
12252         }       
12253         if (FILE_cnt(fp) == (cnt - 42)) {
12254                 puts("Pass_changed");
12255                 exit (0);
12256         }
12257         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12258         return 1;
12259
12260 }
12261 EOP
12262         set try
12263         if eval $compile && $to try.c; then
12264                 case `$run ./try` in
12265                 Pass_changed)
12266                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12267                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12268                 Pass_unchanged)
12269                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12270                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12271                 Fail*)
12272                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12273                 *)
12274                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12275         esac
12276         else
12277                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12278         fi
12279         $rm -f try.c try
12280         ;;
12281 esac
12282
12283 : see if _base is also standard
12284 val="$undef"
12285 case "$d_stdstdio" in
12286 $define)
12287         $cat >try.c <<EOP
12288 #include <stdio.h>
12289 #$i_stdlib I_STDLIB
12290 #ifdef I_STDLIB
12291 #include <stdlib.h>
12292 #endif
12293 #define FILE_base(fp)   $stdio_base
12294 #define FILE_bufsiz(fp) $stdio_bufsiz
12295 int main() {
12296         FILE *fp = fopen("try.c", "r");
12297         char c = getc(fp);
12298         if (
12299                 19 <= FILE_bufsiz(fp) &&
12300                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12301         )
12302                 exit(0);
12303         exit(1);
12304 }
12305 EOP
12306         set try
12307         if eval $compile && $to try.c; then
12308                 if $run ./try; then
12309                         echo "And its _base field acts std."
12310                         val="$define"
12311                 else
12312                         echo "But its _base field isn't std."
12313                 fi
12314         else
12315                 echo "However, it seems to be lacking the _base field."
12316         fi
12317         $rm -f try.c try
12318         ;;
12319 esac
12320 set d_stdiobase
12321 eval $setvar
12322
12323 : see if fast_stdio exists
12324 val="$undef"
12325 case "$d_stdstdio:$d_stdio_ptr_lval" in
12326 "$define:$define")
12327         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12328         *$define*)
12329                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12330                 val="$define"
12331                 ;;
12332         esac
12333         ;;
12334 esac
12335 set d_faststdio
12336 eval $setvar
12337
12338
12339
12340 : see if fchdir exists
12341 set fchdir d_fchdir
12342 eval $inlibc
12343
12344 : see if fchmod exists
12345 set fchmod d_fchmod
12346 eval $inlibc
12347
12348 : see if fchown exists
12349 set fchown d_fchown
12350 eval $inlibc
12351
12352 : see if this is an fcntl system
12353 set fcntl d_fcntl
12354 eval $inlibc
12355
12356 echo " "
12357 : See if fcntl-based locking works.
12358 $cat >try.c <<EOCP
12359 #$i_stdlib I_STDLIB
12360 #ifdef I_STDLIB
12361 #include <stdlib.h>
12362 #endif
12363 #include <unistd.h>
12364 #include <fcntl.h>
12365 #include <signal.h>
12366 $signal_t blech(x) int x; { exit(3); }
12367 int main() {
12368 #if defined(F_SETLK) && defined(F_SETLKW)
12369      struct flock flock;
12370      int retval, fd;
12371      fd = open("try.c", O_RDONLY);
12372      flock.l_type = F_RDLCK;
12373      flock.l_whence = SEEK_SET;
12374      flock.l_start = flock.l_len = 0;
12375      signal(SIGALRM, blech);
12376      alarm(10);
12377      retval = fcntl(fd, F_SETLK, &flock);
12378      close(fd);
12379      (retval < 0 ? exit(2) : exit(0));
12380 #else
12381      exit(2);
12382 #endif
12383 }
12384 EOCP
12385 echo "Checking if fcntl-based file locking works... "
12386 case "$d_fcntl" in
12387 "$define")
12388         set try
12389         if eval $compile_ok; then
12390                 if $run ./try; then
12391                         echo "Yes, it seems to work."
12392                         val="$define"
12393                 else
12394                         echo "Nope, it didn't work."
12395                         val="$undef"
12396                         case "$?" in
12397                         3) $cat >&4 <<EOM
12398 ***
12399 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12400 *** This is (almost) impossible.
12401 *** If your NFS lock daemons are not feeling well, something like
12402 *** this may happen, please investigate.  Cannot continue, aborting.
12403 ***
12404 EOM
12405                                 exit 1
12406                                 ;;
12407                         esac
12408                 fi
12409         else
12410                 echo "I'm unable to compile the test program, so I'll assume not."
12411                 val="$undef"
12412         fi
12413         ;;
12414 *) val="$undef";
12415         echo "Nope, since you don't even have fcntl()."
12416         ;;
12417 esac
12418 set d_fcntl_can_lock
12419 eval $setvar
12420 $rm -f try*
12421
12422
12423 : check for fd_set items
12424 $cat <<EOM
12425
12426 Checking to see how well your C compiler handles fd_set and friends ...
12427 EOM
12428 $cat >try.c <<EOCP
12429 #$i_stdlib I_STDLIB
12430 #ifdef I_STDLIB
12431 #include <stdlib.h>
12432 #endif
12433 #$i_systime I_SYS_TIME
12434 #$i_sysselct I_SYS_SELECT
12435 #$d_socket HAS_SOCKET
12436 #include <sys/types.h>
12437 #ifdef HAS_SOCKET
12438 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12439 #endif
12440 #ifdef I_SYS_TIME
12441 #include <sys/time.h>
12442 #endif
12443 #ifdef I_SYS_SELECT
12444 #include <sys/select.h>
12445 #endif
12446 int main() {
12447         fd_set fds;
12448
12449 #ifdef TRYBITS
12450         if(fds.fds_bits);
12451 #endif
12452
12453 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12454         exit(0);
12455 #else
12456         exit(1);
12457 #endif
12458 }
12459 EOCP
12460 set try -DTRYBITS
12461 if eval $compile; then
12462         d_fds_bits="$define"
12463         d_fd_set="$define"
12464         echo "Well, your system knows about the normal fd_set typedef..." >&4
12465         if $run ./try; then
12466                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12467                 d_fd_macros="$define"
12468         else
12469                 $cat >&4 <<'EOM'
12470 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12471 EOM
12472                 d_fd_macros="$undef"
12473         fi
12474 else
12475         $cat <<'EOM'
12476 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12477 EOM
12478         set try
12479         if eval $compile; then
12480                 d_fds_bits="$undef"
12481                 d_fd_set="$define"
12482                 echo "Well, your system has some sort of fd_set available..." >&4
12483                 if $run ./try; then
12484                         echo "and you have the normal fd_set macros." >&4
12485                         d_fd_macros="$define"
12486                 else
12487                         $cat <<'EOM'
12488 but not the normal fd_set macros!  Gross!  More work for me...
12489 EOM
12490                         d_fd_macros="$undef"
12491                 fi
12492         else
12493         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
12494                 d_fd_set="$undef"
12495                 d_fds_bits="$undef"
12496                 d_fd_macros="$undef"
12497         fi
12498 fi
12499 $rm -f try try.*
12500
12501 : see if fgetpos exists
12502 set fgetpos d_fgetpos
12503 eval $inlibc
12504
12505 : see if finite exists
12506 set finite d_finite
12507 eval $inlibc
12508
12509 : see if finitel exists
12510 set finitel d_finitel
12511 eval $inlibc
12512
12513 : see if flock exists
12514 set flock d_flock
12515 eval $inlibc
12516
12517 : see if prototype for flock is available
12518 echo " "
12519 set d_flockproto flock $i_sysfile sys/file.h
12520 eval $hasproto
12521
12522 : see if fork exists
12523 set fork d_fork
12524 eval $inlibc
12525
12526 : see if fp_class exists
12527 set fp_class d_fp_class
12528 eval $inlibc
12529
12530 : see if pathconf exists
12531 set pathconf d_pathconf
12532 eval $inlibc
12533
12534 : see if fpathconf exists
12535 set fpathconf d_fpathconf
12536 eval $inlibc
12537
12538 : see if fpclass exists
12539 set fpclass d_fpclass
12540 eval $inlibc
12541
12542 : see if fpclassify exists
12543 set fpclassify d_fpclassify
12544 eval $inlibc
12545
12546 : see if fpclassl exists
12547 set fpclassl d_fpclassl
12548 eval $inlibc
12549
12550
12551 : check for fpos64_t
12552 echo " "
12553 echo "Checking to see if you have fpos64_t..." >&4
12554 $cat >try.c <<EOCP
12555 #include <stdio.h>
12556 int main() { fpos64_t x = 7; }
12557 EOCP
12558 set try
12559 if eval $compile; then
12560         val="$define"
12561         echo "You have fpos64_t."
12562 else
12563         val="$undef"
12564         echo "You do not have fpos64_t."
12565         case "$fpossize" in
12566         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12567         esac
12568 fi
12569 $rm -f try.* try
12570 set d_fpos64_t
12571 eval $setvar
12572
12573 : see if frexpl exists
12574 set frexpl d_frexpl
12575 eval $inlibc
12576
12577 : see if this is a sys/param system
12578 set sys/param.h i_sysparam
12579 eval $inhdr
12580
12581 : see if this is a sys/mount.h system
12582 set sys/mount.h i_sysmount
12583 eval $inhdr
12584
12585
12586 echo " "
12587 echo "Checking to see if your system supports struct fs_data..." >&4
12588 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12589 eval $hasstruct
12590 case "$d_fs_data_s" in
12591 "$define")      echo "Yes, it does."   ;;
12592 *)              echo "No, it doesn't." ;;
12593 esac
12594
12595 : see if fseeko exists
12596 set fseeko d_fseeko
12597 eval $inlibc
12598 case "$longsize" in
12599 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12600 esac
12601
12602 : see if fsetpos exists
12603 set fsetpos d_fsetpos
12604 eval $inlibc
12605
12606
12607 : see if fstatfs exists
12608 set fstatfs d_fstatfs
12609 eval $inlibc
12610
12611
12612 : see if statvfs exists
12613 set statvfs d_statvfs
12614 eval $inlibc
12615
12616 : see if fstatvfs exists
12617 set fstatvfs d_fstatvfs
12618 eval $inlibc
12619
12620
12621 : see if fsync exists
12622 set fsync d_fsync
12623 eval $inlibc
12624
12625 : see if ftello exists
12626 set ftello d_ftello
12627 eval $inlibc
12628 case "$longsize" in
12629 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12630 esac
12631
12632 d_futimes="$undef"
12633 : check for a working futimes
12634 echo " "
12635 echo "Checking for a working futimes()" >&4
12636 $cat >try.c <<EOCP
12637 #include <stdio.h>
12638 #include <sys/time.h>
12639 #include <errno.h>
12640 #include <fcntl.h>
12641
12642 int main ()
12643 {
12644     int fd, rv;
12645     fd = open ("try.c", O_RDWR);
12646     if (-1 == fd) exit (1);
12647     rv = futimes (fd, NULL);
12648     exit (rv == -1 ? errno : 0);
12649 }
12650 EOCP
12651 set try
12652 if eval $compile; then
12653     `$run ./try`
12654     rc=$?
12655     case "$rc" in
12656         0)  echo "Yes, it does" >&4
12657             d_futimes="$define"
12658             ;;
12659         *)  echo "No, it has futimes, but it isn't working ($rc) (probably harmless)\n" >&4
12660             ;;
12661     esac
12662 else
12663     echo "No, it does not (probably harmless)\n" >&4
12664 fi
12665 $rm -f try.* try core core.try.*
12666
12667 : see if getcwd exists
12668 set getcwd d_getcwd
12669 eval $inlibc
12670
12671 : see if getespwnam exists
12672 set getespwnam d_getespwnam
12673 eval $inlibc
12674
12675
12676 : see if getfsstat exists
12677 set getfsstat d_getfsstat
12678 eval $inlibc
12679
12680 : see if getgrent exists
12681 set getgrent d_getgrent
12682 eval $inlibc
12683
12684 : see if getgrent_r exists
12685 set getgrent_r d_getgrent_r
12686 eval $inlibc
12687 case "$d_getgrent_r" in
12688 "$define")
12689         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12690         case "$d_getgrent_r_proto:$usethreads" in
12691         ":define")      d_getgrent_r_proto=define
12692                 set d_getgrent_r_proto getgrent_r $hdrs
12693                 eval $hasproto ;;
12694         *)      ;;
12695         esac
12696         case "$d_getgrent_r_proto" in
12697         define)
12698         case "$getgrent_r_proto" in
12699         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
12700         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
12701         esac
12702         case "$getgrent_r_proto" in
12703         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
12704         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
12705         esac
12706         case "$getgrent_r_proto" in
12707         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12708         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12709         esac
12710         case "$getgrent_r_proto" in
12711         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12712         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12713         esac
12714         case "$getgrent_r_proto" in
12715         ''|0) try='int getgrent_r(struct group*, char*, int);'
12716         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12717         esac
12718         case "$getgrent_r_proto" in
12719         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12720         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12721         esac
12722         case "$getgrent_r_proto" in
12723         ''|0)   d_getgrent_r=undef
12724                 getgrent_r_proto=0
12725                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
12726         * )     case "$getgrent_r_proto" in
12727                 REENTRANT_PROTO*) ;;
12728                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12729                 esac
12730                 echo "Prototype: $try" ;;
12731         esac
12732         ;;
12733         *)      case "$usethreads" in
12734                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12735                 esac
12736                 d_getgrent_r=undef
12737                 getgrent_r_proto=0
12738                 ;;
12739         esac
12740         ;;
12741 *)      getgrent_r_proto=0
12742         ;;
12743 esac
12744
12745 : see if getgrgid_r exists
12746 set getgrgid_r d_getgrgid_r
12747 eval $inlibc
12748 case "$d_getgrgid_r" in
12749 "$define")
12750         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12751         case "$d_getgrgid_r_proto:$usethreads" in
12752         ":define")      d_getgrgid_r_proto=define
12753                 set d_getgrgid_r_proto getgrgid_r $hdrs
12754                 eval $hasproto ;;
12755         *)      ;;
12756         esac
12757         case "$d_getgrgid_r_proto" in
12758         define)
12759         case "$getgrgid_r_proto" in
12760         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12761         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12762         esac
12763         case "$getgrgid_r_proto" in
12764         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12765         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12766         esac
12767         case "$getgrgid_r_proto" in
12768         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12769         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12770         esac
12771         case "$getgrgid_r_proto" in
12772         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12773         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12774         esac
12775         case "$getgrgid_r_proto" in
12776         ''|0)   d_getgrgid_r=undef
12777                 getgrgid_r_proto=0
12778                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
12779         * )     case "$getgrgid_r_proto" in
12780                 REENTRANT_PROTO*) ;;
12781                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12782                 esac
12783                 echo "Prototype: $try" ;;
12784         esac
12785         ;;
12786         *)      case "$usethreads" in
12787                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12788                 esac
12789                 d_getgrgid_r=undef
12790                 getgrgid_r_proto=0
12791                 ;;
12792         esac
12793         ;;
12794 *)      getgrgid_r_proto=0
12795         ;;
12796 esac
12797
12798 : see if getgrnam_r exists
12799 set getgrnam_r d_getgrnam_r
12800 eval $inlibc
12801 case "$d_getgrnam_r" in
12802 "$define")
12803         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12804         case "$d_getgrnam_r_proto:$usethreads" in
12805         ":define")      d_getgrnam_r_proto=define
12806                 set d_getgrnam_r_proto getgrnam_r $hdrs
12807                 eval $hasproto ;;
12808         *)      ;;
12809         esac
12810         case "$d_getgrnam_r_proto" in
12811         define)
12812         case "$getgrnam_r_proto" in
12813         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12814         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12815         esac
12816         case "$getgrnam_r_proto" in
12817         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12818         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12819         esac
12820         case "$getgrnam_r_proto" in
12821         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12822         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12823         esac
12824         case "$getgrnam_r_proto" in
12825         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
12826         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
12827         esac
12828         case "$getgrnam_r_proto" in
12829         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
12830         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
12831         esac
12832         case "$getgrnam_r_proto" in
12833         ''|0)   d_getgrnam_r=undef
12834                 getgrnam_r_proto=0
12835                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
12836         * )     case "$getgrnam_r_proto" in
12837                 REENTRANT_PROTO*) ;;
12838                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
12839                 esac
12840                 echo "Prototype: $try" ;;
12841         esac
12842         ;;
12843         *)      case "$usethreads" in
12844                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
12845                 esac
12846                 d_getgrnam_r=undef
12847                 getgrnam_r_proto=0
12848                 ;;
12849         esac
12850         ;;
12851 *)      getgrnam_r_proto=0
12852         ;;
12853 esac
12854
12855 : see if gethostbyaddr exists
12856 set gethostbyaddr d_gethbyaddr
12857 eval $inlibc
12858
12859 : see if gethostbyname exists
12860 set gethostbyname d_gethbyname
12861 eval $inlibc
12862
12863 : see if gethostent exists
12864 set gethostent d_gethent
12865 eval $inlibc
12866
12867 : see how we will look up host name
12868 echo " "
12869 call=''
12870 if set gethostname val -f d_gethname; eval $csym; $val; then
12871         echo 'gethostname() found.' >&4
12872         d_gethname="$define"
12873         call=gethostname
12874 fi
12875 if set uname val -f d_uname; eval $csym; $val; then
12876         if ./xenix; then
12877                 $cat <<'EOM'
12878 uname() was found, but you're running xenix, and older versions of xenix
12879 have a broken uname(). If you don't really know whether your xenix is old
12880 enough to have a broken system call, use the default answer.
12881
12882 EOM
12883                 dflt=y
12884                 case "$d_uname" in
12885                 "$define") dflt=n;;
12886                 esac
12887                 rp='Is your uname() broken?'
12888                 . ./myread
12889                 case "$ans" in
12890                 n*) d_uname="$define"; call=uname;;
12891                 esac
12892         else
12893                 echo 'uname() found.' >&4
12894                 d_uname="$define"
12895                 case "$call" in
12896                 '') call=uname ;;
12897                 esac
12898         fi
12899 fi
12900 case "$d_gethname" in
12901 '') d_gethname="$undef";;
12902 esac
12903 case "$d_uname" in
12904 '') d_uname="$undef";;
12905 esac
12906 case "$d_uname$d_gethname" in
12907 *define*)
12908         dflt=n
12909         cat <<EOM
12910  
12911 Every now and then someone has a $call() that lies about the hostname
12912 but can't be fixed for political or economic reasons.  If you wish, I can
12913 pretend $call() isn't there and maybe compute hostname at run-time
12914 thanks to the '$phostname' command.
12915
12916 EOM
12917         rp="Shall I ignore $call() from now on?"
12918         . ./myread
12919         case "$ans" in
12920         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
12921         esac;;
12922 esac
12923 case "$phostname" in
12924 '') aphostname='';;
12925 *) case "$aphostname" in
12926         /*) ;;
12927         *) set X $phostname
12928                 shift
12929                 file=$1
12930                 shift
12931                 file=`./loc $file $file $pth`
12932                 aphostname=`echo $file $*`
12933                 ;;
12934         esac
12935         ;;
12936 esac
12937 case "$d_uname$d_gethname" in
12938 *define*) ;;
12939 *)
12940         case "$phostname" in
12941         '')
12942                 echo "There will be no way for $package to get your hostname." >&4;;
12943         *)
12944         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
12945                 ;;
12946         esac;;
12947 esac
12948 case "$d_phostname" in
12949 '') d_phostname="$undef";;
12950 esac
12951
12952 : see if gethostbyaddr_r exists
12953 set gethostbyaddr_r d_gethostbyaddr_r
12954 eval $inlibc
12955 case "$d_gethostbyaddr_r" in
12956 "$define")
12957         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12958         case "$d_gethostbyaddr_r_proto:$usethreads" in
12959         ":define")      d_gethostbyaddr_r_proto=define
12960                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
12961                 eval $hasproto ;;
12962         *)      ;;
12963         esac
12964         case "$d_gethostbyaddr_r_proto" in
12965         define)
12966         case "$gethostbyaddr_r_proto" in
12967         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12968         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
12969         esac
12970         case "$gethostbyaddr_r_proto" in
12971         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
12972         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
12973         esac
12974         case "$gethostbyaddr_r_proto" in
12975         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
12976         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
12977         esac
12978         case "$gethostbyaddr_r_proto" in
12979         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
12980         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
12981         esac
12982         case "$gethostbyaddr_r_proto" in
12983         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
12984         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
12985         esac
12986         case "$gethostbyaddr_r_proto" in
12987         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
12988         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
12989         esac
12990         case "$gethostbyaddr_r_proto" in
12991         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
12992         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
12993         esac
12994         case "$gethostbyaddr_r_proto" in
12995         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
12996         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
12997         esac
12998         case "$gethostbyaddr_r_proto" in
12999         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13000         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13001         esac
13002         case "$gethostbyaddr_r_proto" in
13003         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13004         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13005         esac
13006         case "$gethostbyaddr_r_proto" in
13007         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13008         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13009         esac
13010         case "$gethostbyaddr_r_proto" in
13011         ''|0)   d_gethostbyaddr_r=undef
13012                 gethostbyaddr_r_proto=0
13013                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13014         * )     case "$gethostbyaddr_r_proto" in
13015                 REENTRANT_PROTO*) ;;
13016                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13017                 esac
13018                 echo "Prototype: $try" ;;
13019         esac
13020         ;;
13021         *)      case "$usethreads" in
13022                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13023                 esac
13024                 d_gethostbyaddr_r=undef
13025                 gethostbyaddr_r_proto=0
13026                 ;;
13027         esac
13028         ;;
13029 *)      gethostbyaddr_r_proto=0
13030         ;;
13031 esac
13032
13033 : see if gethostbyname_r exists
13034 set gethostbyname_r d_gethostbyname_r
13035 eval $inlibc
13036 case "$d_gethostbyname_r" in
13037 "$define")
13038         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13039         case "$d_gethostbyname_r_proto:$usethreads" in
13040         ":define")      d_gethostbyname_r_proto=define
13041                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13042                 eval $hasproto ;;
13043         *)      ;;
13044         esac
13045         case "$d_gethostbyname_r_proto" in
13046         define)
13047         case "$gethostbyname_r_proto" in
13048         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13049         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13050         esac
13051         case "$gethostbyname_r_proto" in
13052         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13053         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13054         esac
13055         case "$gethostbyname_r_proto" in
13056         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13057         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13058         esac
13059         case "$gethostbyname_r_proto" in
13060         ''|0)   d_gethostbyname_r=undef
13061                 gethostbyname_r_proto=0
13062                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13063         * )     case "$gethostbyname_r_proto" in
13064                 REENTRANT_PROTO*) ;;
13065                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13066                 esac
13067                 echo "Prototype: $try" ;;
13068         esac
13069         ;;
13070         *)      case "$usethreads" in
13071                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13072                 esac
13073                 d_gethostbyname_r=undef
13074                 gethostbyname_r_proto=0
13075                 ;;
13076         esac
13077         ;;
13078 *)      gethostbyname_r_proto=0
13079         ;;
13080 esac
13081
13082 : see if gethostent_r exists
13083 set gethostent_r d_gethostent_r
13084 eval $inlibc
13085 case "$d_gethostent_r" in
13086 "$define")
13087         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13088         case "$d_gethostent_r_proto:$usethreads" in
13089         ":define")      d_gethostent_r_proto=define
13090                 set d_gethostent_r_proto gethostent_r $hdrs
13091                 eval $hasproto ;;
13092         *)      ;;
13093         esac
13094         case "$d_gethostent_r_proto" in
13095         define)
13096         case "$gethostent_r_proto" in
13097         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13098         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13099         esac
13100         case "$gethostent_r_proto" in
13101         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13102         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13103         esac
13104         case "$gethostent_r_proto" in
13105         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13106         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13107         esac
13108         case "$gethostent_r_proto" in
13109         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13110         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13111         esac
13112         case "$gethostent_r_proto" in
13113         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13114         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13115         esac
13116         case "$gethostent_r_proto" in
13117         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13118         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13119         esac
13120         case "$gethostent_r_proto" in
13121         ''|0)   d_gethostent_r=undef
13122                 gethostent_r_proto=0
13123                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13124         * )     case "$gethostent_r_proto" in
13125                 REENTRANT_PROTO*) ;;
13126                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13127                 esac
13128                 echo "Prototype: $try" ;;
13129         esac
13130         ;;
13131         *)      case "$usethreads" in
13132                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13133                 esac
13134                 d_gethostent_r=undef
13135                 gethostent_r_proto=0
13136                 ;;
13137         esac
13138         ;;
13139 *)      gethostent_r_proto=0
13140         ;;
13141 esac
13142
13143 : see if prototypes for various gethostxxx netdb.h functions are available
13144 echo " "
13145 set d_gethostprotos gethostent $i_netdb netdb.h
13146 eval $hasproto
13147
13148 : see if getitimer exists
13149 set getitimer d_getitimer
13150 eval $inlibc
13151
13152 : see if getlogin exists
13153 set getlogin d_getlogin
13154 eval $inlibc
13155
13156 : see if getlogin_r exists
13157 set getlogin_r d_getlogin_r
13158 eval $inlibc
13159 case "$d_getlogin_r" in
13160 "$define")
13161         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13162         case "$d_getlogin_r_proto:$usethreads" in
13163         ":define")      d_getlogin_r_proto=define
13164                 set d_getlogin_r_proto getlogin_r $hdrs
13165                 eval $hasproto ;;
13166         *)      ;;
13167         esac
13168         case "$d_getlogin_r_proto" in
13169         define)
13170         case "$getlogin_r_proto" in
13171         ''|0) try='int getlogin_r(char*, size_t);'
13172         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13173         esac
13174         case "$getlogin_r_proto" in
13175         ''|0) try='int getlogin_r(char*, int);'
13176         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13177         esac
13178         case "$getlogin_r_proto" in
13179         ''|0) try='char* getlogin_r(char*, size_t);'
13180         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13181         esac
13182         case "$getlogin_r_proto" in
13183         ''|0) try='char* getlogin_r(char*, int);'
13184         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13185         esac
13186         case "$getlogin_r_proto" in
13187         ''|0)   d_getlogin_r=undef
13188                 getlogin_r_proto=0
13189                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13190         * )     case "$getlogin_r_proto" in
13191                 REENTRANT_PROTO*) ;;
13192                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13193                 esac
13194                 echo "Prototype: $try" ;;
13195         esac
13196         ;;
13197         *)      case "$usethreads" in
13198                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13199                 esac
13200                 d_getlogin_r=undef
13201                 getlogin_r_proto=0
13202                 ;;
13203         esac
13204         ;;
13205 *)      getlogin_r_proto=0
13206         ;;
13207 esac
13208
13209 : see if getmnt exists
13210 set getmnt d_getmnt
13211 eval $inlibc
13212
13213 : see if getmntent exists
13214 set getmntent d_getmntent
13215 eval $inlibc
13216
13217 : see if getnetbyaddr exists
13218 set getnetbyaddr d_getnbyaddr
13219 eval $inlibc
13220
13221 : see if getnetbyname exists
13222 set getnetbyname d_getnbyname
13223 eval $inlibc
13224
13225 : see if getnetent exists
13226 set getnetent d_getnent
13227 eval $inlibc
13228
13229 : see if getnetbyaddr_r exists
13230 set getnetbyaddr_r d_getnetbyaddr_r
13231 eval $inlibc
13232 case "$d_getnetbyaddr_r" in
13233 "$define")
13234         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13235         case "$d_getnetbyaddr_r_proto:$usethreads" in
13236         ":define")      d_getnetbyaddr_r_proto=define
13237                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13238                 eval $hasproto ;;
13239         *)      ;;
13240         esac
13241         case "$d_getnetbyaddr_r_proto" in
13242         define)
13243         case "$getnetbyaddr_r_proto" in
13244         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13245         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13246         esac
13247         case "$getnetbyaddr_r_proto" in
13248         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13249         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13250         esac
13251         case "$getnetbyaddr_r_proto" in
13252         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13253         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13254         esac
13255         case "$getnetbyaddr_r_proto" in
13256         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13257         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13258         esac
13259         case "$getnetbyaddr_r_proto" in
13260         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13261         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13262         esac
13263         case "$getnetbyaddr_r_proto" in
13264         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13265         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13266         esac
13267         case "$getnetbyaddr_r_proto" in
13268         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13269         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13270         esac
13271         case "$getnetbyaddr_r_proto" in
13272         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13273         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13274         esac
13275         case "$getnetbyaddr_r_proto" in
13276         ''|0)   d_getnetbyaddr_r=undef
13277                 getnetbyaddr_r_proto=0
13278                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13279         * )     case "$getnetbyaddr_r_proto" in
13280                 REENTRANT_PROTO*) ;;
13281                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13282                 esac
13283                 echo "Prototype: $try" ;;
13284         esac
13285         ;;
13286         *)      case "$usethreads" in
13287                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13288                 esac
13289                 d_getnetbyaddr_r=undef
13290                 getnetbyaddr_r_proto=0
13291                 ;;
13292         esac
13293         ;;
13294 *)      getnetbyaddr_r_proto=0
13295         ;;
13296 esac
13297
13298 : see if getnetbyname_r exists
13299 set getnetbyname_r d_getnetbyname_r
13300 eval $inlibc
13301 case "$d_getnetbyname_r" in
13302 "$define")
13303         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13304         case "$d_getnetbyname_r_proto:$usethreads" in
13305         ":define")      d_getnetbyname_r_proto=define
13306                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13307                 eval $hasproto ;;
13308         *)      ;;
13309         esac
13310         case "$d_getnetbyname_r_proto" in
13311         define)
13312         case "$getnetbyname_r_proto" in
13313         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13314         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13315         esac
13316         case "$getnetbyname_r_proto" in
13317         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13318         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13319         esac
13320         case "$getnetbyname_r_proto" in
13321         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13322         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13323         esac
13324         case "$getnetbyname_r_proto" in
13325         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13326         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13327         esac
13328         case "$getnetbyname_r_proto" in
13329         ''|0)   d_getnetbyname_r=undef
13330                 getnetbyname_r_proto=0
13331                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13332         * )     case "$getnetbyname_r_proto" in
13333                 REENTRANT_PROTO*) ;;
13334                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13335                 esac
13336                 echo "Prototype: $try" ;;
13337         esac
13338         ;;
13339         *)      case "$usethreads" in
13340                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13341                 esac
13342                 d_getnetbyname_r=undef
13343                 getnetbyname_r_proto=0
13344                 ;;
13345         esac
13346         ;;
13347 *)      getnetbyname_r_proto=0
13348         ;;
13349 esac
13350
13351 : see if getnetent_r exists
13352 set getnetent_r d_getnetent_r
13353 eval $inlibc
13354 case "$d_getnetent_r" in
13355 "$define")
13356         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13357         case "$d_getnetent_r_proto:$usethreads" in
13358         ":define")      d_getnetent_r_proto=define
13359                 set d_getnetent_r_proto getnetent_r $hdrs
13360                 eval $hasproto ;;
13361         *)      ;;
13362         esac
13363         case "$d_getnetent_r_proto" in
13364         define)
13365         case "$getnetent_r_proto" in
13366         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13367         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13368         esac
13369         case "$getnetent_r_proto" in
13370         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13371         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13372         esac
13373         case "$getnetent_r_proto" in
13374         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13375         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13376         esac
13377         case "$getnetent_r_proto" in
13378         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13379         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13380         esac
13381         case "$getnetent_r_proto" in
13382         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13383         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13384         esac
13385         case "$getnetent_r_proto" in
13386         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13387         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13388         esac
13389         case "$getnetent_r_proto" in
13390         ''|0)   d_getnetent_r=undef
13391                 getnetent_r_proto=0
13392                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13393         * )     case "$getnetent_r_proto" in
13394                 REENTRANT_PROTO*) ;;
13395                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13396                 esac
13397                 echo "Prototype: $try" ;;
13398         esac
13399         ;;
13400         *)      case "$usethreads" in
13401                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13402                 esac
13403                 d_getnetent_r=undef
13404                 getnetent_r_proto=0
13405                 ;;
13406         esac
13407         ;;
13408 *)      getnetent_r_proto=0
13409         ;;
13410 esac
13411
13412 : see if prototypes for various getnetxxx netdb.h functions are available
13413 echo " "
13414 set d_getnetprotos getnetent $i_netdb netdb.h
13415 eval $hasproto
13416
13417 : see if getpagesize exists
13418 set getpagesize d_getpagsz
13419 eval $inlibc
13420
13421
13422 : see if getprotobyname exists
13423 set getprotobyname d_getpbyname
13424 eval $inlibc
13425
13426 : see if getprotobynumber exists
13427 set getprotobynumber d_getpbynumber
13428 eval $inlibc
13429
13430 : see if getprotoent exists
13431 set getprotoent d_getpent
13432 eval $inlibc
13433
13434 : see if getpgid exists
13435 set getpgid d_getpgid
13436 eval $inlibc
13437
13438 : see if getpgrp2 exists
13439 set getpgrp2 d_getpgrp2
13440 eval $inlibc
13441
13442 : see if getppid exists
13443 set getppid d_getppid
13444 eval $inlibc
13445
13446 : see if getpriority exists
13447 set getpriority d_getprior
13448 eval $inlibc
13449
13450 : see if getprotobyname_r exists
13451 set getprotobyname_r d_getprotobyname_r
13452 eval $inlibc
13453 case "$d_getprotobyname_r" in
13454 "$define")
13455         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13456         case "$d_getprotobyname_r_proto:$usethreads" in
13457         ":define")      d_getprotobyname_r_proto=define
13458                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13459                 eval $hasproto ;;
13460         *)      ;;
13461         esac
13462         case "$d_getprotobyname_r_proto" in
13463         define)
13464         case "$getprotobyname_r_proto" in
13465         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13466         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13467         esac
13468         case "$getprotobyname_r_proto" in
13469         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13470         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13471         esac
13472         case "$getprotobyname_r_proto" in
13473         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13474         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13475         esac
13476         case "$getprotobyname_r_proto" in
13477         ''|0)   d_getprotobyname_r=undef
13478                 getprotobyname_r_proto=0
13479                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13480         * )     case "$getprotobyname_r_proto" in
13481                 REENTRANT_PROTO*) ;;
13482                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13483                 esac
13484                 echo "Prototype: $try" ;;
13485         esac
13486         ;;
13487         *)      case "$usethreads" in
13488                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13489                 esac
13490                 d_getprotobyname_r=undef
13491                 getprotobyname_r_proto=0
13492                 ;;
13493         esac
13494         ;;
13495 *)      getprotobyname_r_proto=0
13496         ;;
13497 esac
13498
13499 : see if getprotobynumber_r exists
13500 set getprotobynumber_r d_getprotobynumber_r
13501 eval $inlibc
13502 case "$d_getprotobynumber_r" in
13503 "$define")
13504         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13505         case "$d_getprotobynumber_r_proto:$usethreads" in
13506         ":define")      d_getprotobynumber_r_proto=define
13507                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13508                 eval $hasproto ;;
13509         *)      ;;
13510         esac
13511         case "$d_getprotobynumber_r_proto" in
13512         define)
13513         case "$getprotobynumber_r_proto" in
13514         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13515         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13516         esac
13517         case "$getprotobynumber_r_proto" in
13518         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13519         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13520         esac
13521         case "$getprotobynumber_r_proto" in
13522         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13523         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13524         esac
13525         case "$getprotobynumber_r_proto" in
13526         ''|0)   d_getprotobynumber_r=undef
13527                 getprotobynumber_r_proto=0
13528                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
13529         * )     case "$getprotobynumber_r_proto" in
13530                 REENTRANT_PROTO*) ;;
13531                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13532                 esac
13533                 echo "Prototype: $try" ;;
13534         esac
13535         ;;
13536         *)      case "$usethreads" in
13537                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13538                 esac
13539                 d_getprotobynumber_r=undef
13540                 getprotobynumber_r_proto=0
13541                 ;;
13542         esac
13543         ;;
13544 *)      getprotobynumber_r_proto=0
13545         ;;
13546 esac
13547
13548 : see if getprotoent_r exists
13549 set getprotoent_r d_getprotoent_r
13550 eval $inlibc
13551 case "$d_getprotoent_r" in
13552 "$define")
13553         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13554         case "$d_getprotoent_r_proto:$usethreads" in
13555         ":define")      d_getprotoent_r_proto=define
13556                 set d_getprotoent_r_proto getprotoent_r $hdrs
13557                 eval $hasproto ;;
13558         *)      ;;
13559         esac
13560         case "$d_getprotoent_r_proto" in
13561         define)
13562         case "$getprotoent_r_proto" in
13563         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13564         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13565         esac
13566         case "$getprotoent_r_proto" in
13567         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13568         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13569         esac
13570         case "$getprotoent_r_proto" in
13571         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13572         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13573         esac
13574         case "$getprotoent_r_proto" in
13575         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13576         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13577         esac
13578         case "$getprotoent_r_proto" in
13579         ''|0)   d_getprotoent_r=undef
13580                 getprotoent_r_proto=0
13581                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
13582         * )     case "$getprotoent_r_proto" in
13583                 REENTRANT_PROTO*) ;;
13584                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13585                 esac
13586                 echo "Prototype: $try" ;;
13587         esac
13588         ;;
13589         *)      case "$usethreads" in
13590                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13591                 esac
13592                 d_getprotoent_r=undef
13593                 getprotoent_r_proto=0
13594                 ;;
13595         esac
13596         ;;
13597 *)      getprotoent_r_proto=0
13598         ;;
13599 esac
13600
13601 : see if prototypes for various getprotoxxx netdb.h functions are available
13602 echo " "
13603 set d_getprotoprotos getprotoent $i_netdb netdb.h
13604 eval $hasproto
13605
13606 : see if getprpwnam exists
13607 set getprpwnam d_getprpwnam
13608 eval $inlibc
13609
13610 : see if getpwent exists
13611 set getpwent d_getpwent
13612 eval $inlibc
13613
13614 : see if getpwent_r exists
13615 set getpwent_r d_getpwent_r
13616 eval $inlibc
13617 case "$d_getpwent_r" in
13618 "$define")
13619         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13620         case "$d_getpwent_r_proto:$usethreads" in
13621         ":define")      d_getpwent_r_proto=define
13622                 set d_getpwent_r_proto getpwent_r $hdrs
13623                 eval $hasproto ;;
13624         *)      ;;
13625         esac
13626         case "$d_getpwent_r_proto" in
13627         define)
13628         case "$getpwent_r_proto" in
13629         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13630         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13631         esac
13632         case "$getpwent_r_proto" in
13633         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13634         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13635         esac
13636         case "$getpwent_r_proto" in
13637         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13638         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13639         esac
13640         case "$getpwent_r_proto" in
13641         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13642         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13643         esac
13644         case "$getpwent_r_proto" in
13645         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13646         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13647         esac
13648         case "$getpwent_r_proto" in
13649         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13650         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13651         esac
13652         case "$getpwent_r_proto" in
13653         ''|0)   d_getpwent_r=undef
13654                 getpwent_r_proto=0
13655                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
13656         * )     case "$getpwent_r_proto" in
13657                 REENTRANT_PROTO*) ;;
13658                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13659                 esac
13660                 echo "Prototype: $try" ;;
13661         esac
13662         ;;
13663         *)      case "$usethreads" in
13664                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13665                 esac
13666                 d_getpwent_r=undef
13667                 getpwent_r_proto=0
13668                 ;;
13669         esac
13670         ;;
13671 *)      getpwent_r_proto=0
13672         ;;
13673 esac
13674
13675 : see if getpwnam_r exists
13676 set getpwnam_r d_getpwnam_r
13677 eval $inlibc
13678 case "$d_getpwnam_r" in
13679 "$define")
13680         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13681         case "$d_getpwnam_r_proto:$usethreads" in
13682         ":define")      d_getpwnam_r_proto=define
13683                 set d_getpwnam_r_proto getpwnam_r $hdrs
13684                 eval $hasproto ;;
13685         *)      ;;
13686         esac
13687         case "$d_getpwnam_r_proto" in
13688         define)
13689         case "$getpwnam_r_proto" in
13690         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13691         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
13692         esac
13693         case "$getpwnam_r_proto" in
13694         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
13695         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
13696         esac
13697         case "$getpwnam_r_proto" in
13698         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
13699         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
13700         esac
13701         case "$getpwnam_r_proto" in
13702         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
13703         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
13704         esac
13705         case "$getpwnam_r_proto" in
13706         ''|0)   d_getpwnam_r=undef
13707                 getpwnam_r_proto=0
13708                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
13709         * )     case "$getpwnam_r_proto" in
13710                 REENTRANT_PROTO*) ;;
13711                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
13712                 esac
13713                 echo "Prototype: $try" ;;
13714         esac
13715         ;;
13716         *)      case "$usethreads" in
13717                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13718                 esac
13719                 d_getpwnam_r=undef
13720                 getpwnam_r_proto=0
13721                 ;;
13722         esac
13723         ;;
13724 *)      getpwnam_r_proto=0
13725         ;;
13726 esac
13727
13728 : see if getpwuid_r exists
13729 set getpwuid_r d_getpwuid_r
13730 eval $inlibc
13731 case "$d_getpwuid_r" in
13732 "$define")
13733         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13734         case "$d_getpwuid_r_proto:$usethreads" in
13735         ":define")      d_getpwuid_r_proto=define
13736                 set d_getpwuid_r_proto getpwuid_r $hdrs
13737                 eval $hasproto ;;
13738         *)      ;;
13739         esac
13740         case "$d_getpwuid_r_proto" in
13741         define)
13742         case "$getpwuid_r_proto" in
13743         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13744         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13745         esac
13746         case "$getpwuid_r_proto" in
13747         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13748         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13749         esac
13750         case "$getpwuid_r_proto" in
13751         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13752         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13753         esac
13754         case "$getpwuid_r_proto" in
13755         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13756         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13757         esac
13758         case "$getpwuid_r_proto" in
13759         ''|0)   d_getpwuid_r=undef
13760                 getpwuid_r_proto=0
13761                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
13762         * )     case "$getpwuid_r_proto" in
13763                 REENTRANT_PROTO*) ;;
13764                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13765                 esac
13766                 echo "Prototype: $try" ;;
13767         esac
13768         ;;
13769         *)      case "$usethreads" in
13770                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13771                 esac
13772                 d_getpwuid_r=undef
13773                 getpwuid_r_proto=0
13774                 ;;
13775         esac
13776         ;;
13777 *)      getpwuid_r_proto=0
13778         ;;
13779 esac
13780
13781
13782 : see if getservbyname exists
13783 set getservbyname d_getsbyname
13784 eval $inlibc
13785
13786 : see if getservbyport exists
13787 set getservbyport d_getsbyport
13788 eval $inlibc
13789
13790 : see if getservent exists
13791 set getservent d_getsent
13792 eval $inlibc
13793
13794 : see if getservbyname_r exists
13795 set getservbyname_r d_getservbyname_r
13796 eval $inlibc
13797 case "$d_getservbyname_r" in
13798 "$define")
13799         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13800         case "$d_getservbyname_r_proto:$usethreads" in
13801         ":define")      d_getservbyname_r_proto=define
13802                 set d_getservbyname_r_proto getservbyname_r $hdrs
13803                 eval $hasproto ;;
13804         *)      ;;
13805         esac
13806         case "$d_getservbyname_r_proto" in
13807         define)
13808         case "$getservbyname_r_proto" in
13809         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13810         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13811         esac
13812         case "$getservbyname_r_proto" in
13813         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13814         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13815         esac
13816         case "$getservbyname_r_proto" in
13817         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13818         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13819         esac
13820         case "$getservbyname_r_proto" in
13821         ''|0)   d_getservbyname_r=undef
13822                 getservbyname_r_proto=0
13823                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
13824         * )     case "$getservbyname_r_proto" in
13825                 REENTRANT_PROTO*) ;;
13826                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
13827                 esac
13828                 echo "Prototype: $try" ;;
13829         esac
13830         ;;
13831         *)      case "$usethreads" in
13832                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
13833                 esac
13834                 d_getservbyname_r=undef
13835                 getservbyname_r_proto=0
13836                 ;;
13837         esac
13838         ;;
13839 *)      getservbyname_r_proto=0
13840         ;;
13841 esac
13842
13843 : see if getservbyport_r exists
13844 set getservbyport_r d_getservbyport_r
13845 eval $inlibc
13846 case "$d_getservbyport_r" in
13847 "$define")
13848         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13849         case "$d_getservbyport_r_proto:$usethreads" in
13850         ":define")      d_getservbyport_r_proto=define
13851                 set d_getservbyport_r_proto getservbyport_r $hdrs
13852                 eval $hasproto ;;
13853         *)      ;;
13854         esac
13855         case "$d_getservbyport_r_proto" in
13856         define)
13857         case "$getservbyport_r_proto" in
13858         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
13859         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
13860         esac
13861         case "$getservbyport_r_proto" in
13862         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
13863         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
13864         esac
13865         case "$getservbyport_r_proto" in
13866         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
13867         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
13868         esac
13869         case "$getservbyport_r_proto" in
13870         ''|0)   d_getservbyport_r=undef
13871                 getservbyport_r_proto=0
13872                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
13873         * )     case "$getservbyport_r_proto" in
13874                 REENTRANT_PROTO*) ;;
13875                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
13876                 esac
13877                 echo "Prototype: $try" ;;
13878         esac
13879         ;;
13880         *)      case "$usethreads" in
13881                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
13882                 esac
13883                 d_getservbyport_r=undef
13884                 getservbyport_r_proto=0
13885                 ;;
13886         esac
13887         ;;
13888 *)      getservbyport_r_proto=0
13889         ;;
13890 esac
13891
13892 : see if getservent_r exists
13893 set getservent_r d_getservent_r
13894 eval $inlibc
13895 case "$d_getservent_r" in
13896 "$define")
13897         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13898         case "$d_getservent_r_proto:$usethreads" in
13899         ":define")      d_getservent_r_proto=define
13900                 set d_getservent_r_proto getservent_r $hdrs
13901                 eval $hasproto ;;
13902         *)      ;;
13903         esac
13904         case "$d_getservent_r_proto" in
13905         define)
13906         case "$getservent_r_proto" in
13907         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
13908         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
13909         esac
13910         case "$getservent_r_proto" in
13911         ''|0) try='int getservent_r(struct servent*, char*, int);'
13912         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
13913         esac
13914         case "$getservent_r_proto" in
13915         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
13916         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
13917         esac
13918         case "$getservent_r_proto" in
13919         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
13920         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
13921         esac
13922         case "$getservent_r_proto" in
13923         ''|0)   d_getservent_r=undef
13924                 getservent_r_proto=0
13925                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
13926         * )     case "$getservent_r_proto" in
13927                 REENTRANT_PROTO*) ;;
13928                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
13929                 esac
13930                 echo "Prototype: $try" ;;
13931         esac
13932         ;;
13933         *)      case "$usethreads" in
13934                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
13935                 esac
13936                 d_getservent_r=undef
13937                 getservent_r_proto=0
13938                 ;;
13939         esac
13940         ;;
13941 *)      getservent_r_proto=0
13942         ;;
13943 esac
13944
13945 : see if prototypes for various getservxxx netdb.h functions are available
13946 echo " "
13947 set d_getservprotos getservent $i_netdb netdb.h
13948 eval $hasproto
13949
13950 : see if getspnam exists
13951 set getspnam d_getspnam
13952 eval $inlibc
13953
13954 : see if this is a shadow.h system
13955 set shadow.h i_shadow
13956 eval $inhdr
13957
13958 : see if getspnam_r exists
13959 set getspnam_r d_getspnam_r
13960 eval $inlibc
13961 case "$d_getspnam_r" in
13962 "$define")
13963         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
13964         case "$d_getspnam_r_proto:$usethreads" in
13965         ":define")      d_getspnam_r_proto=define
13966                 set d_getspnam_r_proto getspnam_r $hdrs
13967                 eval $hasproto ;;
13968         *)      ;;
13969         esac
13970         case "$d_getspnam_r_proto" in
13971         define)
13972         case "$getspnam_r_proto" in
13973         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
13974         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
13975         esac
13976         case "$getspnam_r_proto" in
13977         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
13978         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
13979         esac
13980         case "$getspnam_r_proto" in
13981         ''|0)   d_getspnam_r=undef
13982                 getspnam_r_proto=0
13983                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
13984         * )     case "$getspnam_r_proto" in
13985                 REENTRANT_PROTO*) ;;
13986                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
13987                 esac
13988                 echo "Prototype: $try" ;;
13989         esac
13990         ;;
13991         *)      case "$usethreads" in
13992                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
13993                 esac
13994                 d_getspnam_r=undef
13995                 getspnam_r_proto=0
13996                 ;;
13997         esac
13998         ;;
13999 *)      getspnam_r_proto=0
14000         ;;
14001 esac
14002
14003 : see if gettimeofday or ftime exists
14004 set gettimeofday d_gettimeod
14005 eval $inlibc
14006 case "$d_gettimeod" in
14007 "$undef")
14008         set ftime d_ftime 
14009         eval $inlibc
14010         ;;
14011 *)
14012         val="$undef"; set d_ftime; eval $setvar
14013         ;;
14014 esac
14015 case "$d_gettimeod$d_ftime" in
14016 "$undef$undef")
14017         echo " "
14018         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14019         ;;
14020 esac
14021
14022 : see if gmtime_r exists
14023 set gmtime_r d_gmtime_r
14024 eval $inlibc
14025 case "$d_gmtime_r" in
14026 "$define")
14027         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14028         case "$d_gmtime_r_proto:$usethreads" in
14029         ":define")      d_gmtime_r_proto=define
14030                 set d_gmtime_r_proto gmtime_r $hdrs
14031                 eval $hasproto ;;
14032         *)      ;;
14033         esac
14034         case "$d_gmtime_r_proto" in
14035         define)
14036         case "$gmtime_r_proto" in
14037         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14038         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14039         esac
14040         case "$gmtime_r_proto" in
14041         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14042         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14043         esac
14044         case "$gmtime_r_proto" in
14045         ''|0)   d_gmtime_r=undef
14046                 gmtime_r_proto=0
14047                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14048         * )     case "$gmtime_r_proto" in
14049                 REENTRANT_PROTO*) ;;
14050                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14051                 esac
14052                 echo "Prototype: $try" ;;
14053         esac
14054         ;;
14055         *)      case "$usethreads" in
14056                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14057                 esac
14058                 d_gmtime_r=undef
14059                 gmtime_r_proto=0
14060                 ;;
14061         esac
14062         ;;
14063 *)      gmtime_r_proto=0
14064         ;;
14065 esac
14066
14067 : see if hasmntopt exists
14068 set hasmntopt d_hasmntopt
14069 eval $inlibc
14070
14071 : see if this is a netinet/in.h or sys/in.h system
14072 set netinet/in.h i_niin sys/in.h i_sysin
14073 eval $inhdr
14074
14075 : see if arpa/inet.h has to be included
14076 set arpa/inet.h i_arpainet
14077 eval $inhdr
14078
14079 : see if htonl --and friends-- exists
14080 val=''
14081 set htonl val
14082 eval $inlibc
14083
14084 : Maybe they are macros.
14085 case "$val" in
14086 $undef)
14087         $cat >htonl.c <<EOM
14088 #include <stdio.h>
14089 #include <sys/types.h>
14090 #$i_niin I_NETINET_IN
14091 #$i_sysin I_SYS_IN
14092 #$i_arpainet I_ARPA_INET
14093 #ifdef I_NETINET_IN
14094 #include <netinet/in.h>
14095 #endif
14096 #ifdef I_SYS_IN
14097 #include <sys/in.h>
14098 #endif
14099 #ifdef I_ARPA_INET
14100 #include <arpa/inet.h>
14101 #endif
14102 #ifdef htonl
14103 printf("Defined as a macro.");
14104 #endif
14105 EOM
14106         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14107         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14108                 val="$define"
14109                 echo "But it seems to be defined as a macro." >&4
14110         fi
14111         $rm -f htonl.?
14112         ;;
14113 esac
14114 set d_htonl
14115 eval $setvar
14116
14117 : see if ilogbl exists
14118 set ilogbl d_ilogbl
14119 eval $inlibc
14120
14121 : index or strchr
14122 echo " "
14123 if set index val -f; eval $csym; $val; then
14124         if set strchr val -f d_strchr; eval $csym; $val; then
14125                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14126                         val="$define"
14127                         vali="$undef"
14128                         echo "strchr() found." >&4
14129                 else
14130                         val="$undef"
14131                         vali="$define"
14132                         echo "index() found." >&4
14133                 fi
14134         else
14135                 val="$undef"
14136                 vali="$define"
14137                 echo "index() found." >&4
14138         fi
14139 else
14140         if set strchr val -f d_strchr; eval $csym; $val; then
14141                 val="$define"
14142                 vali="$undef"
14143                 echo "strchr() found." >&4
14144         else
14145                 echo "No index() or strchr() found!" >&4
14146                 val="$undef"
14147                 vali="$undef"
14148         fi
14149 fi
14150 set d_strchr; eval $setvar
14151 val="$vali"
14152 set d_index; eval $setvar
14153
14154 : check whether inet_aton exists
14155 set inet_aton d_inetaton
14156 eval $inlibc
14157
14158 : Look for isascii
14159 echo " "
14160 $cat >isascii.c <<EOCP
14161 #include <stdio.h>
14162 #include <ctype.h>
14163 #$i_stdlib I_STDLIB
14164 #ifdef I_STDLIB
14165 #include <stdlib.h>
14166 #endif
14167 int main() {
14168         int c = 'A';
14169         if (isascii(c))
14170                 exit(0);
14171         else
14172                 exit(1);
14173 }
14174 EOCP
14175 set isascii
14176 if eval $compile; then
14177         echo "isascii() found." >&4
14178         val="$define"
14179 else
14180         echo "isascii() NOT found." >&4
14181         val="$undef"
14182 fi
14183 set d_isascii
14184 eval $setvar
14185 $rm -f isascii*
14186
14187 : see if isfinite exists
14188 set isfinite d_isfinite
14189 eval $inlibc
14190
14191 : see if isinf exists
14192 set isinf d_isinf
14193 eval $inlibc
14194
14195 : see if isnan exists
14196 set isnan d_isnan
14197 eval $inlibc
14198
14199 : see if isnanl exists
14200 set isnanl d_isnanl
14201 eval $inlibc
14202
14203 : see if killpg exists
14204 set killpg d_killpg
14205 eval $inlibc
14206
14207 : see if lchown exists
14208 echo " "
14209 $cat > try.c <<'EOCP'
14210 /* System header to define __stub macros and hopefully few prototypes,
14211     which can conflict with char lchown(); below.  */
14212 #include <assert.h>
14213 /* Override any gcc2 internal prototype to avoid an error.  */
14214 /* We use char because int might match the return type of a gcc2
14215    builtin and then its argument prototype would still apply.  */
14216 char lchown();
14217 int main() {
14218     /*  The GNU C library defines this for functions which it implements
14219         to always fail with ENOSYS.  Some functions are actually named
14220         something starting with __ and the normal name is an alias.  */
14221 #if defined (__stub_lchown) || defined (__stub___lchown)
14222 choke me
14223 #else
14224 lchown();
14225 #endif
14226 ; return 0; }
14227 EOCP
14228 set try
14229 if eval $compile; then
14230     $echo "lchown() found." >&4
14231     val="$define"
14232 else
14233     $echo "lchown() NOT found." >&4
14234     val="$undef"
14235 fi
14236 set d_lchown
14237 eval $setvar
14238
14239 : See if number of significant digits in a double precision number is known
14240 echo " "
14241 $cat >ldbl_dig.c <<EOM
14242 #$i_limits I_LIMITS
14243 #$i_float I_FLOAT
14244 #ifdef I_LIMITS
14245 #include <limits.h>
14246 #endif
14247 #ifdef I_FLOAT
14248 #include <float.h>
14249 #endif
14250 #ifdef LDBL_DIG
14251 printf("Contains LDBL_DIG");
14252 #endif
14253 EOM
14254 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14255 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14256         echo "LDBL_DIG found." >&4
14257         val="$define"
14258 else
14259         echo "LDBL_DIG NOT found." >&4
14260         val="$undef"
14261 fi
14262 $rm -f ldbl_dig.?
14263 set d_ldbl_dig
14264 eval $setvar
14265
14266 : see if this is a math.h system
14267 set math.h i_math
14268 eval $inhdr
14269
14270 d_libm_lib_version="$undef"
14271 case $i_math in
14272     $define)
14273         : check to see if math.h defines _LIB_VERSION
14274         echo " "
14275         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14276         $cat >try.c <<EOCP
14277 #include <unistd.h>
14278 #include <math.h>
14279 int main (int argc, char *argv[])
14280 {
14281     printf ("%d\n", _LIB_VERSION);
14282     return (0);
14283     } /* main */
14284 EOCP
14285         set try
14286         if eval $compile; then
14287             foo=`$run ./try`
14288             echo "Yes, it does ($foo)" >&4
14289             d_libm_lib_version="$define"
14290         else
14291             echo "No, it does not (probably harmless)\n" >&4
14292             fi
14293         $rm -f try.* try core core.try.*
14294         ;;
14295
14296     esac
14297
14298 : see if link exists
14299 set link d_link
14300 eval $inlibc
14301
14302 : see if localtime_r exists
14303 set localtime_r d_localtime_r
14304 eval $inlibc
14305 case "$d_localtime_r" in
14306 "$define")
14307         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14308         case "$d_localtime_r_proto:$usethreads" in
14309         ":define")      d_localtime_r_proto=define
14310                 set d_localtime_r_proto localtime_r $hdrs
14311                 eval $hasproto ;;
14312         *)      ;;
14313         esac
14314         case "$d_localtime_r_proto" in
14315         define)
14316         case "$localtime_r_proto" in
14317         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14318         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14319         esac
14320         case "$localtime_r_proto" in
14321         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14322         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14323         esac
14324         case "$localtime_r_proto" in
14325         ''|0)   d_localtime_r=undef
14326                 localtime_r_proto=0
14327                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14328         * )     case "$localtime_r_proto" in
14329                 REENTRANT_PROTO*) ;;
14330                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14331                 esac
14332                 echo "Prototype: $try" ;;
14333         esac
14334         ;;
14335         *)      case "$usethreads" in
14336                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14337                 esac
14338                 d_localtime_r=undef
14339                 localtime_r_proto=0
14340                 ;;
14341         esac
14342         ;;
14343 *)      localtime_r_proto=0
14344         ;;
14345 esac
14346
14347 : see if localeconv exists
14348 set localeconv d_locconv
14349 eval $inlibc
14350
14351 : see if lockf exists
14352 set lockf d_lockf
14353 eval $inlibc
14354
14355 : see if prototype for lseek is available
14356 echo " "
14357 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14358 eval $hasproto
14359
14360 : see if lstat exists
14361 set lstat d_lstat
14362 eval $inlibc
14363
14364 : see if madvise exists
14365 set madvise d_madvise
14366 eval $inlibc
14367
14368 : see if malloc_size exists
14369 set malloc_size d_malloc_size
14370 eval $inlibc
14371
14372 : see if malloc_size_good exists
14373 set malloc_good_size d_malloc_good_size
14374 eval $inlibc
14375
14376 : see if mblen exists
14377 set mblen d_mblen
14378 eval $inlibc
14379
14380 : see if mbstowcs exists
14381 set mbstowcs d_mbstowcs
14382 eval $inlibc
14383
14384 : see if mbtowc exists
14385 set mbtowc d_mbtowc
14386 eval $inlibc
14387
14388 : see if memchr exists
14389 set memchr d_memchr
14390 eval $inlibc
14391
14392 : see if memcmp exists
14393 set memcmp d_memcmp
14394 eval $inlibc
14395
14396 : see if memcpy exists
14397 set memcpy d_memcpy
14398 eval $inlibc
14399
14400 : see if memmove exists
14401 set memmove d_memmove
14402 eval $inlibc
14403
14404 : see if memset exists
14405 set memset d_memset
14406 eval $inlibc
14407
14408 : see if mkdir exists
14409 set mkdir d_mkdir
14410 eval $inlibc
14411
14412 : see if mkdtemp exists
14413 set mkdtemp d_mkdtemp
14414 eval $inlibc
14415
14416 : see if mkfifo exists
14417 set mkfifo d_mkfifo
14418 eval $inlibc
14419
14420 : see if mkstemp exists
14421 set mkstemp d_mkstemp
14422 eval $inlibc
14423
14424 : see if mkstemps exists
14425 set mkstemps d_mkstemps
14426 eval $inlibc
14427
14428 : see if mktime exists
14429 set mktime d_mktime
14430 eval $inlibc
14431
14432 : see if this is a sys/mman.h system
14433 set sys/mman.h i_sysmman
14434 eval $inhdr
14435
14436 : see if mmap exists
14437 set mmap d_mmap
14438 eval $inlibc
14439 : see what shmat returns
14440 : default to something harmless
14441 mmaptype='void *'
14442 case "$i_sysmman$d_mmap" in
14443 "$define$define")
14444         $cat >mmap.c <<'END'
14445 #include <sys/mman.h>
14446 void *mmap();
14447 END
14448         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14449                 mmaptype='void *'
14450         else
14451                 mmaptype='caddr_t'
14452         fi
14453         echo "and it returns ($mmaptype)." >&4
14454         ;;
14455 esac
14456
14457
14458
14459 : see if sqrtl exists
14460 set sqrtl d_sqrtl
14461 eval $inlibc
14462
14463 : see if scalbnl exists
14464 set scalbnl d_scalbnl
14465 eval $inlibc
14466
14467 : see if modfl exists
14468 set modfl d_modfl
14469 eval $inlibc
14470
14471 : see if prototype for modfl is available
14472 echo " "
14473 set d_modflproto modfl $i_math math.h
14474 eval $hasproto
14475
14476 d_modfl_pow32_bug="$undef"
14477
14478 case "$d_longdbl$d_modfl" in
14479 $define$define)
14480         $cat <<EOM
14481 Checking to see whether your modfl() is okay for large values...
14482 EOM
14483 $cat >try.c <<EOCP
14484 #include <math.h> 
14485 #include <stdio.h>
14486 EOCP
14487 if $test "X$d_modflproto" != "X$define"; then
14488         $cat >>try.c <<EOCP
14489 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
14490 long double modfl (long double, long double *);
14491 EOCP
14492 fi
14493 $cat >>try.c <<EOCP
14494 int main() {
14495     long double nv = 4294967303.15;
14496     long double v, w;
14497     v = modfl(nv, &w);         
14498 #ifdef __GLIBC__
14499     printf("glibc");
14500 #endif
14501     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14502     return 0;
14503 }
14504 EOCP
14505         case "$osname:$gccversion" in
14506         aix:)   saveccflags="$ccflags"
14507                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14508         esac
14509         set try
14510         if eval $compile; then
14511                 foo=`$run ./try`
14512                 case "$foo" in
14513                 *" 4294967303.150000 1.150000 4294967302.000000")
14514                         echo >&4 "Your modfl() is broken for large values."
14515                         d_modfl_pow32_bug="$define"
14516                         case "$foo" in
14517                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14518                         ;;
14519                         esac
14520                         ;;
14521                 *" 4294967303.150000 0.150000 4294967303.000000")
14522                         echo >&4 "Your modfl() seems okay for large values."
14523                         ;;
14524                 *)      echo >&4 "I don't understand your modfl() at all."
14525                         d_modfl="$undef"
14526                         ;;
14527                 esac
14528                 $rm -f try.* try core core.try.*
14529         else
14530                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14531                 d_modfl="$undef"
14532         fi
14533         case "$osname:$gccversion" in
14534         aix:)   ccflags="$saveccflags" ;; # restore
14535         esac
14536         ;;
14537 esac
14538
14539 if $test "$uselongdouble" = "$define"; then
14540     message=""
14541     if $test "$d_sqrtl" != "$define"; then
14542         message="$message sqrtl"
14543     fi
14544     if $test "$d_modfl" != "$define"; then
14545         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14546             echo "You have both aintl and copysignl, so I can emulate modfl."
14547         else
14548             message="$message modfl"
14549         fi
14550     fi
14551     if $test "$d_frexpl" != "$define"; then
14552         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14553             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14554         else
14555             message="$message frexpl"
14556         fi
14557     fi
14558
14559     if $test "$message" != ""; then
14560         $cat <<EOM >&4
14561
14562 *** You requested the use of long doubles but you do not seem to have
14563 *** the following mathematical functions needed for long double support:
14564 ***    $message
14565 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14566 *** Cannot continue, aborting.
14567
14568 EOM
14569
14570         exit 1
14571     fi
14572 fi
14573
14574 : see if mprotect exists
14575 set mprotect d_mprotect
14576 eval $inlibc
14577
14578 : see if msgctl exists
14579 set msgctl d_msgctl
14580 eval $inlibc
14581
14582 : see if msgget exists
14583 set msgget d_msgget
14584 eval $inlibc
14585
14586 : see if msgsnd exists
14587 set msgsnd d_msgsnd
14588 eval $inlibc
14589
14590 : see if msgrcv exists
14591 set msgrcv d_msgrcv
14592 eval $inlibc
14593
14594 : see how much of the 'msg*(2)' library is present.
14595 h_msg=true
14596 echo " "
14597 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14598 *"$undef"*) h_msg=false;;
14599 esac
14600 case "$osname" in
14601 freebsd)
14602     case "`ipcs 2>&1`" in
14603     "SVID messages"*"not configured"*)
14604         echo "Your $osname does not have the msg*(2) configured." >&4
14605         h_msg=false
14606         val="$undef"
14607         set msgctl d_msgctl
14608         eval $setvar
14609         set msgget d_msgget
14610         eval $setvar
14611         set msgsnd d_msgsnd
14612         eval $setvar
14613         set msgrcv d_msgrcv
14614         eval $setvar
14615         ;;
14616     esac
14617     ;;
14618 esac
14619 : we could also check for sys/ipc.h ...
14620 if $h_msg && $test `./findhdr sys/msg.h`; then
14621         echo "You have the full msg*(2) library." >&4
14622         val="$define"
14623 else
14624         echo "You don't have the full msg*(2) library." >&4
14625         val="$undef"
14626 fi
14627 set d_msg
14628 eval $setvar
14629
14630
14631 echo " "
14632 echo "Checking to see if your system supports struct msghdr..." >&4
14633 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14634 eval $hasstruct
14635 case "$d_msghdr_s" in
14636 "$define")      echo "Yes, it does."   ;;
14637 *)              echo "No, it doesn't." ;;
14638 esac
14639
14640
14641 : see if msync exists
14642 set msync d_msync
14643 eval $inlibc
14644
14645 : see if munmap exists
14646 set munmap d_munmap
14647 eval $inlibc
14648
14649 : see if nice exists
14650 set nice d_nice
14651 eval $inlibc
14652
14653 : see if this is a langinfo.h system
14654 set langinfo.h i_langinfo
14655 eval $inhdr
14656
14657 : see if nl_langinfo exists
14658 set nl_langinfo d_nl_langinfo
14659 eval $inlibc
14660
14661 : check for length of character
14662 echo " "
14663 case "$charsize" in
14664 '')
14665         echo "Checking to see how big your characters are (hey, you never know)..." >&4
14666         $cat >try.c <<EOCP
14667 #include <stdio.h>
14668 #$i_stdlib I_STDLIB
14669 #ifdef I_STDLIB
14670 #include <stdlib.h>
14671 #endif
14672 int main()
14673 {
14674     printf("%d\n", (int)sizeof(char));
14675     exit(0);
14676 }
14677 EOCP
14678         set try
14679         if eval $compile_ok; then
14680                 dflt=`$run ./try`
14681         else
14682                 dflt='1'
14683                 echo "(I can't seem to compile the test program.  Guessing...)"
14684         fi
14685         ;;
14686 *)
14687         dflt="$charsize"
14688         ;;
14689 esac
14690 rp="What is the size of a character (in bytes)?"
14691 . ./myread
14692 charsize="$ans"
14693 $rm -f try.c try
14694
14695 : check for volatile keyword
14696 echo " "
14697 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
14698 $cat >try.c <<'EOCP'
14699 int main()
14700 {
14701         typedef struct _goo_struct goo_struct;
14702         goo_struct * volatile goo = ((goo_struct *)0);
14703         struct _goo_struct {
14704                 long long_int;
14705                 int reg_int;
14706                 char char_var;
14707         };
14708         typedef unsigned short foo_t;
14709         char *volatile foo;
14710         volatile int bar;
14711         volatile foo_t blech;
14712         foo = foo;
14713 }
14714 EOCP
14715 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
14716         val="$define"
14717         echo "Yup, it does."
14718 else
14719         val="$undef"
14720         echo "Nope, it doesn't."
14721 fi
14722 set d_volatile
14723 eval $setvar
14724 $rm -f try.*
14725
14726
14727 echo " "
14728 $echo "Choosing the C types to be used for Perl's internal types..." >&4
14729
14730 case "$use64bitint:$d_quad:$quadtype" in
14731 define:define:?*)
14732         ivtype="$quadtype"
14733         uvtype="$uquadtype"
14734         ivsize=8
14735         uvsize=8
14736         ;;
14737 *)      ivtype="long"
14738         uvtype="unsigned long"
14739         ivsize=$longsize
14740         uvsize=$longsize
14741         ;;
14742 esac
14743
14744 case "$uselongdouble:$d_longdbl" in
14745 define:define)
14746         nvtype="long double"
14747         nvsize=$longdblsize
14748         ;;
14749 *)      nvtype=double
14750         nvsize=$doublesize
14751         ;;
14752 esac
14753
14754 $echo "(IV will be "$ivtype", $ivsize bytes)"
14755 $echo "(UV will be "$uvtype", $uvsize bytes)"
14756 $echo "(NV will be "$nvtype", $nvsize bytes)"
14757
14758 $cat >try.c <<EOCP
14759 #$i_inttypes I_INTTYPES
14760 #ifdef I_INTTYPES
14761 #include <inttypes.h>
14762 #endif
14763 #include <stdio.h>
14764 int main() {
14765 #ifdef INT8
14766    int8_t i =  INT8_MAX;
14767   uint8_t u = UINT8_MAX;
14768   printf("int8_t\n");
14769 #endif
14770 #ifdef INT16
14771    int16_t i =  INT16_MAX;
14772   uint16_t i = UINT16_MAX;
14773   printf("int16_t\n");
14774 #endif
14775 #ifdef INT32
14776    int32_t i =  INT32_MAX;
14777   uint32_t u = UINT32_MAX;
14778   printf("int32_t\n");
14779 #endif
14780 }
14781 EOCP
14782
14783 case "$i8type" in
14784 '')     case "$charsize" in
14785         1)      i8type=char
14786                 u8type="unsigned char"
14787                 i8size=$charsize
14788                 u8size=$charsize
14789                 ;;
14790         esac
14791         ;;
14792 esac
14793 case "$i8type" in
14794 '')     set try -DINT8
14795         if eval $compile; then
14796                 case "`$run ./try`" in
14797                 int8_t) i8type=int8_t
14798                         u8type=uint8_t
14799                         i8size=1
14800                         u8size=1
14801                         ;;
14802                 esac
14803         fi
14804         ;;
14805 esac
14806 case "$i8type" in
14807 '')     if $test $charsize -ge 1; then
14808                 i8type=char
14809                 u8type="unsigned char"
14810                 i8size=$charsize
14811                 u8size=$charsize
14812         fi
14813         ;;
14814 esac
14815
14816 case "$i16type" in
14817 '')     case "$shortsize" in
14818         2)      i16type=short
14819                 u16type="unsigned short"
14820                 i16size=$shortsize
14821                 u16size=$shortsize
14822                 ;;
14823         esac
14824         ;;
14825 esac
14826 case "$i16type" in
14827 '')     set try -DINT16
14828         if eval $compile; then
14829                 case "`$run ./try`" in
14830                 int16_t)
14831                         i16type=int16_t
14832                         u16type=uint16_t
14833                         i16size=2
14834                         u16size=2
14835                         ;;
14836                 esac
14837         fi
14838         ;;
14839 esac
14840 case "$i16type" in
14841 '')     if $test $shortsize -ge 2; then
14842                 i16type=short
14843                 u16type="unsigned short"
14844                 i16size=$shortsize
14845                 u16size=$shortsize
14846         fi
14847         ;;
14848 esac
14849
14850 case "$i32type" in
14851 '')     case "$longsize" in
14852         4)      i32type=long
14853                 u32type="unsigned long"
14854                 i32size=$longsize
14855                 u32size=$longsize
14856                 ;;
14857         *)      case "$intsize" in
14858                 4)      i32type=int
14859                         u32type="unsigned int"
14860                         i32size=$intsize
14861                         u32size=$intsize
14862                         ;;
14863                 esac
14864                 ;;
14865         esac
14866         ;;
14867 esac
14868 case "$i32type" in
14869 '')     set try -DINT32
14870         if eval $compile; then
14871                 case "`$run ./try`" in
14872                 int32_t)
14873                         i32type=int32_t
14874                         u32type=uint32_t
14875                         i32size=4
14876                         u32size=4
14877                         ;;
14878                 esac
14879         fi
14880         ;;
14881 esac
14882 case "$i32type" in
14883 '')     if $test $intsize -ge 4; then
14884                 i32type=int
14885                 u32type="unsigned int"
14886                 i32size=$intsize
14887                 u32size=$intsize
14888         fi
14889         ;;
14890 esac
14891
14892 case "$i64type" in
14893 '')     case "$d_quad:$quadtype" in
14894         define:?*)
14895                 i64type="$quadtype"
14896                 u64type="$uquadtype"
14897                 i64size=8
14898                 u64size=8
14899                 ;;
14900         esac
14901         ;;
14902 esac
14903
14904 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
14905 : volatile so that the compiler has to store it out to memory.
14906 if test X"$d_volatile" = X"$define"; then
14907         volatile=volatile
14908 fi
14909 $cat <<EOP >try.c
14910 #include <stdio.h>
14911 #$i_stdlib I_STDLIB
14912 #ifdef I_STDLIB
14913 #include <stdlib.h>
14914 #endif
14915 #include <sys/types.h>
14916 #include <signal.h>
14917 #ifdef SIGFPE
14918 $volatile int bletched = 0;
14919 $signal_t blech(s) int s; { bletched = 1; }
14920 #endif
14921 int main() {
14922     $uvtype u = 0;
14923     $nvtype d;
14924     int     n = 8 * $uvsize;
14925     int     i;
14926 #ifdef SIGFPE
14927     signal(SIGFPE, blech);
14928 #endif
14929
14930     for (i = 0; i < n; i++) {
14931       u = u << 1 | ($uvtype)1;
14932       d = ($nvtype)u;
14933       if (($uvtype)d != u)
14934         break;
14935       if (d <= 0)
14936         break;
14937       d = ($nvtype)(u - 1);
14938       if (($uvtype)d != (u - 1))
14939         break;
14940 #ifdef SIGFPE
14941       if (bletched) {
14942         break;
14943 #endif
14944       } 
14945     }
14946     printf("%d\n", ((i == n) ? -n : i));
14947     exit(0);
14948 }
14949 EOP
14950 set try
14951
14952 d_nv_preserves_uv="$undef"
14953 if eval $compile; then
14954         nv_preserves_uv_bits="`$run ./try`"
14955 fi
14956 case "$nv_preserves_uv_bits" in
14957 \-[1-9]*)       
14958         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
14959         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
14960         d_nv_preserves_uv="$define"
14961         ;;
14962 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
14963         d_nv_preserves_uv="$undef" ;;
14964 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
14965         nv_preserves_uv_bits="$undef" ;;
14966 esac
14967
14968 $rm -f try.* try
14969
14970 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
14971 : volatile so that the compiler has to store it out to memory.
14972 if test X"$d_volatile" = X"$define"; then
14973         volatile=volatile
14974 fi
14975 $cat <<EOP >try.c
14976 #include <stdio.h>
14977 #$i_stdlib I_STDLIB
14978 #ifdef I_STDLIB
14979 #include <stdlib.h>
14980 #endif
14981 #$i_string I_STRING
14982 #ifdef I_STRING
14983 #  include <string.h>
14984 #else
14985 #  include <strings.h>
14986 #endif
14987 #include <sys/types.h>
14988 #include <signal.h>
14989 #ifdef SIGFPE
14990 $volatile int bletched = 0;
14991 $signal_t blech(s) int s; { bletched = 1; }
14992 #endif
14993
14994 int checkit($nvtype d, char *where) {
14995     unsigned char *p = (char *)&d;
14996     unsigned char *end = p + sizeof(d);
14997     int fail = 0;
14998
14999     while (p < end)
15000         fail += *p++;
15001
15002     if (!fail)
15003         return 0;
15004
15005     p = (char *)&d;
15006     printf("No - %s: 0x", where);
15007     while (p < end)
15008         printf ("%02X", *p++);
15009     printf("\n");
15010     return 1;
15011 }
15012
15013 int main(int argc, char **argv) {
15014     $nvtype d = 0.0;
15015     int fail = 0;
15016     fail += checkit(d, "0.0");
15017
15018     /* The compiler shouldn't be assuming that bletched is 0  */
15019     d = bletched;
15020
15021     fail += checkit(d, "bleched");
15022
15023 #ifdef SIGFPE
15024     signal(SIGFPE, blech);
15025 #endif
15026
15027     /* Paranoia - the compiler should have no way of knowing that ANSI says
15028        that argv[argc] will always be NULL.  Actually, if it did assume this it
15029        would be buggy, as this is C and main() can be called from elsewhere in
15030        the program.  */
15031     d = argv[argc] ? 1 : 0;
15032
15033     if (d) {
15034         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15035     }
15036
15037     fail += checkit(d, "ternary");
15038
15039     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15040
15041     if (d != 0.0) {
15042         printf("No - memset doesn't give 0.0\n");
15043         /* This might just blow up:  */
15044         printf("(gives %g)\n", d);
15045         return 1;
15046     }
15047     
15048 #ifdef SIGFPE
15049     if (bletched) {
15050         printf("No - something bleched\n");
15051         return 1;
15052     }
15053 #endif
15054     if (fail) {
15055       printf("No - %d fail(s)\n", fail);
15056       return 1;
15057     }
15058     printf("Yes\n");
15059     return 0;
15060 }
15061 EOP
15062 set try
15063
15064 d_nv_zero_is_allbits_zero="$undef"
15065 if eval $compile; then
15066     xxx="`$run ./try`"
15067     case "$?" in
15068         0)
15069             case "$xxx" in
15070                 Yes)  cat >&4 <<EOM
15071 0.0 is represented as all bits zero in memory
15072 EOM
15073                     d_nv_zero_is_allbits_zero="$define"
15074                     ;;
15075                 *)  cat >&4 <<EOM
15076 0.0 is not represented as all bits zero in memory
15077 EOM
15078                     d_nv_zero_is_allbits_zero="$undef"
15079                     ;;
15080             esac
15081             ;;
15082         *)  cat >&4 <<EOM
15083 0.0 is not represented as all bits zero in memory
15084 EOM
15085             d_nv_zero_is_allbits_zero="$undef"
15086             ;;
15087     esac
15088 fi
15089
15090 $rm -f try.* try
15091
15092
15093 : check for off64_t
15094 echo " "
15095 echo "Checking to see if you have off64_t..." >&4
15096 $cat >try.c <<EOCP
15097 #include <sys/types.h>
15098 #include <unistd.h>
15099 int main() { off64_t x = 7; }
15100 EOCP
15101 set try
15102 if eval $compile; then
15103         val="$define"
15104         echo "You have off64_t."
15105 else
15106         val="$undef"
15107         echo "You do not have off64_t."
15108         case "$lseeksize" in
15109         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15110         esac
15111 fi
15112 $rm -f try.* try
15113 set d_off64_t
15114 eval $setvar
15115
15116 : how to create joinable pthreads
15117 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15118         echo " "
15119         echo "Checking what constant to use for creating joinable pthreads..." >&4 
15120         $cat >try.c <<'EOCP'
15121 #include <pthread.h>
15122 int main() {
15123     int detachstate = JOINABLE;
15124 }
15125 EOCP
15126         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15127         if eval $compile; then
15128                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15129                 val="$undef" # Yes, undef.
15130                 set d_old_pthread_create_joinable
15131                 eval $setvar
15132                 val=""
15133                 set old_pthread_create_joinable
15134                 eval $setvar
15135         else
15136                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15137                 if eval $compile; then
15138                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15139                         val="$define"
15140                         set d_old_pthread_create_joinable
15141                         eval $setvar
15142                         val=PTHREAD_CREATE_UNDETACHED
15143                         set old_pthread_create_joinable
15144                         eval $setvar
15145                 else            
15146                         set try -DJOINABLE=__UNDETACHED
15147                         if eval $compile; then
15148                                 echo "You seem to use __UNDETACHED." >&4
15149                                 val="$define"
15150                                 set d_old_pthread_create_joinable
15151                                 eval $setvar
15152                                 val=__UNDETACHED
15153                                 set old_pthread_create_joinable
15154                                 eval $setvar
15155                         else
15156                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15157                                 val="$define"
15158                                 set d_old_pthread_create_joinable
15159                                 eval $setvar
15160                                 val=0
15161                                 set old_pthread_create_joinable
15162                                 eval $setvar
15163                         fi
15164                 fi
15165         fi
15166         $rm -f try try.*
15167 else
15168     d_old_pthread_create_joinable="$undef"
15169     old_pthread_create_joinable=""
15170 fi
15171
15172 : see if pause exists
15173 set pause d_pause
15174 eval $inlibc
15175
15176 : see if pipe exists
15177 set pipe d_pipe
15178 eval $inlibc
15179
15180 : see if poll exists
15181 set poll d_poll
15182 eval $inlibc
15183
15184 : see if readlink exists
15185 set readlink d_readlink
15186 eval $inlibc
15187
15188 echo " "
15189 procselfexe=''
15190 val="$undef"
15191 case "$d_readlink" in
15192 "$define")
15193         if $issymlink /proc/self/exe ; then
15194                 $ls -l /proc/self/exe > reflect
15195                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15196                         echo "You have Linux-like /proc/self/exe."
15197                         procselfexe='"/proc/self/exe"'
15198                         val="$define"
15199                 fi
15200         fi
15201         if $issymlink /proc/curproc/file ; then
15202                 $ls -l /proc/curproc/file > reflect
15203                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15204                         echo "You have BSD-like /proc/curproc/file."
15205                         procselfexe='"/proc/curproc/file"'
15206                         val="$define"
15207                 fi
15208         fi
15209         ;;
15210 esac
15211 $rm -f reflect
15212 set d_procselfexe
15213 eval $setvar
15214
15215 : see whether the pthread_atfork exists
15216 $cat >try.c <<EOP
15217 #include <pthread.h>
15218 #include <stdio.h>
15219 int main() {
15220 #ifdef  PTHREAD_ATFORK
15221         pthread_atfork(NULL,NULL,NULL);
15222 #endif
15223 }
15224 EOP
15225
15226 : see if pthread_atfork exists
15227 set try -DPTHREAD_ATFORK
15228 if eval $compile; then
15229     val="$define"
15230 else
15231     val="$undef"
15232 fi
15233 case "$usethreads" in
15234 $define)
15235         case "$val" in
15236         $define) echo 'pthread_atfork found.' >&4        ;;
15237         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15238         esac
15239 esac
15240 set d_pthread_atfork
15241 eval $setvar
15242
15243 : see if pthread_attr_setscope exists
15244 set pthread_attr_setscope d_pthread_attr_setscope
15245 eval $inlibc
15246
15247
15248 : see whether the various POSIXish _yields exist
15249 $cat >try.c <<EOP
15250 #include <pthread.h>
15251 #include <stdio.h>
15252 int main() {
15253 #ifdef SCHED_YIELD
15254         sched_yield();
15255 #else
15256 #ifdef PTHREAD_YIELD
15257         pthread_yield();
15258 #else
15259 #ifdef PTHREAD_YIELD_NULL
15260         pthread_yield(NULL);
15261 #endif
15262 #endif
15263 #endif
15264 }
15265 EOP
15266 : see if sched_yield exists
15267 set try -DSCHED_YIELD
15268 if eval $compile; then
15269     val="$define"
15270     sched_yield='sched_yield()'
15271 else
15272     val="$undef"
15273 fi
15274 case "$usethreads" in
15275 $define)
15276         case "$val" in
15277         $define) echo 'sched_yield() found.' >&4        ;;
15278         *)       echo 'sched_yield() NOT found.' >&4    ;;
15279         esac
15280 esac
15281 set d_sched_yield
15282 eval $setvar
15283
15284 : see if pthread_yield exists
15285 set try -DPTHREAD_YIELD
15286 if eval $compile; then
15287     val="$define"
15288     case "$sched_yield" in
15289     '') sched_yield='pthread_yield()' ;;
15290     esac
15291 else
15292     set try -DPTHREAD_YIELD_NULL
15293     if eval $compile; then
15294         val="$define"
15295         case "$sched_yield" in
15296         '') sched_yield='pthread_yield(NULL)' ;;
15297         esac
15298     else
15299         val="$undef"
15300     fi
15301 fi
15302 case "$usethreads" in
15303 $define)
15304         case "$val" in
15305         $define) echo 'pthread_yield() found.' >&4      ;;
15306         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15307         esac
15308         ;;
15309 esac
15310 set d_pthread_yield
15311 eval $setvar
15312
15313 case "$sched_yield" in
15314 '') sched_yield=undef ;;
15315 esac
15316
15317 $rm -f try try.*
15318
15319 : see if random_r exists
15320 set random_r d_random_r
15321 eval $inlibc
15322 case "$d_random_r" in
15323 "$define")
15324         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15325         case "$d_random_r_proto:$usethreads" in
15326         ":define")      d_random_r_proto=define
15327                 set d_random_r_proto random_r $hdrs
15328                 eval $hasproto ;;
15329         *)      ;;
15330         esac
15331         case "$d_random_r_proto" in
15332         define)
15333         case "$random_r_proto" in
15334         ''|0) try='int random_r(int*, struct random_data*);'
15335         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15336         esac
15337         case "$random_r_proto" in
15338         ''|0) try='int random_r(long*, struct random_data*);'
15339         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15340         esac
15341         case "$random_r_proto" in
15342         ''|0) try='int random_r(struct random_data*, int32_t*);'
15343         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15344         esac
15345         case "$random_r_proto" in
15346         ''|0)   d_random_r=undef
15347                 random_r_proto=0
15348                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
15349         * )     case "$random_r_proto" in
15350                 REENTRANT_PROTO*) ;;
15351                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15352                 esac
15353                 echo "Prototype: $try" ;;
15354         esac
15355         ;;
15356         *)      case "$usethreads" in
15357                 define) echo "random_r has no prototype, not using it." >&4 ;;
15358                 esac
15359                 d_random_r=undef
15360                 random_r_proto=0
15361                 ;;
15362         esac
15363         ;;
15364 *)      random_r_proto=0
15365         ;;
15366 esac
15367
15368 : see if readdir and friends exist
15369 set readdir d_readdir
15370 eval $inlibc
15371 set seekdir d_seekdir
15372 eval $inlibc
15373 set telldir d_telldir
15374 eval $inlibc
15375 set rewinddir d_rewinddir
15376 eval $inlibc
15377
15378 : see if readdir64_r exists
15379 set readdir64_r d_readdir64_r
15380 eval $inlibc
15381 case "$d_readdir64_r" in
15382 "$define")
15383         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15384         case "$d_readdir64_r_proto:$usethreads" in
15385         ":define")      d_readdir64_r_proto=define
15386                 set d_readdir64_r_proto readdir64_r $hdrs
15387                 eval $hasproto ;;
15388         *)      ;;
15389         esac
15390         case "$d_readdir64_r_proto" in
15391         define)
15392         case "$readdir64_r_proto" in
15393         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15394         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15395         esac
15396         case "$readdir64_r_proto" in
15397         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15398         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15399         esac
15400         case "$readdir64_r_proto" in
15401         ''|0)   d_readdir64_r=undef
15402                 readdir64_r_proto=0
15403                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
15404         * )     case "$readdir64_r_proto" in
15405                 REENTRANT_PROTO*) ;;
15406                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15407                 esac
15408                 echo "Prototype: $try" ;;
15409         esac
15410         ;;
15411         *)      case "$usethreads" in
15412                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15413                 esac
15414                 d_readdir64_r=undef
15415                 readdir64_r_proto=0
15416                 ;;
15417         esac
15418         ;;
15419 *)      readdir64_r_proto=0
15420         ;;
15421 esac
15422
15423 : see if readdir_r exists
15424 set readdir_r d_readdir_r
15425 eval $inlibc
15426 case "$d_readdir_r" in
15427 "$define")
15428         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15429         case "$d_readdir_r_proto:$usethreads" in
15430         ":define")      d_readdir_r_proto=define
15431                 set d_readdir_r_proto readdir_r $hdrs
15432                 eval $hasproto ;;
15433         *)      ;;
15434         esac
15435         case "$d_readdir_r_proto" in
15436         define)
15437         case "$readdir_r_proto" in
15438         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15439         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15440         esac
15441         case "$readdir_r_proto" in
15442         ''|0) try='int readdir_r(DIR*, struct dirent*);'
15443         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15444         esac
15445         case "$readdir_r_proto" in
15446         ''|0)   d_readdir_r=undef
15447                 readdir_r_proto=0
15448                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
15449         * )     case "$readdir_r_proto" in
15450                 REENTRANT_PROTO*) ;;
15451                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15452                 esac
15453                 echo "Prototype: $try" ;;
15454         esac
15455         ;;
15456         *)      case "$usethreads" in
15457                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15458                 esac
15459                 d_readdir_r=undef
15460                 readdir_r_proto=0
15461                 ;;
15462         esac
15463         ;;
15464 *)      readdir_r_proto=0
15465         ;;
15466 esac
15467
15468 : see if readv exists
15469 set readv d_readv
15470 eval $inlibc
15471
15472 : see if recvmsg exists
15473 set recvmsg d_recvmsg
15474 eval $inlibc
15475
15476 : see if rename exists
15477 set rename d_rename
15478 eval $inlibc
15479
15480 : see if rmdir exists
15481 set rmdir d_rmdir
15482 eval $inlibc
15483
15484 : see if memory.h is available.
15485 val=''
15486 set memory.h val
15487 eval $inhdr
15488
15489 : See if it conflicts with string.h
15490 case "$val" in
15491 $define)
15492         case "$strings" in
15493         '') ;;
15494         *)
15495                 $cppstdin $cppflags $cppminus < $strings > mem.h
15496                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15497                         echo " "
15498                         echo "We won't be including <memory.h>."
15499                         val="$undef"
15500                 fi
15501                 $rm -f mem.h
15502                 ;;
15503         esac
15504 esac
15505 set i_memory
15506 eval $setvar
15507
15508 : can bcopy handle overlapping blocks?
15509 echo " "
15510 val="$undef"
15511 case "$d_memmove" in
15512 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15513 *)      case "$d_bcopy" in
15514         "$define")
15515                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15516                 $cat >try.c <<EOCP
15517 #$i_memory I_MEMORY
15518 #$i_stdlib I_STDLIB
15519 #$i_string I_STRING
15520 #$i_unistd I_UNISTD
15521 EOCP
15522         $cat >>try.c <<'EOCP'
15523 #include <stdio.h>
15524 #ifdef I_MEMORY
15525 #  include <memory.h>
15526 #endif
15527 #ifdef I_STDLIB
15528 #  include <stdlib.h>
15529 #endif
15530 #ifdef I_STRING
15531 #  include <string.h>
15532 #else
15533 #  include <strings.h>
15534 #endif
15535 #ifdef I_UNISTD
15536 #  include <unistd.h>  /* Needed for NetBSD */
15537 #endif
15538 int main()
15539 {
15540 char buf[128], abc[128];
15541 char *b;
15542 int len;
15543 int off;
15544 int align;
15545
15546 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15547    try to store the string in read-only memory. */
15548 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15549
15550 for (align = 7; align >= 0; align--) {
15551         for (len = 36; len; len--) {
15552                 b = buf+align;
15553                 bcopy(abc, b, len);
15554                 for (off = 1; off <= len; off++) {
15555                         bcopy(b, b+off, len);
15556                         bcopy(b+off, b, len);
15557                         if (bcmp(b, abc, len))
15558                                 exit(1);
15559                 }
15560         }
15561 }
15562 exit(0);
15563 }
15564 EOCP
15565                 set try
15566                 if eval $compile_ok; then
15567                         if ./try 2>/dev/null; then
15568                                 echo "Yes, it can."
15569                                 val="$define"
15570                         else
15571                                 echo "It can't, sorry."
15572                         fi
15573                 else
15574                         echo "(I can't compile the test program, so we'll assume not...)"
15575                 fi
15576                 ;;
15577         esac
15578         $rm -f try.* try core
15579         ;;
15580 esac
15581 set d_safebcpy
15582 eval $setvar
15583
15584 : can memcpy handle overlapping blocks?
15585 echo " "
15586 val="$undef"
15587 case "$d_memmove" in
15588 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15589 *)      case "$d_memcpy" in
15590         "$define")
15591                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
15592                 $cat >try.c <<EOCP
15593 #$i_memory I_MEMORY
15594 #$i_stdlib I_STDLIB
15595 #$i_string I_STRING
15596 #$i_unistd I_UNISTD
15597 EOCP
15598         $cat >>try.c <<'EOCP'
15599 #include <stdio.h>
15600 #ifdef I_MEMORY
15601 #  include <memory.h>
15602 #endif
15603 #ifdef I_STDLIB
15604 #  include <stdlib.h>
15605 #endif
15606 #ifdef I_STRING
15607 #  include <string.h>
15608 #else
15609 #  include <strings.h>
15610 #endif
15611 #ifdef I_UNISTD
15612 #  include <unistd.h>  /* Needed for NetBSD */
15613 #endif
15614 int main()
15615 {
15616 char buf[128], abc[128];
15617 char *b;
15618 int len;
15619 int off;
15620 int align;
15621
15622 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15623    try to store the string in read-only memory. */
15624 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
15625
15626 for (align = 7; align >= 0; align--) {
15627         for (len = 36; len; len--) {
15628                 b = buf+align;
15629                 memcpy(b, abc, len);
15630                 for (off = 1; off <= len; off++) {
15631                         memcpy(b+off, b, len);
15632                         memcpy(b, b+off, len);
15633                         if (memcmp(b, abc, len))
15634                                 exit(1);
15635                 }
15636         }
15637 }
15638 exit(0);
15639 }
15640 EOCP
15641                 set try
15642                 if eval $compile_ok; then
15643                         if ./try 2>/dev/null; then
15644                                 echo "Yes, it can."
15645                                 val="$define"
15646                         else
15647                                 echo "It can't, sorry."
15648                         fi
15649                 else
15650                         echo "(I can't compile the test program, so we'll assume not...)"
15651                 fi
15652                 ;;
15653         esac
15654         $rm -f try.* try core
15655         ;;
15656 esac
15657 set d_safemcpy
15658 eval $setvar
15659
15660 : can memcmp be trusted to compare relative magnitude?
15661 val="$undef"
15662 case "$d_memcmp" in
15663 "$define")
15664         echo " "
15665         echo "Checking if your memcmp() can compare relative magnitude..." >&4
15666         $cat >try.c <<EOCP
15667 #$i_memory I_MEMORY
15668 #$i_stdlib I_STDLIB
15669 #$i_string I_STRING
15670 #$i_unistd I_UNISTD
15671 EOCP
15672         $cat >>try.c <<'EOCP'
15673 #include <stdio.h>
15674 #ifdef I_MEMORY
15675 #  include <memory.h>
15676 #endif
15677 #ifdef I_STDLIB
15678 #  include <stdlib.h>
15679 #endif
15680 #ifdef I_STRING
15681 #  include <string.h>
15682 #else
15683 #  include <strings.h>
15684 #endif
15685 #ifdef I_UNISTD
15686 #  include <unistd.h>  /* Needed for NetBSD */
15687 #endif
15688 int main()
15689 {
15690 char a = -1;
15691 char b = 0;
15692 if ((a < b) && memcmp(&a, &b, 1) < 0)
15693         exit(1);
15694 exit(0);
15695 }
15696 EOCP
15697         set try
15698         if eval $compile_ok; then
15699                 if $run ./try 2>/dev/null; then
15700                         echo "Yes, it can."
15701                         val="$define"
15702                 else
15703                         echo "No, it can't (it uses signed chars)."
15704                 fi
15705         else
15706                 echo "(I can't compile the test program, so we'll assume not...)"
15707         fi
15708         ;;
15709 esac
15710 $rm -f try.* try core
15711 set d_sanemcmp
15712 eval $setvar
15713
15714 : see if prototype for sbrk is available
15715 echo " "
15716 set d_sbrkproto sbrk $i_unistd unistd.h
15717 eval $hasproto
15718
15719 : see if select exists
15720 set select d_select
15721 eval $inlibc
15722
15723 : see if semctl exists
15724 set semctl d_semctl
15725 eval $inlibc
15726
15727 : see if semget exists
15728 set semget d_semget
15729 eval $inlibc
15730
15731 : see if semop exists
15732 set semop d_semop
15733 eval $inlibc
15734
15735 : see how much of the 'sem*(2)' library is present.
15736 h_sem=true
15737 echo " "
15738 case "$d_semctl$d_semget$d_semop" in
15739 *"$undef"*) h_sem=false;;
15740 esac
15741 case "$osname" in
15742 freebsd)
15743     case "`ipcs 2>&1`" in
15744     "SVID messages"*"not configured"*)
15745         echo "Your $osname does not have the sem*(2) configured." >&4
15746         h_sem=false
15747         val="$undef"
15748         set semctl d_semctl
15749         eval $setvar
15750         set semget d_semget
15751         eval $setvar
15752         set semop d_semop
15753         eval $setvar
15754         ;;
15755     esac
15756     ;;
15757 esac
15758 : we could also check for sys/ipc.h ...
15759 if $h_sem && $test `./findhdr sys/sem.h`; then
15760         echo "You have the full sem*(2) library." >&4
15761         val="$define"
15762 else
15763         echo "You don't have the full sem*(2) library." >&4
15764         val="$undef"
15765 fi
15766 set d_sem
15767 eval $setvar
15768
15769 : see whether sys/sem.h defines union semun
15770 echo " "
15771 $cat > try.c <<'END'
15772 #include <sys/types.h>
15773 #include <sys/ipc.h>
15774 #include <sys/sem.h>
15775 int main () { union semun semun; semun.buf = 0; }
15776 END
15777 set try
15778 if eval $compile; then
15779     echo "You have union semun in <sys/sem.h>." >&4
15780     val="$define"
15781 else
15782     echo "You do not have union semun in <sys/sem.h>." >&4
15783     val="$undef"
15784 fi
15785 $rm -f try try.c
15786 set d_union_semun
15787 eval $setvar
15788
15789 : see how to do semctl IPC_STAT
15790 case "$d_sem" in
15791 $define)
15792     echo " "
15793     $cat > try.h <<END
15794 #ifndef S_IRUSR
15795 #   ifdef S_IREAD
15796 #       define S_IRUSR S_IREAD
15797 #       define S_IWUSR S_IWRITE
15798 #       define S_IXUSR S_IEXEC
15799 #   else
15800 #       define S_IRUSR 0400
15801 #       define S_IWUSR 0200
15802 #       define S_IXUSR 0100
15803 #   endif
15804 #   define S_IRGRP (S_IRUSR>>3)
15805 #   define S_IWGRP (S_IWUSR>>3)
15806 #   define S_IXGRP (S_IXUSR>>3)
15807 #   define S_IROTH (S_IRUSR>>6)
15808 #   define S_IWOTH (S_IWUSR>>6)
15809 #   define S_IXOTH (S_IXUSR>>6)
15810 #endif
15811 #ifndef S_IRWXU
15812 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
15813 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
15814 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
15815 #endif
15816 END
15817     : see whether semctl IPC_STAT can use union semun
15818     case "$d_semctl_semun" in
15819     '')
15820       val="$undef"
15821       $cat > try.c <<END
15822 #include <sys/types.h>
15823 #include <sys/ipc.h>
15824 #include <sys/sem.h>
15825 #include <sys/stat.h>
15826 #include <stdio.h>
15827 #include <errno.h>
15828 #include "try.h"
15829 #ifndef errno
15830 extern int errno;
15831 #endif
15832 #$d_union_semun HAS_UNION_SEMUN
15833 int main() {
15834     union semun
15835 #ifndef HAS_UNION_SEMUN
15836     {
15837         int val;
15838         struct semid_ds *buf;
15839         unsigned short *array;
15840     }
15841 #endif
15842     arg;
15843     int sem, st;
15844
15845 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
15846     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15847     if (sem > -1) {
15848         struct semid_ds argbuf;
15849         arg.buf = &argbuf;
15850 #       ifdef IPC_STAT
15851         st = semctl(sem, 0, IPC_STAT, arg);
15852         if (st == 0)
15853             printf("semun\n");
15854         else
15855 #       endif /* IPC_STAT */
15856             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15857 #       ifdef IPC_RMID
15858         if (semctl(sem, 0, IPC_RMID, arg) != 0)
15859 #       endif /* IPC_RMID */
15860             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15861     } else
15862 #endif /* IPC_PRIVATE && ... */
15863         printf("semget failed: errno = %d\n", errno);
15864   return 0;
15865 }
15866 END
15867       set try
15868       if eval $compile; then
15869           xxx=`$run ./try`
15870           case "$xxx" in
15871           semun) val="$define" ;;
15872           esac
15873       fi
15874       $rm -f try try.c
15875       set d_semctl_semun
15876       eval $setvar
15877       ;;
15878     esac
15879     case "$d_semctl_semun" in
15880     $define)
15881         echo "You can use union semun for semctl IPC_STAT." >&4
15882         also='also'
15883         ;;
15884     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
15885         also=''
15886         ;;
15887     esac
15888
15889     : see whether semctl IPC_STAT can use struct semid_ds pointer
15890     case "$d_semctl_semid_ds" in
15891     '')
15892       val="$undef"
15893       $cat > try.c <<'END'
15894 #include <sys/types.h>
15895 #include <sys/ipc.h>
15896 #include <sys/sem.h>
15897 #include <sys/stat.h>
15898 #include "try.h"
15899 #include <stdio.h>
15900 #include <errno.h>
15901 #ifndef errno
15902 extern int errno;
15903 #endif
15904 int main() {
15905     struct semid_ds arg;
15906     int sem, st;
15907
15908 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
15909     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15910     if (sem > -1) {
15911 #       ifdef IPC_STAT
15912         st = semctl(sem, 0, IPC_STAT, &arg);
15913         if (st == 0)
15914             printf("semid_ds\n");
15915         else
15916 #       endif /* IPC_STAT */
15917             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15918 #       ifdef IPC_RMID
15919         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
15920 #       endif /* IPC_RMID */
15921             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15922     } else
15923 #endif /* IPC_PRIVATE && ... */
15924         printf("semget failed: errno = %d\n", errno);
15925
15926     return 0;
15927 }
15928 END
15929       set try
15930       if eval $compile; then
15931           xxx=`$run ./try`
15932           case "$xxx" in
15933           semid_ds) val="$define" ;;
15934           esac
15935       fi
15936       $rm -f try try.c
15937       set d_semctl_semid_ds
15938       eval $setvar
15939       ;;
15940     esac
15941     case "$d_semctl_semid_ds" in
15942     $define)
15943         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
15944         ;;
15945     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
15946         ;;
15947     esac
15948     $rm -f try.h
15949     ;;
15950 *)  val="$undef"
15951
15952     # We do not have the full sem*(2) library, so assume we can not
15953     # use either.
15954
15955     set d_semctl_semun
15956     eval $setvar
15957
15958     set d_semctl_semid_ds
15959     eval $setvar
15960     ;;
15961 esac
15962
15963 : see if sendmsg exists
15964 set sendmsg d_sendmsg
15965 eval $inlibc
15966
15967 : see if setegid exists
15968 set setegid d_setegid
15969 eval $inlibc
15970
15971 : see if seteuid exists
15972 set seteuid d_seteuid
15973 eval $inlibc
15974
15975 : see if setgrent exists
15976 set setgrent d_setgrent
15977 eval $inlibc
15978
15979 : see if setgrent_r exists
15980 set setgrent_r d_setgrent_r
15981 eval $inlibc
15982 case "$d_setgrent_r" in
15983 "$define")
15984         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
15985         case "$d_setgrent_r_proto:$usethreads" in
15986         ":define")      d_setgrent_r_proto=define
15987                 set d_setgrent_r_proto setgrent_r $hdrs
15988                 eval $hasproto ;;
15989         *)      ;;
15990         esac
15991         case "$d_setgrent_r_proto" in
15992         define)
15993         case "$setgrent_r_proto" in
15994         ''|0) try='int setgrent_r(FILE**);'
15995         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
15996         esac
15997         case "$setgrent_r_proto" in
15998         ''|0) try='void setgrent_r(FILE**);'
15999         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
16000         esac
16001         case "$setgrent_r_proto" in
16002         ''|0)   d_setgrent_r=undef
16003                 setgrent_r_proto=0
16004                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16005         * )     case "$setgrent_r_proto" in
16006                 REENTRANT_PROTO*) ;;
16007                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16008                 esac
16009                 echo "Prototype: $try" ;;
16010         esac
16011         ;;
16012         *)      case "$usethreads" in
16013                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16014                 esac
16015                 d_setgrent_r=undef
16016                 setgrent_r_proto=0
16017                 ;;
16018         esac
16019         ;;
16020 *)      setgrent_r_proto=0
16021         ;;
16022 esac
16023
16024 : see if sethostent exists
16025 set sethostent d_sethent
16026 eval $inlibc
16027
16028 : see if sethostent_r exists
16029 set sethostent_r d_sethostent_r
16030 eval $inlibc
16031 case "$d_sethostent_r" in
16032 "$define")
16033         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16034         case "$d_sethostent_r_proto:$usethreads" in
16035         ":define")      d_sethostent_r_proto=define
16036                 set d_sethostent_r_proto sethostent_r $hdrs
16037                 eval $hasproto ;;
16038         *)      ;;
16039         esac
16040         case "$d_sethostent_r_proto" in
16041         define)
16042         case "$sethostent_r_proto" in
16043         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16044         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16045         esac
16046         case "$sethostent_r_proto" in
16047         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16048         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16049         esac
16050         case "$sethostent_r_proto" in
16051         ''|0)   d_sethostent_r=undef
16052                 sethostent_r_proto=0
16053                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16054         * )     case "$sethostent_r_proto" in
16055                 REENTRANT_PROTO*) ;;
16056                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16057                 esac
16058                 echo "Prototype: $try" ;;
16059         esac
16060         ;;
16061         *)      case "$usethreads" in
16062                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16063                 esac
16064                 d_sethostent_r=undef
16065                 sethostent_r_proto=0
16066                 ;;
16067         esac
16068         ;;
16069 *)      sethostent_r_proto=0
16070         ;;
16071 esac
16072
16073 : see if setitimer exists
16074 set setitimer d_setitimer
16075 eval $inlibc
16076
16077 : see if setlinebuf exists
16078 set setlinebuf d_setlinebuf
16079 eval $inlibc
16080
16081 : see if setlocale exists
16082 set setlocale d_setlocale
16083 eval $inlibc
16084
16085 : see if locale.h is available
16086 set locale.h i_locale
16087 eval $inhdr
16088
16089 : see if setlocale_r exists
16090 set setlocale_r d_setlocale_r
16091 eval $inlibc
16092 case "$d_setlocale_r" in
16093 "$define")
16094         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16095         case "$d_setlocale_r_proto:$usethreads" in
16096         ":define")      d_setlocale_r_proto=define
16097                 set d_setlocale_r_proto setlocale_r $hdrs
16098                 eval $hasproto ;;
16099         *)      ;;
16100         esac
16101         case "$d_setlocale_r_proto" in
16102         define)
16103         case "$setlocale_r_proto" in
16104         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16105         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16106         esac
16107         case "$setlocale_r_proto" in
16108         ''|0)   d_setlocale_r=undef
16109                 setlocale_r_proto=0
16110                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16111         * )     case "$setlocale_r_proto" in
16112                 REENTRANT_PROTO*) ;;
16113                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16114                 esac
16115                 echo "Prototype: $try" ;;
16116         esac
16117         ;;
16118         *)      case "$usethreads" in
16119                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16120                 esac
16121                 d_setlocale_r=undef
16122                 setlocale_r_proto=0
16123                 ;;
16124         esac
16125         ;;
16126 *)      setlocale_r_proto=0
16127         ;;
16128 esac
16129
16130 : see if setnetent exists
16131 set setnetent d_setnent
16132 eval $inlibc
16133
16134 : see if setnetent_r exists
16135 set setnetent_r d_setnetent_r
16136 eval $inlibc
16137 case "$d_setnetent_r" in
16138 "$define")
16139         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16140         case "$d_setnetent_r_proto:$usethreads" in
16141         ":define")      d_setnetent_r_proto=define
16142                 set d_setnetent_r_proto setnetent_r $hdrs
16143                 eval $hasproto ;;
16144         *)      ;;
16145         esac
16146         case "$d_setnetent_r_proto" in
16147         define)
16148         case "$setnetent_r_proto" in
16149         ''|0) try='int setnetent_r(int, struct netent_data*);'
16150         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16151         esac
16152         case "$setnetent_r_proto" in
16153         ''|0) try='void setnetent_r(int, struct netent_data*);'
16154         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16155         esac
16156         case "$setnetent_r_proto" in
16157         ''|0)   d_setnetent_r=undef
16158                 setnetent_r_proto=0
16159                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16160         * )     case "$setnetent_r_proto" in
16161                 REENTRANT_PROTO*) ;;
16162                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16163                 esac
16164                 echo "Prototype: $try" ;;
16165         esac
16166         ;;
16167         *)      case "$usethreads" in
16168                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16169                 esac
16170                 d_setnetent_r=undef
16171                 setnetent_r_proto=0
16172                 ;;
16173         esac
16174         ;;
16175 *)      setnetent_r_proto=0
16176         ;;
16177 esac
16178
16179 : see if setprotoent exists
16180 set setprotoent d_setpent
16181 eval $inlibc
16182
16183 : see if setpgid exists
16184 set setpgid d_setpgid
16185 eval $inlibc
16186
16187 : see if setpgrp2 exists
16188 set setpgrp2 d_setpgrp2
16189 eval $inlibc
16190
16191 : see if setpriority exists
16192 set setpriority d_setprior
16193 eval $inlibc
16194
16195 : see if setproctitle exists
16196 set setproctitle d_setproctitle
16197 eval $inlibc
16198
16199 : see if setprotoent_r exists
16200 set setprotoent_r d_setprotoent_r
16201 eval $inlibc
16202 case "$d_setprotoent_r" in
16203 "$define")
16204         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16205         case "$d_setprotoent_r_proto:$usethreads" in
16206         ":define")      d_setprotoent_r_proto=define
16207                 set d_setprotoent_r_proto setprotoent_r $hdrs
16208                 eval $hasproto ;;
16209         *)      ;;
16210         esac
16211         case "$d_setprotoent_r_proto" in
16212         define)
16213         case "$setprotoent_r_proto" in
16214         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16215         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16216         esac
16217         case "$setprotoent_r_proto" in
16218         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16219         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16220         esac
16221         case "$setprotoent_r_proto" in
16222         ''|0)   d_setprotoent_r=undef
16223                 setprotoent_r_proto=0
16224                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16225         * )     case "$setprotoent_r_proto" in
16226                 REENTRANT_PROTO*) ;;
16227                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16228                 esac
16229                 echo "Prototype: $try" ;;
16230         esac
16231         ;;
16232         *)      case "$usethreads" in
16233                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16234                 esac
16235                 d_setprotoent_r=undef
16236                 setprotoent_r_proto=0
16237                 ;;
16238         esac
16239         ;;
16240 *)      setprotoent_r_proto=0
16241         ;;
16242 esac
16243
16244 : see if setpwent exists
16245 set setpwent d_setpwent
16246 eval $inlibc
16247
16248 : see if setpwent_r exists
16249 set setpwent_r d_setpwent_r
16250 eval $inlibc
16251 case "$d_setpwent_r" in
16252 "$define")
16253         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16254         case "$d_setpwent_r_proto:$usethreads" in
16255         ":define")      d_setpwent_r_proto=define
16256                 set d_setpwent_r_proto setpwent_r $hdrs
16257                 eval $hasproto ;;
16258         *)      ;;
16259         esac
16260         case "$d_setpwent_r_proto" in
16261         define)
16262         case "$setpwent_r_proto" in
16263         ''|0) try='int setpwent_r(FILE**);'
16264         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16265         esac
16266         case "$setpwent_r_proto" in
16267         ''|0) try='void setpwent_r(FILE**);'
16268         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16269         esac
16270         case "$setpwent_r_proto" in
16271         ''|0)   d_setpwent_r=undef
16272                 setpwent_r_proto=0
16273                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16274         * )     case "$setpwent_r_proto" in
16275                 REENTRANT_PROTO*) ;;
16276                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16277                 esac
16278                 echo "Prototype: $try" ;;
16279         esac
16280         ;;
16281         *)      case "$usethreads" in
16282                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16283                 esac
16284                 d_setpwent_r=undef
16285                 setpwent_r_proto=0
16286                 ;;
16287         esac
16288         ;;
16289 *)      setpwent_r_proto=0
16290         ;;
16291 esac
16292
16293 : see if setregid exists
16294 set setregid d_setregid
16295 eval $inlibc
16296 set setresgid d_setresgid
16297 eval $inlibc
16298
16299 : see if setreuid exists
16300 set setreuid d_setreuid
16301 eval $inlibc
16302 set setresuid d_setresuid
16303 eval $inlibc
16304
16305 : see if setrgid exists
16306 set setrgid d_setrgid
16307 eval $inlibc
16308
16309 : see if setruid exists
16310 set setruid d_setruid
16311 eval $inlibc
16312
16313 : see if setservent exists
16314 set setservent d_setsent
16315 eval $inlibc
16316
16317 : see if setservent_r exists
16318 set setservent_r d_setservent_r
16319 eval $inlibc
16320 case "$d_setservent_r" in
16321 "$define")
16322         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16323         case "$d_setservent_r_proto:$usethreads" in
16324         ":define")      d_setservent_r_proto=define
16325                 set d_setservent_r_proto setservent_r $hdrs
16326                 eval $hasproto ;;
16327         *)      ;;
16328         esac
16329         case "$d_setservent_r_proto" in
16330         define)
16331         case "$setservent_r_proto" in
16332         ''|0) try='int setservent_r(int, struct servent_data*);'
16333         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16334         esac
16335         case "$setservent_r_proto" in
16336         ''|0) try='void setservent_r(int, struct servent_data*);'
16337         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16338         esac
16339         case "$setservent_r_proto" in
16340         ''|0)   d_setservent_r=undef
16341                 setservent_r_proto=0
16342                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16343         * )     case "$setservent_r_proto" in
16344                 REENTRANT_PROTO*) ;;
16345                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16346                 esac
16347                 echo "Prototype: $try" ;;
16348         esac
16349         ;;
16350         *)      case "$usethreads" in
16351                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16352                 esac
16353                 d_setservent_r=undef
16354                 setservent_r_proto=0
16355                 ;;
16356         esac
16357         ;;
16358 *)      setservent_r_proto=0
16359         ;;
16360 esac
16361
16362 : see if setsid exists
16363 set setsid d_setsid
16364 eval $inlibc
16365
16366 : see if setvbuf exists
16367 set setvbuf d_setvbuf
16368 eval $inlibc
16369
16370 : see if sfio.h is available
16371 set sfio.h i_sfio
16372 eval $inhdr
16373
16374
16375 : see if sfio library is available
16376 case "$i_sfio" in
16377 $define)
16378         val=''
16379         set sfreserve val
16380         eval $inlibc
16381         ;;
16382 *)
16383         val="$undef"
16384         ;;
16385 esac
16386 : Ok, but do we want to use it.
16387 case "$val" in
16388 $define)
16389         case "$usesfio" in
16390         true|$define|[yY]*) dflt='y';;
16391         *) dflt='n';;
16392         esac
16393         echo "$package can use the sfio library, but it is experimental."
16394         case "$useperlio" in
16395         "$undef")
16396             echo "For sfio also the PerlIO abstraction layer is needed."
16397             echo "Earlier you said you wouldn't want that."
16398             ;;
16399         esac
16400         rp="You seem to have sfio available, do you want to try using it?"
16401         . ./myread
16402         case "$ans" in
16403         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
16404                 useperlio="$define"
16405                 val="$define"
16406                 ;;
16407         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
16408                 val="$undef"
16409                 ;;
16410         esac
16411         ;;
16412 *)      case "$usesfio" in
16413         true|$define|[yY]*)
16414                 echo "Sorry, cannot find sfio on this machine." >&4
16415                 echo "Ignoring your setting of usesfio=$usesfio." >&4
16416                 val="$undef"
16417                 ;;
16418         esac
16419         ;;
16420 esac
16421 set d_sfio
16422 eval $setvar
16423 case "$d_sfio" in
16424 $define) usesfio='true';;
16425 *) usesfio='false';;
16426 esac
16427 case "$d_sfio" in
16428 $define) ;;
16429 *)      : Remove sfio from list of libraries to use
16430         case "$libs" in
16431         *-lsfio*)
16432                 echo "Removing unneeded -lsfio from library list" >&4
16433                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16434                 shift
16435                 libs="$*"
16436                 echo "libs = $libs" >&4
16437                 ;;
16438         esac
16439 ;;
16440 esac
16441
16442
16443 : see if shmctl exists
16444 set shmctl d_shmctl
16445 eval $inlibc
16446
16447 : see if shmget exists
16448 set shmget d_shmget
16449 eval $inlibc
16450
16451 : see if shmat exists
16452 set shmat d_shmat
16453 eval $inlibc
16454 : see what shmat returns
16455 case "$d_shmat" in
16456 "$define")
16457         $cat >shmat.c <<'END'
16458 #include <sys/shm.h>
16459 void *shmat();
16460 END
16461         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16462                 shmattype='void *'
16463         else
16464                 shmattype='char *'
16465         fi
16466         echo "and it returns ($shmattype)." >&4
16467         : see if a prototype for shmat is available
16468         xxx=`./findhdr sys/shm.h`
16469         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16470         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16471                 val="$define"
16472         else
16473                 val="$undef"
16474         fi
16475         $rm -f shmat.[co]
16476         ;;
16477 *)
16478         val="$undef"
16479         ;;
16480 esac
16481 set d_shmatprototype
16482 eval $setvar
16483
16484 : see if shmdt exists
16485 set shmdt d_shmdt
16486 eval $inlibc
16487
16488 : see how much of the 'shm*(2)' library is present.
16489 h_shm=true
16490 echo " "
16491 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16492 *"$undef"*) h_shm=false;;
16493 esac
16494 case "$osname" in
16495 freebsd)
16496     case "`ipcs 2>&1`" in
16497     "SVID shared memory"*"not configured"*)
16498         echo "Your $osname does not have the shm*(2) configured." >&4
16499         h_shm=false
16500         val="$undef"
16501         set shmctl d_shmctl
16502         evat $setvar
16503         set shmget d_shmget
16504         evat $setvar
16505         set shmat d_shmat
16506         evat $setvar
16507         set shmdt d_shmdt
16508         evat $setvar
16509         ;;
16510     esac
16511     ;;
16512 esac
16513 : we could also check for sys/ipc.h ...
16514 if $h_shm && $test `./findhdr sys/shm.h`; then
16515         echo "You have the full shm*(2) library." >&4
16516         val="$define"
16517 else
16518         echo "You don't have the full shm*(2) library." >&4
16519         val="$undef"
16520 fi
16521 set d_shm
16522 eval $setvar
16523
16524 echo " "
16525 : see if we have sigaction
16526 if set sigaction val -f d_sigaction; eval $csym; $val; then
16527         echo 'sigaction() found.' >&4
16528         $cat > try.c <<EOP
16529 #include <stdio.h>
16530 #include <sys/types.h>
16531 #include <signal.h>
16532 #$i_stdlib I_STDLIB
16533 #ifdef I_STDLIB
16534 #include <stdlib.h>
16535 #endif
16536 int main()
16537 {
16538     struct sigaction act, oact;
16539     act.sa_flags = 0;
16540     oact.sa_handler = 0;
16541     /* so that act and oact are used */
16542     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
16543 }
16544 EOP
16545         set try
16546         if eval $compile_ok; then
16547                 val="$define"
16548         else
16549                 echo "But you don't seem to have a useable struct sigaction." >&4
16550                 val="$undef"
16551         fi
16552 else
16553         echo 'sigaction NOT found.' >&4
16554         val="$undef"
16555 fi
16556 set d_sigaction; eval $setvar
16557 $rm -f try try$_o try.c
16558
16559 : see if sigprocmask exists
16560 set sigprocmask d_sigprocmask
16561 eval $inlibc
16562
16563 : see if sigsetjmp exists
16564 echo " "
16565 case "$d_sigsetjmp" in
16566 '')
16567         $cat >try.c <<EOP
16568 #include <setjmp.h>
16569 #$i_stdlib I_STDLIB
16570 #ifdef I_STDLIB
16571 #include <stdlib.h>
16572 #endif
16573 sigjmp_buf env;
16574 int set = 1;
16575 int main()
16576 {
16577         if (sigsetjmp(env,1))
16578                 exit(set);
16579         set = 0;
16580         siglongjmp(env, 1);
16581         exit(1);
16582 }
16583 EOP
16584         set try
16585         if eval $compile; then
16586                 if $run ./try >/dev/null 2>&1; then
16587                         echo "POSIX sigsetjmp found." >&4
16588                         val="$define"
16589                 else
16590                         $cat >&4 <<EOM
16591 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
16592 I'll ignore them.
16593 EOM
16594                         val="$undef"
16595                 fi
16596         else
16597                 echo "sigsetjmp not found." >&4
16598                 val="$undef"
16599         fi
16600         ;;
16601 *) val="$d_sigsetjmp"
16602         case "$d_sigsetjmp" in
16603         $define) echo "POSIX sigsetjmp found." >&4;;
16604         $undef) echo "sigsetjmp not found." >&4;;
16605         esac
16606         ;;
16607 esac
16608 set d_sigsetjmp
16609 eval $setvar
16610 $rm -f try.c try
16611
16612 : see if snprintf exists
16613 set snprintf d_snprintf
16614 eval $inlibc
16615
16616 : see if vsnprintf exists
16617 set vsnprintf d_vsnprintf
16618 eval $inlibc
16619
16620 case "$d_snprintf-$d_vsnprintf" in
16621 "$define-$define")
16622     $cat <<EOM
16623 Checking whether your snprintf() and vsnprintf() work okay...
16624 EOM
16625     $cat >try.c <<'EOCP'
16626 /* v?snprintf testing logic courtesy of Russ Allbery.
16627  * According to C99:
16628  * - if the buffer is too short it still must be \0-terminated
16629  * - if the buffer is too short the potentially required length
16630  *   must be returned and not -1
16631  * - if the buffer is NULL the potentially required length
16632  *   must be returned and not -1 or core dump
16633  */
16634 #include <stdio.h>
16635 #include <stdarg.h>
16636
16637 char buf[2];
16638
16639 int test (char *format, ...)
16640 {
16641     va_list args;
16642     int count;
16643
16644     va_start (args, format);
16645     count = vsnprintf (buf, sizeof buf, format, args);
16646     va_end (args);
16647     return count;
16648 }
16649
16650 int main ()
16651 {
16652     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
16653              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
16654 }
16655 EOCP
16656     set try
16657     if eval $compile; then
16658         `$run ./try`
16659         case "$?" in
16660         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
16661         *) cat <<EOM >&4
16662 Your snprintf() and snprintf() don't seem to be working okay.
16663 EOM
16664            d_snprintf="$undef"
16665            d_vsnprintf="$undef"
16666            ;;
16667         esac
16668     else
16669         echo "(I can't seem to compile the test program--assuming they don't)"
16670         d_snprintf="$undef"
16671         d_vsnprintf="$undef"
16672     fi
16673     $rm -f try.* try core core.try.*
16674     ;;
16675 esac
16676
16677 : see if sockatmark exists
16678 set sockatmark d_sockatmark
16679 eval $inlibc
16680
16681 : see if prototype for sockatmark is available
16682 echo " "
16683 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
16684 eval $hasproto
16685
16686 : see if socks5_init exists
16687 set socks5_init d_socks5_init
16688 eval $inlibc
16689
16690 : see if sprintf returns the length of the string in the buffer as per ANSI
16691 $echo "Checking whether sprintf returns the length of the string..." >&4
16692 $cat <<EOP >try.c
16693 #include <stdio.h>
16694 #$i_stdlib I_STDLIB
16695 #ifdef I_STDLIB
16696 #include <stdlib.h>
16697 #endif
16698 #$i_string I_STRING
16699 #ifdef I_STRING
16700 #  include <string.h>
16701 #else
16702 #  include <strings.h>
16703 #endif
16704 #$i_math I_MATH
16705 #ifdef I_MATH
16706 #include <math.h>
16707 #endif
16708
16709 char buffer[256];
16710
16711 int check (size_t expect, int test) {
16712   size_t got = strlen(buffer);
16713   if (expect == got)
16714     return 0;
16715
16716   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
16717        test, buffer);
16718   exit (test);
16719 }
16720
16721 int main(int argc, char **argv) {
16722   int test = 0;
16723
16724   check(sprintf(buffer, ""), ++test);
16725   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
16726   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
16727
16728   return 0;
16729 }
16730 EOP
16731 set try
16732
16733 d_sprintf_returns_strlen="$undef"
16734 if eval $compile; then
16735     xxx="`$run ./try`"
16736     case "$?" in
16737         0) cat >&4 <<EOM
16738 sprintf returns the length of the string (as ANSI says it should)
16739 EOM
16740         d_sprintf_returns_strlen="$define"
16741         ;;
16742         *) cat >&4 <<EOM
16743 sprintf does not return the length of the string (how old is this system?)
16744 EOM
16745         d_sprintf_returns_strlen="$undef"
16746         ;;
16747     esac
16748 fi
16749
16750 $rm -f try.* try
16751
16752 : see if srand48_r exists
16753 set srand48_r d_srand48_r
16754 eval $inlibc
16755 case "$d_srand48_r" in
16756 "$define")
16757         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16758         case "$d_srand48_r_proto:$usethreads" in
16759         ":define")      d_srand48_r_proto=define
16760                 set d_srand48_r_proto srand48_r $hdrs
16761                 eval $hasproto ;;
16762         *)      ;;
16763         esac
16764         case "$d_srand48_r_proto" in
16765         define)
16766         case "$srand48_r_proto" in
16767         ''|0) try='int srand48_r(long, struct drand48_data*);'
16768         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
16769         esac
16770         case "$srand48_r_proto" in
16771         ''|0)   d_srand48_r=undef
16772                 srand48_r_proto=0
16773                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
16774         * )     case "$srand48_r_proto" in
16775                 REENTRANT_PROTO*) ;;
16776                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
16777                 esac
16778                 echo "Prototype: $try" ;;
16779         esac
16780         ;;
16781         *)      case "$usethreads" in
16782                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
16783                 esac
16784                 d_srand48_r=undef
16785                 srand48_r_proto=0
16786                 ;;
16787         esac
16788         ;;
16789 *)      srand48_r_proto=0
16790         ;;
16791 esac
16792
16793 : see if srandom_r exists
16794 set srandom_r d_srandom_r
16795 eval $inlibc
16796 case "$d_srandom_r" in
16797 "$define")
16798         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16799         case "$d_srandom_r_proto:$usethreads" in
16800         ":define")      d_srandom_r_proto=define
16801                 set d_srandom_r_proto srandom_r $hdrs
16802                 eval $hasproto ;;
16803         *)      ;;
16804         esac
16805         case "$d_srandom_r_proto" in
16806         define)
16807         case "$srandom_r_proto" in
16808         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
16809         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
16810         esac
16811         case "$srandom_r_proto" in
16812         ''|0)   d_srandom_r=undef
16813                 srandom_r_proto=0
16814                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
16815         * )     case "$srandom_r_proto" in
16816                 REENTRANT_PROTO*) ;;
16817                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
16818                 esac
16819                 echo "Prototype: $try" ;;
16820         esac
16821         ;;
16822         *)      case "$usethreads" in
16823                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
16824                 esac
16825                 d_srandom_r=undef
16826                 srandom_r_proto=0
16827                 ;;
16828         esac
16829         ;;
16830 *)      srandom_r_proto=0
16831         ;;
16832 esac
16833
16834 : see if prototype for setresgid is available
16835 echo " "
16836 set d_sresgproto setresgid $i_unistd unistd.h
16837 eval $hasproto
16838
16839 : see if prototype for setresuid is available
16840 echo " "
16841 set d_sresuproto setresuid $i_unistd unistd.h
16842 eval $hasproto
16843
16844 : see if sys/stat.h is available
16845 set sys/stat.h i_sysstat
16846 eval $inhdr
16847
16848
16849 : see if stat knows about block sizes
16850 echo " "
16851 echo "Checking to see if your struct stat has st_blocks field..." >&4
16852 set d_statblks stat st_blocks $i_sysstat sys/stat.h
16853 eval $hasfield
16854
16855
16856 : see if this is a sys/vfs.h system
16857 set sys/vfs.h i_sysvfs
16858 eval $inhdr
16859
16860
16861 : see if this is a sys/statfs.h system
16862 set sys/statfs.h i_sysstatfs
16863 eval $inhdr
16864
16865
16866 echo " "
16867 echo "Checking to see if your system supports struct statfs..." >&4
16868 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
16869 eval $hasstruct
16870 case "$d_statfs_s" in
16871 "$define")      echo "Yes, it does."   ;;
16872 *)              echo "No, it doesn't." ;;
16873 esac
16874
16875
16876
16877 : see if struct statfs knows about f_flags
16878 case "$d_statfs_s" in
16879 define) 
16880         echo " "
16881         echo "Checking to see if your struct statfs has f_flags field..." >&4
16882         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
16883         eval $hasfield
16884         ;;
16885 *)      val="$undef"
16886         set d_statfs_f_flags
16887         eval $setvar
16888         ;;
16889 esac
16890 case "$d_statfs_f_flags" in
16891 "$define")      echo "Yes, it does."   ;;
16892 *)              echo "No, it doesn't." ;;
16893 esac
16894
16895 $cat >&4 <<EOM
16896 Checking how to access stdio streams by file descriptor number...
16897 EOM
16898 case "$stdio_stream_array" in
16899 '')     $cat >try.c <<EOCP
16900 #include <stdio.h>
16901 int main() {
16902   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
16903     printf("yes\n");
16904 }
16905 EOCP
16906         for s in _iob __iob __sF
16907         do
16908                 set try -DSTDIO_STREAM_ARRAY=$s
16909                 if eval $compile; then
16910                         case "`$run ./try`" in
16911                         yes)    stdio_stream_array=$s; break ;;
16912                         esac
16913                 fi
16914         done
16915         $rm -f try.* try$exe_ext
16916 esac
16917 case "$stdio_stream_array" in
16918 '')     $cat >&4 <<EOM
16919 I can't figure out how to access stdio streams by file descriptor number.
16920 EOM
16921         d_stdio_stream_array="$undef"
16922         ;;
16923 *)      $cat >&4 <<EOM
16924 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
16925 EOM
16926         d_stdio_stream_array="$define"
16927         ;;
16928 esac
16929
16930 : see if strcoll exists
16931 set strcoll d_strcoll
16932 eval $inlibc
16933
16934 : check for structure copying
16935 echo " "
16936 echo "Checking to see if your C compiler can copy structs..." >&4
16937 $cat >try.c <<'EOCP'
16938 int main()
16939 {
16940         struct blurfl {
16941                 int dyick;
16942         } foo, bar;
16943
16944         foo = bar;
16945 }
16946 EOCP
16947 if $cc -c try.c >/dev/null 2>&1 ; then
16948         val="$define"
16949         echo "Yup, it can."
16950 else
16951         val="$undef"
16952         echo "Nope, it can't."
16953 fi
16954 set d_strctcpy
16955 eval $setvar
16956 $rm -f try.*
16957
16958 : see if strerror and/or sys_errlist[] exist
16959 echo " "
16960 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
16961     if set strerror val -f d_strerror; eval $csym; $val; then
16962                 echo 'strerror() found.' >&4
16963                 d_strerror="$define"
16964                 d_strerrm='strerror(e)'
16965                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16966                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
16967                         d_syserrlst="$define"
16968                 else
16969                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
16970                         d_syserrlst="$undef"
16971                 fi
16972     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
16973                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
16974                 echo 'strerror() found in string header.' >&4
16975                 d_strerror="$define"
16976                 d_strerrm='strerror(e)'
16977                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16978                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
16979                                 d_syserrlst="$define"
16980                 else
16981                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
16982                         d_syserrlst="$undef"
16983                 fi
16984     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16985                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
16986                 d_strerror="$undef"
16987                 d_syserrlst="$define"
16988                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
16989     else
16990                 echo 'strerror() and sys_errlist[] NOT found.' >&4
16991                 d_strerror="$undef"
16992                 d_syserrlst="$undef"
16993                 d_strerrm='"unknown"'
16994     fi
16995 fi
16996
16997 : see if strerror_r exists
16998 set strerror_r d_strerror_r
16999 eval $inlibc
17000 case "$d_strerror_r" in
17001 "$define")
17002         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17003         case "$d_strerror_r_proto:$usethreads" in
17004         ":define")      d_strerror_r_proto=define
17005                 set d_strerror_r_proto strerror_r $hdrs
17006                 eval $hasproto ;;
17007         *)      ;;
17008         esac
17009         case "$d_strerror_r_proto" in
17010         define)
17011         case "$strerror_r_proto" in
17012         ''|0) try='int strerror_r(int, char*, size_t);'
17013         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17014         esac
17015         case "$strerror_r_proto" in
17016         ''|0) try='int strerror_r(int, char*, int);'
17017         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17018         esac
17019         case "$strerror_r_proto" in
17020         ''|0) try='char* strerror_r(int, char*, size_t);'
17021         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17022         esac
17023         case "$strerror_r_proto" in
17024         ''|0)   d_strerror_r=undef
17025                 strerror_r_proto=0
17026                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17027         * )     case "$strerror_r_proto" in
17028                 REENTRANT_PROTO*) ;;
17029                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17030                 esac
17031                 echo "Prototype: $try" ;;
17032         esac
17033         ;;
17034         *)      case "$usethreads" in
17035                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17036                 esac
17037                 d_strerror_r=undef
17038                 strerror_r_proto=0
17039                 ;;
17040         esac
17041         ;;
17042 *)      strerror_r_proto=0
17043         ;;
17044 esac
17045
17046 : see if strftime exists
17047 set strftime d_strftime
17048 eval $inlibc
17049
17050 : see if strlcat exists
17051 set strlcat d_strlcat
17052 eval $inlibc
17053
17054 : see if strlcpy exists
17055 set strlcpy d_strlcpy
17056 eval $inlibc
17057
17058 : see if strtod exists
17059 set strtod d_strtod
17060 eval $inlibc
17061
17062 : see if strtol exists
17063 set strtol d_strtol
17064 eval $inlibc
17065
17066 : see if strtold exists
17067 set strtold d_strtold
17068 eval $inlibc
17069
17070 : see if strtoll exists
17071 set strtoll d_strtoll
17072 eval $inlibc
17073
17074 case "$d_longlong-$d_strtoll" in
17075 "$define-$define")
17076         $cat <<EOM
17077 Checking whether your strtoll() works okay...
17078 EOM
17079         $cat >try.c <<'EOCP'
17080 #include <errno.h>
17081 #ifdef __hpux
17082 #define strtoll __strtoll
17083 #endif
17084 #ifdef __EMX__
17085 #define strtoll _strtoll
17086 #endif
17087 #include <stdio.h>
17088 extern long long int strtoll(char *s, char **, int); 
17089 static int bad = 0;
17090 int check(char *s, long long ell, int een) {
17091         long long gll;
17092         errno = 0;
17093         gll = strtoll(s, 0, 10);
17094         if (!((gll == ell) && (errno == een)))
17095                 bad++;
17096 }
17097 int main() {
17098         check(" 1",                                      1LL, 0);
17099         check(" 0",                                      0LL, 0);
17100         check("-1",                                     -1LL, 0);
17101         check("-9223372036854775808", -9223372036854775808LL, 0);
17102         check("-9223372036854775808", -9223372036854775808LL, 0);
17103         check(" 9223372036854775807",  9223372036854775807LL, 0);
17104         check("-9223372036854775808", -9223372036854775808LL, 0);
17105         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17106         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17107         if (!bad)
17108                 printf("ok\n");
17109 }
17110 EOCP
17111         set try
17112         if eval $compile; then
17113                 yyy=`$run ./try`
17114                 case "$yyy" in
17115                 ok) echo "Your strtoll() seems to be working okay." ;;
17116                 *) cat <<EOM >&4
17117 Your strtoll() doesn't seem to be working okay.
17118 EOM
17119                    d_strtoll="$undef"
17120                    ;;
17121                 esac
17122         else
17123                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17124                 d_strtoll="$undef"
17125         fi
17126         ;;
17127 esac
17128
17129 : see if strtoq exists
17130 set strtoq d_strtoq
17131 eval $inlibc
17132
17133 : see if strtoul exists
17134 set strtoul d_strtoul
17135 eval $inlibc
17136
17137 case "$d_strtoul" in
17138 "$define")
17139         $cat <<EOM
17140 Checking whether your strtoul() works okay...
17141 EOM
17142         $cat >try.c <<'EOCP'
17143 #include <errno.h>
17144 #include <stdio.h>
17145 extern unsigned long int strtoul(char *s, char **, int); 
17146 static int bad = 0;
17147 void check(char *s, unsigned long eul, int een) {
17148         unsigned long gul;
17149         errno = 0;
17150         gul = strtoul(s, 0, 10);
17151         if (!((gul == eul) && (errno == een)))
17152                 bad++;
17153 }
17154 int main() {
17155         check(" 1", 1L, 0);
17156         check(" 0", 0L, 0);
17157 EOCP
17158         case "$longsize" in
17159         8)
17160             $cat >>try.c <<'EOCP'
17161         check("18446744073709551615", 18446744073709551615UL, 0);
17162         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17163 #if 0 /* strtoul() for /^-/ strings is undefined. */
17164         check("-1", 18446744073709551615UL, 0);
17165         check("-18446744073709551614", 2, 0);
17166         check("-18446744073709551615", 1, 0);
17167         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17168         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17169 #endif
17170 EOCP
17171                 ;;
17172         4)
17173                     $cat >>try.c <<'EOCP'
17174         check("4294967295", 4294967295UL, 0);
17175         check("4294967296", 4294967295UL, ERANGE);
17176 #if 0 /* strtoul() for /^-/ strings is undefined. */
17177         check("-1", 4294967295UL, 0);
17178         check("-4294967294", 2, 0);
17179         check("-4294967295", 1, 0);
17180         check("-4294967296", 4294967295UL, ERANGE);
17181         check("-4294967297", 4294967295UL, ERANGE);
17182 #endif
17183 EOCP
17184                 ;;
17185         *)
17186 : Should we write these tests to be more portable by sprintf-ing
17187 : ~0 and then manipulating that char string as input for strtol?
17188                 ;;
17189         esac
17190         $cat >>try.c <<'EOCP'
17191         if (!bad)
17192                 printf("ok\n");
17193         return 0;
17194 }
17195 EOCP
17196         set try
17197         if eval $compile; then
17198                 case "`$run ./try`" in
17199                 ok) echo "Your strtoul() seems to be working okay." ;;
17200                 *) cat <<EOM >&4
17201 Your strtoul() doesn't seem to be working okay.
17202 EOM
17203                    d_strtoul="$undef"
17204                    ;;
17205                 esac
17206         fi
17207         ;;
17208 esac
17209
17210 : see if strtoull exists
17211 set strtoull d_strtoull
17212 eval $inlibc
17213
17214 case "$d_longlong-$d_strtoull" in
17215 "$define-$define")
17216         $cat <<EOM
17217 Checking whether your strtoull() works okay...
17218 EOM
17219         $cat >try.c <<'EOCP'
17220 #include <errno.h>
17221 #ifdef __hpux
17222 #define strtoull __strtoull
17223 #endif
17224 #include <stdio.h>
17225 extern unsigned long long int strtoull(char *s, char **, int); 
17226 static int bad = 0;
17227 int check(char *s, long long eull, int een) {
17228         long long gull;
17229         errno = 0;
17230         gull = strtoull(s, 0, 10);
17231         if (!((gull == eull) && (errno == een)))
17232                 bad++;
17233 }
17234 int main() {
17235         check(" 1",                                        1LL, 0);
17236         check(" 0",                                        0LL, 0);
17237         check("18446744073709551615",  18446744073709551615ULL, 0);
17238         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17239 #if 0 /* strtoull() for /^-/ strings is undefined. */
17240         check("-1",                    18446744073709551615ULL, 0);
17241         check("-18446744073709551614",                     2LL, 0);
17242         check("-18446744073709551615",                     1LL, 0);
17243         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17244         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17245 #endif
17246         if (!bad)
17247                 printf("ok\n");
17248 }
17249 EOCP
17250         set try
17251         if eval $compile; then
17252                 case "`$run ./try`" in
17253                 ok) echo "Your strtoull() seems to be working okay." ;;
17254                 *) cat <<EOM >&4
17255 Your strtoull() doesn't seem to be working okay.
17256 EOM
17257                    d_strtoull="$undef"
17258                    ;;
17259                 esac
17260         fi
17261         ;;
17262 esac
17263
17264 : see if strtouq exists
17265 set strtouq d_strtouq
17266 eval $inlibc
17267
17268 case "$d_strtouq" in
17269 "$define")
17270         $cat <<EOM
17271 Checking whether your strtouq() works okay...
17272 EOM
17273         $cat >try.c <<'EOCP'
17274 #include <errno.h>
17275 #include <stdio.h>
17276 extern unsigned long long int strtouq(char *s, char **, int); 
17277 static int bad = 0;
17278 void check(char *s, unsigned long long eull, int een) {
17279         unsigned long long gull;
17280         errno = 0;
17281         gull = strtouq(s, 0, 10);
17282         if (!((gull == eull) && (errno == een)))
17283                 bad++;
17284 }
17285 int main() {
17286         check(" 1",                                        1LL, 0);
17287         check(" 0",                                        0LL, 0);
17288         check("18446744073709551615",  18446744073709551615ULL, 0);
17289         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17290 #if 0 /* strtouq() for /^-/ strings is undefined. */
17291         check("-1",                    18446744073709551615ULL, 0);
17292         check("-18446744073709551614",                     2LL, 0);
17293         check("-18446744073709551615",                     1LL, 0);
17294         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17295         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17296 #endif
17297         if (!bad)
17298                 printf("ok\n");
17299         return 0;
17300 }
17301 EOCP
17302         set try
17303         if eval $compile; then
17304                 case "`$run ./try`" in
17305                 ok) echo "Your strtouq() seems to be working okay." ;;
17306                 *) cat <<EOM >&4
17307 Your strtouq() doesn't seem to be working okay.
17308 EOM
17309                    d_strtouq="$undef"
17310                    ;;
17311                 esac
17312         fi
17313         ;;
17314 esac
17315
17316 : see if strxfrm exists
17317 set strxfrm d_strxfrm
17318 eval $inlibc
17319
17320 : see if symlink exists
17321 set symlink d_symlink
17322 eval $inlibc
17323
17324 : see if syscall exists
17325 set syscall d_syscall
17326 eval $inlibc
17327
17328 : see if prototype for syscall is available
17329 echo " "
17330 set d_syscallproto syscall $i_unistd unistd.h
17331 eval $hasproto
17332
17333 : see if sysconf exists
17334 set sysconf d_sysconf
17335 eval $inlibc
17336
17337 : see if system exists
17338 set system d_system
17339 eval $inlibc
17340
17341 : see if tcgetpgrp exists
17342 set tcgetpgrp d_tcgetpgrp
17343 eval $inlibc
17344
17345 : see if tcsetpgrp exists
17346 set tcsetpgrp d_tcsetpgrp
17347 eval $inlibc
17348
17349 : see if prototype for telldir is available
17350 echo " "
17351 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17352 eval $hasproto
17353
17354 : see if time exists
17355 echo " "
17356 if test "X$d_time" = X -o X"$timetype" = X; then
17357     if set time val -f d_time; eval $csym; $val; then
17358                 echo 'time() found.' >&4
17359                 val="$define"
17360                 rp="What is the type returned by time() on this system?"
17361                 set time_t timetype long stdio.h sys/types.h
17362                 eval $typedef_ask
17363     else
17364                 echo 'time() not found, hope that will do.' >&4
17365                 val="$undef"
17366                 timetype='int';
17367     fi
17368     set d_time
17369     eval $setvar
17370 fi
17371
17372 : see if this is a sys/times.h system
17373 set sys/times.h i_systimes
17374 eval $inhdr
17375
17376 : see if times exists
17377 echo " "
17378 if set times val -f d_times; eval $csym; $val; then
17379         echo 'times() found.' >&4
17380         d_times="$define"
17381         inc=''
17382         case "$i_systimes" in
17383         "$define") inc='sys/times.h';;
17384         esac
17385         rp="What is the type returned by times() on this system?"
17386         set clock_t clocktype long stdio.h sys/types.h $inc
17387         eval $typedef_ask
17388 else
17389         echo 'times() NOT found, hope that will do.' >&4
17390         d_times="$undef"
17391         clocktype='int'
17392 fi
17393
17394 : see if tmpnam_r exists
17395 set tmpnam_r d_tmpnam_r
17396 eval $inlibc
17397 case "$d_tmpnam_r" in
17398 "$define")
17399         hdrs="$i_systypes sys/types.h define stdio.h "
17400         case "$d_tmpnam_r_proto:$usethreads" in
17401         ":define")      d_tmpnam_r_proto=define
17402                 set d_tmpnam_r_proto tmpnam_r $hdrs
17403                 eval $hasproto ;;
17404         *)      ;;
17405         esac
17406         case "$d_tmpnam_r_proto" in
17407         define)
17408         case "$tmpnam_r_proto" in
17409         ''|0) try='char* tmpnam_r(char*);'
17410         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17411         esac
17412         case "$tmpnam_r_proto" in
17413         ''|0)   d_tmpnam_r=undef
17414                 tmpnam_r_proto=0
17415                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
17416         * )     case "$tmpnam_r_proto" in
17417                 REENTRANT_PROTO*) ;;
17418                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17419                 esac
17420                 echo "Prototype: $try" ;;
17421         esac
17422         ;;
17423         *)      case "$usethreads" in
17424                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17425                 esac
17426                 d_tmpnam_r=undef
17427                 tmpnam_r_proto=0
17428                 ;;
17429         esac
17430         ;;
17431 *)      tmpnam_r_proto=0
17432         ;;
17433 esac
17434
17435 : see if truncate exists
17436 set truncate d_truncate
17437 eval $inlibc
17438
17439 : see if ttyname_r exists
17440 set ttyname_r d_ttyname_r
17441 eval $inlibc
17442 case "$d_ttyname_r" in
17443 "$define")
17444         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
17445         case "$d_ttyname_r_proto:$usethreads" in
17446         ":define")      d_ttyname_r_proto=define
17447                 set d_ttyname_r_proto ttyname_r $hdrs
17448                 eval $hasproto ;;
17449         *)      ;;
17450         esac
17451         case "$d_ttyname_r_proto" in
17452         define)
17453         case "$ttyname_r_proto" in
17454         ''|0) try='int ttyname_r(int, char*, size_t);'
17455         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17456         esac
17457         case "$ttyname_r_proto" in
17458         ''|0) try='int ttyname_r(int, char*, int);'
17459         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17460         esac
17461         case "$ttyname_r_proto" in
17462         ''|0) try='char* ttyname_r(int, char*, int);'
17463         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17464         esac
17465         case "$ttyname_r_proto" in
17466         ''|0)   d_ttyname_r=undef
17467                 ttyname_r_proto=0
17468                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
17469         * )     case "$ttyname_r_proto" in
17470                 REENTRANT_PROTO*) ;;
17471                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17472                 esac
17473                 echo "Prototype: $try" ;;
17474         esac
17475         ;;
17476         *)      case "$usethreads" in
17477                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17478                 esac
17479                 d_ttyname_r=undef
17480                 ttyname_r_proto=0
17481                 ;;
17482         esac
17483         ;;
17484 *)      ttyname_r_proto=0
17485         ;;
17486 esac
17487
17488 : see if tzname[] exists
17489 echo " "
17490 if set tzname val -a d_tzname; eval $csym; $val; then
17491         val="$define"
17492         echo 'tzname[] found.' >&4
17493 else
17494         val="$undef"
17495         echo 'tzname[] NOT found.' >&4
17496 fi
17497 set d_tzname
17498 eval $setvar
17499
17500 case "$osname" in
17501 next|rhapsody|darwin) multiarch="$define" ;;
17502 esac
17503 case "$multiarch" in
17504 ''|[nN]*) multiarch="$undef" ;;
17505 esac
17506
17507 : check for ordering of bytes in a UV
17508 echo " "
17509 case "$usecrosscompile$multiarch" in
17510 *$define*)
17511         $cat <<EOM
17512 You seem to be either cross-compiling or doing a multiarchitecture build,
17513 skipping the byteorder check.
17514
17515 EOM
17516         byteorder='ffff'
17517         ;;
17518 *)
17519         case "$byteorder" in
17520         '')
17521                 $cat <<'EOM'
17522 In the following, larger digits indicate more significance.  A big-endian
17523 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17524 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17525 machines may have weird orders like 3412.  A Cray will report 87654321,
17526 an Alpha will report 12345678. If the test program works the default is
17527 probably right.
17528 I'm now running the test program...
17529 EOM
17530                 $cat >try.c <<EOCP
17531 #include <stdio.h>
17532 #$i_stdlib I_STDLIB
17533 #ifdef I_STDLIB
17534 #include <stdlib.h>
17535 #endif
17536 #include <sys/types.h>
17537 typedef $uvtype UV;
17538 int main()
17539 {
17540         int i;
17541         union {
17542                 UV l;
17543                 char c[$uvsize];
17544         } u;
17545
17546         if ($uvsize > 4)
17547                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
17548         else
17549                 u.l = (UV)0x04030201;
17550         for (i = 0; i < $uvsize; i++)
17551                 printf("%c", u.c[i]+'0');
17552         printf("\n");
17553         exit(0);
17554 }
17555 EOCP
17556                 xxx_prompt=y
17557                 set try
17558                 if eval $compile && ./try > /dev/null; then
17559                         dflt=`$run ./try`
17560                         case "$dflt" in
17561                         [1-4][1-4][1-4][1-4]|12345678|87654321)
17562                                 echo "(The test program ran ok.)"
17563                                 echo "byteorder=$dflt"
17564                                 xxx_prompt=n
17565                         ;;
17566                         ????|????????) echo "(The test program ran ok.)" ;;
17567                         *) echo "(The test program didn't run right for some reason.)" ;;
17568                         esac
17569                 else
17570                         dflt='4321'
17571                         cat <<'EOM'
17572 (I can't seem to compile the test program.  Guessing big-endian...)
17573 EOM
17574                 fi
17575                 case "$xxx_prompt" in
17576                 y)
17577                         rp="What is the order of bytes in $uvtype?"
17578                         . ./myread
17579                         byteorder="$ans"
17580                         ;;
17581                 *)      byteorder=$dflt
17582                         ;;
17583                 esac
17584                 ;;
17585         esac
17586         $rm -f try.c try
17587         ;;
17588 esac
17589
17590
17591 $cat <<EOM
17592
17593 Checking to see whether you can access character data unalignedly...
17594 EOM
17595 case "$d_u32align" in
17596 '')   $cat >try.c <<EOCP
17597 #include <stdio.h>
17598 #$i_stdlib I_STDLIB
17599 #ifdef I_STDLIB
17600 #include <stdlib.h>
17601 #endif
17602 #define U32 $u32type
17603 #define BYTEORDER 0x$byteorder
17604 #define U8 $u8type
17605 #include <signal.h>
17606 #ifdef SIGBUS
17607 $signal_t bletch(s) int s; { exit(4); }
17608 #endif
17609 int main() {
17610 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
17611     U8 buf[8];
17612     U32 *up;
17613     int i;
17614
17615     if (sizeof(U32) != 4) {
17616         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
17617         exit(1);
17618     }
17619
17620     fflush(stdout);
17621
17622 #ifdef SIGBUS
17623     signal(SIGBUS, bletch);
17624 #endif
17625
17626     buf[0] = 0;
17627     buf[1] = 0;
17628     buf[2] = 0;
17629     buf[3] = 1;
17630     buf[4] = 0;
17631     buf[5] = 0;
17632     buf[6] = 0;
17633     buf[7] = 1;
17634
17635     for (i = 0; i < 4; i++) {
17636         up = (U32*)(buf + i);
17637         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
17638                (*up == 1 << (8*(3-i)))  /* little-endian */
17639               )
17640            )
17641         {
17642             printf("read failed (%x)\n", *up);
17643             exit(2);
17644         }
17645     }
17646
17647     /* write test */
17648     for (i = 0; i < 4; i++) {
17649         up = (U32*)(buf + i);
17650         *up = 0xBeef;
17651         if (*up != 0xBeef) {
17652             printf("write failed (%x)\n", *up);
17653             exit(3);
17654         }
17655     }
17656
17657     exit(0);
17658 #else
17659     printf("1\n");
17660     exit(1);
17661 #endif
17662     return 0;
17663 }
17664 EOCP
17665 set try
17666 if eval $compile_ok; then
17667         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
17668         $run ./try 2>&1 >/dev/null
17669         case "$?" in
17670         0)      cat >&4 <<EOM
17671 You can access character data pretty unalignedly.
17672 EOM
17673                 d_u32align="$undef"
17674                 ;;
17675         *)      cat >&4 <<EOM
17676 It seems that you must access character data in an aligned manner.
17677 EOM
17678                 d_u32align="$define"
17679                 ;;
17680         esac
17681 else
17682         rp='Can you access character data at unaligned addresses?'
17683         dflt='n'
17684         . ./myread
17685         case "$ans" in
17686         [yY]*)  d_u32align="$undef"  ;;
17687         *)      d_u32align="$define" ;;
17688         esac
17689 fi
17690 $rm -f core core.try.* try.core
17691 ;;
17692 esac
17693
17694 : see if ualarm exists
17695 set ualarm d_ualarm
17696 eval $inlibc
17697
17698 : see if umask exists
17699 set umask d_umask
17700 eval $inlibc
17701
17702 : see if unordered exists
17703 set unordered d_unordered
17704 eval $inlibc
17705
17706 : see if unsetenv exists
17707 set unsetenv d_unsetenv
17708 eval $inlibc
17709
17710 : see if usleep exists
17711 set usleep d_usleep
17712 eval $inlibc
17713
17714 : see if prototype for usleep is available
17715 echo " "
17716 set d_usleepproto usleep $i_unistd unistd.h
17717 eval $hasproto
17718
17719 : see if ustat exists
17720 set ustat d_ustat
17721 eval $inlibc
17722
17723 : backward compatibility for d_hvfork
17724 if test X$d_hvfork != X; then
17725         d_vfork="$d_hvfork"
17726         d_hvfork=''
17727 fi
17728 : see if there is a vfork
17729 val=''
17730 set vfork val
17731 eval $inlibc
17732
17733 : Ok, but do we want to use it. vfork is reportedly unreliable in 
17734 : perl on Solaris 2.x, and probably elsewhere.
17735 case "$val" in
17736 $define)
17737         echo " "
17738         case "$usevfork" in
17739         false) dflt='n';;
17740         *) dflt='y';;
17741         esac
17742         cat <<'EOM'
17743  
17744 Perl can only use a vfork() that doesn't suffer from strict
17745 restrictions on calling functions or modifying global data in
17746 the child.  For example, glibc-2.1 contains such a vfork()
17747 that is unsuitable.  If your system provides a proper fork()
17748 call, chances are that you do NOT want perl to use vfork().
17749
17750 EOM
17751         rp="Do you still want to use vfork()?"
17752         . ./myread
17753         case "$ans" in
17754         y|Y) ;;
17755         *)
17756                 echo "Ok, we won't use vfork()."
17757                 val="$undef"
17758                 ;;
17759         esac
17760         ;;
17761 esac
17762 set d_vfork
17763 eval $setvar
17764 case "$d_vfork" in
17765 $define) usevfork='true';;
17766 *) usevfork='false';;
17767 esac
17768
17769 : see if closedir exists
17770 set closedir d_closedir
17771 eval $inlibc
17772
17773 case "$d_closedir" in
17774 "$define")
17775         echo " "
17776         echo "Checking whether closedir() returns a status..." >&4
17777         cat > try.c <<EOM
17778 #$i_dirent I_DIRENT             /**/
17779 #$i_sysdir I_SYS_DIR            /**/
17780 #$i_sysndir I_SYS_NDIR          /**/
17781 #$i_systypes I_SYS_TYPES        /**/
17782
17783 #if defined(I_SYS_TYPES)
17784 #include <sys/types.h>
17785 #endif
17786 #if defined(I_DIRENT)
17787 #include <dirent.h>
17788 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
17789 #include <sys/dir.h>
17790 #endif
17791 #else
17792 #ifdef I_SYS_NDIR
17793 #include <sys/ndir.h>
17794 #else
17795 #ifdef I_SYS_DIR
17796 #ifdef hp9000s500
17797 #include <ndir.h>       /* may be wrong in the future */
17798 #else
17799 #include <sys/dir.h>
17800 #endif
17801 #endif
17802 #endif
17803 #endif 
17804 int main() { return closedir(opendir(".")); }
17805 EOM
17806         set try
17807         if eval $compile_ok; then
17808                 if $run ./try > /dev/null 2>&1 ; then
17809                         echo "Yes, it does."
17810                         val="$undef"
17811                 else
17812                         echo "No, it doesn't."
17813                         val="$define"
17814                 fi
17815         else
17816                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17817                 val="$define"
17818         fi
17819         ;;
17820 *)
17821         val="$undef";
17822         ;;
17823 esac
17824 set d_void_closedir
17825 eval $setvar
17826 $rm -f try try.*
17827 : see if there is a wait4
17828 set wait4 d_wait4
17829 eval $inlibc
17830
17831 : see if waitpid exists
17832 set waitpid d_waitpid
17833 eval $inlibc
17834
17835 : see if wcstombs exists
17836 set wcstombs d_wcstombs
17837 eval $inlibc
17838
17839 : see if wctomb exists
17840 set wctomb d_wctomb
17841 eval $inlibc
17842
17843 : see if writev exists
17844 set writev d_writev
17845 eval $inlibc
17846
17847 : preserve RCS keywords in files with variable substitution, grrr
17848 Date='$Date'
17849 Id='$Id'
17850 Log='$Log'
17851 RCSfile='$RCSfile'
17852 Revision='$Revision'
17853
17854 : check for alignment requirements
17855 echo " "
17856 case "$usecrosscompile$multiarch" in
17857 *$define*)
17858         $cat <<EOM
17859 You seem to be either cross-compiling or doing a multiarchitecture build,
17860 skipping the memory alignment check.
17861
17862 EOM
17863         case "$alignbytes" in
17864         '') alignbytes=8 ;;
17865         esac
17866         ;;
17867 *)
17868         case "$alignbytes" in
17869         '') echo "Checking alignment constraints..." >&4
17870                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
17871                         $cat >try.c <<'EOCP'
17872 typedef long double NV;
17873 EOCP
17874                 else
17875                         $cat >try.c <<'EOCP'
17876 typedef double NV;
17877 EOCP
17878                 fi
17879                 $cat >>try.c <<'EOCP'
17880 #include <stdio.h>
17881 struct foobar {
17882         char foo;
17883         NV bar;
17884 } try_algn;
17885 int main()
17886 {
17887     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
17888     return(0);
17889 }
17890 EOCP
17891                 set try
17892                 if eval $compile_ok; then
17893                         dflt=`$run ./try`
17894                 else
17895                         dflt='8'
17896                         echo "(I can't seem to compile the test program...)"
17897                 fi
17898                 ;;
17899         *) dflt="$alignbytes"
17900                 ;;
17901         esac
17902         rp="Doubles must be aligned on a how-many-byte boundary?"
17903         . ./myread
17904         alignbytes="$ans"
17905         $rm -f try.c try
17906         ;;
17907 esac
17908
17909
17910 : set the base revision
17911 baserev=5.0
17912
17913 : how do we concatenate cpp tokens here?
17914 echo " "
17915 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
17916 $cat >cpp_stuff.c <<'EOCP'
17917 #define RCAT(a,b)a/**/b
17918 #define ACAT(a,b)a ## b
17919 RCAT(Rei,ser)
17920 ACAT(Cir,cus)
17921 EOCP
17922 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
17923 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
17924         echo "Oh!  Smells like ANSI's been here." >&4
17925         echo "We can catify or stringify, separately or together!"
17926         cpp_stuff=42
17927 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
17928         echo "Ah, yes!  The good old days!" >&4
17929         echo "However, in the good old days we don't know how to stringify and"
17930         echo "catify at the same time."
17931         cpp_stuff=1
17932 else
17933         $cat >&4 <<EOM
17934 Hmm, I don't seem to be able to concatenate tokens with your cpp.
17935 You're going to have to edit the values of CAT[2-5] in config.h...
17936 EOM
17937         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
17938 fi
17939 $rm -f cpp_stuff.*
17940
17941 : see if this is a db.h system
17942 set db.h i_db
17943 eval $inhdr
17944
17945 case "$i_db" in
17946 $define)
17947         : Check db version.
17948         echo " "
17949         echo "Checking Berkeley DB version ..." >&4
17950         $cat >try.c <<EOCP
17951 #$d_const HASCONST
17952 #ifndef HASCONST
17953 #define const
17954 #endif
17955 #include <sys/types.h>
17956 #include <stdio.h>
17957 #$i_stdlib I_STDLIB
17958 #ifdef I_STDLIB
17959 #include <stdlib.h>
17960 #endif
17961 #include <db.h>
17962 int main(int argc, char *argv[])
17963 {
17964 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
17965     int Major, Minor, Patch ;
17966     unsigned long Version ;
17967     (void)db_version(&Major, &Minor, &Patch) ;
17968     if (argc == 2) {
17969         printf("%d %d %d %d %d %d\n",
17970                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
17971                Major, Minor, Patch);
17972         exit(0);
17973     }
17974     printf("You have Berkeley DB Version 2 or greater.\n");
17975
17976     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
17977                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
17978     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
17979                 Major, Minor, Patch) ;
17980
17981     /* check that db.h & libdb are compatible */
17982     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
17983         printf("db.h and libdb are incompatible.\n") ;
17984         exit(3);        
17985     }
17986
17987     printf("db.h and libdb are compatible.\n") ;
17988
17989     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
17990                 + DB_VERSION_PATCH ;
17991
17992     /* needs to be >= 2.3.4 */
17993     if (Version < 2003004) {
17994     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
17995         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
17996         exit(2);        
17997     }
17998
17999     exit(0);
18000 #else
18001 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18002     if (argc == 2) {
18003         printf("1 0 0\n");
18004         exit(0);
18005     }
18006     printf("You have Berkeley DB Version 1.\n");
18007     exit(0);    /* DB version < 2: the coast is clear. */
18008 #else
18009     exit(1);    /* <db.h> not Berkeley DB? */
18010 #endif
18011 #endif
18012 }
18013 EOCP
18014         set try
18015         if eval $compile_ok && $run ./try; then
18016                 echo 'Looks OK.' >&4
18017                 set `$run ./try 1`
18018                 db_version_major=$1
18019                 db_version_minor=$2
18020                 db_version_patch=$3
18021         else
18022                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18023                 i_db=$undef
18024                 case " $libs " in
18025                 *"-ldb "*)
18026                         : Remove db from list of libraries to use
18027                         echo "Removing unusable -ldb from library list" >&4
18028                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18029                         shift
18030                         libs="$*"
18031                         echo "libs = $libs" >&4
18032                         ;;
18033                 esac
18034         fi
18035         $rm -f try.*
18036         ;;
18037 esac
18038
18039 case "$i_db" in
18040 define)
18041         : Check the return type needed for hash 
18042         echo " "
18043         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18044         $cat >try.c <<EOCP
18045 #$d_const HASCONST
18046 #ifndef HASCONST
18047 #define const
18048 #endif
18049 #include <sys/types.h>
18050 #include <db.h>
18051
18052 #ifndef DB_VERSION_MAJOR
18053 u_int32_t hash_cb (ptr, size)
18054 const void *ptr;
18055 size_t size;
18056 {
18057 }
18058 HASHINFO info;
18059 int main()
18060 {
18061         info.hash = hash_cb;
18062 }
18063 #endif
18064 EOCP
18065         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18066                 if $contains warning try.out >>/dev/null 2>&1 ; then
18067                         db_hashtype='int'
18068                 else
18069                         db_hashtype='u_int32_t'
18070                 fi
18071         else
18072                 : XXX Maybe we should just give up here.
18073                 db_hashtype=u_int32_t
18074                 $cat try.out >&4
18075                 echo "Help:  I can't seem to compile the db test program." >&4
18076                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18077         fi
18078         $rm -f try.*
18079         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18080         ;;
18081 *)      db_hashtype=u_int32_t
18082         ;;
18083 esac
18084 case "$i_db" in
18085 define)
18086         : Check the return type needed for prefix 
18087         echo " "
18088         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18089         cat >try.c <<EOCP
18090 #$d_const HASCONST
18091 #ifndef HASCONST
18092 #define const
18093 #endif
18094 #include <sys/types.h>
18095 #include <db.h>
18096
18097 #ifndef DB_VERSION_MAJOR
18098 size_t prefix_cb (key1, key2)
18099 const DBT *key1;
18100 const DBT *key2;
18101 {
18102 }
18103 BTREEINFO info;
18104 int main()
18105 {
18106         info.prefix = prefix_cb;
18107 }
18108 #endif
18109 EOCP
18110         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18111                 if $contains warning try.out >>/dev/null 2>&1 ; then
18112                         db_prefixtype='int'
18113                 else
18114                         db_prefixtype='size_t'
18115                 fi
18116         else
18117                 db_prefixtype='size_t'
18118                 : XXX Maybe we should just give up here.
18119                 $cat try.out >&4
18120                 echo "Help:  I can't seem to compile the db test program." >&4
18121                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18122         fi
18123         $rm -f try.*
18124         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18125         ;;
18126 *)      db_prefixtype='size_t'
18127         ;;
18128 esac
18129
18130
18131 : How can we generate normalized random numbers ?
18132 echo " "
18133 echo "Looking for a random number function..." >&4
18134 case "$randfunc" in
18135 '')
18136         if set drand48 val -f; eval $csym; $val; then
18137                 dflt="drand48"
18138                 echo "Good, found drand48()." >&4
18139         elif set random val -f; eval $csym; $val; then
18140                 dflt="random"
18141                 echo "OK, found random()." >&4
18142         else
18143                 dflt="rand"
18144                 echo "Yick, looks like I have to use rand()." >&4
18145         fi
18146         echo " "
18147         ;;
18148 *)
18149         dflt="$randfunc"
18150         ;;
18151 esac
18152 cont=true
18153
18154 case "$ccflags" in
18155 *-Dmy_rand=*|*-Dmy_srand=*)
18156         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18157         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18158         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18159         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18160         ;;
18161 esac
18162
18163 while $test "$cont"; do
18164         rp="Use which function to generate random numbers?"
18165         . ./myread
18166         if $test "$ans" = "$dflt"; then
18167                 : null
18168         else
18169                 randbits=''
18170         fi
18171         randfunc="$ans"
18172         if set $ans val -f; eval $csym; $val; then
18173                 cont=''
18174         else
18175                 dflt=y
18176                 rp="I cannot find function $ans. Use that name anyway?"
18177                 . ./myread
18178                 dflt=rand
18179                 case "$ans" in
18180                         [yY]*) cont='';;
18181                 esac
18182         fi
18183         case "$cont" in
18184         '')
18185                 case "$randfunc" in
18186                 drand48)
18187                         drand01="drand48()"
18188                         seedfunc="srand48"
18189                         randbits=48
18190                         randseedtype=long
18191                         ;;
18192                 rand|random)
18193                         case "$randbits" in
18194                         '')
18195 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18196                                 $cat >try.c <<EOCP
18197 #$i_unistd I_UNISTD
18198 #$i_stdlib I_STDLIB
18199 #include <stdio.h>
18200 #ifdef I_UNISTD
18201 #  include <unistd.h>
18202 #endif
18203 #ifdef I_STDLIB
18204 #  include <stdlib.h>
18205 #endif
18206 int main()
18207 {
18208         register int i;
18209         register unsigned long tmp;
18210         register unsigned long max = 0L;
18211
18212         for (i = 1000; i; i--) {
18213                 tmp = (unsigned long) $randfunc();
18214                 if (tmp > max) max = tmp;
18215         }
18216         for (i = 0; max; i++)
18217                 max /= 2;
18218         printf("%d\n",i);
18219 }
18220 EOCP
18221                                 set try
18222                                 if eval $compile_ok; then
18223                                         dflt=`try`
18224                                 else
18225                                         dflt='?'
18226                                         echo "(I can't seem to compile the test program...)"
18227                                 fi
18228                                 ;;
18229                         *)
18230                                 dflt="$randbits"
18231                                 ;;
18232                         esac
18233                         rp="How many bits does your $randfunc() function produce?"
18234                         . ./myread
18235                         randbits="$ans"
18236                         $rm -f try.c try
18237                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18238                         seedfunc="s$randfunc"
18239                         randseedtype=unsigned
18240                         ;;
18241                 *)
18242                         dflt="31"
18243                         rp="How many bits does your $randfunc() function produce?"
18244                         . ./myread
18245                         randbits="$ans"
18246                         seedfunc="s$randfunc"
18247                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18248                         if set $seedfunc val -f; eval $csym; $val; then
18249                                 echo "(Using $seedfunc() to seed random generator)"
18250                         else
18251                                 echo "(Warning: no $seedfunc() to seed random generator)"
18252                                 seedfunc=rand
18253                         fi
18254                         randseedtype=unsigned
18255                         ;;
18256                 esac
18257                 ;;
18258         esac
18259 done
18260
18261 echo " "
18262 echo "Determining whether or not we are on an EBCDIC system..." >&4
18263 $cat >try.c <<'EOM'
18264 int main()
18265 {
18266   if ('M'==0xd4) return 0;
18267   return 1;
18268 }
18269 EOM
18270
18271 val=$undef
18272 set try
18273 if eval $compile_ok; then
18274         if $run ./try; then
18275                 echo "You seem to speak EBCDIC." >&4
18276                 val="$define"
18277         else
18278                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18279         fi
18280 else
18281         echo "I'm unable to compile the test program." >&4
18282         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18283 fi
18284 $rm -f try try.*
18285 set ebcdic
18286 eval $setvar
18287
18288 echo " "
18289 $cat >&4 <<EOM
18290 Checking how to flush all pending stdio output...
18291 EOM
18292 # I only know how to find the first 32 possibly open files on SunOS.
18293 # See also hints/sunos_4_1.sh and util.c  --AD
18294 case "$osname" in
18295 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18296 esac
18297 $cat >>try.c <<EOCP
18298 #include <stdio.h>
18299 #$i_stdlib I_STDLIB
18300 #ifdef I_STDLIB
18301 #include <stdlib.h>
18302 #endif
18303 #$i_unistd I_UNISTD
18304 #ifdef I_UNISTD
18305 # include <unistd.h>
18306 #endif
18307 #$d_sysconf HAS_SYSCONF
18308 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18309 #ifdef HAS_STDIO_STREAM_ARRAY
18310 # define STDIO_STREAM_ARRAY $stdio_stream_array
18311 #endif
18312 int main() {
18313   FILE* p;
18314   unlink("try.out");
18315   p = fopen("try.out", "w");
18316 #ifdef TRY_FPUTC
18317   fputc('x', p);
18318 #else
18319 # ifdef TRY_FPRINTF
18320   fprintf(p, "x");
18321 # endif
18322 #endif
18323 #ifdef TRY_FFLUSH_NULL
18324   fflush(NULL);
18325 #endif
18326 #ifdef TRY_FFLUSH_ALL
18327   {
18328     long open_max = -1;
18329 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18330     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18331 # else
18332 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18333     open_max = sysconf(_SC_OPEN_MAX);
18334 #  else
18335 #   ifdef FOPEN_MAX
18336     open_max = FOPEN_MAX;
18337 #   else
18338 #    ifdef OPEN_MAX
18339     open_max = OPEN_MAX;
18340 #    else
18341 #     ifdef _NFILE
18342     open_max = _NFILE;
18343 #     endif
18344 #    endif
18345 #   endif
18346 #  endif
18347 # endif 
18348 # ifdef HAS_STDIO_STREAM_ARRAY
18349     if (open_max > 0) {
18350       long i;
18351       for (i = 0; i < open_max; i++)
18352             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18353                 STDIO_STREAM_ARRAY[i]._file < open_max &&
18354                 STDIO_STREAM_ARRAY[i]._flag)
18355                 fflush(&STDIO_STREAM_ARRAY[i]);
18356     }   
18357   }
18358 # endif
18359 #endif
18360   _exit(42);
18361 }
18362 EOCP
18363 : first we have to find out how _not_ to flush
18364 $to try.c
18365 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18366     output=''
18367     set try -DTRY_FPUTC
18368     if eval $compile; then
18369             $run ./try 2>/dev/null
18370             code="$?"
18371             $from try.out
18372             if $test ! -s try.out -a "X$code" = X42; then
18373                 output=-DTRY_FPUTC
18374             fi
18375     fi
18376     case "$output" in
18377     '')
18378             set try -DTRY_FPRINTF
18379             if eval $compile; then
18380                     $run ./try 2>/dev/null
18381                     code="$?"
18382                     $from try.out
18383                     if $test ! -s try.out -a "X$code" = X42; then
18384                         output=-DTRY_FPRINTF
18385                     fi
18386             fi
18387         ;;
18388     esac
18389 fi
18390 : check for fflush NULL behaviour
18391 case "$fflushNULL" in
18392 '')     set try -DTRY_FFLUSH_NULL $output
18393         if eval $compile; then
18394                 $run ./try 2>/dev/null
18395                 code="$?"
18396                 $from try.out
18397                 if $test -s try.out -a "X$code" = X42; then
18398                         fflushNULL="`$cat try.out`"
18399                 else
18400                         if $test "X$code" != X42; then
18401                                 $cat >&4 <<EOM
18402 (If this test failed, don't worry, we'll try another method shortly.)
18403 EOM
18404                         fi
18405                 fi
18406         fi
18407         $rm -f core try.core core.try.*
18408         case "$fflushNULL" in
18409         x)      $cat >&4 <<EOM
18410 Your fflush(NULL) works okay for output streams.
18411 Let's see if it clobbers input pipes...
18412 EOM
18413 # As of mid-March 2000 all versions of Solaris appear to have a stdio
18414 # bug that improperly flushes the input end of pipes.  So we avoid the
18415 # autoflush on fork/system/exec support for now. :-(
18416 $cat >tryp.c <<EOCP
18417 #include <stdio.h>
18418 int
18419 main(int argc, char **argv)
18420 {
18421     char buf[1024];
18422     int i;
18423     char *bp = buf;
18424     while (1) {
18425         while ((i = getc(stdin)) != -1
18426                && (*bp++ = i) != '\n'
18427                && bp < &buf[1024])
18428         /* DO NOTHING */ ;
18429         *bp = '\0';
18430         fprintf(stdout, "%s", buf);
18431         fflush(NULL);
18432         if (i == -1)
18433             return 0;
18434         bp = buf;
18435     }
18436 }
18437 EOCP
18438                 fflushNULL="$define"
18439                 set tryp
18440                 if eval $compile; then
18441                     $rm -f tryp.out
18442                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18443                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
18444                        $cat >&4 <<EOM
18445 fflush(NULL) seems to behave okay with input streams.
18446 EOM
18447                         fflushNULL="$define"
18448                     else
18449                         $cat >&4 <<EOM
18450 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
18451 EOM
18452                         fflushNULL="$undef"
18453                     fi
18454                 fi
18455                 $rm -f core tryp.c tryp.core core.tryp.*
18456                 ;;
18457         '')     $cat >&4 <<EOM
18458 Your fflush(NULL) isn't working (contrary to ANSI C).
18459 EOM
18460                 fflushNULL="$undef"
18461                 ;;
18462         *)      $cat >&4 <<EOM
18463 Cannot figure out whether your fflush(NULL) works or not.
18464 I'm assuming it doesn't (contrary to ANSI C).
18465 EOM
18466                 fflushNULL="$undef"
18467                 ;;
18468         esac
18469         ;;
18470 $define|true|[yY]*)
18471         fflushNULL="$define"
18472         ;;
18473 *)
18474         fflushNULL="$undef"
18475         ;;
18476 esac
18477 : check explicit looping only if NULL did not work, and if the pipe
18478 : bug does not show up on an explicit flush too
18479 case "$fflushNULL" in
18480 "$undef")
18481         $cat >tryp.c <<EOCP
18482 #include <stdio.h>
18483 int
18484 main(int argc, char **argv)
18485 {
18486     char buf[1024];
18487     int i;
18488     char *bp = buf;
18489     while (1) {
18490         while ((i = getc(stdin)) != -1
18491                && (*bp++ = i) != '\n'
18492                && bp < &buf[1024])
18493         /* DO NOTHING */ ;
18494         *bp = '\0';
18495         fprintf(stdout, "%s", buf);
18496         fflush(stdin);
18497         if (i == -1)
18498             return 0;
18499         bp = buf;
18500     }
18501 }
18502 EOCP
18503         set tryp
18504         if eval $compile; then
18505             $rm -f tryp.out
18506             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18507             if cmp tryp.c tryp.out >/dev/null 2>&1; then
18508                $cat >&4 <<EOM
18509 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18510 EOM
18511                 : now check for fflushall behaviour
18512                 case "$fflushall" in
18513                 '')     set try -DTRY_FFLUSH_ALL $output
18514                         if eval $compile; then
18515                                 $cat >&4 <<EOM
18516 (Now testing the other method--but note that this also may fail.)
18517 EOM
18518                                 $run ./try 2>/dev/null
18519                                 code=$?
18520                                 $from try.out
18521                                 if $test -s try.out -a "X$code" = X42; then
18522                                         fflushall="`$cat try.out`"
18523                                 fi
18524                         fi
18525                         $rm -f core try.core core.try.*
18526                         case "$fflushall" in
18527                         x)      $cat >&4 <<EOM
18528 Whew. Flushing explicitly all the stdio streams works.
18529 EOM
18530                                 fflushall="$define"
18531                                 ;;
18532                         '')     $cat >&4 <<EOM
18533 Sigh. Flushing explicitly all the stdio streams doesn't work.
18534 EOM
18535                                 fflushall="$undef"
18536                                 ;;
18537                         *)      $cat >&4 <<EOM
18538 Cannot figure out whether flushing stdio streams explicitly works or not.
18539 I'm assuming it doesn't.
18540 EOM
18541                                 fflushall="$undef"
18542                                 ;;
18543                         esac
18544                         ;;
18545                 "$define"|true|[yY]*)
18546                         fflushall="$define"
18547                         ;;
18548                 *)
18549                         fflushall="$undef"
18550                         ;;
18551                 esac
18552             else
18553                 $cat >&4 <<EOM
18554 All is futile.  Even fflush(stdin) clobbers input pipes!
18555 EOM
18556                 fflushall="$undef"
18557             fi
18558         else
18559             fflushall="$undef"
18560         fi
18561         $rm -f core tryp.c tryp.core core.tryp.*
18562         ;;
18563 *)      fflushall="$undef"
18564         ;;
18565 esac
18566
18567 case "$fflushNULL$fflushall" in
18568 undefundef)
18569         $cat <<EOM
18570 OK, I give up.  I cannot figure out how to flush pending stdio output.
18571 We won't be flushing handles at all before fork/exec/popen.
18572 EOM
18573         ;;
18574 esac
18575 $rm -f try.* try$exe_ext
18576
18577 : Store the full pathname to the ar program for use in the C program
18578 : Respect a hint or command line value for full_ar.
18579 case "$full_ar" in
18580 '') full_ar=$ar ;;
18581 esac
18582
18583 : Store the full pathname to the sed program for use in the C program
18584 full_sed=$sed
18585
18586 : see what type gids are declared as in the kernel
18587 echo " "
18588 echo "Looking for the type for group ids returned by getgid()."
18589 set gid_t gidtype xxx stdio.h sys/types.h
18590 eval $typedef
18591 case "$gidtype" in
18592 xxx)
18593         xxx=`./findhdr sys/user.h`
18594         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
18595         case $1 in
18596         unsigned) dflt="$1 $2" ;;
18597         *) dflt="$1" ;;
18598         esac
18599         ;;
18600 *) dflt="$gidtype";;
18601 esac
18602 case "$gidtype" in
18603 gid_t) echo "gid_t found." ;;
18604 *)      rp="What is the type for group ids returned by getgid()?"
18605         . ./myread
18606         gidtype="$ans"
18607         ;;
18608 esac
18609
18610 echo " "
18611 case "$gidtype" in
18612 *_t) zzz="$gidtype"     ;;
18613 *)   zzz="gid"          ;;
18614 esac
18615 echo "Checking the size of $zzz..." >&4 
18616 cat > try.c <<EOCP
18617 #include <sys/types.h>
18618 #include <stdio.h>
18619 #$i_stdlib I_STDLIB
18620 #ifdef I_STDLIB
18621 #include <stdlib.h>
18622 #endif
18623 int main() {
18624     printf("%d\n", (int)sizeof($gidtype));
18625     exit(0);
18626 }
18627 EOCP
18628 set try
18629 if eval $compile_ok; then
18630         yyy=`$run ./try`
18631         case "$yyy" in
18632         '')     gidsize=4
18633                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
18634                 ;;
18635         *)      gidsize=$yyy
18636                 echo "Your $zzz is $gidsize bytes long."
18637                 ;;
18638         esac
18639 else
18640         gidsize=4
18641         echo "(I can't compile the test program--guessing $gidsize.)" >&4
18642 fi
18643
18644
18645 echo " "
18646 case "$gidtype" in
18647 *_t) zzz="$gidtype"     ;;
18648 *)   zzz="gid"          ;;
18649 esac
18650 echo "Checking the sign of $zzz..." >&4 
18651 cat > try.c <<EOCP
18652 #include <sys/types.h>
18653 #include <stdio.h>
18654 int main() {
18655         $gidtype foo = -1;
18656         if (foo < 0)
18657                 printf("-1\n");
18658         else
18659                 printf("1\n");
18660 }
18661 EOCP
18662 set try
18663 if eval $compile; then
18664         yyy=`$run ./try`
18665         case "$yyy" in
18666         '')     gidsign=1
18667                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18668                 ;;
18669         *)      gidsign=$yyy
18670                 case "$gidsign" in
18671                  1) echo "Your $zzz is unsigned." ;;
18672                 -1) echo "Your $zzz is signed."   ;;
18673                 esac
18674                 ;;
18675         esac
18676 else
18677         gidsign=1
18678         echo "(I can't compile the test program--guessing unsigned.)" >&4
18679 fi
18680
18681
18682 echo " "
18683
18684 if $test X"$quadtype" != X; then
18685
18686 echo "Checking how to print 64-bit integers..." >&4
18687
18688 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
18689         $cat >try.c <<'EOCP'
18690 #include <sys/types.h>
18691 #include <stdio.h>
18692 int main() {
18693   int q = 12345678901;
18694   printf("%ld\n", q);
18695 }
18696 EOCP
18697         set try
18698         if eval $compile; then
18699                 yyy=`$run ./try`
18700                 case "$yyy" in
18701                 12345678901)
18702                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
18703                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
18704                         echo "We will use %d."
18705                         ;;
18706                 esac
18707         fi
18708 fi
18709
18710 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
18711         $cat >try.c <<'EOCP'
18712 #include <sys/types.h>
18713 #include <stdio.h>
18714 int main() {
18715   long q = 12345678901;
18716   printf("%ld\n", q);
18717 }
18718 EOCP
18719         set try
18720         if eval $compile; then
18721                 yyy=`$run ./try`
18722                 case "$yyy" in
18723                 12345678901)
18724                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
18725                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
18726                         echo "We will use %ld."
18727                         ;;
18728                 esac
18729         fi
18730 fi
18731
18732 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
18733         $cat >try.c <<'EOCP'
18734 #include <sys/types.h>
18735 #include <inttypes.h>
18736 #include <stdio.h>
18737 int main() {
18738   int64_t q = 12345678901;
18739   printf("%" PRId64 "\n", q);
18740 }
18741 EOCP
18742         set try
18743         if eval $compile; then
18744                 yyy=`$run ./try`
18745                 case "$yyy" in
18746                 12345678901)
18747                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
18748                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
18749                         echo "We will use the C9X style."
18750                         ;;
18751                 esac
18752         fi
18753 fi
18754
18755 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18756         $cat >try.c <<EOCP
18757 #include <sys/types.h>
18758 #include <stdio.h>
18759 int main() {
18760   $quadtype q = 12345678901;
18761   printf("%Ld\n", q);
18762 }
18763 EOCP
18764         set try
18765         if eval $compile; then
18766                 yyy=`$run ./try`
18767                 case "$yyy" in
18768                 12345678901)
18769                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
18770                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
18771                         echo "We will use %Ld."
18772                         ;;
18773                 esac
18774         fi
18775 fi
18776
18777 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
18778         $cat >try.c <<'EOCP'
18779 #include <sys/types.h>
18780 #include <stdio.h>
18781 int main() {
18782   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
18783   printf("%lld\n", q);
18784 }
18785 EOCP
18786         set try
18787         if eval $compile; then
18788                 yyy=`$run ./try`
18789                 case "$yyy" in
18790                 12345678901)
18791                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
18792                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
18793                         echo "We will use the %lld style."
18794                         ;;
18795                 esac
18796         fi
18797 fi
18798
18799 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18800         $cat >try.c <<EOCP
18801 #include <sys/types.h>
18802 #include <stdio.h>
18803 int main() {
18804   $quadtype q = 12345678901;
18805   printf("%qd\n", q);
18806 }
18807 EOCP
18808         set try
18809         if eval $compile; then
18810                 yyy=`$run ./try`
18811                 case "$yyy" in
18812                 12345678901)
18813                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
18814                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
18815                         echo "We will use %qd."
18816                         ;;
18817                 esac
18818         fi
18819 fi
18820
18821 if $test X"$sPRId64" = X; then
18822         echo "Cannot figure out how to print 64-bit integers." >&4
18823 fi
18824
18825 $rm -f try try.*
18826
18827 fi
18828
18829 case "$sPRId64" in
18830 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
18831         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
18832         ;;
18833 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
18834         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
18835         ;;
18836 esac
18837
18838
18839 echo " "
18840 $echo "Checking the format strings to be used for Perl's internal types..." >&4
18841
18842 if $test X"$ivsize" = X8; then
18843         ivdformat="$sPRId64"
18844         uvuformat="$sPRIu64"
18845         uvoformat="$sPRIo64"
18846         uvxformat="$sPRIx64"
18847         uvXUformat="$sPRIXU64"
18848 else
18849         if $test X"$ivsize" = X"$longsize"; then
18850                 ivdformat='"ld"'
18851                 uvuformat='"lu"'
18852                 uvoformat='"lo"'
18853                 uvxformat='"lx"'
18854                 uvXUformat='"lX"'
18855         else
18856                 if $test X"$ivsize" = X"$intsize"; then
18857                         ivdformat='"d"'
18858                         uvuformat='"u"'
18859                         uvoformat='"o"'
18860                         uvxformat='"x"'
18861                         uvXUformat='"X"'
18862                 else
18863                         : far out
18864                         if $test X"$ivsize" = X"$shortsize"; then
18865                                 ivdformat='"hd"'
18866                                 uvuformat='"hu"'
18867                                 uvoformat='"ho"'
18868                                 uvxformat='"hx"'
18869                                 uvXUformat='"hX"'
18870                         fi
18871                 fi
18872         fi
18873 fi
18874
18875 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
18876         nveformat="$sPRIeldbl"
18877         nvfformat="$sPRIfldbl"
18878         nvgformat="$sPRIgldbl"
18879         nvEUformat="$sPRIEUldbl"
18880         nvFUformat="$sPRIFUldbl"
18881         nvGUformat="$sPRIGUldbl"
18882 else
18883         nveformat='"e"'
18884         nvfformat='"f"'
18885         nvgformat='"g"'
18886         nvEUformat='"E"'
18887         nvFUformat='"F"'
18888         nvGUformat='"G"'
18889 fi
18890
18891 case "$ivdformat" in
18892 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
18893     exit 1
18894     ;;
18895 esac
18896
18897
18898 echo " "
18899 $echo "Checking the format string to be used for gids..." >&4
18900
18901 case "$gidsign" in
18902 -1)     if $test X"$gidsize" = X"$ivsize"; then
18903                 gidformat="$ivdformat"
18904         else
18905                 if $test X"$gidsize" = X"$longsize"; then
18906                         gidformat='"ld"'
18907                 else
18908                         if $test X"$gidsize" = X"$intsize"; then
18909                                 gidformat='"d"'
18910                         else
18911                                 if $test X"$gidsize" = X"$shortsize"; then
18912                                         gidformat='"hd"'
18913                                 fi
18914                         fi
18915                 fi
18916         fi
18917         ;;
18918 *)      if $test X"$gidsize" = X"$uvsize"; then
18919                 gidformat="$uvuformat"
18920         else
18921                 if $test X"$gidsize" = X"$longsize"; then
18922                         gidformat='"lu"'
18923                 else
18924                         if $test X"$gidsize" = X"$intsize"; then
18925                                 gidformat='"u"'
18926                         else
18927                                 if $test X"$gidsize" = X"$shortsize"; then
18928                                         gidformat='"hu"'
18929                                 fi
18930                         fi
18931                 fi
18932         fi
18933         ;;
18934 esac
18935
18936 : see if getgroups exists
18937 set getgroups d_getgrps
18938 eval $inlibc
18939
18940 : see if setgroups exists
18941 set setgroups d_setgrps
18942 eval $inlibc
18943
18944
18945 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
18946 echo " "
18947 case "$d_getgrps$d_setgrps" in
18948 *define*)
18949         case "$groupstype" in
18950         '') dflt="$gidtype" ;;
18951         *)  dflt="$groupstype" ;;
18952         esac
18953         $cat <<EOM
18954 What type of pointer is the second argument to getgroups() and setgroups()?
18955 Usually this is the same as group ids, $gidtype, but not always.
18956
18957 EOM
18958         rp='What type pointer is the second argument to getgroups() and setgroups()?'
18959         . ./myread
18960         groupstype="$ans"
18961         ;;
18962 *)  groupstype="$gidtype";;
18963 esac
18964
18965
18966 case "$mad" in
18967 $define|true|[yY]*)     dflt='y' ;;
18968 *)                      dflt='n' ;;
18969 esac
18970 cat <<EOM
18971
18972 Would you like to build with Misc Attribute Decoration? This is development
18973 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
18974 overhead on the interpreter.
18975
18976 If this doesn't make any sense to you, just accept the default '$dflt'.
18977 EOM
18978 rp='Build Perl with MAD?'
18979 . ./myread
18980 case "$ans" in
18981 y|Y)    val="$define" ;;
18982 *)      val="$undef"  ;;
18983 esac
18984 set mad
18985 eval $setvar
18986
18987 echo " "
18988 echo "Checking if your $make program sets \$(MAKE)..." >&4
18989 case "$make_set_make" in
18990 '')
18991         $sed 's/^X //' > testmake.mak << 'EOF'
18992 Xall:
18993 X       @echo 'maketemp="$(MAKE)"'
18994 EOF
18995         case "`$make -f testmake.mak 2>/dev/null`" in
18996         *maketemp=*) make_set_make='#' ;;
18997         *)      make_set_make="MAKE=$make" ;;
18998         esac
18999         $rm -f testmake.mak
19000         ;;
19001 esac
19002 case "$make_set_make" in
19003 '#') echo "Yup, it does.";;
19004 *) echo "Nope, it doesn't.";;
19005 esac
19006
19007 : see what type is used for mode_t
19008 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19009 set mode_t modetype int stdio.h sys/types.h
19010 eval $typedef_ask
19011
19012 : see if stdarg is available
19013 echo " "
19014 if $test `./findhdr stdarg.h`; then
19015         echo "<stdarg.h> found." >&4
19016         valstd="$define"
19017 else
19018         echo "<stdarg.h> NOT found." >&4
19019         valstd="$undef"
19020 fi
19021
19022 : see if varags is available
19023 echo " "
19024 if $test `./findhdr varargs.h`; then
19025         echo "<varargs.h> found." >&4
19026 else
19027         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
19028 fi
19029
19030 : set up the varargs testing programs
19031 $cat > varargs.c <<EOP
19032 #ifdef I_STDARG
19033 #include <stdarg.h>
19034 #endif
19035 #ifdef I_VARARGS
19036 #include <varargs.h>
19037 #endif
19038
19039 #ifdef I_STDARG
19040 int f(char *p, ...)
19041 #else
19042 int f(va_alist)
19043 va_dcl
19044 #endif
19045 {
19046         va_list ap;
19047 #ifndef I_STDARG
19048         char *p;
19049 #endif
19050 #ifdef I_STDARG
19051         va_start(ap,p);
19052 #else
19053         va_start(ap);
19054         p = va_arg(ap, char *);
19055 #endif
19056         va_end(ap);
19057 }
19058 EOP
19059 $cat > varargs <<EOP
19060 $startsh
19061 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
19062         echo "true"
19063 else
19064         echo "false"
19065 fi
19066 $rm -f varargs$_o
19067 EOP
19068 chmod +x varargs
19069
19070 : now check which varargs header should be included
19071 echo " "
19072 i_varhdr=''
19073 case "$valstd" in
19074 "$define")
19075         if `./varargs I_STDARG`; then
19076                 val='stdarg.h'
19077         elif `./varargs I_VARARGS`; then
19078                 val='varargs.h'
19079         fi
19080         ;;
19081 *)
19082         if `./varargs I_VARARGS`; then
19083                 val='varargs.h'
19084         fi
19085         ;;
19086 esac
19087 case "$val" in
19088 '')
19089 echo "I could not find the definition for va_dcl... You have problems..." >&4
19090         val="$undef"; set i_stdarg; eval $setvar
19091         val="$undef"; set i_varargs; eval $setvar
19092         ;;
19093 *) 
19094         set i_varhdr
19095         eval $setvar
19096         case "$i_varhdr" in
19097         stdarg.h)
19098                 val="$define"; set i_stdarg; eval $setvar
19099                 val="$undef"; set i_varargs; eval $setvar
19100                 ;;
19101         varargs.h)
19102                 val="$undef"; set i_stdarg; eval $setvar
19103                 val="$define"; set i_varargs; eval $setvar
19104                 ;;
19105         esac
19106         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
19107 esac
19108 $rm -f varargs*
19109
19110 : see if we need va_copy
19111 echo " "
19112 case "$i_stdarg" in
19113 "$define")
19114         $cat >try.c <<EOCP
19115 #include <stdarg.h>
19116 #include <stdio.h>
19117 #$i_stdlib I_STDLIB
19118 #ifdef I_STDLIB
19119 #include <stdlib.h>
19120 #endif
19121 #include <signal.h>
19122
19123 int
19124 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19125 {
19126   return vfprintf(f, fmt, *valp);
19127 }
19128  
19129 int    
19130 myvfprintf(FILE *f, const  char *fmt, va_list val)
19131 {
19132   return ivfprintf(f, fmt, &val);
19133 }
19134       
19135 int
19136 myprintf(char *fmt, ...) 
19137 {
19138   va_list val;
19139   va_start(val, fmt);
19140   return myvfprintf(stdout, fmt, val); 
19141 }         
19142
19143 int
19144 main(int ac, char **av)
19145 {
19146   signal(SIGSEGV, exit);
19147
19148   myprintf("%s%cs all right, then\n", "that", '\'');                            
19149   exit(0);      
19150 }
19151 EOCP
19152         set try
19153         if eval $compile && $run ./try 2>&1 >/dev/null; then
19154                 case "`$run ./try`" in
19155                 "that's all right, then")
19156                         okay=yes
19157                         ;;
19158                 esac
19159         fi
19160         case "$okay" in
19161         yes)    echo "It seems that you don't need va_copy()." >&4
19162                 need_va_copy="$undef"
19163                 ;;
19164         *)      echo "It seems that va_copy() or similar will be needed." >&4
19165                 need_va_copy="$define"
19166                 ;;
19167         esac
19168         $rm -f try.* core core.* *.core *.core.*
19169         ;;
19170 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19171         ;;
19172 esac
19173
19174 : see what type is used for size_t
19175 rp="What is the type used for the length parameter for string functions?"
19176 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19177 eval $typedef_ask
19178
19179 : check for type of arguments to gethostbyaddr. 
19180 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19181         case "$d_gethbyaddr" in
19182         $define)
19183                 $cat <<EOM
19184
19185 Checking to see what type of arguments are accepted by gethostbyaddr().
19186 EOM
19187                 hdrs="$define sys/types.h
19188                         $d_socket sys/socket.h 
19189                         $i_niin netinet/in.h 
19190                         $i_netdb netdb.h
19191                         $i_unistd unistd.h"
19192                 : The first arg can 'char *' or 'void *'
19193                 : The second arg is some of integral type
19194                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19195                         for yyy in size_t long int; do
19196                                 case "$netdb_host_type" in
19197                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19198                                         if ./protochk "$try" $hdrs; then
19199                                                 echo "Your system accepts $xxx for the first arg."
19200                                                 echo "...and $yyy for the second arg."
19201                                                 netdb_host_type="$xxx"
19202                                                 netdb_hlen_type="$yyy"
19203                                         fi
19204                                         ;;
19205                                 esac
19206                         done
19207                 done
19208                 : In case none of those worked, prompt the user.
19209                 case "$netdb_host_type" in
19210                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19211                         dflt='char *'
19212                         . ./myread
19213                         netdb_host_type=$ans
19214                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19215                         dflt="$sizetype"
19216                         . ./myread
19217                         netdb_hlen_type=$ans
19218                         ;;
19219                 esac
19220                 ;;
19221         *)      : no gethostbyaddr, so pick harmless defaults
19222                 netdb_host_type='char *'
19223                 netdb_hlen_type="$sizetype"
19224                 ;;
19225         esac
19226         # Remove the "const" if needed. -- but then we'll have a 
19227         # prototype clash!
19228         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19229 fi
19230
19231 : check for type of argument to gethostbyname. 
19232 if test "X$netdb_name_type" = X ; then
19233         case "$d_gethbyname" in
19234         $define)
19235                 $cat <<EOM
19236
19237 Checking to see what type of argument is accepted by gethostbyname().
19238 EOM
19239                 hdrs="$define sys/types.h
19240                         $d_socket sys/socket.h 
19241                         $i_niin netinet/in.h 
19242                         $i_netdb netdb.h
19243                         $i_unistd unistd.h"
19244                 for xxx in "const char *" "char *"; do
19245                         case "$netdb_name_type" in
19246                         '')     try="extern struct hostent *gethostbyname($xxx);"
19247                                 if ./protochk "$try" $hdrs; then
19248                                         echo "Your system accepts $xxx."
19249                                         netdb_name_type="$xxx"
19250                                 fi
19251                                 ;;
19252                         esac
19253                 done
19254                 : In case none of those worked, prompt the user.
19255                 case "$netdb_name_type" in
19256                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19257                         dflt='char *'
19258                         . ./myread
19259                         netdb_name_type=$ans
19260                         ;;
19261                 esac
19262                 ;;
19263         *)      : no gethostbyname, so pick harmless default
19264                 netdb_name_type='char *'
19265                 ;;
19266         esac
19267 fi
19268
19269 : check for type of 1st argument to getnetbyaddr. 
19270 if test "X$netdb_net_type" = X ; then
19271         case "$d_getnbyaddr" in
19272         $define)
19273                 $cat <<EOM
19274
19275 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19276 EOM
19277                 hdrs="$define sys/types.h
19278                         $d_socket sys/socket.h 
19279                         $i_niin netinet/in.h 
19280                         $i_netdb netdb.h
19281                         $i_unistd unistd.h"
19282                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19283                         case "$netdb_net_type" in
19284                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19285                                 if ./protochk "$try" $hdrs; then
19286                                         echo "Your system accepts $xxx."
19287                                         netdb_net_type="$xxx"
19288                                 fi
19289                                 ;;
19290                         esac
19291                 done
19292                 : In case none of those worked, prompt the user.
19293                 case "$netdb_net_type" in
19294                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19295                         dflt='long'
19296                         . ./myread
19297                         netdb_net_type=$ans
19298                         ;;
19299                 esac
19300                 ;;
19301         *)      : no getnetbyaddr, so pick harmless default
19302                 netdb_net_type='long'
19303                 ;;
19304         esac
19305 fi
19306 : locate the preferred pager for this system
19307 fn=f/
19308 case "$pager" in
19309 '')
19310         dflt=''
19311         case "$pg" in
19312         /*) dflt=$pg;;
19313         [a-zA-Z]:/*) dflt=$pg;;
19314         esac
19315         case "$more" in
19316         /*) dflt=$more;;
19317         [a-zA-Z]:/*) dflt=$more;;
19318         esac
19319         case "$less" in
19320         /*) dflt=$less;;
19321         [a-zA-Z]:/*) dflt=$less;;
19322         esac
19323         case "$dflt" in
19324         '') dflt=/usr/ucb/more;;
19325         esac
19326         ;;
19327 *)      dflt="$pager"
19328         : Instruct ./getfile to trust the hinted or previous pager value,
19329         : even if it does not begin with a slash.  For example, on os2,
19330         : pager might be cmd /c more.  See comments in UU/getfile.
19331         fn="f/($pager)"
19332         ;;
19333 esac
19334 echo " "
19335 rp='What pager is used on your system?'
19336 . ./getfile
19337 pager="$ans"
19338
19339 : see what type pids are declared as in the kernel
19340 rp="What is the type of process ids on this system?"
19341 set pid_t pidtype int stdio.h sys/types.h
19342 eval $typedef_ask
19343
19344 : see if ar generates random libraries by itself
19345 echo " "
19346 echo "Checking how to generate random libraries on your machine..." >&4
19347 echo 'int bar1() { return bar2(); }' > bar1.c
19348 echo 'int bar2() { return 2; }' > bar2.c
19349 $cat > foo.c <<EOP
19350 #$i_stdlib I_STDLIB
19351 #ifdef I_STDLIB
19352 #include <stdlib.h>
19353 #endif
19354 int main() { printf("%d\n", bar1()); exit(0); }
19355 EOP
19356 $cc $ccflags -c bar1.c >/dev/null 2>&1
19357 $cc $ccflags -c bar2.c >/dev/null 2>&1
19358 $cc $ccflags -c foo.c >/dev/null 2>&1
19359 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19360 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19361         $run ./foobar >/dev/null 2>&1; then
19362         echo "$ar appears to generate random libraries itself."
19363         orderlib=false
19364         if [ "X$ranlib" = "X" ]; then
19365             ranlib=":"
19366         fi
19367 elif $ar s bar$_a >/dev/null 2>&1 &&
19368         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19369         $run ./foobar >/dev/null 2>&1; then
19370                 echo "a table of contents needs to be added with '$ar s'."
19371                 orderlib=false
19372                 ranlib="$ar s"
19373 elif $ar ts bar$_a >/dev/null 2>&1 &&
19374         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19375         $run ./foobar >/dev/null 2>&1; then
19376                 echo "a table of contents needs to be added with '$ar ts'."
19377                 orderlib=false
19378                 ranlib="$ar ts"
19379 else
19380         case "$ranlib" in
19381         :) ranlib='';;
19382         '')
19383                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19384                 $test -f $ranlib || ranlib=''
19385                 ;;
19386         esac
19387         if $test -n "$ranlib"; then
19388                 echo "your system has '$ranlib'; we'll use that."
19389                 orderlib=false
19390         else
19391                 echo "your system doesn't seem to support random libraries"
19392                 echo "so we'll use lorder and tsort to order the libraries."
19393                 orderlib=true
19394                 ranlib=":"
19395         fi
19396 fi
19397 $rm -f foo* bar*
19398
19399 : check for type of arguments to select. 
19400 case "$selecttype" in
19401 '') case "$d_select" in
19402         $define)
19403                 echo " "
19404                 $cat <<EOM
19405 Checking to see what type of arguments are accepted by select().
19406 EOM
19407                 hdrs="$define sys/types.h
19408                         $i_systime sys/time.h 
19409                         $i_sysselct sys/select.h
19410                         $d_socket sys/socket.h"
19411                 : The first arg can be int, unsigned, or size_t
19412                 : The last arg may or may not be 'const'
19413                 val=''
19414                 : void pointer has been seen but using that
19415                 : breaks the selectminbits test
19416                 for xxx in 'fd_set *' 'int *'; do
19417                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19418                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
19419                                         case "$val" in
19420                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19421                                                 if ./protochk "$try" $hdrs; then
19422                                                         echo "Your system accepts $xxx."
19423                                                         val="$xxx"
19424                                                 fi
19425                                                 ;;
19426                                         esac
19427                                 done
19428                         done
19429                 done
19430                 case "$val" in
19431                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19432                         case "$d_fd_set" in
19433                                 $define) dflt="fd_set *" ;;
19434                                 *)              dflt="int *" ;;
19435                         esac
19436                         . ./myread
19437                         val=$ans
19438                         ;;
19439                 esac
19440                 selecttype="$val"
19441                 ;;
19442         *)      : no select, so pick a harmless default
19443                 selecttype='int *'
19444                 ;;
19445         esac
19446         ;;
19447 esac
19448
19449 : check for the select 'width'
19450 case "$selectminbits" in
19451 '') safebits=`expr $ptrsize \* 8`
19452     case "$d_select" in
19453         $define)
19454                 $cat <<EOM
19455
19456 Checking to see on how many bits at a time your select() operates...
19457 EOM
19458                 $cat >try.c <<EOCP
19459 #include <sys/types.h>
19460 #$i_time I_TIME
19461 #$i_systime I_SYS_TIME
19462 #$i_systimek I_SYS_TIME_KERNEL
19463 #ifdef I_TIME
19464 #   include <time.h>
19465 #endif
19466 #ifdef I_SYS_TIME
19467 #   ifdef I_SYS_TIME_KERNEL
19468 #       define KERNEL
19469 #   endif
19470 #   include <sys/time.h>
19471 #   ifdef I_SYS_TIME_KERNEL
19472 #       undef KERNEL
19473 #   endif
19474 #endif
19475 #$i_sysselct I_SYS_SELECT
19476 #ifdef I_SYS_SELECT
19477 #include <sys/select.h>
19478 #endif
19479 #$d_socket HAS_SOCKET
19480 #ifdef HAS_SOCKET
19481 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19482 #endif
19483 #include <stdio.h>
19484 #$i_stdlib I_STDLIB
19485 #ifdef I_STDLIB
19486 #include <stdlib.h>
19487 #endif
19488 $selecttype b;
19489 #define S sizeof(*(b))
19490 #define MINBITS 64
19491 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19492 #define NBITS  (NBYTES * 8)
19493 int main() {
19494     char *s = malloc(NBYTES);
19495     struct timeval t;
19496     int i;
19497     FILE* fp;
19498     int fd;
19499
19500     if (!s)
19501         exit(1);
19502     fclose(stdin);
19503     fp = fopen("try.c", "r");
19504     if (fp == 0)
19505       exit(2);
19506     fd = fileno(fp);
19507     if (fd < 0)
19508       exit(3);
19509     b = ($selecttype)s;
19510     for (i = 0; i < NBITS; i++)
19511         FD_SET(i, b);
19512     t.tv_sec  = 0;
19513     t.tv_usec = 0;
19514     select(fd + 1, b, 0, 0, &t);
19515     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
19516     free(s);
19517     printf("%d\n", i + 1);
19518     return 0;
19519 }
19520 EOCP
19521                 set try
19522                 if eval $compile_ok; then
19523                         selectminbits=`$run ./try`
19524                         case "$selectminbits" in
19525                         '')     cat >&4 <<EOM
19526 Cannot figure out on how many bits at a time your select() operates.
19527 I'll play safe and guess it is $safebits bits.
19528 EOM
19529                                 selectminbits=$safebits
19530                                 bits="$safebits bits"
19531                                 ;;
19532                         1)      bits="1 bit" ;;
19533                         *)      bits="$selectminbits bits" ;;
19534                         esac
19535                         echo "Your select() operates on $bits at a time." >&4
19536                 else
19537                         rp='What is the minimum number of bits your select() operates on?'
19538                         case "$byteorder" in
19539                         12345678)       dflt=64 ;;
19540                         1234)           dflt=32 ;;
19541                         *)              dflt=1  ;;
19542                         esac
19543                         . ./myread
19544                         val=$ans
19545                         selectminbits="$val"
19546                 fi
19547                 $rm -f try.* try
19548                 ;;
19549         *)      : no select, so pick a harmless default
19550                 selectminbits=$safebits
19551                 ;;
19552         esac
19553         ;;
19554 esac
19555
19556 : Trace out the files included by signal.h, then look for SIGxxx names.
19557 : Remove SIGARRAYSIZE used by HPUX.
19558 : Remove SIGSTKSIZE used by Linux.
19559 : Remove SIGSTKSZ used by Posix.
19560 : Remove SIGTYP void lines used by OS2.
19561 : Some cpps, like os390, dont give the file name anywhere
19562 if [ "X$fieldn" = X ]; then
19563         : Just make some guesses.  We check them later.
19564         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19565 else
19566         xxx=`echo '#include <signal.h>' |
19567         $cppstdin $cppminus $cppflags 2>/dev/null |
19568         $grep '^[       ]*#.*include' | 
19569         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
19570 fi
19571 : Check this list of files to be sure we have parsed the cpp output ok.
19572 : This will also avoid potentially non-existent files, such 
19573 : as ../foo/bar.h
19574 xxxfiles=''
19575 for xx in $xxx /dev/null ; do
19576         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19577 done
19578 : If we have found no files, at least try signal.h
19579 case "$xxxfiles" in
19580 '')     xxxfiles=`./findhdr signal.h` ;;
19581 esac
19582 xxx=`awk '
19583 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19584         print substr($2, 4, 20)
19585 }
19586 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19587         print substr($3, 4, 20)
19588 }' $xxxfiles`
19589 : Append some common names just in case the awk scan failed.
19590 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19591 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19592 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19593 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19594 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19595
19596 : generate a few handy files for later
19597 $cat > signal.c <<EOCP
19598 #include <sys/types.h>
19599 #include <signal.h>
19600 #$i_stdlib I_STDLIB
19601 #ifdef I_STDLIB
19602 #include <stdlib.h>
19603 #endif
19604 #include <stdio.h>
19605 int main() {
19606
19607 /* Strange style to avoid deeply-nested #if/#else/#endif */
19608 #ifndef NSIG
19609 #  ifdef _NSIG
19610 #    define NSIG (_NSIG)
19611 #  endif
19612 #endif
19613
19614 #ifndef NSIG
19615 #  ifdef SIGMAX
19616 #    define NSIG (SIGMAX+1)
19617 #  endif
19618 #endif
19619
19620 #ifndef NSIG
19621 #  ifdef SIG_MAX
19622 #    define NSIG (SIG_MAX+1)
19623 #  endif
19624 #endif
19625
19626 #ifndef NSIG
19627 #  ifdef _SIG_MAX
19628 #    define NSIG (_SIG_MAX+1)
19629 #  endif
19630 #endif
19631
19632 #ifndef NSIG
19633 #  ifdef MAXSIG
19634 #    define NSIG (MAXSIG+1)
19635 #  endif
19636 #endif
19637
19638 #ifndef NSIG
19639 #  ifdef MAX_SIG
19640 #    define NSIG (MAX_SIG+1)
19641 #  endif
19642 #endif
19643
19644 #ifndef NSIG
19645 #  ifdef SIGARRAYSIZE
19646 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
19647 #  endif
19648 #endif
19649
19650 #ifndef NSIG
19651 #  ifdef _sys_nsig
19652 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
19653 #  endif
19654 #endif
19655
19656 /* Default to some arbitrary number that's big enough to get most
19657    of the common signals.
19658 */
19659 #ifndef NSIG
19660 #    define NSIG 50
19661 #endif
19662
19663 printf("NSIG %d\n", NSIG);
19664
19665 #ifndef JUST_NSIG
19666
19667 EOCP
19668
19669 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19670 {
19671         printf "#ifdef SIG"; printf $1; printf "\n"
19672         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
19673         printf $1; printf ");\n"
19674         printf "#endif\n"
19675 }
19676 END {
19677         printf "#endif /* JUST_NSIG */\n";
19678         printf "exit(0);\n}\n";
19679 }
19680 ' >>signal.c
19681 $cat >signal.awk <<'EOP'
19682 BEGIN { ndups = 0 }
19683 $1 ~ /^NSIG$/ { nsig = $2 }
19684 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
19685     if ($2 > maxsig) { maxsig = $2 }
19686     if (sig_name[$2]) {
19687         dup_name[ndups] = $1
19688         dup_num[ndups] = $2
19689         ndups++ 
19690     }
19691     else {
19692         sig_name[$2] = $1
19693         sig_num[$2] = $2
19694     }
19695 }
19696 END { 
19697     if (nsig == 0) {
19698         nsig = maxsig + 1
19699     }
19700     printf("NSIG %d\n", nsig);
19701     for (n = 1; n < nsig; n++) {
19702         if (sig_name[n]) {
19703             printf("%s %d\n", sig_name[n], sig_num[n])
19704         }
19705         else {
19706             printf("NUM%d %d\n", n, n) 
19707         }
19708     }
19709     for (n = 0; n < ndups; n++) {
19710         printf("%s %d\n", dup_name[n], dup_num[n])
19711     }
19712 }
19713 EOP
19714 $cat >signal_cmd <<EOS
19715 $startsh
19716 if $test -s signal.lst; then
19717     echo "Using your existing signal.lst file"
19718         exit 0
19719 fi
19720 xxx="$xxx"
19721 EOS
19722 $cat >>signal_cmd <<'EOS'
19723
19724 set signal
19725 if eval $compile_ok; then
19726         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
19727 else
19728         echo "(I can't seem be able to compile the whole test program)" >&4
19729         echo "(I'll try it in little pieces.)" >&4
19730         set signal -DJUST_NSIG
19731         if eval $compile_ok; then
19732                 $run ./signal$_exe > signal.nsg
19733                 $cat signal.nsg
19734         else
19735                 echo "I can't seem to figure out how many signals you have." >&4
19736                 echo "Guessing 50." >&4
19737                 echo 'NSIG 50' > signal.nsg
19738         fi
19739         : Now look at all the signal names, one at a time.
19740         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
19741                 $cat > signal.c <<EOCP
19742 #include <sys/types.h>
19743 #include <signal.h>
19744 #include <stdio.h>
19745 int main() {
19746 printf("$xx %d\n", SIG${xx});
19747 return 0;
19748 }
19749 EOCP
19750                 set signal
19751                 if eval $compile; then
19752                         echo "SIG${xx} found."
19753                         $run ./signal$_exe  >> signal.ls1
19754                 else
19755                         echo "SIG${xx} NOT found."
19756                 fi
19757         done
19758         if $test -s signal.ls1; then
19759                 $cat signal.nsg signal.ls1 |
19760                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
19761         fi
19762
19763 fi
19764 if $test -s signal.lst; then
19765         :
19766 else
19767         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
19768         echo 'kill -l' >signal
19769         set X `csh -f <signal`
19770         $rm -f signal
19771         shift
19772         case $# in
19773         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
19774         esac
19775         echo $@ | $tr ' ' $trnl | \
19776             $awk '{ printf "%s %d\n", $1, ++s; }
19777                   END { printf "NSIG %d\n", ++s }' >signal.lst
19778 fi
19779 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
19780 EOS
19781 chmod a+x signal_cmd
19782 $eunicefix signal_cmd
19783
19784 : generate list of signal names
19785 echo " "
19786 case "$sig_name_init" in
19787 '') doinit=yes ;;
19788 *)  case "$sig_num_init" in
19789     ''|*,*) doinit=yes ;;
19790     esac ;;
19791 esac
19792 case "$doinit" in
19793 yes)
19794         echo "Generating a list of signal names and numbers..." >&4
19795         . ./signal_cmd
19796         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
19797         sig_name=`$awk 'BEGIN { printf "ZERO " }
19798                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
19799         sig_num=`$awk  'BEGIN { printf "0 " }
19800                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
19801         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
19802                              !/^NSIG/   { printf "\"%s\", ", $1 }
19803                              END        { printf "0\n" }' signal.lst`
19804         sig_num_init=`$awk  'BEGIN      { printf "0, " }
19805                              !/^NSIG/   { printf "%d, ", $2}
19806                              END        { printf "0\n"}' signal.lst`
19807         ;;
19808 esac
19809 echo "The following $sig_count signals are available:"
19810 echo " "
19811 echo $sig_name | $awk \
19812 'BEGIN { linelen = 0 }
19813 {
19814         for (i = 1; i <= NF; i++) {
19815                 name = "SIG" $i " "
19816                 linelen = linelen + length(name)
19817                 if (linelen > 70) {
19818                         printf "\n"
19819                         linelen = length(name)
19820                 }
19821                 printf "%s", name
19822         }
19823         printf "\n"
19824 }'
19825 sig_size=`echo $sig_name | awk '{print NF}'`
19826 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
19827
19828 echo " "
19829 case "$sizetype" in
19830 *_t) zzz="$sizetype"    ;;
19831 *)   zzz="filesize"     ;;
19832 esac
19833 echo "Checking the size of $zzz..." >&4 
19834 cat > try.c <<EOCP
19835 #include <sys/types.h>
19836 #include <stdio.h>
19837 #$i_stdlib I_STDLIB
19838 #ifdef I_STDLIB
19839 #include <stdlib.h>
19840 #endif
19841 int main() {
19842     printf("%d\n", (int)sizeof($sizetype));
19843     exit(0);
19844 }
19845 EOCP
19846 set try
19847 if eval $compile_ok; then
19848         yyy=`$run ./try`
19849         case "$yyy" in
19850         '')     sizesize=4
19851                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
19852                 ;;
19853         *)      sizesize=$yyy
19854                 echo "Your $zzz size is $sizesize bytes."
19855                 ;;
19856         esac
19857 else
19858         sizesize=4
19859         echo "(I can't compile the test program--guessing $sizesize.)" >&4
19860 fi
19861
19862
19863 : check for socklen_t
19864 echo " "
19865 echo "Checking to see if you have socklen_t..." >&4
19866 $cat >try.c <<EOCP
19867 #include <sys/types.h>
19868 #$d_socket HAS_SOCKET
19869 #ifdef HAS_SOCKET
19870 #include <sys/socket.h>
19871 #endif
19872 int main() { socklen_t x = 16; }
19873 EOCP
19874 set try
19875 if eval $compile; then
19876         val="$define"
19877         echo "You have socklen_t."
19878 else
19879         val="$undef"
19880         echo "You do not have socklen_t."
19881         case "$sizetype" in
19882         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
19883         esac
19884 fi
19885 $rm -f try try.*
19886 set d_socklen_t
19887 eval $setvar
19888
19889 : see if this is a socks.h system
19890 set socks.h i_socks
19891 eval $inhdr
19892
19893 : check for type of the size argument to socket calls
19894 case "$d_socket" in
19895 "$define")
19896         $cat <<EOM
19897
19898 Checking to see what type is the last argument of accept().
19899 EOM
19900         yyy=''
19901         case "$d_socklen_t" in
19902         "$define") yyy="$yyy socklen_t"
19903         esac
19904         yyy="$yyy $sizetype int long unsigned"
19905         for xxx in $yyy; do
19906                 case "$socksizetype" in
19907                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
19908                         case "$usesocks" in
19909                         "$define")
19910                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
19911                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19912                                         socksizetype="$xxx"
19913                                 fi
19914                                 ;;
19915                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
19916                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19917                                         socksizetype="$xxx"
19918                                 fi
19919                                 ;;
19920                         esac
19921                         ;;
19922                 esac
19923         done
19924 : In case none of those worked, prompt the user.
19925         case "$socksizetype" in
19926         '')     rp='What is the type for socket address structure sizes?'
19927                 dflt='int'
19928                 . ./myread
19929                 socksizetype=$ans
19930                 ;;
19931         esac
19932         ;;
19933 *)      : no sockets, so pick relatively harmless default
19934         socksizetype='int'
19935         ;;
19936 esac
19937
19938 : see what type is used for signed size_t
19939 set ssize_t ssizetype int stdio.h sys/types.h
19940 eval $typedef
19941 dflt="$ssizetype"
19942 $cat > try.c <<EOM
19943 #include <stdio.h>
19944 #$i_stdlib I_STDLIB
19945 #ifdef I_STDLIB
19946 #include <stdlib.h>
19947 #endif
19948 #include <sys/types.h>
19949 #define Size_t $sizetype
19950 #define SSize_t $dflt
19951 int main()
19952 {
19953         if (sizeof(Size_t) == sizeof(SSize_t))
19954                 printf("$dflt\n");
19955         else if (sizeof(Size_t) == sizeof(int))
19956                 printf("int\n");
19957         else 
19958                 printf("long\n");
19959         exit(0);
19960 }
19961 EOM
19962 echo " "
19963 set try
19964 if eval $compile_ok && $run ./try > /dev/null; then
19965         ssizetype=`$run ./try`
19966         echo "I'll be using $ssizetype for functions returning a byte count." >&4
19967 else
19968         $cat >&4 <<EOM
19969 Help! I can't compile and run the ssize_t test program: please enlighten me!
19970 (This is probably a misconfiguration in your system or libraries, and
19971 you really ought to fix it.  Still, I'll try anyway.)
19972
19973 I need a type that is the same size as $sizetype, but is guaranteed to
19974 be signed.  Common values are ssize_t, int and long.
19975
19976 EOM
19977         rp="What signed type is the same size as $sizetype?"
19978         . ./myread
19979         ssizetype="$ans"
19980 fi
19981 $rm -f try try.*
19982
19983 : see what type of char stdio uses.
19984 echo " "
19985 echo '#include <stdio.h>' > stdio.c
19986 $cppstdin $cppminus < stdio.c > stdioh
19987 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
19988         echo "Your stdio uses unsigned chars." >&4
19989         stdchar="unsigned char"
19990 else
19991         echo "Your stdio uses signed chars." >&4
19992         stdchar="char"
19993 fi
19994 $rm -f stdio.* stdioh
19995
19996 : see what type uids are declared as in the kernel
19997 echo " "
19998 echo "Looking for the type for user ids returned by getuid()."
19999 set uid_t uidtype xxx stdio.h sys/types.h
20000 eval $typedef
20001 case "$uidtype" in
20002 xxx)
20003         xxx=`./findhdr sys/user.h`
20004         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20005         case $1 in
20006         unsigned) dflt="$1 $2" ;;
20007         *) dflt="$1" ;;
20008         esac
20009         ;;
20010 *) dflt="$uidtype";;
20011 esac
20012 case "$uidtype" in
20013 uid_t)  echo "uid_t found." ;;
20014 *)      rp="What is the type for user ids returned by getuid()?"
20015         . ./myread
20016         uidtype="$ans"
20017         ;;
20018 esac
20019
20020 echo " "
20021 case "$uidtype" in
20022 *_t) zzz="$uidtype"     ;;
20023 *)   zzz="uid"          ;;
20024 esac
20025 echo "Checking the size of $zzz..." >&4 
20026 cat > try.c <<EOCP
20027 #include <sys/types.h>
20028 #include <stdio.h>
20029 #$i_stdlib I_STDLIB
20030 #ifdef I_STDLIB
20031 #include <stdlib.h>
20032 #endif
20033 int main() {
20034     printf("%d\n", (int)sizeof($uidtype));
20035     exit(0);
20036 }
20037 EOCP
20038 set try
20039 if eval $compile_ok; then
20040         yyy=`$run ./try`
20041         case "$yyy" in
20042         '')     uidsize=4
20043                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20044                 ;;
20045         *)      uidsize=$yyy
20046                 echo "Your $zzz is $uidsize bytes long."
20047                 ;;
20048         esac
20049 else
20050         uidsize=4
20051         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20052 fi
20053
20054 echo " "
20055 case "$uidtype" in
20056 *_t) zzz="$uidtype"     ;;
20057 *)   zzz="uid"          ;;
20058 esac
20059 echo "Checking the sign of $zzz..." >&4
20060 cat > try.c <<EOCP
20061 #include <sys/types.h>
20062 #include <stdio.h>
20063 int main() {
20064         $uidtype foo = -1;
20065         if (foo < 0)
20066                 printf("-1\n");
20067         else
20068                 printf("1\n");
20069 }
20070 EOCP
20071 set try
20072 if eval $compile; then
20073         yyy=`$run ./try`
20074         case "$yyy" in
20075         '')     uidsign=1
20076                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20077                 ;;
20078         *)      uidsign=$yyy
20079                 case "$uidsign" in
20080                  1) echo "Your $zzz is unsigned." ;;
20081                 -1) echo "Your $zzz is signed."   ;;
20082                 esac
20083                 ;;
20084         esac
20085 else
20086         uidsign=1
20087         echo "(I can't compile the test program--guessing unsigned.)" >&4
20088 fi
20089
20090
20091
20092 echo " "
20093 $echo "Checking the format string to be used for uids..." >&4
20094
20095 case "$uidsign" in
20096 -1)     if $test X"$uidsize" = X"$ivsize"; then
20097                 uidformat="$ivdformat"
20098         else
20099                 if $test X"$uidsize" = X"$longsize"; then
20100                         uidformat='"ld"'
20101                 else
20102                         if $test X"$uidsize" = X"$intsize"; then
20103                                 uidformat='"d"'
20104                         else
20105                                 if $test X"$uidsize" = X"$shortsize"; then
20106                                         uidformat='"hd"'
20107                                 fi
20108                         fi
20109                 fi
20110         fi
20111         ;;
20112 *)      if $test X"$uidsize" = X"$uvsize"; then
20113                 uidformat="$uvuformat"
20114         else
20115                 if $test X"$uidsize" = X"$longsize"; then
20116                         uidformat='"lu"'
20117                 else
20118                         if $test X"$uidsize" = X"$intsize"; then
20119                                 uidformat='"u"'
20120                         else
20121                                 if $test X"$uidsize" = X"$shortsize"; then
20122                                         uidformat='"hu"'
20123                                 fi
20124                         fi
20125                 fi
20126         fi
20127         ;;
20128 esac
20129
20130
20131 case "$usesitecustomize" in
20132     $define|true|[Yy]*)
20133         usesitecustomize="$define"
20134         ;;
20135     *)
20136         usesitecustomize="$undef"
20137         ;;
20138     esac
20139
20140 : determine compiler compiler
20141 case "$yacc" in
20142 '')
20143         dflt=yacc;;
20144 *)
20145         dflt="$yacc";;
20146 esac
20147 echo " "
20148 comp='yacc'
20149 if $test -f "$byacc$_exe"; then
20150         dflt="$byacc"
20151         comp="byacc or $comp"
20152 fi
20153 if $test -f "$bison$_exe"; then
20154         comp="$comp or bison -y"
20155 fi
20156 rp="Which compiler compiler ($comp) shall I use?"
20157 . ./myread
20158 yacc="$ans"
20159 case "$yacc" in
20160 *bis*)
20161         case "$yacc" in
20162         *-y*) ;;
20163         *)
20164                 yacc="$yacc -y"
20165                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20166                 ;;
20167         esac
20168         ;;
20169 esac
20170
20171 : see if this is a fp.h system
20172 set fp.h i_fp
20173 eval $inhdr
20174
20175 : see if this is a fp_class.h system
20176 set fp_class.h i_fp_class
20177 eval $inhdr
20178
20179 : see if this is a ieeefp.h system
20180 case "$i_ieeefp" in
20181 '' ) set ieeefp.h i_ieeefp
20182      eval $inhdr
20183      ;;
20184 esac
20185
20186 : see if this is a libutil.h system
20187 set libutil.h i_libutil
20188 eval $inhdr
20189
20190 : see if mach cthreads are available
20191 if test "X$usethreads" = "X$define"; then
20192         set mach/cthreads.h i_machcthr
20193         eval $inhdr
20194 else
20195         i_machcthr="$undef"
20196 fi
20197
20198
20199
20200 : see if this is a mntent.h system
20201 set mntent.h i_mntent
20202 eval $inhdr
20203
20204 : see if ndbm.h is available
20205 set ndbm.h t_ndbm
20206 eval $inhdr
20207
20208 case "$t_ndbm" in
20209 $undef)
20210     # Some Linux distributions such as RedHat 7.1 put the
20211     # ndbm.h header in /usr/include/gdbm/ndbm.h.
20212     if $test -f /usr/include/gdbm/ndbm.h; then
20213         echo '<gdbm/ndbm.h> found.'
20214         ccflags="$ccflags -I/usr/include/gdbm"
20215         cppflags="$cppflags -I/usr/include/gdbm"
20216         t_ndbm=$define
20217     fi
20218     ;;
20219 esac
20220
20221 case "$t_ndbm" in
20222 $define)
20223         : see if dbm_open exists
20224         set dbm_open d_dbm_open
20225         eval $inlibc
20226         case "$d_dbm_open" in
20227         $undef)
20228                 t_ndbm="$undef"
20229                 echo "We won't be including <ndbm.h>"
20230                 ;;
20231         esac
20232         ;;
20233 esac
20234 val="$t_ndbm"
20235 set i_ndbm
20236 eval $setvar
20237
20238 : see if net/errno.h is available
20239 val=''
20240 set net/errno.h val
20241 eval $inhdr
20242
20243 : Unfortunately, it causes problems on some systems.  Arrgh.
20244 case "$val" in
20245 $define)
20246         cat > try.c <<'EOM'
20247 #include <stdio.h>
20248 #include <errno.h>
20249 #include <net/errno.h>
20250 int func()
20251 {
20252         return ENOTSOCK;
20253 }
20254 EOM
20255         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20256                 echo "We'll be including <net/errno.h>." >&4
20257         else
20258                 echo "We won't be including <net/errno.h>." >&4
20259                 val="$undef"
20260         fi
20261         $rm -f try.* try
20262         ;;
20263 esac
20264 set i_neterrno
20265 eval $setvar
20266
20267 : see if netinet/tcp.h is available
20268 set netinet/tcp.h i_netinettcp
20269 eval $inhdr
20270
20271 : see if this is a poll.h system
20272 set poll.h i_poll
20273 eval $inhdr
20274
20275 : see if this is a prot.h system
20276 set prot.h i_prot
20277 eval $inhdr
20278
20279 echo " "
20280 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20281 $cat <<'EOSH' > Cppsym.know
20282 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20283 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20284 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20285 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20286 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20287 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20288 bull c cadmus clipper CMU COFF COMPILER_VERSION
20289 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20290 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20291 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20292 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20293 GLIBC GLIBC_MINOR
20294 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20295 H3050R H3050RX hbullx20 hcx host_mips
20296 hp200 hp300 hp700 HP700 hp800 hp9000
20297 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20298 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20299 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20300 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20301 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20302 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20303 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20304 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20305 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20306 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20307 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20308 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20309 MATH_HAS_NO_SIDE_EFFECTS
20310 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20311 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20312 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20313 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20314 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20315 NetBSD news1500 news1700 news1800 news1900 news3700
20316 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20317 ns32016 ns32332 ns32k nsc32000
20318 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20319 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20320 pc532 pdp11 PGC PIC plexus PORTAR posix
20321 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20322 POSIX_C_SOURCE POSIX_SOURCE POWER
20323 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
20324 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20325 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20326 sony sony_news sonyrisc sparc sparclite spectrum
20327 stardent stdc STDC_EXT stratos sun sun3 sun386
20328 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20329 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20330 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20331 sysV68 sysV88 Tek4132 Tek4300 titan
20332 TM3200 TM5400 TM5600
20333 tower tower32 tower32_200 tower32_600 tower32_700
20334 tower32_800 tower32_850 tss
20335 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20336 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20337 unix UNIX95 UNIX99 unixpc unos
20338 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20339 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20340 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20341 USGr4 USGr4_2
20342 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20343 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20344 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20345 z8000
20346 EOSH
20347 # Maybe put other stuff here too.
20348 cat <<EOSH >>Cppsym.know
20349 $osname
20350 EOSH
20351 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20352 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20353 $cat Cppsym.know > Cppsym.c
20354 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20355 $rm -f Cppsym.a Cppsym.b Cppsym.c
20356 cat <<EOSH > Cppsym
20357 $startsh
20358 if $test \$# -gt 0; then
20359     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20360     if $test -s Cppsym.got; then
20361         $rm -f Cppsym.got
20362         exit 0
20363     fi
20364     $rm -f Cppsym.got
20365     exit 1
20366 else
20367     $tr " " "$trnl" | ./Cppsym.try
20368     exit 0
20369 fi
20370 EOSH
20371 chmod +x Cppsym
20372 $eunicefix Cppsym
20373 cat <<EOSH > Cppsym.try
20374 $startsh
20375 cat <<'EOCP' > try.c
20376 #include <stdio.h>
20377 #if cpp_stuff == 1
20378 #define STRINGIFY(a)    "a"
20379 #endif
20380 #if cpp_stuff == 42
20381 #define StGiFy(a)  #a
20382 #define STRINGIFY(a)    StGiFy(a)
20383 #endif
20384 #if $cpp_stuff != 1 && $cpp_stuff != 42
20385 #   include "Bletch: How does this C preprocessor stringify macros?"
20386 #endif
20387 int main() {
20388 EOCP
20389 $awk \\
20390 EOSH
20391 cat <<'EOSH' >> Cppsym.try
20392 'length($1) > 0 {
20393     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20394     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20395     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20396     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
20397 }'       >> try.c
20398 echo 'return 0;}' >> try.c
20399 EOSH
20400 cat <<EOSH >> Cppsym.try
20401 ccflags="$ccflags"
20402 case "$osname-$gccversion" in
20403 irix-) ccflags="\$ccflags -woff 1178" ;;
20404 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20405 esac
20406 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
20407 EOSH
20408 chmod +x Cppsym.try
20409 $eunicefix Cppsym.try
20410 ./Cppsym < Cppsym.know > Cppsym.true
20411 : Add in any linux cpp "predefined macros":
20412 case "$osname::$gccversion" in
20413   *linux*::*.*)
20414     tHdrH=_tmpHdr
20415     rm -f $tHdrH'.h' $tHdrH
20416     touch $tHdrH'.h'
20417     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
20418        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
20419        if [ -s $tHdrH'_cppsym.real' ]; then
20420           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
20421        fi
20422     fi
20423     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
20424   ;;
20425 esac
20426 : now check the C compiler for additional symbols
20427 postprocess_cc_v=''
20428 case "$osname" in
20429 aix) postprocess_cc_v="|$tr , ' '" ;;
20430 esac
20431 $cat >ccsym <<EOS
20432 $startsh
20433 $cat >tmp.c <<EOF
20434 extern int foo;
20435 EOF
20436 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20437 do
20438         case "\$i" in
20439         -D*) echo "\$i" | $sed 's/^-D//';;
20440         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
20441         esac
20442 done
20443 $rm -f try.c
20444 EOS
20445 postprocess_cc_v=''
20446 chmod +x ccsym
20447 $eunicefix ccsym
20448 ./ccsym > ccsym1.raw
20449 if $test -s ccsym1.raw; then
20450        $sort ccsym1.raw | $uniq >ccsym.raw
20451 else
20452        mv ccsym1.raw ccsym.raw
20453 fi
20454
20455 $awk '/\=/ { print $0; next }
20456         { print $0"=1" }' ccsym.raw >ccsym.list
20457 $comm -13 Cppsym.true ccsym.list >ccsym.own
20458 $comm -12 Cppsym.true ccsym.list >ccsym.com
20459 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
20460 also=''
20461 if $test -z ccsym.raw; then
20462         echo "Your C compiler doesn't seem to define any symbols!" >&4
20463         echo " "
20464         echo "However, your C preprocessor defines the following symbols:"
20465         $cat Cppsym.true
20466         ccsymbols=''
20467         cppsymbols=`$cat Cppsym.true`
20468         cppsymbols=`echo $cppsymbols`
20469         cppccsymbols="$cppsymbols"
20470 else
20471         if $test -s ccsym.com; then
20472                 echo "Your C compiler and pre-processor define these symbols:"
20473                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20474                 also='also '
20475                 symbols='ones'
20476                 cppccsymbols=`$cat ccsym.com`
20477                 cppccsymbols=`echo $cppccsymbols`
20478                 $test "$silent" || sleep 1
20479         fi
20480         if $test -s ccsym.cpp; then
20481                 $test "$also" && echo " "
20482                 echo "Your C pre-processor ${also}defines the following symbols:"
20483                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20484                 also='further '
20485                 cppsymbols=`$cat ccsym.cpp`
20486                 cppsymbols=`echo $cppsymbols`
20487                 $test "$silent" || sleep 1
20488         fi
20489         if $test -s ccsym.own; then
20490                 $test "$also" && echo " "
20491                 echo "Your C compiler ${also}defines the following cpp symbols:"
20492                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20493                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20494                 ccsymbols=`$cat ccsym.own`
20495                 ccsymbols=`echo $ccsymbols`
20496                 $test "$silent" || sleep 1
20497         fi
20498 fi
20499
20500 : see if this is a termio system
20501 val="$undef"
20502 val2="$undef"
20503 val3="$undef"
20504 if $test `./findhdr termios.h`; then
20505         set tcsetattr i_termios
20506         eval $inlibc
20507         val3="$i_termios"
20508 fi
20509 echo " "
20510 case "$val3" in
20511 "$define") echo "You have POSIX termios.h... good!" >&4;;
20512 *) if ./Cppsym pyr; then
20513                 case "`/bin/universe`" in
20514                 ucb) if $test `./findhdr sgtty.h`; then
20515                                 val2="$define"
20516                                 echo "<sgtty.h> found." >&4
20517                         else
20518                                 echo "System is pyramid with BSD universe."
20519                                 echo "<sgtty.h> not found--you could have problems." >&4
20520                         fi;;
20521                 *) if $test `./findhdr termio.h`; then
20522                                 val="$define"
20523                                 echo "<termio.h> found." >&4
20524                         else
20525                                 echo "System is pyramid with USG universe."
20526                                 echo "<termio.h> not found--you could have problems." >&4
20527                         fi;;
20528                 esac
20529         elif ./usg; then
20530                 if $test `./findhdr termio.h`; then
20531                         echo "<termio.h> found." >&4
20532                         val="$define"
20533                 elif $test `./findhdr sgtty.h`; then
20534                         echo "<sgtty.h> found." >&4
20535                         val2="$define"
20536                 else
20537 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20538                 fi
20539         else
20540                 if $test `./findhdr sgtty.h`; then
20541                         echo "<sgtty.h> found." >&4
20542                         val2="$define"
20543                 elif $test `./findhdr termio.h`; then
20544                         echo "<termio.h> found." >&4
20545                         val="$define"
20546                 else
20547 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20548                 fi
20549         fi;;
20550 esac
20551 set i_termio; eval $setvar
20552 val=$val2; set i_sgtty; eval $setvar
20553 val=$val3; set i_termios; eval $setvar
20554
20555 : see if stddef is available
20556 set stddef.h i_stddef
20557 eval $inhdr
20558
20559 : see if this is a sunmath.h system
20560 set sunmath.h i_sunmath
20561 eval $inhdr
20562
20563 : see if sys/access.h is available
20564 set sys/access.h i_sysaccess
20565 eval $inhdr
20566
20567 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20568 set sys/filio.h i_sysfilio
20569 eval $inhdr
20570 echo " "
20571 if $test `./findhdr sys/ioctl.h`; then
20572         val="$define"
20573         echo '<sys/ioctl.h> found.' >&4
20574 else
20575         val="$undef"
20576         if $test $i_sysfilio = "$define"; then
20577             echo '<sys/ioctl.h> NOT found.' >&4
20578         else
20579                 $test $i_sgtty = "$define" && xxx="sgtty.h"
20580                 $test $i_termio = "$define" && xxx="termio.h"
20581                 $test $i_termios = "$define" && xxx="termios.h"
20582 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20583         fi
20584 fi
20585 set i_sysioctl
20586 eval $setvar
20587
20588 : see if socket ioctl defs are in sys/sockio.h
20589 echo " "
20590 xxx=`./findhdr sys/sockio.h`
20591 if $test "$xxx"; then
20592         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20593                 val="$define"
20594                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20595         else
20596                 val="$undef"
20597                 echo "No socket ioctls found in <sys/sockio.h>." >&4
20598         fi
20599 else
20600         val="$undef"
20601         $cat <<EOM
20602 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20603 EOM
20604 fi
20605 set i_syssockio
20606 eval $setvar
20607
20608
20609 : see if this is a syslog.h system
20610 set syslog.h i_syslog
20611 eval $inhdr
20612
20613
20614 : see if this is a sys/mode.h system
20615 set sys/mode.h i_sysmode
20616 eval $inhdr
20617
20618 : see if sys/resource.h has to be included
20619 set sys/resource.h i_sysresrc
20620 eval $inhdr
20621
20622 : see if sys/security.h is available
20623 set sys/security.h i_syssecrt
20624 eval $inhdr
20625
20626 : see if this is a sys/statvfs.h system
20627 set sys/statvfs.h i_sysstatvfs
20628 eval $inhdr
20629
20630 : see if this is a sys/un.h system
20631 set sys/un.h i_sysun
20632 eval $inhdr
20633
20634
20635 : see if this is a sys/utsname.h system
20636 set sys/utsname.h i_sysutsname
20637 eval $inhdr
20638
20639 : see if this is a syswait system
20640 set sys/wait.h i_syswait
20641 eval $inhdr
20642
20643 : see if this is a ustat.h system
20644 set ustat.h i_ustat
20645 eval $inhdr
20646
20647 : see if this is an utime system
20648 set utime.h i_utime
20649 eval $inhdr
20650
20651 : see if this is a values.h system
20652 set values.h i_values
20653 eval $inhdr
20654
20655 : see if this is a vfork system
20656 case "$d_vfork" in
20657 "$define")
20658         set vfork.h i_vfork
20659         eval $inhdr
20660         ;;
20661 *)
20662         i_vfork="$undef"
20663         ;;
20664 esac
20665
20666 : see if gdbm.h is available
20667 set gdbm.h t_gdbm
20668 eval $inhdr
20669 case "$t_gdbm" in
20670 $define)
20671         : see if gdbm_open exists
20672         set gdbm_open d_gdbm_open
20673         eval $inlibc
20674         case "$d_gdbm_open" in
20675         $undef)
20676                 t_gdbm="$undef"
20677                 echo "We won't be including <gdbm.h>"
20678                 ;;
20679         esac
20680         ;;
20681 esac
20682 val="$t_gdbm"
20683 set i_gdbm
20684 eval $setvar
20685
20686 echo " "
20687 echo "Looking for extensions..." >&4
20688 : If we are using the old config.sh, known_extensions may contain
20689 : old or inaccurate or duplicate values.
20690 known_extensions=''
20691 nonxs_extensions=''
20692 : We do not use find because it might not be available.
20693 : We do not just use MANIFEST because the user may have dropped
20694 : some additional extensions into the source tree and expect them
20695 : to be built.
20696
20697 : Function to recursively find available extensions, ignoring DynaLoader
20698 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
20699 find_extensions='
20700     for xxx in *; do
20701        case "$xxx" in
20702            DynaLoader|dynaload) ;;
20703            *)
20704            if $test -f $xxx/$xxx.xs; then
20705                known_extensions="$known_extensions $1$xxx";
20706            elif $test -f $xxx/Makefile.PL; then
20707                nonxs_extensions="$nonxs_extensions $1$xxx";
20708            else
20709                if $test -d $xxx -a $# -lt 10; then
20710                    set $1$xxx/ $*;
20711                    cd "$xxx";
20712                    eval $find_extensions;
20713                    cd ..;
20714                    shift;
20715                fi;
20716            fi
20717            ;;
20718        esac;
20719     done'
20720 tdir=`pwd`
20721 cd "$rsrc/ext"
20722 set X
20723 shift
20724 eval $find_extensions
20725 # Special case:  Add in threads/shared since it is not picked up by the
20726 # recursive find above (and adding in general recursive finding breaks
20727 # SDBM_File/sdbm).  A.D.  10/25/2001.
20728 known_extensions="$known_extensions threads/shared"
20729 set X $nonxs_extensions
20730 shift
20731 nonxs_extensions="$*"
20732 set X $known_extensions
20733 shift
20734 known_extensions="$*"
20735 cd "$tdir"
20736
20737 : Now see which are supported on this system.
20738 avail_ext=''
20739 for xxx in $known_extensions ; do
20740         case "$xxx" in
20741         DB_File|db_file)
20742                 case "$i_db" in
20743                 $define) avail_ext="$avail_ext $xxx" ;;
20744                 esac
20745                 ;;
20746         GDBM_File|gdbm_fil)
20747                 case "$i_gdbm" in 
20748                 $define) avail_ext="$avail_ext $xxx" ;;
20749                 esac
20750                 ;;
20751         I18N/Langinfo|i18n_lan)
20752                 case "$i_langinfo$d_nl_langinfo" in 
20753                 $define$define) avail_ext="$avail_ext $xxx" ;;
20754                 esac
20755                 ;;
20756         NDBM_File|ndbm_fil)
20757                 case "$i_ndbm" in
20758                 $define)
20759                     case "$osname-$use64bitint" in
20760                     hpux-define)
20761                         case "$libs" in
20762                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
20763                         esac
20764                         ;;
20765                     *) avail_ext="$avail_ext $xxx" ;;
20766                     esac
20767                     ;;
20768                 esac
20769                 ;;
20770         ODBM_File|odbm_fil) 
20771                 case "${i_dbm}${i_rpcsvcdbm}" in
20772                 *"${define}"*)
20773                     case "$osname-$use64bitint" in
20774                     hpux-define)
20775                         case "$libs" in
20776                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
20777                         esac
20778                         ;;
20779                     *) avail_ext="$avail_ext $xxx" ;;
20780                     esac
20781                     ;;
20782                 esac
20783                 ;;
20784         POSIX|posix)
20785                 case "$useposix" in
20786                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20787                 esac
20788                 ;;
20789         Opcode|opcode)
20790                 case "$useopcode" in
20791                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20792                 esac
20793                 ;;
20794         Socket|socket)
20795                 case "$d_socket" in 
20796                 true|$define|y)
20797                     case "$osname" in
20798                     beos) ;; # not unless BONE
20799                     *) avail_ext="$avail_ext $xxx" ;;
20800                     esac
20801                     ;;
20802                 esac
20803                 ;;
20804         Sys/Syslog|sys/syslog)
20805                 : XXX syslog requires socket
20806                 case "$d_socket" in 
20807                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
20808                 esac
20809                 ;;
20810         Thread|thread)
20811                 case "$usethreads" in
20812                 true|$define|y)
20813                         case "$useithreads" in
20814                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
20815                         esac
20816                 esac
20817                 ;;
20818         XS/APItest|xs/apitest)
20819                 # This is just for testing.  Skip it unless we have dynamic loading.
20820
20821                 case "$usedl" in
20822                 $define) avail_ext="$avail_ext $xxx" ;;
20823                 esac
20824                 ;;
20825         XS/Typemap|xs/typemap)
20826                 # This is just for testing.  Skip it unless we have dynamic loading.
20827                 case "$usedl" in
20828                 $define) avail_ext="$avail_ext $xxx" ;;
20829                 esac
20830                 ;;
20831         threads|threads/shared)
20832                 # threads and threads::shared are special cases.
20833                 # To stop people from asking "Perl 5.8.0 was supposed
20834                 # to have this new fancy threads implementation but my
20835                 # perl doesn't have it" and from people trying to
20836                 # (re)install the threads module using CPAN.pm and
20837                 # CPAN.pm then offering to reinstall Perl 5.8.0,
20838                 # the threads.pm and threads/shared.pm will always be
20839                 # there, croaking informatively ("you need to rebuild
20840                 # all of Perl with threads, sorry") when threads haven't
20841                 # been compiled in.
20842                 # --jhi
20843                 avail_ext="$avail_ext $xxx"
20844                 ;;
20845         IPC/SysV|ipc/sysv)
20846                 : XXX Do we need a useipcsysv variable here
20847                 case "${d_msg}${d_sem}${d_shm}" in 
20848                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
20849                 esac
20850                 ;;
20851         *)      avail_ext="$avail_ext $xxx"
20852                 ;;
20853         esac
20854 done
20855
20856 set X $avail_ext
20857 shift
20858 avail_ext="$*"
20859
20860 case "$onlyextensions" in
20861 '') ;;
20862 *)  keepextensions=''
20863     echo "You have requested that only certains extensions be included..." >&4
20864     for i in $onlyextensions; do
20865         case " $avail_ext " in
20866         *" $i "*)
20867             echo "Keeping extension $i."
20868             keepextensions="$keepextensions $i"
20869             ;;
20870         *) echo "Ignoring extension $i." ;;
20871         esac
20872     done
20873     avail_ext="$keepextensions"
20874     ;;
20875 esac
20876
20877 case "$noextensions" in
20878 '') ;;
20879 *)  keepextensions=''
20880     echo "You have requested that certain extensions be ignored..." >&4
20881     for i in $avail_ext; do
20882         case " $noextensions " in
20883         *" $i "*) echo "Ignoring extension $i." ;;
20884         *) echo "Keeping extension $i.";
20885            keepextensions="$keepextensions $i"
20886            ;;
20887         esac
20888     done
20889     avail_ext="$keepextensions"
20890     ;;
20891 esac
20892
20893 : Now see which nonxs extensions are supported on this system.
20894 : For now assume all are.
20895 nonxs_ext=''
20896 for xxx in $nonxs_extensions ; do
20897         case "$xxx" in
20898         *)      nonxs_ext="$nonxs_ext $xxx"
20899                 ;;
20900         esac
20901 done
20902
20903 set X $nonxs_ext
20904 shift
20905 nonxs_ext="$*"
20906
20907 case $usedl in
20908 $define)
20909         $cat <<EOM
20910 A number of extensions are supplied with $package.  You may choose to
20911 compile these extensions for dynamic loading (the default), compile
20912 them into the $package executable (static loading), or not include
20913 them at all.  Answer "none" to include no extensions.
20914 Note that DynaLoader is always built and need not be mentioned here.
20915
20916 EOM
20917         case "$dynamic_ext" in
20918         '')
20919                 : Exclude those listed in static_ext
20920                 dflt=''
20921                 for xxx in $avail_ext; do
20922                         case " $static_ext " in
20923                         *" $xxx "*) ;;
20924                         *) dflt="$dflt $xxx" ;;
20925                         esac
20926                 done
20927                 set X $dflt
20928                 shift
20929                 dflt="$*"
20930                 ;;
20931         *)      dflt="$dynamic_ext"
20932                 # Perhaps we are reusing an old out-of-date config.sh.
20933                 case "$hint" in
20934                 previous)
20935                         if test X"$dynamic_ext" != X"$avail_ext"; then
20936                                 $cat <<EOM
20937 NOTICE:  Your previous config.sh list may be incorrect. 
20938 The extensions now available to you are 
20939         ${avail_ext}
20940 but the default list from your previous config.sh is
20941         ${dynamic_ext} 
20942
20943 EOM
20944                         fi
20945                         ;;
20946                 esac
20947                 ;;
20948         esac
20949         case "$dflt" in
20950         '')     dflt=none;;
20951         esac
20952         rp="What extensions do you wish to load dynamically?"
20953         . ./myread
20954         case "$ans" in
20955         none) dynamic_ext=' ' ;;
20956         *) dynamic_ext="$ans" ;;
20957         esac
20958
20959         case "$static_ext" in
20960         '')
20961                 : Exclude those already listed in dynamic linking
20962                 dflt=''
20963                 for xxx in $avail_ext; do
20964                         case " $dynamic_ext " in
20965                         *" $xxx "*) ;;
20966                         *) dflt="$dflt $xxx" ;;
20967                         esac
20968                 done
20969                 set X $dflt
20970                 shift
20971                 dflt="$*"
20972                 ;;
20973         *)  dflt="$static_ext" 
20974                 ;;
20975         esac
20976
20977         case "$dflt" in
20978         '')     dflt=none;;
20979         esac
20980         rp="What extensions do you wish to load statically?"
20981         . ./myread
20982         case "$ans" in
20983         none) static_ext=' ' ;;
20984         *) static_ext="$ans" ;;
20985         esac
20986         ;;
20987 *)
20988         $cat <<EOM
20989 A number of extensions are supplied with $package.  Answer "none" 
20990 to include no extensions. 
20991 Note that DynaLoader is always built and need not be mentioned here.
20992
20993 EOM
20994         case "$static_ext" in
20995         '') dflt="$avail_ext" ;;
20996         *)      dflt="$static_ext"
20997                 # Perhaps we are reusing an old out-of-date config.sh.
20998                 case "$hint" in
20999                 previous)
21000                         if test X"$static_ext" != X"$avail_ext"; then
21001                                 $cat <<EOM
21002 NOTICE:  Your previous config.sh list may be incorrect. 
21003 The extensions now available to you are 
21004         ${avail_ext}
21005 but the default list from your previous config.sh is
21006         ${static_ext} 
21007
21008 EOM
21009                         fi
21010                         ;;
21011                 esac
21012                 ;;
21013         esac
21014         : Exclude those that are not xs extensions
21015         case "$dflt" in
21016         '')     dflt=none;;
21017         esac
21018         rp="What extensions do you wish to include?"
21019         . ./myread
21020         case "$ans" in
21021         none) static_ext=' ' ;;
21022         *) static_ext="$ans" ;;
21023         esac
21024         ;;
21025 esac
21026 #        
21027 # Encode is a special case.  If we are building Encode as a static
21028 # extension, we need to explicitly list its subextensions as well.
21029 # For other nested extensions, this is handled automatically by
21030 # the appropriate Makefile.PL.
21031 case " $static_ext " in
21032         *" Encode "*) # Add the subextensions of Encode
21033         cd "$rsrc/ext"
21034         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21035                 static_ext="$static_ext Encode/$xxx"
21036         done
21037         cd "$tdir"
21038         ;;
21039 esac
21040
21041 set X $dynamic_ext $static_ext $nonxs_ext
21042 shift
21043 extensions="$*"
21044
21045 # Sanity check:  We require an extension suitable for use with
21046 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21047 # should show up as failures in the test suite, but it's helpful to
21048 # catch them now.) The 'extensions' list is normally sorted
21049 # alphabetically, so we need to accept either
21050 #    DB_File ... Fcntl ... IO  ....
21051 # or something like
21052 #    Fcntl ... NDBM_File ... IO  ....
21053 case " $extensions"  in
21054 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21055 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21056 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21057 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21058    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21059    ;;
21060 esac
21061
21062 : Remove libraries needed only for extensions
21063 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21064 : The exception is SunOS 4.x, which needs them.
21065 case "${osname}X${osvers}" in
21066 sunos*X4*)
21067     perllibs="$libs"
21068     ;;
21069 *) case "$usedl" in
21070     $define|true|[yY]*)
21071             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21072             shift
21073             perllibs="$*"
21074             ;;
21075     *)  perllibs="$libs"
21076             ;;
21077     esac
21078     ;;
21079 esac
21080
21081 : Remove build directory name from cppstdin so it can be used from
21082 : either the present location or the final installed location.
21083 echo " "
21084 : Get out of the UU directory to get correct path name.
21085 cd ..
21086 case "$cppstdin" in
21087 `pwd`/cppstdin)
21088         echo "Stripping down cppstdin path name"
21089         cppstdin=cppstdin
21090         ;;
21091 esac
21092 cd UU
21093
21094 : end of configuration questions
21095 echo " "
21096 echo "End of configuration questions."
21097 echo " "
21098
21099 : back to where it started
21100 if test -d ../UU; then
21101         cd ..
21102 fi
21103
21104 : configuration may be patched via a 'config.arch' file
21105 if $test -f config.arch; then
21106         echo "I see a config.arch file, loading it."
21107         . ./config.arch
21108 fi
21109
21110 : configuration may be patched via a 'config.over' file
21111 if $test -f config.over; then
21112         echo " "
21113         dflt=y
21114         rp='I see a config.over file.  Do you wish to load it?'
21115         . UU/myread
21116         case "$ans" in
21117         n*) echo "OK, I'll ignore it.";;
21118         *)      . ./config.over
21119                 echo "Configuration override changes have been loaded."
21120                 ;;
21121         esac
21122 fi
21123
21124 : in case they want portability, strip down executable paths
21125 case "$d_portable" in
21126 "$define")
21127         echo " "
21128         echo "Stripping down executable paths..." >&4
21129         for file in $loclist $trylist; do
21130                 eval temp=\$$file
21131                 eval $file=`basename $temp`
21132         done
21133         ;;
21134 esac
21135
21136 : create config.sh file
21137 echo " "
21138 echo "Creating config.sh..." >&4
21139 $spitshell <<EOT >config.sh
21140 $startsh
21141 #
21142 # This file was produced by running the Configure script. It holds all the
21143 # definitions figured out by Configure. Should you modify one of these values,
21144 # do not forget to propagate your changes by running "Configure -der". You may
21145 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21146 #
21147
21148 # Package name      : $package
21149 # Source directory  : $src
21150 # Configuration time: $cf_time
21151 # Configured by     : $cf_by
21152 # Target system     : $myuname
21153
21154 Author='$Author'
21155 Date='$Date'
21156 Header='$Header'
21157 Id='$Id'
21158 Locker='$Locker'
21159 Log='$Log'
21160 Mcc='$Mcc'
21161 RCSfile='$RCSfile'
21162 Revision='$Revision'
21163 Source='$Source'
21164 State='$State'
21165 _a='$_a'
21166 _exe='$_exe'
21167 _o='$_o'
21168 afs='$afs'
21169 afsroot='$afsroot'
21170 alignbytes='$alignbytes'
21171 ansi2knr='$ansi2knr'
21172 aphostname='$aphostname'
21173 api_revision='$api_revision'
21174 api_subversion='$api_subversion'
21175 api_version='$api_version'
21176 api_versionstring='$api_versionstring'
21177 ar='$ar'
21178 archlib='$archlib'
21179 archlibexp='$archlibexp'
21180 archname64='$archname64'
21181 archname='$archname'
21182 archobjs='$archobjs'
21183 asctime_r_proto='$asctime_r_proto'
21184 awk='$awk'
21185 baserev='$baserev'
21186 bash='$bash'
21187 bin='$bin'
21188 binexp='$binexp'
21189 bison='$bison'
21190 byacc='$byacc'
21191 byteorder='$byteorder'
21192 c='$c'
21193 castflags='$castflags'
21194 cat='$cat'
21195 cc='$cc'
21196 cccdlflags='$cccdlflags'
21197 ccdlflags='$ccdlflags'
21198 ccflags='$ccflags'
21199 ccflags_uselargefiles='$ccflags_uselargefiles'
21200 ccname='$ccname'
21201 ccsymbols='$ccsymbols'
21202 ccversion='$ccversion'
21203 cf_by='$cf_by'
21204 cf_email='$cf_email'
21205 cf_time='$cf_time'
21206 charsize='$charsize'
21207 chgrp='$chgrp'
21208 chmod='$chmod'
21209 chown='$chown'
21210 clocktype='$clocktype'
21211 comm='$comm'
21212 compress='$compress'
21213 contains='$contains'
21214 cp='$cp'
21215 cpio='$cpio'
21216 cpp='$cpp'
21217 cpp_stuff='$cpp_stuff'
21218 cppccsymbols='$cppccsymbols'
21219 cppflags='$cppflags'
21220 cpplast='$cpplast'
21221 cppminus='$cppminus'
21222 cpprun='$cpprun'
21223 cppstdin='$cppstdin'
21224 cppsymbols='$cppsymbols'
21225 crypt_r_proto='$crypt_r_proto'
21226 cryptlib='$cryptlib'
21227 csh='$csh'
21228 ctermid_r_proto='$ctermid_r_proto'
21229 ctime_r_proto='$ctime_r_proto'
21230 d_Gconvert='$d_Gconvert'
21231 d_PRIEUldbl='$d_PRIEUldbl'
21232 d_PRIFUldbl='$d_PRIFUldbl'
21233 d_PRIGUldbl='$d_PRIGUldbl'
21234 d_PRIXU64='$d_PRIXU64'
21235 d_PRId64='$d_PRId64'
21236 d_PRIeldbl='$d_PRIeldbl'
21237 d_PRIfldbl='$d_PRIfldbl'
21238 d_PRIgldbl='$d_PRIgldbl'
21239 d_PRIi64='$d_PRIi64'
21240 d_PRIo64='$d_PRIo64'
21241 d_PRIu64='$d_PRIu64'
21242 d_PRIx64='$d_PRIx64'
21243 d_SCNfldbl='$d_SCNfldbl'
21244 d__fwalk='$d__fwalk'
21245 d_access='$d_access'
21246 d_accessx='$d_accessx'
21247 d_aintl='$d_aintl'
21248 d_alarm='$d_alarm'
21249 d_archlib='$d_archlib'
21250 d_asctime_r='$d_asctime_r'
21251 d_atolf='$d_atolf'
21252 d_atoll='$d_atoll'
21253 d_attribute_format='$d_attribute_format'
21254 d_attribute_malloc='$d_attribute_malloc'
21255 d_attribute_nonnull='$d_attribute_nonnull'
21256 d_attribute_noreturn='$d_attribute_noreturn'
21257 d_attribute_pure='$d_attribute_pure'
21258 d_attribute_unused='$d_attribute_unused'
21259 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21260 d_bcmp='$d_bcmp'
21261 d_bcopy='$d_bcopy'
21262 d_bsd='$d_bsd'
21263 d_bsdgetpgrp='$d_bsdgetpgrp'
21264 d_bsdsetpgrp='$d_bsdsetpgrp'
21265 d_builtin_choose_expr='$d_builtin_choose_expr'
21266 d_builtin_expect='$d_builtin_expect'
21267 d_bzero='$d_bzero'
21268 d_casti32='$d_casti32'
21269 d_castneg='$d_castneg'
21270 d_charvspr='$d_charvspr'
21271 d_chown='$d_chown'
21272 d_chroot='$d_chroot'
21273 d_chsize='$d_chsize'
21274 d_class='$d_class'
21275 d_clearenv='$d_clearenv'
21276 d_closedir='$d_closedir'
21277 d_cmsghdr_s='$d_cmsghdr_s'
21278 d_const='$d_const'
21279 d_copysignl='$d_copysignl'
21280 d_crypt='$d_crypt'
21281 d_crypt_r='$d_crypt_r'
21282 d_csh='$d_csh'
21283 d_ctermid_r='$d_ctermid_r'
21284 d_ctime_r='$d_ctime_r'
21285 d_cuserid='$d_cuserid'
21286 d_dbl_dig='$d_dbl_dig'
21287 d_dbminitproto='$d_dbminitproto'
21288 d_difftime='$d_difftime'
21289 d_dirfd='$d_dirfd'
21290 d_dirnamlen='$d_dirnamlen'
21291 d_dlerror='$d_dlerror'
21292 d_dlopen='$d_dlopen'
21293 d_dlsymun='$d_dlsymun'
21294 d_dosuid='$d_dosuid'
21295 d_drand48_r='$d_drand48_r'
21296 d_drand48proto='$d_drand48proto'
21297 d_dup2='$d_dup2'
21298 d_eaccess='$d_eaccess'
21299 d_endgrent='$d_endgrent'
21300 d_endgrent_r='$d_endgrent_r'
21301 d_endhent='$d_endhent'
21302 d_endhostent_r='$d_endhostent_r'
21303 d_endnent='$d_endnent'
21304 d_endnetent_r='$d_endnetent_r'
21305 d_endpent='$d_endpent'
21306 d_endprotoent_r='$d_endprotoent_r'
21307 d_endpwent='$d_endpwent'
21308 d_endpwent_r='$d_endpwent_r'
21309 d_endsent='$d_endsent'
21310 d_endservent_r='$d_endservent_r'
21311 d_eofnblk='$d_eofnblk'
21312 d_eunice='$d_eunice'
21313 d_faststdio='$d_faststdio'
21314 d_fchdir='$d_fchdir'
21315 d_fchmod='$d_fchmod'
21316 d_fchown='$d_fchown'
21317 d_fcntl='$d_fcntl'
21318 d_fcntl_can_lock='$d_fcntl_can_lock'
21319 d_fd_macros='$d_fd_macros'
21320 d_fd_set='$d_fd_set'
21321 d_fds_bits='$d_fds_bits'
21322 d_fgetpos='$d_fgetpos'
21323 d_finite='$d_finite'
21324 d_finitel='$d_finitel'
21325 d_flexfnam='$d_flexfnam'
21326 d_flock='$d_flock'
21327 d_flockproto='$d_flockproto'
21328 d_fork='$d_fork'
21329 d_fp_class='$d_fp_class'
21330 d_fpathconf='$d_fpathconf'
21331 d_fpclass='$d_fpclass'
21332 d_fpclassify='$d_fpclassify'
21333 d_fpclassl='$d_fpclassl'
21334 d_fpos64_t='$d_fpos64_t'
21335 d_frexpl='$d_frexpl'
21336 d_fs_data_s='$d_fs_data_s'
21337 d_fseeko='$d_fseeko'
21338 d_fsetpos='$d_fsetpos'
21339 d_fstatfs='$d_fstatfs'
21340 d_fstatvfs='$d_fstatvfs'
21341 d_fsync='$d_fsync'
21342 d_ftello='$d_ftello'
21343 d_ftime='$d_ftime'
21344 d_futimes='$d_futimes'
21345 d_getcwd='$d_getcwd'
21346 d_getespwnam='$d_getespwnam'
21347 d_getfsstat='$d_getfsstat'
21348 d_getgrent='$d_getgrent'
21349 d_getgrent_r='$d_getgrent_r'
21350 d_getgrgid_r='$d_getgrgid_r'
21351 d_getgrnam_r='$d_getgrnam_r'
21352 d_getgrps='$d_getgrps'
21353 d_gethbyaddr='$d_gethbyaddr'
21354 d_gethbyname='$d_gethbyname'
21355 d_gethent='$d_gethent'
21356 d_gethname='$d_gethname'
21357 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21358 d_gethostbyname_r='$d_gethostbyname_r'
21359 d_gethostent_r='$d_gethostent_r'
21360 d_gethostprotos='$d_gethostprotos'
21361 d_getitimer='$d_getitimer'
21362 d_getlogin='$d_getlogin'
21363 d_getlogin_r='$d_getlogin_r'
21364 d_getmnt='$d_getmnt'
21365 d_getmntent='$d_getmntent'
21366 d_getnbyaddr='$d_getnbyaddr'
21367 d_getnbyname='$d_getnbyname'
21368 d_getnent='$d_getnent'
21369 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21370 d_getnetbyname_r='$d_getnetbyname_r'
21371 d_getnetent_r='$d_getnetent_r'
21372 d_getnetprotos='$d_getnetprotos'
21373 d_getpagsz='$d_getpagsz'
21374 d_getpbyname='$d_getpbyname'
21375 d_getpbynumber='$d_getpbynumber'
21376 d_getpent='$d_getpent'
21377 d_getpgid='$d_getpgid'
21378 d_getpgrp2='$d_getpgrp2'
21379 d_getpgrp='$d_getpgrp'
21380 d_getppid='$d_getppid'
21381 d_getprior='$d_getprior'
21382 d_getprotobyname_r='$d_getprotobyname_r'
21383 d_getprotobynumber_r='$d_getprotobynumber_r'
21384 d_getprotoent_r='$d_getprotoent_r'
21385 d_getprotoprotos='$d_getprotoprotos'
21386 d_getprpwnam='$d_getprpwnam'
21387 d_getpwent='$d_getpwent'
21388 d_getpwent_r='$d_getpwent_r'
21389 d_getpwnam_r='$d_getpwnam_r'
21390 d_getpwuid_r='$d_getpwuid_r'
21391 d_getsbyname='$d_getsbyname'
21392 d_getsbyport='$d_getsbyport'
21393 d_getsent='$d_getsent'
21394 d_getservbyname_r='$d_getservbyname_r'
21395 d_getservbyport_r='$d_getservbyport_r'
21396 d_getservent_r='$d_getservent_r'
21397 d_getservprotos='$d_getservprotos'
21398 d_getspnam='$d_getspnam'
21399 d_getspnam_r='$d_getspnam_r'
21400 d_gettimeod='$d_gettimeod'
21401 d_gmtime_r='$d_gmtime_r'
21402 d_gnulibc='$d_gnulibc'
21403 d_grpasswd='$d_grpasswd'
21404 d_hasmntopt='$d_hasmntopt'
21405 d_htonl='$d_htonl'
21406 d_ilogbl='$d_ilogbl'
21407 d_index='$d_index'
21408 d_inetaton='$d_inetaton'
21409 d_int64_t='$d_int64_t'
21410 d_isascii='$d_isascii'
21411 d_isfinite='$d_isfinite'
21412 d_isinf='$d_isinf'
21413 d_isnan='$d_isnan'
21414 d_isnanl='$d_isnanl'
21415 d_killpg='$d_killpg'
21416 d_lchown='$d_lchown'
21417 d_ldbl_dig='$d_ldbl_dig'
21418 d_libm_lib_version='$d_libm_lib_version'
21419 d_link='$d_link'
21420 d_localtime_r='$d_localtime_r'
21421 d_locconv='$d_locconv'
21422 d_lockf='$d_lockf'
21423 d_longdbl='$d_longdbl'
21424 d_longlong='$d_longlong'
21425 d_lseekproto='$d_lseekproto'
21426 d_lstat='$d_lstat'
21427 d_madvise='$d_madvise'
21428 d_malloc_good_size='$d_malloc_good_size'
21429 d_malloc_size='$d_malloc_size'
21430 d_mblen='$d_mblen'
21431 d_mbstowcs='$d_mbstowcs'
21432 d_mbtowc='$d_mbtowc'
21433 d_memchr='$d_memchr'
21434 d_memcmp='$d_memcmp'
21435 d_memcpy='$d_memcpy'
21436 d_memmove='$d_memmove'
21437 d_memset='$d_memset'
21438 d_mkdir='$d_mkdir'
21439 d_mkdtemp='$d_mkdtemp'
21440 d_mkfifo='$d_mkfifo'
21441 d_mkstemp='$d_mkstemp'
21442 d_mkstemps='$d_mkstemps'
21443 d_mktime='$d_mktime'
21444 d_mmap='$d_mmap'
21445 d_modfl='$d_modfl'
21446 d_modfl_pow32_bug='$d_modfl_pow32_bug'
21447 d_modflproto='$d_modflproto'
21448 d_mprotect='$d_mprotect'
21449 d_msg='$d_msg'
21450 d_msg_ctrunc='$d_msg_ctrunc'
21451 d_msg_dontroute='$d_msg_dontroute'
21452 d_msg_oob='$d_msg_oob'
21453 d_msg_peek='$d_msg_peek'
21454 d_msg_proxy='$d_msg_proxy'
21455 d_msgctl='$d_msgctl'
21456 d_msgget='$d_msgget'
21457 d_msghdr_s='$d_msghdr_s'
21458 d_msgrcv='$d_msgrcv'
21459 d_msgsnd='$d_msgsnd'
21460 d_msync='$d_msync'
21461 d_munmap='$d_munmap'
21462 d_mymalloc='$d_mymalloc'
21463 d_nice='$d_nice'
21464 d_nl_langinfo='$d_nl_langinfo'
21465 d_nv_preserves_uv='$d_nv_preserves_uv'
21466 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
21467 d_off64_t='$d_off64_t'
21468 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21469 d_oldpthreads='$d_oldpthreads'
21470 d_oldsock='$d_oldsock'
21471 d_open3='$d_open3'
21472 d_pathconf='$d_pathconf'
21473 d_pause='$d_pause'
21474 d_perl_otherlibdirs='$d_perl_otherlibdirs'
21475 d_phostname='$d_phostname'
21476 d_pipe='$d_pipe'
21477 d_poll='$d_poll'
21478 d_portable='$d_portable'
21479 d_procselfexe='$d_procselfexe'
21480 d_pthread_atfork='$d_pthread_atfork'
21481 d_pthread_attr_setscope='$d_pthread_attr_setscope'
21482 d_pthread_yield='$d_pthread_yield'
21483 d_pwage='$d_pwage'
21484 d_pwchange='$d_pwchange'
21485 d_pwclass='$d_pwclass'
21486 d_pwcomment='$d_pwcomment'
21487 d_pwexpire='$d_pwexpire'
21488 d_pwgecos='$d_pwgecos'
21489 d_pwpasswd='$d_pwpasswd'
21490 d_pwquota='$d_pwquota'
21491 d_qgcvt='$d_qgcvt'
21492 d_quad='$d_quad'
21493 d_random_r='$d_random_r'
21494 d_readdir64_r='$d_readdir64_r'
21495 d_readdir='$d_readdir'
21496 d_readdir_r='$d_readdir_r'
21497 d_readlink='$d_readlink'
21498 d_readv='$d_readv'
21499 d_recvmsg='$d_recvmsg'
21500 d_rename='$d_rename'
21501 d_rewinddir='$d_rewinddir'
21502 d_rmdir='$d_rmdir'
21503 d_safebcpy='$d_safebcpy'
21504 d_safemcpy='$d_safemcpy'
21505 d_sanemcmp='$d_sanemcmp'
21506 d_sbrkproto='$d_sbrkproto'
21507 d_scalbnl='$d_scalbnl'
21508 d_sched_yield='$d_sched_yield'
21509 d_scm_rights='$d_scm_rights'
21510 d_seekdir='$d_seekdir'
21511 d_select='$d_select'
21512 d_sem='$d_sem'
21513 d_semctl='$d_semctl'
21514 d_semctl_semid_ds='$d_semctl_semid_ds'
21515 d_semctl_semun='$d_semctl_semun'
21516 d_semget='$d_semget'
21517 d_semop='$d_semop'
21518 d_sendmsg='$d_sendmsg'
21519 d_setegid='$d_setegid'
21520 d_seteuid='$d_seteuid'
21521 d_setgrent='$d_setgrent'
21522 d_setgrent_r='$d_setgrent_r'
21523 d_setgrps='$d_setgrps'
21524 d_sethent='$d_sethent'
21525 d_sethostent_r='$d_sethostent_r'
21526 d_setitimer='$d_setitimer'
21527 d_setlinebuf='$d_setlinebuf'
21528 d_setlocale='$d_setlocale'
21529 d_setlocale_r='$d_setlocale_r'
21530 d_setnent='$d_setnent'
21531 d_setnetent_r='$d_setnetent_r'
21532 d_setpent='$d_setpent'
21533 d_setpgid='$d_setpgid'
21534 d_setpgrp2='$d_setpgrp2'
21535 d_setpgrp='$d_setpgrp'
21536 d_setprior='$d_setprior'
21537 d_setproctitle='$d_setproctitle'
21538 d_setprotoent_r='$d_setprotoent_r'
21539 d_setpwent='$d_setpwent'
21540 d_setpwent_r='$d_setpwent_r'
21541 d_setregid='$d_setregid'
21542 d_setresgid='$d_setresgid'
21543 d_setresuid='$d_setresuid'
21544 d_setreuid='$d_setreuid'
21545 d_setrgid='$d_setrgid'
21546 d_setruid='$d_setruid'
21547 d_setsent='$d_setsent'
21548 d_setservent_r='$d_setservent_r'
21549 d_setsid='$d_setsid'
21550 d_setvbuf='$d_setvbuf'
21551 d_sfio='$d_sfio'
21552 d_shm='$d_shm'
21553 d_shmat='$d_shmat'
21554 d_shmatprototype='$d_shmatprototype'
21555 d_shmctl='$d_shmctl'
21556 d_shmdt='$d_shmdt'
21557 d_shmget='$d_shmget'
21558 d_sigaction='$d_sigaction'
21559 d_sigprocmask='$d_sigprocmask'
21560 d_sigsetjmp='$d_sigsetjmp'
21561 d_snprintf='$d_snprintf'
21562 d_sockatmark='$d_sockatmark'
21563 d_sockatmarkproto='$d_sockatmarkproto'
21564 d_socket='$d_socket'
21565 d_socklen_t='$d_socklen_t'
21566 d_sockpair='$d_sockpair'
21567 d_socks5_init='$d_socks5_init'
21568 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
21569 d_sqrtl='$d_sqrtl'
21570 d_srand48_r='$d_srand48_r'
21571 d_srandom_r='$d_srandom_r'
21572 d_sresgproto='$d_sresgproto'
21573 d_sresuproto='$d_sresuproto'
21574 d_statblks='$d_statblks'
21575 d_statfs_f_flags='$d_statfs_f_flags'
21576 d_statfs_s='$d_statfs_s'
21577 d_statvfs='$d_statvfs'
21578 d_stdio_cnt_lval='$d_stdio_cnt_lval'
21579 d_stdio_ptr_lval='$d_stdio_ptr_lval'
21580 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21581 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
21582 d_stdio_stream_array='$d_stdio_stream_array'
21583 d_stdiobase='$d_stdiobase'
21584 d_stdstdio='$d_stdstdio'
21585 d_strchr='$d_strchr'
21586 d_strcoll='$d_strcoll'
21587 d_strctcpy='$d_strctcpy'
21588 d_strerrm='$d_strerrm'
21589 d_strerror='$d_strerror'
21590 d_strerror_r='$d_strerror_r'
21591 d_strftime='$d_strftime'
21592 d_strlcat='$d_strlcat'
21593 d_strlcpy='$d_strlcpy'
21594 d_strtod='$d_strtod'
21595 d_strtol='$d_strtol'
21596 d_strtold='$d_strtold'
21597 d_strtoll='$d_strtoll'
21598 d_strtoq='$d_strtoq'
21599 d_strtoul='$d_strtoul'
21600 d_strtoull='$d_strtoull'
21601 d_strtouq='$d_strtouq'
21602 d_strxfrm='$d_strxfrm'
21603 d_suidsafe='$d_suidsafe'
21604 d_symlink='$d_symlink'
21605 d_syscall='$d_syscall'
21606 d_syscallproto='$d_syscallproto'
21607 d_sysconf='$d_sysconf'
21608 d_sysernlst='$d_sysernlst'
21609 d_syserrlst='$d_syserrlst'
21610 d_system='$d_system'
21611 d_tcgetpgrp='$d_tcgetpgrp'
21612 d_tcsetpgrp='$d_tcsetpgrp'
21613 d_telldir='$d_telldir'
21614 d_telldirproto='$d_telldirproto'
21615 d_time='$d_time'
21616 d_times='$d_times'
21617 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21618 d_tm_tm_zone='$d_tm_tm_zone'
21619 d_tmpnam_r='$d_tmpnam_r'
21620 d_truncate='$d_truncate'
21621 d_ttyname_r='$d_ttyname_r'
21622 d_tzname='$d_tzname'
21623 d_u32align='$d_u32align'
21624 d_ualarm='$d_ualarm'
21625 d_umask='$d_umask'
21626 d_uname='$d_uname'
21627 d_union_semun='$d_union_semun'
21628 d_unordered='$d_unordered'
21629 d_unsetenv='$d_unsetenv'
21630 d_usleep='$d_usleep'
21631 d_usleepproto='$d_usleepproto'
21632 d_ustat='$d_ustat'
21633 d_vendorarch='$d_vendorarch'
21634 d_vendorbin='$d_vendorbin'
21635 d_vendorlib='$d_vendorlib'
21636 d_vendorscript='$d_vendorscript'
21637 d_vfork='$d_vfork'
21638 d_void_closedir='$d_void_closedir'
21639 d_voidsig='$d_voidsig'
21640 d_voidtty='$d_voidtty'
21641 d_volatile='$d_volatile'
21642 d_vprintf='$d_vprintf'
21643 d_vsnprintf='$d_vsnprintf'
21644 d_wait4='$d_wait4'
21645 d_waitpid='$d_waitpid'
21646 d_wcstombs='$d_wcstombs'
21647 d_wctomb='$d_wctomb'
21648 d_writev='$d_writev'
21649 d_xenix='$d_xenix'
21650 date='$date'
21651 db_hashtype='$db_hashtype'
21652 db_prefixtype='$db_prefixtype'
21653 db_version_major='$db_version_major'
21654 db_version_minor='$db_version_minor'
21655 db_version_patch='$db_version_patch'
21656 defvoidused='$defvoidused'
21657 direntrytype='$direntrytype'
21658 dlext='$dlext'
21659 dlsrc='$dlsrc'
21660 doublesize='$doublesize'
21661 drand01='$drand01'
21662 drand48_r_proto='$drand48_r_proto'
21663 dynamic_ext='$dynamic_ext'
21664 eagain='$eagain'
21665 ebcdic='$ebcdic'
21666 echo='$echo'
21667 egrep='$egrep'
21668 emacs='$emacs'
21669 endgrent_r_proto='$endgrent_r_proto'
21670 endhostent_r_proto='$endhostent_r_proto'
21671 endnetent_r_proto='$endnetent_r_proto'
21672 endprotoent_r_proto='$endprotoent_r_proto'
21673 endpwent_r_proto='$endpwent_r_proto'
21674 endservent_r_proto='$endservent_r_proto'
21675 eunicefix='$eunicefix'
21676 exe_ext='$exe_ext'
21677 expr='$expr'
21678 extensions='$extensions'
21679 extras='$extras'
21680 fflushNULL='$fflushNULL'
21681 fflushall='$fflushall'
21682 find='$find'
21683 firstmakefile='$firstmakefile'
21684 flex='$flex'
21685 fpossize='$fpossize'
21686 fpostype='$fpostype'
21687 freetype='$freetype'
21688 from='$from'
21689 full_ar='$full_ar'
21690 full_csh='$full_csh'
21691 full_sed='$full_sed'
21692 gccansipedantic='$gccansipedantic'
21693 gccosandvers='$gccosandvers'
21694 gccversion='$gccversion'
21695 getgrent_r_proto='$getgrent_r_proto'
21696 getgrgid_r_proto='$getgrgid_r_proto'
21697 getgrnam_r_proto='$getgrnam_r_proto'
21698 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
21699 gethostbyname_r_proto='$gethostbyname_r_proto'
21700 gethostent_r_proto='$gethostent_r_proto'
21701 getlogin_r_proto='$getlogin_r_proto'
21702 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
21703 getnetbyname_r_proto='$getnetbyname_r_proto'
21704 getnetent_r_proto='$getnetent_r_proto'
21705 getprotobyname_r_proto='$getprotobyname_r_proto'
21706 getprotobynumber_r_proto='$getprotobynumber_r_proto'
21707 getprotoent_r_proto='$getprotoent_r_proto'
21708 getpwent_r_proto='$getpwent_r_proto'
21709 getpwnam_r_proto='$getpwnam_r_proto'
21710 getpwuid_r_proto='$getpwuid_r_proto'
21711 getservbyname_r_proto='$getservbyname_r_proto'
21712 getservbyport_r_proto='$getservbyport_r_proto'
21713 getservent_r_proto='$getservent_r_proto'
21714 getspnam_r_proto='$getspnam_r_proto'
21715 gidformat='$gidformat'
21716 gidsign='$gidsign'
21717 gidsize='$gidsize'
21718 gidtype='$gidtype'
21719 glibpth='$glibpth'
21720 gmake='$gmake'
21721 gmtime_r_proto='$gmtime_r_proto'
21722 gnulibc_version='$gnulibc_version'
21723 grep='$grep'
21724 groupcat='$groupcat'
21725 groupstype='$groupstype'
21726 gzip='$gzip'
21727 h_fcntl='$h_fcntl'
21728 h_sysfile='$h_sysfile'
21729 hint='$hint'
21730 hostcat='$hostcat'
21731 html1dir='$html1dir'
21732 html1direxp='$html1direxp'
21733 html3dir='$html3dir'
21734 html3direxp='$html3direxp'
21735 i16size='$i16size'
21736 i16type='$i16type'
21737 i32size='$i32size'
21738 i32type='$i32type'
21739 i64size='$i64size'
21740 i64type='$i64type'
21741 i8size='$i8size'
21742 i8type='$i8type'
21743 i_arpainet='$i_arpainet'
21744 i_bsdioctl='$i_bsdioctl'
21745 i_crypt='$i_crypt'
21746 i_db='$i_db'
21747 i_dbm='$i_dbm'
21748 i_dirent='$i_dirent'
21749 i_dld='$i_dld'
21750 i_dlfcn='$i_dlfcn'
21751 i_fcntl='$i_fcntl'
21752 i_float='$i_float'
21753 i_fp='$i_fp'
21754 i_fp_class='$i_fp_class'
21755 i_gdbm='$i_gdbm'
21756 i_grp='$i_grp'
21757 i_ieeefp='$i_ieeefp'
21758 i_inttypes='$i_inttypes'
21759 i_langinfo='$i_langinfo'
21760 i_libutil='$i_libutil'
21761 i_limits='$i_limits'
21762 i_locale='$i_locale'
21763 i_machcthr='$i_machcthr'
21764 i_malloc='$i_malloc'
21765 i_math='$i_math'
21766 i_memory='$i_memory'
21767 i_mntent='$i_mntent'
21768 i_ndbm='$i_ndbm'
21769 i_netdb='$i_netdb'
21770 i_neterrno='$i_neterrno'
21771 i_netinettcp='$i_netinettcp'
21772 i_niin='$i_niin'
21773 i_poll='$i_poll'
21774 i_prot='$i_prot'
21775 i_pthread='$i_pthread'
21776 i_pwd='$i_pwd'
21777 i_rpcsvcdbm='$i_rpcsvcdbm'
21778 i_sfio='$i_sfio'
21779 i_sgtty='$i_sgtty'
21780 i_shadow='$i_shadow'
21781 i_socks='$i_socks'
21782 i_stdarg='$i_stdarg'
21783 i_stddef='$i_stddef'
21784 i_stdlib='$i_stdlib'
21785 i_string='$i_string'
21786 i_sunmath='$i_sunmath'
21787 i_sysaccess='$i_sysaccess'
21788 i_sysdir='$i_sysdir'
21789 i_sysfile='$i_sysfile'
21790 i_sysfilio='$i_sysfilio'
21791 i_sysin='$i_sysin'
21792 i_sysioctl='$i_sysioctl'
21793 i_syslog='$i_syslog'
21794 i_sysmman='$i_sysmman'
21795 i_sysmode='$i_sysmode'
21796 i_sysmount='$i_sysmount'
21797 i_sysndir='$i_sysndir'
21798 i_sysparam='$i_sysparam'
21799 i_sysresrc='$i_sysresrc'
21800 i_syssecrt='$i_syssecrt'
21801 i_sysselct='$i_sysselct'
21802 i_syssockio='$i_syssockio'
21803 i_sysstat='$i_sysstat'
21804 i_sysstatfs='$i_sysstatfs'
21805 i_sysstatvfs='$i_sysstatvfs'
21806 i_systime='$i_systime'
21807 i_systimek='$i_systimek'
21808 i_systimes='$i_systimes'
21809 i_systypes='$i_systypes'
21810 i_sysuio='$i_sysuio'
21811 i_sysun='$i_sysun'
21812 i_sysutsname='$i_sysutsname'
21813 i_sysvfs='$i_sysvfs'
21814 i_syswait='$i_syswait'
21815 i_termio='$i_termio'
21816 i_termios='$i_termios'
21817 i_time='$i_time'
21818 i_unistd='$i_unistd'
21819 i_ustat='$i_ustat'
21820 i_utime='$i_utime'
21821 i_values='$i_values'
21822 i_varargs='$i_varargs'
21823 i_varhdr='$i_varhdr'
21824 i_vfork='$i_vfork'
21825 ignore_versioned_solibs='$ignore_versioned_solibs'
21826 inc_version_list='$inc_version_list'
21827 inc_version_list_init='$inc_version_list_init'
21828 incpath='$incpath'
21829 inews='$inews'
21830 installarchlib='$installarchlib'
21831 installbin='$installbin'
21832 installhtml1dir='$installhtml1dir'
21833 installhtml3dir='$installhtml3dir'
21834 installman1dir='$installman1dir'
21835 installman3dir='$installman3dir'
21836 installprefix='$installprefix'
21837 installprefixexp='$installprefixexp'
21838 installprivlib='$installprivlib'
21839 installscript='$installscript'
21840 installsitearch='$installsitearch'
21841 installsitebin='$installsitebin'
21842 installsitehtml1dir='$installsitehtml1dir'
21843 installsitehtml3dir='$installsitehtml3dir'
21844 installsitelib='$installsitelib'
21845 installsiteman1dir='$installsiteman1dir'
21846 installsiteman3dir='$installsiteman3dir'
21847 installsitescript='$installsitescript'
21848 installstyle='$installstyle'
21849 installusrbinperl='$installusrbinperl'
21850 installvendorarch='$installvendorarch'
21851 installvendorbin='$installvendorbin'
21852 installvendorhtml1dir='$installvendorhtml1dir'
21853 installvendorhtml3dir='$installvendorhtml3dir'
21854 installvendorlib='$installvendorlib'
21855 installvendorman1dir='$installvendorman1dir'
21856 installvendorman3dir='$installvendorman3dir'
21857 installvendorscript='$installvendorscript'
21858 intsize='$intsize'
21859 issymlink='$issymlink'
21860 ivdformat='$ivdformat'
21861 ivsize='$ivsize'
21862 ivtype='$ivtype'
21863 known_extensions='$known_extensions'
21864 ksh='$ksh'
21865 ld='$ld'
21866 lddlflags='$lddlflags'
21867 ldflags='$ldflags'
21868 ldflags_uselargefiles='$ldflags_uselargefiles'
21869 ldlibpthname='$ldlibpthname'
21870 less='$less'
21871 lib_ext='$lib_ext'
21872 libc='$libc'
21873 libperl='$libperl'
21874 libpth='$libpth'
21875 libs='$libs'
21876 libsdirs='$libsdirs'
21877 libsfiles='$libsfiles'
21878 libsfound='$libsfound'
21879 libspath='$libspath'
21880 libswanted='$libswanted'
21881 libswanted_uselargefiles='$libswanted_uselargefiles'
21882 line='$line'
21883 lint='$lint'
21884 lkflags='$lkflags'
21885 ln='$ln'
21886 lns='$lns'
21887 localtime_r_proto='$localtime_r_proto'
21888 locincpth='$locincpth'
21889 loclibpth='$loclibpth'
21890 longdblsize='$longdblsize'
21891 longlongsize='$longlongsize'
21892 longsize='$longsize'
21893 lp='$lp'
21894 lpr='$lpr'
21895 ls='$ls'
21896 lseeksize='$lseeksize'
21897 lseektype='$lseektype'
21898 mad='$mad'
21899 mail='$mail'
21900 mailx='$mailx'
21901 make='$make'
21902 make_set_make='$make_set_make'
21903 mallocobj='$mallocobj'
21904 mallocsrc='$mallocsrc'
21905 malloctype='$malloctype'
21906 man1dir='$man1dir'
21907 man1direxp='$man1direxp'
21908 man1ext='$man1ext'
21909 man3dir='$man3dir'
21910 man3direxp='$man3direxp'
21911 man3ext='$man3ext'
21912 mips_type='$mips_type'
21913 mistrustnm='$mistrustnm'
21914 mkdir='$mkdir'
21915 mmaptype='$mmaptype'
21916 modetype='$modetype'
21917 more='$more'
21918 multiarch='$multiarch'
21919 mv='$mv'
21920 myarchname='$myarchname'
21921 mydomain='$mydomain'
21922 myhostname='$myhostname'
21923 myuname='$myuname'
21924 n='$n'
21925 need_va_copy='$need_va_copy'
21926 netdb_hlen_type='$netdb_hlen_type'
21927 netdb_host_type='$netdb_host_type'
21928 netdb_name_type='$netdb_name_type'
21929 netdb_net_type='$netdb_net_type'
21930 nm='$nm'
21931 nm_opt='$nm_opt'
21932 nm_so_opt='$nm_so_opt'
21933 nonxs_ext='$nonxs_ext'
21934 nroff='$nroff'
21935 nvEUformat='$nvEUformat'
21936 nvFUformat='$nvFUformat'
21937 nvGUformat='$nvGUformat'
21938 nv_preserves_uv_bits='$nv_preserves_uv_bits'
21939 nveformat='$nveformat'
21940 nvfformat='$nvfformat'
21941 nvgformat='$nvgformat'
21942 nvsize='$nvsize'
21943 nvtype='$nvtype'
21944 o_nonblock='$o_nonblock'
21945 obj_ext='$obj_ext'
21946 old_pthread_create_joinable='$old_pthread_create_joinable'
21947 optimize='$optimize'
21948 orderlib='$orderlib'
21949 osname='$osname'
21950 osvers='$osvers'
21951 otherlibdirs='$otherlibdirs'
21952 package='$package'
21953 pager='$pager'
21954 passcat='$passcat'
21955 patchlevel='$patchlevel'
21956 path_sep='$path_sep'
21957 perl5='$perl5'
21958 perl='$perl'
21959 perl_patchlevel='$perl_patchlevel'
21960 perladmin='$perladmin'
21961 perllibs='$perllibs'
21962 perlpath='$perlpath'
21963 pg='$pg'
21964 phostname='$phostname'
21965 pidtype='$pidtype'
21966 plibpth='$plibpth'
21967 pmake='$pmake'
21968 pr='$pr'
21969 prefix='$prefix'
21970 prefixexp='$prefixexp'
21971 privlib='$privlib'
21972 privlibexp='$privlibexp'
21973 procselfexe='$procselfexe'
21974 prototype='$prototype'
21975 ptrsize='$ptrsize'
21976 quadkind='$quadkind'
21977 quadtype='$quadtype'
21978 randbits='$randbits'
21979 randfunc='$randfunc'
21980 random_r_proto='$random_r_proto'
21981 randseedtype='$randseedtype'
21982 ranlib='$ranlib'
21983 rd_nodata='$rd_nodata'
21984 readdir64_r_proto='$readdir64_r_proto'
21985 readdir_r_proto='$readdir_r_proto'
21986 revision='$revision'
21987 rm='$rm'
21988 rmail='$rmail'
21989 run='$run'
21990 runnm='$runnm'
21991 sPRIEUldbl='$sPRIEUldbl'
21992 sPRIFUldbl='$sPRIFUldbl'
21993 sPRIGUldbl='$sPRIGUldbl'
21994 sPRIXU64='$sPRIXU64'
21995 sPRId64='$sPRId64'
21996 sPRIeldbl='$sPRIeldbl'
21997 sPRIfldbl='$sPRIfldbl'
21998 sPRIgldbl='$sPRIgldbl'
21999 sPRIi64='$sPRIi64'
22000 sPRIo64='$sPRIo64'
22001 sPRIu64='$sPRIu64'
22002 sPRIx64='$sPRIx64'
22003 sSCNfldbl='$sSCNfldbl'
22004 sched_yield='$sched_yield'
22005 scriptdir='$scriptdir'
22006 scriptdirexp='$scriptdirexp'
22007 sed='$sed'
22008 seedfunc='$seedfunc'
22009 selectminbits='$selectminbits'
22010 selecttype='$selecttype'
22011 sendmail='$sendmail'
22012 setgrent_r_proto='$setgrent_r_proto'
22013 sethostent_r_proto='$sethostent_r_proto'
22014 setlocale_r_proto='$setlocale_r_proto'
22015 setnetent_r_proto='$setnetent_r_proto'
22016 setprotoent_r_proto='$setprotoent_r_proto'
22017 setpwent_r_proto='$setpwent_r_proto'
22018 setservent_r_proto='$setservent_r_proto'
22019 sh='$sh'
22020 shar='$shar'
22021 sharpbang='$sharpbang'
22022 shmattype='$shmattype'
22023 shortsize='$shortsize'
22024 shrpenv='$shrpenv'
22025 shsharp='$shsharp'
22026 sig_count='$sig_count'
22027 sig_name='$sig_name'
22028 sig_name_init='$sig_name_init'
22029 sig_num='$sig_num'
22030 sig_num_init='$sig_num_init'
22031 sig_size='$sig_size'
22032 signal_t='$signal_t'
22033 sitearch='$sitearch'
22034 sitearchexp='$sitearchexp'
22035 sitebin='$sitebin'
22036 sitebinexp='$sitebinexp'
22037 sitehtml1dir='$sitehtml1dir'
22038 sitehtml1direxp='$sitehtml1direxp'
22039 sitehtml3dir='$sitehtml3dir'
22040 sitehtml3direxp='$sitehtml3direxp'
22041 sitelib='$sitelib'
22042 sitelib_stem='$sitelib_stem'
22043 sitelibexp='$sitelibexp'
22044 siteman1dir='$siteman1dir'
22045 siteman1direxp='$siteman1direxp'
22046 siteman3dir='$siteman3dir'
22047 siteman3direxp='$siteman3direxp'
22048 siteprefix='$siteprefix'
22049 siteprefixexp='$siteprefixexp'
22050 sitescript='$sitescript'
22051 sitescriptexp='$sitescriptexp'
22052 sizesize='$sizesize'
22053 sizetype='$sizetype'
22054 sleep='$sleep'
22055 smail='$smail'
22056 so='$so'
22057 sockethdr='$sockethdr'
22058 socketlib='$socketlib'
22059 socksizetype='$socksizetype'
22060 sort='$sort'
22061 spackage='$spackage'
22062 spitshell='$spitshell'
22063 srand48_r_proto='$srand48_r_proto'
22064 srandom_r_proto='$srandom_r_proto'
22065 src='$src'
22066 ssizetype='$ssizetype'
22067 startperl='$startperl'
22068 startsh='$startsh'
22069 static_ext='$static_ext'
22070 stdchar='$stdchar'
22071 stdio_base='$stdio_base'
22072 stdio_bufsiz='$stdio_bufsiz'
22073 stdio_cnt='$stdio_cnt'
22074 stdio_filbuf='$stdio_filbuf'
22075 stdio_ptr='$stdio_ptr'
22076 stdio_stream_array='$stdio_stream_array'
22077 strerror_r_proto='$strerror_r_proto'
22078 strings='$strings'
22079 submit='$submit'
22080 subversion='$subversion'
22081 sysman='$sysman'
22082 tail='$tail'
22083 tar='$tar'
22084 targetarch='$targetarch'
22085 tbl='$tbl'
22086 tee='$tee'
22087 test='$test'
22088 timeincl='$timeincl'
22089 timetype='$timetype'
22090 tmpnam_r_proto='$tmpnam_r_proto'
22091 to='$to'
22092 touch='$touch'
22093 tr='$tr'
22094 trnl='$trnl'
22095 troff='$troff'
22096 ttyname_r_proto='$ttyname_r_proto'
22097 u16size='$u16size'
22098 u16type='$u16type'
22099 u32size='$u32size'
22100 u32type='$u32type'
22101 u64size='$u64size'
22102 u64type='$u64type'
22103 u8size='$u8size'
22104 u8type='$u8type'
22105 uidformat='$uidformat'
22106 uidsign='$uidsign'
22107 uidsize='$uidsize'
22108 uidtype='$uidtype'
22109 uname='$uname'
22110 uniq='$uniq'
22111 uquadtype='$uquadtype'
22112 use5005threads='$use5005threads'
22113 use64bitall='$use64bitall'
22114 use64bitint='$use64bitint'
22115 usecrosscompile='$usecrosscompile'
22116 usedl='$usedl'
22117 usefaststdio='$usefaststdio'
22118 useithreads='$useithreads'
22119 uselargefiles='$uselargefiles'
22120 uselongdouble='$uselongdouble'
22121 usemallocwrap='$usemallocwrap'
22122 usemorebits='$usemorebits'
22123 usemultiplicity='$usemultiplicity'
22124 usemymalloc='$usemymalloc'
22125 usenm='$usenm'
22126 useopcode='$useopcode'
22127 useperlio='$useperlio'
22128 useposix='$useposix'
22129 usereentrant='$usereentrant'
22130 userelocatableinc='$userelocatableinc'
22131 usesfio='$usesfio'
22132 useshrplib='$useshrplib'
22133 usesitecustomize='$usesitecustomize'
22134 usesocks='$usesocks'
22135 usethreads='$usethreads'
22136 usevendorprefix='$usevendorprefix'
22137 usevfork='$usevfork'
22138 usrinc='$usrinc'
22139 uuname='$uuname'
22140 uvXUformat='$uvXUformat'
22141 uvoformat='$uvoformat'
22142 uvsize='$uvsize'
22143 uvtype='$uvtype'
22144 uvuformat='$uvuformat'
22145 uvxformat='$uvxformat'
22146 vendorarch='$vendorarch'
22147 vendorarchexp='$vendorarchexp'
22148 vendorbin='$vendorbin'
22149 vendorbinexp='$vendorbinexp'
22150 vendorhtml1dir='$vendorhtml1dir'
22151 vendorhtml1direxp='$vendorhtml1direxp'
22152 vendorhtml3dir='$vendorhtml3dir'
22153 vendorhtml3direxp='$vendorhtml3direxp'
22154 vendorlib='$vendorlib'
22155 vendorlib_stem='$vendorlib_stem'
22156 vendorlibexp='$vendorlibexp'
22157 vendorman1dir='$vendorman1dir'
22158 vendorman1direxp='$vendorman1direxp'
22159 vendorman3dir='$vendorman3dir'
22160 vendorman3direxp='$vendorman3direxp'
22161 vendorprefix='$vendorprefix'
22162 vendorprefixexp='$vendorprefixexp'
22163 vendorscript='$vendorscript'
22164 vendorscriptexp='$vendorscriptexp'
22165 version='$version'
22166 version_patchlevel_string='$version_patchlevel_string'
22167 versiononly='$versiononly'
22168 vi='$vi'
22169 voidflags='$voidflags'
22170 xlibpth='$xlibpth'
22171 yacc='$yacc'
22172 yaccflags='$yaccflags'
22173 zcat='$zcat'
22174 zip='$zip'
22175 EOT
22176
22177 : Add in command line options if available
22178 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22179
22180 : add special variables
22181 $test -f $src/patchlevel.h && \
22182 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22183 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22184 echo "PERL_CONFIG_SH=true" >>config.sh
22185
22186 : propagate old symbols
22187 if $test -f UU/config.sh; then
22188         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22189         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
22190         $sort | $uniq -u >UU/oldsyms
22191         set X `cat UU/oldsyms`
22192         shift
22193         case $# in
22194         0) ;;
22195         *)
22196                 cat <<EOM
22197 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22198 EOM
22199                 echo "# Variables propagated from previous config.sh file." >>config.sh
22200                 for sym in `cat UU/oldsyms`; do
22201                         echo "    Propagating $hint variable "'$'"$sym..."
22202                         eval 'tmp="$'"${sym}"'"'
22203                         echo "$tmp" | \
22204                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22205                 done
22206                 ;;
22207         esac
22208 fi
22209
22210 : Finish up by extracting the .SH files
22211 case "$alldone" in
22212 exit)
22213         $rm -rf UU
22214         echo "Extraction done."
22215         exit 0
22216         ;;
22217 cont)
22218         ;;
22219 '')
22220         dflt=''
22221         nostick=true
22222         $cat <<EOM
22223
22224 If you'd like to make any changes to the config.sh file before I begin
22225 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22226
22227 EOM
22228         rp="Press return or use a shell escape to edit config.sh:"
22229         . UU/myread
22230         nostick=''
22231         case "$ans" in
22232         '') ;;
22233         *) : in case they cannot read
22234                 sh 1>&4 -c "$ans";;
22235         esac
22236         ;;
22237 esac
22238
22239 : if this fails, just run all the .SH files by hand
22240 . ./config.sh
22241
22242 echo " "
22243 exec 1>&4
22244 pwd=`pwd`
22245 . ./UU/extract
22246 cd "$pwd"
22247
22248 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22249         dflt=y
22250         case "$silent" in
22251         true) ;;
22252         *)
22253                 $cat <<EOM
22254
22255 Now you need to generate make dependencies by running "$make depend".
22256 You might prefer to run it in background: "$make depend > makedepend.out &"
22257 It can take a while, so you might not want to run it right now.
22258
22259 EOM
22260                 ;;
22261         esac
22262         rp="Run $make depend now?"
22263         . UU/myread
22264         case "$ans" in
22265         y*)
22266                 $make depend && echo "Now you must run '$make'."
22267                 ;;
22268         *)
22269                 echo "You must run '$make depend' then '$make'."
22270                 ;;
22271         esac
22272 elif test -f [Mm]akefile; then
22273         echo " "
22274         echo "Now you must run a $make."
22275 else
22276         echo "Configure done."
22277 fi
22278
22279 if $test -f Policy.sh; then
22280     $cat <<EOM
22281
22282 If you compile $package on a different machine or from a different object
22283 directory, copy the Policy.sh file from this object directory to the
22284 new one before you run Configure -- this will help you with most of
22285 the policy defaults.
22286
22287 EOM
22288 fi
22289 if $test -f config.msg; then
22290     echo "Hmm.  I also noted the following information while running:"
22291     echo " "
22292     $cat config.msg >&4
22293     $rm -f config.msg
22294 fi
22295 $rm -f kit*isdone ark*isdone
22296 $rm -rf UU
22297
22298 : End of Configure
22299