Compress::Zlib
[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 Mon Oct 10 16:08:59 CEST 2005 [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_bzero=''
358 d_casti32=''
359 castflags=''
360 d_castneg=''
361 d_chown=''
362 d_chroot=''
363 d_chsize=''
364 d_class=''
365 d_closedir=''
366 d_void_closedir=''
367 d_cmsghdr_s=''
368 d_const=''
369 d_copysignl=''
370 cryptlib=''
371 d_crypt=''
372 crypt_r_proto=''
373 d_crypt_r=''
374 d_csh=''
375 full_csh=''
376 ctermid_r_proto=''
377 d_ctermid_r=''
378 ctime_r_proto=''
379 d_ctime_r=''
380 d_cuserid=''
381 d_dbl_dig=''
382 d_dbminitproto=''
383 d_difftime=''
384 d_dirfd=''
385 d_dlerror=''
386 d_dlopen=''
387 d_dlsymun=''
388 d_dosuid=''
389 d_suidsafe=''
390 d_drand48_r=''
391 drand48_r_proto=''
392 d_drand48proto=''
393 d_dup2=''
394 d_eaccess=''
395 d_endgrent=''
396 d_endgrent_r=''
397 endgrent_r_proto=''
398 d_endhent=''
399 d_endhostent_r=''
400 endhostent_r_proto=''
401 d_endnent=''
402 d_endnetent_r=''
403 endnetent_r_proto=''
404 d_endpent=''
405 d_endprotoent_r=''
406 endprotoent_r_proto=''
407 d_endpwent=''
408 d_endpwent_r=''
409 endpwent_r_proto=''
410 d_endsent=''
411 d_endservent_r=''
412 endservent_r_proto=''
413 d_faststdio=''
414 d_fchdir=''
415 d_fchmod=''
416 d_fchown=''
417 d_fcntl=''
418 d_fcntl_can_lock=''
419 d_fd_macros=''
420 d_fd_set=''
421 d_fds_bits=''
422 d_fgetpos=''
423 d_finite=''
424 d_finitel=''
425 d_flexfnam=''
426 d_flock=''
427 d_flockproto=''
428 d_fork=''
429 d_fp_class=''
430 d_fpclass=''
431 d_fpclassify=''
432 d_fpclassl=''
433 d_fpos64_t=''
434 d_frexpl=''
435 d_fs_data_s=''
436 d_fseeko=''
437 d_fsetpos=''
438 d_fstatfs=''
439 d_fsync=''
440 d_ftello=''
441 d_ftime=''
442 d_gettimeod=''
443 d_Gconvert=''
444 d_getcwd=''
445 d_getespwnam=''
446 d_getfsstat=''
447 d_getgrent=''
448 d_getgrent_r=''
449 getgrent_r_proto=''
450 d_getgrgid_r=''
451 getgrgid_r_proto=''
452 d_getgrnam_r=''
453 getgrnam_r_proto=''
454 d_getgrps=''
455 d_gethbyaddr=''
456 d_gethbyname=''
457 d_gethent=''
458 aphostname=''
459 d_gethname=''
460 d_phostname=''
461 d_uname=''
462 d_gethostbyaddr_r=''
463 gethostbyaddr_r_proto=''
464 d_gethostbyname_r=''
465 gethostbyname_r_proto=''
466 d_gethostent_r=''
467 gethostent_r_proto=''
468 d_gethostprotos=''
469 d_getitimer=''
470 d_getlogin=''
471 d_getlogin_r=''
472 getlogin_r_proto=''
473 d_getmnt=''
474 d_getmntent=''
475 d_getnbyaddr=''
476 d_getnbyname=''
477 d_getnent=''
478 d_getnetbyaddr_r=''
479 getnetbyaddr_r_proto=''
480 d_getnetbyname_r=''
481 getnetbyname_r_proto=''
482 d_getnetent_r=''
483 getnetent_r_proto=''
484 d_getnetprotos=''
485 d_getpagsz=''
486 d_getpent=''
487 d_getpgid=''
488 d_getpgrp2=''
489 d_bsdgetpgrp=''
490 d_getpgrp=''
491 d_getppid=''
492 d_getprior=''
493 d_getpbyname=''
494 d_getpbynumber=''
495 d_getprotobyname_r=''
496 getprotobyname_r_proto=''
497 d_getprotobynumber_r=''
498 getprotobynumber_r_proto=''
499 d_getprotoent_r=''
500 getprotoent_r_proto=''
501 d_getprotoprotos=''
502 d_getprpwnam=''
503 d_getpwent=''
504 d_getpwent_r=''
505 getpwent_r_proto=''
506 d_getpwnam_r=''
507 getpwnam_r_proto=''
508 d_getpwuid_r=''
509 getpwuid_r_proto=''
510 d_getsent=''
511 d_getservbyname_r=''
512 getservbyname_r_proto=''
513 d_getservbyport_r=''
514 getservbyport_r_proto=''
515 d_getservent_r=''
516 getservent_r_proto=''
517 d_getservprotos=''
518 d_getspnam=''
519 d_getspnam_r=''
520 getspnam_r_proto=''
521 d_getsbyname=''
522 d_getsbyport=''
523 d_gmtime_r=''
524 gmtime_r_proto=''
525 d_gnulibc=''
526 gnulibc_version=''
527 d_hasmntopt=''
528 d_htonl=''
529 d_ilogbl=''
530 d_inetaton=''
531 d_int64_t=''
532 d_isascii=''
533 d_isfinite=''
534 d_isinf=''
535 d_isnan=''
536 d_isnanl=''
537 d_killpg=''
538 d_lchown=''
539 d_ldbl_dig=''
540 d_libm_lib_version=''
541 d_link=''
542 d_localtime_r=''
543 localtime_r_proto=''
544 d_locconv=''
545 d_lockf=''
546 d_longdbl=''
547 longdblsize=''
548 d_longlong=''
549 longlongsize=''
550 d_lseekproto=''
551 d_lstat=''
552 d_madvise=''
553 d_malloc_good_size=''
554 d_malloc_size=''
555 d_mblen=''
556 d_mbstowcs=''
557 d_mbtowc=''
558 d_memchr=''
559 d_memcmp=''
560 d_memcpy=''
561 d_memmove=''
562 d_memset=''
563 d_mkdir=''
564 d_mkdtemp=''
565 d_mkfifo=''
566 d_mkstemp=''
567 d_mkstemps=''
568 d_mktime=''
569 d_mmap=''
570 mmaptype=''
571 d_modfl=''
572 d_modfl_pow32_bug=''
573 d_modflproto=''
574 d_mprotect=''
575 d_msg=''
576 d_msgctl=''
577 d_msgget=''
578 d_msghdr_s=''
579 d_msgrcv=''
580 d_msgsnd=''
581 d_msync=''
582 d_munmap=''
583 d_nice=''
584 d_nl_langinfo=''
585 d_off64_t=''
586 d_open3=''
587 d_fpathconf=''
588 d_pathconf=''
589 d_pause=''
590 d_pipe=''
591 d_poll=''
592 d_portable=''
593 d_procselfexe=''
594 procselfexe=''
595 d_old_pthread_create_joinable=''
596 old_pthread_create_joinable=''
597 d_pthread_atfork=''
598 d_pthread_attr_setscope=''
599 d_pthread_yield=''
600 d_sched_yield=''
601 sched_yield=''
602 d_qgcvt=''
603 d_random_r=''
604 random_r_proto=''
605 d_readdir64_r=''
606 readdir64_r_proto=''
607 d_readdir=''
608 d_rewinddir=''
609 d_seekdir=''
610 d_telldir=''
611 d_readdir_r=''
612 readdir_r_proto=''
613 d_readlink=''
614 d_readv=''
615 d_recvmsg=''
616 d_rename=''
617 d_rmdir=''
618 d_safebcpy=''
619 d_safemcpy=''
620 d_sanemcmp=''
621 d_sbrkproto=''
622 d_scalbnl=''
623 d_select=''
624 d_sem=''
625 d_semctl=''
626 d_semget=''
627 d_semop=''
628 d_sendmsg=''
629 d_setegid=''
630 d_seteuid=''
631 d_setgrent=''
632 d_setgrent_r=''
633 setgrent_r_proto=''
634 d_setgrps=''
635 d_sethent=''
636 d_sethostent_r=''
637 sethostent_r_proto=''
638 d_setitimer=''
639 d_setlinebuf=''
640 d_setlocale=''
641 d_setlocale_r=''
642 setlocale_r_proto=''
643 d_setnent=''
644 d_setnetent_r=''
645 setnetent_r_proto=''
646 d_setpent=''
647 d_setpgid=''
648 d_setpgrp2=''
649 d_bsdsetpgrp=''
650 d_setpgrp=''
651 d_setprior=''
652 d_setproctitle=''
653 d_setprotoent_r=''
654 setprotoent_r_proto=''
655 d_setpwent=''
656 d_setpwent_r=''
657 setpwent_r_proto=''
658 d_setregid=''
659 d_setresgid=''
660 d_setresuid=''
661 d_setreuid=''
662 d_setrgid=''
663 d_setruid=''
664 d_setsent=''
665 d_setservent_r=''
666 setservent_r_proto=''
667 d_setsid=''
668 d_setvbuf=''
669 d_sfio=''
670 usesfio=''
671 d_shm=''
672 d_shmat=''
673 d_shmatprototype=''
674 shmattype=''
675 d_shmctl=''
676 d_shmdt=''
677 d_shmget=''
678 d_sigaction=''
679 d_sigprocmask=''
680 d_sigsetjmp=''
681 usesitecustomize=''
682 d_sockatmark=''
683 d_sockatmarkproto=''
684 d_msg_ctrunc=''
685 d_msg_dontroute=''
686 d_msg_oob=''
687 d_msg_peek=''
688 d_msg_proxy=''
689 d_oldsock=''
690 d_scm_rights=''
691 d_socket=''
692 d_sockpair=''
693 sockethdr=''
694 socketlib=''
695 d_socklen_t=''
696 d_socks5_init=''
697 d_sqrtl=''
698 d_srand48_r=''
699 srand48_r_proto=''
700 d_srandom_r=''
701 srandom_r_proto=''
702 d_sresgproto=''
703 d_sresuproto=''
704 d_statblks=''
705 d_statfs_f_flags=''
706 d_statfs_s=''
707 d_fstatvfs=''
708 d_statvfs=''
709 d_stdio_cnt_lval=''
710 d_stdio_ptr_lval=''
711 d_stdio_ptr_lval_nochange_cnt=''
712 d_stdio_ptr_lval_sets_cnt=''
713 d_stdiobase=''
714 d_stdstdio=''
715 stdio_base=''
716 stdio_bufsiz=''
717 stdio_cnt=''
718 stdio_filbuf=''
719 stdio_ptr=''
720 d_index=''
721 d_strchr=''
722 d_strcoll=''
723 d_strctcpy=''
724 d_strerrm=''
725 d_strerror=''
726 d_sysernlst=''
727 d_syserrlst=''
728 d_strerror_r=''
729 strerror_r_proto=''
730 d_strftime=''
731 d_strlcat=''
732 d_strlcpy=''
733 d_strtod=''
734 d_strtol=''
735 d_strtold=''
736 d_strtoll=''
737 d_strtoq=''
738 d_strtoul=''
739 d_strtoull=''
740 d_strtouq=''
741 d_strxfrm=''
742 d_symlink=''
743 d_syscall=''
744 d_syscallproto=''
745 d_sysconf=''
746 d_system=''
747 d_tcgetpgrp=''
748 d_tcsetpgrp=''
749 d_telldirproto=''
750 d_time=''
751 timetype=''
752 clocktype=''
753 d_times=''
754 d_tmpnam_r=''
755 tmpnam_r_proto=''
756 d_truncate=''
757 d_ttyname_r=''
758 ttyname_r_proto=''
759 d_tzname=''
760 d_u32align=''
761 d_ualarm=''
762 d_umask=''
763 d_semctl_semid_ds=''
764 d_semctl_semun=''
765 d_union_semun=''
766 d_unordered=''
767 d_unsetenv=''
768 d_usleep=''
769 d_usleepproto=''
770 d_ustat=''
771 d_vfork=''
772 usevfork=''
773 d_voidsig=''
774 signal_t=''
775 d_volatile=''
776 d_charvspr=''
777 d_vprintf=''
778 d_wait4=''
779 d_waitpid=''
780 d_wcstombs=''
781 d_wctomb=''
782 d_writev=''
783 dlext=''
784 cccdlflags=''
785 ccdlflags=''
786 dlsrc=''
787 ld=''
788 lddlflags=''
789 usedl=''
790 doublesize=''
791 ebcdic=''
792 fflushNULL=''
793 fflushall=''
794 fpossize=''
795 fpostype=''
796 gccansipedantic=''
797 gccosandvers=''
798 gccversion=''
799 gidformat=''
800 gidsign=''
801 gidsize=''
802 gidtype=''
803 groupstype=''
804 h_fcntl=''
805 h_sysfile=''
806 html1dir=''
807 html1direxp=''
808 installhtml1dir=''
809 html3dir=''
810 html3direxp=''
811 installhtml3dir=''
812 i_arpainet=''
813 i_crypt=''
814 db_hashtype=''
815 db_prefixtype=''
816 db_version_major=''
817 db_version_minor=''
818 db_version_patch=''
819 i_db=''
820 i_dbm=''
821 i_rpcsvcdbm=''
822 d_dirnamlen=''
823 direntrytype=''
824 i_dirent=''
825 i_dld=''
826 i_dlfcn=''
827 i_fcntl=''
828 i_float=''
829 i_fp=''
830 i_fp_class=''
831 i_gdbm=''
832 d_grpasswd=''
833 i_grp=''
834 i_ieeefp=''
835 i_inttypes=''
836 i_langinfo=''
837 i_libutil=''
838 i_limits=''
839 i_locale=''
840 i_machcthr=''
841 i_malloc=''
842 i_math=''
843 i_memory=''
844 i_mntent=''
845 i_ndbm=''
846 i_netdb=''
847 i_neterrno=''
848 i_netinettcp=''
849 i_niin=''
850 i_sysin=''
851 i_poll=''
852 i_prot=''
853 i_pthread=''
854 d_pwage=''
855 d_pwchange=''
856 d_pwclass=''
857 d_pwcomment=''
858 d_pwexpire=''
859 d_pwgecos=''
860 d_pwpasswd=''
861 d_pwquota=''
862 i_pwd=''
863 i_sfio=''
864 i_shadow=''
865 i_socks=''
866 i_stddef=''
867 i_stdlib=''
868 i_string=''
869 strings=''
870 i_sunmath=''
871 i_sysaccess=''
872 i_sysdir=''
873 i_sysfile=''
874 d_voidtty=''
875 i_bsdioctl=''
876 i_sysfilio=''
877 i_sysioctl=''
878 i_syssockio=''
879 i_syslog=''
880 i_sysmman=''
881 i_sysmode=''
882 i_sysmount=''
883 i_sysndir=''
884 i_sysparam=''
885 i_sysresrc=''
886 i_syssecrt=''
887 i_sysselct=''
888 i_sysstat=''
889 i_sysstatfs=''
890 i_sysstatvfs=''
891 i_systimes=''
892 i_systypes=''
893 i_sysuio=''
894 i_sysun=''
895 i_sysutsname=''
896 i_sysvfs=''
897 i_syswait=''
898 i_sgtty=''
899 i_termio=''
900 i_termios=''
901 d_tm_tm_gmtoff=''
902 d_tm_tm_zone=''
903 i_systime=''
904 i_systimek=''
905 i_time=''
906 timeincl=''
907 i_unistd=''
908 i_ustat=''
909 i_utime=''
910 i_values=''
911 i_stdarg=''
912 i_varargs=''
913 i_varhdr=''
914 i_vfork=''
915 inc_version_list=''
916 inc_version_list_init=''
917 installprefix=''
918 installprefixexp=''
919 installstyle=''
920 installusrbinperl=''
921 intsize=''
922 longsize=''
923 shortsize=''
924 issymlink=''
925 libc=''
926 ldlibpthname=''
927 libperl=''
928 shrpenv=''
929 useshrplib=''
930 glibpth=''
931 libpth=''
932 loclibpth=''
933 plibpth=''
934 xlibpth=''
935 ignore_versioned_solibs=''
936 libs=''
937 libsdirs=''
938 libsfiles=''
939 libsfound=''
940 libspath=''
941 lns=''
942 d_PRIEUldbl=''
943 d_PRIFUldbl=''
944 d_PRIGUldbl=''
945 d_PRIeldbl=''
946 d_PRIfldbl=''
947 d_PRIgldbl=''
948 d_SCNfldbl=''
949 sPRIEUldbl=''
950 sPRIFUldbl=''
951 sPRIGUldbl=''
952 sPRIeldbl=''
953 sPRIfldbl=''
954 sPRIgldbl=''
955 sSCNfldbl=''
956 lseeksize=''
957 lseektype=''
958 make_set_make=''
959 d_mymalloc=''
960 freetype=''
961 mallocobj=''
962 mallocsrc=''
963 malloctype=''
964 usemallocwrap=''
965 usemymalloc=''
966 installman1dir=''
967 man1dir=''
968 man1direxp=''
969 man1ext=''
970 installman3dir=''
971 man3dir=''
972 man3direxp=''
973 man3ext=''
974 modetype=''
975 multiarch=''
976 mydomain=''
977 myhostname=''
978 phostname=''
979 c=''
980 n=''
981 d_eofnblk=''
982 eagain=''
983 o_nonblock=''
984 rd_nodata=''
985 need_va_copy=''
986 netdb_hlen_type=''
987 netdb_host_type=''
988 netdb_name_type=''
989 netdb_net_type=''
990 groupcat=''
991 hostcat=''
992 passcat=''
993 orderlib=''
994 ranlib=''
995 d_perl_otherlibdirs=''
996 otherlibdirs=''
997 package=''
998 spackage=''
999 pager=''
1000 api_revision=''
1001 api_subversion=''
1002 api_version=''
1003 api_versionstring=''
1004 patchlevel=''
1005 perl_patchlevel=''
1006 revision=''
1007 subversion=''
1008 version=''
1009 version_patchlevel_string=''
1010 perl5=''
1011 perladmin=''
1012 perlpath=''
1013 d_nv_preserves_uv=''
1014 d_nv_zero_is_allbits_zero=''
1015 i16size=''
1016 i16type=''
1017 i32size=''
1018 i32type=''
1019 i64size=''
1020 i64type=''
1021 i8size=''
1022 i8type=''
1023 ivsize=''
1024 ivtype=''
1025 nv_preserves_uv_bits=''
1026 nvsize=''
1027 nvtype=''
1028 u16size=''
1029 u16type=''
1030 u32size=''
1031 u32type=''
1032 u64size=''
1033 u64type=''
1034 u8size=''
1035 u8type=''
1036 uvsize=''
1037 uvtype=''
1038 ivdformat=''
1039 nvEUformat=''
1040 nvFUformat=''
1041 nvGUformat=''
1042 nveformat=''
1043 nvfformat=''
1044 nvgformat=''
1045 uvXUformat=''
1046 uvoformat=''
1047 uvuformat=''
1048 uvxformat=''
1049 pidtype=''
1050 prefix=''
1051 prefixexp=''
1052 installprivlib=''
1053 privlib=''
1054 privlibexp=''
1055 prototype=''
1056 ptrsize=''
1057 d_PRIXU64=''
1058 d_PRId64=''
1059 d_PRIi64=''
1060 d_PRIo64=''
1061 d_PRIu64=''
1062 d_PRIx64=''
1063 sPRIXU64=''
1064 sPRId64=''
1065 sPRIi64=''
1066 sPRIo64=''
1067 sPRIu64=''
1068 sPRIx64=''
1069 d_quad=''
1070 quadkind=''
1071 quadtype=''
1072 uquadtype=''
1073 drand01=''
1074 randbits=''
1075 randfunc=''
1076 randseedtype=''
1077 seedfunc=''
1078 installscript=''
1079 scriptdir=''
1080 scriptdirexp=''
1081 selectminbits=''
1082 selecttype=''
1083 sh=''
1084 sig_count=''
1085 sig_name=''
1086 sig_name_init=''
1087 sig_num=''
1088 sig_num_init=''
1089 sig_size=''
1090 installsitearch=''
1091 sitearch=''
1092 sitearchexp=''
1093 installsitebin=''
1094 sitebin=''
1095 sitebinexp=''
1096 installsitehtml1dir=''
1097 sitehtml1dir=''
1098 sitehtml1direxp=''
1099 installsitehtml3dir=''
1100 sitehtml3dir=''
1101 sitehtml3direxp=''
1102 installsitelib=''
1103 sitelib=''
1104 sitelib_stem=''
1105 sitelibexp=''
1106 installsiteman1dir=''
1107 siteman1dir=''
1108 siteman1direxp=''
1109 installsiteman3dir=''
1110 siteman3dir=''
1111 siteman3direxp=''
1112 siteprefix=''
1113 siteprefixexp=''
1114 installsitescript=''
1115 sitescript=''
1116 sitescriptexp=''
1117 sizesize=''
1118 sizetype=''
1119 so=''
1120 socksizetype=''
1121 sharpbang=''
1122 shsharp=''
1123 spitshell=''
1124 src=''
1125 ssizetype=''
1126 startperl=''
1127 startsh=''
1128 stdchar=''
1129 d_stdio_stream_array=''
1130 stdio_stream_array=''
1131 sysman=''
1132 trnl=''
1133 uidformat=''
1134 uidsign=''
1135 uidsize=''
1136 uidtype=''
1137 archname64=''
1138 use64bitall=''
1139 use64bitint=''
1140 usefaststdio=''
1141 ccflags_uselargefiles=''
1142 ldflags_uselargefiles=''
1143 libswanted_uselargefiles=''
1144 uselargefiles=''
1145 uselongdouble=''
1146 usemorebits=''
1147 usemultiplicity=''
1148 nm_opt=''
1149 nm_so_opt=''
1150 runnm=''
1151 usenm=''
1152 useperlio=''
1153 userelocatableinc=''
1154 usesocks=''
1155 d_oldpthreads=''
1156 use5005threads=''
1157 useithreads=''
1158 usereentrant=''
1159 usethreads=''
1160 incpath=''
1161 mips_type=''
1162 usrinc=''
1163 d_vendorarch=''
1164 installvendorarch=''
1165 vendorarch=''
1166 vendorarchexp=''
1167 d_vendorbin=''
1168 installvendorbin=''
1169 vendorbin=''
1170 vendorbinexp=''
1171 installvendorhtml1dir=''
1172 vendorhtml1dir=''
1173 vendorhtml1direxp=''
1174 installvendorhtml3dir=''
1175 vendorhtml3dir=''
1176 vendorhtml3direxp=''
1177 d_vendorlib=''
1178 installvendorlib=''
1179 vendorlib=''
1180 vendorlib_stem=''
1181 vendorlibexp=''
1182 installvendorman1dir=''
1183 vendorman1dir=''
1184 vendorman1direxp=''
1185 installvendorman3dir=''
1186 vendorman3dir=''
1187 vendorman3direxp=''
1188 usevendorprefix=''
1189 vendorprefix=''
1190 vendorprefixexp=''
1191 d_vendorscript=''
1192 installvendorscript=''
1193 vendorscript=''
1194 vendorscriptexp=''
1195 versiononly=''
1196 defvoidused=''
1197 voidflags=''
1198 yacc=''
1199 yaccflags=''
1200 CONFIG=''
1201
1202 define='define'
1203 undef='undef'
1204 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1205 rmlist=''
1206
1207 : We must find out about Eunice early
1208 eunicefix=':'
1209 if test -f /etc/unixtovms; then
1210         eunicefix=/etc/unixtovms
1211 fi
1212 if test -f /etc/unixtovms.exe; then
1213         eunicefix=/etc/unixtovms.exe
1214 fi
1215
1216 : Set executable suffix now -- needed before hints available
1217 if test -f "/libs/version.library"; then
1218 : Amiga OS
1219     _exe=""
1220 elif test -f "/system/gnu_library/bin/ar.pm"; then
1221 : Stratus VOS
1222     _exe=".pm"
1223 elif test -n "$DJGPP"; then
1224 : DOS DJGPP
1225     _exe=".exe"
1226 elif test -d c:/. -o -n "$is_os2" ; then
1227 : OS/2 or cygwin
1228     _exe=".exe"
1229 fi
1230
1231 i_whoami=''
1232 ccname=''
1233 ccversion=''
1234 perllibs=''
1235 : set useposix=false in your hint file to disable the POSIX extension.
1236 useposix=true
1237 : set useopcode=false in your hint file to disable the Opcode extension.
1238 useopcode=true
1239 : Trailing extension.  Override this in a hint file, if needed.
1240 : Extra object files, if any, needed on this platform.
1241 archobjs=''
1242 archname=''
1243 : Possible local include directories to search.
1244 : Set locincpth to "" in a hint file to defeat local include searches.
1245 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1246 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1247 :
1248 : no include file wanted by default
1249 inclwanted=''
1250
1251 groupstype=''
1252 libnames=''
1253 : change the next line if compiling for Xenix/286 on Xenix/386
1254 xlibpth='/usr/lib/386 /lib/386'
1255 : Possible local library directories to search.
1256 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1257 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1258
1259 : general looking path for locating libraries
1260 glibpth="/lib /usr/lib $xlibpth"
1261 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1262 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1263 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1264
1265 : Private path used by Configure to find libraries.  Its value
1266 : is prepended to libpth. This variable takes care of special
1267 : machines, like the mips.  Usually, it should be empty.
1268 plibpth=''
1269
1270 : default library list
1271 libswanted=''
1272 : some systems want to use only the non-versioned libso:s
1273 ignore_versioned_solibs=''
1274 siteman1dir=''
1275 siteman3dir=''
1276 sitescript=''
1277 archname64=''
1278 ccflags_uselargefiles=''
1279 ldflags_uselargefiles=''
1280 libswanted_uselargefiles=''
1281 : set usemultiplicity on the Configure command line to enable multiplicity.
1282 : set usesocks on the Configure command line to enable socks.
1283 : set usethreads on the Configure command line to enable threads.
1284 usereentrant='undef'
1285 : full support for void wanted by default
1286 defvoidused=15
1287
1288 : List of libraries we want.
1289 : If anyone needs extra -lxxx, put those in a hint file.
1290 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1291 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1292 : We probably want to search /usr/shlib before most other libraries.
1293 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1294 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1295 glibpth="/usr/shlib $glibpth"
1296 : Do not use vfork unless overridden by a hint file.
1297 usevfork=false
1298
1299 : Find the basic shell for Bourne shell scripts
1300 case "$sh" in
1301 '')
1302         case "$SYSTYPE" in
1303         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1304         *) xxx='/bin/sh';;
1305         esac
1306         if test -f "$xxx"; then
1307                 sh="$xxx"
1308         else
1309                 : Build up a list and do a single loop so we can 'break' out.
1310                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1311                 for xxx in sh bash ksh pdksh ash; do
1312                         for p in $pth; do
1313                                 try="$try ${p}/${xxx}"
1314                         done
1315                 done
1316                 for xxx in $try; do
1317                         if test -f "$xxx"; then
1318                                 sh="$xxx";
1319                                 break
1320                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1321                                 sh="$xxx";
1322                                 break
1323                         elif test -f "$xxx.exe"; then
1324                                 sh="$xxx";
1325                                 break
1326                         fi
1327                 done
1328         fi
1329         ;;
1330 esac
1331
1332 case "$sh" in
1333 '')     cat >&2 <<EOM
1334 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1335
1336 Usually it's in /bin/sh.  How did you even get this far?
1337 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1338 we'll try to straighten this all out.
1339 EOM
1340         exit 1
1341         ;;
1342 esac
1343
1344 : see if sh knows # comments
1345 if `$sh -c '#' >/dev/null 2>&1`; then
1346         shsharp=true
1347         spitshell=cat
1348         xcat=/bin/cat
1349         test -f $xcat$_exe || xcat=/usr/bin/cat
1350         if test ! -f $xcat$_exe; then
1351                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1352                         if test -f $p/cat$_exe; then
1353                                 xcat=$p/cat
1354                                 break
1355                         fi
1356                 done
1357                 if test ! -f $xcat$_exe; then
1358                         echo "Can't find cat anywhere!"
1359                         exit 1
1360                 fi
1361         fi
1362         echo "#!$xcat" >sharp
1363         $eunicefix sharp
1364         chmod +x sharp
1365         ./sharp > today
1366         if test -s today; then
1367                 sharpbang='#!'
1368         else
1369                 echo "#! $xcat" > sharp
1370                 $eunicefix sharp
1371                 chmod +x sharp
1372                 ./sharp > today
1373                 if test -s today; then
1374                         sharpbang='#! '
1375                 else
1376                         sharpbang=': use '
1377                 fi
1378         fi
1379 else
1380         echo " "
1381         echo "Your $sh doesn't grok # comments--I will strip them later on."
1382         shsharp=false
1383         cd ..
1384         echo "exec grep -v '^[  ]*#'" >spitshell
1385         chmod +x spitshell
1386         $eunicefix spitshell
1387         spitshell=`pwd`/spitshell
1388         cd UU
1389         echo "I presume that if # doesn't work, #! won't work either!"
1390         sharpbang=': use '
1391 fi
1392 rm -f sharp today
1393
1394 : figure out how to guarantee sh startup
1395 case "$startsh" in
1396 '') startsh=${sharpbang}${sh} ;;
1397 *)
1398 esac
1399 cat >sharp <<EOSS
1400 $startsh
1401 set abc
1402 test "$?abc" != 1
1403 EOSS
1404
1405 chmod +x sharp
1406 $eunicefix sharp
1407 if ./sharp; then
1408         : echo "Yup, it does."
1409 else
1410         echo "Hmm... '$startsh' does not guarantee sh startup..."
1411         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1412 fi
1413 rm -f sharp
1414
1415
1416 : Save command line options in file UU/cmdline.opt for later use in
1417 : generating config.sh.
1418 cat > cmdline.opt <<EOSH
1419 # Configure command line arguments.
1420 config_arg0='$0'
1421 config_args='$*'
1422 config_argc=$#
1423 EOSH
1424 argn=1
1425 args_exp=''
1426 args_sep=''
1427 for arg in "$@"; do
1428         cat >>cmdline.opt <<EOSH
1429 config_arg$argn='$arg'
1430 EOSH
1431         # Extreme backslashitis: replace each ' by '"'"'
1432         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1433 $arg
1434 EOC
1435         arg_exp=`cat cmdl.opt`
1436         args_exp="$args_exp$args_sep'$arg_exp'"
1437         argn=`expr $argn + 1`
1438         args_sep=' '
1439 done
1440 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1441 # used by ./hints/os2.sh
1442 rm -f cmdl.opt
1443
1444 : produce awk script to parse command line options
1445 cat >options.awk <<'EOF'
1446 BEGIN {
1447         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1448
1449         len = length(optstr);
1450         for (i = 1; i <= len; i++) {
1451                 c = substr(optstr, i, 1);
1452                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1453                 if (a == ":") {
1454                         arg[c] = 1;
1455                         i++;
1456                 }
1457                 opt[c] = 1;
1458         }
1459 }
1460 {
1461         expect = 0;
1462         str = $0;
1463         if (substr(str, 1, 1) != "-") {
1464                 printf("'%s'\n", str);
1465                 next;
1466         }
1467         len = length($0);
1468         for (i = 2; i <= len; i++) {
1469                 c = substr(str, i, 1);
1470                 if (!opt[c]) {
1471                         printf("-%s\n", substr(str, i));
1472                         next;
1473                 }
1474                 printf("-%s\n", c);
1475                 if (arg[c]) {
1476                         if (i < len)
1477                                 printf("'%s'\n", substr(str, i + 1));
1478                         else
1479                                 expect = 1;
1480                         next;
1481                 }
1482         }
1483 }
1484 END {
1485         if (expect)
1486                 print "?";
1487 }
1488 EOF
1489
1490 : process the command line options
1491 set X `for arg in "$@"; do echo "X$arg"; done |
1492         sed -e s/X// | awk -f options.awk`
1493 eval "set $*"
1494 shift
1495 rm -f options.awk
1496
1497 : set up default values
1498 fastread=''
1499 reuseval=false
1500 config_sh=''
1501 alldone=''
1502 error=''
1503 silent=''
1504 extractsh=''
1505 override=''
1506 knowitall=''
1507 rm -f optdef.sh posthint.sh
1508 cat >optdef.sh <<EOS
1509 $startsh
1510 EOS
1511
1512
1513 : option parsing
1514 while test $# -gt 0; do
1515         case "$1" in
1516         -d) shift; fastread=yes;;
1517         -e) shift; alldone=cont;;
1518         -f)
1519                 shift
1520                 cd ..
1521                 if test -r "$1"; then
1522                         config_sh="$1"
1523                 else
1524                         echo "$me: cannot read config file $1." >&2
1525                         error=true
1526                 fi
1527                 cd UU
1528                 shift;;
1529         -h) shift; error=true;;
1530         -r) shift; reuseval=true;;
1531         -s) shift; silent=true; realsilent=true;;
1532         -E) shift; alldone=exit;;
1533         -K) shift; knowitall=true;;
1534         -O) shift; override=true;;
1535         -S) shift; silent=true; extractsh=true;;
1536         -D)
1537                 shift
1538                 case "$1" in
1539                 *=)
1540                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1541                         echo "$me: ignoring -D $1" >&2
1542                         ;;
1543                 *=*) echo "$1" | \
1544                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1545                 *) echo "$1='define'" >> optdef.sh;;
1546                 esac
1547                 shift
1548                 ;;
1549         -U)
1550                 shift
1551                 case "$1" in
1552                 *=) echo "$1" >> optdef.sh;;
1553                 *=*)
1554                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1555                         echo "$me: ignoring -U $1" >&2
1556                         ;;
1557                 *) echo "$1='undef'" >> optdef.sh;;
1558                 esac
1559                 shift
1560                 ;;
1561         -A)
1562             shift
1563             xxx=''
1564             yyy="$1"
1565             zzz=''
1566             uuu=undef
1567             case "$yyy" in
1568             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1569                  case "$zzz" in
1570                  *:*) zzz='' ;;
1571                  *)   xxx=append
1572                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1573                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1574                  esac
1575                  ;;
1576             esac
1577             case "$xxx" in
1578             '')  case "$yyy" in
1579                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1580                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1581                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1582                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1583                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1584                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1585                  esac
1586                  ;;       
1587             esac
1588             case "$xxx" in
1589             append)
1590                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1591             clear)
1592                 echo "$yyy=''"                  >> posthint.sh ;;
1593             define)
1594                 case "$zzz" in
1595                 '') zzz=define ;;
1596                 esac
1597                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1598             eval)
1599                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1600             prepend)
1601                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1602             undef)
1603                 case "$zzz" in
1604                 '') zzz="$uuu" ;;
1605                 esac
1606                 echo "$yyy=$zzz"                >> posthint.sh ;;
1607             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1608             esac
1609             shift
1610             ;;
1611         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1612             exit 0;;
1613         --) break;;
1614         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1615         *) break;;
1616         esac
1617 done
1618
1619 case "$error" in
1620 true)
1621         cat >&2 <<EOM
1622 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1623                  [-U symbol] [-U symbol=] [-A command:symbol...]
1624   -d : use defaults for all answers.
1625   -e : go on without questioning past the production of config.sh.
1626   -f : specify an alternate default configuration file.
1627   -h : print this help message and exit (with an error status).
1628   -r : reuse C symbols value if possible (skips costly nm extraction).
1629   -s : silent mode, only echoes questions and essential information.
1630   -D : define symbol to have some value:
1631          -D symbol         symbol gets the value 'define'
1632          -D symbol=value   symbol gets the value 'value'
1633   -E : stop at the end of questions, after having produced config.sh.
1634   -K : do not use unless you know what you are doing.
1635   -O : let -D and -U override definitions from loaded configuration file.
1636   -S : perform variable substitutions on all .SH files (can mix with -f)
1637   -U : undefine symbol:
1638          -U symbol    symbol gets the value 'undef'
1639          -U symbol=   symbol gets completely empty
1640   -A : manipulate symbol after the platform specific hints have been applied:
1641          -A symbol=value                append " "value to symbol
1642          -A append:symbol=value         append value to symbol
1643          -A define:symbol=value         define symbol to have value
1644          -A clear:symbol                define symbol to be ''
1645          -A define:symbol               define symbol to be 'define'
1646          -A eval:symbol=value           define symbol to be eval of value
1647          -A prepend:symbol=value        prepend value to symbol
1648          -A undef:symbol                define symbol to be 'undef'
1649          -A undef:symbol=               define symbol to be ''
1650   -V : print version number and exit (with a zero status).
1651 EOM
1652         exit 1
1653         ;;
1654 esac
1655
1656 : Sanity checks
1657 case "$fastread$alldone" in
1658 yescont|yesexit) ;;
1659 *)
1660         case "$extractsh" in
1661         true) ;;
1662         *)
1663                 if test ! -t 0; then
1664                         echo "Say 'sh Configure', not 'sh <Configure'"
1665                         exit 1
1666                 fi
1667                 ;;
1668         esac
1669         ;;
1670 esac
1671
1672 exec 4>&1
1673 case "$silent" in
1674 true) exec 1>/dev/null;;
1675 esac
1676
1677 : run the defines and the undefines, if any, but leave the file out there...
1678 touch optdef.sh
1679 . ./optdef.sh
1680 : create the posthint manipulation script and leave the file out there...
1681 touch posthint.sh
1682
1683 : set package name
1684 package=perl5
1685 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1686 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1687 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1688 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1689 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1690 esac
1691
1692 : Some greps do not return status, grrr.
1693 echo "grimblepritz" >grimble
1694 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1695         contains=contains
1696 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1697         contains=grep
1698 else
1699         contains=contains
1700 fi
1701 rm -f grimble
1702 : the following should work in any shell
1703 case "$contains" in
1704 contains*)
1705         echo " "
1706         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1707         cat >contains <<'EOSS'
1708 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1709 EOSS
1710 chmod +x contains
1711 esac
1712
1713 : Find the path to the source tree
1714 case "$src" in
1715 '') case "$0" in
1716     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1717          case "$src" in
1718          /*)    ;;
1719          .)     ;;
1720          *)     src=`cd ../$src && pwd` ;;
1721          esac
1722          ;;
1723     *)   src='.';;
1724     esac;;
1725 esac
1726 case "$src" in
1727 '')     src=/
1728         rsrc=/
1729         ;;
1730 /*) rsrc="$src";;
1731 *) rsrc="../$src";;
1732 esac
1733 if test -f $rsrc/Configure && \
1734         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1735 then
1736    : found it, so we are ok.
1737 else
1738         rsrc=''
1739         for src in . .. ../.. ../../.. ../../../..; do
1740                 if test -f ../$src/Configure && \
1741                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1742                 then
1743                         rsrc=../$src
1744                         break
1745                 fi
1746         done
1747 fi
1748 case "$rsrc" in
1749 '')
1750         cat <<EOM >&4
1751
1752 Sorry, I can't seem to locate the source dir for $package.  Please start
1753 Configure with an explicit path -- i.e. /some/path/Configure.
1754
1755 EOM
1756         exit 1
1757         ;;
1758 ../.)   rsrc='..';;
1759 *)
1760         echo " "
1761         echo "Sources for $package found in \"$src\"." >&4
1762         ;;
1763 esac
1764
1765 : script used to extract .SH files with variable substitutions
1766 cat >extract <<'EOS'
1767 PERL_CONFIG_SH=true
1768 echo "Doing variable substitutions on .SH files..."
1769 if test -f MANIFEST; then
1770         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1771 else
1772         echo "(Looking for .SH files under the source directory.)"
1773         set x `(cd "$src"; find . -name "*.SH" -print)`
1774 fi
1775 shift
1776 case $# in
1777 0) set x `(cd "$src"; echo *.SH)`; shift;;
1778 esac
1779 if test ! -f "$src/$1"; then
1780         shift
1781 fi
1782 mkdir_p='
1783 name=$1;
1784 create="";
1785 while test $name; do
1786         if test ! -d "$name"; then
1787                 create="$name $create";
1788                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1789                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1790         else
1791                 name="";
1792         fi;
1793 done;
1794 for file in $create; do
1795         mkdir $file;
1796 done
1797 '
1798 for file in $*; do
1799         case "$src" in
1800         ".")
1801                 case "$file" in
1802                 */*)
1803                         dir=`expr X$file : 'X\(.*\)/'`
1804                         file=`expr X$file : 'X.*/\(.*\)'`
1805                         (cd "$dir" && . ./$file)
1806                         ;;
1807                 *)
1808                         . ./$file
1809                         ;;
1810                 esac
1811                 ;;
1812         *)
1813                 case "$file" in
1814                 */*)
1815                         dir=`expr X$file : 'X\(.*\)/'`
1816                         file=`expr X$file : 'X.*/\(.*\)'`
1817                         (set x $dir; shift; eval $mkdir_p)
1818                         sh <"$src/$dir/$file"
1819                         ;;
1820                 *)
1821                         sh <"$src/$file"
1822                         ;;
1823                 esac
1824                 ;;
1825         esac
1826 done
1827 if test -f "$src/config_h.SH"; then
1828         if test ! -f config.h; then
1829         : oops, they left it out of MANIFEST, probably, so do it anyway.
1830         . "$src/config_h.SH"
1831         fi
1832 fi
1833 EOS
1834
1835 : extract files and exit if asked to do so
1836 case "$extractsh" in
1837 true)
1838         case "$realsilent" in
1839         true) ;;
1840         *) exec 1>&4;;
1841         esac
1842         case "$config_sh" in
1843         '') config_sh='config.sh';;
1844         esac
1845         echo " "
1846         echo "Fetching answers from $config_sh..."
1847         cd ..
1848         . $config_sh
1849         test "$override" && . ./optdef.sh
1850         echo " "
1851         . UU/extract
1852         rm -rf UU
1853         echo "Extraction done."
1854         exit 0
1855         ;;
1856 esac
1857
1858 : Eunice requires " " instead of "", can you believe it
1859 echo " "
1860 : Here we go...
1861 echo "Beginning of configuration questions for $package."
1862
1863 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1864
1865 : first determine how to suppress newline on echo command
1866 echo " "
1867 echo "Checking echo to see how to suppress newlines..."
1868 (echo "hi there\c" ; echo " ") >.echotmp
1869 if $contains c .echotmp >/dev/null 2>&1 ; then
1870         echo "...using -n."
1871         n='-n'
1872         c=''
1873 else
1874         cat <<'EOM'
1875 ...using \c
1876 EOM
1877         n=''
1878         c='\c'
1879 fi
1880 echo $n "The star should be here-->$c"
1881 echo '*'
1882 rm -f .echotmp
1883
1884 : Now test for existence of everything in MANIFEST
1885 echo " "
1886 if test -f "$rsrc/MANIFEST"; then
1887         echo "First let's make sure your kit is complete.  Checking..." >&4
1888         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1889         rm -f missing
1890         tmppwd=`pwd`
1891         for filelist in x??; do
1892                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1893         done
1894         if test -s missing; then
1895                 cat missing >&4
1896                 cat >&4 <<'EOM'
1897
1898 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1899
1900 You have the option of continuing the configuration process, despite the
1901 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1902 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1903 and contact the author (perlbug@perl.org).
1904
1905 EOM
1906                 echo $n "Continue? [n] $c" >&4
1907                 read ans
1908                 case "$ans" in
1909                 y*)
1910                         echo "Continuing..." >&4
1911                         rm -f missing
1912                         ;;
1913                 *)
1914                         echo "ABORTING..." >&4
1915                         kill $$
1916                         ;;
1917                 esac
1918         else
1919                 echo "Looks good..."
1920         fi
1921 else
1922         echo "There is no MANIFEST file.  I hope your kit is complete !"
1923 fi
1924 rm -f missing x??
1925
1926 echo " "
1927 : Find the appropriate value for a newline for tr
1928 if test -n "$DJGPP"; then
1929        trnl='\012'
1930 fi
1931 if test X"$trnl" = X; then
1932         case "`echo foo|tr '\n' x 2>/dev/null`" in
1933         foox) trnl='\n' ;;
1934         esac
1935 fi
1936 if test X"$trnl" = X; then
1937         case "`echo foo|tr '\012' x 2>/dev/null`" in
1938         foox) trnl='\012' ;;
1939         esac
1940 fi
1941 if test X"$trnl" = X; then
1942        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1943        fooxy) trnl='\n\r' ;;
1944        esac
1945 fi
1946 if test X"$trnl" = X; then
1947         cat <<EOM >&2
1948
1949 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1950
1951 EOM
1952         exit 1
1953 fi
1954
1955 : compute the number of columns on the terminal for proper question formatting
1956 case "$COLUMNS" in
1957 '') COLUMNS='80';;
1958 esac
1959
1960 : set up the echo used in my read
1961 myecho="case \"\$xxxm\" in
1962 '') echo $n \"\$rp $c\" >&4;;
1963 *) case \"\$rp\" in
1964         '') echo $n \"[\$xxxm] $c\";;
1965         *)
1966                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1967                         echo \"\$rp\" >&4
1968                         echo $n \"[\$xxxm] $c\" >&4
1969                 else
1970                         echo $n \"\$rp [\$xxxm] $c\" >&4
1971                 fi
1972                 ;;
1973         esac;;
1974 esac"
1975
1976 : now set up to do reads with possible shell escape and default assignment
1977 cat <<EOSC >myread
1978 $startsh
1979 xxxm=\$dflt
1980 $myecho
1981 ans='!'
1982 case "\$fastread" in
1983 yes) case "\$dflt" in
1984         '') ;;
1985         *) ans='';
1986                 case "\$silent-\$rp" in
1987                 true-) ;;
1988                 *) echo " " >&4;;
1989                 esac;;
1990         esac;;
1991 *) case "\$silent" in
1992         true) case "\$rp" in
1993                 '') ans='';;
1994                 esac;;
1995         esac;;
1996 esac
1997 while expr "X\$ans" : "X!" >/dev/null; do
1998         read answ
1999         set x \$xxxm
2000         shift
2001         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2002         case  "\$answ" in
2003         "!")
2004                 sh 1>&4
2005                 echo " "
2006                 $myecho
2007                 ;;
2008         !*)
2009                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2010                 shift
2011                 sh 1>&4 -c "\$*"
2012                 echo " "
2013                 $myecho
2014                 ;;
2015         "\$ans")
2016                 case "\$ans" in
2017                 \\&*)
2018                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2019                         shift
2020                         case "\$1" in
2021                         -d)
2022                                 fastread=yes
2023                                 echo "(OK, I'll run with -d after this question.)" >&4
2024                                 ;;
2025                         -*)
2026                                 echo "*** Sorry, \$1 not supported yet." >&4
2027                                 ;;
2028                         esac
2029                         $myecho
2030                         ans=!
2031                         ;;
2032                 esac;;
2033         *)
2034                 case "\$aok" in
2035                 y)
2036                         echo "*** Substitution done -- please confirm."
2037                         xxxm="\$ans"
2038                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2039                         xxxm="\$ans"
2040                         ans=!
2041                         ;;
2042                 *)
2043                         echo "*** Error -- try again."
2044                         ans=!
2045                         ;;
2046                 esac
2047                 $myecho
2048                 ;;
2049         esac
2050         case "\$ans\$xxxm\$nostick" in
2051         '')
2052                 ans=!
2053                 $myecho
2054                 ;;
2055         esac
2056 done
2057 case "\$ans" in
2058 '') ans="\$xxxm";;
2059 esac
2060 EOSC
2061
2062 : create .config dir to save info across Configure sessions
2063 test -d ../.config || mkdir ../.config
2064 cat >../.config/README <<EOF
2065 This directory created by Configure to save information that should
2066 persist across sessions for $package.
2067
2068 You may safely delete it if you wish.
2069 EOF
2070
2071 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2072 case "$usedevel" in
2073 $define|true|[yY]*) ;;
2074 *) case "$xversion" in
2075    *[13579])
2076         cat >&4 <<EOH
2077 *** WHOA THERE!!! ***
2078
2079     This is an UNSTABLE DEVELOPMENT release.
2080     The version of this $package distribution is $xversion, that is, odd,
2081     (as opposed to even) and that signifies a development release.
2082     If you want a maintenance release, you want an even-numbered version.
2083
2084     Do ***NOT*** install this into production use.
2085     Data corruption and crashes are possible.
2086
2087     It is most seriously suggested that you do not continue any further
2088     unless you want to help in developing and debugging Perl.
2089
2090     If you *still* want to build perl, you can answer 'y' now,
2091     or pass -Dusedevel to Configure.
2092
2093 EOH
2094         rp='Do you really want to continue?'
2095         dflt='n'
2096         . ./myread
2097         case "$ans" in
2098         [yY]) echo >&4 "Okay, continuing."
2099               usedevel="$define" ;;
2100         *) echo >&4 "Okay, bye."
2101            exit 1
2102            ;;
2103         esac
2104         ;;
2105     esac
2106     ;;
2107 esac
2108 case "$usedevel" in
2109 $define|true|[yY]*)
2110         case "$versiononly" in
2111         '') versiononly="$define" ;;
2112         esac
2113         case "$installusrbinperl" in
2114         '') installusrbinperl="$undef" ;;
2115         esac
2116         ;;
2117 esac
2118
2119 : general instructions
2120 needman=true
2121 firsttime=true
2122 user=`(logname) 2>/dev/null`
2123 case "$user" in
2124 '') user=`whoami 2>&1`;;
2125 esac
2126 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2127         firsttime=false
2128         echo " "
2129         rp='Would you like to see the instructions?'
2130         dflt=n
2131         . ./myread
2132         case "$ans" in
2133         [yY]*) ;;
2134         *) needman=false;;
2135         esac
2136 fi
2137 if $needman; then
2138         cat <<EOH
2139
2140 This installation shell script will examine your system and ask you questions
2141 to determine how the perl5 package should be installed. If you get
2142 stuck on a question, you may use a ! shell escape to start a subshell or
2143 execute a command.  Many of the questions will have default answers in square
2144 brackets; typing carriage return will give you the default.
2145
2146 On some of the questions which ask for file or directory names you are allowed
2147 to use the ~name construct to specify the login directory belonging to "name",
2148 even if you don't have a shell which knows about that.  Questions where this is
2149 allowed will be marked "(~name ok)".
2150
2151 EOH
2152         rp=''
2153         dflt='Type carriage return to continue'
2154         . ./myread
2155         cat <<'EOH'
2156
2157 The prompter used in this script allows you to use shell variables and
2158 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2159 in the default answer, as if the default line was a set of arguments given to a
2160 script shell.  This means you may also use $* to repeat the whole default line,
2161 so you do not have to re-type everything to add something to the default.
2162
2163 Everytime there is a substitution, you will have to confirm.  If there is an
2164 error (e.g. an unmatched backtick), the default answer will remain unchanged
2165 and you will be prompted again.
2166
2167 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2168 the questions and use the computed defaults (or the previous answers if there
2169 was already a config.sh file). Type 'Configure -h' for a list of options.
2170 You may also start interactively and then answer '& -d' at any prompt to turn
2171 on the non-interactive behaviour for the remainder of the execution.
2172
2173 EOH
2174         . ./myread
2175         cat <<EOH
2176
2177 Much effort has been expended to ensure that this shell script will run on any
2178 Unix system.  If despite that it blows up on yours, your best bet is to edit
2179 Configure and run it again.  If you can't run Configure for some reason,
2180 you'll have to generate a config.sh file by hand.  Whatever problems you
2181 have, let me (perlbug@perl.org) know how I blew it.
2182
2183 This installation script affects things in two ways:
2184
2185 1) it may do direct variable substitutions on some of the files included
2186    in this kit.
2187 2) it builds a config.h file for inclusion in C programs.  You may edit
2188    any of these files as the need arises after running this script.
2189
2190 If you make a mistake on a question, there is no easy way to back up to it
2191 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2192 files.  Configure will offer to let you do this before it runs the SH files.
2193
2194 EOH
2195         dflt='Type carriage return to continue'
2196         . ./myread
2197         case "$firsttime" in
2198         true) echo $user >>../.config/instruct;;
2199         esac
2200 fi
2201
2202 : find out where common programs are
2203 echo " "
2204 echo "Locating common programs..." >&4
2205 cat <<EOSC >loc
2206 $startsh
2207 case \$# in
2208 0) exit 1;;
2209 esac
2210 thing=\$1
2211 shift
2212 dflt=\$1
2213 shift
2214 for dir in \$*; do
2215         case "\$thing" in
2216         .)
2217         if test -d \$dir/\$thing; then
2218                 echo \$dir
2219                 exit 0
2220         fi
2221         ;;
2222         *)
2223         for thisthing in \$dir/\$thing; do
2224                 : just loop through to pick last item
2225         done
2226         if test -f \$thisthing; then
2227                 echo \$thisthing
2228                 exit 0
2229         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2230                 echo \$thisthing
2231                 exit 0
2232         elif test -f \$dir/\$thing.exe; then
2233                 if test -n "$DJGPP"; then
2234                         echo \$dir/\$thing.exe
2235                 elif test "$eunicefix" != ":"; then
2236                         : on Eunice apparently
2237                         echo \$dir/\$thing
2238                         exit 0
2239                 fi
2240                 exit 0
2241         fi
2242         ;;
2243         esac
2244 done
2245 echo \$dflt
2246 exit 1
2247 EOSC
2248 chmod +x loc
2249 $eunicefix loc
2250 loclist="
2251 awk
2252 cat
2253 chmod
2254 comm
2255 cp
2256 echo
2257 expr
2258 grep
2259 ls
2260 mkdir
2261 rm
2262 sed
2263 sort
2264 touch
2265 tr
2266 uniq
2267 "
2268 trylist="
2269 Mcc
2270 ar
2271 bison
2272 byacc
2273 cpp
2274 csh
2275 date
2276 egrep
2277 gmake
2278 gzip
2279 less
2280 ln
2281 make
2282 more
2283 nm
2284 nroff
2285 pg
2286 test
2287 uname
2288 zip
2289 "
2290 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2291 pth="$pth /lib /usr/lib"
2292 for file in $loclist; do
2293         eval xxx=\$$file
2294         case "$xxx" in
2295         /*|?:[\\/]*)
2296                 if test -f "$xxx"; then
2297                         : ok
2298                 else
2299                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2300                         xxx=`./loc $file $file $pth`
2301                 fi
2302                 ;;
2303         '') xxx=`./loc $file $file $pth`;;
2304         *) xxx=`./loc $xxx $xxx $pth`;;
2305         esac
2306         eval $file=$xxx$_exe
2307         eval _$file=$xxx
2308         case "$xxx" in
2309         /*)
2310                 echo $file is in $xxx.
2311                 ;;
2312         ?:[\\/]*)
2313                 echo $file is in $xxx.
2314                 ;;
2315         *)
2316                 echo "I don't know where '$file' is, and my life depends on it." >&4
2317                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2318                 exit 1
2319                 ;;
2320         esac
2321 done
2322 echo " "
2323 echo "Don't worry if any of the following aren't found..."
2324 say=offhand
2325 for file in $trylist; do
2326         eval xxx=\$$file
2327         case "$xxx" in
2328         /*|?:[\\/]*)
2329                 if test -f "$xxx"; then
2330                         : ok
2331                 else
2332                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2333                         xxx=`./loc $file $file $pth`
2334                 fi
2335                 ;;
2336         '') xxx=`./loc $file $file $pth`;;
2337         *) xxx=`./loc $xxx $xxx $pth`;;
2338         esac
2339         eval $file=$xxx$_exe
2340         eval _$file=$xxx
2341         case "$xxx" in
2342         /*)
2343                 echo $file is in $xxx.
2344                 ;;
2345         ?:[\\/]*)
2346                 echo $file is in $xxx.
2347                 ;;
2348         *)
2349                 echo "I don't see $file out there, $say."
2350                 say=either
2351                 ;;
2352         esac
2353 done
2354 case "$egrep" in
2355 egrep)
2356         echo "Substituting grep for egrep."
2357         egrep=$grep
2358         _egrep=$grep
2359         ;;
2360 esac
2361 case "$ln" in
2362 ln)
2363         echo "Substituting cp for ln."
2364         ln=$cp
2365         _ln=$cp
2366         ;;
2367 esac
2368 case "$make" in
2369 make)   
2370         case "$gmake" in
2371         gmake)
2372         echo "I can't find make or gmake, and my life depends on it." >&4
2373         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2374         exit 1
2375         ;;
2376         esac
2377         ;;
2378 esac    
2379 case "$gmake" in
2380 gmake)  ;;
2381 *)      # We can't have osname yet.
2382         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2383                 # Assume that gmake, if found, is definitely GNU make
2384                 # and prefer it over the system make.
2385                 echo "Substituting gmake for make."
2386                 make=$gmake
2387                 _make=$gmake
2388         fi
2389         ;;
2390 esac
2391 case "$test" in
2392 test)
2393         echo "Hopefully test is built into your sh."
2394         ;;
2395 *)
2396         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2397                 echo "Using the test built into your sh."
2398                 test=test
2399                 _test=test
2400         fi
2401         ;;
2402 esac
2403 case "$echo" in
2404 echo)
2405         echo "Hopefully echo is built into your sh."
2406         ;;
2407 '') ;;
2408 *)
2409         echo " "
2410 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2411         $echo $n "hi there$c" >foo1
2412         echo $n "hi there$c" >foo2
2413         if cmp foo1 foo2 >/dev/null 2>&1; then
2414                 echo "They are compatible.  In fact, they may be identical."
2415         else
2416                 case "$n" in
2417                 '-n') n='' c='\c';;
2418                 *) n='-n' c='';;
2419                 esac
2420                 cat <<FOO
2421 They are not compatible!  You are probably running ksh on a non-USG system.
2422 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2423 have echo built in and we may have to run some Bourne shell scripts.  That
2424 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2425
2426 FOO
2427                 $echo $n "The star should be here-->$c"
2428                 $echo "*"
2429         fi
2430         $rm -f foo1 foo2
2431         ;;
2432 esac
2433
2434 cat <<EOS >trygcc
2435 $startsh
2436 EOS
2437 cat <<'EOSC' >>trygcc
2438 case "$cc" in
2439 '') ;;
2440 *)  $rm -f try try.*
2441     $cat >try.c <<EOM
2442 int main(int argc, char *argv[]) {
2443   return 0;
2444 }
2445 EOM
2446     if $cc -o try $ccflags $ldflags try.c; then
2447        :
2448     else
2449         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2450         despair=yes
2451         trygcc=yes
2452         case "$cc" in
2453         *gcc*) trygcc=no ;;
2454         esac
2455         case "`$cc -v -c try.c 2>&1`" in
2456         *gcc*) trygcc=no ;;
2457         esac
2458         if $test X"$trygcc" = Xyes; then
2459             if gcc -o try -c try.c; then
2460                 echo " "
2461                 echo "You seem to have a working gcc, though." >&4
2462                 rp="Would you like to use it?"
2463                 dflt=y
2464                 if $test -f myread; then
2465                     . ./myread
2466                 else
2467                     if $test -f UU/myread; then
2468                         . ./UU/myread
2469                     else
2470                         echo "Cannot find myread, sorry.  Aborting." >&2
2471                         exit 1
2472                     fi
2473                 fi  
2474                 case "$ans" in
2475                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2476                        if $test -f usethreads.cbu; then
2477                            $cat >&4 <<EOM 
2478
2479 *** However, any setting of the C compiler flags (e.g. for thread support)
2480 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2481 *** (together with e.g. -Dusethreads).
2482
2483 EOM
2484                        fi;;
2485                 esac
2486             fi
2487         fi
2488     fi
2489     $rm -f try try.*
2490     ;;
2491 esac
2492 EOSC
2493
2494 cat <<EOS >checkcc
2495 $startsh
2496 EOS
2497 cat <<'EOSC' >>checkcc
2498 case "$cc" in        
2499 '') ;;
2500 *)  $rm -f try try.*              
2501     $cat >try.c <<EOM
2502 int main(int argc, char *argv[]) {
2503   return 0;
2504 }
2505 EOM
2506     if $cc -o try $ccflags $ldflags try.c; then
2507        :
2508     else
2509         if $test X"$despair" = Xyes; then
2510            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2511         fi
2512         $cat >&4 <<EOM         
2513 You need to find a working C compiler.
2514 Either (purchase and) install the C compiler supplied by your OS vendor,
2515 or for a free C compiler try http://gcc.gnu.org/
2516 I cannot continue any further, aborting.
2517 EOM
2518         exit 1
2519     fi
2520     $rm -f try try.*
2521     ;;
2522 esac
2523 EOSC
2524
2525 : determine whether symbolic links are supported
2526 echo " "
2527 $touch blurfl
2528 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2529         echo "Symbolic links are supported." >&4
2530         lns="$ln -s"
2531 else
2532         echo "Symbolic links are NOT supported." >&4
2533         lns="$ln"
2534 fi
2535 $rm -f blurfl sym
2536
2537 : determine whether symbolic links are supported
2538 echo " "
2539 case "$lns" in
2540 *"ln"*" -s")
2541         echo "Checking how to test for symbolic links..." >&4
2542         $lns blurfl sym
2543         if $test "X$issymlink" = X; then
2544                 case "$newsh" in
2545                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2546                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2547                 esac
2548                 if test $? = 0; then
2549                         issymlink="test -h"
2550                 else
2551                         echo "Your builtin 'test -h' may be broken." >&4
2552                         case "$test" in
2553                         /*)     ;;
2554                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2555                                 for p in $pth
2556                                 do
2557                                         if test -f "$p/$test"; then
2558                                                 test="$p/$test"
2559                                                 break
2560                                         fi
2561                                 done
2562                                 ;;
2563                         esac
2564                         case "$test" in
2565                         /*)
2566                                 echo "Trying external '$test -h'." >&4
2567                                 issymlink="$test -h"
2568                                 if $test ! -h sym >/dev/null 2>&1; then
2569                                         echo "External '$test -h' is broken, too." >&4
2570                                         issymlink=''
2571                                 fi
2572                                 ;;
2573                         *)      issymlink='' ;;
2574                         esac
2575                 fi              
2576         fi
2577         if $test "X$issymlink" = X; then
2578                 if $test -L sym 2>/dev/null; then
2579                         issymlink="$test -L"
2580                         echo "The builtin '$test -L' worked." >&4
2581                 fi
2582         fi
2583         if $test "X$issymlink" != X; then
2584                 echo "You can test for symbolic links with '$issymlink'." >&4
2585         else
2586                 echo "I do not know how you can test for symbolic links." >&4
2587         fi
2588         $rm -f blurfl sym
2589         ;;
2590 *)      echo "No symbolic links, so not testing for their testing..." >&4
2591         ;;
2592 esac
2593 echo " "
2594
2595
2596 case "$mksymlinks" in
2597 $define|true|[yY]*)
2598         case "$src" in
2599         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2600                 exit 1
2601                 ;;
2602         *)      case "$lns:$issymlink" in
2603                 *"ln"*" -s:"*"test -"?)
2604                         echo "Creating the symbolic links..." >&4
2605                         echo "(First creating the subdirectories...)" >&4
2606                         cd ..
2607                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2608                                 read directory
2609                                 test -z "$directory" && break
2610                                 mkdir -p $directory
2611                         done
2612                         # Sanity check 1.
2613                         if test ! -d t/base; then
2614                                 echo "Failed to create the subdirectories.  Aborting." >&4
2615                                 exit 1
2616                         fi
2617                         echo "(Then creating the symlinks...)" >&4
2618                         awk '{print $1}' $src/MANIFEST | while true; do
2619                                 read filename
2620                                 test -z "$filename" && break
2621                                 if test -f $filename; then
2622                                         if $issymlink $filename; then
2623                                                 rm -f $filename
2624                                         fi
2625                                 fi
2626                                 if test -f $filename; then
2627                                         echo "$filename already exists, not symlinking."
2628                                 else
2629                                         ln -s $src/$filename $filename
2630                                 fi
2631                         done
2632                         # Sanity check 2.
2633                         if test ! -f t/base/lex.t; then
2634                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2635                                 exit 1
2636                         fi
2637                         cd UU
2638                         ;;
2639                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2640                         ;;
2641                 esac
2642                 ;;
2643         esac
2644         ;;
2645 esac
2646
2647
2648 case "$usecrosscompile" in
2649 $define|true|[yY]*)
2650         $echo "Cross-compiling..."
2651         croak=''
2652         case "$cc" in
2653         *-*-gcc) # A cross-compiling gcc, probably.
2654             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2655             ar=$targetarch-ar
2656             # leave out ld, choosing it is more complex
2657             nm=$targetarch-nm
2658             ranlib=$targetarch-ranlib
2659             $echo 'extern int foo;' > try.c
2660             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2661             shift
2662             if $test $# -gt 0; then
2663                 incpth="$incpth $*"
2664                 incpth="`$echo $incpth|$sed 's/^ //'`"
2665                 echo "Guessing incpth '$incpth'." >&4
2666                 for i in $*; do
2667                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2668                     if $test -d $j; then
2669                         libpth="$libpth $j"
2670                     fi
2671                 done   
2672                 libpth="`$echo $libpth|$sed 's/^ //'`"
2673                 echo "Guessing libpth '$libpth'." >&4
2674             fi
2675             $rm -f try.c
2676             ;;
2677         esac
2678         case "$targetarch" in
2679         '') echo "Targetarch not defined." >&4; croak=y ;;
2680         *)  echo "Using targetarch $targetarch." >&4 ;;
2681         esac
2682         case "$incpth" in
2683         '') echo "Incpth not defined." >&4; croak=y ;;
2684         *)  echo "Using incpth '$incpth'." >&4 ;;
2685         esac
2686         case "$libpth" in
2687         '') echo "Libpth not defined." >&4; croak=y ;;
2688         *)  echo "Using libpth '$libpth'." >&4 ;;
2689         esac
2690         case "$usrinc" in
2691         '') for i in $incpth; do
2692                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2693                     usrinc=$i
2694                     echo "Guessing usrinc $usrinc." >&4
2695                     break
2696                 fi
2697             done
2698             case "$usrinc" in
2699             '') echo "Usrinc not defined." >&4; croak=y ;;
2700             esac
2701             ;;
2702         *)  echo "Using usrinc $usrinc." >&4 ;;
2703         esac
2704         case "$targethost" in
2705         '') echo "Targethost not defined." >&4; croak=y ;;
2706         *)  echo "Using targethost $targethost." >&4
2707         esac
2708         locincpth=' '
2709         loclibpth=' '
2710         case "$croak" in
2711         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2712         esac
2713         case "$src" in
2714         /*) run=$src/Cross/run
2715             targetmkdir=$src/Cross/mkdir
2716             to=$src/Cross/to
2717             from=$src/Cross/from
2718             ;;
2719         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2720             run=$pwd/Cross/run
2721             targetmkdir=$pwd/Cross/mkdir
2722             to=$pwd/Cross/to
2723             from=$pwd/Cross/from
2724             ;;
2725         esac
2726         case "$targetrun" in
2727         '') targetrun=ssh ;;
2728         esac
2729         case "$targetto" in
2730         '') targetto=scp ;;
2731         esac
2732         case "$targetfrom" in
2733         '') targetfrom=scp ;;
2734         esac
2735         run=$run-$targetrun
2736         to=$to-$targetto
2737         from=$from-$targetfrom
2738         case "$targetdir" in
2739         '')  targetdir=/tmp
2740              echo "Guessing targetdir $targetdir." >&4
2741              ;;
2742         esac
2743         case "$targetuser" in
2744         '')  targetuser=root
2745              echo "Guessing targetuser $targetuser." >&4
2746              ;;
2747         esac
2748         case "$targetfrom" in
2749         scp)    q=-q ;;
2750         *)      q='' ;;
2751         esac
2752         case "$targetrun" in
2753         ssh|rsh)
2754             cat >$run <<EOF
2755 #!/bin/sh
2756 case "\$1" in
2757 -cwd)
2758   shift
2759   cwd=\$1
2760   shift
2761   ;;
2762 esac
2763 case "\$cwd" in
2764 '') cwd=$targetdir ;;
2765 esac
2766 exe=\$1
2767 shift
2768 if $test ! -f \$exe.xok; then
2769   $to \$exe
2770   $touch \$exe.xok
2771 fi
2772 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2773 EOF
2774             ;;
2775         *)  echo "Unknown targetrun '$targetrun'" >&4
2776             exit 1
2777             ;;
2778         esac
2779         case "$targetmkdir" in
2780         */Cross/mkdir)
2781             cat >$targetmkdir <<EOF
2782 #!/bin/sh
2783 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2784 EOF
2785             $chmod a+rx $targetmkdir
2786             ;;
2787         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2788             exit 1
2789             ;;
2790         esac
2791         case "$targetto" in
2792         scp|rcp)
2793             cat >$to <<EOF
2794 #!/bin/sh
2795 for f in \$@
2796 do
2797   case "\$f" in
2798   /*)
2799     $targetmkdir \`dirname \$f\`
2800     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2801     ;;
2802   *)
2803     $targetmkdir $targetdir/\`dirname \$f\`
2804     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2805     ;;
2806   esac
2807 done
2808 exit 0
2809 EOF
2810             ;;
2811         cp) cat >$to <<EOF
2812 #!/bin/sh
2813 for f in \$@
2814 do
2815   case "\$f" in
2816   /*)
2817     $mkdir -p $targetdir/\`dirname \$f\`
2818     $cp \$f $targetdir/\$f || exit 1
2819     ;;
2820   *)
2821     $targetmkdir $targetdir/\`dirname \$f\`
2822     $cp \$f $targetdir/\$f || exit 1
2823     ;;
2824   esac
2825 done
2826 exit 0
2827 EOF
2828             ;;
2829         *)  echo "Unknown targetto '$targetto'" >&4
2830             exit 1
2831             ;;
2832         esac
2833         case "$targetfrom" in
2834         scp|rcp)
2835           cat >$from <<EOF
2836 #!/bin/sh
2837 for f in \$@
2838 do
2839   $rm -f \$f
2840   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2841 done
2842 exit 0
2843 EOF
2844             ;;
2845         cp) cat >$from <<EOF
2846 #!/bin/sh
2847 for f in \$@
2848 do
2849   $rm -f \$f
2850   cp $targetdir/\$f . || exit 1
2851 done
2852 exit 0
2853 EOF
2854             ;;
2855         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2856             exit 1
2857             ;;
2858         esac
2859         if $test ! -f $run; then
2860             echo "Target 'run' script '$run' not found." >&4
2861         else
2862             $chmod a+rx $run
2863         fi
2864         if $test ! -f $to; then
2865             echo "Target 'to' script '$to' not found." >&4
2866         else
2867             $chmod a+rx $to
2868         fi
2869         if $test ! -f $from; then
2870             echo "Target 'from' script '$from' not found." >&4
2871         else
2872             $chmod a+rx $from
2873         fi
2874         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2875             exit 1
2876         fi
2877         cat >&4 <<EOF
2878 Using '$run' for remote execution,
2879 and '$from' and '$to'
2880 for remote file transfer.
2881 EOF
2882         ;;
2883 *)      run=''
2884         to=:
2885         from=:
2886         usecrosscompile='undef'
2887         targetarch=''
2888         ;;
2889 esac
2890
2891 : see whether [:lower:] and [:upper:] are supported character classes
2892 echo " "
2893 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2894 ABYZ)
2895         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2896         up='[:upper:]'
2897         low='[:lower:]'
2898         ;;
2899 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2900         # (0xd9 and 0xe2), therefore that is a nice testing point.
2901         if test "X$up" = X -o "X$low" = X; then
2902             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2903             rs) up='[A-Z]'
2904                 low='[a-z]'
2905                 ;;
2906             esac
2907         fi
2908         if test "X$up" = X -o "X$low" = X; then
2909             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2910             rs) up='A-Z'
2911                 low='a-z'
2912                 ;;
2913             esac
2914         fi
2915         if test "X$up" = X -o "X$low" = X; then
2916             case "`echo RS | od -x 2>/dev/null`" in
2917             *D9E2*|*d9e2*)
2918                 echo "Hey, this might be EBCDIC." >&4
2919                 if test "X$up" = X -o "X$low" = X; then
2920                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2921                     rs) up='[A-IJ-RS-Z]'
2922                         low='[a-ij-rs-z]'
2923                         ;;
2924                     esac
2925                 fi
2926                 if test "X$up" = X -o "X$low" = X; then
2927                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2928                     rs) up='A-IJ-RS-Z'
2929                         low='a-ij-rs-z'
2930                         ;;
2931                     esac
2932                 fi
2933                 ;;
2934             esac
2935         fi
2936 esac
2937 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2938 rs)
2939     echo "Using $up and $low to convert case." >&4
2940     ;;
2941 *)
2942     echo "I don't know how to translate letters from upper to lower case." >&4
2943     echo "Your tr is not acting any way I know of." >&4
2944     exit 1
2945     ;;
2946 esac
2947 : set up the translation script tr, must be called with ./tr of course
2948 cat >tr <<EOSC
2949 $startsh
2950 case "\$1\$2" in
2951 '[A-Z][a-z]') exec $tr '$up' '$low';;
2952 '[a-z][A-Z]') exec $tr '$low' '$up';;
2953 esac
2954 exec $tr "\$@"
2955 EOSC
2956 chmod +x tr
2957 $eunicefix tr
2958
2959 : Try to determine whether config.sh was made on this system
2960 case "$config_sh" in
2961 '')
2962 myuname=`$uname -a 2>/dev/null`
2963 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2964 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2965 # because the A-Z/a-z are not consecutive.
2966 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2967         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2968 newmyuname="$myuname"
2969 dflt=n
2970 case "$knowitall" in
2971 '')
2972         if test -f ../config.sh; then
2973                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2974                         eval "`grep myuname= ../config.sh`"
2975                 fi
2976                 if test "X$myuname" = "X$newmyuname"; then
2977                         dflt=y
2978                 fi
2979         fi
2980         ;;
2981 *) dflt=y;;
2982 esac
2983
2984 : Get old answers from old config file if Configure was run on the
2985 : same system, otherwise use the hints.
2986 hint=default
2987 cd ..
2988 if test -f config.sh; then
2989         echo " "
2990         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2991         . UU/myread
2992         case "$ans" in
2993         n*|N*) echo "OK, I'll ignore it."
2994                 mv config.sh config.sh.old
2995                 myuname="$newmyuname"
2996                 ;;
2997         *)  echo "Fetching default answers from your old config.sh file..." >&4
2998                 tmp_n="$n"
2999                 tmp_c="$c"
3000                 tmp_sh="$sh"
3001                 . ./config.sh
3002                 cp config.sh UU
3003                 n="$tmp_n"
3004                 c="$tmp_c"
3005                 : Older versions did not always set $sh.  Catch re-use of such
3006                 : an old config.sh.
3007                 case "$sh" in
3008                 '') sh="$tmp_sh" ;;
3009                 esac
3010                 hint=previous
3011                 ;;
3012         esac
3013 fi
3014 . ./UU/checkcc
3015 if test ! -f config.sh; then
3016         $cat <<EOM
3017
3018 First time through, eh?  I have some defaults handy for some systems
3019 that need some extra help getting the Configure answers right:
3020
3021 EOM
3022         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3023         dflt=''
3024         : Half the following guesses are probably wrong... If you have better
3025         : tests or hints, please send them to perlbug@perl.org
3026         : The metaconfig authors would also appreciate a copy...
3027         $test -f /irix && osname=irix
3028         $test -f /xenix && osname=sco_xenix
3029         $test -f /dynix && osname=dynix
3030         $test -f /dnix && osname=dnix
3031         $test -f /lynx.os && osname=lynxos
3032         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3033         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3034         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3035         $test -f /bin/mips && /bin/mips && osname=mips
3036         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3037                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3038         $test -d /usr/apollo/bin && osname=apollo
3039         $test -f /etc/saf/_sactab && osname=svr4
3040         $test -d /usr/include/minix && osname=minix
3041         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3042         if $test -d /MachTen -o -d /MachTen_Folder; then
3043                 osname=machten
3044                 if $test -x /sbin/version; then
3045                         osvers=`/sbin/version | $awk '{print $2}' |
3046                         $sed -e 's/[A-Za-z]$//'`
3047                 elif $test -x /usr/etc/version; then
3048                         osvers=`/usr/etc/version | $awk '{print $2}' |
3049                         $sed -e 's/[A-Za-z]$//'`
3050                 else
3051                         osvers="$2.$3"
3052                 fi
3053         fi
3054
3055         $test -f /sys/posix.dll &&
3056                 $test -f /usr/bin/what &&
3057                 set X `/usr/bin/what /sys/posix.dll` &&
3058                 $test "$3" = UWIN &&
3059                 osname=uwin &&
3060                 osvers="$5"
3061
3062         if $test -f $uname; then
3063                 set X $myuname
3064                 shift
3065
3066                 case "$5" in
3067                 fps*) osname=fps ;;
3068                 mips*)
3069                         case "$4" in
3070                         umips) osname=umips ;;
3071                         *) osname=mips ;;
3072                         esac;;
3073                 [23]100) osname=mips ;;
3074                 next*) osname=next ;;
3075                 i386*)
3076                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3077                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3078                                 osname='sco'
3079                                 osvers=$tmp
3080                         elif $test -f /etc/kconfig; then
3081                                 osname=isc
3082                                 if test "$lns" = "$ln -s"; then
3083                                         osvers=4
3084                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3085                                         osvers=3
3086                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3087                                         osvers=2
3088                                 fi
3089                         fi
3090                         tmp=''
3091                         ;;
3092                 pc*)
3093                         if test -n "$DJGPP"; then
3094                                 osname=dos
3095                                 osvers=djgpp
3096                         fi
3097                         ;;
3098                 esac
3099
3100                 case "$1" in
3101                 aix) osname=aix
3102                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3103                         case "$tmp" in
3104                         # oslevel can fail with:
3105                         # oslevel: Unable to acquire lock.
3106                         *not\ found) osvers="$4"."$3" ;;
3107                         '<3240'|'<>3240') osvers=3.2.0 ;;
3108                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3109                         '=3250'|'>3250') osvers=3.2.5 ;;
3110                         *) osvers=$tmp;;
3111                         esac
3112                         ;;
3113                 bsd386) osname=bsd386
3114                         osvers=`$uname -r`
3115                         ;;
3116                 cygwin*) osname=cygwin
3117                         osvers="$3"
3118                         ;;
3119                 *dc.osx) osname=dcosx
3120                         osvers="$3"
3121                         ;;
3122                 dnix) osname=dnix
3123                         osvers="$3"
3124                         ;;
3125                 domainos) osname=apollo
3126                         osvers="$3"
3127                         ;;
3128                 dgux)   osname=dgux 
3129                         osvers="$3"
3130                         ;;
3131                 dynixptx*) osname=dynixptx
3132                         osvers=`echo "$4"|sed 's/^v//'`
3133                         ;;
3134                 freebsd) osname=freebsd 
3135                         osvers="$3" ;;
3136                 genix)  osname=genix ;;
3137                 gnu)    osname=gnu
3138                         osvers="$3" ;;
3139                 hp*)    osname=hpux 
3140                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3141                         ;;
3142                 irix*)  osname=irix
3143                         case "$3" in
3144                         4*) osvers=4 ;;
3145                         5*) osvers=5 ;;
3146                         *)      osvers="$3" ;;
3147                         esac
3148                         ;;
3149                 linux)  osname=linux
3150                         case "$3" in
3151                         *)      osvers="$3" ;;
3152                         esac
3153                         ;;
3154                 MiNT)   osname=mint
3155                         ;;
3156                 netbsd*) osname=netbsd
3157                         osvers="$3"
3158                         ;;
3159                 news-os) osvers="$3"
3160                         case "$3" in
3161                         4*) osname=newsos4 ;;
3162                         *) osname=newsos ;;
3163                         esac
3164                         ;;
3165                 next*) osname=next ;;
3166                 nonstop-ux) osname=nonstopux ;;
3167                 openbsd) osname=openbsd
3168                         osvers="$3"
3169                         ;;
3170                 os2)    osname=os2
3171                         osvers="$4"
3172                         ;;
3173                 POSIX-BC | posix-bc ) osname=posix-bc
3174                         osvers="$3"
3175                         ;;
3176                 powerux | power_ux | powermax_os | powermaxos | \
3177                 powerunix | power_unix) osname=powerux
3178                         osvers="$3"
3179                         ;;
3180                 qnx) osname=qnx
3181                         osvers="$4"
3182                         ;;
3183                 solaris) osname=solaris
3184                         case "$3" in
3185                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3186                         *)      osvers="$3" ;;
3187                         esac
3188                         ;;
3189                 sunos) osname=sunos
3190                         case "$3" in
3191                         5*) osname=solaris
3192                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3193                         *)      osvers="$3" ;;
3194                         esac
3195                         ;;
3196                 titanos) osname=titanos
3197                         case "$3" in
3198                         1*) osvers=1 ;;
3199                         2*) osvers=2 ;;
3200                         3*) osvers=3 ;;
3201                         4*) osvers=4 ;;
3202                         *)      osvers="$3" ;;
3203                         esac
3204                         ;;
3205                 ultrix) osname=ultrix
3206                         osvers="$3"
3207                         ;;
3208                 osf1|mls+)      case "$5" in
3209                                 alpha)
3210                                         osname=dec_osf
3211                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3212                                         case "$osvers" in
3213                                         [1-9].[0-9]*) ;;
3214                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3215                                         esac
3216                                         ;;
3217                         hp*)    osname=hp_osf1  ;;
3218                         mips)   osname=mips_osf1 ;;
3219                         esac
3220                         ;;
3221                 # UnixWare 7.1.2 is known as Open UNIX 8
3222                 openunix|unixware) osname=svr5
3223                         osvers="$4"
3224                         ;;
3225                 uts)    osname=uts
3226                         osvers="$3"
3227                         ;;
3228                 vos) osvers="$3"
3229                         ;;
3230                 $2) case "$osname" in
3231                         *isc*) ;;
3232                         *freebsd*) ;;
3233                         svr*)
3234                                 : svr4.x or possibly later
3235                                 case "svr$3" in 
3236                                 ${osname}*)
3237                                         osname=svr$3
3238                                         osvers=$4
3239                                         ;;
3240                                 esac
3241                                 case "$osname" in
3242                                 svr4.0)
3243                                         : Check for ESIX
3244                                         if test -f /stand/boot ; then
3245                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3246                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3247                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3248                                                         if test -n "$isesix"; then
3249                                                                 osname=esix4
3250                                                         fi
3251                                                 fi
3252                                         fi
3253                                         ;;
3254                                 esac
3255                                 ;;
3256                         *)      if test -f /etc/systemid; then
3257                                         osname=sco
3258                                         set `echo $3 | $sed 's/\./ /g'` $4
3259                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3260                                                 osvers=$1.$2.$3
3261                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3262                                                 osvers=$1.$2
3263                                         elif $test -f $src/hints/sco_$1.sh; then
3264                                                 osvers=$1
3265                                         fi
3266                                 else
3267                                         case "$osname" in
3268                                         '') : Still unknown.  Probably a generic Sys V.
3269                                                 osname="sysv"
3270                                                 osvers="$3"
3271                                                 ;;
3272                                         esac
3273                                 fi
3274                                 ;;
3275                         esac
3276                         ;;
3277                 *)      case "$osname" in
3278                         '') : Still unknown.  Probably a generic BSD.
3279                                 osname="$1"
3280                                 osvers="$3"
3281                                 ;;
3282                         esac
3283                         ;;
3284                 esac
3285         else
3286                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3287                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3288                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3289                                 osname=news_os
3290                         fi
3291                         $rm -f UU/kernel.what
3292                 elif test -d c:/. -o -n "$is_os2" ; then
3293                         set X $myuname
3294                         osname=os2
3295                         osvers="$5"
3296                 fi
3297         fi
3298         
3299         case "$targetarch" in
3300         '') ;;
3301         *)  hostarch=$osname
3302             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3303             osvers=''
3304             ;;
3305         esac
3306
3307         : Now look for a hint file osname_osvers, unless one has been
3308         : specified already.
3309         case "$hintfile" in
3310         ''|' ')
3311                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3312                 : Also try without trailing minor version numbers.
3313                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3314                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3315                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3316                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3317                 case "$file" in
3318                 '') dflt=none ;;
3319                 *)  case "$osvers" in
3320                         '') dflt=$file
3321                                 ;;
3322                         *)  if $test -f $src/hints/$file.sh ; then
3323                                         dflt=$file
3324                                 elif $test -f $src/hints/$xfile.sh ; then
3325                                         dflt=$xfile
3326                                 elif $test -f $src/hints/$xxfile.sh ; then
3327                                         dflt=$xxfile
3328                                 elif $test -f $src/hints/$xxxfile.sh ; then
3329                                         dflt=$xxxfile
3330                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3331                                         dflt=$xxxxfile
3332                                 elif $test -f "$src/hints/${osname}.sh" ; then
3333                                         dflt="${osname}"
3334                                 else
3335                                         dflt=none
3336                                 fi
3337                                 ;;
3338                         esac
3339                         ;;
3340                 esac
3341                 if $test -f Policy.sh ; then
3342                         case "$dflt" in
3343                         *Policy*) ;;
3344                         none) dflt="Policy" ;;
3345                         *) dflt="Policy $dflt" ;;
3346                         esac
3347                 fi
3348                 ;;
3349         *)
3350                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3351                 ;;
3352         esac
3353
3354         if $test -f Policy.sh ; then
3355                 $cat <<EOM
3356
3357 There's also a Policy hint file available, which should make the
3358 site-specific (policy) questions easier to answer.
3359 EOM
3360
3361         fi
3362
3363         $cat <<EOM
3364
3365 You may give one or more space-separated answers, or "none" if appropriate.
3366 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3367 is a good thing.  DO NOT give a wrong version or a wrong OS.
3368
3369 EOM
3370
3371         rp="Which of these apply, if any?"
3372         . UU/myread
3373         tans=$ans
3374         for file in $tans; do
3375                 if $test X$file = XPolicy -a -f Policy.sh; then
3376                         . Policy.sh
3377                         $cat Policy.sh >> UU/config.sh
3378                 elif $test -f $src/hints/$file.sh; then
3379                         . $src/hints/$file.sh
3380                         $cat $src/hints/$file.sh >> UU/config.sh
3381                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3382                         : nothing
3383                 else
3384                         : Give one chance to correct a possible typo.
3385                         echo "$file.sh does not exist"
3386                         dflt=$file
3387                         rp="hint to use instead?"
3388                         . UU/myread
3389                         for file in $ans; do
3390                                 if $test -f "$src/hints/$file.sh"; then
3391                                         . $src/hints/$file.sh
3392                                         $cat $src/hints/$file.sh >> UU/config.sh
3393                                 elif $test X$ans = X -o X$ans = Xnone ; then
3394                                         : nothing
3395                                 else
3396                                         echo "$file.sh does not exist -- ignored."
3397                                 fi
3398                         done
3399                 fi
3400         done
3401
3402         hint=recommended
3403         : Remember our hint file for later.
3404         if $test -f "$src/hints/$file.sh" ; then
3405                 hintfile="$file"
3406         else
3407                 hintfile=''
3408         fi
3409 fi
3410 cd UU
3411 ;;
3412 *)
3413         echo " "
3414         echo "Fetching default answers from $config_sh..." >&4
3415         tmp_n="$n"
3416         tmp_c="$c"
3417         cd ..
3418         cp $config_sh config.sh 2>/dev/null
3419         chmod +w config.sh
3420         . ./config.sh
3421         cd UU
3422         cp ../config.sh .
3423         n="$tmp_n"
3424         c="$tmp_c"
3425         hint=previous
3426         ;;
3427 esac
3428 test "$override" && . ./optdef.sh
3429
3430 : Restore computed paths
3431 for file in $loclist $trylist; do
3432         eval $file="\$_$file"
3433 done
3434
3435 cat << EOM
3436
3437 Configure uses the operating system name and version to set some defaults.
3438 The default value is probably right if the name rings a bell. Otherwise,
3439 since spelling matters for me, either accept the default or answer "none"
3440 to leave it blank.
3441
3442 EOM
3443 case "$osname" in
3444         ''|' ')
3445                 case "$hintfile" in
3446                 ''|' '|none) dflt=none ;;
3447                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3448                 esac
3449                 ;;
3450         *) dflt="$osname" ;;
3451 esac
3452 rp="Operating system name?"
3453 . ./myread
3454 case "$ans" in
3455 none)  osname='' ;;
3456 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3457 esac
3458 echo " "
3459 case "$osvers" in
3460         ''|' ')
3461                 case "$hintfile" in
3462                 ''|' '|none) dflt=none ;;
3463                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3464                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3465                         case "$dflt" in
3466                         ''|' ') dflt=none ;;
3467                         esac
3468                         ;;
3469                 esac
3470                 ;;
3471         *) dflt="$osvers" ;;
3472 esac
3473 rp="Operating system version?"
3474 . ./myread
3475 case "$ans" in
3476 none)  osvers='' ;;
3477 *) osvers="$ans" ;;
3478 esac
3479
3480
3481 . ./posthint.sh
3482
3483 : who configured the system
3484 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3485 case "$cf_by" in
3486 "")
3487         cf_by=`(logname) 2>/dev/null`
3488         case "$cf_by" in
3489         "")
3490                 cf_by=`(whoami) 2>/dev/null`
3491                 case "$cf_by" in
3492                 "") cf_by=unknown ;;
3493                 esac ;;
3494         esac ;;
3495 esac
3496
3497 : set up the script used to warn in case of inconsistency
3498 cat <<EOS >whoa
3499 $startsh
3500 EOS
3501 cat <<'EOSC' >>whoa
3502 dflt=y
3503 echo " "
3504 echo "*** WHOA THERE!!! ***" >&4
3505 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3506 rp="    Keep the $hint value?"
3507 . ./myread
3508 case "$ans" in
3509 y) td=$was; tu=$was;;
3510 esac
3511 EOSC
3512
3513 : function used to set $1 to $val
3514 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3515 case "$val$was" in
3516 $define$undef) . ./whoa; eval "$var=\$td";;
3517 $undef$define) . ./whoa; eval "$var=\$tu";;
3518 *) eval "$var=$val";;
3519 esac'
3520
3521 case "$usesocks" in
3522 $define|true|[yY]*)     dflt='y';;
3523 *) dflt='n';;
3524 esac
3525 cat <<EOM
3526
3527 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3528 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3529 to use the PerlIO abstraction layer, this will be implicitly selected.
3530
3531 If this doesn't make any sense to you, just accept the default '$dflt'.
3532 EOM
3533 rp='Build Perl for SOCKS?'
3534 . ./myread
3535 case "$ans" in
3536 y|Y)    val="$define" ;;     
3537 *)      val="$undef" ;;
3538 esac
3539 set usesocks
3540 eval $setvar
3541
3542 case "$usesocks" in
3543 $define|true|[yY]*) useperlio="$define";;
3544 esac
3545
3546 case "$useperlio" in
3547 $define|true|[yY]*|'')  dflt='y';;
3548 *) dflt='n';;
3549 esac
3550 cat <<EOM
3551
3552 Previous version of $package used the standard IO mechanisms as
3553 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
3554 alternate IO mechanisms via the PerlIO abstraction layer, but the
3555 stdio mechanism is still available if needed.  The abstraction layer
3556 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3557 Using PerlIO with sfio may cause problems with some extension modules.
3558
3559 If this doesn't make any sense to you, just accept the default '$dflt'.
3560 EOM
3561 rp='Use the PerlIO abstraction layer?'
3562 . ./myread
3563 case "$ans" in
3564 y|Y) 
3565         val="$define"
3566         ;;
3567 *)      
3568         echo "Ok, doing things the stdio way."
3569         val="$undef"
3570         ;;
3571 esac
3572 set useperlio
3573 eval $setvar 
3574
3575 case "$usesocks" in
3576 $define|true|[yY]*)
3577         case "$useperlio" in
3578         $define|true|[yY]*) ;;
3579         *)      cat >&4 <<EOM
3580
3581 You are using the SOCKS proxy protocol library which means that you
3582 should also use the PerlIO layer.  You may be headed for trouble.
3583
3584 EOM
3585                 ;;
3586         esac
3587         ;;
3588 esac
3589
3590         
3591 case "$usethreads" in
3592 $define|true|[yY]*)     dflt='y';;
3593 *)     # Catch case where user specified ithreads or 5005threads but
3594        # forgot -Dusethreads (A.D. 4/2002)
3595        case "$useithreads$use5005threads" in
3596        *$define*)      
3597                 case "$useperlio" in
3598                 "$define")      dflt='y' ;;
3599                 *)              dflt='n' ;;
3600                 esac
3601                 ;;
3602        *)       dflt='n';;
3603        esac
3604        ;;
3605 esac
3606 cat <<EOM
3607
3608 Perl can be built to take advantage of threads on some systems.
3609 To do so, Configure can be run with -Dusethreads.
3610
3611 Note that Perl built with threading support runs slightly slower
3612 and uses more memory than plain Perl. The current implementation
3613 is believed to be stable, but it is fairly new, and so should be
3614 treated with caution.
3615
3616 If this doesn't make any sense to you, just accept the default '$dflt'.
3617 EOM
3618 rp='Build a threading Perl?'
3619 . ./myread
3620 case "$ans" in
3621 y|Y)    val="$define" ;;
3622 *)      val="$undef" ;;
3623 esac
3624 set usethreads
3625 eval $setvar
3626
3627 case "$usethreads" in
3628 $define)
3629         $cat <<EOM
3630
3631 Since release 5.6, Perl has had two different threading implementations,
3632 the newer interpreter-based version (ithreads) with one interpreter per
3633 thread, and the older 5.005 version (5005threads).
3634 The 5005threads version is effectively unmaintained and will probably be
3635 removed in Perl 5.10, so there should be no need to build a Perl using it
3636 unless needed for backwards compatibility with some existing 5.005threads
3637 code.
3638
3639 EOM
3640         : Default to ithreads unless overridden on command line or with
3641         : old config.sh
3642         dflt='y'
3643         case "$use5005threads" in
3644                 $define|true|[yY]*) dflt='n';;
3645         esac
3646         case "$useithreads" in
3647                 $undef|false|[nN]*) dflt='n';;
3648         esac
3649         rp='Use the newer interpreter-based ithreads?'
3650         . ./myread
3651         case "$ans" in
3652         y|Y)    val="$define" ;;
3653         *)      val="$undef" ;;
3654         esac
3655         set useithreads
3656         eval $setvar
3657         : Now set use5005threads to the opposite value.
3658         case "$useithreads" in
3659         $define) val="$undef" ;;
3660         *) val="$define" ;;
3661         esac
3662         set use5005threads
3663         eval $setvar
3664         ;;
3665 *)
3666         useithreads="$undef"
3667         use5005threads="$undef"
3668         ;;
3669 esac
3670
3671 case "$useithreads$use5005threads" in
3672 "$define$define")
3673         $cat >&4 <<EOM
3674
3675 You cannot have both the ithreads and the 5.005 threads enabled
3676 at the same time.  Disabling the 5.005 threads since they are
3677 much less stable than the ithreads.
3678
3679 EOM
3680         use5005threads="$undef"
3681         ;;
3682 esac
3683
3684 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
3685         cat >&4 <<EOF
3686 ***
3687 *** To build with ithreads you must also use the PerlIO layer.
3688 *** Cannot continue, aborting.
3689 ***
3690 EOF
3691         exit 1
3692 fi
3693
3694 case "$d_oldpthreads" in
3695 '')     : Configure tests would be welcome here.  For now, assume undef.
3696         val="$undef" ;;
3697 *)      val="$d_oldpthreads" ;;
3698 esac
3699 set d_oldpthreads
3700 eval $setvar
3701
3702
3703 : Look for a hint-file generated 'call-back-unit'.  If the
3704 : user has specified that a threading perl is to be built,
3705 : we may need to set or change some other defaults.
3706 if $test -f usethreads.cbu; then
3707     echo "Your platform has some specific hints regarding threaded builds, using them..."
3708     . ./usethreads.cbu
3709 else
3710     case "$usethreads" in
3711         "$define"|true|[yY]*)
3712                 $cat <<EOM
3713 (Your platform does not have any specific hints for threaded builds.
3714  Assuming POSIX threads, then.)
3715 EOM
3716         ;;
3717     esac
3718 fi
3719
3720 cat <<EOM
3721
3722 Perl can be built so that multiple Perl interpreters can coexist
3723 within the same Perl executable.
3724 EOM
3725
3726 case "$useithreads" in
3727 $define)
3728         cat <<EOM
3729 This multiple interpreter support is required for interpreter-based threads.
3730 EOM
3731         val="$define"
3732         ;;
3733 *)      case "$usemultiplicity" in
3734         $define|true|[yY]*)     dflt='y';;
3735         *) dflt='n';;
3736         esac
3737         echo " "
3738         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3739         rp='Build Perl for multiplicity?'
3740         . ./myread
3741         case "$ans" in
3742         y|Y)    val="$define" ;;
3743         *)      val="$undef" ;;
3744         esac
3745         ;;
3746 esac
3747 set usemultiplicity
3748 eval $setvar
3749
3750
3751 case "$usemorebits" in
3752 "$define"|true|[yY]*)
3753         use64bitint="$define"
3754         uselongdouble="$define"
3755         usemorebits="$define"
3756         ;;
3757 *)      usemorebits="$undef"
3758         ;;
3759 esac
3760
3761 : make some quick guesses about what we are up against
3762 echo " "
3763 $echo $n "Hmm...  $c"
3764 echo exit 1 >bsd
3765 echo exit 1 >usg
3766 echo exit 1 >v7
3767 echo exit 1 >osf1
3768 echo exit 1 >eunice
3769 echo exit 1 >xenix
3770 echo exit 1 >venix
3771 echo exit 1 >os2
3772 d_bsd="$undef"
3773 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3774 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3775 then
3776         echo "Looks kind of like an OSF/1 system, but we'll see..."
3777         echo exit 0 >osf1
3778 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3779         xxx=`./loc addbib blurfl $pth`
3780         if $test -f $xxx; then
3781         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3782                 echo exit 0 >bsd
3783                 echo exit 0 >usg
3784         else
3785                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3786                         echo "Looks kind of like an extended USG system, but we'll see..."
3787                 else
3788                         echo "Looks kind of like a USG system, but we'll see..."
3789                 fi
3790                 echo exit 0 >usg
3791         fi
3792 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3793         echo "Looks kind of like a BSD system, but we'll see..."
3794         d_bsd="$define"
3795         echo exit 0 >bsd
3796 else
3797         echo "Looks kind of like a Version 7 system, but we'll see..."
3798         echo exit 0 >v7
3799 fi
3800 case "$eunicefix" in
3801 *unixtovms*)
3802         $cat <<'EOI'
3803 There is, however, a strange, musty smell in the air that reminds me of
3804 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3805 EOI
3806         echo exit 0 >eunice
3807         d_eunice="$define"
3808 : it so happens the Eunice I know will not run shell scripts in Unix format
3809         ;;
3810 *)
3811         echo " "
3812         echo "Congratulations.  You aren't running Eunice."
3813         d_eunice="$undef"
3814         ;;
3815 esac
3816 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3817 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3818 : semicolon as a patch separator
3819 case "$p_" in
3820 :) ;;
3821 *)
3822         $cat <<'EOI'
3823 I have the feeling something is not exactly right, however...don't tell me...
3824 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3825 (Or you may be running DOS with DJGPP.)
3826 EOI
3827         echo exit 0 >os2
3828         ;;
3829 esac
3830 if test -f /xenix; then
3831         echo "Actually, this looks more like a XENIX system..."
3832         echo exit 0 >xenix
3833         d_xenix="$define"
3834 else
3835         echo " "
3836         echo "It's not Xenix..."
3837         d_xenix="$undef"
3838 fi
3839 chmod +x xenix
3840 $eunicefix xenix
3841 if test -f /venix; then
3842         echo "Actually, this looks more like a VENIX system..."
3843         echo exit 0 >venix
3844 else
3845         echo " "
3846         if ./xenix; then
3847                 : null
3848         else
3849                 echo "Nor is it Venix..."
3850         fi
3851 fi
3852 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3853 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3854 $rm -f foo
3855
3856 case "$cc" in
3857 '') dflt=cc;;
3858 *) dflt="$cc";;
3859 esac
3860 rp="Use which C compiler?"
3861 . ./myread
3862 cc="$ans"
3863
3864 : See if they have not cc but they do have gcc
3865 . ./trygcc
3866 : Look for a hint-file generated 'call-back-unit'.  Now that the
3867 : user has specified the compiler, we may need to set or change some
3868 : other defaults.
3869 if $test -f cc.cbu; then
3870     . ./cc.cbu
3871 fi
3872 . ./checkcc
3873
3874 echo " "
3875 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3876 $cat >try.c <<EOM
3877 #include <stdio.h>
3878 int main() {
3879 #ifdef __GNUC__
3880 #ifdef __VERSION__
3881         printf("%s\n", __VERSION__);
3882 #else
3883         printf("%s\n", "1");
3884 #endif
3885 #endif
3886         return(0);
3887 }
3888 EOM
3889 if $cc -o try $ccflags $ldflags try.c; then
3890         gccversion=`$run ./try`
3891         case "$gccversion" in
3892         '') echo "You are not using GNU cc." ;;
3893         *)  echo "You are using GNU cc $gccversion."
3894             ccname=gcc
3895             ;;
3896         esac
3897 else
3898         echo " "
3899         echo "*** WHOA THERE!!! ***" >&4
3900         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3901         case "$knowitall" in
3902         '')
3903         echo "    You'd better start hunting for one and let me know about it." >&4
3904                 exit 1
3905                 ;;
3906         esac
3907 fi
3908 $rm -f try try.*
3909 case "$gccversion" in
3910 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3911 esac
3912 case "$gccversion" in
3913 '') gccosandvers='' ;;
3914 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3915    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3916    gccshortvers=''
3917    case "$gccosandvers" in
3918    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3919    $osname$osvers) ;; # looking good
3920    $osname*) cat <<EOM >&4
3921
3922 *** WHOA THERE!!! ***
3923
3924     Your gcc has not been compiled for the exact release of
3925     your operating system ($gccosandvers versus $osname$osvers).
3926
3927     In general it is a good idea to keep gcc synchronized with
3928     the operating system because otherwise serious problems
3929     may ensue when trying to compile software, like Perl.
3930
3931     I'm trying to be optimistic here, though, and will continue.
3932     If later during the configuration and build icky compilation
3933     problems appear (headerfile conflicts being the most common
3934     manifestation), I suggest reinstalling the gcc to match
3935     your operating system release.
3936
3937 EOM
3938       ;;
3939    *) gccosandvers='' ;; # failed to parse, better be silent
3940    esac
3941    ;;
3942 esac
3943 case "$ccname" in
3944 '') ccname="$cc" ;;
3945 esac
3946
3947 # gcc 3.* complain about adding -Idirectories that they already know about,
3948 # so we will take those off from locincpth.
3949 case "$gccversion" in
3950 3*)
3951     echo "main(){}">try.c
3952     for incdir in $locincpth; do
3953        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
3954              grep '^c[cp]p*[01]: warning: changing search order '`
3955        if test "X$warn" != X; then
3956            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
3957        fi
3958     done
3959     $rm -f try try.*
3960 esac
3961
3962 : decide how portable to be.  Allow command line overrides.
3963 case "$d_portable" in
3964 "$undef") ;;
3965 *)      d_portable="$define" ;;
3966 esac
3967
3968 : set up shell script to do ~ expansion
3969 cat >filexp <<EOSS
3970 $startsh
3971 : expand filename
3972 case "\$1" in
3973  ~/*|~)
3974         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3975         ;;
3976  ~*)
3977         if $test -f /bin/csh; then
3978                 /bin/csh -f -c "glob \$1"
3979                 failed=\$?
3980                 echo ""
3981                 exit \$failed
3982         else
3983                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3984                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3985                 if $test ! -d "\$dir"; then
3986                         me=\`basename \$0\`
3987                         echo "\$me: can't locate home directory for: \$name" >&2
3988                         exit 1
3989                 fi
3990                 case "\$1" in
3991                 */*)
3992                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3993                         ;;
3994                 *)
3995                         echo \$dir
3996                         ;;
3997                 esac
3998         fi
3999         ;;
4000 *)
4001         echo \$1
4002         ;;
4003 esac
4004 EOSS
4005 chmod +x filexp
4006 $eunicefix filexp
4007
4008 : now set up to get a file name
4009 cat <<EOS >getfile
4010 $startsh
4011 EOS
4012 cat <<'EOSC' >>getfile
4013 tilde=''
4014 fullpath=''
4015 already=''
4016 skip=''
4017 none_ok=''
4018 exp_file=''
4019 nopath_ok=''
4020 orig_rp="$rp"
4021 orig_dflt="$dflt"
4022 case "$gfpth" in
4023 '') gfpth='.' ;;
4024 esac
4025
4026 case "$fn" in
4027 *\(*)
4028         : getfile will accept an answer from the comma-separated list
4029         : enclosed in parentheses even if it does not meet other criteria.
4030         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
4031         fn=`echo $fn | sed 's/(.*)//'`
4032         ;;
4033 esac
4034
4035 case "$fn" in
4036 *:*)
4037         loc_file=`expr $fn : '.*:\(.*\)'`
4038         fn=`expr $fn : '\(.*\):.*'`
4039         ;;
4040 esac
4041
4042 case "$fn" in
4043 *~*) tilde=true;;
4044 esac
4045 case "$fn" in
4046 */*) fullpath=true;;
4047 esac
4048 case "$fn" in
4049 *+*) skip=true;;
4050 esac
4051 case "$fn" in
4052 *n*) none_ok=true;;
4053 esac
4054 case "$fn" in
4055 *e*) exp_file=true;;
4056 esac
4057 case "$fn" in
4058 *p*) nopath_ok=true;;
4059 esac
4060
4061 case "$fn" in
4062 *f*) type='File';;
4063 *d*) type='Directory';;
4064 *l*) type='Locate';;
4065 esac
4066
4067 what="$type"
4068 case "$what" in
4069 Locate) what='File';;
4070 esac
4071
4072 case "$exp_file" in
4073 '')
4074         case "$d_portable" in
4075         "$define") ;;
4076         *) exp_file=true;;
4077         esac
4078         ;;
4079 esac
4080
4081 cd ..
4082 while test "$type"; do
4083         redo=''
4084         rp="$orig_rp"
4085         dflt="$orig_dflt"
4086         case "$tilde" in
4087         true) rp="$rp (~name ok)";;
4088         esac
4089         . UU/myread
4090         if test -f UU/getfile.ok && \
4091                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4092         then
4093                 value="$ans"
4094                 ansexp="$ans"
4095                 break
4096         fi
4097         case "$ans" in
4098         none)
4099                 value=''
4100                 ansexp=''
4101                 case "$none_ok" in
4102                 true) type='';;
4103                 esac
4104                 ;;
4105         *)
4106                 case "$tilde" in
4107                 '') value="$ans"
4108                         ansexp="$ans";;
4109                 *)
4110                         value=`UU/filexp $ans`
4111                         case $? in
4112                         0)
4113                                 if test "$ans" != "$value"; then
4114                                         echo "(That expands to $value on this system.)"
4115                                 fi
4116                                 ;;
4117                         *) value="$ans";;
4118                         esac
4119                         ansexp="$value"
4120                         case "$exp_file" in
4121                         '') value="$ans";;
4122                         esac
4123                         ;;
4124                 esac
4125                 case "$fullpath" in
4126                 true)
4127                         case "$ansexp" in
4128                         /*) value="$ansexp" ;;
4129                         [a-zA-Z]:/*) value="$ansexp" ;;
4130                         *)
4131                                 redo=true
4132                                 case "$already" in
4133                                 true)
4134                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4135                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4136                                         ;;
4137                                 *)
4138                                 echo "Please give a full path name, starting with slash." >&4
4139                                         case "$tilde" in
4140                                         true)
4141                                 echo "Note that using ~name is ok provided it expands well." >&4
4142                                                 already=true
4143                                                 ;;
4144                                         esac
4145                                 esac
4146                                 ;;
4147                         esac
4148                         ;;
4149                 esac
4150                 case "$redo" in
4151                 '')
4152                         case "$type" in
4153                         File)
4154                                 for fp in $gfpth; do
4155                                         if test "X$fp" = X.; then
4156                                             pf="$ansexp"
4157                                         else    
4158                                             pf="$fp/$ansexp"
4159                                         fi
4160                                         if test -f "$pf"; then
4161                                                 type=''
4162                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4163                                         then
4164                                                 echo "($value is not a plain file, but that's ok.)"
4165                                                 type=''
4166                                         fi
4167                                         if test X"$type" = X; then
4168                                             value="$pf"
4169                                             break
4170                                         fi
4171                                 done
4172                                 ;;
4173                         Directory)
4174                                 for fp in $gfpth; do
4175                                         if test "X$fp" = X.; then
4176                                             dir="$ans"
4177                                             direxp="$ansexp"
4178                                         else    
4179                                             dir="$fp/$ansexp"
4180                                             direxp="$fp/$ansexp"
4181                                         fi
4182                                         if test -d "$direxp"; then
4183                                                 type=''
4184                                                 value="$dir"
4185                                                 break
4186                                         fi
4187                                 done
4188                                 ;;
4189                         Locate)
4190                                 if test -d "$ansexp"; then
4191                                         echo "(Looking for $loc_file in directory $value.)"
4192                                         value="$value/$loc_file"
4193                                         ansexp="$ansexp/$loc_file"
4194                                 fi
4195                                 if test -f "$ansexp"; then
4196                                         type=''
4197                                 fi
4198                                 case "$nopath_ok" in
4199                                 true)   case "$value" in
4200                                         */*) ;;
4201                                         *)      echo "Assuming $value will be in people's path."
4202                                                 type=''
4203                                                 ;;
4204                                         esac
4205                                         ;;
4206                                 esac
4207                                 ;;
4208                         esac
4209
4210                         case "$skip" in
4211                         true) type='';
4212                         esac
4213
4214                         case "$type" in
4215                         '') ;;
4216                         *)
4217                                 if test "$fastread" = yes; then
4218                                         dflt=y
4219                                 else
4220                                         dflt=n
4221                                 fi
4222                                 rp="$what $value doesn't exist.  Use that name anyway?"
4223                                 . UU/myread
4224                                 dflt=''
4225                                 case "$ans" in
4226                                 y*) type='';;
4227                                 *) echo " ";;
4228                                 esac
4229                                 ;;
4230                         esac
4231                         ;;
4232                 esac
4233                 ;;
4234         esac
4235 done
4236 cd UU
4237 ans="$value"
4238 rp="$orig_rp"
4239 dflt="$orig_dflt"
4240 rm -f getfile.ok
4241 test "X$gfpthkeep" != Xy && gfpth=""
4242 EOSC
4243
4244 : What should the include directory be ?
4245 echo " "
4246 $echo $n "Hmm...  $c"
4247 dflt='/usr/include'
4248 incpath=''
4249 mips_type=''
4250 if $test -f /bin/mips && /bin/mips; then
4251         echo "Looks like a MIPS system..."
4252         $cat >usr.c <<'EOCP'
4253 #ifdef SYSTYPE_BSD43
4254 /bsd43
4255 #endif
4256 EOCP
4257         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4258                 dflt='/bsd43/usr/include'
4259                 incpath='/bsd43'
4260                 mips_type='BSD 4.3'
4261         else
4262                 mips_type='System V'
4263         fi
4264         $rm -f usr.c usr.out
4265         echo "and you're compiling with the $mips_type compiler and libraries."
4266         xxx_prompt=y
4267         echo "exit 0" >mips
4268 else
4269         echo "Doesn't look like a MIPS system."
4270         xxx_prompt=n
4271         echo "exit 1" >mips
4272 fi
4273 chmod +x mips
4274 $eunicefix mips
4275 case "$usrinc" in
4276 '') ;;
4277 *) dflt="$usrinc";;
4278 esac
4279 case "$xxx_prompt" in
4280 y)      fn=d/
4281         echo " "
4282         rp='Where are the include files you want to use?'
4283         . ./getfile
4284         usrinc="$ans"
4285         ;;
4286 *)      usrinc="$dflt"
4287         ;;
4288 esac
4289
4290 : see how we invoke the C preprocessor
4291 echo " "
4292 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4293 cat <<'EOT' >testcpp.c
4294 #define ABC abc
4295 #define XYZ xyz
4296 ABC.XYZ
4297 EOT
4298 cd ..
4299 if test ! -f cppstdin; then
4300         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4301                 # AIX cc -E doesn't show the absolute headerfile
4302                 # locations but we'll cheat by using the -M flag.
4303                 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
4304         else
4305                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4306         fi
4307 else
4308         echo "Keeping your $hint cppstdin wrapper."
4309 fi
4310 chmod 755 cppstdin
4311 wrapper=`pwd`/cppstdin
4312 ok='false'
4313 cd UU
4314
4315 if $test "X$cppstdin" != "X" && \
4316         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4317         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4318 then
4319         echo "You used to use $cppstdin $cppminus so we'll use that again."
4320         case "$cpprun" in
4321         '') echo "But let's see if we can live without a wrapper..." ;;
4322         *)
4323                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4324                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4325                 then
4326                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4327                         ok='true'
4328                 else
4329                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4330                 fi
4331                 ;;
4332         esac
4333 else
4334         case "$cppstdin" in
4335         '') ;;
4336         *)
4337                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4338                 ;;
4339         esac
4340 fi
4341
4342 if $ok; then
4343         : nothing
4344 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4345         $cc -E <testcpp.c >testcpp.out 2>&1; \
4346         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4347         echo "Yup, it does."
4348         x_cpp="$cc -E"
4349         x_minus='';
4350 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4351         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4352         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4353         echo "Yup, it does."
4354         x_cpp="$cc -E"
4355         x_minus='-';
4356 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4357         $cc -P <testcpp.c >testcpp.out 2>&1; \
4358         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4359         echo "Yipee, that works!"
4360         x_cpp="$cc -P"
4361         x_minus='';
4362 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4363         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4364         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4365         echo "At long last!"
4366         x_cpp="$cc -P"
4367         x_minus='-';
4368 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4369         $cpp <testcpp.c >testcpp.out 2>&1; \
4370         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4371         echo "It works!"
4372         x_cpp="$cpp"
4373         x_minus='';
4374 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4375         $cpp - <testcpp.c >testcpp.out 2>&1; \
4376         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4377         echo "Hooray, it works!  I was beginning to wonder."
4378         x_cpp="$cpp"
4379         x_minus='-';
4380 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4381         $wrapper <testcpp.c >testcpp.out 2>&1; \
4382         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4383         x_cpp="$wrapper"
4384         x_minus=''
4385         echo "Eureka!"
4386 else
4387         dflt=''
4388         rp="No dice.  I can't find a C preprocessor.  Name one:"
4389         . ./myread
4390         x_cpp="$ans"
4391         x_minus=''
4392         $x_cpp <testcpp.c >testcpp.out 2>&1
4393         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4394                 echo "OK, that will do." >&4
4395         else
4396 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4397                 exit 1
4398         fi
4399 fi
4400
4401 case "$ok" in
4402 false)
4403         cppstdin="$x_cpp"
4404         cppminus="$x_minus"
4405         cpprun="$x_cpp"
4406         cpplast="$x_minus"
4407         set X $x_cpp
4408         shift
4409         case "$1" in
4410         "$cpp")
4411                 echo "Perhaps can we force $cc -E using a wrapper..."
4412                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4413                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4414                 then
4415                         echo "Yup, we can."
4416                         cppstdin="$wrapper"
4417                         cppminus='';
4418                 else
4419                         echo "Nope, we'll have to live without it..."
4420                 fi
4421                 ;;
4422         esac
4423         case "$cpprun" in
4424         "$wrapper")
4425                 cpprun=''
4426                 cpplast=''
4427                 ;;
4428         esac
4429         ;;
4430 esac
4431
4432 case "$cppstdin" in
4433 "$wrapper"|'cppstdin') ;;
4434 *) $rm -f $wrapper;;
4435 esac
4436 $rm -f testcpp.c testcpp.out
4437
4438 : Set private lib path
4439 case "$plibpth" in
4440 '') if ./mips; then
4441                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4442         fi;;
4443 esac
4444 case "$libpth" in
4445 ' ') dlist='';;
4446 '') dlist="$loclibpth $plibpth $glibpth";;
4447 *) dlist="$libpth";;
4448 esac
4449
4450 : Now check and see which directories actually exist, avoiding duplicates
4451 libpth=''
4452 for xxx in $dlist
4453 do
4454     if $test -d $xxx; then
4455                 case " $libpth " in
4456                 *" $xxx "*) ;;
4457                 *) libpth="$libpth $xxx";;
4458                 esac
4459     fi
4460 done
4461 $cat <<'EOM'
4462
4463 Some systems have incompatible or broken versions of libraries.  Among
4464 the directories listed in the question below, please remove any you
4465 know not to be holding relevant libraries, and add any that are needed.
4466 Say "none" for none.
4467
4468 EOM
4469 case "$libpth" in
4470 '') dflt='none';;
4471 *)
4472         set X $libpth
4473         shift
4474         dflt=${1+"$@"}
4475         ;;
4476 esac
4477 rp="Directories to use for library searches?"
4478 . ./myread
4479 case "$ans" in
4480 none) libpth=' ';;
4481 *) libpth="$ans";;
4482 esac
4483
4484 : compute shared library extension
4485 case "$so" in
4486 '')
4487         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4488                 dflt='sl'
4489         else
4490                 dflt='so'
4491         fi
4492         ;;
4493 *) dflt="$so";;
4494 esac
4495 $cat <<EOM
4496
4497 On some systems, shared libraries may be available.  Answer 'none' if
4498 you want to suppress searching of shared libraries for the remainder
4499 of this configuration.
4500
4501 EOM
4502 rp='What is the file extension used for shared libraries?'
4503 . ./myread
4504 so="$ans"
4505
4506 : Define several unixisms.
4507 : Hints files or command line option can be used to override them.
4508 : The convoluted testing is in case hints files set either the old
4509 : or the new name.
4510 case "$_exe" in
4511 '')     case "$exe_ext" in
4512         '')     ;;
4513         *)      _exe="$exe_ext" ;;
4514         esac
4515         ;;
4516 esac
4517 case "$_a" in
4518 '')     case "$lib_ext" in
4519     '') _a='.a';;
4520         *)      _a="$lib_ext" ;;
4521         esac
4522         ;;
4523 esac
4524 case "$_o" in
4525 '') case "$obj_ext" in
4526         '')     _o='.o';;
4527         *)      _o="$obj_ext";;
4528         esac
4529         ;;
4530 esac
4531 case "$p_" in
4532 '') case "$path_sep" in
4533         '')     p_=':';;
4534         *)      p_="$path_sep";;
4535         esac
4536         ;;
4537 esac
4538 exe_ext=$_exe
4539 lib_ext=$_a
4540 obj_ext=$_o
4541 path_sep=$p_
4542
4543 : Which makefile gets called first.  This is used by make depend.
4544 case "$firstmakefile" in
4545 '') firstmakefile='makefile';;
4546 esac
4547
4548 case "$ccflags" in
4549 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4550 esac
4551
4552 case "$uselongdouble" in
4553 $define|true|[yY]*)     dflt='y';;
4554 *) dflt='n';;
4555 esac
4556 cat <<EOM
4557
4558 Perl can be built to take advantage of long doubles which
4559 (if available) may give more accuracy and range for floating point numbers.
4560
4561 If this doesn't make any sense to you, just accept the default '$dflt'.
4562 EOM
4563 rp='Try to use long doubles if available?'
4564 . ./myread
4565 case "$ans" in
4566 y|Y)    val="$define"   ;;
4567 *)      val="$undef"    ;;
4568 esac
4569 set uselongdouble
4570 eval $setvar
4571
4572 case "$uselongdouble" in
4573 true|[yY]*) uselongdouble="$define" ;;
4574 esac
4575
4576 : Look for a hint-file generated 'call-back-unit'.  If the
4577 : user has specified that long doubles should be used,
4578 : we may need to set or change some other defaults.
4579 if $test -f uselongdouble.cbu; then
4580     echo "Your platform has some specific hints regarding long doubles, using them..."
4581     . ./uselongdouble.cbu
4582 else
4583     case "$uselongdouble" in
4584         $define)
4585                 $cat <<EOM
4586 (Your platform does not have any specific hints for long doubles.)
4587 EOM
4588         ;;
4589     esac
4590 fi
4591
4592 : Looking for optional libraries
4593 echo " "
4594 echo "Checking for optional libraries..." >&4
4595 case "$libs" in
4596 ' '|'') dflt='';;
4597 *) dflt="$libs";;
4598 esac
4599 case "$libswanted" in
4600 '') libswanted='c_s';;
4601 esac
4602 case "$usesocks" in
4603 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4604 esac
4605 libsfound=''
4606 libsfiles=''
4607 libsdirs=''
4608 libspath=''
4609 for thisdir in $libpth $xlibpth; do
4610   test -d $thisdir && libspath="$libspath $thisdir"
4611 done
4612 for thislib in $libswanted; do
4613         for thisdir in $libspath; do
4614             xxx=''
4615             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4616                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4617                 $test -f "$xxx" && eval $libscheck
4618                 $test -f "$xxx" && libstyle=shared
4619             fi
4620             if test ! -f "$xxx"; then
4621                 xxx=$thisdir/lib$thislib.$so
4622                 $test -f "$xxx" && eval $libscheck
4623                 $test -f "$xxx" && libstyle=shared
4624             fi  
4625             if test ! -f "$xxx"; then
4626                 xxx=$thisdir/lib$thislib$_a
4627                 $test -f "$xxx" && eval $libscheck
4628                 $test -f "$xxx" && libstyle=static
4629             fi
4630             if test ! -f "$xxx"; then
4631                 xxx=$thisdir/$thislib$_a
4632                 $test -f "$xxx" && eval $libscheck
4633                 $test -f "$xxx" && libstyle=static
4634             fi
4635             if test ! -f "$xxx"; then
4636                 xxx=$thisdir/lib${thislib}_s$_a
4637                 $test -f "$xxx" && eval $libscheck
4638                 $test -f "$xxx" && libstyle=static
4639                 $test -f "$xxx" && thislib=${thislib}_s
4640             fi
4641             if test ! -f "$xxx"; then
4642                 xxx=$thisdir/Slib$thislib$_a
4643                 $test -f "$xxx" && eval $libscheck
4644                 $test -f "$xxx" && libstyle=static
4645             fi
4646             if $test -f "$xxx"; then
4647                 case "$libstyle" in
4648                 shared) echo "Found -l$thislib (shared)." ;;
4649                 static) echo "Found -l$thislib." ;;
4650                 *)      echo "Found -l$thislib ($libstyle)." ;;
4651                 esac
4652                 case " $dflt " in
4653                 *"-l$thislib "*);;
4654                 *) dflt="$dflt -l$thislib"
4655                    libsfound="$libsfound $xxx"
4656                    yyy=`basename $xxx`
4657                    libsfiles="$libsfiles $yyy"
4658                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4659                    case " $libsdirs " in
4660                    *" $yyy "*) ;;
4661                    *) libsdirs="$libsdirs $yyy" ;;
4662                    esac
4663                    ;;
4664                 esac
4665                 break
4666             fi  
4667         done
4668         if $test ! -f "$xxx"; then
4669             echo "No -l$thislib."
4670         fi
4671 done
4672 set X $dflt
4673 shift
4674 dflt="$*"
4675 case "$libs" in
4676 '') dflt="$dflt";;
4677 *) dflt="$libs";;
4678 esac
4679 case "$dflt" in
4680 ' '|'') dflt='none';;
4681 esac
4682
4683 $cat <<EOM
4684
4685 In order to compile $package on your machine, a number of libraries
4686 are usually needed.  Include any other special libraries here as well.
4687 Say "none" for none.  The default list is almost always right.
4688 EOM
4689
4690 echo " "
4691 rp="What libraries to use?"
4692 . ./myread
4693 case "$ans" in
4694 none) libs=' ';;
4695 *) libs="$ans";;
4696 esac
4697
4698 : determine optimization, if desired, or use for debug flag also
4699 case "$optimize" in
4700 ' '|$undef) dflt='none';;
4701 '') dflt='-O';;
4702 *) dflt="$optimize";;
4703 esac
4704 $cat <<EOH
4705
4706 By default, $package compiles with the -O flag to use the optimizer.
4707 Alternately, you might want to use the symbolic debugger, which uses
4708 the -g flag (on traditional Unix systems).  Either flag can be
4709 specified here.  To use neither flag, specify the word "none".
4710
4711 EOH
4712 rp="What optimizer/debugger flag should be used?"
4713 . ./myread
4714 optimize="$ans"
4715 case "$optimize" in
4716 'none') optimize=" ";;
4717 esac
4718
4719 dflt=''
4720 : We will not override a previous value, but we might want to
4721 : augment a hint file
4722 case "$hint" in
4723 default|recommended)
4724         case "$gccversion" in
4725         1*) dflt='-fpcc-struct-return' ;;
4726         esac
4727         case "$optimize" in
4728         *-g*) dflt="$dflt -DDEBUGGING";;
4729         esac
4730         case "$gccversion" in
4731         2*) if test -d /etc/conf/kconfig.d &&
4732                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4733                 then
4734                         # Interactive Systems (ISC) POSIX mode.
4735                         dflt="$dflt -posix"
4736                 fi
4737                 ;;
4738         esac
4739         case "$gccversion" in
4740         1*) ;;
4741         2.[0-8]*) ;;
4742         ?*)     echo " "
4743                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4744                 echo 'int main(void) { return 0; }' > gcctest.c
4745                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4746                         echo "Yes, it does." 2>&1
4747                         case "$ccflags" in
4748                         *strict-aliasing*)
4749                                 echo "Leaving current flags $ccflags alone." 2>&1
4750                                 ;;
4751                         *) dflt="$dflt -fno-strict-aliasing" ;;
4752                         esac
4753                 else
4754                         echo "Nope, it doesn't, but that's ok." 2>&1
4755                 fi
4756                 ;;
4757         esac
4758         # For gcc, adding -pipe speeds up compilations for some, but apparently
4759         # some assemblers can't read from stdin.  (It also slows down compilations
4760         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
4761         case "$gccversion" in
4762         ?*)     echo " "
4763                 echo "Checking if your compiler accepts -pipe" 2>&1
4764                 echo 'int main(void) { return 0; }' > gcctest.c
4765                 if $cc -pipe -o gcctest gcctest.c; then
4766                         echo "Yes, it does." 2>&1
4767                         case "$ccflags" in
4768                         *-pipe*)
4769                                 echo "Leaving current flags $ccflags alone." 2>&1
4770                                 ;;
4771                         *) dflt="$dflt -pipe" ;;
4772                         esac
4773                 else
4774                         echo "Nope, it doesn't, but that's ok." 2>&1
4775                 fi
4776
4777                 echo "Checking if your compiler accepts -Wdeclaration-after-statement" 2>&1
4778                 echo 'int main(void) { return 0; }' > gcctest.c
4779                 if $cc -Wdeclaration-after-statement -o gcctest gcctest.c; then
4780                         echo "Yes, it does." 2>&1
4781                         case "$ccflags" in
4782                         *-Wdeclaration-after-statement*)
4783                                 echo "Leaving current flags $ccflags alone." 2>&1
4784                                 ;;
4785                         *) dflt="$dflt -Wdeclaration-after-statement" ;;
4786                         esac
4787                 else
4788                         echo "Nope, it doesn't, but that's ok." 2>&1
4789                 fi
4790                 ;;
4791         esac
4792         ;;
4793 esac
4794
4795 case "$mips_type" in
4796 *BSD*|'') inclwanted="$locincpth $usrinc";;
4797 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4798 esac
4799 for thisincl in $inclwanted; do
4800         if $test -d $thisincl; then
4801                 if $test x$thisincl != x$usrinc; then
4802                         case "$dflt" in
4803                         *" -I$thisincl "*);;
4804                         *) dflt="$dflt -I$thisincl ";;
4805                         esac
4806                 fi
4807         fi
4808 done
4809
4810 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4811         xxx=true;
4812 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4813         xxx=true;
4814 else
4815         xxx=false;
4816 fi;
4817 if $xxx; then
4818         case "$dflt" in
4819         *$2*);;
4820         *) dflt="$dflt -D$2";;
4821         esac;
4822 fi'
4823
4824 set signal.h LANGUAGE_C; eval $inctest
4825
4826 case "$usesocks" in
4827 $define)
4828         ccflags="$ccflags -DSOCKS"
4829         ;;
4830 esac
4831
4832 case "$hint" in
4833 default|recommended) dflt="$ccflags $dflt" ;;
4834 *) dflt="$ccflags";;
4835 esac
4836
4837 case "$dflt" in
4838 ''|' ') dflt=none;;
4839 esac
4840
4841 $cat <<EOH
4842
4843 Your C compiler may want other flags.  For this question you should include
4844 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4845 but you should NOT include libraries or ld flags like -lwhatever.  If you
4846 want $package to honor its debug switch, you should include -DDEBUGGING here.
4847 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4848
4849 To use no flags, specify the word "none".
4850
4851 EOH
4852 set X $dflt
4853 shift
4854 dflt=${1+"$@"}
4855 rp="Any additional cc flags?"
4856 . ./myread
4857 case "$ans" in
4858 none) ccflags='';;
4859 *) ccflags="$ans";;
4860 esac
4861
4862 : the following weeds options from ccflags that are of no interest to cpp
4863 case "$cppflags" in
4864 '') cppflags="$ccflags" ;;
4865 *)  cppflags="$cppflags $ccflags" ;;
4866 esac
4867 case "$gccversion" in
4868 1*) cppflags="$cppflags -D__GNUC__"
4869 esac
4870 case "$mips_type" in
4871 '');;
4872 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4873 esac
4874 case "$cppflags" in
4875 '');;
4876 *)
4877         echo " "
4878         echo "Let me guess what the preprocessor flags are..." >&4
4879         set X $cppflags
4880         shift
4881         cppflags=''
4882         $cat >cpp.c <<'EOM'
4883 #define BLURFL foo
4884
4885 BLURFL xx LFRULB
4886 EOM
4887         previous=''
4888         for flag in $*
4889         do
4890                 case "$flag" in
4891                 -*) ftry="$flag";;
4892                 *) ftry="$previous $flag";;
4893                 esac
4894                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4895                         >cpp1.out 2>/dev/null && \
4896                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4897                         >cpp2.out 2>/dev/null && \
4898                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4899                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4900                 then
4901                         cppflags="$cppflags $ftry"
4902                         previous=''
4903                 else
4904                         previous="$flag"
4905                 fi
4906         done
4907         set X $cppflags
4908         shift
4909         cppflags=${1+"$@"}
4910         case "$cppflags" in
4911         *-*)  echo "They appear to be: $cppflags";;
4912         esac
4913         $rm -f cpp.c cpp?.out
4914         ;;
4915 esac
4916
4917 : flags used in final linking phase
4918 case "$ldflags" in
4919 '') if ./venix; then
4920                 dflt='-i -z'
4921         else
4922                 dflt=''
4923         fi
4924         case "$ccflags" in
4925         *-posix*) dflt="$dflt -posix" ;;
4926         esac
4927         ;;
4928 *) dflt="$ldflags";;
4929 esac
4930
4931 : Try to guess additional flags to pick up local libraries.
4932 for thislibdir in $libpth; do
4933         case " $loclibpth " in
4934         *" $thislibdir "*)
4935                 case "$dflt " in
4936                 *"-L$thislibdir "*) ;;
4937                 *)  dflt="$dflt -L$thislibdir" ;;
4938                 esac
4939                 ;;
4940         esac
4941 done
4942
4943 case "$dflt" in
4944 '') dflt='none' ;;
4945 esac
4946
4947 $cat <<EOH
4948
4949 Your C linker may need flags.  For this question you should
4950 include -L/whatever and any other flags used by the C linker, but you
4951 should NOT include libraries like -lwhatever.
4952
4953 Make sure you include the appropriate -L/path flags if your C linker
4954 does not normally search all of the directories you specified above,
4955 namely
4956         $libpth
4957 To use no flags, specify the word "none".
4958
4959 EOH
4960
4961 rp="Any additional ld flags (NOT including libraries)?"
4962 . ./myread
4963 case "$ans" in
4964 none) ldflags='';;
4965 *) ldflags="$ans";;
4966 esac
4967 rmlist="$rmlist pdp11"
4968
4969 : coherency check
4970 echo " "
4971 echo "Checking your choice of C compiler and flags for coherency..." >&4
4972 $cat > try.c <<'EOF'
4973 #include <stdio.h>
4974 int main() { printf("Ok\n"); return(0); }
4975 EOF
4976 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4977 shift
4978 $cat >try.msg <<'EOM'
4979 I've tried to compile and run the following simple program:
4980
4981 EOM
4982 $cat try.c >> try.msg
4983
4984 $cat >> try.msg <<EOM
4985
4986 I used the command:
4987
4988         $*
4989         $run ./try
4990
4991 and I got the following output:
4992
4993 EOM
4994 dflt=y
4995 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4996         if $sh -c "$run ./try" >>try.msg 2>&1; then
4997                 xxx=`$run ./try`
4998                 case "$xxx" in
4999                 "Ok") dflt=n ;;
5000                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5001                         case " $libs " in
5002                         *" -lsfio "*)
5003                                 cat >> try.msg <<'EOQS'
5004 If $libs contains -lsfio, and sfio is mis-configured, then it
5005 sometimes (apparently) runs and exits with a 0 status, but with no
5006 output!  It may have to do with sfio's use of _exit vs. exit.
5007
5008 EOQS
5009                                 rp="You have a big problem.  Shall I abort Configure"
5010                                 dflt=y
5011                                 ;;
5012                         esac
5013                         ;;
5014                 esac
5015         else
5016                 echo "The program compiled OK, but exited with status $?." >>try.msg
5017                 rp="You have a problem.  Shall I abort Configure"
5018                 dflt=y
5019         fi
5020 else
5021         echo "I can't compile the test program." >>try.msg
5022         rp="You have a BIG problem.  Shall I abort Configure"
5023         dflt=y
5024 fi
5025 case "$dflt" in
5026 y)
5027         $cat try.msg >&4
5028         case "$knowitall" in
5029         '')
5030                 echo "(The supplied flags or libraries might be incorrect.)"
5031                 ;;
5032         *) dflt=n;;
5033         esac
5034         echo " "
5035         . ./myread
5036         case "$ans" in
5037         n*|N*) ;;
5038         *)      echo "Ok.  Stopping Configure." >&4
5039                 exit 1
5040                 ;;
5041         esac
5042         ;;
5043 n) echo "OK, that should do.";;
5044 esac
5045 $rm -f try try.* core
5046
5047 : define a shorthand compile call
5048 compile='
5049 mc_file=$1;
5050 shift;
5051 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5052 : define a shorthand compile call for compilations that should be ok.
5053 compile_ok='
5054 mc_file=$1;
5055 shift;
5056 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5057
5058 : determine filename position in cpp output
5059 echo " "
5060 echo "Computing filename position in cpp output for #include directives..." >&4
5061 case "$osname" in
5062 vos) testaccess=-e ;;
5063 *)   testaccess=-r ;;
5064 esac
5065 echo '#include <stdio.h>' > foo.c
5066 $cat >fieldn <<EOF
5067 $startsh
5068 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5069 $grep '^[       ]*#.*stdio\.h' | \
5070 while read cline; do
5071         pos=1
5072         set \$cline
5073         while $test \$# -gt 0; do
5074                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5075                         echo "\$pos"
5076                         exit 0
5077                 fi
5078                 shift
5079                 pos=\`expr \$pos + 1\`
5080         done
5081 done
5082 EOF
5083 chmod +x fieldn
5084 fieldn=`./fieldn`
5085 $rm -f foo.c fieldn
5086 case $fieldn in
5087 '') pos='???';;
5088 1) pos=first;;
5089 2) pos=second;;
5090 3) pos=third;;
5091 *) pos="${fieldn}th";;
5092 esac
5093 echo "Your cpp writes the filename in the $pos field of the line."
5094
5095 case "$osname" in
5096 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5097 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5098 *)   cppfilter='' ;;
5099 esac
5100 : locate header file
5101 $cat >findhdr <<EOF
5102 $startsh
5103 wanted=\$1
5104 name=''
5105 for usrincdir in $usrinc
5106 do
5107         if test -f \$usrincdir/\$wanted; then
5108                 echo "\$usrincdir/\$wanted"
5109                 exit 0
5110         fi
5111 done
5112 awkprg='{ print \$$fieldn }'
5113 echo "#include <\$wanted>" > foo\$\$.c
5114 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5115 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5116 while read cline; do
5117         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5118         case "\$name" in
5119         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5120         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5121         *) exit 2;;
5122         esac;
5123 done;
5124 #
5125 # status = 0: grep returned 0 lines, case statement not executed
5126 # status = 1: headerfile found
5127 # status = 2: while loop executed, no headerfile found
5128 #
5129 status=\$?
5130 $rm -f foo\$\$.c;
5131 if test \$status -eq 1; then
5132         exit 0;
5133 fi
5134 exit 1
5135 EOF
5136 chmod +x findhdr
5137
5138 : define an alternate in-header-list? function
5139 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5140 cont=true; xxf="echo \"<\$1> found.\" >&4";
5141 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5142 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5143 esac;
5144 case $# in 4) instead=instead;; *) instead="at last";; esac;
5145 while $test "$cont"; do
5146         xxx=`./findhdr $1`
5147         var=$2; eval "was=\$$2";
5148         if $test "$xxx" && $test -r "$xxx";
5149         then eval $xxf;
5150         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5151                 cont="";
5152         else eval $xxnf;
5153         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5154         set $yyy; shift; shift; yyy=$@;
5155         case $# in 0) cont="";;
5156         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5157                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5158         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5159                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5160         esac;
5161 done;
5162 while $test "$yyy";
5163 do set $yyy; var=$2; eval "was=\$$2";
5164         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5165         set $yyy; shift; shift; yyy=$@;
5166 done'
5167
5168 : see if stdlib is available
5169 set stdlib.h i_stdlib
5170 eval $inhdr
5171
5172 : check for lengths of integral types
5173 echo " "
5174 case "$intsize" in
5175 '')
5176         echo "Checking to see how big your integers are..." >&4
5177         $cat >try.c <<EOCP
5178 #include <stdio.h>
5179 #$i_stdlib I_STDLIB
5180 #ifdef I_STDLIB
5181 #include <stdlib.h>
5182 #endif
5183 int main()
5184 {
5185         printf("intsize=%d;\n", (int)sizeof(int));
5186         printf("longsize=%d;\n", (int)sizeof(long));
5187         printf("shortsize=%d;\n", (int)sizeof(short));
5188         exit(0);
5189 }
5190 EOCP
5191         set try
5192         if eval $compile_ok && $run ./try > /dev/null; then
5193                 eval `$run ./try`
5194                 echo "Your integers are $intsize bytes long."
5195                 echo "Your long integers are $longsize bytes long."
5196                 echo "Your short integers are $shortsize bytes long."
5197         else
5198                 $cat >&4 <<EOM
5199 !
5200 Help! I can't compile and run the intsize test program: please enlighten me!
5201 (This is probably a misconfiguration in your system or libraries, and
5202 you really ought to fix it.  Still, I'll try anyway.)
5203 !
5204 EOM
5205                 dflt=4
5206                 rp="What is the size of an integer (in bytes)?"
5207                 . ./myread
5208                 intsize="$ans"
5209                 dflt=$intsize
5210                 rp="What is the size of a long integer (in bytes)?"
5211                 . ./myread
5212                 longsize="$ans"
5213                 dflt=2
5214                 rp="What is the size of a short integer (in bytes)?"
5215                 . ./myread
5216                 shortsize="$ans"
5217         fi
5218         ;;
5219 esac
5220 $rm -f try try.*
5221
5222 : check for long long
5223 echo " "
5224 echo "Checking to see if you have long long..." >&4
5225 echo 'int main() { long long x = 7; return 0; }' > try.c
5226 set try
5227 if eval $compile; then
5228         val="$define"
5229         echo "You have long long."
5230 else
5231         val="$undef"
5232         echo "You do not have long long."
5233 fi
5234 $rm try.*
5235 set d_longlong
5236 eval $setvar
5237
5238 : check for length of long long
5239 case "${d_longlong}${longlongsize}" in
5240 $define)
5241         echo " "
5242         echo "Checking to see how big your long longs are..." >&4
5243         $cat >try.c <<'EOCP'
5244 #include <stdio.h>
5245 int main()
5246 {
5247     printf("%d\n", (int)sizeof(long long));
5248     return(0);
5249 }
5250 EOCP
5251         set try
5252         if eval $compile_ok; then
5253                 longlongsize=`$run ./try`
5254                 echo "Your long longs are $longlongsize bytes long."
5255         else
5256                 dflt='8'
5257                 echo " "
5258                 echo "(I can't seem to compile the test program.  Guessing...)"
5259                 rp="What is the size of a long long (in bytes)?"
5260                 . ./myread
5261                 longlongsize="$ans"
5262         fi
5263         if $test "X$longsize" = "X$longlongsize"; then
5264                 echo "(That isn't any different from an ordinary long.)"
5265         fi      
5266         ;;
5267 esac
5268 $rm -f try.* try
5269
5270 : see if inttypes.h is available
5271 : we want a real compile instead of Inhdr because some systems
5272 : have an inttypes.h which includes non-existent headers
5273 echo " "
5274 $cat >try.c <<EOCP
5275 #include <inttypes.h>
5276 int main() {
5277         static int32_t foo32 = 0x12345678;
5278 }
5279 EOCP
5280 set try
5281 if eval $compile; then
5282         echo "<inttypes.h> found." >&4
5283         val="$define"
5284 else
5285         echo "<inttypes.h> NOT found." >&4
5286         val="$undef"
5287 fi
5288 $rm -f try.c try
5289 set i_inttypes
5290 eval $setvar
5291
5292 : check for int64_t
5293 echo " "
5294 echo "Checking to see if you have int64_t..." >&4
5295 $cat >try.c <<EOCP
5296 #include <sys/types.h>
5297 #$i_inttypes I_INTTYPES
5298 #ifdef I_INTTYPES
5299 #include <inttypes.h>
5300 #endif
5301 int main() { int64_t x = 7; }
5302 EOCP
5303 set try
5304 if eval $compile; then
5305         val="$define"
5306         echo "You have int64_t."
5307 else
5308         val="$undef"
5309         echo "You do not have int64_t."
5310 fi
5311 $rm -f try try.*
5312 set d_int64_t
5313 eval $setvar
5314
5315
5316 echo " "
5317 echo "Checking which 64-bit integer type we could use..." >&4
5318
5319 case "$intsize" in
5320 8) val=int
5321    set quadtype
5322    eval $setvar
5323    val='"unsigned int"'
5324    set uquadtype
5325    eval $setvar
5326    quadkind=1
5327    ;;
5328 *) case "$longsize" in
5329    8) val=long
5330       set quadtype
5331       eval $setvar
5332       val='"unsigned long"'
5333       set uquadtype
5334       eval $setvar
5335       quadkind=2
5336       ;;
5337    *) case "$d_longlong:$longlongsize" in
5338       define:8)
5339         val='"long long"'
5340         set quadtype
5341         eval $setvar
5342         val='"unsigned long long"'
5343         set uquadtype
5344         eval $setvar
5345         quadkind=3
5346         ;;
5347       *) case "$d_int64_t" in
5348          define)
5349            val=int64_t
5350            set quadtype
5351            eval $setvar
5352            val=uint64_t
5353            set uquadtype
5354            eval $setvar
5355            quadkind=4
5356            ;;
5357          esac
5358          ;;
5359       esac
5360       ;;
5361    esac
5362    ;;
5363 esac
5364
5365 case "$quadtype" in
5366 '')     echo "Alas, no 64-bit integer types in sight." >&4
5367         d_quad="$undef"
5368         ;;
5369 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5370         d_quad="$define"
5371         ;;
5372 esac
5373
5374
5375 case "$uselonglong" in
5376 "$define"|true|[yY]*)
5377         cat <<EOM >&4
5378
5379 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5380 EOM
5381         use64bitint="$define"
5382         ;;
5383 esac                          
5384 case "$use64bits" in
5385 "$define"|true|[yY]*)
5386         cat <<EOM >&4
5387
5388 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5389 EOM
5390         use64bitint="$define"
5391         ;;
5392 esac                          
5393 case "$use64bitints" in
5394 "$define"|true|[yY]*)
5395         cat <<EOM >&4
5396
5397 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5398 EOM
5399         use64bitint="$define"
5400         ;;
5401 esac                          
5402 case "$use64bitsint" in
5403 "$define"|true|[yY]*)
5404         cat <<EOM >&4
5405
5406 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5407 EOM
5408         use64bitint="$define"
5409         ;;
5410 esac                          
5411 case "$uselonglongs" in
5412 "$define"|true|[yY]*)
5413         cat <<EOM >&4
5414
5415 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5416 EOM
5417         use64bitint="$define"
5418         ;;
5419 esac                          
5420 case "$use64bitsall" in
5421 "$define"|true|[yY]*)
5422         cat <<EOM >&4
5423
5424 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5425 EOM
5426         use64bitall="$define"
5427         ;;
5428 esac                          
5429
5430 case "$ccflags" in
5431 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5432 esac
5433 case "$use64bitall" in
5434 "$define"|true|[yY]*) use64bitint="$define" ;;
5435 esac
5436
5437 case "$longsize" in
5438 8) cat <<EOM
5439
5440 You have natively 64-bit long integers.
5441 EOM
5442    val="$define"
5443    ;;
5444 *) case "$use64bitint" in
5445    "$define"|true|[yY]*) dflt='y';;
5446    *) dflt='n';;
5447    esac
5448    case "$d_quad" in
5449    "$define") ;;
5450    *) dflt='n' ;;
5451    esac
5452    cat <<EOM
5453
5454 Perl can be built to take advantage of 64-bit integer types
5455 on some systems.  To do so, Configure can be run with -Duse64bitint.
5456 Choosing this option will most probably introduce binary incompatibilities.
5457
5458 If this doesn't make any sense to you, just accept the default '$dflt'.
5459 (The default has been chosen based on your configuration.)
5460 EOM
5461    rp='Try to use 64-bit integers, if available?'
5462    . ./myread
5463    case "$ans" in
5464    [yY]*) val="$define" ;;
5465    *)     val="$undef"  ;;
5466    esac
5467    ;;
5468 esac
5469 set use64bitint
5470 eval $setvar
5471
5472 case "$use64bitall" in
5473 "$define"|true|[yY]*) dflt='y' ;;
5474 *) case "$longsize" in
5475    8) dflt='y' ;;
5476    *) dflt='n' ;;
5477    esac
5478    ;;
5479 esac    
5480 cat <<EOM
5481
5482 You may also choose to try maximal 64-bitness.  It means using as much
5483 64-bitness as possible on the platform.  This in turn means even more
5484 binary incompatibilities.  On the other hand, your platform may not
5485 have any more 64-bitness available than what you already have chosen.
5486
5487 If this doesn't make any sense to you, just accept the default '$dflt'.
5488 (The default has been chosen based on your configuration.)
5489 EOM
5490 rp='Try to use maximal 64-bit support, if available?'
5491 . ./myread
5492 case "$ans" in
5493 [yY]*) val="$define" ;;
5494 *)     val="$undef"  ;;
5495 esac
5496 set use64bitall
5497 eval $setvar
5498 case "$use64bitall" in
5499 "$define")
5500         case "$use64bitint" in
5501         "$undef")
5502                 cat <<EOM
5503
5504 Since you have chosen a maximally 64-bit build, I'm also turning on
5505 the use of 64-bit integers.
5506 EOM
5507                 use64bitint="$define" ;;
5508         esac
5509         ;;
5510 esac
5511
5512 : Look for a hint-file generated 'call-back-unit'.  If the
5513 : user has specified that a 64-bit perl is to be built,
5514 : we may need to set or change some other defaults.
5515 if $test -f use64bitint.cbu; then
5516         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5517         . ./use64bitint.cbu
5518 fi
5519 case "$use64bitint" in
5520 "$define"|true|[yY]*)
5521         case "$longsize" in
5522         4) case "$archname64" in
5523            '') archname64=64int ;;
5524            esac
5525            ;;
5526         esac
5527         ;;
5528 esac
5529
5530 : Look for a hint-file generated 'call-back-unit'.  If the
5531 : user has specified that a maximally 64-bit perl is to be built,
5532 : we may need to set or change some other defaults.
5533 if $test -f use64bitall.cbu; then
5534         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5535         . ./use64bitall.cbu
5536 fi
5537 case "$use64bitall" in
5538 "$define"|true|[yY]*)
5539         case "$longsize" in
5540         4) case "$archname64" in
5541            ''|64int) archname64=64all ;;
5542            esac
5543            ;;
5544         esac
5545         ;;
5546 esac
5547
5548 case "$d_quad:$use64bitint" in
5549 $undef:$define)
5550         cat >&4 <<EOF
5551
5552 *** You have chosen to use 64-bit integers,
5553 *** but none can be found.
5554 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5555 *** Cannot continue, aborting.
5556
5557 EOF
5558         exit 1
5559         ;;
5560 esac
5561
5562 : check for length of double
5563 echo " "
5564 case "$doublesize" in
5565 '')
5566         echo "Checking to see how big your double precision numbers are..." >&4
5567         $cat >try.c <<EOCP
5568 #include <stdio.h>
5569 #$i_stdlib I_STDLIB
5570 #ifdef I_STDLIB
5571 #include <stdlib.h>
5572 #endif
5573 int main()
5574 {
5575     printf("%d\n", (int)sizeof(double));
5576     exit(0);
5577 }
5578 EOCP
5579         set try
5580         if eval $compile_ok; then
5581                 doublesize=`$run ./try`
5582                 echo "Your double is $doublesize bytes long."
5583         else
5584                 dflt='8'
5585                 echo "(I can't seem to compile the test program.  Guessing...)"
5586                 rp="What is the size of a double precision number (in bytes)?"
5587                 . ./myread
5588                 doublesize="$ans"
5589         fi
5590         ;;
5591 esac
5592 $rm -f try.c try
5593
5594 : check for long doubles
5595 echo " "
5596 echo "Checking to see if you have long double..." >&4
5597 echo 'int main() { long double x = 7.0; }' > try.c
5598 set try
5599 if eval $compile; then
5600         val="$define"
5601         echo "You have long double."
5602 else
5603         val="$undef"
5604         echo "You do not have long double."
5605 fi
5606 $rm try.*
5607 set d_longdbl
5608 eval $setvar
5609
5610 : check for length of long double
5611 case "${d_longdbl}${longdblsize}" in
5612 $define)
5613         echo " "
5614         echo "Checking to see how big your long doubles are..." >&4
5615         $cat >try.c <<'EOCP'
5616 #include <stdio.h>
5617 int main()
5618 {
5619         printf("%d\n", sizeof(long double));
5620 }
5621 EOCP
5622         set try
5623         set try
5624         if eval $compile; then
5625                 longdblsize=`$run ./try`
5626                 echo "Your long doubles are $longdblsize bytes long."
5627         else
5628                 dflt='8'
5629                 echo " "
5630                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5631                 rp="What is the size of a long double (in bytes)?"
5632                 . ./myread
5633                 longdblsize="$ans"
5634         fi
5635         if $test "X$doublesize" = "X$longdblsize"; then
5636                 echo "That isn't any different from an ordinary double."
5637                 echo "I'll keep your setting anyway, but you may see some"
5638                 echo "harmless compilation warnings."
5639         fi      
5640         ;;
5641 esac
5642 $rm -f try.* try
5643
5644 : determine the architecture name
5645 echo " "
5646 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5647         tarch=`arch`"-$osname"
5648 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5649         if uname -m > tmparch 2>&1 ; then
5650                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5651                         -e 's/$/'"-$osname/" tmparch`
5652         else
5653                 tarch="$osname"
5654         fi
5655         $rm -f tmparch
5656 else
5657         tarch="$osname"
5658 fi
5659 case "$myarchname" in
5660 ''|"$tarch") ;;
5661 *)
5662         echo "(Your architecture name used to be $myarchname.)"
5663         archname=''
5664         ;;
5665 esac
5666 case "$targetarch" in
5667 '') ;;
5668 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5669 esac
5670 myarchname="$tarch"
5671 case "$archname" in
5672 '') dflt="$tarch";;
5673 *) dflt="$archname";;
5674 esac
5675 rp='What is your architecture name'
5676 . ./myread
5677 archname="$ans"
5678 case "$usethreads" in
5679 $define)
5680         echo "Threads selected." >&4
5681         case "$archname" in
5682         *-thread*) echo "...and architecture name already has -thread." >&4
5683                 ;;
5684         *)      archname="$archname-thread"
5685                 echo "...setting architecture name to $archname." >&4
5686                 ;;
5687         esac
5688         ;;
5689 esac
5690 case "$usemultiplicity" in
5691 $define)
5692         echo "Multiplicity selected." >&4
5693         case "$archname" in
5694         *-multi*) echo "...and architecture name already has -multi." >&4
5695                 ;;
5696         *)      archname="$archname-multi"
5697                 echo "...setting architecture name to $archname." >&4
5698                 ;;
5699         esac
5700         ;;
5701 esac
5702 case "$use64bitint$use64bitall" in
5703 *"$define"*)
5704         case "$archname64" in
5705         '')
5706                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5707                 ;;
5708         *)
5709                 case "$use64bitint" in
5710                 "$define") echo "64 bit integers selected." >&4 ;;
5711                 esac
5712                 case "$use64bitall" in
5713                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5714                 esac
5715                 case "$archname" in
5716                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5717                         ;;
5718                 *)      archname="$archname-$archname64"
5719                         echo "...setting architecture name to $archname." >&4
5720                         ;;
5721                 esac
5722                 ;;
5723         esac
5724 esac
5725 case "$uselongdouble" in
5726 $define)
5727         echo "Long doubles selected." >&4
5728         case "$longdblsize" in
5729         $doublesize)
5730                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
5731                 ;;
5732         *)
5733                 case "$archname" in
5734                 *-ld*) echo "...and architecture name already has -ld." >&4
5735                         ;;
5736                 *)      archname="$archname-ld"
5737                         echo "...setting architecture name to $archname." >&4
5738                         ;;
5739                 esac
5740                 ;;
5741         esac
5742         ;;
5743 esac
5744 case "$useperlio" in
5745 $define)
5746         echo "Perlio selected." >&4
5747         ;;
5748 *)
5749         echo "Perlio not selected, using stdio." >&4
5750         case "$archname" in
5751         *-stdio*) echo "...and architecture name already has -stdio." >&4
5752                 ;;
5753         *)      archname="$archname-stdio"
5754                 echo "...setting architecture name to $archname." >&4
5755                 ;;
5756         esac
5757         ;;
5758 esac
5759 if $test -f archname.cbu; then
5760         echo "Your platform has some specific hints for architecture name, using them..."
5761         . ./archname.cbu
5762 fi
5763
5764 : determine root of directory hierarchy where package will be installed.
5765 case "$prefix" in
5766 '')
5767         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5768         ;;
5769 *?/)
5770         dflt=`echo "$prefix" | sed 's/.$//'`
5771         ;;
5772 *)
5773         dflt="$prefix"
5774         ;;
5775 esac
5776 $cat <<EOM
5777
5778 By default, $package will be installed in $dflt/bin, manual pages
5779 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5780 installation directories. Typically this is something like /usr/local.
5781 If you wish to have binaries under /usr/bin but other parts of the
5782 installation under /usr/local, that's ok: you will be prompted
5783 separately for each of the installation directories, the prefix being
5784 only used to set the defaults.
5785
5786 EOM
5787 fn=d~
5788 rp='Installation prefix to use?'
5789 . ./getfile
5790 oldprefix=''
5791 case "$prefix" in
5792 '') ;;
5793 *)
5794         case "$ans" in
5795         "$prefix") ;;
5796         *) oldprefix="$prefix";;
5797         esac
5798         ;;
5799 esac
5800 prefix="$ans"
5801 prefixexp="$ansexp"
5802
5803 case "$afsroot" in
5804 '')     afsroot=/afs ;;
5805 *)      afsroot=$afsroot ;;
5806 esac
5807
5808 : is AFS running?
5809 echo " "
5810 case "$afs" in
5811 $define|true)   afs=true ;;
5812 $undef|false)   afs=false ;;
5813 *)      if test -d $afsroot; then
5814                 afs=true
5815         else
5816                 afs=false
5817         fi
5818         ;;
5819 esac
5820 if $afs; then
5821         echo "AFS may be running... I'll be extra cautious then..." >&4
5822 else
5823         echo "AFS does not seem to be running..." >&4
5824 fi
5825
5826 : determine installation prefix for where package is to be installed.
5827 if $afs; then 
5828 $cat <<EOM
5829
5830 Since you are running AFS, I need to distinguish the directory in which
5831 files will reside from the directory in which they are installed (and from
5832 which they are presumably copied to the former directory by occult means).
5833
5834 EOM
5835         case "$installprefix" in
5836         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5837         *) dflt="$installprefix";;
5838         esac
5839 else
5840 $cat <<EOM
5841
5842 In some special cases, particularly when building $package for distribution,
5843 it is convenient to distinguish the directory in which files should be
5844 installed from the directory ($prefix) in which they will
5845 eventually reside.  For most users, these two directories are the same.
5846
5847 EOM
5848         case "$installprefix" in
5849         '') dflt=$prefix ;;
5850         *) dflt=$installprefix;;
5851         esac
5852 fi
5853 fn=d~
5854 rp='What installation prefix should I use for installing files?'
5855 . ./getfile
5856 installprefix="$ans"
5857 installprefixexp="$ansexp"
5858
5859 : set the prefixit variable, to compute a suitable default value
5860 prefixit='case "$3" in
5861 ""|none)
5862         case "$oldprefix" in
5863         "") eval "$1=\"\$$2\"";;
5864         *)
5865                 case "$3" in
5866                 "") eval "$1=";;
5867                 none)
5868                         eval "tp=\"\$$2\"";
5869                         case "$tp" in
5870                         ""|" ") eval "$1=\"\$$2\"";;
5871                         *) eval "$1=";;
5872                         esac;;
5873                 esac;;
5874         esac;;
5875 *)
5876         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5877         case "$tp" in
5878         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5879         /*-$oldprefix/*|\~*-$oldprefix/*)
5880                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5881         *) eval "$1=\"\$$2\"";;
5882         esac;;
5883 esac'
5884
5885 : get the patchlevel
5886 echo " "
5887 echo "Getting the current patchlevel..." >&4
5888 if $test -r $rsrc/patchlevel.h;then
5889         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5890         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5891         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5892         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5893         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5894         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5895        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
5896 else
5897         revision=0
5898         patchlevel=0
5899         subversion=0
5900         api_revision=0
5901         api_version=0
5902         api_subversion=0
5903         perl_patchlevel=0
5904         $echo "(You do not have patchlevel.h.  Eek.)"
5905 fi
5906 if $test -r $rsrc/.patch ; then  
5907         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
5908                 perl_patchlevel=`cat $rsrc/.patch`
5909         fi
5910 fi
5911 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
5912 version_patchlevel_string="version $patchlevel subversion $subversion"
5913 case "$perl_patchlevel" in
5914 0|'') ;;
5915 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
5916 esac
5917
5918 $echo "(You have $package $version_patchlevel_string.)"
5919
5920 case "$osname" in
5921 dos|vms)
5922         : XXX Should be a Configure test for double-dots in filenames.
5923         version=`echo $revision $patchlevel $subversion | \
5924                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5925         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5926                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5927         ;;
5928 *)
5929         version=`echo $revision $patchlevel $subversion | \
5930                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5931         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5932                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5933         ;;
5934 esac
5935 : Special case the 5.005_xx maintenance series, which used 5.005
5936 : without any subversion label as a subdirectory in $sitelib
5937 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5938         api_versionstring='5.005'
5939 fi
5940
5941 : determine installation style
5942 : For now, try to deduce it from prefix unless it is already set.
5943 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5944 case "$installstyle" in
5945 '')     case "$prefix" in
5946                 *perl*) dflt='lib';;
5947                 *) dflt='lib/perl5' ;;
5948         esac
5949         ;;
5950 *)      dflt="$installstyle" ;;
5951 esac
5952 : Probably not worth prompting for this since we prompt for all
5953 : the directories individually, and the prompt would be too long and
5954 : confusing anyway.
5955 installstyle=$dflt
5956
5957 : determine where private library files go
5958 : Usual default is /usr/local/lib/perl5/$version.
5959 : Also allow things like /opt/perl/lib/$version, since 
5960 : /opt/perl/lib/perl5... would be redundant.
5961 : The default "style" setting is made in installstyle.U
5962 case "$installstyle" in
5963 *lib/perl5*) set dflt privlib lib/$package/$version ;;
5964 *)       set dflt privlib lib/$version ;;
5965 esac
5966 eval $prefixit
5967 $cat <<EOM
5968
5969 There are some auxiliary files for $package that need to be put into a
5970 private library directory that is accessible by everyone.
5971
5972 EOM
5973 fn=d~+
5974 rp='Pathname where the private library files will reside?'
5975 . ./getfile
5976 privlib="$ans"
5977 privlibexp="$ansexp"
5978 : Change installation prefix, if necessary.
5979 if $test X"$prefix" != X"$installprefix"; then
5980         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5981 else
5982         installprivlib="$privlibexp"
5983 fi
5984
5985 : set the prefixup variable, to restore leading tilda escape
5986 prefixup='case "$prefixexp" in
5987 "$prefix") ;;
5988 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5989 esac'
5990
5991 : determine where public architecture dependent libraries go
5992 set archlib archlib
5993 eval $prefixit
5994 : privlib default is /usr/local/lib/$package/$version
5995 : archlib default is /usr/local/lib/$package/$version/$archname
5996 : privlib may have an optional trailing /share.
5997 tdflt=`echo $privlib | $sed 's,/share$,,'`
5998 tdflt=$tdflt/$archname
5999 case "$archlib" in
6000 '')     dflt=$tdflt
6001         ;;
6002 *)      dflt="$archlib"
6003     ;;
6004 esac
6005 $cat <<EOM
6006
6007 $spackage contains architecture-dependent library files.  If you are
6008 sharing libraries in a heterogeneous environment, you might store
6009 these files in a separate location.  Otherwise, you can just include
6010 them with the rest of the public library files.
6011
6012 EOM
6013 fn=d+~
6014 rp='Where do you want to put the public architecture-dependent libraries?'
6015 . ./getfile
6016 archlib="$ans"
6017 archlibexp="$ansexp"
6018 if $test X"$archlib" = X"$privlib"; then
6019         d_archlib="$undef"
6020 else
6021         d_archlib="$define"
6022 fi
6023 : Change installation prefix, if necessary.
6024 if $test X"$prefix" != X"$installprefix"; then
6025         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6026 else
6027         installarchlib="$archlibexp"
6028 fi
6029
6030 : see if setuid scripts can be secure
6031 $cat <<EOM
6032
6033 Some kernels have a bug that prevents setuid #! scripts from being
6034 secure.  Some sites have disabled setuid #! scripts because of this.
6035
6036 First let's decide if your kernel supports secure setuid #! scripts.
6037 (If setuid #! scripts would be secure but have been disabled anyway,
6038 don't say that they are secure if asked.)
6039
6040 EOM
6041
6042 val="$undef"
6043 if $test -d /dev/fd; then
6044         echo "#!$ls" >reflect
6045         chmod +x,u+s reflect
6046         ./reflect >flect 2>&1
6047         if $contains "/dev/fd" flect >/dev/null; then
6048                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6049                 val="$define"
6050         else
6051                 $cat <<EOM
6052 If you are not sure if they are secure, I can check but I'll need a
6053 username and password different from the one you are using right now.
6054 If you don't have such a username or don't want me to test, simply
6055 enter 'none'.
6056
6057 EOM
6058                 rp='Other username to test security of setuid scripts with?'
6059                 dflt='none'
6060                 . ./myread
6061                 case "$ans" in
6062                 n|none)
6063                         case "$d_suidsafe" in
6064                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6065                                 dflt=n;;
6066                         "$undef")
6067                                 echo "Well, the $hint value is *not* secure." >&4
6068                                 dflt=n;;
6069                         *)      echo "Well, the $hint value *is* secure." >&4
6070                                 dflt=y;;
6071                         esac
6072                         ;;
6073                 *)
6074                         $rm -f reflect flect
6075                         echo "#!$ls" >reflect
6076                         chmod +x,u+s reflect
6077                         echo >flect
6078                         chmod a+w flect
6079                         echo '"su" will (probably) prompt you for '"$ans's password."
6080                         su $ans -c './reflect >flect'
6081                         if $contains "/dev/fd" flect >/dev/null; then
6082                                 echo "Okay, it looks like setuid scripts are secure." >&4
6083                                 dflt=y
6084                         else
6085                                 echo "I don't think setuid scripts are secure." >&4
6086                                 dflt=n
6087                         fi
6088                         ;;
6089                 esac
6090                 rp='Does your kernel have *secure* setuid scripts?'
6091                 . ./myread
6092                 case "$ans" in
6093                 [yY]*)  val="$define";;
6094                 *)      val="$undef";;
6095                 esac
6096         fi
6097 else
6098         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6099         echo "(That's for file descriptors, not floppy disks.)"
6100         val="$undef"
6101 fi
6102 set d_suidsafe
6103 eval $setvar
6104
6105 $rm -f reflect flect
6106
6107 : now see if they want to do setuid emulation
6108 echo " "
6109 val="$undef"
6110 case "$d_suidsafe" in
6111 "$define")
6112         val="$undef"
6113         echo "No need to emulate SUID scripts since they are secure here." >&4
6114         ;;
6115 *)
6116         $cat <<EOM
6117 Some systems have disabled setuid scripts, especially systems where
6118 setuid scripts cannot be secure.  On systems where setuid scripts have
6119 been disabled, the setuid/setgid bits on scripts are currently
6120 useless.  It is possible for $package to detect those bits and emulate
6121 setuid/setgid in a secure fashion.  This emulation will only work if
6122 setuid scripts have been disabled in your kernel.
6123
6124 EOM
6125         case "$d_dosuid" in
6126         "$define") dflt=y ;;
6127         *) dflt=n ;;
6128         esac
6129         rp="Do you want to do setuid/setgid emulation?"
6130         . ./myread
6131         case "$ans" in
6132         [yY]*)  val="$define";;
6133         *)      val="$undef";;
6134         esac
6135         ;;
6136 esac
6137 set d_dosuid
6138 eval $setvar
6139
6140 : see if this is a malloc.h system
6141 : we want a real compile instead of Inhdr because some systems have a
6142 : malloc.h that just gives a compile error saying to use stdlib.h instead
6143 echo " "
6144 $cat >try.c <<EOCP
6145 #include <stdlib.h>
6146 #include <malloc.h>
6147 int main () { return 0; }
6148 EOCP
6149 set try
6150 if eval $compile; then
6151     echo "<malloc.h> found." >&4
6152     val="$define"
6153 else
6154     echo "<malloc.h> NOT found." >&4
6155     val="$undef"
6156 fi
6157 $rm -f try.c try
6158 set i_malloc
6159 eval $setvar
6160
6161 : check for void type
6162 echo " "
6163 echo "Checking to see how well your C compiler groks the void type..." >&4
6164 case "$voidflags" in
6165 '')
6166         $cat >try.c <<EOCP
6167 #$i_stdlib I_STDLIB
6168 #ifdef I_STDLIB
6169 #include <stdlib.h>
6170 #endif
6171 #if TRY & 1
6172 void sub() {
6173 #else
6174 sub() {
6175 #endif
6176         extern void moo();      /* function returning void */
6177         void (*goo)();          /* ptr to func returning void */
6178 #if TRY & 8
6179         void *hue;              /* generic ptr */
6180 #endif
6181 #if TRY & 2
6182         void (*foo[10])();
6183 #endif
6184
6185 #if TRY & 4
6186         if(goo == moo) {
6187                 exit(0);
6188         }
6189 #endif
6190         exit(0);
6191 }
6192 int main() { sub(); }
6193 EOCP
6194         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6195                 voidflags=$defvoidused
6196         echo "Good.  It appears to support void to the level $package wants.">&4
6197                 if $contains warning .out >/dev/null 2>&1; then
6198                         echo "However, you might get some warnings that look like this:"
6199                         $cat .out
6200                 fi
6201         else
6202 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6203                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6204                         echo "It supports 1..."
6205                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6206                                 echo "It also supports 2..."
6207                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6208                                         voidflags=7
6209                                         echo "And it supports 4 but not 8 definitely."
6210                                 else
6211                                         echo "It doesn't support 4..."
6212                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6213                                                 voidflags=11
6214                                                 echo "But it supports 8."
6215                                         else
6216                                                 voidflags=3
6217                                                 echo "Neither does it support 8."
6218                                         fi
6219                                 fi
6220                         else
6221                                 echo "It does not support 2..."
6222                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6223                                         voidflags=13
6224                                         echo "But it supports 4 and 8."
6225                                 else
6226                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6227                                                 voidflags=5
6228                                                 echo "And it supports 4 but has not heard about 8."
6229                                         else
6230                                                 echo "However it supports 8 but not 4."
6231                                         fi
6232                                 fi
6233                         fi
6234                 else
6235                         echo "There is no support at all for void."
6236                         voidflags=0
6237                 fi
6238         fi
6239 esac
6240 case "$voidflags" in
6241 "$defvoidused") ;;
6242 *)      $cat >&4 <<'EOM'
6243   Support flag bits are:
6244     1: basic void declarations.
6245     2: arrays of pointers to functions returning void.
6246     4: operations between pointers to and addresses of void functions.
6247     8: generic void pointers.
6248 EOM
6249         dflt="$voidflags";
6250         rp="Your void support flags add up to what?"
6251         . ./myread
6252         voidflags="$ans"
6253         ;;
6254 esac
6255 $rm -f try.* .out
6256
6257 : check for length of pointer
6258 echo " "
6259 case "$ptrsize" in
6260 '')
6261         echo "Checking to see how big your pointers are..." >&4
6262         if test "$voidflags" -gt 7; then
6263                 echo '#define VOID_PTR char *' > try.c
6264         else
6265                 echo '#define VOID_PTR void *' > try.c
6266         fi
6267         $cat >>try.c <<EOCP
6268 #include <stdio.h>
6269 #$i_stdlib I_STDLIB
6270 #ifdef I_STDLIB
6271 #include <stdlib.h>
6272 #endif
6273 int main()
6274 {
6275     printf("%d\n", (int)sizeof(VOID_PTR));
6276     exit(0);
6277 }
6278 EOCP
6279         set try
6280         if eval $compile_ok; then
6281                 ptrsize=`$run ./try`
6282                 echo "Your pointers are $ptrsize bytes long."
6283         else
6284                 dflt='4'
6285                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6286                 rp="What is the size of a pointer (in bytes)?"
6287                 . ./myread
6288                 ptrsize="$ans"
6289         fi
6290         ;;
6291 esac
6292 $rm -f try.c try
6293 case "$use64bitall" in
6294 "$define"|true|[yY]*)
6295         case "$ptrsize" in
6296         4)      cat <<EOM >&4
6297
6298 *** You have chosen a maximally 64-bit build,
6299 *** but your pointers are only 4 bytes wide.
6300 *** Please rerun Configure without -Duse64bitall.
6301 EOM
6302                 case "$d_quad" in
6303                 define)
6304                         cat <<EOM >&4
6305 *** Since you have quads, you could possibly try with -Duse64bitint.
6306 EOM
6307                         ;;
6308                 esac
6309                 cat <<EOM >&4
6310 *** Cannot continue, aborting.
6311
6312 EOM
6313
6314                 exit 1
6315                 ;;
6316         esac
6317         ;;
6318 esac
6319
6320
6321 : determine whether to use malloc wrapping
6322 echo " "
6323 case "$usemallocwrap" in
6324 [yY]*|true|$define)     dflt='y' ;;
6325 [nN]*|false|$undef)     dflt='n' ;;
6326 *)      case "$usedevel" in
6327         [yY]*|true|$define)     dflt='y' ;;
6328         *) dflt='n' ;;
6329         esac
6330         ;;
6331 esac
6332 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6333 . ./myread
6334 usemallocwrap="$ans"
6335 case "$ans" in
6336 y*|true)
6337         usemallocwrap="$define" ;;
6338 *)
6339         usemallocwrap="$undef" ;;
6340 esac
6341
6342 : determine which malloc to compile in
6343 echo " "
6344 case "$usemymalloc" in
6345 [yY]*|true|$define)     dflt='y' ;;
6346 [nN]*|false|$undef)     dflt='n' ;;
6347 *)      case "$ptrsize" in
6348         4) dflt='y' ;;
6349         *) dflt='n' ;;
6350         esac
6351         ;;
6352 esac
6353 rp="Do you wish to attempt to use the malloc that comes with $package?"
6354 . ./myread
6355 usemymalloc="$ans"
6356 case "$ans" in
6357 y*|true)
6358         usemymalloc='y'
6359         mallocsrc='malloc.c'
6360         mallocobj="malloc$_o"
6361         d_mymalloc="$define"
6362         case "$libs" in
6363         *-lmalloc*)
6364                 : Remove malloc from list of libraries to use
6365                 echo "Removing unneeded -lmalloc from library list" >&4
6366                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6367                 shift
6368                 libs="$*"
6369                 echo "libs = $libs" >&4
6370                 ;;
6371         esac
6372         ;;
6373 *)
6374         usemymalloc='n'
6375         mallocsrc=''
6376         mallocobj=''
6377         d_mymalloc="$undef"
6378         ;;
6379 esac
6380
6381 : compute the return types of malloc and free
6382 echo " "
6383 $cat >malloc.c <<END
6384 #$i_malloc I_MALLOC
6385 #$i_stdlib I_STDLIB
6386 #include <stdio.h>
6387 #include <sys/types.h>
6388 #ifdef I_MALLOC
6389 #include <malloc.h>
6390 #endif
6391 #ifdef I_STDLIB
6392 #include <stdlib.h>
6393 #endif
6394 #ifdef TRY_MALLOC
6395 void *malloc();
6396 #endif
6397 #ifdef TRY_FREE
6398 void free();
6399 #endif
6400 END
6401 case "$malloctype" in
6402 '')
6403         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6404                 malloctype='void *'
6405         else
6406                 malloctype='char *'
6407         fi
6408         ;;
6409 esac
6410 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6411
6412 case "$freetype" in
6413 '')
6414         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6415                 freetype='void'
6416         else
6417                 freetype='int'
6418         fi
6419         ;;
6420 esac
6421 echo "Your system uses $freetype free(), it would seem." >&4
6422 $rm -f malloc.[co]
6423 $cat <<EOM
6424
6425 After $package is installed, you may wish to install various
6426 add-on modules and utilities.  Typically, these add-ons will
6427 be installed under $prefix with the rest
6428 of this package.  However, you may wish to install such add-ons
6429 elsewhere under a different prefix.
6430
6431 If you do not wish to put everything under a single prefix, that's
6432 ok.  You will be prompted for the individual locations; this siteprefix
6433 is only used to suggest the defaults.
6434
6435 The default should be fine for most people.
6436
6437 EOM
6438 fn=d~+
6439 rp='Installation prefix to use for add-on modules and utilities?'
6440 : XXX Here might be another good place for an installstyle setting.
6441 case "$siteprefix" in
6442 '') dflt=$prefix ;;
6443 *)  dflt=$siteprefix ;;
6444 esac
6445 . ./getfile
6446 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6447 oldsiteprefix=''
6448 case "$siteprefix" in
6449 '') ;;
6450 *)      case "$ans" in
6451         "$prefix") ;;
6452         *) oldsiteprefix="$prefix";;
6453         esac
6454         ;;
6455 esac
6456 siteprefix="$ans"
6457 siteprefixexp="$ansexp"
6458
6459 : determine where site specific libraries go.
6460 : Usual default is /usr/local/lib/perl5/site_perl/$version
6461 : The default "style" setting is made in installstyle.U
6462 : XXX No longer works with Prefixit stuff.
6463 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6464 case "$sitelib" in
6465 '') case "$installstyle" in
6466         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6467         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6468         esac
6469         ;;
6470 *)      dflt="$sitelib"
6471         ;;
6472 esac
6473 $cat <<EOM
6474
6475 The installation process will create a directory for
6476 site-specific extensions and modules.  Most users find it convenient
6477 to place all site-specific files in this directory rather than in the
6478 main distribution directory.
6479
6480 EOM
6481 fn=d~+
6482 rp='Pathname for the site-specific library files?'
6483 . ./getfile
6484 sitelib="$ans"
6485 sitelibexp="$ansexp"
6486 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6487 : Change installation prefix, if necessary.
6488 if $test X"$prefix" != X"$installprefix"; then
6489         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6490 else
6491         installsitelib="$sitelibexp"
6492 fi
6493
6494 : determine where site specific architecture-dependent libraries go.
6495 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6496 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6497 : sitelib may have an optional trailing /share.
6498 case "$sitearch" in
6499 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6500         dflt="$dflt/$archname"
6501         ;;
6502 *)      dflt="$sitearch"
6503         ;;
6504 esac
6505 set sitearch sitearch none
6506 eval $prefixit
6507 $cat <<EOM
6508
6509 The installation process will also create a directory for
6510 architecture-dependent site-specific extensions and modules.
6511
6512 EOM
6513 fn=d~+
6514 rp='Pathname for the site-specific architecture-dependent library files?'
6515 . ./getfile
6516 sitearch="$ans"
6517 sitearchexp="$ansexp"
6518 : Change installation prefix, if necessary.
6519 if $test X"$prefix" != X"$installprefix"; then
6520         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6521 else
6522         installsitearch="$sitearchexp"
6523 fi
6524
6525 $cat <<EOM
6526
6527 The installation process will also create a directory for
6528 vendor-supplied add-ons.  Vendors who supply perl with their system
6529 may find it convenient to place all vendor-supplied files in this
6530 directory rather than in the main distribution directory.  This will
6531 ease upgrades between binary-compatible maintenance versions of perl.
6532
6533 Of course you may also use these directories in whatever way you see
6534 fit.  For example, you might use them to access modules shared over a
6535 company-wide network.
6536
6537 The default answer should be fine for most people.
6538 This causes further questions about vendor add-ons to be skipped
6539 and no vendor-specific directories will be configured for perl.
6540
6541 EOM
6542 rp='Do you want to configure vendor-specific add-on directories?'
6543 case "$usevendorprefix" in
6544 define|true|[yY]*) dflt=y ;;
6545 *)      : User may have set vendorprefix directly on Configure command line.
6546         case "$vendorprefix" in
6547         ''|' ') dflt=n ;;
6548         *)      dflt=y ;;
6549         esac
6550         ;;
6551 esac
6552 . ./myread
6553 case "$ans" in
6554 [yY]*)  fn=d~+
6555         rp='Installation prefix to use for vendor-supplied add-ons?'
6556         case "$vendorprefix" in
6557         '') dflt='' ;;
6558         *)  dflt=$vendorprefix ;;
6559         esac
6560         . ./getfile
6561         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6562         oldvendorprefix=''
6563         case "$vendorprefix" in
6564         '') ;;
6565         *)      case "$ans" in
6566                 "$prefix") ;;
6567                 *) oldvendorprefix="$prefix";;
6568                 esac
6569                 ;;
6570         esac
6571         usevendorprefix="$define"
6572         vendorprefix="$ans"
6573         vendorprefixexp="$ansexp"
6574         ;;
6575 *)      usevendorprefix="$undef"
6576         vendorprefix=''
6577         vendorprefixexp=''
6578         ;;
6579 esac
6580
6581 case "$vendorprefix" in
6582 '')     d_vendorlib="$undef"
6583         vendorlib=''
6584         vendorlibexp=''
6585         ;;
6586 *)      d_vendorlib="$define"
6587         : determine where vendor-supplied modules go.
6588         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6589         case "$vendorlib" in
6590         '')
6591                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6592                 case "$installstyle" in
6593                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6594                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6595                 esac
6596                 ;;
6597         *)      dflt="$vendorlib"
6598                 ;;
6599         esac
6600         fn=d~+
6601         rp='Pathname for the vendor-supplied library files?'
6602         . ./getfile
6603         vendorlib="$ans"
6604         vendorlibexp="$ansexp"
6605         ;;
6606 esac
6607 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6608 : Change installation prefix, if necessary.
6609 if $test X"$prefix" != X"$installprefix"; then
6610         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6611 else
6612         installvendorlib="$vendorlibexp"
6613 fi
6614
6615 case "$vendorprefix" in
6616 '')     d_vendorarch="$undef"
6617         vendorarch=''
6618         vendorarchexp=''
6619         ;;
6620 *)      d_vendorarch="$define"
6621         : determine where vendor-supplied architecture-dependent libraries go.
6622         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6623         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6624         : vendorlib may have an optional trailing /share.
6625         case "$vendorarch" in
6626         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6627                 dflt="$dflt/$archname"
6628                 ;;
6629         *)      dflt="$vendorarch" ;;
6630         esac
6631         fn=d~+
6632         rp='Pathname for vendor-supplied architecture-dependent files?'
6633         . ./getfile
6634         vendorarch="$ans"
6635         vendorarchexp="$ansexp"
6636         ;;
6637 esac
6638 : Change installation prefix, if necessary.
6639 if $test X"$prefix" != X"$installprefix"; then
6640         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6641 else
6642         installvendorarch="$vendorarchexp"
6643 fi
6644
6645 : Final catch-all directories to search
6646 $cat <<EOM
6647
6648 Lastly, you can have perl look in other directories for extensions and
6649 modules in addition to those already specified.
6650 These directories will be searched after 
6651         $sitearch 
6652         $sitelib 
6653 EOM
6654 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6655 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6656 echo ' '
6657 case "$otherlibdirs" in
6658 ''|' ') dflt='none' ;;
6659 *)      dflt="$otherlibdirs" ;;
6660 esac
6661 $cat <<EOM
6662 Enter a colon-separated set of extra paths to include in perl's @INC
6663 search path, or enter 'none' for no extra paths.
6664
6665 EOM
6666
6667 rp='Colon-separated list of additional directories for perl to search?'
6668 . ./myread
6669 case "$ans" in
6670 ' '|''|none)    otherlibdirs=' ' ;;     
6671 *)      otherlibdirs="$ans" ;;
6672 esac
6673 case "$otherlibdirs" in
6674 ' ') val=$undef ;;
6675 *)      val=$define ;;
6676 esac
6677 set d_perl_otherlibdirs
6678 eval $setvar
6679
6680 : Cruising for prototypes
6681 echo " "
6682 echo "Checking out function prototypes..." >&4
6683 $cat >prototype.c <<EOCP
6684 #$i_stdlib I_STDLIB
6685 #ifdef I_STDLIB
6686 #include <stdlib.h>
6687 #endif
6688 int main(int argc, char *argv[]) {
6689         exit(0);}
6690 EOCP
6691 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6692         echo "Your C compiler appears to support function prototypes."
6693         val="$define"
6694 else
6695         echo "Your C compiler doesn't seem to understand function prototypes."
6696         val="$undef"
6697 fi
6698 set prototype
6699 eval $setvar
6700 $rm -f prototype*
6701
6702 case "$prototype" in
6703 "$define") ;;
6704 *)      ansi2knr='ansi2knr'
6705         echo " "
6706         cat <<EOM >&4
6707
6708 $me:  FATAL ERROR:
6709 This version of $package can only be compiled by a compiler that 
6710 understands function prototypes.  Unfortunately, your C compiler 
6711         $cc $ccflags
6712 doesn't seem to understand them.  Sorry about that.
6713
6714 If GNU cc is available for your system, perhaps you could try that instead.  
6715
6716 Eventually, we hope to support building Perl with pre-ANSI compilers.
6717 If you would like to help in that effort, please contact <perlbug@perl.org>.
6718
6719 Aborting Configure now.
6720 EOM
6721         exit 2
6722         ;;
6723 esac
6724
6725 : determine where public executables go
6726 echo " "
6727 set dflt bin bin
6728 eval $prefixit
6729 fn=d~
6730 rp='Pathname where the public executables will reside?'
6731 . ./getfile
6732 if $test "X$ansexp" != "X$binexp"; then
6733         installbin=''
6734 fi
6735 bin="$ans"
6736 binexp="$ansexp"
6737 : Change installation prefix, if necessary.
6738 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6739 if $test X"$prefix" != X"$installprefix"; then
6740         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6741 else
6742         installbin="$binexp"
6743 fi
6744
6745 echo " "
6746 case "$extras" in
6747 '') dflt='n';;
6748 *) dflt='y';;
6749 esac
6750 cat <<EOM
6751 Perl can be built with extra modules or bundles of modules which
6752 will be fetched from the CPAN and installed alongside Perl.
6753
6754 Notice that you will need access to the CPAN; either via the Internet,
6755 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
6756 be asked later to configure the CPAN.pm module which will in turn do
6757 the installation of the rest of the extra modules or bundles.)
6758
6759 Notice also that if the modules require any external software such as
6760 libraries and headers (the libz library and the zlib.h header for the
6761 Compress::Zlib module, for example) you MUST have any such software
6762 already installed, this configuration process will NOT install such
6763 things for you.
6764
6765 If this doesn't make any sense to you, just accept the default '$dflt'.
6766 EOM
6767 rp='Install any extra modules (y or n)?'
6768 . ./myread
6769 case "$ans" in
6770 y|Y)
6771         cat <<EOM
6772
6773 Please list any extra modules or bundles to be installed from CPAN,
6774 with spaces between the names.  The names can be in any format the
6775 'install' command of CPAN.pm will understand.  (Answer 'none',
6776 without the quotes, to install no extra modules or bundles.)
6777 EOM
6778         rp='Extras?'
6779         dflt="$extras"
6780         . ./myread
6781         extras="$ans"
6782 esac
6783 case "$extras" in
6784 ''|'none')
6785         val=''
6786         $rm -f ../extras.lst
6787         ;;
6788 *)      echo "(Saving the list of extras for later...)"
6789         echo "$extras" > ../extras.lst
6790         val="'$extras'"
6791         ;;
6792 esac
6793 set extras
6794 eval $setvar
6795 echo " "
6796
6797 : determine where html pages for programs go
6798 set html1dir html1dir none
6799 eval $prefixit
6800 $cat <<EOM
6801
6802 If you wish to install html files for programs in $spackage, indicate 
6803 the appropriate directory here.  To skip installing html files,
6804 answer "none".
6805 EOM
6806 case "$html1dir" in
6807 ''|none|$undef|' ') dflt=none ;;
6808 *) dflt=$html1dir ;;
6809 esac
6810 fn=dn+~
6811 rp="Directory for the main $spackage html pages?"
6812 . ./getfile
6813 html1dir="$ans"
6814 html1direxp="$ansexp"
6815 : Use ' ' for none so value is preserved next time through Configure
6816 $test X"$html1dir" = "X" && html1dir=' '
6817 : Change installation prefix, if necessary.
6818 if $test X"$prefix" != X"$installprefix"; then
6819         installhtml1dir=`echo $html1direxp | sed "s#^$prefix#$installprefix#"`
6820 else
6821         installhtml1dir="$html1direxp"
6822 fi
6823
6824 : determine where html pages for libraries and modules go
6825 set html3dir html3dir none
6826 eval $prefixit
6827 $cat <<EOM
6828
6829 If you wish to install html files for modules associated with $spackage,
6830 indicate the appropriate directory here.  To skip installing html files,
6831 answer "none".
6832 EOM
6833 : There is no obvious default.  If they have specified html1dir, then
6834 : try to key off that, possibly changing .../html1 into .../html3.
6835 case "$html3dir" in
6836 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
6837 *) dflt=$html3dir ;;
6838 esac
6839 fn=dn+~
6840 rp="Directory for the $spackage module html pages?"
6841 . ./getfile
6842 html3dir="$ans"
6843 html3direxp="$ansexp"
6844 : Use ' ' for none so value is preserved next time through Configure
6845 $test X"$html3dir" = "X" && html3dir=' '
6846 : Change installation prefix, if necessary.
6847 if $test X"$prefix" != X"$installprefix"; then
6848         installhtml3dir=`echo $html3direxp | sed "s#^$prefix#$installprefix#"`
6849 else
6850         installhtml3dir="$html3direxp"
6851 fi
6852
6853 : Find perl5.005 or later.
6854 echo "Looking for a previously installed perl5.005 or later... "
6855 case "$perl5" in
6856 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6857                 : Check if this perl is recent and can load a simple module
6858                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6859                         perl5=$tdir/perl
6860                         break;
6861                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6862                         perl5=$tdir/perl5
6863                         break;
6864                 fi
6865         done
6866         ;;
6867 *)      perl5="$perl5"
6868         ;;
6869 esac
6870 case "$perl5" in
6871 '')     echo "None found.  That's ok.";;
6872 *)      echo "Using $perl5." ;;
6873 esac
6874
6875 : Determine list of previous versions to include in @INC
6876 $cat > getverlist <<EOPL
6877 #!$perl5 -w
6878 use File::Basename;
6879 \$api_versionstring = "$api_versionstring";
6880 \$version = "$version";
6881 \$stem = "$sitelib_stem";
6882 \$archname = "$archname";
6883 EOPL
6884         $cat >> getverlist <<'EOPL'
6885 # Can't have leading @ because metaconfig interprets it as a command!
6886 ;@inc_version_list=();
6887 # XXX Redo to do opendir/readdir? 
6888 if (-d $stem) {
6889     chdir($stem);
6890     ;@candidates = glob("5.*");
6891 }
6892 else {
6893     ;@candidates = ();
6894 }
6895
6896 # XXX ToDo:  These comparisons must be reworked when two-digit
6897 # subversions come along, so that 5.7.10 compares as greater than
6898 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6899 # widespread that we can use the built-in version vectors rather
6900 # than reinventing them here.  For 5.6.0, however, we must
6901 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6902 foreach $d (@candidates) {
6903     if ($d lt $version) {
6904         if ($d ge $api_versionstring) {
6905             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6906         }
6907         elsif ($d ge "5.005") {
6908             unshift(@inc_version_list, grep { -d } $d);
6909         }
6910     }
6911     else {
6912         # Skip newer version.  I.e. don't look in
6913         # 5.7.0 if we're installing 5.6.1.
6914     }
6915 }
6916
6917 if (@inc_version_list) {
6918     print join(' ', @inc_version_list);
6919 }
6920 else {
6921     # Blank space to preserve value for next Configure run.
6922     print " ";
6923 }
6924 EOPL
6925 chmod +x getverlist
6926 case "$inc_version_list" in
6927 '')     if test -x "$perl5$exe_ext"; then
6928                 dflt=`$perl5 getverlist`
6929         else
6930                 dflt='none'
6931         fi
6932         ;;
6933 $undef) dflt='none' ;;
6934 *)  eval dflt=\"$inc_version_list\" ;;
6935 esac
6936 case "$dflt" in
6937 ''|' ') dflt=none ;;
6938 esac
6939 case "$dflt" in
6940 5.005) dflt=none ;;
6941 esac
6942 $cat <<EOM
6943
6944 In order to ease the process of upgrading, this version of perl 
6945 can be configured to use modules built and installed with earlier 
6946 versions of perl that were installed under $prefix.  Specify here
6947 the list of earlier versions that this version of perl should check.
6948 If Configure detected no earlier versions of perl installed under
6949 $prefix, then the list will be empty.  Answer 'none' to tell perl
6950 to not search earlier versions.
6951
6952 The default should almost always be sensible, so if you're not sure,
6953 just accept the default.
6954 EOM
6955
6956 rp='List of earlier versions to include in @INC?'
6957 . ./myread
6958 case "$ans" in
6959 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6960 *) inc_version_list="$ans" ;;
6961 esac
6962 case "$inc_version_list" in
6963 ''|' ') 
6964         inc_version_list_init='0';;
6965 *)      inc_version_list_init=`echo $inc_version_list |
6966                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6967         ;;
6968 esac
6969 $rm -f getverlist
6970
6971 : determine whether to install perl also as /usr/bin/perl
6972
6973 echo " "
6974 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6975         $cat <<EOM
6976 Many scripts expect perl to be installed as /usr/bin/perl.
6977
6978 If you want to, I can install the perl you are about to compile
6979 as /usr/bin/perl (in addition to $bin/perl).
6980 EOM
6981         if test -f /usr/bin/perl; then
6982             $cat <<EOM
6983
6984 However, please note that because you already have a /usr/bin/perl,
6985 overwriting that with a new Perl would very probably cause problems.
6986 Therefore I'm assuming you don't want to do that (unless you insist).
6987
6988 EOM
6989             case "$installusrbinperl" in
6990             "$define"|[yY]*)    dflt='y';;
6991             *)                  dflt='n';;
6992             esac
6993         else
6994             $cat <<EOM
6995
6996 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
6997
6998 EOM
6999             case "$installusrbinperl" in
7000             "$undef"|[nN]*)     dflt='n';;
7001             *)                  dflt='y';;
7002             esac
7003         fi
7004         rp="Do you want to install perl as /usr/bin/perl?"
7005         . ./myread
7006         case "$ans" in
7007         [yY]*)  val="$define";;
7008         *)      val="$undef" ;;
7009         esac
7010 else
7011         val="$undef"
7012 fi
7013 set installusrbinperl
7014 eval $setvar
7015
7016 echo " "
7017 echo "Checking for GNU C Library..." >&4
7018 cat >try.c <<'EOCP'
7019 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7020    alone are insufficient to distinguish different versions, such as
7021    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7022    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7023 */
7024 #include <stdio.h>
7025 int main(void)
7026 {
7027 #ifdef __GLIBC__
7028 #   ifdef __GLIBC_MINOR__
7029 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
7030 #           include <gnu/libc-version.h>
7031             printf("%s\n",  gnu_get_libc_version());
7032 #       else
7033             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7034 #       endif
7035 #   else
7036         printf("%d\n",  __GLIBC__);
7037 #   endif
7038     return 0;
7039 #else
7040     return 1;
7041 #endif
7042 }
7043 EOCP
7044 set try
7045 if eval $compile_ok && $run ./try > glibc.ver; then
7046         val="$define"
7047         gnulibc_version=`$cat glibc.ver`
7048         echo "You are using the GNU C Library version $gnulibc_version"
7049 else
7050         val="$undef"
7051         gnulibc_version=''
7052         echo "You are not using the GNU C Library"
7053 fi
7054 $rm -f try try.* glibc.ver
7055 set d_gnulibc
7056 eval $setvar
7057
7058 : see if nm is to be used to determine whether a symbol is defined or not
7059 case "$usenm" in
7060 '')
7061         dflt=''
7062         case "$d_gnulibc" in
7063         "$define")
7064                 echo " "
7065                 echo "nm probably won't work on the GNU C Library." >&4
7066                 dflt=n
7067                 ;;
7068         esac
7069         case "$dflt" in
7070         '') 
7071                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7072                         echo " "
7073                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7074                         echo "'nm' won't be sufficient on this sytem." >&4
7075                         dflt=n
7076                 fi
7077                 ;;
7078         esac
7079         case "$dflt" in
7080         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7081                 if $test $dflt -gt 20; then
7082                         dflt=y
7083                 else
7084                         dflt=n
7085                 fi
7086                 ;;
7087         esac
7088         ;;
7089 *)
7090         case "$usenm" in
7091         true|$define) dflt=y;;
7092         *) dflt=n;;
7093         esac
7094         ;;
7095 esac
7096 $cat <<EOM
7097
7098 I can use $nm to extract the symbols from your C libraries. This
7099 is a time consuming task which may generate huge output on the disk (up
7100 to 3 megabytes) but that should make the symbols extraction faster. The
7101 alternative is to skip the 'nm' extraction part and to compile a small
7102 test program instead to determine whether each symbol is present. If
7103 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7104 this may be the best solution.
7105
7106 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7107
7108 EOM
7109 rp="Shall I use $nm to extract C symbols from the libraries?"
7110 . ./myread
7111 case "$ans" in
7112 [Nn]*) usenm=false;;
7113 *) usenm=true;;
7114 esac
7115
7116 runnm=$usenm
7117 case "$reuseval" in
7118 true) runnm=false;;
7119 esac
7120
7121 : nm options which may be necessary
7122 case "$nm_opt" in
7123 '') if $test -f /mach_boot; then
7124                 nm_opt=''       # Mach
7125         elif $test -d /usr/ccs/lib; then
7126                 nm_opt='-p'     # Solaris (and SunOS?)
7127         elif $test -f /dgux; then
7128                 nm_opt='-p'     # DG-UX
7129         elif $test -f /lib64/rld; then
7130                 nm_opt='-p'     # 64-bit Irix
7131         else
7132                 nm_opt=''
7133         fi;;
7134 esac
7135
7136 : nm options which may be necessary for shared libraries but illegal
7137 : for archive libraries.  Thank you, Linux.
7138 case "$nm_so_opt" in
7139 '')     case "$myuname" in
7140         *linux*|gnu*)
7141                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7142                         nm_so_opt='--dynamic'
7143                 fi
7144                 ;;
7145         esac
7146         ;;
7147 esac
7148
7149 case "$runnm" in
7150 true)
7151 : get list of predefined functions in a handy place
7152 echo " "
7153 case "$libc" in
7154 '') libc=unknown
7155         case "$libs" in
7156         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7157         esac
7158         ;;
7159 esac
7160 case "$libs" in
7161 '') ;;
7162 *)  for thislib in $libs; do
7163         case "$thislib" in
7164         -lc|-lc_s)
7165                 : Handle C library specially below.
7166                 ;;
7167         -l*)
7168                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7169                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7170                         :
7171                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7172                         :
7173                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7174                         :
7175                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7176                         :
7177                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7178                         :
7179                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7180                         :
7181                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7182                         :
7183                 else
7184                         try=''
7185                 fi
7186                 libnames="$libnames $try"
7187                 ;;
7188         *) libnames="$libnames $thislib" ;;
7189         esac
7190         done
7191         ;;
7192 esac
7193 xxx=normal
7194 case "$libc" in
7195 unknown)
7196         set /lib/libc.$so
7197         for xxx in $libpth; do
7198                 $test -r $1 || set $xxx/libc.$so
7199                 : The messy sed command sorts on library version numbers.
7200                 $test -r $1 || \
7201                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7202                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7203                                 h
7204                                 s/[0-9][0-9]*/0000&/g
7205                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7206                                 G
7207                                 s/\n/ /' | \
7208                          $sort | $sed -e 's/^.* //'`
7209                 eval set \$$#
7210         done
7211         $test -r $1 || set /usr/ccs/lib/libc.$so
7212         $test -r $1 || set /lib/libsys_s$_a
7213         ;;
7214 *)
7215         set blurfl
7216         ;;
7217 esac
7218 if $test -r "$1"; then
7219         echo "Your (shared) C library seems to be in $1."
7220         libc="$1"
7221 elif $test -r /lib/libc && $test -r /lib/clib; then
7222         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7223         xxx=apollo
7224         libc='/lib/clib /lib/libc'
7225         if $test -r /lib/syslib; then
7226                 echo "(Your math library is in /lib/syslib.)"
7227                 libc="$libc /lib/syslib"
7228         fi
7229 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7230         echo "Your C library seems to be in $libc, as you said before."
7231 elif $test -r $incpath/usr/lib/libc$_a; then
7232         libc=$incpath/usr/lib/libc$_a;
7233         echo "Your C library seems to be in $libc.  That's fine."
7234 elif $test -r /lib/libc$_a; then
7235         libc=/lib/libc$_a;
7236         echo "Your C library seems to be in $libc.  You're normal."
7237 else
7238         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7239                 :
7240         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7241                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7242         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7243                 :
7244         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7245                 :
7246         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7247                 :
7248         else
7249                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7250         fi
7251         if $test -r "$tans"; then
7252                 echo "Your C library seems to be in $tans, of all places."
7253                 libc=$tans
7254         else
7255                 libc='blurfl'
7256         fi
7257 fi
7258 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7259         dflt="$libc"
7260         cat <<EOM
7261
7262 If the guess above is wrong (which it might be if you're using a strange
7263 compiler, or your machine supports multiple models), you can override it here.
7264
7265 EOM
7266 else
7267         dflt=''
7268         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7269         cat >&4 <<EOM
7270 I can't seem to find your C library.  I've looked in the following places:
7271
7272 EOM
7273         $sed 's/^/      /' libpath
7274         cat <<EOM
7275
7276 None of these seems to contain your C library. I need to get its name...
7277
7278 EOM
7279 fi
7280 fn=f
7281 rp='Where is your C library?'
7282 . ./getfile
7283 libc="$ans"
7284
7285 echo " "
7286 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7287 set X `cat libnames`
7288 shift
7289 xxx=files
7290 case $# in 1) xxx=file; esac
7291 echo "Extracting names from the following $xxx for later perusal:" >&4
7292 echo " "
7293 $sed 's/^/      /' libnames >&4
7294 echo " "
7295 $echo $n "This may take a while...$c" >&4
7296
7297 for file in $*; do
7298         case $file in
7299         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7300         *) $nm $nm_opt $file 2>/dev/null;;
7301         esac
7302 done >libc.tmp
7303
7304 $echo $n ".$c"
7305 $grep fprintf libc.tmp > libc.ptf
7306 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7307 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7308 xxx='[ADTSIW]'
7309 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7310         eval $xscan;\
7311         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7312                 eval $xrun
7313 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7314         eval $xscan;\
7315         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7316                 eval $xrun
7317 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7318         eval $xscan;\
7319         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7320                 eval $xrun
7321 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7322         eval $xscan;\
7323         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7324                 eval $xrun
7325 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7326         eval $xscan;\
7327         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7328                 eval $xrun
7329 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7330         eval $xscan;\
7331         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7332                 eval $xrun
7333 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7334                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7335         eval $xscan;\
7336         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7337                 eval $xrun
7338 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7339         eval $xscan;\
7340         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7341                 eval $xrun
7342 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7343         eval $xscan;\
7344         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7345                 eval $xrun
7346 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7347         eval $xscan;\
7348         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7349                 eval $xrun
7350 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7351         eval $xscan;\
7352         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7353                 eval $xrun
7354 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7355         eval $xscan;\
7356         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7357                 eval $xrun
7358 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7359         eval $xscan;\
7360         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7361                 eval $xrun
7362 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7363         eval $xscan;\
7364         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7365                 eval $xrun
7366 else
7367         $nm -p $* 2>/dev/null >libc.tmp
7368         $grep fprintf libc.tmp > libc.ptf
7369         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7370                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7371         then
7372                 nm_opt='-p'
7373                 eval $xrun
7374         else
7375                 echo " "
7376                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7377                 com=''
7378                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7379                         for thisname in $libnames $libc; do
7380                                 $ar t $thisname >>libc.tmp
7381                         done
7382                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7383                         echo "Ok." >&4
7384                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7385                         # Repeat libc to extract forwarders to DLL entries too
7386                         for thisname in $libnames $libc; do
7387                                 $ar tv $thisname >>libc.tmp
7388                                 # Revision 50 of EMX has bug in $ar.
7389                                 # it will not extract forwarders to DLL entries
7390                                 # Use emximp which will extract exactly them.
7391                                 emximp -o tmp.imp $thisname \
7392                                     2>/dev/null && \
7393                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7394                                     < tmp.imp >>libc.tmp
7395                                 $rm tmp.imp
7396                         done
7397                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7398                         echo "Ok." >&4
7399                 else
7400                         echo "$ar didn't seem to work right." >&4
7401                         echo "Maybe this is a Cray...trying bld instead..." >&4
7402                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7403                         then
7404                                 for thisname in $libnames; do
7405                                         bld t $libnames | \
7406                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7407                                         $ar t $thisname >>libc.tmp
7408                                 done
7409                                 echo "Ok." >&4
7410                         else
7411                                 echo "That didn't work either.  Giving up." >&4
7412                                 exit 1
7413                         fi
7414                 fi
7415         fi
7416 fi
7417 nm_extract="$com"
7418 case "$PASE" in
7419 define)
7420     echo " "
7421     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7422     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7423     ;;
7424 *)  if $test -f /lib/syscalls.exp; then
7425         echo " "
7426         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7427         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7428     fi
7429     ;;
7430 esac
7431 ;;
7432 esac
7433 $rm -f libnames libpath
7434
7435 : see if dld is available
7436 set dld.h i_dld
7437 eval $inhdr
7438
7439 : is a C symbol defined?
7440 csym='tlook=$1;
7441 case "$3" in
7442 -v) tf=libc.tmp; tdc="";;
7443 -a) tf=libc.tmp; tdc="[]";;
7444 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7445 esac;
7446 tx=yes;
7447 case "$reuseval-$4" in
7448 true-) ;;
7449 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7450 esac;
7451 case "$tx" in
7452 yes)
7453         tval=false;
7454         if $test "$runnm" = true; then
7455                 if $contains $tlook $tf >/dev/null 2>&1; then
7456                         tval=true;
7457                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7458                         echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7459                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7460                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7461                         $rm -f try$_exe try.c core core.* try.core;
7462                 fi;
7463         else
7464                 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7465                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7466                 $rm -f try$_exe try.c;
7467         fi;
7468         ;;
7469 *)
7470         case "$tval" in
7471         $define) tval=true;;
7472         *) tval=false;;
7473         esac;
7474         ;;
7475 esac;
7476 eval "$2=$tval"'
7477
7478 : define an is-in-libc? function
7479 inlibc='echo " "; td=$define; tu=$undef;
7480 sym=$1; var=$2; eval "was=\$$2";
7481 tx=yes;
7482 case "$reuseval$was" in
7483 true) ;;
7484 true*) tx=no;;
7485 esac;
7486 case "$tx" in
7487 yes)
7488         set $sym tres -f;
7489         eval $csym;
7490         case "$tres" in
7491         true)
7492                 echo "$sym() found." >&4;
7493                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7494         *)
7495                 echo "$sym() NOT found." >&4;
7496                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7497         esac;;
7498 *)
7499         case "$was" in
7500         $define) echo "$sym() found." >&4;;
7501         *) echo "$sym() NOT found." >&4;;
7502         esac;;
7503 esac'
7504
7505 : see if dlopen exists
7506 xxx_runnm="$runnm"
7507 runnm=false
7508 set dlopen d_dlopen
7509 eval $inlibc
7510 runnm="$xxx_runnm"
7511
7512 : determine which dynamic loading, if any, to compile in
7513 echo " "
7514 dldir="ext/DynaLoader"
7515 case "$usedl" in
7516 $define|y|true)
7517         dflt='y'
7518         usedl="$define"
7519         ;;
7520 $undef|n|false)
7521         dflt='n'
7522         usedl="$undef"
7523         ;;
7524 *) 
7525         dflt='n'
7526         case "$d_dlopen" in
7527             $define) dflt='y' ;;
7528         esac
7529         case "$i_dld" in
7530             $define) dflt='y' ;;
7531         esac
7532         : Does a dl_xxx.xs file exist for this operating system
7533         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7534         ;;
7535 esac
7536 rp="Do you wish to use dynamic loading?"
7537 . ./myread
7538 usedl="$ans"
7539 case "$ans" in
7540 y*) usedl="$define"
7541         case "$dlsrc" in
7542         '')
7543                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7544                         dflt="$dldir/dl_${osname}.xs"
7545                 elif $test "$d_dlopen" = "$define" ; then
7546                         dflt="$dldir/dl_dlopen.xs"
7547                 elif $test "$i_dld" = "$define" ; then
7548                         dflt="$dldir/dl_dld.xs"
7549                 else
7550                         dflt=''
7551                 fi
7552                 ;;
7553         *)      dflt="$dldir/$dlsrc"
7554                 ;;
7555         esac
7556     echo "The following dynamic loading files are available:"
7557         : Can not go over to $dldir because getfile has path hard-coded in.
7558         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7559         rp="Source file to use for dynamic loading"
7560         fn="fne"
7561         gfpth="$src"
7562         . ./getfile
7563         usedl="$define"
7564         : emulate basename
7565         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7566
7567         $cat << EOM
7568
7569 Some systems may require passing special flags to $cc -c to
7570 compile modules that will be used to create a shared library.
7571 To use no flags, say "none".
7572
7573 EOM
7574     case "$cccdlflags" in
7575     '') case "$gccversion" in
7576                 '') case "$osname" in
7577                         hpux)   dflt='+z' ;;
7578                         next)   dflt='none' ;;
7579                         irix*)  dflt='-KPIC' ;;
7580                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7581                         sunos)  dflt='-pic' ;;
7582                         *)      dflt='none' ;;
7583                     esac
7584                         ;;
7585                 *)  case "$osname" in
7586                         darwin) dflt='none' ;;
7587                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7588                         *)      dflt='-fpic' ;;
7589                     esac ;;
7590             esac ;;
7591         ' ') dflt='none' ;;
7592     *)  dflt="$cccdlflags" ;;
7593     esac
7594     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7595     . ./myread
7596     case "$ans" in
7597     none) cccdlflags=' ' ;;
7598     *) cccdlflags="$ans" ;;
7599     esac
7600
7601     cat << EOM
7602
7603 Some systems use ld to create libraries that can be dynamically loaded,
7604 while other systems (such as those using ELF) use $cc.
7605
7606 EOM
7607         case "$ld" in
7608         '')     $cat >try.c <<EOM
7609 /* Test for whether ELF binaries are produced */
7610 #include <fcntl.h>
7611 #$i_stdlib I_STDLIB
7612 #ifdef I_STDLIB
7613 #include <stdlib.h>
7614 #endif
7615 int main() {
7616         char b[4];
7617         int i = open("a.out",O_RDONLY);
7618         if(i == -1) 
7619                 exit(1); /* fail */
7620         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7621                 exit(0); /* succeed (yes, it's ELF) */
7622         else
7623                 exit(1); /* fail */
7624 }
7625 EOM
7626                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7627                         cat <<EOM
7628 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7629 EOM
7630                         dflt="$cc"
7631                 else
7632                         echo "I'll use ld to build dynamic libraries."
7633                         dflt='ld'
7634                 fi
7635                 rm -f try.c a.out
7636                 ;;
7637         *)      dflt="$ld"
7638                 ;;
7639         esac
7640
7641     rp="What command should be used to create dynamic libraries?"
7642     . ./myread
7643         ld="$ans"
7644
7645     cat << EOM
7646
7647 Some systems may require passing special flags to $ld to create a
7648 library that can be dynamically loaded.  If your ld flags include
7649 -L/other/path options to locate libraries outside your loader's normal
7650 search path, you may need to specify those -L options here as well.  To
7651 use no flags, say "none".
7652
7653 EOM
7654     case "$lddlflags" in
7655     '') case "$osname" in
7656                         beos) dflt='-nostart' ;;
7657                         hpux) dflt='-b';
7658                               case "$gccversion" in
7659                               '') dflt="$dflt +vnocompatwarnings" ;;
7660                               esac
7661                               ;;        
7662                         linux|irix*|gnu*)       dflt='-shared' ;;
7663                         next)  dflt='none' ;;
7664                         solaris) dflt='-G' ;;
7665                         sunos) dflt='-assert nodefinitions' ;;
7666                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7667                 *)     dflt='none' ;;
7668                         esac
7669                         ;;
7670     *) dflt="$lddlflags" ;;
7671     esac
7672
7673         : Try to guess additional flags to pick up local libraries.
7674         : Be careful not to append to a plain 'none'
7675         case "$dflt" in
7676         none) dflt='' ;;
7677         esac
7678         for thisflag in $ldflags; do
7679                 case "$thisflag" in
7680                 -L*|-R*|-Wl,-R*)
7681                         case " $dflt " in
7682                         *" $thisflag "*) ;;
7683                         *) dflt="$dflt $thisflag" ;;
7684                         esac
7685                         ;;
7686                 esac
7687         done
7688
7689         case "$dflt" in
7690         ''|' ') dflt='none' ;;
7691         esac
7692
7693     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7694     . ./myread
7695     case "$ans" in
7696     none) lddlflags=' ' ;;
7697     *) lddlflags="$ans" ;;
7698     esac
7699
7700         cat <<EOM
7701
7702 Some systems may require passing special flags to $cc to indicate that
7703 the resulting executable will use dynamic linking.  To use no flags,
7704 say "none".
7705
7706 EOM
7707     case "$ccdlflags" in
7708     '') case "$osname" in
7709             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
7710             next|sunos) dflt='none' ;;
7711             *)          dflt='none' ;;
7712             esac ;;
7713     ' ')  dflt='none' ;;
7714     *)  dflt="$ccdlflags" ;;
7715     esac
7716     rp="Any special flags to pass to $cc to use dynamic linking?"
7717     . ./myread
7718     case "$ans" in
7719     none) ccdlflags=' ' ;;
7720     *) ccdlflags="$ans" ;;
7721     esac
7722     ;;
7723 *)  usedl="$undef"
7724         ld='ld'
7725     dlsrc='dl_none.xs'
7726     lddlflags=''
7727     ccdlflags=''
7728     ;;
7729 esac
7730
7731 also=''
7732 case "$usedl" in
7733 $undef)
7734         # No dynamic loading being used, so don't bother even to prompt.
7735         useshrplib='false'
7736         ;;
7737 *)      case "$useshrplib" in
7738         '')     case "$osname" in
7739                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7740                         dflt=y
7741                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7742                         ;;
7743                 next*)
7744                         case "$osvers" in
7745                         4*)     dflt=y
7746                                 also='Building a shared libperl is needed for MAB support.'
7747                                 ;;
7748                         *)      dflt=n
7749                                 ;;
7750                         esac
7751                         ;;
7752                 *)      dflt=n
7753                         ;;
7754                 esac
7755                 ;;
7756         $define|true|[Yy]*)
7757                 dflt=y
7758                 ;;
7759         *)      dflt=n
7760                 ;;
7761         esac
7762         $cat << EOM
7763
7764 The perl executable is normally obtained by linking perlmain.c with
7765 libperl${_a}, any static extensions (usually just DynaLoader), and
7766 any other libraries needed on this system (such as -lm, etc.).  Since
7767 your system supports dynamic loading, it is probably possible to build
7768 a shared libperl.$so.  If you will have more than one executable linked
7769 to libperl.$so, this will significantly reduce the size of each
7770 executable, but it may have a noticeable effect on performance.  The
7771 default is probably sensible for your system.
7772 $also
7773
7774 EOM
7775         rp="Build a shared libperl.$so (y/n)"
7776         . ./myread
7777         case "$ans" in
7778         true|$define|[Yy]*)
7779                 useshrplib='true'  ;;
7780         *)      useshrplib='false' ;;
7781         esac
7782         ;;
7783 esac
7784
7785 case "$useshrplib" in
7786 true)
7787         case "$libperl" in
7788         '')
7789                 # Figure out a good name for libperl.so.  Since it gets stored in
7790                 # a version-specific architecture-dependent library, the version
7791                 # number isn't really that important, except for making cc/ld happy.
7792                 #
7793                 # A name such as libperl.so.3.1
7794                 majmin="libperl.$so.$patchlevel.$subversion"
7795                 # A name such as libperl.so.301
7796                 majonly=`echo $patchlevel $subversion |
7797                         $awk '{printf "%d%02d", $1, $2}'`
7798                 majonly=libperl.$so.$majonly
7799                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7800                 # rely on figuring it out from the naming of libc.
7801                 case "${osname}${osvers}" in
7802                 next4*)
7803                         dflt=libperl.5.$so
7804                         # XXX How handle the --version stuff for MAB?
7805                         ;;
7806                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
7807                         dflt=libperl.$so
7808                         ;;
7809                 cygwin*) # ld links against an importlib
7810                         dflt=libperl$lib_ext
7811                         ;;
7812                 *)      # Try to guess based on whether libc has major.minor.
7813                         case "$libc" in
7814                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7815                         *libc.$so.[0-9]*) dflt=$majonly ;;
7816                         *)      dflt=libperl.$so ;;
7817                         esac
7818                         ;;
7819                 esac
7820                 ;;
7821         *)      dflt=$libperl
7822                 ;;
7823         esac
7824         cat << EOM
7825
7826 I need to select a good name for the shared libperl.  If your system uses
7827 library names with major and minor numbers, then you might want something
7828 like $majmin.  Alternatively, if your system uses a single version
7829 number for shared libraries, then you might want to use $majonly.
7830 Or, your system might be quite happy with a simple libperl.$so.
7831
7832 Since the shared libperl will get installed into a version-specific
7833 architecture-dependent directory, the version number of the shared perl
7834 library probably isn't important, so the default should be o.k.
7835
7836 EOM
7837         rp='What name do you want to give to the shared libperl?'
7838         . ./myread
7839         libperl=$ans
7840         echo "Ok, I'll use $libperl"
7841         ;;
7842 *)
7843         libperl="libperl${_a}"
7844         ;;
7845 esac
7846
7847 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7848 case "$shrpdir" in
7849 '') ;;
7850 *)      $cat >&4 <<EOM
7851 WARNING:  Use of the shrpdir variable for the installation location of
7852 the shared $libperl is not supported.  It was never documented and
7853 will not work in this version.  Let me (perlbug@perl.org)
7854 know of any problems this may cause.
7855
7856 EOM
7857         case "$shrpdir" in
7858         "$archlibexp/CORE")
7859                 $cat >&4 <<EOM
7860 But your current setting of $shrpdir is
7861 the default anyway, so it's harmless.
7862 EOM
7863                 ;;
7864         *)
7865                 $cat >&4 <<EOM
7866 Further, your current attempted setting of $shrpdir
7867 conflicts with the value of $archlibexp/CORE
7868 that installperl will use.
7869 EOM
7870                 ;;
7871         esac
7872         ;;
7873 esac
7874
7875 # How will the perl executable find the installed shared $libperl?
7876 # Add $xxx to ccdlflags.
7877 # If we can't figure out a command-line option, use $shrpenv to
7878 # set env LD_RUN_PATH.  The main perl makefile uses this.
7879 shrpdir=$archlibexp/CORE
7880 xxx=''
7881 tmp_shrpenv=''
7882 if "$useshrplib"; then
7883     case "$osname" in 
7884         aix)
7885                 # We'll set it in Makefile.SH...
7886                 ;;
7887         solaris)
7888                 xxx="-R $shrpdir"
7889                 ;;
7890         freebsd|netbsd|openbsd|interix)
7891                 xxx="-Wl,-R$shrpdir"
7892                 ;;
7893         bsdos|linux|irix*|dec_osf|gnu*)
7894                 xxx="-Wl,-rpath,$shrpdir"
7895                 ;;
7896         next)
7897                 # next doesn't like the default...
7898                 ;;
7899         beos)
7900                 # beos doesn't like the default, either.
7901                 ;;
7902         hpux*)
7903                 # hpux doesn't like the default, either.
7904                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7905                 ;;
7906         *)
7907                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7908                 ;;
7909         esac
7910         case "$xxx" in
7911         '') ;;
7912         *)      
7913                 # Only add $xxx if it isn't already in ccdlflags.
7914                 case " $ccdlflags " in
7915                 *" $xxx "*)     ;;
7916                 *)      ccdlflags="$ccdlflags $xxx"
7917                         cat <<EOM >&4
7918
7919 Adding $xxx to the flags
7920 passed to $ld so that the perl executable will find the 
7921 installed shared $libperl.
7922
7923 EOM
7924                         ;;
7925                 esac
7926                 ;;
7927         esac
7928 fi
7929 # Fix ccdlflags in AIX for building external extensions.
7930 # (For building Perl itself bare -bE:perl.exp is needed,
7931 #  Makefile.SH takes care of this.)
7932 case "$osname" in
7933 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7934 esac
7935 # Respect a hint or command-line value.
7936 case "$shrpenv" in
7937 '') shrpenv="$tmp_shrpenv" ;;
7938 esac
7939 case "$ldlibpthname" in
7940 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7941 none)   ldlibpthname='' ;;
7942 esac
7943
7944 : determine where manual pages are on this system
7945 echo " "
7946 case "$sysman" in
7947 '') 
7948         syspath='/usr/share/man/man1 /usr/man/man1'
7949         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7950         syspath="$syspath /usr/man/u_man/man1"
7951         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7952         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7953         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7954         sysman=`./loc . /usr/man/man1 $syspath`
7955         ;;
7956 esac
7957 if $test -d "$sysman"; then
7958         echo "System manual is in $sysman." >&4
7959 else
7960         echo "Could not find manual pages in source form." >&4
7961 fi
7962
7963 : determine where manual pages go
7964 set man1dir man1dir none
7965 eval $prefixit
7966 $cat <<EOM
7967
7968 $spackage has manual pages available in source form.
7969 EOM
7970 case "$nroff" in
7971 nroff)
7972         echo "However, you don't have nroff, so they're probably useless to you."
7973         case "$man1dir" in
7974         '') man1dir="none";;
7975         esac;;
7976 esac
7977 echo "If you don't want the manual sources installed, answer 'none'."
7978 case "$man1dir" in
7979 ' ') dflt=none
7980         ;;
7981 '')
7982         lookpath="$prefixexp/share/man/man1"
7983         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
7984         lookpath="$lookpath $prefixexp/man/p_man/man1"
7985         lookpath="$lookpath $prefixexp/man/u_man/man1"
7986         lookpath="$lookpath $prefixexp/man/man.1"
7987         case "$sysman" in
7988         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7989         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7990         esac
7991         set dflt
7992         eval $prefixup
7993         ;;
7994 *)  dflt="$man1dir"
7995         ;;
7996 esac
7997 echo " "
7998 fn=dn+~
7999 rp="Where do the main $spackage manual pages (source) go?"
8000 . ./getfile
8001 if $test "X$man1direxp" != "X$ansexp"; then
8002         installman1dir=''
8003 fi
8004 man1dir="$ans"
8005 man1direxp="$ansexp"
8006 case "$man1dir" in
8007 '')     man1dir=' '
8008         installman1dir='';;
8009 esac
8010
8011 : Change installation prefix, if necessary.
8012 if $test X"$prefix" != X"$installprefix"; then
8013         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
8014 else
8015         installman1dir="$man1direxp"
8016 fi
8017
8018 : What suffix to use on installed man pages
8019
8020 case "$man1dir" in
8021 ' ')
8022         man1ext='0'
8023         ;;
8024 *)
8025         rp="What suffix should be used for the main $spackage man pages?"
8026         case "$man1ext" in
8027         '')     case "$man1dir" in
8028                 *1)  dflt=1 ;;
8029                 *1p) dflt=1p ;;
8030                 *1pm) dflt=1pm ;;
8031                 *l) dflt=l;;
8032                 *n) dflt=n;;
8033                 *o) dflt=o;;
8034                 *p) dflt=p;;
8035                 *C) dflt=C;;
8036                 *L) dflt=L;;
8037                 *L1) dflt=L1;;
8038                 *) dflt=1;;
8039                 esac
8040                 ;;
8041         *)      dflt="$man1ext";;
8042         esac
8043         . ./myread
8044         man1ext="$ans"
8045         ;;
8046 esac
8047
8048 : see if we can have long filenames
8049 echo " "
8050 first=123456789abcdef
8051 $rm -f $first
8052 if (echo hi >$first) 2>/dev/null; then
8053         if $test -f 123456789abcde; then
8054                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8055                 val="$undef"
8056         else
8057                 echo 'You can have filenames longer than 14 characters.'>&4
8058                 val="$define"
8059         fi
8060 else
8061         $cat <<'EOM'
8062 You can't have filenames longer than 14 chars.
8063 You can't even think about them!
8064 EOM
8065         val="$undef"
8066 fi 
8067 set d_flexfnam
8068 eval $setvar
8069 $rm -rf 123456789abcde*
8070
8071 : determine where library module manual pages go
8072 set man3dir man3dir none
8073 eval $prefixit
8074 $cat <<EOM
8075
8076 $spackage has manual pages for many of the library modules.
8077 EOM
8078
8079 case "$nroff" in
8080 nroff)
8081         $cat <<'EOM'
8082 However, you don't have nroff, so they're probably useless to you.
8083 EOM
8084         case "$man3dir" in
8085         '') man3dir="none";;
8086         esac;;
8087 esac
8088
8089 case "$d_flexfnam" in
8090 undef)
8091         $cat <<'EOM'
8092 However, your system can't handle the long file names like File::Basename.3. 
8093 EOM
8094         case "$man3dir" in
8095         '') man3dir="none";;
8096         esac;;
8097 esac
8098
8099 echo "If you don't want the manual sources installed, answer 'none'."
8100 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8101 case "$man3dir" in
8102 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8103         if $test -d "$privlib/man/man3"; then
8104                 cat <<EOM >&4
8105
8106 WARNING:  Previous versions of perl installed man3 pages into
8107 $privlib/man/man3.  This version will suggest a 
8108 new default of $dflt.  
8109 EOM
8110                 tdflt=$dflt
8111                 dflt='n'
8112                 rp='Do you wish to preserve the old behavior?(y/n)'
8113                 . ./myread
8114                 case "$ans" in
8115                 y*) dflt="$privlib/man/man3" ;;
8116                 *)  dflt=$tdflt ;;
8117                 esac
8118     fi
8119         ;;
8120 *)      dflt="$man3dir" ;;
8121 esac
8122 case "$dflt" in
8123 ' ') dflt=none ;;
8124 esac
8125 echo " "
8126 fn=dn+~
8127 rp="Where do the $package library man pages (source) go?"
8128 . ./getfile
8129 man3dir="$ans"
8130 man3direxp="$ansexp"
8131 case "$man3dir" in
8132 '')     man3dir=' '
8133         installman3dir='';;
8134 esac
8135
8136 : Change installation prefix, if necessary.
8137 if $test X"$prefix" != X"$installprefix"; then
8138         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8139 else
8140         installman3dir="$man3direxp"
8141 fi
8142
8143 : What suffix to use on installed man pages
8144 case "$man3dir" in
8145 ' ')
8146         man3ext='0'
8147         ;;
8148 *)
8149         rp="What suffix should be used for the $package library man pages?"
8150         case "$man3ext" in
8151         '')     case "$man3dir" in
8152                 *3)  dflt=3 ;;
8153                 *3p) dflt=3p ;;
8154                 *3pm) dflt=3pm ;;
8155                 *l) dflt=l;;
8156                 *n) dflt=n;;
8157                 *o) dflt=o;;
8158                 *p) dflt=p;;
8159                 *C) dflt=C;;
8160                 *L) dflt=L;;
8161                 *L3) dflt=L3;;
8162                 *) dflt=3;;
8163                 esac
8164                 ;;
8165         *)      dflt="$man3ext";;
8166         esac
8167         . ./myread
8168         man3ext="$ans"
8169         ;;
8170 esac
8171
8172 : see if we have to deal with yellow pages, now NIS.
8173 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8174         if $test -f /usr/etc/nibindd; then
8175                 echo " "
8176                 echo "I'm fairly confident you're on a NeXT."
8177                 echo " "
8178                 rp='Do you get the hosts file via NetInfo?'
8179                 dflt=y
8180                 case "$hostcat" in
8181                 nidump*) ;;
8182                 '') ;;
8183                 *) dflt=n;;
8184                 esac
8185                 . ./myread
8186                 case "$ans" in
8187                 y*) hostcat='nidump hosts .';;
8188                 *)      case "$hostcat" in
8189                         nidump*) hostcat='';;
8190                         esac
8191                         ;;
8192                 esac
8193         fi
8194         case "$hostcat" in
8195         nidump*) ;;
8196         *)
8197                 case "$hostcat" in
8198                 *ypcat*) dflt=y;;
8199                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8200                                 dflt=y
8201                         else
8202                                 dflt=n
8203                         fi;;
8204                 *) dflt=n;;
8205                 esac
8206                 echo " "
8207                 rp='Are you getting the hosts file via yellow pages?'
8208                 . ./myread
8209                 case "$ans" in
8210                 y*) hostcat='ypcat hosts';;
8211                 *) hostcat='cat /etc/hosts';;
8212                 esac
8213                 ;;
8214         esac
8215 fi
8216 case "$hostcat" in
8217 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8218 esac
8219 case "$groupcat" in
8220 '') test -f /etc/group && groupcat='cat /etc/group';;
8221 esac
8222 case "$passcat" in
8223 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8224 esac
8225
8226 : now get the host name
8227 echo " "
8228 echo "Figuring out host name..." >&4
8229 case "$myhostname" in
8230 '') cont=true
8231         echo 'Maybe "hostname" will work...'
8232         if tans=`sh -c hostname 2>&1` ; then
8233                 myhostname=$tans
8234                 phostname=hostname
8235                 cont=''
8236         fi
8237         ;;
8238 *) cont='';;
8239 esac
8240 if $test "$cont"; then
8241         if ./xenix; then
8242                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8243                 if tans=`cat /etc/systemid 2>&1` ; then
8244                         myhostname=$tans
8245                         phostname='cat /etc/systemid'
8246                         echo "Whadyaknow.  Xenix always was a bit strange..."
8247                         cont=''
8248                 fi
8249         elif $test -r /etc/systemid; then
8250                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8251         fi
8252 fi
8253 if $test "$cont"; then
8254         echo 'No, maybe "uuname -l" will work...'
8255         if tans=`sh -c 'uuname -l' 2>&1` ; then
8256                 myhostname=$tans
8257                 phostname='uuname -l'
8258         else
8259                 echo 'Strange.  Maybe "uname -n" will work...'
8260                 if tans=`sh -c 'uname -n' 2>&1` ; then
8261                         myhostname=$tans
8262                         phostname='uname -n'
8263                 else
8264                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8265                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8266                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8267                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8268                         else
8269                                 case "$myhostname" in
8270                                 '') echo "Does this machine have an identity crisis or something?"
8271                                         phostname='';;
8272                                 *)
8273                                         echo "Well, you said $myhostname before..."
8274                                         phostname='echo $myhostname';;
8275                                 esac
8276                         fi
8277                 fi
8278         fi
8279 fi
8280 case "$myhostname" in
8281 '') myhostname=noname ;;
8282 esac
8283 : you do not want to know about this
8284 set $myhostname
8285 myhostname=$1
8286
8287 : verify guess
8288 if $test "$myhostname" ; then
8289         dflt=y
8290         rp='Your host name appears to be "'$myhostname'".'" Right?"
8291         . ./myread
8292         case "$ans" in
8293         y*) ;;
8294         *) myhostname='';;
8295         esac
8296 fi
8297
8298 : bad guess or no guess
8299 while $test "X$myhostname" = X ; do
8300         dflt=''
8301         rp="Please type the (one word) name of your host:"
8302         . ./myread
8303         myhostname="$ans"
8304 done
8305
8306 : translate upper to lower if necessary
8307 case "$myhostname" in
8308 *[A-Z]*)
8309         echo "(Normalizing case in your host name)"
8310         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8311         ;;
8312 esac
8313
8314 case "$myhostname" in
8315 *.*)
8316         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8317         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8318         echo "(Trimming domain name from host name--host name is now $myhostname)"
8319         ;;
8320 *) case "$mydomain" in
8321         '')
8322                 {
8323                         test "X$hostcat" = "Xypcat hosts" &&
8324                         ypmatch "$myhostname" hosts 2>/dev/null |\
8325                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8326                         $test -s hosts
8327                 } || {
8328                         test "X$hostcat" != "X" &&
8329                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8330                                         /[       ]$myhostname[  . ]/p" > hosts
8331                 }
8332                 tmp_re="[       . ]"
8333                 if $test -f hosts; then
8334                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8335                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8336                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8337                                 hosts | $sort | $uniq | \
8338                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8339                         case `$echo X$dflt` in
8340                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8341                                 dflt=.
8342                                 ;;
8343                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8344                                 ;;
8345                         esac
8346                 else
8347                         echo "(I cannot locate a hosts database anywhere)"
8348                         dflt=.
8349                 fi
8350                 case "$dflt" in
8351                 .)
8352                         tans=`./loc resolv.conf X /etc /usr/etc`
8353                         if $test -f "$tans"; then
8354                                 echo "(Attempting domain name extraction from $tans)"
8355                                 dflt=.`$sed -n -e 's/   / /g' \
8356                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8357                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8358                                 case "$dflt" in
8359                                 .) dflt=.`$sed -n -e 's/        / /g' \
8360                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8361                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8362                                         ;;
8363                                 esac
8364                         fi
8365                         ;;
8366                 esac
8367                 case "$dflt" in
8368                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8369                         dflt=.`sh -c domainname 2>/dev/null`
8370                         case "$dflt" in
8371                         '') dflt='.';;
8372                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8373                         esac
8374                         ;;
8375                 esac
8376                 case "$dflt$osname" in
8377                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8378                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8379                         ;;
8380                 esac
8381                 case "$dflt" in
8382                 .) echo "(Lost all hope -- silly guess then)"
8383                         dflt='.nonet'
8384                         ;;
8385                 esac
8386                 $rm -f hosts
8387                 ;;
8388         *) dflt="$mydomain";;
8389         esac;;
8390 esac
8391 echo " "
8392 rp="What is your domain name?"
8393 . ./myread
8394 tans="$ans"
8395 case "$ans" in
8396 '') ;;
8397 .*) ;;
8398 *) tans=".$tans";;
8399 esac
8400 mydomain="$tans"
8401
8402 : translate upper to lower if necessary
8403 case "$mydomain" in
8404 *[A-Z]*)
8405         echo "(Normalizing case in your domain name)"
8406         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8407         ;;
8408 esac
8409
8410 : a little sanity check here
8411 case "$phostname" in
8412 '') ;;
8413 *)
8414         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8415         $myhostname$mydomain|$myhostname) ;;
8416         *)
8417                 case "$phostname" in
8418                 sed*)
8419                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8420                         ;;
8421                 *)
8422                         echo "(That doesn't agree with your $phostname command, by the way.)"
8423                         ;;
8424                 esac
8425         ;;
8426         esac
8427         ;;
8428 esac
8429
8430 $cat <<EOM
8431
8432 I need to get your e-mail address in Internet format if possible, i.e.
8433 something like user@host.domain. Please answer accurately since I have
8434 no easy means to double check it. The default value provided below
8435 is most probably close to reality but may not be valid from outside
8436 your organization...
8437
8438 EOM
8439 cont=x
8440 while test "$cont"; do
8441         case "$cf_email" in
8442         '') dflt="$cf_by@$myhostname$mydomain";;
8443         *) dflt="$cf_email";;
8444         esac
8445         rp='What is your e-mail address?'
8446         . ./myread
8447         cf_email="$ans"
8448         case "$cf_email" in
8449         *@*.*) cont='' ;;
8450         *)
8451                 rp='Address does not look like an Internet one.  Use it anyway?'
8452                 case "$fastread" in
8453                 yes) dflt=y ;;
8454                 *) dflt=n ;;
8455                 esac
8456                 . ./myread
8457                 case "$ans" in
8458                 y*) cont='' ;;
8459                 *) echo " " ;;
8460                 esac
8461                 ;;
8462         esac
8463 done
8464
8465 $cat <<EOM
8466
8467 If you or somebody else will be maintaining perl at your site, please
8468 fill in the correct e-mail address here so that they may be contacted
8469 if necessary. Currently, the "perlbug" program included with perl
8470 will send mail to this address in addition to perlbug@perl.org. You may
8471 enter "none" for no administrator.
8472
8473 EOM
8474 case "$perladmin" in
8475 '') dflt="$cf_email";;
8476 *) dflt="$perladmin";;
8477 esac
8478 rp='Perl administrator e-mail address'
8479 . ./myread
8480 perladmin="$ans"
8481
8482 : determine whether to only install version-specific parts.
8483 echo " "
8484 $cat <<EOM
8485 Do you want to install only the version-specific parts of the perl
8486 distribution?  Usually you do *not* want to do this.
8487 EOM
8488 case "$versiononly" in
8489 "$define"|[Yy]*|true) dflt='y' ;;
8490 *) dflt='n';
8491 esac
8492 rp="Do you want to install only the version-specific parts of perl?"
8493 . ./myread
8494 case "$ans" in
8495 [yY]*)  val="$define";;
8496 *)      val="$undef" ;;
8497 esac
8498 set versiononly
8499 eval $setvar
8500
8501 case "$versiononly" in
8502 "$define") inc_version_list=''
8503            inc_version_list_init=0
8504            ;;
8505 esac
8506
8507 : figure out how to guarantee perl startup
8508 case "$startperl" in
8509 '')
8510         case "$sharpbang" in
8511         *!)
8512                 $cat <<EOH
8513
8514 I can use the #! construct to start perl on your system. This will
8515 make startup of perl scripts faster, but may cause problems if you
8516 want to share those scripts and perl is not in a standard place
8517 ($binexp/perl) on all your platforms. The alternative is to force
8518 a shell by starting the script with a single ':' character.
8519
8520 EOH
8521                 case "$versiononly" in
8522                 "$define")      dflt="$binexp/perl$version";;  
8523                 *)              dflt="$binexp/perl";;
8524                 esac
8525                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8526                 . ./myread
8527                 case "$ans" in
8528                 none)   startperl=": # use perl";;
8529                 *)      startperl="#!$ans"
8530                         if $test 30 -lt `echo "$ans" | wc -c`; then
8531                                 $cat >&4 <<EOM
8532
8533 WARNING:  Some systems limit the #! command to 32 characters.
8534 If you experience difficulty running Perl scripts with #!, try
8535 installing Perl in a directory with a shorter pathname.
8536
8537 EOM
8538                         fi ;;
8539                 esac
8540                 ;;
8541         *) startperl=": # use perl"
8542                 ;;
8543         esac
8544         ;;
8545 esac
8546 echo "I'll use $startperl to start perl scripts."
8547
8548 : figure best path for perl in scripts
8549 case "$perlpath" in
8550 '')
8551         case "$versiononly" in
8552         "$define")      perlpath="$binexp/perl$version";;
8553         *)              perlpath="$binexp/perl";;
8554         esac
8555         case "$startperl" in
8556         *!*) ;;
8557         *)
8558                 $cat <<EOH
8559
8560 I will use the "eval 'exec'" idiom to start Perl on your system.
8561 I can use the full path of your Perl binary for this purpose, but
8562 doing so may cause problems if you want to share those scripts and
8563 Perl is not always in a standard place ($binexp/perl).
8564
8565 EOH
8566                 dflt="$binexp/perl"
8567                 rp="What path shall I use in \"eval 'exec'\"?"
8568                 . ./myread
8569                 perlpath="$ans"
8570                 ;;
8571         esac
8572         ;;
8573 esac
8574 case "$startperl" in
8575 *!*)    ;;
8576 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8577 esac
8578
8579 : determine where public executable scripts go
8580 set scriptdir scriptdir
8581 eval $prefixit
8582 case "$scriptdir" in
8583 '')
8584         dflt="$bin"
8585         : guess some guesses
8586         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8587         $test -d /usr/share/bin     && dflt=/usr/share/bin
8588         $test -d /usr/local/script  && dflt=/usr/local/script
8589         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8590         $test -d $prefixexp/script  && dflt=$prefixexp/script
8591         set dflt
8592         eval $prefixup
8593         ;;
8594 *)  dflt="$scriptdir"
8595         ;;
8596 esac
8597 $cat <<EOM
8598  
8599 Some installations have a separate directory just for executable scripts so
8600 that they can mount it across multiple architectures but keep the scripts in
8601 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8602 Or you might just lump your scripts in with all your other executables.
8603  
8604 EOM
8605 fn=d~
8606 rp='Where do you keep publicly executable scripts?'
8607 . ./getfile
8608 if $test "X$ansexp" != "X$scriptdirexp"; then
8609         installscript=''
8610 fi
8611 scriptdir="$ans"
8612 scriptdirexp="$ansexp"
8613 : Change installation prefix, if necessary.
8614 if $test X"$prefix" != X"$installprefix"; then
8615         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8616 else
8617         installscript="$scriptdirexp"
8618 fi
8619
8620 : determine where add-on public executables go
8621 case "$sitebin" in
8622 '')     dflt=$siteprefix/bin ;;
8623 *)      dflt=$sitebin ;;
8624 esac
8625 fn=d~
8626 rp='Pathname where the add-on public executables should be installed?'
8627 . ./getfile
8628 sitebin="$ans"
8629 sitebinexp="$ansexp"
8630 : Change installation prefix, if necessary.
8631 if $test X"$prefix" != X"$installprefix"; then
8632         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8633 else
8634         installsitebin="$sitebinexp"
8635 fi
8636
8637 : determine where add-on html pages go
8638 : There is no standard location, so try to copy the previously-selected
8639 : directory structure for the core html pages.
8640 case "$sitehtml1dir" in
8641 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8642 *)     dflt=$sitehtml1dir ;;
8643 esac
8644 case "$dflt" in
8645 ''|' ') dflt=none ;;
8646 esac
8647 fn=dn+~
8648 rp='Pathname where the site-specific html pages should be installed?'
8649 . ./getfile
8650 sitehtml1dir="$ans"
8651 sitehtml1direxp="$ansexp"
8652 : Change installation prefix, if necessary.
8653 if $test X"$prefix" != X"$installprefix"; then
8654         installsitehtml1dir=`echo $sitehtml1direxp | $sed "s#^$prefix#$installprefix#"`
8655 else
8656         installsitehtml1dir="$sitehtml1direxp"
8657 fi
8658
8659 : determine where add-on library html pages go
8660 : There is no standard location, so try to copy the previously-selected
8661 : directory structure for the core html pages.
8662 case "$sitehtml3dir" in
8663 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8664 *)     dflt=$sitehtml3dir ;;
8665 esac
8666 case "$dflt" in
8667 ''|' ') dflt=none ;;
8668 esac
8669 fn=dn+~
8670 rp='Pathname where the site-specific library html pages should be installed?'
8671 . ./getfile
8672 sitehtml3dir="$ans"
8673 sitehtml3direxp="$ansexp"
8674 : Change installation prefix, if necessary.
8675 if $test X"$prefix" != X"$installprefix"; then
8676         installsitehtml3dir=`echo $sitehtml3direxp | $sed "s#^$prefix#$installprefix#"`
8677 else
8678         installsitehtml3dir="$sitehtml3direxp"
8679 fi
8680
8681 : determine where add-on manual pages go
8682 case "$siteman1dir" in
8683 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8684 *)      dflt=$siteman1dir ;;
8685 esac
8686 case "$dflt" in
8687 ''|' ') dflt=none ;;
8688 esac
8689 fn=dn+~
8690 rp='Pathname where the site-specific manual pages should be installed?'
8691 . ./getfile
8692 siteman1dir="$ans"
8693 siteman1direxp="$ansexp"
8694 : Change installation prefix, if necessary.
8695 if $test X"$prefix" != X"$installprefix"; then
8696         installsiteman1dir=`echo $siteman1direxp | $sed "s#^$prefix#$installprefix#"`
8697 else
8698         installsiteman1dir="$siteman1direxp"
8699 fi
8700
8701 : determine where add-on library man pages go
8702 case "$siteman3dir" in
8703 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8704 *)      dflt=$siteman3dir ;;
8705 esac
8706 case "$dflt" in
8707 ''|' ') dflt=none ;;
8708 esac
8709 fn=dn+~
8710 rp='Pathname where the site-specific library manual pages should be installed?'
8711 . ./getfile
8712 siteman3dir="$ans"
8713 siteman3direxp="$ansexp"
8714 : Change installation prefix, if necessary.
8715 if $test X"$prefix" != X"$installprefix"; then
8716         installsiteman3dir=`echo $siteman3direxp | $sed "s#^$prefix#$installprefix#"`
8717 else
8718         installsiteman3dir="$siteman3direxp"
8719 fi
8720
8721 : determine where add-on public executable scripts go
8722 case "$sitescript" in
8723 '')     dflt=$siteprefix/script
8724         $test -d $dflt || dflt=$sitebin ;;
8725 *)  dflt="$sitescript" ;;
8726 esac
8727 fn=d~+
8728 rp='Pathname where add-on public executable scripts should be installed?'
8729 . ./getfile
8730 sitescript="$ans"
8731 sitescriptexp="$ansexp"
8732 : Change installation prefix, if necessary.
8733 if $test X"$prefix" != X"$installprefix"; then
8734         installsitescript=`echo $sitescriptexp | sed "s#^$prefix#$installprefix#"`
8735 else
8736         installsitescript="$sitescriptexp"
8737 fi
8738
8739 case "$usefaststdio" in
8740 $define|true|[yY]*|'')
8741         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8742         case "$xversion" in
8743         [68])   dflt='y' ;;
8744         *)      dflt='n' ;;
8745         esac
8746         ;;
8747 *) dflt='n';;
8748 esac
8749 cat <<EOM
8750
8751 Perl can be built to use 'fast stdio', which means using the stdio
8752 library but also directly manipulating the stdio buffers to enable
8753 faster I/O.  Using stdio is better for backward compatibility (especially
8754 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8755 interface has been preferred instead of stdio.
8756
8757 If this doesn't make any sense to you, just accept the default '$dflt'.
8758 EOM
8759 rp='Use the "fast stdio" if available?'
8760 . ./myread
8761 case "$ans" in
8762 y|Y)    val="$define" ;;     
8763 *)      val="$undef" ;;
8764 esac
8765 set usefaststdio
8766 eval $setvar
8767
8768
8769 : define an is-a-typedef? function
8770 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8771 case "$inclist" in
8772 "") inclist="sys/types.h";;
8773 esac;
8774 eval "varval=\$$var";
8775 case "$varval" in
8776 "")
8777         $rm -f temp.c;
8778         for inc in $inclist; do
8779                 echo "#include <$inc>" >>temp.c;
8780         done;
8781         echo "#ifdef $type" >> temp.c;
8782         echo "printf(\"We have $type\");" >> temp.c;
8783         echo "#endif" >> temp.c;
8784         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8785         if $contains $type temp.E >/dev/null 2>&1; then
8786                 eval "$var=\$type";
8787         else
8788                 eval "$var=\$def";
8789         fi;
8790         $rm -f temp.?;;
8791 *) eval "$var=\$varval";;
8792 esac'
8793
8794 : define an is-a-typedef? function that prompts if the type is not available.
8795 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8796 case "$inclist" in
8797 "") inclist="sys/types.h";;
8798 esac;
8799 eval "varval=\$$var";
8800 case "$varval" in
8801 "")
8802         $rm -f temp.c;
8803         for inc in $inclist; do
8804                 echo "#include <$inc>" >>temp.c;
8805         done;
8806         echo "#ifdef $type" >> temp.c;
8807         echo "printf(\"We have $type\");" >> temp.c;
8808         echo "#endif" >> temp.c;
8809         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8810         echo " " ;
8811         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8812         if $contains $type temp.E >/dev/null 2>&1; then
8813                 echo "$type found." >&4;
8814                 eval "$var=\$type";
8815         else
8816                 echo "$type NOT found." >&4;
8817                 dflt="$def";
8818                 . ./myread ;
8819                 eval "$var=\$ans";
8820         fi;
8821         $rm -f temp.?;;
8822 *) eval "$var=\$varval";;
8823 esac'
8824
8825 : see what type lseek is declared as in the kernel
8826 rp="What is the type used for lseek's offset on this system?"
8827 set off_t lseektype long stdio.h sys/types.h
8828 eval $typedef_ask
8829
8830 echo " "
8831 echo "Checking to see how big your file offsets are..." >&4
8832 $cat >try.c <<EOCP
8833 #include <sys/types.h>
8834 #include <stdio.h>
8835 int main()
8836 {
8837     printf("%d\n", (int)sizeof($lseektype));
8838     return(0); 
8839 }
8840 EOCP
8841 set try
8842 if eval $compile_ok; then
8843         lseeksize=`$run ./try`
8844         echo "Your file offsets are $lseeksize bytes long."
8845 else
8846         dflt=$longsize
8847         echo " "
8848         echo "(I can't seem to compile the test program.  Guessing...)"
8849         rp="What is the size of your file offsets (in bytes)?"
8850         . ./myread
8851         lseeksize="$ans"
8852 fi
8853 $rm -f try.c try
8854
8855 : see what type file positions are declared as in the library
8856 rp="What is the type for file position used by fsetpos()?"
8857 set fpos_t fpostype long stdio.h sys/types.h
8858 eval $typedef_ask
8859
8860 echo " "
8861 case "$fpostype" in
8862 *_t) zzz="$fpostype"    ;;
8863 *)   zzz="fpos_t"       ;;
8864 esac
8865 echo "Checking the size of $zzz..." >&4 
8866 cat > try.c <<EOCP
8867 #include <sys/types.h>
8868 #include <stdio.h>
8869 #$i_stdlib I_STDLIB
8870 #ifdef I_STDLIB
8871 #include <stdlib.h>
8872 #endif
8873 int main() {
8874     printf("%d\n", (int)sizeof($fpostype));
8875     exit(0);
8876 }
8877 EOCP
8878 set try
8879 if eval $compile_ok; then
8880         yyy=`$run ./try`
8881         case "$yyy" in
8882         '')     fpossize=4
8883                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8884                 ;;
8885         *)      fpossize=$yyy
8886                 echo "Your $zzz is $fpossize bytes long."
8887                 ;;
8888         esac
8889 else
8890         dflt="$longsize"
8891         echo " " >&4
8892         echo "(I can't compile the test program.  Guessing...)" >&4
8893         rp="What is the size of your file positions (in bytes)?"
8894         . ./myread
8895         fpossize="$ans"
8896 fi
8897
8898 # Backward compatibility (uselfs is deprecated).
8899 case "$uselfs" in
8900 "$define"|true|[yY]*)
8901         cat <<EOM >&4
8902
8903 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8904 EOM
8905         uselargefiles="$define"
8906         ;;
8907 esac                          
8908
8909 case "$lseeksize:$fpossize" in
8910 8:8) cat <<EOM
8911
8912 You can have files larger than 2 gigabytes.
8913 EOM
8914    val="$define" ;;
8915 *)    case "$uselargefiles" in
8916    "$undef"|false|[nN]*) dflt='n' ;;
8917    *)   dflt='y' ;;
8918    esac
8919    cat <<EOM
8920
8921 Perl can be built to understand large files (files larger than 2 gigabytes)
8922 on some systems.  To do so, Configure can be run with -Duselargefiles.
8923
8924 If this doesn't make any sense to you, just accept the default '$dflt'.
8925 EOM
8926    rp='Try to understand large files, if available?'
8927    . ./myread
8928    case "$ans" in
8929    y|Y)         val="$define" ;;
8930    *)           val="$undef"  ;;
8931    esac
8932    ;;
8933 esac
8934 set uselargefiles
8935 eval $setvar
8936 : Look for a hint-file generated 'call-back-unit'.  If the
8937 : user has specified that a large files perl is to be built,
8938 : we may need to set or change some other defaults.
8939 if $test -f uselargefiles.cbu; then
8940         echo "Your platform has some specific hints regarding large file builds, using them..."
8941         . ./uselargefiles.cbu
8942 fi
8943 case "$uselargefiles" in
8944 "$define")
8945         if $test -f uselargefiles.cbu; then
8946                 echo " "
8947                 echo "Rechecking to see how big your file offsets are..." >&4
8948                 $cat >try.c <<EOCP
8949 #include <sys/types.h>
8950 #include <stdio.h>
8951 int main()
8952 {
8953     printf("%d\n", (int)sizeof($lseektype));
8954     return(0); 
8955 }
8956 EOCP
8957                 set try
8958                 if eval $compile_ok; then
8959                         lseeksize=`$run ./try`
8960                         $echo "Your file offsets are now $lseeksize bytes long."
8961                 else
8962                         dflt="$lseeksize"
8963                         echo " "
8964                         echo "(I can't seem to compile the test program.  Guessing...)"
8965                         rp="What is the size of your file offsets (in bytes)?"
8966                         . ./myread
8967                         lseeksize="$ans"
8968                 fi
8969                 case "$fpostype" in
8970                 *_t) zzz="$fpostype"    ;;
8971                 *)   zzz="fpos_t"       ;;
8972                 esac
8973                 $echo $n "Rechecking the size of $zzz...$c" >&4 
8974                 $cat > try.c <<EOCP
8975 #include <sys/types.h>
8976 #include <stdio.h>
8977 #$i_stdlib I_STDLIB
8978 #ifdef I_STDLIB
8979 #include <stdlib.h>
8980 #endif
8981 int main() {
8982     printf("%d\n", (int)sizeof($fpostype));
8983     return(0);
8984 }
8985 EOCP
8986                 set try
8987                 if eval $compile_ok; then
8988                         yyy=`$run ./try`
8989                         dflt="$lseeksize"
8990                         case "$yyy" in
8991                         '')     echo " "
8992                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8993                                 ;;
8994                         *)      fpossize=$yyy
8995                                 echo " $fpossize bytes." >&4
8996                                 ;;
8997                         esac
8998                 else
8999                         dflt="$fpossize"
9000                         echo " "
9001                         echo "(I can't compile the test program.  Guessing...)" >&4
9002                         rp="What is the size of your file positions (in bytes)?"
9003                         . ./myread
9004                         fpossize="$ans"
9005                 fi
9006                 $rm -f try.c try
9007         fi
9008         ;;
9009 esac
9010
9011 # probably will refer to
9012 #   $archlib $privlib $sitearch $sitelib $vendorarch $vendorlib
9013 need_relocation=0
9014 userelocatableinc=undef
9015
9016 case "$vendorprefix" in
9017 '')     d_vendorbin="$undef"
9018         vendorbin=''
9019         vendorbinexp=''
9020         ;;
9021 *)      d_vendorbin="$define"
9022         : determine where vendor-supplied executables go.
9023         case "$vendorbin" in
9024         '') dflt=$vendorprefix/bin ;;
9025         *)      dflt="$vendorbin" ;;
9026         esac
9027         fn=d~+
9028         rp='Pathname for the vendor-supplied executables directory?'
9029         . ./getfile
9030         vendorbin="$ans"
9031         vendorbinexp="$ansexp"
9032         ;;
9033 esac
9034 : Change installation prefix, if necessary.
9035 if $test X"$prefix" != X"$installprefix"; then
9036         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
9037 else
9038         installvendorbin="$vendorbinexp"
9039 fi
9040
9041 case "$vendorprefix" in
9042 '')     vendorhtml1dir=''
9043         vendorhtml1direxp=''
9044         ;;
9045 *)      : determine where vendor-supplied html pages go.
9046         : There is no standard location, so try to copy the previously-selected
9047         : directory structure for the core html pages.
9048         : XXX Better default suggestions would be welcome.
9049         case "$vendorhtml1dir" in
9050         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9051         *)      dflt=$vendorhtml1dir ;;
9052         esac
9053         case "$dflt" in
9054         ''|' ') dflt=none ;;
9055         esac
9056         fn=dn+~
9057         rp='Pathname for the vendor-supplied html pages?'
9058         . ./getfile
9059         vendorhtml1dir="$ans"
9060         vendorhtml1direxp="$ansexp"
9061         ;;
9062 esac
9063 : Use ' ' for none so value is preserved next time through Configure
9064 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9065 : Change installation prefix, if necessary.
9066 if $test X"$prefix" != X"$installprefix"; then
9067         installvendorhtml1dir=`echo $vendorhtml1direxp | $sed "s#^$prefix#$installprefix#"`
9068 else
9069         installvendorhtml1dir="$vendorhtml1direxp"
9070 fi
9071
9072 case "$vendorprefix" in
9073 '')     vendorhtml3dir=''
9074         vendorhtml3direxp=''
9075         ;;
9076 *)      : determine where vendor-supplied module html pages go.
9077         : There is no standard location, so try to copy the previously-selected
9078         : directory structure for the core html pages.
9079         : XXX Better default suggestions would be welcome.
9080         case "$vendorhtml3dir" in
9081         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9082         *)      dflt=$vendorhtml3dir ;;
9083         esac
9084         case "$dflt" in
9085         ''|' ') dflt=none ;;
9086         esac
9087         fn=dn+~
9088         rp='Pathname for the vendor-supplied html pages?'
9089         . ./getfile
9090         vendorhtml3dir="$ans"
9091         vendorhtml3direxp="$ansexp"
9092         ;;
9093 esac
9094 : Use ' ' for none so value is preserved next time through Configure
9095 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9096 : Change installation prefix, if necessary.
9097 if $test X"$prefix" != X"$installprefix"; then
9098         installvendorhtml3dir=`echo $vendorhtml3direxp | $sed "s#^$prefix#$installprefix#"`
9099 else
9100         installvendorhtml3dir="$vendorhtml3direxp"
9101 fi
9102
9103 case "$vendorprefix" in
9104 '')     vendorman1dir=''
9105         vendorman1direxp=''
9106         ;;
9107 *)      : determine where vendor-supplied manual pages go.
9108         case "$vendorman1dir" in
9109         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9110         *)      dflt=$vendorman1dir ;;
9111         esac
9112         case "$dflt" in
9113         ''|' ') dflt=none ;;
9114         esac
9115         fn=nd~+
9116         rp='Pathname for the vendor-supplied manual section 1 pages?'
9117         . ./getfile
9118         vendorman1dir="$ans"
9119         vendorman1direxp="$ansexp"
9120         ;;
9121 esac
9122 : Use ' ' for none so value is preserved next time through Configure
9123 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9124 : Change installation prefix, if necessary.
9125 if $test X"$prefix" != X"$installprefix"; then
9126         installvendorman1dir=`echo "$vendorman1direxp" | $sed "s#^$prefix#$installprefix#"`
9127 else
9128         installvendorman1dir="$vendorman1direxp"
9129 fi
9130
9131 case "$vendorprefix" in
9132 '')     vendorman3dir=''
9133         vendorman3direxp=''
9134         ;;
9135 *)      : determine where vendor-supplied module manual pages go.
9136         case "$vendorman3dir" in
9137         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9138         *)      dflt=$vendorman3dir ;;
9139         esac
9140         case "$dflt" in
9141         ''|' ') dflt=none ;;
9142         esac
9143         fn=nd~+
9144         rp='Pathname for the vendor-supplied manual section 3 pages?'
9145         . ./getfile
9146         vendorman3dir="$ans"
9147         vendorman3direxp="$ansexp"
9148         ;;
9149 esac
9150 : Use ' ' for none so value is preserved next time through Configure
9151 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9152 : Change installation prefix, if necessary.
9153 if $test X"$prefix" != X"$installprefix"; then
9154         installvendorman3dir=`echo "$vendorman3direxp" | $sed "s#^$prefix#$installprefix#"`
9155 else
9156         installvendorman3dir="$vendorman3direxp"
9157 fi
9158
9159 case "$vendorprefix" in
9160 '')     d_vendorscript="$undef"
9161         vendorscript=''
9162         vendorscriptexp=''
9163         ;;
9164 *)      d_vendorscript="$define"
9165         : determine where vendor-supplied scripts go.
9166         case "$vendorscript" in
9167         '')     dflt=$vendorprefix/script
9168                 $test -d $dflt || dflt=$vendorbin ;;
9169         *)  dflt="$vendorscript" ;;
9170         esac
9171         $cat <<EOM
9172
9173 The installation process will create a directory for 
9174 vendor-supplied scripts.
9175
9176 EOM
9177         fn=d~+
9178         rp='Pathname for the vendor-supplied scripts directory?'
9179         . ./getfile
9180         vendorscript="$ans"
9181         vendorscriptexp="$ansexp"
9182         ;;
9183 esac
9184 : Change installation prefix, if necessary.
9185 if $test X"$prefix" != X"$installprefix"; then
9186         installvendorscript=`echo $vendorscriptexp | $sed "s#^$prefix#$installprefix#"`
9187 else
9188         installvendorscript="$vendorscriptexp"
9189 fi
9190
9191 : see if qgcvt exists
9192 set qgcvt d_qgcvt
9193 eval $inlibc
9194
9195 echo " "
9196
9197 if $test X"$d_longdbl" = X"$define"; then
9198
9199 echo "Checking how to print long doubles..." >&4
9200
9201 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9202         $cat >try.c <<'EOCP'
9203 #include <sys/types.h>
9204 #include <stdio.h>
9205 int main() {
9206   double d = 123.456;
9207   printf("%.3f\n", d);
9208 }
9209 EOCP
9210         set try
9211         if eval $compile; then
9212                 yyy=`$run ./try`
9213                 case "$yyy" in
9214                 123.456)
9215                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9216                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9217                         echo "We will use %f."
9218                         ;;
9219                 esac
9220         fi
9221 fi
9222
9223 if $test X"$sPRIfldbl" = X; then
9224         $cat >try.c <<'EOCP'
9225 #include <sys/types.h>
9226 #include <stdio.h>
9227 int main() {
9228   long double d = 123.456;
9229   printf("%.3Lf\n", d);
9230 }
9231 EOCP
9232         set try
9233         if eval $compile; then
9234                 yyy=`$run ./try`
9235                 case "$yyy" in
9236                 123.456)
9237                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9238                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9239                         echo "We will use %Lf."
9240                         ;;
9241                 esac
9242         fi
9243 fi
9244
9245 if $test X"$sPRIfldbl" = X; then
9246         $cat >try.c <<'EOCP'
9247 #include <sys/types.h>
9248 #include <stdio.h>
9249 int main() {
9250   long double d = 123.456;
9251   printf("%.3llf\n", d);
9252 }
9253 EOCP
9254         set try
9255         if eval $compile; then
9256                 yyy=`$run ./try`
9257                 case "$yyy" in
9258                 123.456)
9259                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9260                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9261                         echo "We will use %llf."
9262                         ;;
9263                 esac
9264         fi
9265 fi
9266
9267 if $test X"$sPRIfldbl" = X; then
9268         $cat >try.c <<'EOCP'
9269 #include <sys/types.h>
9270 #include <stdio.h>
9271 int main() {
9272   long double d = 123.456;
9273   printf("%.3lf\n", d);
9274 }
9275 EOCP
9276         set try
9277         if eval $compile; then
9278                 yyy=`$run ./try`
9279                 case "$yyy" in
9280                 123.456)
9281                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9282                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9283                         echo "We will use %lf."
9284                         ;;
9285                 esac
9286         fi
9287 fi
9288
9289 if $test X"$sPRIfldbl" = X; then
9290         echo "Cannot figure out how to print long doubles." >&4
9291 else
9292         sSCNfldbl=$sPRIfldbl    # expect consistency
9293 fi
9294
9295 $rm -f try try.*
9296
9297 fi # d_longdbl
9298
9299 case "$sPRIfldbl" in
9300 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
9301         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
9302         d_SCNfldbl="$undef";
9303         ;;
9304 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
9305         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
9306         d_SCNfldbl="$define";
9307         ;;
9308 esac
9309
9310 : Check how to convert floats to strings.
9311
9312 if test "X$d_Gconvert" = X; then
9313
9314 echo " "
9315 echo "Checking for an efficient way to convert floats to strings."
9316 echo " " > try.c
9317 case "$uselongdouble" in
9318 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9319 esac
9320 case "$d_longdbl" in
9321 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9322 esac
9323 case "$d_PRIgldbl" in
9324 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9325 esac
9326 $cat >>try.c <<EOP
9327 #ifdef TRY_gconvert
9328 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9329 char *myname = "gconvert";
9330 #endif
9331 #ifdef TRY_gcvt
9332 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9333 char *myname = "gcvt";
9334 #endif
9335 #ifdef TRY_qgcvt
9336 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9337 char *myname = "qgcvt";
9338 #define DOUBLETYPE long double
9339 #endif
9340 #ifdef TRY_sprintf
9341 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9342 #ifdef HAS_PRIgldbl
9343 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9344 #else
9345 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9346 #endif
9347 #else
9348 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9349 #endif
9350 char *myname = "sprintf";
9351 #endif
9352
9353 #ifndef DOUBLETYPE
9354 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9355 #define DOUBLETYPE long double
9356 #else
9357 #define DOUBLETYPE double
9358 #endif
9359 #endif
9360
9361 #include <stdio.h>
9362
9363 #define I_STDLIB $i_stdlib
9364 #ifdef I_STDLIB
9365 #include <stdlib.h>
9366 #endif
9367
9368 int
9369 checkit(expect, got)
9370 char *expect;
9371 char *got;
9372 {
9373     if (strcmp(expect, got)) {
9374                 printf("%s oddity:  Expected %s, got %s\n",
9375                         myname, expect, got);
9376                 exit(1);
9377         }
9378 }
9379
9380 int main()
9381
9382         char buf[64]; 
9383         buf[63] = '\0';
9384
9385         /* This must be 1st test on (which?) platform */
9386         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9387         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9388         checkit("0.1", buf);
9389
9390         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
9391         checkit("0.01", buf);
9392
9393         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
9394         checkit("0.001", buf);
9395
9396         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
9397         checkit("0.0001", buf);
9398
9399         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9400         if (strlen(buf) > 5)
9401             checkit("9e-005", buf); /* for Microsoft ?? */
9402         else
9403             checkit("9e-05", buf);
9404
9405         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
9406         checkit("1", buf);
9407
9408         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
9409         checkit("1.1", buf);
9410
9411         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
9412         checkit("1.01", buf);
9413
9414         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
9415         checkit("1.001", buf);
9416
9417         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
9418         checkit("1.0001", buf);
9419
9420         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
9421         checkit("1.00001", buf);
9422
9423         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
9424         checkit("1.000001", buf);
9425
9426         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
9427         checkit("0", buf);
9428
9429         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
9430         checkit("-1", buf);
9431
9432         /* Some Linux gcvt's give 1.e+5 here. */
9433         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
9434         checkit("100000", buf);
9435         
9436         /* Some Linux gcvt's give -1.e+5 here. */
9437         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
9438         checkit("-100000", buf);
9439
9440         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
9441         checkit("123.456", buf);
9442
9443         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9444         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9445         /* 34 should be enough to scare even long double
9446          * places into using the e notation. */
9447         if (strlen(buf) > 5)
9448             checkit("1e+034", buf); /* for Microsoft */
9449         else
9450             checkit("1e+34", buf);
9451
9452         /* For Perl, if you add additional tests here, also add them to
9453          * t/base/num.t for benefit of platforms not using Configure or
9454          * overriding d_Gconvert */
9455
9456         exit(0);
9457 }
9458 EOP
9459 : first add preferred functions to our list
9460 xxx_list=""
9461 for xxx_convert in $gconvert_preference; do
9462     case $xxx_convert in
9463     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9464     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9465     esac 
9466 done
9467 : then add any others
9468 for xxx_convert in gconvert gcvt sprintf; do
9469     case "$xxx_list" in
9470     *$xxx_convert*) ;;
9471     *) xxx_list="$xxx_list $xxx_convert" ;;
9472     esac 
9473 done
9474
9475 case "$d_longdbl$uselongdouble" in
9476 "$define$define")
9477     : again, add prefered functions to our list first
9478     xxx_ld_list=""
9479     for xxx_convert in $gconvert_ld_preference; do
9480         case $xxx_convert in
9481         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9482         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9483         esac
9484     done
9485     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9486     for xxx_convert in qgcvt sprintf $xxx_list; do
9487         case "$xxx_ld_list" in
9488         $xxx_convert*|*" $xxx_convert"*) ;;
9489         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9490         esac
9491     done
9492     : if sprintf cannot do long doubles, move it to the end
9493     if test "$d_PRIgldbl" != "$define"; then
9494         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9495     fi
9496     : if no qgcvt, remove it
9497     if test "$d_qgcvt" != "$define"; then
9498         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9499     fi
9500     : use the ld_list
9501     xxx_list="$xxx_ld_list"
9502     ;;
9503 esac
9504
9505 for xxx_convert in $xxx_list; do
9506         echo "Trying $xxx_convert..."
9507         $rm -f try try$_o
9508         set try -DTRY_$xxx_convert
9509         if eval $compile; then
9510                 echo "$xxx_convert() found." >&4
9511                 if $run ./try; then
9512                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9513                         break;
9514                 else
9515                         echo "...But $xxx_convert didn't work as I expected."
9516                         xxx_convert=''
9517                 fi
9518         else
9519                 echo "$xxx_convert NOT found." >&4
9520         fi
9521 done
9522
9523 if test X$xxx_convert = X; then
9524     echo "*** WHOA THERE!!! ***" >&4
9525     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9526     xxx_convert=sprintf
9527 fi
9528
9529 case "$xxx_convert" in
9530 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9531 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9532 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9533 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9534    "$define$define$define")
9535       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9536    "$define$define$undef")
9537       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9538    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9539    esac
9540    ;;  
9541 esac
9542
9543 fi
9544
9545 : see if _fwalk exists
9546 set fwalk d__fwalk
9547 eval $inlibc
9548
9549 : Initialize h_fcntl
9550 h_fcntl=false
9551
9552 : Initialize h_sysfile
9553 h_sysfile=false
9554
9555 : access call always available on UNIX
9556 set access d_access
9557 eval $inlibc
9558
9559 : locate the flags for 'access()'
9560 case "$d_access" in
9561 "$define")
9562         echo " "
9563         $cat >access.c <<EOCP
9564 #include <sys/types.h>
9565 #ifdef I_FCNTL
9566 #include <fcntl.h>
9567 #endif
9568 #ifdef I_SYS_FILE
9569 #include <sys/file.h>
9570 #endif
9571 #ifdef I_UNISTD
9572 #include <unistd.h>
9573 #endif
9574 #$i_stdlib I_STDLIB
9575 #ifdef I_STDLIB
9576 #include <stdlib.h>
9577 #endif
9578 int main() {
9579         exit(R_OK);
9580 }
9581 EOCP
9582         : check sys/file.h first, no particular reason here
9583         if $test `./findhdr sys/file.h` && \
9584                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9585                 h_sysfile=true;
9586                 echo "<sys/file.h> defines the *_OK access constants." >&4
9587         elif $test `./findhdr fcntl.h` && \
9588                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9589                 h_fcntl=true;
9590                 echo "<fcntl.h> defines the *_OK access constants." >&4
9591         elif $test `./findhdr unistd.h` && \
9592                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9593                 echo "<unistd.h> defines the *_OK access constants." >&4
9594         else
9595                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9596         fi
9597         ;;
9598 esac
9599 $rm -f access*
9600
9601 : see if accessx exists
9602 set accessx d_accessx
9603 eval $inlibc
9604
9605 : see if aintl exists
9606 set aintl d_aintl
9607 eval $inlibc
9608
9609 : see if alarm exists
9610 set alarm d_alarm
9611 eval $inlibc
9612
9613 : see if POSIX threads are available
9614 set pthread.h i_pthread
9615 eval $inhdr
9616
9617 : define a fucntion to check prototypes
9618 $cat > protochk <<EOSH
9619 $startsh
9620 cc="$cc"
9621 optimize="$optimize"
9622 ccflags="$ccflags"
9623 prototype="$prototype"
9624 define="$define"
9625 rm=$rm
9626 usethreads=$usethreads
9627 i_pthread=$i_pthread
9628 pthread_h_first=$pthread_h_first
9629 EOSH
9630
9631 $cat >> protochk <<'EOSH'
9632
9633 $rm -f try.c
9634 foo="$1"
9635 shift
9636 while test $# -ge 2; do
9637         case "$1" in
9638                 $define) echo "#include <$2>" >> try.c ;;
9639                 literal) echo "$2" >> try.c ;;
9640         esac
9641     # Extra magic for the benefit of systems that need pthread.h
9642     # to be included early to correctly detect threadsafe functions.
9643     # Such functions must guarantee themselves, though, that the usethreads
9644     # and i_pthread have been defined, before calling protochk.
9645     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9646         echo "#include <pthread.h>" >> try.c
9647         pthread_h_done=yes
9648     fi
9649     shift 2
9650 done
9651 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9652 cat >> try.c <<'EOCP'
9653 #ifdef CAN_PROTOTYPE
9654 #define _(args) args
9655 #else
9656 #define _(args) ()
9657 #endif
9658 EOCP
9659 echo "$foo" >> try.c
9660 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9661 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9662 status=$?
9663 $rm -f try.[co]
9664 exit $status
9665 EOSH
9666 chmod +x protochk
9667 $eunicefix protochk
9668
9669 hasproto='varname=$1; func=$2; shift; shift;
9670 while $test $# -ge 2; do
9671         case "$1" in
9672         $define) echo "#include <$2>";;
9673         esac ;
9674     shift 2;
9675 done > try.c;
9676 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9677 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9678         echo "$func() prototype found.";
9679         val="$define";
9680 else
9681         echo "$func() prototype NOT found.";
9682         val="$undef";
9683 fi;
9684 set $varname;
9685 eval $setvar;
9686 $rm -f try.c tryout.c'
9687
9688 : see if sys/types.h has to be included
9689 set sys/types.h i_systypes
9690 eval $inhdr
9691
9692 : see if sys/select.h has to be included
9693 set sys/select.h i_sysselct
9694 eval $inhdr
9695
9696 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9697 while $test $# -ge 2; do
9698         case "$1" in
9699         $define) echo "#include <$2>";;
9700         esac ;
9701     shift 2;
9702 done > try.c;
9703 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9704 set try;
9705 if eval $compile; then
9706         val="$define";
9707 else
9708         val="$undef";
9709 fi;
9710 set $varname;
9711 eval $setvar;
9712 $rm -f try.c try.o'
9713
9714 : see if we should include time.h, sys/time.h, or both
9715 echo " "
9716 if test "X$timeincl" = X; then
9717         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9718         $echo $n "I'm now running the test program...$c"
9719         $cat >try.c <<EOCP
9720 #include <sys/types.h>
9721 #ifdef I_TIME
9722 #include <time.h>
9723 #endif
9724 #ifdef I_SYSTIME
9725 #ifdef SYSTIMEKERNEL
9726 #define KERNEL
9727 #endif
9728 #include <sys/time.h>
9729 #endif
9730 #ifdef I_SYSSELECT
9731 #include <sys/select.h>
9732 #endif
9733 #$i_stdlib I_STDLIB
9734 #ifdef I_STDLIB
9735 #include <stdlib.h>
9736 #endif
9737 int main()
9738 {
9739         struct tm foo;
9740 #ifdef S_TIMEVAL
9741         struct timeval bar;
9742 #endif
9743 #ifdef S_TIMEZONE
9744         struct timezone tzp;
9745 #endif
9746         if (foo.tm_sec == foo.tm_sec)
9747                 exit(0);
9748 #ifdef S_TIMEVAL
9749         if (bar.tv_sec == bar.tv_sec)
9750                 exit(0);
9751 #endif
9752         exit(1);
9753 }
9754 EOCP
9755         flags=''
9756         for s_timezone in '-DS_TIMEZONE' ''; do
9757         sysselect=''
9758         for s_timeval in '-DS_TIMEVAL' ''; do
9759         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9760         for i_time in '' '-DI_TIME'; do
9761         for i_systime in '-DI_SYSTIME' ''; do
9762                 case "$flags" in
9763                 '') $echo $n ".$c"
9764                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9765                         if eval $compile; then
9766                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9767                                 shift
9768                                 flags="$*"
9769                                 echo " "
9770                                 $echo $n "Succeeded with $flags$c"
9771                         fi
9772                         ;;
9773                 esac
9774         done
9775         done
9776         done
9777         done
9778         done
9779         timeincl=''
9780         echo " "
9781         case "$flags" in
9782         *SYSTIMEKERNEL*) i_systimek="$define"
9783                 timeincl=`./findhdr sys/time.h`
9784                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9785         *) i_systimek="$undef";;
9786         esac
9787         case "$flags" in
9788         *I_TIME*) i_time="$define"
9789                 timeincl=`./findhdr time.h`" $timeincl"
9790                 echo "We'll include <time.h>." >&4;;
9791         *) i_time="$undef";;
9792         esac
9793         case "$flags" in
9794         *I_SYSTIME*) i_systime="$define"
9795                 timeincl=`./findhdr sys/time.h`" $timeincl"
9796                 echo "We'll include <sys/time.h>." >&4;;
9797         *) i_systime="$undef";;
9798         esac
9799         $rm -f try.c try
9800 fi
9801 : see if struct tm knows about tm_zone
9802 case "$i_systime$i_time" in
9803 *$define*) 
9804         echo " "
9805         echo "Checking to see if your struct tm has tm_zone field..." >&4
9806         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9807         eval $hasfield
9808         ;;
9809 *)      val="$undef"
9810         set d_tm_tm_zone
9811         eval $setvar
9812         ;;
9813 esac
9814 case "$d_tm_tm_zone" in
9815 "$define")      echo "Yes, it does."   ;;
9816 *)              echo "No, it doesn't." ;;
9817 esac
9818 : see if struct tm knows about tm_gmtoff
9819 case "$i_systime$i_time" in
9820 *$define*) 
9821         echo " "
9822         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9823         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9824         eval $hasfield
9825         ;;
9826 *)      val="$undef"
9827         set d_tm_tm_gmtoff
9828         eval $setvar
9829         ;;
9830 esac
9831 case "$d_tm_tm_gmtoff" in
9832 "$define")      echo "Yes, it does."   ;;
9833 *)              echo "No, it doesn't." ;;
9834 esac
9835
9836 : see if asctime_r exists
9837 set asctime_r d_asctime_r
9838 eval $inlibc
9839 case "$d_asctime_r" in
9840 "$define")
9841         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9842         case "$d_asctime_r_proto:$usethreads" in
9843         ":define")      d_asctime_r_proto=define
9844                 set d_asctime_r_proto asctime_r $hdrs
9845                 eval $hasproto ;;
9846         *)      ;;
9847         esac
9848         case "$d_asctime_r_proto" in
9849         define)
9850         case "$asctime_r_proto" in
9851         ''|0) try='char* asctime_r(const struct tm*, char*);'
9852         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9853         esac
9854         case "$asctime_r_proto" in
9855         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9856         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9857         esac
9858         case "$asctime_r_proto" in
9859         ''|0) try='int asctime_r(const struct tm*, char*);'
9860         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9861         esac
9862         case "$asctime_r_proto" in
9863         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9864         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9865         esac
9866         case "$asctime_r_proto" in
9867         ''|0)   d_asctime_r=undef
9868                 asctime_r_proto=0
9869                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9870         * )     case "$asctime_r_proto" in
9871                 REENTRANT_PROTO*) ;;
9872                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9873                 esac
9874                 echo "Prototype: $try" ;;
9875         esac
9876         ;;
9877         *)      case "$usethreads" in
9878                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9879                 esac
9880                 d_asctime_r=undef
9881                 asctime_r_proto=0
9882                 ;;
9883         esac
9884         ;;
9885 *)      asctime_r_proto=0
9886         ;;
9887 esac
9888
9889 : see if atolf exists
9890 set atolf d_atolf
9891 eval $inlibc
9892
9893 : see if atoll exists
9894 set atoll d_atoll
9895 eval $inlibc
9896
9897 : Look for GCC-style attribute format
9898 case "$d_attribute_format" in
9899 '')
9900 echo " "
9901 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
9902 $cat >attrib.c <<'EOCP'
9903 #include <stdio.h>
9904 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
9905 EOCP
9906 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9907         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9908                 echo "Your C compiler doesn't support __attribute__((format))."
9909                 val="$undef"
9910         else
9911                 echo "Your C compiler supports __attribute__((format))."
9912                 val="$define"
9913         fi
9914 else
9915         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9916         val="$undef"
9917 fi
9918 ;;
9919 *) val="$d_attribute_format" ;;
9920 esac
9921 set d_attribute_format
9922 eval $setvar
9923 $rm -f attrib*
9924
9925 : Look for GCC-style attribute malloc
9926 case "$d_attribute_malloc" in
9927 '')
9928 echo " "
9929 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
9930 $cat >attrib.c <<'EOCP'
9931 #include <stdio.h>
9932 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
9933 EOCP
9934 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9935         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9936                 echo "Your C compiler doesn't support __attribute__((malloc))."
9937                 val="$undef"
9938         else
9939                 echo "Your C compiler supports __attribute__((malloc))."
9940                 val="$define"
9941         fi
9942 else
9943         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9944         val="$undef"
9945 fi
9946 ;;
9947 *) val="$d_attribute_malloc" ;;
9948 esac
9949 set d_attribute_malloc
9950 eval $setvar
9951 $rm -f attrib*
9952
9953 : Look for GCC-style attribute nonnull
9954 case "$d_attribute_nonnull" in
9955 '')
9956 echo " "
9957 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
9958 $cat >attrib.c <<'EOCP'
9959 #include <stdio.h>
9960 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
9961 EOCP
9962 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9963         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9964                 echo "Your C compiler doesn't support __attribute__((nonnull))."
9965                 val="$undef"
9966         else
9967                 echo "Your C compiler supports __attribute__((nonnull))."
9968                 val="$define"
9969         fi
9970 else
9971         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9972         val="$undef"
9973 fi
9974 ;;
9975 *) val="$d_attribute_nonnull" ;;
9976 esac
9977 set d_attribute_nonnull
9978 eval $setvar
9979 $rm -f attrib*
9980
9981 : Look for GCC-style attribute noreturn
9982 case "$d_attribute_noreturn" in
9983 '')
9984 echo " "
9985 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
9986 $cat >attrib.c <<'EOCP'
9987 #include <stdio.h>
9988 void fall_over_dead( void ) __attribute__((noreturn));
9989 EOCP
9990 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9991         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9992                 echo "Your C compiler doesn't support __attribute__((noreturn))."
9993                 val="$undef"
9994         else
9995                 echo "Your C compiler supports __attribute__((noreturn))."
9996                 val="$define"
9997         fi
9998 else
9999         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10000         val="$undef"
10001 fi
10002 ;;
10003 *) val="$d_attribute_noreturn" ;;
10004 esac
10005 set d_attribute_noreturn
10006 eval $setvar
10007 $rm -f attrib*
10008
10009 : Look for GCC-style attribute pure
10010 case "$d_attribute_pure" in
10011 '')
10012 echo " "
10013 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10014 $cat >attrib.c <<'EOCP'
10015 #include <stdio.h>
10016 int square( int n ) __attribute__((pure));
10017 EOCP
10018 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10019         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10020                 echo "Your C compiler doesn't support __attribute__((pure))."
10021                 val="$undef"
10022         else
10023                 echo "Your C compiler supports __attribute__((pure))."
10024                 val="$define"
10025         fi
10026 else
10027         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10028         val="$undef"
10029 fi
10030 ;;
10031 *) val="$d_attribute_pure" ;;
10032 esac
10033 set d_attribute_pure
10034 eval $setvar
10035 $rm -f attrib*
10036
10037 : Look for GCC-style attribute unused
10038 case "$d_attribute_unused" in
10039 '')
10040 echo " "
10041 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10042 $cat >attrib.c <<'EOCP'
10043 #include <stdio.h>
10044 int do_something( int dummy __attribute__((unused)), int n );
10045 EOCP
10046 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10047         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10048                 echo "Your C compiler doesn't support __attribute__((unused))."
10049                 val="$undef"
10050         else
10051                 echo "Your C compiler supports __attribute__((unused))."
10052                 val="$define"
10053         fi
10054 else
10055         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10056         val="$undef"
10057 fi
10058 ;;
10059 *) val="$d_attribute_unused" ;;
10060 esac
10061 set d_attribute_unused
10062 eval $setvar
10063 $rm -f attrib*
10064
10065 : Look for GCC-style attribute warn_unused_result
10066 case "$d_attribute_warn_unused_result" in
10067 '')
10068 echo " "
10069 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10070 $cat >attrib.c <<'EOCP'
10071 #include <stdio.h>
10072 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10073 EOCP
10074 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10075         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10076                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10077                 val="$undef"
10078         else
10079                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10080                 val="$define"
10081         fi
10082 else
10083         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10084         val="$undef"
10085 fi
10086 ;;
10087 *) val="$d_attribute_warn_unused_result" ;;
10088 esac
10089 set d_attribute_warn_unused_result
10090 eval $setvar
10091 $rm -f attrib*
10092
10093 : see if bcmp exists
10094 set bcmp d_bcmp
10095 eval $inlibc
10096
10097 : see if bcopy exists
10098 set bcopy d_bcopy
10099 eval $inlibc
10100
10101 : see if this is a unistd.h system
10102 set unistd.h i_unistd
10103 eval $inhdr
10104
10105 : see if getpgrp exists
10106 set getpgrp d_getpgrp
10107 eval $inlibc
10108
10109 case "$d_getpgrp" in
10110 "$define")
10111         echo " "
10112         echo "Checking to see which flavor of getpgrp is in use..."
10113         $cat >try.c <<EOP
10114 #$i_unistd I_UNISTD
10115 #include <sys/types.h>
10116 #ifdef I_UNISTD
10117 #  include <unistd.h>
10118 #endif
10119 #$i_stdlib I_STDLIB
10120 #ifdef I_STDLIB
10121 #include <stdlib.h>
10122 #endif
10123 int main()
10124 {
10125         if (getuid() == 0) {
10126                 printf("(I see you are running Configure as super-user...)\n");
10127                 setuid(1);
10128         }
10129 #ifdef TRY_BSD_PGRP
10130         if (getpgrp(1) == 0)
10131                 exit(0);
10132 #else
10133         if (getpgrp() > 0)
10134                 exit(0);
10135 #endif
10136         exit(1);
10137 }
10138 EOP
10139         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10140                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10141                 val="$define"
10142         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10143                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10144                 val="$undef"
10145         else
10146                 echo "I can't seem to compile and run the test program."
10147                 if ./usg; then
10148                         xxx="a USG one, i.e. you use getpgrp()."
10149                 else
10150                         # SVR4 systems can appear rather BSD-ish.
10151                         case "$i_unistd" in
10152                         $undef)
10153                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10154                                 val="$define"
10155                                 ;;
10156                         $define)
10157                                 xxx="probably a USG one, i.e. you use getpgrp()."
10158                                 val="$undef"
10159                                 ;;
10160                         esac
10161                 fi
10162                 echo "Assuming your getpgrp is $xxx" >&4
10163         fi
10164         ;;
10165 *) val="$undef";;
10166 esac
10167 set d_bsdgetpgrp
10168 eval $setvar
10169 $rm -f try try.*
10170
10171 : see if setpgrp exists
10172 set setpgrp d_setpgrp
10173 eval $inlibc
10174
10175 case "$d_setpgrp" in
10176 "$define")
10177         echo " "
10178         echo "Checking to see which flavor of setpgrp is in use..."
10179         $cat >try.c <<EOP
10180 #$i_unistd I_UNISTD
10181 #include <sys/types.h>
10182 #ifdef I_UNISTD
10183 #  include <unistd.h>
10184 #endif
10185 #$i_stdlib I_STDLIB
10186 #ifdef I_STDLIB
10187 #include <stdlib.h>
10188 #endif
10189 int main()
10190 {
10191         if (getuid() == 0) {
10192                 printf("(I see you are running Configure as super-user...)\n");
10193                 setuid(1);
10194         }
10195 #ifdef TRY_BSD_PGRP
10196         if (-1 == setpgrp(1, 1))
10197                 exit(0);
10198 #else
10199         if (setpgrp() != -1)
10200                 exit(0);
10201 #endif
10202         exit(1);
10203 }
10204 EOP
10205         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10206                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10207                 val="$define"
10208         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10209                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10210                 val="$undef"
10211         else
10212                 echo "(I can't seem to compile and run the test program.)"
10213                 if ./usg; then
10214                         xxx="a USG one, i.e. you use setpgrp()."
10215                 else
10216                         # SVR4 systems can appear rather BSD-ish.
10217                         case "$i_unistd" in
10218                         $undef)
10219                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10220                                 val="$define"
10221                                 ;;
10222                         $define)
10223                                 xxx="probably a USG one, i.e. you use setpgrp()."
10224                                 val="$undef"
10225                                 ;;
10226                         esac
10227                 fi
10228                 echo "Assuming your setpgrp is $xxx" >&4
10229         fi
10230         ;;
10231 *) val="$undef";;
10232 esac
10233 set d_bsdsetpgrp
10234 eval $setvar
10235 $rm -f try try.*
10236 : see if bzero exists
10237 set bzero d_bzero
10238 eval $inlibc
10239
10240 : see if signal is declared as pointer to function returning int or void
10241 echo " "
10242 xxx=`./findhdr signal.h`
10243 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10244 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10245         echo "You have int (*signal())() instead of void." >&4
10246         val="$undef"
10247 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10248         echo "You have void (*signal())()." >&4
10249         val="$define"
10250 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10251         echo "You have int (*signal())() instead of void." >&4
10252         val="$undef"
10253 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10254         echo "You have void (*signal())()." >&4
10255         val="$define"
10256 else
10257         case "$d_voidsig" in
10258         '')
10259         echo "I can't determine whether signal handler returns void or int..." >&4
10260                 dflt=void
10261                 rp="What type does your signal handler return?"
10262                 . ./myread
10263                 case "$ans" in
10264                 v*) val="$define";;
10265                 *) val="$undef";;
10266                 esac;;
10267         "$define")
10268                 echo "As you already told me, signal handler returns void." >&4
10269                 val="$define"
10270                 ;;
10271         *)      echo "As you already told me, signal handler returns int." >&4
10272                 val="$undef"
10273                 ;;
10274         esac
10275 fi
10276 set d_voidsig
10277 eval $setvar
10278 case "$d_voidsig" in
10279 "$define") signal_t="void";;
10280 *) signal_t="int";;
10281 esac
10282 $rm -f $$.tmp
10283
10284 : check for ability to cast large floats to 32-bit ints.
10285 echo " "
10286 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10287 if $test "$intsize" -ge 4; then
10288         xxx=int
10289 else
10290         xxx=long
10291 fi
10292 $cat >try.c <<EOCP
10293 #include <stdio.h>
10294 #$i_stdlib I_STDLIB
10295 #ifdef I_STDLIB
10296 #include <stdlib.h>
10297 #endif
10298 #include <sys/types.h>
10299 #include <signal.h>
10300 $signal_t blech(s) int s; { exit(3); }
10301 int main()
10302 {
10303         $xxx i32;
10304         double f, g;
10305         int result = 0;
10306         char str[16];
10307         signal(SIGFPE, blech);
10308
10309         /* Don't let compiler optimize the test away.  Store the number 
10310            in a writable string for gcc to pass to sscanf under HP/UX.
10311         */
10312         sprintf(str, "2147483647");
10313         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10314         g = 10 * f;
10315         i32  = ($xxx) g;
10316
10317         /* x86 processors will probably give 0x8000 0000, which is a
10318            sign change.  We don't want that.  We want to mimic SPARC
10319            behavior here, which is to preserve the sign and give
10320            back 0x7fff ffff.
10321         */
10322         if (i32 != ($xxx) f)
10323                 result |= 1;
10324         exit(result);
10325 }
10326 EOCP
10327 set try
10328 if eval $compile_ok; then
10329         $run ./try
10330         yyy=$?
10331 else
10332         echo "(I can't seem to compile the test program--assuming it can't)"
10333         yyy=1
10334 fi
10335 case "$yyy" in
10336 0)      val="$define"
10337         echo "Yup, it can."
10338         ;;
10339 *)      val="$undef"
10340         echo "Nope, it can't."
10341         ;;
10342 esac
10343 set d_casti32
10344 eval $setvar
10345 $rm -f try try.*
10346
10347 : check for ability to cast negative floats to unsigned
10348 echo " "
10349 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10350 $cat >try.c <<EOCP
10351 #include <stdio.h>
10352 #$i_stdlib I_STDLIB
10353 #ifdef I_STDLIB
10354 #include <stdlib.h>
10355 #endif
10356 #include <sys/types.h>
10357 #include <signal.h>
10358 $signal_t blech(s) int s; { exit(7); }
10359 $signal_t blech_in_list(s) int s; { exit(4); }
10360 unsigned long dummy_long(p) unsigned long p; { return p; }
10361 unsigned int dummy_int(p) unsigned int p; { return p; }
10362 unsigned short dummy_short(p) unsigned short p; { return p; }
10363 int main()
10364 {
10365         double f;
10366         unsigned long along;
10367         unsigned int aint;
10368         unsigned short ashort;
10369         int result = 0;
10370         char str[16];
10371         
10372         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10373            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10374            optimized the whole file away
10375         */
10376         /* Store the number in a writable string for gcc to pass to 
10377            sscanf under HP/UX.
10378         */
10379         sprintf(str, "-123");
10380         sscanf(str, "%lf", &f);  /* f = -123.; */
10381
10382         signal(SIGFPE, blech);
10383         along = (unsigned long)f;
10384         aint = (unsigned int)f;
10385         ashort = (unsigned short)f;
10386         if (along != (unsigned long)-123)
10387                 result |= 1;
10388         if (aint != (unsigned int)-123)
10389                 result |= 1;
10390         if (ashort != (unsigned short)-123)
10391                 result |= 1;
10392         sprintf(str, "1073741824.");
10393         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10394         f = f + f;
10395         along = 0;
10396         along = (unsigned long)f;
10397         if (along != 0x80000000)
10398                 result |= 2;
10399         f -= 1.;
10400         along = 0;
10401         along = (unsigned long)f;
10402         if (along != 0x7fffffff)
10403                 result |= 1;
10404         f += 2.;
10405         along = 0;
10406         along = (unsigned long)f;
10407         if (along != 0x80000001)
10408                 result |= 2;
10409         if (result)
10410                 exit(result);
10411         signal(SIGFPE, blech_in_list);
10412         sprintf(str, "123.");
10413         sscanf(str, "%lf", &f);  /* f = 123.; */
10414         along = dummy_long((unsigned long)f);
10415         aint = dummy_int((unsigned int)f);
10416         ashort = dummy_short((unsigned short)f);
10417         if (along != (unsigned long)123)
10418                 result |= 4;
10419         if (aint != (unsigned int)123)
10420                 result |= 4;
10421         if (ashort != (unsigned short)123)
10422                 result |= 4;
10423         exit(result);
10424
10425 }
10426 EOCP
10427 set try
10428 if eval $compile_ok; then
10429         $run ./try
10430         castflags=$?
10431 else
10432         echo "(I can't seem to compile the test program--assuming it can't)"
10433         castflags=7
10434 fi
10435 case "$castflags" in
10436 0)      val="$define"
10437         echo "Yup, it can."
10438         ;;
10439 *)      val="$undef"
10440         echo "Nope, it can't."
10441         ;;
10442 esac
10443 set d_castneg
10444 eval $setvar
10445 $rm -f try.*
10446
10447 : see if vprintf exists
10448 echo " "
10449 if set vprintf val -f d_vprintf; eval $csym; $val; then
10450         echo 'vprintf() found.' >&4
10451         val="$define"
10452         $cat >try.c <<EOF
10453 #include <varargs.h>
10454 #$i_stdlib I_STDLIB
10455 #ifdef I_STDLIB
10456 #include <stdlib.h>
10457 #endif
10458
10459 int main() { xxx("foo"); }
10460
10461 xxx(va_alist)
10462 va_dcl
10463 {
10464         va_list args;
10465         char buf[10];
10466
10467         va_start(args);
10468         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10469 }
10470 EOF
10471         set try
10472         if eval $compile && $run ./try; then
10473                 echo "Your vsprintf() returns (int)." >&4
10474                 val2="$undef"
10475         else
10476                 echo "Your vsprintf() returns (char*)." >&4
10477                 val2="$define"
10478         fi
10479 else
10480         echo 'vprintf() NOT found.' >&4
10481                 val="$undef"
10482                 val2="$undef"
10483 fi
10484 $rm -f try try.*
10485 set d_vprintf
10486 eval $setvar
10487 val=$val2
10488 set d_charvspr
10489 eval $setvar
10490
10491 : see if chown exists
10492 set chown d_chown
10493 eval $inlibc
10494
10495 : see if chroot exists
10496 set chroot d_chroot
10497 eval $inlibc
10498
10499 : see if chsize exists
10500 set chsize d_chsize
10501 eval $inlibc
10502
10503 : see if class exists
10504 set class d_class
10505 eval $inlibc
10506
10507 hasstruct='varname=$1; struct=$2; shift; shift;
10508 while $test $# -ge 2; do
10509         case "$1" in
10510         $define) echo "#include <$2>";;
10511         esac ;
10512     shift 2;
10513 done > try.c;
10514 echo "int main () { struct $struct foo; }" >> try.c;
10515 set try;
10516 if eval $compile; then
10517         val="$define";
10518 else
10519         val="$undef";
10520 fi;
10521 set $varname;
10522 eval $setvar;
10523 $rm -f try.c try.o'
10524
10525 socketlib=''
10526 sockethdr=''
10527 : see whether socket exists
10528 echo " "
10529 $echo $n "Hmm... $c" >&4
10530 if set socket val -f d_socket; eval $csym; $val; then
10531         echo "Looks like you have Berkeley networking support." >&4
10532         d_socket="$define"
10533         if set setsockopt val -f; eval $csym; $val; then
10534                 d_oldsock="$undef"
10535         else
10536                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10537                 d_oldsock="$define"
10538         fi
10539 else
10540         if $contains socklib libc.list >/dev/null 2>&1; then
10541                 echo "Looks like you have Berkeley networking support." >&4
10542                 d_socket="$define"
10543                 : we will have to assume that it supports the 4.2 BSD interface
10544                 d_oldsock="$undef"
10545         else
10546                 echo "You don't have Berkeley networking in libc$_a..." >&4
10547                 if test "X$d_socket" = "X$define"; then
10548                    echo "...but you seem to believe that you have sockets." >&4
10549                 else
10550                         for net in net socket
10551                         do
10552                                 if test -f /usr/lib/lib$net$_a; then
10553                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10554                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10555                                         if $contains socket libc.list >/dev/null 2>&1; then
10556                                                 d_socket="$define"
10557                                                 socketlib="-l$net"
10558                                                 case "$net" in
10559                                                 net)
10560                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10561                                                         sockethdr="-I/usr/netinclude"
10562                                                         ;;
10563                                                 esac
10564                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
10565                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10566                                                         d_oldsock="$undef"
10567                                                 else
10568                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10569                                                         d_oldsock="$define"
10570                                                 fi
10571                                                 break
10572                                         fi
10573                                 fi
10574                         done
10575                         if test "X$d_socket" != "X$define"; then
10576                            echo "or anywhere else I see." >&4
10577                            d_socket="$undef"
10578                            d_oldsock="$undef"
10579                         fi
10580                 fi
10581         fi
10582 fi
10583
10584 : see if socketpair exists
10585 set socketpair d_sockpair
10586 eval $inlibc
10587
10588
10589 echo " "
10590 echo "Checking the availability of certain socket constants..." >&4
10591 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10592         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10593         $cat >try.c <<EOF
10594 #include <sys/types.h>
10595 #include <sys/socket.h>
10596 int main() {
10597     int i = $ENUM;
10598 }
10599 EOF
10600         val="$undef"
10601         set try; if eval $compile; then
10602                 val="$define"
10603         fi
10604         set d_${enum}; eval $setvar
10605         $rm -f try.c try
10606 done
10607
10608 : see if this is a sys/uio.h system
10609 set sys/uio.h i_sysuio
10610 eval $inhdr
10611
10612
10613 echo " "
10614 echo "Checking to see if your system supports struct cmsghdr..." >&4
10615 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10616 eval $hasstruct
10617 case "$d_cmsghdr_s" in
10618 "$define")      echo "Yes, it does."   ;;
10619 *)              echo "No, it doesn't." ;;
10620 esac
10621
10622
10623 : check for const keyword
10624 echo " "
10625 echo 'Checking to see if your C compiler knows about "const"...' >&4
10626 $cat >const.c <<'EOCP'
10627 typedef struct spug { int drokk; } spug;
10628 int main()
10629 {
10630         const char *foo;
10631         const spug y;
10632 }
10633 EOCP
10634 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10635         val="$define"
10636         echo "Yup, it does."
10637 else
10638         val="$undef"
10639         echo "Nope, it doesn't."
10640 fi
10641 set d_const
10642 eval $setvar
10643
10644 : see if copysignl exists
10645 set copysignl d_copysignl
10646 eval $inlibc
10647
10648 : see if crypt exists
10649 echo " "
10650 set crypt d_crypt
10651 eval $inlibc
10652 case "$d_crypt" in
10653 $define) cryptlib='' ;;
10654 *)      if set crypt val -f d_crypt; eval $csym; $val; then
10655                 echo 'crypt() found.' >&4
10656                 val="$define"
10657                 cryptlib=''
10658         else
10659                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10660                 if $test -z "$cryptlib"; then
10661                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10662                 else
10663                         cryptlib=-lcrypt
10664                 fi
10665                 if $test -z "$cryptlib"; then
10666                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10667                 else
10668                         cryptlib=-lcrypt
10669                 fi
10670                 if $test -z "$cryptlib"; then
10671                         cryptlib=`./loc libcrypt$_a "" $libpth`
10672                 else
10673                         cryptlib=-lcrypt
10674                 fi
10675                 if $test -z "$cryptlib"; then
10676                         echo 'crypt() NOT found.' >&4
10677                         val="$undef"
10678                 else
10679                         val="$define"
10680                 fi
10681         fi
10682         set d_crypt
10683         eval $setvar
10684         ;;
10685 esac
10686
10687 : see if this is a crypt.h system
10688 set crypt.h i_crypt
10689 eval $inhdr
10690
10691 : see if crypt_r exists
10692 set crypt_r d_crypt_r
10693 eval $inlibc
10694 case "$d_crypt_r" in
10695 "$define")
10696         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
10697         case "$d_crypt_r_proto:$usethreads" in
10698         ":define")      d_crypt_r_proto=define
10699                 set d_crypt_r_proto crypt_r $hdrs
10700                 eval $hasproto ;;
10701         *)      ;;
10702         esac
10703         case "$d_crypt_r_proto" in
10704         define)
10705         case "$crypt_r_proto" in
10706         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10707         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10708         esac
10709         case "$crypt_r_proto" in
10710         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10711         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10712         esac
10713         case "$crypt_r_proto" in
10714         ''|0)   d_crypt_r=undef
10715                 crypt_r_proto=0
10716                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10717         * )     case "$crypt_r_proto" in
10718                 REENTRANT_PROTO*) ;;
10719                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10720                 esac
10721                 echo "Prototype: $try" ;;
10722         esac
10723         ;;
10724         *)      case "$usethreads" in
10725                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10726                 esac
10727                 d_crypt_r=undef
10728                 crypt_r_proto=0
10729                 ;;
10730         esac
10731         ;;
10732 *)      crypt_r_proto=0
10733         ;;
10734 esac
10735
10736 : get csh whereabouts
10737 case "$csh" in
10738 'csh') val="$undef" ;;
10739 *) val="$define" ;;
10740 esac
10741 set d_csh
10742 eval $setvar
10743 : Respect a hint or command line value for full_csh.
10744 case "$full_csh" in
10745 '') full_csh=$csh ;;
10746 esac
10747
10748 : see if ctermid_r exists
10749 set ctermid_r d_ctermid_r
10750 eval $inlibc
10751 case "$d_ctermid_r" in
10752 "$define")
10753         hdrs="$i_systypes sys/types.h define stdio.h "
10754         case "$d_ctermid_r_proto:$usethreads" in
10755         ":define")      d_ctermid_r_proto=define
10756                 set d_ctermid_r_proto ctermid_r $hdrs
10757                 eval $hasproto ;;
10758         *)      ;;
10759         esac
10760         case "$d_ctermid_r_proto" in
10761         define)
10762         case "$ctermid_r_proto" in
10763         ''|0) try='char* ctermid_r(char*);'
10764         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10765         esac
10766         case "$ctermid_r_proto" in
10767         ''|0)   d_ctermid_r=undef
10768                 ctermid_r_proto=0
10769                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10770         * )     case "$ctermid_r_proto" in
10771                 REENTRANT_PROTO*) ;;
10772                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10773                 esac
10774                 echo "Prototype: $try" ;;
10775         esac
10776         ;;
10777         *)      case "$usethreads" in
10778                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10779                 esac
10780                 d_ctermid_r=undef
10781                 ctermid_r_proto=0
10782                 ;;
10783         esac
10784         ;;
10785 *)      ctermid_r_proto=0
10786         ;;
10787 esac
10788
10789 : see if ctime_r exists
10790 set ctime_r d_ctime_r
10791 eval $inlibc
10792 case "$d_ctime_r" in
10793 "$define")
10794         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10795         case "$d_ctime_r_proto:$usethreads" in
10796         ":define")      d_ctime_r_proto=define
10797                 set d_ctime_r_proto ctime_r $hdrs
10798                 eval $hasproto ;;
10799         *)      ;;
10800         esac
10801         case "$d_ctime_r_proto" in
10802         define)
10803         case "$ctime_r_proto" in
10804         ''|0) try='char* ctime_r(const time_t*, char*);'
10805         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10806         esac
10807         case "$ctime_r_proto" in
10808         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10809         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10810         esac
10811         case "$ctime_r_proto" in
10812         ''|0) try='int ctime_r(const time_t*, char*);'
10813         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10814         esac
10815         case "$ctime_r_proto" in
10816         ''|0) try='int ctime_r(const time_t*, char*, int);'
10817         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10818         esac
10819         case "$ctime_r_proto" in
10820         ''|0)   d_ctime_r=undef
10821                 ctime_r_proto=0
10822                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10823         * )     case "$ctime_r_proto" in
10824                 REENTRANT_PROTO*) ;;
10825                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10826                 esac
10827                 echo "Prototype: $try" ;;
10828         esac
10829         ;;
10830         *)      case "$usethreads" in
10831                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10832                 esac
10833                 d_ctime_r=undef
10834                 ctime_r_proto=0
10835                 ;;
10836         esac
10837         ;;
10838 *)      ctime_r_proto=0
10839         ;;
10840 esac
10841
10842 : see if cuserid exists
10843 set cuserid d_cuserid
10844 eval $inlibc
10845
10846 : see if this is a limits.h system
10847 set limits.h i_limits
10848 eval $inhdr
10849
10850 : see if this is a float.h system
10851 set float.h i_float
10852 eval $inhdr
10853
10854 : See if number of significant digits in a double precision number is known
10855 echo " "
10856 $cat >dbl_dig.c <<EOM
10857 #$i_limits I_LIMITS
10858 #$i_float I_FLOAT
10859 #ifdef I_LIMITS
10860 #include <limits.h>
10861 #endif
10862 #ifdef I_FLOAT
10863 #include <float.h>
10864 #endif
10865 #ifdef DBL_DIG
10866 printf("Contains DBL_DIG");
10867 #endif
10868 EOM
10869 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10870 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10871         echo "DBL_DIG found." >&4
10872         val="$define"
10873 else
10874         echo "DBL_DIG NOT found." >&4
10875         val="$undef"
10876 fi
10877 $rm -f dbl_dig.?
10878 set d_dbl_dig
10879 eval $setvar
10880
10881 : see if dbm.h is available
10882 : see if dbmclose exists
10883 set dbmclose d_dbmclose
10884 eval $inlibc
10885
10886 case "$d_dbmclose" in
10887 $define)
10888         set dbm.h i_dbm
10889         eval $inhdr
10890         case "$i_dbm" in
10891         $define)
10892                 val="$undef"
10893                 set i_rpcsvcdbm
10894                 eval $setvar
10895                 ;;
10896         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10897                 eval $inhdr
10898                 ;;
10899         esac
10900         ;;
10901 *)      echo "We won't be including <dbm.h>"
10902         val="$undef"
10903         set i_dbm
10904         eval $setvar
10905         val="$undef"
10906         set i_rpcsvcdbm
10907         eval $setvar
10908         ;;
10909 esac
10910
10911 : see if prototype for dbminit is available
10912 echo " "
10913 set d_dbminitproto dbminit $i_dbm dbm.h
10914 eval $hasproto
10915
10916 : see if difftime exists
10917 set difftime d_difftime
10918 eval $inlibc
10919
10920 : see if this is a dirent system
10921 echo " "
10922 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10923         val="$define"
10924         echo "<dirent.h> found." >&4
10925 else
10926         val="$undef"
10927         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10928                 echo "<sys/dir.h> found." >&4
10929                 echo " "
10930         else
10931                 xinc=`./findhdr sys/ndir.h`
10932         fi
10933         echo "<dirent.h> NOT found." >&4
10934 fi
10935 set i_dirent
10936 eval $setvar
10937
10938 : Look for type of directory structure.
10939 echo " "
10940 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10941
10942 case "$direntrytype" in
10943 ''|' ')
10944         case "$i_dirent" in
10945         $define) guess1='struct dirent' ;;
10946         *) guess1='struct direct'  ;;
10947         esac
10948         ;;
10949 *)      guess1="$direntrytype"
10950         ;;
10951 esac
10952
10953 case "$guess1" in
10954 'struct dirent') guess2='struct direct' ;;
10955 *) guess2='struct dirent' ;;
10956 esac
10957                 
10958 if $contains "$guess1" try.c >/dev/null 2>&1; then
10959         direntrytype="$guess1"
10960         echo "Your directory entries are $direntrytype." >&4
10961 elif $contains "$guess2" try.c >/dev/null 2>&1; then
10962         direntrytype="$guess2"
10963         echo "Your directory entries seem to be $direntrytype." >&4
10964 else
10965         echo "I don't recognize your system's directory entries." >&4
10966         rp="What type is used for directory entries on this system?"
10967         dflt="$guess1"
10968         . ./myread
10969         direntrytype="$ans"
10970 fi
10971 $rm -f try.c
10972
10973
10974 : see if the directory entry stores field length
10975 echo " "
10976 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10977 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10978         echo "Good, your directory entry keeps length information in d_namlen." >&4
10979         val="$define"
10980 else
10981         echo "Your directory entry does not know about the d_namlen field." >&4
10982         val="$undef"
10983 fi
10984 set d_dirnamlen
10985 eval $setvar
10986 $rm -f try.c
10987
10988 : see if this is an sysdir system
10989 set sys/dir.h i_sysdir
10990 eval $inhdr
10991
10992 : see if this is an sysndir system
10993 set sys/ndir.h i_sysndir
10994 eval $inhdr
10995
10996 : Look for dirfd
10997 echo " "
10998 $cat >dirfd.c <<EOM
10999 #include <stdio.h>
11000 #$i_stdlib I_STDLIB
11001 #ifdef I_STDLIB
11002 #include <stdlib.h>
11003 #endif
11004 #$i_dirent I_DIRENT             /**/
11005 #$i_sysdir I_SYS_DIR            /**/
11006 #$i_sysndir I_SYS_NDIR          /**/
11007 #$i_systypes I_SYS_TYPES        /**/
11008 #if defined(I_SYS_TYPES)
11009 #include <sys/types.h>
11010 #endif
11011 #if defined(I_DIRENT)
11012 #include <dirent.h>
11013 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11014 #include <sys/dir.h>
11015 #endif
11016 #else
11017 #ifdef I_SYS_NDIR
11018 #include <sys/ndir.h>
11019 #else
11020 #ifdef I_SYS_DIR
11021 #ifdef hp9000s500
11022 #include <ndir.h>       /* may be wrong in the future */
11023 #else
11024 #include <sys/dir.h>
11025 #endif
11026 #endif
11027 #endif
11028 #endif 
11029 int main() {
11030         DIR *dirp = opendir(".");
11031         if (dirfd(dirp) >= 0)
11032                 exit(0);
11033         else
11034                 exit(1);
11035 }
11036 EOM
11037 val=$undef
11038 set dirfd
11039 if eval $compile; then
11040         val="$define"
11041 fi
11042 case "$val" in
11043 $define)        echo "dirfd() found." >&4       ;;
11044 *)              echo "dirfd() NOT found." >&4   ;;
11045 esac
11046 set d_dirfd
11047 eval $setvar
11048 $rm -f dirfd*
11049
11050 : see if dlerror exists
11051 xxx_runnm="$runnm"
11052 runnm=false
11053 set dlerror d_dlerror
11054 eval $inlibc
11055 runnm="$xxx_runnm"
11056
11057 : see if dlfcn is available
11058 set dlfcn.h i_dlfcn
11059 eval $inhdr
11060
11061 case "$usedl" in
11062 $define|y|true)
11063         $cat << EOM
11064
11065 On a few systems, the dynamically loaded modules that perl generates and uses
11066 will need a different extension than shared libs. The default will probably
11067 be appropriate.
11068
11069 EOM
11070         case "$dlext" in
11071         '')     dflt="$so" ;;
11072         *)      dflt="$dlext" ;;
11073         esac
11074         rp='What is the extension of dynamically loaded modules'
11075         . ./myread
11076         dlext="$ans"
11077         ;;
11078 *)
11079         dlext="none"
11080         ;;
11081 esac
11082
11083 : Check if dlsym need a leading underscore
11084 echo " "
11085 val="$undef"
11086
11087 case "$dlsrc" in
11088 dl_dlopen.xs)
11089         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11090         $cat >dyna.c <<'EOM'
11091 fred () { }
11092 EOM
11093
11094 $cat >fred.c<<EOM
11095
11096 #include <stdio.h>
11097 #$i_stdlib I_STDLIB
11098 #ifdef I_STDLIB
11099 #include <stdlib.h>
11100 #endif
11101 #$i_dlfcn I_DLFCN
11102 #ifdef I_DLFCN
11103 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11104 #else
11105 #include <sys/types.h>
11106 #include <nlist.h>
11107 #include <link.h>
11108 #endif
11109
11110 extern int fred() ;
11111
11112 int main()
11113 {
11114     void * handle ;
11115     void * symbol ;
11116 #ifndef RTLD_LAZY
11117     int mode = 1 ;
11118 #else
11119     int mode = RTLD_LAZY ;
11120 #endif
11121     handle = dlopen("./dyna.$dlext", mode) ;
11122     if (handle == NULL) {
11123         printf ("1\n") ;
11124         fflush (stdout) ;
11125         exit(0);
11126     }
11127     symbol = dlsym(handle, "fred") ;
11128     if (symbol == NULL) {
11129         /* try putting a leading underscore */
11130         symbol = dlsym(handle, "_fred") ;
11131         if (symbol == NULL) {
11132             printf ("2\n") ;
11133             fflush (stdout) ;
11134             exit(0);
11135         }
11136         printf ("3\n") ;
11137     }
11138     else
11139         printf ("4\n") ;
11140     fflush (stdout) ;
11141     exit(0);
11142 }
11143 EOM
11144         : Call the object file tmp-dyna.o in case dlext=o.
11145         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
11146                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
11147                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
11148                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11149                 xxx=`$run ./fred`
11150                 case $xxx in
11151                 1)      echo "Test program failed using dlopen." >&4
11152                         echo "Perhaps you should not use dynamic loading." >&4;;
11153                 2)      echo "Test program failed using dlsym." >&4
11154                         echo "Perhaps you should not use dynamic loading." >&4;;
11155                 3)      echo "dlsym needs a leading underscore" >&4
11156                         val="$define" ;;
11157                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11158                 esac
11159         else
11160                 echo "I can't compile and run the test program." >&4
11161                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11162         fi
11163         ;;
11164 esac
11165                 
11166 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11167
11168 set d_dlsymun
11169 eval $setvar
11170
11171 : see if drand48_r exists
11172 set drand48_r d_drand48_r
11173 eval $inlibc
11174 case "$d_drand48_r" in
11175 "$define")
11176         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11177         case "$d_drand48_r_proto:$usethreads" in
11178         ":define")      d_drand48_r_proto=define
11179                 set d_drand48_r_proto drand48_r $hdrs
11180                 eval $hasproto ;;
11181         *)      ;;
11182         esac
11183         case "$d_drand48_r_proto" in
11184         define)
11185         case "$drand48_r_proto" in
11186         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11187         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11188         esac
11189         case "$drand48_r_proto" in
11190         ''|0)   d_drand48_r=undef
11191                 drand48_r_proto=0
11192                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11193         * )     case "$drand48_r_proto" in
11194                 REENTRANT_PROTO*) ;;
11195                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11196                 esac
11197                 echo "Prototype: $try" ;;
11198         esac
11199         ;;
11200         *)      case "$usethreads" in
11201                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11202                 esac
11203                 d_drand48_r=undef
11204                 drand48_r_proto=0
11205                 ;;
11206         esac
11207         ;;
11208 *)      drand48_r_proto=0
11209         ;;
11210 esac
11211
11212 : see if prototype for drand48 is available
11213 echo " "
11214 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11215 eval $hasproto
11216
11217 : see if dup2 exists
11218 set dup2 d_dup2
11219 eval $inlibc
11220
11221 : see if eaccess exists
11222 set eaccess d_eaccess
11223 eval $inlibc
11224
11225 : see if endgrent exists
11226 set endgrent d_endgrent
11227 eval $inlibc
11228
11229 : see if this is an grp system
11230 set grp.h i_grp
11231 eval $inhdr
11232
11233 case "$i_grp" in
11234 $define)
11235         xxx=`./findhdr grp.h`
11236         $cppstdin $cppflags $cppminus < $xxx >$$.h
11237
11238         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11239                 val="$define"
11240         else
11241                 val="$undef"
11242         fi
11243         set d_grpasswd
11244         eval $setvar
11245
11246         $rm -f $$.h
11247         ;;
11248 *)
11249         val="$undef";
11250         set d_grpasswd; eval $setvar
11251         ;;
11252 esac
11253
11254 : see if endgrent_r exists
11255 set endgrent_r d_endgrent_r
11256 eval $inlibc
11257 case "$d_endgrent_r" in
11258 "$define")
11259         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11260         case "$d_endgrent_r_proto:$usethreads" in
11261         ":define")      d_endgrent_r_proto=define
11262                 set d_endgrent_r_proto endgrent_r $hdrs
11263                 eval $hasproto ;;
11264         *)      ;;
11265         esac
11266         case "$d_endgrent_r_proto" in
11267         define)
11268         case "$endgrent_r_proto" in
11269         ''|0) try='int endgrent_r(FILE**);'
11270         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11271         esac
11272         case "$endgrent_r_proto" in
11273         ''|0) try='void endgrent_r(FILE**);'
11274         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11275         esac
11276         case "$endgrent_r_proto" in
11277         ''|0)   d_endgrent_r=undef
11278                 endgrent_r_proto=0
11279                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11280         * )     case "$endgrent_r_proto" in
11281                 REENTRANT_PROTO*) ;;
11282                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11283                 esac
11284                 echo "Prototype: $try" ;;
11285         esac
11286         ;;
11287         *)      case "$usethreads" in
11288                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11289                 esac
11290                 d_endgrent_r=undef
11291                 endgrent_r_proto=0
11292                 ;;
11293         esac
11294         ;;
11295 *)      endgrent_r_proto=0
11296         ;;
11297 esac
11298
11299 : see if endhostent exists
11300 set endhostent d_endhent
11301 eval $inlibc
11302
11303 : see if this is a netdb.h system
11304 set netdb.h i_netdb
11305 eval $inhdr
11306
11307 : see if endhostent_r exists
11308 set endhostent_r d_endhostent_r
11309 eval $inlibc
11310 case "$d_endhostent_r" in
11311 "$define")
11312         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11313         case "$d_endhostent_r_proto:$usethreads" in
11314         ":define")      d_endhostent_r_proto=define
11315                 set d_endhostent_r_proto endhostent_r $hdrs
11316                 eval $hasproto ;;
11317         *)      ;;
11318         esac
11319         case "$d_endhostent_r_proto" in
11320         define)
11321         case "$endhostent_r_proto" in
11322         ''|0) try='int endhostent_r(struct hostent_data*);'
11323         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11324         esac
11325         case "$endhostent_r_proto" in
11326         ''|0) try='void endhostent_r(struct hostent_data*);'
11327         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11328         esac
11329         case "$endhostent_r_proto" in
11330         ''|0)   d_endhostent_r=undef
11331                 endhostent_r_proto=0
11332                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11333         * )     case "$endhostent_r_proto" in
11334                 REENTRANT_PROTO*) ;;
11335                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11336                 esac
11337                 echo "Prototype: $try" ;;
11338         esac
11339         ;;
11340         *)      case "$usethreads" in
11341                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11342                 esac
11343                 d_endhostent_r=undef
11344                 endhostent_r_proto=0
11345                 ;;
11346         esac
11347         ;;
11348 *)      endhostent_r_proto=0
11349         ;;
11350 esac
11351
11352 : see if endnetent exists
11353 set endnetent d_endnent
11354 eval $inlibc
11355
11356 : see if endnetent_r exists
11357 set endnetent_r d_endnetent_r
11358 eval $inlibc
11359 case "$d_endnetent_r" in
11360 "$define")
11361         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11362         case "$d_endnetent_r_proto:$usethreads" in
11363         ":define")      d_endnetent_r_proto=define
11364                 set d_endnetent_r_proto endnetent_r $hdrs
11365                 eval $hasproto ;;
11366         *)      ;;
11367         esac
11368         case "$d_endnetent_r_proto" in
11369         define)
11370         case "$endnetent_r_proto" in
11371         ''|0) try='int endnetent_r(struct netent_data*);'
11372         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11373         esac
11374         case "$endnetent_r_proto" in
11375         ''|0) try='void endnetent_r(struct netent_data*);'
11376         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11377         esac
11378         case "$endnetent_r_proto" in
11379         ''|0)   d_endnetent_r=undef
11380                 endnetent_r_proto=0
11381                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11382         * )     case "$endnetent_r_proto" in
11383                 REENTRANT_PROTO*) ;;
11384                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11385                 esac
11386                 echo "Prototype: $try" ;;
11387         esac
11388         ;;
11389         *)      case "$usethreads" in
11390                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11391                 esac
11392                 d_endnetent_r=undef
11393                 endnetent_r_proto=0
11394                 ;;
11395         esac
11396         ;;
11397 *)      endnetent_r_proto=0
11398         ;;
11399 esac
11400
11401 : see if endprotoent exists
11402 set endprotoent d_endpent
11403 eval $inlibc
11404
11405 : see if endprotoent_r exists
11406 set endprotoent_r d_endprotoent_r
11407 eval $inlibc
11408 case "$d_endprotoent_r" in
11409 "$define")
11410         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11411         case "$d_endprotoent_r_proto:$usethreads" in
11412         ":define")      d_endprotoent_r_proto=define
11413                 set d_endprotoent_r_proto endprotoent_r $hdrs
11414                 eval $hasproto ;;
11415         *)      ;;
11416         esac
11417         case "$d_endprotoent_r_proto" in
11418         define)
11419         case "$endprotoent_r_proto" in
11420         ''|0) try='int endprotoent_r(struct protoent_data*);'
11421         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11422         esac
11423         case "$endprotoent_r_proto" in
11424         ''|0) try='void endprotoent_r(struct protoent_data*);'
11425         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11426         esac
11427         case "$endprotoent_r_proto" in
11428         ''|0)   d_endprotoent_r=undef
11429                 endprotoent_r_proto=0
11430                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11431         * )     case "$endprotoent_r_proto" in
11432                 REENTRANT_PROTO*) ;;
11433                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11434                 esac
11435                 echo "Prototype: $try" ;;
11436         esac
11437         ;;
11438         *)      case "$usethreads" in
11439                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11440                 esac
11441                 d_endprotoent_r=undef
11442                 endprotoent_r_proto=0
11443                 ;;
11444         esac
11445         ;;
11446 *)      endprotoent_r_proto=0
11447         ;;
11448 esac
11449
11450 : see if endpwent exists
11451 set endpwent d_endpwent
11452 eval $inlibc
11453
11454 : see if this is a pwd.h system
11455 set pwd.h i_pwd
11456 eval $inhdr
11457
11458 case "$i_pwd" in
11459 $define)
11460         xxx=`./findhdr pwd.h`
11461         $cppstdin $cppflags $cppminus < $xxx >$$.h
11462
11463         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11464                 val="$define"
11465         else
11466                 val="$undef"
11467         fi
11468         set d_pwquota
11469         eval $setvar
11470
11471         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11472                 val="$define"
11473         else
11474                 val="$undef"
11475         fi
11476         set d_pwage
11477         eval $setvar
11478
11479         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11480                 val="$define"
11481         else
11482                 val="$undef"
11483         fi
11484         set d_pwchange
11485         eval $setvar
11486
11487         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11488                 val="$define"
11489         else
11490                 val="$undef"
11491         fi
11492         set d_pwclass
11493         eval $setvar
11494
11495         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11496                 val="$define"
11497         else
11498                 val="$undef"
11499         fi
11500         set d_pwexpire
11501         eval $setvar
11502
11503         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11504                 val="$define"
11505         else
11506                 val="$undef"
11507         fi
11508         set d_pwcomment
11509         eval $setvar
11510
11511         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11512                 val="$define"
11513         else
11514                 val="$undef"
11515         fi
11516         set d_pwgecos
11517         eval $setvar
11518
11519         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11520                 val="$define"
11521         else
11522                 val="$undef"
11523         fi
11524         set d_pwpasswd
11525         eval $setvar
11526
11527         $rm -f $$.h
11528         ;;
11529 *)
11530         val="$undef"; 
11531         set d_pwquota; eval $setvar
11532         set d_pwage; eval $setvar
11533         set d_pwchange; eval $setvar
11534         set d_pwclass; eval $setvar
11535         set d_pwexpire; eval $setvar
11536         set d_pwcomment; eval $setvar
11537         set d_pwgecos; eval $setvar
11538         set d_pwpasswd; eval $setvar
11539         ;;
11540 esac
11541
11542 : see if endpwent_r exists
11543 set endpwent_r d_endpwent_r
11544 eval $inlibc
11545 case "$d_endpwent_r" in
11546 "$define")
11547         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11548         case "$d_endpwent_r_proto:$usethreads" in
11549         ":define")      d_endpwent_r_proto=define
11550                 set d_endpwent_r_proto endpwent_r $hdrs
11551                 eval $hasproto ;;
11552         *)      ;;
11553         esac
11554         case "$d_endpwent_r_proto" in
11555         define)
11556         case "$endpwent_r_proto" in
11557         ''|0) try='int endpwent_r(FILE**);'
11558         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11559         esac
11560         case "$endpwent_r_proto" in
11561         ''|0) try='void endpwent_r(FILE**);'
11562         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11563         esac
11564         case "$endpwent_r_proto" in
11565         ''|0)   d_endpwent_r=undef
11566                 endpwent_r_proto=0
11567                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
11568         * )     case "$endpwent_r_proto" in
11569                 REENTRANT_PROTO*) ;;
11570                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11571                 esac
11572                 echo "Prototype: $try" ;;
11573         esac
11574         ;;
11575         *)      case "$usethreads" in
11576                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11577                 esac
11578                 d_endpwent_r=undef
11579                 endpwent_r_proto=0
11580                 ;;
11581         esac
11582         ;;
11583 *)      endpwent_r_proto=0
11584         ;;
11585 esac
11586
11587 : see if endservent exists
11588 set endservent d_endsent
11589 eval $inlibc
11590
11591 : see if endservent_r exists
11592 set endservent_r d_endservent_r
11593 eval $inlibc
11594 case "$d_endservent_r" in
11595 "$define")
11596         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11597         case "$d_endservent_r_proto:$usethreads" in
11598         ":define")      d_endservent_r_proto=define
11599                 set d_endservent_r_proto endservent_r $hdrs
11600                 eval $hasproto ;;
11601         *)      ;;
11602         esac
11603         case "$d_endservent_r_proto" in
11604         define)
11605         case "$endservent_r_proto" in
11606         ''|0) try='int endservent_r(struct servent_data*);'
11607         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
11608         esac
11609         case "$endservent_r_proto" in
11610         ''|0) try='void endservent_r(struct servent_data*);'
11611         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
11612         esac
11613         case "$endservent_r_proto" in
11614         ''|0)   d_endservent_r=undef
11615                 endservent_r_proto=0
11616                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
11617         * )     case "$endservent_r_proto" in
11618                 REENTRANT_PROTO*) ;;
11619                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11620                 esac
11621                 echo "Prototype: $try" ;;
11622         esac
11623         ;;
11624         *)      case "$usethreads" in
11625                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11626                 esac
11627                 d_endservent_r=undef
11628                 endservent_r_proto=0
11629                 ;;
11630         esac
11631         ;;
11632 *)      endservent_r_proto=0
11633         ;;
11634 esac
11635
11636 : Locate the flags for 'open()'
11637 echo " "
11638 $cat >try.c <<EOCP
11639 #include <sys/types.h>
11640 #ifdef I_FCNTL
11641 #include <fcntl.h>
11642 #endif
11643 #ifdef I_SYS_FILE
11644 #include <sys/file.h>
11645 #endif
11646 #$i_stdlib I_STDLIB
11647 #ifdef I_STDLIB
11648 #include <stdlib.h>
11649 #endif
11650 int main() {
11651         if(O_RDONLY);
11652 #ifdef O_TRUNC
11653         exit(0);
11654 #else
11655         exit(1);
11656 #endif
11657 }
11658 EOCP
11659 : check sys/file.h first to get FREAD on Sun
11660 if $test `./findhdr sys/file.h` && \
11661                 set try -DI_SYS_FILE && eval $compile; then
11662         h_sysfile=true;
11663         echo "<sys/file.h> defines the O_* constants..." >&4
11664         if $run ./try; then
11665                 echo "and you have the 3 argument form of open()." >&4
11666                 val="$define"
11667         else
11668                 echo "but not the 3 argument form of open().  Oh, well." >&4
11669                 val="$undef"
11670         fi
11671 elif $test `./findhdr fcntl.h` && \
11672                 set try -DI_FCNTL && eval $compile; then
11673         h_fcntl=true;
11674         echo "<fcntl.h> defines the O_* constants..." >&4
11675         if $run ./try; then
11676                 echo "and you have the 3 argument form of open()." >&4
11677                 val="$define"
11678         else
11679                 echo "but not the 3 argument form of open().  Oh, well." >&4
11680                 val="$undef"
11681         fi
11682 else
11683         val="$undef"
11684         echo "I can't find the O_* constant definitions!  You got problems." >&4
11685 fi
11686 set d_open3
11687 eval $setvar
11688 $rm -f try try.*
11689
11690 : see which of string.h or strings.h is needed
11691 echo " "
11692 strings=`./findhdr string.h`
11693 if $test "$strings" && $test -r "$strings"; then
11694         echo "Using <string.h> instead of <strings.h>." >&4
11695         val="$define"
11696 else
11697         val="$undef"
11698         strings=`./findhdr strings.h`
11699         if $test "$strings" && $test -r "$strings"; then
11700                 echo "Using <strings.h> instead of <string.h>." >&4
11701         else
11702                 echo "No string header found -- You'll surely have problems." >&4
11703         fi
11704 fi
11705 set i_string
11706 eval $setvar
11707 case "$i_string" in
11708 "$undef") strings=`./findhdr strings.h`;;
11709 *)        strings=`./findhdr string.h`;;
11710 esac
11711
11712 : see if this is a sys/file.h system
11713 val=''
11714 set sys/file.h val
11715 eval $inhdr
11716
11717 : do we need to include sys/file.h ?
11718 case "$val" in
11719 "$define")
11720         echo " "
11721         if $h_sysfile; then
11722                 val="$define"
11723                 echo "We'll be including <sys/file.h>." >&4
11724         else
11725                 val="$undef"
11726                 echo "We won't be including <sys/file.h>." >&4
11727         fi
11728         ;;
11729 *)
11730         h_sysfile=false
11731         ;;
11732 esac
11733 set i_sysfile
11734 eval $setvar
11735
11736 : see if fcntl.h is there
11737 val=''
11738 set fcntl.h val
11739 eval $inhdr
11740
11741 : see if we can include fcntl.h
11742 case "$val" in
11743 "$define")
11744         echo " "
11745         if $h_fcntl; then
11746                 val="$define"
11747                 echo "We'll be including <fcntl.h>." >&4
11748         else
11749                 val="$undef"
11750                 if $h_sysfile; then
11751         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11752                 else
11753                         echo "We won't be including <fcntl.h>." >&4
11754                 fi
11755         fi
11756         ;;
11757 *)
11758         h_fcntl=false
11759         val="$undef"
11760         ;;
11761 esac
11762 set i_fcntl
11763 eval $setvar
11764
11765 : check for non-blocking I/O stuff
11766 case "$h_sysfile" in
11767 true) echo "#include <sys/file.h>" > head.c;;
11768 *)
11769        case "$h_fcntl" in
11770        true) echo "#include <fcntl.h>" > head.c;;
11771        *) echo "#include <sys/fcntl.h>" > head.c;;
11772        esac
11773        ;;
11774 esac
11775 echo " "
11776 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11777 case "$o_nonblock" in
11778 '')
11779         $cat head.c > try.c
11780         $cat >>try.c <<EOCP
11781 #include <stdio.h>
11782 #$i_stdlib I_STDLIB
11783 #ifdef I_STDLIB
11784 #include <stdlib.h>
11785 #endif
11786 #$i_fcntl I_FCNTL
11787 #ifdef I_FCNTL
11788 #include <fcntl.h>
11789 #endif
11790 int main() {
11791 #ifdef O_NONBLOCK
11792         printf("O_NONBLOCK\n");
11793         exit(0);
11794 #endif
11795 #ifdef O_NDELAY
11796         printf("O_NDELAY\n");
11797         exit(0);
11798 #endif
11799 #ifdef FNDELAY
11800         printf("FNDELAY\n");
11801         exit(0);
11802 #endif
11803         exit(0);
11804 }
11805 EOCP
11806         set try
11807         if eval $compile_ok; then
11808                 o_nonblock=`$run ./try`
11809                 case "$o_nonblock" in
11810                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11811                 *) echo "Seems like we can use $o_nonblock.";;
11812                 esac
11813         else
11814                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11815         fi
11816         ;;
11817 *) echo "Using $hint value $o_nonblock.";;
11818 esac
11819 $rm -f try try.* .out core
11820
11821 echo " "
11822 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11823 case "$eagain" in
11824 '')
11825         $cat head.c > try.c
11826         $cat >>try.c <<EOCP
11827 #include <errno.h>
11828 #include <sys/types.h>
11829 #include <signal.h>
11830 #include <stdio.h> 
11831 #$i_stdlib I_STDLIB
11832 #ifdef I_STDLIB
11833 #include <stdlib.h>
11834 #endif
11835 #$i_fcntl I_FCNTL
11836 #ifdef I_FCNTL
11837 #include <fcntl.h>
11838 #endif
11839 #define MY_O_NONBLOCK $o_nonblock
11840 #ifndef errno  /* XXX need better Configure test */
11841 extern int errno;
11842 #endif
11843 #$i_unistd I_UNISTD
11844 #ifdef I_UNISTD
11845 #include <unistd.h>
11846 #endif
11847 #$i_string I_STRING
11848 #ifdef I_STRING
11849 #include <string.h>
11850 #else
11851 #include <strings.h>
11852 #endif
11853 $signal_t blech(x) int x; { exit(3); }
11854 EOCP
11855         $cat >> try.c <<'EOCP'
11856 int main()
11857 {
11858         int pd[2];
11859         int pu[2];
11860         char buf[1];
11861         char string[100];
11862
11863         pipe(pd);       /* Down: child -> parent */
11864         pipe(pu);       /* Up: parent -> child */
11865         if (0 != fork()) {
11866                 int ret;
11867                 close(pd[1]);   /* Parent reads from pd[0] */
11868                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11869 #ifdef F_SETFL
11870                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11871                         exit(1);
11872 #else
11873                 exit(4);
11874 #endif
11875                 signal(SIGALRM, blech);
11876                 alarm(5);
11877                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11878                         exit(2);
11879                 sprintf(string, "%d\n", ret);
11880                 write(2, string, strlen(string));
11881                 alarm(0);
11882 #ifdef EAGAIN
11883                 if (errno == EAGAIN) {
11884                         printf("EAGAIN\n");
11885                         goto ok;
11886                 }
11887 #endif
11888 #ifdef EWOULDBLOCK
11889                 if (errno == EWOULDBLOCK)
11890                         printf("EWOULDBLOCK\n");
11891 #endif
11892         ok:
11893                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11894                 sleep(2);                               /* Give it time to close our pipe */
11895                 alarm(5);
11896                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11897                 alarm(0);
11898                 sprintf(string, "%d\n", ret);
11899                 write(4, string, strlen(string));
11900                 exit(0);
11901         }
11902
11903         close(pd[0]);                   /* We write to pd[1] */
11904         close(pu[1]);                   /* We read from pu[0] */
11905         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11906         close(pd[1]);                   /* Pipe pd is now fully closed! */
11907         exit(0);                                /* Bye bye, thank you for playing! */
11908 }
11909 EOCP
11910         set try
11911         if eval $compile_ok; then
11912                 echo "$startsh" >mtry
11913                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11914                 chmod +x mtry
11915                 ./mtry >/dev/null 2>&1
11916                 case $? in
11917                 0) eagain=`$cat try.out`;;
11918                 1) echo "Could not perform non-blocking setting!";;
11919                 2) echo "I did a successful read() for something that was not there!";;
11920                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
11921                 4) echo "Could not find F_SETFL!";;
11922                 *) echo "Something terribly wrong happened during testing.";;
11923                 esac
11924                 rd_nodata=`$cat try.ret`
11925                 echo "A read() system call with no data present returns $rd_nodata."
11926                 case "$rd_nodata" in
11927                 0|-1) ;;
11928                 *)
11929                         echo "(That's peculiar, fixing that to be -1.)"
11930                         rd_nodata=-1
11931                         ;;
11932                 esac
11933                 case "$eagain" in
11934                 '')
11935                         echo "Forcing errno EAGAIN on read() with no data available."
11936                         eagain=EAGAIN
11937                         ;;
11938                 *)
11939                         echo "Your read() sets errno to $eagain when no data is available."
11940                         ;;
11941                 esac
11942                 status=`$cat try.err`
11943                 case "$status" in
11944                 0) echo "And it correctly returns 0 to signal EOF.";;
11945                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11946                 *) echo "However, your read() returns '$status' on EOF??";;
11947                 esac
11948                 val="$define"
11949                 if test "$status" = "$rd_nodata"; then
11950                         echo "WARNING: you can't distinguish between EOF and no data!"
11951                         val="$undef"
11952                 fi
11953         else
11954                 echo "I can't compile the test program--assuming errno EAGAIN will do."
11955                 eagain=EAGAIN
11956         fi
11957         set d_eofnblk
11958         eval $setvar
11959         ;;
11960 *)
11961         echo "Using $hint value $eagain."
11962         echo "Your read() returns $rd_nodata when no data is present."
11963         case "$d_eofnblk" in
11964         "$define") echo "And you can see EOF because read() returns 0.";;
11965         "$undef") echo "But you can't see EOF status from read() returned value.";;
11966         *)
11967                 echo "(Assuming you can't see EOF status from read anyway.)"
11968                 d_eofnblk=$undef
11969                 ;;
11970         esac
11971         ;;
11972 esac
11973 $rm -f try try.* .out core head.c mtry
11974
11975 : see if _ptr and _cnt from stdio act std
11976 echo " "
11977
11978 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11979         echo "(Looks like you have stdio.h from BSD.)"
11980         case "$stdio_ptr" in
11981         '') stdio_ptr='((fp)->_p)'
11982                 ptr_lval=$define
11983                 ;;
11984         *)      ptr_lval=$d_stdio_ptr_lval;;
11985         esac
11986         case "$stdio_cnt" in
11987         '') stdio_cnt='((fp)->_r)'
11988                 cnt_lval=$define
11989                 ;;
11990         *)      cnt_lval=$d_stdio_cnt_lval;;
11991         esac
11992         case "$stdio_base" in
11993         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
11994         esac
11995         case "$stdio_bufsiz" in
11996         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
11997         esac
11998 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11999         echo "(Looks like you have stdio.h from Linux.)"
12000         case "$stdio_ptr" in
12001         '') stdio_ptr='((fp)->_IO_read_ptr)'
12002                 ptr_lval=$define
12003                 ;;
12004         *)      ptr_lval=$d_stdio_ptr_lval;;
12005         esac
12006         case "$stdio_cnt" in
12007         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12008                 cnt_lval=$undef
12009                 ;;
12010         *)      cnt_lval=$d_stdio_cnt_lval;;
12011         esac
12012         case "$stdio_base" in
12013         '') stdio_base='((fp)->_IO_read_base)';;
12014         esac
12015         case "$stdio_bufsiz" in
12016         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12017         esac
12018 else
12019         case "$stdio_ptr" in
12020         '') stdio_ptr='((fp)->_ptr)'
12021                 ptr_lval=$define
12022                 ;;
12023         *)      ptr_lval=$d_stdio_ptr_lval;;
12024         esac
12025         case "$stdio_cnt" in
12026         '') stdio_cnt='((fp)->_cnt)'
12027                 cnt_lval=$define
12028                 ;;
12029         *)      cnt_lval=$d_stdio_cnt_lval;;
12030         esac
12031         case "$stdio_base" in
12032         '') stdio_base='((fp)->_base)';;
12033         esac
12034         case "$stdio_bufsiz" in
12035         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12036         esac
12037 fi
12038
12039 : test whether _ptr and _cnt really work
12040 echo "Checking how std your stdio is..." >&4
12041 $cat >try.c <<EOP
12042 #include <stdio.h>
12043 #$i_stdlib I_STDLIB
12044 #ifdef I_STDLIB
12045 #include <stdlib.h>
12046 #endif
12047 #define FILE_ptr(fp)    $stdio_ptr
12048 #define FILE_cnt(fp)    $stdio_cnt
12049 int main() {
12050         FILE *fp = fopen("try.c", "r");
12051         char c = getc(fp);
12052         if (
12053                 18 <= FILE_cnt(fp) &&
12054                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12055         )
12056                 exit(0);
12057         exit(1);
12058 }
12059 EOP
12060 val="$undef"
12061 set try
12062 if eval $compile && $to try.c; then
12063         if $run ./try; then
12064                 echo "Your stdio acts pretty std."
12065                 val="$define"
12066         else
12067                 echo "Your stdio isn't very std."
12068         fi
12069 else
12070         echo "Your stdio doesn't appear very std."
12071 fi
12072 $rm -f try.c try
12073
12074 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12075 # direct buffer manipulation no longer works.  The Configure tests
12076 # should be changed to correctly detect this, but until then,
12077 # the following check should at least let perl compile and run.
12078 # (This quick fix should be updated before 5.8.1.)
12079 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12080 # A. Dougherty, June 3, 2002.
12081 case "$d_gnulibc" in
12082 $define)
12083         case "$gnulibc_version" in
12084         2.[01]*)  ;;
12085         2.2) ;;
12086         2.2.[0-9]) ;;
12087         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12088                 val="$undef"
12089                 ;;
12090         esac
12091         ;;
12092 esac
12093 set d_stdstdio
12094 eval $setvar
12095
12096 : Can _ptr be used as an lvalue?
12097 case "$d_stdstdio$ptr_lval" in
12098 $define$define) val=$define ;;
12099 *) val=$undef ;;
12100 esac
12101 set d_stdio_ptr_lval
12102 eval $setvar
12103
12104 : Can _cnt be used as an lvalue?
12105 case "$d_stdstdio$cnt_lval" in
12106 $define$define) val=$define ;;
12107 *) val=$undef ;;
12108 esac
12109 set d_stdio_cnt_lval
12110 eval $setvar
12111
12112
12113 : test whether setting _ptr sets _cnt as a side effect
12114 d_stdio_ptr_lval_sets_cnt="$undef"
12115 d_stdio_ptr_lval_nochange_cnt="$undef"
12116 case "$d_stdio_ptr_lval$d_stdstdio" in
12117 $define$define)
12118         echo "Checking to see what happens if we set the stdio ptr..." >&4
12119 $cat >try.c <<EOP
12120 #include <stdio.h>
12121 /* Can we scream? */
12122 /* Eat dust sed :-) */
12123 /* In the buffer space, no one can hear you scream. */
12124 #$i_stdlib I_STDLIB
12125 #ifdef I_STDLIB
12126 #include <stdlib.h>
12127 #endif
12128 #define FILE_ptr(fp)    $stdio_ptr
12129 #define FILE_cnt(fp)    $stdio_cnt
12130 #include <sys/types.h>
12131 int main() {
12132         FILE *fp = fopen("try.c", "r");
12133         int c;
12134         char *ptr;
12135         size_t cnt;
12136         if (!fp) {
12137             puts("Fail even to read");
12138             exit(1);
12139         }
12140         c = getc(fp); /* Read away the first # */
12141         if (c == EOF) {
12142             puts("Fail even to read");
12143             exit(1);
12144         }
12145         if (!(
12146                 18 <= FILE_cnt(fp) &&
12147                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12148         )) {
12149                 puts("Fail even to read");
12150                 exit (1);
12151         }
12152         ptr = (char*) FILE_ptr(fp);
12153         cnt = (size_t)FILE_cnt(fp);
12154
12155         FILE_ptr(fp) += 42;
12156
12157         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12158                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12159                 exit (1);
12160         }
12161         if (FILE_cnt(fp) <= 20) {
12162                 printf ("Fail (<20 chars to test)");
12163                 exit (1);
12164         }
12165         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12166                 puts("Fail compare");
12167                 exit (1);
12168         }
12169         if (cnt == FILE_cnt(fp)) {
12170                 puts("Pass_unchanged");
12171                 exit (0);
12172         }       
12173         if (FILE_cnt(fp) == (cnt - 42)) {
12174                 puts("Pass_changed");
12175                 exit (0);
12176         }
12177         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12178         return 1;
12179
12180 }
12181 EOP
12182         set try
12183         if eval $compile && $to try.c; then
12184                 case `$run ./try` in
12185                 Pass_changed)
12186                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12187                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12188                 Pass_unchanged)
12189                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12190                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12191                 Fail*)
12192                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12193                 *)
12194                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12195         esac
12196         else
12197                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12198         fi
12199         $rm -f try.c try
12200         ;;
12201 esac
12202
12203 : see if _base is also standard
12204 val="$undef"
12205 case "$d_stdstdio" in
12206 $define)
12207         $cat >try.c <<EOP
12208 #include <stdio.h>
12209 #$i_stdlib I_STDLIB
12210 #ifdef I_STDLIB
12211 #include <stdlib.h>
12212 #endif
12213 #define FILE_base(fp)   $stdio_base
12214 #define FILE_bufsiz(fp) $stdio_bufsiz
12215 int main() {
12216         FILE *fp = fopen("try.c", "r");
12217         char c = getc(fp);
12218         if (
12219                 19 <= FILE_bufsiz(fp) &&
12220                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12221         )
12222                 exit(0);
12223         exit(1);
12224 }
12225 EOP
12226         set try
12227         if eval $compile && $to try.c; then
12228                 if $run ./try; then
12229                         echo "And its _base field acts std."
12230                         val="$define"
12231                 else
12232                         echo "But its _base field isn't std."
12233                 fi
12234         else
12235                 echo "However, it seems to be lacking the _base field."
12236         fi
12237         $rm -f try.c try
12238         ;;
12239 esac
12240 set d_stdiobase
12241 eval $setvar
12242
12243 : see if fast_stdio exists
12244 val="$undef"
12245 case "$d_stdstdio:$d_stdio_ptr_lval" in
12246 "$define:$define")
12247         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12248         *$define*)
12249                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12250                 val="$define"
12251                 ;;
12252         esac
12253         ;;
12254 esac
12255 set d_faststdio
12256 eval $setvar
12257
12258
12259
12260 : see if fchdir exists
12261 set fchdir d_fchdir
12262 eval $inlibc
12263
12264 : see if fchmod exists
12265 set fchmod d_fchmod
12266 eval $inlibc
12267
12268 : see if fchown exists
12269 set fchown d_fchown
12270 eval $inlibc
12271
12272 : see if this is an fcntl system
12273 set fcntl d_fcntl
12274 eval $inlibc
12275
12276 echo " "
12277 : See if fcntl-based locking works.
12278 $cat >try.c <<EOCP
12279 #$i_stdlib I_STDLIB
12280 #ifdef I_STDLIB
12281 #include <stdlib.h>
12282 #endif
12283 #include <unistd.h>
12284 #include <fcntl.h>
12285 #include <signal.h>
12286 $signal_t blech(x) int x; { exit(3); }
12287 int main() {
12288 #if defined(F_SETLK) && defined(F_SETLKW)
12289      struct flock flock;
12290      int retval, fd;
12291      fd = open("try.c", O_RDONLY);
12292      flock.l_type = F_RDLCK;
12293      flock.l_whence = SEEK_SET;
12294      flock.l_start = flock.l_len = 0;
12295      signal(SIGALRM, blech);
12296      alarm(10);
12297      retval = fcntl(fd, F_SETLK, &flock);
12298      close(fd);
12299      (retval < 0 ? exit(2) : exit(0));
12300 #else
12301      exit(2);
12302 #endif
12303 }
12304 EOCP
12305 echo "Checking if fcntl-based file locking works... "
12306 case "$d_fcntl" in
12307 "$define")
12308         set try
12309         if eval $compile_ok; then
12310                 if $run ./try; then
12311                         echo "Yes, it seems to work."
12312                         val="$define"
12313                 else
12314                         echo "Nope, it didn't work."
12315                         val="$undef"
12316                         case "$?" in
12317                         3) $cat >&4 <<EOM
12318 ***
12319 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12320 *** This is (almost) impossible.
12321 *** If your NFS lock daemons are not feeling well, something like
12322 *** this may happen, please investigate.  Cannot continue, aborting.
12323 ***
12324 EOM
12325                                 exit 1
12326                                 ;;
12327                         esac
12328                 fi
12329         else
12330                 echo "I'm unable to compile the test program, so I'll assume not."
12331                 val="$undef"
12332         fi
12333         ;;
12334 *) val="$undef";
12335         echo "Nope, since you don't even have fcntl()."
12336         ;;
12337 esac
12338 set d_fcntl_can_lock
12339 eval $setvar
12340 $rm -f try*
12341
12342
12343 : check for fd_set items
12344 $cat <<EOM
12345
12346 Checking to see how well your C compiler handles fd_set and friends ...
12347 EOM
12348 $cat >try.c <<EOCP
12349 #$i_stdlib I_STDLIB
12350 #ifdef I_STDLIB
12351 #include <stdlib.h>
12352 #endif
12353 #$i_systime I_SYS_TIME
12354 #$i_sysselct I_SYS_SELECT
12355 #$d_socket HAS_SOCKET
12356 #include <sys/types.h>
12357 #ifdef HAS_SOCKET
12358 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12359 #endif
12360 #ifdef I_SYS_TIME
12361 #include <sys/time.h>
12362 #endif
12363 #ifdef I_SYS_SELECT
12364 #include <sys/select.h>
12365 #endif
12366 int main() {
12367         fd_set fds;
12368
12369 #ifdef TRYBITS
12370         if(fds.fds_bits);
12371 #endif
12372
12373 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12374         exit(0);
12375 #else
12376         exit(1);
12377 #endif
12378 }
12379 EOCP
12380 set try -DTRYBITS
12381 if eval $compile; then
12382         d_fds_bits="$define"
12383         d_fd_set="$define"
12384         echo "Well, your system knows about the normal fd_set typedef..." >&4
12385         if $run ./try; then
12386                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12387                 d_fd_macros="$define"
12388         else
12389                 $cat >&4 <<'EOM'
12390 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12391 EOM
12392                 d_fd_macros="$undef"
12393         fi
12394 else
12395         $cat <<'EOM'
12396 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12397 EOM
12398         set try
12399         if eval $compile; then
12400                 d_fds_bits="$undef"
12401                 d_fd_set="$define"
12402                 echo "Well, your system has some sort of fd_set available..." >&4
12403                 if $run ./try; then
12404                         echo "and you have the normal fd_set macros." >&4
12405                         d_fd_macros="$define"
12406                 else
12407                         $cat <<'EOM'
12408 but not the normal fd_set macros!  Gross!  More work for me...
12409 EOM
12410                         d_fd_macros="$undef"
12411                 fi
12412         else
12413         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
12414                 d_fd_set="$undef"
12415                 d_fds_bits="$undef"
12416                 d_fd_macros="$undef"
12417         fi
12418 fi
12419 $rm -f try try.*
12420
12421 : see if fgetpos exists
12422 set fgetpos d_fgetpos
12423 eval $inlibc
12424
12425 : see if finite exists
12426 set finite d_finite
12427 eval $inlibc
12428
12429 : see if finitel exists
12430 set finitel d_finitel
12431 eval $inlibc
12432
12433 : see if flock exists
12434 set flock d_flock
12435 eval $inlibc
12436
12437 : see if prototype for flock is available
12438 echo " "
12439 set d_flockproto flock $i_sysfile sys/file.h
12440 eval $hasproto
12441
12442 : see if fork exists
12443 set fork d_fork
12444 eval $inlibc
12445
12446 : see if fp_class exists
12447 set fp_class d_fp_class
12448 eval $inlibc
12449
12450 : see if pathconf exists
12451 set pathconf d_pathconf
12452 eval $inlibc
12453
12454 : see if fpathconf exists
12455 set fpathconf d_fpathconf
12456 eval $inlibc
12457
12458 : see if fpclass exists
12459 set fpclass d_fpclass
12460 eval $inlibc
12461
12462 : see if fpclassify exists
12463 set fpclassify d_fpclassify
12464 eval $inlibc
12465
12466 : see if fpclassl exists
12467 set fpclassl d_fpclassl
12468 eval $inlibc
12469
12470
12471 : check for fpos64_t
12472 echo " "
12473 echo "Checking to see if you have fpos64_t..." >&4
12474 $cat >try.c <<EOCP
12475 #include <stdio.h>
12476 int main() { fpos64_t x = 7; }
12477 EOCP
12478 set try
12479 if eval $compile; then
12480         val="$define"
12481         echo "You have fpos64_t."
12482 else
12483         val="$undef"
12484         echo "You do not have fpos64_t."
12485         case "$fpossize" in
12486         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12487         esac
12488 fi
12489 $rm -f try.* try
12490 set d_fpos64_t
12491 eval $setvar
12492
12493 : see if frexpl exists
12494 set frexpl d_frexpl
12495 eval $inlibc
12496
12497 : see if this is a sys/param system
12498 set sys/param.h i_sysparam
12499 eval $inhdr
12500
12501 : see if this is a sys/mount.h system
12502 set sys/mount.h i_sysmount
12503 eval $inhdr
12504
12505
12506 echo " "
12507 echo "Checking to see if your system supports struct fs_data..." >&4
12508 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12509 eval $hasstruct
12510 case "$d_fs_data_s" in
12511 "$define")      echo "Yes, it does."   ;;
12512 *)              echo "No, it doesn't." ;;
12513 esac
12514
12515 : see if fseeko exists
12516 set fseeko d_fseeko
12517 eval $inlibc
12518 case "$longsize" in
12519 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12520 esac
12521
12522 : see if fsetpos exists
12523 set fsetpos d_fsetpos
12524 eval $inlibc
12525
12526
12527 : see if fstatfs exists
12528 set fstatfs d_fstatfs
12529 eval $inlibc
12530
12531
12532 : see if statvfs exists
12533 set statvfs d_statvfs
12534 eval $inlibc
12535
12536 : see if fstatvfs exists
12537 set fstatvfs d_fstatvfs
12538 eval $inlibc
12539
12540
12541 : see if fsync exists
12542 set fsync d_fsync
12543 eval $inlibc
12544
12545 : see if ftello exists
12546 set ftello d_ftello
12547 eval $inlibc
12548 case "$longsize" in
12549 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12550 esac
12551
12552 : see if getcwd exists
12553 set getcwd d_getcwd
12554 eval $inlibc
12555
12556 : see if getespwnam exists
12557 set getespwnam d_getespwnam
12558 eval $inlibc
12559
12560
12561 : see if getfsstat exists
12562 set getfsstat d_getfsstat
12563 eval $inlibc
12564
12565 : see if getgrent exists
12566 set getgrent d_getgrent
12567 eval $inlibc
12568
12569 : see if getgrent_r exists
12570 set getgrent_r d_getgrent_r
12571 eval $inlibc
12572 case "$d_getgrent_r" in
12573 "$define")
12574         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12575         case "$d_getgrent_r_proto:$usethreads" in
12576         ":define")      d_getgrent_r_proto=define
12577                 set d_getgrent_r_proto getgrent_r $hdrs
12578                 eval $hasproto ;;
12579         *)      ;;
12580         esac
12581         case "$d_getgrent_r_proto" in
12582         define)
12583         case "$getgrent_r_proto" in
12584         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
12585         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
12586         esac
12587         case "$getgrent_r_proto" in
12588         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
12589         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
12590         esac
12591         case "$getgrent_r_proto" in
12592         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12593         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12594         esac
12595         case "$getgrent_r_proto" in
12596         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12597         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12598         esac
12599         case "$getgrent_r_proto" in
12600         ''|0) try='int getgrent_r(struct group*, char*, int);'
12601         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12602         esac
12603         case "$getgrent_r_proto" in
12604         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12605         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12606         esac
12607         case "$getgrent_r_proto" in
12608         ''|0)   d_getgrent_r=undef
12609                 getgrent_r_proto=0
12610                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
12611         * )     case "$getgrent_r_proto" in
12612                 REENTRANT_PROTO*) ;;
12613                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12614                 esac
12615                 echo "Prototype: $try" ;;
12616         esac
12617         ;;
12618         *)      case "$usethreads" in
12619                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12620                 esac
12621                 d_getgrent_r=undef
12622                 getgrent_r_proto=0
12623                 ;;
12624         esac
12625         ;;
12626 *)      getgrent_r_proto=0
12627         ;;
12628 esac
12629
12630 : see if getgrgid_r exists
12631 set getgrgid_r d_getgrgid_r
12632 eval $inlibc
12633 case "$d_getgrgid_r" in
12634 "$define")
12635         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12636         case "$d_getgrgid_r_proto:$usethreads" in
12637         ":define")      d_getgrgid_r_proto=define
12638                 set d_getgrgid_r_proto getgrgid_r $hdrs
12639                 eval $hasproto ;;
12640         *)      ;;
12641         esac
12642         case "$d_getgrgid_r_proto" in
12643         define)
12644         case "$getgrgid_r_proto" in
12645         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12646         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12647         esac
12648         case "$getgrgid_r_proto" in
12649         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12650         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12651         esac
12652         case "$getgrgid_r_proto" in
12653         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12654         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12655         esac
12656         case "$getgrgid_r_proto" in
12657         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12658         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12659         esac
12660         case "$getgrgid_r_proto" in
12661         ''|0)   d_getgrgid_r=undef
12662                 getgrgid_r_proto=0
12663                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
12664         * )     case "$getgrgid_r_proto" in
12665                 REENTRANT_PROTO*) ;;
12666                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12667                 esac
12668                 echo "Prototype: $try" ;;
12669         esac
12670         ;;
12671         *)      case "$usethreads" in
12672                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12673                 esac
12674                 d_getgrgid_r=undef
12675                 getgrgid_r_proto=0
12676                 ;;
12677         esac
12678         ;;
12679 *)      getgrgid_r_proto=0
12680         ;;
12681 esac
12682
12683 : see if getgrnam_r exists
12684 set getgrnam_r d_getgrnam_r
12685 eval $inlibc
12686 case "$d_getgrnam_r" in
12687 "$define")
12688         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12689         case "$d_getgrnam_r_proto:$usethreads" in
12690         ":define")      d_getgrnam_r_proto=define
12691                 set d_getgrnam_r_proto getgrnam_r $hdrs
12692                 eval $hasproto ;;
12693         *)      ;;
12694         esac
12695         case "$d_getgrnam_r_proto" in
12696         define)
12697         case "$getgrnam_r_proto" in
12698         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12699         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12700         esac
12701         case "$getgrnam_r_proto" in
12702         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12703         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12704         esac
12705         case "$getgrnam_r_proto" in
12706         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12707         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12708         esac
12709         case "$getgrnam_r_proto" in
12710         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
12711         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
12712         esac
12713         case "$getgrnam_r_proto" in
12714         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
12715         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
12716         esac
12717         case "$getgrnam_r_proto" in
12718         ''|0)   d_getgrnam_r=undef
12719                 getgrnam_r_proto=0
12720                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
12721         * )     case "$getgrnam_r_proto" in
12722                 REENTRANT_PROTO*) ;;
12723                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
12724                 esac
12725                 echo "Prototype: $try" ;;
12726         esac
12727         ;;
12728         *)      case "$usethreads" in
12729                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
12730                 esac
12731                 d_getgrnam_r=undef
12732                 getgrnam_r_proto=0
12733                 ;;
12734         esac
12735         ;;
12736 *)      getgrnam_r_proto=0
12737         ;;
12738 esac
12739
12740 : see if gethostbyaddr exists
12741 set gethostbyaddr d_gethbyaddr
12742 eval $inlibc
12743
12744 : see if gethostbyname exists
12745 set gethostbyname d_gethbyname
12746 eval $inlibc
12747
12748 : see if gethostent exists
12749 set gethostent d_gethent
12750 eval $inlibc
12751
12752 : see how we will look up host name
12753 echo " "
12754 call=''
12755 if set gethostname val -f d_gethname; eval $csym; $val; then
12756         echo 'gethostname() found.' >&4
12757         d_gethname="$define"
12758         call=gethostname
12759 fi
12760 if set uname val -f d_uname; eval $csym; $val; then
12761         if ./xenix; then
12762                 $cat <<'EOM'
12763 uname() was found, but you're running xenix, and older versions of xenix
12764 have a broken uname(). If you don't really know whether your xenix is old
12765 enough to have a broken system call, use the default answer.
12766
12767 EOM
12768                 dflt=y
12769                 case "$d_uname" in
12770                 "$define") dflt=n;;
12771                 esac
12772                 rp='Is your uname() broken?'
12773                 . ./myread
12774                 case "$ans" in
12775                 n*) d_uname="$define"; call=uname;;
12776                 esac
12777         else
12778                 echo 'uname() found.' >&4
12779                 d_uname="$define"
12780                 case "$call" in
12781                 '') call=uname ;;
12782                 esac
12783         fi
12784 fi
12785 case "$d_gethname" in
12786 '') d_gethname="$undef";;
12787 esac
12788 case "$d_uname" in
12789 '') d_uname="$undef";;
12790 esac
12791 case "$d_uname$d_gethname" in
12792 *define*)
12793         dflt=n
12794         cat <<EOM
12795  
12796 Every now and then someone has a $call() that lies about the hostname
12797 but can't be fixed for political or economic reasons.  If you wish, I can
12798 pretend $call() isn't there and maybe compute hostname at run-time
12799 thanks to the '$phostname' command.
12800
12801 EOM
12802         rp="Shall I ignore $call() from now on?"
12803         . ./myread
12804         case "$ans" in
12805         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
12806         esac;;
12807 esac
12808 case "$phostname" in
12809 '') aphostname='';;
12810 *) case "$aphostname" in
12811         /*) ;;
12812         *) set X $phostname
12813                 shift
12814                 file=$1
12815                 shift
12816                 file=`./loc $file $file $pth`
12817                 aphostname=`echo $file $*`
12818                 ;;
12819         esac
12820         ;;
12821 esac
12822 case "$d_uname$d_gethname" in
12823 *define*) ;;
12824 *)
12825         case "$phostname" in
12826         '')
12827                 echo "There will be no way for $package to get your hostname." >&4;;
12828         *)
12829         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
12830                 ;;
12831         esac;;
12832 esac
12833 case "$d_phostname" in
12834 '') d_phostname="$undef";;
12835 esac
12836
12837 : see if gethostbyaddr_r exists
12838 set gethostbyaddr_r d_gethostbyaddr_r
12839 eval $inlibc
12840 case "$d_gethostbyaddr_r" in
12841 "$define")
12842         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12843         case "$d_gethostbyaddr_r_proto:$usethreads" in
12844         ":define")      d_gethostbyaddr_r_proto=define
12845                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
12846                 eval $hasproto ;;
12847         *)      ;;
12848         esac
12849         case "$d_gethostbyaddr_r_proto" in
12850         define)
12851         case "$gethostbyaddr_r_proto" in
12852         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12853         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
12854         esac
12855         case "$gethostbyaddr_r_proto" in
12856         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
12857         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
12858         esac
12859         case "$gethostbyaddr_r_proto" in
12860         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
12861         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
12862         esac
12863         case "$gethostbyaddr_r_proto" in
12864         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
12865         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
12866         esac
12867         case "$gethostbyaddr_r_proto" in
12868         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
12869         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
12870         esac
12871         case "$gethostbyaddr_r_proto" in
12872         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
12873         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
12874         esac
12875         case "$gethostbyaddr_r_proto" in
12876         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
12877         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
12878         esac
12879         case "$gethostbyaddr_r_proto" in
12880         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
12881         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
12882         esac
12883         case "$gethostbyaddr_r_proto" in
12884         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
12885         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
12886         esac
12887         case "$gethostbyaddr_r_proto" in
12888         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
12889         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
12890         esac
12891         case "$gethostbyaddr_r_proto" in
12892         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12893         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
12894         esac
12895         case "$gethostbyaddr_r_proto" in
12896         ''|0)   d_gethostbyaddr_r=undef
12897                 gethostbyaddr_r_proto=0
12898                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
12899         * )     case "$gethostbyaddr_r_proto" in
12900                 REENTRANT_PROTO*) ;;
12901                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
12902                 esac
12903                 echo "Prototype: $try" ;;
12904         esac
12905         ;;
12906         *)      case "$usethreads" in
12907                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
12908                 esac
12909                 d_gethostbyaddr_r=undef
12910                 gethostbyaddr_r_proto=0
12911                 ;;
12912         esac
12913         ;;
12914 *)      gethostbyaddr_r_proto=0
12915         ;;
12916 esac
12917
12918 : see if gethostbyname_r exists
12919 set gethostbyname_r d_gethostbyname_r
12920 eval $inlibc
12921 case "$d_gethostbyname_r" in
12922 "$define")
12923         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12924         case "$d_gethostbyname_r_proto:$usethreads" in
12925         ":define")      d_gethostbyname_r_proto=define
12926                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
12927                 eval $hasproto ;;
12928         *)      ;;
12929         esac
12930         case "$d_gethostbyname_r_proto" in
12931         define)
12932         case "$gethostbyname_r_proto" in
12933         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
12934         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
12935         esac
12936         case "$gethostbyname_r_proto" in
12937         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
12938         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
12939         esac
12940         case "$gethostbyname_r_proto" in
12941         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
12942         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
12943         esac
12944         case "$gethostbyname_r_proto" in
12945         ''|0)   d_gethostbyname_r=undef
12946                 gethostbyname_r_proto=0
12947                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
12948         * )     case "$gethostbyname_r_proto" in
12949                 REENTRANT_PROTO*) ;;
12950                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
12951                 esac
12952                 echo "Prototype: $try" ;;
12953         esac
12954         ;;
12955         *)      case "$usethreads" in
12956                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
12957                 esac
12958                 d_gethostbyname_r=undef
12959                 gethostbyname_r_proto=0
12960                 ;;
12961         esac
12962         ;;
12963 *)      gethostbyname_r_proto=0
12964         ;;
12965 esac
12966
12967 : see if gethostent_r exists
12968 set gethostent_r d_gethostent_r
12969 eval $inlibc
12970 case "$d_gethostent_r" in
12971 "$define")
12972         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12973         case "$d_gethostent_r_proto:$usethreads" in
12974         ":define")      d_gethostent_r_proto=define
12975                 set d_gethostent_r_proto gethostent_r $hdrs
12976                 eval $hasproto ;;
12977         *)      ;;
12978         esac
12979         case "$d_gethostent_r_proto" in
12980         define)
12981         case "$gethostent_r_proto" in
12982         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
12983         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
12984         esac
12985         case "$gethostent_r_proto" in
12986         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
12987         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
12988         esac
12989         case "$gethostent_r_proto" in
12990         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
12991         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
12992         esac
12993         case "$gethostent_r_proto" in
12994         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
12995         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
12996         esac
12997         case "$gethostent_r_proto" in
12998         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
12999         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13000         esac
13001         case "$gethostent_r_proto" in
13002         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13003         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13004         esac
13005         case "$gethostent_r_proto" in
13006         ''|0)   d_gethostent_r=undef
13007                 gethostent_r_proto=0
13008                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13009         * )     case "$gethostent_r_proto" in
13010                 REENTRANT_PROTO*) ;;
13011                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13012                 esac
13013                 echo "Prototype: $try" ;;
13014         esac
13015         ;;
13016         *)      case "$usethreads" in
13017                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13018                 esac
13019                 d_gethostent_r=undef
13020                 gethostent_r_proto=0
13021                 ;;
13022         esac
13023         ;;
13024 *)      gethostent_r_proto=0
13025         ;;
13026 esac
13027
13028 : see if prototypes for various gethostxxx netdb.h functions are available
13029 echo " "
13030 set d_gethostprotos gethostent $i_netdb netdb.h
13031 eval $hasproto
13032
13033 : see if getitimer exists
13034 set getitimer d_getitimer
13035 eval $inlibc
13036
13037 : see if getlogin exists
13038 set getlogin d_getlogin
13039 eval $inlibc
13040
13041 : see if getlogin_r exists
13042 set getlogin_r d_getlogin_r
13043 eval $inlibc
13044 case "$d_getlogin_r" in
13045 "$define")
13046         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13047         case "$d_getlogin_r_proto:$usethreads" in
13048         ":define")      d_getlogin_r_proto=define
13049                 set d_getlogin_r_proto getlogin_r $hdrs
13050                 eval $hasproto ;;
13051         *)      ;;
13052         esac
13053         case "$d_getlogin_r_proto" in
13054         define)
13055         case "$getlogin_r_proto" in
13056         ''|0) try='int getlogin_r(char*, size_t);'
13057         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13058         esac
13059         case "$getlogin_r_proto" in
13060         ''|0) try='int getlogin_r(char*, int);'
13061         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13062         esac
13063         case "$getlogin_r_proto" in
13064         ''|0) try='char* getlogin_r(char*, size_t);'
13065         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13066         esac
13067         case "$getlogin_r_proto" in
13068         ''|0) try='char* getlogin_r(char*, int);'
13069         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13070         esac
13071         case "$getlogin_r_proto" in
13072         ''|0)   d_getlogin_r=undef
13073                 getlogin_r_proto=0
13074                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13075         * )     case "$getlogin_r_proto" in
13076                 REENTRANT_PROTO*) ;;
13077                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13078                 esac
13079                 echo "Prototype: $try" ;;
13080         esac
13081         ;;
13082         *)      case "$usethreads" in
13083                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13084                 esac
13085                 d_getlogin_r=undef
13086                 getlogin_r_proto=0
13087                 ;;
13088         esac
13089         ;;
13090 *)      getlogin_r_proto=0
13091         ;;
13092 esac
13093
13094 : see if getmnt exists
13095 set getmnt d_getmnt
13096 eval $inlibc
13097
13098 : see if getmntent exists
13099 set getmntent d_getmntent
13100 eval $inlibc
13101
13102 : see if getnetbyaddr exists
13103 set getnetbyaddr d_getnbyaddr
13104 eval $inlibc
13105
13106 : see if getnetbyname exists
13107 set getnetbyname d_getnbyname
13108 eval $inlibc
13109
13110 : see if getnetent exists
13111 set getnetent d_getnent
13112 eval $inlibc
13113
13114 : see if getnetbyaddr_r exists
13115 set getnetbyaddr_r d_getnetbyaddr_r
13116 eval $inlibc
13117 case "$d_getnetbyaddr_r" in
13118 "$define")
13119         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13120         case "$d_getnetbyaddr_r_proto:$usethreads" in
13121         ":define")      d_getnetbyaddr_r_proto=define
13122                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13123                 eval $hasproto ;;
13124         *)      ;;
13125         esac
13126         case "$d_getnetbyaddr_r_proto" in
13127         define)
13128         case "$getnetbyaddr_r_proto" in
13129         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13130         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13131         esac
13132         case "$getnetbyaddr_r_proto" in
13133         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13134         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13135         esac
13136         case "$getnetbyaddr_r_proto" in
13137         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13138         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13139         esac
13140         case "$getnetbyaddr_r_proto" in
13141         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13142         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13143         esac
13144         case "$getnetbyaddr_r_proto" in
13145         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13146         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13147         esac
13148         case "$getnetbyaddr_r_proto" in
13149         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13150         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13151         esac
13152         case "$getnetbyaddr_r_proto" in
13153         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13154         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13155         esac
13156         case "$getnetbyaddr_r_proto" in
13157         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13158         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13159         esac
13160         case "$getnetbyaddr_r_proto" in
13161         ''|0)   d_getnetbyaddr_r=undef
13162                 getnetbyaddr_r_proto=0
13163                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13164         * )     case "$getnetbyaddr_r_proto" in
13165                 REENTRANT_PROTO*) ;;
13166                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13167                 esac
13168                 echo "Prototype: $try" ;;
13169         esac
13170         ;;
13171         *)      case "$usethreads" in
13172                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13173                 esac
13174                 d_getnetbyaddr_r=undef
13175                 getnetbyaddr_r_proto=0
13176                 ;;
13177         esac
13178         ;;
13179 *)      getnetbyaddr_r_proto=0
13180         ;;
13181 esac
13182
13183 : see if getnetbyname_r exists
13184 set getnetbyname_r d_getnetbyname_r
13185 eval $inlibc
13186 case "$d_getnetbyname_r" in
13187 "$define")
13188         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13189         case "$d_getnetbyname_r_proto:$usethreads" in
13190         ":define")      d_getnetbyname_r_proto=define
13191                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13192                 eval $hasproto ;;
13193         *)      ;;
13194         esac
13195         case "$d_getnetbyname_r_proto" in
13196         define)
13197         case "$getnetbyname_r_proto" in
13198         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13199         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13200         esac
13201         case "$getnetbyname_r_proto" in
13202         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13203         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13204         esac
13205         case "$getnetbyname_r_proto" in
13206         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13207         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13208         esac
13209         case "$getnetbyname_r_proto" in
13210         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13211         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13212         esac
13213         case "$getnetbyname_r_proto" in
13214         ''|0)   d_getnetbyname_r=undef
13215                 getnetbyname_r_proto=0
13216                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13217         * )     case "$getnetbyname_r_proto" in
13218                 REENTRANT_PROTO*) ;;
13219                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13220                 esac
13221                 echo "Prototype: $try" ;;
13222         esac
13223         ;;
13224         *)      case "$usethreads" in
13225                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13226                 esac
13227                 d_getnetbyname_r=undef
13228                 getnetbyname_r_proto=0
13229                 ;;
13230         esac
13231         ;;
13232 *)      getnetbyname_r_proto=0
13233         ;;
13234 esac
13235
13236 : see if getnetent_r exists
13237 set getnetent_r d_getnetent_r
13238 eval $inlibc
13239 case "$d_getnetent_r" in
13240 "$define")
13241         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13242         case "$d_getnetent_r_proto:$usethreads" in
13243         ":define")      d_getnetent_r_proto=define
13244                 set d_getnetent_r_proto getnetent_r $hdrs
13245                 eval $hasproto ;;
13246         *)      ;;
13247         esac
13248         case "$d_getnetent_r_proto" in
13249         define)
13250         case "$getnetent_r_proto" in
13251         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13252         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13253         esac
13254         case "$getnetent_r_proto" in
13255         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13256         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13257         esac
13258         case "$getnetent_r_proto" in
13259         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13260         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13261         esac
13262         case "$getnetent_r_proto" in
13263         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13264         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13265         esac
13266         case "$getnetent_r_proto" in
13267         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13268         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13269         esac
13270         case "$getnetent_r_proto" in
13271         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13272         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13273         esac
13274         case "$getnetent_r_proto" in
13275         ''|0)   d_getnetent_r=undef
13276                 getnetent_r_proto=0
13277                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13278         * )     case "$getnetent_r_proto" in
13279                 REENTRANT_PROTO*) ;;
13280                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13281                 esac
13282                 echo "Prototype: $try" ;;
13283         esac
13284         ;;
13285         *)      case "$usethreads" in
13286                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13287                 esac
13288                 d_getnetent_r=undef
13289                 getnetent_r_proto=0
13290                 ;;
13291         esac
13292         ;;
13293 *)      getnetent_r_proto=0
13294         ;;
13295 esac
13296
13297 : see if prototypes for various getnetxxx netdb.h functions are available
13298 echo " "
13299 set d_getnetprotos getnetent $i_netdb netdb.h
13300 eval $hasproto
13301
13302 : see if getpagesize exists
13303 set getpagesize d_getpagsz
13304 eval $inlibc
13305
13306
13307 : see if getprotobyname exists
13308 set getprotobyname d_getpbyname
13309 eval $inlibc
13310
13311 : see if getprotobynumber exists
13312 set getprotobynumber d_getpbynumber
13313 eval $inlibc
13314
13315 : see if getprotoent exists
13316 set getprotoent d_getpent
13317 eval $inlibc
13318
13319 : see if getpgid exists
13320 set getpgid d_getpgid
13321 eval $inlibc
13322
13323 : see if getpgrp2 exists
13324 set getpgrp2 d_getpgrp2
13325 eval $inlibc
13326
13327 : see if getppid exists
13328 set getppid d_getppid
13329 eval $inlibc
13330
13331 : see if getpriority exists
13332 set getpriority d_getprior
13333 eval $inlibc
13334
13335 : see if getprotobyname_r exists
13336 set getprotobyname_r d_getprotobyname_r
13337 eval $inlibc
13338 case "$d_getprotobyname_r" in
13339 "$define")
13340         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13341         case "$d_getprotobyname_r_proto:$usethreads" in
13342         ":define")      d_getprotobyname_r_proto=define
13343                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13344                 eval $hasproto ;;
13345         *)      ;;
13346         esac
13347         case "$d_getprotobyname_r_proto" in
13348         define)
13349         case "$getprotobyname_r_proto" in
13350         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13351         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13352         esac
13353         case "$getprotobyname_r_proto" in
13354         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13355         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13356         esac
13357         case "$getprotobyname_r_proto" in
13358         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13359         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13360         esac
13361         case "$getprotobyname_r_proto" in
13362         ''|0)   d_getprotobyname_r=undef
13363                 getprotobyname_r_proto=0
13364                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13365         * )     case "$getprotobyname_r_proto" in
13366                 REENTRANT_PROTO*) ;;
13367                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13368                 esac
13369                 echo "Prototype: $try" ;;
13370         esac
13371         ;;
13372         *)      case "$usethreads" in
13373                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13374                 esac
13375                 d_getprotobyname_r=undef
13376                 getprotobyname_r_proto=0
13377                 ;;
13378         esac
13379         ;;
13380 *)      getprotobyname_r_proto=0
13381         ;;
13382 esac
13383
13384 : see if getprotobynumber_r exists
13385 set getprotobynumber_r d_getprotobynumber_r
13386 eval $inlibc
13387 case "$d_getprotobynumber_r" in
13388 "$define")
13389         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13390         case "$d_getprotobynumber_r_proto:$usethreads" in
13391         ":define")      d_getprotobynumber_r_proto=define
13392                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13393                 eval $hasproto ;;
13394         *)      ;;
13395         esac
13396         case "$d_getprotobynumber_r_proto" in
13397         define)
13398         case "$getprotobynumber_r_proto" in
13399         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13400         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13401         esac
13402         case "$getprotobynumber_r_proto" in
13403         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13404         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13405         esac
13406         case "$getprotobynumber_r_proto" in
13407         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13408         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13409         esac
13410         case "$getprotobynumber_r_proto" in
13411         ''|0)   d_getprotobynumber_r=undef
13412                 getprotobynumber_r_proto=0
13413                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
13414         * )     case "$getprotobynumber_r_proto" in
13415                 REENTRANT_PROTO*) ;;
13416                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13417                 esac
13418                 echo "Prototype: $try" ;;
13419         esac
13420         ;;
13421         *)      case "$usethreads" in
13422                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13423                 esac
13424                 d_getprotobynumber_r=undef
13425                 getprotobynumber_r_proto=0
13426                 ;;
13427         esac
13428         ;;
13429 *)      getprotobynumber_r_proto=0
13430         ;;
13431 esac
13432
13433 : see if getprotoent_r exists
13434 set getprotoent_r d_getprotoent_r
13435 eval $inlibc
13436 case "$d_getprotoent_r" in
13437 "$define")
13438         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13439         case "$d_getprotoent_r_proto:$usethreads" in
13440         ":define")      d_getprotoent_r_proto=define
13441                 set d_getprotoent_r_proto getprotoent_r $hdrs
13442                 eval $hasproto ;;
13443         *)      ;;
13444         esac
13445         case "$d_getprotoent_r_proto" in
13446         define)
13447         case "$getprotoent_r_proto" in
13448         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13449         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13450         esac
13451         case "$getprotoent_r_proto" in
13452         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13453         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13454         esac
13455         case "$getprotoent_r_proto" in
13456         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13457         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13458         esac
13459         case "$getprotoent_r_proto" in
13460         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13461         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13462         esac
13463         case "$getprotoent_r_proto" in
13464         ''|0)   d_getprotoent_r=undef
13465                 getprotoent_r_proto=0
13466                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
13467         * )     case "$getprotoent_r_proto" in
13468                 REENTRANT_PROTO*) ;;
13469                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13470                 esac
13471                 echo "Prototype: $try" ;;
13472         esac
13473         ;;
13474         *)      case "$usethreads" in
13475                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13476                 esac
13477                 d_getprotoent_r=undef
13478                 getprotoent_r_proto=0
13479                 ;;
13480         esac
13481         ;;
13482 *)      getprotoent_r_proto=0
13483         ;;
13484 esac
13485
13486 : see if prototypes for various getprotoxxx netdb.h functions are available
13487 echo " "
13488 set d_getprotoprotos getprotoent $i_netdb netdb.h
13489 eval $hasproto
13490
13491 : see if getprpwnam exists
13492 set getprpwnam d_getprpwnam
13493 eval $inlibc
13494
13495 : see if getpwent exists
13496 set getpwent d_getpwent
13497 eval $inlibc
13498
13499 : see if getpwent_r exists
13500 set getpwent_r d_getpwent_r
13501 eval $inlibc
13502 case "$d_getpwent_r" in
13503 "$define")
13504         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13505         case "$d_getpwent_r_proto:$usethreads" in
13506         ":define")      d_getpwent_r_proto=define
13507                 set d_getpwent_r_proto getpwent_r $hdrs
13508                 eval $hasproto ;;
13509         *)      ;;
13510         esac
13511         case "$d_getpwent_r_proto" in
13512         define)
13513         case "$getpwent_r_proto" in
13514         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13515         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13516         esac
13517         case "$getpwent_r_proto" in
13518         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13519         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13520         esac
13521         case "$getpwent_r_proto" in
13522         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13523         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13524         esac
13525         case "$getpwent_r_proto" in
13526         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13527         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13528         esac
13529         case "$getpwent_r_proto" in
13530         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13531         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13532         esac
13533         case "$getpwent_r_proto" in
13534         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13535         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13536         esac
13537         case "$getpwent_r_proto" in
13538         ''|0)   d_getpwent_r=undef
13539                 getpwent_r_proto=0
13540                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
13541         * )     case "$getpwent_r_proto" in
13542                 REENTRANT_PROTO*) ;;
13543                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13544                 esac
13545                 echo "Prototype: $try" ;;
13546         esac
13547         ;;
13548         *)      case "$usethreads" in
13549                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13550                 esac
13551                 d_getpwent_r=undef
13552                 getpwent_r_proto=0
13553                 ;;
13554         esac
13555         ;;
13556 *)      getpwent_r_proto=0
13557         ;;
13558 esac
13559
13560 : see if getpwnam_r exists
13561 set getpwnam_r d_getpwnam_r
13562 eval $inlibc
13563 case "$d_getpwnam_r" in
13564 "$define")
13565         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13566         case "$d_getpwnam_r_proto:$usethreads" in
13567         ":define")      d_getpwnam_r_proto=define
13568                 set d_getpwnam_r_proto getpwnam_r $hdrs
13569                 eval $hasproto ;;
13570         *)      ;;
13571         esac
13572         case "$d_getpwnam_r_proto" in
13573         define)
13574         case "$getpwnam_r_proto" in
13575         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13576         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
13577         esac
13578         case "$getpwnam_r_proto" in
13579         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
13580         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
13581         esac
13582         case "$getpwnam_r_proto" in
13583         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
13584         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
13585         esac
13586         case "$getpwnam_r_proto" in
13587         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
13588         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
13589         esac
13590         case "$getpwnam_r_proto" in
13591         ''|0)   d_getpwnam_r=undef
13592                 getpwnam_r_proto=0
13593                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
13594         * )     case "$getpwnam_r_proto" in
13595                 REENTRANT_PROTO*) ;;
13596                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
13597                 esac
13598                 echo "Prototype: $try" ;;
13599         esac
13600         ;;
13601         *)      case "$usethreads" in
13602                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13603                 esac
13604                 d_getpwnam_r=undef
13605                 getpwnam_r_proto=0
13606                 ;;
13607         esac
13608         ;;
13609 *)      getpwnam_r_proto=0
13610         ;;
13611 esac
13612
13613 : see if getpwuid_r exists
13614 set getpwuid_r d_getpwuid_r
13615 eval $inlibc
13616 case "$d_getpwuid_r" in
13617 "$define")
13618         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13619         case "$d_getpwuid_r_proto:$usethreads" in
13620         ":define")      d_getpwuid_r_proto=define
13621                 set d_getpwuid_r_proto getpwuid_r $hdrs
13622                 eval $hasproto ;;
13623         *)      ;;
13624         esac
13625         case "$d_getpwuid_r_proto" in
13626         define)
13627         case "$getpwuid_r_proto" in
13628         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13629         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13630         esac
13631         case "$getpwuid_r_proto" in
13632         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13633         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13634         esac
13635         case "$getpwuid_r_proto" in
13636         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13637         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13638         esac
13639         case "$getpwuid_r_proto" in
13640         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13641         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13642         esac
13643         case "$getpwuid_r_proto" in
13644         ''|0)   d_getpwuid_r=undef
13645                 getpwuid_r_proto=0
13646                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
13647         * )     case "$getpwuid_r_proto" in
13648                 REENTRANT_PROTO*) ;;
13649                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13650                 esac
13651                 echo "Prototype: $try" ;;
13652         esac
13653         ;;
13654         *)      case "$usethreads" in
13655                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13656                 esac
13657                 d_getpwuid_r=undef
13658                 getpwuid_r_proto=0
13659                 ;;
13660         esac
13661         ;;
13662 *)      getpwuid_r_proto=0
13663         ;;
13664 esac
13665
13666
13667 : see if getservbyname exists
13668 set getservbyname d_getsbyname
13669 eval $inlibc
13670
13671 : see if getservbyport exists
13672 set getservbyport d_getsbyport
13673 eval $inlibc
13674
13675 : see if getservent exists
13676 set getservent d_getsent
13677 eval $inlibc
13678
13679 : see if getservbyname_r exists
13680 set getservbyname_r d_getservbyname_r
13681 eval $inlibc
13682 case "$d_getservbyname_r" in
13683 "$define")
13684         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13685         case "$d_getservbyname_r_proto:$usethreads" in
13686         ":define")      d_getservbyname_r_proto=define
13687                 set d_getservbyname_r_proto getservbyname_r $hdrs
13688                 eval $hasproto ;;
13689         *)      ;;
13690         esac
13691         case "$d_getservbyname_r_proto" in
13692         define)
13693         case "$getservbyname_r_proto" in
13694         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13695         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13696         esac
13697         case "$getservbyname_r_proto" in
13698         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13699         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13700         esac
13701         case "$getservbyname_r_proto" in
13702         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13703         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13704         esac
13705         case "$getservbyname_r_proto" in
13706         ''|0)   d_getservbyname_r=undef
13707                 getservbyname_r_proto=0
13708                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
13709         * )     case "$getservbyname_r_proto" in
13710                 REENTRANT_PROTO*) ;;
13711                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
13712                 esac
13713                 echo "Prototype: $try" ;;
13714         esac
13715         ;;
13716         *)      case "$usethreads" in
13717                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
13718                 esac
13719                 d_getservbyname_r=undef
13720                 getservbyname_r_proto=0
13721                 ;;
13722         esac
13723         ;;
13724 *)      getservbyname_r_proto=0
13725         ;;
13726 esac
13727
13728 : see if getservbyport_r exists
13729 set getservbyport_r d_getservbyport_r
13730 eval $inlibc
13731 case "$d_getservbyport_r" in
13732 "$define")
13733         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13734         case "$d_getservbyport_r_proto:$usethreads" in
13735         ":define")      d_getservbyport_r_proto=define
13736                 set d_getservbyport_r_proto getservbyport_r $hdrs
13737                 eval $hasproto ;;
13738         *)      ;;
13739         esac
13740         case "$d_getservbyport_r_proto" in
13741         define)
13742         case "$getservbyport_r_proto" in
13743         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
13744         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
13745         esac
13746         case "$getservbyport_r_proto" in
13747         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
13748         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
13749         esac
13750         case "$getservbyport_r_proto" in
13751         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
13752         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
13753         esac
13754         case "$getservbyport_r_proto" in
13755         ''|0)   d_getservbyport_r=undef
13756                 getservbyport_r_proto=0
13757                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
13758         * )     case "$getservbyport_r_proto" in
13759                 REENTRANT_PROTO*) ;;
13760                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
13761                 esac
13762                 echo "Prototype: $try" ;;
13763         esac
13764         ;;
13765         *)      case "$usethreads" in
13766                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
13767                 esac
13768                 d_getservbyport_r=undef
13769                 getservbyport_r_proto=0
13770                 ;;
13771         esac
13772         ;;
13773 *)      getservbyport_r_proto=0
13774         ;;
13775 esac
13776
13777 : see if getservent_r exists
13778 set getservent_r d_getservent_r
13779 eval $inlibc
13780 case "$d_getservent_r" in
13781 "$define")
13782         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13783         case "$d_getservent_r_proto:$usethreads" in
13784         ":define")      d_getservent_r_proto=define
13785                 set d_getservent_r_proto getservent_r $hdrs
13786                 eval $hasproto ;;
13787         *)      ;;
13788         esac
13789         case "$d_getservent_r_proto" in
13790         define)
13791         case "$getservent_r_proto" in
13792         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
13793         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
13794         esac
13795         case "$getservent_r_proto" in
13796         ''|0) try='int getservent_r(struct servent*, char*, int);'
13797         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
13798         esac
13799         case "$getservent_r_proto" in
13800         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
13801         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
13802         esac
13803         case "$getservent_r_proto" in
13804         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
13805         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
13806         esac
13807         case "$getservent_r_proto" in
13808         ''|0)   d_getservent_r=undef
13809                 getservent_r_proto=0
13810                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
13811         * )     case "$getservent_r_proto" in
13812                 REENTRANT_PROTO*) ;;
13813                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
13814                 esac
13815                 echo "Prototype: $try" ;;
13816         esac
13817         ;;
13818         *)      case "$usethreads" in
13819                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
13820                 esac
13821                 d_getservent_r=undef
13822                 getservent_r_proto=0
13823                 ;;
13824         esac
13825         ;;
13826 *)      getservent_r_proto=0
13827         ;;
13828 esac
13829
13830 : see if prototypes for various getservxxx netdb.h functions are available
13831 echo " "
13832 set d_getservprotos getservent $i_netdb netdb.h
13833 eval $hasproto
13834
13835 : see if getspnam exists
13836 set getspnam d_getspnam
13837 eval $inlibc
13838
13839 : see if this is a shadow.h system
13840 set shadow.h i_shadow
13841 eval $inhdr
13842
13843 : see if getspnam_r exists
13844 set getspnam_r d_getspnam_r
13845 eval $inlibc
13846 case "$d_getspnam_r" in
13847 "$define")
13848         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
13849         case "$d_getspnam_r_proto:$usethreads" in
13850         ":define")      d_getspnam_r_proto=define
13851                 set d_getspnam_r_proto getspnam_r $hdrs
13852                 eval $hasproto ;;
13853         *)      ;;
13854         esac
13855         case "$d_getspnam_r_proto" in
13856         define)
13857         case "$getspnam_r_proto" in
13858         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
13859         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
13860         esac
13861         case "$getspnam_r_proto" in
13862         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
13863         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
13864         esac
13865         case "$getspnam_r_proto" in
13866         ''|0)   d_getspnam_r=undef
13867                 getspnam_r_proto=0
13868                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
13869         * )     case "$getspnam_r_proto" in
13870                 REENTRANT_PROTO*) ;;
13871                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
13872                 esac
13873                 echo "Prototype: $try" ;;
13874         esac
13875         ;;
13876         *)      case "$usethreads" in
13877                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
13878                 esac
13879                 d_getspnam_r=undef
13880                 getspnam_r_proto=0
13881                 ;;
13882         esac
13883         ;;
13884 *)      getspnam_r_proto=0
13885         ;;
13886 esac
13887
13888 : see if gettimeofday or ftime exists
13889 set gettimeofday d_gettimeod
13890 eval $inlibc
13891 case "$d_gettimeod" in
13892 "$undef")
13893         set ftime d_ftime 
13894         eval $inlibc
13895         ;;
13896 *)
13897         val="$undef"; set d_ftime; eval $setvar
13898         ;;
13899 esac
13900 case "$d_gettimeod$d_ftime" in
13901 "$undef$undef")
13902         echo " "
13903         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
13904         ;;
13905 esac
13906
13907 : see if gmtime_r exists
13908 set gmtime_r d_gmtime_r
13909 eval $inlibc
13910 case "$d_gmtime_r" in
13911 "$define")
13912         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13913         case "$d_gmtime_r_proto:$usethreads" in
13914         ":define")      d_gmtime_r_proto=define
13915                 set d_gmtime_r_proto gmtime_r $hdrs
13916                 eval $hasproto ;;
13917         *)      ;;
13918         esac
13919         case "$d_gmtime_r_proto" in
13920         define)
13921         case "$gmtime_r_proto" in
13922         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
13923         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
13924         esac
13925         case "$gmtime_r_proto" in
13926         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
13927         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
13928         esac
13929         case "$gmtime_r_proto" in
13930         ''|0)   d_gmtime_r=undef
13931                 gmtime_r_proto=0
13932                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
13933         * )     case "$gmtime_r_proto" in
13934                 REENTRANT_PROTO*) ;;
13935                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
13936                 esac
13937                 echo "Prototype: $try" ;;
13938         esac
13939         ;;
13940         *)      case "$usethreads" in
13941                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
13942                 esac
13943                 d_gmtime_r=undef
13944                 gmtime_r_proto=0
13945                 ;;
13946         esac
13947         ;;
13948 *)      gmtime_r_proto=0
13949         ;;
13950 esac
13951
13952 : see if hasmntopt exists
13953 set hasmntopt d_hasmntopt
13954 eval $inlibc
13955
13956 : see if this is a netinet/in.h or sys/in.h system
13957 set netinet/in.h i_niin sys/in.h i_sysin
13958 eval $inhdr
13959
13960 : see if arpa/inet.h has to be included
13961 set arpa/inet.h i_arpainet
13962 eval $inhdr
13963
13964 : see if htonl --and friends-- exists
13965 val=''
13966 set htonl val
13967 eval $inlibc
13968
13969 : Maybe they are macros.
13970 case "$val" in
13971 $undef)
13972         $cat >htonl.c <<EOM
13973 #include <stdio.h>
13974 #include <sys/types.h>
13975 #$i_niin I_NETINET_IN
13976 #$i_sysin I_SYS_IN
13977 #$i_arpainet I_ARPA_INET
13978 #ifdef I_NETINET_IN
13979 #include <netinet/in.h>
13980 #endif
13981 #ifdef I_SYS_IN
13982 #include <sys/in.h>
13983 #endif
13984 #ifdef I_ARPA_INET
13985 #include <arpa/inet.h>
13986 #endif
13987 #ifdef htonl
13988 printf("Defined as a macro.");
13989 #endif
13990 EOM
13991         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
13992         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
13993                 val="$define"
13994                 echo "But it seems to be defined as a macro." >&4
13995         fi
13996         $rm -f htonl.?
13997         ;;
13998 esac
13999 set d_htonl
14000 eval $setvar
14001
14002 : see if ilogbl exists
14003 set ilogbl d_ilogbl
14004 eval $inlibc
14005
14006 : index or strchr
14007 echo " "
14008 if set index val -f; eval $csym; $val; then
14009         if set strchr val -f d_strchr; eval $csym; $val; then
14010                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14011                         val="$define"
14012                         vali="$undef"
14013                         echo "strchr() found." >&4
14014                 else
14015                         val="$undef"
14016                         vali="$define"
14017                         echo "index() found." >&4
14018                 fi
14019         else
14020                 val="$undef"
14021                 vali="$define"
14022                 echo "index() found." >&4
14023         fi
14024 else
14025         if set strchr val -f d_strchr; eval $csym; $val; then
14026                 val="$define"
14027                 vali="$undef"
14028                 echo "strchr() found." >&4
14029         else
14030                 echo "No index() or strchr() found!" >&4
14031                 val="$undef"
14032                 vali="$undef"
14033         fi
14034 fi
14035 set d_strchr; eval $setvar
14036 val="$vali"
14037 set d_index; eval $setvar
14038
14039 : check whether inet_aton exists
14040 set inet_aton d_inetaton
14041 eval $inlibc
14042
14043 : Look for isascii
14044 echo " "
14045 $cat >isascii.c <<EOCP
14046 #include <stdio.h>
14047 #include <ctype.h>
14048 #$i_stdlib I_STDLIB
14049 #ifdef I_STDLIB
14050 #include <stdlib.h>
14051 #endif
14052 int main() {
14053         int c = 'A';
14054         if (isascii(c))
14055                 exit(0);
14056         else
14057                 exit(1);
14058 }
14059 EOCP
14060 set isascii
14061 if eval $compile; then
14062         echo "isascii() found." >&4
14063         val="$define"
14064 else
14065         echo "isascii() NOT found." >&4
14066         val="$undef"
14067 fi
14068 set d_isascii
14069 eval $setvar
14070 $rm -f isascii*
14071
14072 : see if isfinite exists
14073 set isfinite d_isfinite
14074 eval $inlibc
14075
14076 : see if isinf exists
14077 set isinf d_isinf
14078 eval $inlibc
14079
14080 : see if isnan exists
14081 set isnan d_isnan
14082 eval $inlibc
14083
14084 : see if isnanl exists
14085 set isnanl d_isnanl
14086 eval $inlibc
14087
14088 : see if killpg exists
14089 set killpg d_killpg
14090 eval $inlibc
14091
14092 : see if lchown exists
14093 echo " "
14094 $cat > try.c <<'EOCP'
14095 /* System header to define __stub macros and hopefully few prototypes,
14096     which can conflict with char lchown(); below.  */
14097 #include <assert.h>
14098 /* Override any gcc2 internal prototype to avoid an error.  */
14099 /* We use char because int might match the return type of a gcc2
14100    builtin and then its argument prototype would still apply.  */
14101 char lchown();
14102 int main() {
14103     /*  The GNU C library defines this for functions which it implements
14104         to always fail with ENOSYS.  Some functions are actually named
14105         something starting with __ and the normal name is an alias.  */
14106 #if defined (__stub_lchown) || defined (__stub___lchown)
14107 choke me
14108 #else
14109 lchown();
14110 #endif
14111 ; return 0; }
14112 EOCP
14113 set try
14114 if eval $compile; then
14115     $echo "lchown() found." >&4
14116     val="$define"
14117 else
14118     $echo "lchown() NOT found." >&4
14119     val="$undef"
14120 fi
14121 set d_lchown
14122 eval $setvar
14123
14124 : See if number of significant digits in a double precision number is known
14125 echo " "
14126 $cat >ldbl_dig.c <<EOM
14127 #$i_limits I_LIMITS
14128 #$i_float I_FLOAT
14129 #ifdef I_LIMITS
14130 #include <limits.h>
14131 #endif
14132 #ifdef I_FLOAT
14133 #include <float.h>
14134 #endif
14135 #ifdef LDBL_DIG
14136 printf("Contains LDBL_DIG");
14137 #endif
14138 EOM
14139 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14140 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14141         echo "LDBL_DIG found." >&4
14142         val="$define"
14143 else
14144         echo "LDBL_DIG NOT found." >&4
14145         val="$undef"
14146 fi
14147 $rm -f ldbl_dig.?
14148 set d_ldbl_dig
14149 eval $setvar
14150
14151 : see if this is a math.h system
14152 set math.h i_math
14153 eval $inhdr
14154
14155 d_libm_lib_version="$undef"
14156 case $i_math in
14157     $define)
14158         : check to see if math.h defines _LIB_VERSION
14159         echo " "
14160         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14161         $cat >try.c <<EOCP
14162 #include <unistd.h>
14163 #include <math.h>
14164 int main (int argc, char *argv[])
14165 {
14166     printf ("%d\n", _LIB_VERSION);
14167     return (0);
14168     } /* main */
14169 EOCP
14170         set try
14171         if eval $compile; then
14172             foo=`$run ./try`
14173             echo "Yes, it does ($foo)" >&4
14174             d_libm_lib_version="$define"
14175         else
14176             echo "No, it does not (probably harmless)\n" >&4
14177             fi
14178         $rm -f try.* try core core.try.*
14179         ;;
14180
14181     esac
14182
14183 : see if link exists
14184 set link d_link
14185 eval $inlibc
14186
14187 : see if localtime_r exists
14188 set localtime_r d_localtime_r
14189 eval $inlibc
14190 case "$d_localtime_r" in
14191 "$define")
14192         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14193         case "$d_localtime_r_proto:$usethreads" in
14194         ":define")      d_localtime_r_proto=define
14195                 set d_localtime_r_proto localtime_r $hdrs
14196                 eval $hasproto ;;
14197         *)      ;;
14198         esac
14199         case "$d_localtime_r_proto" in
14200         define)
14201         case "$localtime_r_proto" in
14202         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14203         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14204         esac
14205         case "$localtime_r_proto" in
14206         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14207         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14208         esac
14209         case "$localtime_r_proto" in
14210         ''|0)   d_localtime_r=undef
14211                 localtime_r_proto=0
14212                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14213         * )     case "$localtime_r_proto" in
14214                 REENTRANT_PROTO*) ;;
14215                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14216                 esac
14217                 echo "Prototype: $try" ;;
14218         esac
14219         ;;
14220         *)      case "$usethreads" in
14221                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14222                 esac
14223                 d_localtime_r=undef
14224                 localtime_r_proto=0
14225                 ;;
14226         esac
14227         ;;
14228 *)      localtime_r_proto=0
14229         ;;
14230 esac
14231
14232 : see if localeconv exists
14233 set localeconv d_locconv
14234 eval $inlibc
14235
14236 : see if lockf exists
14237 set lockf d_lockf
14238 eval $inlibc
14239
14240 : see if prototype for lseek is available
14241 echo " "
14242 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14243 eval $hasproto
14244
14245 : see if lstat exists
14246 set lstat d_lstat
14247 eval $inlibc
14248
14249 : see if madvise exists
14250 set madvise d_madvise
14251 eval $inlibc
14252
14253 : see if malloc_size exists
14254 set malloc_size d_malloc_size
14255 eval $inlibc
14256
14257 : see if malloc_size_good exists
14258 set malloc_good_size d_malloc_good_size
14259 eval $inlibc
14260
14261 : see if mblen exists
14262 set mblen d_mblen
14263 eval $inlibc
14264
14265 : see if mbstowcs exists
14266 set mbstowcs d_mbstowcs
14267 eval $inlibc
14268
14269 : see if mbtowc exists
14270 set mbtowc d_mbtowc
14271 eval $inlibc
14272
14273 : see if memchr exists
14274 set memchr d_memchr
14275 eval $inlibc
14276
14277 : see if memcmp exists
14278 set memcmp d_memcmp
14279 eval $inlibc
14280
14281 : see if memcpy exists
14282 set memcpy d_memcpy
14283 eval $inlibc
14284
14285 : see if memmove exists
14286 set memmove d_memmove
14287 eval $inlibc
14288
14289 : see if memset exists
14290 set memset d_memset
14291 eval $inlibc
14292
14293 : see if mkdir exists
14294 set mkdir d_mkdir
14295 eval $inlibc
14296
14297 : see if mkdtemp exists
14298 set mkdtemp d_mkdtemp
14299 eval $inlibc
14300
14301 : see if mkfifo exists
14302 set mkfifo d_mkfifo
14303 eval $inlibc
14304
14305 : see if mkstemp exists
14306 set mkstemp d_mkstemp
14307 eval $inlibc
14308
14309 : see if mkstemps exists
14310 set mkstemps d_mkstemps
14311 eval $inlibc
14312
14313 : see if mktime exists
14314 set mktime d_mktime
14315 eval $inlibc
14316
14317 : see if this is a sys/mman.h system
14318 set sys/mman.h i_sysmman
14319 eval $inhdr
14320
14321 : see if mmap exists
14322 set mmap d_mmap
14323 eval $inlibc
14324 : see what shmat returns
14325 : default to something harmless
14326 mmaptype='void *'
14327 case "$i_sysmman$d_mmap" in
14328 "$define$define")
14329         $cat >mmap.c <<'END'
14330 #include <sys/mman.h>
14331 void *mmap();
14332 END
14333         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14334                 mmaptype='void *'
14335         else
14336                 mmaptype='caddr_t'
14337         fi
14338         echo "and it returns ($mmaptype)." >&4
14339         ;;
14340 esac
14341
14342
14343
14344 : see if sqrtl exists
14345 set sqrtl d_sqrtl
14346 eval $inlibc
14347
14348 : see if scalbnl exists
14349 set scalbnl d_scalbnl
14350 eval $inlibc
14351
14352 : see if modfl exists
14353 set modfl d_modfl
14354 eval $inlibc
14355
14356 : see if prototype for modfl is available
14357 echo " "
14358 set d_modflproto modfl $i_math math.h
14359 eval $hasproto
14360
14361 d_modfl_pow32_bug="$undef"
14362
14363 case "$d_longdbl$d_modfl" in
14364 $define$define)
14365         $cat <<EOM
14366 Checking to see whether your modfl() is okay for large values...
14367 EOM
14368 $cat >try.c <<EOCP
14369 #include <math.h> 
14370 #include <stdio.h>
14371 EOCP
14372 if $test "X$d_modflproto" != "X$define"; then
14373         $cat >>try.c <<EOCP
14374 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
14375 long double modfl (long double, long double *);
14376 EOCP
14377 fi
14378 $cat >>try.c <<EOCP
14379 int main() {
14380     long double nv = 4294967303.15;
14381     long double v, w;
14382     v = modfl(nv, &w);         
14383 #ifdef __GLIBC__
14384     printf("glibc");
14385 #endif
14386     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14387     return 0;
14388 }
14389 EOCP
14390         case "$osname:$gccversion" in
14391         aix:)   saveccflags="$ccflags"
14392                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14393         esac
14394         set try
14395         if eval $compile; then
14396                 foo=`$run ./try`
14397                 case "$foo" in
14398                 *" 4294967303.150000 1.150000 4294967302.000000")
14399                         echo >&4 "Your modfl() is broken for large values."
14400                         d_modfl_pow32_bug="$define"
14401                         case "$foo" in
14402                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14403                         ;;
14404                         esac
14405                         ;;
14406                 *" 4294967303.150000 0.150000 4294967303.000000")
14407                         echo >&4 "Your modfl() seems okay for large values."
14408                         ;;
14409                 *)      echo >&4 "I don't understand your modfl() at all."
14410                         d_modfl="$undef"
14411                         ;;
14412                 esac
14413                 $rm -f try.* try core core.try.*
14414         else
14415                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14416                 d_modfl="$undef"
14417         fi
14418         case "$osname:$gccversion" in
14419         aix:)   ccflags="$saveccflags" ;; # restore
14420         esac
14421         ;;
14422 esac
14423
14424 if $test "$uselongdouble" = "$define"; then
14425     message=""
14426     if $test "$d_sqrtl" != "$define"; then
14427         message="$message sqrtl"
14428     fi
14429     if $test "$d_modfl" != "$define"; then
14430         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14431             echo "You have both aintl and copysignl, so I can emulate modfl."
14432         else
14433             message="$message modfl"
14434         fi
14435     fi
14436     if $test "$d_frexpl" != "$define"; then
14437         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14438             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14439         else
14440             message="$message frexpl"
14441         fi
14442     fi
14443
14444     if $test "$message" != ""; then
14445         $cat <<EOM >&4
14446
14447 *** You requested the use of long doubles but you do not seem to have
14448 *** the following mathematical functions needed for long double support:
14449 ***    $message
14450 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14451 *** Cannot continue, aborting.
14452
14453 EOM
14454
14455         exit 1
14456     fi
14457 fi
14458
14459 : see if mprotect exists
14460 set mprotect d_mprotect
14461 eval $inlibc
14462
14463 : see if msgctl exists
14464 set msgctl d_msgctl
14465 eval $inlibc
14466
14467 : see if msgget exists
14468 set msgget d_msgget
14469 eval $inlibc
14470
14471 : see if msgsnd exists
14472 set msgsnd d_msgsnd
14473 eval $inlibc
14474
14475 : see if msgrcv exists
14476 set msgrcv d_msgrcv
14477 eval $inlibc
14478
14479 : see how much of the 'msg*(2)' library is present.
14480 h_msg=true
14481 echo " "
14482 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14483 *"$undef"*) h_msg=false;;
14484 esac
14485 case "$osname" in
14486 freebsd)
14487     case "`ipcs 2>&1`" in
14488     "SVID messages"*"not configured"*)
14489         echo "Your $osname does not have the msg*(2) configured." >&4
14490         h_msg=false
14491         val="$undef"
14492         set msgctl d_msgctl
14493         eval $setvar
14494         set msgget d_msgget
14495         eval $setvar
14496         set msgsnd d_msgsnd
14497         eval $setvar
14498         set msgrcv d_msgrcv
14499         eval $setvar
14500         ;;
14501     esac
14502     ;;
14503 esac
14504 : we could also check for sys/ipc.h ...
14505 if $h_msg && $test `./findhdr sys/msg.h`; then
14506         echo "You have the full msg*(2) library." >&4
14507         val="$define"
14508 else
14509         echo "You don't have the full msg*(2) library." >&4
14510         val="$undef"
14511 fi
14512 set d_msg
14513 eval $setvar
14514
14515
14516 echo " "
14517 echo "Checking to see if your system supports struct msghdr..." >&4
14518 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14519 eval $hasstruct
14520 case "$d_msghdr_s" in
14521 "$define")      echo "Yes, it does."   ;;
14522 *)              echo "No, it doesn't." ;;
14523 esac
14524
14525
14526 : see if msync exists
14527 set msync d_msync
14528 eval $inlibc
14529
14530 : see if munmap exists
14531 set munmap d_munmap
14532 eval $inlibc
14533
14534 : see if nice exists
14535 set nice d_nice
14536 eval $inlibc
14537
14538 : see if this is a langinfo.h system
14539 set langinfo.h i_langinfo
14540 eval $inhdr
14541
14542 : see if nl_langinfo exists
14543 set nl_langinfo d_nl_langinfo
14544 eval $inlibc
14545
14546 : check for length of character
14547 echo " "
14548 case "$charsize" in
14549 '')
14550         echo "Checking to see how big your characters are (hey, you never know)..." >&4
14551         $cat >try.c <<EOCP
14552 #include <stdio.h>
14553 #$i_stdlib I_STDLIB
14554 #ifdef I_STDLIB
14555 #include <stdlib.h>
14556 #endif
14557 int main()
14558 {
14559     printf("%d\n", (int)sizeof(char));
14560     exit(0);
14561 }
14562 EOCP
14563         set try
14564         if eval $compile_ok; then
14565                 dflt=`$run ./try`
14566         else
14567                 dflt='1'
14568                 echo "(I can't seem to compile the test program.  Guessing...)"
14569         fi
14570         ;;
14571 *)
14572         dflt="$charsize"
14573         ;;
14574 esac
14575 rp="What is the size of a character (in bytes)?"
14576 . ./myread
14577 charsize="$ans"
14578 $rm -f try.c try
14579
14580 : check for volatile keyword
14581 echo " "
14582 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
14583 $cat >try.c <<'EOCP'
14584 int main()
14585 {
14586         typedef struct _goo_struct goo_struct;
14587         goo_struct * volatile goo = ((goo_struct *)0);
14588         struct _goo_struct {
14589                 long long_int;
14590                 int reg_int;
14591                 char char_var;
14592         };
14593         typedef unsigned short foo_t;
14594         char *volatile foo;
14595         volatile int bar;
14596         volatile foo_t blech;
14597         foo = foo;
14598 }
14599 EOCP
14600 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
14601         val="$define"
14602         echo "Yup, it does."
14603 else
14604         val="$undef"
14605         echo "Nope, it doesn't."
14606 fi
14607 set d_volatile
14608 eval $setvar
14609 $rm -f try.*
14610
14611
14612 echo " "
14613 $echo "Choosing the C types to be used for Perl's internal types..." >&4
14614
14615 case "$use64bitint:$d_quad:$quadtype" in
14616 define:define:?*)
14617         ivtype="$quadtype"
14618         uvtype="$uquadtype"
14619         ivsize=8
14620         uvsize=8
14621         ;;
14622 *)      ivtype="long"
14623         uvtype="unsigned long"
14624         ivsize=$longsize
14625         uvsize=$longsize
14626         ;;
14627 esac
14628
14629 case "$uselongdouble:$d_longdbl" in
14630 define:define)
14631         nvtype="long double"
14632         nvsize=$longdblsize
14633         ;;
14634 *)      nvtype=double
14635         nvsize=$doublesize
14636         ;;
14637 esac
14638
14639 $echo "(IV will be "$ivtype", $ivsize bytes)"
14640 $echo "(UV will be "$uvtype", $uvsize bytes)"
14641 $echo "(NV will be "$nvtype", $nvsize bytes)"
14642
14643 $cat >try.c <<EOCP
14644 #$i_inttypes I_INTTYPES
14645 #ifdef I_INTTYPES
14646 #include <inttypes.h>
14647 #endif
14648 #include <stdio.h>
14649 int main() {
14650 #ifdef INT8
14651    int8_t i =  INT8_MAX;
14652   uint8_t u = UINT8_MAX;
14653   printf("int8_t\n");
14654 #endif
14655 #ifdef INT16
14656    int16_t i =  INT16_MAX;
14657   uint16_t i = UINT16_MAX;
14658   printf("int16_t\n");
14659 #endif
14660 #ifdef INT32
14661    int32_t i =  INT32_MAX;
14662   uint32_t u = UINT32_MAX;
14663   printf("int32_t\n");
14664 #endif
14665 }
14666 EOCP
14667
14668 case "$i8type" in
14669 '')     case "$charsize" in
14670         1)      i8type=char
14671                 u8type="unsigned char"
14672                 i8size=$charsize
14673                 u8size=$charsize
14674                 ;;
14675         esac
14676         ;;
14677 esac
14678 case "$i8type" in
14679 '')     set try -DINT8
14680         if eval $compile; then
14681                 case "`$run ./try`" in
14682                 int8_t) i8type=int8_t
14683                         u8type=uint8_t
14684                         i8size=1
14685                         u8size=1
14686                         ;;
14687                 esac
14688         fi
14689         ;;
14690 esac
14691 case "$i8type" in
14692 '')     if $test $charsize -ge 1; then
14693                 i8type=char
14694                 u8type="unsigned char"
14695                 i8size=$charsize
14696                 u8size=$charsize
14697         fi
14698         ;;
14699 esac
14700
14701 case "$i16type" in
14702 '')     case "$shortsize" in
14703         2)      i16type=short
14704                 u16type="unsigned short"
14705                 i16size=$shortsize
14706                 u16size=$shortsize
14707                 ;;
14708         esac
14709         ;;
14710 esac
14711 case "$i16type" in
14712 '')     set try -DINT16
14713         if eval $compile; then
14714                 case "`$run ./try`" in
14715                 int16_t)
14716                         i16type=int16_t
14717                         u16type=uint16_t
14718                         i16size=2
14719                         u16size=2
14720                         ;;
14721                 esac
14722         fi
14723         ;;
14724 esac
14725 case "$i16type" in
14726 '')     if $test $shortsize -ge 2; then
14727                 i16type=short
14728                 u16type="unsigned short"
14729                 i16size=$shortsize
14730                 u16size=$shortsize
14731         fi
14732         ;;
14733 esac
14734
14735 case "$i32type" in
14736 '')     case "$longsize" in
14737         4)      i32type=long
14738                 u32type="unsigned long"
14739                 i32size=$longsize
14740                 u32size=$longsize
14741                 ;;
14742         *)      case "$intsize" in
14743                 4)      i32type=int
14744                         u32type="unsigned int"
14745                         i32size=$intsize
14746                         u32size=$intsize
14747                         ;;
14748                 esac
14749                 ;;
14750         esac
14751         ;;
14752 esac
14753 case "$i32type" in
14754 '')     set try -DINT32
14755         if eval $compile; then
14756                 case "`$run ./try`" in
14757                 int32_t)
14758                         i32type=int32_t
14759                         u32type=uint32_t
14760                         i32size=4
14761                         u32size=4
14762                         ;;
14763                 esac
14764         fi
14765         ;;
14766 esac
14767 case "$i32type" in
14768 '')     if $test $intsize -ge 4; then
14769                 i32type=int
14770                 u32type="unsigned int"
14771                 i32size=$intsize
14772                 u32size=$intsize
14773         fi
14774         ;;
14775 esac
14776
14777 case "$i64type" in
14778 '')     case "$d_quad:$quadtype" in
14779         define:?*)
14780                 i64type="$quadtype"
14781                 u64type="$uquadtype"
14782                 i64size=8
14783                 u64size=8
14784                 ;;
14785         esac
14786         ;;
14787 esac
14788
14789 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
14790 : volatile so that the compiler has to store it out to memory.
14791 if test X"$d_volatile" = X"$define"; then
14792         volatile=volatile
14793 fi
14794 $cat <<EOP >try.c
14795 #include <stdio.h>
14796 #$i_stdlib I_STDLIB
14797 #ifdef I_STDLIB
14798 #include <stdlib.h>
14799 #endif
14800 #include <sys/types.h>
14801 #include <signal.h>
14802 #ifdef SIGFPE
14803 $volatile int bletched = 0;
14804 $signal_t blech(s) int s; { bletched = 1; }
14805 #endif
14806 int main() {
14807     $uvtype u = 0;
14808     $nvtype d;
14809     int     n = 8 * $uvsize;
14810     int     i;
14811 #ifdef SIGFPE
14812     signal(SIGFPE, blech);
14813 #endif
14814
14815     for (i = 0; i < n; i++) {
14816       u = u << 1 | ($uvtype)1;
14817       d = ($nvtype)u;
14818       if (($uvtype)d != u)
14819         break;
14820       if (d <= 0)
14821         break;
14822       d = ($nvtype)(u - 1);
14823       if (($uvtype)d != (u - 1))
14824         break;
14825 #ifdef SIGFPE
14826       if (bletched) {
14827         break;
14828 #endif
14829       } 
14830     }
14831     printf("%d\n", ((i == n) ? -n : i));
14832     exit(0);
14833 }
14834 EOP
14835 set try
14836
14837 d_nv_preserves_uv="$undef"
14838 if eval $compile; then
14839         nv_preserves_uv_bits="`$run ./try`"
14840 fi
14841 case "$nv_preserves_uv_bits" in
14842 \-[1-9]*)       
14843         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
14844         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
14845         d_nv_preserves_uv="$define"
14846         ;;
14847 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
14848         d_nv_preserves_uv="$undef" ;;
14849 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
14850         nv_preserves_uv_bits="$undef" ;;
14851 esac
14852
14853 $rm -f try.* try
14854
14855 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
14856 : volatile so that the compiler has to store it out to memory.
14857 if test X"$d_volatile" = X"$define"; then
14858         volatile=volatile
14859 fi
14860 $cat <<EOP >try.c
14861 #include <stdio.h>
14862 #$i_stdlib I_STDLIB
14863 #ifdef I_STDLIB
14864 #include <stdlib.h>
14865 #endif
14866 #$i_string I_STRING
14867 #ifdef I_STRING
14868 #  include <string.h>
14869 #else
14870 #  include <strings.h>
14871 #endif
14872 #include <sys/types.h>
14873 #include <signal.h>
14874 #ifdef SIGFPE
14875 $volatile int bletched = 0;
14876 $signal_t blech(s) int s; { bletched = 1; }
14877 #endif
14878
14879 int checkit($nvtype d, char *where) {
14880     unsigned char *p = (char *)&d;
14881     unsigned char *end = p + sizeof(d);
14882     int fail = 0;
14883
14884     while (p < end)
14885         fail += *p++;
14886
14887     if (!fail)
14888         return 0;
14889
14890     p = (char *)&d;
14891     printf("No - %s: 0x", where);
14892     while (p < end)
14893         printf ("%02X", *p++);
14894     printf("\n");
14895     return 1;
14896 }
14897
14898 int main(int argc, char **argv) {
14899     $nvtype d = 0.0;
14900     int fail = 0;
14901     fail += checkit(d, "0.0");
14902
14903     /* The compiler shouldn't be assuming that bletched is 0  */
14904     d = bletched;
14905
14906     fail += checkit(d, "bleched");
14907
14908 #ifdef SIGFPE
14909     signal(SIGFPE, blech);
14910 #endif
14911
14912     /* Paranoia - the compiler should have no way of knowing that ANSI says
14913        that argv[argc] will always be NULL.  Actually, if it did assume this it
14914        would be buggy, as this is C and main() can be called from elsewhere in
14915        the program.  */
14916     d = argv[argc] ? 1 : 0;
14917
14918     if (d) {
14919         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
14920     }
14921
14922     fail += checkit(d, "ternary");
14923
14924     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
14925
14926     if (d != 0.0) {
14927         printf("No - memset doesn't give 0.0\n");
14928         /* This might just blow up:  */
14929         printf("(gives %g)\n", d);
14930         return 1;
14931     }
14932     
14933 #ifdef SIGFPE
14934     if (bletched) {
14935         printf("No - something bleched\n");
14936         return 1;
14937     }
14938 #endif
14939     if (fail) {
14940       printf("No - %d fail(s)\n", fail);
14941       return 1;
14942     }
14943     printf("Yes\n");
14944     return 0;
14945 }
14946 EOP
14947 set try
14948
14949 d_nv_zero_is_allbits_zero="$undef"
14950 if eval $compile; then
14951     xxx="`$run ./try`"
14952     case "$?" in
14953         0)
14954             case "$xxx" in
14955                 Yes)  cat >&4 <<EOM
14956 0.0 is represented as all bits zero in memory
14957 EOM
14958                     d_nv_zero_is_allbits_zero="$define"
14959                     ;;
14960                 *)  cat >&4 <<EOM
14961 0.0 is not represented as all bits zero in memory
14962 EOM
14963                     d_nv_zero_is_allbits_zero="$undef"
14964                     ;;
14965             esac
14966             ;;
14967         *)  cat >&4 <<EOM
14968 0.0 is not represented as all bits zero in memory
14969 EOM
14970             d_nv_zero_is_allbits_zero="$undef"
14971             ;;
14972     esac
14973 fi
14974
14975 $rm -f try.* try
14976
14977
14978 : check for off64_t
14979 echo " "
14980 echo "Checking to see if you have off64_t..." >&4
14981 $cat >try.c <<EOCP
14982 #include <sys/types.h>
14983 #include <unistd.h>
14984 int main() { off64_t x = 7; }
14985 EOCP
14986 set try
14987 if eval $compile; then
14988         val="$define"
14989         echo "You have off64_t."
14990 else
14991         val="$undef"
14992         echo "You do not have off64_t."
14993         case "$lseeksize" in
14994         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
14995         esac
14996 fi
14997 $rm -f try.* try
14998 set d_off64_t
14999 eval $setvar
15000
15001 : how to create joinable pthreads
15002 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15003         echo " "
15004         echo "Checking what constant to use for creating joinable pthreads..." >&4 
15005         $cat >try.c <<'EOCP'
15006 #include <pthread.h>
15007 int main() {
15008     int detachstate = JOINABLE;
15009 }
15010 EOCP
15011         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15012         if eval $compile; then
15013                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15014                 val="$undef" # Yes, undef.
15015                 set d_old_pthread_create_joinable
15016                 eval $setvar
15017                 val=""
15018                 set old_pthread_create_joinable
15019                 eval $setvar
15020         else
15021                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15022                 if eval $compile; then
15023                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15024                         val="$define"
15025                         set d_old_pthread_create_joinable
15026                         eval $setvar
15027                         val=PTHREAD_CREATE_UNDETACHED
15028                         set old_pthread_create_joinable
15029                         eval $setvar
15030                 else            
15031                         set try -DJOINABLE=__UNDETACHED
15032                         if eval $compile; then
15033                                 echo "You seem to use __UNDETACHED." >&4
15034                                 val="$define"
15035                                 set d_old_pthread_create_joinable
15036                                 eval $setvar
15037                                 val=__UNDETACHED
15038                                 set old_pthread_create_joinable
15039                                 eval $setvar
15040                         else
15041                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15042                                 val="$define"
15043                                 set d_old_pthread_create_joinable
15044                                 eval $setvar
15045                                 val=0
15046                                 set old_pthread_create_joinable
15047                                 eval $setvar
15048                         fi
15049                 fi
15050         fi
15051         $rm -f try try.*
15052 else
15053     d_old_pthread_create_joinable="$undef"
15054     old_pthread_create_joinable=""
15055 fi
15056
15057 : see if pause exists
15058 set pause d_pause
15059 eval $inlibc
15060
15061 : see if pipe exists
15062 set pipe d_pipe
15063 eval $inlibc
15064
15065 : see if poll exists
15066 set poll d_poll
15067 eval $inlibc
15068
15069 : see if readlink exists
15070 set readlink d_readlink
15071 eval $inlibc
15072
15073 echo " "
15074 procselfexe=''
15075 val="$undef"
15076 case "$d_readlink" in
15077 "$define")
15078         if $issymlink /proc/self/exe ; then
15079                 $ls -l /proc/self/exe > reflect
15080                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15081                         echo "You have Linux-like /proc/self/exe."
15082                         procselfexe='"/proc/self/exe"'
15083                         val="$define"
15084                 fi
15085         fi
15086         if $issymlink /proc/curproc/file ; then
15087                 $ls -l /proc/curproc/file > reflect
15088                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15089                         echo "You have BSD-like /proc/curproc/file."
15090                         procselfexe='"/proc/curproc/file"'
15091                         val="$define"
15092                 fi
15093         fi
15094         ;;
15095 esac
15096 $rm -f reflect
15097 set d_procselfexe
15098 eval $setvar
15099
15100 : see whether the pthread_atfork exists
15101 $cat >try.c <<EOP
15102 #include <pthread.h>
15103 #include <stdio.h>
15104 int main() {
15105 #ifdef  PTHREAD_ATFORK
15106         pthread_atfork(NULL,NULL,NULL);
15107 #endif
15108 }
15109 EOP
15110
15111 : see if pthread_atfork exists
15112 set try -DPTHREAD_ATFORK
15113 if eval $compile; then
15114     val="$define"
15115 else
15116     val="$undef"
15117 fi
15118 case "$usethreads" in
15119 $define)
15120         case "$val" in
15121         $define) echo 'pthread_atfork found.' >&4        ;;
15122         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15123         esac
15124 esac
15125 set d_pthread_atfork
15126 eval $setvar
15127
15128 : see if pthread_attr_setscope exists
15129 set pthread_attr_setscope d_pthread_attr_setscope
15130 eval $inlibc
15131
15132
15133 : see whether the various POSIXish _yields exist
15134 $cat >try.c <<EOP
15135 #include <pthread.h>
15136 #include <stdio.h>
15137 int main() {
15138 #ifdef SCHED_YIELD
15139         sched_yield();
15140 #else
15141 #ifdef PTHREAD_YIELD
15142         pthread_yield();
15143 #else
15144 #ifdef PTHREAD_YIELD_NULL
15145         pthread_yield(NULL);
15146 #endif
15147 #endif
15148 #endif
15149 }
15150 EOP
15151 : see if sched_yield exists
15152 set try -DSCHED_YIELD
15153 if eval $compile; then
15154     val="$define"
15155     sched_yield='sched_yield()'
15156 else
15157     val="$undef"
15158 fi
15159 case "$usethreads" in
15160 $define)
15161         case "$val" in
15162         $define) echo 'sched_yield() found.' >&4        ;;
15163         *)       echo 'sched_yield() NOT found.' >&4    ;;
15164         esac
15165 esac
15166 set d_sched_yield
15167 eval $setvar
15168
15169 : see if pthread_yield exists
15170 set try -DPTHREAD_YIELD
15171 if eval $compile; then
15172     val="$define"
15173     case "$sched_yield" in
15174     '') sched_yield='pthread_yield()' ;;
15175     esac
15176 else
15177     set try -DPTHREAD_YIELD_NULL
15178     if eval $compile; then
15179         val="$define"
15180         case "$sched_yield" in
15181         '') sched_yield='pthread_yield(NULL)' ;;
15182         esac
15183     else
15184         val="$undef"
15185     fi
15186 fi
15187 case "$usethreads" in
15188 $define)
15189         case "$val" in
15190         $define) echo 'pthread_yield() found.' >&4      ;;
15191         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15192         esac
15193         ;;
15194 esac
15195 set d_pthread_yield
15196 eval $setvar
15197
15198 case "$sched_yield" in
15199 '') sched_yield=undef ;;
15200 esac
15201
15202 $rm -f try try.*
15203
15204 : see if random_r exists
15205 set random_r d_random_r
15206 eval $inlibc
15207 case "$d_random_r" in
15208 "$define")
15209         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15210         case "$d_random_r_proto:$usethreads" in
15211         ":define")      d_random_r_proto=define
15212                 set d_random_r_proto random_r $hdrs
15213                 eval $hasproto ;;
15214         *)      ;;
15215         esac
15216         case "$d_random_r_proto" in
15217         define)
15218         case "$random_r_proto" in
15219         ''|0) try='int random_r(int*, struct random_data*);'
15220         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15221         esac
15222         case "$random_r_proto" in
15223         ''|0) try='int random_r(long*, struct random_data*);'
15224         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15225         esac
15226         case "$random_r_proto" in
15227         ''|0) try='int random_r(struct random_data*, int32_t*);'
15228         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15229         esac
15230         case "$random_r_proto" in
15231         ''|0)   d_random_r=undef
15232                 random_r_proto=0
15233                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
15234         * )     case "$random_r_proto" in
15235                 REENTRANT_PROTO*) ;;
15236                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15237                 esac
15238                 echo "Prototype: $try" ;;
15239         esac
15240         ;;
15241         *)      case "$usethreads" in
15242                 define) echo "random_r has no prototype, not using it." >&4 ;;
15243                 esac
15244                 d_random_r=undef
15245                 random_r_proto=0
15246                 ;;
15247         esac
15248         ;;
15249 *)      random_r_proto=0
15250         ;;
15251 esac
15252
15253 : see if readdir and friends exist
15254 set readdir d_readdir
15255 eval $inlibc
15256 set seekdir d_seekdir
15257 eval $inlibc
15258 set telldir d_telldir
15259 eval $inlibc
15260 set rewinddir d_rewinddir
15261 eval $inlibc
15262
15263 : see if readdir64_r exists
15264 set readdir64_r d_readdir64_r
15265 eval $inlibc
15266 case "$d_readdir64_r" in
15267 "$define")
15268         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15269         case "$d_readdir64_r_proto:$usethreads" in
15270         ":define")      d_readdir64_r_proto=define
15271                 set d_readdir64_r_proto readdir64_r $hdrs
15272                 eval $hasproto ;;
15273         *)      ;;
15274         esac
15275         case "$d_readdir64_r_proto" in
15276         define)
15277         case "$readdir64_r_proto" in
15278         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15279         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15280         esac
15281         case "$readdir64_r_proto" in
15282         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15283         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15284         esac
15285         case "$readdir64_r_proto" in
15286         ''|0)   d_readdir64_r=undef
15287                 readdir64_r_proto=0
15288                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
15289         * )     case "$readdir64_r_proto" in
15290                 REENTRANT_PROTO*) ;;
15291                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15292                 esac
15293                 echo "Prototype: $try" ;;
15294         esac
15295         ;;
15296         *)      case "$usethreads" in
15297                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15298                 esac
15299                 d_readdir64_r=undef
15300                 readdir64_r_proto=0
15301                 ;;
15302         esac
15303         ;;
15304 *)      readdir64_r_proto=0
15305         ;;
15306 esac
15307
15308 : see if readdir_r exists
15309 set readdir_r d_readdir_r
15310 eval $inlibc
15311 case "$d_readdir_r" in
15312 "$define")
15313         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15314         case "$d_readdir_r_proto:$usethreads" in
15315         ":define")      d_readdir_r_proto=define
15316                 set d_readdir_r_proto readdir_r $hdrs
15317                 eval $hasproto ;;
15318         *)      ;;
15319         esac
15320         case "$d_readdir_r_proto" in
15321         define)
15322         case "$readdir_r_proto" in
15323         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15324         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15325         esac
15326         case "$readdir_r_proto" in
15327         ''|0) try='int readdir_r(DIR*, struct dirent*);'
15328         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15329         esac
15330         case "$readdir_r_proto" in
15331         ''|0)   d_readdir_r=undef
15332                 readdir_r_proto=0
15333                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
15334         * )     case "$readdir_r_proto" in
15335                 REENTRANT_PROTO*) ;;
15336                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15337                 esac
15338                 echo "Prototype: $try" ;;
15339         esac
15340         ;;
15341         *)      case "$usethreads" in
15342                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15343                 esac
15344                 d_readdir_r=undef
15345                 readdir_r_proto=0
15346                 ;;
15347         esac
15348         ;;
15349 *)      readdir_r_proto=0
15350         ;;
15351 esac
15352
15353 : see if readv exists
15354 set readv d_readv
15355 eval $inlibc
15356
15357 : see if recvmsg exists
15358 set recvmsg d_recvmsg
15359 eval $inlibc
15360
15361 : see if rename exists
15362 set rename d_rename
15363 eval $inlibc
15364
15365 : see if rmdir exists
15366 set rmdir d_rmdir
15367 eval $inlibc
15368
15369 : see if memory.h is available.
15370 val=''
15371 set memory.h val
15372 eval $inhdr
15373
15374 : See if it conflicts with string.h
15375 case "$val" in
15376 $define)
15377         case "$strings" in
15378         '') ;;
15379         *)
15380                 $cppstdin $cppflags $cppminus < $strings > mem.h
15381                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15382                         echo " "
15383                         echo "We won't be including <memory.h>."
15384                         val="$undef"
15385                 fi
15386                 $rm -f mem.h
15387                 ;;
15388         esac
15389 esac
15390 set i_memory
15391 eval $setvar
15392
15393 : can bcopy handle overlapping blocks?
15394 echo " "
15395 val="$undef"
15396 case "$d_memmove" in
15397 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15398 *)      case "$d_bcopy" in
15399         "$define")
15400                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15401                 $cat >try.c <<EOCP
15402 #$i_memory I_MEMORY
15403 #$i_stdlib I_STDLIB
15404 #$i_string I_STRING
15405 #$i_unistd I_UNISTD
15406 EOCP
15407         $cat >>try.c <<'EOCP'
15408 #include <stdio.h>
15409 #ifdef I_MEMORY
15410 #  include <memory.h>
15411 #endif
15412 #ifdef I_STDLIB
15413 #  include <stdlib.h>
15414 #endif
15415 #ifdef I_STRING
15416 #  include <string.h>
15417 #else
15418 #  include <strings.h>
15419 #endif
15420 #ifdef I_UNISTD
15421 #  include <unistd.h>  /* Needed for NetBSD */
15422 #endif
15423 int main()
15424 {
15425 char buf[128], abc[128];
15426 char *b;
15427 int len;
15428 int off;
15429 int align;
15430
15431 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15432    try to store the string in read-only memory. */
15433 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15434
15435 for (align = 7; align >= 0; align--) {
15436         for (len = 36; len; len--) {
15437                 b = buf+align;
15438                 bcopy(abc, b, len);
15439                 for (off = 1; off <= len; off++) {
15440                         bcopy(b, b+off, len);
15441                         bcopy(b+off, b, len);
15442                         if (bcmp(b, abc, len))
15443                                 exit(1);
15444                 }
15445         }
15446 }
15447 exit(0);
15448 }
15449 EOCP
15450                 set try
15451                 if eval $compile_ok; then
15452                         if ./try 2>/dev/null; then
15453                                 echo "Yes, it can."
15454                                 val="$define"
15455                         else
15456                                 echo "It can't, sorry."
15457                         fi
15458                 else
15459                         echo "(I can't compile the test program, so we'll assume not...)"
15460                 fi
15461                 ;;
15462         esac
15463         $rm -f try.* try core
15464         ;;
15465 esac
15466 set d_safebcpy
15467 eval $setvar
15468
15469 : can memcpy handle overlapping blocks?
15470 echo " "
15471 val="$undef"
15472 case "$d_memmove" in
15473 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15474 *)      case "$d_memcpy" in
15475         "$define")
15476                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
15477                 $cat >try.c <<EOCP
15478 #$i_memory I_MEMORY
15479 #$i_stdlib I_STDLIB
15480 #$i_string I_STRING
15481 #$i_unistd I_UNISTD
15482 EOCP
15483         $cat >>try.c <<'EOCP'
15484 #include <stdio.h>
15485 #ifdef I_MEMORY
15486 #  include <memory.h>
15487 #endif
15488 #ifdef I_STDLIB
15489 #  include <stdlib.h>
15490 #endif
15491 #ifdef I_STRING
15492 #  include <string.h>
15493 #else
15494 #  include <strings.h>
15495 #endif
15496 #ifdef I_UNISTD
15497 #  include <unistd.h>  /* Needed for NetBSD */
15498 #endif
15499 int main()
15500 {
15501 char buf[128], abc[128];
15502 char *b;
15503 int len;
15504 int off;
15505 int align;
15506
15507 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15508    try to store the string in read-only memory. */
15509 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
15510
15511 for (align = 7; align >= 0; align--) {
15512         for (len = 36; len; len--) {
15513                 b = buf+align;
15514                 memcpy(b, abc, len);
15515                 for (off = 1; off <= len; off++) {
15516                         memcpy(b+off, b, len);
15517                         memcpy(b, b+off, len);
15518                         if (memcmp(b, abc, len))
15519                                 exit(1);
15520                 }
15521         }
15522 }
15523 exit(0);
15524 }
15525 EOCP
15526                 set try
15527                 if eval $compile_ok; then
15528                         if ./try 2>/dev/null; then
15529                                 echo "Yes, it can."
15530                                 val="$define"
15531                         else
15532                                 echo "It can't, sorry."
15533                         fi
15534                 else
15535                         echo "(I can't compile the test program, so we'll assume not...)"
15536                 fi
15537                 ;;
15538         esac
15539         $rm -f try.* try core
15540         ;;
15541 esac
15542 set d_safemcpy
15543 eval $setvar
15544
15545 : can memcmp be trusted to compare relative magnitude?
15546 val="$undef"
15547 case "$d_memcmp" in
15548 "$define")
15549         echo " "
15550         echo "Checking if your memcmp() can compare relative magnitude..." >&4
15551         $cat >try.c <<EOCP
15552 #$i_memory I_MEMORY
15553 #$i_stdlib I_STDLIB
15554 #$i_string I_STRING
15555 #$i_unistd I_UNISTD
15556 EOCP
15557         $cat >>try.c <<'EOCP'
15558 #include <stdio.h>
15559 #ifdef I_MEMORY
15560 #  include <memory.h>
15561 #endif
15562 #ifdef I_STDLIB
15563 #  include <stdlib.h>
15564 #endif
15565 #ifdef I_STRING
15566 #  include <string.h>
15567 #else
15568 #  include <strings.h>
15569 #endif
15570 #ifdef I_UNISTD
15571 #  include <unistd.h>  /* Needed for NetBSD */
15572 #endif
15573 int main()
15574 {
15575 char a = -1;
15576 char b = 0;
15577 if ((a < b) && memcmp(&a, &b, 1) < 0)
15578         exit(1);
15579 exit(0);
15580 }
15581 EOCP
15582         set try
15583         if eval $compile_ok; then
15584                 if $run ./try 2>/dev/null; then
15585                         echo "Yes, it can."
15586                         val="$define"
15587                 else
15588                         echo "No, it can't (it uses signed chars)."
15589                 fi
15590         else
15591                 echo "(I can't compile the test program, so we'll assume not...)"
15592         fi
15593         ;;
15594 esac
15595 $rm -f try.* try core
15596 set d_sanemcmp
15597 eval $setvar
15598
15599 : see if prototype for sbrk is available
15600 echo " "
15601 set d_sbrkproto sbrk $i_unistd unistd.h
15602 eval $hasproto
15603
15604 : see if select exists
15605 set select d_select
15606 eval $inlibc
15607
15608 : see if semctl exists
15609 set semctl d_semctl
15610 eval $inlibc
15611
15612 : see if semget exists
15613 set semget d_semget
15614 eval $inlibc
15615
15616 : see if semop exists
15617 set semop d_semop
15618 eval $inlibc
15619
15620 : see how much of the 'sem*(2)' library is present.
15621 h_sem=true
15622 echo " "
15623 case "$d_semctl$d_semget$d_semop" in
15624 *"$undef"*) h_sem=false;;
15625 esac
15626 case "$osname" in
15627 freebsd)
15628     case "`ipcs 2>&1`" in
15629     "SVID messages"*"not configured"*)
15630         echo "Your $osname does not have the sem*(2) configured." >&4
15631         h_sem=false
15632         val="$undef"
15633         set semctl d_semctl
15634         eval $setvar
15635         set semget d_semget
15636         eval $setvar
15637         set semop d_semop
15638         eval $setvar
15639         ;;
15640     esac
15641     ;;
15642 esac
15643 : we could also check for sys/ipc.h ...
15644 if $h_sem && $test `./findhdr sys/sem.h`; then
15645         echo "You have the full sem*(2) library." >&4
15646         val="$define"
15647 else
15648         echo "You don't have the full sem*(2) library." >&4
15649         val="$undef"
15650 fi
15651 set d_sem
15652 eval $setvar
15653
15654 : see whether sys/sem.h defines union semun
15655 echo " "
15656 $cat > try.c <<'END'
15657 #include <sys/types.h>
15658 #include <sys/ipc.h>
15659 #include <sys/sem.h>
15660 int main () { union semun semun; semun.buf = 0; }
15661 END
15662 set try
15663 if eval $compile; then
15664     echo "You have union semun in <sys/sem.h>." >&4
15665     val="$define"
15666 else
15667     echo "You do not have union semun in <sys/sem.h>." >&4
15668     val="$undef"
15669 fi
15670 $rm -f try try.c
15671 set d_union_semun
15672 eval $setvar
15673
15674 : see how to do semctl IPC_STAT
15675 case "$d_sem" in
15676 $define)
15677     echo " "
15678     $cat > try.h <<END
15679 #ifndef S_IRUSR
15680 #   ifdef S_IREAD
15681 #       define S_IRUSR S_IREAD
15682 #       define S_IWUSR S_IWRITE
15683 #       define S_IXUSR S_IEXEC
15684 #   else
15685 #       define S_IRUSR 0400
15686 #       define S_IWUSR 0200
15687 #       define S_IXUSR 0100
15688 #   endif
15689 #   define S_IRGRP (S_IRUSR>>3)
15690 #   define S_IWGRP (S_IWUSR>>3)
15691 #   define S_IXGRP (S_IXUSR>>3)
15692 #   define S_IROTH (S_IRUSR>>6)
15693 #   define S_IWOTH (S_IWUSR>>6)
15694 #   define S_IXOTH (S_IXUSR>>6)
15695 #endif
15696 #ifndef S_IRWXU
15697 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
15698 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
15699 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
15700 #endif
15701 END
15702     : see whether semctl IPC_STAT can use union semun
15703     val="$undef"
15704     case "$d_semctl_semun" in
15705     '')
15706       $cat > try.c <<END
15707 #include <sys/types.h>
15708 #include <sys/ipc.h>
15709 #include <sys/sem.h>
15710 #include <sys/stat.h>
15711 #include <stdio.h>
15712 #include <errno.h>
15713 #include "try.h"
15714 #ifndef errno
15715 extern int errno;
15716 #endif
15717 #$d_union_semun HAS_UNION_SEMUN
15718 int main() {
15719     union semun
15720 #ifndef HAS_UNION_SEMUN
15721     {
15722         int val;
15723         struct semid_ds *buf;
15724         unsigned short *array;
15725     }
15726 #endif
15727     arg;
15728     int sem, st;
15729
15730 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
15731     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15732     if (sem > -1) {
15733         struct semid_ds argbuf;
15734         arg.buf = &argbuf;
15735 #       ifdef IPC_STAT
15736         st = semctl(sem, 0, IPC_STAT, arg);
15737         if (st == 0)
15738             printf("semun\n");
15739         else
15740 #       endif /* IPC_STAT */
15741             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15742 #       ifdef IPC_RMID
15743         if (semctl(sem, 0, IPC_RMID, arg) != 0)
15744 #       endif /* IPC_RMID */
15745             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15746     } else
15747 #endif /* IPC_PRIVATE && ... */
15748         printf("semget failed: errno = %d\n", errno);
15749   return 0;
15750 }
15751 END
15752       set try
15753       if eval $compile; then
15754           xxx=`$run ./try`
15755           case "$xxx" in
15756           semun) val="$define" ;;
15757           esac
15758       fi
15759       $rm -f try try.c
15760       ;;
15761     esac
15762     set d_semctl_semun
15763     eval $setvar
15764     case "$d_semctl_semun" in
15765     $define)
15766         echo "You can use union semun for semctl IPC_STAT." >&4
15767         also='also'
15768         ;;
15769     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
15770         also=''
15771         ;;
15772     esac
15773
15774     : see whether semctl IPC_STAT can use struct semid_ds pointer
15775     val="$undef"
15776     case "$d_semctl_semid_ds" in
15777     '')
15778       $cat > try.c <<'END'
15779 #include <sys/types.h>
15780 #include <sys/ipc.h>
15781 #include <sys/sem.h>
15782 #include <sys/stat.h>
15783 #include "try.h"
15784 #include <stdio.h>
15785 #include <errno.h>
15786 #ifndef errno
15787 extern int errno;
15788 #endif
15789 int main() {
15790     struct semid_ds arg;
15791     int sem, st;
15792
15793 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
15794     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15795     if (sem > -1) {
15796 #       ifdef IPC_STAT
15797         st = semctl(sem, 0, IPC_STAT, &arg);
15798         if (st == 0)
15799             printf("semid_ds\n");
15800         else
15801 #       endif /* IPC_STAT */
15802             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15803 #       ifdef IPC_RMID
15804         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
15805 #       endif /* IPC_RMID */
15806             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15807     } else
15808 #endif /* IPC_PRIVATE && ... */
15809         printf("semget failed: errno = %d\n", errno);
15810
15811     return 0;
15812 }
15813 END
15814       set try
15815       if eval $compile; then
15816           xxx=`$run ./try`
15817           case "$xxx" in
15818           semid_ds) val="$define" ;;
15819           esac
15820       fi
15821       $rm -f try try.c
15822       ;;
15823     esac
15824     set d_semctl_semid_ds
15825     eval $setvar
15826     case "$d_semctl_semid_ds" in
15827     $define)
15828         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
15829         ;;
15830     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
15831         ;;
15832     esac
15833     $rm -f try.h
15834     ;;
15835 *)  val="$undef"
15836
15837     # We do not have the full sem*(2) library, so assume we can not
15838     # use either.
15839
15840     set d_semctl_semun
15841     eval $setvar
15842
15843     set d_semctl_semid_ds
15844     eval $setvar
15845     ;;
15846 esac
15847
15848 : see if sendmsg exists
15849 set sendmsg d_sendmsg
15850 eval $inlibc
15851
15852 : see if setegid exists
15853 set setegid d_setegid
15854 eval $inlibc
15855
15856 : see if seteuid exists
15857 set seteuid d_seteuid
15858 eval $inlibc
15859
15860 : see if setgrent exists
15861 set setgrent d_setgrent
15862 eval $inlibc
15863
15864 : see if setgrent_r exists
15865 set setgrent_r d_setgrent_r
15866 eval $inlibc
15867 case "$d_setgrent_r" in
15868 "$define")
15869         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
15870         case "$d_setgrent_r_proto:$usethreads" in
15871         ":define")      d_setgrent_r_proto=define
15872                 set d_setgrent_r_proto setgrent_r $hdrs
15873                 eval $hasproto ;;
15874         *)      ;;
15875         esac
15876         case "$d_setgrent_r_proto" in
15877         define)
15878         case "$setgrent_r_proto" in
15879         ''|0) try='int setgrent_r(FILE**);'
15880         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
15881         esac
15882         case "$setgrent_r_proto" in
15883         ''|0) try='void setgrent_r(FILE**);'
15884         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
15885         esac
15886         case "$setgrent_r_proto" in
15887         ''|0)   d_setgrent_r=undef
15888                 setgrent_r_proto=0
15889                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
15890         * )     case "$setgrent_r_proto" in
15891                 REENTRANT_PROTO*) ;;
15892                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
15893                 esac
15894                 echo "Prototype: $try" ;;
15895         esac
15896         ;;
15897         *)      case "$usethreads" in
15898                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
15899                 esac
15900                 d_setgrent_r=undef
15901                 setgrent_r_proto=0
15902                 ;;
15903         esac
15904         ;;
15905 *)      setgrent_r_proto=0
15906         ;;
15907 esac
15908
15909 : see if sethostent exists
15910 set sethostent d_sethent
15911 eval $inlibc
15912
15913 : see if sethostent_r exists
15914 set sethostent_r d_sethostent_r
15915 eval $inlibc
15916 case "$d_sethostent_r" in
15917 "$define")
15918         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15919         case "$d_sethostent_r_proto:$usethreads" in
15920         ":define")      d_sethostent_r_proto=define
15921                 set d_sethostent_r_proto sethostent_r $hdrs
15922                 eval $hasproto ;;
15923         *)      ;;
15924         esac
15925         case "$d_sethostent_r_proto" in
15926         define)
15927         case "$sethostent_r_proto" in
15928         ''|0) try='int sethostent_r(int, struct hostent_data*);'
15929         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
15930         esac
15931         case "$sethostent_r_proto" in
15932         ''|0) try='void sethostent_r(int, struct hostent_data*);'
15933         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
15934         esac
15935         case "$sethostent_r_proto" in
15936         ''|0)   d_sethostent_r=undef
15937                 sethostent_r_proto=0
15938                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
15939         * )     case "$sethostent_r_proto" in
15940                 REENTRANT_PROTO*) ;;
15941                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
15942                 esac
15943                 echo "Prototype: $try" ;;
15944         esac
15945         ;;
15946         *)      case "$usethreads" in
15947                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
15948                 esac
15949                 d_sethostent_r=undef
15950                 sethostent_r_proto=0
15951                 ;;
15952         esac
15953         ;;
15954 *)      sethostent_r_proto=0
15955         ;;
15956 esac
15957
15958 : see if setitimer exists
15959 set setitimer d_setitimer
15960 eval $inlibc
15961
15962 : see if setlinebuf exists
15963 set setlinebuf d_setlinebuf
15964 eval $inlibc
15965
15966 : see if setlocale exists
15967 set setlocale d_setlocale
15968 eval $inlibc
15969
15970 : see if locale.h is available
15971 set locale.h i_locale
15972 eval $inhdr
15973
15974 : see if setlocale_r exists
15975 set setlocale_r d_setlocale_r
15976 eval $inlibc
15977 case "$d_setlocale_r" in
15978 "$define")
15979         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
15980         case "$d_setlocale_r_proto:$usethreads" in
15981         ":define")      d_setlocale_r_proto=define
15982                 set d_setlocale_r_proto setlocale_r $hdrs
15983                 eval $hasproto ;;
15984         *)      ;;
15985         esac
15986         case "$d_setlocale_r_proto" in
15987         define)
15988         case "$setlocale_r_proto" in
15989         ''|0) try='int setlocale_r(int, const char*, char*, int);'
15990         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
15991         esac
15992         case "$setlocale_r_proto" in
15993         ''|0)   d_setlocale_r=undef
15994                 setlocale_r_proto=0
15995                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
15996         * )     case "$setlocale_r_proto" in
15997                 REENTRANT_PROTO*) ;;
15998                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
15999                 esac
16000                 echo "Prototype: $try" ;;
16001         esac
16002         ;;
16003         *)      case "$usethreads" in
16004                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16005                 esac
16006                 d_setlocale_r=undef
16007                 setlocale_r_proto=0
16008                 ;;
16009         esac
16010         ;;
16011 *)      setlocale_r_proto=0
16012         ;;
16013 esac
16014
16015 : see if setnetent exists
16016 set setnetent d_setnent
16017 eval $inlibc
16018
16019 : see if setnetent_r exists
16020 set setnetent_r d_setnetent_r
16021 eval $inlibc
16022 case "$d_setnetent_r" in
16023 "$define")
16024         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16025         case "$d_setnetent_r_proto:$usethreads" in
16026         ":define")      d_setnetent_r_proto=define
16027                 set d_setnetent_r_proto setnetent_r $hdrs
16028                 eval $hasproto ;;
16029         *)      ;;
16030         esac
16031         case "$d_setnetent_r_proto" in
16032         define)
16033         case "$setnetent_r_proto" in
16034         ''|0) try='int setnetent_r(int, struct netent_data*);'
16035         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16036         esac
16037         case "$setnetent_r_proto" in
16038         ''|0) try='void setnetent_r(int, struct netent_data*);'
16039         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16040         esac
16041         case "$setnetent_r_proto" in
16042         ''|0)   d_setnetent_r=undef
16043                 setnetent_r_proto=0
16044                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16045         * )     case "$setnetent_r_proto" in
16046                 REENTRANT_PROTO*) ;;
16047                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16048                 esac
16049                 echo "Prototype: $try" ;;
16050         esac
16051         ;;
16052         *)      case "$usethreads" in
16053                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16054                 esac
16055                 d_setnetent_r=undef
16056                 setnetent_r_proto=0
16057                 ;;
16058         esac
16059         ;;
16060 *)      setnetent_r_proto=0
16061         ;;
16062 esac
16063
16064 : see if setprotoent exists
16065 set setprotoent d_setpent
16066 eval $inlibc
16067
16068 : see if setpgid exists
16069 set setpgid d_setpgid
16070 eval $inlibc
16071
16072 : see if setpgrp2 exists
16073 set setpgrp2 d_setpgrp2
16074 eval $inlibc
16075
16076 : see if setpriority exists
16077 set setpriority d_setprior
16078 eval $inlibc
16079
16080 : see if setproctitle exists
16081 set setproctitle d_setproctitle
16082 eval $inlibc
16083
16084 : see if setprotoent_r exists
16085 set setprotoent_r d_setprotoent_r
16086 eval $inlibc
16087 case "$d_setprotoent_r" in
16088 "$define")
16089         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16090         case "$d_setprotoent_r_proto:$usethreads" in
16091         ":define")      d_setprotoent_r_proto=define
16092                 set d_setprotoent_r_proto setprotoent_r $hdrs
16093                 eval $hasproto ;;
16094         *)      ;;
16095         esac
16096         case "$d_setprotoent_r_proto" in
16097         define)
16098         case "$setprotoent_r_proto" in
16099         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16100         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16101         esac
16102         case "$setprotoent_r_proto" in
16103         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16104         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16105         esac
16106         case "$setprotoent_r_proto" in
16107         ''|0)   d_setprotoent_r=undef
16108                 setprotoent_r_proto=0
16109                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16110         * )     case "$setprotoent_r_proto" in
16111                 REENTRANT_PROTO*) ;;
16112                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16113                 esac
16114                 echo "Prototype: $try" ;;
16115         esac
16116         ;;
16117         *)      case "$usethreads" in
16118                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16119                 esac
16120                 d_setprotoent_r=undef
16121                 setprotoent_r_proto=0
16122                 ;;
16123         esac
16124         ;;
16125 *)      setprotoent_r_proto=0
16126         ;;
16127 esac
16128
16129 : see if setpwent exists
16130 set setpwent d_setpwent
16131 eval $inlibc
16132
16133 : see if setpwent_r exists
16134 set setpwent_r d_setpwent_r
16135 eval $inlibc
16136 case "$d_setpwent_r" in
16137 "$define")
16138         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16139         case "$d_setpwent_r_proto:$usethreads" in
16140         ":define")      d_setpwent_r_proto=define
16141                 set d_setpwent_r_proto setpwent_r $hdrs
16142                 eval $hasproto ;;
16143         *)      ;;
16144         esac
16145         case "$d_setpwent_r_proto" in
16146         define)
16147         case "$setpwent_r_proto" in
16148         ''|0) try='int setpwent_r(FILE**);'
16149         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16150         esac
16151         case "$setpwent_r_proto" in
16152         ''|0) try='void setpwent_r(FILE**);'
16153         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16154         esac
16155         case "$setpwent_r_proto" in
16156         ''|0)   d_setpwent_r=undef
16157                 setpwent_r_proto=0
16158                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16159         * )     case "$setpwent_r_proto" in
16160                 REENTRANT_PROTO*) ;;
16161                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16162                 esac
16163                 echo "Prototype: $try" ;;
16164         esac
16165         ;;
16166         *)      case "$usethreads" in
16167                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16168                 esac
16169                 d_setpwent_r=undef
16170                 setpwent_r_proto=0
16171                 ;;
16172         esac
16173         ;;
16174 *)      setpwent_r_proto=0
16175         ;;
16176 esac
16177
16178 : see if setregid exists
16179 set setregid d_setregid
16180 eval $inlibc
16181 set setresgid d_setresgid
16182 eval $inlibc
16183
16184 : see if setreuid exists
16185 set setreuid d_setreuid
16186 eval $inlibc
16187 set setresuid d_setresuid
16188 eval $inlibc
16189
16190 : see if setrgid exists
16191 set setrgid d_setrgid
16192 eval $inlibc
16193
16194 : see if setruid exists
16195 set setruid d_setruid
16196 eval $inlibc
16197
16198 : see if setservent exists
16199 set setservent d_setsent
16200 eval $inlibc
16201
16202 : see if setservent_r exists
16203 set setservent_r d_setservent_r
16204 eval $inlibc
16205 case "$d_setservent_r" in
16206 "$define")
16207         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16208         case "$d_setservent_r_proto:$usethreads" in
16209         ":define")      d_setservent_r_proto=define
16210                 set d_setservent_r_proto setservent_r $hdrs
16211                 eval $hasproto ;;
16212         *)      ;;
16213         esac
16214         case "$d_setservent_r_proto" in
16215         define)
16216         case "$setservent_r_proto" in
16217         ''|0) try='int setservent_r(int, struct servent_data*);'
16218         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16219         esac
16220         case "$setservent_r_proto" in
16221         ''|0) try='void setservent_r(int, struct servent_data*);'
16222         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16223         esac
16224         case "$setservent_r_proto" in
16225         ''|0)   d_setservent_r=undef
16226                 setservent_r_proto=0
16227                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16228         * )     case "$setservent_r_proto" in
16229                 REENTRANT_PROTO*) ;;
16230                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16231                 esac
16232                 echo "Prototype: $try" ;;
16233         esac
16234         ;;
16235         *)      case "$usethreads" in
16236                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16237                 esac
16238                 d_setservent_r=undef
16239                 setservent_r_proto=0
16240                 ;;
16241         esac
16242         ;;
16243 *)      setservent_r_proto=0
16244         ;;
16245 esac
16246
16247 : see if setsid exists
16248 set setsid d_setsid
16249 eval $inlibc
16250
16251 : see if setvbuf exists
16252 set setvbuf d_setvbuf
16253 eval $inlibc
16254
16255 : see if sfio.h is available
16256 set sfio.h i_sfio
16257 eval $inhdr
16258
16259
16260 : see if sfio library is available
16261 case "$i_sfio" in
16262 $define)
16263         val=''
16264         set sfreserve val
16265         eval $inlibc
16266         ;;
16267 *)
16268         val="$undef"
16269         ;;
16270 esac
16271 : Ok, but do we want to use it.
16272 case "$val" in
16273 $define)
16274         case "$usesfio" in
16275         true|$define|[yY]*) dflt='y';;
16276         *) dflt='n';;
16277         esac
16278         echo "$package can use the sfio library, but it is experimental."
16279         case "$useperlio" in
16280         "$undef")
16281             echo "For sfio also the PerlIO abstraction layer is needed."
16282             echo "Earlier you said you wouldn't want that."
16283             ;;
16284         esac
16285         rp="You seem to have sfio available, do you want to try using it?"
16286         . ./myread
16287         case "$ans" in
16288         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
16289                 useperlio="$define"
16290                 val="$define"
16291                 ;;
16292         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
16293                 val="$undef"
16294                 ;;
16295         esac
16296         ;;
16297 *)      case "$usesfio" in
16298         true|$define|[yY]*)
16299                 echo "Sorry, cannot find sfio on this machine." >&4
16300                 echo "Ignoring your setting of usesfio=$usesfio." >&4
16301                 val="$undef"
16302                 ;;
16303         esac
16304         ;;
16305 esac
16306 set d_sfio
16307 eval $setvar
16308 case "$d_sfio" in
16309 $define) usesfio='true';;
16310 *) usesfio='false';;
16311 esac
16312 case "$d_sfio" in
16313 $define) ;;
16314 *)      : Remove sfio from list of libraries to use
16315         case "$libs" in
16316         *-lsfio*)
16317                 echo "Removing unneeded -lsfio from library list" >&4
16318                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16319                 shift
16320                 libs="$*"
16321                 echo "libs = $libs" >&4
16322                 ;;
16323         esac
16324 ;;
16325 esac
16326
16327
16328 : see if shmctl exists
16329 set shmctl d_shmctl
16330 eval $inlibc
16331
16332 : see if shmget exists
16333 set shmget d_shmget
16334 eval $inlibc
16335
16336 : see if shmat exists
16337 set shmat d_shmat
16338 eval $inlibc
16339 : see what shmat returns
16340 case "$d_shmat" in
16341 "$define")
16342         $cat >shmat.c <<'END'
16343 #include <sys/shm.h>
16344 void *shmat();
16345 END
16346         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16347                 shmattype='void *'
16348         else
16349                 shmattype='char *'
16350         fi
16351         echo "and it returns ($shmattype)." >&4
16352         : see if a prototype for shmat is available
16353         xxx=`./findhdr sys/shm.h`
16354         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16355         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16356                 val="$define"
16357         else
16358                 val="$undef"
16359         fi
16360         $rm -f shmat.[co]
16361         ;;
16362 *)
16363         val="$undef"
16364         ;;
16365 esac
16366 set d_shmatprototype
16367 eval $setvar
16368
16369 : see if shmdt exists
16370 set shmdt d_shmdt
16371 eval $inlibc
16372
16373 : see how much of the 'shm*(2)' library is present.
16374 h_shm=true
16375 echo " "
16376 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16377 *"$undef"*) h_shm=false;;
16378 esac
16379 case "$osname" in
16380 freebsd)
16381     case "`ipcs 2>&1`" in
16382     "SVID shared memory"*"not configured"*)
16383         echo "Your $osname does not have the shm*(2) configured." >&4
16384         h_shm=false
16385         val="$undef"
16386         set shmctl d_shmctl
16387         evat $setvar
16388         set shmget d_shmget
16389         evat $setvar
16390         set shmat d_shmat
16391         evat $setvar
16392         set shmdt d_shmdt
16393         evat $setvar
16394         ;;
16395     esac
16396     ;;
16397 esac
16398 : we could also check for sys/ipc.h ...
16399 if $h_shm && $test `./findhdr sys/shm.h`; then
16400         echo "You have the full shm*(2) library." >&4
16401         val="$define"
16402 else
16403         echo "You don't have the full shm*(2) library." >&4
16404         val="$undef"
16405 fi
16406 set d_shm
16407 eval $setvar
16408
16409 echo " "
16410 : see if we have sigaction
16411 if set sigaction val -f d_sigaction; eval $csym; $val; then
16412         echo 'sigaction() found.' >&4
16413         $cat > try.c <<EOP
16414 #include <stdio.h>
16415 #include <sys/types.h>
16416 #include <signal.h>
16417 #$i_stdlib I_STDLIB
16418 #ifdef I_STDLIB
16419 #include <stdlib.h>
16420 #endif
16421 int main()
16422 {
16423     struct sigaction act, oact;
16424     act.sa_flags = 0;
16425     oact.sa_handler = 0;
16426     /* so that act and oact are used */
16427     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
16428 }
16429 EOP
16430         set try
16431         if eval $compile_ok; then
16432                 val="$define"
16433         else
16434                 echo "But you don't seem to have a useable struct sigaction." >&4
16435                 val="$undef"
16436         fi
16437 else
16438         echo 'sigaction NOT found.' >&4
16439         val="$undef"
16440 fi
16441 set d_sigaction; eval $setvar
16442 $rm -f try try$_o try.c
16443
16444 : see if sigprocmask exists
16445 set sigprocmask d_sigprocmask
16446 eval $inlibc
16447
16448 : see if sigsetjmp exists
16449 echo " "
16450 case "$d_sigsetjmp" in
16451 '')
16452         $cat >try.c <<EOP
16453 #include <setjmp.h>
16454 #$i_stdlib I_STDLIB
16455 #ifdef I_STDLIB
16456 #include <stdlib.h>
16457 #endif
16458 sigjmp_buf env;
16459 int set = 1;
16460 int main()
16461 {
16462         if (sigsetjmp(env,1))
16463                 exit(set);
16464         set = 0;
16465         siglongjmp(env, 1);
16466         exit(1);
16467 }
16468 EOP
16469         set try
16470         if eval $compile; then
16471                 if $run ./try >/dev/null 2>&1; then
16472                         echo "POSIX sigsetjmp found." >&4
16473                         val="$define"
16474                 else
16475                         $cat >&4 <<EOM
16476 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
16477 I'll ignore them.
16478 EOM
16479                         val="$undef"
16480                 fi
16481         else
16482                 echo "sigsetjmp not found." >&4
16483                 val="$undef"
16484         fi
16485         ;;
16486 *) val="$d_sigsetjmp"
16487         case "$d_sigsetjmp" in
16488         $define) echo "POSIX sigsetjmp found." >&4;;
16489         $undef) echo "sigsetjmp not found." >&4;;
16490         esac
16491         ;;
16492 esac
16493 set d_sigsetjmp
16494 eval $setvar
16495 $rm -f try.c try
16496
16497 : see if sockatmark exists
16498 set sockatmark d_sockatmark
16499 eval $inlibc
16500
16501 : see if prototype for sockatmark is available
16502 echo " "
16503 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
16504 eval $hasproto
16505
16506 : see if socks5_init exists
16507 set socks5_init d_socks5_init
16508 eval $inlibc
16509
16510 : see if srand48_r exists
16511 set srand48_r d_srand48_r
16512 eval $inlibc
16513 case "$d_srand48_r" in
16514 "$define")
16515         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16516         case "$d_srand48_r_proto:$usethreads" in
16517         ":define")      d_srand48_r_proto=define
16518                 set d_srand48_r_proto srand48_r $hdrs
16519                 eval $hasproto ;;
16520         *)      ;;
16521         esac
16522         case "$d_srand48_r_proto" in
16523         define)
16524         case "$srand48_r_proto" in
16525         ''|0) try='int srand48_r(long, struct drand48_data*);'
16526         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
16527         esac
16528         case "$srand48_r_proto" in
16529         ''|0)   d_srand48_r=undef
16530                 srand48_r_proto=0
16531                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
16532         * )     case "$srand48_r_proto" in
16533                 REENTRANT_PROTO*) ;;
16534                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
16535                 esac
16536                 echo "Prototype: $try" ;;
16537         esac
16538         ;;
16539         *)      case "$usethreads" in
16540                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
16541                 esac
16542                 d_srand48_r=undef
16543                 srand48_r_proto=0
16544                 ;;
16545         esac
16546         ;;
16547 *)      srand48_r_proto=0
16548         ;;
16549 esac
16550
16551 : see if srandom_r exists
16552 set srandom_r d_srandom_r
16553 eval $inlibc
16554 case "$d_srandom_r" in
16555 "$define")
16556         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16557         case "$d_srandom_r_proto:$usethreads" in
16558         ":define")      d_srandom_r_proto=define
16559                 set d_srandom_r_proto srandom_r $hdrs
16560                 eval $hasproto ;;
16561         *)      ;;
16562         esac
16563         case "$d_srandom_r_proto" in
16564         define)
16565         case "$srandom_r_proto" in
16566         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
16567         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
16568         esac
16569         case "$srandom_r_proto" in
16570         ''|0)   d_srandom_r=undef
16571                 srandom_r_proto=0
16572                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
16573         * )     case "$srandom_r_proto" in
16574                 REENTRANT_PROTO*) ;;
16575                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
16576                 esac
16577                 echo "Prototype: $try" ;;
16578         esac
16579         ;;
16580         *)      case "$usethreads" in
16581                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
16582                 esac
16583                 d_srandom_r=undef
16584                 srandom_r_proto=0
16585                 ;;
16586         esac
16587         ;;
16588 *)      srandom_r_proto=0
16589         ;;
16590 esac
16591
16592 : see if prototype for setresgid is available
16593 echo " "
16594 set d_sresgproto setresgid $i_unistd unistd.h
16595 eval $hasproto
16596
16597 : see if prototype for setresuid is available
16598 echo " "
16599 set d_sresuproto setresuid $i_unistd unistd.h
16600 eval $hasproto
16601
16602 : see if sys/stat.h is available
16603 set sys/stat.h i_sysstat
16604 eval $inhdr
16605
16606
16607 : see if stat knows about block sizes
16608 echo " "
16609 echo "Checking to see if your struct stat has st_blocks field..." >&4
16610 set d_statblks stat st_blocks $i_sysstat sys/stat.h
16611 eval $hasfield
16612
16613
16614 : see if this is a sys/vfs.h system
16615 set sys/vfs.h i_sysvfs
16616 eval $inhdr
16617
16618
16619 : see if this is a sys/statfs.h system
16620 set sys/statfs.h i_sysstatfs
16621 eval $inhdr
16622
16623
16624 echo " "
16625 echo "Checking to see if your system supports struct statfs..." >&4
16626 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
16627 eval $hasstruct
16628 case "$d_statfs_s" in
16629 "$define")      echo "Yes, it does."   ;;
16630 *)              echo "No, it doesn't." ;;
16631 esac
16632
16633
16634
16635 : see if struct statfs knows about f_flags
16636 case "$d_statfs_s" in
16637 define) 
16638         echo " "
16639         echo "Checking to see if your struct statfs has f_flags field..." >&4
16640         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
16641         eval $hasfield
16642         ;;
16643 *)      val="$undef"
16644         set d_statfs_f_flags
16645         eval $setvar
16646         ;;
16647 esac
16648 case "$d_statfs_f_flags" in
16649 "$define")      echo "Yes, it does."   ;;
16650 *)              echo "No, it doesn't." ;;
16651 esac
16652
16653 $cat >&4 <<EOM
16654 Checking how to access stdio streams by file descriptor number...
16655 EOM
16656 case "$stdio_stream_array" in
16657 '')     $cat >try.c <<EOCP
16658 #include <stdio.h>
16659 int main() {
16660   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
16661     printf("yes\n");
16662 }
16663 EOCP
16664         for s in _iob __iob __sF
16665         do
16666                 set try -DSTDIO_STREAM_ARRAY=$s
16667                 if eval $compile; then
16668                         case "`$run ./try`" in
16669                         yes)    stdio_stream_array=$s; break ;;
16670                         esac
16671                 fi
16672         done
16673         $rm -f try.* try$exe_ext
16674 esac
16675 case "$stdio_stream_array" in
16676 '')     $cat >&4 <<EOM
16677 I can't figure out how to access stdio streams by file descriptor number.
16678 EOM
16679         d_stdio_stream_array="$undef"
16680         ;;
16681 *)      $cat >&4 <<EOM
16682 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
16683 EOM
16684         d_stdio_stream_array="$define"
16685         ;;
16686 esac
16687
16688 : see if strcoll exists
16689 set strcoll d_strcoll
16690 eval $inlibc
16691
16692 : check for structure copying
16693 echo " "
16694 echo "Checking to see if your C compiler can copy structs..." >&4
16695 $cat >try.c <<'EOCP'
16696 int main()
16697 {
16698         struct blurfl {
16699                 int dyick;
16700         } foo, bar;
16701
16702         foo = bar;
16703 }
16704 EOCP
16705 if $cc -c try.c >/dev/null 2>&1 ; then
16706         val="$define"
16707         echo "Yup, it can."
16708 else
16709         val="$undef"
16710         echo "Nope, it can't."
16711 fi
16712 set d_strctcpy
16713 eval $setvar
16714 $rm -f try.*
16715
16716 : see if strerror and/or sys_errlist[] exist
16717 echo " "
16718 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
16719     if set strerror val -f d_strerror; eval $csym; $val; then
16720                 echo 'strerror() found.' >&4
16721                 d_strerror="$define"
16722                 d_strerrm='strerror(e)'
16723                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16724                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
16725                         d_syserrlst="$define"
16726                 else
16727                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
16728                         d_syserrlst="$undef"
16729                 fi
16730     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
16731                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
16732                 echo 'strerror() found in string header.' >&4
16733                 d_strerror="$define"
16734                 d_strerrm='strerror(e)'
16735                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16736                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
16737                                 d_syserrlst="$define"
16738                 else
16739                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
16740                         d_syserrlst="$undef"
16741                 fi
16742     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16743                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
16744                 d_strerror="$undef"
16745                 d_syserrlst="$define"
16746                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
16747     else
16748                 echo 'strerror() and sys_errlist[] NOT found.' >&4
16749                 d_strerror="$undef"
16750                 d_syserrlst="$undef"
16751                 d_strerrm='"unknown"'
16752     fi
16753 fi
16754
16755 : see if strerror_r exists
16756 set strerror_r d_strerror_r
16757 eval $inlibc
16758 case "$d_strerror_r" in
16759 "$define")
16760         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
16761         case "$d_strerror_r_proto:$usethreads" in
16762         ":define")      d_strerror_r_proto=define
16763                 set d_strerror_r_proto strerror_r $hdrs
16764                 eval $hasproto ;;
16765         *)      ;;
16766         esac
16767         case "$d_strerror_r_proto" in
16768         define)
16769         case "$strerror_r_proto" in
16770         ''|0) try='int strerror_r(int, char*, size_t);'
16771         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
16772         esac
16773         case "$strerror_r_proto" in
16774         ''|0) try='int strerror_r(int, char*, int);'
16775         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
16776         esac
16777         case "$strerror_r_proto" in
16778         ''|0) try='char* strerror_r(int, char*, size_t);'
16779         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
16780         esac
16781         case "$strerror_r_proto" in
16782         ''|0)   d_strerror_r=undef
16783                 strerror_r_proto=0
16784                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
16785         * )     case "$strerror_r_proto" in
16786                 REENTRANT_PROTO*) ;;
16787                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
16788                 esac
16789                 echo "Prototype: $try" ;;
16790         esac
16791         ;;
16792         *)      case "$usethreads" in
16793                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
16794                 esac
16795                 d_strerror_r=undef
16796                 strerror_r_proto=0
16797                 ;;
16798         esac
16799         ;;
16800 *)      strerror_r_proto=0
16801         ;;
16802 esac
16803
16804 : see if strftime exists
16805 set strftime d_strftime
16806 eval $inlibc
16807
16808 : see if strlcat exists
16809 set strlcat d_strlcat
16810 eval $inlibc
16811
16812 : see if strlcpy exists
16813 set strlcpy d_strlcpy
16814 eval $inlibc
16815
16816 : see if strtod exists
16817 set strtod d_strtod
16818 eval $inlibc
16819
16820 : see if strtol exists
16821 set strtol d_strtol
16822 eval $inlibc
16823
16824 : see if strtold exists
16825 set strtold d_strtold
16826 eval $inlibc
16827
16828 : see if strtoll exists
16829 set strtoll d_strtoll
16830 eval $inlibc
16831
16832 case "$d_longlong-$d_strtoll" in
16833 "$define-$define")
16834         $cat <<EOM
16835 Checking whether your strtoll() works okay...
16836 EOM
16837         $cat >try.c <<'EOCP'
16838 #include <errno.h>
16839 #ifdef __hpux
16840 #define strtoll __strtoll
16841 #endif
16842 #ifdef __EMX__
16843 #define strtoll _strtoll
16844 #endif
16845 #include <stdio.h>
16846 extern long long int strtoll(char *s, char **, int); 
16847 static int bad = 0;
16848 int check(char *s, long long ell, int een) {
16849         long long gll;
16850         errno = 0;
16851         gll = strtoll(s, 0, 10);
16852         if (!((gll == ell) && (errno == een)))
16853                 bad++;
16854 }
16855 int main() {
16856         check(" 1",                                      1LL, 0);
16857         check(" 0",                                      0LL, 0);
16858         check("-1",                                     -1LL, 0);
16859         check("-9223372036854775808", -9223372036854775808LL, 0);
16860         check("-9223372036854775808", -9223372036854775808LL, 0);
16861         check(" 9223372036854775807",  9223372036854775807LL, 0);
16862         check("-9223372036854775808", -9223372036854775808LL, 0);
16863         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
16864         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
16865         if (!bad)
16866                 printf("ok\n");
16867 }
16868 EOCP
16869         set try
16870         if eval $compile; then
16871                 yyy=`$run ./try`
16872                 case "$yyy" in
16873                 ok) echo "Your strtoll() seems to be working okay." ;;
16874                 *) cat <<EOM >&4
16875 Your strtoll() doesn't seem to be working okay.
16876 EOM
16877                    d_strtoll="$undef"
16878                    ;;
16879                 esac
16880         else
16881                 echo "(I can't seem to compile the test program--assuming it doesn't)"
16882                 d_strtoll="$undef"
16883         fi
16884         ;;
16885 esac
16886
16887 : see if strtoq exists
16888 set strtoq d_strtoq
16889 eval $inlibc
16890
16891 : see if strtoul exists
16892 set strtoul d_strtoul
16893 eval $inlibc
16894
16895 case "$d_strtoul" in
16896 "$define")
16897         $cat <<EOM
16898 Checking whether your strtoul() works okay...
16899 EOM
16900         $cat >try.c <<'EOCP'
16901 #include <errno.h>
16902 #include <stdio.h>
16903 extern unsigned long int strtoul(char *s, char **, int); 
16904 static int bad = 0;
16905 void check(char *s, unsigned long eul, int een) {
16906         unsigned long gul;
16907         errno = 0;
16908         gul = strtoul(s, 0, 10);
16909         if (!((gul == eul) && (errno == een)))
16910                 bad++;
16911 }
16912 int main() {
16913         check(" 1", 1L, 0);
16914         check(" 0", 0L, 0);
16915 EOCP
16916         case "$longsize" in
16917         8)
16918             $cat >>try.c <<'EOCP'
16919         check("18446744073709551615", 18446744073709551615UL, 0);
16920         check("18446744073709551616", 18446744073709551615UL, ERANGE);
16921 #if 0 /* strtoul() for /^-/ strings is undefined. */
16922         check("-1", 18446744073709551615UL, 0);
16923         check("-18446744073709551614", 2, 0);
16924         check("-18446744073709551615", 1, 0);
16925         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
16926         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
16927 #endif
16928 EOCP
16929                 ;;
16930         4)
16931                     $cat >>try.c <<'EOCP'
16932         check("4294967295", 4294967295UL, 0);
16933         check("4294967296", 4294967295UL, ERANGE);
16934 #if 0 /* strtoul() for /^-/ strings is undefined. */
16935         check("-1", 4294967295UL, 0);
16936         check("-4294967294", 2, 0);
16937         check("-4294967295", 1, 0);
16938         check("-4294967296", 4294967295UL, ERANGE);
16939         check("-4294967297", 4294967295UL, ERANGE);
16940 #endif
16941 EOCP
16942                 ;;
16943         *)
16944 : Should we write these tests to be more portable by sprintf-ing
16945 : ~0 and then manipulating that char string as input for strtol?
16946                 ;;
16947         esac
16948         $cat >>try.c <<'EOCP'
16949         if (!bad)
16950                 printf("ok\n");
16951         return 0;
16952 }
16953 EOCP
16954         set try
16955         if eval $compile; then
16956                 case "`$run ./try`" in
16957                 ok) echo "Your strtoul() seems to be working okay." ;;
16958                 *) cat <<EOM >&4
16959 Your strtoul() doesn't seem to be working okay.
16960 EOM
16961                    d_strtoul="$undef"
16962                    ;;
16963                 esac
16964         fi
16965         ;;
16966 esac
16967
16968 : see if strtoull exists
16969 set strtoull d_strtoull
16970 eval $inlibc
16971
16972 case "$d_longlong-$d_strtoull" in
16973 "$define-$define")
16974         $cat <<EOM
16975 Checking whether your strtoull() works okay...
16976 EOM
16977         $cat >try.c <<'EOCP'
16978 #include <errno.h>
16979 #ifdef __hpux
16980 #define strtoull __strtoull
16981 #endif
16982 #include <stdio.h>
16983 extern unsigned long long int strtoull(char *s, char **, int); 
16984 static int bad = 0;
16985 int check(char *s, long long eull, int een) {
16986         long long gull;
16987         errno = 0;
16988         gull = strtoull(s, 0, 10);
16989         if (!((gull == eull) && (errno == een)))
16990                 bad++;
16991 }
16992 int main() {
16993         check(" 1",                                        1LL, 0);
16994         check(" 0",                                        0LL, 0);
16995         check("18446744073709551615",  18446744073709551615ULL, 0);
16996         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
16997 #if 0 /* strtoull() for /^-/ strings is undefined. */
16998         check("-1",                    18446744073709551615ULL, 0);
16999         check("-18446744073709551614",                     2LL, 0);
17000         check("-18446744073709551615",                     1LL, 0);
17001         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17002         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17003 #endif
17004         if (!bad)
17005                 printf("ok\n");
17006 }
17007 EOCP
17008         set try
17009         if eval $compile; then
17010                 case "`$run ./try`" in
17011                 ok) echo "Your strtoull() seems to be working okay." ;;
17012                 *) cat <<EOM >&4
17013 Your strtoull() doesn't seem to be working okay.
17014 EOM
17015                    d_strtoull="$undef"
17016                    ;;
17017                 esac
17018         fi
17019         ;;
17020 esac
17021
17022 : see if strtouq exists
17023 set strtouq d_strtouq
17024 eval $inlibc
17025
17026 case "$d_strtouq" in
17027 "$define")
17028         $cat <<EOM
17029 Checking whether your strtouq() works okay...
17030 EOM
17031         $cat >try.c <<'EOCP'
17032 #include <errno.h>
17033 #include <stdio.h>
17034 extern unsigned long long int strtouq(char *s, char **, int); 
17035 static int bad = 0;
17036 void check(char *s, unsigned long long eull, int een) {
17037         unsigned long long gull;
17038         errno = 0;
17039         gull = strtouq(s, 0, 10);
17040         if (!((gull == eull) && (errno == een)))
17041                 bad++;
17042 }
17043 int main() {
17044         check(" 1",                                        1LL, 0);
17045         check(" 0",                                        0LL, 0);
17046         check("18446744073709551615",  18446744073709551615ULL, 0);
17047         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17048 #if 0 /* strtouq() for /^-/ strings is undefined. */
17049         check("-1",                    18446744073709551615ULL, 0);
17050         check("-18446744073709551614",                     2LL, 0);
17051         check("-18446744073709551615",                     1LL, 0);
17052         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17053         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17054 #endif
17055         if (!bad)
17056                 printf("ok\n");
17057         return 0;
17058 }
17059 EOCP
17060         set try
17061         if eval $compile; then
17062                 case "`$run ./try`" in
17063                 ok) echo "Your strtouq() seems to be working okay." ;;
17064                 *) cat <<EOM >&4
17065 Your strtouq() doesn't seem to be working okay.
17066 EOM
17067                    d_strtouq="$undef"
17068                    ;;
17069                 esac
17070         fi
17071         ;;
17072 esac
17073
17074 : see if strxfrm exists
17075 set strxfrm d_strxfrm
17076 eval $inlibc
17077
17078 : see if symlink exists
17079 set symlink d_symlink
17080 eval $inlibc
17081
17082 : see if syscall exists
17083 set syscall d_syscall
17084 eval $inlibc
17085
17086 : see if prototype for syscall is available
17087 echo " "
17088 set d_syscallproto syscall $i_unistd unistd.h
17089 eval $hasproto
17090
17091 : see if sysconf exists
17092 set sysconf d_sysconf
17093 eval $inlibc
17094
17095 : see if system exists
17096 set system d_system
17097 eval $inlibc
17098
17099 : see if tcgetpgrp exists
17100 set tcgetpgrp d_tcgetpgrp
17101 eval $inlibc
17102
17103 : see if tcsetpgrp exists
17104 set tcsetpgrp d_tcsetpgrp
17105 eval $inlibc
17106
17107 : see if prototype for telldir is available
17108 echo " "
17109 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17110 eval $hasproto
17111
17112 : see if time exists
17113 echo " "
17114 if test "X$d_time" = X -o X"$timetype" = X; then
17115     if set time val -f d_time; eval $csym; $val; then
17116                 echo 'time() found.' >&4
17117                 val="$define"
17118                 rp="What is the type returned by time() on this system?"
17119                 set time_t timetype long stdio.h sys/types.h
17120                 eval $typedef_ask
17121     else
17122                 echo 'time() not found, hope that will do.' >&4
17123                 val="$undef"
17124                 timetype='int';
17125     fi
17126     set d_time
17127     eval $setvar
17128 fi
17129
17130 : see if this is a sys/times.h system
17131 set sys/times.h i_systimes
17132 eval $inhdr
17133
17134 : see if times exists
17135 echo " "
17136 if set times val -f d_times; eval $csym; $val; then
17137         echo 'times() found.' >&4
17138         d_times="$define"
17139         inc=''
17140         case "$i_systimes" in
17141         "$define") inc='sys/times.h';;
17142         esac
17143         rp="What is the type returned by times() on this system?"
17144         set clock_t clocktype long stdio.h sys/types.h $inc
17145         eval $typedef_ask
17146 else
17147         echo 'times() NOT found, hope that will do.' >&4
17148         d_times="$undef"
17149         clocktype='int'
17150 fi
17151
17152 : see if tmpnam_r exists
17153 set tmpnam_r d_tmpnam_r
17154 eval $inlibc
17155 case "$d_tmpnam_r" in
17156 "$define")
17157         hdrs="$i_systypes sys/types.h define stdio.h "
17158         case "$d_tmpnam_r_proto:$usethreads" in
17159         ":define")      d_tmpnam_r_proto=define
17160                 set d_tmpnam_r_proto tmpnam_r $hdrs
17161                 eval $hasproto ;;
17162         *)      ;;
17163         esac
17164         case "$d_tmpnam_r_proto" in
17165         define)
17166         case "$tmpnam_r_proto" in
17167         ''|0) try='char* tmpnam_r(char*);'
17168         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17169         esac
17170         case "$tmpnam_r_proto" in
17171         ''|0)   d_tmpnam_r=undef
17172                 tmpnam_r_proto=0
17173                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
17174         * )     case "$tmpnam_r_proto" in
17175                 REENTRANT_PROTO*) ;;
17176                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17177                 esac
17178                 echo "Prototype: $try" ;;
17179         esac
17180         ;;
17181         *)      case "$usethreads" in
17182                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17183                 esac
17184                 d_tmpnam_r=undef
17185                 tmpnam_r_proto=0
17186                 ;;
17187         esac
17188         ;;
17189 *)      tmpnam_r_proto=0
17190         ;;
17191 esac
17192
17193 : see if truncate exists
17194 set truncate d_truncate
17195 eval $inlibc
17196
17197 : see if ttyname_r exists
17198 set ttyname_r d_ttyname_r
17199 eval $inlibc
17200 case "$d_ttyname_r" in
17201 "$define")
17202         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
17203         case "$d_ttyname_r_proto:$usethreads" in
17204         ":define")      d_ttyname_r_proto=define
17205                 set d_ttyname_r_proto ttyname_r $hdrs
17206                 eval $hasproto ;;
17207         *)      ;;
17208         esac
17209         case "$d_ttyname_r_proto" in
17210         define)
17211         case "$ttyname_r_proto" in
17212         ''|0) try='int ttyname_r(int, char*, size_t);'
17213         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17214         esac
17215         case "$ttyname_r_proto" in
17216         ''|0) try='int ttyname_r(int, char*, int);'
17217         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17218         esac
17219         case "$ttyname_r_proto" in
17220         ''|0) try='char* ttyname_r(int, char*, int);'
17221         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17222         esac
17223         case "$ttyname_r_proto" in
17224         ''|0)   d_ttyname_r=undef
17225                 ttyname_r_proto=0
17226                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
17227         * )     case "$ttyname_r_proto" in
17228                 REENTRANT_PROTO*) ;;
17229                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17230                 esac
17231                 echo "Prototype: $try" ;;
17232         esac
17233         ;;
17234         *)      case "$usethreads" in
17235                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17236                 esac
17237                 d_ttyname_r=undef
17238                 ttyname_r_proto=0
17239                 ;;
17240         esac
17241         ;;
17242 *)      ttyname_r_proto=0
17243         ;;
17244 esac
17245
17246 : see if tzname[] exists
17247 echo " "
17248 if set tzname val -a d_tzname; eval $csym; $val; then
17249         val="$define"
17250         echo 'tzname[] found.' >&4
17251 else
17252         val="$undef"
17253         echo 'tzname[] NOT found.' >&4
17254 fi
17255 set d_tzname
17256 eval $setvar
17257
17258 case "$osname" in
17259 next|rhapsody|darwin) multiarch="$define" ;;
17260 esac
17261 case "$multiarch" in
17262 ''|[nN]*) multiarch="$undef" ;;
17263 esac
17264
17265 : check for ordering of bytes in a UV
17266 echo " "
17267 case "$usecrosscompile$multiarch" in
17268 *$define*)
17269         $cat <<EOM
17270 You seem to be either cross-compiling or doing a multiarchitecture build,
17271 skipping the byteorder check.
17272
17273 EOM
17274         byteorder='ffff'
17275         ;;
17276 *)
17277         case "$byteorder" in
17278         '')
17279                 $cat <<'EOM'
17280 In the following, larger digits indicate more significance.  A big-endian
17281 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17282 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17283 machines may have weird orders like 3412.  A Cray will report 87654321,
17284 an Alpha will report 12345678. If the test program works the default is
17285 probably right.
17286 I'm now running the test program...
17287 EOM
17288                 $cat >try.c <<EOCP
17289 #include <stdio.h>
17290 #$i_stdlib I_STDLIB
17291 #ifdef I_STDLIB
17292 #include <stdlib.h>
17293 #endif
17294 #include <sys/types.h>
17295 typedef $uvtype UV;
17296 int main()
17297 {
17298         int i;
17299         union {
17300                 UV l;
17301                 char c[$uvsize];
17302         } u;
17303
17304         if ($uvsize > 4)
17305                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
17306         else
17307                 u.l = (UV)0x04030201;
17308         for (i = 0; i < $uvsize; i++)
17309                 printf("%c", u.c[i]+'0');
17310         printf("\n");
17311         exit(0);
17312 }
17313 EOCP
17314                 xxx_prompt=y
17315                 set try
17316                 if eval $compile && ./try > /dev/null; then
17317                         dflt=`$run ./try`
17318                         case "$dflt" in
17319                         [1-4][1-4][1-4][1-4]|12345678|87654321)
17320                                 echo "(The test program ran ok.)"
17321                                 echo "byteorder=$dflt"
17322                                 xxx_prompt=n
17323                         ;;
17324                         ????|????????) echo "(The test program ran ok.)" ;;
17325                         *) echo "(The test program didn't run right for some reason.)" ;;
17326                         esac
17327                 else
17328                         dflt='4321'
17329                         cat <<'EOM'
17330 (I can't seem to compile the test program.  Guessing big-endian...)
17331 EOM
17332                 fi
17333                 case "$xxx_prompt" in
17334                 y)
17335                         rp="What is the order of bytes in $uvtype?"
17336                         . ./myread
17337                         byteorder="$ans"
17338                         ;;
17339                 *)      byteorder=$dflt
17340                         ;;
17341                 esac
17342                 ;;
17343         esac
17344         $rm -f try.c try
17345         ;;
17346 esac
17347
17348
17349 $cat <<EOM
17350
17351 Checking to see whether you can access character data unalignedly...
17352 EOM
17353 case "$d_u32align" in
17354 '')   $cat >try.c <<EOCP
17355 #include <stdio.h>
17356 #$i_stdlib I_STDLIB
17357 #ifdef I_STDLIB
17358 #include <stdlib.h>
17359 #endif
17360 #define U32 $u32type
17361 #define BYTEORDER 0x$byteorder
17362 #define U8 $u8type
17363 #include <signal.h>
17364 #ifdef SIGBUS
17365 $signal_t bletch(s) int s; { exit(4); }
17366 #endif
17367 int main() {
17368 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
17369     U8 buf[8];
17370     U32 *up;
17371     int i;
17372
17373     if (sizeof(U32) != 4) {
17374         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
17375         exit(1);
17376     }
17377
17378     fflush(stdout);
17379
17380 #ifdef SIGBUS
17381     signal(SIGBUS, bletch);
17382 #endif
17383
17384     buf[0] = 0;
17385     buf[1] = 0;
17386     buf[2] = 0;
17387     buf[3] = 1;
17388     buf[4] = 0;
17389     buf[5] = 0;
17390     buf[6] = 0;
17391     buf[7] = 1;
17392
17393     for (i = 0; i < 4; i++) {
17394         up = (U32*)(buf + i);
17395         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
17396                (*up == 1 << (8*(3-i)))  /* little-endian */
17397               )
17398            )
17399         {
17400             printf("read failed (%x)\n", *up);
17401             exit(2);
17402         }
17403     }
17404
17405     /* write test */
17406     for (i = 0; i < 4; i++) {
17407         up = (U32*)(buf + i);
17408         *up = 0xBeef;
17409         if (*up != 0xBeef) {
17410             printf("write failed (%x)\n", *up);
17411             exit(3);
17412         }
17413     }
17414
17415     exit(0);
17416 #else
17417     printf("1\n");
17418     exit(1);
17419 #endif
17420     return 0;
17421 }
17422 EOCP
17423 set try
17424 if eval $compile_ok; then
17425         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
17426         $run ./try 2>&1 >/dev/null
17427         case "$?" in
17428         0)      cat >&4 <<EOM
17429 You can access character data pretty unalignedly.
17430 EOM
17431                 d_u32align="$undef"
17432                 ;;
17433         *)      cat >&4 <<EOM
17434 It seems that you must access character data in an aligned manner.
17435 EOM
17436                 d_u32align="$define"
17437                 ;;
17438         esac
17439 else
17440         rp='Can you access character data at unaligned addresses?'
17441         dflt='n'
17442         . ./myread
17443         case "$ans" in
17444         [yY]*)  d_u32align="$undef"  ;;
17445         *)      d_u32align="$define" ;;
17446         esac
17447 fi
17448 $rm -f core core.try.* try.core
17449 ;;
17450 esac
17451
17452 : see if ualarm exists
17453 set ualarm d_ualarm
17454 eval $inlibc
17455
17456 : see if umask exists
17457 set umask d_umask
17458 eval $inlibc
17459
17460 : see if unordered exists
17461 set unordered d_unordered
17462 eval $inlibc
17463
17464 : see if unsetenv exists
17465 set unsetenv d_unsetenv
17466 eval $inlibc
17467
17468 : see if usleep exists
17469 set usleep d_usleep
17470 eval $inlibc
17471
17472 : see if prototype for usleep is available
17473 echo " "
17474 set d_usleepproto usleep $i_unistd unistd.h
17475 eval $hasproto
17476
17477 : see if ustat exists
17478 set ustat d_ustat
17479 eval $inlibc
17480
17481 : backward compatibility for d_hvfork
17482 if test X$d_hvfork != X; then
17483         d_vfork="$d_hvfork"
17484         d_hvfork=''
17485 fi
17486 : see if there is a vfork
17487 val=''
17488 set vfork val
17489 eval $inlibc
17490
17491 : Ok, but do we want to use it. vfork is reportedly unreliable in 
17492 : perl on Solaris 2.x, and probably elsewhere.
17493 case "$val" in
17494 $define)
17495         echo " "
17496         case "$usevfork" in
17497         false) dflt='n';;
17498         *) dflt='y';;
17499         esac
17500         cat <<'EOM'
17501  
17502 Perl can only use a vfork() that doesn't suffer from strict
17503 restrictions on calling functions or modifying global data in
17504 the child.  For example, glibc-2.1 contains such a vfork()
17505 that is unsuitable.  If your system provides a proper fork()
17506 call, chances are that you do NOT want perl to use vfork().
17507
17508 EOM
17509         rp="Do you still want to use vfork()?"
17510         . ./myread
17511         case "$ans" in
17512         y|Y) ;;
17513         *)
17514                 echo "Ok, we won't use vfork()."
17515                 val="$undef"
17516                 ;;
17517         esac
17518         ;;
17519 esac
17520 set d_vfork
17521 eval $setvar
17522 case "$d_vfork" in
17523 $define) usevfork='true';;
17524 *) usevfork='false';;
17525 esac
17526
17527 : see if closedir exists
17528 set closedir d_closedir
17529 eval $inlibc
17530
17531 case "$d_closedir" in
17532 "$define")
17533         echo " "
17534         echo "Checking whether closedir() returns a status..." >&4
17535         cat > try.c <<EOM
17536 #$i_dirent I_DIRENT             /**/
17537 #$i_sysdir I_SYS_DIR            /**/
17538 #$i_sysndir I_SYS_NDIR          /**/
17539 #$i_systypes I_SYS_TYPES        /**/
17540
17541 #if defined(I_SYS_TYPES)
17542 #include <sys/types.h>
17543 #endif
17544 #if defined(I_DIRENT)
17545 #include <dirent.h>
17546 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
17547 #include <sys/dir.h>
17548 #endif
17549 #else
17550 #ifdef I_SYS_NDIR
17551 #include <sys/ndir.h>
17552 #else
17553 #ifdef I_SYS_DIR
17554 #ifdef hp9000s500
17555 #include <ndir.h>       /* may be wrong in the future */
17556 #else
17557 #include <sys/dir.h>
17558 #endif
17559 #endif
17560 #endif
17561 #endif 
17562 int main() { return closedir(opendir(".")); }
17563 EOM
17564         set try
17565         if eval $compile_ok; then
17566                 if $run ./try > /dev/null 2>&1 ; then
17567                         echo "Yes, it does."
17568                         val="$undef"
17569                 else
17570                         echo "No, it doesn't."
17571                         val="$define"
17572                 fi
17573         else
17574                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17575                 val="$define"
17576         fi
17577         ;;
17578 *)
17579         val="$undef";
17580         ;;
17581 esac
17582 set d_void_closedir
17583 eval $setvar
17584 $rm -f try try.*
17585 : see if there is a wait4
17586 set wait4 d_wait4
17587 eval $inlibc
17588
17589 : see if waitpid exists
17590 set waitpid d_waitpid
17591 eval $inlibc
17592
17593 : see if wcstombs exists
17594 set wcstombs d_wcstombs
17595 eval $inlibc
17596
17597 : see if wctomb exists
17598 set wctomb d_wctomb
17599 eval $inlibc
17600
17601 : see if writev exists
17602 set writev d_writev
17603 eval $inlibc
17604
17605 : preserve RCS keywords in files with variable substitution, grrr
17606 Date='$Date'
17607 Id='$Id'
17608 Log='$Log'
17609 RCSfile='$RCSfile'
17610 Revision='$Revision'
17611
17612 : check for alignment requirements
17613 echo " "
17614 case "$usecrosscompile$multiarch" in
17615 *$define*)
17616         $cat <<EOM
17617 You seem to be either cross-compiling or doing a multiarchitecture build,
17618 skipping the memory alignment check.
17619
17620 EOM
17621         case "$alignbytes" in
17622         '') alignbytes=8 ;;
17623         esac
17624         ;;
17625 *)
17626         case "$alignbytes" in
17627         '') echo "Checking alignment constraints..." >&4
17628                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
17629                         $cat >try.c <<'EOCP'
17630 typedef long double NV;
17631 EOCP
17632                 else
17633                         $cat >try.c <<'EOCP'
17634 typedef double NV;
17635 EOCP
17636                 fi
17637                 $cat >>try.c <<'EOCP'
17638 #include <stdio.h>
17639 struct foobar {
17640         char foo;
17641         NV bar;
17642 } try_algn;
17643 int main()
17644 {
17645     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
17646     return(0);
17647 }
17648 EOCP
17649                 set try
17650                 if eval $compile_ok; then
17651                         dflt=`$run ./try`
17652                 else
17653                         dflt='8'
17654                         echo "(I can't seem to compile the test program...)"
17655                 fi
17656                 ;;
17657         *) dflt="$alignbytes"
17658                 ;;
17659         esac
17660         rp="Doubles must be aligned on a how-many-byte boundary?"
17661         . ./myread
17662         alignbytes="$ans"
17663         $rm -f try.c try
17664         ;;
17665 esac
17666
17667
17668 : set the base revision
17669 baserev=5.0
17670
17671 : how do we concatenate cpp tokens here?
17672 echo " "
17673 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
17674 $cat >cpp_stuff.c <<'EOCP'
17675 #define RCAT(a,b)a/**/b
17676 #define ACAT(a,b)a ## b
17677 RCAT(Rei,ser)
17678 ACAT(Cir,cus)
17679 EOCP
17680 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
17681 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
17682         echo "Oh!  Smells like ANSI's been here." >&4
17683         echo "We can catify or stringify, separately or together!"
17684         cpp_stuff=42
17685 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
17686         echo "Ah, yes!  The good old days!" >&4
17687         echo "However, in the good old days we don't know how to stringify and"
17688         echo "catify at the same time."
17689         cpp_stuff=1
17690 else
17691         $cat >&4 <<EOM
17692 Hmm, I don't seem to be able to concatenate tokens with your cpp.
17693 You're going to have to edit the values of CAT[2-5] in config.h...
17694 EOM
17695         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
17696 fi
17697 $rm -f cpp_stuff.*
17698
17699 : see if this is a db.h system
17700 set db.h i_db
17701 eval $inhdr
17702
17703 case "$i_db" in
17704 $define)
17705         : Check db version.
17706         echo " "
17707         echo "Checking Berkeley DB version ..." >&4
17708         $cat >try.c <<EOCP
17709 #$d_const HASCONST
17710 #ifndef HASCONST
17711 #define const
17712 #endif
17713 #include <sys/types.h>
17714 #include <stdio.h>
17715 #$i_stdlib I_STDLIB
17716 #ifdef I_STDLIB
17717 #include <stdlib.h>
17718 #endif
17719 #include <db.h>
17720 int main(int argc, char *argv[])
17721 {
17722 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
17723     int Major, Minor, Patch ;
17724     unsigned long Version ;
17725     (void)db_version(&Major, &Minor, &Patch) ;
17726     if (argc == 2) {
17727         printf("%d %d %d %d %d %d\n",
17728                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
17729                Major, Minor, Patch);
17730         exit(0);
17731     }
17732     printf("You have Berkeley DB Version 2 or greater.\n");
17733
17734     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
17735                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
17736     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
17737                 Major, Minor, Patch) ;
17738
17739     /* check that db.h & libdb are compatible */
17740     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
17741         printf("db.h and libdb are incompatible.\n") ;
17742         exit(3);        
17743     }
17744
17745     printf("db.h and libdb are compatible.\n") ;
17746
17747     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
17748                 + DB_VERSION_PATCH ;
17749
17750     /* needs to be >= 2.3.4 */
17751     if (Version < 2003004) {
17752     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
17753         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
17754         exit(2);        
17755     }
17756
17757     exit(0);
17758 #else
17759 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
17760     if (argc == 2) {
17761         printf("1 0 0\n");
17762         exit(0);
17763     }
17764     printf("You have Berkeley DB Version 1.\n");
17765     exit(0);    /* DB version < 2: the coast is clear. */
17766 #else
17767     exit(1);    /* <db.h> not Berkeley DB? */
17768 #endif
17769 #endif
17770 }
17771 EOCP
17772         set try
17773         if eval $compile_ok && $run ./try; then
17774                 echo 'Looks OK.' >&4
17775                 set `$run ./try 1`
17776                 db_version_major=$1
17777                 db_version_minor=$2
17778                 db_version_patch=$3
17779         else
17780                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
17781                 i_db=$undef
17782                 case " $libs " in
17783                 *"-ldb "*)
17784                         : Remove db from list of libraries to use
17785                         echo "Removing unusable -ldb from library list" >&4
17786                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
17787                         shift
17788                         libs="$*"
17789                         echo "libs = $libs" >&4
17790                         ;;
17791                 esac
17792         fi
17793         $rm -f try.*
17794         ;;
17795 esac
17796
17797 case "$i_db" in
17798 define)
17799         : Check the return type needed for hash 
17800         echo " "
17801         echo "Checking return type needed for hash for Berkeley DB ..." >&4
17802         $cat >try.c <<EOCP
17803 #$d_const HASCONST
17804 #ifndef HASCONST
17805 #define const
17806 #endif
17807 #include <sys/types.h>
17808 #include <db.h>
17809
17810 #ifndef DB_VERSION_MAJOR
17811 u_int32_t hash_cb (ptr, size)
17812 const void *ptr;
17813 size_t size;
17814 {
17815 }
17816 HASHINFO info;
17817 int main()
17818 {
17819         info.hash = hash_cb;
17820 }
17821 #endif
17822 EOCP
17823         if $cc $ccflags -c try.c >try.out 2>&1 ; then
17824                 if $contains warning try.out >>/dev/null 2>&1 ; then
17825                         db_hashtype='int'
17826                 else
17827                         db_hashtype='u_int32_t'
17828                 fi
17829         else
17830                 : XXX Maybe we should just give up here.
17831                 db_hashtype=u_int32_t
17832                 $cat try.out >&4
17833                 echo "Help:  I can't seem to compile the db test program." >&4
17834                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
17835         fi
17836         $rm -f try.*
17837         echo "Your version of Berkeley DB uses $db_hashtype for hash."
17838         ;;
17839 *)      db_hashtype=u_int32_t
17840         ;;
17841 esac
17842 case "$i_db" in
17843 define)
17844         : Check the return type needed for prefix 
17845         echo " "
17846         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
17847         cat >try.c <<EOCP
17848 #$d_const HASCONST
17849 #ifndef HASCONST
17850 #define const
17851 #endif
17852 #include <sys/types.h>
17853 #include <db.h>
17854
17855 #ifndef DB_VERSION_MAJOR
17856 size_t prefix_cb (key1, key2)
17857 const DBT *key1;
17858 const DBT *key2;
17859 {
17860 }
17861 BTREEINFO info;
17862 int main()
17863 {
17864         info.prefix = prefix_cb;
17865 }
17866 #endif
17867 EOCP
17868         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
17869                 if $contains warning try.out >>/dev/null 2>&1 ; then
17870                         db_prefixtype='int'
17871                 else
17872                         db_prefixtype='size_t'
17873                 fi
17874         else
17875                 db_prefixtype='size_t'
17876                 : XXX Maybe we should just give up here.
17877                 $cat try.out >&4
17878                 echo "Help:  I can't seem to compile the db test program." >&4
17879                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
17880         fi
17881         $rm -f try.*
17882         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
17883         ;;
17884 *)      db_prefixtype='size_t'
17885         ;;
17886 esac
17887
17888
17889 : How can we generate normalized random numbers ?
17890 echo " "
17891 echo "Looking for a random number function..." >&4
17892 case "$randfunc" in
17893 '')
17894         if set drand48 val -f; eval $csym; $val; then
17895                 dflt="drand48"
17896                 echo "Good, found drand48()." >&4
17897         elif set random val -f; eval $csym; $val; then
17898                 dflt="random"
17899                 echo "OK, found random()." >&4
17900         else
17901                 dflt="rand"
17902                 echo "Yick, looks like I have to use rand()." >&4
17903         fi
17904         echo " "
17905         ;;
17906 *)
17907         dflt="$randfunc"
17908         ;;
17909 esac
17910 cont=true
17911
17912 case "$ccflags" in
17913 *-Dmy_rand=*|*-Dmy_srand=*)
17914         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
17915         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
17916         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
17917         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
17918         ;;
17919 esac
17920
17921 while $test "$cont"; do
17922         rp="Use which function to generate random numbers?"
17923         . ./myread
17924         if $test "$ans" = "$dflt"; then
17925                 : null
17926         else
17927                 randbits=''
17928         fi
17929         randfunc="$ans"
17930         if set $ans val -f; eval $csym; $val; then
17931                 cont=''
17932         else
17933                 dflt=y
17934                 rp="I cannot find function $ans. Use that name anyway?"
17935                 . ./myread
17936                 dflt=rand
17937                 case "$ans" in
17938                         [yY]*) cont='';;
17939                 esac
17940         fi
17941         case "$cont" in
17942         '')
17943                 case "$randfunc" in
17944                 drand48)
17945                         drand01="drand48()"
17946                         seedfunc="srand48"
17947                         randbits=48
17948                         randseedtype=long
17949                         ;;
17950                 rand|random)
17951                         case "$randbits" in
17952                         '')
17953 echo "Checking to see how many bits your $randfunc() function produces..." >&4
17954                                 $cat >try.c <<EOCP
17955 #$i_unistd I_UNISTD
17956 #$i_stdlib I_STDLIB
17957 #include <stdio.h>
17958 #ifdef I_UNISTD
17959 #  include <unistd.h>
17960 #endif
17961 #ifdef I_STDLIB
17962 #  include <stdlib.h>
17963 #endif
17964 int main()
17965 {
17966         register int i;
17967         register unsigned long tmp;
17968         register unsigned long max = 0L;
17969
17970         for (i = 1000; i; i--) {
17971                 tmp = (unsigned long) $randfunc();
17972                 if (tmp > max) max = tmp;
17973         }
17974         for (i = 0; max; i++)
17975                 max /= 2;
17976         printf("%d\n",i);
17977 }
17978 EOCP
17979                                 set try
17980                                 if eval $compile_ok; then
17981                                         dflt=`try`
17982                                 else
17983                                         dflt='?'
17984                                         echo "(I can't seem to compile the test program...)"
17985                                 fi
17986                                 ;;
17987                         *)
17988                                 dflt="$randbits"
17989                                 ;;
17990                         esac
17991                         rp="How many bits does your $randfunc() function produce?"
17992                         . ./myread
17993                         randbits="$ans"
17994                         $rm -f try.c try
17995                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17996                         seedfunc="s$randfunc"
17997                         randseedtype=unsigned
17998                         ;;
17999                 *)
18000                         dflt="31"
18001                         rp="How many bits does your $randfunc() function produce?"
18002                         . ./myread
18003                         randbits="$ans"
18004                         seedfunc="s$randfunc"
18005                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18006                         if set $seedfunc val -f; eval $csym; $val; then
18007                                 echo "(Using $seedfunc() to seed random generator)"
18008                         else
18009                                 echo "(Warning: no $seedfunc() to seed random generator)"
18010                                 seedfunc=rand
18011                         fi
18012                         randseedtype=unsigned
18013                         ;;
18014                 esac
18015                 ;;
18016         esac
18017 done
18018
18019 echo " "
18020 echo "Determining whether or not we are on an EBCDIC system..." >&4
18021 $cat >try.c <<'EOM'
18022 int main()
18023 {
18024   if ('M'==0xd4) return 0;
18025   return 1;
18026 }
18027 EOM
18028
18029 val=$undef
18030 set try
18031 if eval $compile_ok; then
18032         if $run ./try; then
18033                 echo "You seem to speak EBCDIC." >&4
18034                 val="$define"
18035         else
18036                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18037         fi
18038 else
18039         echo "I'm unable to compile the test program." >&4
18040         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18041 fi
18042 $rm -f try try.*
18043 set ebcdic
18044 eval $setvar
18045
18046 echo " "
18047 $cat >&4 <<EOM
18048 Checking how to flush all pending stdio output...
18049 EOM
18050 # I only know how to find the first 32 possibly open files on SunOS.
18051 # See also hints/sunos_4_1.sh and util.c  --AD
18052 case "$osname" in
18053 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18054 esac
18055 $cat >>try.c <<EOCP
18056 #include <stdio.h>
18057 #$i_stdlib I_STDLIB
18058 #ifdef I_STDLIB
18059 #include <stdlib.h>
18060 #endif
18061 #$i_unistd I_UNISTD
18062 #ifdef I_UNISTD
18063 # include <unistd.h>
18064 #endif
18065 #$d_sysconf HAS_SYSCONF
18066 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18067 #ifdef HAS_STDIO_STREAM_ARRAY
18068 # define STDIO_STREAM_ARRAY $stdio_stream_array
18069 #endif
18070 int main() {
18071   FILE* p;
18072   unlink("try.out");
18073   p = fopen("try.out", "w");
18074 #ifdef TRY_FPUTC
18075   fputc('x', p);
18076 #else
18077 # ifdef TRY_FPRINTF
18078   fprintf(p, "x");
18079 # endif
18080 #endif
18081 #ifdef TRY_FFLUSH_NULL
18082   fflush(NULL);
18083 #endif
18084 #ifdef TRY_FFLUSH_ALL
18085   {
18086     long open_max = -1;
18087 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18088     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18089 # else
18090 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18091     open_max = sysconf(_SC_OPEN_MAX);
18092 #  else
18093 #   ifdef FOPEN_MAX
18094     open_max = FOPEN_MAX;
18095 #   else
18096 #    ifdef OPEN_MAX
18097     open_max = OPEN_MAX;
18098 #    else
18099 #     ifdef _NFILE
18100     open_max = _NFILE;
18101 #     endif
18102 #    endif
18103 #   endif
18104 #  endif
18105 # endif 
18106 # ifdef HAS_STDIO_STREAM_ARRAY
18107     if (open_max > 0) {
18108       long i;
18109       for (i = 0; i < open_max; i++)
18110             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18111                 STDIO_STREAM_ARRAY[i]._file < open_max &&
18112                 STDIO_STREAM_ARRAY[i]._flag)
18113                 fflush(&STDIO_STREAM_ARRAY[i]);
18114     }   
18115   }
18116 # endif
18117 #endif
18118   _exit(42);
18119 }
18120 EOCP
18121 : first we have to find out how _not_ to flush
18122 $to try.c
18123 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18124     output=''
18125     set try -DTRY_FPUTC
18126     if eval $compile; then
18127             $run ./try 2>/dev/null
18128             code="$?"
18129             $from try.out
18130             if $test ! -s try.out -a "X$code" = X42; then
18131                 output=-DTRY_FPUTC
18132             fi
18133     fi
18134     case "$output" in
18135     '')
18136             set try -DTRY_FPRINTF
18137             if eval $compile; then
18138                     $run ./try 2>/dev/null
18139                     code="$?"
18140                     $from try.out
18141                     if $test ! -s try.out -a "X$code" = X42; then
18142                         output=-DTRY_FPRINTF
18143                     fi
18144             fi
18145         ;;
18146     esac
18147 fi
18148 : check for fflush NULL behaviour
18149 case "$fflushNULL" in
18150 '')     set try -DTRY_FFLUSH_NULL $output
18151         if eval $compile; then
18152                 $run ./try 2>/dev/null
18153                 code="$?"
18154                 $from try.out
18155                 if $test -s try.out -a "X$code" = X42; then
18156                         fflushNULL="`$cat try.out`"
18157                 else
18158                         if $test "X$code" != X42; then
18159                                 $cat >&4 <<EOM
18160 (If this test failed, don't worry, we'll try another method shortly.)
18161 EOM
18162                         fi
18163                 fi
18164         fi
18165         $rm -f core try.core core.try.*
18166         case "$fflushNULL" in
18167         x)      $cat >&4 <<EOM
18168 Your fflush(NULL) works okay for output streams.
18169 Let's see if it clobbers input pipes...
18170 EOM
18171 # As of mid-March 2000 all versions of Solaris appear to have a stdio
18172 # bug that improperly flushes the input end of pipes.  So we avoid the
18173 # autoflush on fork/system/exec support for now. :-(
18174 $cat >tryp.c <<EOCP
18175 #include <stdio.h>
18176 int
18177 main(int argc, char **argv)
18178 {
18179     char buf[1024];
18180     int i;
18181     char *bp = buf;
18182     while (1) {
18183         while ((i = getc(stdin)) != -1
18184                && (*bp++ = i) != '\n'
18185                && bp < &buf[1024])
18186         /* DO NOTHING */ ;
18187         *bp = '\0';
18188         fprintf(stdout, "%s", buf);
18189         fflush(NULL);
18190         if (i == -1)
18191             return 0;
18192         bp = buf;
18193     }
18194 }
18195 EOCP
18196                 fflushNULL="$define"
18197                 set tryp
18198                 if eval $compile; then
18199                     $rm -f tryp.out
18200                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18201                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
18202                        $cat >&4 <<EOM
18203 fflush(NULL) seems to behave okay with input streams.
18204 EOM
18205                         fflushNULL="$define"
18206                     else
18207                         $cat >&4 <<EOM
18208 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
18209 EOM
18210                         fflushNULL="$undef"
18211                     fi
18212                 fi
18213                 $rm -f core tryp.c tryp.core core.tryp.*
18214                 ;;
18215         '')     $cat >&4 <<EOM
18216 Your fflush(NULL) isn't working (contrary to ANSI C).
18217 EOM
18218                 fflushNULL="$undef"
18219                 ;;
18220         *)      $cat >&4 <<EOM
18221 Cannot figure out whether your fflush(NULL) works or not.
18222 I'm assuming it doesn't (contrary to ANSI C).
18223 EOM
18224                 fflushNULL="$undef"
18225                 ;;
18226         esac
18227         ;;
18228 $define|true|[yY]*)
18229         fflushNULL="$define"
18230         ;;
18231 *)
18232         fflushNULL="$undef"
18233         ;;
18234 esac
18235 : check explicit looping only if NULL did not work, and if the pipe
18236 : bug does not show up on an explicit flush too
18237 case "$fflushNULL" in
18238 "$undef")
18239         $cat >tryp.c <<EOCP
18240 #include <stdio.h>
18241 int
18242 main(int argc, char **argv)
18243 {
18244     char buf[1024];
18245     int i;
18246     char *bp = buf;
18247     while (1) {
18248         while ((i = getc(stdin)) != -1
18249                && (*bp++ = i) != '\n'
18250                && bp < &buf[1024])
18251         /* DO NOTHING */ ;
18252         *bp = '\0';
18253         fprintf(stdout, "%s", buf);
18254         fflush(stdin);
18255         if (i == -1)
18256             return 0;
18257         bp = buf;
18258     }
18259 }
18260 EOCP
18261         set tryp
18262         if eval $compile; then
18263             $rm -f tryp.out
18264             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18265             if cmp tryp.c tryp.out >/dev/null 2>&1; then
18266                $cat >&4 <<EOM
18267 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18268 EOM
18269                 : now check for fflushall behaviour
18270                 case "$fflushall" in
18271                 '')     set try -DTRY_FFLUSH_ALL $output
18272                         if eval $compile; then
18273                                 $cat >&4 <<EOM
18274 (Now testing the other method--but note that this also may fail.)
18275 EOM
18276                                 $run ./try 2>/dev/null
18277                                 code=$?
18278                                 $from try.out
18279                                 if $test -s try.out -a "X$code" = X42; then
18280                                         fflushall="`$cat try.out`"
18281                                 fi
18282                         fi
18283                         $rm -f core try.core core.try.*
18284                         case "$fflushall" in
18285                         x)      $cat >&4 <<EOM
18286 Whew. Flushing explicitly all the stdio streams works.
18287 EOM
18288                                 fflushall="$define"
18289                                 ;;
18290                         '')     $cat >&4 <<EOM
18291 Sigh. Flushing explicitly all the stdio streams doesn't work.
18292 EOM
18293                                 fflushall="$undef"
18294                                 ;;
18295                         *)      $cat >&4 <<EOM
18296 Cannot figure out whether flushing stdio streams explicitly works or not.
18297 I'm assuming it doesn't.
18298 EOM
18299                                 fflushall="$undef"
18300                                 ;;
18301                         esac
18302                         ;;
18303                 "$define"|true|[yY]*)
18304                         fflushall="$define"
18305                         ;;
18306                 *)
18307                         fflushall="$undef"
18308                         ;;
18309                 esac
18310             else
18311                 $cat >&4 <<EOM
18312 All is futile.  Even fflush(stdin) clobbers input pipes!
18313 EOM
18314                 fflushall="$undef"
18315             fi
18316         else
18317             fflushall="$undef"
18318         fi
18319         $rm -f core tryp.c tryp.core core.tryp.*
18320         ;;
18321 *)      fflushall="$undef"
18322         ;;
18323 esac
18324
18325 case "$fflushNULL$fflushall" in
18326 undefundef)
18327         $cat <<EOM
18328 OK, I give up.  I cannot figure out how to flush pending stdio output.
18329 We won't be flushing handles at all before fork/exec/popen.
18330 EOM
18331         ;;
18332 esac
18333 $rm -f try.* try$exe_ext
18334
18335 : Store the full pathname to the ar program for use in the C program
18336 : Respect a hint or command line value for full_ar.
18337 case "$full_ar" in
18338 '') full_ar=$ar ;;
18339 esac
18340
18341 : Store the full pathname to the sed program for use in the C program
18342 full_sed=$sed
18343
18344 : see what type gids are declared as in the kernel
18345 echo " "
18346 echo "Looking for the type for group ids returned by getgid()."
18347 set gid_t gidtype xxx stdio.h sys/types.h
18348 eval $typedef
18349 case "$gidtype" in
18350 xxx)
18351         xxx=`./findhdr sys/user.h`
18352         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
18353         case $1 in
18354         unsigned) dflt="$1 $2" ;;
18355         *) dflt="$1" ;;
18356         esac
18357         ;;
18358 *) dflt="$gidtype";;
18359 esac
18360 case "$gidtype" in
18361 gid_t) echo "gid_t found." ;;
18362 *)      rp="What is the type for group ids returned by getgid()?"
18363         . ./myread
18364         gidtype="$ans"
18365         ;;
18366 esac
18367
18368 echo " "
18369 case "$gidtype" in
18370 *_t) zzz="$gidtype"     ;;
18371 *)   zzz="gid"          ;;
18372 esac
18373 echo "Checking the size of $zzz..." >&4 
18374 cat > try.c <<EOCP
18375 #include <sys/types.h>
18376 #include <stdio.h>
18377 #$i_stdlib I_STDLIB
18378 #ifdef I_STDLIB
18379 #include <stdlib.h>
18380 #endif
18381 int main() {
18382     printf("%d\n", (int)sizeof($gidtype));
18383     exit(0);
18384 }
18385 EOCP
18386 set try
18387 if eval $compile_ok; then
18388         yyy=`$run ./try`
18389         case "$yyy" in
18390         '')     gidsize=4
18391                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
18392                 ;;
18393         *)      gidsize=$yyy
18394                 echo "Your $zzz is $gidsize bytes long."
18395                 ;;
18396         esac
18397 else
18398         gidsize=4
18399         echo "(I can't compile the test program--guessing $gidsize.)" >&4
18400 fi
18401
18402
18403 echo " "
18404 case "$gidtype" in
18405 *_t) zzz="$gidtype"     ;;
18406 *)   zzz="gid"          ;;
18407 esac
18408 echo "Checking the sign of $zzz..." >&4 
18409 cat > try.c <<EOCP
18410 #include <sys/types.h>
18411 #include <stdio.h>
18412 int main() {
18413         $gidtype foo = -1;
18414         if (foo < 0)
18415                 printf("-1\n");
18416         else
18417                 printf("1\n");
18418 }
18419 EOCP
18420 set try
18421 if eval $compile; then
18422         yyy=`$run ./try`
18423         case "$yyy" in
18424         '')     gidsign=1
18425                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18426                 ;;
18427         *)      gidsign=$yyy
18428                 case "$gidsign" in
18429                  1) echo "Your $zzz is unsigned." ;;
18430                 -1) echo "Your $zzz is signed."   ;;
18431                 esac
18432                 ;;
18433         esac
18434 else
18435         gidsign=1
18436         echo "(I can't compile the test program--guessing unsigned.)" >&4
18437 fi
18438
18439
18440 echo " "
18441
18442 if $test X"$quadtype" != X; then
18443
18444 echo "Checking how to print 64-bit integers..." >&4
18445
18446 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
18447         $cat >try.c <<'EOCP'
18448 #include <sys/types.h>
18449 #include <stdio.h>
18450 int main() {
18451   int q = 12345678901;
18452   printf("%ld\n", q);
18453 }
18454 EOCP
18455         set try
18456         if eval $compile; then
18457                 yyy=`$run ./try`
18458                 case "$yyy" in
18459                 12345678901)
18460                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
18461                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
18462                         echo "We will use %d."
18463                         ;;
18464                 esac
18465         fi
18466 fi
18467
18468 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
18469         $cat >try.c <<'EOCP'
18470 #include <sys/types.h>
18471 #include <stdio.h>
18472 int main() {
18473   long q = 12345678901;
18474   printf("%ld\n", q);
18475 }
18476 EOCP
18477         set try
18478         if eval $compile; then
18479                 yyy=`$run ./try`
18480                 case "$yyy" in
18481                 12345678901)
18482                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
18483                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
18484                         echo "We will use %ld."
18485                         ;;
18486                 esac
18487         fi
18488 fi
18489
18490 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
18491         $cat >try.c <<'EOCP'
18492 #include <sys/types.h>
18493 #include <inttypes.h>
18494 #include <stdio.h>
18495 int main() {
18496   int64_t q = 12345678901;
18497   printf("%" PRId64 "\n", q);
18498 }
18499 EOCP
18500         set try
18501         if eval $compile; then
18502                 yyy=`$run ./try`
18503                 case "$yyy" in
18504                 12345678901)
18505                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
18506                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
18507                         echo "We will use the C9X style."
18508                         ;;
18509                 esac
18510         fi
18511 fi
18512
18513 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18514         $cat >try.c <<EOCP
18515 #include <sys/types.h>
18516 #include <stdio.h>
18517 int main() {
18518   $quadtype q = 12345678901;
18519   printf("%Ld\n", q);
18520 }
18521 EOCP
18522         set try
18523         if eval $compile; then
18524                 yyy=`$run ./try`
18525                 case "$yyy" in
18526                 12345678901)
18527                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
18528                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
18529                         echo "We will use %Ld."
18530                         ;;
18531                 esac
18532         fi
18533 fi
18534
18535 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
18536         $cat >try.c <<'EOCP'
18537 #include <sys/types.h>
18538 #include <stdio.h>
18539 int main() {
18540   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
18541   printf("%lld\n", q);
18542 }
18543 EOCP
18544         set try
18545         if eval $compile; then
18546                 yyy=`$run ./try`
18547                 case "$yyy" in
18548                 12345678901)
18549                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
18550                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
18551                         echo "We will use the %lld style."
18552                         ;;
18553                 esac
18554         fi
18555 fi
18556
18557 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18558         $cat >try.c <<EOCP
18559 #include <sys/types.h>
18560 #include <stdio.h>
18561 int main() {
18562   $quadtype q = 12345678901;
18563   printf("%qd\n", q);
18564 }
18565 EOCP
18566         set try
18567         if eval $compile; then
18568                 yyy=`$run ./try`
18569                 case "$yyy" in
18570                 12345678901)
18571                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
18572                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
18573                         echo "We will use %qd."
18574                         ;;
18575                 esac
18576         fi
18577 fi
18578
18579 if $test X"$sPRId64" = X; then
18580         echo "Cannot figure out how to print 64-bit integers." >&4
18581 fi
18582
18583 $rm -f try try.*
18584
18585 fi
18586
18587 case "$sPRId64" in
18588 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
18589         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
18590         ;;
18591 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
18592         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
18593         ;;
18594 esac
18595
18596
18597 echo " "
18598 $echo "Checking the format strings to be used for Perl's internal types..." >&4
18599
18600 if $test X"$ivsize" = X8; then
18601         ivdformat="$sPRId64"
18602         uvuformat="$sPRIu64"
18603         uvoformat="$sPRIo64"
18604         uvxformat="$sPRIx64"
18605         uvXUformat="$sPRIXU64"
18606 else
18607         if $test X"$ivsize" = X"$longsize"; then
18608                 ivdformat='"ld"'
18609                 uvuformat='"lu"'
18610                 uvoformat='"lo"'
18611                 uvxformat='"lx"'
18612                 uvXUformat='"lX"'
18613         else
18614                 if $test X"$ivsize" = X"$intsize"; then
18615                         ivdformat='"d"'
18616                         uvuformat='"u"'
18617                         uvoformat='"o"'
18618                         uvxformat='"x"'
18619                         uvXUformat='"X"'
18620                 else
18621                         : far out
18622                         if $test X"$ivsize" = X"$shortsize"; then
18623                                 ivdformat='"hd"'
18624                                 uvuformat='"hu"'
18625                                 uvoformat='"ho"'
18626                                 uvxformat='"hx"'
18627                                 uvXUformat='"hX"'
18628                         fi
18629                 fi
18630         fi
18631 fi
18632
18633 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
18634         nveformat="$sPRIeldbl"
18635         nvfformat="$sPRIfldbl"
18636         nvgformat="$sPRIgldbl"
18637         nvEUformat="$sPRIEUldbl"
18638         nvFUformat="$sPRIFUldbl"
18639         nvGUformat="$sPRIGUldbl"
18640 else
18641         nveformat='"e"'
18642         nvfformat='"f"'
18643         nvgformat='"g"'
18644         nvEUformat='"E"'
18645         nvFUformat='"F"'
18646         nvGUformat='"G"'
18647 fi
18648
18649 case "$ivdformat" in
18650 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
18651     exit 1
18652     ;;
18653 esac
18654
18655
18656 echo " "
18657 $echo "Checking the format string to be used for gids..." >&4
18658
18659 case "$gidsign" in
18660 -1)     if $test X"$gidsize" = X"$ivsize"; then
18661                 gidformat="$ivdformat"
18662         else
18663                 if $test X"$gidsize" = X"$longsize"; then
18664                         gidformat='"ld"'
18665                 else
18666                         if $test X"$gidsize" = X"$intsize"; then
18667                                 gidformat='"d"'
18668                         else
18669                                 if $test X"$gidsize" = X"$shortsize"; then
18670                                         gidformat='"hd"'
18671                                 fi
18672                         fi
18673                 fi
18674         fi
18675         ;;
18676 *)      if $test X"$gidsize" = X"$uvsize"; then
18677                 gidformat="$uvuformat"
18678         else
18679                 if $test X"$gidsize" = X"$longsize"; then
18680                         gidformat='"lu"'
18681                 else
18682                         if $test X"$gidsize" = X"$intsize"; then
18683                                 gidformat='"u"'
18684                         else
18685                                 if $test X"$gidsize" = X"$shortsize"; then
18686                                         gidformat='"hu"'
18687                                 fi
18688                         fi
18689                 fi
18690         fi
18691         ;;
18692 esac
18693
18694 : see if getgroups exists
18695 set getgroups d_getgrps
18696 eval $inlibc
18697
18698 : see if setgroups exists
18699 set setgroups d_setgrps
18700 eval $inlibc
18701
18702
18703 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
18704 echo " "
18705 case "$d_getgrps$d_setgrps" in
18706 *define*)
18707         case "$groupstype" in
18708         '') dflt="$gidtype" ;;
18709         *)  dflt="$groupstype" ;;
18710         esac
18711         $cat <<EOM
18712 What type of pointer is the second argument to getgroups() and setgroups()?
18713 Usually this is the same as group ids, $gidtype, but not always.
18714
18715 EOM
18716         rp='What type pointer is the second argument to getgroups() and setgroups()?'
18717         . ./myread
18718         groupstype="$ans"
18719         ;;
18720 *)  groupstype="$gidtype";;
18721 esac
18722
18723 echo " "
18724 echo "Checking if your $make program sets \$(MAKE)..." >&4
18725 case "$make_set_make" in
18726 '')
18727         $sed 's/^X //' > testmake.mak << 'EOF'
18728 Xall:
18729 X       @echo 'maketemp="$(MAKE)"'
18730 EOF
18731         case "`$make -f testmake.mak 2>/dev/null`" in
18732         *maketemp=*) make_set_make='#' ;;
18733         *)      make_set_make="MAKE=$make" ;;
18734         esac
18735         $rm -f testmake.mak
18736         ;;
18737 esac
18738 case "$make_set_make" in
18739 '#') echo "Yup, it does.";;
18740 *) echo "Nope, it doesn't.";;
18741 esac
18742
18743 : see what type is used for mode_t
18744 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
18745 set mode_t modetype int stdio.h sys/types.h
18746 eval $typedef_ask
18747
18748 : see if stdarg is available
18749 echo " "
18750 if $test `./findhdr stdarg.h`; then
18751         echo "<stdarg.h> found." >&4
18752         valstd="$define"
18753 else
18754         echo "<stdarg.h> NOT found." >&4
18755         valstd="$undef"
18756 fi
18757
18758 : see if varags is available
18759 echo " "
18760 if $test `./findhdr varargs.h`; then
18761         echo "<varargs.h> found." >&4
18762 else
18763         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
18764 fi
18765
18766 : set up the varargs testing programs
18767 $cat > varargs.c <<EOP
18768 #ifdef I_STDARG
18769 #include <stdarg.h>
18770 #endif
18771 #ifdef I_VARARGS
18772 #include <varargs.h>
18773 #endif
18774
18775 #ifdef I_STDARG
18776 int f(char *p, ...)
18777 #else
18778 int f(va_alist)
18779 va_dcl
18780 #endif
18781 {
18782         va_list ap;
18783 #ifndef I_STDARG
18784         char *p;
18785 #endif
18786 #ifdef I_STDARG
18787         va_start(ap,p);
18788 #else
18789         va_start(ap);
18790         p = va_arg(ap, char *);
18791 #endif
18792         va_end(ap);
18793 }
18794 EOP
18795 $cat > varargs <<EOP
18796 $startsh
18797 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
18798         echo "true"
18799 else
18800         echo "false"
18801 fi
18802 $rm -f varargs$_o
18803 EOP
18804 chmod +x varargs
18805
18806 : now check which varargs header should be included
18807 echo " "
18808 i_varhdr=''
18809 case "$valstd" in
18810 "$define")
18811         if `./varargs I_STDARG`; then
18812                 val='stdarg.h'
18813         elif `./varargs I_VARARGS`; then
18814                 val='varargs.h'
18815         fi
18816         ;;
18817 *)
18818         if `./varargs I_VARARGS`; then
18819                 val='varargs.h'
18820         fi
18821         ;;
18822 esac
18823 case "$val" in
18824 '')
18825 echo "I could not find the definition for va_dcl... You have problems..." >&4
18826         val="$undef"; set i_stdarg; eval $setvar
18827         val="$undef"; set i_varargs; eval $setvar
18828         ;;
18829 *) 
18830         set i_varhdr
18831         eval $setvar
18832         case "$i_varhdr" in
18833         stdarg.h)
18834                 val="$define"; set i_stdarg; eval $setvar
18835                 val="$undef"; set i_varargs; eval $setvar
18836                 ;;
18837         varargs.h)
18838                 val="$undef"; set i_stdarg; eval $setvar
18839                 val="$define"; set i_varargs; eval $setvar
18840                 ;;
18841         esac
18842         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
18843 esac
18844 $rm -f varargs*
18845
18846 : see if we need va_copy
18847 echo " "
18848 case "$i_stdarg" in
18849 "$define")
18850         $cat >try.c <<EOCP
18851 #include <stdarg.h>
18852 #include <stdio.h>
18853 #$i_stdlib I_STDLIB
18854 #ifdef I_STDLIB
18855 #include <stdlib.h>
18856 #endif
18857 #include <signal.h>
18858
18859 int
18860 ivfprintf(FILE *f, const char *fmt, va_list *valp)
18861 {
18862   return vfprintf(f, fmt, *valp);
18863 }
18864  
18865 int    
18866 myvfprintf(FILE *f, const  char *fmt, va_list val)
18867 {
18868   return ivfprintf(f, fmt, &val);
18869 }
18870       
18871 int
18872 myprintf(char *fmt, ...) 
18873 {
18874   va_list val;
18875   va_start(val, fmt);
18876   return myvfprintf(stdout, fmt, val); 
18877 }         
18878
18879 int
18880 main(int ac, char **av)
18881 {
18882   signal(SIGSEGV, exit);
18883
18884   myprintf("%s%cs all right, then\n", "that", '\'');                            
18885   exit(0);      
18886 }
18887 EOCP
18888         set try
18889         if eval $compile && $run ./try 2>&1 >/dev/null; then
18890                 case "`$run ./try`" in
18891                 "that's all right, then")
18892                         okay=yes
18893                         ;;
18894                 esac
18895         fi
18896         case "$okay" in
18897         yes)    echo "It seems that you don't need va_copy()." >&4
18898                 need_va_copy="$undef"
18899                 ;;
18900         *)      echo "It seems that va_copy() or similar will be needed." >&4
18901                 need_va_copy="$define"
18902                 ;;
18903         esac
18904         $rm -f try.* core core.* *.core *.core.*
18905         ;;
18906 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
18907         ;;
18908 esac
18909
18910 : see what type is used for size_t
18911 rp="What is the type used for the length parameter for string functions?"
18912 set size_t sizetype 'unsigned int' stdio.h sys/types.h
18913 eval $typedef_ask
18914
18915 : check for type of arguments to gethostbyaddr. 
18916 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
18917         case "$d_gethbyaddr" in
18918         $define)
18919                 $cat <<EOM
18920
18921 Checking to see what type of arguments are accepted by gethostbyaddr().
18922 EOM
18923                 hdrs="$define sys/types.h
18924                         $d_socket sys/socket.h 
18925                         $i_niin netinet/in.h 
18926                         $i_netdb netdb.h
18927                         $i_unistd unistd.h"
18928                 : The first arg can 'char *' or 'void *'
18929                 : The second arg is some of integral type
18930                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
18931                         for yyy in size_t long int; do
18932                                 case "$netdb_host_type" in
18933                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
18934                                         if ./protochk "$try" $hdrs; then
18935                                                 echo "Your system accepts $xxx for the first arg."
18936                                                 echo "...and $yyy for the second arg."
18937                                                 netdb_host_type="$xxx"
18938                                                 netdb_hlen_type="$yyy"
18939                                         fi
18940                                         ;;
18941                                 esac
18942                         done
18943                 done
18944                 : In case none of those worked, prompt the user.
18945                 case "$netdb_host_type" in
18946                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
18947                         dflt='char *'
18948                         . ./myread
18949                         netdb_host_type=$ans
18950                         rp='What is the type for the 2nd argument to gethostbyaddr?'
18951                         dflt="$sizetype"
18952                         . ./myread
18953                         netdb_hlen_type=$ans
18954                         ;;
18955                 esac
18956                 ;;
18957         *)      : no gethostbyaddr, so pick harmless defaults
18958                 netdb_host_type='char *'
18959                 netdb_hlen_type="$sizetype"
18960                 ;;
18961         esac
18962         # Remove the "const" if needed. -- but then we'll have a 
18963         # prototype clash!
18964         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
18965 fi
18966
18967 : check for type of argument to gethostbyname. 
18968 if test "X$netdb_name_type" = X ; then
18969         case "$d_gethbyname" in
18970         $define)
18971                 $cat <<EOM
18972
18973 Checking to see what type of argument is accepted by gethostbyname().
18974 EOM
18975                 hdrs="$define sys/types.h
18976                         $d_socket sys/socket.h 
18977                         $i_niin netinet/in.h 
18978                         $i_netdb netdb.h
18979                         $i_unistd unistd.h"
18980                 for xxx in "const char *" "char *"; do
18981                         case "$netdb_name_type" in
18982                         '')     try="extern struct hostent *gethostbyname($xxx);"
18983                                 if ./protochk "$try" $hdrs; then
18984                                         echo "Your system accepts $xxx."
18985                                         netdb_name_type="$xxx"
18986                                 fi
18987                                 ;;
18988                         esac
18989                 done
18990                 : In case none of those worked, prompt the user.
18991                 case "$netdb_name_type" in
18992                 '')     rp='What is the type for the 1st argument to gethostbyname?'
18993                         dflt='char *'
18994                         . ./myread
18995                         netdb_name_type=$ans
18996                         ;;
18997                 esac
18998                 ;;
18999         *)      : no gethostbyname, so pick harmless default
19000                 netdb_name_type='char *'
19001                 ;;
19002         esac
19003 fi
19004
19005 : check for type of 1st argument to getnetbyaddr. 
19006 if test "X$netdb_net_type" = X ; then
19007         case "$d_getnbyaddr" in
19008         $define)
19009                 $cat <<EOM
19010
19011 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19012 EOM
19013                 hdrs="$define sys/types.h
19014                         $d_socket sys/socket.h 
19015                         $i_niin netinet/in.h 
19016                         $i_netdb netdb.h
19017                         $i_unistd unistd.h"
19018                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19019                         case "$netdb_net_type" in
19020                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19021                                 if ./protochk "$try" $hdrs; then
19022                                         echo "Your system accepts $xxx."
19023                                         netdb_net_type="$xxx"
19024                                 fi
19025                                 ;;
19026                         esac
19027                 done
19028                 : In case none of those worked, prompt the user.
19029                 case "$netdb_net_type" in
19030                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19031                         dflt='long'
19032                         . ./myread
19033                         netdb_net_type=$ans
19034                         ;;
19035                 esac
19036                 ;;
19037         *)      : no getnetbyaddr, so pick harmless default
19038                 netdb_net_type='long'
19039                 ;;
19040         esac
19041 fi
19042 : locate the preferred pager for this system
19043 fn=f/
19044 case "$pager" in
19045 '')
19046         dflt=''
19047         case "$pg" in
19048         /*) dflt=$pg;;
19049         [a-zA-Z]:/*) dflt=$pg;;
19050         esac
19051         case "$more" in
19052         /*) dflt=$more;;
19053         [a-zA-Z]:/*) dflt=$more;;
19054         esac
19055         case "$less" in
19056         /*) dflt=$less;;
19057         [a-zA-Z]:/*) dflt=$less;;
19058         esac
19059         case "$dflt" in
19060         '') dflt=/usr/ucb/more;;
19061         esac
19062         ;;
19063 *)      dflt="$pager"
19064         : Instruct ./getfile to trust the hinted or previous pager value,
19065         : even if it does not begin with a slash.  For example, on os2,
19066         : pager might be cmd /c more.  See comments in UU/getfile.
19067         fn="f/($pager)"
19068         ;;
19069 esac
19070 echo " "
19071 rp='What pager is used on your system?'
19072 . ./getfile
19073 pager="$ans"
19074
19075 : see what type pids are declared as in the kernel
19076 rp="What is the type of process ids on this system?"
19077 set pid_t pidtype int stdio.h sys/types.h
19078 eval $typedef_ask
19079
19080 : see if ar generates random libraries by itself
19081 echo " "
19082 echo "Checking how to generate random libraries on your machine..." >&4
19083 echo 'int bar1() { return bar2(); }' > bar1.c
19084 echo 'int bar2() { return 2; }' > bar2.c
19085 $cat > foo.c <<EOP
19086 #$i_stdlib I_STDLIB
19087 #ifdef I_STDLIB
19088 #include <stdlib.h>
19089 #endif
19090 int main() { printf("%d\n", bar1()); exit(0); }
19091 EOP
19092 $cc $ccflags -c bar1.c >/dev/null 2>&1
19093 $cc $ccflags -c bar2.c >/dev/null 2>&1
19094 $cc $ccflags -c foo.c >/dev/null 2>&1
19095 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19096 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19097         $run ./foobar >/dev/null 2>&1; then
19098         echo "$ar appears to generate random libraries itself."
19099         orderlib=false
19100         if [ "X$ranlib" = "X" ]; then
19101             ranlib=":"
19102         fi
19103 elif $ar ts bar$_a >/dev/null 2>&1 &&
19104         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19105         $run ./foobar >/dev/null 2>&1; then
19106                 echo "a table of contents needs to be added with '$ar ts'."
19107                 orderlib=false
19108                 ranlib="$ar ts"
19109 else
19110         case "$ranlib" in
19111         :) ranlib='';;
19112         '')
19113                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19114                 $test -f $ranlib || ranlib=''
19115                 ;;
19116         esac
19117         if $test -n "$ranlib"; then
19118                 echo "your system has '$ranlib'; we'll use that."
19119                 orderlib=false
19120         else
19121                 echo "your system doesn't seem to support random libraries"
19122                 echo "so we'll use lorder and tsort to order the libraries."
19123                 orderlib=true
19124                 ranlib=":"
19125         fi
19126 fi
19127 $rm -f foo* bar* 
19128
19129 : check for type of arguments to select. 
19130 case "$selecttype" in
19131 '') case "$d_select" in
19132         $define)
19133                 echo " "
19134                 $cat <<EOM
19135 Checking to see what type of arguments are accepted by select().
19136 EOM
19137                 hdrs="$define sys/types.h
19138                         $i_systime sys/time.h 
19139                         $i_sysselct sys/select.h
19140                         $d_socket sys/socket.h"
19141                 : The first arg can be int, unsigned, or size_t
19142                 : The last arg may or may not be 'const'
19143                 val=''
19144                 : void pointer has been seen but using that
19145                 : breaks the selectminbits test
19146                 for xxx in 'fd_set *' 'int *'; do
19147                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19148                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
19149                                         case "$val" in
19150                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19151                                                 if ./protochk "$try" $hdrs; then
19152                                                         echo "Your system accepts $xxx."
19153                                                         val="$xxx"
19154                                                 fi
19155                                                 ;;
19156                                         esac
19157                                 done
19158                         done
19159                 done
19160                 case "$val" in
19161                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19162                         case "$d_fd_set" in
19163                                 $define) dflt="fd_set *" ;;
19164                                 *)              dflt="int *" ;;
19165                         esac
19166                         . ./myread
19167                         val=$ans
19168                         ;;
19169                 esac
19170                 selecttype="$val"
19171                 ;;
19172         *)      : no select, so pick a harmless default
19173                 selecttype='int *'
19174                 ;;
19175         esac
19176         ;;
19177 esac
19178
19179 : check for the select 'width'
19180 case "$selectminbits" in
19181 '') safebits=`expr $ptrsize \* 8`
19182     case "$d_select" in
19183         $define)
19184                 $cat <<EOM
19185
19186 Checking to see on how many bits at a time your select() operates...
19187 EOM
19188                 $cat >try.c <<EOCP
19189 #include <sys/types.h>
19190 #$i_time I_TIME
19191 #$i_systime I_SYS_TIME
19192 #$i_systimek I_SYS_TIME_KERNEL
19193 #ifdef I_TIME
19194 #   include <time.h>
19195 #endif
19196 #ifdef I_SYS_TIME
19197 #   ifdef I_SYS_TIME_KERNEL
19198 #       define KERNEL
19199 #   endif
19200 #   include <sys/time.h>
19201 #   ifdef I_SYS_TIME_KERNEL
19202 #       undef KERNEL
19203 #   endif
19204 #endif
19205 #$i_sysselct I_SYS_SELECT
19206 #ifdef I_SYS_SELECT
19207 #include <sys/select.h>
19208 #endif
19209 #$d_socket HAS_SOCKET
19210 #ifdef HAS_SOCKET
19211 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19212 #endif
19213 #include <stdio.h>
19214 #$i_stdlib I_STDLIB
19215 #ifdef I_STDLIB
19216 #include <stdlib.h>
19217 #endif
19218 $selecttype b;
19219 #define S sizeof(*(b))
19220 #define MINBITS 64
19221 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19222 #define NBITS  (NBYTES * 8)
19223 int main() {
19224     char *s = malloc(NBYTES);
19225     struct timeval t;
19226     int i;
19227     FILE* fp;
19228     int fd;
19229
19230     if (!s)
19231         exit(1);
19232     fclose(stdin);
19233     fp = fopen("try.c", "r");
19234     if (fp == 0)
19235       exit(2);
19236     fd = fileno(fp);
19237     if (fd < 0)
19238       exit(3);
19239     b = ($selecttype)s;
19240     for (i = 0; i < NBITS; i++)
19241         FD_SET(i, b);
19242     t.tv_sec  = 0;
19243     t.tv_usec = 0;
19244     select(fd + 1, b, 0, 0, &t);
19245     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
19246     free(s);
19247     printf("%d\n", i + 1);
19248     return 0;
19249 }
19250 EOCP
19251                 set try
19252                 if eval $compile_ok; then
19253                         selectminbits=`$run ./try`
19254                         case "$selectminbits" in
19255                         '')     cat >&4 <<EOM
19256 Cannot figure out on how many bits at a time your select() operates.
19257 I'll play safe and guess it is $safebits bits.
19258 EOM
19259                                 selectminbits=$safebits
19260                                 bits="$safebits bits"
19261                                 ;;
19262                         1)      bits="1 bit" ;;
19263                         *)      bits="$selectminbits bits" ;;
19264                         esac
19265                         echo "Your select() operates on $bits at a time." >&4
19266                 else
19267                         rp='What is the minimum number of bits your select() operates on?'
19268                         case "$byteorder" in
19269                         12345678)       dflt=64 ;;
19270                         1234)           dflt=32 ;;
19271                         *)              dflt=1  ;;
19272                         esac
19273                         . ./myread
19274                         val=$ans
19275                         selectminbits="$val"
19276                 fi
19277                 $rm -f try.* try
19278                 ;;
19279         *)      : no select, so pick a harmless default
19280                 selectminbits=$safebits
19281                 ;;
19282         esac
19283         ;;
19284 esac
19285
19286 : Trace out the files included by signal.h, then look for SIGxxx names.
19287 : Remove SIGARRAYSIZE used by HPUX.
19288 : Remove SIGSTKSIZE used by Linux.
19289 : Remove SIGSTKSZ used by Posix.
19290 : Remove SIGTYP void lines used by OS2.
19291 : Some cpps, like os390, dont give the file name anywhere
19292 if [ "X$fieldn" = X ]; then
19293         : Just make some guesses.  We check them later.
19294         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19295 else
19296         xxx=`echo '#include <signal.h>' |
19297         $cppstdin $cppminus $cppflags 2>/dev/null |
19298         $grep '^[       ]*#.*include' | 
19299         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
19300 fi
19301 : Check this list of files to be sure we have parsed the cpp output ok.
19302 : This will also avoid potentially non-existent files, such 
19303 : as ../foo/bar.h
19304 xxxfiles=''
19305 for xx in $xxx /dev/null ; do
19306         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19307 done
19308 : If we have found no files, at least try signal.h
19309 case "$xxxfiles" in
19310 '')     xxxfiles=`./findhdr signal.h` ;;
19311 esac
19312 xxx=`awk '
19313 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19314         print substr($2, 4, 20)
19315 }
19316 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19317         print substr($3, 4, 20)
19318 }' $xxxfiles`
19319 : Append some common names just in case the awk scan failed.
19320 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19321 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19322 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19323 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19324 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19325
19326 : generate a few handy files for later
19327 $cat > signal.c <<EOCP
19328 #include <sys/types.h>
19329 #include <signal.h>
19330 #$i_stdlib I_STDLIB
19331 #ifdef I_STDLIB
19332 #include <stdlib.h>
19333 #endif
19334 #include <stdio.h>
19335 int main() {
19336
19337 /* Strange style to avoid deeply-nested #if/#else/#endif */
19338 #ifndef NSIG
19339 #  ifdef _NSIG
19340 #    define NSIG (_NSIG)
19341 #  endif
19342 #endif
19343
19344 #ifndef NSIG
19345 #  ifdef SIGMAX
19346 #    define NSIG (SIGMAX+1)
19347 #  endif
19348 #endif
19349
19350 #ifndef NSIG
19351 #  ifdef SIG_MAX
19352 #    define NSIG (SIG_MAX+1)
19353 #  endif
19354 #endif
19355
19356 #ifndef NSIG
19357 #  ifdef _SIG_MAX
19358 #    define NSIG (_SIG_MAX+1)
19359 #  endif
19360 #endif
19361
19362 #ifndef NSIG
19363 #  ifdef MAXSIG
19364 #    define NSIG (MAXSIG+1)
19365 #  endif
19366 #endif
19367
19368 #ifndef NSIG
19369 #  ifdef MAX_SIG
19370 #    define NSIG (MAX_SIG+1)
19371 #  endif
19372 #endif
19373
19374 #ifndef NSIG
19375 #  ifdef SIGARRAYSIZE
19376 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
19377 #  endif
19378 #endif
19379
19380 #ifndef NSIG
19381 #  ifdef _sys_nsig
19382 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
19383 #  endif
19384 #endif
19385
19386 /* Default to some arbitrary number that's big enough to get most
19387    of the common signals.
19388 */
19389 #ifndef NSIG
19390 #    define NSIG 50
19391 #endif
19392
19393 printf("NSIG %d\n", NSIG);
19394
19395 #ifndef JUST_NSIG
19396
19397 EOCP
19398
19399 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19400 {
19401         printf "#ifdef SIG"; printf $1; printf "\n"
19402         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
19403         printf $1; printf ");\n"
19404         printf "#endif\n"
19405 }
19406 END {
19407         printf "#endif /* JUST_NSIG */\n";
19408         printf "exit(0);\n}\n";
19409 }
19410 ' >>signal.c
19411 $cat >signal.awk <<'EOP'
19412 BEGIN { ndups = 0 }
19413 $1 ~ /^NSIG$/ { nsig = $2 }
19414 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
19415     if ($2 > maxsig) { maxsig = $2 }
19416     if (sig_name[$2]) {
19417         dup_name[ndups] = $1
19418         dup_num[ndups] = $2
19419         ndups++ 
19420     }
19421     else {
19422         sig_name[$2] = $1
19423         sig_num[$2] = $2
19424     }
19425 }
19426 END { 
19427     if (nsig == 0) {
19428         nsig = maxsig + 1
19429     }
19430     printf("NSIG %d\n", nsig);
19431     for (n = 1; n < nsig; n++) {
19432         if (sig_name[n]) {
19433             printf("%s %d\n", sig_name[n], sig_num[n])
19434         }
19435         else {
19436             printf("NUM%d %d\n", n, n) 
19437         }
19438     }
19439     for (n = 0; n < ndups; n++) {
19440         printf("%s %d\n", dup_name[n], dup_num[n])
19441     }
19442 }
19443 EOP
19444 $cat >signal_cmd <<EOS
19445 $startsh
19446 if $test -s signal.lst; then
19447     echo "Using your existing signal.lst file"
19448         exit 0
19449 fi
19450 xxx="$xxx"
19451 EOS
19452 $cat >>signal_cmd <<'EOS'
19453
19454 set signal
19455 if eval $compile_ok; then
19456         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
19457 else
19458         echo "(I can't seem be able to compile the whole test program)" >&4
19459         echo "(I'll try it in little pieces.)" >&4
19460         set signal -DJUST_NSIG
19461         if eval $compile_ok; then
19462                 $run ./signal$_exe > signal.nsg
19463                 $cat signal.nsg
19464         else
19465                 echo "I can't seem to figure out how many signals you have." >&4
19466                 echo "Guessing 50." >&4
19467                 echo 'NSIG 50' > signal.nsg
19468         fi
19469         : Now look at all the signal names, one at a time.
19470         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
19471                 $cat > signal.c <<EOCP
19472 #include <sys/types.h>
19473 #include <signal.h>
19474 #include <stdio.h>
19475 int main() {
19476 printf("$xx %d\n", SIG${xx});
19477 return 0;
19478 }
19479 EOCP
19480                 set signal
19481                 if eval $compile; then
19482                         echo "SIG${xx} found."
19483                         $run ./signal$_exe  >> signal.ls1
19484                 else
19485                         echo "SIG${xx} NOT found."
19486                 fi
19487         done
19488         if $test -s signal.ls1; then
19489                 $cat signal.nsg signal.ls1 |
19490                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
19491         fi
19492
19493 fi
19494 if $test -s signal.lst; then
19495         :
19496 else
19497         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
19498         echo 'kill -l' >signal
19499         set X `csh -f <signal`
19500         $rm -f signal
19501         shift
19502         case $# in
19503         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
19504         esac
19505         echo $@ | $tr ' ' $trnl | \
19506             $awk '{ printf "%s %d\n", $1, ++s; }
19507                   END { printf "NSIG %d\n", ++s }' >signal.lst
19508 fi
19509 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
19510 EOS
19511 chmod a+x signal_cmd
19512 $eunicefix signal_cmd
19513
19514 : generate list of signal names
19515 echo " "
19516 case "$sig_name_init" in
19517 '') doinit=yes ;;
19518 *)  case "$sig_num_init" in
19519     ''|*,*) doinit=yes ;;
19520     esac ;;
19521 esac
19522 case "$doinit" in
19523 yes)
19524         echo "Generating a list of signal names and numbers..." >&4
19525         . ./signal_cmd
19526         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
19527         sig_name=`$awk 'BEGIN { printf "ZERO " }
19528                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
19529         sig_num=`$awk  'BEGIN { printf "0 " }
19530                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
19531         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
19532                              !/^NSIG/   { printf "\"%s\", ", $1 }
19533                              END        { printf "0\n" }' signal.lst`
19534         sig_num_init=`$awk  'BEGIN      { printf "0, " }
19535                              !/^NSIG/   { printf "%d, ", $2}
19536                              END        { printf "0\n"}' signal.lst`
19537         ;;
19538 esac
19539 echo "The following $sig_count signals are available:"
19540 echo " "
19541 echo $sig_name | $awk \
19542 'BEGIN { linelen = 0 }
19543 {
19544         for (i = 1; i <= NF; i++) {
19545                 name = "SIG" $i " "
19546                 linelen = linelen + length(name)
19547                 if (linelen > 70) {
19548                         printf "\n"
19549                         linelen = length(name)
19550                 }
19551                 printf "%s", name
19552         }
19553         printf "\n"
19554 }'
19555 sig_size=`echo $sig_name | awk '{print NF}'`
19556 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
19557
19558 echo " "
19559 case "$sizetype" in
19560 *_t) zzz="$sizetype"    ;;
19561 *)   zzz="filesize"     ;;
19562 esac
19563 echo "Checking the size of $zzz..." >&4 
19564 cat > try.c <<EOCP
19565 #include <sys/types.h>
19566 #include <stdio.h>
19567 #$i_stdlib I_STDLIB
19568 #ifdef I_STDLIB
19569 #include <stdlib.h>
19570 #endif
19571 int main() {
19572     printf("%d\n", (int)sizeof($sizetype));
19573     exit(0);
19574 }
19575 EOCP
19576 set try
19577 if eval $compile_ok; then
19578         yyy=`$run ./try`
19579         case "$yyy" in
19580         '')     sizesize=4
19581                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
19582                 ;;
19583         *)      sizesize=$yyy
19584                 echo "Your $zzz size is $sizesize bytes."
19585                 ;;
19586         esac
19587 else
19588         sizesize=4
19589         echo "(I can't compile the test program--guessing $sizesize.)" >&4
19590 fi
19591
19592
19593 : check for socklen_t
19594 echo " "
19595 echo "Checking to see if you have socklen_t..." >&4
19596 $cat >try.c <<EOCP
19597 #include <sys/types.h>
19598 #$d_socket HAS_SOCKET
19599 #ifdef HAS_SOCKET
19600 #include <sys/socket.h>
19601 #endif
19602 int main() { socklen_t x = 16; }
19603 EOCP
19604 set try
19605 if eval $compile; then
19606         val="$define"
19607         echo "You have socklen_t."
19608 else
19609         val="$undef"
19610         echo "You do not have socklen_t."
19611         case "$sizetype" in
19612         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
19613         esac
19614 fi
19615 $rm -f try try.*
19616 set d_socklen_t
19617 eval $setvar
19618
19619 : see if this is a socks.h system
19620 set socks.h i_socks
19621 eval $inhdr
19622
19623 : check for type of the size argument to socket calls
19624 case "$d_socket" in
19625 "$define")
19626         $cat <<EOM
19627
19628 Checking to see what type is the last argument of accept().
19629 EOM
19630         yyy=''
19631         case "$d_socklen_t" in
19632         "$define") yyy="$yyy socklen_t"
19633         esac
19634         yyy="$yyy $sizetype int long unsigned"
19635         for xxx in $yyy; do
19636                 case "$socksizetype" in
19637                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
19638                         case "$usesocks" in
19639                         "$define")
19640                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
19641                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19642                                         socksizetype="$xxx"
19643                                 fi
19644                                 ;;
19645                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
19646                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19647                                         socksizetype="$xxx"
19648                                 fi
19649                                 ;;
19650                         esac
19651                         ;;
19652                 esac
19653         done
19654 : In case none of those worked, prompt the user.
19655         case "$socksizetype" in
19656         '')     rp='What is the type for socket address structure sizes?'
19657                 dflt='int'
19658                 . ./myread
19659                 socksizetype=$ans
19660                 ;;
19661         esac
19662         ;;
19663 *)      : no sockets, so pick relatively harmless default
19664         socksizetype='int'
19665         ;;
19666 esac
19667
19668 : see what type is used for signed size_t
19669 set ssize_t ssizetype int stdio.h sys/types.h
19670 eval $typedef
19671 dflt="$ssizetype"
19672 $cat > try.c <<EOM
19673 #include <stdio.h>
19674 #$i_stdlib I_STDLIB
19675 #ifdef I_STDLIB
19676 #include <stdlib.h>
19677 #endif
19678 #include <sys/types.h>
19679 #define Size_t $sizetype
19680 #define SSize_t $dflt
19681 int main()
19682 {
19683         if (sizeof(Size_t) == sizeof(SSize_t))
19684                 printf("$dflt\n");
19685         else if (sizeof(Size_t) == sizeof(int))
19686                 printf("int\n");
19687         else 
19688                 printf("long\n");
19689         exit(0);
19690 }
19691 EOM
19692 echo " "
19693 set try
19694 if eval $compile_ok && $run ./try > /dev/null; then
19695         ssizetype=`$run ./try`
19696         echo "I'll be using $ssizetype for functions returning a byte count." >&4
19697 else
19698         $cat >&4 <<EOM
19699 Help! I can't compile and run the ssize_t test program: please enlighten me!
19700 (This is probably a misconfiguration in your system or libraries, and
19701 you really ought to fix it.  Still, I'll try anyway.)
19702
19703 I need a type that is the same size as $sizetype, but is guaranteed to
19704 be signed.  Common values are ssize_t, int and long.
19705
19706 EOM
19707         rp="What signed type is the same size as $sizetype?"
19708         . ./myread
19709         ssizetype="$ans"
19710 fi
19711 $rm -f try try.*
19712
19713 : see what type of char stdio uses.
19714 echo " "
19715 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
19716 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
19717         echo "Your stdio uses unsigned chars." >&4
19718         stdchar="unsigned char"
19719 else
19720         echo "Your stdio uses signed chars." >&4
19721         stdchar="char"
19722 fi
19723 $rm -f stdioh
19724
19725
19726
19727 : see what type uids are declared as in the kernel
19728 echo " "
19729 echo "Looking for the type for user ids returned by getuid()."
19730 set uid_t uidtype xxx stdio.h sys/types.h
19731 eval $typedef
19732 case "$uidtype" in
19733 xxx)
19734         xxx=`./findhdr sys/user.h`
19735         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
19736         case $1 in
19737         unsigned) dflt="$1 $2" ;;
19738         *) dflt="$1" ;;
19739         esac
19740         ;;
19741 *) dflt="$uidtype";;
19742 esac
19743 case "$uidtype" in
19744 uid_t)  echo "uid_t found." ;;
19745 *)      rp="What is the type for user ids returned by getuid()?"
19746         . ./myread
19747         uidtype="$ans"
19748         ;;
19749 esac
19750
19751 echo " "
19752 case "$uidtype" in
19753 *_t) zzz="$uidtype"     ;;
19754 *)   zzz="uid"          ;;
19755 esac
19756 echo "Checking the size of $zzz..." >&4 
19757 cat > try.c <<EOCP
19758 #include <sys/types.h>
19759 #include <stdio.h>
19760 #$i_stdlib I_STDLIB
19761 #ifdef I_STDLIB
19762 #include <stdlib.h>
19763 #endif
19764 int main() {
19765     printf("%d\n", (int)sizeof($uidtype));
19766     exit(0);
19767 }
19768 EOCP
19769 set try
19770 if eval $compile_ok; then
19771         yyy=`$run ./try`
19772         case "$yyy" in
19773         '')     uidsize=4
19774                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
19775                 ;;
19776         *)      uidsize=$yyy
19777                 echo "Your $zzz is $uidsize bytes long."
19778                 ;;
19779         esac
19780 else
19781         uidsize=4
19782         echo "(I can't compile the test program--guessing $uidsize.)" >&4
19783 fi
19784
19785 echo " "
19786 case "$uidtype" in
19787 *_t) zzz="$uidtype"     ;;
19788 *)   zzz="uid"          ;;
19789 esac
19790 echo "Checking the sign of $zzz..." >&4
19791 cat > try.c <<EOCP
19792 #include <sys/types.h>
19793 #include <stdio.h>
19794 int main() {
19795         $uidtype foo = -1;
19796         if (foo < 0)
19797                 printf("-1\n");
19798         else
19799                 printf("1\n");
19800 }
19801 EOCP
19802 set try
19803 if eval $compile; then
19804         yyy=`$run ./try`
19805         case "$yyy" in
19806         '')     uidsign=1
19807                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19808                 ;;
19809         *)      uidsign=$yyy
19810                 case "$uidsign" in
19811                  1) echo "Your $zzz is unsigned." ;;
19812                 -1) echo "Your $zzz is signed."   ;;
19813                 esac
19814                 ;;
19815         esac
19816 else
19817         uidsign=1
19818         echo "(I can't compile the test program--guessing unsigned.)" >&4
19819 fi
19820
19821
19822
19823 echo " "
19824 $echo "Checking the format string to be used for uids..." >&4
19825
19826 case "$uidsign" in
19827 -1)     if $test X"$uidsize" = X"$ivsize"; then
19828                 uidformat="$ivdformat"
19829         else
19830                 if $test X"$uidsize" = X"$longsize"; then
19831                         uidformat='"ld"'
19832                 else
19833                         if $test X"$uidsize" = X"$intsize"; then
19834                                 uidformat='"d"'
19835                         else
19836                                 if $test X"$uidsize" = X"$shortsize"; then
19837                                         uidformat='"hd"'
19838                                 fi
19839                         fi
19840                 fi
19841         fi
19842         ;;
19843 *)      if $test X"$uidsize" = X"$uvsize"; then
19844                 uidformat="$uvuformat"
19845         else
19846                 if $test X"$uidsize" = X"$longsize"; then
19847                         uidformat='"lu"'
19848                 else
19849                         if $test X"$uidsize" = X"$intsize"; then
19850                                 uidformat='"u"'
19851                         else
19852                                 if $test X"$uidsize" = X"$shortsize"; then
19853                                         uidformat='"hu"'
19854                                 fi
19855                         fi
19856                 fi
19857         fi
19858         ;;
19859 esac
19860
19861
19862 case "$usesitecustomize" in
19863     $define|true|[Yy]*)
19864         usesitecustomize="$define"
19865         ;;
19866     *)
19867         usesitecustomize="$undef"
19868         ;;
19869     esac
19870
19871 : determine compiler compiler
19872 case "$yacc" in
19873 '')
19874         dflt=yacc;;
19875 *)
19876         dflt="$yacc";;
19877 esac
19878 echo " "
19879 comp='yacc'
19880 if $test -f "$byacc$_exe"; then
19881         dflt="$byacc"
19882         comp="byacc or $comp"
19883 fi
19884 if $test -f "$bison$_exe"; then
19885         comp="$comp or bison -y"
19886 fi
19887 rp="Which compiler compiler ($comp) shall I use?"
19888 . ./myread
19889 yacc="$ans"
19890 case "$yacc" in
19891 *bis*)
19892         case "$yacc" in
19893         *-y*) ;;
19894         *)
19895                 yacc="$yacc -y"
19896                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
19897                 ;;
19898         esac
19899         ;;
19900 esac
19901
19902 : see if this is a fp.h system
19903 set fp.h i_fp
19904 eval $inhdr
19905
19906 : see if this is a fp_class.h system
19907 set fp_class.h i_fp_class
19908 eval $inhdr
19909
19910 : see if this is a ieeefp.h system
19911 case "$i_ieeefp" in
19912 '' ) set ieeefp.h i_ieeefp
19913      eval $inhdr
19914      ;;
19915 esac
19916
19917 : see if this is a libutil.h system
19918 set libutil.h i_libutil
19919 eval $inhdr
19920
19921 : see if mach cthreads are available
19922 if test "X$usethreads" = "X$define"; then
19923         set mach/cthreads.h i_machcthr
19924         eval $inhdr
19925 else
19926         i_machcthr="$undef"
19927 fi
19928
19929
19930
19931 : see if this is a mntent.h system
19932 set mntent.h i_mntent
19933 eval $inhdr
19934
19935 : see if ndbm.h is available
19936 set ndbm.h t_ndbm
19937 eval $inhdr
19938
19939 case "$t_ndbm" in
19940 $undef)
19941     # Some Linux distributions such as RedHat 7.1 put the
19942     # ndbm.h header in /usr/include/gdbm/ndbm.h.
19943     if $test -f /usr/include/gdbm/ndbm.h; then
19944         echo '<gdbm/ndbm.h> found.'
19945         ccflags="$ccflags -I/usr/include/gdbm"
19946         cppflags="$cppflags -I/usr/include/gdbm"
19947         t_ndbm=$define
19948     fi
19949     ;;
19950 esac
19951
19952 case "$t_ndbm" in
19953 $define)
19954         : see if dbm_open exists
19955         set dbm_open d_dbm_open
19956         eval $inlibc
19957         case "$d_dbm_open" in
19958         $undef)
19959                 t_ndbm="$undef"
19960                 echo "We won't be including <ndbm.h>"
19961                 ;;
19962         esac
19963         ;;
19964 esac
19965 val="$t_ndbm"
19966 set i_ndbm
19967 eval $setvar
19968
19969 : see if net/errno.h is available
19970 val=''
19971 set net/errno.h val
19972 eval $inhdr
19973
19974 : Unfortunately, it causes problems on some systems.  Arrgh.
19975 case "$val" in
19976 $define)
19977         cat > try.c <<'EOM'
19978 #include <stdio.h>
19979 #include <errno.h>
19980 #include <net/errno.h>
19981 int func()
19982 {
19983         return ENOTSOCK;
19984 }
19985 EOM
19986         if $cc $ccflags -c try.c >/dev/null 2>&1; then
19987                 echo "We'll be including <net/errno.h>." >&4
19988         else
19989                 echo "We won't be including <net/errno.h>." >&4
19990                 val="$undef"
19991         fi
19992         $rm -f try.* try
19993         ;;
19994 esac
19995 set i_neterrno
19996 eval $setvar
19997
19998 : see if netinet/tcp.h is available
19999 set netinet/tcp.h i_netinettcp
20000 eval $inhdr
20001
20002 : see if this is a poll.h system
20003 set poll.h i_poll
20004 eval $inhdr
20005
20006 : see if this is a prot.h system
20007 set prot.h i_prot
20008 eval $inhdr
20009
20010 echo " "
20011 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
20012 $cat <<'EOSH' > Cppsym.know
20013 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20014 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20015 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20016 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20017 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20018 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20019 bull c cadmus clipper CMU COFF COMPILER_VERSION
20020 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20021 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20022 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20023 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20024 GLIBC GLIBC_MINOR
20025 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20026 H3050R H3050RX hbullx20 hcx host_mips
20027 hp200 hp300 hp700 HP700 hp800 hp9000
20028 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20029 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20030 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20031 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20032 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20033 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20034 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20035 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20036 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20037 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20038 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20039 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20040 MATH_HAS_NO_SIDE_EFFECTS
20041 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20042 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20043 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20044 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20045 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20046 NetBSD news1500 news1700 news1800 news1900 news3700
20047 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20048 ns32016 ns32332 ns32k nsc32000
20049 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20050 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20051 pc532 pdp11 PGC PIC plexus PORTAR posix
20052 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20053 POSIX_C_SOURCE POSIX_SOURCE POWER
20054 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
20055 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20056 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20057 sony sony_news sonyrisc sparc sparclite spectrum
20058 stardent stdc STDC_EXT stratos sun sun3 sun386
20059 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20060 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20061 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20062 sysV68 sysV88 Tek4132 Tek4300 titan
20063 TM3200 TM5400 TM5600
20064 tower tower32 tower32_200 tower32_600 tower32_700
20065 tower32_800 tower32_850 tss
20066 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20067 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20068 unix UNIX95 UNIX99 unixpc unos
20069 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20070 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20071 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20072 USGr4 USGr4_2
20073 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20074 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20075 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20076 z8000
20077 EOSH
20078 # Maybe put other stuff here too.
20079 cat <<EOSH >>Cppsym.know
20080 $osname
20081 EOSH
20082 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20083 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20084 $cat Cppsym.know > Cppsym.c
20085 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20086 $rm -f Cppsym.a Cppsym.b Cppsym.c
20087 cat <<EOSH > Cppsym
20088 $startsh
20089 if $test \$# -gt 0; then
20090     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20091     if $test -s Cppsym.got; then
20092         $rm -f Cppsym.got
20093         exit 0
20094     fi
20095     $rm -f Cppsym.got
20096     exit 1
20097 else
20098     $tr " " "$trnl" | ./Cppsym.try
20099     exit 0
20100 fi
20101 EOSH
20102 chmod +x Cppsym
20103 $eunicefix Cppsym
20104 cat <<EOSH > Cppsym.try
20105 $startsh
20106 cat <<'EOCP' > try.c
20107 #include <stdio.h>
20108 int main() {
20109 EOCP
20110 $awk \\
20111 EOSH
20112 cat <<'EOSH' >> Cppsym.try
20113 'length($1) > 0 {
20114     printf "#ifdef %s\n#if %s+0\nprintf(\"%s=%%ld\\n\", (long)%s);\n#else\nprintf(\"%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
20115     printf "#ifdef _%s\n#if _%s+0\nprintf(\"_%s=%%ld\\n\", (long)_%s);\n#else\nprintf(\"_%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
20116     printf "#ifdef __%s\n#if __%s+0\nprintf(\"__%s=%%ld\\n\", (long)__%s);\n#else\nprintf(\"__%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
20117     printf "#ifdef __%s__\n#if __%s__+0\nprintf(\"__%s__=%%ld\\n\", (long)__%s__);\n#else\nprintf(\"__%s__\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
20118 }'       >> try.c
20119 echo 'return 0;}' >> try.c
20120 EOSH
20121 cat <<EOSH >> Cppsym.try
20122 ccflags="$ccflags"
20123 case "$osname-$gccversion" in
20124 irix-) ccflags="\$ccflags -woff 1178" ;;
20125 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20126 esac
20127 $cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
20128 EOSH
20129 chmod +x Cppsym.try
20130 $eunicefix Cppsym.try
20131 ./Cppsym < Cppsym.know > Cppsym.true
20132 : now check the C compiler for additional symbols
20133 postprocess_cc_v=''
20134 case "$osname" in
20135 aix) postprocess_cc_v="|$tr , ' '" ;;
20136 esac
20137 $cat >ccsym <<EOS
20138 $startsh
20139 $cat >tmp.c <<EOF
20140 extern int foo;
20141 EOF
20142 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20143 do
20144         case "\$i" in
20145         -D*) echo "\$i" | $sed 's/^-D//';;
20146         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
20147         esac
20148 done
20149 $rm -f try.c
20150 EOS
20151 postprocess_cc_v=''
20152 chmod +x ccsym
20153 $eunicefix ccsym
20154 ./ccsym > ccsym1.raw
20155 if $test -s ccsym1.raw; then
20156        $sort ccsym1.raw | $uniq >ccsym.raw
20157 else
20158        mv ccsym1.raw ccsym.raw
20159 fi
20160
20161 $awk '/\=/ { print $0; next }
20162         { print $0"=1" }' ccsym.raw >ccsym.list
20163 $awk '/\=/ { print $0; next }
20164         { print $0"=1" }' Cppsym.true >ccsym.true
20165 $comm -13 ccsym.true ccsym.list >ccsym.own
20166 $comm -12 ccsym.true ccsym.list >ccsym.com
20167 $comm -23 ccsym.true ccsym.list >ccsym.cpp
20168 also=''
20169 if $test -z ccsym.raw; then
20170         echo "Your C compiler doesn't seem to define any symbols!" >&4
20171         echo " "
20172         echo "However, your C preprocessor defines the following symbols:"
20173         $cat Cppsym.true
20174         ccsymbols=''
20175         cppsymbols=`$cat Cppsym.true`
20176         cppsymbols=`echo $cppsymbols`
20177         cppccsymbols="$cppsymbols"
20178 else
20179         if $test -s ccsym.com; then
20180                 echo "Your C compiler and pre-processor define these symbols:"
20181                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20182                 also='also '
20183                 symbols='ones'
20184                 cppccsymbols=`$cat ccsym.com`
20185                 cppccsymbols=`echo $cppccsymbols`
20186                 $test "$silent" || sleep 1
20187         fi
20188         if $test -s ccsym.cpp; then
20189                 $test "$also" && echo " "
20190                 echo "Your C pre-processor ${also}defines the following symbols:"
20191                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20192                 also='further '
20193                 cppsymbols=`$cat ccsym.cpp`
20194                 cppsymbols=`echo $cppsymbols`
20195                 $test "$silent" || sleep 1
20196         fi
20197         if $test -s ccsym.own; then
20198                 $test "$also" && echo " "
20199                 echo "Your C compiler ${also}defines the following cpp symbols:"
20200                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20201                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20202                 ccsymbols=`$cat ccsym.own`
20203                 ccsymbols=`echo $ccsymbols`
20204                 $test "$silent" || sleep 1
20205         fi
20206 fi
20207
20208 : see if this is a termio system
20209 val="$undef"
20210 val2="$undef"
20211 val3="$undef"
20212 if $test `./findhdr termios.h`; then
20213         set tcsetattr i_termios
20214         eval $inlibc
20215         val3="$i_termios"
20216 fi
20217 echo " "
20218 case "$val3" in
20219 "$define") echo "You have POSIX termios.h... good!" >&4;;
20220 *) if ./Cppsym pyr; then
20221                 case "`/bin/universe`" in
20222                 ucb) if $test `./findhdr sgtty.h`; then
20223                                 val2="$define"
20224                                 echo "<sgtty.h> found." >&4
20225                         else
20226                                 echo "System is pyramid with BSD universe."
20227                                 echo "<sgtty.h> not found--you could have problems." >&4
20228                         fi;;
20229                 *) if $test `./findhdr termio.h`; then
20230                                 val="$define"
20231                                 echo "<termio.h> found." >&4
20232                         else
20233                                 echo "System is pyramid with USG universe."
20234                                 echo "<termio.h> not found--you could have problems." >&4
20235                         fi;;
20236                 esac
20237         elif ./usg; then
20238                 if $test `./findhdr termio.h`; then
20239                         echo "<termio.h> found." >&4
20240                         val="$define"
20241                 elif $test `./findhdr sgtty.h`; then
20242                         echo "<sgtty.h> found." >&4
20243                         val2="$define"
20244                 else
20245 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20246                 fi
20247         else
20248                 if $test `./findhdr sgtty.h`; then
20249                         echo "<sgtty.h> found." >&4
20250                         val2="$define"
20251                 elif $test `./findhdr termio.h`; then
20252                         echo "<termio.h> found." >&4
20253                         val="$define"
20254                 else
20255 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20256                 fi
20257         fi;;
20258 esac
20259 set i_termio; eval $setvar
20260 val=$val2; set i_sgtty; eval $setvar
20261 val=$val3; set i_termios; eval $setvar
20262
20263 : see if stddef is available
20264 set stddef.h i_stddef
20265 eval $inhdr
20266
20267 : see if this is a sunmath.h system
20268 set sunmath.h i_sunmath
20269 eval $inhdr
20270
20271 : see if sys/access.h is available
20272 set sys/access.h i_sysaccess
20273 eval $inhdr
20274
20275 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20276 set sys/filio.h i_sysfilio
20277 eval $inhdr
20278 echo " "
20279 if $test `./findhdr sys/ioctl.h`; then
20280         val="$define"
20281         echo '<sys/ioctl.h> found.' >&4
20282 else
20283         val="$undef"
20284         if $test $i_sysfilio = "$define"; then
20285             echo '<sys/ioctl.h> NOT found.' >&4
20286         else
20287                 $test $i_sgtty = "$define" && xxx="sgtty.h"
20288                 $test $i_termio = "$define" && xxx="termio.h"
20289                 $test $i_termios = "$define" && xxx="termios.h"
20290 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20291         fi
20292 fi
20293 set i_sysioctl
20294 eval $setvar
20295
20296 : see if socket ioctl defs are in sys/sockio.h
20297 echo " "
20298 xxx=`./findhdr sys/sockio.h`
20299 if $test "$xxx"; then
20300         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20301                 val="$define"
20302                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20303         else
20304                 val="$undef"
20305                 echo "No socket ioctls found in <sys/sockio.h>." >&4
20306         fi
20307 else
20308         val="$undef"
20309         $cat <<EOM
20310 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20311 EOM
20312 fi
20313 set i_syssockio
20314 eval $setvar
20315
20316
20317 : see if this is a syslog.h system
20318 set syslog.h i_syslog
20319 eval $inhdr
20320
20321
20322 : see if this is a sys/mode.h system
20323 set sys/mode.h i_sysmode
20324 eval $inhdr
20325
20326 : see if sys/resource.h has to be included
20327 set sys/resource.h i_sysresrc
20328 eval $inhdr
20329
20330 : see if sys/security.h is available
20331 set sys/security.h i_syssecrt
20332 eval $inhdr
20333
20334 : see if this is a sys/statvfs.h system
20335 set sys/statvfs.h i_sysstatvfs
20336 eval $inhdr
20337
20338 : see if this is a sys/un.h system
20339 set sys/un.h i_sysun
20340 eval $inhdr
20341
20342
20343 : see if this is a sys/utsname.h system
20344 set sys/utsname.h i_sysutsname
20345 eval $inhdr
20346
20347 : see if this is a syswait system
20348 set sys/wait.h i_syswait
20349 eval $inhdr
20350
20351 : see if this is a ustat.h system
20352 set ustat.h i_ustat
20353 eval $inhdr
20354
20355 : see if this is an utime system
20356 set utime.h i_utime
20357 eval $inhdr
20358
20359 : see if this is a values.h system
20360 set values.h i_values
20361 eval $inhdr
20362
20363 : see if this is a vfork system
20364 case "$d_vfork" in
20365 "$define")
20366         set vfork.h i_vfork
20367         eval $inhdr
20368         ;;
20369 *)
20370         i_vfork="$undef"
20371         ;;
20372 esac
20373
20374 : see if gdbm.h is available
20375 set gdbm.h t_gdbm
20376 eval $inhdr
20377 case "$t_gdbm" in
20378 $define)
20379         : see if gdbm_open exists
20380         set gdbm_open d_gdbm_open
20381         eval $inlibc
20382         case "$d_gdbm_open" in
20383         $undef)
20384                 t_gdbm="$undef"
20385                 echo "We won't be including <gdbm.h>"
20386                 ;;
20387         esac
20388         ;;
20389 esac
20390 val="$t_gdbm"
20391 set i_gdbm
20392 eval $setvar
20393
20394 echo " "
20395 echo "Looking for extensions..." >&4
20396 : If we are using the old config.sh, known_extensions may contain
20397 : old or inaccurate or duplicate values.
20398 known_extensions=''
20399 nonxs_extensions=''
20400 : We do not use find because it might not be available.
20401 : We do not just use MANIFEST because the user may have dropped
20402 : some additional extensions into the source tree and expect them
20403 : to be built.
20404
20405 : Function to recursively find available extensions, ignoring DynaLoader
20406 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
20407 find_extensions='
20408     for xxx in *; do
20409        case "$xxx" in
20410            DynaLoader|dynaload) ;;
20411            *)
20412            if $test -f $xxx/$xxx.xs; then
20413                known_extensions="$known_extensions $1$xxx";
20414            elif $test -f $xxx/Makefile.PL; then
20415                nonxs_extensions="$nonxs_extensions $1$xxx";
20416            else
20417                if $test -d $xxx -a $# -lt 10; then
20418                    set $1$xxx/ $*;
20419                    cd "$xxx";
20420                    eval $find_extensions;
20421                    cd ..;
20422                    shift;
20423                fi;
20424            fi
20425            ;;
20426        esac;
20427     done'
20428 tdir=`pwd`
20429 cd "$rsrc/ext"
20430 set X
20431 shift
20432 eval $find_extensions
20433 # Special case:  Add in threads/shared since it is not picked up by the
20434 # recursive find above (and adding in general recursive finding breaks
20435 # SDBM_File/sdbm).  A.D.  10/25/2001.
20436 known_extensions="$known_extensions threads/shared"
20437 set X $nonxs_extensions
20438 shift
20439 nonxs_extensions="$*"
20440 set X $known_extensions
20441 shift
20442 known_extensions="$*"
20443 cd "$tdir"
20444
20445 : Now see which are supported on this system.
20446 avail_ext=''
20447 for xxx in $known_extensions ; do
20448         case "$xxx" in
20449         DB_File|db_file)
20450                 case "$i_db" in
20451                 $define) avail_ext="$avail_ext $xxx" ;;
20452                 esac
20453                 ;;
20454         GDBM_File|gdbm_fil)
20455                 case "$i_gdbm" in 
20456                 $define) avail_ext="$avail_ext $xxx" ;;
20457                 esac
20458                 ;;
20459         I18N/Langinfo|i18n_lan)
20460                 case "$i_langinfo$d_nl_langinfo" in 
20461                 $define$define) avail_ext="$avail_ext $xxx" ;;
20462                 esac
20463                 ;;
20464         NDBM_File|ndbm_fil)
20465                 case "$i_ndbm" in
20466                 $define)
20467                     case "$osname-$use64bitint" in
20468                     hpux-define)
20469                         case "$libs" in
20470                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
20471                         esac
20472                         ;;
20473                     *) avail_ext="$avail_ext $xxx" ;;
20474                     esac
20475                     ;;
20476                 esac
20477                 ;;
20478         ODBM_File|odbm_fil) 
20479                 case "${i_dbm}${i_rpcsvcdbm}" in
20480                 *"${define}"*)
20481                     case "$osname-$use64bitint" in
20482                     hpux-define)
20483                         case "$libs" in
20484                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
20485                         esac
20486                         ;;
20487                     *) avail_ext="$avail_ext $xxx" ;;
20488                     esac
20489                     ;;
20490                 esac
20491                 ;;
20492         POSIX|posix)
20493                 case "$useposix" in
20494                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20495                 esac
20496                 ;;
20497         Opcode|opcode)
20498                 case "$useopcode" in
20499                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20500                 esac
20501                 ;;
20502         Socket|socket)
20503                 case "$d_socket" in 
20504                 true|$define|y)
20505                     case "$osname" in
20506                     beos) ;; # not unless BONE
20507                     *) avail_ext="$avail_ext $xxx" ;;
20508                     esac
20509                     ;;
20510                 esac
20511                 ;;
20512         Sys/Syslog|sys/syslog)
20513                 : XXX syslog requires socket
20514                 case "$d_socket" in 
20515                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
20516                 esac
20517                 ;;
20518         Thread|thread)
20519                 case "$usethreads" in
20520                 true|$define|y)
20521                         case "$useithreads" in
20522                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
20523                         esac
20524                 esac
20525                 ;;
20526         XS/APItest|xs/apitest)
20527                 # This is just for testing.  Skip it unless we have dynamic loading.
20528
20529                 case "$usedl" in
20530                 $define) avail_ext="$avail_ext $xxx" ;;
20531                 esac
20532                 ;;
20533         XS/Typemap|xs/typemap)
20534                 # This is just for testing.  Skip it unless we have dynamic loading.
20535                 case "$usedl" in
20536                 $define) avail_ext="$avail_ext $xxx" ;;
20537                 esac
20538                 ;;
20539         threads|threads/shared)
20540                 # threads and threads::shared are special cases.
20541                 # To stop people from asking "Perl 5.8.0 was supposed
20542                 # to have this new fancy threads implementation but my
20543                 # perl doesn't have it" and from people trying to
20544                 # (re)install the threads module using CPAN.pm and
20545                 # CPAN.pm then offering to reinstall Perl 5.8.0,
20546                 # the threads.pm and threads/shared.pm will always be
20547                 # there, croaking informatively ("you need to rebuild
20548                 # all of Perl with threads, sorry") when threads haven't
20549                 # been compiled in.
20550                 # --jhi
20551                 avail_ext="$avail_ext $xxx"
20552                 ;;
20553         IPC/SysV|ipc/sysv)
20554                 : XXX Do we need a useipcsysv variable here
20555                 case "${d_msg}${d_sem}${d_shm}" in 
20556                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
20557                 esac
20558                 ;;
20559         *)      avail_ext="$avail_ext $xxx"
20560                 ;;
20561         esac
20562 done
20563
20564 set X $avail_ext
20565 shift
20566 avail_ext="$*"
20567
20568 case "$onlyextensions" in
20569 '') ;;
20570 *)  keepextensions=''
20571     echo "You have requested that only certains extensions be included..." >&4
20572     for i in $onlyextensions; do
20573         case " $avail_ext " in
20574         *" $i "*)
20575             echo "Keeping extension $i."
20576             keepextensions="$keepextensions $i"
20577             ;;
20578         *) echo "Ignoring extension $i." ;;
20579         esac
20580     done
20581     avail_ext="$keepextensions"
20582     ;;
20583 esac
20584
20585 case "$noextensions" in
20586 '') ;;
20587 *)  keepextensions=''
20588     echo "You have requested that certain extensions be ignored..." >&4
20589     for i in $avail_ext; do
20590         case " $noextensions " in
20591         *" $i "*) echo "Ignoring extension $i." ;;
20592         *) echo "Keeping extension $i.";
20593            keepextensions="$keepextensions $i"
20594            ;;
20595         esac
20596     done
20597     avail_ext="$keepextensions"
20598     ;;
20599 esac
20600
20601 : Now see which nonxs extensions are supported on this system.
20602 : For now assume all are.
20603 nonxs_ext=''
20604 for xxx in $nonxs_extensions ; do
20605         case "$xxx" in
20606         *)      nonxs_ext="$nonxs_ext $xxx"
20607                 ;;
20608         esac
20609 done
20610
20611 set X $nonxs_ext
20612 shift
20613 nonxs_ext="$*"
20614
20615 case $usedl in
20616 $define)
20617         $cat <<EOM
20618 A number of extensions are supplied with $package.  You may choose to
20619 compile these extensions for dynamic loading (the default), compile
20620 them into the $package executable (static loading), or not include
20621 them at all.  Answer "none" to include no extensions.
20622 Note that DynaLoader is always built and need not be mentioned here.
20623
20624 EOM
20625         case "$dynamic_ext" in
20626         '')
20627                 : Exclude those listed in static_ext
20628                 dflt=''
20629                 for xxx in $avail_ext; do
20630                         case " $static_ext " in
20631                         *" $xxx "*) ;;
20632                         *) dflt="$dflt $xxx" ;;
20633                         esac
20634                 done
20635                 set X $dflt
20636                 shift
20637                 dflt="$*"
20638                 ;;
20639         *)      dflt="$dynamic_ext"
20640                 # Perhaps we are reusing an old out-of-date config.sh.
20641                 case "$hint" in
20642                 previous)
20643                         if test X"$dynamic_ext" != X"$avail_ext"; then
20644                                 $cat <<EOM
20645 NOTICE:  Your previous config.sh list may be incorrect. 
20646 The extensions now available to you are 
20647         ${avail_ext}
20648 but the default list from your previous config.sh is
20649         ${dynamic_ext} 
20650
20651 EOM
20652                         fi
20653                         ;;
20654                 esac
20655                 ;;
20656         esac
20657         case "$dflt" in
20658         '')     dflt=none;;
20659         esac
20660         rp="What extensions do you wish to load dynamically?"
20661         . ./myread
20662         case "$ans" in
20663         none) dynamic_ext=' ' ;;
20664         *) dynamic_ext="$ans" ;;
20665         esac
20666
20667         case "$static_ext" in
20668         '')
20669                 : Exclude those already listed in dynamic linking
20670                 dflt=''
20671                 for xxx in $avail_ext; do
20672                         case " $dynamic_ext " in
20673                         *" $xxx "*) ;;
20674                         *) dflt="$dflt $xxx" ;;
20675                         esac
20676                 done
20677                 set X $dflt
20678                 shift
20679                 dflt="$*"
20680                 ;;
20681         *)  dflt="$static_ext" 
20682                 ;;
20683         esac
20684
20685         case "$dflt" in
20686         '')     dflt=none;;
20687         esac
20688         rp="What extensions do you wish to load statically?"
20689         . ./myread
20690         case "$ans" in
20691         none) static_ext=' ' ;;
20692         *) static_ext="$ans" ;;
20693         esac
20694         ;;
20695 *)
20696         $cat <<EOM
20697 A number of extensions are supplied with $package.  Answer "none" 
20698 to include no extensions. 
20699 Note that DynaLoader is always built and need not be mentioned here.
20700
20701 EOM
20702         case "$static_ext" in
20703         '') dflt="$avail_ext" ;;
20704         *)      dflt="$static_ext"
20705                 # Perhaps we are reusing an old out-of-date config.sh.
20706                 case "$hint" in
20707                 previous)
20708                         if test X"$static_ext" != X"$avail_ext"; then
20709                                 $cat <<EOM
20710 NOTICE:  Your previous config.sh list may be incorrect. 
20711 The extensions now available to you are 
20712         ${avail_ext}
20713 but the default list from your previous config.sh is
20714         ${static_ext} 
20715
20716 EOM
20717                         fi
20718                         ;;
20719                 esac
20720                 ;;
20721         esac
20722         : Exclude those that are not xs extensions
20723         case "$dflt" in
20724         '')     dflt=none;;
20725         esac
20726         rp="What extensions do you wish to include?"
20727         . ./myread
20728         case "$ans" in
20729         none) static_ext=' ' ;;
20730         *) static_ext="$ans" ;;
20731         esac
20732         ;;
20733 esac
20734 #        
20735 # Encode is a special case.  If we are building Encode as a static
20736 # extension, we need to explicitly list its subextensions as well.
20737 # For other nested extensions, this is handled automatically by
20738 # the appropriate Makefile.PL.
20739 case " $static_ext " in
20740         *" Encode "*) # Add the subextensions of Encode
20741         cd "$rsrc/ext"
20742         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
20743                 static_ext="$static_ext Encode/$xxx"
20744         done
20745         cd "$tdir"
20746         ;;
20747 esac
20748
20749 set X $dynamic_ext $static_ext $nonxs_ext
20750 shift
20751 extensions="$*"
20752
20753 # Sanity check:  We require an extension suitable for use with
20754 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
20755 # should show up as failures in the test suite, but it's helpful to
20756 # catch them now.) The 'extensions' list is normally sorted
20757 # alphabetically, so we need to accept either
20758 #    DB_File ... Fcntl ... IO  ....
20759 # or something like
20760 #    Fcntl ... NDBM_File ... IO  ....
20761 case " $extensions"  in
20762 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
20763 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
20764 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
20765 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
20766    echo "WARNING: The Perl you are building will be quite crippled." >& 4
20767    ;;
20768 esac
20769
20770 : Remove libraries needed only for extensions
20771 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
20772 : The exception is SunOS 4.x, which needs them.
20773 case "${osname}X${osvers}" in
20774 sunos*X4*)
20775     perllibs="$libs"
20776     ;;
20777 *) case "$usedl" in
20778     $define|true|[yY]*)
20779             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
20780             shift
20781             perllibs="$*"
20782             ;;
20783     *)  perllibs="$libs"
20784             ;;
20785     esac
20786     ;;
20787 esac
20788
20789 : Remove build directory name from cppstdin so it can be used from
20790 : either the present location or the final installed location.
20791 echo " "
20792 : Get out of the UU directory to get correct path name.
20793 cd ..
20794 case "$cppstdin" in
20795 `pwd`/cppstdin)
20796         echo "Stripping down cppstdin path name"
20797         cppstdin=cppstdin
20798         ;;
20799 esac
20800 cd UU
20801
20802 : end of configuration questions
20803 echo " "
20804 echo "End of configuration questions."
20805 echo " "
20806
20807 : back to where it started
20808 if test -d ../UU; then
20809         cd ..
20810 fi
20811
20812 : configuration may be patched via a 'config.arch' file
20813 if $test -f config.arch; then
20814         echo "I see a config.arch file, loading it."
20815         . ./config.arch
20816 fi
20817
20818 : configuration may be patched via a 'config.over' file
20819 if $test -f config.over; then
20820         echo " "
20821         dflt=y
20822         rp='I see a config.over file.  Do you wish to load it?'
20823         . UU/myread
20824         case "$ans" in
20825         n*) echo "OK, I'll ignore it.";;
20826         *)      . ./config.over
20827                 echo "Configuration override changes have been loaded."
20828                 ;;
20829         esac
20830 fi
20831
20832 : in case they want portability, strip down executable paths
20833 case "$d_portable" in
20834 "$define")
20835         echo " "
20836         echo "Stripping down executable paths..." >&4
20837         for file in $loclist $trylist; do
20838                 eval temp=\$$file
20839                 eval $file=`basename $temp`
20840         done
20841         ;;
20842 esac
20843
20844 : create config.sh file
20845 echo " "
20846 echo "Creating config.sh..." >&4
20847 $spitshell <<EOT >config.sh
20848 $startsh
20849 #
20850 # This file was produced by running the Configure script. It holds all the
20851 # definitions figured out by Configure. Should you modify one of these values,
20852 # do not forget to propagate your changes by running "Configure -der". You may
20853 # instead choose to run each of the .SH files by yourself, or "Configure -S".
20854 #
20855
20856 # Package name      : $package
20857 # Source directory  : $src
20858 # Configuration time: $cf_time
20859 # Configured by     : $cf_by
20860 # Target system     : $myuname
20861
20862 Author='$Author'
20863 Date='$Date'
20864 Header='$Header'
20865 Id='$Id'
20866 Locker='$Locker'
20867 Log='$Log'
20868 Mcc='$Mcc'
20869 RCSfile='$RCSfile'
20870 Revision='$Revision'
20871 Source='$Source'
20872 State='$State'
20873 _a='$_a'
20874 _exe='$_exe'
20875 _o='$_o'
20876 afs='$afs'
20877 afsroot='$afsroot'
20878 alignbytes='$alignbytes'
20879 ansi2knr='$ansi2knr'
20880 aphostname='$aphostname'
20881 api_revision='$api_revision'
20882 api_subversion='$api_subversion'
20883 api_version='$api_version'
20884 api_versionstring='$api_versionstring'
20885 ar='$ar'
20886 archlib='$archlib'
20887 archlibexp='$archlibexp'
20888 archname64='$archname64'
20889 archname='$archname'
20890 archobjs='$archobjs'
20891 asctime_r_proto='$asctime_r_proto'
20892 awk='$awk'
20893 baserev='$baserev'
20894 bash='$bash'
20895 bin='$bin'
20896 binexp='$binexp'
20897 bison='$bison'
20898 byacc='$byacc'
20899 byteorder='$byteorder'
20900 c='$c'
20901 castflags='$castflags'
20902 cat='$cat'
20903 cc='$cc'
20904 cccdlflags='$cccdlflags'
20905 ccdlflags='$ccdlflags'
20906 ccflags='$ccflags'
20907 ccflags_uselargefiles='$ccflags_uselargefiles'
20908 ccname='$ccname'
20909 ccsymbols='$ccsymbols'
20910 ccversion='$ccversion'
20911 cf_by='$cf_by'
20912 cf_email='$cf_email'
20913 cf_time='$cf_time'
20914 charsize='$charsize'
20915 chgrp='$chgrp'
20916 chmod='$chmod'
20917 chown='$chown'
20918 clocktype='$clocktype'
20919 comm='$comm'
20920 compress='$compress'
20921 contains='$contains'
20922 cp='$cp'
20923 cpio='$cpio'
20924 cpp='$cpp'
20925 cpp_stuff='$cpp_stuff'
20926 cppccsymbols='$cppccsymbols'
20927 cppflags='$cppflags'
20928 cpplast='$cpplast'
20929 cppminus='$cppminus'
20930 cpprun='$cpprun'
20931 cppstdin='$cppstdin'
20932 cppsymbols='$cppsymbols'
20933 crypt_r_proto='$crypt_r_proto'
20934 cryptlib='$cryptlib'
20935 csh='$csh'
20936 ctermid_r_proto='$ctermid_r_proto'
20937 ctime_r_proto='$ctime_r_proto'
20938 d_Gconvert='$d_Gconvert'
20939 d_PRIEUldbl='$d_PRIEUldbl'
20940 d_PRIFUldbl='$d_PRIFUldbl'
20941 d_PRIGUldbl='$d_PRIGUldbl'
20942 d_PRIXU64='$d_PRIXU64'
20943 d_PRId64='$d_PRId64'
20944 d_PRIeldbl='$d_PRIeldbl'
20945 d_PRIfldbl='$d_PRIfldbl'
20946 d_PRIgldbl='$d_PRIgldbl'
20947 d_PRIi64='$d_PRIi64'
20948 d_PRIo64='$d_PRIo64'
20949 d_PRIu64='$d_PRIu64'
20950 d_PRIx64='$d_PRIx64'
20951 d_SCNfldbl='$d_SCNfldbl'
20952 d__fwalk='$d__fwalk'
20953 d_access='$d_access'
20954 d_accessx='$d_accessx'
20955 d_aintl='$d_aintl'
20956 d_alarm='$d_alarm'
20957 d_archlib='$d_archlib'
20958 d_asctime_r='$d_asctime_r'
20959 d_atolf='$d_atolf'
20960 d_atoll='$d_atoll'
20961 d_attribute_format='$d_attribute_format'
20962 d_attribute_malloc='$d_attribute_malloc'
20963 d_attribute_nonnull='$d_attribute_nonnull'
20964 d_attribute_noreturn='$d_attribute_noreturn'
20965 d_attribute_pure='$d_attribute_pure'
20966 d_attribute_unused='$d_attribute_unused'
20967 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
20968 d_bcmp='$d_bcmp'
20969 d_bcopy='$d_bcopy'
20970 d_bsd='$d_bsd'
20971 d_bsdgetpgrp='$d_bsdgetpgrp'
20972 d_bsdsetpgrp='$d_bsdsetpgrp'
20973 d_bzero='$d_bzero'
20974 d_casti32='$d_casti32'
20975 d_castneg='$d_castneg'
20976 d_charvspr='$d_charvspr'
20977 d_chown='$d_chown'
20978 d_chroot='$d_chroot'
20979 d_chsize='$d_chsize'
20980 d_class='$d_class'
20981 d_closedir='$d_closedir'
20982 d_cmsghdr_s='$d_cmsghdr_s'
20983 d_const='$d_const'
20984 d_copysignl='$d_copysignl'
20985 d_crypt='$d_crypt'
20986 d_crypt_r='$d_crypt_r'
20987 d_csh='$d_csh'
20988 d_ctermid_r='$d_ctermid_r'
20989 d_ctime_r='$d_ctime_r'
20990 d_cuserid='$d_cuserid'
20991 d_dbl_dig='$d_dbl_dig'
20992 d_dbminitproto='$d_dbminitproto'
20993 d_difftime='$d_difftime'
20994 d_dirfd='$d_dirfd'
20995 d_dirnamlen='$d_dirnamlen'
20996 d_dlerror='$d_dlerror'
20997 d_dlopen='$d_dlopen'
20998 d_dlsymun='$d_dlsymun'
20999 d_dosuid='$d_dosuid'
21000 d_drand48_r='$d_drand48_r'
21001 d_drand48proto='$d_drand48proto'
21002 d_dup2='$d_dup2'
21003 d_eaccess='$d_eaccess'
21004 d_endgrent='$d_endgrent'
21005 d_endgrent_r='$d_endgrent_r'
21006 d_endhent='$d_endhent'
21007 d_endhostent_r='$d_endhostent_r'
21008 d_endnent='$d_endnent'
21009 d_endnetent_r='$d_endnetent_r'
21010 d_endpent='$d_endpent'
21011 d_endprotoent_r='$d_endprotoent_r'
21012 d_endpwent='$d_endpwent'
21013 d_endpwent_r='$d_endpwent_r'
21014 d_endsent='$d_endsent'
21015 d_endservent_r='$d_endservent_r'
21016 d_eofnblk='$d_eofnblk'
21017 d_eunice='$d_eunice'
21018 d_faststdio='$d_faststdio'
21019 d_fchdir='$d_fchdir'
21020 d_fchmod='$d_fchmod'
21021 d_fchown='$d_fchown'
21022 d_fcntl='$d_fcntl'
21023 d_fcntl_can_lock='$d_fcntl_can_lock'
21024 d_fd_macros='$d_fd_macros'
21025 d_fd_set='$d_fd_set'
21026 d_fds_bits='$d_fds_bits'
21027 d_fgetpos='$d_fgetpos'
21028 d_finite='$d_finite'
21029 d_finitel='$d_finitel'
21030 d_flexfnam='$d_flexfnam'
21031 d_flock='$d_flock'
21032 d_flockproto='$d_flockproto'
21033 d_fork='$d_fork'
21034 d_fp_class='$d_fp_class'
21035 d_fpathconf='$d_fpathconf'
21036 d_fpclass='$d_fpclass'
21037 d_fpclassify='$d_fpclassify'
21038 d_fpclassl='$d_fpclassl'
21039 d_fpos64_t='$d_fpos64_t'
21040 d_frexpl='$d_frexpl'
21041 d_fs_data_s='$d_fs_data_s'
21042 d_fseeko='$d_fseeko'
21043 d_fsetpos='$d_fsetpos'
21044 d_fstatfs='$d_fstatfs'
21045 d_fstatvfs='$d_fstatvfs'
21046 d_fsync='$d_fsync'
21047 d_ftello='$d_ftello'
21048 d_ftime='$d_ftime'
21049 d_getcwd='$d_getcwd'
21050 d_getespwnam='$d_getespwnam'
21051 d_getfsstat='$d_getfsstat'
21052 d_getgrent='$d_getgrent'
21053 d_getgrent_r='$d_getgrent_r'
21054 d_getgrgid_r='$d_getgrgid_r'
21055 d_getgrnam_r='$d_getgrnam_r'
21056 d_getgrps='$d_getgrps'
21057 d_gethbyaddr='$d_gethbyaddr'
21058 d_gethbyname='$d_gethbyname'
21059 d_gethent='$d_gethent'
21060 d_gethname='$d_gethname'
21061 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21062 d_gethostbyname_r='$d_gethostbyname_r'
21063 d_gethostent_r='$d_gethostent_r'
21064 d_gethostprotos='$d_gethostprotos'
21065 d_getitimer='$d_getitimer'
21066 d_getlogin='$d_getlogin'
21067 d_getlogin_r='$d_getlogin_r'
21068 d_getmnt='$d_getmnt'
21069 d_getmntent='$d_getmntent'
21070 d_getnbyaddr='$d_getnbyaddr'
21071 d_getnbyname='$d_getnbyname'
21072 d_getnent='$d_getnent'
21073 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21074 d_getnetbyname_r='$d_getnetbyname_r'
21075 d_getnetent_r='$d_getnetent_r'
21076 d_getnetprotos='$d_getnetprotos'
21077 d_getpagsz='$d_getpagsz'
21078 d_getpbyname='$d_getpbyname'
21079 d_getpbynumber='$d_getpbynumber'
21080 d_getpent='$d_getpent'
21081 d_getpgid='$d_getpgid'
21082 d_getpgrp2='$d_getpgrp2'
21083 d_getpgrp='$d_getpgrp'
21084 d_getppid='$d_getppid'
21085 d_getprior='$d_getprior'
21086 d_getprotobyname_r='$d_getprotobyname_r'
21087 d_getprotobynumber_r='$d_getprotobynumber_r'
21088 d_getprotoent_r='$d_getprotoent_r'
21089 d_getprotoprotos='$d_getprotoprotos'
21090 d_getprpwnam='$d_getprpwnam'
21091 d_getpwent='$d_getpwent'
21092 d_getpwent_r='$d_getpwent_r'
21093 d_getpwnam_r='$d_getpwnam_r'
21094 d_getpwuid_r='$d_getpwuid_r'
21095 d_getsbyname='$d_getsbyname'
21096 d_getsbyport='$d_getsbyport'
21097 d_getsent='$d_getsent'
21098 d_getservbyname_r='$d_getservbyname_r'
21099 d_getservbyport_r='$d_getservbyport_r'
21100 d_getservent_r='$d_getservent_r'
21101 d_getservprotos='$d_getservprotos'
21102 d_getspnam='$d_getspnam'
21103 d_getspnam_r='$d_getspnam_r'
21104 d_gettimeod='$d_gettimeod'
21105 d_gmtime_r='$d_gmtime_r'
21106 d_gnulibc='$d_gnulibc'
21107 d_grpasswd='$d_grpasswd'
21108 d_hasmntopt='$d_hasmntopt'
21109 d_htonl='$d_htonl'
21110 d_ilogbl='$d_ilogbl'
21111 d_index='$d_index'
21112 d_inetaton='$d_inetaton'
21113 d_int64_t='$d_int64_t'
21114 d_isascii='$d_isascii'
21115 d_isfinite='$d_isfinite'
21116 d_isinf='$d_isinf'
21117 d_isnan='$d_isnan'
21118 d_isnanl='$d_isnanl'
21119 d_killpg='$d_killpg'
21120 d_lchown='$d_lchown'
21121 d_ldbl_dig='$d_ldbl_dig'
21122 d_libm_lib_version='$d_libm_lib_version'
21123 d_link='$d_link'
21124 d_localtime_r='$d_localtime_r'
21125 d_locconv='$d_locconv'
21126 d_lockf='$d_lockf'
21127 d_longdbl='$d_longdbl'
21128 d_longlong='$d_longlong'
21129 d_lseekproto='$d_lseekproto'
21130 d_lstat='$d_lstat'
21131 d_madvise='$d_madvise'
21132 d_malloc_good_size='$d_malloc_good_size'
21133 d_malloc_size='$d_malloc_size'
21134 d_mblen='$d_mblen'
21135 d_mbstowcs='$d_mbstowcs'
21136 d_mbtowc='$d_mbtowc'
21137 d_memchr='$d_memchr'
21138 d_memcmp='$d_memcmp'
21139 d_memcpy='$d_memcpy'
21140 d_memmove='$d_memmove'
21141 d_memset='$d_memset'
21142 d_mkdir='$d_mkdir'
21143 d_mkdtemp='$d_mkdtemp'
21144 d_mkfifo='$d_mkfifo'
21145 d_mkstemp='$d_mkstemp'
21146 d_mkstemps='$d_mkstemps'
21147 d_mktime='$d_mktime'
21148 d_mmap='$d_mmap'
21149 d_modfl='$d_modfl'
21150 d_modfl_pow32_bug='$d_modfl_pow32_bug'
21151 d_modflproto='$d_modflproto'
21152 d_mprotect='$d_mprotect'
21153 d_msg='$d_msg'
21154 d_msg_ctrunc='$d_msg_ctrunc'
21155 d_msg_dontroute='$d_msg_dontroute'
21156 d_msg_oob='$d_msg_oob'
21157 d_msg_peek='$d_msg_peek'
21158 d_msg_proxy='$d_msg_proxy'
21159 d_msgctl='$d_msgctl'
21160 d_msgget='$d_msgget'
21161 d_msghdr_s='$d_msghdr_s'
21162 d_msgrcv='$d_msgrcv'
21163 d_msgsnd='$d_msgsnd'
21164 d_msync='$d_msync'
21165 d_munmap='$d_munmap'
21166 d_mymalloc='$d_mymalloc'
21167 d_nice='$d_nice'
21168 d_nl_langinfo='$d_nl_langinfo'
21169 d_nv_preserves_uv='$d_nv_preserves_uv'
21170 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
21171 d_off64_t='$d_off64_t'
21172 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21173 d_oldpthreads='$d_oldpthreads'
21174 d_oldsock='$d_oldsock'
21175 d_open3='$d_open3'
21176 d_pathconf='$d_pathconf'
21177 d_pause='$d_pause'
21178 d_perl_otherlibdirs='$d_perl_otherlibdirs'
21179 d_phostname='$d_phostname'
21180 d_pipe='$d_pipe'
21181 d_poll='$d_poll'
21182 d_portable='$d_portable'
21183 d_procselfexe='$d_procselfexe'
21184 d_pthread_atfork='$d_pthread_atfork'
21185 d_pthread_attr_setscope='$d_pthread_attr_setscope'
21186 d_pthread_yield='$d_pthread_yield'
21187 d_pwage='$d_pwage'
21188 d_pwchange='$d_pwchange'
21189 d_pwclass='$d_pwclass'
21190 d_pwcomment='$d_pwcomment'
21191 d_pwexpire='$d_pwexpire'
21192 d_pwgecos='$d_pwgecos'
21193 d_pwpasswd='$d_pwpasswd'
21194 d_pwquota='$d_pwquota'
21195 d_qgcvt='$d_qgcvt'
21196 d_quad='$d_quad'
21197 d_random_r='$d_random_r'
21198 d_readdir64_r='$d_readdir64_r'
21199 d_readdir='$d_readdir'
21200 d_readdir_r='$d_readdir_r'
21201 d_readlink='$d_readlink'
21202 d_readv='$d_readv'
21203 d_recvmsg='$d_recvmsg'
21204 d_rename='$d_rename'
21205 d_rewinddir='$d_rewinddir'
21206 d_rmdir='$d_rmdir'
21207 d_safebcpy='$d_safebcpy'
21208 d_safemcpy='$d_safemcpy'
21209 d_sanemcmp='$d_sanemcmp'
21210 d_sbrkproto='$d_sbrkproto'
21211 d_scalbnl='$d_scalbnl'
21212 d_sched_yield='$d_sched_yield'
21213 d_scm_rights='$d_scm_rights'
21214 d_seekdir='$d_seekdir'
21215 d_select='$d_select'
21216 d_sem='$d_sem'
21217 d_semctl='$d_semctl'
21218 d_semctl_semid_ds='$d_semctl_semid_ds'
21219 d_semctl_semun='$d_semctl_semun'
21220 d_semget='$d_semget'
21221 d_semop='$d_semop'
21222 d_sendmsg='$d_sendmsg'
21223 d_setegid='$d_setegid'
21224 d_seteuid='$d_seteuid'
21225 d_setgrent='$d_setgrent'
21226 d_setgrent_r='$d_setgrent_r'
21227 d_setgrps='$d_setgrps'
21228 d_sethent='$d_sethent'
21229 d_sethostent_r='$d_sethostent_r'
21230 d_setitimer='$d_setitimer'
21231 d_setlinebuf='$d_setlinebuf'
21232 d_setlocale='$d_setlocale'
21233 d_setlocale_r='$d_setlocale_r'
21234 d_setnent='$d_setnent'
21235 d_setnetent_r='$d_setnetent_r'
21236 d_setpent='$d_setpent'
21237 d_setpgid='$d_setpgid'
21238 d_setpgrp2='$d_setpgrp2'
21239 d_setpgrp='$d_setpgrp'
21240 d_setprior='$d_setprior'
21241 d_setproctitle='$d_setproctitle'
21242 d_setprotoent_r='$d_setprotoent_r'
21243 d_setpwent='$d_setpwent'
21244 d_setpwent_r='$d_setpwent_r'
21245 d_setregid='$d_setregid'
21246 d_setresgid='$d_setresgid'
21247 d_setresuid='$d_setresuid'
21248 d_setreuid='$d_setreuid'
21249 d_setrgid='$d_setrgid'
21250 d_setruid='$d_setruid'
21251 d_setsent='$d_setsent'
21252 d_setservent_r='$d_setservent_r'
21253 d_setsid='$d_setsid'
21254 d_setvbuf='$d_setvbuf'
21255 d_sfio='$d_sfio'
21256 d_shm='$d_shm'
21257 d_shmat='$d_shmat'
21258 d_shmatprototype='$d_shmatprototype'
21259 d_shmctl='$d_shmctl'
21260 d_shmdt='$d_shmdt'
21261 d_shmget='$d_shmget'
21262 d_sigaction='$d_sigaction'
21263 d_sigprocmask='$d_sigprocmask'
21264 d_sigsetjmp='$d_sigsetjmp'
21265 d_sockatmark='$d_sockatmark'
21266 d_sockatmarkproto='$d_sockatmarkproto'
21267 d_socket='$d_socket'
21268 d_socklen_t='$d_socklen_t'
21269 d_sockpair='$d_sockpair'
21270 d_socks5_init='$d_socks5_init'
21271 d_sqrtl='$d_sqrtl'
21272 d_srand48_r='$d_srand48_r'
21273 d_srandom_r='$d_srandom_r'
21274 d_sresgproto='$d_sresgproto'
21275 d_sresuproto='$d_sresuproto'
21276 d_statblks='$d_statblks'
21277 d_statfs_f_flags='$d_statfs_f_flags'
21278 d_statfs_s='$d_statfs_s'
21279 d_statvfs='$d_statvfs'
21280 d_stdio_cnt_lval='$d_stdio_cnt_lval'
21281 d_stdio_ptr_lval='$d_stdio_ptr_lval'
21282 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21283 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
21284 d_stdio_stream_array='$d_stdio_stream_array'
21285 d_stdiobase='$d_stdiobase'
21286 d_stdstdio='$d_stdstdio'
21287 d_strchr='$d_strchr'
21288 d_strcoll='$d_strcoll'
21289 d_strctcpy='$d_strctcpy'
21290 d_strerrm='$d_strerrm'
21291 d_strerror='$d_strerror'
21292 d_strerror_r='$d_strerror_r'
21293 d_strftime='$d_strftime'
21294 d_strlcat='$d_strlcat'
21295 d_strlcpy='$d_strlcpy'
21296 d_strtod='$d_strtod'
21297 d_strtol='$d_strtol'
21298 d_strtold='$d_strtold'
21299 d_strtoll='$d_strtoll'
21300 d_strtoq='$d_strtoq'
21301 d_strtoul='$d_strtoul'
21302 d_strtoull='$d_strtoull'
21303 d_strtouq='$d_strtouq'
21304 d_strxfrm='$d_strxfrm'
21305 d_suidsafe='$d_suidsafe'
21306 d_symlink='$d_symlink'
21307 d_syscall='$d_syscall'
21308 d_syscallproto='$d_syscallproto'
21309 d_sysconf='$d_sysconf'
21310 d_sysernlst='$d_sysernlst'
21311 d_syserrlst='$d_syserrlst'
21312 d_system='$d_system'
21313 d_tcgetpgrp='$d_tcgetpgrp'
21314 d_tcsetpgrp='$d_tcsetpgrp'
21315 d_telldir='$d_telldir'
21316 d_telldirproto='$d_telldirproto'
21317 d_time='$d_time'
21318 d_times='$d_times'
21319 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21320 d_tm_tm_zone='$d_tm_tm_zone'
21321 d_tmpnam_r='$d_tmpnam_r'
21322 d_truncate='$d_truncate'
21323 d_ttyname_r='$d_ttyname_r'
21324 d_tzname='$d_tzname'
21325 d_u32align='$d_u32align'
21326 d_ualarm='$d_ualarm'
21327 d_umask='$d_umask'
21328 d_uname='$d_uname'
21329 d_union_semun='$d_union_semun'
21330 d_unordered='$d_unordered'
21331 d_unsetenv='$d_unsetenv'
21332 d_usleep='$d_usleep'
21333 d_usleepproto='$d_usleepproto'
21334 d_ustat='$d_ustat'
21335 d_vendorarch='$d_vendorarch'
21336 d_vendorbin='$d_vendorbin'
21337 d_vendorlib='$d_vendorlib'
21338 d_vendorscript='$d_vendorscript'
21339 d_vfork='$d_vfork'
21340 d_void_closedir='$d_void_closedir'
21341 d_voidsig='$d_voidsig'
21342 d_voidtty='$d_voidtty'
21343 d_volatile='$d_volatile'
21344 d_vprintf='$d_vprintf'
21345 d_wait4='$d_wait4'
21346 d_waitpid='$d_waitpid'
21347 d_wcstombs='$d_wcstombs'
21348 d_wctomb='$d_wctomb'
21349 d_writev='$d_writev'
21350 d_xenix='$d_xenix'
21351 date='$date'
21352 db_hashtype='$db_hashtype'
21353 db_prefixtype='$db_prefixtype'
21354 db_version_major='$db_version_major'
21355 db_version_minor='$db_version_minor'
21356 db_version_patch='$db_version_patch'
21357 defvoidused='$defvoidused'
21358 direntrytype='$direntrytype'
21359 dlext='$dlext'
21360 dlsrc='$dlsrc'
21361 doublesize='$doublesize'
21362 drand01='$drand01'
21363 drand48_r_proto='$drand48_r_proto'
21364 dynamic_ext='$dynamic_ext'
21365 eagain='$eagain'
21366 ebcdic='$ebcdic'
21367 echo='$echo'
21368 egrep='$egrep'
21369 emacs='$emacs'
21370 endgrent_r_proto='$endgrent_r_proto'
21371 endhostent_r_proto='$endhostent_r_proto'
21372 endnetent_r_proto='$endnetent_r_proto'
21373 endprotoent_r_proto='$endprotoent_r_proto'
21374 endpwent_r_proto='$endpwent_r_proto'
21375 endservent_r_proto='$endservent_r_proto'
21376 eunicefix='$eunicefix'
21377 exe_ext='$exe_ext'
21378 expr='$expr'
21379 extensions='$extensions'
21380 extras='$extras'
21381 fflushNULL='$fflushNULL'
21382 fflushall='$fflushall'
21383 find='$find'
21384 firstmakefile='$firstmakefile'
21385 flex='$flex'
21386 fpossize='$fpossize'
21387 fpostype='$fpostype'
21388 freetype='$freetype'
21389 from='$from'
21390 full_ar='$full_ar'
21391 full_csh='$full_csh'
21392 full_sed='$full_sed'
21393 gccansipedantic='$gccansipedantic'
21394 gccosandvers='$gccosandvers'
21395 gccversion='$gccversion'
21396 getgrent_r_proto='$getgrent_r_proto'
21397 getgrgid_r_proto='$getgrgid_r_proto'
21398 getgrnam_r_proto='$getgrnam_r_proto'
21399 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
21400 gethostbyname_r_proto='$gethostbyname_r_proto'
21401 gethostent_r_proto='$gethostent_r_proto'
21402 getlogin_r_proto='$getlogin_r_proto'
21403 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
21404 getnetbyname_r_proto='$getnetbyname_r_proto'
21405 getnetent_r_proto='$getnetent_r_proto'
21406 getprotobyname_r_proto='$getprotobyname_r_proto'
21407 getprotobynumber_r_proto='$getprotobynumber_r_proto'
21408 getprotoent_r_proto='$getprotoent_r_proto'
21409 getpwent_r_proto='$getpwent_r_proto'
21410 getpwnam_r_proto='$getpwnam_r_proto'
21411 getpwuid_r_proto='$getpwuid_r_proto'
21412 getservbyname_r_proto='$getservbyname_r_proto'
21413 getservbyport_r_proto='$getservbyport_r_proto'
21414 getservent_r_proto='$getservent_r_proto'
21415 getspnam_r_proto='$getspnam_r_proto'
21416 gidformat='$gidformat'
21417 gidsign='$gidsign'
21418 gidsize='$gidsize'
21419 gidtype='$gidtype'
21420 glibpth='$glibpth'
21421 gmake='$gmake'
21422 gmtime_r_proto='$gmtime_r_proto'
21423 gnulibc_version='$gnulibc_version'
21424 grep='$grep'
21425 groupcat='$groupcat'
21426 groupstype='$groupstype'
21427 gzip='$gzip'
21428 h_fcntl='$h_fcntl'
21429 h_sysfile='$h_sysfile'
21430 hint='$hint'
21431 hostcat='$hostcat'
21432 html1dir='$html1dir'
21433 html1direxp='$html1direxp'
21434 html3dir='$html3dir'
21435 html3direxp='$html3direxp'
21436 i16size='$i16size'
21437 i16type='$i16type'
21438 i32size='$i32size'
21439 i32type='$i32type'
21440 i64size='$i64size'
21441 i64type='$i64type'
21442 i8size='$i8size'
21443 i8type='$i8type'
21444 i_arpainet='$i_arpainet'
21445 i_bsdioctl='$i_bsdioctl'
21446 i_crypt='$i_crypt'
21447 i_db='$i_db'
21448 i_dbm='$i_dbm'
21449 i_dirent='$i_dirent'
21450 i_dld='$i_dld'
21451 i_dlfcn='$i_dlfcn'
21452 i_fcntl='$i_fcntl'
21453 i_float='$i_float'
21454 i_fp='$i_fp'
21455 i_fp_class='$i_fp_class'
21456 i_gdbm='$i_gdbm'
21457 i_grp='$i_grp'
21458 i_ieeefp='$i_ieeefp'
21459 i_inttypes='$i_inttypes'
21460 i_langinfo='$i_langinfo'
21461 i_libutil='$i_libutil'
21462 i_limits='$i_limits'
21463 i_locale='$i_locale'
21464 i_machcthr='$i_machcthr'
21465 i_malloc='$i_malloc'
21466 i_math='$i_math'
21467 i_memory='$i_memory'
21468 i_mntent='$i_mntent'
21469 i_ndbm='$i_ndbm'
21470 i_netdb='$i_netdb'
21471 i_neterrno='$i_neterrno'
21472 i_netinettcp='$i_netinettcp'
21473 i_niin='$i_niin'
21474 i_poll='$i_poll'
21475 i_prot='$i_prot'
21476 i_pthread='$i_pthread'
21477 i_pwd='$i_pwd'
21478 i_rpcsvcdbm='$i_rpcsvcdbm'
21479 i_sfio='$i_sfio'
21480 i_sgtty='$i_sgtty'
21481 i_shadow='$i_shadow'
21482 i_socks='$i_socks'
21483 i_stdarg='$i_stdarg'
21484 i_stddef='$i_stddef'
21485 i_stdlib='$i_stdlib'
21486 i_string='$i_string'
21487 i_sunmath='$i_sunmath'
21488 i_sysaccess='$i_sysaccess'
21489 i_sysdir='$i_sysdir'
21490 i_sysfile='$i_sysfile'
21491 i_sysfilio='$i_sysfilio'
21492 i_sysin='$i_sysin'
21493 i_sysioctl='$i_sysioctl'
21494 i_syslog='$i_syslog'
21495 i_sysmman='$i_sysmman'
21496 i_sysmode='$i_sysmode'
21497 i_sysmount='$i_sysmount'
21498 i_sysndir='$i_sysndir'
21499 i_sysparam='$i_sysparam'
21500 i_sysresrc='$i_sysresrc'
21501 i_syssecrt='$i_syssecrt'
21502 i_sysselct='$i_sysselct'
21503 i_syssockio='$i_syssockio'
21504 i_sysstat='$i_sysstat'
21505 i_sysstatfs='$i_sysstatfs'
21506 i_sysstatvfs='$i_sysstatvfs'
21507 i_systime='$i_systime'
21508 i_systimek='$i_systimek'
21509 i_systimes='$i_systimes'
21510 i_systypes='$i_systypes'
21511 i_sysuio='$i_sysuio'
21512 i_sysun='$i_sysun'
21513 i_sysutsname='$i_sysutsname'
21514 i_sysvfs='$i_sysvfs'
21515 i_syswait='$i_syswait'
21516 i_termio='$i_termio'
21517 i_termios='$i_termios'
21518 i_time='$i_time'
21519 i_unistd='$i_unistd'
21520 i_ustat='$i_ustat'
21521 i_utime='$i_utime'
21522 i_values='$i_values'
21523 i_varargs='$i_varargs'
21524 i_varhdr='$i_varhdr'
21525 i_vfork='$i_vfork'
21526 ignore_versioned_solibs='$ignore_versioned_solibs'
21527 inc_version_list='$inc_version_list'
21528 inc_version_list_init='$inc_version_list_init'
21529 incpath='$incpath'
21530 inews='$inews'
21531 installarchlib='$installarchlib'
21532 installbin='$installbin'
21533 installhtml1dir='$installhtml1dir'
21534 installhtml3dir='$installhtml3dir'
21535 installman1dir='$installman1dir'
21536 installman3dir='$installman3dir'
21537 installprefix='$installprefix'
21538 installprefixexp='$installprefixexp'
21539 installprivlib='$installprivlib'
21540 installscript='$installscript'
21541 installsitearch='$installsitearch'
21542 installsitebin='$installsitebin'
21543 installsitehtml1dir='$installsitehtml1dir'
21544 installsitehtml3dir='$installsitehtml3dir'
21545 installsitelib='$installsitelib'
21546 installsiteman1dir='$installsiteman1dir'
21547 installsiteman3dir='$installsiteman3dir'
21548 installsitescript='$installsitescript'
21549 installstyle='$installstyle'
21550 installusrbinperl='$installusrbinperl'
21551 installvendorarch='$installvendorarch'
21552 installvendorbin='$installvendorbin'
21553 installvendorhtml1dir='$installvendorhtml1dir'
21554 installvendorhtml3dir='$installvendorhtml3dir'
21555 installvendorlib='$installvendorlib'
21556 installvendorman1dir='$installvendorman1dir'
21557 installvendorman3dir='$installvendorman3dir'
21558 installvendorscript='$installvendorscript'
21559 intsize='$intsize'
21560 issymlink='$issymlink'
21561 ivdformat='$ivdformat'
21562 ivsize='$ivsize'
21563 ivtype='$ivtype'
21564 known_extensions='$known_extensions'
21565 ksh='$ksh'
21566 ld='$ld'
21567 lddlflags='$lddlflags'
21568 ldflags='$ldflags'
21569 ldflags_uselargefiles='$ldflags_uselargefiles'
21570 ldlibpthname='$ldlibpthname'
21571 less='$less'
21572 lib_ext='$lib_ext'
21573 libc='$libc'
21574 libperl='$libperl'
21575 libpth='$libpth'
21576 libs='$libs'
21577 libsdirs='$libsdirs'
21578 libsfiles='$libsfiles'
21579 libsfound='$libsfound'
21580 libspath='$libspath'
21581 libswanted='$libswanted'
21582 libswanted_uselargefiles='$libswanted_uselargefiles'
21583 line='$line'
21584 lint='$lint'
21585 lkflags='$lkflags'
21586 ln='$ln'
21587 lns='$lns'
21588 localtime_r_proto='$localtime_r_proto'
21589 locincpth='$locincpth'
21590 loclibpth='$loclibpth'
21591 longdblsize='$longdblsize'
21592 longlongsize='$longlongsize'
21593 longsize='$longsize'
21594 lp='$lp'
21595 lpr='$lpr'
21596 ls='$ls'
21597 lseeksize='$lseeksize'
21598 lseektype='$lseektype'
21599 mail='$mail'
21600 mailx='$mailx'
21601 make='$make'
21602 make_set_make='$make_set_make'
21603 mallocobj='$mallocobj'
21604 mallocsrc='$mallocsrc'
21605 malloctype='$malloctype'
21606 man1dir='$man1dir'
21607 man1direxp='$man1direxp'
21608 man1ext='$man1ext'
21609 man3dir='$man3dir'
21610 man3direxp='$man3direxp'
21611 man3ext='$man3ext'
21612 mips_type='$mips_type'
21613 mistrustnm='$mistrustnm'
21614 mkdir='$mkdir'
21615 mmaptype='$mmaptype'
21616 modetype='$modetype'
21617 more='$more'
21618 multiarch='$multiarch'
21619 mv='$mv'
21620 myarchname='$myarchname'
21621 mydomain='$mydomain'
21622 myhostname='$myhostname'
21623 myuname='$myuname'
21624 n='$n'
21625 need_va_copy='$need_va_copy'
21626 netdb_hlen_type='$netdb_hlen_type'
21627 netdb_host_type='$netdb_host_type'
21628 netdb_name_type='$netdb_name_type'
21629 netdb_net_type='$netdb_net_type'
21630 nm='$nm'
21631 nm_opt='$nm_opt'
21632 nm_so_opt='$nm_so_opt'
21633 nonxs_ext='$nonxs_ext'
21634 nroff='$nroff'
21635 nvEUformat='$nvEUformat'
21636 nvFUformat='$nvFUformat'
21637 nvGUformat='$nvGUformat'
21638 nv_preserves_uv_bits='$nv_preserves_uv_bits'
21639 nveformat='$nveformat'
21640 nvfformat='$nvfformat'
21641 nvgformat='$nvgformat'
21642 nvsize='$nvsize'
21643 nvtype='$nvtype'
21644 o_nonblock='$o_nonblock'
21645 obj_ext='$obj_ext'
21646 old_pthread_create_joinable='$old_pthread_create_joinable'
21647 optimize='$optimize'
21648 orderlib='$orderlib'
21649 osname='$osname'
21650 osvers='$osvers'
21651 otherlibdirs='$otherlibdirs'
21652 package='$package'
21653 pager='$pager'
21654 passcat='$passcat'
21655 patchlevel='$patchlevel'
21656 path_sep='$path_sep'
21657 perl5='$perl5'
21658 perl='$perl'
21659 perl_patchlevel='$perl_patchlevel'
21660 perladmin='$perladmin'
21661 perllibs='$perllibs'
21662 perlpath='$perlpath'
21663 pg='$pg'
21664 phostname='$phostname'
21665 pidtype='$pidtype'
21666 plibpth='$plibpth'
21667 pmake='$pmake'
21668 pr='$pr'
21669 prefix='$prefix'
21670 prefixexp='$prefixexp'
21671 privlib='$privlib'
21672 privlibexp='$privlibexp'
21673 procselfexe='$procselfexe'
21674 prototype='$prototype'
21675 ptrsize='$ptrsize'
21676 quadkind='$quadkind'
21677 quadtype='$quadtype'
21678 randbits='$randbits'
21679 randfunc='$randfunc'
21680 random_r_proto='$random_r_proto'
21681 randseedtype='$randseedtype'
21682 ranlib='$ranlib'
21683 rd_nodata='$rd_nodata'
21684 readdir64_r_proto='$readdir64_r_proto'
21685 readdir_r_proto='$readdir_r_proto'
21686 revision='$revision'
21687 rm='$rm'
21688 rmail='$rmail'
21689 run='$run'
21690 runnm='$runnm'
21691 sPRIEUldbl='$sPRIEUldbl'
21692 sPRIFUldbl='$sPRIFUldbl'
21693 sPRIGUldbl='$sPRIGUldbl'
21694 sPRIXU64='$sPRIXU64'
21695 sPRId64='$sPRId64'
21696 sPRIeldbl='$sPRIeldbl'
21697 sPRIfldbl='$sPRIfldbl'
21698 sPRIgldbl='$sPRIgldbl'
21699 sPRIi64='$sPRIi64'
21700 sPRIo64='$sPRIo64'
21701 sPRIu64='$sPRIu64'
21702 sPRIx64='$sPRIx64'
21703 sSCNfldbl='$sSCNfldbl'
21704 sched_yield='$sched_yield'
21705 scriptdir='$scriptdir'
21706 scriptdirexp='$scriptdirexp'
21707 sed='$sed'
21708 seedfunc='$seedfunc'
21709 selectminbits='$selectminbits'
21710 selecttype='$selecttype'
21711 sendmail='$sendmail'
21712 setgrent_r_proto='$setgrent_r_proto'
21713 sethostent_r_proto='$sethostent_r_proto'
21714 setlocale_r_proto='$setlocale_r_proto'
21715 setnetent_r_proto='$setnetent_r_proto'
21716 setprotoent_r_proto='$setprotoent_r_proto'
21717 setpwent_r_proto='$setpwent_r_proto'
21718 setservent_r_proto='$setservent_r_proto'
21719 sh='$sh'
21720 shar='$shar'
21721 sharpbang='$sharpbang'
21722 shmattype='$shmattype'
21723 shortsize='$shortsize'
21724 shrpenv='$shrpenv'
21725 shsharp='$shsharp'
21726 sig_count='$sig_count'
21727 sig_name='$sig_name'
21728 sig_name_init='$sig_name_init'
21729 sig_num='$sig_num'
21730 sig_num_init='$sig_num_init'
21731 sig_size='$sig_size'
21732 signal_t='$signal_t'
21733 sitearch='$sitearch'
21734 sitearchexp='$sitearchexp'
21735 sitebin='$sitebin'
21736 sitebinexp='$sitebinexp'
21737 sitehtml1dir='$sitehtml1dir'
21738 sitehtml1direxp='$sitehtml1direxp'
21739 sitehtml3dir='$sitehtml3dir'
21740 sitehtml3direxp='$sitehtml3direxp'
21741 sitelib='$sitelib'
21742 sitelib_stem='$sitelib_stem'
21743 sitelibexp='$sitelibexp'
21744 siteman1dir='$siteman1dir'
21745 siteman1direxp='$siteman1direxp'
21746 siteman3dir='$siteman3dir'
21747 siteman3direxp='$siteman3direxp'
21748 siteprefix='$siteprefix'
21749 siteprefixexp='$siteprefixexp'
21750 sitescript='$sitescript'
21751 sitescriptexp='$sitescriptexp'
21752 sizesize='$sizesize'
21753 sizetype='$sizetype'
21754 sleep='$sleep'
21755 smail='$smail'
21756 so='$so'
21757 sockethdr='$sockethdr'
21758 socketlib='$socketlib'
21759 socksizetype='$socksizetype'
21760 sort='$sort'
21761 spackage='$spackage'
21762 spitshell='$spitshell'
21763 srand48_r_proto='$srand48_r_proto'
21764 srandom_r_proto='$srandom_r_proto'
21765 src='$src'
21766 ssizetype='$ssizetype'
21767 startperl='$startperl'
21768 startsh='$startsh'
21769 static_ext='$static_ext'
21770 stdchar='$stdchar'
21771 stdio_base='$stdio_base'
21772 stdio_bufsiz='$stdio_bufsiz'
21773 stdio_cnt='$stdio_cnt'
21774 stdio_filbuf='$stdio_filbuf'
21775 stdio_ptr='$stdio_ptr'
21776 stdio_stream_array='$stdio_stream_array'
21777 strerror_r_proto='$strerror_r_proto'
21778 strings='$strings'
21779 submit='$submit'
21780 subversion='$subversion'
21781 sysman='$sysman'
21782 tail='$tail'
21783 tar='$tar'
21784 targetarch='$targetarch'
21785 tbl='$tbl'
21786 tee='$tee'
21787 test='$test'
21788 timeincl='$timeincl'
21789 timetype='$timetype'
21790 tmpnam_r_proto='$tmpnam_r_proto'
21791 to='$to'
21792 touch='$touch'
21793 tr='$tr'
21794 trnl='$trnl'
21795 troff='$troff'
21796 ttyname_r_proto='$ttyname_r_proto'
21797 u16size='$u16size'
21798 u16type='$u16type'
21799 u32size='$u32size'
21800 u32type='$u32type'
21801 u64size='$u64size'
21802 u64type='$u64type'
21803 u8size='$u8size'
21804 u8type='$u8type'
21805 uidformat='$uidformat'
21806 uidsign='$uidsign'
21807 uidsize='$uidsize'
21808 uidtype='$uidtype'
21809 uname='$uname'
21810 uniq='$uniq'
21811 uquadtype='$uquadtype'
21812 use5005threads='$use5005threads'
21813 use64bitall='$use64bitall'
21814 use64bitint='$use64bitint'
21815 usecrosscompile='$usecrosscompile'
21816 usedl='$usedl'
21817 usefaststdio='$usefaststdio'
21818 useithreads='$useithreads'
21819 uselargefiles='$uselargefiles'
21820 uselongdouble='$uselongdouble'
21821 usemallocwrap='$usemallocwrap'
21822 usemorebits='$usemorebits'
21823 usemultiplicity='$usemultiplicity'
21824 usemymalloc='$usemymalloc'
21825 usenm='$usenm'
21826 useopcode='$useopcode'
21827 useperlio='$useperlio'
21828 useposix='$useposix'
21829 usereentrant='$usereentrant'
21830 userelocatableinc='$userelocatableinc'
21831 usesfio='$usesfio'
21832 useshrplib='$useshrplib'
21833 usesitecustomize='$usesitecustomize'
21834 usesocks='$usesocks'
21835 usethreads='$usethreads'
21836 usevendorprefix='$usevendorprefix'
21837 usevfork='$usevfork'
21838 usrinc='$usrinc'
21839 uuname='$uuname'
21840 uvXUformat='$uvXUformat'
21841 uvoformat='$uvoformat'
21842 uvsize='$uvsize'
21843 uvtype='$uvtype'
21844 uvuformat='$uvuformat'
21845 uvxformat='$uvxformat'
21846 vendorarch='$vendorarch'
21847 vendorarchexp='$vendorarchexp'
21848 vendorbin='$vendorbin'
21849 vendorbinexp='$vendorbinexp'
21850 vendorhtml1dir='$vendorhtml1dir'
21851 vendorhtml1direxp='$vendorhtml1direxp'
21852 vendorhtml3dir='$vendorhtml3dir'
21853 vendorhtml3direxp='$vendorhtml3direxp'
21854 vendorlib='$vendorlib'
21855 vendorlib_stem='$vendorlib_stem'
21856 vendorlibexp='$vendorlibexp'
21857 vendorman1dir='$vendorman1dir'
21858 vendorman1direxp='$vendorman1direxp'
21859 vendorman3dir='$vendorman3dir'
21860 vendorman3direxp='$vendorman3direxp'
21861 vendorprefix='$vendorprefix'
21862 vendorprefixexp='$vendorprefixexp'
21863 vendorscript='$vendorscript'
21864 vendorscriptexp='$vendorscriptexp'
21865 version='$version'
21866 version_patchlevel_string='$version_patchlevel_string'
21867 versiononly='$versiononly'
21868 vi='$vi'
21869 voidflags='$voidflags'
21870 xlibpth='$xlibpth'
21871 yacc='$yacc'
21872 yaccflags='$yaccflags'
21873 zcat='$zcat'
21874 zip='$zip'
21875 EOT
21876
21877 : Add in command line options if available
21878 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
21879
21880 : add special variables
21881 $test -f $src/patchlevel.h && \
21882 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
21883 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
21884 echo "PERL_CONFIG_SH=true" >>config.sh
21885
21886 : propagate old symbols
21887 if $test -f UU/config.sh; then
21888         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
21889         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
21890         $sort | $uniq -u >UU/oldsyms
21891         set X `cat UU/oldsyms`
21892         shift
21893         case $# in
21894         0) ;;
21895         *)
21896                 cat <<EOM
21897 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
21898 EOM
21899                 echo "# Variables propagated from previous config.sh file." >>config.sh
21900                 for sym in `cat UU/oldsyms`; do
21901                         echo "    Propagating $hint variable "'$'"$sym..."
21902                         eval 'tmp="$'"${sym}"'"'
21903                         echo "$tmp" | \
21904                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
21905                 done
21906                 ;;
21907         esac
21908 fi
21909
21910 : Finish up by extracting the .SH files
21911 case "$alldone" in
21912 exit)
21913         $rm -rf UU
21914         echo "Extraction done."
21915         exit 0
21916         ;;
21917 cont)
21918         ;;
21919 '')
21920         dflt=''
21921         nostick=true
21922         $cat <<EOM
21923
21924 If you'd like to make any changes to the config.sh file before I begin
21925 to configure things, do it as a shell escape now (e.g. !vi config.sh).
21926
21927 EOM
21928         rp="Press return or use a shell escape to edit config.sh:"
21929         . UU/myread
21930         nostick=''
21931         case "$ans" in
21932         '') ;;
21933         *) : in case they cannot read
21934                 sh 1>&4 -c "$ans";;
21935         esac
21936         ;;
21937 esac
21938
21939 : if this fails, just run all the .SH files by hand
21940 . ./config.sh
21941
21942 echo " "
21943 exec 1>&4
21944 pwd=`pwd`
21945 . ./UU/extract
21946 cd "$pwd"
21947
21948 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
21949         dflt=y
21950         case "$silent" in
21951         true) ;;
21952         *)
21953                 $cat <<EOM
21954
21955 Now you need to generate make dependencies by running "$make depend".
21956 You might prefer to run it in background: "$make depend > makedepend.out &"
21957 It can take a while, so you might not want to run it right now.
21958
21959 EOM
21960                 ;;
21961         esac
21962         rp="Run $make depend now?"
21963         . UU/myread
21964         case "$ans" in
21965         y*)
21966                 $make depend && echo "Now you must run '$make'."
21967                 ;;
21968         *)
21969                 echo "You must run '$make depend' then '$make'."
21970                 ;;
21971         esac
21972 elif test -f [Mm]akefile; then
21973         echo " "
21974         echo "Now you must run a $make."
21975 else
21976         echo "Configure done."
21977 fi
21978
21979 if $test -f Policy.sh; then
21980     $cat <<EOM
21981
21982 If you compile $package on a different machine or from a different object
21983 directory, copy the Policy.sh file from this object directory to the
21984 new one before you run Configure -- this will help you with most of
21985 the policy defaults.
21986
21987 EOM
21988 fi
21989 if $test -f config.msg; then
21990     echo "Hmm.  I also noted the following information while running:"
21991     echo " "
21992     $cat config.msg >&4
21993     $rm -f config.msg
21994 fi
21995 $rm -f kit*isdone ark*isdone
21996 $rm -rf UU
21997
21998 : End of Configure
21999