blead 25801: Symbian batch of today
[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 Tue Oct 18 16:11:43 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_clearenv=''
366 d_closedir=''
367 d_void_closedir=''
368 d_cmsghdr_s=''
369 d_const=''
370 d_copysignl=''
371 cryptlib=''
372 d_crypt=''
373 crypt_r_proto=''
374 d_crypt_r=''
375 d_csh=''
376 full_csh=''
377 ctermid_r_proto=''
378 d_ctermid_r=''
379 ctime_r_proto=''
380 d_ctime_r=''
381 d_cuserid=''
382 d_dbl_dig=''
383 d_dbminitproto=''
384 d_difftime=''
385 d_dirfd=''
386 d_dlerror=''
387 d_dlopen=''
388 d_dlsymun=''
389 d_dosuid=''
390 d_suidsafe=''
391 d_drand48_r=''
392 drand48_r_proto=''
393 d_drand48proto=''
394 d_dup2=''
395 d_eaccess=''
396 d_endgrent=''
397 d_endgrent_r=''
398 endgrent_r_proto=''
399 d_endhent=''
400 d_endhostent_r=''
401 endhostent_r_proto=''
402 d_endnent=''
403 d_endnetent_r=''
404 endnetent_r_proto=''
405 d_endpent=''
406 d_endprotoent_r=''
407 endprotoent_r_proto=''
408 d_endpwent=''
409 d_endpwent_r=''
410 endpwent_r_proto=''
411 d_endsent=''
412 d_endservent_r=''
413 endservent_r_proto=''
414 d_faststdio=''
415 d_fchdir=''
416 d_fchmod=''
417 d_fchown=''
418 d_fcntl=''
419 d_fcntl_can_lock=''
420 d_fd_macros=''
421 d_fd_set=''
422 d_fds_bits=''
423 d_fgetpos=''
424 d_finite=''
425 d_finitel=''
426 d_flexfnam=''
427 d_flock=''
428 d_flockproto=''
429 d_fork=''
430 d_fp_class=''
431 d_fpclass=''
432 d_fpclassify=''
433 d_fpclassl=''
434 d_fpos64_t=''
435 d_frexpl=''
436 d_fs_data_s=''
437 d_fseeko=''
438 d_fsetpos=''
439 d_fstatfs=''
440 d_fsync=''
441 d_ftello=''
442 d_ftime=''
443 d_gettimeod=''
444 d_Gconvert=''
445 d_getcwd=''
446 d_getespwnam=''
447 d_getfsstat=''
448 d_getgrent=''
449 d_getgrent_r=''
450 getgrent_r_proto=''
451 d_getgrgid_r=''
452 getgrgid_r_proto=''
453 d_getgrnam_r=''
454 getgrnam_r_proto=''
455 d_getgrps=''
456 d_gethbyaddr=''
457 d_gethbyname=''
458 d_gethent=''
459 aphostname=''
460 d_gethname=''
461 d_phostname=''
462 d_uname=''
463 d_gethostbyaddr_r=''
464 gethostbyaddr_r_proto=''
465 d_gethostbyname_r=''
466 gethostbyname_r_proto=''
467 d_gethostent_r=''
468 gethostent_r_proto=''
469 d_gethostprotos=''
470 d_getitimer=''
471 d_getlogin=''
472 d_getlogin_r=''
473 getlogin_r_proto=''
474 d_getmnt=''
475 d_getmntent=''
476 d_getnbyaddr=''
477 d_getnbyname=''
478 d_getnent=''
479 d_getnetbyaddr_r=''
480 getnetbyaddr_r_proto=''
481 d_getnetbyname_r=''
482 getnetbyname_r_proto=''
483 d_getnetent_r=''
484 getnetent_r_proto=''
485 d_getnetprotos=''
486 d_getpagsz=''
487 d_getpent=''
488 d_getpgid=''
489 d_getpgrp2=''
490 d_bsdgetpgrp=''
491 d_getpgrp=''
492 d_getppid=''
493 d_getprior=''
494 d_getpbyname=''
495 d_getpbynumber=''
496 d_getprotobyname_r=''
497 getprotobyname_r_proto=''
498 d_getprotobynumber_r=''
499 getprotobynumber_r_proto=''
500 d_getprotoent_r=''
501 getprotoent_r_proto=''
502 d_getprotoprotos=''
503 d_getprpwnam=''
504 d_getpwent=''
505 d_getpwent_r=''
506 getpwent_r_proto=''
507 d_getpwnam_r=''
508 getpwnam_r_proto=''
509 d_getpwuid_r=''
510 getpwuid_r_proto=''
511 d_getsent=''
512 d_getservbyname_r=''
513 getservbyname_r_proto=''
514 d_getservbyport_r=''
515 getservbyport_r_proto=''
516 d_getservent_r=''
517 getservent_r_proto=''
518 d_getservprotos=''
519 d_getspnam=''
520 d_getspnam_r=''
521 getspnam_r_proto=''
522 d_getsbyname=''
523 d_getsbyport=''
524 d_gmtime_r=''
525 gmtime_r_proto=''
526 d_gnulibc=''
527 gnulibc_version=''
528 d_hasmntopt=''
529 d_htonl=''
530 d_ilogbl=''
531 d_inetaton=''
532 d_int64_t=''
533 d_isascii=''
534 d_isfinite=''
535 d_isinf=''
536 d_isnan=''
537 d_isnanl=''
538 d_killpg=''
539 d_lchown=''
540 d_ldbl_dig=''
541 d_libm_lib_version=''
542 d_link=''
543 d_localtime_r=''
544 localtime_r_proto=''
545 d_locconv=''
546 d_lockf=''
547 d_longdbl=''
548 longdblsize=''
549 d_longlong=''
550 longlongsize=''
551 d_lseekproto=''
552 d_lstat=''
553 d_madvise=''
554 d_malloc_good_size=''
555 d_malloc_size=''
556 d_mblen=''
557 d_mbstowcs=''
558 d_mbtowc=''
559 d_memchr=''
560 d_memcmp=''
561 d_memcpy=''
562 d_memmove=''
563 d_memset=''
564 d_mkdir=''
565 d_mkdtemp=''
566 d_mkfifo=''
567 d_mkstemp=''
568 d_mkstemps=''
569 d_mktime=''
570 d_mmap=''
571 mmaptype=''
572 d_modfl=''
573 d_modfl_pow32_bug=''
574 d_modflproto=''
575 d_mprotect=''
576 d_msg=''
577 d_msgctl=''
578 d_msgget=''
579 d_msghdr_s=''
580 d_msgrcv=''
581 d_msgsnd=''
582 d_msync=''
583 d_munmap=''
584 d_nice=''
585 d_nl_langinfo=''
586 d_off64_t=''
587 d_open3=''
588 d_fpathconf=''
589 d_pathconf=''
590 d_pause=''
591 d_pipe=''
592 d_poll=''
593 d_portable=''
594 d_procselfexe=''
595 procselfexe=''
596 d_old_pthread_create_joinable=''
597 old_pthread_create_joinable=''
598 d_pthread_atfork=''
599 d_pthread_attr_setscope=''
600 d_pthread_yield=''
601 d_sched_yield=''
602 sched_yield=''
603 d_qgcvt=''
604 d_random_r=''
605 random_r_proto=''
606 d_readdir64_r=''
607 readdir64_r_proto=''
608 d_readdir=''
609 d_rewinddir=''
610 d_seekdir=''
611 d_telldir=''
612 d_readdir_r=''
613 readdir_r_proto=''
614 d_readlink=''
615 d_readv=''
616 d_recvmsg=''
617 d_rename=''
618 d_rmdir=''
619 d_safebcpy=''
620 d_safemcpy=''
621 d_sanemcmp=''
622 d_sbrkproto=''
623 d_scalbnl=''
624 d_select=''
625 d_sem=''
626 d_semctl=''
627 d_semget=''
628 d_semop=''
629 d_sendmsg=''
630 d_setegid=''
631 d_seteuid=''
632 d_setgrent=''
633 d_setgrent_r=''
634 setgrent_r_proto=''
635 d_setgrps=''
636 d_sethent=''
637 d_sethostent_r=''
638 sethostent_r_proto=''
639 d_setitimer=''
640 d_setlinebuf=''
641 d_setlocale=''
642 d_setlocale_r=''
643 setlocale_r_proto=''
644 d_setnent=''
645 d_setnetent_r=''
646 setnetent_r_proto=''
647 d_setpent=''
648 d_setpgid=''
649 d_setpgrp2=''
650 d_bsdsetpgrp=''
651 d_setpgrp=''
652 d_setprior=''
653 d_setproctitle=''
654 d_setprotoent_r=''
655 setprotoent_r_proto=''
656 d_setpwent=''
657 d_setpwent_r=''
658 setpwent_r_proto=''
659 d_setregid=''
660 d_setresgid=''
661 d_setresuid=''
662 d_setreuid=''
663 d_setrgid=''
664 d_setruid=''
665 d_setsent=''
666 d_setservent_r=''
667 setservent_r_proto=''
668 d_setsid=''
669 d_setvbuf=''
670 d_sfio=''
671 usesfio=''
672 d_shm=''
673 d_shmat=''
674 d_shmatprototype=''
675 shmattype=''
676 d_shmctl=''
677 d_shmdt=''
678 d_shmget=''
679 d_sigaction=''
680 d_sigprocmask=''
681 d_sigsetjmp=''
682 usesitecustomize=''
683 d_sockatmark=''
684 d_sockatmarkproto=''
685 d_msg_ctrunc=''
686 d_msg_dontroute=''
687 d_msg_oob=''
688 d_msg_peek=''
689 d_msg_proxy=''
690 d_oldsock=''
691 d_scm_rights=''
692 d_socket=''
693 d_sockpair=''
694 sockethdr=''
695 socketlib=''
696 d_socklen_t=''
697 d_socks5_init=''
698 d_sqrtl=''
699 d_srand48_r=''
700 srand48_r_proto=''
701 d_srandom_r=''
702 srandom_r_proto=''
703 d_sresgproto=''
704 d_sresuproto=''
705 d_statblks=''
706 d_statfs_f_flags=''
707 d_statfs_s=''
708 d_fstatvfs=''
709 d_statvfs=''
710 d_stdio_cnt_lval=''
711 d_stdio_ptr_lval=''
712 d_stdio_ptr_lval_nochange_cnt=''
713 d_stdio_ptr_lval_sets_cnt=''
714 d_stdiobase=''
715 d_stdstdio=''
716 stdio_base=''
717 stdio_bufsiz=''
718 stdio_cnt=''
719 stdio_filbuf=''
720 stdio_ptr=''
721 d_index=''
722 d_strchr=''
723 d_strcoll=''
724 d_strctcpy=''
725 d_strerrm=''
726 d_strerror=''
727 d_sysernlst=''
728 d_syserrlst=''
729 d_strerror_r=''
730 strerror_r_proto=''
731 d_strftime=''
732 d_strlcat=''
733 d_strlcpy=''
734 d_strtod=''
735 d_strtol=''
736 d_strtold=''
737 d_strtoll=''
738 d_strtoq=''
739 d_strtoul=''
740 d_strtoull=''
741 d_strtouq=''
742 d_strxfrm=''
743 d_symlink=''
744 d_syscall=''
745 d_syscallproto=''
746 d_sysconf=''
747 d_system=''
748 d_tcgetpgrp=''
749 d_tcsetpgrp=''
750 d_telldirproto=''
751 d_time=''
752 timetype=''
753 clocktype=''
754 d_times=''
755 d_tmpnam_r=''
756 tmpnam_r_proto=''
757 d_truncate=''
758 d_ttyname_r=''
759 ttyname_r_proto=''
760 d_tzname=''
761 d_u32align=''
762 d_ualarm=''
763 d_umask=''
764 d_semctl_semid_ds=''
765 d_semctl_semun=''
766 d_union_semun=''
767 d_unordered=''
768 d_unsetenv=''
769 d_usleep=''
770 d_usleepproto=''
771 d_ustat=''
772 d_vfork=''
773 usevfork=''
774 d_voidsig=''
775 signal_t=''
776 d_volatile=''
777 d_charvspr=''
778 d_vprintf=''
779 d_wait4=''
780 d_waitpid=''
781 d_wcstombs=''
782 d_wctomb=''
783 d_writev=''
784 dlext=''
785 cccdlflags=''
786 ccdlflags=''
787 dlsrc=''
788 ld=''
789 lddlflags=''
790 usedl=''
791 doublesize=''
792 ebcdic=''
793 fflushNULL=''
794 fflushall=''
795 fpossize=''
796 fpostype=''
797 gccansipedantic=''
798 gccosandvers=''
799 gccversion=''
800 gidformat=''
801 gidsign=''
802 gidsize=''
803 gidtype=''
804 groupstype=''
805 h_fcntl=''
806 h_sysfile=''
807 html1dir=''
808 html1direxp=''
809 installhtml1dir=''
810 html3dir=''
811 html3direxp=''
812 installhtml3dir=''
813 i_arpainet=''
814 i_crypt=''
815 db_hashtype=''
816 db_prefixtype=''
817 db_version_major=''
818 db_version_minor=''
819 db_version_patch=''
820 i_db=''
821 i_dbm=''
822 i_rpcsvcdbm=''
823 d_dirnamlen=''
824 direntrytype=''
825 i_dirent=''
826 i_dld=''
827 i_dlfcn=''
828 i_fcntl=''
829 i_float=''
830 i_fp=''
831 i_fp_class=''
832 i_gdbm=''
833 d_grpasswd=''
834 i_grp=''
835 i_ieeefp=''
836 i_inttypes=''
837 i_langinfo=''
838 i_libutil=''
839 i_limits=''
840 i_locale=''
841 i_machcthr=''
842 i_malloc=''
843 i_math=''
844 i_memory=''
845 i_mntent=''
846 i_ndbm=''
847 i_netdb=''
848 i_neterrno=''
849 i_netinettcp=''
850 i_niin=''
851 i_sysin=''
852 i_poll=''
853 i_prot=''
854 i_pthread=''
855 d_pwage=''
856 d_pwchange=''
857 d_pwclass=''
858 d_pwcomment=''
859 d_pwexpire=''
860 d_pwgecos=''
861 d_pwpasswd=''
862 d_pwquota=''
863 i_pwd=''
864 i_sfio=''
865 i_shadow=''
866 i_socks=''
867 i_stddef=''
868 i_stdlib=''
869 i_string=''
870 strings=''
871 i_sunmath=''
872 i_sysaccess=''
873 i_sysdir=''
874 i_sysfile=''
875 d_voidtty=''
876 i_bsdioctl=''
877 i_sysfilio=''
878 i_sysioctl=''
879 i_syssockio=''
880 i_syslog=''
881 i_sysmman=''
882 i_sysmode=''
883 i_sysmount=''
884 i_sysndir=''
885 i_sysparam=''
886 i_sysresrc=''
887 i_syssecrt=''
888 i_sysselct=''
889 i_sysstat=''
890 i_sysstatfs=''
891 i_sysstatvfs=''
892 i_systimes=''
893 i_systypes=''
894 i_sysuio=''
895 i_sysun=''
896 i_sysutsname=''
897 i_sysvfs=''
898 i_syswait=''
899 i_sgtty=''
900 i_termio=''
901 i_termios=''
902 d_tm_tm_gmtoff=''
903 d_tm_tm_zone=''
904 i_systime=''
905 i_systimek=''
906 i_time=''
907 timeincl=''
908 i_unistd=''
909 i_ustat=''
910 i_utime=''
911 i_values=''
912 i_stdarg=''
913 i_varargs=''
914 i_varhdr=''
915 i_vfork=''
916 inc_version_list=''
917 inc_version_list_init=''
918 installprefix=''
919 installprefixexp=''
920 installstyle=''
921 installusrbinperl=''
922 intsize=''
923 longsize=''
924 shortsize=''
925 issymlink=''
926 libc=''
927 ldlibpthname=''
928 libperl=''
929 shrpenv=''
930 useshrplib=''
931 glibpth=''
932 libpth=''
933 loclibpth=''
934 plibpth=''
935 xlibpth=''
936 ignore_versioned_solibs=''
937 libs=''
938 libsdirs=''
939 libsfiles=''
940 libsfound=''
941 libspath=''
942 lns=''
943 d_PRIEUldbl=''
944 d_PRIFUldbl=''
945 d_PRIGUldbl=''
946 d_PRIeldbl=''
947 d_PRIfldbl=''
948 d_PRIgldbl=''
949 d_SCNfldbl=''
950 sPRIEUldbl=''
951 sPRIFUldbl=''
952 sPRIGUldbl=''
953 sPRIeldbl=''
954 sPRIfldbl=''
955 sPRIgldbl=''
956 sSCNfldbl=''
957 lseeksize=''
958 lseektype=''
959 make_set_make=''
960 d_mymalloc=''
961 freetype=''
962 mallocobj=''
963 mallocsrc=''
964 malloctype=''
965 usemallocwrap=''
966 usemymalloc=''
967 installman1dir=''
968 man1dir=''
969 man1direxp=''
970 man1ext=''
971 installman3dir=''
972 man3dir=''
973 man3direxp=''
974 man3ext=''
975 modetype=''
976 multiarch=''
977 mydomain=''
978 myhostname=''
979 phostname=''
980 c=''
981 n=''
982 d_eofnblk=''
983 eagain=''
984 o_nonblock=''
985 rd_nodata=''
986 need_va_copy=''
987 netdb_hlen_type=''
988 netdb_host_type=''
989 netdb_name_type=''
990 netdb_net_type=''
991 groupcat=''
992 hostcat=''
993 passcat=''
994 orderlib=''
995 ranlib=''
996 d_perl_otherlibdirs=''
997 otherlibdirs=''
998 package=''
999 spackage=''
1000 pager=''
1001 api_revision=''
1002 api_subversion=''
1003 api_version=''
1004 api_versionstring=''
1005 patchlevel=''
1006 perl_patchlevel=''
1007 revision=''
1008 subversion=''
1009 version=''
1010 version_patchlevel_string=''
1011 perl5=''
1012 perladmin=''
1013 perlpath=''
1014 d_nv_preserves_uv=''
1015 d_nv_zero_is_allbits_zero=''
1016 i16size=''
1017 i16type=''
1018 i32size=''
1019 i32type=''
1020 i64size=''
1021 i64type=''
1022 i8size=''
1023 i8type=''
1024 ivsize=''
1025 ivtype=''
1026 nv_preserves_uv_bits=''
1027 nvsize=''
1028 nvtype=''
1029 u16size=''
1030 u16type=''
1031 u32size=''
1032 u32type=''
1033 u64size=''
1034 u64type=''
1035 u8size=''
1036 u8type=''
1037 uvsize=''
1038 uvtype=''
1039 ivdformat=''
1040 nvEUformat=''
1041 nvFUformat=''
1042 nvGUformat=''
1043 nveformat=''
1044 nvfformat=''
1045 nvgformat=''
1046 uvXUformat=''
1047 uvoformat=''
1048 uvuformat=''
1049 uvxformat=''
1050 pidtype=''
1051 prefix=''
1052 prefixexp=''
1053 installprivlib=''
1054 privlib=''
1055 privlibexp=''
1056 prototype=''
1057 ptrsize=''
1058 d_PRIXU64=''
1059 d_PRId64=''
1060 d_PRIi64=''
1061 d_PRIo64=''
1062 d_PRIu64=''
1063 d_PRIx64=''
1064 sPRIXU64=''
1065 sPRId64=''
1066 sPRIi64=''
1067 sPRIo64=''
1068 sPRIu64=''
1069 sPRIx64=''
1070 d_quad=''
1071 quadkind=''
1072 quadtype=''
1073 uquadtype=''
1074 drand01=''
1075 randbits=''
1076 randfunc=''
1077 randseedtype=''
1078 seedfunc=''
1079 installscript=''
1080 scriptdir=''
1081 scriptdirexp=''
1082 selectminbits=''
1083 selecttype=''
1084 sh=''
1085 sig_count=''
1086 sig_name=''
1087 sig_name_init=''
1088 sig_num=''
1089 sig_num_init=''
1090 sig_size=''
1091 installsitearch=''
1092 sitearch=''
1093 sitearchexp=''
1094 installsitebin=''
1095 sitebin=''
1096 sitebinexp=''
1097 installsitehtml1dir=''
1098 sitehtml1dir=''
1099 sitehtml1direxp=''
1100 installsitehtml3dir=''
1101 sitehtml3dir=''
1102 sitehtml3direxp=''
1103 installsitelib=''
1104 sitelib=''
1105 sitelib_stem=''
1106 sitelibexp=''
1107 installsiteman1dir=''
1108 siteman1dir=''
1109 siteman1direxp=''
1110 installsiteman3dir=''
1111 siteman3dir=''
1112 siteman3direxp=''
1113 siteprefix=''
1114 siteprefixexp=''
1115 installsitescript=''
1116 sitescript=''
1117 sitescriptexp=''
1118 sizesize=''
1119 sizetype=''
1120 so=''
1121 socksizetype=''
1122 sharpbang=''
1123 shsharp=''
1124 spitshell=''
1125 src=''
1126 ssizetype=''
1127 startperl=''
1128 startsh=''
1129 stdchar=''
1130 d_stdio_stream_array=''
1131 stdio_stream_array=''
1132 sysman=''
1133 trnl=''
1134 uidformat=''
1135 uidsign=''
1136 uidsize=''
1137 uidtype=''
1138 archname64=''
1139 use64bitall=''
1140 use64bitint=''
1141 usefaststdio=''
1142 ccflags_uselargefiles=''
1143 ldflags_uselargefiles=''
1144 libswanted_uselargefiles=''
1145 uselargefiles=''
1146 uselongdouble=''
1147 usemorebits=''
1148 usemultiplicity=''
1149 nm_opt=''
1150 nm_so_opt=''
1151 runnm=''
1152 usenm=''
1153 useperlio=''
1154 userelocatableinc=''
1155 usesocks=''
1156 d_oldpthreads=''
1157 use5005threads=''
1158 useithreads=''
1159 usereentrant=''
1160 usethreads=''
1161 incpath=''
1162 mips_type=''
1163 usrinc=''
1164 d_vendorarch=''
1165 installvendorarch=''
1166 vendorarch=''
1167 vendorarchexp=''
1168 d_vendorbin=''
1169 installvendorbin=''
1170 vendorbin=''
1171 vendorbinexp=''
1172 installvendorhtml1dir=''
1173 vendorhtml1dir=''
1174 vendorhtml1direxp=''
1175 installvendorhtml3dir=''
1176 vendorhtml3dir=''
1177 vendorhtml3direxp=''
1178 d_vendorlib=''
1179 installvendorlib=''
1180 vendorlib=''
1181 vendorlib_stem=''
1182 vendorlibexp=''
1183 installvendorman1dir=''
1184 vendorman1dir=''
1185 vendorman1direxp=''
1186 installvendorman3dir=''
1187 vendorman3dir=''
1188 vendorman3direxp=''
1189 usevendorprefix=''
1190 vendorprefix=''
1191 vendorprefixexp=''
1192 d_vendorscript=''
1193 installvendorscript=''
1194 vendorscript=''
1195 vendorscriptexp=''
1196 versiononly=''
1197 defvoidused=''
1198 voidflags=''
1199 yacc=''
1200 yaccflags=''
1201 CONFIG=''
1202
1203 define='define'
1204 undef='undef'
1205 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1206 rmlist=''
1207
1208 : We must find out about Eunice early
1209 eunicefix=':'
1210 if test -f /etc/unixtovms; then
1211         eunicefix=/etc/unixtovms
1212 fi
1213 if test -f /etc/unixtovms.exe; then
1214         eunicefix=/etc/unixtovms.exe
1215 fi
1216
1217 : Set executable suffix now -- needed before hints available
1218 if test -f "/libs/version.library"; then
1219 : Amiga OS
1220     _exe=""
1221 elif test -f "/system/gnu_library/bin/ar.pm"; then
1222 : Stratus VOS
1223     _exe=".pm"
1224 elif test -n "$DJGPP"; then
1225 : DOS DJGPP
1226     _exe=".exe"
1227 elif test -d c:/. -o -n "$is_os2" ; then
1228 : OS/2 or cygwin
1229     _exe=".exe"
1230 fi
1231
1232 i_whoami=''
1233 ccname=''
1234 ccversion=''
1235 perllibs=''
1236 : set useposix=false in your hint file to disable the POSIX extension.
1237 useposix=true
1238 : set useopcode=false in your hint file to disable the Opcode extension.
1239 useopcode=true
1240 : Trailing extension.  Override this in a hint file, if needed.
1241 : Extra object files, if any, needed on this platform.
1242 archobjs=''
1243 archname=''
1244 : Possible local include directories to search.
1245 : Set locincpth to "" in a hint file to defeat local include searches.
1246 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1247 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1248 :
1249 : no include file wanted by default
1250 inclwanted=''
1251
1252 groupstype=''
1253 libnames=''
1254 : change the next line if compiling for Xenix/286 on Xenix/386
1255 xlibpth='/usr/lib/386 /lib/386'
1256 : Possible local library directories to search.
1257 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1258 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1259
1260 : general looking path for locating libraries
1261 glibpth="/lib /usr/lib $xlibpth"
1262 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1263 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1264 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1265
1266 : Private path used by Configure to find libraries.  Its value
1267 : is prepended to libpth. This variable takes care of special
1268 : machines, like the mips.  Usually, it should be empty.
1269 plibpth=''
1270
1271 : default library list
1272 libswanted=''
1273 : some systems want to use only the non-versioned libso:s
1274 ignore_versioned_solibs=''
1275 siteman1dir=''
1276 siteman3dir=''
1277 sitescript=''
1278 archname64=''
1279 ccflags_uselargefiles=''
1280 ldflags_uselargefiles=''
1281 libswanted_uselargefiles=''
1282 : set usemultiplicity on the Configure command line to enable multiplicity.
1283 : set usesocks on the Configure command line to enable socks.
1284 : set usethreads on the Configure command line to enable threads.
1285 usereentrant='undef'
1286 : full support for void wanted by default
1287 defvoidused=15
1288
1289 : List of libraries we want.
1290 : If anyone needs extra -lxxx, put those in a hint file.
1291 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1292 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1293 : We probably want to search /usr/shlib before most other libraries.
1294 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1295 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1296 glibpth="/usr/shlib $glibpth"
1297 : Do not use vfork unless overridden by a hint file.
1298 usevfork=false
1299
1300 : Find the basic shell for Bourne shell scripts
1301 case "$sh" in
1302 '')
1303         case "$SYSTYPE" in
1304         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1305         *) xxx='/bin/sh';;
1306         esac
1307         if test -f "$xxx"; then
1308                 sh="$xxx"
1309         else
1310                 : Build up a list and do a single loop so we can 'break' out.
1311                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1312                 for xxx in sh bash ksh pdksh ash; do
1313                         for p in $pth; do
1314                                 try="$try ${p}/${xxx}"
1315                         done
1316                 done
1317                 for xxx in $try; do
1318                         if test -f "$xxx"; then
1319                                 sh="$xxx";
1320                                 break
1321                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1322                                 sh="$xxx";
1323                                 break
1324                         elif test -f "$xxx.exe"; then
1325                                 sh="$xxx";
1326                                 break
1327                         fi
1328                 done
1329         fi
1330         ;;
1331 esac
1332
1333 case "$sh" in
1334 '')     cat >&2 <<EOM
1335 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1336
1337 Usually it's in /bin/sh.  How did you even get this far?
1338 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1339 we'll try to straighten this all out.
1340 EOM
1341         exit 1
1342         ;;
1343 esac
1344
1345 : see if sh knows # comments
1346 if `$sh -c '#' >/dev/null 2>&1`; then
1347         shsharp=true
1348         spitshell=cat
1349         xcat=/bin/cat
1350         test -f $xcat$_exe || xcat=/usr/bin/cat
1351         if test ! -f $xcat$_exe; then
1352                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1353                         if test -f $p/cat$_exe; then
1354                                 xcat=$p/cat
1355                                 break
1356                         fi
1357                 done
1358                 if test ! -f $xcat$_exe; then
1359                         echo "Can't find cat anywhere!"
1360                         exit 1
1361                 fi
1362         fi
1363         echo "#!$xcat" >sharp
1364         $eunicefix sharp
1365         chmod +x sharp
1366         ./sharp > today
1367         if test -s today; then
1368                 sharpbang='#!'
1369         else
1370                 echo "#! $xcat" > sharp
1371                 $eunicefix sharp
1372                 chmod +x sharp
1373                 ./sharp > today
1374                 if test -s today; then
1375                         sharpbang='#! '
1376                 else
1377                         sharpbang=': use '
1378                 fi
1379         fi
1380 else
1381         echo " "
1382         echo "Your $sh doesn't grok # comments--I will strip them later on."
1383         shsharp=false
1384         cd ..
1385         echo "exec grep -v '^[  ]*#'" >spitshell
1386         chmod +x spitshell
1387         $eunicefix spitshell
1388         spitshell=`pwd`/spitshell
1389         cd UU
1390         echo "I presume that if # doesn't work, #! won't work either!"
1391         sharpbang=': use '
1392 fi
1393 rm -f sharp today
1394
1395 : figure out how to guarantee sh startup
1396 case "$startsh" in
1397 '') startsh=${sharpbang}${sh} ;;
1398 *)
1399 esac
1400 cat >sharp <<EOSS
1401 $startsh
1402 set abc
1403 test "$?abc" != 1
1404 EOSS
1405
1406 chmod +x sharp
1407 $eunicefix sharp
1408 if ./sharp; then
1409         : echo "Yup, it does."
1410 else
1411         echo "Hmm... '$startsh' does not guarantee sh startup..."
1412         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1413 fi
1414 rm -f sharp
1415
1416
1417 : Save command line options in file UU/cmdline.opt for later use in
1418 : generating config.sh.
1419 cat > cmdline.opt <<EOSH
1420 # Configure command line arguments.
1421 config_arg0='$0'
1422 config_args='$*'
1423 config_argc=$#
1424 EOSH
1425 argn=1
1426 args_exp=''
1427 args_sep=''
1428 for arg in "$@"; do
1429         cat >>cmdline.opt <<EOSH
1430 config_arg$argn='$arg'
1431 EOSH
1432         # Extreme backslashitis: replace each ' by '"'"'
1433         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1434 $arg
1435 EOC
1436         arg_exp=`cat cmdl.opt`
1437         args_exp="$args_exp$args_sep'$arg_exp'"
1438         argn=`expr $argn + 1`
1439         args_sep=' '
1440 done
1441 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1442 # used by ./hints/os2.sh
1443 rm -f cmdl.opt
1444
1445 : produce awk script to parse command line options
1446 cat >options.awk <<'EOF'
1447 BEGIN {
1448         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1449
1450         len = length(optstr);
1451         for (i = 1; i <= len; i++) {
1452                 c = substr(optstr, i, 1);
1453                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1454                 if (a == ":") {
1455                         arg[c] = 1;
1456                         i++;
1457                 }
1458                 opt[c] = 1;
1459         }
1460 }
1461 {
1462         expect = 0;
1463         str = $0;
1464         if (substr(str, 1, 1) != "-") {
1465                 printf("'%s'\n", str);
1466                 next;
1467         }
1468         len = length($0);
1469         for (i = 2; i <= len; i++) {
1470                 c = substr(str, i, 1);
1471                 if (!opt[c]) {
1472                         printf("-%s\n", substr(str, i));
1473                         next;
1474                 }
1475                 printf("-%s\n", c);
1476                 if (arg[c]) {
1477                         if (i < len)
1478                                 printf("'%s'\n", substr(str, i + 1));
1479                         else
1480                                 expect = 1;
1481                         next;
1482                 }
1483         }
1484 }
1485 END {
1486         if (expect)
1487                 print "?";
1488 }
1489 EOF
1490
1491 : process the command line options
1492 set X `for arg in "$@"; do echo "X$arg"; done |
1493         sed -e s/X// | awk -f options.awk`
1494 eval "set $*"
1495 shift
1496 rm -f options.awk
1497
1498 : set up default values
1499 fastread=''
1500 reuseval=false
1501 config_sh=''
1502 alldone=''
1503 error=''
1504 silent=''
1505 extractsh=''
1506 override=''
1507 knowitall=''
1508 rm -f optdef.sh posthint.sh
1509 cat >optdef.sh <<EOS
1510 $startsh
1511 EOS
1512
1513
1514 : option parsing
1515 while test $# -gt 0; do
1516         case "$1" in
1517         -d) shift; fastread=yes;;
1518         -e) shift; alldone=cont;;
1519         -f)
1520                 shift
1521                 cd ..
1522                 if test -r "$1"; then
1523                         config_sh="$1"
1524                 else
1525                         echo "$me: cannot read config file $1." >&2
1526                         error=true
1527                 fi
1528                 cd UU
1529                 shift;;
1530         -h) shift; error=true;;
1531         -r) shift; reuseval=true;;
1532         -s) shift; silent=true; realsilent=true;;
1533         -E) shift; alldone=exit;;
1534         -K) shift; knowitall=true;;
1535         -O) shift; override=true;;
1536         -S) shift; silent=true; extractsh=true;;
1537         -D)
1538                 shift
1539                 case "$1" in
1540                 *=)
1541                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1542                         echo "$me: ignoring -D $1" >&2
1543                         ;;
1544                 *=*) echo "$1" | \
1545                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1546                 *) echo "$1='define'" >> optdef.sh;;
1547                 esac
1548                 shift
1549                 ;;
1550         -U)
1551                 shift
1552                 case "$1" in
1553                 *=) echo "$1" >> optdef.sh;;
1554                 *=*)
1555                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1556                         echo "$me: ignoring -U $1" >&2
1557                         ;;
1558                 *) echo "$1='undef'" >> optdef.sh;;
1559                 esac
1560                 shift
1561                 ;;
1562         -A)
1563             shift
1564             xxx=''
1565             yyy="$1"
1566             zzz=''
1567             uuu=undef
1568             case "$yyy" in
1569             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1570                  case "$zzz" in
1571                  *:*) zzz='' ;;
1572                  *)   xxx=append
1573                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1574                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1575                  esac
1576                  ;;
1577             esac
1578             case "$xxx" in
1579             '')  case "$yyy" in
1580                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1581                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1582                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1583                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1584                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1585                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1586                  esac
1587                  ;;       
1588             esac
1589             case "$xxx" in
1590             append)
1591                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1592             clear)
1593                 echo "$yyy=''"                  >> posthint.sh ;;
1594             define)
1595                 case "$zzz" in
1596                 '') zzz=define ;;
1597                 esac
1598                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1599             eval)
1600                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1601             prepend)
1602                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1603             undef)
1604                 case "$zzz" in
1605                 '') zzz="$uuu" ;;
1606                 esac
1607                 echo "$yyy=$zzz"                >> posthint.sh ;;
1608             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1609             esac
1610             shift
1611             ;;
1612         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1613             exit 0;;
1614         --) break;;
1615         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1616         *) break;;
1617         esac
1618 done
1619
1620 case "$error" in
1621 true)
1622         cat >&2 <<EOM
1623 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1624                  [-U symbol] [-U symbol=] [-A command:symbol...]
1625   -d : use defaults for all answers.
1626   -e : go on without questioning past the production of config.sh.
1627   -f : specify an alternate default configuration file.
1628   -h : print this help message and exit (with an error status).
1629   -r : reuse C symbols value if possible (skips costly nm extraction).
1630   -s : silent mode, only echoes questions and essential information.
1631   -D : define symbol to have some value:
1632          -D symbol         symbol gets the value 'define'
1633          -D symbol=value   symbol gets the value 'value'
1634   -E : stop at the end of questions, after having produced config.sh.
1635   -K : do not use unless you know what you are doing.
1636   -O : let -D and -U override definitions from loaded configuration file.
1637   -S : perform variable substitutions on all .SH files (can mix with -f)
1638   -U : undefine symbol:
1639          -U symbol    symbol gets the value 'undef'
1640          -U symbol=   symbol gets completely empty
1641   -A : manipulate symbol after the platform specific hints have been applied:
1642          -A symbol=value                append " "value to symbol
1643          -A append:symbol=value         append value to symbol
1644          -A define:symbol=value         define symbol to have value
1645          -A clear:symbol                define symbol to be ''
1646          -A define:symbol               define symbol to be 'define'
1647          -A eval:symbol=value           define symbol to be eval of value
1648          -A prepend:symbol=value        prepend value to symbol
1649          -A undef:symbol                define symbol to be 'undef'
1650          -A undef:symbol=               define symbol to be ''
1651   -V : print version number and exit (with a zero status).
1652 EOM
1653         exit 1
1654         ;;
1655 esac
1656
1657 : Sanity checks
1658 case "$fastread$alldone" in
1659 yescont|yesexit) ;;
1660 *)
1661         case "$extractsh" in
1662         true) ;;
1663         *)
1664                 if test ! -t 0; then
1665                         echo "Say 'sh Configure', not 'sh <Configure'"
1666                         exit 1
1667                 fi
1668                 ;;
1669         esac
1670         ;;
1671 esac
1672
1673 exec 4>&1
1674 case "$silent" in
1675 true) exec 1>/dev/null;;
1676 esac
1677
1678 : run the defines and the undefines, if any, but leave the file out there...
1679 touch optdef.sh
1680 . ./optdef.sh
1681 : create the posthint manipulation script and leave the file out there...
1682 touch posthint.sh
1683
1684 : set package name
1685 package=perl5
1686 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1687 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1688 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1689 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1690 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1691 esac
1692
1693 : Some greps do not return status, grrr.
1694 echo "grimblepritz" >grimble
1695 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1696         contains=contains
1697 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1698         contains=grep
1699 else
1700         contains=contains
1701 fi
1702 rm -f grimble
1703 : the following should work in any shell
1704 case "$contains" in
1705 contains*)
1706         echo " "
1707         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1708         cat >contains <<'EOSS'
1709 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1710 EOSS
1711 chmod +x contains
1712 esac
1713
1714 : Find the path to the source tree
1715 case "$src" in
1716 '') case "$0" in
1717     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1718          case "$src" in
1719          /*)    ;;
1720          .)     ;;
1721          *)     src=`cd ../$src && pwd` ;;
1722          esac
1723          ;;
1724     *)   src='.';;
1725     esac;;
1726 esac
1727 case "$src" in
1728 '')     src=/
1729         rsrc=/
1730         ;;
1731 /*) rsrc="$src";;
1732 *) rsrc="../$src";;
1733 esac
1734 if test -f $rsrc/Configure && \
1735         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1736 then
1737    : found it, so we are ok.
1738 else
1739         rsrc=''
1740         for src in . .. ../.. ../../.. ../../../..; do
1741                 if test -f ../$src/Configure && \
1742                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1743                 then
1744                         rsrc=../$src
1745                         break
1746                 fi
1747         done
1748 fi
1749 case "$rsrc" in
1750 '')
1751         cat <<EOM >&4
1752
1753 Sorry, I can't seem to locate the source dir for $package.  Please start
1754 Configure with an explicit path -- i.e. /some/path/Configure.
1755
1756 EOM
1757         exit 1
1758         ;;
1759 ../.)   rsrc='..';;
1760 *)
1761         echo " "
1762         echo "Sources for $package found in \"$src\"." >&4
1763         ;;
1764 esac
1765
1766 : script used to extract .SH files with variable substitutions
1767 cat >extract <<'EOS'
1768 PERL_CONFIG_SH=true
1769 echo "Doing variable substitutions on .SH files..."
1770 if test -f MANIFEST; then
1771         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1772 else
1773         echo "(Looking for .SH files under the source directory.)"
1774         set x `(cd "$src"; find . -name "*.SH" -print)`
1775 fi
1776 shift
1777 case $# in
1778 0) set x `(cd "$src"; echo *.SH)`; shift;;
1779 esac
1780 if test ! -f "$src/$1"; then
1781         shift
1782 fi
1783 mkdir_p='
1784 name=$1;
1785 create="";
1786 while test $name; do
1787         if test ! -d "$name"; then
1788                 create="$name $create";
1789                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1790                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1791         else
1792                 name="";
1793         fi;
1794 done;
1795 for file in $create; do
1796         mkdir $file;
1797 done
1798 '
1799 for file in $*; do
1800         case "$src" in
1801         ".")
1802                 case "$file" in
1803                 */*)
1804                         dir=`expr X$file : 'X\(.*\)/'`
1805                         file=`expr X$file : 'X.*/\(.*\)'`
1806                         (cd "$dir" && . ./$file)
1807                         ;;
1808                 *)
1809                         . ./$file
1810                         ;;
1811                 esac
1812                 ;;
1813         *)
1814                 case "$file" in
1815                 */*)
1816                         dir=`expr X$file : 'X\(.*\)/'`
1817                         file=`expr X$file : 'X.*/\(.*\)'`
1818                         (set x $dir; shift; eval $mkdir_p)
1819                         sh <"$src/$dir/$file"
1820                         ;;
1821                 *)
1822                         sh <"$src/$file"
1823                         ;;
1824                 esac
1825                 ;;
1826         esac
1827 done
1828 if test -f "$src/config_h.SH"; then
1829         if test ! -f config.h; then
1830         : oops, they left it out of MANIFEST, probably, so do it anyway.
1831         . "$src/config_h.SH"
1832         fi
1833 fi
1834 EOS
1835
1836 : extract files and exit if asked to do so
1837 case "$extractsh" in
1838 true)
1839         case "$realsilent" in
1840         true) ;;
1841         *) exec 1>&4;;
1842         esac
1843         case "$config_sh" in
1844         '') config_sh='config.sh';;
1845         esac
1846         echo " "
1847         echo "Fetching answers from $config_sh..."
1848         cd ..
1849         . $config_sh
1850         test "$override" && . ./optdef.sh
1851         echo " "
1852         . UU/extract
1853         rm -rf UU
1854         echo "Extraction done."
1855         exit 0
1856         ;;
1857 esac
1858
1859 : Eunice requires " " instead of "", can you believe it
1860 echo " "
1861 : Here we go...
1862 echo "Beginning of configuration questions for $package."
1863
1864 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1865
1866 : first determine how to suppress newline on echo command
1867 echo " "
1868 echo "Checking echo to see how to suppress newlines..."
1869 (echo "hi there\c" ; echo " ") >.echotmp
1870 if $contains c .echotmp >/dev/null 2>&1 ; then
1871         echo "...using -n."
1872         n='-n'
1873         c=''
1874 else
1875         cat <<'EOM'
1876 ...using \c
1877 EOM
1878         n=''
1879         c='\c'
1880 fi
1881 echo $n "The star should be here-->$c"
1882 echo '*'
1883 rm -f .echotmp
1884
1885 : Now test for existence of everything in MANIFEST
1886 echo " "
1887 if test -f "$rsrc/MANIFEST"; then
1888         echo "First let's make sure your kit is complete.  Checking..." >&4
1889         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1890         rm -f missing
1891         tmppwd=`pwd`
1892         for filelist in x??; do
1893                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1894         done
1895         if test -s missing; then
1896                 cat missing >&4
1897                 cat >&4 <<'EOM'
1898
1899 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1900
1901 You have the option of continuing the configuration process, despite the
1902 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1903 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1904 and contact the author (perlbug@perl.org).
1905
1906 EOM
1907                 echo $n "Continue? [n] $c" >&4
1908                 read ans
1909                 case "$ans" in
1910                 y*)
1911                         echo "Continuing..." >&4
1912                         rm -f missing
1913                         ;;
1914                 *)
1915                         echo "ABORTING..." >&4
1916                         kill $$
1917                         ;;
1918                 esac
1919         else
1920                 echo "Looks good..."
1921         fi
1922 else
1923         echo "There is no MANIFEST file.  I hope your kit is complete !"
1924 fi
1925 rm -f missing x??
1926
1927 echo " "
1928 : Find the appropriate value for a newline for tr
1929 if test -n "$DJGPP"; then
1930        trnl='\012'
1931 fi
1932 if test X"$trnl" = X; then
1933         case "`echo foo|tr '\n' x 2>/dev/null`" in
1934         foox) trnl='\n' ;;
1935         esac
1936 fi
1937 if test X"$trnl" = X; then
1938         case "`echo foo|tr '\012' x 2>/dev/null`" in
1939         foox) trnl='\012' ;;
1940         esac
1941 fi
1942 if test X"$trnl" = X; then
1943        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1944        fooxy) trnl='\n\r' ;;
1945        esac
1946 fi
1947 if test X"$trnl" = X; then
1948         cat <<EOM >&2
1949
1950 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1951
1952 EOM
1953         exit 1
1954 fi
1955
1956 : compute the number of columns on the terminal for proper question formatting
1957 case "$COLUMNS" in
1958 '') COLUMNS='80';;
1959 esac
1960
1961 : set up the echo used in my read
1962 myecho="case \"\$xxxm\" in
1963 '') echo $n \"\$rp $c\" >&4;;
1964 *) case \"\$rp\" in
1965         '') echo $n \"[\$xxxm] $c\";;
1966         *)
1967                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1968                         echo \"\$rp\" >&4
1969                         echo $n \"[\$xxxm] $c\" >&4
1970                 else
1971                         echo $n \"\$rp [\$xxxm] $c\" >&4
1972                 fi
1973                 ;;
1974         esac;;
1975 esac"
1976
1977 : now set up to do reads with possible shell escape and default assignment
1978 cat <<EOSC >myread
1979 $startsh
1980 xxxm=\$dflt
1981 $myecho
1982 ans='!'
1983 case "\$fastread" in
1984 yes) case "\$dflt" in
1985         '') ;;
1986         *) ans='';
1987                 case "\$silent-\$rp" in
1988                 true-) ;;
1989                 *) echo " " >&4;;
1990                 esac;;
1991         esac;;
1992 *) case "\$silent" in
1993         true) case "\$rp" in
1994                 '') ans='';;
1995                 esac;;
1996         esac;;
1997 esac
1998 while expr "X\$ans" : "X!" >/dev/null; do
1999         read answ
2000         set x \$xxxm
2001         shift
2002         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2003         case  "\$answ" in
2004         "!")
2005                 sh 1>&4
2006                 echo " "
2007                 $myecho
2008                 ;;
2009         !*)
2010                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2011                 shift
2012                 sh 1>&4 -c "\$*"
2013                 echo " "
2014                 $myecho
2015                 ;;
2016         "\$ans")
2017                 case "\$ans" in
2018                 \\&*)
2019                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2020                         shift
2021                         case "\$1" in
2022                         -d)
2023                                 fastread=yes
2024                                 echo "(OK, I'll run with -d after this question.)" >&4
2025                                 ;;
2026                         -*)
2027                                 echo "*** Sorry, \$1 not supported yet." >&4
2028                                 ;;
2029                         esac
2030                         $myecho
2031                         ans=!
2032                         ;;
2033                 esac;;
2034         *)
2035                 case "\$aok" in
2036                 y)
2037                         echo "*** Substitution done -- please confirm."
2038                         xxxm="\$ans"
2039                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2040                         xxxm="\$ans"
2041                         ans=!
2042                         ;;
2043                 *)
2044                         echo "*** Error -- try again."
2045                         ans=!
2046                         ;;
2047                 esac
2048                 $myecho
2049                 ;;
2050         esac
2051         case "\$ans\$xxxm\$nostick" in
2052         '')
2053                 ans=!
2054                 $myecho
2055                 ;;
2056         esac
2057 done
2058 case "\$ans" in
2059 '') ans="\$xxxm";;
2060 esac
2061 EOSC
2062
2063 : create .config dir to save info across Configure sessions
2064 test -d ../.config || mkdir ../.config
2065 cat >../.config/README <<EOF
2066 This directory created by Configure to save information that should
2067 persist across sessions for $package.
2068
2069 You may safely delete it if you wish.
2070 EOF
2071
2072 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2073 case "$usedevel" in
2074 $define|true|[yY]*) ;;
2075 *) case "$xversion" in
2076    *[13579])
2077         cat >&4 <<EOH
2078 *** WHOA THERE!!! ***
2079
2080     This is an UNSTABLE DEVELOPMENT release.
2081     The version of this $package distribution is $xversion, that is, odd,
2082     (as opposed to even) and that signifies a development release.
2083     If you want a maintenance release, you want an even-numbered version.
2084
2085     Do ***NOT*** install this into production use.
2086     Data corruption and crashes are possible.
2087
2088     It is most seriously suggested that you do not continue any further
2089     unless you want to help in developing and debugging Perl.
2090
2091     If you *still* want to build perl, you can answer 'y' now,
2092     or pass -Dusedevel to Configure.
2093
2094 EOH
2095         rp='Do you really want to continue?'
2096         dflt='n'
2097         . ./myread
2098         case "$ans" in
2099         [yY]) echo >&4 "Okay, continuing."
2100               usedevel="$define" ;;
2101         *) echo >&4 "Okay, bye."
2102            exit 1
2103            ;;
2104         esac
2105         ;;
2106     esac
2107     ;;
2108 esac
2109 case "$usedevel" in
2110 $define|true|[yY]*)
2111         case "$versiononly" in
2112         '') versiononly="$define" ;;
2113         esac
2114         case "$installusrbinperl" in
2115         '') installusrbinperl="$undef" ;;
2116         esac
2117         ;;
2118 esac
2119
2120 : general instructions
2121 needman=true
2122 firsttime=true
2123 user=`(logname) 2>/dev/null`
2124 case "$user" in
2125 '') user=`whoami 2>&1`;;
2126 esac
2127 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2128         firsttime=false
2129         echo " "
2130         rp='Would you like to see the instructions?'
2131         dflt=n
2132         . ./myread
2133         case "$ans" in
2134         [yY]*) ;;
2135         *) needman=false;;
2136         esac
2137 fi
2138 if $needman; then
2139         cat <<EOH
2140
2141 This installation shell script will examine your system and ask you questions
2142 to determine how the perl5 package should be installed. If you get
2143 stuck on a question, you may use a ! shell escape to start a subshell or
2144 execute a command.  Many of the questions will have default answers in square
2145 brackets; typing carriage return will give you the default.
2146
2147 On some of the questions which ask for file or directory names you are allowed
2148 to use the ~name construct to specify the login directory belonging to "name",
2149 even if you don't have a shell which knows about that.  Questions where this is
2150 allowed will be marked "(~name ok)".
2151
2152 EOH
2153         rp=''
2154         dflt='Type carriage return to continue'
2155         . ./myread
2156         cat <<'EOH'
2157
2158 The prompter used in this script allows you to use shell variables and
2159 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2160 in the default answer, as if the default line was a set of arguments given to a
2161 script shell.  This means you may also use $* to repeat the whole default line,
2162 so you do not have to re-type everything to add something to the default.
2163
2164 Everytime there is a substitution, you will have to confirm.  If there is an
2165 error (e.g. an unmatched backtick), the default answer will remain unchanged
2166 and you will be prompted again.
2167
2168 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2169 the questions and use the computed defaults (or the previous answers if there
2170 was already a config.sh file). Type 'Configure -h' for a list of options.
2171 You may also start interactively and then answer '& -d' at any prompt to turn
2172 on the non-interactive behaviour for the remainder of the execution.
2173
2174 EOH
2175         . ./myread
2176         cat <<EOH
2177
2178 Much effort has been expended to ensure that this shell script will run on any
2179 Unix system.  If despite that it blows up on yours, your best bet is to edit
2180 Configure and run it again.  If you can't run Configure for some reason,
2181 you'll have to generate a config.sh file by hand.  Whatever problems you
2182 have, let me (perlbug@perl.org) know how I blew it.
2183
2184 This installation script affects things in two ways:
2185
2186 1) it may do direct variable substitutions on some of the files included
2187    in this kit.
2188 2) it builds a config.h file for inclusion in C programs.  You may edit
2189    any of these files as the need arises after running this script.
2190
2191 If you make a mistake on a question, there is no easy way to back up to it
2192 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2193 files.  Configure will offer to let you do this before it runs the SH files.
2194
2195 EOH
2196         dflt='Type carriage return to continue'
2197         . ./myread
2198         case "$firsttime" in
2199         true) echo $user >>../.config/instruct;;
2200         esac
2201 fi
2202
2203 : find out where common programs are
2204 echo " "
2205 echo "Locating common programs..." >&4
2206 cat <<EOSC >loc
2207 $startsh
2208 case \$# in
2209 0) exit 1;;
2210 esac
2211 thing=\$1
2212 shift
2213 dflt=\$1
2214 shift
2215 for dir in \$*; do
2216         case "\$thing" in
2217         .)
2218         if test -d \$dir/\$thing; then
2219                 echo \$dir
2220                 exit 0
2221         fi
2222         ;;
2223         *)
2224         for thisthing in \$dir/\$thing; do
2225                 : just loop through to pick last item
2226         done
2227         if test -f \$thisthing; then
2228                 echo \$thisthing
2229                 exit 0
2230         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2231                 echo \$thisthing
2232                 exit 0
2233         elif test -f \$dir/\$thing.exe; then
2234                 if test -n "$DJGPP"; then
2235                         echo \$dir/\$thing.exe
2236                 elif test "$eunicefix" != ":"; then
2237                         : on Eunice apparently
2238                         echo \$dir/\$thing
2239                         exit 0
2240                 fi
2241                 exit 0
2242         fi
2243         ;;
2244         esac
2245 done
2246 echo \$dflt
2247 exit 1
2248 EOSC
2249 chmod +x loc
2250 $eunicefix loc
2251 loclist="
2252 awk
2253 cat
2254 chmod
2255 comm
2256 cp
2257 echo
2258 expr
2259 grep
2260 ls
2261 mkdir
2262 rm
2263 sed
2264 sort
2265 touch
2266 tr
2267 uniq
2268 "
2269 trylist="
2270 Mcc
2271 ar
2272 bison
2273 byacc
2274 cpp
2275 csh
2276 date
2277 egrep
2278 gmake
2279 gzip
2280 less
2281 ln
2282 make
2283 more
2284 nm
2285 nroff
2286 pg
2287 test
2288 uname
2289 zip
2290 "
2291 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2292 pth="$pth /lib /usr/lib"
2293 for file in $loclist; do
2294         eval xxx=\$$file
2295         case "$xxx" in
2296         /*|?:[\\/]*)
2297                 if test -f "$xxx"; then
2298                         : ok
2299                 else
2300                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2301                         xxx=`./loc $file $file $pth`
2302                 fi
2303                 ;;
2304         '') xxx=`./loc $file $file $pth`;;
2305         *) xxx=`./loc $xxx $xxx $pth`;;
2306         esac
2307         eval $file=$xxx$_exe
2308         eval _$file=$xxx
2309         case "$xxx" in
2310         /*)
2311                 echo $file is in $xxx.
2312                 ;;
2313         ?:[\\/]*)
2314                 echo $file is in $xxx.
2315                 ;;
2316         *)
2317                 echo "I don't know where '$file' is, and my life depends on it." >&4
2318                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2319                 exit 1
2320                 ;;
2321         esac
2322 done
2323 echo " "
2324 echo "Don't worry if any of the following aren't found..."
2325 say=offhand
2326 for file in $trylist; do
2327         eval xxx=\$$file
2328         case "$xxx" in
2329         /*|?:[\\/]*)
2330                 if test -f "$xxx"; then
2331                         : ok
2332                 else
2333                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2334                         xxx=`./loc $file $file $pth`
2335                 fi
2336                 ;;
2337         '') xxx=`./loc $file $file $pth`;;
2338         *) xxx=`./loc $xxx $xxx $pth`;;
2339         esac
2340         eval $file=$xxx$_exe
2341         eval _$file=$xxx
2342         case "$xxx" in
2343         /*)
2344                 echo $file is in $xxx.
2345                 ;;
2346         ?:[\\/]*)
2347                 echo $file is in $xxx.
2348                 ;;
2349         *)
2350                 echo "I don't see $file out there, $say."
2351                 say=either
2352                 ;;
2353         esac
2354 done
2355 case "$egrep" in
2356 egrep)
2357         echo "Substituting grep for egrep."
2358         egrep=$grep
2359         _egrep=$grep
2360         ;;
2361 esac
2362 case "$ln" in
2363 ln)
2364         echo "Substituting cp for ln."
2365         ln=$cp
2366         _ln=$cp
2367         ;;
2368 esac
2369 case "$make" in
2370 make)   
2371         case "$gmake" in
2372         gmake)
2373         echo "I can't find make or gmake, and my life depends on it." >&4
2374         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2375         exit 1
2376         ;;
2377         esac
2378         ;;
2379 esac    
2380 case "$gmake" in
2381 gmake)  ;;
2382 *)      # We can't have osname yet.
2383         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2384                 # Assume that gmake, if found, is definitely GNU make
2385                 # and prefer it over the system make.
2386                 echo "Substituting gmake for make."
2387                 make=$gmake
2388                 _make=$gmake
2389         fi
2390         ;;
2391 esac
2392 case "$test" in
2393 test)
2394         echo "Hopefully test is built into your sh."
2395         ;;
2396 *)
2397         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2398                 echo "Using the test built into your sh."
2399                 test=test
2400                 _test=test
2401         fi
2402         ;;
2403 esac
2404 case "$echo" in
2405 echo)
2406         echo "Hopefully echo is built into your sh."
2407         ;;
2408 '') ;;
2409 *)
2410         echo " "
2411 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2412         $echo $n "hi there$c" >foo1
2413         echo $n "hi there$c" >foo2
2414         if cmp foo1 foo2 >/dev/null 2>&1; then
2415                 echo "They are compatible.  In fact, they may be identical."
2416         else
2417                 case "$n" in
2418                 '-n') n='' c='\c';;
2419                 *) n='-n' c='';;
2420                 esac
2421                 cat <<FOO
2422 They are not compatible!  You are probably running ksh on a non-USG system.
2423 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2424 have echo built in and we may have to run some Bourne shell scripts.  That
2425 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2426
2427 FOO
2428                 $echo $n "The star should be here-->$c"
2429                 $echo "*"
2430         fi
2431         $rm -f foo1 foo2
2432         ;;
2433 esac
2434
2435 cat <<EOS >trygcc
2436 $startsh
2437 EOS
2438 cat <<'EOSC' >>trygcc
2439 case "$cc" in
2440 '') ;;
2441 *)  $rm -f try try.*
2442     $cat >try.c <<EOM
2443 int main(int argc, char *argv[]) {
2444   return 0;
2445 }
2446 EOM
2447     if $cc -o try $ccflags $ldflags try.c; then
2448        :
2449     else
2450         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2451         despair=yes
2452         trygcc=yes
2453         case "$cc" in
2454         *gcc*) trygcc=no ;;
2455         esac
2456         case "`$cc -v -c try.c 2>&1`" in
2457         *gcc*) trygcc=no ;;
2458         esac
2459         if $test X"$trygcc" = Xyes; then
2460             if gcc -o try -c try.c; then
2461                 echo " "
2462                 echo "You seem to have a working gcc, though." >&4
2463                 rp="Would you like to use it?"
2464                 dflt=y
2465                 if $test -f myread; then
2466                     . ./myread
2467                 else
2468                     if $test -f UU/myread; then
2469                         . ./UU/myread
2470                     else
2471                         echo "Cannot find myread, sorry.  Aborting." >&2
2472                         exit 1
2473                     fi
2474                 fi  
2475                 case "$ans" in
2476                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2477                        if $test -f usethreads.cbu; then
2478                            $cat >&4 <<EOM 
2479
2480 *** However, any setting of the C compiler flags (e.g. for thread support)
2481 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2482 *** (together with e.g. -Dusethreads).
2483
2484 EOM
2485                        fi;;
2486                 esac
2487             fi
2488         fi
2489     fi
2490     $rm -f try try.*
2491     ;;
2492 esac
2493 EOSC
2494
2495 cat <<EOS >checkcc
2496 $startsh
2497 EOS
2498 cat <<'EOSC' >>checkcc
2499 case "$cc" in        
2500 '') ;;
2501 *)  $rm -f try try.*              
2502     $cat >try.c <<EOM
2503 int main(int argc, char *argv[]) {
2504   return 0;
2505 }
2506 EOM
2507     if $cc -o try $ccflags $ldflags try.c; then
2508        :
2509     else
2510         if $test X"$despair" = Xyes; then
2511            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2512         fi
2513         $cat >&4 <<EOM         
2514 You need to find a working C compiler.
2515 Either (purchase and) install the C compiler supplied by your OS vendor,
2516 or for a free C compiler try http://gcc.gnu.org/
2517 I cannot continue any further, aborting.
2518 EOM
2519         exit 1
2520     fi
2521     $rm -f try try.*
2522     ;;
2523 esac
2524 EOSC
2525
2526 : determine whether symbolic links are supported
2527 echo " "
2528 $touch blurfl
2529 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2530         echo "Symbolic links are supported." >&4
2531         lns="$ln -s"
2532 else
2533         echo "Symbolic links are NOT supported." >&4
2534         lns="$ln"
2535 fi
2536 $rm -f blurfl sym
2537
2538 : determine whether symbolic links are supported
2539 echo " "
2540 case "$lns" in
2541 *"ln"*" -s")
2542         echo "Checking how to test for symbolic links..." >&4
2543         $lns blurfl sym
2544         if $test "X$issymlink" = X; then
2545                 case "$newsh" in
2546                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2547                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2548                 esac
2549                 if test $? = 0; then
2550                         issymlink="test -h"
2551                 else
2552                         echo "Your builtin 'test -h' may be broken." >&4
2553                         case "$test" in
2554                         /*)     ;;
2555                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2556                                 for p in $pth
2557                                 do
2558                                         if test -f "$p/$test"; then
2559                                                 test="$p/$test"
2560                                                 break
2561                                         fi
2562                                 done
2563                                 ;;
2564                         esac
2565                         case "$test" in
2566                         /*)
2567                                 echo "Trying external '$test -h'." >&4
2568                                 issymlink="$test -h"
2569                                 if $test ! -h sym >/dev/null 2>&1; then
2570                                         echo "External '$test -h' is broken, too." >&4
2571                                         issymlink=''
2572                                 fi
2573                                 ;;
2574                         *)      issymlink='' ;;
2575                         esac
2576                 fi              
2577         fi
2578         if $test "X$issymlink" = X; then
2579                 if $test -L sym 2>/dev/null; then
2580                         issymlink="$test -L"
2581                         echo "The builtin '$test -L' worked." >&4
2582                 fi
2583         fi
2584         if $test "X$issymlink" != X; then
2585                 echo "You can test for symbolic links with '$issymlink'." >&4
2586         else
2587                 echo "I do not know how you can test for symbolic links." >&4
2588         fi
2589         $rm -f blurfl sym
2590         ;;
2591 *)      echo "No symbolic links, so not testing for their testing..." >&4
2592         ;;
2593 esac
2594 echo " "
2595
2596
2597 case "$mksymlinks" in
2598 $define|true|[yY]*)
2599         case "$src" in
2600         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2601                 exit 1
2602                 ;;
2603         *)      case "$lns:$issymlink" in
2604                 *"ln"*" -s:"*"test -"?)
2605                         echo "Creating the symbolic links..." >&4
2606                         echo "(First creating the subdirectories...)" >&4
2607                         cd ..
2608                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2609                                 read directory
2610                                 test -z "$directory" && break
2611                                 mkdir -p $directory
2612                         done
2613                         # Sanity check 1.
2614                         if test ! -d t/base; then
2615                                 echo "Failed to create the subdirectories.  Aborting." >&4
2616                                 exit 1
2617                         fi
2618                         echo "(Then creating the symlinks...)" >&4
2619                         awk '{print $1}' $src/MANIFEST | while true; do
2620                                 read filename
2621                                 test -z "$filename" && break
2622                                 if test -f $filename; then
2623                                         if $issymlink $filename; then
2624                                                 rm -f $filename
2625                                         fi
2626                                 fi
2627                                 if test -f $filename; then
2628                                         echo "$filename already exists, not symlinking."
2629                                 else
2630                                         ln -s $src/$filename $filename
2631                                 fi
2632                         done
2633                         # Sanity check 2.
2634                         if test ! -f t/base/lex.t; then
2635                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2636                                 exit 1
2637                         fi
2638                         cd UU
2639                         ;;
2640                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2641                         ;;
2642                 esac
2643                 ;;
2644         esac
2645         ;;
2646 esac
2647
2648
2649 case "$usecrosscompile" in
2650 $define|true|[yY]*)
2651         $echo "Cross-compiling..."
2652         croak=''
2653         case "$cc" in
2654         *-*-gcc) # A cross-compiling gcc, probably.
2655             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2656             ar=$targetarch-ar
2657             # leave out ld, choosing it is more complex
2658             nm=$targetarch-nm
2659             ranlib=$targetarch-ranlib
2660             $echo 'extern int foo;' > try.c
2661             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2662             shift
2663             if $test $# -gt 0; then
2664                 incpth="$incpth $*"
2665                 incpth="`$echo $incpth|$sed 's/^ //'`"
2666                 echo "Guessing incpth '$incpth'." >&4
2667                 for i in $*; do
2668                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2669                     if $test -d $j; then
2670                         libpth="$libpth $j"
2671                     fi
2672                 done   
2673                 libpth="`$echo $libpth|$sed 's/^ //'`"
2674                 echo "Guessing libpth '$libpth'." >&4
2675             fi
2676             $rm -f try.c
2677             ;;
2678         esac
2679         case "$targetarch" in
2680         '') echo "Targetarch not defined." >&4; croak=y ;;
2681         *)  echo "Using targetarch $targetarch." >&4 ;;
2682         esac
2683         case "$incpth" in
2684         '') echo "Incpth not defined." >&4; croak=y ;;
2685         *)  echo "Using incpth '$incpth'." >&4 ;;
2686         esac
2687         case "$libpth" in
2688         '') echo "Libpth not defined." >&4; croak=y ;;
2689         *)  echo "Using libpth '$libpth'." >&4 ;;
2690         esac
2691         case "$usrinc" in
2692         '') for i in $incpth; do
2693                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2694                     usrinc=$i
2695                     echo "Guessing usrinc $usrinc." >&4
2696                     break
2697                 fi
2698             done
2699             case "$usrinc" in
2700             '') echo "Usrinc not defined." >&4; croak=y ;;
2701             esac
2702             ;;
2703         *)  echo "Using usrinc $usrinc." >&4 ;;
2704         esac
2705         case "$targethost" in
2706         '') echo "Targethost not defined." >&4; croak=y ;;
2707         *)  echo "Using targethost $targethost." >&4
2708         esac
2709         locincpth=' '
2710         loclibpth=' '
2711         case "$croak" in
2712         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2713         esac
2714         case "$src" in
2715         /*) run=$src/Cross/run
2716             targetmkdir=$src/Cross/mkdir
2717             to=$src/Cross/to
2718             from=$src/Cross/from
2719             ;;
2720         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2721             run=$pwd/Cross/run
2722             targetmkdir=$pwd/Cross/mkdir
2723             to=$pwd/Cross/to
2724             from=$pwd/Cross/from
2725             ;;
2726         esac
2727         case "$targetrun" in
2728         '') targetrun=ssh ;;
2729         esac
2730         case "$targetto" in
2731         '') targetto=scp ;;
2732         esac
2733         case "$targetfrom" in
2734         '') targetfrom=scp ;;
2735         esac
2736         run=$run-$targetrun
2737         to=$to-$targetto
2738         from=$from-$targetfrom
2739         case "$targetdir" in
2740         '')  targetdir=/tmp
2741              echo "Guessing targetdir $targetdir." >&4
2742              ;;
2743         esac
2744         case "$targetuser" in
2745         '')  targetuser=root
2746              echo "Guessing targetuser $targetuser." >&4
2747              ;;
2748         esac
2749         case "$targetfrom" in
2750         scp)    q=-q ;;
2751         *)      q='' ;;
2752         esac
2753         case "$targetrun" in
2754         ssh|rsh)
2755             cat >$run <<EOF
2756 #!/bin/sh
2757 case "\$1" in
2758 -cwd)
2759   shift
2760   cwd=\$1
2761   shift
2762   ;;
2763 esac
2764 case "\$cwd" in
2765 '') cwd=$targetdir ;;
2766 esac
2767 exe=\$1
2768 shift
2769 if $test ! -f \$exe.xok; then
2770   $to \$exe
2771   $touch \$exe.xok
2772 fi
2773 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2774 EOF
2775             ;;
2776         *)  echo "Unknown targetrun '$targetrun'" >&4
2777             exit 1
2778             ;;
2779         esac
2780         case "$targetmkdir" in
2781         */Cross/mkdir)
2782             cat >$targetmkdir <<EOF
2783 #!/bin/sh
2784 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2785 EOF
2786             $chmod a+rx $targetmkdir
2787             ;;
2788         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2789             exit 1
2790             ;;
2791         esac
2792         case "$targetto" in
2793         scp|rcp)
2794             cat >$to <<EOF
2795 #!/bin/sh
2796 for f in \$@
2797 do
2798   case "\$f" in
2799   /*)
2800     $targetmkdir \`dirname \$f\`
2801     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2802     ;;
2803   *)
2804     $targetmkdir $targetdir/\`dirname \$f\`
2805     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2806     ;;
2807   esac
2808 done
2809 exit 0
2810 EOF
2811             ;;
2812         cp) cat >$to <<EOF
2813 #!/bin/sh
2814 for f in \$@
2815 do
2816   case "\$f" in
2817   /*)
2818     $mkdir -p $targetdir/\`dirname \$f\`
2819     $cp \$f $targetdir/\$f || exit 1
2820     ;;
2821   *)
2822     $targetmkdir $targetdir/\`dirname \$f\`
2823     $cp \$f $targetdir/\$f || exit 1
2824     ;;
2825   esac
2826 done
2827 exit 0
2828 EOF
2829             ;;
2830         *)  echo "Unknown targetto '$targetto'" >&4
2831             exit 1
2832             ;;
2833         esac
2834         case "$targetfrom" in
2835         scp|rcp)
2836           cat >$from <<EOF
2837 #!/bin/sh
2838 for f in \$@
2839 do
2840   $rm -f \$f
2841   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2842 done
2843 exit 0
2844 EOF
2845             ;;
2846         cp) cat >$from <<EOF
2847 #!/bin/sh
2848 for f in \$@
2849 do
2850   $rm -f \$f
2851   cp $targetdir/\$f . || exit 1
2852 done
2853 exit 0
2854 EOF
2855             ;;
2856         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2857             exit 1
2858             ;;
2859         esac
2860         if $test ! -f $run; then
2861             echo "Target 'run' script '$run' not found." >&4
2862         else
2863             $chmod a+rx $run
2864         fi
2865         if $test ! -f $to; then
2866             echo "Target 'to' script '$to' not found." >&4
2867         else
2868             $chmod a+rx $to
2869         fi
2870         if $test ! -f $from; then
2871             echo "Target 'from' script '$from' not found." >&4
2872         else
2873             $chmod a+rx $from
2874         fi
2875         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2876             exit 1
2877         fi
2878         cat >&4 <<EOF
2879 Using '$run' for remote execution,
2880 and '$from' and '$to'
2881 for remote file transfer.
2882 EOF
2883         ;;
2884 *)      run=''
2885         to=:
2886         from=:
2887         usecrosscompile='undef'
2888         targetarch=''
2889         ;;
2890 esac
2891
2892 : see whether [:lower:] and [:upper:] are supported character classes
2893 echo " "
2894 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2895 ABYZ)
2896         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2897         up='[:upper:]'
2898         low='[:lower:]'
2899         ;;
2900 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2901         # (0xd9 and 0xe2), therefore that is a nice testing point.
2902         if test "X$up" = X -o "X$low" = X; then
2903             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2904             rs) up='[A-Z]'
2905                 low='[a-z]'
2906                 ;;
2907             esac
2908         fi
2909         if test "X$up" = X -o "X$low" = X; then
2910             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2911             rs) up='A-Z'
2912                 low='a-z'
2913                 ;;
2914             esac
2915         fi
2916         if test "X$up" = X -o "X$low" = X; then
2917             case "`echo RS | od -x 2>/dev/null`" in
2918             *D9E2*|*d9e2*)
2919                 echo "Hey, this might be EBCDIC." >&4
2920                 if test "X$up" = X -o "X$low" = X; then
2921                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2922                     rs) up='[A-IJ-RS-Z]'
2923                         low='[a-ij-rs-z]'
2924                         ;;
2925                     esac
2926                 fi
2927                 if test "X$up" = X -o "X$low" = X; then
2928                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2929                     rs) up='A-IJ-RS-Z'
2930                         low='a-ij-rs-z'
2931                         ;;
2932                     esac
2933                 fi
2934                 ;;
2935             esac
2936         fi
2937 esac
2938 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2939 rs)
2940     echo "Using $up and $low to convert case." >&4
2941     ;;
2942 *)
2943     echo "I don't know how to translate letters from upper to lower case." >&4
2944     echo "Your tr is not acting any way I know of." >&4
2945     exit 1
2946     ;;
2947 esac
2948 : set up the translation script tr, must be called with ./tr of course
2949 cat >tr <<EOSC
2950 $startsh
2951 case "\$1\$2" in
2952 '[A-Z][a-z]') exec $tr '$up' '$low';;
2953 '[a-z][A-Z]') exec $tr '$low' '$up';;
2954 esac
2955 exec $tr "\$@"
2956 EOSC
2957 chmod +x tr
2958 $eunicefix tr
2959
2960 : Try to determine whether config.sh was made on this system
2961 case "$config_sh" in
2962 '')
2963 myuname=`$uname -a 2>/dev/null`
2964 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2965 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2966 # because the A-Z/a-z are not consecutive.
2967 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2968         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2969 newmyuname="$myuname"
2970 dflt=n
2971 case "$knowitall" in
2972 '')
2973         if test -f ../config.sh; then
2974                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2975                         eval "`grep myuname= ../config.sh`"
2976                 fi
2977                 if test "X$myuname" = "X$newmyuname"; then
2978                         dflt=y
2979                 fi
2980         fi
2981         ;;
2982 *) dflt=y;;
2983 esac
2984
2985 : Get old answers from old config file if Configure was run on the
2986 : same system, otherwise use the hints.
2987 hint=default
2988 cd ..
2989 if test -f config.sh; then
2990         echo " "
2991         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2992         . UU/myread
2993         case "$ans" in
2994         n*|N*) echo "OK, I'll ignore it."
2995                 mv config.sh config.sh.old
2996                 myuname="$newmyuname"
2997                 ;;
2998         *)  echo "Fetching default answers from your old config.sh file..." >&4
2999                 tmp_n="$n"
3000                 tmp_c="$c"
3001                 tmp_sh="$sh"
3002                 . ./config.sh
3003                 cp config.sh UU
3004                 n="$tmp_n"
3005                 c="$tmp_c"
3006                 : Older versions did not always set $sh.  Catch re-use of such
3007                 : an old config.sh.
3008                 case "$sh" in
3009                 '') sh="$tmp_sh" ;;
3010                 esac
3011                 hint=previous
3012                 ;;
3013         esac
3014 fi
3015 . ./UU/checkcc
3016 if test ! -f config.sh; then
3017         $cat <<EOM
3018
3019 First time through, eh?  I have some defaults handy for some systems
3020 that need some extra help getting the Configure answers right:
3021
3022 EOM
3023         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3024         dflt=''
3025         : Half the following guesses are probably wrong... If you have better
3026         : tests or hints, please send them to perlbug@perl.org
3027         : The metaconfig authors would also appreciate a copy...
3028         $test -f /irix && osname=irix
3029         $test -f /xenix && osname=sco_xenix
3030         $test -f /dynix && osname=dynix
3031         $test -f /dnix && osname=dnix
3032         $test -f /lynx.os && osname=lynxos
3033         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3034         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3035         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3036         $test -f /bin/mips && /bin/mips && osname=mips
3037         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3038                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3039         $test -d /usr/apollo/bin && osname=apollo
3040         $test -f /etc/saf/_sactab && osname=svr4
3041         $test -d /usr/include/minix && osname=minix
3042         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3043         if $test -d /MachTen -o -d /MachTen_Folder; then
3044                 osname=machten
3045                 if $test -x /sbin/version; then
3046                         osvers=`/sbin/version | $awk '{print $2}' |
3047                         $sed -e 's/[A-Za-z]$//'`
3048                 elif $test -x /usr/etc/version; then
3049                         osvers=`/usr/etc/version | $awk '{print $2}' |
3050                         $sed -e 's/[A-Za-z]$//'`
3051                 else
3052                         osvers="$2.$3"
3053                 fi
3054         fi
3055
3056         $test -f /sys/posix.dll &&
3057                 $test -f /usr/bin/what &&
3058                 set X `/usr/bin/what /sys/posix.dll` &&
3059                 $test "$3" = UWIN &&
3060                 osname=uwin &&
3061                 osvers="$5"
3062
3063         if $test -f $uname; then
3064                 set X $myuname
3065                 shift
3066
3067                 case "$5" in
3068                 fps*) osname=fps ;;
3069                 mips*)
3070                         case "$4" in
3071                         umips) osname=umips ;;
3072                         *) osname=mips ;;
3073                         esac;;
3074                 [23]100) osname=mips ;;
3075                 next*) osname=next ;;
3076                 i386*)
3077                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3078                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3079                                 osname='sco'
3080                                 osvers=$tmp
3081                         elif $test -f /etc/kconfig; then
3082                                 osname=isc
3083                                 if test "$lns" = "$ln -s"; then
3084                                         osvers=4
3085                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3086                                         osvers=3
3087                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3088                                         osvers=2
3089                                 fi
3090                         fi
3091                         tmp=''
3092                         ;;
3093                 pc*)
3094                         if test -n "$DJGPP"; then
3095                                 osname=dos
3096                                 osvers=djgpp
3097                         fi
3098                         ;;
3099                 esac
3100
3101                 case "$1" in
3102                 aix) osname=aix
3103                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3104                         case "$tmp" in
3105                         # oslevel can fail with:
3106                         # oslevel: Unable to acquire lock.
3107                         *not\ found) osvers="$4"."$3" ;;
3108                         '<3240'|'<>3240') osvers=3.2.0 ;;
3109                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3110                         '=3250'|'>3250') osvers=3.2.5 ;;
3111                         *) osvers=$tmp;;
3112                         esac
3113                         ;;
3114                 bsd386) osname=bsd386
3115                         osvers=`$uname -r`
3116                         ;;
3117                 cygwin*) osname=cygwin
3118                         osvers="$3"
3119                         ;;
3120                 *dc.osx) osname=dcosx
3121                         osvers="$3"
3122                         ;;
3123                 dnix) osname=dnix
3124                         osvers="$3"
3125                         ;;
3126                 domainos) osname=apollo
3127                         osvers="$3"
3128                         ;;
3129                 dgux)   osname=dgux 
3130                         osvers="$3"
3131                         ;;
3132                 dynixptx*) osname=dynixptx
3133                         osvers=`echo "$4"|sed 's/^v//'`
3134                         ;;
3135                 freebsd) osname=freebsd 
3136                         osvers="$3" ;;
3137                 genix)  osname=genix ;;
3138                 gnu)    osname=gnu
3139                         osvers="$3" ;;
3140                 hp*)    osname=hpux 
3141                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3142                         ;;
3143                 irix*)  osname=irix
3144                         case "$3" in
3145                         4*) osvers=4 ;;
3146                         5*) osvers=5 ;;
3147                         *)      osvers="$3" ;;
3148                         esac
3149                         ;;
3150                 linux)  osname=linux
3151                         case "$3" in
3152                         *)      osvers="$3" ;;
3153                         esac
3154                         ;;
3155                 MiNT)   osname=mint
3156                         ;;
3157                 netbsd*) osname=netbsd
3158                         osvers="$3"
3159                         ;;
3160                 news-os) osvers="$3"
3161                         case "$3" in
3162                         4*) osname=newsos4 ;;
3163                         *) osname=newsos ;;
3164                         esac
3165                         ;;
3166                 next*) osname=next ;;
3167                 nonstop-ux) osname=nonstopux ;;
3168                 openbsd) osname=openbsd
3169                         osvers="$3"
3170                         ;;
3171                 os2)    osname=os2
3172                         osvers="$4"
3173                         ;;
3174                 POSIX-BC | posix-bc ) osname=posix-bc
3175                         osvers="$3"
3176                         ;;
3177                 powerux | power_ux | powermax_os | powermaxos | \
3178                 powerunix | power_unix) osname=powerux
3179                         osvers="$3"
3180                         ;;
3181                 qnx) osname=qnx
3182                         osvers="$4"
3183                         ;;
3184                 solaris) osname=solaris
3185                         case "$3" in
3186                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3187                         *)      osvers="$3" ;;
3188                         esac
3189                         ;;
3190                 sunos) osname=sunos
3191                         case "$3" in
3192                         5*) osname=solaris
3193                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3194                         *)      osvers="$3" ;;
3195                         esac
3196                         ;;
3197                 titanos) osname=titanos
3198                         case "$3" in
3199                         1*) osvers=1 ;;
3200                         2*) osvers=2 ;;
3201                         3*) osvers=3 ;;
3202                         4*) osvers=4 ;;
3203                         *)      osvers="$3" ;;
3204                         esac
3205                         ;;
3206                 ultrix) osname=ultrix
3207                         osvers="$3"
3208                         ;;
3209                 osf1|mls+)      case "$5" in
3210                                 alpha)
3211                                         osname=dec_osf
3212                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3213                                         case "$osvers" in
3214                                         [1-9].[0-9]*) ;;
3215                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3216                                         esac
3217                                         ;;
3218                         hp*)    osname=hp_osf1  ;;
3219                         mips)   osname=mips_osf1 ;;
3220                         esac
3221                         ;;
3222                 # UnixWare 7.1.2 is known as Open UNIX 8
3223                 openunix|unixware) osname=svr5
3224                         osvers="$4"
3225                         ;;
3226                 uts)    osname=uts
3227                         osvers="$3"
3228                         ;;
3229                 vos) osvers="$3"
3230                         ;;
3231                 $2) case "$osname" in
3232                         *isc*) ;;
3233                         *freebsd*) ;;
3234                         svr*)
3235                                 : svr4.x or possibly later
3236                                 case "svr$3" in 
3237                                 ${osname}*)
3238                                         osname=svr$3
3239                                         osvers=$4
3240                                         ;;
3241                                 esac
3242                                 case "$osname" in
3243                                 svr4.0)
3244                                         : Check for ESIX
3245                                         if test -f /stand/boot ; then
3246                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3247                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3248                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3249                                                         if test -n "$isesix"; then
3250                                                                 osname=esix4
3251                                                         fi
3252                                                 fi
3253                                         fi
3254                                         ;;
3255                                 esac
3256                                 ;;
3257                         *)      if test -f /etc/systemid; then
3258                                         osname=sco
3259                                         set `echo $3 | $sed 's/\./ /g'` $4
3260                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3261                                                 osvers=$1.$2.$3
3262                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3263                                                 osvers=$1.$2
3264                                         elif $test -f $src/hints/sco_$1.sh; then
3265                                                 osvers=$1
3266                                         fi
3267                                 else
3268                                         case "$osname" in
3269                                         '') : Still unknown.  Probably a generic Sys V.
3270                                                 osname="sysv"
3271                                                 osvers="$3"
3272                                                 ;;
3273                                         esac
3274                                 fi
3275                                 ;;
3276                         esac
3277                         ;;
3278                 *)      case "$osname" in
3279                         '') : Still unknown.  Probably a generic BSD.
3280                                 osname="$1"
3281                                 osvers="$3"
3282                                 ;;
3283                         esac
3284                         ;;
3285                 esac
3286         else
3287                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3288                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3289                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3290                                 osname=news_os
3291                         fi
3292                         $rm -f UU/kernel.what
3293                 elif test -d c:/. -o -n "$is_os2" ; then
3294                         set X $myuname
3295                         osname=os2
3296                         osvers="$5"
3297                 fi
3298         fi
3299         
3300         case "$targetarch" in
3301         '') ;;
3302         *)  hostarch=$osname
3303             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3304             osvers=''
3305             ;;
3306         esac
3307
3308         : Now look for a hint file osname_osvers, unless one has been
3309         : specified already.
3310         case "$hintfile" in
3311         ''|' ')
3312                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3313                 : Also try without trailing minor version numbers.
3314                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3315                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3316                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3317                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3318                 case "$file" in
3319                 '') dflt=none ;;
3320                 *)  case "$osvers" in
3321                         '') dflt=$file
3322                                 ;;
3323                         *)  if $test -f $src/hints/$file.sh ; then
3324                                         dflt=$file
3325                                 elif $test -f $src/hints/$xfile.sh ; then
3326                                         dflt=$xfile
3327                                 elif $test -f $src/hints/$xxfile.sh ; then
3328                                         dflt=$xxfile
3329                                 elif $test -f $src/hints/$xxxfile.sh ; then
3330                                         dflt=$xxxfile
3331                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3332                                         dflt=$xxxxfile
3333                                 elif $test -f "$src/hints/${osname}.sh" ; then
3334                                         dflt="${osname}"
3335                                 else
3336                                         dflt=none
3337                                 fi
3338                                 ;;
3339                         esac
3340                         ;;
3341                 esac
3342                 if $test -f Policy.sh ; then
3343                         case "$dflt" in
3344                         *Policy*) ;;
3345                         none) dflt="Policy" ;;
3346                         *) dflt="Policy $dflt" ;;
3347                         esac
3348                 fi
3349                 ;;
3350         *)
3351                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3352                 ;;
3353         esac
3354
3355         if $test -f Policy.sh ; then
3356                 $cat <<EOM
3357
3358 There's also a Policy hint file available, which should make the
3359 site-specific (policy) questions easier to answer.
3360 EOM
3361
3362         fi
3363
3364         $cat <<EOM
3365
3366 You may give one or more space-separated answers, or "none" if appropriate.
3367 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3368 is a good thing.  DO NOT give a wrong version or a wrong OS.
3369
3370 EOM
3371
3372         rp="Which of these apply, if any?"
3373         . UU/myread
3374         tans=$ans
3375         for file in $tans; do
3376                 if $test X$file = XPolicy -a -f Policy.sh; then
3377                         . Policy.sh
3378                         $cat Policy.sh >> UU/config.sh
3379                 elif $test -f $src/hints/$file.sh; then
3380                         . $src/hints/$file.sh
3381                         $cat $src/hints/$file.sh >> UU/config.sh
3382                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3383                         : nothing
3384                 else
3385                         : Give one chance to correct a possible typo.
3386                         echo "$file.sh does not exist"
3387                         dflt=$file
3388                         rp="hint to use instead?"
3389                         . UU/myread
3390                         for file in $ans; do
3391                                 if $test -f "$src/hints/$file.sh"; then
3392                                         . $src/hints/$file.sh
3393                                         $cat $src/hints/$file.sh >> UU/config.sh
3394                                 elif $test X$ans = X -o X$ans = Xnone ; then
3395                                         : nothing
3396                                 else
3397                                         echo "$file.sh does not exist -- ignored."
3398                                 fi
3399                         done
3400                 fi
3401         done
3402
3403         hint=recommended
3404         : Remember our hint file for later.
3405         if $test -f "$src/hints/$file.sh" ; then
3406                 hintfile="$file"
3407         else
3408                 hintfile=''
3409         fi
3410 fi
3411 cd UU
3412 ;;
3413 *)
3414         echo " "
3415         echo "Fetching default answers from $config_sh..." >&4
3416         tmp_n="$n"
3417         tmp_c="$c"
3418         cd ..
3419         cp $config_sh config.sh 2>/dev/null
3420         chmod +w config.sh
3421         . ./config.sh
3422         cd UU
3423         cp ../config.sh .
3424         n="$tmp_n"
3425         c="$tmp_c"
3426         hint=previous
3427         ;;
3428 esac
3429 test "$override" && . ./optdef.sh
3430
3431 : Restore computed paths
3432 for file in $loclist $trylist; do
3433         eval $file="\$_$file"
3434 done
3435
3436 cat << EOM
3437
3438 Configure uses the operating system name and version to set some defaults.
3439 The default value is probably right if the name rings a bell. Otherwise,
3440 since spelling matters for me, either accept the default or answer "none"
3441 to leave it blank.
3442
3443 EOM
3444 case "$osname" in
3445         ''|' ')
3446                 case "$hintfile" in
3447                 ''|' '|none) dflt=none ;;
3448                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3449                 esac
3450                 ;;
3451         *) dflt="$osname" ;;
3452 esac
3453 rp="Operating system name?"
3454 . ./myread
3455 case "$ans" in
3456 none)  osname='' ;;
3457 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3458 esac
3459 echo " "
3460 case "$osvers" in
3461         ''|' ')
3462                 case "$hintfile" in
3463                 ''|' '|none) dflt=none ;;
3464                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3465                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3466                         case "$dflt" in
3467                         ''|' ') dflt=none ;;
3468                         esac
3469                         ;;
3470                 esac
3471                 ;;
3472         *) dflt="$osvers" ;;
3473 esac
3474 rp="Operating system version?"
3475 . ./myread
3476 case "$ans" in
3477 none)  osvers='' ;;
3478 *) osvers="$ans" ;;
3479 esac
3480
3481
3482 . ./posthint.sh
3483
3484 : who configured the system
3485 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3486 case "$cf_by" in
3487 "")
3488         cf_by=`(logname) 2>/dev/null`
3489         case "$cf_by" in
3490         "")
3491                 cf_by=`(whoami) 2>/dev/null`
3492                 case "$cf_by" in
3493                 "") cf_by=unknown ;;
3494                 esac ;;
3495         esac ;;
3496 esac
3497
3498 : set up the script used to warn in case of inconsistency
3499 cat <<EOS >whoa
3500 $startsh
3501 EOS
3502 cat <<'EOSC' >>whoa
3503 dflt=y
3504 echo " "
3505 echo "*** WHOA THERE!!! ***" >&4
3506 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3507 rp="    Keep the $hint value?"
3508 . ./myread
3509 case "$ans" in
3510 y) td=$was; tu=$was;;
3511 esac
3512 EOSC
3513
3514 : function used to set $1 to $val
3515 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3516 case "$val$was" in
3517 $define$undef) . ./whoa; eval "$var=\$td";;
3518 $undef$define) . ./whoa; eval "$var=\$tu";;
3519 *) eval "$var=$val";;
3520 esac'
3521
3522 case "$usesocks" in
3523 $define|true|[yY]*)     dflt='y';;
3524 *) dflt='n';;
3525 esac
3526 cat <<EOM
3527
3528 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3529 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3530 to use the PerlIO abstraction layer, this will be implicitly selected.
3531
3532 If this doesn't make any sense to you, just accept the default '$dflt'.
3533 EOM
3534 rp='Build Perl for SOCKS?'
3535 . ./myread
3536 case "$ans" in
3537 y|Y)    val="$define" ;;     
3538 *)      val="$undef" ;;
3539 esac
3540 set usesocks
3541 eval $setvar
3542
3543 case "$usesocks" in
3544 $define|true|[yY]*) useperlio="$define";;
3545 esac
3546
3547 case "$useperlio" in
3548 $define|true|[yY]*|'')  dflt='y';;
3549 *) dflt='n';;
3550 esac
3551 cat <<EOM
3552
3553 Previous version of $package used the standard IO mechanisms as
3554 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
3555 alternate IO mechanisms via the PerlIO abstraction layer, but the
3556 stdio mechanism is still available if needed.  The abstraction layer
3557 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3558 Using PerlIO with sfio may cause problems with some extension modules.
3559
3560 If this doesn't make any sense to you, just accept the default '$dflt'.
3561 EOM
3562 rp='Use the PerlIO abstraction layer?'
3563 . ./myread
3564 case "$ans" in
3565 y|Y) 
3566         val="$define"
3567         ;;
3568 *)      
3569         echo "Ok, doing things the stdio way."
3570         val="$undef"
3571         ;;
3572 esac
3573 set useperlio
3574 eval $setvar 
3575
3576 case "$usesocks" in
3577 $define|true|[yY]*)
3578         case "$useperlio" in
3579         $define|true|[yY]*) ;;
3580         *)      cat >&4 <<EOM
3581
3582 You are using the SOCKS proxy protocol library which means that you
3583 should also use the PerlIO layer.  You may be headed for trouble.
3584
3585 EOM
3586                 ;;
3587         esac
3588         ;;
3589 esac
3590
3591         
3592 case "$usethreads" in
3593 $define|true|[yY]*)     dflt='y';;
3594 *)     # Catch case where user specified ithreads or 5005threads but
3595        # forgot -Dusethreads (A.D. 4/2002)
3596        case "$useithreads$use5005threads" in
3597        *$define*)      
3598                 case "$useperlio" in
3599                 "$define")      dflt='y' ;;
3600                 *)              dflt='n' ;;
3601                 esac
3602                 ;;
3603        *)       dflt='n';;
3604        esac
3605        ;;
3606 esac
3607 cat <<EOM
3608
3609 Perl can be built to take advantage of threads on some systems.
3610 To do so, Configure can be run with -Dusethreads.
3611
3612 Note that Perl built with threading support runs slightly slower
3613 and uses more memory than plain Perl. The current implementation
3614 is believed to be stable, but it is fairly new, and so should be
3615 treated with caution.
3616
3617 If this doesn't make any sense to you, just accept the default '$dflt'.
3618 EOM
3619 rp='Build a threading Perl?'
3620 . ./myread
3621 case "$ans" in
3622 y|Y)    val="$define" ;;
3623 *)      val="$undef" ;;
3624 esac
3625 set usethreads
3626 eval $setvar
3627
3628 case "$usethreads" in
3629 $define)
3630         $cat <<EOM
3631
3632 Since release 5.6, Perl has had two different threading implementations,
3633 the newer interpreter-based version (ithreads) with one interpreter per
3634 thread, and the older 5.005 version (5005threads).
3635 The 5005threads version is effectively unmaintained and will probably be
3636 removed in Perl 5.10, so there should be no need to build a Perl using it
3637 unless needed for backwards compatibility with some existing 5.005threads
3638 code.
3639
3640 EOM
3641         : Default to ithreads unless overridden on command line or with
3642         : old config.sh
3643         dflt='y'
3644         case "$use5005threads" in
3645                 $define|true|[yY]*) dflt='n';;
3646         esac
3647         case "$useithreads" in
3648                 $undef|false|[nN]*) dflt='n';;
3649         esac
3650         rp='Use the newer interpreter-based ithreads?'
3651         . ./myread
3652         case "$ans" in
3653         y|Y)    val="$define" ;;
3654         *)      val="$undef" ;;
3655         esac
3656         set useithreads
3657         eval $setvar
3658         : Now set use5005threads to the opposite value.
3659         case "$useithreads" in
3660         $define) val="$undef" ;;
3661         *) val="$define" ;;
3662         esac
3663         set use5005threads
3664         eval $setvar
3665         ;;
3666 *)
3667         useithreads="$undef"
3668         use5005threads="$undef"
3669         ;;
3670 esac
3671
3672 case "$useithreads$use5005threads" in
3673 "$define$define")
3674         $cat >&4 <<EOM
3675
3676 You cannot have both the ithreads and the 5.005 threads enabled
3677 at the same time.  Disabling the 5.005 threads since they are
3678 much less stable than the ithreads.
3679
3680 EOM
3681         use5005threads="$undef"
3682         ;;
3683 esac
3684
3685 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
3686         cat >&4 <<EOF
3687 ***
3688 *** To build with ithreads you must also use the PerlIO layer.
3689 *** Cannot continue, aborting.
3690 ***
3691 EOF
3692         exit 1
3693 fi
3694
3695 case "$d_oldpthreads" in
3696 '')     : Configure tests would be welcome here.  For now, assume undef.
3697         val="$undef" ;;
3698 *)      val="$d_oldpthreads" ;;
3699 esac
3700 set d_oldpthreads
3701 eval $setvar
3702
3703
3704 : Look for a hint-file generated 'call-back-unit'.  If the
3705 : user has specified that a threading perl is to be built,
3706 : we may need to set or change some other defaults.
3707 if $test -f usethreads.cbu; then
3708     echo "Your platform has some specific hints regarding threaded builds, using them..."
3709     . ./usethreads.cbu
3710 else
3711     case "$usethreads" in
3712         "$define"|true|[yY]*)
3713                 $cat <<EOM
3714 (Your platform does not have any specific hints for threaded builds.
3715  Assuming POSIX threads, then.)
3716 EOM
3717         ;;
3718     esac
3719 fi
3720
3721 cat <<EOM
3722
3723 Perl can be built so that multiple Perl interpreters can coexist
3724 within the same Perl executable.
3725 EOM
3726
3727 case "$useithreads" in
3728 $define)
3729         cat <<EOM
3730 This multiple interpreter support is required for interpreter-based threads.
3731 EOM
3732         val="$define"
3733         ;;
3734 *)      case "$usemultiplicity" in
3735         $define|true|[yY]*)     dflt='y';;
3736         *) dflt='n';;
3737         esac
3738         echo " "
3739         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3740         rp='Build Perl for multiplicity?'
3741         . ./myread
3742         case "$ans" in
3743         y|Y)    val="$define" ;;
3744         *)      val="$undef" ;;
3745         esac
3746         ;;
3747 esac
3748 set usemultiplicity
3749 eval $setvar
3750
3751
3752 case "$usemorebits" in
3753 "$define"|true|[yY]*)
3754         use64bitint="$define"
3755         uselongdouble="$define"
3756         usemorebits="$define"
3757         ;;
3758 *)      usemorebits="$undef"
3759         ;;
3760 esac
3761
3762 : make some quick guesses about what we are up against
3763 echo " "
3764 $echo $n "Hmm...  $c"
3765 echo exit 1 >bsd
3766 echo exit 1 >usg
3767 echo exit 1 >v7
3768 echo exit 1 >osf1
3769 echo exit 1 >eunice
3770 echo exit 1 >xenix
3771 echo exit 1 >venix
3772 echo exit 1 >os2
3773 d_bsd="$undef"
3774 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3775 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3776 then
3777         echo "Looks kind of like an OSF/1 system, but we'll see..."
3778         echo exit 0 >osf1
3779 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3780         xxx=`./loc addbib blurfl $pth`
3781         if $test -f $xxx; then
3782         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3783                 echo exit 0 >bsd
3784                 echo exit 0 >usg
3785         else
3786                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3787                         echo "Looks kind of like an extended USG system, but we'll see..."
3788                 else
3789                         echo "Looks kind of like a USG system, but we'll see..."
3790                 fi
3791                 echo exit 0 >usg
3792         fi
3793 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3794         echo "Looks kind of like a BSD system, but we'll see..."
3795         d_bsd="$define"
3796         echo exit 0 >bsd
3797 else
3798         echo "Looks kind of like a Version 7 system, but we'll see..."
3799         echo exit 0 >v7
3800 fi
3801 case "$eunicefix" in
3802 *unixtovms*)
3803         $cat <<'EOI'
3804 There is, however, a strange, musty smell in the air that reminds me of
3805 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3806 EOI
3807         echo exit 0 >eunice
3808         d_eunice="$define"
3809 : it so happens the Eunice I know will not run shell scripts in Unix format
3810         ;;
3811 *)
3812         echo " "
3813         echo "Congratulations.  You aren't running Eunice."
3814         d_eunice="$undef"
3815         ;;
3816 esac
3817 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3818 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3819 : semicolon as a patch separator
3820 case "$p_" in
3821 :) ;;
3822 *)
3823         $cat <<'EOI'
3824 I have the feeling something is not exactly right, however...don't tell me...
3825 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3826 (Or you may be running DOS with DJGPP.)
3827 EOI
3828         echo exit 0 >os2
3829         ;;
3830 esac
3831 if test -f /xenix; then
3832         echo "Actually, this looks more like a XENIX system..."
3833         echo exit 0 >xenix
3834         d_xenix="$define"
3835 else
3836         echo " "
3837         echo "It's not Xenix..."
3838         d_xenix="$undef"
3839 fi
3840 chmod +x xenix
3841 $eunicefix xenix
3842 if test -f /venix; then
3843         echo "Actually, this looks more like a VENIX system..."
3844         echo exit 0 >venix
3845 else
3846         echo " "
3847         if ./xenix; then
3848                 : null
3849         else
3850                 echo "Nor is it Venix..."
3851         fi
3852 fi
3853 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3854 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3855 $rm -f foo
3856
3857 case "$cc" in
3858 '') dflt=cc;;
3859 *) dflt="$cc";;
3860 esac
3861 rp="Use which C compiler?"
3862 . ./myread
3863 cc="$ans"
3864
3865 : See if they have not cc but they do have gcc
3866 . ./trygcc
3867 : Look for a hint-file generated 'call-back-unit'.  Now that the
3868 : user has specified the compiler, we may need to set or change some
3869 : other defaults.
3870 if $test -f cc.cbu; then
3871     . ./cc.cbu
3872 fi
3873 . ./checkcc
3874
3875 echo " "
3876 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3877 $cat >try.c <<EOM
3878 #include <stdio.h>
3879 int main() {
3880 #ifdef __GNUC__
3881 #ifdef __VERSION__
3882         printf("%s\n", __VERSION__);
3883 #else
3884         printf("%s\n", "1");
3885 #endif
3886 #endif
3887         return(0);
3888 }
3889 EOM
3890 if $cc -o try $ccflags $ldflags try.c; then
3891         gccversion=`$run ./try`
3892         case "$gccversion" in
3893         '') echo "You are not using GNU cc." ;;
3894         *)  echo "You are using GNU cc $gccversion."
3895             ccname=gcc
3896             ;;
3897         esac
3898 else
3899         echo " "
3900         echo "*** WHOA THERE!!! ***" >&4
3901         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3902         case "$knowitall" in
3903         '')
3904         echo "    You'd better start hunting for one and let me know about it." >&4
3905                 exit 1
3906                 ;;
3907         esac
3908 fi
3909 $rm -f try try.*
3910 case "$gccversion" in
3911 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3912 esac
3913 case "$gccversion" in
3914 '') gccosandvers='' ;;
3915 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3916    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3917    gccshortvers=''
3918    case "$gccosandvers" in
3919    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3920    $osname$osvers) ;; # looking good
3921    $osname*) cat <<EOM >&4
3922
3923 *** WHOA THERE!!! ***
3924
3925     Your gcc has not been compiled for the exact release of
3926     your operating system ($gccosandvers versus $osname$osvers).
3927
3928     In general it is a good idea to keep gcc synchronized with
3929     the operating system because otherwise serious problems
3930     may ensue when trying to compile software, like Perl.
3931
3932     I'm trying to be optimistic here, though, and will continue.
3933     If later during the configuration and build icky compilation
3934     problems appear (headerfile conflicts being the most common
3935     manifestation), I suggest reinstalling the gcc to match
3936     your operating system release.
3937
3938 EOM
3939       ;;
3940    *) gccosandvers='' ;; # failed to parse, better be silent
3941    esac
3942    ;;
3943 esac
3944 case "$ccname" in
3945 '') ccname="$cc" ;;
3946 esac
3947
3948 # gcc 3.* complain about adding -Idirectories that they already know about,
3949 # so we will take those off from locincpth.
3950 case "$gccversion" in
3951 3*)
3952     echo "main(){}">try.c
3953     for incdir in $locincpth; do
3954        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
3955              grep '^c[cp]p*[01]: warning: changing search order '`
3956        if test "X$warn" != X; then
3957            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
3958        fi
3959     done
3960     $rm -f try try.*
3961 esac
3962
3963 : decide how portable to be.  Allow command line overrides.
3964 case "$d_portable" in
3965 "$undef") ;;
3966 *)      d_portable="$define" ;;
3967 esac
3968
3969 : set up shell script to do ~ expansion
3970 cat >filexp <<EOSS
3971 $startsh
3972 : expand filename
3973 case "\$1" in
3974  ~/*|~)
3975         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3976         ;;
3977  ~*)
3978         if $test -f /bin/csh; then
3979                 /bin/csh -f -c "glob \$1"
3980                 failed=\$?
3981                 echo ""
3982                 exit \$failed
3983         else
3984                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3985                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3986                 if $test ! -d "\$dir"; then
3987                         me=\`basename \$0\`
3988                         echo "\$me: can't locate home directory for: \$name" >&2
3989                         exit 1
3990                 fi
3991                 case "\$1" in
3992                 */*)
3993                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3994                         ;;
3995                 *)
3996                         echo \$dir
3997                         ;;
3998                 esac
3999         fi
4000         ;;
4001 *)
4002         echo \$1
4003         ;;
4004 esac
4005 EOSS
4006 chmod +x filexp
4007 $eunicefix filexp
4008
4009 : now set up to get a file name
4010 cat <<EOS >getfile
4011 $startsh
4012 EOS
4013 cat <<'EOSC' >>getfile
4014 tilde=''
4015 fullpath=''
4016 already=''
4017 skip=''
4018 none_ok=''
4019 exp_file=''
4020 nopath_ok=''
4021 orig_rp="$rp"
4022 orig_dflt="$dflt"
4023 case "$gfpth" in
4024 '') gfpth='.' ;;
4025 esac
4026
4027 case "$fn" in
4028 *\(*)
4029         : getfile will accept an answer from the comma-separated list
4030         : enclosed in parentheses even if it does not meet other criteria.
4031         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
4032         fn=`echo $fn | sed 's/(.*)//'`
4033         ;;
4034 esac
4035
4036 case "$fn" in
4037 *:*)
4038         loc_file=`expr $fn : '.*:\(.*\)'`
4039         fn=`expr $fn : '\(.*\):.*'`
4040         ;;
4041 esac
4042
4043 case "$fn" in
4044 *~*) tilde=true;;
4045 esac
4046 case "$fn" in
4047 */*) fullpath=true;;
4048 esac
4049 case "$fn" in
4050 *+*) skip=true;;
4051 esac
4052 case "$fn" in
4053 *n*) none_ok=true;;
4054 esac
4055 case "$fn" in
4056 *e*) exp_file=true;;
4057 esac
4058 case "$fn" in
4059 *p*) nopath_ok=true;;
4060 esac
4061
4062 case "$fn" in
4063 *f*) type='File';;
4064 *d*) type='Directory';;
4065 *l*) type='Locate';;
4066 esac
4067
4068 what="$type"
4069 case "$what" in
4070 Locate) what='File';;
4071 esac
4072
4073 case "$exp_file" in
4074 '')
4075         case "$d_portable" in
4076         "$define") ;;
4077         *) exp_file=true;;
4078         esac
4079         ;;
4080 esac
4081
4082 cd ..
4083 while test "$type"; do
4084         redo=''
4085         rp="$orig_rp"
4086         dflt="$orig_dflt"
4087         case "$tilde" in
4088         true) rp="$rp (~name ok)";;
4089         esac
4090         . UU/myread
4091         if test -f UU/getfile.ok && \
4092                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4093         then
4094                 value="$ans"
4095                 ansexp="$ans"
4096                 break
4097         fi
4098         case "$ans" in
4099         none)
4100                 value=''
4101                 ansexp=''
4102                 case "$none_ok" in
4103                 true) type='';;
4104                 esac
4105                 ;;
4106         *)
4107                 case "$tilde" in
4108                 '') value="$ans"
4109                         ansexp="$ans";;
4110                 *)
4111                         value=`UU/filexp $ans`
4112                         case $? in
4113                         0)
4114                                 if test "$ans" != "$value"; then
4115                                         echo "(That expands to $value on this system.)"
4116                                 fi
4117                                 ;;
4118                         *) value="$ans";;
4119                         esac
4120                         ansexp="$value"
4121                         case "$exp_file" in
4122                         '') value="$ans";;
4123                         esac
4124                         ;;
4125                 esac
4126                 case "$fullpath" in
4127                 true)
4128                         case "$ansexp" in
4129                         /*) value="$ansexp" ;;
4130                         [a-zA-Z]:/*) value="$ansexp" ;;
4131                         *)
4132                                 redo=true
4133                                 case "$already" in
4134                                 true)
4135                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4136                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4137                                         ;;
4138                                 *)
4139                                 echo "Please give a full path name, starting with slash." >&4
4140                                         case "$tilde" in
4141                                         true)
4142                                 echo "Note that using ~name is ok provided it expands well." >&4
4143                                                 already=true
4144                                                 ;;
4145                                         esac
4146                                 esac
4147                                 ;;
4148                         esac
4149                         ;;
4150                 esac
4151                 case "$redo" in
4152                 '')
4153                         case "$type" in
4154                         File)
4155                                 for fp in $gfpth; do
4156                                         if test "X$fp" = X.; then
4157                                             pf="$ansexp"
4158                                         else    
4159                                             pf="$fp/$ansexp"
4160                                         fi
4161                                         if test -f "$pf"; then
4162                                                 type=''
4163                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4164                                         then
4165                                                 echo "($value is not a plain file, but that's ok.)"
4166                                                 type=''
4167                                         fi
4168                                         if test X"$type" = X; then
4169                                             value="$pf"
4170                                             break
4171                                         fi
4172                                 done
4173                                 ;;
4174                         Directory)
4175                                 for fp in $gfpth; do
4176                                         if test "X$fp" = X.; then
4177                                             dir="$ans"
4178                                             direxp="$ansexp"
4179                                         else    
4180                                             dir="$fp/$ansexp"
4181                                             direxp="$fp/$ansexp"
4182                                         fi
4183                                         if test -d "$direxp"; then
4184                                                 type=''
4185                                                 value="$dir"
4186                                                 break
4187                                         fi
4188                                 done
4189                                 ;;
4190                         Locate)
4191                                 if test -d "$ansexp"; then
4192                                         echo "(Looking for $loc_file in directory $value.)"
4193                                         value="$value/$loc_file"
4194                                         ansexp="$ansexp/$loc_file"
4195                                 fi
4196                                 if test -f "$ansexp"; then
4197                                         type=''
4198                                 fi
4199                                 case "$nopath_ok" in
4200                                 true)   case "$value" in
4201                                         */*) ;;
4202                                         *)      echo "Assuming $value will be in people's path."
4203                                                 type=''
4204                                                 ;;
4205                                         esac
4206                                         ;;
4207                                 esac
4208                                 ;;
4209                         esac
4210
4211                         case "$skip" in
4212                         true) type='';
4213                         esac
4214
4215                         case "$type" in
4216                         '') ;;
4217                         *)
4218                                 if test "$fastread" = yes; then
4219                                         dflt=y
4220                                 else
4221                                         dflt=n
4222                                 fi
4223                                 rp="$what $value doesn't exist.  Use that name anyway?"
4224                                 . UU/myread
4225                                 dflt=''
4226                                 case "$ans" in
4227                                 y*) type='';;
4228                                 *) echo " ";;
4229                                 esac
4230                                 ;;
4231                         esac
4232                         ;;
4233                 esac
4234                 ;;
4235         esac
4236 done
4237 cd UU
4238 ans="$value"
4239 rp="$orig_rp"
4240 dflt="$orig_dflt"
4241 rm -f getfile.ok
4242 test "X$gfpthkeep" != Xy && gfpth=""
4243 EOSC
4244
4245 : What should the include directory be ?
4246 echo " "
4247 $echo $n "Hmm...  $c"
4248 dflt='/usr/include'
4249 incpath=''
4250 mips_type=''
4251 if $test -f /bin/mips && /bin/mips; then
4252         echo "Looks like a MIPS system..."
4253         $cat >usr.c <<'EOCP'
4254 #ifdef SYSTYPE_BSD43
4255 /bsd43
4256 #endif
4257 EOCP
4258         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4259                 dflt='/bsd43/usr/include'
4260                 incpath='/bsd43'
4261                 mips_type='BSD 4.3'
4262         else
4263                 mips_type='System V'
4264         fi
4265         $rm -f usr.c usr.out
4266         echo "and you're compiling with the $mips_type compiler and libraries."
4267         xxx_prompt=y
4268         echo "exit 0" >mips
4269 else
4270         echo "Doesn't look like a MIPS system."
4271         xxx_prompt=n
4272         echo "exit 1" >mips
4273 fi
4274 chmod +x mips
4275 $eunicefix mips
4276 case "$usrinc" in
4277 '') ;;
4278 *) dflt="$usrinc";;
4279 esac
4280 case "$xxx_prompt" in
4281 y)      fn=d/
4282         echo " "
4283         rp='Where are the include files you want to use?'
4284         . ./getfile
4285         usrinc="$ans"
4286         ;;
4287 *)      usrinc="$dflt"
4288         ;;
4289 esac
4290
4291 : see how we invoke the C preprocessor
4292 echo " "
4293 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4294 cat <<'EOT' >testcpp.c
4295 #define ABC abc
4296 #define XYZ xyz
4297 ABC.XYZ
4298 EOT
4299 cd ..
4300 if test ! -f cppstdin; then
4301         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4302                 # AIX cc -E doesn't show the absolute headerfile
4303                 # locations but we'll cheat by using the -M flag.
4304                 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
4305         else
4306                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4307         fi
4308 else
4309         echo "Keeping your $hint cppstdin wrapper."
4310 fi
4311 chmod 755 cppstdin
4312 wrapper=`pwd`/cppstdin
4313 ok='false'
4314 cd UU
4315
4316 if $test "X$cppstdin" != "X" && \
4317         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4318         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4319 then
4320         echo "You used to use $cppstdin $cppminus so we'll use that again."
4321         case "$cpprun" in
4322         '') echo "But let's see if we can live without a wrapper..." ;;
4323         *)
4324                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4325                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4326                 then
4327                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4328                         ok='true'
4329                 else
4330                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4331                 fi
4332                 ;;
4333         esac
4334 else
4335         case "$cppstdin" in
4336         '') ;;
4337         *)
4338                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4339                 ;;
4340         esac
4341 fi
4342
4343 if $ok; then
4344         : nothing
4345 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4346         $cc -E <testcpp.c >testcpp.out 2>&1; \
4347         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4348         echo "Yup, it does."
4349         x_cpp="$cc -E"
4350         x_minus='';
4351 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4352         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4353         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4354         echo "Yup, it does."
4355         x_cpp="$cc -E"
4356         x_minus='-';
4357 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4358         $cc -P <testcpp.c >testcpp.out 2>&1; \
4359         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4360         echo "Yipee, that works!"
4361         x_cpp="$cc -P"
4362         x_minus='';
4363 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4364         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4365         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4366         echo "At long last!"
4367         x_cpp="$cc -P"
4368         x_minus='-';
4369 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4370         $cpp <testcpp.c >testcpp.out 2>&1; \
4371         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4372         echo "It works!"
4373         x_cpp="$cpp"
4374         x_minus='';
4375 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4376         $cpp - <testcpp.c >testcpp.out 2>&1; \
4377         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4378         echo "Hooray, it works!  I was beginning to wonder."
4379         x_cpp="$cpp"
4380         x_minus='-';
4381 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4382         $wrapper <testcpp.c >testcpp.out 2>&1; \
4383         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4384         x_cpp="$wrapper"
4385         x_minus=''
4386         echo "Eureka!"
4387 else
4388         dflt=''
4389         rp="No dice.  I can't find a C preprocessor.  Name one:"
4390         . ./myread
4391         x_cpp="$ans"
4392         x_minus=''
4393         $x_cpp <testcpp.c >testcpp.out 2>&1
4394         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4395                 echo "OK, that will do." >&4
4396         else
4397 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4398                 exit 1
4399         fi
4400 fi
4401
4402 case "$ok" in
4403 false)
4404         cppstdin="$x_cpp"
4405         cppminus="$x_minus"
4406         cpprun="$x_cpp"
4407         cpplast="$x_minus"
4408         set X $x_cpp
4409         shift
4410         case "$1" in
4411         "$cpp")
4412                 echo "Perhaps can we force $cc -E using a wrapper..."
4413                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4414                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4415                 then
4416                         echo "Yup, we can."
4417                         cppstdin="$wrapper"
4418                         cppminus='';
4419                 else
4420                         echo "Nope, we'll have to live without it..."
4421                 fi
4422                 ;;
4423         esac
4424         case "$cpprun" in
4425         "$wrapper")
4426                 cpprun=''
4427                 cpplast=''
4428                 ;;
4429         esac
4430         ;;
4431 esac
4432
4433 case "$cppstdin" in
4434 "$wrapper"|'cppstdin') ;;
4435 *) $rm -f $wrapper;;
4436 esac
4437 $rm -f testcpp.c testcpp.out
4438
4439 : Set private lib path
4440 case "$plibpth" in
4441 '') if ./mips; then
4442                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4443         fi;;
4444 esac
4445 case "$libpth" in
4446 ' ') dlist='';;
4447 '') dlist="$loclibpth $plibpth $glibpth";;
4448 *) dlist="$libpth";;
4449 esac
4450
4451 : Now check and see which directories actually exist, avoiding duplicates
4452 libpth=''
4453 for xxx in $dlist
4454 do
4455     if $test -d $xxx; then
4456                 case " $libpth " in
4457                 *" $xxx "*) ;;
4458                 *) libpth="$libpth $xxx";;
4459                 esac
4460     fi
4461 done
4462 $cat <<'EOM'
4463
4464 Some systems have incompatible or broken versions of libraries.  Among
4465 the directories listed in the question below, please remove any you
4466 know not to be holding relevant libraries, and add any that are needed.
4467 Say "none" for none.
4468
4469 EOM
4470 case "$libpth" in
4471 '') dflt='none';;
4472 *)
4473         set X $libpth
4474         shift
4475         dflt=${1+"$@"}
4476         ;;
4477 esac
4478 rp="Directories to use for library searches?"
4479 . ./myread
4480 case "$ans" in
4481 none) libpth=' ';;
4482 *) libpth="$ans";;
4483 esac
4484
4485 : compute shared library extension
4486 case "$so" in
4487 '')
4488         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4489                 dflt='sl'
4490         else
4491                 dflt='so'
4492         fi
4493         ;;
4494 *) dflt="$so";;
4495 esac
4496 $cat <<EOM
4497
4498 On some systems, shared libraries may be available.  Answer 'none' if
4499 you want to suppress searching of shared libraries for the remainder
4500 of this configuration.
4501
4502 EOM
4503 rp='What is the file extension used for shared libraries?'
4504 . ./myread
4505 so="$ans"
4506
4507 : Define several unixisms.
4508 : Hints files or command line option can be used to override them.
4509 : The convoluted testing is in case hints files set either the old
4510 : or the new name.
4511 case "$_exe" in
4512 '')     case "$exe_ext" in
4513         '')     ;;
4514         *)      _exe="$exe_ext" ;;
4515         esac
4516         ;;
4517 esac
4518 case "$_a" in
4519 '')     case "$lib_ext" in
4520     '') _a='.a';;
4521         *)      _a="$lib_ext" ;;
4522         esac
4523         ;;
4524 esac
4525 case "$_o" in
4526 '') case "$obj_ext" in
4527         '')     _o='.o';;
4528         *)      _o="$obj_ext";;
4529         esac
4530         ;;
4531 esac
4532 case "$p_" in
4533 '') case "$path_sep" in
4534         '')     p_=':';;
4535         *)      p_="$path_sep";;
4536         esac
4537         ;;
4538 esac
4539 exe_ext=$_exe
4540 lib_ext=$_a
4541 obj_ext=$_o
4542 path_sep=$p_
4543
4544 : Which makefile gets called first.  This is used by make depend.
4545 case "$firstmakefile" in
4546 '') firstmakefile='makefile';;
4547 esac
4548
4549 case "$ccflags" in
4550 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4551 esac
4552
4553 case "$uselongdouble" in
4554 $define|true|[yY]*)     dflt='y';;
4555 *) dflt='n';;
4556 esac
4557 cat <<EOM
4558
4559 Perl can be built to take advantage of long doubles which
4560 (if available) may give more accuracy and range for floating point numbers.
4561
4562 If this doesn't make any sense to you, just accept the default '$dflt'.
4563 EOM
4564 rp='Try to use long doubles if available?'
4565 . ./myread
4566 case "$ans" in
4567 y|Y)    val="$define"   ;;
4568 *)      val="$undef"    ;;
4569 esac
4570 set uselongdouble
4571 eval $setvar
4572
4573 case "$uselongdouble" in
4574 true|[yY]*) uselongdouble="$define" ;;
4575 esac
4576
4577 : Look for a hint-file generated 'call-back-unit'.  If the
4578 : user has specified that long doubles should be used,
4579 : we may need to set or change some other defaults.
4580 if $test -f uselongdouble.cbu; then
4581     echo "Your platform has some specific hints regarding long doubles, using them..."
4582     . ./uselongdouble.cbu
4583 else
4584     case "$uselongdouble" in
4585         $define)
4586                 $cat <<EOM
4587 (Your platform does not have any specific hints for long doubles.)
4588 EOM
4589         ;;
4590     esac
4591 fi
4592
4593 : Looking for optional libraries
4594 echo " "
4595 echo "Checking for optional libraries..." >&4
4596 case "$libs" in
4597 ' '|'') dflt='';;
4598 *) dflt="$libs";;
4599 esac
4600 case "$libswanted" in
4601 '') libswanted='c_s';;
4602 esac
4603 case "$usesocks" in
4604 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4605 esac
4606 libsfound=''
4607 libsfiles=''
4608 libsdirs=''
4609 libspath=''
4610 for thisdir in $libpth $xlibpth; do
4611   test -d $thisdir && libspath="$libspath $thisdir"
4612 done
4613 for thislib in $libswanted; do
4614         for thisdir in $libspath; do
4615             xxx=''
4616             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4617                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4618                 $test -f "$xxx" && eval $libscheck
4619                 $test -f "$xxx" && libstyle=shared
4620             fi
4621             if test ! -f "$xxx"; then
4622                 xxx=$thisdir/lib$thislib.$so
4623                 $test -f "$xxx" && eval $libscheck
4624                 $test -f "$xxx" && libstyle=shared
4625             fi  
4626             if test ! -f "$xxx"; then
4627                 xxx=$thisdir/lib$thislib$_a
4628                 $test -f "$xxx" && eval $libscheck
4629                 $test -f "$xxx" && libstyle=static
4630             fi
4631             if test ! -f "$xxx"; then
4632                 xxx=$thisdir/$thislib$_a
4633                 $test -f "$xxx" && eval $libscheck
4634                 $test -f "$xxx" && libstyle=static
4635             fi
4636             if test ! -f "$xxx"; then
4637                 xxx=$thisdir/lib${thislib}_s$_a
4638                 $test -f "$xxx" && eval $libscheck
4639                 $test -f "$xxx" && libstyle=static
4640                 $test -f "$xxx" && thislib=${thislib}_s
4641             fi
4642             if test ! -f "$xxx"; then
4643                 xxx=$thisdir/Slib$thislib$_a
4644                 $test -f "$xxx" && eval $libscheck
4645                 $test -f "$xxx" && libstyle=static
4646             fi
4647             if $test -f "$xxx"; then
4648                 case "$libstyle" in
4649                 shared) echo "Found -l$thislib (shared)." ;;
4650                 static) echo "Found -l$thislib." ;;
4651                 *)      echo "Found -l$thislib ($libstyle)." ;;
4652                 esac
4653                 case " $dflt " in
4654                 *"-l$thislib "*);;
4655                 *) dflt="$dflt -l$thislib"
4656                    libsfound="$libsfound $xxx"
4657                    yyy=`basename $xxx`
4658                    libsfiles="$libsfiles $yyy"
4659                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4660                    case " $libsdirs " in
4661                    *" $yyy "*) ;;
4662                    *) libsdirs="$libsdirs $yyy" ;;
4663                    esac
4664                    ;;
4665                 esac
4666                 break
4667             fi  
4668         done
4669         if $test ! -f "$xxx"; then
4670             echo "No -l$thislib."
4671         fi
4672 done
4673 set X $dflt
4674 shift
4675 dflt="$*"
4676 case "$libs" in
4677 '') dflt="$dflt";;
4678 *) dflt="$libs";;
4679 esac
4680 case "$dflt" in
4681 ' '|'') dflt='none';;
4682 esac
4683
4684 $cat <<EOM
4685
4686 In order to compile $package on your machine, a number of libraries
4687 are usually needed.  Include any other special libraries here as well.
4688 Say "none" for none.  The default list is almost always right.
4689 EOM
4690
4691 echo " "
4692 rp="What libraries to use?"
4693 . ./myread
4694 case "$ans" in
4695 none) libs=' ';;
4696 *) libs="$ans";;
4697 esac
4698
4699 : determine optimization, if desired, or use for debug flag also
4700 case "$optimize" in
4701 ' '|$undef) dflt='none';;
4702 '') dflt='-O';;
4703 *) dflt="$optimize";;
4704 esac
4705 $cat <<EOH
4706
4707 By default, $package compiles with the -O flag to use the optimizer.
4708 Alternately, you might want to use the symbolic debugger, which uses
4709 the -g flag (on traditional Unix systems).  Either flag can be
4710 specified here.  To use neither flag, specify the word "none".
4711
4712 EOH
4713 rp="What optimizer/debugger flag should be used?"
4714 . ./myread
4715 optimize="$ans"
4716 case "$optimize" in
4717 'none') optimize=" ";;
4718 esac
4719
4720 dflt=''
4721 : We will not override a previous value, but we might want to
4722 : augment a hint file
4723 case "$hint" in
4724 default|recommended)
4725         case "$gccversion" in
4726         1*) dflt='-fpcc-struct-return' ;;
4727         esac
4728         case "$optimize" in
4729         *-g*) dflt="$dflt -DDEBUGGING";;
4730         esac
4731         case "$gccversion" in
4732         2*) if test -d /etc/conf/kconfig.d &&
4733                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4734                 then
4735                         # Interactive Systems (ISC) POSIX mode.
4736                         dflt="$dflt -posix"
4737                 fi
4738                 ;;
4739         esac
4740         case "$gccversion" in
4741         1*) ;;
4742         2.[0-8]*) ;;
4743         ?*)     echo " "
4744                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4745                 echo 'int main(void) { return 0; }' > gcctest.c
4746                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4747                         echo "Yes, it does." 2>&1
4748                         case "$ccflags" in
4749                         *strict-aliasing*)
4750                                 echo "Leaving current flags $ccflags alone." 2>&1
4751                                 ;;
4752                         *) dflt="$dflt -fno-strict-aliasing" ;;
4753                         esac
4754                 else
4755                         echo "Nope, it doesn't, but that's ok." 2>&1
4756                 fi
4757                 ;;
4758         esac
4759         # For gcc, adding -pipe speeds up compilations for some, but apparently
4760         # some assemblers can't read from stdin.  (It also slows down compilations
4761         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
4762         case "$gccversion" in
4763         ?*)     echo " "
4764                 echo "Checking if your compiler accepts -pipe" 2>&1
4765                 echo 'int main(void) { return 0; }' > gcctest.c
4766                 if $cc -pipe -o gcctest gcctest.c; then
4767                         echo "Yes, it does." 2>&1
4768                         case "$ccflags" in
4769                         *-pipe*)
4770                                 echo "Leaving current flags $ccflags alone." 2>&1
4771                                 ;;
4772                         *) dflt="$dflt -pipe" ;;
4773                         esac
4774                 else
4775                         echo "Nope, it doesn't, but that's ok." 2>&1
4776                 fi
4777
4778                 echo "Checking if your compiler accepts -Wdeclaration-after-statement" 2>&1
4779                 echo 'int main(void) { return 0; }' > gcctest.c
4780                 if $cc -Wdeclaration-after-statement -o gcctest gcctest.c; then
4781                         echo "Yes, it does." 2>&1
4782                         case "$ccflags" in
4783                         *-Wdeclaration-after-statement*)
4784                                 echo "Leaving current flags $ccflags alone." 2>&1
4785                                 ;;
4786                         *) dflt="$dflt -Wdeclaration-after-statement" ;;
4787                         esac
4788                 else
4789                         echo "Nope, it doesn't, but that's ok." 2>&1
4790                 fi
4791                 ;;
4792         esac
4793         ;;
4794 esac
4795
4796 case "$mips_type" in
4797 *BSD*|'') inclwanted="$locincpth $usrinc";;
4798 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4799 esac
4800 for thisincl in $inclwanted; do
4801         if $test -d $thisincl; then
4802                 if $test x$thisincl != x$usrinc; then
4803                         case "$dflt" in
4804                         *" -I$thisincl "*);;
4805                         *) dflt="$dflt -I$thisincl ";;
4806                         esac
4807                 fi
4808         fi
4809 done
4810
4811 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4812         xxx=true;
4813 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4814         xxx=true;
4815 else
4816         xxx=false;
4817 fi;
4818 if $xxx; then
4819         case "$dflt" in
4820         *$2*);;
4821         *) dflt="$dflt -D$2";;
4822         esac;
4823 fi'
4824
4825 set signal.h LANGUAGE_C; eval $inctest
4826
4827 case "$usesocks" in
4828 $define)
4829         ccflags="$ccflags -DSOCKS"
4830         ;;
4831 esac
4832
4833 case "$hint" in
4834 default|recommended) dflt="$ccflags $dflt" ;;
4835 *) dflt="$ccflags";;
4836 esac
4837
4838 case "$dflt" in
4839 ''|' ') dflt=none;;
4840 esac
4841
4842 $cat <<EOH
4843
4844 Your C compiler may want other flags.  For this question you should include
4845 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4846 but you should NOT include libraries or ld flags like -lwhatever.  If you
4847 want $package to honor its debug switch, you should include -DDEBUGGING here.
4848 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4849
4850 To use no flags, specify the word "none".
4851
4852 EOH
4853 set X $dflt
4854 shift
4855 dflt=${1+"$@"}
4856 rp="Any additional cc flags?"
4857 . ./myread
4858 case "$ans" in
4859 none) ccflags='';;
4860 *) ccflags="$ans";;
4861 esac
4862
4863 : the following weeds options from ccflags that are of no interest to cpp
4864 case "$cppflags" in
4865 '') cppflags="$ccflags" ;;
4866 *)  cppflags="$cppflags $ccflags" ;;
4867 esac
4868 case "$gccversion" in
4869 1*) cppflags="$cppflags -D__GNUC__"
4870 esac
4871 case "$mips_type" in
4872 '');;
4873 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4874 esac
4875 case "$cppflags" in
4876 '');;
4877 *)
4878         echo " "
4879         echo "Let me guess what the preprocessor flags are..." >&4
4880         set X $cppflags
4881         shift
4882         cppflags=''
4883         $cat >cpp.c <<'EOM'
4884 #define BLURFL foo
4885
4886 BLURFL xx LFRULB
4887 EOM
4888         previous=''
4889         for flag in $*
4890         do
4891                 case "$flag" in
4892                 -*) ftry="$flag";;
4893                 *) ftry="$previous $flag";;
4894                 esac
4895                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4896                         >cpp1.out 2>/dev/null && \
4897                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4898                         >cpp2.out 2>/dev/null && \
4899                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4900                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4901                 then
4902                         cppflags="$cppflags $ftry"
4903                         previous=''
4904                 else
4905                         previous="$flag"
4906                 fi
4907         done
4908         set X $cppflags
4909         shift
4910         cppflags=${1+"$@"}
4911         case "$cppflags" in
4912         *-*)  echo "They appear to be: $cppflags";;
4913         esac
4914         $rm -f cpp.c cpp?.out
4915         ;;
4916 esac
4917
4918 : flags used in final linking phase
4919 case "$ldflags" in
4920 '') if ./venix; then
4921                 dflt='-i -z'
4922         else
4923                 dflt=''
4924         fi
4925         case "$ccflags" in
4926         *-posix*) dflt="$dflt -posix" ;;
4927         esac
4928         ;;
4929 *) dflt="$ldflags";;
4930 esac
4931
4932 : Try to guess additional flags to pick up local libraries.
4933 for thislibdir in $libpth; do
4934         case " $loclibpth " in
4935         *" $thislibdir "*)
4936                 case "$dflt " in
4937                 *"-L$thislibdir "*) ;;
4938                 *)  dflt="$dflt -L$thislibdir" ;;
4939                 esac
4940                 ;;
4941         esac
4942 done
4943
4944 case "$dflt" in
4945 '') dflt='none' ;;
4946 esac
4947
4948 $cat <<EOH
4949
4950 Your C linker may need flags.  For this question you should
4951 include -L/whatever and any other flags used by the C linker, but you
4952 should NOT include libraries like -lwhatever.
4953
4954 Make sure you include the appropriate -L/path flags if your C linker
4955 does not normally search all of the directories you specified above,
4956 namely
4957         $libpth
4958 To use no flags, specify the word "none".
4959
4960 EOH
4961
4962 rp="Any additional ld flags (NOT including libraries)?"
4963 . ./myread
4964 case "$ans" in
4965 none) ldflags='';;
4966 *) ldflags="$ans";;
4967 esac
4968 rmlist="$rmlist pdp11"
4969
4970 : coherency check
4971 echo " "
4972 echo "Checking your choice of C compiler and flags for coherency..." >&4
4973 $cat > try.c <<'EOF'
4974 #include <stdio.h>
4975 int main() { printf("Ok\n"); return(0); }
4976 EOF
4977 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4978 shift
4979 $cat >try.msg <<'EOM'
4980 I've tried to compile and run the following simple program:
4981
4982 EOM
4983 $cat try.c >> try.msg
4984
4985 $cat >> try.msg <<EOM
4986
4987 I used the command:
4988
4989         $*
4990         $run ./try
4991
4992 and I got the following output:
4993
4994 EOM
4995 dflt=y
4996 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4997         if $sh -c "$run ./try" >>try.msg 2>&1; then
4998                 xxx=`$run ./try`
4999                 case "$xxx" in
5000                 "Ok") dflt=n ;;
5001                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5002                         case " $libs " in
5003                         *" -lsfio "*)
5004                                 cat >> try.msg <<'EOQS'
5005 If $libs contains -lsfio, and sfio is mis-configured, then it
5006 sometimes (apparently) runs and exits with a 0 status, but with no
5007 output!  It may have to do with sfio's use of _exit vs. exit.
5008
5009 EOQS
5010                                 rp="You have a big problem.  Shall I abort Configure"
5011                                 dflt=y
5012                                 ;;
5013                         esac
5014                         ;;
5015                 esac
5016         else
5017                 echo "The program compiled OK, but exited with status $?." >>try.msg
5018                 rp="You have a problem.  Shall I abort Configure"
5019                 dflt=y
5020         fi
5021 else
5022         echo "I can't compile the test program." >>try.msg
5023         rp="You have a BIG problem.  Shall I abort Configure"
5024         dflt=y
5025 fi
5026 case "$dflt" in
5027 y)
5028         $cat try.msg >&4
5029         case "$knowitall" in
5030         '')
5031                 echo "(The supplied flags or libraries might be incorrect.)"
5032                 ;;
5033         *) dflt=n;;
5034         esac
5035         echo " "
5036         . ./myread
5037         case "$ans" in
5038         n*|N*) ;;
5039         *)      echo "Ok.  Stopping Configure." >&4
5040                 exit 1
5041                 ;;
5042         esac
5043         ;;
5044 n) echo "OK, that should do.";;
5045 esac
5046 $rm -f try try.* core
5047
5048 : define a shorthand compile call
5049 compile='
5050 mc_file=$1;
5051 shift;
5052 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5053 : define a shorthand compile call for compilations that should be ok.
5054 compile_ok='
5055 mc_file=$1;
5056 shift;
5057 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5058
5059 : determine filename position in cpp output
5060 echo " "
5061 echo "Computing filename position in cpp output for #include directives..." >&4
5062 case "$osname" in
5063 vos) testaccess=-e ;;
5064 *)   testaccess=-r ;;
5065 esac
5066 echo '#include <stdio.h>' > foo.c
5067 $cat >fieldn <<EOF
5068 $startsh
5069 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5070 $grep '^[       ]*#.*stdio\.h' | \
5071 while read cline; do
5072         pos=1
5073         set \$cline
5074         while $test \$# -gt 0; do
5075                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5076                         echo "\$pos"
5077                         exit 0
5078                 fi
5079                 shift
5080                 pos=\`expr \$pos + 1\`
5081         done
5082 done
5083 EOF
5084 chmod +x fieldn
5085 fieldn=`./fieldn`
5086 $rm -f foo.c fieldn
5087 case $fieldn in
5088 '') pos='???';;
5089 1) pos=first;;
5090 2) pos=second;;
5091 3) pos=third;;
5092 *) pos="${fieldn}th";;
5093 esac
5094 echo "Your cpp writes the filename in the $pos field of the line."
5095
5096 case "$osname" in
5097 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5098 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5099 *)   cppfilter='' ;;
5100 esac
5101 : locate header file
5102 $cat >findhdr <<EOF
5103 $startsh
5104 wanted=\$1
5105 name=''
5106 for usrincdir in $usrinc
5107 do
5108         if test -f \$usrincdir/\$wanted; then
5109                 echo "\$usrincdir/\$wanted"
5110                 exit 0
5111         fi
5112 done
5113 awkprg='{ print \$$fieldn }'
5114 echo "#include <\$wanted>" > foo\$\$.c
5115 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5116 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5117 while read cline; do
5118         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5119         case "\$name" in
5120         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5121         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5122         *) exit 2;;
5123         esac;
5124 done;
5125 #
5126 # status = 0: grep returned 0 lines, case statement not executed
5127 # status = 1: headerfile found
5128 # status = 2: while loop executed, no headerfile found
5129 #
5130 status=\$?
5131 $rm -f foo\$\$.c;
5132 if test \$status -eq 1; then
5133         exit 0;
5134 fi
5135 exit 1
5136 EOF
5137 chmod +x findhdr
5138
5139 : define an alternate in-header-list? function
5140 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5141 cont=true; xxf="echo \"<\$1> found.\" >&4";
5142 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5143 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5144 esac;
5145 case $# in 4) instead=instead;; *) instead="at last";; esac;
5146 while $test "$cont"; do
5147         xxx=`./findhdr $1`
5148         var=$2; eval "was=\$$2";
5149         if $test "$xxx" && $test -r "$xxx";
5150         then eval $xxf;
5151         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5152                 cont="";
5153         else eval $xxnf;
5154         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5155         set $yyy; shift; shift; yyy=$@;
5156         case $# in 0) cont="";;
5157         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5158                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5159         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5160                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5161         esac;
5162 done;
5163 while $test "$yyy";
5164 do set $yyy; var=$2; eval "was=\$$2";
5165         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5166         set $yyy; shift; shift; yyy=$@;
5167 done'
5168
5169 : see if stdlib is available
5170 set stdlib.h i_stdlib
5171 eval $inhdr
5172
5173 : check for lengths of integral types
5174 echo " "
5175 case "$intsize" in
5176 '')
5177         echo "Checking to see how big your integers are..." >&4
5178         $cat >try.c <<EOCP
5179 #include <stdio.h>
5180 #$i_stdlib I_STDLIB
5181 #ifdef I_STDLIB
5182 #include <stdlib.h>
5183 #endif
5184 int main()
5185 {
5186         printf("intsize=%d;\n", (int)sizeof(int));
5187         printf("longsize=%d;\n", (int)sizeof(long));
5188         printf("shortsize=%d;\n", (int)sizeof(short));
5189         exit(0);
5190 }
5191 EOCP
5192         set try
5193         if eval $compile_ok && $run ./try > /dev/null; then
5194                 eval `$run ./try`
5195                 echo "Your integers are $intsize bytes long."
5196                 echo "Your long integers are $longsize bytes long."
5197                 echo "Your short integers are $shortsize bytes long."
5198         else
5199                 $cat >&4 <<EOM
5200 !
5201 Help! I can't compile and run the intsize test program: please enlighten me!
5202 (This is probably a misconfiguration in your system or libraries, and
5203 you really ought to fix it.  Still, I'll try anyway.)
5204 !
5205 EOM
5206                 dflt=4
5207                 rp="What is the size of an integer (in bytes)?"
5208                 . ./myread
5209                 intsize="$ans"
5210                 dflt=$intsize
5211                 rp="What is the size of a long integer (in bytes)?"
5212                 . ./myread
5213                 longsize="$ans"
5214                 dflt=2
5215                 rp="What is the size of a short integer (in bytes)?"
5216                 . ./myread
5217                 shortsize="$ans"
5218         fi
5219         ;;
5220 esac
5221 $rm -f try try.*
5222
5223 : check for long long
5224 echo " "
5225 echo "Checking to see if you have long long..." >&4
5226 echo 'int main() { long long x = 7; return 0; }' > try.c
5227 set try
5228 if eval $compile; then
5229         val="$define"
5230         echo "You have long long."
5231 else
5232         val="$undef"
5233         echo "You do not have long long."
5234 fi
5235 $rm try.*
5236 set d_longlong
5237 eval $setvar
5238
5239 : check for length of long long
5240 case "${d_longlong}${longlongsize}" in
5241 $define)
5242         echo " "
5243         echo "Checking to see how big your long longs are..." >&4
5244         $cat >try.c <<'EOCP'
5245 #include <stdio.h>
5246 int main()
5247 {
5248     printf("%d\n", (int)sizeof(long long));
5249     return(0);
5250 }
5251 EOCP
5252         set try
5253         if eval $compile_ok; then
5254                 longlongsize=`$run ./try`
5255                 echo "Your long longs are $longlongsize bytes long."
5256         else
5257                 dflt='8'
5258                 echo " "
5259                 echo "(I can't seem to compile the test program.  Guessing...)"
5260                 rp="What is the size of a long long (in bytes)?"
5261                 . ./myread
5262                 longlongsize="$ans"
5263         fi
5264         if $test "X$longsize" = "X$longlongsize"; then
5265                 echo "(That isn't any different from an ordinary long.)"
5266         fi      
5267         ;;
5268 esac
5269 $rm -f try.* try
5270
5271 : see if inttypes.h is available
5272 : we want a real compile instead of Inhdr because some systems
5273 : have an inttypes.h which includes non-existent headers
5274 echo " "
5275 $cat >try.c <<EOCP
5276 #include <inttypes.h>
5277 int main() {
5278         static int32_t foo32 = 0x12345678;
5279 }
5280 EOCP
5281 set try
5282 if eval $compile; then
5283         echo "<inttypes.h> found." >&4
5284         val="$define"
5285 else
5286         echo "<inttypes.h> NOT found." >&4
5287         val="$undef"
5288 fi
5289 $rm -f try.c try
5290 set i_inttypes
5291 eval $setvar
5292
5293 : check for int64_t
5294 echo " "
5295 echo "Checking to see if you have int64_t..." >&4
5296 $cat >try.c <<EOCP
5297 #include <sys/types.h>
5298 #$i_inttypes I_INTTYPES
5299 #ifdef I_INTTYPES
5300 #include <inttypes.h>
5301 #endif
5302 int main() { int64_t x = 7; }
5303 EOCP
5304 set try
5305 if eval $compile; then
5306         val="$define"
5307         echo "You have int64_t."
5308 else
5309         val="$undef"
5310         echo "You do not have int64_t."
5311 fi
5312 $rm -f try try.*
5313 set d_int64_t
5314 eval $setvar
5315
5316
5317 echo " "
5318 echo "Checking which 64-bit integer type we could use..." >&4
5319
5320 case "$intsize" in
5321 8) val=int
5322    set quadtype
5323    eval $setvar
5324    val='"unsigned int"'
5325    set uquadtype
5326    eval $setvar
5327    quadkind=1
5328    ;;
5329 *) case "$longsize" in
5330    8) val=long
5331       set quadtype
5332       eval $setvar
5333       val='"unsigned long"'
5334       set uquadtype
5335       eval $setvar
5336       quadkind=2
5337       ;;
5338    *) case "$d_longlong:$longlongsize" in
5339       define:8)
5340         val='"long long"'
5341         set quadtype
5342         eval $setvar
5343         val='"unsigned long long"'
5344         set uquadtype
5345         eval $setvar
5346         quadkind=3
5347         ;;
5348       *) case "$d_int64_t" in
5349          define)
5350            val=int64_t
5351            set quadtype
5352            eval $setvar
5353            val=uint64_t
5354            set uquadtype
5355            eval $setvar
5356            quadkind=4
5357            ;;
5358          esac
5359          ;;
5360       esac
5361       ;;
5362    esac
5363    ;;
5364 esac
5365
5366 case "$quadtype" in
5367 '')     echo "Alas, no 64-bit integer types in sight." >&4
5368         d_quad="$undef"
5369         ;;
5370 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5371         d_quad="$define"
5372         ;;
5373 esac
5374
5375
5376 case "$uselonglong" in
5377 "$define"|true|[yY]*)
5378         cat <<EOM >&4
5379
5380 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5381 EOM
5382         use64bitint="$define"
5383         ;;
5384 esac                          
5385 case "$use64bits" in
5386 "$define"|true|[yY]*)
5387         cat <<EOM >&4
5388
5389 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5390 EOM
5391         use64bitint="$define"
5392         ;;
5393 esac                          
5394 case "$use64bitints" in
5395 "$define"|true|[yY]*)
5396         cat <<EOM >&4
5397
5398 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5399 EOM
5400         use64bitint="$define"
5401         ;;
5402 esac                          
5403 case "$use64bitsint" in
5404 "$define"|true|[yY]*)
5405         cat <<EOM >&4
5406
5407 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5408 EOM
5409         use64bitint="$define"
5410         ;;
5411 esac                          
5412 case "$uselonglongs" in
5413 "$define"|true|[yY]*)
5414         cat <<EOM >&4
5415
5416 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5417 EOM
5418         use64bitint="$define"
5419         ;;
5420 esac                          
5421 case "$use64bitsall" in
5422 "$define"|true|[yY]*)
5423         cat <<EOM >&4
5424
5425 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5426 EOM
5427         use64bitall="$define"
5428         ;;
5429 esac                          
5430
5431 case "$ccflags" in
5432 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5433 esac
5434 case "$use64bitall" in
5435 "$define"|true|[yY]*) use64bitint="$define" ;;
5436 esac
5437
5438 case "$longsize" in
5439 8) cat <<EOM
5440
5441 You have natively 64-bit long integers.
5442 EOM
5443    val="$define"
5444    ;;
5445 *) case "$use64bitint" in
5446    "$define"|true|[yY]*) dflt='y';;
5447    *) dflt='n';;
5448    esac
5449    case "$d_quad" in
5450    "$define") ;;
5451    *) dflt='n' ;;
5452    esac
5453    cat <<EOM
5454
5455 Perl can be built to take advantage of 64-bit integer types
5456 on some systems.  To do so, Configure can be run with -Duse64bitint.
5457 Choosing this option will most probably introduce binary incompatibilities.
5458
5459 If this doesn't make any sense to you, just accept the default '$dflt'.
5460 (The default has been chosen based on your configuration.)
5461 EOM
5462    rp='Try to use 64-bit integers, if available?'
5463    . ./myread
5464    case "$ans" in
5465    [yY]*) val="$define" ;;
5466    *)     val="$undef"  ;;
5467    esac
5468    ;;
5469 esac
5470 set use64bitint
5471 eval $setvar
5472
5473 case "$use64bitall" in
5474 "$define"|true|[yY]*) dflt='y' ;;
5475 *) case "$longsize" in
5476    8) dflt='y' ;;
5477    *) dflt='n' ;;
5478    esac
5479    ;;
5480 esac    
5481 cat <<EOM
5482
5483 You may also choose to try maximal 64-bitness.  It means using as much
5484 64-bitness as possible on the platform.  This in turn means even more
5485 binary incompatibilities.  On the other hand, your platform may not
5486 have any more 64-bitness available than what you already have chosen.
5487
5488 If this doesn't make any sense to you, just accept the default '$dflt'.
5489 (The default has been chosen based on your configuration.)
5490 EOM
5491 rp='Try to use maximal 64-bit support, if available?'
5492 . ./myread
5493 case "$ans" in
5494 [yY]*) val="$define" ;;
5495 *)     val="$undef"  ;;
5496 esac
5497 set use64bitall
5498 eval $setvar
5499 case "$use64bitall" in
5500 "$define")
5501         case "$use64bitint" in
5502         "$undef")
5503                 cat <<EOM
5504
5505 Since you have chosen a maximally 64-bit build, I'm also turning on
5506 the use of 64-bit integers.
5507 EOM
5508                 use64bitint="$define" ;;
5509         esac
5510         ;;
5511 esac
5512
5513 : Look for a hint-file generated 'call-back-unit'.  If the
5514 : user has specified that a 64-bit perl is to be built,
5515 : we may need to set or change some other defaults.
5516 if $test -f use64bitint.cbu; then
5517         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5518         . ./use64bitint.cbu
5519 fi
5520 case "$use64bitint" in
5521 "$define"|true|[yY]*)
5522         case "$longsize" in
5523         4) case "$archname64" in
5524            '') archname64=64int ;;
5525            esac
5526            ;;
5527         esac
5528         ;;
5529 esac
5530
5531 : Look for a hint-file generated 'call-back-unit'.  If the
5532 : user has specified that a maximally 64-bit perl is to be built,
5533 : we may need to set or change some other defaults.
5534 if $test -f use64bitall.cbu; then
5535         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5536         . ./use64bitall.cbu
5537 fi
5538 case "$use64bitall" in
5539 "$define"|true|[yY]*)
5540         case "$longsize" in
5541         4) case "$archname64" in
5542            ''|64int) archname64=64all ;;
5543            esac
5544            ;;
5545         esac
5546         ;;
5547 esac
5548
5549 case "$d_quad:$use64bitint" in
5550 $undef:$define)
5551         cat >&4 <<EOF
5552
5553 *** You have chosen to use 64-bit integers,
5554 *** but none can be found.
5555 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5556 *** Cannot continue, aborting.
5557
5558 EOF
5559         exit 1
5560         ;;
5561 esac
5562
5563 : check for length of double
5564 echo " "
5565 case "$doublesize" in
5566 '')
5567         echo "Checking to see how big your double precision numbers are..." >&4
5568         $cat >try.c <<EOCP
5569 #include <stdio.h>
5570 #$i_stdlib I_STDLIB
5571 #ifdef I_STDLIB
5572 #include <stdlib.h>
5573 #endif
5574 int main()
5575 {
5576     printf("%d\n", (int)sizeof(double));
5577     exit(0);
5578 }
5579 EOCP
5580         set try
5581         if eval $compile_ok; then
5582                 doublesize=`$run ./try`
5583                 echo "Your double is $doublesize bytes long."
5584         else
5585                 dflt='8'
5586                 echo "(I can't seem to compile the test program.  Guessing...)"
5587                 rp="What is the size of a double precision number (in bytes)?"
5588                 . ./myread
5589                 doublesize="$ans"
5590         fi
5591         ;;
5592 esac
5593 $rm -f try.c try
5594
5595 : check for long doubles
5596 echo " "
5597 echo "Checking to see if you have long double..." >&4
5598 echo 'int main() { long double x = 7.0; }' > try.c
5599 set try
5600 if eval $compile; then
5601         val="$define"
5602         echo "You have long double."
5603 else
5604         val="$undef"
5605         echo "You do not have long double."
5606 fi
5607 $rm try.*
5608 set d_longdbl
5609 eval $setvar
5610
5611 : check for length of long double
5612 case "${d_longdbl}${longdblsize}" in
5613 $define)
5614         echo " "
5615         echo "Checking to see how big your long doubles are..." >&4
5616         $cat >try.c <<'EOCP'
5617 #include <stdio.h>
5618 int main()
5619 {
5620         printf("%d\n", sizeof(long double));
5621 }
5622 EOCP
5623         set try
5624         set try
5625         if eval $compile; then
5626                 longdblsize=`$run ./try`
5627                 echo "Your long doubles are $longdblsize bytes long."
5628         else
5629                 dflt='8'
5630                 echo " "
5631                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5632                 rp="What is the size of a long double (in bytes)?"
5633                 . ./myread
5634                 longdblsize="$ans"
5635         fi
5636         if $test "X$doublesize" = "X$longdblsize"; then
5637                 echo "That isn't any different from an ordinary double."
5638                 echo "I'll keep your setting anyway, but you may see some"
5639                 echo "harmless compilation warnings."
5640         fi      
5641         ;;
5642 esac
5643 $rm -f try.* try
5644
5645 : determine the architecture name
5646 echo " "
5647 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5648         tarch=`arch`"-$osname"
5649 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5650         if uname -m > tmparch 2>&1 ; then
5651                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5652                         -e 's/$/'"-$osname/" tmparch`
5653         else
5654                 tarch="$osname"
5655         fi
5656         $rm -f tmparch
5657 else
5658         tarch="$osname"
5659 fi
5660 case "$myarchname" in
5661 ''|"$tarch") ;;
5662 *)
5663         echo "(Your architecture name used to be $myarchname.)"
5664         archname=''
5665         ;;
5666 esac
5667 case "$targetarch" in
5668 '') ;;
5669 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5670 esac
5671 myarchname="$tarch"
5672 case "$archname" in
5673 '') dflt="$tarch";;
5674 *) dflt="$archname";;
5675 esac
5676 rp='What is your architecture name'
5677 . ./myread
5678 archname="$ans"
5679 case "$usethreads" in
5680 $define)
5681         echo "Threads selected." >&4
5682         case "$archname" in
5683         *-thread*) echo "...and architecture name already has -thread." >&4
5684                 ;;
5685         *)      archname="$archname-thread"
5686                 echo "...setting architecture name to $archname." >&4
5687                 ;;
5688         esac
5689         ;;
5690 esac
5691 case "$usemultiplicity" in
5692 $define)
5693         echo "Multiplicity selected." >&4
5694         case "$archname" in
5695         *-multi*) echo "...and architecture name already has -multi." >&4
5696                 ;;
5697         *)      archname="$archname-multi"
5698                 echo "...setting architecture name to $archname." >&4
5699                 ;;
5700         esac
5701         ;;
5702 esac
5703 case "$use64bitint$use64bitall" in
5704 *"$define"*)
5705         case "$archname64" in
5706         '')
5707                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5708                 ;;
5709         *)
5710                 case "$use64bitint" in
5711                 "$define") echo "64 bit integers selected." >&4 ;;
5712                 esac
5713                 case "$use64bitall" in
5714                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5715                 esac
5716                 case "$archname" in
5717                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5718                         ;;
5719                 *)      archname="$archname-$archname64"
5720                         echo "...setting architecture name to $archname." >&4
5721                         ;;
5722                 esac
5723                 ;;
5724         esac
5725 esac
5726 case "$uselongdouble" in
5727 $define)
5728         echo "Long doubles selected." >&4
5729         case "$longdblsize" in
5730         $doublesize)
5731                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
5732                 ;;
5733         *)
5734                 case "$archname" in
5735                 *-ld*) echo "...and architecture name already has -ld." >&4
5736                         ;;
5737                 *)      archname="$archname-ld"
5738                         echo "...setting architecture name to $archname." >&4
5739                         ;;
5740                 esac
5741                 ;;
5742         esac
5743         ;;
5744 esac
5745 case "$useperlio" in
5746 $define)
5747         echo "Perlio selected." >&4
5748         ;;
5749 *)
5750         echo "Perlio not selected, using stdio." >&4
5751         case "$archname" in
5752         *-stdio*) echo "...and architecture name already has -stdio." >&4
5753                 ;;
5754         *)      archname="$archname-stdio"
5755                 echo "...setting architecture name to $archname." >&4
5756                 ;;
5757         esac
5758         ;;
5759 esac
5760 if $test -f archname.cbu; then
5761         echo "Your platform has some specific hints for architecture name, using them..."
5762         . ./archname.cbu
5763 fi
5764
5765 : determine root of directory hierarchy where package will be installed.
5766 case "$prefix" in
5767 '')
5768         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5769         ;;
5770 *?/)
5771         dflt=`echo "$prefix" | sed 's/.$//'`
5772         ;;
5773 *)
5774         dflt="$prefix"
5775         ;;
5776 esac
5777 $cat <<EOM
5778
5779 By default, $package will be installed in $dflt/bin, manual pages
5780 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5781 installation directories. Typically this is something like /usr/local.
5782 If you wish to have binaries under /usr/bin but other parts of the
5783 installation under /usr/local, that's ok: you will be prompted
5784 separately for each of the installation directories, the prefix being
5785 only used to set the defaults.
5786
5787 EOM
5788 fn=d~
5789 rp='Installation prefix to use?'
5790 . ./getfile
5791 oldprefix=''
5792 case "$prefix" in
5793 '') ;;
5794 *)
5795         case "$ans" in
5796         "$prefix") ;;
5797         *) oldprefix="$prefix";;
5798         esac
5799         ;;
5800 esac
5801 prefix="$ans"
5802 prefixexp="$ansexp"
5803
5804 case "$afsroot" in
5805 '')     afsroot=/afs ;;
5806 *)      afsroot=$afsroot ;;
5807 esac
5808
5809 : is AFS running?
5810 echo " "
5811 case "$afs" in
5812 $define|true)   afs=true ;;
5813 $undef|false)   afs=false ;;
5814 *)      if test -d $afsroot; then
5815                 afs=true
5816         else
5817                 afs=false
5818         fi
5819         ;;
5820 esac
5821 if $afs; then
5822         echo "AFS may be running... I'll be extra cautious then..." >&4
5823 else
5824         echo "AFS does not seem to be running..." >&4
5825 fi
5826
5827 : determine installation prefix for where package is to be installed.
5828 if $afs; then 
5829 $cat <<EOM
5830
5831 Since you are running AFS, I need to distinguish the directory in which
5832 files will reside from the directory in which they are installed (and from
5833 which they are presumably copied to the former directory by occult means).
5834
5835 EOM
5836         case "$installprefix" in
5837         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5838         *) dflt="$installprefix";;
5839         esac
5840 else
5841 $cat <<EOM
5842
5843 In some special cases, particularly when building $package for distribution,
5844 it is convenient to distinguish the directory in which files should be
5845 installed from the directory ($prefix) in which they will
5846 eventually reside.  For most users, these two directories are the same.
5847
5848 EOM
5849         case "$installprefix" in
5850         '') dflt=$prefix ;;
5851         *) dflt=$installprefix;;
5852         esac
5853 fi
5854 fn=d~
5855 rp='What installation prefix should I use for installing files?'
5856 . ./getfile
5857 installprefix="$ans"
5858 installprefixexp="$ansexp"
5859
5860 : set the prefixit variable, to compute a suitable default value
5861 prefixit='case "$3" in
5862 ""|none)
5863         case "$oldprefix" in
5864         "") eval "$1=\"\$$2\"";;
5865         *)
5866                 case "$3" in
5867                 "") eval "$1=";;
5868                 none)
5869                         eval "tp=\"\$$2\"";
5870                         case "$tp" in
5871                         ""|" ") eval "$1=\"\$$2\"";;
5872                         *) eval "$1=";;
5873                         esac;;
5874                 esac;;
5875         esac;;
5876 *)
5877         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5878         case "$tp" in
5879         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5880         /*-$oldprefix/*|\~*-$oldprefix/*)
5881                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5882         *) eval "$1=\"\$$2\"";;
5883         esac;;
5884 esac'
5885
5886 : get the patchlevel
5887 echo " "
5888 echo "Getting the current patchlevel..." >&4
5889 if $test -r $rsrc/patchlevel.h;then
5890         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5891         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5892         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5893         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5894         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5895         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5896        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
5897 else
5898         revision=0
5899         patchlevel=0
5900         subversion=0
5901         api_revision=0
5902         api_version=0
5903         api_subversion=0
5904         perl_patchlevel=0
5905         $echo "(You do not have patchlevel.h.  Eek.)"
5906 fi
5907 if $test -r $rsrc/.patch ; then  
5908         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
5909                 perl_patchlevel=`cat $rsrc/.patch`
5910         fi
5911 fi
5912 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
5913 version_patchlevel_string="version $patchlevel subversion $subversion"
5914 case "$perl_patchlevel" in
5915 0|'') ;;
5916 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
5917 esac
5918
5919 $echo "(You have $package $version_patchlevel_string.)"
5920
5921 case "$osname" in
5922 dos|vms)
5923         : XXX Should be a Configure test for double-dots in filenames.
5924         version=`echo $revision $patchlevel $subversion | \
5925                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5926         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5927                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5928         ;;
5929 *)
5930         version=`echo $revision $patchlevel $subversion | \
5931                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5932         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5933                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5934         ;;
5935 esac
5936 : Special case the 5.005_xx maintenance series, which used 5.005
5937 : without any subversion label as a subdirectory in $sitelib
5938 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5939         api_versionstring='5.005'
5940 fi
5941
5942 : determine installation style
5943 : For now, try to deduce it from prefix unless it is already set.
5944 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5945 case "$installstyle" in
5946 '')     case "$prefix" in
5947                 *perl*) dflt='lib';;
5948                 *) dflt='lib/perl5' ;;
5949         esac
5950         ;;
5951 *)      dflt="$installstyle" ;;
5952 esac
5953 : Probably not worth prompting for this since we prompt for all
5954 : the directories individually, and the prompt would be too long and
5955 : confusing anyway.
5956 installstyle=$dflt
5957
5958 : determine where private library files go
5959 : Usual default is /usr/local/lib/perl5/$version.
5960 : Also allow things like /opt/perl/lib/$version, since 
5961 : /opt/perl/lib/perl5... would be redundant.
5962 : The default "style" setting is made in installstyle.U
5963 case "$installstyle" in
5964 *lib/perl5*) set dflt privlib lib/$package/$version ;;
5965 *)       set dflt privlib lib/$version ;;
5966 esac
5967 eval $prefixit
5968 $cat <<EOM
5969
5970 There are some auxiliary files for $package that need to be put into a
5971 private library directory that is accessible by everyone.
5972
5973 EOM
5974 fn=d~+
5975 rp='Pathname where the private library files will reside?'
5976 . ./getfile
5977 privlib="$ans"
5978 privlibexp="$ansexp"
5979 : Change installation prefix, if necessary.
5980 if $test X"$prefix" != X"$installprefix"; then
5981         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5982 else
5983         installprivlib="$privlibexp"
5984 fi
5985
5986 : set the prefixup variable, to restore leading tilda escape
5987 prefixup='case "$prefixexp" in
5988 "$prefix") ;;
5989 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5990 esac'
5991
5992 : determine where public architecture dependent libraries go
5993 set archlib archlib
5994 eval $prefixit
5995 : privlib default is /usr/local/lib/$package/$version
5996 : archlib default is /usr/local/lib/$package/$version/$archname
5997 : privlib may have an optional trailing /share.
5998 tdflt=`echo $privlib | $sed 's,/share$,,'`
5999 tdflt=$tdflt/$archname
6000 case "$archlib" in
6001 '')     dflt=$tdflt
6002         ;;
6003 *)      dflt="$archlib"
6004     ;;
6005 esac
6006 $cat <<EOM
6007
6008 $spackage contains architecture-dependent library files.  If you are
6009 sharing libraries in a heterogeneous environment, you might store
6010 these files in a separate location.  Otherwise, you can just include
6011 them with the rest of the public library files.
6012
6013 EOM
6014 fn=d+~
6015 rp='Where do you want to put the public architecture-dependent libraries?'
6016 . ./getfile
6017 archlib="$ans"
6018 archlibexp="$ansexp"
6019 if $test X"$archlib" = X"$privlib"; then
6020         d_archlib="$undef"
6021 else
6022         d_archlib="$define"
6023 fi
6024 : Change installation prefix, if necessary.
6025 if $test X"$prefix" != X"$installprefix"; then
6026         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6027 else
6028         installarchlib="$archlibexp"
6029 fi
6030
6031 : see if setuid scripts can be secure
6032 $cat <<EOM
6033
6034 Some kernels have a bug that prevents setuid #! scripts from being
6035 secure.  Some sites have disabled setuid #! scripts because of this.
6036
6037 First let's decide if your kernel supports secure setuid #! scripts.
6038 (If setuid #! scripts would be secure but have been disabled anyway,
6039 don't say that they are secure if asked.)
6040
6041 EOM
6042
6043 val="$undef"
6044 if $test -d /dev/fd; then
6045         echo "#!$ls" >reflect
6046         chmod +x,u+s reflect
6047         ./reflect >flect 2>&1
6048         if $contains "/dev/fd" flect >/dev/null; then
6049                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6050                 val="$define"
6051         else
6052                 $cat <<EOM
6053 If you are not sure if they are secure, I can check but I'll need a
6054 username and password different from the one you are using right now.
6055 If you don't have such a username or don't want me to test, simply
6056 enter 'none'.
6057
6058 EOM
6059                 rp='Other username to test security of setuid scripts with?'
6060                 dflt='none'
6061                 . ./myread
6062                 case "$ans" in
6063                 n|none)
6064                         case "$d_suidsafe" in
6065                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6066                                 dflt=n;;
6067                         "$undef")
6068                                 echo "Well, the $hint value is *not* secure." >&4
6069                                 dflt=n;;
6070                         *)      echo "Well, the $hint value *is* secure." >&4
6071                                 dflt=y;;
6072                         esac
6073                         ;;
6074                 *)
6075                         $rm -f reflect flect
6076                         echo "#!$ls" >reflect
6077                         chmod +x,u+s reflect
6078                         echo >flect
6079                         chmod a+w flect
6080                         echo '"su" will (probably) prompt you for '"$ans's password."
6081                         su $ans -c './reflect >flect'
6082                         if $contains "/dev/fd" flect >/dev/null; then
6083                                 echo "Okay, it looks like setuid scripts are secure." >&4
6084                                 dflt=y
6085                         else
6086                                 echo "I don't think setuid scripts are secure." >&4
6087                                 dflt=n
6088                         fi
6089                         ;;
6090                 esac
6091                 rp='Does your kernel have *secure* setuid scripts?'
6092                 . ./myread
6093                 case "$ans" in
6094                 [yY]*)  val="$define";;
6095                 *)      val="$undef";;
6096                 esac
6097         fi
6098 else
6099         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6100         echo "(That's for file descriptors, not floppy disks.)"
6101         val="$undef"
6102 fi
6103 set d_suidsafe
6104 eval $setvar
6105
6106 $rm -f reflect flect
6107
6108 : now see if they want to do setuid emulation
6109 echo " "
6110 val="$undef"
6111 case "$d_suidsafe" in
6112 "$define")
6113         val="$undef"
6114         echo "No need to emulate SUID scripts since they are secure here." >&4
6115         ;;
6116 *)
6117         $cat <<EOM
6118 Some systems have disabled setuid scripts, especially systems where
6119 setuid scripts cannot be secure.  On systems where setuid scripts have
6120 been disabled, the setuid/setgid bits on scripts are currently
6121 useless.  It is possible for $package to detect those bits and emulate
6122 setuid/setgid in a secure fashion.  This emulation will only work if
6123 setuid scripts have been disabled in your kernel.
6124
6125 EOM
6126         case "$d_dosuid" in
6127         "$define") dflt=y ;;
6128         *) dflt=n ;;
6129         esac
6130         rp="Do you want to do setuid/setgid emulation?"
6131         . ./myread
6132         case "$ans" in
6133         [yY]*)  val="$define";;
6134         *)      val="$undef";;
6135         esac
6136         ;;
6137 esac
6138 set d_dosuid
6139 eval $setvar
6140
6141 : see if this is a malloc.h system
6142 : we want a real compile instead of Inhdr because some systems have a
6143 : malloc.h that just gives a compile error saying to use stdlib.h instead
6144 echo " "
6145 $cat >try.c <<EOCP
6146 #include <stdlib.h>
6147 #include <malloc.h>
6148 int main () { return 0; }
6149 EOCP
6150 set try
6151 if eval $compile; then
6152     echo "<malloc.h> found." >&4
6153     val="$define"
6154 else
6155     echo "<malloc.h> NOT found." >&4
6156     val="$undef"
6157 fi
6158 $rm -f try.c try
6159 set i_malloc
6160 eval $setvar
6161
6162 : check for void type
6163 echo " "
6164 echo "Checking to see how well your C compiler groks the void type..." >&4
6165 case "$voidflags" in
6166 '')
6167         $cat >try.c <<EOCP
6168 #$i_stdlib I_STDLIB
6169 #ifdef I_STDLIB
6170 #include <stdlib.h>
6171 #endif
6172 #if TRY & 1
6173 void sub() {
6174 #else
6175 sub() {
6176 #endif
6177         extern void moo();      /* function returning void */
6178         void (*goo)();          /* ptr to func returning void */
6179 #if TRY & 8
6180         void *hue;              /* generic ptr */
6181 #endif
6182 #if TRY & 2
6183         void (*foo[10])();
6184 #endif
6185
6186 #if TRY & 4
6187         if(goo == moo) {
6188                 exit(0);
6189         }
6190 #endif
6191         exit(0);
6192 }
6193 int main() { sub(); }
6194 EOCP
6195         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6196                 voidflags=$defvoidused
6197         echo "Good.  It appears to support void to the level $package wants.">&4
6198                 if $contains warning .out >/dev/null 2>&1; then
6199                         echo "However, you might get some warnings that look like this:"
6200                         $cat .out
6201                 fi
6202         else
6203 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6204                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6205                         echo "It supports 1..."
6206                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6207                                 echo "It also supports 2..."
6208                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6209                                         voidflags=7
6210                                         echo "And it supports 4 but not 8 definitely."
6211                                 else
6212                                         echo "It doesn't support 4..."
6213                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6214                                                 voidflags=11
6215                                                 echo "But it supports 8."
6216                                         else
6217                                                 voidflags=3
6218                                                 echo "Neither does it support 8."
6219                                         fi
6220                                 fi
6221                         else
6222                                 echo "It does not support 2..."
6223                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6224                                         voidflags=13
6225                                         echo "But it supports 4 and 8."
6226                                 else
6227                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6228                                                 voidflags=5
6229                                                 echo "And it supports 4 but has not heard about 8."
6230                                         else
6231                                                 echo "However it supports 8 but not 4."
6232                                         fi
6233                                 fi
6234                         fi
6235                 else
6236                         echo "There is no support at all for void."
6237                         voidflags=0
6238                 fi
6239         fi
6240 esac
6241 case "$voidflags" in
6242 "$defvoidused") ;;
6243 *)      $cat >&4 <<'EOM'
6244   Support flag bits are:
6245     1: basic void declarations.
6246     2: arrays of pointers to functions returning void.
6247     4: operations between pointers to and addresses of void functions.
6248     8: generic void pointers.
6249 EOM
6250         dflt="$voidflags";
6251         rp="Your void support flags add up to what?"
6252         . ./myread
6253         voidflags="$ans"
6254         ;;
6255 esac
6256 $rm -f try.* .out
6257
6258 : check for length of pointer
6259 echo " "
6260 case "$ptrsize" in
6261 '')
6262         echo "Checking to see how big your pointers are..." >&4
6263         if test "$voidflags" -gt 7; then
6264                 echo '#define VOID_PTR char *' > try.c
6265         else
6266                 echo '#define VOID_PTR void *' > try.c
6267         fi
6268         $cat >>try.c <<EOCP
6269 #include <stdio.h>
6270 #$i_stdlib I_STDLIB
6271 #ifdef I_STDLIB
6272 #include <stdlib.h>
6273 #endif
6274 int main()
6275 {
6276     printf("%d\n", (int)sizeof(VOID_PTR));
6277     exit(0);
6278 }
6279 EOCP
6280         set try
6281         if eval $compile_ok; then
6282                 ptrsize=`$run ./try`
6283                 echo "Your pointers are $ptrsize bytes long."
6284         else
6285                 dflt='4'
6286                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6287                 rp="What is the size of a pointer (in bytes)?"
6288                 . ./myread
6289                 ptrsize="$ans"
6290         fi
6291         ;;
6292 esac
6293 $rm -f try.c try
6294 case "$use64bitall" in
6295 "$define"|true|[yY]*)
6296         case "$ptrsize" in
6297         4)      cat <<EOM >&4
6298
6299 *** You have chosen a maximally 64-bit build,
6300 *** but your pointers are only 4 bytes wide.
6301 *** Please rerun Configure without -Duse64bitall.
6302 EOM
6303                 case "$d_quad" in
6304                 define)
6305                         cat <<EOM >&4
6306 *** Since you have quads, you could possibly try with -Duse64bitint.
6307 EOM
6308                         ;;
6309                 esac
6310                 cat <<EOM >&4
6311 *** Cannot continue, aborting.
6312
6313 EOM
6314
6315                 exit 1
6316                 ;;
6317         esac
6318         ;;
6319 esac
6320
6321
6322 : determine whether to use malloc wrapping
6323 echo " "
6324 case "$usemallocwrap" in
6325 [yY]*|true|$define)     dflt='y' ;;
6326 [nN]*|false|$undef)     dflt='n' ;;
6327 *)      case "$usedevel" in
6328         [yY]*|true|$define)     dflt='y' ;;
6329         *) dflt='n' ;;
6330         esac
6331         ;;
6332 esac
6333 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6334 . ./myread
6335 usemallocwrap="$ans"
6336 case "$ans" in
6337 y*|true)
6338         usemallocwrap="$define" ;;
6339 *)
6340         usemallocwrap="$undef" ;;
6341 esac
6342
6343 : determine which malloc to compile in
6344 echo " "
6345 case "$usemymalloc" in
6346 [yY]*|true|$define)     dflt='y' ;;
6347 [nN]*|false|$undef)     dflt='n' ;;
6348 *)      case "$ptrsize" in
6349         4) dflt='y' ;;
6350         *) dflt='n' ;;
6351         esac
6352         ;;
6353 esac
6354 rp="Do you wish to attempt to use the malloc that comes with $package?"
6355 . ./myread
6356 usemymalloc="$ans"
6357 case "$ans" in
6358 y*|true)
6359         usemymalloc='y'
6360         mallocsrc='malloc.c'
6361         mallocobj="malloc$_o"
6362         d_mymalloc="$define"
6363         case "$libs" in
6364         *-lmalloc*)
6365                 : Remove malloc from list of libraries to use
6366                 echo "Removing unneeded -lmalloc from library list" >&4
6367                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6368                 shift
6369                 libs="$*"
6370                 echo "libs = $libs" >&4
6371                 ;;
6372         esac
6373         ;;
6374 *)
6375         usemymalloc='n'
6376         mallocsrc=''
6377         mallocobj=''
6378         d_mymalloc="$undef"
6379         ;;
6380 esac
6381
6382 : compute the return types of malloc and free
6383 echo " "
6384 $cat >malloc.c <<END
6385 #$i_malloc I_MALLOC
6386 #$i_stdlib I_STDLIB
6387 #include <stdio.h>
6388 #include <sys/types.h>
6389 #ifdef I_MALLOC
6390 #include <malloc.h>
6391 #endif
6392 #ifdef I_STDLIB
6393 #include <stdlib.h>
6394 #endif
6395 #ifdef TRY_MALLOC
6396 void *malloc();
6397 #endif
6398 #ifdef TRY_FREE
6399 void free();
6400 #endif
6401 END
6402 case "$malloctype" in
6403 '')
6404         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6405                 malloctype='void *'
6406         else
6407                 malloctype='char *'
6408         fi
6409         ;;
6410 esac
6411 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6412
6413 case "$freetype" in
6414 '')
6415         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6416                 freetype='void'
6417         else
6418                 freetype='int'
6419         fi
6420         ;;
6421 esac
6422 echo "Your system uses $freetype free(), it would seem." >&4
6423 $rm -f malloc.[co]
6424 $cat <<EOM
6425
6426 After $package is installed, you may wish to install various
6427 add-on modules and utilities.  Typically, these add-ons will
6428 be installed under $prefix with the rest
6429 of this package.  However, you may wish to install such add-ons
6430 elsewhere under a different prefix.
6431
6432 If you do not wish to put everything under a single prefix, that's
6433 ok.  You will be prompted for the individual locations; this siteprefix
6434 is only used to suggest the defaults.
6435
6436 The default should be fine for most people.
6437
6438 EOM
6439 fn=d~+
6440 rp='Installation prefix to use for add-on modules and utilities?'
6441 : XXX Here might be another good place for an installstyle setting.
6442 case "$siteprefix" in
6443 '') dflt=$prefix ;;
6444 *)  dflt=$siteprefix ;;
6445 esac
6446 . ./getfile
6447 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6448 oldsiteprefix=''
6449 case "$siteprefix" in
6450 '') ;;
6451 *)      case "$ans" in
6452         "$prefix") ;;
6453         *) oldsiteprefix="$prefix";;
6454         esac
6455         ;;
6456 esac
6457 siteprefix="$ans"
6458 siteprefixexp="$ansexp"
6459
6460 : determine where site specific libraries go.
6461 : Usual default is /usr/local/lib/perl5/site_perl/$version
6462 : The default "style" setting is made in installstyle.U
6463 : XXX No longer works with Prefixit stuff.
6464 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6465 case "$sitelib" in
6466 '') case "$installstyle" in
6467         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6468         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6469         esac
6470         ;;
6471 *)      dflt="$sitelib"
6472         ;;
6473 esac
6474 $cat <<EOM
6475
6476 The installation process will create a directory for
6477 site-specific extensions and modules.  Most users find it convenient
6478 to place all site-specific files in this directory rather than in the
6479 main distribution directory.
6480
6481 EOM
6482 fn=d~+
6483 rp='Pathname for the site-specific library files?'
6484 . ./getfile
6485 sitelib="$ans"
6486 sitelibexp="$ansexp"
6487 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6488 : Change installation prefix, if necessary.
6489 if $test X"$prefix" != X"$installprefix"; then
6490         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6491 else
6492         installsitelib="$sitelibexp"
6493 fi
6494
6495 : determine where site specific architecture-dependent libraries go.
6496 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6497 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6498 : sitelib may have an optional trailing /share.
6499 case "$sitearch" in
6500 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6501         dflt="$dflt/$archname"
6502         ;;
6503 *)      dflt="$sitearch"
6504         ;;
6505 esac
6506 set sitearch sitearch none
6507 eval $prefixit
6508 $cat <<EOM
6509
6510 The installation process will also create a directory for
6511 architecture-dependent site-specific extensions and modules.
6512
6513 EOM
6514 fn=d~+
6515 rp='Pathname for the site-specific architecture-dependent library files?'
6516 . ./getfile
6517 sitearch="$ans"
6518 sitearchexp="$ansexp"
6519 : Change installation prefix, if necessary.
6520 if $test X"$prefix" != X"$installprefix"; then
6521         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6522 else
6523         installsitearch="$sitearchexp"
6524 fi
6525
6526 $cat <<EOM
6527
6528 The installation process will also create a directory for
6529 vendor-supplied add-ons.  Vendors who supply perl with their system
6530 may find it convenient to place all vendor-supplied files in this
6531 directory rather than in the main distribution directory.  This will
6532 ease upgrades between binary-compatible maintenance versions of perl.
6533
6534 Of course you may also use these directories in whatever way you see
6535 fit.  For example, you might use them to access modules shared over a
6536 company-wide network.
6537
6538 The default answer should be fine for most people.
6539 This causes further questions about vendor add-ons to be skipped
6540 and no vendor-specific directories will be configured for perl.
6541
6542 EOM
6543 rp='Do you want to configure vendor-specific add-on directories?'
6544 case "$usevendorprefix" in
6545 define|true|[yY]*) dflt=y ;;
6546 *)      : User may have set vendorprefix directly on Configure command line.
6547         case "$vendorprefix" in
6548         ''|' ') dflt=n ;;
6549         *)      dflt=y ;;
6550         esac
6551         ;;
6552 esac
6553 . ./myread
6554 case "$ans" in
6555 [yY]*)  fn=d~+
6556         rp='Installation prefix to use for vendor-supplied add-ons?'
6557         case "$vendorprefix" in
6558         '') dflt='' ;;
6559         *)  dflt=$vendorprefix ;;
6560         esac
6561         . ./getfile
6562         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6563         oldvendorprefix=''
6564         case "$vendorprefix" in
6565         '') ;;
6566         *)      case "$ans" in
6567                 "$prefix") ;;
6568                 *) oldvendorprefix="$prefix";;
6569                 esac
6570                 ;;
6571         esac
6572         usevendorprefix="$define"
6573         vendorprefix="$ans"
6574         vendorprefixexp="$ansexp"
6575         ;;
6576 *)      usevendorprefix="$undef"
6577         vendorprefix=''
6578         vendorprefixexp=''
6579         ;;
6580 esac
6581
6582 case "$vendorprefix" in
6583 '')     d_vendorlib="$undef"
6584         vendorlib=''
6585         vendorlibexp=''
6586         ;;
6587 *)      d_vendorlib="$define"
6588         : determine where vendor-supplied modules go.
6589         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6590         case "$vendorlib" in
6591         '')
6592                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6593                 case "$installstyle" in
6594                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6595                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6596                 esac
6597                 ;;
6598         *)      dflt="$vendorlib"
6599                 ;;
6600         esac
6601         fn=d~+
6602         rp='Pathname for the vendor-supplied library files?'
6603         . ./getfile
6604         vendorlib="$ans"
6605         vendorlibexp="$ansexp"
6606         ;;
6607 esac
6608 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6609 : Change installation prefix, if necessary.
6610 if $test X"$prefix" != X"$installprefix"; then
6611         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6612 else
6613         installvendorlib="$vendorlibexp"
6614 fi
6615
6616 case "$vendorprefix" in
6617 '')     d_vendorarch="$undef"
6618         vendorarch=''
6619         vendorarchexp=''
6620         ;;
6621 *)      d_vendorarch="$define"
6622         : determine where vendor-supplied architecture-dependent libraries go.
6623         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6624         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6625         : vendorlib may have an optional trailing /share.
6626         case "$vendorarch" in
6627         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6628                 dflt="$dflt/$archname"
6629                 ;;
6630         *)      dflt="$vendorarch" ;;
6631         esac
6632         fn=d~+
6633         rp='Pathname for vendor-supplied architecture-dependent files?'
6634         . ./getfile
6635         vendorarch="$ans"
6636         vendorarchexp="$ansexp"
6637         ;;
6638 esac
6639 : Change installation prefix, if necessary.
6640 if $test X"$prefix" != X"$installprefix"; then
6641         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6642 else
6643         installvendorarch="$vendorarchexp"
6644 fi
6645
6646 : Final catch-all directories to search
6647 $cat <<EOM
6648
6649 Lastly, you can have perl look in other directories for extensions and
6650 modules in addition to those already specified.
6651 These directories will be searched after 
6652         $sitearch 
6653         $sitelib 
6654 EOM
6655 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6656 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6657 echo ' '
6658 case "$otherlibdirs" in
6659 ''|' ') dflt='none' ;;
6660 *)      dflt="$otherlibdirs" ;;
6661 esac
6662 $cat <<EOM
6663 Enter a colon-separated set of extra paths to include in perl's @INC
6664 search path, or enter 'none' for no extra paths.
6665
6666 EOM
6667
6668 rp='Colon-separated list of additional directories for perl to search?'
6669 . ./myread
6670 case "$ans" in
6671 ' '|''|none)    otherlibdirs=' ' ;;     
6672 *)      otherlibdirs="$ans" ;;
6673 esac
6674 case "$otherlibdirs" in
6675 ' ') val=$undef ;;
6676 *)      val=$define ;;
6677 esac
6678 set d_perl_otherlibdirs
6679 eval $setvar
6680
6681 : Cruising for prototypes
6682 echo " "
6683 echo "Checking out function prototypes..." >&4
6684 $cat >prototype.c <<EOCP
6685 #$i_stdlib I_STDLIB
6686 #ifdef I_STDLIB
6687 #include <stdlib.h>
6688 #endif
6689 int main(int argc, char *argv[]) {
6690         exit(0);}
6691 EOCP
6692 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6693         echo "Your C compiler appears to support function prototypes."
6694         val="$define"
6695 else
6696         echo "Your C compiler doesn't seem to understand function prototypes."
6697         val="$undef"
6698 fi
6699 set prototype
6700 eval $setvar
6701 $rm -f prototype*
6702
6703 case "$prototype" in
6704 "$define") ;;
6705 *)      ansi2knr='ansi2knr'
6706         echo " "
6707         cat <<EOM >&4
6708
6709 $me:  FATAL ERROR:
6710 This version of $package can only be compiled by a compiler that 
6711 understands function prototypes.  Unfortunately, your C compiler 
6712         $cc $ccflags
6713 doesn't seem to understand them.  Sorry about that.
6714
6715 If GNU cc is available for your system, perhaps you could try that instead.  
6716
6717 Eventually, we hope to support building Perl with pre-ANSI compilers.
6718 If you would like to help in that effort, please contact <perlbug@perl.org>.
6719
6720 Aborting Configure now.
6721 EOM
6722         exit 2
6723         ;;
6724 esac
6725
6726 : determine where public executables go
6727 echo " "
6728 set dflt bin bin
6729 eval $prefixit
6730 fn=d~
6731 rp='Pathname where the public executables will reside?'
6732 . ./getfile
6733 if $test "X$ansexp" != "X$binexp"; then
6734         installbin=''
6735 fi
6736 bin="$ans"
6737 binexp="$ansexp"
6738 : Change installation prefix, if necessary.
6739 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6740 if $test X"$prefix" != X"$installprefix"; then
6741         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6742 else
6743         installbin="$binexp"
6744 fi
6745
6746 echo " "
6747 case "$extras" in
6748 '') dflt='n';;
6749 *) dflt='y';;
6750 esac
6751 cat <<EOM
6752 Perl can be built with extra modules or bundles of modules which
6753 will be fetched from the CPAN and installed alongside Perl.
6754
6755 Notice that you will need access to the CPAN; either via the Internet,
6756 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
6757 be asked later to configure the CPAN.pm module which will in turn do
6758 the installation of the rest of the extra modules or bundles.)
6759
6760 Notice also that if the modules require any external software such as
6761 libraries and headers (the libz library and the zlib.h header for the
6762 Compress::Zlib module, for example) you MUST have any such software
6763 already installed, this configuration process will NOT install such
6764 things for you.
6765
6766 If this doesn't make any sense to you, just accept the default '$dflt'.
6767 EOM
6768 rp='Install any extra modules (y or n)?'
6769 . ./myread
6770 case "$ans" in
6771 y|Y)
6772         cat <<EOM
6773
6774 Please list any extra modules or bundles to be installed from CPAN,
6775 with spaces between the names.  The names can be in any format the
6776 'install' command of CPAN.pm will understand.  (Answer 'none',
6777 without the quotes, to install no extra modules or bundles.)
6778 EOM
6779         rp='Extras?'
6780         dflt="$extras"
6781         . ./myread
6782         extras="$ans"
6783 esac
6784 case "$extras" in
6785 ''|'none')
6786         val=''
6787         $rm -f ../extras.lst
6788         ;;
6789 *)      echo "(Saving the list of extras for later...)"
6790         echo "$extras" > ../extras.lst
6791         val="'$extras'"
6792         ;;
6793 esac
6794 set extras
6795 eval $setvar
6796 echo " "
6797
6798 : determine where html pages for programs go
6799 set html1dir html1dir none
6800 eval $prefixit
6801 $cat <<EOM
6802
6803 If you wish to install html files for programs in $spackage, indicate 
6804 the appropriate directory here.  To skip installing html files,
6805 answer "none".
6806 EOM
6807 case "$html1dir" in
6808 ''|none|$undef|' ') dflt=none ;;
6809 *) dflt=$html1dir ;;
6810 esac
6811 fn=dn+~
6812 rp="Directory for the main $spackage html pages?"
6813 . ./getfile
6814 html1dir="$ans"
6815 html1direxp="$ansexp"
6816 : Use ' ' for none so value is preserved next time through Configure
6817 $test X"$html1dir" = "X" && html1dir=' '
6818 : Change installation prefix, if necessary.
6819 if $test X"$prefix" != X"$installprefix"; then
6820         installhtml1dir=`echo $html1direxp | sed "s#^$prefix#$installprefix#"`
6821 else
6822         installhtml1dir="$html1direxp"
6823 fi
6824
6825 : determine where html pages for libraries and modules go
6826 set html3dir html3dir none
6827 eval $prefixit
6828 $cat <<EOM
6829
6830 If you wish to install html files for modules associated with $spackage,
6831 indicate the appropriate directory here.  To skip installing html files,
6832 answer "none".
6833 EOM
6834 : There is no obvious default.  If they have specified html1dir, then
6835 : try to key off that, possibly changing .../html1 into .../html3.
6836 case "$html3dir" in
6837 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
6838 *) dflt=$html3dir ;;
6839 esac
6840 fn=dn+~
6841 rp="Directory for the $spackage module html pages?"
6842 . ./getfile
6843 html3dir="$ans"
6844 html3direxp="$ansexp"
6845 : Use ' ' for none so value is preserved next time through Configure
6846 $test X"$html3dir" = "X" && html3dir=' '
6847 : Change installation prefix, if necessary.
6848 if $test X"$prefix" != X"$installprefix"; then
6849         installhtml3dir=`echo $html3direxp | sed "s#^$prefix#$installprefix#"`
6850 else
6851         installhtml3dir="$html3direxp"
6852 fi
6853
6854 : Find perl5.005 or later.
6855 echo "Looking for a previously installed perl5.005 or later... "
6856 case "$perl5" in
6857 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6858                 : Check if this perl is recent and can load a simple module
6859                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6860                         perl5=$tdir/perl
6861                         break;
6862                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6863                         perl5=$tdir/perl5
6864                         break;
6865                 fi
6866         done
6867         ;;
6868 *)      perl5="$perl5"
6869         ;;
6870 esac
6871 case "$perl5" in
6872 '')     echo "None found.  That's ok.";;
6873 *)      echo "Using $perl5." ;;
6874 esac
6875
6876 : Determine list of previous versions to include in @INC
6877 $cat > getverlist <<EOPL
6878 #!$perl5 -w
6879 use File::Basename;
6880 \$api_versionstring = "$api_versionstring";
6881 \$version = "$version";
6882 \$stem = "$sitelib_stem";
6883 \$archname = "$archname";
6884 EOPL
6885         $cat >> getverlist <<'EOPL'
6886 # Can't have leading @ because metaconfig interprets it as a command!
6887 ;@inc_version_list=();
6888 # XXX Redo to do opendir/readdir? 
6889 if (-d $stem) {
6890     chdir($stem);
6891     ;@candidates = glob("5.*");
6892 }
6893 else {
6894     ;@candidates = ();
6895 }
6896
6897 # XXX ToDo:  These comparisons must be reworked when two-digit
6898 # subversions come along, so that 5.7.10 compares as greater than
6899 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6900 # widespread that we can use the built-in version vectors rather
6901 # than reinventing them here.  For 5.6.0, however, we must
6902 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6903 foreach $d (@candidates) {
6904     if ($d lt $version) {
6905         if ($d ge $api_versionstring) {
6906             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6907         }
6908         elsif ($d ge "5.005") {
6909             unshift(@inc_version_list, grep { -d } $d);
6910         }
6911     }
6912     else {
6913         # Skip newer version.  I.e. don't look in
6914         # 5.7.0 if we're installing 5.6.1.
6915     }
6916 }
6917
6918 if (@inc_version_list) {
6919     print join(' ', @inc_version_list);
6920 }
6921 else {
6922     # Blank space to preserve value for next Configure run.
6923     print " ";
6924 }
6925 EOPL
6926 chmod +x getverlist
6927 case "$inc_version_list" in
6928 '')     if test -x "$perl5$exe_ext"; then
6929                 dflt=`$perl5 getverlist`
6930         else
6931                 dflt='none'
6932         fi
6933         ;;
6934 $undef) dflt='none' ;;
6935 *)  eval dflt=\"$inc_version_list\" ;;
6936 esac
6937 case "$dflt" in
6938 ''|' ') dflt=none ;;
6939 esac
6940 case "$dflt" in
6941 5.005) dflt=none ;;
6942 esac
6943 $cat <<EOM
6944
6945 In order to ease the process of upgrading, this version of perl 
6946 can be configured to use modules built and installed with earlier 
6947 versions of perl that were installed under $prefix.  Specify here
6948 the list of earlier versions that this version of perl should check.
6949 If Configure detected no earlier versions of perl installed under
6950 $prefix, then the list will be empty.  Answer 'none' to tell perl
6951 to not search earlier versions.
6952
6953 The default should almost always be sensible, so if you're not sure,
6954 just accept the default.
6955 EOM
6956
6957 rp='List of earlier versions to include in @INC?'
6958 . ./myread
6959 case "$ans" in
6960 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6961 *) inc_version_list="$ans" ;;
6962 esac
6963 case "$inc_version_list" in
6964 ''|' ') 
6965         inc_version_list_init='0';;
6966 *)      inc_version_list_init=`echo $inc_version_list |
6967                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6968         ;;
6969 esac
6970 $rm -f getverlist
6971
6972 : determine whether to install perl also as /usr/bin/perl
6973
6974 echo " "
6975 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6976         $cat <<EOM
6977 Many scripts expect perl to be installed as /usr/bin/perl.
6978
6979 If you want to, I can install the perl you are about to compile
6980 as /usr/bin/perl (in addition to $bin/perl).
6981 EOM
6982         if test -f /usr/bin/perl; then
6983             $cat <<EOM
6984
6985 However, please note that because you already have a /usr/bin/perl,
6986 overwriting that with a new Perl would very probably cause problems.
6987 Therefore I'm assuming you don't want to do that (unless you insist).
6988
6989 EOM
6990             case "$installusrbinperl" in
6991             "$define"|[yY]*)    dflt='y';;
6992             *)                  dflt='n';;
6993             esac
6994         else
6995             $cat <<EOM
6996
6997 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
6998
6999 EOM
7000             case "$installusrbinperl" in
7001             "$undef"|[nN]*)     dflt='n';;
7002             *)                  dflt='y';;
7003             esac
7004         fi
7005         rp="Do you want to install perl as /usr/bin/perl?"
7006         . ./myread
7007         case "$ans" in
7008         [yY]*)  val="$define";;
7009         *)      val="$undef" ;;
7010         esac
7011 else
7012         val="$undef"
7013 fi
7014 set installusrbinperl
7015 eval $setvar
7016
7017 echo " "
7018 echo "Checking for GNU C Library..." >&4
7019 cat >try.c <<'EOCP'
7020 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7021    alone are insufficient to distinguish different versions, such as
7022    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7023    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7024 */
7025 #include <stdio.h>
7026 int main(void)
7027 {
7028 #ifdef __GLIBC__
7029 #   ifdef __GLIBC_MINOR__
7030 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
7031 #           include <gnu/libc-version.h>
7032             printf("%s\n",  gnu_get_libc_version());
7033 #       else
7034             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7035 #       endif
7036 #   else
7037         printf("%d\n",  __GLIBC__);
7038 #   endif
7039     return 0;
7040 #else
7041     return 1;
7042 #endif
7043 }
7044 EOCP
7045 set try
7046 if eval $compile_ok && $run ./try > glibc.ver; then
7047         val="$define"
7048         gnulibc_version=`$cat glibc.ver`
7049         echo "You are using the GNU C Library version $gnulibc_version"
7050 else
7051         val="$undef"
7052         gnulibc_version=''
7053         echo "You are not using the GNU C Library"
7054 fi
7055 $rm -f try try.* glibc.ver
7056 set d_gnulibc
7057 eval $setvar
7058
7059 : see if nm is to be used to determine whether a symbol is defined or not
7060 case "$usenm" in
7061 '')
7062         dflt=''
7063         case "$d_gnulibc" in
7064         "$define")
7065                 echo " "
7066                 echo "nm probably won't work on the GNU C Library." >&4
7067                 dflt=n
7068                 ;;
7069         esac
7070         case "$dflt" in
7071         '') 
7072                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7073                         echo " "
7074                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7075                         echo "'nm' won't be sufficient on this sytem." >&4
7076                         dflt=n
7077                 fi
7078                 ;;
7079         esac
7080         case "$dflt" in
7081         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7082                 if $test $dflt -gt 20; then
7083                         dflt=y
7084                 else
7085                         dflt=n
7086                 fi
7087                 ;;
7088         esac
7089         ;;
7090 *)
7091         case "$usenm" in
7092         true|$define) dflt=y;;
7093         *) dflt=n;;
7094         esac
7095         ;;
7096 esac
7097 $cat <<EOM
7098
7099 I can use $nm to extract the symbols from your C libraries. This
7100 is a time consuming task which may generate huge output on the disk (up
7101 to 3 megabytes) but that should make the symbols extraction faster. The
7102 alternative is to skip the 'nm' extraction part and to compile a small
7103 test program instead to determine whether each symbol is present. If
7104 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7105 this may be the best solution.
7106
7107 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7108
7109 EOM
7110 rp="Shall I use $nm to extract C symbols from the libraries?"
7111 . ./myread
7112 case "$ans" in
7113 [Nn]*) usenm=false;;
7114 *) usenm=true;;
7115 esac
7116
7117 runnm=$usenm
7118 case "$reuseval" in
7119 true) runnm=false;;
7120 esac
7121
7122 : nm options which may be necessary
7123 case "$nm_opt" in
7124 '') if $test -f /mach_boot; then
7125                 nm_opt=''       # Mach
7126         elif $test -d /usr/ccs/lib; then
7127                 nm_opt='-p'     # Solaris (and SunOS?)
7128         elif $test -f /dgux; then
7129                 nm_opt='-p'     # DG-UX
7130         elif $test -f /lib64/rld; then
7131                 nm_opt='-p'     # 64-bit Irix
7132         else
7133                 nm_opt=''
7134         fi;;
7135 esac
7136
7137 : nm options which may be necessary for shared libraries but illegal
7138 : for archive libraries.  Thank you, Linux.
7139 case "$nm_so_opt" in
7140 '')     case "$myuname" in
7141         *linux*|gnu*)
7142                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7143                         nm_so_opt='--dynamic'
7144                 fi
7145                 ;;
7146         esac
7147         ;;
7148 esac
7149
7150 case "$runnm" in
7151 true)
7152 : get list of predefined functions in a handy place
7153 echo " "
7154 case "$libc" in
7155 '') libc=unknown
7156         case "$libs" in
7157         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7158         esac
7159         ;;
7160 esac
7161 case "$libs" in
7162 '') ;;
7163 *)  for thislib in $libs; do
7164         case "$thislib" in
7165         -lc|-lc_s)
7166                 : Handle C library specially below.
7167                 ;;
7168         -l*)
7169                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7170                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7171                         :
7172                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7173                         :
7174                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7175                         :
7176                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7177                         :
7178                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7179                         :
7180                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7181                         :
7182                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7183                         :
7184                 else
7185                         try=''
7186                 fi
7187                 libnames="$libnames $try"
7188                 ;;
7189         *) libnames="$libnames $thislib" ;;
7190         esac
7191         done
7192         ;;
7193 esac
7194 xxx=normal
7195 case "$libc" in
7196 unknown)
7197         set /lib/libc.$so
7198         for xxx in $libpth; do
7199                 $test -r $1 || set $xxx/libc.$so
7200                 : The messy sed command sorts on library version numbers.
7201                 $test -r $1 || \
7202                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7203                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7204                                 h
7205                                 s/[0-9][0-9]*/0000&/g
7206                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7207                                 G
7208                                 s/\n/ /' | \
7209                          $sort | $sed -e 's/^.* //'`
7210                 eval set \$$#
7211         done
7212         $test -r $1 || set /usr/ccs/lib/libc.$so
7213         $test -r $1 || set /lib/libsys_s$_a
7214         ;;
7215 *)
7216         set blurfl
7217         ;;
7218 esac
7219 if $test -r "$1"; then
7220         echo "Your (shared) C library seems to be in $1."
7221         libc="$1"
7222 elif $test -r /lib/libc && $test -r /lib/clib; then
7223         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7224         xxx=apollo
7225         libc='/lib/clib /lib/libc'
7226         if $test -r /lib/syslib; then
7227                 echo "(Your math library is in /lib/syslib.)"
7228                 libc="$libc /lib/syslib"
7229         fi
7230 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7231         echo "Your C library seems to be in $libc, as you said before."
7232 elif $test -r $incpath/usr/lib/libc$_a; then
7233         libc=$incpath/usr/lib/libc$_a;
7234         echo "Your C library seems to be in $libc.  That's fine."
7235 elif $test -r /lib/libc$_a; then
7236         libc=/lib/libc$_a;
7237         echo "Your C library seems to be in $libc.  You're normal."
7238 else
7239         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7240                 :
7241         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7242                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7243         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7244                 :
7245         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7246                 :
7247         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7248                 :
7249         else
7250                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7251         fi
7252         if $test -r "$tans"; then
7253                 echo "Your C library seems to be in $tans, of all places."
7254                 libc=$tans
7255         else
7256                 libc='blurfl'
7257         fi
7258 fi
7259 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7260         dflt="$libc"
7261         cat <<EOM
7262
7263 If the guess above is wrong (which it might be if you're using a strange
7264 compiler, or your machine supports multiple models), you can override it here.
7265
7266 EOM
7267 else
7268         dflt=''
7269         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7270         cat >&4 <<EOM
7271 I can't seem to find your C library.  I've looked in the following places:
7272
7273 EOM
7274         $sed 's/^/      /' libpath
7275         cat <<EOM
7276
7277 None of these seems to contain your C library. I need to get its name...
7278
7279 EOM
7280 fi
7281 fn=f
7282 rp='Where is your C library?'
7283 . ./getfile
7284 libc="$ans"
7285
7286 echo " "
7287 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7288 set X `cat libnames`
7289 shift
7290 xxx=files
7291 case $# in 1) xxx=file; esac
7292 echo "Extracting names from the following $xxx for later perusal:" >&4
7293 echo " "
7294 $sed 's/^/      /' libnames >&4
7295 echo " "
7296 $echo $n "This may take a while...$c" >&4
7297
7298 for file in $*; do
7299         case $file in
7300         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7301         *) $nm $nm_opt $file 2>/dev/null;;
7302         esac
7303 done >libc.tmp
7304
7305 $echo $n ".$c"
7306 $grep fprintf libc.tmp > libc.ptf
7307 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7308 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7309 xxx='[ADTSIW]'
7310 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7311         eval $xscan;\
7312         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7313                 eval $xrun
7314 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7315         eval $xscan;\
7316         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7317                 eval $xrun
7318 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7319         eval $xscan;\
7320         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7321                 eval $xrun
7322 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7323         eval $xscan;\
7324         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7325                 eval $xrun
7326 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7327         eval $xscan;\
7328         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7329                 eval $xrun
7330 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7331         eval $xscan;\
7332         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7333                 eval $xrun
7334 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7335                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7336         eval $xscan;\
7337         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7338                 eval $xrun
7339 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7340         eval $xscan;\
7341         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7342                 eval $xrun
7343 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7344         eval $xscan;\
7345         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7346                 eval $xrun
7347 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7348         eval $xscan;\
7349         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7350                 eval $xrun
7351 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7352         eval $xscan;\
7353         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7354                 eval $xrun
7355 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7356         eval $xscan;\
7357         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7358                 eval $xrun
7359 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7360         eval $xscan;\
7361         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7362                 eval $xrun
7363 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7364         eval $xscan;\
7365         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7366                 eval $xrun
7367 else
7368         $nm -p $* 2>/dev/null >libc.tmp
7369         $grep fprintf libc.tmp > libc.ptf
7370         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7371                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7372         then
7373                 nm_opt='-p'
7374                 eval $xrun
7375         else
7376                 echo " "
7377                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7378                 com=''
7379                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7380                         for thisname in $libnames $libc; do
7381                                 $ar t $thisname >>libc.tmp
7382                         done
7383                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7384                         echo "Ok." >&4
7385                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7386                         # Repeat libc to extract forwarders to DLL entries too
7387                         for thisname in $libnames $libc; do
7388                                 $ar tv $thisname >>libc.tmp
7389                                 # Revision 50 of EMX has bug in $ar.
7390                                 # it will not extract forwarders to DLL entries
7391                                 # Use emximp which will extract exactly them.
7392                                 emximp -o tmp.imp $thisname \
7393                                     2>/dev/null && \
7394                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7395                                     < tmp.imp >>libc.tmp
7396                                 $rm tmp.imp
7397                         done
7398                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7399                         echo "Ok." >&4
7400                 else
7401                         echo "$ar didn't seem to work right." >&4
7402                         echo "Maybe this is a Cray...trying bld instead..." >&4
7403                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7404                         then
7405                                 for thisname in $libnames; do
7406                                         bld t $libnames | \
7407                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7408                                         $ar t $thisname >>libc.tmp
7409                                 done
7410                                 echo "Ok." >&4
7411                         else
7412                                 echo "That didn't work either.  Giving up." >&4
7413                                 exit 1
7414                         fi
7415                 fi
7416         fi
7417 fi
7418 nm_extract="$com"
7419 case "$PASE" in
7420 define)
7421     echo " "
7422     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7423     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7424     ;;
7425 *)  if $test -f /lib/syscalls.exp; then
7426         echo " "
7427         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7428         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7429     fi
7430     ;;
7431 esac
7432 ;;
7433 esac
7434 $rm -f libnames libpath
7435
7436 : see if dld is available
7437 set dld.h i_dld
7438 eval $inhdr
7439
7440 : is a C symbol defined?
7441 csym='tlook=$1;
7442 case "$3" in
7443 -v) tf=libc.tmp; tdc="";;
7444 -a) tf=libc.tmp; tdc="[]";;
7445 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7446 esac;
7447 tx=yes;
7448 case "$reuseval-$4" in
7449 true-) ;;
7450 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7451 esac;
7452 case "$tx" in
7453 yes)
7454         tval=false;
7455         if $test "$runnm" = true; then
7456                 if $contains $tlook $tf >/dev/null 2>&1; then
7457                         tval=true;
7458                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7459                         echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7460                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7461                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7462                         $rm -f try$_exe try.c core core.* try.core;
7463                 fi;
7464         else
7465                 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7466                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7467                 $rm -f try$_exe try.c;
7468         fi;
7469         ;;
7470 *)
7471         case "$tval" in
7472         $define) tval=true;;
7473         *) tval=false;;
7474         esac;
7475         ;;
7476 esac;
7477 eval "$2=$tval"'
7478
7479 : define an is-in-libc? function
7480 inlibc='echo " "; td=$define; tu=$undef;
7481 sym=$1; var=$2; eval "was=\$$2";
7482 tx=yes;
7483 case "$reuseval$was" in
7484 true) ;;
7485 true*) tx=no;;
7486 esac;
7487 case "$tx" in
7488 yes)
7489         set $sym tres -f;
7490         eval $csym;
7491         case "$tres" in
7492         true)
7493                 echo "$sym() found." >&4;
7494                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7495         *)
7496                 echo "$sym() NOT found." >&4;
7497                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7498         esac;;
7499 *)
7500         case "$was" in
7501         $define) echo "$sym() found." >&4;;
7502         *) echo "$sym() NOT found." >&4;;
7503         esac;;
7504 esac'
7505
7506 : see if dlopen exists
7507 xxx_runnm="$runnm"
7508 runnm=false
7509 set dlopen d_dlopen
7510 eval $inlibc
7511 runnm="$xxx_runnm"
7512
7513 : determine which dynamic loading, if any, to compile in
7514 echo " "
7515 dldir="ext/DynaLoader"
7516 case "$usedl" in
7517 $define|y|true)
7518         dflt='y'
7519         usedl="$define"
7520         ;;
7521 $undef|n|false)
7522         dflt='n'
7523         usedl="$undef"
7524         ;;
7525 *) 
7526         dflt='n'
7527         case "$d_dlopen" in
7528             $define) dflt='y' ;;
7529         esac
7530         case "$i_dld" in
7531             $define) dflt='y' ;;
7532         esac
7533         : Does a dl_xxx.xs file exist for this operating system
7534         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7535         ;;
7536 esac
7537 rp="Do you wish to use dynamic loading?"
7538 . ./myread
7539 usedl="$ans"
7540 case "$ans" in
7541 y*) usedl="$define"
7542         case "$dlsrc" in
7543         '')
7544                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7545                         dflt="$dldir/dl_${osname}.xs"
7546                 elif $test "$d_dlopen" = "$define" ; then
7547                         dflt="$dldir/dl_dlopen.xs"
7548                 elif $test "$i_dld" = "$define" ; then
7549                         dflt="$dldir/dl_dld.xs"
7550                 else
7551                         dflt=''
7552                 fi
7553                 ;;
7554         *)      dflt="$dldir/$dlsrc"
7555                 ;;
7556         esac
7557     echo "The following dynamic loading files are available:"
7558         : Can not go over to $dldir because getfile has path hard-coded in.
7559         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7560         rp="Source file to use for dynamic loading"
7561         fn="fne"
7562         gfpth="$src"
7563         . ./getfile
7564         usedl="$define"
7565         : emulate basename
7566         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7567
7568         $cat << EOM
7569
7570 Some systems may require passing special flags to $cc -c to
7571 compile modules that will be used to create a shared library.
7572 To use no flags, say "none".
7573
7574 EOM
7575     case "$cccdlflags" in
7576     '') case "$gccversion" in
7577                 '') case "$osname" in
7578                         hpux)   dflt='+z' ;;
7579                         next)   dflt='none' ;;
7580                         irix*)  dflt='-KPIC' ;;
7581                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7582                         sunos)  dflt='-pic' ;;
7583                         *)      dflt='none' ;;
7584                     esac
7585                         ;;
7586                 *)  case "$osname" in
7587                         darwin) dflt='none' ;;
7588                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7589                         *)      dflt='-fpic' ;;
7590                     esac ;;
7591             esac ;;
7592         ' ') dflt='none' ;;
7593     *)  dflt="$cccdlflags" ;;
7594     esac
7595     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7596     . ./myread
7597     case "$ans" in
7598     none) cccdlflags=' ' ;;
7599     *) cccdlflags="$ans" ;;
7600     esac
7601
7602     cat << EOM
7603
7604 Some systems use ld to create libraries that can be dynamically loaded,
7605 while other systems (such as those using ELF) use $cc.
7606
7607 EOM
7608         case "$ld" in
7609         '')     $cat >try.c <<EOM
7610 /* Test for whether ELF binaries are produced */
7611 #include <fcntl.h>
7612 #$i_stdlib I_STDLIB
7613 #ifdef I_STDLIB
7614 #include <stdlib.h>
7615 #endif
7616 int main() {
7617         char b[4];
7618         int i = open("a.out",O_RDONLY);
7619         if(i == -1) 
7620                 exit(1); /* fail */
7621         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7622                 exit(0); /* succeed (yes, it's ELF) */
7623         else
7624                 exit(1); /* fail */
7625 }
7626 EOM
7627                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7628                         cat <<EOM
7629 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7630 EOM
7631                         dflt="$cc"
7632                 else
7633                         echo "I'll use ld to build dynamic libraries."
7634                         dflt='ld'
7635                 fi
7636                 rm -f try.c a.out
7637                 ;;
7638         *)      dflt="$ld"
7639                 ;;
7640         esac
7641
7642     rp="What command should be used to create dynamic libraries?"
7643     . ./myread
7644         ld="$ans"
7645
7646     cat << EOM
7647
7648 Some systems may require passing special flags to $ld to create a
7649 library that can be dynamically loaded.  If your ld flags include
7650 -L/other/path options to locate libraries outside your loader's normal
7651 search path, you may need to specify those -L options here as well.  To
7652 use no flags, say "none".
7653
7654 EOM
7655     case "$lddlflags" in
7656     '') case "$osname" in
7657                         beos) dflt='-nostart' ;;
7658                         hpux) dflt='-b';
7659                               case "$gccversion" in
7660                               '') dflt="$dflt +vnocompatwarnings" ;;
7661                               esac
7662                               ;;        
7663                         linux|irix*|gnu*)       dflt='-shared' ;;
7664                         next)  dflt='none' ;;
7665                         solaris) dflt='-G' ;;
7666                         sunos) dflt='-assert nodefinitions' ;;
7667                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7668                 *)     dflt='none' ;;
7669                         esac
7670                         ;;
7671     *) dflt="$lddlflags" ;;
7672     esac
7673
7674         : Try to guess additional flags to pick up local libraries.
7675         : Be careful not to append to a plain 'none'
7676         case "$dflt" in
7677         none) dflt='' ;;
7678         esac
7679         for thisflag in $ldflags; do
7680                 case "$thisflag" in
7681                 -L*|-R*|-Wl,-R*)
7682                         case " $dflt " in
7683                         *" $thisflag "*) ;;
7684                         *) dflt="$dflt $thisflag" ;;
7685                         esac
7686                         ;;
7687                 esac
7688         done
7689
7690         case "$dflt" in
7691         ''|' ') dflt='none' ;;
7692         esac
7693
7694     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7695     . ./myread
7696     case "$ans" in
7697     none) lddlflags=' ' ;;
7698     *) lddlflags="$ans" ;;
7699     esac
7700
7701         cat <<EOM
7702
7703 Some systems may require passing special flags to $cc to indicate that
7704 the resulting executable will use dynamic linking.  To use no flags,
7705 say "none".
7706
7707 EOM
7708     case "$ccdlflags" in
7709     '') case "$osname" in
7710             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
7711             next|sunos) dflt='none' ;;
7712             *)          dflt='none' ;;
7713             esac ;;
7714     ' ')  dflt='none' ;;
7715     *)  dflt="$ccdlflags" ;;
7716     esac
7717     rp="Any special flags to pass to $cc to use dynamic linking?"
7718     . ./myread
7719     case "$ans" in
7720     none) ccdlflags=' ' ;;
7721     *) ccdlflags="$ans" ;;
7722     esac
7723     ;;
7724 *)  usedl="$undef"
7725         ld='ld'
7726     dlsrc='dl_none.xs'
7727     lddlflags=''
7728     ccdlflags=''
7729     ;;
7730 esac
7731
7732 also=''
7733 case "$usedl" in
7734 $undef)
7735         # No dynamic loading being used, so don't bother even to prompt.
7736         useshrplib='false'
7737         ;;
7738 *)      case "$useshrplib" in
7739         '')     case "$osname" in
7740                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7741                         dflt=y
7742                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7743                         ;;
7744                 next*)
7745                         case "$osvers" in
7746                         4*)     dflt=y
7747                                 also='Building a shared libperl is needed for MAB support.'
7748                                 ;;
7749                         *)      dflt=n
7750                                 ;;
7751                         esac
7752                         ;;
7753                 *)      dflt=n
7754                         ;;
7755                 esac
7756                 ;;
7757         $define|true|[Yy]*)
7758                 dflt=y
7759                 ;;
7760         *)      dflt=n
7761                 ;;
7762         esac
7763         $cat << EOM
7764
7765 The perl executable is normally obtained by linking perlmain.c with
7766 libperl${_a}, any static extensions (usually just DynaLoader), and
7767 any other libraries needed on this system (such as -lm, etc.).  Since
7768 your system supports dynamic loading, it is probably possible to build
7769 a shared libperl.$so.  If you will have more than one executable linked
7770 to libperl.$so, this will significantly reduce the size of each
7771 executable, but it may have a noticeable effect on performance.  The
7772 default is probably sensible for your system.
7773 $also
7774
7775 EOM
7776         rp="Build a shared libperl.$so (y/n)"
7777         . ./myread
7778         case "$ans" in
7779         true|$define|[Yy]*)
7780                 useshrplib='true'  ;;
7781         *)      useshrplib='false' ;;
7782         esac
7783         ;;
7784 esac
7785
7786 case "$useshrplib" in
7787 true)
7788         case "$libperl" in
7789         '')
7790                 # Figure out a good name for libperl.so.  Since it gets stored in
7791                 # a version-specific architecture-dependent library, the version
7792                 # number isn't really that important, except for making cc/ld happy.
7793                 #
7794                 # A name such as libperl.so.3.1
7795                 majmin="libperl.$so.$patchlevel.$subversion"
7796                 # A name such as libperl.so.301
7797                 majonly=`echo $patchlevel $subversion |
7798                         $awk '{printf "%d%02d", $1, $2}'`
7799                 majonly=libperl.$so.$majonly
7800                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7801                 # rely on figuring it out from the naming of libc.
7802                 case "${osname}${osvers}" in
7803                 next4*)
7804                         dflt=libperl.5.$so
7805                         # XXX How handle the --version stuff for MAB?
7806                         ;;
7807                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
7808                         dflt=libperl.$so
7809                         ;;
7810                 cygwin*) # ld links against an importlib
7811                         dflt=libperl$lib_ext
7812                         ;;
7813                 *)      # Try to guess based on whether libc has major.minor.
7814                         case "$libc" in
7815                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7816                         *libc.$so.[0-9]*) dflt=$majonly ;;
7817                         *)      dflt=libperl.$so ;;
7818                         esac
7819                         ;;
7820                 esac
7821                 ;;
7822         *)      dflt=$libperl
7823                 ;;
7824         esac
7825         cat << EOM
7826
7827 I need to select a good name for the shared libperl.  If your system uses
7828 library names with major and minor numbers, then you might want something
7829 like $majmin.  Alternatively, if your system uses a single version
7830 number for shared libraries, then you might want to use $majonly.
7831 Or, your system might be quite happy with a simple libperl.$so.
7832
7833 Since the shared libperl will get installed into a version-specific
7834 architecture-dependent directory, the version number of the shared perl
7835 library probably isn't important, so the default should be o.k.
7836
7837 EOM
7838         rp='What name do you want to give to the shared libperl?'
7839         . ./myread
7840         libperl=$ans
7841         echo "Ok, I'll use $libperl"
7842         ;;
7843 *)
7844         libperl="libperl${_a}"
7845         ;;
7846 esac
7847
7848 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7849 case "$shrpdir" in
7850 '') ;;
7851 *)      $cat >&4 <<EOM
7852 WARNING:  Use of the shrpdir variable for the installation location of
7853 the shared $libperl is not supported.  It was never documented and
7854 will not work in this version.  Let me (perlbug@perl.org)
7855 know of any problems this may cause.
7856
7857 EOM
7858         case "$shrpdir" in
7859         "$archlibexp/CORE")
7860                 $cat >&4 <<EOM
7861 But your current setting of $shrpdir is
7862 the default anyway, so it's harmless.
7863 EOM
7864                 ;;
7865         *)
7866                 $cat >&4 <<EOM
7867 Further, your current attempted setting of $shrpdir
7868 conflicts with the value of $archlibexp/CORE
7869 that installperl will use.
7870 EOM
7871                 ;;
7872         esac
7873         ;;
7874 esac
7875
7876 # How will the perl executable find the installed shared $libperl?
7877 # Add $xxx to ccdlflags.
7878 # If we can't figure out a command-line option, use $shrpenv to
7879 # set env LD_RUN_PATH.  The main perl makefile uses this.
7880 shrpdir=$archlibexp/CORE
7881 xxx=''
7882 tmp_shrpenv=''
7883 if "$useshrplib"; then
7884     case "$osname" in 
7885         aix)
7886                 # We'll set it in Makefile.SH...
7887                 ;;
7888         solaris)
7889                 xxx="-R $shrpdir"
7890                 ;;
7891         freebsd|netbsd|openbsd|interix)
7892                 xxx="-Wl,-R$shrpdir"
7893                 ;;
7894         bsdos|linux|irix*|dec_osf|gnu*)
7895                 xxx="-Wl,-rpath,$shrpdir"
7896                 ;;
7897         next)
7898                 # next doesn't like the default...
7899                 ;;
7900         beos)
7901                 # beos doesn't like the default, either.
7902                 ;;
7903         hpux*)
7904                 # hpux doesn't like the default, either.
7905                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7906                 ;;
7907         *)
7908                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7909                 ;;
7910         esac
7911         case "$xxx" in
7912         '') ;;
7913         *)      
7914                 # Only add $xxx if it isn't already in ccdlflags.
7915                 case " $ccdlflags " in
7916                 *" $xxx "*)     ;;
7917                 *)      ccdlflags="$ccdlflags $xxx"
7918                         cat <<EOM >&4
7919
7920 Adding $xxx to the flags
7921 passed to $ld so that the perl executable will find the 
7922 installed shared $libperl.
7923
7924 EOM
7925                         ;;
7926                 esac
7927                 ;;
7928         esac
7929 fi
7930 # Fix ccdlflags in AIX for building external extensions.
7931 # (For building Perl itself bare -bE:perl.exp is needed,
7932 #  Makefile.SH takes care of this.)
7933 case "$osname" in
7934 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7935 esac
7936 # Respect a hint or command-line value.
7937 case "$shrpenv" in
7938 '') shrpenv="$tmp_shrpenv" ;;
7939 esac
7940 case "$ldlibpthname" in
7941 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7942 none)   ldlibpthname='' ;;
7943 esac
7944
7945 : determine where manual pages are on this system
7946 echo " "
7947 case "$sysman" in
7948 '') 
7949         syspath='/usr/share/man/man1 /usr/man/man1'
7950         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7951         syspath="$syspath /usr/man/u_man/man1"
7952         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7953         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7954         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7955         sysman=`./loc . /usr/man/man1 $syspath`
7956         ;;
7957 esac
7958 if $test -d "$sysman"; then
7959         echo "System manual is in $sysman." >&4
7960 else
7961         echo "Could not find manual pages in source form." >&4
7962 fi
7963
7964 : determine where manual pages go
7965 set man1dir man1dir none
7966 eval $prefixit
7967 $cat <<EOM
7968
7969 $spackage has manual pages available in source form.
7970 EOM
7971 case "$nroff" in
7972 nroff)
7973         echo "However, you don't have nroff, so they're probably useless to you."
7974         case "$man1dir" in
7975         '') man1dir="none";;
7976         esac;;
7977 esac
7978 echo "If you don't want the manual sources installed, answer 'none'."
7979 case "$man1dir" in
7980 ' ') dflt=none
7981         ;;
7982 '')
7983         lookpath="$prefixexp/share/man/man1"
7984         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
7985         lookpath="$lookpath $prefixexp/man/p_man/man1"
7986         lookpath="$lookpath $prefixexp/man/u_man/man1"
7987         lookpath="$lookpath $prefixexp/man/man.1"
7988         case "$sysman" in
7989         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7990         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7991         esac
7992         set dflt
7993         eval $prefixup
7994         ;;
7995 *)  dflt="$man1dir"
7996         ;;
7997 esac
7998 echo " "
7999 fn=dn+~
8000 rp="Where do the main $spackage manual pages (source) go?"
8001 . ./getfile
8002 if $test "X$man1direxp" != "X$ansexp"; then
8003         installman1dir=''
8004 fi
8005 man1dir="$ans"
8006 man1direxp="$ansexp"
8007 case "$man1dir" in
8008 '')     man1dir=' '
8009         installman1dir='';;
8010 esac
8011
8012 : Change installation prefix, if necessary.
8013 if $test X"$prefix" != X"$installprefix"; then
8014         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
8015 else
8016         installman1dir="$man1direxp"
8017 fi
8018
8019 : What suffix to use on installed man pages
8020
8021 case "$man1dir" in
8022 ' ')
8023         man1ext='0'
8024         ;;
8025 *)
8026         rp="What suffix should be used for the main $spackage man pages?"
8027         case "$man1ext" in
8028         '')     case "$man1dir" in
8029                 *1)  dflt=1 ;;
8030                 *1p) dflt=1p ;;
8031                 *1pm) dflt=1pm ;;
8032                 *l) dflt=l;;
8033                 *n) dflt=n;;
8034                 *o) dflt=o;;
8035                 *p) dflt=p;;
8036                 *C) dflt=C;;
8037                 *L) dflt=L;;
8038                 *L1) dflt=L1;;
8039                 *) dflt=1;;
8040                 esac
8041                 ;;
8042         *)      dflt="$man1ext";;
8043         esac
8044         . ./myread
8045         man1ext="$ans"
8046         ;;
8047 esac
8048
8049 : see if we can have long filenames
8050 echo " "
8051 first=123456789abcdef
8052 $rm -f $first
8053 if (echo hi >$first) 2>/dev/null; then
8054         if $test -f 123456789abcde; then
8055                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8056                 val="$undef"
8057         else
8058                 echo 'You can have filenames longer than 14 characters.'>&4
8059                 val="$define"
8060         fi
8061 else
8062         $cat <<'EOM'
8063 You can't have filenames longer than 14 chars.
8064 You can't even think about them!
8065 EOM
8066         val="$undef"
8067 fi 
8068 set d_flexfnam
8069 eval $setvar
8070 $rm -rf 123456789abcde*
8071
8072 : determine where library module manual pages go
8073 set man3dir man3dir none
8074 eval $prefixit
8075 $cat <<EOM
8076
8077 $spackage has manual pages for many of the library modules.
8078 EOM
8079
8080 case "$nroff" in
8081 nroff)
8082         $cat <<'EOM'
8083 However, you don't have nroff, so they're probably useless to you.
8084 EOM
8085         case "$man3dir" in
8086         '') man3dir="none";;
8087         esac;;
8088 esac
8089
8090 case "$d_flexfnam" in
8091 undef)
8092         $cat <<'EOM'
8093 However, your system can't handle the long file names like File::Basename.3. 
8094 EOM
8095         case "$man3dir" in
8096         '') man3dir="none";;
8097         esac;;
8098 esac
8099
8100 echo "If you don't want the manual sources installed, answer 'none'."
8101 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8102 case "$man3dir" in
8103 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8104         if $test -d "$privlib/man/man3"; then
8105                 cat <<EOM >&4
8106
8107 WARNING:  Previous versions of perl installed man3 pages into
8108 $privlib/man/man3.  This version will suggest a 
8109 new default of $dflt.  
8110 EOM
8111                 tdflt=$dflt
8112                 dflt='n'
8113                 rp='Do you wish to preserve the old behavior?(y/n)'
8114                 . ./myread
8115                 case "$ans" in
8116                 y*) dflt="$privlib/man/man3" ;;
8117                 *)  dflt=$tdflt ;;
8118                 esac
8119     fi
8120         ;;
8121 *)      dflt="$man3dir" ;;
8122 esac
8123 case "$dflt" in
8124 ' ') dflt=none ;;
8125 esac
8126 echo " "
8127 fn=dn+~
8128 rp="Where do the $package library man pages (source) go?"
8129 . ./getfile
8130 man3dir="$ans"
8131 man3direxp="$ansexp"
8132 case "$man3dir" in
8133 '')     man3dir=' '
8134         installman3dir='';;
8135 esac
8136
8137 : Change installation prefix, if necessary.
8138 if $test X"$prefix" != X"$installprefix"; then
8139         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8140 else
8141         installman3dir="$man3direxp"
8142 fi
8143
8144 : What suffix to use on installed man pages
8145 case "$man3dir" in
8146 ' ')
8147         man3ext='0'
8148         ;;
8149 *)
8150         rp="What suffix should be used for the $package library man pages?"
8151         case "$man3ext" in
8152         '')     case "$man3dir" in
8153                 *3)  dflt=3 ;;
8154                 *3p) dflt=3p ;;
8155                 *3pm) dflt=3pm ;;
8156                 *l) dflt=l;;
8157                 *n) dflt=n;;
8158                 *o) dflt=o;;
8159                 *p) dflt=p;;
8160                 *C) dflt=C;;
8161                 *L) dflt=L;;
8162                 *L3) dflt=L3;;
8163                 *) dflt=3;;
8164                 esac
8165                 ;;
8166         *)      dflt="$man3ext";;
8167         esac
8168         . ./myread
8169         man3ext="$ans"
8170         ;;
8171 esac
8172
8173 : see if we have to deal with yellow pages, now NIS.
8174 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8175         if $test -f /usr/etc/nibindd; then
8176                 echo " "
8177                 echo "I'm fairly confident you're on a NeXT."
8178                 echo " "
8179                 rp='Do you get the hosts file via NetInfo?'
8180                 dflt=y
8181                 case "$hostcat" in
8182                 nidump*) ;;
8183                 '') ;;
8184                 *) dflt=n;;
8185                 esac
8186                 . ./myread
8187                 case "$ans" in
8188                 y*) hostcat='nidump hosts .';;
8189                 *)      case "$hostcat" in
8190                         nidump*) hostcat='';;
8191                         esac
8192                         ;;
8193                 esac
8194         fi
8195         case "$hostcat" in
8196         nidump*) ;;
8197         *)
8198                 case "$hostcat" in
8199                 *ypcat*) dflt=y;;
8200                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8201                                 dflt=y
8202                         else
8203                                 dflt=n
8204                         fi;;
8205                 *) dflt=n;;
8206                 esac
8207                 echo " "
8208                 rp='Are you getting the hosts file via yellow pages?'
8209                 . ./myread
8210                 case "$ans" in
8211                 y*) hostcat='ypcat hosts';;
8212                 *) hostcat='cat /etc/hosts';;
8213                 esac
8214                 ;;
8215         esac
8216 fi
8217 case "$hostcat" in
8218 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8219 esac
8220 case "$groupcat" in
8221 '') test -f /etc/group && groupcat='cat /etc/group';;
8222 esac
8223 case "$passcat" in
8224 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8225 esac
8226
8227 : now get the host name
8228 echo " "
8229 echo "Figuring out host name..." >&4
8230 case "$myhostname" in
8231 '') cont=true
8232         echo 'Maybe "hostname" will work...'
8233         if tans=`sh -c hostname 2>&1` ; then
8234                 myhostname=$tans
8235                 phostname=hostname
8236                 cont=''
8237         fi
8238         ;;
8239 *) cont='';;
8240 esac
8241 if $test "$cont"; then
8242         if ./xenix; then
8243                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8244                 if tans=`cat /etc/systemid 2>&1` ; then
8245                         myhostname=$tans
8246                         phostname='cat /etc/systemid'
8247                         echo "Whadyaknow.  Xenix always was a bit strange..."
8248                         cont=''
8249                 fi
8250         elif $test -r /etc/systemid; then
8251                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8252         fi
8253 fi
8254 if $test "$cont"; then
8255         echo 'No, maybe "uuname -l" will work...'
8256         if tans=`sh -c 'uuname -l' 2>&1` ; then
8257                 myhostname=$tans
8258                 phostname='uuname -l'
8259         else
8260                 echo 'Strange.  Maybe "uname -n" will work...'
8261                 if tans=`sh -c 'uname -n' 2>&1` ; then
8262                         myhostname=$tans
8263                         phostname='uname -n'
8264                 else
8265                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8266                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8267                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8268                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8269                         else
8270                                 case "$myhostname" in
8271                                 '') echo "Does this machine have an identity crisis or something?"
8272                                         phostname='';;
8273                                 *)
8274                                         echo "Well, you said $myhostname before..."
8275                                         phostname='echo $myhostname';;
8276                                 esac
8277                         fi
8278                 fi
8279         fi
8280 fi
8281 case "$myhostname" in
8282 '') myhostname=noname ;;
8283 esac
8284 : you do not want to know about this
8285 set $myhostname
8286 myhostname=$1
8287
8288 : verify guess
8289 if $test "$myhostname" ; then
8290         dflt=y
8291         rp='Your host name appears to be "'$myhostname'".'" Right?"
8292         . ./myread
8293         case "$ans" in
8294         y*) ;;
8295         *) myhostname='';;
8296         esac
8297 fi
8298
8299 : bad guess or no guess
8300 while $test "X$myhostname" = X ; do
8301         dflt=''
8302         rp="Please type the (one word) name of your host:"
8303         . ./myread
8304         myhostname="$ans"
8305 done
8306
8307 : translate upper to lower if necessary
8308 case "$myhostname" in
8309 *[A-Z]*)
8310         echo "(Normalizing case in your host name)"
8311         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8312         ;;
8313 esac
8314
8315 case "$myhostname" in
8316 *.*)
8317         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8318         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8319         echo "(Trimming domain name from host name--host name is now $myhostname)"
8320         ;;
8321 *) case "$mydomain" in
8322         '')
8323                 {
8324                         test "X$hostcat" = "Xypcat hosts" &&
8325                         ypmatch "$myhostname" hosts 2>/dev/null |\
8326                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8327                         $test -s hosts
8328                 } || {
8329                         test "X$hostcat" != "X" &&
8330                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8331                                         /[       ]$myhostname[  . ]/p" > hosts
8332                 }
8333                 tmp_re="[       . ]"
8334                 if $test -f hosts; then
8335                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8336                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8337                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8338                                 hosts | $sort | $uniq | \
8339                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8340                         case `$echo X$dflt` in
8341                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8342                                 dflt=.
8343                                 ;;
8344                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8345                                 ;;
8346                         esac
8347                 else
8348                         echo "(I cannot locate a hosts database anywhere)"
8349                         dflt=.
8350                 fi
8351                 case "$dflt" in
8352                 .)
8353                         tans=`./loc resolv.conf X /etc /usr/etc`
8354                         if $test -f "$tans"; then
8355                                 echo "(Attempting domain name extraction from $tans)"
8356                                 dflt=.`$sed -n -e 's/   / /g' \
8357                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8358                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8359                                 case "$dflt" in
8360                                 .) dflt=.`$sed -n -e 's/        / /g' \
8361                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8362                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8363                                         ;;
8364                                 esac
8365                         fi
8366                         ;;
8367                 esac
8368                 case "$dflt" in
8369                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8370                         dflt=.`sh -c domainname 2>/dev/null`
8371                         case "$dflt" in
8372                         '') dflt='.';;
8373                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8374                         esac
8375                         ;;
8376                 esac
8377                 case "$dflt$osname" in
8378                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8379                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8380                         ;;
8381                 esac
8382                 case "$dflt" in
8383                 .) echo "(Lost all hope -- silly guess then)"
8384                         dflt='.nonet'
8385                         ;;
8386                 esac
8387                 $rm -f hosts
8388                 ;;
8389         *) dflt="$mydomain";;
8390         esac;;
8391 esac
8392 echo " "
8393 rp="What is your domain name?"
8394 . ./myread
8395 tans="$ans"
8396 case "$ans" in
8397 '') ;;
8398 .*) ;;
8399 *) tans=".$tans";;
8400 esac
8401 mydomain="$tans"
8402
8403 : translate upper to lower if necessary
8404 case "$mydomain" in
8405 *[A-Z]*)
8406         echo "(Normalizing case in your domain name)"
8407         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8408         ;;
8409 esac
8410
8411 : a little sanity check here
8412 case "$phostname" in
8413 '') ;;
8414 *)
8415         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8416         $myhostname$mydomain|$myhostname) ;;
8417         *)
8418                 case "$phostname" in
8419                 sed*)
8420                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8421                         ;;
8422                 *)
8423                         echo "(That doesn't agree with your $phostname command, by the way.)"
8424                         ;;
8425                 esac
8426         ;;
8427         esac
8428         ;;
8429 esac
8430
8431 $cat <<EOM
8432
8433 I need to get your e-mail address in Internet format if possible, i.e.
8434 something like user@host.domain. Please answer accurately since I have
8435 no easy means to double check it. The default value provided below
8436 is most probably close to reality but may not be valid from outside
8437 your organization...
8438
8439 EOM
8440 cont=x
8441 while test "$cont"; do
8442         case "$cf_email" in
8443         '') dflt="$cf_by@$myhostname$mydomain";;
8444         *) dflt="$cf_email";;
8445         esac
8446         rp='What is your e-mail address?'
8447         . ./myread
8448         cf_email="$ans"
8449         case "$cf_email" in
8450         *@*.*) cont='' ;;
8451         *)
8452                 rp='Address does not look like an Internet one.  Use it anyway?'
8453                 case "$fastread" in
8454                 yes) dflt=y ;;
8455                 *) dflt=n ;;
8456                 esac
8457                 . ./myread
8458                 case "$ans" in
8459                 y*) cont='' ;;
8460                 *) echo " " ;;
8461                 esac
8462                 ;;
8463         esac
8464 done
8465
8466 $cat <<EOM
8467
8468 If you or somebody else will be maintaining perl at your site, please
8469 fill in the correct e-mail address here so that they may be contacted
8470 if necessary. Currently, the "perlbug" program included with perl
8471 will send mail to this address in addition to perlbug@perl.org. You may
8472 enter "none" for no administrator.
8473
8474 EOM
8475 case "$perladmin" in
8476 '') dflt="$cf_email";;
8477 *) dflt="$perladmin";;
8478 esac
8479 rp='Perl administrator e-mail address'
8480 . ./myread
8481 perladmin="$ans"
8482
8483 : determine whether to only install version-specific parts.
8484 echo " "
8485 $cat <<EOM
8486 Do you want to install only the version-specific parts of the perl
8487 distribution?  Usually you do *not* want to do this.
8488 EOM
8489 case "$versiononly" in
8490 "$define"|[Yy]*|true) dflt='y' ;;
8491 *) dflt='n';
8492 esac
8493 rp="Do you want to install only the version-specific parts of perl?"
8494 . ./myread
8495 case "$ans" in
8496 [yY]*)  val="$define";;
8497 *)      val="$undef" ;;
8498 esac
8499 set versiononly
8500 eval $setvar
8501
8502 case "$versiononly" in
8503 "$define") inc_version_list=''
8504            inc_version_list_init=0
8505            ;;
8506 esac
8507
8508 : figure out how to guarantee perl startup
8509 case "$startperl" in
8510 '')
8511         case "$sharpbang" in
8512         *!)
8513                 $cat <<EOH
8514
8515 I can use the #! construct to start perl on your system. This will
8516 make startup of perl scripts faster, but may cause problems if you
8517 want to share those scripts and perl is not in a standard place
8518 ($binexp/perl) on all your platforms. The alternative is to force
8519 a shell by starting the script with a single ':' character.
8520
8521 EOH
8522                 case "$versiononly" in
8523                 "$define")      dflt="$binexp/perl$version";;  
8524                 *)              dflt="$binexp/perl";;
8525                 esac
8526                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8527                 . ./myread
8528                 case "$ans" in
8529                 none)   startperl=": # use perl";;
8530                 *)      startperl="#!$ans"
8531                         if $test 30 -lt `echo "$ans" | wc -c`; then
8532                                 $cat >&4 <<EOM
8533
8534 WARNING:  Some systems limit the #! command to 32 characters.
8535 If you experience difficulty running Perl scripts with #!, try
8536 installing Perl in a directory with a shorter pathname.
8537
8538 EOM
8539                         fi ;;
8540                 esac
8541                 ;;
8542         *) startperl=": # use perl"
8543                 ;;
8544         esac
8545         ;;
8546 esac
8547 echo "I'll use $startperl to start perl scripts."
8548
8549 : figure best path for perl in scripts
8550 case "$perlpath" in
8551 '')
8552         case "$versiononly" in
8553         "$define")      perlpath="$binexp/perl$version";;
8554         *)              perlpath="$binexp/perl";;
8555         esac
8556         case "$startperl" in
8557         *!*) ;;
8558         *)
8559                 $cat <<EOH
8560
8561 I will use the "eval 'exec'" idiom to start Perl on your system.
8562 I can use the full path of your Perl binary for this purpose, but
8563 doing so may cause problems if you want to share those scripts and
8564 Perl is not always in a standard place ($binexp/perl).
8565
8566 EOH
8567                 dflt="$binexp/perl"
8568                 rp="What path shall I use in \"eval 'exec'\"?"
8569                 . ./myread
8570                 perlpath="$ans"
8571                 ;;
8572         esac
8573         ;;
8574 esac
8575 case "$startperl" in
8576 *!*)    ;;
8577 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8578 esac
8579
8580 : determine where public executable scripts go
8581 set scriptdir scriptdir
8582 eval $prefixit
8583 case "$scriptdir" in
8584 '')
8585         dflt="$bin"
8586         : guess some guesses
8587         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8588         $test -d /usr/share/bin     && dflt=/usr/share/bin
8589         $test -d /usr/local/script  && dflt=/usr/local/script
8590         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8591         $test -d $prefixexp/script  && dflt=$prefixexp/script
8592         set dflt
8593         eval $prefixup
8594         ;;
8595 *)  dflt="$scriptdir"
8596         ;;
8597 esac
8598 $cat <<EOM
8599  
8600 Some installations have a separate directory just for executable scripts so
8601 that they can mount it across multiple architectures but keep the scripts in
8602 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8603 Or you might just lump your scripts in with all your other executables.
8604  
8605 EOM
8606 fn=d~
8607 rp='Where do you keep publicly executable scripts?'
8608 . ./getfile
8609 if $test "X$ansexp" != "X$scriptdirexp"; then
8610         installscript=''
8611 fi
8612 scriptdir="$ans"
8613 scriptdirexp="$ansexp"
8614 : Change installation prefix, if necessary.
8615 if $test X"$prefix" != X"$installprefix"; then
8616         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8617 else
8618         installscript="$scriptdirexp"
8619 fi
8620
8621 : determine where add-on public executables go
8622 case "$sitebin" in
8623 '')     dflt=$siteprefix/bin ;;
8624 *)      dflt=$sitebin ;;
8625 esac
8626 fn=d~
8627 rp='Pathname where the add-on public executables should be installed?'
8628 . ./getfile
8629 sitebin="$ans"
8630 sitebinexp="$ansexp"
8631 : Change installation prefix, if necessary.
8632 if $test X"$prefix" != X"$installprefix"; then
8633         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8634 else
8635         installsitebin="$sitebinexp"
8636 fi
8637
8638 : determine where add-on html pages go
8639 : There is no standard location, so try to copy the previously-selected
8640 : directory structure for the core html pages.
8641 case "$sitehtml1dir" in
8642 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8643 *)     dflt=$sitehtml1dir ;;
8644 esac
8645 case "$dflt" in
8646 ''|' ') dflt=none ;;
8647 esac
8648 fn=dn+~
8649 rp='Pathname where the site-specific html pages should be installed?'
8650 . ./getfile
8651 sitehtml1dir="$ans"
8652 sitehtml1direxp="$ansexp"
8653 : Change installation prefix, if necessary.
8654 if $test X"$prefix" != X"$installprefix"; then
8655         installsitehtml1dir=`echo $sitehtml1direxp | $sed "s#^$prefix#$installprefix#"`
8656 else
8657         installsitehtml1dir="$sitehtml1direxp"
8658 fi
8659
8660 : determine where add-on library html pages go
8661 : There is no standard location, so try to copy the previously-selected
8662 : directory structure for the core html pages.
8663 case "$sitehtml3dir" in
8664 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8665 *)     dflt=$sitehtml3dir ;;
8666 esac
8667 case "$dflt" in
8668 ''|' ') dflt=none ;;
8669 esac
8670 fn=dn+~
8671 rp='Pathname where the site-specific library html pages should be installed?'
8672 . ./getfile
8673 sitehtml3dir="$ans"
8674 sitehtml3direxp="$ansexp"
8675 : Change installation prefix, if necessary.
8676 if $test X"$prefix" != X"$installprefix"; then
8677         installsitehtml3dir=`echo $sitehtml3direxp | $sed "s#^$prefix#$installprefix#"`
8678 else
8679         installsitehtml3dir="$sitehtml3direxp"
8680 fi
8681
8682 : determine where add-on manual pages go
8683 case "$siteman1dir" in
8684 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8685 *)      dflt=$siteman1dir ;;
8686 esac
8687 case "$dflt" in
8688 ''|' ') dflt=none ;;
8689 esac
8690 fn=dn+~
8691 rp='Pathname where the site-specific manual pages should be installed?'
8692 . ./getfile
8693 siteman1dir="$ans"
8694 siteman1direxp="$ansexp"
8695 : Change installation prefix, if necessary.
8696 if $test X"$prefix" != X"$installprefix"; then
8697         installsiteman1dir=`echo $siteman1direxp | $sed "s#^$prefix#$installprefix#"`
8698 else
8699         installsiteman1dir="$siteman1direxp"
8700 fi
8701
8702 : determine where add-on library man pages go
8703 case "$siteman3dir" in
8704 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8705 *)      dflt=$siteman3dir ;;
8706 esac
8707 case "$dflt" in
8708 ''|' ') dflt=none ;;
8709 esac
8710 fn=dn+~
8711 rp='Pathname where the site-specific library manual pages should be installed?'
8712 . ./getfile
8713 siteman3dir="$ans"
8714 siteman3direxp="$ansexp"
8715 : Change installation prefix, if necessary.
8716 if $test X"$prefix" != X"$installprefix"; then
8717         installsiteman3dir=`echo $siteman3direxp | $sed "s#^$prefix#$installprefix#"`
8718 else
8719         installsiteman3dir="$siteman3direxp"
8720 fi
8721
8722 : determine where add-on public executable scripts go
8723 case "$sitescript" in
8724 '')     dflt=$siteprefix/script
8725         $test -d $dflt || dflt=$sitebin ;;
8726 *)  dflt="$sitescript" ;;
8727 esac
8728 fn=d~+
8729 rp='Pathname where add-on public executable scripts should be installed?'
8730 . ./getfile
8731 sitescript="$ans"
8732 sitescriptexp="$ansexp"
8733 : Change installation prefix, if necessary.
8734 if $test X"$prefix" != X"$installprefix"; then
8735         installsitescript=`echo $sitescriptexp | sed "s#^$prefix#$installprefix#"`
8736 else
8737         installsitescript="$sitescriptexp"
8738 fi
8739
8740 case "$usefaststdio" in
8741 $define|true|[yY]*|'')
8742         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8743         case "$xversion" in
8744         [68])   dflt='y' ;;
8745         *)      dflt='n' ;;
8746         esac
8747         ;;
8748 *) dflt='n';;
8749 esac
8750 cat <<EOM
8751
8752 Perl can be built to use 'fast stdio', which means using the stdio
8753 library but also directly manipulating the stdio buffers to enable
8754 faster I/O.  Using stdio is better for backward compatibility (especially
8755 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8756 interface has been preferred instead of stdio.
8757
8758 If this doesn't make any sense to you, just accept the default '$dflt'.
8759 EOM
8760 rp='Use the "fast stdio" if available?'
8761 . ./myread
8762 case "$ans" in
8763 y|Y)    val="$define" ;;     
8764 *)      val="$undef" ;;
8765 esac
8766 set usefaststdio
8767 eval $setvar
8768
8769
8770 : define an is-a-typedef? function
8771 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8772 case "$inclist" in
8773 "") inclist="sys/types.h";;
8774 esac;
8775 eval "varval=\$$var";
8776 case "$varval" in
8777 "")
8778         $rm -f temp.c;
8779         for inc in $inclist; do
8780                 echo "#include <$inc>" >>temp.c;
8781         done;
8782         echo "#ifdef $type" >> temp.c;
8783         echo "printf(\"We have $type\");" >> temp.c;
8784         echo "#endif" >> temp.c;
8785         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8786         if $contains $type temp.E >/dev/null 2>&1; then
8787                 eval "$var=\$type";
8788         else
8789                 eval "$var=\$def";
8790         fi;
8791         $rm -f temp.?;;
8792 *) eval "$var=\$varval";;
8793 esac'
8794
8795 : define an is-a-typedef? function that prompts if the type is not available.
8796 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8797 case "$inclist" in
8798 "") inclist="sys/types.h";;
8799 esac;
8800 eval "varval=\$$var";
8801 case "$varval" in
8802 "")
8803         $rm -f temp.c;
8804         for inc in $inclist; do
8805                 echo "#include <$inc>" >>temp.c;
8806         done;
8807         echo "#ifdef $type" >> temp.c;
8808         echo "printf(\"We have $type\");" >> temp.c;
8809         echo "#endif" >> temp.c;
8810         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8811         echo " " ;
8812         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8813         if $contains $type temp.E >/dev/null 2>&1; then
8814                 echo "$type found." >&4;
8815                 eval "$var=\$type";
8816         else
8817                 echo "$type NOT found." >&4;
8818                 dflt="$def";
8819                 . ./myread ;
8820                 eval "$var=\$ans";
8821         fi;
8822         $rm -f temp.?;;
8823 *) eval "$var=\$varval";;
8824 esac'
8825
8826 : see what type lseek is declared as in the kernel
8827 rp="What is the type used for lseek's offset on this system?"
8828 set off_t lseektype long stdio.h sys/types.h
8829 eval $typedef_ask
8830
8831 echo " "
8832 echo "Checking to see how big your file offsets are..." >&4
8833 $cat >try.c <<EOCP
8834 #include <sys/types.h>
8835 #include <stdio.h>
8836 int main()
8837 {
8838     printf("%d\n", (int)sizeof($lseektype));
8839     return(0); 
8840 }
8841 EOCP
8842 set try
8843 if eval $compile_ok; then
8844         lseeksize=`$run ./try`
8845         echo "Your file offsets are $lseeksize bytes long."
8846 else
8847         dflt=$longsize
8848         echo " "
8849         echo "(I can't seem to compile the test program.  Guessing...)"
8850         rp="What is the size of your file offsets (in bytes)?"
8851         . ./myread
8852         lseeksize="$ans"
8853 fi
8854 $rm -f try.c try
8855
8856 : see what type file positions are declared as in the library
8857 rp="What is the type for file position used by fsetpos()?"
8858 set fpos_t fpostype long stdio.h sys/types.h
8859 eval $typedef_ask
8860
8861 echo " "
8862 case "$fpostype" in
8863 *_t) zzz="$fpostype"    ;;
8864 *)   zzz="fpos_t"       ;;
8865 esac
8866 echo "Checking the size of $zzz..." >&4 
8867 cat > try.c <<EOCP
8868 #include <sys/types.h>
8869 #include <stdio.h>
8870 #$i_stdlib I_STDLIB
8871 #ifdef I_STDLIB
8872 #include <stdlib.h>
8873 #endif
8874 int main() {
8875     printf("%d\n", (int)sizeof($fpostype));
8876     exit(0);
8877 }
8878 EOCP
8879 set try
8880 if eval $compile_ok; then
8881         yyy=`$run ./try`
8882         case "$yyy" in
8883         '')     fpossize=4
8884                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8885                 ;;
8886         *)      fpossize=$yyy
8887                 echo "Your $zzz is $fpossize bytes long."
8888                 ;;
8889         esac
8890 else
8891         dflt="$longsize"
8892         echo " " >&4
8893         echo "(I can't compile the test program.  Guessing...)" >&4
8894         rp="What is the size of your file positions (in bytes)?"
8895         . ./myread
8896         fpossize="$ans"
8897 fi
8898
8899 # Backward compatibility (uselfs is deprecated).
8900 case "$uselfs" in
8901 "$define"|true|[yY]*)
8902         cat <<EOM >&4
8903
8904 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8905 EOM
8906         uselargefiles="$define"
8907         ;;
8908 esac                          
8909
8910 case "$lseeksize:$fpossize" in
8911 8:8) cat <<EOM
8912
8913 You can have files larger than 2 gigabytes.
8914 EOM
8915    val="$define" ;;
8916 *)    case "$uselargefiles" in
8917    "$undef"|false|[nN]*) dflt='n' ;;
8918    *)   dflt='y' ;;
8919    esac
8920    cat <<EOM
8921
8922 Perl can be built to understand large files (files larger than 2 gigabytes)
8923 on some systems.  To do so, Configure can be run with -Duselargefiles.
8924
8925 If this doesn't make any sense to you, just accept the default '$dflt'.
8926 EOM
8927    rp='Try to understand large files, if available?'
8928    . ./myread
8929    case "$ans" in
8930    y|Y)         val="$define" ;;
8931    *)           val="$undef"  ;;
8932    esac
8933    ;;
8934 esac
8935 set uselargefiles
8936 eval $setvar
8937 : Look for a hint-file generated 'call-back-unit'.  If the
8938 : user has specified that a large files perl is to be built,
8939 : we may need to set or change some other defaults.
8940 if $test -f uselargefiles.cbu; then
8941         echo "Your platform has some specific hints regarding large file builds, using them..."
8942         . ./uselargefiles.cbu
8943 fi
8944 case "$uselargefiles" in
8945 "$define")
8946         if $test -f uselargefiles.cbu; then
8947                 echo " "
8948                 echo "Rechecking to see how big your file offsets are..." >&4
8949                 $cat >try.c <<EOCP
8950 #include <sys/types.h>
8951 #include <stdio.h>
8952 int main()
8953 {
8954     printf("%d\n", (int)sizeof($lseektype));
8955     return(0); 
8956 }
8957 EOCP
8958                 set try
8959                 if eval $compile_ok; then
8960                         lseeksize=`$run ./try`
8961                         $echo "Your file offsets are now $lseeksize bytes long."
8962                 else
8963                         dflt="$lseeksize"
8964                         echo " "
8965                         echo "(I can't seem to compile the test program.  Guessing...)"
8966                         rp="What is the size of your file offsets (in bytes)?"
8967                         . ./myread
8968                         lseeksize="$ans"
8969                 fi
8970                 case "$fpostype" in
8971                 *_t) zzz="$fpostype"    ;;
8972                 *)   zzz="fpos_t"       ;;
8973                 esac
8974                 $echo $n "Rechecking the size of $zzz...$c" >&4 
8975                 $cat > try.c <<EOCP
8976 #include <sys/types.h>
8977 #include <stdio.h>
8978 #$i_stdlib I_STDLIB
8979 #ifdef I_STDLIB
8980 #include <stdlib.h>
8981 #endif
8982 int main() {
8983     printf("%d\n", (int)sizeof($fpostype));
8984     return(0);
8985 }
8986 EOCP
8987                 set try
8988                 if eval $compile_ok; then
8989                         yyy=`$run ./try`
8990                         dflt="$lseeksize"
8991                         case "$yyy" in
8992                         '')     echo " "
8993                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8994                                 ;;
8995                         *)      fpossize=$yyy
8996                                 echo " $fpossize bytes." >&4
8997                                 ;;
8998                         esac
8999                 else
9000                         dflt="$fpossize"
9001                         echo " "
9002                         echo "(I can't compile the test program.  Guessing...)" >&4
9003                         rp="What is the size of your file positions (in bytes)?"
9004                         . ./myread
9005                         fpossize="$ans"
9006                 fi
9007                 $rm -f try.c try
9008         fi
9009         ;;
9010 esac
9011
9012 # probably will refer to
9013 #   $archlib $privlib $sitearch $sitelib $vendorarch $vendorlib
9014 need_relocation=0
9015 userelocatableinc=undef
9016
9017 case "$vendorprefix" in
9018 '')     d_vendorbin="$undef"
9019         vendorbin=''
9020         vendorbinexp=''
9021         ;;
9022 *)      d_vendorbin="$define"
9023         : determine where vendor-supplied executables go.
9024         case "$vendorbin" in
9025         '') dflt=$vendorprefix/bin ;;
9026         *)      dflt="$vendorbin" ;;
9027         esac
9028         fn=d~+
9029         rp='Pathname for the vendor-supplied executables directory?'
9030         . ./getfile
9031         vendorbin="$ans"
9032         vendorbinexp="$ansexp"
9033         ;;
9034 esac
9035 : Change installation prefix, if necessary.
9036 if $test X"$prefix" != X"$installprefix"; then
9037         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
9038 else
9039         installvendorbin="$vendorbinexp"
9040 fi
9041
9042 case "$vendorprefix" in
9043 '')     vendorhtml1dir=''
9044         vendorhtml1direxp=''
9045         ;;
9046 *)      : determine where vendor-supplied html pages go.
9047         : There is no standard location, so try to copy the previously-selected
9048         : directory structure for the core html pages.
9049         : XXX Better default suggestions would be welcome.
9050         case "$vendorhtml1dir" in
9051         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9052         *)      dflt=$vendorhtml1dir ;;
9053         esac
9054         case "$dflt" in
9055         ''|' ') dflt=none ;;
9056         esac
9057         fn=dn+~
9058         rp='Pathname for the vendor-supplied html pages?'
9059         . ./getfile
9060         vendorhtml1dir="$ans"
9061         vendorhtml1direxp="$ansexp"
9062         ;;
9063 esac
9064 : Use ' ' for none so value is preserved next time through Configure
9065 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9066 : Change installation prefix, if necessary.
9067 if $test X"$prefix" != X"$installprefix"; then
9068         installvendorhtml1dir=`echo $vendorhtml1direxp | $sed "s#^$prefix#$installprefix#"`
9069 else
9070         installvendorhtml1dir="$vendorhtml1direxp"
9071 fi
9072
9073 case "$vendorprefix" in
9074 '')     vendorhtml3dir=''
9075         vendorhtml3direxp=''
9076         ;;
9077 *)      : determine where vendor-supplied module html pages go.
9078         : There is no standard location, so try to copy the previously-selected
9079         : directory structure for the core html pages.
9080         : XXX Better default suggestions would be welcome.
9081         case "$vendorhtml3dir" in
9082         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9083         *)      dflt=$vendorhtml3dir ;;
9084         esac
9085         case "$dflt" in
9086         ''|' ') dflt=none ;;
9087         esac
9088         fn=dn+~
9089         rp='Pathname for the vendor-supplied html pages?'
9090         . ./getfile
9091         vendorhtml3dir="$ans"
9092         vendorhtml3direxp="$ansexp"
9093         ;;
9094 esac
9095 : Use ' ' for none so value is preserved next time through Configure
9096 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9097 : Change installation prefix, if necessary.
9098 if $test X"$prefix" != X"$installprefix"; then
9099         installvendorhtml3dir=`echo $vendorhtml3direxp | $sed "s#^$prefix#$installprefix#"`
9100 else
9101         installvendorhtml3dir="$vendorhtml3direxp"
9102 fi
9103
9104 case "$vendorprefix" in
9105 '')     vendorman1dir=''
9106         vendorman1direxp=''
9107         ;;
9108 *)      : determine where vendor-supplied manual pages go.
9109         case "$vendorman1dir" in
9110         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9111         *)      dflt=$vendorman1dir ;;
9112         esac
9113         case "$dflt" in
9114         ''|' ') dflt=none ;;
9115         esac
9116         fn=nd~+
9117         rp='Pathname for the vendor-supplied manual section 1 pages?'
9118         . ./getfile
9119         vendorman1dir="$ans"
9120         vendorman1direxp="$ansexp"
9121         ;;
9122 esac
9123 : Use ' ' for none so value is preserved next time through Configure
9124 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9125 : Change installation prefix, if necessary.
9126 if $test X"$prefix" != X"$installprefix"; then
9127         installvendorman1dir=`echo "$vendorman1direxp" | $sed "s#^$prefix#$installprefix#"`
9128 else
9129         installvendorman1dir="$vendorman1direxp"
9130 fi
9131
9132 case "$vendorprefix" in
9133 '')     vendorman3dir=''
9134         vendorman3direxp=''
9135         ;;
9136 *)      : determine where vendor-supplied module manual pages go.
9137         case "$vendorman3dir" in
9138         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9139         *)      dflt=$vendorman3dir ;;
9140         esac
9141         case "$dflt" in
9142         ''|' ') dflt=none ;;
9143         esac
9144         fn=nd~+
9145         rp='Pathname for the vendor-supplied manual section 3 pages?'
9146         . ./getfile
9147         vendorman3dir="$ans"
9148         vendorman3direxp="$ansexp"
9149         ;;
9150 esac
9151 : Use ' ' for none so value is preserved next time through Configure
9152 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9153 : Change installation prefix, if necessary.
9154 if $test X"$prefix" != X"$installprefix"; then
9155         installvendorman3dir=`echo "$vendorman3direxp" | $sed "s#^$prefix#$installprefix#"`
9156 else
9157         installvendorman3dir="$vendorman3direxp"
9158 fi
9159
9160 case "$vendorprefix" in
9161 '')     d_vendorscript="$undef"
9162         vendorscript=''
9163         vendorscriptexp=''
9164         ;;
9165 *)      d_vendorscript="$define"
9166         : determine where vendor-supplied scripts go.
9167         case "$vendorscript" in
9168         '')     dflt=$vendorprefix/script
9169                 $test -d $dflt || dflt=$vendorbin ;;
9170         *)  dflt="$vendorscript" ;;
9171         esac
9172         $cat <<EOM
9173
9174 The installation process will create a directory for 
9175 vendor-supplied scripts.
9176
9177 EOM
9178         fn=d~+
9179         rp='Pathname for the vendor-supplied scripts directory?'
9180         . ./getfile
9181         vendorscript="$ans"
9182         vendorscriptexp="$ansexp"
9183         ;;
9184 esac
9185 : Change installation prefix, if necessary.
9186 if $test X"$prefix" != X"$installprefix"; then
9187         installvendorscript=`echo $vendorscriptexp | $sed "s#^$prefix#$installprefix#"`
9188 else
9189         installvendorscript="$vendorscriptexp"
9190 fi
9191
9192 : see if qgcvt exists
9193 set qgcvt d_qgcvt
9194 eval $inlibc
9195
9196 echo " "
9197
9198 if $test X"$d_longdbl" = X"$define"; then
9199
9200 echo "Checking how to print long doubles..." >&4
9201
9202 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9203         $cat >try.c <<'EOCP'
9204 #include <sys/types.h>
9205 #include <stdio.h>
9206 int main() {
9207   double d = 123.456;
9208   printf("%.3f\n", d);
9209 }
9210 EOCP
9211         set try
9212         if eval $compile; then
9213                 yyy=`$run ./try`
9214                 case "$yyy" in
9215                 123.456)
9216                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9217                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9218                         echo "We will use %f."
9219                         ;;
9220                 esac
9221         fi
9222 fi
9223
9224 if $test X"$sPRIfldbl" = X; then
9225         $cat >try.c <<'EOCP'
9226 #include <sys/types.h>
9227 #include <stdio.h>
9228 int main() {
9229   long double d = 123.456;
9230   printf("%.3Lf\n", d);
9231 }
9232 EOCP
9233         set try
9234         if eval $compile; then
9235                 yyy=`$run ./try`
9236                 case "$yyy" in
9237                 123.456)
9238                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9239                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9240                         echo "We will use %Lf."
9241                         ;;
9242                 esac
9243         fi
9244 fi
9245
9246 if $test X"$sPRIfldbl" = X; then
9247         $cat >try.c <<'EOCP'
9248 #include <sys/types.h>
9249 #include <stdio.h>
9250 int main() {
9251   long double d = 123.456;
9252   printf("%.3llf\n", d);
9253 }
9254 EOCP
9255         set try
9256         if eval $compile; then
9257                 yyy=`$run ./try`
9258                 case "$yyy" in
9259                 123.456)
9260                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9261                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9262                         echo "We will use %llf."
9263                         ;;
9264                 esac
9265         fi
9266 fi
9267
9268 if $test X"$sPRIfldbl" = X; then
9269         $cat >try.c <<'EOCP'
9270 #include <sys/types.h>
9271 #include <stdio.h>
9272 int main() {
9273   long double d = 123.456;
9274   printf("%.3lf\n", d);
9275 }
9276 EOCP
9277         set try
9278         if eval $compile; then
9279                 yyy=`$run ./try`
9280                 case "$yyy" in
9281                 123.456)
9282                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9283                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9284                         echo "We will use %lf."
9285                         ;;
9286                 esac
9287         fi
9288 fi
9289
9290 if $test X"$sPRIfldbl" = X; then
9291         echo "Cannot figure out how to print long doubles." >&4
9292 else
9293         sSCNfldbl=$sPRIfldbl    # expect consistency
9294 fi
9295
9296 $rm -f try try.*
9297
9298 fi # d_longdbl
9299
9300 case "$sPRIfldbl" in
9301 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
9302         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
9303         d_SCNfldbl="$undef";
9304         ;;
9305 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
9306         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
9307         d_SCNfldbl="$define";
9308         ;;
9309 esac
9310
9311 : Check how to convert floats to strings.
9312
9313 if test "X$d_Gconvert" = X; then
9314
9315 echo " "
9316 echo "Checking for an efficient way to convert floats to strings."
9317 echo " " > try.c
9318 case "$uselongdouble" in
9319 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9320 esac
9321 case "$d_longdbl" in
9322 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9323 esac
9324 case "$d_PRIgldbl" in
9325 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9326 esac
9327 $cat >>try.c <<EOP
9328 #ifdef TRY_gconvert
9329 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9330 char *myname = "gconvert";
9331 #endif
9332 #ifdef TRY_gcvt
9333 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9334 char *myname = "gcvt";
9335 #endif
9336 #ifdef TRY_qgcvt
9337 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9338 char *myname = "qgcvt";
9339 #define DOUBLETYPE long double
9340 #endif
9341 #ifdef TRY_sprintf
9342 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9343 #ifdef HAS_PRIgldbl
9344 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9345 #else
9346 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9347 #endif
9348 #else
9349 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9350 #endif
9351 char *myname = "sprintf";
9352 #endif
9353
9354 #ifndef DOUBLETYPE
9355 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9356 #define DOUBLETYPE long double
9357 #else
9358 #define DOUBLETYPE double
9359 #endif
9360 #endif
9361
9362 #include <stdio.h>
9363
9364 #define I_STDLIB $i_stdlib
9365 #ifdef I_STDLIB
9366 #include <stdlib.h>
9367 #endif
9368
9369 int
9370 checkit(expect, got)
9371 char *expect;
9372 char *got;
9373 {
9374     if (strcmp(expect, got)) {
9375                 printf("%s oddity:  Expected %s, got %s\n",
9376                         myname, expect, got);
9377                 exit(1);
9378         }
9379 }
9380
9381 int main()
9382
9383         char buf[64]; 
9384         buf[63] = '\0';
9385
9386         /* This must be 1st test on (which?) platform */
9387         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9388         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9389         checkit("0.1", buf);
9390
9391         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
9392         checkit("0.01", buf);
9393
9394         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
9395         checkit("0.001", buf);
9396
9397         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
9398         checkit("0.0001", buf);
9399
9400         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9401         if (strlen(buf) > 5)
9402             checkit("9e-005", buf); /* for Microsoft ?? */
9403         else
9404             checkit("9e-05", buf);
9405
9406         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
9407         checkit("1", buf);
9408
9409         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
9410         checkit("1.1", buf);
9411
9412         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
9413         checkit("1.01", buf);
9414
9415         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
9416         checkit("1.001", buf);
9417
9418         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
9419         checkit("1.0001", buf);
9420
9421         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
9422         checkit("1.00001", buf);
9423
9424         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
9425         checkit("1.000001", buf);
9426
9427         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
9428         checkit("0", buf);
9429
9430         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
9431         checkit("-1", buf);
9432
9433         /* Some Linux gcvt's give 1.e+5 here. */
9434         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
9435         checkit("100000", buf);
9436         
9437         /* Some Linux gcvt's give -1.e+5 here. */
9438         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
9439         checkit("-100000", buf);
9440
9441         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
9442         checkit("123.456", buf);
9443
9444         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9445         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9446         /* 34 should be enough to scare even long double
9447          * places into using the e notation. */
9448         if (strlen(buf) > 5)
9449             checkit("1e+034", buf); /* for Microsoft */
9450         else
9451             checkit("1e+34", buf);
9452
9453         /* For Perl, if you add additional tests here, also add them to
9454          * t/base/num.t for benefit of platforms not using Configure or
9455          * overriding d_Gconvert */
9456
9457         exit(0);
9458 }
9459 EOP
9460 : first add preferred functions to our list
9461 xxx_list=""
9462 for xxx_convert in $gconvert_preference; do
9463     case $xxx_convert in
9464     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9465     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9466     esac 
9467 done
9468 : then add any others
9469 for xxx_convert in gconvert gcvt sprintf; do
9470     case "$xxx_list" in
9471     *$xxx_convert*) ;;
9472     *) xxx_list="$xxx_list $xxx_convert" ;;
9473     esac 
9474 done
9475
9476 case "$d_longdbl$uselongdouble" in
9477 "$define$define")
9478     : again, add prefered functions to our list first
9479     xxx_ld_list=""
9480     for xxx_convert in $gconvert_ld_preference; do
9481         case $xxx_convert in
9482         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9483         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9484         esac
9485     done
9486     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9487     for xxx_convert in qgcvt sprintf $xxx_list; do
9488         case "$xxx_ld_list" in
9489         $xxx_convert*|*" $xxx_convert"*) ;;
9490         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9491         esac
9492     done
9493     : if sprintf cannot do long doubles, move it to the end
9494     if test "$d_PRIgldbl" != "$define"; then
9495         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9496     fi
9497     : if no qgcvt, remove it
9498     if test "$d_qgcvt" != "$define"; then
9499         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9500     fi
9501     : use the ld_list
9502     xxx_list="$xxx_ld_list"
9503     ;;
9504 esac
9505
9506 for xxx_convert in $xxx_list; do
9507         echo "Trying $xxx_convert..."
9508         $rm -f try try$_o
9509         set try -DTRY_$xxx_convert
9510         if eval $compile; then
9511                 echo "$xxx_convert() found." >&4
9512                 if $run ./try; then
9513                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9514                         break;
9515                 else
9516                         echo "...But $xxx_convert didn't work as I expected."
9517                         xxx_convert=''
9518                 fi
9519         else
9520                 echo "$xxx_convert NOT found." >&4
9521         fi
9522 done
9523
9524 if test X$xxx_convert = X; then
9525     echo "*** WHOA THERE!!! ***" >&4
9526     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9527     xxx_convert=sprintf
9528 fi
9529
9530 case "$xxx_convert" in
9531 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9532 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9533 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9534 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9535    "$define$define$define")
9536       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9537    "$define$define$undef")
9538       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9539    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9540    esac
9541    ;;  
9542 esac
9543
9544 fi
9545
9546 : see if _fwalk exists
9547 set fwalk d__fwalk
9548 eval $inlibc
9549
9550 : Initialize h_fcntl
9551 h_fcntl=false
9552
9553 : Initialize h_sysfile
9554 h_sysfile=false
9555
9556 : access call always available on UNIX
9557 set access d_access
9558 eval $inlibc
9559
9560 : locate the flags for 'access()'
9561 case "$d_access" in
9562 "$define")
9563         echo " "
9564         $cat >access.c <<EOCP
9565 #include <sys/types.h>
9566 #ifdef I_FCNTL
9567 #include <fcntl.h>
9568 #endif
9569 #ifdef I_SYS_FILE
9570 #include <sys/file.h>
9571 #endif
9572 #ifdef I_UNISTD
9573 #include <unistd.h>
9574 #endif
9575 #$i_stdlib I_STDLIB
9576 #ifdef I_STDLIB
9577 #include <stdlib.h>
9578 #endif
9579 int main() {
9580         exit(R_OK);
9581 }
9582 EOCP
9583         : check sys/file.h first, no particular reason here
9584         if $test `./findhdr sys/file.h` && \
9585                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9586                 h_sysfile=true;
9587                 echo "<sys/file.h> defines the *_OK access constants." >&4
9588         elif $test `./findhdr fcntl.h` && \
9589                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9590                 h_fcntl=true;
9591                 echo "<fcntl.h> defines the *_OK access constants." >&4
9592         elif $test `./findhdr unistd.h` && \
9593                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9594                 echo "<unistd.h> defines the *_OK access constants." >&4
9595         else
9596                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9597         fi
9598         ;;
9599 esac
9600 $rm -f access*
9601
9602 : see if accessx exists
9603 set accessx d_accessx
9604 eval $inlibc
9605
9606 : see if aintl exists
9607 set aintl d_aintl
9608 eval $inlibc
9609
9610 : see if alarm exists
9611 set alarm d_alarm
9612 eval $inlibc
9613
9614 : see if POSIX threads are available
9615 set pthread.h i_pthread
9616 eval $inhdr
9617
9618 : define a fucntion to check prototypes
9619 $cat > protochk <<EOSH
9620 $startsh
9621 cc="$cc"
9622 optimize="$optimize"
9623 ccflags="$ccflags"
9624 prototype="$prototype"
9625 define="$define"
9626 rm=$rm
9627 usethreads=$usethreads
9628 i_pthread=$i_pthread
9629 pthread_h_first=$pthread_h_first
9630 EOSH
9631
9632 $cat >> protochk <<'EOSH'
9633
9634 $rm -f try.c
9635 foo="$1"
9636 shift
9637 while test $# -ge 2; do
9638         case "$1" in
9639                 $define) echo "#include <$2>" >> try.c ;;
9640                 literal) echo "$2" >> try.c ;;
9641         esac
9642     # Extra magic for the benefit of systems that need pthread.h
9643     # to be included early to correctly detect threadsafe functions.
9644     # Such functions must guarantee themselves, though, that the usethreads
9645     # and i_pthread have been defined, before calling protochk.
9646     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9647         echo "#include <pthread.h>" >> try.c
9648         pthread_h_done=yes
9649     fi
9650     shift 2
9651 done
9652 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9653 cat >> try.c <<'EOCP'
9654 #ifdef CAN_PROTOTYPE
9655 #define _(args) args
9656 #else
9657 #define _(args) ()
9658 #endif
9659 EOCP
9660 echo "$foo" >> try.c
9661 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9662 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9663 status=$?
9664 $rm -f try.[co]
9665 exit $status
9666 EOSH
9667 chmod +x protochk
9668 $eunicefix protochk
9669
9670 hasproto='varname=$1; func=$2; shift; shift;
9671 while $test $# -ge 2; do
9672         case "$1" in
9673         $define) echo "#include <$2>";;
9674         esac ;
9675     shift 2;
9676 done > try.c;
9677 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9678 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9679         echo "$func() prototype found.";
9680         val="$define";
9681 else
9682         echo "$func() prototype NOT found.";
9683         val="$undef";
9684 fi;
9685 set $varname;
9686 eval $setvar;
9687 $rm -f try.c tryout.c'
9688
9689 : see if sys/types.h has to be included
9690 set sys/types.h i_systypes
9691 eval $inhdr
9692
9693 : see if sys/select.h has to be included
9694 set sys/select.h i_sysselct
9695 eval $inhdr
9696
9697 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9698 while $test $# -ge 2; do
9699         case "$1" in
9700         $define) echo "#include <$2>";;
9701         esac ;
9702     shift 2;
9703 done > try.c;
9704 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9705 set try;
9706 if eval $compile; then
9707         val="$define";
9708 else
9709         val="$undef";
9710 fi;
9711 set $varname;
9712 eval $setvar;
9713 $rm -f try.c try.o'
9714
9715 : see if we should include time.h, sys/time.h, or both
9716 echo " "
9717 if test "X$timeincl" = X; then
9718         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9719         $echo $n "I'm now running the test program...$c"
9720         $cat >try.c <<EOCP
9721 #include <sys/types.h>
9722 #ifdef I_TIME
9723 #include <time.h>
9724 #endif
9725 #ifdef I_SYSTIME
9726 #ifdef SYSTIMEKERNEL
9727 #define KERNEL
9728 #endif
9729 #include <sys/time.h>
9730 #endif
9731 #ifdef I_SYSSELECT
9732 #include <sys/select.h>
9733 #endif
9734 #$i_stdlib I_STDLIB
9735 #ifdef I_STDLIB
9736 #include <stdlib.h>
9737 #endif
9738 int main()
9739 {
9740         struct tm foo;
9741 #ifdef S_TIMEVAL
9742         struct timeval bar;
9743 #endif
9744 #ifdef S_TIMEZONE
9745         struct timezone tzp;
9746 #endif
9747         if (foo.tm_sec == foo.tm_sec)
9748                 exit(0);
9749 #ifdef S_TIMEVAL
9750         if (bar.tv_sec == bar.tv_sec)
9751                 exit(0);
9752 #endif
9753         exit(1);
9754 }
9755 EOCP
9756         flags=''
9757         for s_timezone in '-DS_TIMEZONE' ''; do
9758         sysselect=''
9759         for s_timeval in '-DS_TIMEVAL' ''; do
9760         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9761         for i_time in '' '-DI_TIME'; do
9762         for i_systime in '-DI_SYSTIME' ''; do
9763                 case "$flags" in
9764                 '') $echo $n ".$c"
9765                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9766                         if eval $compile; then
9767                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9768                                 shift
9769                                 flags="$*"
9770                                 echo " "
9771                                 $echo $n "Succeeded with $flags$c"
9772                         fi
9773                         ;;
9774                 esac
9775         done
9776         done
9777         done
9778         done
9779         done
9780         timeincl=''
9781         echo " "
9782         case "$flags" in
9783         *SYSTIMEKERNEL*) i_systimek="$define"
9784                 timeincl=`./findhdr sys/time.h`
9785                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9786         *) i_systimek="$undef";;
9787         esac
9788         case "$flags" in
9789         *I_TIME*) i_time="$define"
9790                 timeincl=`./findhdr time.h`" $timeincl"
9791                 echo "We'll include <time.h>." >&4;;
9792         *) i_time="$undef";;
9793         esac
9794         case "$flags" in
9795         *I_SYSTIME*) i_systime="$define"
9796                 timeincl=`./findhdr sys/time.h`" $timeincl"
9797                 echo "We'll include <sys/time.h>." >&4;;
9798         *) i_systime="$undef";;
9799         esac
9800         $rm -f try.c try
9801 fi
9802 : see if struct tm knows about tm_zone
9803 case "$i_systime$i_time" in
9804 *$define*) 
9805         echo " "
9806         echo "Checking to see if your struct tm has tm_zone field..." >&4
9807         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9808         eval $hasfield
9809         ;;
9810 *)      val="$undef"
9811         set d_tm_tm_zone
9812         eval $setvar
9813         ;;
9814 esac
9815 case "$d_tm_tm_zone" in
9816 "$define")      echo "Yes, it does."   ;;
9817 *)              echo "No, it doesn't." ;;
9818 esac
9819 : see if struct tm knows about tm_gmtoff
9820 case "$i_systime$i_time" in
9821 *$define*) 
9822         echo " "
9823         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9824         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9825         eval $hasfield
9826         ;;
9827 *)      val="$undef"
9828         set d_tm_tm_gmtoff
9829         eval $setvar
9830         ;;
9831 esac
9832 case "$d_tm_tm_gmtoff" in
9833 "$define")      echo "Yes, it does."   ;;
9834 *)              echo "No, it doesn't." ;;
9835 esac
9836
9837 : see if asctime_r exists
9838 set asctime_r d_asctime_r
9839 eval $inlibc
9840 case "$d_asctime_r" in
9841 "$define")
9842         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9843         case "$d_asctime_r_proto:$usethreads" in
9844         ":define")      d_asctime_r_proto=define
9845                 set d_asctime_r_proto asctime_r $hdrs
9846                 eval $hasproto ;;
9847         *)      ;;
9848         esac
9849         case "$d_asctime_r_proto" in
9850         define)
9851         case "$asctime_r_proto" in
9852         ''|0) try='char* asctime_r(const struct tm*, char*);'
9853         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9854         esac
9855         case "$asctime_r_proto" in
9856         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9857         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9858         esac
9859         case "$asctime_r_proto" in
9860         ''|0) try='int asctime_r(const struct tm*, char*);'
9861         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9862         esac
9863         case "$asctime_r_proto" in
9864         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9865         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9866         esac
9867         case "$asctime_r_proto" in
9868         ''|0)   d_asctime_r=undef
9869                 asctime_r_proto=0
9870                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9871         * )     case "$asctime_r_proto" in
9872                 REENTRANT_PROTO*) ;;
9873                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9874                 esac
9875                 echo "Prototype: $try" ;;
9876         esac
9877         ;;
9878         *)      case "$usethreads" in
9879                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9880                 esac
9881                 d_asctime_r=undef
9882                 asctime_r_proto=0
9883                 ;;
9884         esac
9885         ;;
9886 *)      asctime_r_proto=0
9887         ;;
9888 esac
9889
9890 : see if atolf exists
9891 set atolf d_atolf
9892 eval $inlibc
9893
9894 : see if atoll exists
9895 set atoll d_atoll
9896 eval $inlibc
9897
9898 : Look for GCC-style attribute format
9899 case "$d_attribute_format" in
9900 '')
9901 echo " "
9902 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
9903 $cat >attrib.c <<'EOCP'
9904 #include <stdio.h>
9905 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
9906 EOCP
9907 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9908         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9909                 echo "Your C compiler doesn't support __attribute__((format))."
9910                 val="$undef"
9911         else
9912                 echo "Your C compiler supports __attribute__((format))."
9913                 val="$define"
9914         fi
9915 else
9916         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9917         val="$undef"
9918 fi
9919 ;;
9920 *) val="$d_attribute_format" ;;
9921 esac
9922 set d_attribute_format
9923 eval $setvar
9924 $rm -f attrib*
9925
9926 : Look for GCC-style attribute malloc
9927 case "$d_attribute_malloc" in
9928 '')
9929 echo " "
9930 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
9931 $cat >attrib.c <<'EOCP'
9932 #include <stdio.h>
9933 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
9934 EOCP
9935 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9936         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9937                 echo "Your C compiler doesn't support __attribute__((malloc))."
9938                 val="$undef"
9939         else
9940                 echo "Your C compiler supports __attribute__((malloc))."
9941                 val="$define"
9942         fi
9943 else
9944         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9945         val="$undef"
9946 fi
9947 ;;
9948 *) val="$d_attribute_malloc" ;;
9949 esac
9950 set d_attribute_malloc
9951 eval $setvar
9952 $rm -f attrib*
9953
9954 : Look for GCC-style attribute nonnull
9955 case "$d_attribute_nonnull" in
9956 '')
9957 echo " "
9958 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
9959 $cat >attrib.c <<'EOCP'
9960 #include <stdio.h>
9961 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
9962 EOCP
9963 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9964         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9965                 echo "Your C compiler doesn't support __attribute__((nonnull))."
9966                 val="$undef"
9967         else
9968                 echo "Your C compiler supports __attribute__((nonnull))."
9969                 val="$define"
9970         fi
9971 else
9972         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9973         val="$undef"
9974 fi
9975 ;;
9976 *) val="$d_attribute_nonnull" ;;
9977 esac
9978 set d_attribute_nonnull
9979 eval $setvar
9980 $rm -f attrib*
9981
9982 : Look for GCC-style attribute noreturn
9983 case "$d_attribute_noreturn" in
9984 '')
9985 echo " "
9986 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
9987 $cat >attrib.c <<'EOCP'
9988 #include <stdio.h>
9989 void fall_over_dead( void ) __attribute__((noreturn));
9990 EOCP
9991 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9992         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9993                 echo "Your C compiler doesn't support __attribute__((noreturn))."
9994                 val="$undef"
9995         else
9996                 echo "Your C compiler supports __attribute__((noreturn))."
9997                 val="$define"
9998         fi
9999 else
10000         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10001         val="$undef"
10002 fi
10003 ;;
10004 *) val="$d_attribute_noreturn" ;;
10005 esac
10006 set d_attribute_noreturn
10007 eval $setvar
10008 $rm -f attrib*
10009
10010 : Look for GCC-style attribute pure
10011 case "$d_attribute_pure" in
10012 '')
10013 echo " "
10014 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10015 $cat >attrib.c <<'EOCP'
10016 #include <stdio.h>
10017 int square( int n ) __attribute__((pure));
10018 EOCP
10019 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10020         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10021                 echo "Your C compiler doesn't support __attribute__((pure))."
10022                 val="$undef"
10023         else
10024                 echo "Your C compiler supports __attribute__((pure))."
10025                 val="$define"
10026         fi
10027 else
10028         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10029         val="$undef"
10030 fi
10031 ;;
10032 *) val="$d_attribute_pure" ;;
10033 esac
10034 set d_attribute_pure
10035 eval $setvar
10036 $rm -f attrib*
10037
10038 : Look for GCC-style attribute unused
10039 case "$d_attribute_unused" in
10040 '')
10041 echo " "
10042 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10043 $cat >attrib.c <<'EOCP'
10044 #include <stdio.h>
10045 int do_something( int dummy __attribute__((unused)), int n );
10046 EOCP
10047 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10048         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10049                 echo "Your C compiler doesn't support __attribute__((unused))."
10050                 val="$undef"
10051         else
10052                 echo "Your C compiler supports __attribute__((unused))."
10053                 val="$define"
10054         fi
10055 else
10056         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10057         val="$undef"
10058 fi
10059 ;;
10060 *) val="$d_attribute_unused" ;;
10061 esac
10062 set d_attribute_unused
10063 eval $setvar
10064 $rm -f attrib*
10065
10066 : Look for GCC-style attribute warn_unused_result
10067 case "$d_attribute_warn_unused_result" in
10068 '')
10069 echo " "
10070 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10071 $cat >attrib.c <<'EOCP'
10072 #include <stdio.h>
10073 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10074 EOCP
10075 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10076         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10077                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10078                 val="$undef"
10079         else
10080                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10081                 val="$define"
10082         fi
10083 else
10084         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10085         val="$undef"
10086 fi
10087 ;;
10088 *) val="$d_attribute_warn_unused_result" ;;
10089 esac
10090 set d_attribute_warn_unused_result
10091 eval $setvar
10092 $rm -f attrib*
10093
10094 : see if bcmp exists
10095 set bcmp d_bcmp
10096 eval $inlibc
10097
10098 : see if bcopy exists
10099 set bcopy d_bcopy
10100 eval $inlibc
10101
10102 : see if this is a unistd.h system
10103 set unistd.h i_unistd
10104 eval $inhdr
10105
10106 : see if getpgrp exists
10107 set getpgrp d_getpgrp
10108 eval $inlibc
10109
10110 case "$d_getpgrp" in
10111 "$define")
10112         echo " "
10113         echo "Checking to see which flavor of getpgrp is in use..."
10114         $cat >try.c <<EOP
10115 #$i_unistd I_UNISTD
10116 #include <sys/types.h>
10117 #ifdef I_UNISTD
10118 #  include <unistd.h>
10119 #endif
10120 #$i_stdlib I_STDLIB
10121 #ifdef I_STDLIB
10122 #include <stdlib.h>
10123 #endif
10124 int main()
10125 {
10126         if (getuid() == 0) {
10127                 printf("(I see you are running Configure as super-user...)\n");
10128                 setuid(1);
10129         }
10130 #ifdef TRY_BSD_PGRP
10131         if (getpgrp(1) == 0)
10132                 exit(0);
10133 #else
10134         if (getpgrp() > 0)
10135                 exit(0);
10136 #endif
10137         exit(1);
10138 }
10139 EOP
10140         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10141                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10142                 val="$define"
10143         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10144                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10145                 val="$undef"
10146         else
10147                 echo "I can't seem to compile and run the test program."
10148                 if ./usg; then
10149                         xxx="a USG one, i.e. you use getpgrp()."
10150                 else
10151                         # SVR4 systems can appear rather BSD-ish.
10152                         case "$i_unistd" in
10153                         $undef)
10154                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10155                                 val="$define"
10156                                 ;;
10157                         $define)
10158                                 xxx="probably a USG one, i.e. you use getpgrp()."
10159                                 val="$undef"
10160                                 ;;
10161                         esac
10162                 fi
10163                 echo "Assuming your getpgrp is $xxx" >&4
10164         fi
10165         ;;
10166 *) val="$undef";;
10167 esac
10168 set d_bsdgetpgrp
10169 eval $setvar
10170 $rm -f try try.*
10171
10172 : see if setpgrp exists
10173 set setpgrp d_setpgrp
10174 eval $inlibc
10175
10176 case "$d_setpgrp" in
10177 "$define")
10178         echo " "
10179         echo "Checking to see which flavor of setpgrp is in use..."
10180         $cat >try.c <<EOP
10181 #$i_unistd I_UNISTD
10182 #include <sys/types.h>
10183 #ifdef I_UNISTD
10184 #  include <unistd.h>
10185 #endif
10186 #$i_stdlib I_STDLIB
10187 #ifdef I_STDLIB
10188 #include <stdlib.h>
10189 #endif
10190 int main()
10191 {
10192         if (getuid() == 0) {
10193                 printf("(I see you are running Configure as super-user...)\n");
10194                 setuid(1);
10195         }
10196 #ifdef TRY_BSD_PGRP
10197         if (-1 == setpgrp(1, 1))
10198                 exit(0);
10199 #else
10200         if (setpgrp() != -1)
10201                 exit(0);
10202 #endif
10203         exit(1);
10204 }
10205 EOP
10206         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10207                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10208                 val="$define"
10209         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10210                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10211                 val="$undef"
10212         else
10213                 echo "(I can't seem to compile and run the test program.)"
10214                 if ./usg; then
10215                         xxx="a USG one, i.e. you use setpgrp()."
10216                 else
10217                         # SVR4 systems can appear rather BSD-ish.
10218                         case "$i_unistd" in
10219                         $undef)
10220                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10221                                 val="$define"
10222                                 ;;
10223                         $define)
10224                                 xxx="probably a USG one, i.e. you use setpgrp()."
10225                                 val="$undef"
10226                                 ;;
10227                         esac
10228                 fi
10229                 echo "Assuming your setpgrp is $xxx" >&4
10230         fi
10231         ;;
10232 *) val="$undef";;
10233 esac
10234 set d_bsdsetpgrp
10235 eval $setvar
10236 $rm -f try try.*
10237 : see if bzero exists
10238 set bzero d_bzero
10239 eval $inlibc
10240
10241 : see if signal is declared as pointer to function returning int or void
10242 echo " "
10243 xxx=`./findhdr signal.h`
10244 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10245 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10246         echo "You have int (*signal())() instead of void." >&4
10247         val="$undef"
10248 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10249         echo "You have void (*signal())()." >&4
10250         val="$define"
10251 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10252         echo "You have int (*signal())() instead of void." >&4
10253         val="$undef"
10254 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10255         echo "You have void (*signal())()." >&4
10256         val="$define"
10257 else
10258         case "$d_voidsig" in
10259         '')
10260         echo "I can't determine whether signal handler returns void or int..." >&4
10261                 dflt=void
10262                 rp="What type does your signal handler return?"
10263                 . ./myread
10264                 case "$ans" in
10265                 v*) val="$define";;
10266                 *) val="$undef";;
10267                 esac;;
10268         "$define")
10269                 echo "As you already told me, signal handler returns void." >&4
10270                 val="$define"
10271                 ;;
10272         *)      echo "As you already told me, signal handler returns int." >&4
10273                 val="$undef"
10274                 ;;
10275         esac
10276 fi
10277 set d_voidsig
10278 eval $setvar
10279 case "$d_voidsig" in
10280 "$define") signal_t="void";;
10281 *) signal_t="int";;
10282 esac
10283 $rm -f $$.tmp
10284
10285 : check for ability to cast large floats to 32-bit ints.
10286 echo " "
10287 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10288 if $test "$intsize" -ge 4; then
10289         xxx=int
10290 else
10291         xxx=long
10292 fi
10293 $cat >try.c <<EOCP
10294 #include <stdio.h>
10295 #$i_stdlib I_STDLIB
10296 #ifdef I_STDLIB
10297 #include <stdlib.h>
10298 #endif
10299 #include <sys/types.h>
10300 #include <signal.h>
10301 $signal_t blech(s) int s; { exit(3); }
10302 int main()
10303 {
10304         $xxx i32;
10305         double f, g;
10306         int result = 0;
10307         char str[16];
10308         signal(SIGFPE, blech);
10309
10310         /* Don't let compiler optimize the test away.  Store the number 
10311            in a writable string for gcc to pass to sscanf under HP/UX.
10312         */
10313         sprintf(str, "2147483647");
10314         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10315         g = 10 * f;
10316         i32  = ($xxx) g;
10317
10318         /* x86 processors will probably give 0x8000 0000, which is a
10319            sign change.  We don't want that.  We want to mimic SPARC
10320            behavior here, which is to preserve the sign and give
10321            back 0x7fff ffff.
10322         */
10323         if (i32 != ($xxx) f)
10324                 result |= 1;
10325         exit(result);
10326 }
10327 EOCP
10328 set try
10329 if eval $compile_ok; then
10330         $run ./try
10331         yyy=$?
10332 else
10333         echo "(I can't seem to compile the test program--assuming it can't)"
10334         yyy=1
10335 fi
10336 case "$yyy" in
10337 0)      val="$define"
10338         echo "Yup, it can."
10339         ;;
10340 *)      val="$undef"
10341         echo "Nope, it can't."
10342         ;;
10343 esac
10344 set d_casti32
10345 eval $setvar
10346 $rm -f try try.*
10347
10348 : check for ability to cast negative floats to unsigned
10349 echo " "
10350 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10351 $cat >try.c <<EOCP
10352 #include <stdio.h>
10353 #$i_stdlib I_STDLIB
10354 #ifdef I_STDLIB
10355 #include <stdlib.h>
10356 #endif
10357 #include <sys/types.h>
10358 #include <signal.h>
10359 $signal_t blech(s) int s; { exit(7); }
10360 $signal_t blech_in_list(s) int s; { exit(4); }
10361 unsigned long dummy_long(p) unsigned long p; { return p; }
10362 unsigned int dummy_int(p) unsigned int p; { return p; }
10363 unsigned short dummy_short(p) unsigned short p; { return p; }
10364 int main()
10365 {
10366         double f;
10367         unsigned long along;
10368         unsigned int aint;
10369         unsigned short ashort;
10370         int result = 0;
10371         char str[16];
10372         
10373         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10374            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10375            optimized the whole file away
10376         */
10377         /* Store the number in a writable string for gcc to pass to 
10378            sscanf under HP/UX.
10379         */
10380         sprintf(str, "-123");
10381         sscanf(str, "%lf", &f);  /* f = -123.; */
10382
10383         signal(SIGFPE, blech);
10384         along = (unsigned long)f;
10385         aint = (unsigned int)f;
10386         ashort = (unsigned short)f;
10387         if (along != (unsigned long)-123)
10388                 result |= 1;
10389         if (aint != (unsigned int)-123)
10390                 result |= 1;
10391         if (ashort != (unsigned short)-123)
10392                 result |= 1;
10393         sprintf(str, "1073741824.");
10394         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10395         f = f + f;
10396         along = 0;
10397         along = (unsigned long)f;
10398         if (along != 0x80000000)
10399                 result |= 2;
10400         f -= 1.;
10401         along = 0;
10402         along = (unsigned long)f;
10403         if (along != 0x7fffffff)
10404                 result |= 1;
10405         f += 2.;
10406         along = 0;
10407         along = (unsigned long)f;
10408         if (along != 0x80000001)
10409                 result |= 2;
10410         if (result)
10411                 exit(result);
10412         signal(SIGFPE, blech_in_list);
10413         sprintf(str, "123.");
10414         sscanf(str, "%lf", &f);  /* f = 123.; */
10415         along = dummy_long((unsigned long)f);
10416         aint = dummy_int((unsigned int)f);
10417         ashort = dummy_short((unsigned short)f);
10418         if (along != (unsigned long)123)
10419                 result |= 4;
10420         if (aint != (unsigned int)123)
10421                 result |= 4;
10422         if (ashort != (unsigned short)123)
10423                 result |= 4;
10424         exit(result);
10425
10426 }
10427 EOCP
10428 set try
10429 if eval $compile_ok; then
10430         $run ./try
10431         castflags=$?
10432 else
10433         echo "(I can't seem to compile the test program--assuming it can't)"
10434         castflags=7
10435 fi
10436 case "$castflags" in
10437 0)      val="$define"
10438         echo "Yup, it can."
10439         ;;
10440 *)      val="$undef"
10441         echo "Nope, it can't."
10442         ;;
10443 esac
10444 set d_castneg
10445 eval $setvar
10446 $rm -f try.*
10447
10448 : see if vprintf exists
10449 echo " "
10450 if set vprintf val -f d_vprintf; eval $csym; $val; then
10451         echo 'vprintf() found.' >&4
10452         val="$define"
10453         $cat >try.c <<EOF
10454 #include <varargs.h>
10455 #$i_stdlib I_STDLIB
10456 #ifdef I_STDLIB
10457 #include <stdlib.h>
10458 #endif
10459
10460 int main() { xxx("foo"); }
10461
10462 xxx(va_alist)
10463 va_dcl
10464 {
10465         va_list args;
10466         char buf[10];
10467
10468         va_start(args);
10469         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10470 }
10471 EOF
10472         set try
10473         if eval $compile && $run ./try; then
10474                 echo "Your vsprintf() returns (int)." >&4
10475                 val2="$undef"
10476         else
10477                 echo "Your vsprintf() returns (char*)." >&4
10478                 val2="$define"
10479         fi
10480 else
10481         echo 'vprintf() NOT found.' >&4
10482                 val="$undef"
10483                 val2="$undef"
10484 fi
10485 $rm -f try try.*
10486 set d_vprintf
10487 eval $setvar
10488 val=$val2
10489 set d_charvspr
10490 eval $setvar
10491
10492 : see if chown exists
10493 set chown d_chown
10494 eval $inlibc
10495
10496 : see if chroot exists
10497 set chroot d_chroot
10498 eval $inlibc
10499
10500 : see if chsize exists
10501 set chsize d_chsize
10502 eval $inlibc
10503
10504 : see if class exists
10505 set class d_class
10506 eval $inlibc
10507
10508 : see if clearenv exists
10509 set clearenv d_clearenv
10510 eval $inlibc
10511
10512 hasstruct='varname=$1; struct=$2; shift; shift;
10513 while $test $# -ge 2; do
10514         case "$1" in
10515         $define) echo "#include <$2>";;
10516         esac ;
10517     shift 2;
10518 done > try.c;
10519 echo "int main () { struct $struct foo; }" >> try.c;
10520 set try;
10521 if eval $compile; then
10522         val="$define";
10523 else
10524         val="$undef";
10525 fi;
10526 set $varname;
10527 eval $setvar;
10528 $rm -f try.c try.o'
10529
10530 socketlib=''
10531 sockethdr=''
10532 : see whether socket exists
10533 echo " "
10534 $echo $n "Hmm... $c" >&4
10535 if set socket val -f d_socket; eval $csym; $val; then
10536         echo "Looks like you have Berkeley networking support." >&4
10537         d_socket="$define"
10538         if set setsockopt val -f; eval $csym; $val; then
10539                 d_oldsock="$undef"
10540         else
10541                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10542                 d_oldsock="$define"
10543         fi
10544 else
10545         if $contains socklib libc.list >/dev/null 2>&1; then
10546                 echo "Looks like you have Berkeley networking support." >&4
10547                 d_socket="$define"
10548                 : we will have to assume that it supports the 4.2 BSD interface
10549                 d_oldsock="$undef"
10550         else
10551                 echo "You don't have Berkeley networking in libc$_a..." >&4
10552                 if test "X$d_socket" = "X$define"; then
10553                    echo "...but you seem to believe that you have sockets." >&4
10554                 else
10555                         for net in net socket
10556                         do
10557                                 if test -f /usr/lib/lib$net$_a; then
10558                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10559                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10560                                         if $contains socket libc.list >/dev/null 2>&1; then
10561                                                 d_socket="$define"
10562                                                 socketlib="-l$net"
10563                                                 case "$net" in
10564                                                 net)
10565                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10566                                                         sockethdr="-I/usr/netinclude"
10567                                                         ;;
10568                                                 esac
10569                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
10570                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10571                                                         d_oldsock="$undef"
10572                                                 else
10573                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10574                                                         d_oldsock="$define"
10575                                                 fi
10576                                                 break
10577                                         fi
10578                                 fi
10579                         done
10580                         if test "X$d_socket" != "X$define"; then
10581                            echo "or anywhere else I see." >&4
10582                            d_socket="$undef"
10583                            d_oldsock="$undef"
10584                         fi
10585                 fi
10586         fi
10587 fi
10588
10589 : see if socketpair exists
10590 set socketpair d_sockpair
10591 eval $inlibc
10592
10593
10594 echo " "
10595 echo "Checking the availability of certain socket constants..." >&4
10596 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10597         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10598         $cat >try.c <<EOF
10599 #include <sys/types.h>
10600 #include <sys/socket.h>
10601 int main() {
10602     int i = $ENUM;
10603 }
10604 EOF
10605         val="$undef"
10606         set try; if eval $compile; then
10607                 val="$define"
10608         fi
10609         set d_${enum}; eval $setvar
10610         $rm -f try.c try
10611 done
10612
10613 : see if this is a sys/uio.h system
10614 set sys/uio.h i_sysuio
10615 eval $inhdr
10616
10617
10618 echo " "
10619 echo "Checking to see if your system supports struct cmsghdr..." >&4
10620 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10621 eval $hasstruct
10622 case "$d_cmsghdr_s" in
10623 "$define")      echo "Yes, it does."   ;;
10624 *)              echo "No, it doesn't." ;;
10625 esac
10626
10627
10628 : check for const keyword
10629 echo " "
10630 echo 'Checking to see if your C compiler knows about "const"...' >&4
10631 $cat >const.c <<'EOCP'
10632 typedef struct spug { int drokk; } spug;
10633 int main()
10634 {
10635         const char *foo;
10636         const spug y;
10637 }
10638 EOCP
10639 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10640         val="$define"
10641         echo "Yup, it does."
10642 else
10643         val="$undef"
10644         echo "Nope, it doesn't."
10645 fi
10646 set d_const
10647 eval $setvar
10648
10649 : see if copysignl exists
10650 set copysignl d_copysignl
10651 eval $inlibc
10652
10653 : see if crypt exists
10654 echo " "
10655 set crypt d_crypt
10656 eval $inlibc
10657 case "$d_crypt" in
10658 $define) cryptlib='' ;;
10659 *)      if set crypt val -f d_crypt; eval $csym; $val; then
10660                 echo 'crypt() found.' >&4
10661                 val="$define"
10662                 cryptlib=''
10663         else
10664                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10665                 if $test -z "$cryptlib"; then
10666                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10667                 else
10668                         cryptlib=-lcrypt
10669                 fi
10670                 if $test -z "$cryptlib"; then
10671                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10672                 else
10673                         cryptlib=-lcrypt
10674                 fi
10675                 if $test -z "$cryptlib"; then
10676                         cryptlib=`./loc libcrypt$_a "" $libpth`
10677                 else
10678                         cryptlib=-lcrypt
10679                 fi
10680                 if $test -z "$cryptlib"; then
10681                         echo 'crypt() NOT found.' >&4
10682                         val="$undef"
10683                 else
10684                         val="$define"
10685                 fi
10686         fi
10687         set d_crypt
10688         eval $setvar
10689         ;;
10690 esac
10691
10692 : see if this is a crypt.h system
10693 set crypt.h i_crypt
10694 eval $inhdr
10695
10696 : see if crypt_r exists
10697 set crypt_r d_crypt_r
10698 eval $inlibc
10699 case "$d_crypt_r" in
10700 "$define")
10701         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
10702         case "$d_crypt_r_proto:$usethreads" in
10703         ":define")      d_crypt_r_proto=define
10704                 set d_crypt_r_proto crypt_r $hdrs
10705                 eval $hasproto ;;
10706         *)      ;;
10707         esac
10708         case "$d_crypt_r_proto" in
10709         define)
10710         case "$crypt_r_proto" in
10711         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10712         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10713         esac
10714         case "$crypt_r_proto" in
10715         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10716         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10717         esac
10718         case "$crypt_r_proto" in
10719         ''|0)   d_crypt_r=undef
10720                 crypt_r_proto=0
10721                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10722         * )     case "$crypt_r_proto" in
10723                 REENTRANT_PROTO*) ;;
10724                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10725                 esac
10726                 echo "Prototype: $try" ;;
10727         esac
10728         ;;
10729         *)      case "$usethreads" in
10730                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10731                 esac
10732                 d_crypt_r=undef
10733                 crypt_r_proto=0
10734                 ;;
10735         esac
10736         ;;
10737 *)      crypt_r_proto=0
10738         ;;
10739 esac
10740
10741 : get csh whereabouts
10742 case "$csh" in
10743 'csh') val="$undef" ;;
10744 *) val="$define" ;;
10745 esac
10746 set d_csh
10747 eval $setvar
10748 : Respect a hint or command line value for full_csh.
10749 case "$full_csh" in
10750 '') full_csh=$csh ;;
10751 esac
10752
10753 : see if ctermid_r exists
10754 set ctermid_r d_ctermid_r
10755 eval $inlibc
10756 case "$d_ctermid_r" in
10757 "$define")
10758         hdrs="$i_systypes sys/types.h define stdio.h "
10759         case "$d_ctermid_r_proto:$usethreads" in
10760         ":define")      d_ctermid_r_proto=define
10761                 set d_ctermid_r_proto ctermid_r $hdrs
10762                 eval $hasproto ;;
10763         *)      ;;
10764         esac
10765         case "$d_ctermid_r_proto" in
10766         define)
10767         case "$ctermid_r_proto" in
10768         ''|0) try='char* ctermid_r(char*);'
10769         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10770         esac
10771         case "$ctermid_r_proto" in
10772         ''|0)   d_ctermid_r=undef
10773                 ctermid_r_proto=0
10774                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10775         * )     case "$ctermid_r_proto" in
10776                 REENTRANT_PROTO*) ;;
10777                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10778                 esac
10779                 echo "Prototype: $try" ;;
10780         esac
10781         ;;
10782         *)      case "$usethreads" in
10783                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10784                 esac
10785                 d_ctermid_r=undef
10786                 ctermid_r_proto=0
10787                 ;;
10788         esac
10789         ;;
10790 *)      ctermid_r_proto=0
10791         ;;
10792 esac
10793
10794 : see if ctime_r exists
10795 set ctime_r d_ctime_r
10796 eval $inlibc
10797 case "$d_ctime_r" in
10798 "$define")
10799         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10800         case "$d_ctime_r_proto:$usethreads" in
10801         ":define")      d_ctime_r_proto=define
10802                 set d_ctime_r_proto ctime_r $hdrs
10803                 eval $hasproto ;;
10804         *)      ;;
10805         esac
10806         case "$d_ctime_r_proto" in
10807         define)
10808         case "$ctime_r_proto" in
10809         ''|0) try='char* ctime_r(const time_t*, char*);'
10810         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10811         esac
10812         case "$ctime_r_proto" in
10813         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10814         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10815         esac
10816         case "$ctime_r_proto" in
10817         ''|0) try='int ctime_r(const time_t*, char*);'
10818         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10819         esac
10820         case "$ctime_r_proto" in
10821         ''|0) try='int ctime_r(const time_t*, char*, int);'
10822         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10823         esac
10824         case "$ctime_r_proto" in
10825         ''|0)   d_ctime_r=undef
10826                 ctime_r_proto=0
10827                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10828         * )     case "$ctime_r_proto" in
10829                 REENTRANT_PROTO*) ;;
10830                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10831                 esac
10832                 echo "Prototype: $try" ;;
10833         esac
10834         ;;
10835         *)      case "$usethreads" in
10836                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10837                 esac
10838                 d_ctime_r=undef
10839                 ctime_r_proto=0
10840                 ;;
10841         esac
10842         ;;
10843 *)      ctime_r_proto=0
10844         ;;
10845 esac
10846
10847 : see if cuserid exists
10848 set cuserid d_cuserid
10849 eval $inlibc
10850
10851 : see if this is a limits.h system
10852 set limits.h i_limits
10853 eval $inhdr
10854
10855 : see if this is a float.h system
10856 set float.h i_float
10857 eval $inhdr
10858
10859 : See if number of significant digits in a double precision number is known
10860 echo " "
10861 $cat >dbl_dig.c <<EOM
10862 #$i_limits I_LIMITS
10863 #$i_float I_FLOAT
10864 #ifdef I_LIMITS
10865 #include <limits.h>
10866 #endif
10867 #ifdef I_FLOAT
10868 #include <float.h>
10869 #endif
10870 #ifdef DBL_DIG
10871 printf("Contains DBL_DIG");
10872 #endif
10873 EOM
10874 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10875 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10876         echo "DBL_DIG found." >&4
10877         val="$define"
10878 else
10879         echo "DBL_DIG NOT found." >&4
10880         val="$undef"
10881 fi
10882 $rm -f dbl_dig.?
10883 set d_dbl_dig
10884 eval $setvar
10885
10886 : see if dbm.h is available
10887 : see if dbmclose exists
10888 set dbmclose d_dbmclose
10889 eval $inlibc
10890
10891 case "$d_dbmclose" in
10892 $define)
10893         set dbm.h i_dbm
10894         eval $inhdr
10895         case "$i_dbm" in
10896         $define)
10897                 val="$undef"
10898                 set i_rpcsvcdbm
10899                 eval $setvar
10900                 ;;
10901         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10902                 eval $inhdr
10903                 ;;
10904         esac
10905         ;;
10906 *)      echo "We won't be including <dbm.h>"
10907         val="$undef"
10908         set i_dbm
10909         eval $setvar
10910         val="$undef"
10911         set i_rpcsvcdbm
10912         eval $setvar
10913         ;;
10914 esac
10915
10916 : see if prototype for dbminit is available
10917 echo " "
10918 set d_dbminitproto dbminit $i_dbm dbm.h
10919 eval $hasproto
10920
10921 : see if difftime exists
10922 set difftime d_difftime
10923 eval $inlibc
10924
10925 : see if this is a dirent system
10926 echo " "
10927 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10928         val="$define"
10929         echo "<dirent.h> found." >&4
10930 else
10931         val="$undef"
10932         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10933                 echo "<sys/dir.h> found." >&4
10934                 echo " "
10935         else
10936                 xinc=`./findhdr sys/ndir.h`
10937         fi
10938         echo "<dirent.h> NOT found." >&4
10939 fi
10940 set i_dirent
10941 eval $setvar
10942
10943 : Look for type of directory structure.
10944 echo " "
10945 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10946
10947 case "$direntrytype" in
10948 ''|' ')
10949         case "$i_dirent" in
10950         $define) guess1='struct dirent' ;;
10951         *) guess1='struct direct'  ;;
10952         esac
10953         ;;
10954 *)      guess1="$direntrytype"
10955         ;;
10956 esac
10957
10958 case "$guess1" in
10959 'struct dirent') guess2='struct direct' ;;
10960 *) guess2='struct dirent' ;;
10961 esac
10962                 
10963 if $contains "$guess1" try.c >/dev/null 2>&1; then
10964         direntrytype="$guess1"
10965         echo "Your directory entries are $direntrytype." >&4
10966 elif $contains "$guess2" try.c >/dev/null 2>&1; then
10967         direntrytype="$guess2"
10968         echo "Your directory entries seem to be $direntrytype." >&4
10969 else
10970         echo "I don't recognize your system's directory entries." >&4
10971         rp="What type is used for directory entries on this system?"
10972         dflt="$guess1"
10973         . ./myread
10974         direntrytype="$ans"
10975 fi
10976 $rm -f try.c
10977
10978
10979 : see if the directory entry stores field length
10980 echo " "
10981 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10982 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10983         echo "Good, your directory entry keeps length information in d_namlen." >&4
10984         val="$define"
10985 else
10986         echo "Your directory entry does not know about the d_namlen field." >&4
10987         val="$undef"
10988 fi
10989 set d_dirnamlen
10990 eval $setvar
10991 $rm -f try.c
10992
10993 : see if this is an sysdir system
10994 set sys/dir.h i_sysdir
10995 eval $inhdr
10996
10997 : see if this is an sysndir system
10998 set sys/ndir.h i_sysndir
10999 eval $inhdr
11000
11001 : Look for dirfd
11002 echo " "
11003 $cat >dirfd.c <<EOM
11004 #include <stdio.h>
11005 #$i_stdlib I_STDLIB
11006 #ifdef I_STDLIB
11007 #include <stdlib.h>
11008 #endif
11009 #$i_dirent I_DIRENT             /**/
11010 #$i_sysdir I_SYS_DIR            /**/
11011 #$i_sysndir I_SYS_NDIR          /**/
11012 #$i_systypes I_SYS_TYPES        /**/
11013 #if defined(I_SYS_TYPES)
11014 #include <sys/types.h>
11015 #endif
11016 #if defined(I_DIRENT)
11017 #include <dirent.h>
11018 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11019 #include <sys/dir.h>
11020 #endif
11021 #else
11022 #ifdef I_SYS_NDIR
11023 #include <sys/ndir.h>
11024 #else
11025 #ifdef I_SYS_DIR
11026 #ifdef hp9000s500
11027 #include <ndir.h>       /* may be wrong in the future */
11028 #else
11029 #include <sys/dir.h>
11030 #endif
11031 #endif
11032 #endif
11033 #endif 
11034 int main() {
11035         DIR *dirp = opendir(".");
11036         if (dirfd(dirp) >= 0)
11037                 exit(0);
11038         else
11039                 exit(1);
11040 }
11041 EOM
11042 val=$undef
11043 set dirfd
11044 if eval $compile; then
11045         val="$define"
11046 fi
11047 case "$val" in
11048 $define)        echo "dirfd() found." >&4       ;;
11049 *)              echo "dirfd() NOT found." >&4   ;;
11050 esac
11051 set d_dirfd
11052 eval $setvar
11053 $rm -f dirfd*
11054
11055 : see if dlerror exists
11056 xxx_runnm="$runnm"
11057 runnm=false
11058 set dlerror d_dlerror
11059 eval $inlibc
11060 runnm="$xxx_runnm"
11061
11062 : see if dlfcn is available
11063 set dlfcn.h i_dlfcn
11064 eval $inhdr
11065
11066 case "$usedl" in
11067 $define|y|true)
11068         $cat << EOM
11069
11070 On a few systems, the dynamically loaded modules that perl generates and uses
11071 will need a different extension than shared libs. The default will probably
11072 be appropriate.
11073
11074 EOM
11075         case "$dlext" in
11076         '')     dflt="$so" ;;
11077         *)      dflt="$dlext" ;;
11078         esac
11079         rp='What is the extension of dynamically loaded modules'
11080         . ./myread
11081         dlext="$ans"
11082         ;;
11083 *)
11084         dlext="none"
11085         ;;
11086 esac
11087
11088 : Check if dlsym need a leading underscore
11089 echo " "
11090 val="$undef"
11091
11092 case "$dlsrc" in
11093 dl_dlopen.xs)
11094         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11095         $cat >dyna.c <<'EOM'
11096 fred () { }
11097 EOM
11098
11099 $cat >fred.c<<EOM
11100
11101 #include <stdio.h>
11102 #$i_stdlib I_STDLIB
11103 #ifdef I_STDLIB
11104 #include <stdlib.h>
11105 #endif
11106 #$i_dlfcn I_DLFCN
11107 #ifdef I_DLFCN
11108 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11109 #else
11110 #include <sys/types.h>
11111 #include <nlist.h>
11112 #include <link.h>
11113 #endif
11114
11115 extern int fred() ;
11116
11117 int main()
11118 {
11119     void * handle ;
11120     void * symbol ;
11121 #ifndef RTLD_LAZY
11122     int mode = 1 ;
11123 #else
11124     int mode = RTLD_LAZY ;
11125 #endif
11126     handle = dlopen("./dyna.$dlext", mode) ;
11127     if (handle == NULL) {
11128         printf ("1\n") ;
11129         fflush (stdout) ;
11130         exit(0);
11131     }
11132     symbol = dlsym(handle, "fred") ;
11133     if (symbol == NULL) {
11134         /* try putting a leading underscore */
11135         symbol = dlsym(handle, "_fred") ;
11136         if (symbol == NULL) {
11137             printf ("2\n") ;
11138             fflush (stdout) ;
11139             exit(0);
11140         }
11141         printf ("3\n") ;
11142     }
11143     else
11144         printf ("4\n") ;
11145     fflush (stdout) ;
11146     exit(0);
11147 }
11148 EOM
11149         : Call the object file tmp-dyna.o in case dlext=o.
11150         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
11151                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
11152                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
11153                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11154                 xxx=`$run ./fred`
11155                 case $xxx in
11156                 1)      echo "Test program failed using dlopen." >&4
11157                         echo "Perhaps you should not use dynamic loading." >&4;;
11158                 2)      echo "Test program failed using dlsym." >&4
11159                         echo "Perhaps you should not use dynamic loading." >&4;;
11160                 3)      echo "dlsym needs a leading underscore" >&4
11161                         val="$define" ;;
11162                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11163                 esac
11164         else
11165                 echo "I can't compile and run the test program." >&4
11166                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11167         fi
11168         ;;
11169 esac
11170                 
11171 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11172
11173 set d_dlsymun
11174 eval $setvar
11175
11176 : see if drand48_r exists
11177 set drand48_r d_drand48_r
11178 eval $inlibc
11179 case "$d_drand48_r" in
11180 "$define")
11181         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11182         case "$d_drand48_r_proto:$usethreads" in
11183         ":define")      d_drand48_r_proto=define
11184                 set d_drand48_r_proto drand48_r $hdrs
11185                 eval $hasproto ;;
11186         *)      ;;
11187         esac
11188         case "$d_drand48_r_proto" in
11189         define)
11190         case "$drand48_r_proto" in
11191         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11192         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11193         esac
11194         case "$drand48_r_proto" in
11195         ''|0)   d_drand48_r=undef
11196                 drand48_r_proto=0
11197                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11198         * )     case "$drand48_r_proto" in
11199                 REENTRANT_PROTO*) ;;
11200                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11201                 esac
11202                 echo "Prototype: $try" ;;
11203         esac
11204         ;;
11205         *)      case "$usethreads" in
11206                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11207                 esac
11208                 d_drand48_r=undef
11209                 drand48_r_proto=0
11210                 ;;
11211         esac
11212         ;;
11213 *)      drand48_r_proto=0
11214         ;;
11215 esac
11216
11217 : see if prototype for drand48 is available
11218 echo " "
11219 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11220 eval $hasproto
11221
11222 : see if dup2 exists
11223 set dup2 d_dup2
11224 eval $inlibc
11225
11226 : see if eaccess exists
11227 set eaccess d_eaccess
11228 eval $inlibc
11229
11230 : see if endgrent exists
11231 set endgrent d_endgrent
11232 eval $inlibc
11233
11234 : see if this is an grp system
11235 set grp.h i_grp
11236 eval $inhdr
11237
11238 case "$i_grp" in
11239 $define)
11240         xxx=`./findhdr grp.h`
11241         $cppstdin $cppflags $cppminus < $xxx >$$.h
11242
11243         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11244                 val="$define"
11245         else
11246                 val="$undef"
11247         fi
11248         set d_grpasswd
11249         eval $setvar
11250
11251         $rm -f $$.h
11252         ;;
11253 *)
11254         val="$undef";
11255         set d_grpasswd; eval $setvar
11256         ;;
11257 esac
11258
11259 : see if endgrent_r exists
11260 set endgrent_r d_endgrent_r
11261 eval $inlibc
11262 case "$d_endgrent_r" in
11263 "$define")
11264         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11265         case "$d_endgrent_r_proto:$usethreads" in
11266         ":define")      d_endgrent_r_proto=define
11267                 set d_endgrent_r_proto endgrent_r $hdrs
11268                 eval $hasproto ;;
11269         *)      ;;
11270         esac
11271         case "$d_endgrent_r_proto" in
11272         define)
11273         case "$endgrent_r_proto" in
11274         ''|0) try='int endgrent_r(FILE**);'
11275         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11276         esac
11277         case "$endgrent_r_proto" in
11278         ''|0) try='void endgrent_r(FILE**);'
11279         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11280         esac
11281         case "$endgrent_r_proto" in
11282         ''|0)   d_endgrent_r=undef
11283                 endgrent_r_proto=0
11284                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11285         * )     case "$endgrent_r_proto" in
11286                 REENTRANT_PROTO*) ;;
11287                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11288                 esac
11289                 echo "Prototype: $try" ;;
11290         esac
11291         ;;
11292         *)      case "$usethreads" in
11293                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11294                 esac
11295                 d_endgrent_r=undef
11296                 endgrent_r_proto=0
11297                 ;;
11298         esac
11299         ;;
11300 *)      endgrent_r_proto=0
11301         ;;
11302 esac
11303
11304 : see if endhostent exists
11305 set endhostent d_endhent
11306 eval $inlibc
11307
11308 : see if this is a netdb.h system
11309 set netdb.h i_netdb
11310 eval $inhdr
11311
11312 : see if endhostent_r exists
11313 set endhostent_r d_endhostent_r
11314 eval $inlibc
11315 case "$d_endhostent_r" in
11316 "$define")
11317         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11318         case "$d_endhostent_r_proto:$usethreads" in
11319         ":define")      d_endhostent_r_proto=define
11320                 set d_endhostent_r_proto endhostent_r $hdrs
11321                 eval $hasproto ;;
11322         *)      ;;
11323         esac
11324         case "$d_endhostent_r_proto" in
11325         define)
11326         case "$endhostent_r_proto" in
11327         ''|0) try='int endhostent_r(struct hostent_data*);'
11328         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11329         esac
11330         case "$endhostent_r_proto" in
11331         ''|0) try='void endhostent_r(struct hostent_data*);'
11332         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11333         esac
11334         case "$endhostent_r_proto" in
11335         ''|0)   d_endhostent_r=undef
11336                 endhostent_r_proto=0
11337                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11338         * )     case "$endhostent_r_proto" in
11339                 REENTRANT_PROTO*) ;;
11340                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11341                 esac
11342                 echo "Prototype: $try" ;;
11343         esac
11344         ;;
11345         *)      case "$usethreads" in
11346                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11347                 esac
11348                 d_endhostent_r=undef
11349                 endhostent_r_proto=0
11350                 ;;
11351         esac
11352         ;;
11353 *)      endhostent_r_proto=0
11354         ;;
11355 esac
11356
11357 : see if endnetent exists
11358 set endnetent d_endnent
11359 eval $inlibc
11360
11361 : see if endnetent_r exists
11362 set endnetent_r d_endnetent_r
11363 eval $inlibc
11364 case "$d_endnetent_r" in
11365 "$define")
11366         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11367         case "$d_endnetent_r_proto:$usethreads" in
11368         ":define")      d_endnetent_r_proto=define
11369                 set d_endnetent_r_proto endnetent_r $hdrs
11370                 eval $hasproto ;;
11371         *)      ;;
11372         esac
11373         case "$d_endnetent_r_proto" in
11374         define)
11375         case "$endnetent_r_proto" in
11376         ''|0) try='int endnetent_r(struct netent_data*);'
11377         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11378         esac
11379         case "$endnetent_r_proto" in
11380         ''|0) try='void endnetent_r(struct netent_data*);'
11381         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11382         esac
11383         case "$endnetent_r_proto" in
11384         ''|0)   d_endnetent_r=undef
11385                 endnetent_r_proto=0
11386                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11387         * )     case "$endnetent_r_proto" in
11388                 REENTRANT_PROTO*) ;;
11389                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11390                 esac
11391                 echo "Prototype: $try" ;;
11392         esac
11393         ;;
11394         *)      case "$usethreads" in
11395                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11396                 esac
11397                 d_endnetent_r=undef
11398                 endnetent_r_proto=0
11399                 ;;
11400         esac
11401         ;;
11402 *)      endnetent_r_proto=0
11403         ;;
11404 esac
11405
11406 : see if endprotoent exists
11407 set endprotoent d_endpent
11408 eval $inlibc
11409
11410 : see if endprotoent_r exists
11411 set endprotoent_r d_endprotoent_r
11412 eval $inlibc
11413 case "$d_endprotoent_r" in
11414 "$define")
11415         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11416         case "$d_endprotoent_r_proto:$usethreads" in
11417         ":define")      d_endprotoent_r_proto=define
11418                 set d_endprotoent_r_proto endprotoent_r $hdrs
11419                 eval $hasproto ;;
11420         *)      ;;
11421         esac
11422         case "$d_endprotoent_r_proto" in
11423         define)
11424         case "$endprotoent_r_proto" in
11425         ''|0) try='int endprotoent_r(struct protoent_data*);'
11426         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11427         esac
11428         case "$endprotoent_r_proto" in
11429         ''|0) try='void endprotoent_r(struct protoent_data*);'
11430         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11431         esac
11432         case "$endprotoent_r_proto" in
11433         ''|0)   d_endprotoent_r=undef
11434                 endprotoent_r_proto=0
11435                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11436         * )     case "$endprotoent_r_proto" in
11437                 REENTRANT_PROTO*) ;;
11438                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11439                 esac
11440                 echo "Prototype: $try" ;;
11441         esac
11442         ;;
11443         *)      case "$usethreads" in
11444                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11445                 esac
11446                 d_endprotoent_r=undef
11447                 endprotoent_r_proto=0
11448                 ;;
11449         esac
11450         ;;
11451 *)      endprotoent_r_proto=0
11452         ;;
11453 esac
11454
11455 : see if endpwent exists
11456 set endpwent d_endpwent
11457 eval $inlibc
11458
11459 : see if this is a pwd.h system
11460 set pwd.h i_pwd
11461 eval $inhdr
11462
11463 case "$i_pwd" in
11464 $define)
11465         xxx=`./findhdr pwd.h`
11466         $cppstdin $cppflags $cppminus < $xxx >$$.h
11467
11468         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11469                 val="$define"
11470         else
11471                 val="$undef"
11472         fi
11473         set d_pwquota
11474         eval $setvar
11475
11476         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11477                 val="$define"
11478         else
11479                 val="$undef"
11480         fi
11481         set d_pwage
11482         eval $setvar
11483
11484         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11485                 val="$define"
11486         else
11487                 val="$undef"
11488         fi
11489         set d_pwchange
11490         eval $setvar
11491
11492         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11493                 val="$define"
11494         else
11495                 val="$undef"
11496         fi
11497         set d_pwclass
11498         eval $setvar
11499
11500         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11501                 val="$define"
11502         else
11503                 val="$undef"
11504         fi
11505         set d_pwexpire
11506         eval $setvar
11507
11508         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11509                 val="$define"
11510         else
11511                 val="$undef"
11512         fi
11513         set d_pwcomment
11514         eval $setvar
11515
11516         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11517                 val="$define"
11518         else
11519                 val="$undef"
11520         fi
11521         set d_pwgecos
11522         eval $setvar
11523
11524         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11525                 val="$define"
11526         else
11527                 val="$undef"
11528         fi
11529         set d_pwpasswd
11530         eval $setvar
11531
11532         $rm -f $$.h
11533         ;;
11534 *)
11535         val="$undef"; 
11536         set d_pwquota; eval $setvar
11537         set d_pwage; eval $setvar
11538         set d_pwchange; eval $setvar
11539         set d_pwclass; eval $setvar
11540         set d_pwexpire; eval $setvar
11541         set d_pwcomment; eval $setvar
11542         set d_pwgecos; eval $setvar
11543         set d_pwpasswd; eval $setvar
11544         ;;
11545 esac
11546
11547 : see if endpwent_r exists
11548 set endpwent_r d_endpwent_r
11549 eval $inlibc
11550 case "$d_endpwent_r" in
11551 "$define")
11552         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11553         case "$d_endpwent_r_proto:$usethreads" in
11554         ":define")      d_endpwent_r_proto=define
11555                 set d_endpwent_r_proto endpwent_r $hdrs
11556                 eval $hasproto ;;
11557         *)      ;;
11558         esac
11559         case "$d_endpwent_r_proto" in
11560         define)
11561         case "$endpwent_r_proto" in
11562         ''|0) try='int endpwent_r(FILE**);'
11563         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11564         esac
11565         case "$endpwent_r_proto" in
11566         ''|0) try='void endpwent_r(FILE**);'
11567         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11568         esac
11569         case "$endpwent_r_proto" in
11570         ''|0)   d_endpwent_r=undef
11571                 endpwent_r_proto=0
11572                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
11573         * )     case "$endpwent_r_proto" in
11574                 REENTRANT_PROTO*) ;;
11575                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11576                 esac
11577                 echo "Prototype: $try" ;;
11578         esac
11579         ;;
11580         *)      case "$usethreads" in
11581                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11582                 esac
11583                 d_endpwent_r=undef
11584                 endpwent_r_proto=0
11585                 ;;
11586         esac
11587         ;;
11588 *)      endpwent_r_proto=0
11589         ;;
11590 esac
11591
11592 : see if endservent exists
11593 set endservent d_endsent
11594 eval $inlibc
11595
11596 : see if endservent_r exists
11597 set endservent_r d_endservent_r
11598 eval $inlibc
11599 case "$d_endservent_r" in
11600 "$define")
11601         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11602         case "$d_endservent_r_proto:$usethreads" in
11603         ":define")      d_endservent_r_proto=define
11604                 set d_endservent_r_proto endservent_r $hdrs
11605                 eval $hasproto ;;
11606         *)      ;;
11607         esac
11608         case "$d_endservent_r_proto" in
11609         define)
11610         case "$endservent_r_proto" in
11611         ''|0) try='int endservent_r(struct servent_data*);'
11612         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
11613         esac
11614         case "$endservent_r_proto" in
11615         ''|0) try='void endservent_r(struct servent_data*);'
11616         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
11617         esac
11618         case "$endservent_r_proto" in
11619         ''|0)   d_endservent_r=undef
11620                 endservent_r_proto=0
11621                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
11622         * )     case "$endservent_r_proto" in
11623                 REENTRANT_PROTO*) ;;
11624                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11625                 esac
11626                 echo "Prototype: $try" ;;
11627         esac
11628         ;;
11629         *)      case "$usethreads" in
11630                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11631                 esac
11632                 d_endservent_r=undef
11633                 endservent_r_proto=0
11634                 ;;
11635         esac
11636         ;;
11637 *)      endservent_r_proto=0
11638         ;;
11639 esac
11640
11641 : Locate the flags for 'open()'
11642 echo " "
11643 $cat >try.c <<EOCP
11644 #include <sys/types.h>
11645 #ifdef I_FCNTL
11646 #include <fcntl.h>
11647 #endif
11648 #ifdef I_SYS_FILE
11649 #include <sys/file.h>
11650 #endif
11651 #$i_stdlib I_STDLIB
11652 #ifdef I_STDLIB
11653 #include <stdlib.h>
11654 #endif
11655 int main() {
11656         if(O_RDONLY);
11657 #ifdef O_TRUNC
11658         exit(0);
11659 #else
11660         exit(1);
11661 #endif
11662 }
11663 EOCP
11664 : check sys/file.h first to get FREAD on Sun
11665 if $test `./findhdr sys/file.h` && \
11666                 set try -DI_SYS_FILE && eval $compile; then
11667         h_sysfile=true;
11668         echo "<sys/file.h> defines the O_* constants..." >&4
11669         if $run ./try; then
11670                 echo "and you have the 3 argument form of open()." >&4
11671                 val="$define"
11672         else
11673                 echo "but not the 3 argument form of open().  Oh, well." >&4
11674                 val="$undef"
11675         fi
11676 elif $test `./findhdr fcntl.h` && \
11677                 set try -DI_FCNTL && eval $compile; then
11678         h_fcntl=true;
11679         echo "<fcntl.h> defines the O_* constants..." >&4
11680         if $run ./try; then
11681                 echo "and you have the 3 argument form of open()." >&4
11682                 val="$define"
11683         else
11684                 echo "but not the 3 argument form of open().  Oh, well." >&4
11685                 val="$undef"
11686         fi
11687 else
11688         val="$undef"
11689         echo "I can't find the O_* constant definitions!  You got problems." >&4
11690 fi
11691 set d_open3
11692 eval $setvar
11693 $rm -f try try.*
11694
11695 : see which of string.h or strings.h is needed
11696 echo " "
11697 strings=`./findhdr string.h`
11698 if $test "$strings" && $test -r "$strings"; then
11699         echo "Using <string.h> instead of <strings.h>." >&4
11700         val="$define"
11701 else
11702         val="$undef"
11703         strings=`./findhdr strings.h`
11704         if $test "$strings" && $test -r "$strings"; then
11705                 echo "Using <strings.h> instead of <string.h>." >&4
11706         else
11707                 echo "No string header found -- You'll surely have problems." >&4
11708         fi
11709 fi
11710 set i_string
11711 eval $setvar
11712 case "$i_string" in
11713 "$undef") strings=`./findhdr strings.h`;;
11714 *)        strings=`./findhdr string.h`;;
11715 esac
11716
11717 : see if this is a sys/file.h system
11718 val=''
11719 set sys/file.h val
11720 eval $inhdr
11721
11722 : do we need to include sys/file.h ?
11723 case "$val" in
11724 "$define")
11725         echo " "
11726         if $h_sysfile; then
11727                 val="$define"
11728                 echo "We'll be including <sys/file.h>." >&4
11729         else
11730                 val="$undef"
11731                 echo "We won't be including <sys/file.h>." >&4
11732         fi
11733         ;;
11734 *)
11735         h_sysfile=false
11736         ;;
11737 esac
11738 set i_sysfile
11739 eval $setvar
11740
11741 : see if fcntl.h is there
11742 val=''
11743 set fcntl.h val
11744 eval $inhdr
11745
11746 : see if we can include fcntl.h
11747 case "$val" in
11748 "$define")
11749         echo " "
11750         if $h_fcntl; then
11751                 val="$define"
11752                 echo "We'll be including <fcntl.h>." >&4
11753         else
11754                 val="$undef"
11755                 if $h_sysfile; then
11756         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11757                 else
11758                         echo "We won't be including <fcntl.h>." >&4
11759                 fi
11760         fi
11761         ;;
11762 *)
11763         h_fcntl=false
11764         val="$undef"
11765         ;;
11766 esac
11767 set i_fcntl
11768 eval $setvar
11769
11770 : check for non-blocking I/O stuff
11771 case "$h_sysfile" in
11772 true) echo "#include <sys/file.h>" > head.c;;
11773 *)
11774        case "$h_fcntl" in
11775        true) echo "#include <fcntl.h>" > head.c;;
11776        *) echo "#include <sys/fcntl.h>" > head.c;;
11777        esac
11778        ;;
11779 esac
11780 echo " "
11781 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11782 case "$o_nonblock" in
11783 '')
11784         $cat head.c > try.c
11785         $cat >>try.c <<EOCP
11786 #include <stdio.h>
11787 #$i_stdlib I_STDLIB
11788 #ifdef I_STDLIB
11789 #include <stdlib.h>
11790 #endif
11791 #$i_fcntl I_FCNTL
11792 #ifdef I_FCNTL
11793 #include <fcntl.h>
11794 #endif
11795 int main() {
11796 #ifdef O_NONBLOCK
11797         printf("O_NONBLOCK\n");
11798         exit(0);
11799 #endif
11800 #ifdef O_NDELAY
11801         printf("O_NDELAY\n");
11802         exit(0);
11803 #endif
11804 #ifdef FNDELAY
11805         printf("FNDELAY\n");
11806         exit(0);
11807 #endif
11808         exit(0);
11809 }
11810 EOCP
11811         set try
11812         if eval $compile_ok; then
11813                 o_nonblock=`$run ./try`
11814                 case "$o_nonblock" in
11815                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11816                 *) echo "Seems like we can use $o_nonblock.";;
11817                 esac
11818         else
11819                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11820         fi
11821         ;;
11822 *) echo "Using $hint value $o_nonblock.";;
11823 esac
11824 $rm -f try try.* .out core
11825
11826 echo " "
11827 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11828 case "$eagain" in
11829 '')
11830         $cat head.c > try.c
11831         $cat >>try.c <<EOCP
11832 #include <errno.h>
11833 #include <sys/types.h>
11834 #include <signal.h>
11835 #include <stdio.h> 
11836 #$i_stdlib I_STDLIB
11837 #ifdef I_STDLIB
11838 #include <stdlib.h>
11839 #endif
11840 #$i_fcntl I_FCNTL
11841 #ifdef I_FCNTL
11842 #include <fcntl.h>
11843 #endif
11844 #define MY_O_NONBLOCK $o_nonblock
11845 #ifndef errno  /* XXX need better Configure test */
11846 extern int errno;
11847 #endif
11848 #$i_unistd I_UNISTD
11849 #ifdef I_UNISTD
11850 #include <unistd.h>
11851 #endif
11852 #$i_string I_STRING
11853 #ifdef I_STRING
11854 #include <string.h>
11855 #else
11856 #include <strings.h>
11857 #endif
11858 $signal_t blech(x) int x; { exit(3); }
11859 EOCP
11860         $cat >> try.c <<'EOCP'
11861 int main()
11862 {
11863         int pd[2];
11864         int pu[2];
11865         char buf[1];
11866         char string[100];
11867
11868         pipe(pd);       /* Down: child -> parent */
11869         pipe(pu);       /* Up: parent -> child */
11870         if (0 != fork()) {
11871                 int ret;
11872                 close(pd[1]);   /* Parent reads from pd[0] */
11873                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11874 #ifdef F_SETFL
11875                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11876                         exit(1);
11877 #else
11878                 exit(4);
11879 #endif
11880                 signal(SIGALRM, blech);
11881                 alarm(5);
11882                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11883                         exit(2);
11884                 sprintf(string, "%d\n", ret);
11885                 write(2, string, strlen(string));
11886                 alarm(0);
11887 #ifdef EAGAIN
11888                 if (errno == EAGAIN) {
11889                         printf("EAGAIN\n");
11890                         goto ok;
11891                 }
11892 #endif
11893 #ifdef EWOULDBLOCK
11894                 if (errno == EWOULDBLOCK)
11895                         printf("EWOULDBLOCK\n");
11896 #endif
11897         ok:
11898                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11899                 sleep(2);                               /* Give it time to close our pipe */
11900                 alarm(5);
11901                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11902                 alarm(0);
11903                 sprintf(string, "%d\n", ret);
11904                 write(4, string, strlen(string));
11905                 exit(0);
11906         }
11907
11908         close(pd[0]);                   /* We write to pd[1] */
11909         close(pu[1]);                   /* We read from pu[0] */
11910         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11911         close(pd[1]);                   /* Pipe pd is now fully closed! */
11912         exit(0);                                /* Bye bye, thank you for playing! */
11913 }
11914 EOCP
11915         set try
11916         if eval $compile_ok; then
11917                 echo "$startsh" >mtry
11918                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11919                 chmod +x mtry
11920                 ./mtry >/dev/null 2>&1
11921                 case $? in
11922                 0) eagain=`$cat try.out`;;
11923                 1) echo "Could not perform non-blocking setting!";;
11924                 2) echo "I did a successful read() for something that was not there!";;
11925                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
11926                 4) echo "Could not find F_SETFL!";;
11927                 *) echo "Something terribly wrong happened during testing.";;
11928                 esac
11929                 rd_nodata=`$cat try.ret`
11930                 echo "A read() system call with no data present returns $rd_nodata."
11931                 case "$rd_nodata" in
11932                 0|-1) ;;
11933                 *)
11934                         echo "(That's peculiar, fixing that to be -1.)"
11935                         rd_nodata=-1
11936                         ;;
11937                 esac
11938                 case "$eagain" in
11939                 '')
11940                         echo "Forcing errno EAGAIN on read() with no data available."
11941                         eagain=EAGAIN
11942                         ;;
11943                 *)
11944                         echo "Your read() sets errno to $eagain when no data is available."
11945                         ;;
11946                 esac
11947                 status=`$cat try.err`
11948                 case "$status" in
11949                 0) echo "And it correctly returns 0 to signal EOF.";;
11950                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11951                 *) echo "However, your read() returns '$status' on EOF??";;
11952                 esac
11953                 val="$define"
11954                 if test "$status" = "$rd_nodata"; then
11955                         echo "WARNING: you can't distinguish between EOF and no data!"
11956                         val="$undef"
11957                 fi
11958         else
11959                 echo "I can't compile the test program--assuming errno EAGAIN will do."
11960                 eagain=EAGAIN
11961         fi
11962         set d_eofnblk
11963         eval $setvar
11964         ;;
11965 *)
11966         echo "Using $hint value $eagain."
11967         echo "Your read() returns $rd_nodata when no data is present."
11968         case "$d_eofnblk" in
11969         "$define") echo "And you can see EOF because read() returns 0.";;
11970         "$undef") echo "But you can't see EOF status from read() returned value.";;
11971         *)
11972                 echo "(Assuming you can't see EOF status from read anyway.)"
11973                 d_eofnblk=$undef
11974                 ;;
11975         esac
11976         ;;
11977 esac
11978 $rm -f try try.* .out core head.c mtry
11979
11980 : see if _ptr and _cnt from stdio act std
11981 echo " "
11982
11983 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11984         echo "(Looks like you have stdio.h from BSD.)"
11985         case "$stdio_ptr" in
11986         '') stdio_ptr='((fp)->_p)'
11987                 ptr_lval=$define
11988                 ;;
11989         *)      ptr_lval=$d_stdio_ptr_lval;;
11990         esac
11991         case "$stdio_cnt" in
11992         '') stdio_cnt='((fp)->_r)'
11993                 cnt_lval=$define
11994                 ;;
11995         *)      cnt_lval=$d_stdio_cnt_lval;;
11996         esac
11997         case "$stdio_base" in
11998         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
11999         esac
12000         case "$stdio_bufsiz" in
12001         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12002         esac
12003 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12004         echo "(Looks like you have stdio.h from Linux.)"
12005         case "$stdio_ptr" in
12006         '') stdio_ptr='((fp)->_IO_read_ptr)'
12007                 ptr_lval=$define
12008                 ;;
12009         *)      ptr_lval=$d_stdio_ptr_lval;;
12010         esac
12011         case "$stdio_cnt" in
12012         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12013                 cnt_lval=$undef
12014                 ;;
12015         *)      cnt_lval=$d_stdio_cnt_lval;;
12016         esac
12017         case "$stdio_base" in
12018         '') stdio_base='((fp)->_IO_read_base)';;
12019         esac
12020         case "$stdio_bufsiz" in
12021         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12022         esac
12023 else
12024         case "$stdio_ptr" in
12025         '') stdio_ptr='((fp)->_ptr)'
12026                 ptr_lval=$define
12027                 ;;
12028         *)      ptr_lval=$d_stdio_ptr_lval;;
12029         esac
12030         case "$stdio_cnt" in
12031         '') stdio_cnt='((fp)->_cnt)'
12032                 cnt_lval=$define
12033                 ;;
12034         *)      cnt_lval=$d_stdio_cnt_lval;;
12035         esac
12036         case "$stdio_base" in
12037         '') stdio_base='((fp)->_base)';;
12038         esac
12039         case "$stdio_bufsiz" in
12040         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12041         esac
12042 fi
12043
12044 : test whether _ptr and _cnt really work
12045 echo "Checking how std your stdio is..." >&4
12046 $cat >try.c <<EOP
12047 #include <stdio.h>
12048 #$i_stdlib I_STDLIB
12049 #ifdef I_STDLIB
12050 #include <stdlib.h>
12051 #endif
12052 #define FILE_ptr(fp)    $stdio_ptr
12053 #define FILE_cnt(fp)    $stdio_cnt
12054 int main() {
12055         FILE *fp = fopen("try.c", "r");
12056         char c = getc(fp);
12057         if (
12058                 18 <= FILE_cnt(fp) &&
12059                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12060         )
12061                 exit(0);
12062         exit(1);
12063 }
12064 EOP
12065 val="$undef"
12066 set try
12067 if eval $compile && $to try.c; then
12068         if $run ./try; then
12069                 echo "Your stdio acts pretty std."
12070                 val="$define"
12071         else
12072                 echo "Your stdio isn't very std."
12073         fi
12074 else
12075         echo "Your stdio doesn't appear very std."
12076 fi
12077 $rm -f try.c try
12078
12079 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12080 # direct buffer manipulation no longer works.  The Configure tests
12081 # should be changed to correctly detect this, but until then,
12082 # the following check should at least let perl compile and run.
12083 # (This quick fix should be updated before 5.8.1.)
12084 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12085 # A. Dougherty, June 3, 2002.
12086 case "$d_gnulibc" in
12087 $define)
12088         case "$gnulibc_version" in
12089         2.[01]*)  ;;
12090         2.2) ;;
12091         2.2.[0-9]) ;;
12092         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12093                 val="$undef"
12094                 ;;
12095         esac
12096         ;;
12097 esac
12098 set d_stdstdio
12099 eval $setvar
12100
12101 : Can _ptr be used as an lvalue?
12102 case "$d_stdstdio$ptr_lval" in
12103 $define$define) val=$define ;;
12104 *) val=$undef ;;
12105 esac
12106 set d_stdio_ptr_lval
12107 eval $setvar
12108
12109 : Can _cnt be used as an lvalue?
12110 case "$d_stdstdio$cnt_lval" in
12111 $define$define) val=$define ;;
12112 *) val=$undef ;;
12113 esac
12114 set d_stdio_cnt_lval
12115 eval $setvar
12116
12117
12118 : test whether setting _ptr sets _cnt as a side effect
12119 d_stdio_ptr_lval_sets_cnt="$undef"
12120 d_stdio_ptr_lval_nochange_cnt="$undef"
12121 case "$d_stdio_ptr_lval$d_stdstdio" in
12122 $define$define)
12123         echo "Checking to see what happens if we set the stdio ptr..." >&4
12124 $cat >try.c <<EOP
12125 #include <stdio.h>
12126 /* Can we scream? */
12127 /* Eat dust sed :-) */
12128 /* In the buffer space, no one can hear you scream. */
12129 #$i_stdlib I_STDLIB
12130 #ifdef I_STDLIB
12131 #include <stdlib.h>
12132 #endif
12133 #define FILE_ptr(fp)    $stdio_ptr
12134 #define FILE_cnt(fp)    $stdio_cnt
12135 #include <sys/types.h>
12136 int main() {
12137         FILE *fp = fopen("try.c", "r");
12138         int c;
12139         char *ptr;
12140         size_t cnt;
12141         if (!fp) {
12142             puts("Fail even to read");
12143             exit(1);
12144         }
12145         c = getc(fp); /* Read away the first # */
12146         if (c == EOF) {
12147             puts("Fail even to read");
12148             exit(1);
12149         }
12150         if (!(
12151                 18 <= FILE_cnt(fp) &&
12152                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12153         )) {
12154                 puts("Fail even to read");
12155                 exit (1);
12156         }
12157         ptr = (char*) FILE_ptr(fp);
12158         cnt = (size_t)FILE_cnt(fp);
12159
12160         FILE_ptr(fp) += 42;
12161
12162         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12163                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12164                 exit (1);
12165         }
12166         if (FILE_cnt(fp) <= 20) {
12167                 printf ("Fail (<20 chars to test)");
12168                 exit (1);
12169         }
12170         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12171                 puts("Fail compare");
12172                 exit (1);
12173         }
12174         if (cnt == FILE_cnt(fp)) {
12175                 puts("Pass_unchanged");
12176                 exit (0);
12177         }       
12178         if (FILE_cnt(fp) == (cnt - 42)) {
12179                 puts("Pass_changed");
12180                 exit (0);
12181         }
12182         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12183         return 1;
12184
12185 }
12186 EOP
12187         set try
12188         if eval $compile && $to try.c; then
12189                 case `$run ./try` in
12190                 Pass_changed)
12191                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12192                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12193                 Pass_unchanged)
12194                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12195                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12196                 Fail*)
12197                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12198                 *)
12199                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12200         esac
12201         else
12202                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12203         fi
12204         $rm -f try.c try
12205         ;;
12206 esac
12207
12208 : see if _base is also standard
12209 val="$undef"
12210 case "$d_stdstdio" in
12211 $define)
12212         $cat >try.c <<EOP
12213 #include <stdio.h>
12214 #$i_stdlib I_STDLIB
12215 #ifdef I_STDLIB
12216 #include <stdlib.h>
12217 #endif
12218 #define FILE_base(fp)   $stdio_base
12219 #define FILE_bufsiz(fp) $stdio_bufsiz
12220 int main() {
12221         FILE *fp = fopen("try.c", "r");
12222         char c = getc(fp);
12223         if (
12224                 19 <= FILE_bufsiz(fp) &&
12225                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12226         )
12227                 exit(0);
12228         exit(1);
12229 }
12230 EOP
12231         set try
12232         if eval $compile && $to try.c; then
12233                 if $run ./try; then
12234                         echo "And its _base field acts std."
12235                         val="$define"
12236                 else
12237                         echo "But its _base field isn't std."
12238                 fi
12239         else
12240                 echo "However, it seems to be lacking the _base field."
12241         fi
12242         $rm -f try.c try
12243         ;;
12244 esac
12245 set d_stdiobase
12246 eval $setvar
12247
12248 : see if fast_stdio exists
12249 val="$undef"
12250 case "$d_stdstdio:$d_stdio_ptr_lval" in
12251 "$define:$define")
12252         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12253         *$define*)
12254                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12255                 val="$define"
12256                 ;;
12257         esac
12258         ;;
12259 esac
12260 set d_faststdio
12261 eval $setvar
12262
12263
12264
12265 : see if fchdir exists
12266 set fchdir d_fchdir
12267 eval $inlibc
12268
12269 : see if fchmod exists
12270 set fchmod d_fchmod
12271 eval $inlibc
12272
12273 : see if fchown exists
12274 set fchown d_fchown
12275 eval $inlibc
12276
12277 : see if this is an fcntl system
12278 set fcntl d_fcntl
12279 eval $inlibc
12280
12281 echo " "
12282 : See if fcntl-based locking works.
12283 $cat >try.c <<EOCP
12284 #$i_stdlib I_STDLIB
12285 #ifdef I_STDLIB
12286 #include <stdlib.h>
12287 #endif
12288 #include <unistd.h>
12289 #include <fcntl.h>
12290 #include <signal.h>
12291 $signal_t blech(x) int x; { exit(3); }
12292 int main() {
12293 #if defined(F_SETLK) && defined(F_SETLKW)
12294      struct flock flock;
12295      int retval, fd;
12296      fd = open("try.c", O_RDONLY);
12297      flock.l_type = F_RDLCK;
12298      flock.l_whence = SEEK_SET;
12299      flock.l_start = flock.l_len = 0;
12300      signal(SIGALRM, blech);
12301      alarm(10);
12302      retval = fcntl(fd, F_SETLK, &flock);
12303      close(fd);
12304      (retval < 0 ? exit(2) : exit(0));
12305 #else
12306      exit(2);
12307 #endif
12308 }
12309 EOCP
12310 echo "Checking if fcntl-based file locking works... "
12311 case "$d_fcntl" in
12312 "$define")
12313         set try
12314         if eval $compile_ok; then
12315                 if $run ./try; then
12316                         echo "Yes, it seems to work."
12317                         val="$define"
12318                 else
12319                         echo "Nope, it didn't work."
12320                         val="$undef"
12321                         case "$?" in
12322                         3) $cat >&4 <<EOM
12323 ***
12324 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12325 *** This is (almost) impossible.
12326 *** If your NFS lock daemons are not feeling well, something like
12327 *** this may happen, please investigate.  Cannot continue, aborting.
12328 ***
12329 EOM
12330                                 exit 1
12331                                 ;;
12332                         esac
12333                 fi
12334         else
12335                 echo "I'm unable to compile the test program, so I'll assume not."
12336                 val="$undef"
12337         fi
12338         ;;
12339 *) val="$undef";
12340         echo "Nope, since you don't even have fcntl()."
12341         ;;
12342 esac
12343 set d_fcntl_can_lock
12344 eval $setvar
12345 $rm -f try*
12346
12347
12348 : check for fd_set items
12349 $cat <<EOM
12350
12351 Checking to see how well your C compiler handles fd_set and friends ...
12352 EOM
12353 $cat >try.c <<EOCP
12354 #$i_stdlib I_STDLIB
12355 #ifdef I_STDLIB
12356 #include <stdlib.h>
12357 #endif
12358 #$i_systime I_SYS_TIME
12359 #$i_sysselct I_SYS_SELECT
12360 #$d_socket HAS_SOCKET
12361 #include <sys/types.h>
12362 #ifdef HAS_SOCKET
12363 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12364 #endif
12365 #ifdef I_SYS_TIME
12366 #include <sys/time.h>
12367 #endif
12368 #ifdef I_SYS_SELECT
12369 #include <sys/select.h>
12370 #endif
12371 int main() {
12372         fd_set fds;
12373
12374 #ifdef TRYBITS
12375         if(fds.fds_bits);
12376 #endif
12377
12378 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12379         exit(0);
12380 #else
12381         exit(1);
12382 #endif
12383 }
12384 EOCP
12385 set try -DTRYBITS
12386 if eval $compile; then
12387         d_fds_bits="$define"
12388         d_fd_set="$define"
12389         echo "Well, your system knows about the normal fd_set typedef..." >&4
12390         if $run ./try; then
12391                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12392                 d_fd_macros="$define"
12393         else
12394                 $cat >&4 <<'EOM'
12395 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12396 EOM
12397                 d_fd_macros="$undef"
12398         fi
12399 else
12400         $cat <<'EOM'
12401 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12402 EOM
12403         set try
12404         if eval $compile; then
12405                 d_fds_bits="$undef"
12406                 d_fd_set="$define"
12407                 echo "Well, your system has some sort of fd_set available..." >&4
12408                 if $run ./try; then
12409                         echo "and you have the normal fd_set macros." >&4
12410                         d_fd_macros="$define"
12411                 else
12412                         $cat <<'EOM'
12413 but not the normal fd_set macros!  Gross!  More work for me...
12414 EOM
12415                         d_fd_macros="$undef"
12416                 fi
12417         else
12418         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
12419                 d_fd_set="$undef"
12420                 d_fds_bits="$undef"
12421                 d_fd_macros="$undef"
12422         fi
12423 fi
12424 $rm -f try try.*
12425
12426 : see if fgetpos exists
12427 set fgetpos d_fgetpos
12428 eval $inlibc
12429
12430 : see if finite exists
12431 set finite d_finite
12432 eval $inlibc
12433
12434 : see if finitel exists
12435 set finitel d_finitel
12436 eval $inlibc
12437
12438 : see if flock exists
12439 set flock d_flock
12440 eval $inlibc
12441
12442 : see if prototype for flock is available
12443 echo " "
12444 set d_flockproto flock $i_sysfile sys/file.h
12445 eval $hasproto
12446
12447 : see if fork exists
12448 set fork d_fork
12449 eval $inlibc
12450
12451 : see if fp_class exists
12452 set fp_class d_fp_class
12453 eval $inlibc
12454
12455 : see if pathconf exists
12456 set pathconf d_pathconf
12457 eval $inlibc
12458
12459 : see if fpathconf exists
12460 set fpathconf d_fpathconf
12461 eval $inlibc
12462
12463 : see if fpclass exists
12464 set fpclass d_fpclass
12465 eval $inlibc
12466
12467 : see if fpclassify exists
12468 set fpclassify d_fpclassify
12469 eval $inlibc
12470
12471 : see if fpclassl exists
12472 set fpclassl d_fpclassl
12473 eval $inlibc
12474
12475
12476 : check for fpos64_t
12477 echo " "
12478 echo "Checking to see if you have fpos64_t..." >&4
12479 $cat >try.c <<EOCP
12480 #include <stdio.h>
12481 int main() { fpos64_t x = 7; }
12482 EOCP
12483 set try
12484 if eval $compile; then
12485         val="$define"
12486         echo "You have fpos64_t."
12487 else
12488         val="$undef"
12489         echo "You do not have fpos64_t."
12490         case "$fpossize" in
12491         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12492         esac
12493 fi
12494 $rm -f try.* try
12495 set d_fpos64_t
12496 eval $setvar
12497
12498 : see if frexpl exists
12499 set frexpl d_frexpl
12500 eval $inlibc
12501
12502 : see if this is a sys/param system
12503 set sys/param.h i_sysparam
12504 eval $inhdr
12505
12506 : see if this is a sys/mount.h system
12507 set sys/mount.h i_sysmount
12508 eval $inhdr
12509
12510
12511 echo " "
12512 echo "Checking to see if your system supports struct fs_data..." >&4
12513 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12514 eval $hasstruct
12515 case "$d_fs_data_s" in
12516 "$define")      echo "Yes, it does."   ;;
12517 *)              echo "No, it doesn't." ;;
12518 esac
12519
12520 : see if fseeko exists
12521 set fseeko d_fseeko
12522 eval $inlibc
12523 case "$longsize" in
12524 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12525 esac
12526
12527 : see if fsetpos exists
12528 set fsetpos d_fsetpos
12529 eval $inlibc
12530
12531
12532 : see if fstatfs exists
12533 set fstatfs d_fstatfs
12534 eval $inlibc
12535
12536
12537 : see if statvfs exists
12538 set statvfs d_statvfs
12539 eval $inlibc
12540
12541 : see if fstatvfs exists
12542 set fstatvfs d_fstatvfs
12543 eval $inlibc
12544
12545
12546 : see if fsync exists
12547 set fsync d_fsync
12548 eval $inlibc
12549
12550 : see if ftello exists
12551 set ftello d_ftello
12552 eval $inlibc
12553 case "$longsize" in
12554 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12555 esac
12556
12557 : see if getcwd exists
12558 set getcwd d_getcwd
12559 eval $inlibc
12560
12561 : see if getespwnam exists
12562 set getespwnam d_getespwnam
12563 eval $inlibc
12564
12565
12566 : see if getfsstat exists
12567 set getfsstat d_getfsstat
12568 eval $inlibc
12569
12570 : see if getgrent exists
12571 set getgrent d_getgrent
12572 eval $inlibc
12573
12574 : see if getgrent_r exists
12575 set getgrent_r d_getgrent_r
12576 eval $inlibc
12577 case "$d_getgrent_r" in
12578 "$define")
12579         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12580         case "$d_getgrent_r_proto:$usethreads" in
12581         ":define")      d_getgrent_r_proto=define
12582                 set d_getgrent_r_proto getgrent_r $hdrs
12583                 eval $hasproto ;;
12584         *)      ;;
12585         esac
12586         case "$d_getgrent_r_proto" in
12587         define)
12588         case "$getgrent_r_proto" in
12589         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
12590         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
12591         esac
12592         case "$getgrent_r_proto" in
12593         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
12594         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
12595         esac
12596         case "$getgrent_r_proto" in
12597         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12598         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12599         esac
12600         case "$getgrent_r_proto" in
12601         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12602         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12603         esac
12604         case "$getgrent_r_proto" in
12605         ''|0) try='int getgrent_r(struct group*, char*, int);'
12606         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12607         esac
12608         case "$getgrent_r_proto" in
12609         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12610         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12611         esac
12612         case "$getgrent_r_proto" in
12613         ''|0)   d_getgrent_r=undef
12614                 getgrent_r_proto=0
12615                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
12616         * )     case "$getgrent_r_proto" in
12617                 REENTRANT_PROTO*) ;;
12618                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12619                 esac
12620                 echo "Prototype: $try" ;;
12621         esac
12622         ;;
12623         *)      case "$usethreads" in
12624                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12625                 esac
12626                 d_getgrent_r=undef
12627                 getgrent_r_proto=0
12628                 ;;
12629         esac
12630         ;;
12631 *)      getgrent_r_proto=0
12632         ;;
12633 esac
12634
12635 : see if getgrgid_r exists
12636 set getgrgid_r d_getgrgid_r
12637 eval $inlibc
12638 case "$d_getgrgid_r" in
12639 "$define")
12640         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12641         case "$d_getgrgid_r_proto:$usethreads" in
12642         ":define")      d_getgrgid_r_proto=define
12643                 set d_getgrgid_r_proto getgrgid_r $hdrs
12644                 eval $hasproto ;;
12645         *)      ;;
12646         esac
12647         case "$d_getgrgid_r_proto" in
12648         define)
12649         case "$getgrgid_r_proto" in
12650         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12651         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12652         esac
12653         case "$getgrgid_r_proto" in
12654         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12655         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12656         esac
12657         case "$getgrgid_r_proto" in
12658         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12659         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12660         esac
12661         case "$getgrgid_r_proto" in
12662         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12663         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12664         esac
12665         case "$getgrgid_r_proto" in
12666         ''|0)   d_getgrgid_r=undef
12667                 getgrgid_r_proto=0
12668                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
12669         * )     case "$getgrgid_r_proto" in
12670                 REENTRANT_PROTO*) ;;
12671                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12672                 esac
12673                 echo "Prototype: $try" ;;
12674         esac
12675         ;;
12676         *)      case "$usethreads" in
12677                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12678                 esac
12679                 d_getgrgid_r=undef
12680                 getgrgid_r_proto=0
12681                 ;;
12682         esac
12683         ;;
12684 *)      getgrgid_r_proto=0
12685         ;;
12686 esac
12687
12688 : see if getgrnam_r exists
12689 set getgrnam_r d_getgrnam_r
12690 eval $inlibc
12691 case "$d_getgrnam_r" in
12692 "$define")
12693         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12694         case "$d_getgrnam_r_proto:$usethreads" in
12695         ":define")      d_getgrnam_r_proto=define
12696                 set d_getgrnam_r_proto getgrnam_r $hdrs
12697                 eval $hasproto ;;
12698         *)      ;;
12699         esac
12700         case "$d_getgrnam_r_proto" in
12701         define)
12702         case "$getgrnam_r_proto" in
12703         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12704         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12705         esac
12706         case "$getgrnam_r_proto" in
12707         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12708         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12709         esac
12710         case "$getgrnam_r_proto" in
12711         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12712         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12713         esac
12714         case "$getgrnam_r_proto" in
12715         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
12716         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
12717         esac
12718         case "$getgrnam_r_proto" in
12719         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
12720         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
12721         esac
12722         case "$getgrnam_r_proto" in
12723         ''|0)   d_getgrnam_r=undef
12724                 getgrnam_r_proto=0
12725                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
12726         * )     case "$getgrnam_r_proto" in
12727                 REENTRANT_PROTO*) ;;
12728                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
12729                 esac
12730                 echo "Prototype: $try" ;;
12731         esac
12732         ;;
12733         *)      case "$usethreads" in
12734                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
12735                 esac
12736                 d_getgrnam_r=undef
12737                 getgrnam_r_proto=0
12738                 ;;
12739         esac
12740         ;;
12741 *)      getgrnam_r_proto=0
12742         ;;
12743 esac
12744
12745 : see if gethostbyaddr exists
12746 set gethostbyaddr d_gethbyaddr
12747 eval $inlibc
12748
12749 : see if gethostbyname exists
12750 set gethostbyname d_gethbyname
12751 eval $inlibc
12752
12753 : see if gethostent exists
12754 set gethostent d_gethent
12755 eval $inlibc
12756
12757 : see how we will look up host name
12758 echo " "
12759 call=''
12760 if set gethostname val -f d_gethname; eval $csym; $val; then
12761         echo 'gethostname() found.' >&4
12762         d_gethname="$define"
12763         call=gethostname
12764 fi
12765 if set uname val -f d_uname; eval $csym; $val; then
12766         if ./xenix; then
12767                 $cat <<'EOM'
12768 uname() was found, but you're running xenix, and older versions of xenix
12769 have a broken uname(). If you don't really know whether your xenix is old
12770 enough to have a broken system call, use the default answer.
12771
12772 EOM
12773                 dflt=y
12774                 case "$d_uname" in
12775                 "$define") dflt=n;;
12776                 esac
12777                 rp='Is your uname() broken?'
12778                 . ./myread
12779                 case "$ans" in
12780                 n*) d_uname="$define"; call=uname;;
12781                 esac
12782         else
12783                 echo 'uname() found.' >&4
12784                 d_uname="$define"
12785                 case "$call" in
12786                 '') call=uname ;;
12787                 esac
12788         fi
12789 fi
12790 case "$d_gethname" in
12791 '') d_gethname="$undef";;
12792 esac
12793 case "$d_uname" in
12794 '') d_uname="$undef";;
12795 esac
12796 case "$d_uname$d_gethname" in
12797 *define*)
12798         dflt=n
12799         cat <<EOM
12800  
12801 Every now and then someone has a $call() that lies about the hostname
12802 but can't be fixed for political or economic reasons.  If you wish, I can
12803 pretend $call() isn't there and maybe compute hostname at run-time
12804 thanks to the '$phostname' command.
12805
12806 EOM
12807         rp="Shall I ignore $call() from now on?"
12808         . ./myread
12809         case "$ans" in
12810         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
12811         esac;;
12812 esac
12813 case "$phostname" in
12814 '') aphostname='';;
12815 *) case "$aphostname" in
12816         /*) ;;
12817         *) set X $phostname
12818                 shift
12819                 file=$1
12820                 shift
12821                 file=`./loc $file $file $pth`
12822                 aphostname=`echo $file $*`
12823                 ;;
12824         esac
12825         ;;
12826 esac
12827 case "$d_uname$d_gethname" in
12828 *define*) ;;
12829 *)
12830         case "$phostname" in
12831         '')
12832                 echo "There will be no way for $package to get your hostname." >&4;;
12833         *)
12834         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
12835                 ;;
12836         esac;;
12837 esac
12838 case "$d_phostname" in
12839 '') d_phostname="$undef";;
12840 esac
12841
12842 : see if gethostbyaddr_r exists
12843 set gethostbyaddr_r d_gethostbyaddr_r
12844 eval $inlibc
12845 case "$d_gethostbyaddr_r" in
12846 "$define")
12847         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12848         case "$d_gethostbyaddr_r_proto:$usethreads" in
12849         ":define")      d_gethostbyaddr_r_proto=define
12850                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
12851                 eval $hasproto ;;
12852         *)      ;;
12853         esac
12854         case "$d_gethostbyaddr_r_proto" in
12855         define)
12856         case "$gethostbyaddr_r_proto" in
12857         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12858         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
12859         esac
12860         case "$gethostbyaddr_r_proto" in
12861         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
12862         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
12863         esac
12864         case "$gethostbyaddr_r_proto" in
12865         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
12866         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
12867         esac
12868         case "$gethostbyaddr_r_proto" in
12869         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
12870         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
12871         esac
12872         case "$gethostbyaddr_r_proto" in
12873         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
12874         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
12875         esac
12876         case "$gethostbyaddr_r_proto" in
12877         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
12878         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
12879         esac
12880         case "$gethostbyaddr_r_proto" in
12881         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
12882         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
12883         esac
12884         case "$gethostbyaddr_r_proto" in
12885         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
12886         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
12887         esac
12888         case "$gethostbyaddr_r_proto" in
12889         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
12890         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
12891         esac
12892         case "$gethostbyaddr_r_proto" in
12893         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
12894         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
12895         esac
12896         case "$gethostbyaddr_r_proto" in
12897         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12898         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
12899         esac
12900         case "$gethostbyaddr_r_proto" in
12901         ''|0)   d_gethostbyaddr_r=undef
12902                 gethostbyaddr_r_proto=0
12903                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
12904         * )     case "$gethostbyaddr_r_proto" in
12905                 REENTRANT_PROTO*) ;;
12906                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
12907                 esac
12908                 echo "Prototype: $try" ;;
12909         esac
12910         ;;
12911         *)      case "$usethreads" in
12912                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
12913                 esac
12914                 d_gethostbyaddr_r=undef
12915                 gethostbyaddr_r_proto=0
12916                 ;;
12917         esac
12918         ;;
12919 *)      gethostbyaddr_r_proto=0
12920         ;;
12921 esac
12922
12923 : see if gethostbyname_r exists
12924 set gethostbyname_r d_gethostbyname_r
12925 eval $inlibc
12926 case "$d_gethostbyname_r" in
12927 "$define")
12928         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12929         case "$d_gethostbyname_r_proto:$usethreads" in
12930         ":define")      d_gethostbyname_r_proto=define
12931                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
12932                 eval $hasproto ;;
12933         *)      ;;
12934         esac
12935         case "$d_gethostbyname_r_proto" in
12936         define)
12937         case "$gethostbyname_r_proto" in
12938         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
12939         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
12940         esac
12941         case "$gethostbyname_r_proto" in
12942         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
12943         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
12944         esac
12945         case "$gethostbyname_r_proto" in
12946         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
12947         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
12948         esac
12949         case "$gethostbyname_r_proto" in
12950         ''|0)   d_gethostbyname_r=undef
12951                 gethostbyname_r_proto=0
12952                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
12953         * )     case "$gethostbyname_r_proto" in
12954                 REENTRANT_PROTO*) ;;
12955                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
12956                 esac
12957                 echo "Prototype: $try" ;;
12958         esac
12959         ;;
12960         *)      case "$usethreads" in
12961                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
12962                 esac
12963                 d_gethostbyname_r=undef
12964                 gethostbyname_r_proto=0
12965                 ;;
12966         esac
12967         ;;
12968 *)      gethostbyname_r_proto=0
12969         ;;
12970 esac
12971
12972 : see if gethostent_r exists
12973 set gethostent_r d_gethostent_r
12974 eval $inlibc
12975 case "$d_gethostent_r" in
12976 "$define")
12977         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12978         case "$d_gethostent_r_proto:$usethreads" in
12979         ":define")      d_gethostent_r_proto=define
12980                 set d_gethostent_r_proto gethostent_r $hdrs
12981                 eval $hasproto ;;
12982         *)      ;;
12983         esac
12984         case "$d_gethostent_r_proto" in
12985         define)
12986         case "$gethostent_r_proto" in
12987         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
12988         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
12989         esac
12990         case "$gethostent_r_proto" in
12991         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
12992         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
12993         esac
12994         case "$gethostent_r_proto" in
12995         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
12996         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
12997         esac
12998         case "$gethostent_r_proto" in
12999         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13000         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13001         esac
13002         case "$gethostent_r_proto" in
13003         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13004         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13005         esac
13006         case "$gethostent_r_proto" in
13007         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13008         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13009         esac
13010         case "$gethostent_r_proto" in
13011         ''|0)   d_gethostent_r=undef
13012                 gethostent_r_proto=0
13013                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13014         * )     case "$gethostent_r_proto" in
13015                 REENTRANT_PROTO*) ;;
13016                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13017                 esac
13018                 echo "Prototype: $try" ;;
13019         esac
13020         ;;
13021         *)      case "$usethreads" in
13022                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13023                 esac
13024                 d_gethostent_r=undef
13025                 gethostent_r_proto=0
13026                 ;;
13027         esac
13028         ;;
13029 *)      gethostent_r_proto=0
13030         ;;
13031 esac
13032
13033 : see if prototypes for various gethostxxx netdb.h functions are available
13034 echo " "
13035 set d_gethostprotos gethostent $i_netdb netdb.h
13036 eval $hasproto
13037
13038 : see if getitimer exists
13039 set getitimer d_getitimer
13040 eval $inlibc
13041
13042 : see if getlogin exists
13043 set getlogin d_getlogin
13044 eval $inlibc
13045
13046 : see if getlogin_r exists
13047 set getlogin_r d_getlogin_r
13048 eval $inlibc
13049 case "$d_getlogin_r" in
13050 "$define")
13051         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13052         case "$d_getlogin_r_proto:$usethreads" in
13053         ":define")      d_getlogin_r_proto=define
13054                 set d_getlogin_r_proto getlogin_r $hdrs
13055                 eval $hasproto ;;
13056         *)      ;;
13057         esac
13058         case "$d_getlogin_r_proto" in
13059         define)
13060         case "$getlogin_r_proto" in
13061         ''|0) try='int getlogin_r(char*, size_t);'
13062         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13063         esac
13064         case "$getlogin_r_proto" in
13065         ''|0) try='int getlogin_r(char*, int);'
13066         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13067         esac
13068         case "$getlogin_r_proto" in
13069         ''|0) try='char* getlogin_r(char*, size_t);'
13070         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13071         esac
13072         case "$getlogin_r_proto" in
13073         ''|0) try='char* getlogin_r(char*, int);'
13074         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13075         esac
13076         case "$getlogin_r_proto" in
13077         ''|0)   d_getlogin_r=undef
13078                 getlogin_r_proto=0
13079                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13080         * )     case "$getlogin_r_proto" in
13081                 REENTRANT_PROTO*) ;;
13082                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13083                 esac
13084                 echo "Prototype: $try" ;;
13085         esac
13086         ;;
13087         *)      case "$usethreads" in
13088                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13089                 esac
13090                 d_getlogin_r=undef
13091                 getlogin_r_proto=0
13092                 ;;
13093         esac
13094         ;;
13095 *)      getlogin_r_proto=0
13096         ;;
13097 esac
13098
13099 : see if getmnt exists
13100 set getmnt d_getmnt
13101 eval $inlibc
13102
13103 : see if getmntent exists
13104 set getmntent d_getmntent
13105 eval $inlibc
13106
13107 : see if getnetbyaddr exists
13108 set getnetbyaddr d_getnbyaddr
13109 eval $inlibc
13110
13111 : see if getnetbyname exists
13112 set getnetbyname d_getnbyname
13113 eval $inlibc
13114
13115 : see if getnetent exists
13116 set getnetent d_getnent
13117 eval $inlibc
13118
13119 : see if getnetbyaddr_r exists
13120 set getnetbyaddr_r d_getnetbyaddr_r
13121 eval $inlibc
13122 case "$d_getnetbyaddr_r" in
13123 "$define")
13124         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13125         case "$d_getnetbyaddr_r_proto:$usethreads" in
13126         ":define")      d_getnetbyaddr_r_proto=define
13127                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13128                 eval $hasproto ;;
13129         *)      ;;
13130         esac
13131         case "$d_getnetbyaddr_r_proto" in
13132         define)
13133         case "$getnetbyaddr_r_proto" in
13134         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13135         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13136         esac
13137         case "$getnetbyaddr_r_proto" in
13138         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13139         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13140         esac
13141         case "$getnetbyaddr_r_proto" in
13142         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13143         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13144         esac
13145         case "$getnetbyaddr_r_proto" in
13146         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13147         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13148         esac
13149         case "$getnetbyaddr_r_proto" in
13150         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13151         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13152         esac
13153         case "$getnetbyaddr_r_proto" in
13154         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13155         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13156         esac
13157         case "$getnetbyaddr_r_proto" in
13158         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13159         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13160         esac
13161         case "$getnetbyaddr_r_proto" in
13162         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13163         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13164         esac
13165         case "$getnetbyaddr_r_proto" in
13166         ''|0)   d_getnetbyaddr_r=undef
13167                 getnetbyaddr_r_proto=0
13168                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13169         * )     case "$getnetbyaddr_r_proto" in
13170                 REENTRANT_PROTO*) ;;
13171                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13172                 esac
13173                 echo "Prototype: $try" ;;
13174         esac
13175         ;;
13176         *)      case "$usethreads" in
13177                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13178                 esac
13179                 d_getnetbyaddr_r=undef
13180                 getnetbyaddr_r_proto=0
13181                 ;;
13182         esac
13183         ;;
13184 *)      getnetbyaddr_r_proto=0
13185         ;;
13186 esac
13187
13188 : see if getnetbyname_r exists
13189 set getnetbyname_r d_getnetbyname_r
13190 eval $inlibc
13191 case "$d_getnetbyname_r" in
13192 "$define")
13193         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13194         case "$d_getnetbyname_r_proto:$usethreads" in
13195         ":define")      d_getnetbyname_r_proto=define
13196                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13197                 eval $hasproto ;;
13198         *)      ;;
13199         esac
13200         case "$d_getnetbyname_r_proto" in
13201         define)
13202         case "$getnetbyname_r_proto" in
13203         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13204         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13205         esac
13206         case "$getnetbyname_r_proto" in
13207         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13208         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13209         esac
13210         case "$getnetbyname_r_proto" in
13211         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13212         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13213         esac
13214         case "$getnetbyname_r_proto" in
13215         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13216         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13217         esac
13218         case "$getnetbyname_r_proto" in
13219         ''|0)   d_getnetbyname_r=undef
13220                 getnetbyname_r_proto=0
13221                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13222         * )     case "$getnetbyname_r_proto" in
13223                 REENTRANT_PROTO*) ;;
13224                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13225                 esac
13226                 echo "Prototype: $try" ;;
13227         esac
13228         ;;
13229         *)      case "$usethreads" in
13230                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13231                 esac
13232                 d_getnetbyname_r=undef
13233                 getnetbyname_r_proto=0
13234                 ;;
13235         esac
13236         ;;
13237 *)      getnetbyname_r_proto=0
13238         ;;
13239 esac
13240
13241 : see if getnetent_r exists
13242 set getnetent_r d_getnetent_r
13243 eval $inlibc
13244 case "$d_getnetent_r" in
13245 "$define")
13246         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13247         case "$d_getnetent_r_proto:$usethreads" in
13248         ":define")      d_getnetent_r_proto=define
13249                 set d_getnetent_r_proto getnetent_r $hdrs
13250                 eval $hasproto ;;
13251         *)      ;;
13252         esac
13253         case "$d_getnetent_r_proto" in
13254         define)
13255         case "$getnetent_r_proto" in
13256         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13257         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13258         esac
13259         case "$getnetent_r_proto" in
13260         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13261         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13262         esac
13263         case "$getnetent_r_proto" in
13264         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13265         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13266         esac
13267         case "$getnetent_r_proto" in
13268         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13269         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13270         esac
13271         case "$getnetent_r_proto" in
13272         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13273         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13274         esac
13275         case "$getnetent_r_proto" in
13276         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13277         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13278         esac
13279         case "$getnetent_r_proto" in
13280         ''|0)   d_getnetent_r=undef
13281                 getnetent_r_proto=0
13282                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13283         * )     case "$getnetent_r_proto" in
13284                 REENTRANT_PROTO*) ;;
13285                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13286                 esac
13287                 echo "Prototype: $try" ;;
13288         esac
13289         ;;
13290         *)      case "$usethreads" in
13291                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13292                 esac
13293                 d_getnetent_r=undef
13294                 getnetent_r_proto=0
13295                 ;;
13296         esac
13297         ;;
13298 *)      getnetent_r_proto=0
13299         ;;
13300 esac
13301
13302 : see if prototypes for various getnetxxx netdb.h functions are available
13303 echo " "
13304 set d_getnetprotos getnetent $i_netdb netdb.h
13305 eval $hasproto
13306
13307 : see if getpagesize exists
13308 set getpagesize d_getpagsz
13309 eval $inlibc
13310
13311
13312 : see if getprotobyname exists
13313 set getprotobyname d_getpbyname
13314 eval $inlibc
13315
13316 : see if getprotobynumber exists
13317 set getprotobynumber d_getpbynumber
13318 eval $inlibc
13319
13320 : see if getprotoent exists
13321 set getprotoent d_getpent
13322 eval $inlibc
13323
13324 : see if getpgid exists
13325 set getpgid d_getpgid
13326 eval $inlibc
13327
13328 : see if getpgrp2 exists
13329 set getpgrp2 d_getpgrp2
13330 eval $inlibc
13331
13332 : see if getppid exists
13333 set getppid d_getppid
13334 eval $inlibc
13335
13336 : see if getpriority exists
13337 set getpriority d_getprior
13338 eval $inlibc
13339
13340 : see if getprotobyname_r exists
13341 set getprotobyname_r d_getprotobyname_r
13342 eval $inlibc
13343 case "$d_getprotobyname_r" in
13344 "$define")
13345         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13346         case "$d_getprotobyname_r_proto:$usethreads" in
13347         ":define")      d_getprotobyname_r_proto=define
13348                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13349                 eval $hasproto ;;
13350         *)      ;;
13351         esac
13352         case "$d_getprotobyname_r_proto" in
13353         define)
13354         case "$getprotobyname_r_proto" in
13355         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13356         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13357         esac
13358         case "$getprotobyname_r_proto" in
13359         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13360         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13361         esac
13362         case "$getprotobyname_r_proto" in
13363         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13364         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13365         esac
13366         case "$getprotobyname_r_proto" in
13367         ''|0)   d_getprotobyname_r=undef
13368                 getprotobyname_r_proto=0
13369                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13370         * )     case "$getprotobyname_r_proto" in
13371                 REENTRANT_PROTO*) ;;
13372                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13373                 esac
13374                 echo "Prototype: $try" ;;
13375         esac
13376         ;;
13377         *)      case "$usethreads" in
13378                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13379                 esac
13380                 d_getprotobyname_r=undef
13381                 getprotobyname_r_proto=0
13382                 ;;
13383         esac
13384         ;;
13385 *)      getprotobyname_r_proto=0
13386         ;;
13387 esac
13388
13389 : see if getprotobynumber_r exists
13390 set getprotobynumber_r d_getprotobynumber_r
13391 eval $inlibc
13392 case "$d_getprotobynumber_r" in
13393 "$define")
13394         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13395         case "$d_getprotobynumber_r_proto:$usethreads" in
13396         ":define")      d_getprotobynumber_r_proto=define
13397                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13398                 eval $hasproto ;;
13399         *)      ;;
13400         esac
13401         case "$d_getprotobynumber_r_proto" in
13402         define)
13403         case "$getprotobynumber_r_proto" in
13404         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13405         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13406         esac
13407         case "$getprotobynumber_r_proto" in
13408         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13409         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13410         esac
13411         case "$getprotobynumber_r_proto" in
13412         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13413         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13414         esac
13415         case "$getprotobynumber_r_proto" in
13416         ''|0)   d_getprotobynumber_r=undef
13417                 getprotobynumber_r_proto=0
13418                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
13419         * )     case "$getprotobynumber_r_proto" in
13420                 REENTRANT_PROTO*) ;;
13421                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13422                 esac
13423                 echo "Prototype: $try" ;;
13424         esac
13425         ;;
13426         *)      case "$usethreads" in
13427                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13428                 esac
13429                 d_getprotobynumber_r=undef
13430                 getprotobynumber_r_proto=0
13431                 ;;
13432         esac
13433         ;;
13434 *)      getprotobynumber_r_proto=0
13435         ;;
13436 esac
13437
13438 : see if getprotoent_r exists
13439 set getprotoent_r d_getprotoent_r
13440 eval $inlibc
13441 case "$d_getprotoent_r" in
13442 "$define")
13443         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13444         case "$d_getprotoent_r_proto:$usethreads" in
13445         ":define")      d_getprotoent_r_proto=define
13446                 set d_getprotoent_r_proto getprotoent_r $hdrs
13447                 eval $hasproto ;;
13448         *)      ;;
13449         esac
13450         case "$d_getprotoent_r_proto" in
13451         define)
13452         case "$getprotoent_r_proto" in
13453         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13454         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13455         esac
13456         case "$getprotoent_r_proto" in
13457         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13458         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13459         esac
13460         case "$getprotoent_r_proto" in
13461         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13462         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13463         esac
13464         case "$getprotoent_r_proto" in
13465         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13466         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13467         esac
13468         case "$getprotoent_r_proto" in
13469         ''|0)   d_getprotoent_r=undef
13470                 getprotoent_r_proto=0
13471                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
13472         * )     case "$getprotoent_r_proto" in
13473                 REENTRANT_PROTO*) ;;
13474                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13475                 esac
13476                 echo "Prototype: $try" ;;
13477         esac
13478         ;;
13479         *)      case "$usethreads" in
13480                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13481                 esac
13482                 d_getprotoent_r=undef
13483                 getprotoent_r_proto=0
13484                 ;;
13485         esac
13486         ;;
13487 *)      getprotoent_r_proto=0
13488         ;;
13489 esac
13490
13491 : see if prototypes for various getprotoxxx netdb.h functions are available
13492 echo " "
13493 set d_getprotoprotos getprotoent $i_netdb netdb.h
13494 eval $hasproto
13495
13496 : see if getprpwnam exists
13497 set getprpwnam d_getprpwnam
13498 eval $inlibc
13499
13500 : see if getpwent exists
13501 set getpwent d_getpwent
13502 eval $inlibc
13503
13504 : see if getpwent_r exists
13505 set getpwent_r d_getpwent_r
13506 eval $inlibc
13507 case "$d_getpwent_r" in
13508 "$define")
13509         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13510         case "$d_getpwent_r_proto:$usethreads" in
13511         ":define")      d_getpwent_r_proto=define
13512                 set d_getpwent_r_proto getpwent_r $hdrs
13513                 eval $hasproto ;;
13514         *)      ;;
13515         esac
13516         case "$d_getpwent_r_proto" in
13517         define)
13518         case "$getpwent_r_proto" in
13519         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13520         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13521         esac
13522         case "$getpwent_r_proto" in
13523         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13524         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13525         esac
13526         case "$getpwent_r_proto" in
13527         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13528         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13529         esac
13530         case "$getpwent_r_proto" in
13531         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13532         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13533         esac
13534         case "$getpwent_r_proto" in
13535         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13536         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13537         esac
13538         case "$getpwent_r_proto" in
13539         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13540         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13541         esac
13542         case "$getpwent_r_proto" in
13543         ''|0)   d_getpwent_r=undef
13544                 getpwent_r_proto=0
13545                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
13546         * )     case "$getpwent_r_proto" in
13547                 REENTRANT_PROTO*) ;;
13548                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13549                 esac
13550                 echo "Prototype: $try" ;;
13551         esac
13552         ;;
13553         *)      case "$usethreads" in
13554                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13555                 esac
13556                 d_getpwent_r=undef
13557                 getpwent_r_proto=0
13558                 ;;
13559         esac
13560         ;;
13561 *)      getpwent_r_proto=0
13562         ;;
13563 esac
13564
13565 : see if getpwnam_r exists
13566 set getpwnam_r d_getpwnam_r
13567 eval $inlibc
13568 case "$d_getpwnam_r" in
13569 "$define")
13570         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13571         case "$d_getpwnam_r_proto:$usethreads" in
13572         ":define")      d_getpwnam_r_proto=define
13573                 set d_getpwnam_r_proto getpwnam_r $hdrs
13574                 eval $hasproto ;;
13575         *)      ;;
13576         esac
13577         case "$d_getpwnam_r_proto" in
13578         define)
13579         case "$getpwnam_r_proto" in
13580         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13581         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
13582         esac
13583         case "$getpwnam_r_proto" in
13584         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
13585         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
13586         esac
13587         case "$getpwnam_r_proto" in
13588         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
13589         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
13590         esac
13591         case "$getpwnam_r_proto" in
13592         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
13593         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
13594         esac
13595         case "$getpwnam_r_proto" in
13596         ''|0)   d_getpwnam_r=undef
13597                 getpwnam_r_proto=0
13598                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
13599         * )     case "$getpwnam_r_proto" in
13600                 REENTRANT_PROTO*) ;;
13601                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
13602                 esac
13603                 echo "Prototype: $try" ;;
13604         esac
13605         ;;
13606         *)      case "$usethreads" in
13607                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13608                 esac
13609                 d_getpwnam_r=undef
13610                 getpwnam_r_proto=0
13611                 ;;
13612         esac
13613         ;;
13614 *)      getpwnam_r_proto=0
13615         ;;
13616 esac
13617
13618 : see if getpwuid_r exists
13619 set getpwuid_r d_getpwuid_r
13620 eval $inlibc
13621 case "$d_getpwuid_r" in
13622 "$define")
13623         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13624         case "$d_getpwuid_r_proto:$usethreads" in
13625         ":define")      d_getpwuid_r_proto=define
13626                 set d_getpwuid_r_proto getpwuid_r $hdrs
13627                 eval $hasproto ;;
13628         *)      ;;
13629         esac
13630         case "$d_getpwuid_r_proto" in
13631         define)
13632         case "$getpwuid_r_proto" in
13633         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13634         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13635         esac
13636         case "$getpwuid_r_proto" in
13637         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13638         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13639         esac
13640         case "$getpwuid_r_proto" in
13641         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13642         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13643         esac
13644         case "$getpwuid_r_proto" in
13645         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13646         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13647         esac
13648         case "$getpwuid_r_proto" in
13649         ''|0)   d_getpwuid_r=undef
13650                 getpwuid_r_proto=0
13651                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
13652         * )     case "$getpwuid_r_proto" in
13653                 REENTRANT_PROTO*) ;;
13654                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13655                 esac
13656                 echo "Prototype: $try" ;;
13657         esac
13658         ;;
13659         *)      case "$usethreads" in
13660                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13661                 esac
13662                 d_getpwuid_r=undef
13663                 getpwuid_r_proto=0
13664                 ;;
13665         esac
13666         ;;
13667 *)      getpwuid_r_proto=0
13668         ;;
13669 esac
13670
13671
13672 : see if getservbyname exists
13673 set getservbyname d_getsbyname
13674 eval $inlibc
13675
13676 : see if getservbyport exists
13677 set getservbyport d_getsbyport
13678 eval $inlibc
13679
13680 : see if getservent exists
13681 set getservent d_getsent
13682 eval $inlibc
13683
13684 : see if getservbyname_r exists
13685 set getservbyname_r d_getservbyname_r
13686 eval $inlibc
13687 case "$d_getservbyname_r" in
13688 "$define")
13689         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13690         case "$d_getservbyname_r_proto:$usethreads" in
13691         ":define")      d_getservbyname_r_proto=define
13692                 set d_getservbyname_r_proto getservbyname_r $hdrs
13693                 eval $hasproto ;;
13694         *)      ;;
13695         esac
13696         case "$d_getservbyname_r_proto" in
13697         define)
13698         case "$getservbyname_r_proto" in
13699         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13700         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13701         esac
13702         case "$getservbyname_r_proto" in
13703         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13704         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13705         esac
13706         case "$getservbyname_r_proto" in
13707         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13708         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13709         esac
13710         case "$getservbyname_r_proto" in
13711         ''|0)   d_getservbyname_r=undef
13712                 getservbyname_r_proto=0
13713                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
13714         * )     case "$getservbyname_r_proto" in
13715                 REENTRANT_PROTO*) ;;
13716                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
13717                 esac
13718                 echo "Prototype: $try" ;;
13719         esac
13720         ;;
13721         *)      case "$usethreads" in
13722                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
13723                 esac
13724                 d_getservbyname_r=undef
13725                 getservbyname_r_proto=0
13726                 ;;
13727         esac
13728         ;;
13729 *)      getservbyname_r_proto=0
13730         ;;
13731 esac
13732
13733 : see if getservbyport_r exists
13734 set getservbyport_r d_getservbyport_r
13735 eval $inlibc
13736 case "$d_getservbyport_r" in
13737 "$define")
13738         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13739         case "$d_getservbyport_r_proto:$usethreads" in
13740         ":define")      d_getservbyport_r_proto=define
13741                 set d_getservbyport_r_proto getservbyport_r $hdrs
13742                 eval $hasproto ;;
13743         *)      ;;
13744         esac
13745         case "$d_getservbyport_r_proto" in
13746         define)
13747         case "$getservbyport_r_proto" in
13748         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
13749         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
13750         esac
13751         case "$getservbyport_r_proto" in
13752         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
13753         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
13754         esac
13755         case "$getservbyport_r_proto" in
13756         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
13757         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
13758         esac
13759         case "$getservbyport_r_proto" in
13760         ''|0)   d_getservbyport_r=undef
13761                 getservbyport_r_proto=0
13762                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
13763         * )     case "$getservbyport_r_proto" in
13764                 REENTRANT_PROTO*) ;;
13765                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
13766                 esac
13767                 echo "Prototype: $try" ;;
13768         esac
13769         ;;
13770         *)      case "$usethreads" in
13771                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
13772                 esac
13773                 d_getservbyport_r=undef
13774                 getservbyport_r_proto=0
13775                 ;;
13776         esac
13777         ;;
13778 *)      getservbyport_r_proto=0
13779         ;;
13780 esac
13781
13782 : see if getservent_r exists
13783 set getservent_r d_getservent_r
13784 eval $inlibc
13785 case "$d_getservent_r" in
13786 "$define")
13787         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13788         case "$d_getservent_r_proto:$usethreads" in
13789         ":define")      d_getservent_r_proto=define
13790                 set d_getservent_r_proto getservent_r $hdrs
13791                 eval $hasproto ;;
13792         *)      ;;
13793         esac
13794         case "$d_getservent_r_proto" in
13795         define)
13796         case "$getservent_r_proto" in
13797         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
13798         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
13799         esac
13800         case "$getservent_r_proto" in
13801         ''|0) try='int getservent_r(struct servent*, char*, int);'
13802         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
13803         esac
13804         case "$getservent_r_proto" in
13805         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
13806         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
13807         esac
13808         case "$getservent_r_proto" in
13809         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
13810         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
13811         esac
13812         case "$getservent_r_proto" in
13813         ''|0)   d_getservent_r=undef
13814                 getservent_r_proto=0
13815                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
13816         * )     case "$getservent_r_proto" in
13817                 REENTRANT_PROTO*) ;;
13818                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
13819                 esac
13820                 echo "Prototype: $try" ;;
13821         esac
13822         ;;
13823         *)      case "$usethreads" in
13824                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
13825                 esac
13826                 d_getservent_r=undef
13827                 getservent_r_proto=0
13828                 ;;
13829         esac
13830         ;;
13831 *)      getservent_r_proto=0
13832         ;;
13833 esac
13834
13835 : see if prototypes for various getservxxx netdb.h functions are available
13836 echo " "
13837 set d_getservprotos getservent $i_netdb netdb.h
13838 eval $hasproto
13839
13840 : see if getspnam exists
13841 set getspnam d_getspnam
13842 eval $inlibc
13843
13844 : see if this is a shadow.h system
13845 set shadow.h i_shadow
13846 eval $inhdr
13847
13848 : see if getspnam_r exists
13849 set getspnam_r d_getspnam_r
13850 eval $inlibc
13851 case "$d_getspnam_r" in
13852 "$define")
13853         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
13854         case "$d_getspnam_r_proto:$usethreads" in
13855         ":define")      d_getspnam_r_proto=define
13856                 set d_getspnam_r_proto getspnam_r $hdrs
13857                 eval $hasproto ;;
13858         *)      ;;
13859         esac
13860         case "$d_getspnam_r_proto" in
13861         define)
13862         case "$getspnam_r_proto" in
13863         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
13864         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
13865         esac
13866         case "$getspnam_r_proto" in
13867         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
13868         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
13869         esac
13870         case "$getspnam_r_proto" in
13871         ''|0)   d_getspnam_r=undef
13872                 getspnam_r_proto=0
13873                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
13874         * )     case "$getspnam_r_proto" in
13875                 REENTRANT_PROTO*) ;;
13876                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
13877                 esac
13878                 echo "Prototype: $try" ;;
13879         esac
13880         ;;
13881         *)      case "$usethreads" in
13882                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
13883                 esac
13884                 d_getspnam_r=undef
13885                 getspnam_r_proto=0
13886                 ;;
13887         esac
13888         ;;
13889 *)      getspnam_r_proto=0
13890         ;;
13891 esac
13892
13893 : see if gettimeofday or ftime exists
13894 set gettimeofday d_gettimeod
13895 eval $inlibc
13896 case "$d_gettimeod" in
13897 "$undef")
13898         set ftime d_ftime 
13899         eval $inlibc
13900         ;;
13901 *)
13902         val="$undef"; set d_ftime; eval $setvar
13903         ;;
13904 esac
13905 case "$d_gettimeod$d_ftime" in
13906 "$undef$undef")
13907         echo " "
13908         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
13909         ;;
13910 esac
13911
13912 : see if gmtime_r exists
13913 set gmtime_r d_gmtime_r
13914 eval $inlibc
13915 case "$d_gmtime_r" in
13916 "$define")
13917         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13918         case "$d_gmtime_r_proto:$usethreads" in
13919         ":define")      d_gmtime_r_proto=define
13920                 set d_gmtime_r_proto gmtime_r $hdrs
13921                 eval $hasproto ;;
13922         *)      ;;
13923         esac
13924         case "$d_gmtime_r_proto" in
13925         define)
13926         case "$gmtime_r_proto" in
13927         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
13928         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
13929         esac
13930         case "$gmtime_r_proto" in
13931         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
13932         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
13933         esac
13934         case "$gmtime_r_proto" in
13935         ''|0)   d_gmtime_r=undef
13936                 gmtime_r_proto=0
13937                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
13938         * )     case "$gmtime_r_proto" in
13939                 REENTRANT_PROTO*) ;;
13940                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
13941                 esac
13942                 echo "Prototype: $try" ;;
13943         esac
13944         ;;
13945         *)      case "$usethreads" in
13946                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
13947                 esac
13948                 d_gmtime_r=undef
13949                 gmtime_r_proto=0
13950                 ;;
13951         esac
13952         ;;
13953 *)      gmtime_r_proto=0
13954         ;;
13955 esac
13956
13957 : see if hasmntopt exists
13958 set hasmntopt d_hasmntopt
13959 eval $inlibc
13960
13961 : see if this is a netinet/in.h or sys/in.h system
13962 set netinet/in.h i_niin sys/in.h i_sysin
13963 eval $inhdr
13964
13965 : see if arpa/inet.h has to be included
13966 set arpa/inet.h i_arpainet
13967 eval $inhdr
13968
13969 : see if htonl --and friends-- exists
13970 val=''
13971 set htonl val
13972 eval $inlibc
13973
13974 : Maybe they are macros.
13975 case "$val" in
13976 $undef)
13977         $cat >htonl.c <<EOM
13978 #include <stdio.h>
13979 #include <sys/types.h>
13980 #$i_niin I_NETINET_IN
13981 #$i_sysin I_SYS_IN
13982 #$i_arpainet I_ARPA_INET
13983 #ifdef I_NETINET_IN
13984 #include <netinet/in.h>
13985 #endif
13986 #ifdef I_SYS_IN
13987 #include <sys/in.h>
13988 #endif
13989 #ifdef I_ARPA_INET
13990 #include <arpa/inet.h>
13991 #endif
13992 #ifdef htonl
13993 printf("Defined as a macro.");
13994 #endif
13995 EOM
13996         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
13997         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
13998                 val="$define"
13999                 echo "But it seems to be defined as a macro." >&4
14000         fi
14001         $rm -f htonl.?
14002         ;;
14003 esac
14004 set d_htonl
14005 eval $setvar
14006
14007 : see if ilogbl exists
14008 set ilogbl d_ilogbl
14009 eval $inlibc
14010
14011 : index or strchr
14012 echo " "
14013 if set index val -f; eval $csym; $val; then
14014         if set strchr val -f d_strchr; eval $csym; $val; then
14015                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14016                         val="$define"
14017                         vali="$undef"
14018                         echo "strchr() found." >&4
14019                 else
14020                         val="$undef"
14021                         vali="$define"
14022                         echo "index() found." >&4
14023                 fi
14024         else
14025                 val="$undef"
14026                 vali="$define"
14027                 echo "index() found." >&4
14028         fi
14029 else
14030         if set strchr val -f d_strchr; eval $csym; $val; then
14031                 val="$define"
14032                 vali="$undef"
14033                 echo "strchr() found." >&4
14034         else
14035                 echo "No index() or strchr() found!" >&4
14036                 val="$undef"
14037                 vali="$undef"
14038         fi
14039 fi
14040 set d_strchr; eval $setvar
14041 val="$vali"
14042 set d_index; eval $setvar
14043
14044 : check whether inet_aton exists
14045 set inet_aton d_inetaton
14046 eval $inlibc
14047
14048 : Look for isascii
14049 echo " "
14050 $cat >isascii.c <<EOCP
14051 #include <stdio.h>
14052 #include <ctype.h>
14053 #$i_stdlib I_STDLIB
14054 #ifdef I_STDLIB
14055 #include <stdlib.h>
14056 #endif
14057 int main() {
14058         int c = 'A';
14059         if (isascii(c))
14060                 exit(0);
14061         else
14062                 exit(1);
14063 }
14064 EOCP
14065 set isascii
14066 if eval $compile; then
14067         echo "isascii() found." >&4
14068         val="$define"
14069 else
14070         echo "isascii() NOT found." >&4
14071         val="$undef"
14072 fi
14073 set d_isascii
14074 eval $setvar
14075 $rm -f isascii*
14076
14077 : see if isfinite exists
14078 set isfinite d_isfinite
14079 eval $inlibc
14080
14081 : see if isinf exists
14082 set isinf d_isinf
14083 eval $inlibc
14084
14085 : see if isnan exists
14086 set isnan d_isnan
14087 eval $inlibc
14088
14089 : see if isnanl exists
14090 set isnanl d_isnanl
14091 eval $inlibc
14092
14093 : see if killpg exists
14094 set killpg d_killpg
14095 eval $inlibc
14096
14097 : see if lchown exists
14098 echo " "
14099 $cat > try.c <<'EOCP'
14100 /* System header to define __stub macros and hopefully few prototypes,
14101     which can conflict with char lchown(); below.  */
14102 #include <assert.h>
14103 /* Override any gcc2 internal prototype to avoid an error.  */
14104 /* We use char because int might match the return type of a gcc2
14105    builtin and then its argument prototype would still apply.  */
14106 char lchown();
14107 int main() {
14108     /*  The GNU C library defines this for functions which it implements
14109         to always fail with ENOSYS.  Some functions are actually named
14110         something starting with __ and the normal name is an alias.  */
14111 #if defined (__stub_lchown) || defined (__stub___lchown)
14112 choke me
14113 #else
14114 lchown();
14115 #endif
14116 ; return 0; }
14117 EOCP
14118 set try
14119 if eval $compile; then
14120     $echo "lchown() found." >&4
14121     val="$define"
14122 else
14123     $echo "lchown() NOT found." >&4
14124     val="$undef"
14125 fi
14126 set d_lchown
14127 eval $setvar
14128
14129 : See if number of significant digits in a double precision number is known
14130 echo " "
14131 $cat >ldbl_dig.c <<EOM
14132 #$i_limits I_LIMITS
14133 #$i_float I_FLOAT
14134 #ifdef I_LIMITS
14135 #include <limits.h>
14136 #endif
14137 #ifdef I_FLOAT
14138 #include <float.h>
14139 #endif
14140 #ifdef LDBL_DIG
14141 printf("Contains LDBL_DIG");
14142 #endif
14143 EOM
14144 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14145 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14146         echo "LDBL_DIG found." >&4
14147         val="$define"
14148 else
14149         echo "LDBL_DIG NOT found." >&4
14150         val="$undef"
14151 fi
14152 $rm -f ldbl_dig.?
14153 set d_ldbl_dig
14154 eval $setvar
14155
14156 : see if this is a math.h system
14157 set math.h i_math
14158 eval $inhdr
14159
14160 d_libm_lib_version="$undef"
14161 case $i_math in
14162     $define)
14163         : check to see if math.h defines _LIB_VERSION
14164         echo " "
14165         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14166         $cat >try.c <<EOCP
14167 #include <unistd.h>
14168 #include <math.h>
14169 int main (int argc, char *argv[])
14170 {
14171     printf ("%d\n", _LIB_VERSION);
14172     return (0);
14173     } /* main */
14174 EOCP
14175         set try
14176         if eval $compile; then
14177             foo=`$run ./try`
14178             echo "Yes, it does ($foo)" >&4
14179             d_libm_lib_version="$define"
14180         else
14181             echo "No, it does not (probably harmless)\n" >&4
14182             fi
14183         $rm -f try.* try core core.try.*
14184         ;;
14185
14186     esac
14187
14188 : see if link exists
14189 set link d_link
14190 eval $inlibc
14191
14192 : see if localtime_r exists
14193 set localtime_r d_localtime_r
14194 eval $inlibc
14195 case "$d_localtime_r" in
14196 "$define")
14197         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14198         case "$d_localtime_r_proto:$usethreads" in
14199         ":define")      d_localtime_r_proto=define
14200                 set d_localtime_r_proto localtime_r $hdrs
14201                 eval $hasproto ;;
14202         *)      ;;
14203         esac
14204         case "$d_localtime_r_proto" in
14205         define)
14206         case "$localtime_r_proto" in
14207         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14208         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14209         esac
14210         case "$localtime_r_proto" in
14211         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14212         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14213         esac
14214         case "$localtime_r_proto" in
14215         ''|0)   d_localtime_r=undef
14216                 localtime_r_proto=0
14217                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14218         * )     case "$localtime_r_proto" in
14219                 REENTRANT_PROTO*) ;;
14220                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14221                 esac
14222                 echo "Prototype: $try" ;;
14223         esac
14224         ;;
14225         *)      case "$usethreads" in
14226                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14227                 esac
14228                 d_localtime_r=undef
14229                 localtime_r_proto=0
14230                 ;;
14231         esac
14232         ;;
14233 *)      localtime_r_proto=0
14234         ;;
14235 esac
14236
14237 : see if localeconv exists
14238 set localeconv d_locconv
14239 eval $inlibc
14240
14241 : see if lockf exists
14242 set lockf d_lockf
14243 eval $inlibc
14244
14245 : see if prototype for lseek is available
14246 echo " "
14247 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14248 eval $hasproto
14249
14250 : see if lstat exists
14251 set lstat d_lstat
14252 eval $inlibc
14253
14254 : see if madvise exists
14255 set madvise d_madvise
14256 eval $inlibc
14257
14258 : see if malloc_size exists
14259 set malloc_size d_malloc_size
14260 eval $inlibc
14261
14262 : see if malloc_size_good exists
14263 set malloc_good_size d_malloc_good_size
14264 eval $inlibc
14265
14266 : see if mblen exists
14267 set mblen d_mblen
14268 eval $inlibc
14269
14270 : see if mbstowcs exists
14271 set mbstowcs d_mbstowcs
14272 eval $inlibc
14273
14274 : see if mbtowc exists
14275 set mbtowc d_mbtowc
14276 eval $inlibc
14277
14278 : see if memchr exists
14279 set memchr d_memchr
14280 eval $inlibc
14281
14282 : see if memcmp exists
14283 set memcmp d_memcmp
14284 eval $inlibc
14285
14286 : see if memcpy exists
14287 set memcpy d_memcpy
14288 eval $inlibc
14289
14290 : see if memmove exists
14291 set memmove d_memmove
14292 eval $inlibc
14293
14294 : see if memset exists
14295 set memset d_memset
14296 eval $inlibc
14297
14298 : see if mkdir exists
14299 set mkdir d_mkdir
14300 eval $inlibc
14301
14302 : see if mkdtemp exists
14303 set mkdtemp d_mkdtemp
14304 eval $inlibc
14305
14306 : see if mkfifo exists
14307 set mkfifo d_mkfifo
14308 eval $inlibc
14309
14310 : see if mkstemp exists
14311 set mkstemp d_mkstemp
14312 eval $inlibc
14313
14314 : see if mkstemps exists
14315 set mkstemps d_mkstemps
14316 eval $inlibc
14317
14318 : see if mktime exists
14319 set mktime d_mktime
14320 eval $inlibc
14321
14322 : see if this is a sys/mman.h system
14323 set sys/mman.h i_sysmman
14324 eval $inhdr
14325
14326 : see if mmap exists
14327 set mmap d_mmap
14328 eval $inlibc
14329 : see what shmat returns
14330 : default to something harmless
14331 mmaptype='void *'
14332 case "$i_sysmman$d_mmap" in
14333 "$define$define")
14334         $cat >mmap.c <<'END'
14335 #include <sys/mman.h>
14336 void *mmap();
14337 END
14338         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14339                 mmaptype='void *'
14340         else
14341                 mmaptype='caddr_t'
14342         fi
14343         echo "and it returns ($mmaptype)." >&4
14344         ;;
14345 esac
14346
14347
14348
14349 : see if sqrtl exists
14350 set sqrtl d_sqrtl
14351 eval $inlibc
14352
14353 : see if scalbnl exists
14354 set scalbnl d_scalbnl
14355 eval $inlibc
14356
14357 : see if modfl exists
14358 set modfl d_modfl
14359 eval $inlibc
14360
14361 : see if prototype for modfl is available
14362 echo " "
14363 set d_modflproto modfl $i_math math.h
14364 eval $hasproto
14365
14366 d_modfl_pow32_bug="$undef"
14367
14368 case "$d_longdbl$d_modfl" in
14369 $define$define)
14370         $cat <<EOM
14371 Checking to see whether your modfl() is okay for large values...
14372 EOM
14373 $cat >try.c <<EOCP
14374 #include <math.h> 
14375 #include <stdio.h>
14376 EOCP
14377 if $test "X$d_modflproto" != "X$define"; then
14378         $cat >>try.c <<EOCP
14379 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
14380 long double modfl (long double, long double *);
14381 EOCP
14382 fi
14383 $cat >>try.c <<EOCP
14384 int main() {
14385     long double nv = 4294967303.15;
14386     long double v, w;
14387     v = modfl(nv, &w);         
14388 #ifdef __GLIBC__
14389     printf("glibc");
14390 #endif
14391     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14392     return 0;
14393 }
14394 EOCP
14395         case "$osname:$gccversion" in
14396         aix:)   saveccflags="$ccflags"
14397                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14398         esac
14399         set try
14400         if eval $compile; then
14401                 foo=`$run ./try`
14402                 case "$foo" in
14403                 *" 4294967303.150000 1.150000 4294967302.000000")
14404                         echo >&4 "Your modfl() is broken for large values."
14405                         d_modfl_pow32_bug="$define"
14406                         case "$foo" in
14407                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14408                         ;;
14409                         esac
14410                         ;;
14411                 *" 4294967303.150000 0.150000 4294967303.000000")
14412                         echo >&4 "Your modfl() seems okay for large values."
14413                         ;;
14414                 *)      echo >&4 "I don't understand your modfl() at all."
14415                         d_modfl="$undef"
14416                         ;;
14417                 esac
14418                 $rm -f try.* try core core.try.*
14419         else
14420                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14421                 d_modfl="$undef"
14422         fi
14423         case "$osname:$gccversion" in
14424         aix:)   ccflags="$saveccflags" ;; # restore
14425         esac
14426         ;;
14427 esac
14428
14429 if $test "$uselongdouble" = "$define"; then
14430     message=""
14431     if $test "$d_sqrtl" != "$define"; then
14432         message="$message sqrtl"
14433     fi
14434     if $test "$d_modfl" != "$define"; then
14435         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14436             echo "You have both aintl and copysignl, so I can emulate modfl."
14437         else
14438             message="$message modfl"
14439         fi
14440     fi
14441     if $test "$d_frexpl" != "$define"; then
14442         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14443             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14444         else
14445             message="$message frexpl"
14446         fi
14447     fi
14448
14449     if $test "$message" != ""; then
14450         $cat <<EOM >&4
14451
14452 *** You requested the use of long doubles but you do not seem to have
14453 *** the following mathematical functions needed for long double support:
14454 ***    $message
14455 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14456 *** Cannot continue, aborting.
14457
14458 EOM
14459
14460         exit 1
14461     fi
14462 fi
14463
14464 : see if mprotect exists
14465 set mprotect d_mprotect
14466 eval $inlibc
14467
14468 : see if msgctl exists
14469 set msgctl d_msgctl
14470 eval $inlibc
14471
14472 : see if msgget exists
14473 set msgget d_msgget
14474 eval $inlibc
14475
14476 : see if msgsnd exists
14477 set msgsnd d_msgsnd
14478 eval $inlibc
14479
14480 : see if msgrcv exists
14481 set msgrcv d_msgrcv
14482 eval $inlibc
14483
14484 : see how much of the 'msg*(2)' library is present.
14485 h_msg=true
14486 echo " "
14487 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14488 *"$undef"*) h_msg=false;;
14489 esac
14490 case "$osname" in
14491 freebsd)
14492     case "`ipcs 2>&1`" in
14493     "SVID messages"*"not configured"*)
14494         echo "Your $osname does not have the msg*(2) configured." >&4
14495         h_msg=false
14496         val="$undef"
14497         set msgctl d_msgctl
14498         eval $setvar
14499         set msgget d_msgget
14500         eval $setvar
14501         set msgsnd d_msgsnd
14502         eval $setvar
14503         set msgrcv d_msgrcv
14504         eval $setvar
14505         ;;
14506     esac
14507     ;;
14508 esac
14509 : we could also check for sys/ipc.h ...
14510 if $h_msg && $test `./findhdr sys/msg.h`; then
14511         echo "You have the full msg*(2) library." >&4
14512         val="$define"
14513 else
14514         echo "You don't have the full msg*(2) library." >&4
14515         val="$undef"
14516 fi
14517 set d_msg
14518 eval $setvar
14519
14520
14521 echo " "
14522 echo "Checking to see if your system supports struct msghdr..." >&4
14523 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14524 eval $hasstruct
14525 case "$d_msghdr_s" in
14526 "$define")      echo "Yes, it does."   ;;
14527 *)              echo "No, it doesn't." ;;
14528 esac
14529
14530
14531 : see if msync exists
14532 set msync d_msync
14533 eval $inlibc
14534
14535 : see if munmap exists
14536 set munmap d_munmap
14537 eval $inlibc
14538
14539 : see if nice exists
14540 set nice d_nice
14541 eval $inlibc
14542
14543 : see if this is a langinfo.h system
14544 set langinfo.h i_langinfo
14545 eval $inhdr
14546
14547 : see if nl_langinfo exists
14548 set nl_langinfo d_nl_langinfo
14549 eval $inlibc
14550
14551 : check for length of character
14552 echo " "
14553 case "$charsize" in
14554 '')
14555         echo "Checking to see how big your characters are (hey, you never know)..." >&4
14556         $cat >try.c <<EOCP
14557 #include <stdio.h>
14558 #$i_stdlib I_STDLIB
14559 #ifdef I_STDLIB
14560 #include <stdlib.h>
14561 #endif
14562 int main()
14563 {
14564     printf("%d\n", (int)sizeof(char));
14565     exit(0);
14566 }
14567 EOCP
14568         set try
14569         if eval $compile_ok; then
14570                 dflt=`$run ./try`
14571         else
14572                 dflt='1'
14573                 echo "(I can't seem to compile the test program.  Guessing...)"
14574         fi
14575         ;;
14576 *)
14577         dflt="$charsize"
14578         ;;
14579 esac
14580 rp="What is the size of a character (in bytes)?"
14581 . ./myread
14582 charsize="$ans"
14583 $rm -f try.c try
14584
14585 : check for volatile keyword
14586 echo " "
14587 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
14588 $cat >try.c <<'EOCP'
14589 int main()
14590 {
14591         typedef struct _goo_struct goo_struct;
14592         goo_struct * volatile goo = ((goo_struct *)0);
14593         struct _goo_struct {
14594                 long long_int;
14595                 int reg_int;
14596                 char char_var;
14597         };
14598         typedef unsigned short foo_t;
14599         char *volatile foo;
14600         volatile int bar;
14601         volatile foo_t blech;
14602         foo = foo;
14603 }
14604 EOCP
14605 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
14606         val="$define"
14607         echo "Yup, it does."
14608 else
14609         val="$undef"
14610         echo "Nope, it doesn't."
14611 fi
14612 set d_volatile
14613 eval $setvar
14614 $rm -f try.*
14615
14616
14617 echo " "
14618 $echo "Choosing the C types to be used for Perl's internal types..." >&4
14619
14620 case "$use64bitint:$d_quad:$quadtype" in
14621 define:define:?*)
14622         ivtype="$quadtype"
14623         uvtype="$uquadtype"
14624         ivsize=8
14625         uvsize=8
14626         ;;
14627 *)      ivtype="long"
14628         uvtype="unsigned long"
14629         ivsize=$longsize
14630         uvsize=$longsize
14631         ;;
14632 esac
14633
14634 case "$uselongdouble:$d_longdbl" in
14635 define:define)
14636         nvtype="long double"
14637         nvsize=$longdblsize
14638         ;;
14639 *)      nvtype=double
14640         nvsize=$doublesize
14641         ;;
14642 esac
14643
14644 $echo "(IV will be "$ivtype", $ivsize bytes)"
14645 $echo "(UV will be "$uvtype", $uvsize bytes)"
14646 $echo "(NV will be "$nvtype", $nvsize bytes)"
14647
14648 $cat >try.c <<EOCP
14649 #$i_inttypes I_INTTYPES
14650 #ifdef I_INTTYPES
14651 #include <inttypes.h>
14652 #endif
14653 #include <stdio.h>
14654 int main() {
14655 #ifdef INT8
14656    int8_t i =  INT8_MAX;
14657   uint8_t u = UINT8_MAX;
14658   printf("int8_t\n");
14659 #endif
14660 #ifdef INT16
14661    int16_t i =  INT16_MAX;
14662   uint16_t i = UINT16_MAX;
14663   printf("int16_t\n");
14664 #endif
14665 #ifdef INT32
14666    int32_t i =  INT32_MAX;
14667   uint32_t u = UINT32_MAX;
14668   printf("int32_t\n");
14669 #endif
14670 }
14671 EOCP
14672
14673 case "$i8type" in
14674 '')     case "$charsize" in
14675         1)      i8type=char
14676                 u8type="unsigned char"
14677                 i8size=$charsize
14678                 u8size=$charsize
14679                 ;;
14680         esac
14681         ;;
14682 esac
14683 case "$i8type" in
14684 '')     set try -DINT8
14685         if eval $compile; then
14686                 case "`$run ./try`" in
14687                 int8_t) i8type=int8_t
14688                         u8type=uint8_t
14689                         i8size=1
14690                         u8size=1
14691                         ;;
14692                 esac
14693         fi
14694         ;;
14695 esac
14696 case "$i8type" in
14697 '')     if $test $charsize -ge 1; then
14698                 i8type=char
14699                 u8type="unsigned char"
14700                 i8size=$charsize
14701                 u8size=$charsize
14702         fi
14703         ;;
14704 esac
14705
14706 case "$i16type" in
14707 '')     case "$shortsize" in
14708         2)      i16type=short
14709                 u16type="unsigned short"
14710                 i16size=$shortsize
14711                 u16size=$shortsize
14712                 ;;
14713         esac
14714         ;;
14715 esac
14716 case "$i16type" in
14717 '')     set try -DINT16
14718         if eval $compile; then
14719                 case "`$run ./try`" in
14720                 int16_t)
14721                         i16type=int16_t
14722                         u16type=uint16_t
14723                         i16size=2
14724                         u16size=2
14725                         ;;
14726                 esac
14727         fi
14728         ;;
14729 esac
14730 case "$i16type" in
14731 '')     if $test $shortsize -ge 2; then
14732                 i16type=short
14733                 u16type="unsigned short"
14734                 i16size=$shortsize
14735                 u16size=$shortsize
14736         fi
14737         ;;
14738 esac
14739
14740 case "$i32type" in
14741 '')     case "$longsize" in
14742         4)      i32type=long
14743                 u32type="unsigned long"
14744                 i32size=$longsize
14745                 u32size=$longsize
14746                 ;;
14747         *)      case "$intsize" in
14748                 4)      i32type=int
14749                         u32type="unsigned int"
14750                         i32size=$intsize
14751                         u32size=$intsize
14752                         ;;
14753                 esac
14754                 ;;
14755         esac
14756         ;;
14757 esac
14758 case "$i32type" in
14759 '')     set try -DINT32
14760         if eval $compile; then
14761                 case "`$run ./try`" in
14762                 int32_t)
14763                         i32type=int32_t
14764                         u32type=uint32_t
14765                         i32size=4
14766                         u32size=4
14767                         ;;
14768                 esac
14769         fi
14770         ;;
14771 esac
14772 case "$i32type" in
14773 '')     if $test $intsize -ge 4; then
14774                 i32type=int
14775                 u32type="unsigned int"
14776                 i32size=$intsize
14777                 u32size=$intsize
14778         fi
14779         ;;
14780 esac
14781
14782 case "$i64type" in
14783 '')     case "$d_quad:$quadtype" in
14784         define:?*)
14785                 i64type="$quadtype"
14786                 u64type="$uquadtype"
14787                 i64size=8
14788                 u64size=8
14789                 ;;
14790         esac
14791         ;;
14792 esac
14793
14794 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
14795 : volatile so that the compiler has to store it out to memory.
14796 if test X"$d_volatile" = X"$define"; then
14797         volatile=volatile
14798 fi
14799 $cat <<EOP >try.c
14800 #include <stdio.h>
14801 #$i_stdlib I_STDLIB
14802 #ifdef I_STDLIB
14803 #include <stdlib.h>
14804 #endif
14805 #include <sys/types.h>
14806 #include <signal.h>
14807 #ifdef SIGFPE
14808 $volatile int bletched = 0;
14809 $signal_t blech(s) int s; { bletched = 1; }
14810 #endif
14811 int main() {
14812     $uvtype u = 0;
14813     $nvtype d;
14814     int     n = 8 * $uvsize;
14815     int     i;
14816 #ifdef SIGFPE
14817     signal(SIGFPE, blech);
14818 #endif
14819
14820     for (i = 0; i < n; i++) {
14821       u = u << 1 | ($uvtype)1;
14822       d = ($nvtype)u;
14823       if (($uvtype)d != u)
14824         break;
14825       if (d <= 0)
14826         break;
14827       d = ($nvtype)(u - 1);
14828       if (($uvtype)d != (u - 1))
14829         break;
14830 #ifdef SIGFPE
14831       if (bletched) {
14832         break;
14833 #endif
14834       } 
14835     }
14836     printf("%d\n", ((i == n) ? -n : i));
14837     exit(0);
14838 }
14839 EOP
14840 set try
14841
14842 d_nv_preserves_uv="$undef"
14843 if eval $compile; then
14844         nv_preserves_uv_bits="`$run ./try`"
14845 fi
14846 case "$nv_preserves_uv_bits" in
14847 \-[1-9]*)       
14848         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
14849         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
14850         d_nv_preserves_uv="$define"
14851         ;;
14852 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
14853         d_nv_preserves_uv="$undef" ;;
14854 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
14855         nv_preserves_uv_bits="$undef" ;;
14856 esac
14857
14858 $rm -f try.* try
14859
14860 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
14861 : volatile so that the compiler has to store it out to memory.
14862 if test X"$d_volatile" = X"$define"; then
14863         volatile=volatile
14864 fi
14865 $cat <<EOP >try.c
14866 #include <stdio.h>
14867 #$i_stdlib I_STDLIB
14868 #ifdef I_STDLIB
14869 #include <stdlib.h>
14870 #endif
14871 #$i_string I_STRING
14872 #ifdef I_STRING
14873 #  include <string.h>
14874 #else
14875 #  include <strings.h>
14876 #endif
14877 #include <sys/types.h>
14878 #include <signal.h>
14879 #ifdef SIGFPE
14880 $volatile int bletched = 0;
14881 $signal_t blech(s) int s; { bletched = 1; }
14882 #endif
14883
14884 int checkit($nvtype d, char *where) {
14885     unsigned char *p = (char *)&d;
14886     unsigned char *end = p + sizeof(d);
14887     int fail = 0;
14888
14889     while (p < end)
14890         fail += *p++;
14891
14892     if (!fail)
14893         return 0;
14894
14895     p = (char *)&d;
14896     printf("No - %s: 0x", where);
14897     while (p < end)
14898         printf ("%02X", *p++);
14899     printf("\n");
14900     return 1;
14901 }
14902
14903 int main(int argc, char **argv) {
14904     $nvtype d = 0.0;
14905     int fail = 0;
14906     fail += checkit(d, "0.0");
14907
14908     /* The compiler shouldn't be assuming that bletched is 0  */
14909     d = bletched;
14910
14911     fail += checkit(d, "bleched");
14912
14913 #ifdef SIGFPE
14914     signal(SIGFPE, blech);
14915 #endif
14916
14917     /* Paranoia - the compiler should have no way of knowing that ANSI says
14918        that argv[argc] will always be NULL.  Actually, if it did assume this it
14919        would be buggy, as this is C and main() can be called from elsewhere in
14920        the program.  */
14921     d = argv[argc] ? 1 : 0;
14922
14923     if (d) {
14924         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
14925     }
14926
14927     fail += checkit(d, "ternary");
14928
14929     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
14930
14931     if (d != 0.0) {
14932         printf("No - memset doesn't give 0.0\n");
14933         /* This might just blow up:  */
14934         printf("(gives %g)\n", d);
14935         return 1;
14936     }
14937     
14938 #ifdef SIGFPE
14939     if (bletched) {
14940         printf("No - something bleched\n");
14941         return 1;
14942     }
14943 #endif
14944     if (fail) {
14945       printf("No - %d fail(s)\n", fail);
14946       return 1;
14947     }
14948     printf("Yes\n");
14949     return 0;
14950 }
14951 EOP
14952 set try
14953
14954 d_nv_zero_is_allbits_zero="$undef"
14955 if eval $compile; then
14956     xxx="`$run ./try`"
14957     case "$?" in
14958         0)
14959             case "$xxx" in
14960                 Yes)  cat >&4 <<EOM
14961 0.0 is represented as all bits zero in memory
14962 EOM
14963                     d_nv_zero_is_allbits_zero="$define"
14964                     ;;
14965                 *)  cat >&4 <<EOM
14966 0.0 is not represented as all bits zero in memory
14967 EOM
14968                     d_nv_zero_is_allbits_zero="$undef"
14969                     ;;
14970             esac
14971             ;;
14972         *)  cat >&4 <<EOM
14973 0.0 is not represented as all bits zero in memory
14974 EOM
14975             d_nv_zero_is_allbits_zero="$undef"
14976             ;;
14977     esac
14978 fi
14979
14980 $rm -f try.* try
14981
14982
14983 : check for off64_t
14984 echo " "
14985 echo "Checking to see if you have off64_t..." >&4
14986 $cat >try.c <<EOCP
14987 #include <sys/types.h>
14988 #include <unistd.h>
14989 int main() { off64_t x = 7; }
14990 EOCP
14991 set try
14992 if eval $compile; then
14993         val="$define"
14994         echo "You have off64_t."
14995 else
14996         val="$undef"
14997         echo "You do not have off64_t."
14998         case "$lseeksize" in
14999         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15000         esac
15001 fi
15002 $rm -f try.* try
15003 set d_off64_t
15004 eval $setvar
15005
15006 : how to create joinable pthreads
15007 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15008         echo " "
15009         echo "Checking what constant to use for creating joinable pthreads..." >&4 
15010         $cat >try.c <<'EOCP'
15011 #include <pthread.h>
15012 int main() {
15013     int detachstate = JOINABLE;
15014 }
15015 EOCP
15016         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15017         if eval $compile; then
15018                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15019                 val="$undef" # Yes, undef.
15020                 set d_old_pthread_create_joinable
15021                 eval $setvar
15022                 val=""
15023                 set old_pthread_create_joinable
15024                 eval $setvar
15025         else
15026                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15027                 if eval $compile; then
15028                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15029                         val="$define"
15030                         set d_old_pthread_create_joinable
15031                         eval $setvar
15032                         val=PTHREAD_CREATE_UNDETACHED
15033                         set old_pthread_create_joinable
15034                         eval $setvar
15035                 else            
15036                         set try -DJOINABLE=__UNDETACHED
15037                         if eval $compile; then
15038                                 echo "You seem to use __UNDETACHED." >&4
15039                                 val="$define"
15040                                 set d_old_pthread_create_joinable
15041                                 eval $setvar
15042                                 val=__UNDETACHED
15043                                 set old_pthread_create_joinable
15044                                 eval $setvar
15045                         else
15046                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15047                                 val="$define"
15048                                 set d_old_pthread_create_joinable
15049                                 eval $setvar
15050                                 val=0
15051                                 set old_pthread_create_joinable
15052                                 eval $setvar
15053                         fi
15054                 fi
15055         fi
15056         $rm -f try try.*
15057 else
15058     d_old_pthread_create_joinable="$undef"
15059     old_pthread_create_joinable=""
15060 fi
15061
15062 : see if pause exists
15063 set pause d_pause
15064 eval $inlibc
15065
15066 : see if pipe exists
15067 set pipe d_pipe
15068 eval $inlibc
15069
15070 : see if poll exists
15071 set poll d_poll
15072 eval $inlibc
15073
15074 : see if readlink exists
15075 set readlink d_readlink
15076 eval $inlibc
15077
15078 echo " "
15079 procselfexe=''
15080 val="$undef"
15081 case "$d_readlink" in
15082 "$define")
15083         if $issymlink /proc/self/exe ; then
15084                 $ls -l /proc/self/exe > reflect
15085                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15086                         echo "You have Linux-like /proc/self/exe."
15087                         procselfexe='"/proc/self/exe"'
15088                         val="$define"
15089                 fi
15090         fi
15091         if $issymlink /proc/curproc/file ; then
15092                 $ls -l /proc/curproc/file > reflect
15093                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15094                         echo "You have BSD-like /proc/curproc/file."
15095                         procselfexe='"/proc/curproc/file"'
15096                         val="$define"
15097                 fi
15098         fi
15099         ;;
15100 esac
15101 $rm -f reflect
15102 set d_procselfexe
15103 eval $setvar
15104
15105 : see whether the pthread_atfork exists
15106 $cat >try.c <<EOP
15107 #include <pthread.h>
15108 #include <stdio.h>
15109 int main() {
15110 #ifdef  PTHREAD_ATFORK
15111         pthread_atfork(NULL,NULL,NULL);
15112 #endif
15113 }
15114 EOP
15115
15116 : see if pthread_atfork exists
15117 set try -DPTHREAD_ATFORK
15118 if eval $compile; then
15119     val="$define"
15120 else
15121     val="$undef"
15122 fi
15123 case "$usethreads" in
15124 $define)
15125         case "$val" in
15126         $define) echo 'pthread_atfork found.' >&4        ;;
15127         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15128         esac
15129 esac
15130 set d_pthread_atfork
15131 eval $setvar
15132
15133 : see if pthread_attr_setscope exists
15134 set pthread_attr_setscope d_pthread_attr_setscope
15135 eval $inlibc
15136
15137
15138 : see whether the various POSIXish _yields exist
15139 $cat >try.c <<EOP
15140 #include <pthread.h>
15141 #include <stdio.h>
15142 int main() {
15143 #ifdef SCHED_YIELD
15144         sched_yield();
15145 #else
15146 #ifdef PTHREAD_YIELD
15147         pthread_yield();
15148 #else
15149 #ifdef PTHREAD_YIELD_NULL
15150         pthread_yield(NULL);
15151 #endif
15152 #endif
15153 #endif
15154 }
15155 EOP
15156 : see if sched_yield exists
15157 set try -DSCHED_YIELD
15158 if eval $compile; then
15159     val="$define"
15160     sched_yield='sched_yield()'
15161 else
15162     val="$undef"
15163 fi
15164 case "$usethreads" in
15165 $define)
15166         case "$val" in
15167         $define) echo 'sched_yield() found.' >&4        ;;
15168         *)       echo 'sched_yield() NOT found.' >&4    ;;
15169         esac
15170 esac
15171 set d_sched_yield
15172 eval $setvar
15173
15174 : see if pthread_yield exists
15175 set try -DPTHREAD_YIELD
15176 if eval $compile; then
15177     val="$define"
15178     case "$sched_yield" in
15179     '') sched_yield='pthread_yield()' ;;
15180     esac
15181 else
15182     set try -DPTHREAD_YIELD_NULL
15183     if eval $compile; then
15184         val="$define"
15185         case "$sched_yield" in
15186         '') sched_yield='pthread_yield(NULL)' ;;
15187         esac
15188     else
15189         val="$undef"
15190     fi
15191 fi
15192 case "$usethreads" in
15193 $define)
15194         case "$val" in
15195         $define) echo 'pthread_yield() found.' >&4      ;;
15196         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15197         esac
15198         ;;
15199 esac
15200 set d_pthread_yield
15201 eval $setvar
15202
15203 case "$sched_yield" in
15204 '') sched_yield=undef ;;
15205 esac
15206
15207 $rm -f try try.*
15208
15209 : see if random_r exists
15210 set random_r d_random_r
15211 eval $inlibc
15212 case "$d_random_r" in
15213 "$define")
15214         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15215         case "$d_random_r_proto:$usethreads" in
15216         ":define")      d_random_r_proto=define
15217                 set d_random_r_proto random_r $hdrs
15218                 eval $hasproto ;;
15219         *)      ;;
15220         esac
15221         case "$d_random_r_proto" in
15222         define)
15223         case "$random_r_proto" in
15224         ''|0) try='int random_r(int*, struct random_data*);'
15225         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15226         esac
15227         case "$random_r_proto" in
15228         ''|0) try='int random_r(long*, struct random_data*);'
15229         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15230         esac
15231         case "$random_r_proto" in
15232         ''|0) try='int random_r(struct random_data*, int32_t*);'
15233         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15234         esac
15235         case "$random_r_proto" in
15236         ''|0)   d_random_r=undef
15237                 random_r_proto=0
15238                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
15239         * )     case "$random_r_proto" in
15240                 REENTRANT_PROTO*) ;;
15241                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15242                 esac
15243                 echo "Prototype: $try" ;;
15244         esac
15245         ;;
15246         *)      case "$usethreads" in
15247                 define) echo "random_r has no prototype, not using it." >&4 ;;
15248                 esac
15249                 d_random_r=undef
15250                 random_r_proto=0
15251                 ;;
15252         esac
15253         ;;
15254 *)      random_r_proto=0
15255         ;;
15256 esac
15257
15258 : see if readdir and friends exist
15259 set readdir d_readdir
15260 eval $inlibc
15261 set seekdir d_seekdir
15262 eval $inlibc
15263 set telldir d_telldir
15264 eval $inlibc
15265 set rewinddir d_rewinddir
15266 eval $inlibc
15267
15268 : see if readdir64_r exists
15269 set readdir64_r d_readdir64_r
15270 eval $inlibc
15271 case "$d_readdir64_r" in
15272 "$define")
15273         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15274         case "$d_readdir64_r_proto:$usethreads" in
15275         ":define")      d_readdir64_r_proto=define
15276                 set d_readdir64_r_proto readdir64_r $hdrs
15277                 eval $hasproto ;;
15278         *)      ;;
15279         esac
15280         case "$d_readdir64_r_proto" in
15281         define)
15282         case "$readdir64_r_proto" in
15283         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15284         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15285         esac
15286         case "$readdir64_r_proto" in
15287         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15288         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15289         esac
15290         case "$readdir64_r_proto" in
15291         ''|0)   d_readdir64_r=undef
15292                 readdir64_r_proto=0
15293                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
15294         * )     case "$readdir64_r_proto" in
15295                 REENTRANT_PROTO*) ;;
15296                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15297                 esac
15298                 echo "Prototype: $try" ;;
15299         esac
15300         ;;
15301         *)      case "$usethreads" in
15302                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15303                 esac
15304                 d_readdir64_r=undef
15305                 readdir64_r_proto=0
15306                 ;;
15307         esac
15308         ;;
15309 *)      readdir64_r_proto=0
15310         ;;
15311 esac
15312
15313 : see if readdir_r exists
15314 set readdir_r d_readdir_r
15315 eval $inlibc
15316 case "$d_readdir_r" in
15317 "$define")
15318         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15319         case "$d_readdir_r_proto:$usethreads" in
15320         ":define")      d_readdir_r_proto=define
15321                 set d_readdir_r_proto readdir_r $hdrs
15322                 eval $hasproto ;;
15323         *)      ;;
15324         esac
15325         case "$d_readdir_r_proto" in
15326         define)
15327         case "$readdir_r_proto" in
15328         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15329         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15330         esac
15331         case "$readdir_r_proto" in
15332         ''|0) try='int readdir_r(DIR*, struct dirent*);'
15333         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15334         esac
15335         case "$readdir_r_proto" in
15336         ''|0)   d_readdir_r=undef
15337                 readdir_r_proto=0
15338                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
15339         * )     case "$readdir_r_proto" in
15340                 REENTRANT_PROTO*) ;;
15341                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15342                 esac
15343                 echo "Prototype: $try" ;;
15344         esac
15345         ;;
15346         *)      case "$usethreads" in
15347                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15348                 esac
15349                 d_readdir_r=undef
15350                 readdir_r_proto=0
15351                 ;;
15352         esac
15353         ;;
15354 *)      readdir_r_proto=0
15355         ;;
15356 esac
15357
15358 : see if readv exists
15359 set readv d_readv
15360 eval $inlibc
15361
15362 : see if recvmsg exists
15363 set recvmsg d_recvmsg
15364 eval $inlibc
15365
15366 : see if rename exists
15367 set rename d_rename
15368 eval $inlibc
15369
15370 : see if rmdir exists
15371 set rmdir d_rmdir
15372 eval $inlibc
15373
15374 : see if memory.h is available.
15375 val=''
15376 set memory.h val
15377 eval $inhdr
15378
15379 : See if it conflicts with string.h
15380 case "$val" in
15381 $define)
15382         case "$strings" in
15383         '') ;;
15384         *)
15385                 $cppstdin $cppflags $cppminus < $strings > mem.h
15386                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15387                         echo " "
15388                         echo "We won't be including <memory.h>."
15389                         val="$undef"
15390                 fi
15391                 $rm -f mem.h
15392                 ;;
15393         esac
15394 esac
15395 set i_memory
15396 eval $setvar
15397
15398 : can bcopy handle overlapping blocks?
15399 echo " "
15400 val="$undef"
15401 case "$d_memmove" in
15402 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15403 *)      case "$d_bcopy" in
15404         "$define")
15405                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15406                 $cat >try.c <<EOCP
15407 #$i_memory I_MEMORY
15408 #$i_stdlib I_STDLIB
15409 #$i_string I_STRING
15410 #$i_unistd I_UNISTD
15411 EOCP
15412         $cat >>try.c <<'EOCP'
15413 #include <stdio.h>
15414 #ifdef I_MEMORY
15415 #  include <memory.h>
15416 #endif
15417 #ifdef I_STDLIB
15418 #  include <stdlib.h>
15419 #endif
15420 #ifdef I_STRING
15421 #  include <string.h>
15422 #else
15423 #  include <strings.h>
15424 #endif
15425 #ifdef I_UNISTD
15426 #  include <unistd.h>  /* Needed for NetBSD */
15427 #endif
15428 int main()
15429 {
15430 char buf[128], abc[128];
15431 char *b;
15432 int len;
15433 int off;
15434 int align;
15435
15436 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15437    try to store the string in read-only memory. */
15438 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15439
15440 for (align = 7; align >= 0; align--) {
15441         for (len = 36; len; len--) {
15442                 b = buf+align;
15443                 bcopy(abc, b, len);
15444                 for (off = 1; off <= len; off++) {
15445                         bcopy(b, b+off, len);
15446                         bcopy(b+off, b, len);
15447                         if (bcmp(b, abc, len))
15448                                 exit(1);
15449                 }
15450         }
15451 }
15452 exit(0);
15453 }
15454 EOCP
15455                 set try
15456                 if eval $compile_ok; then
15457                         if ./try 2>/dev/null; then
15458                                 echo "Yes, it can."
15459                                 val="$define"
15460                         else
15461                                 echo "It can't, sorry."
15462                         fi
15463                 else
15464                         echo "(I can't compile the test program, so we'll assume not...)"
15465                 fi
15466                 ;;
15467         esac
15468         $rm -f try.* try core
15469         ;;
15470 esac
15471 set d_safebcpy
15472 eval $setvar
15473
15474 : can memcpy handle overlapping blocks?
15475 echo " "
15476 val="$undef"
15477 case "$d_memmove" in
15478 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15479 *)      case "$d_memcpy" in
15480         "$define")
15481                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
15482                 $cat >try.c <<EOCP
15483 #$i_memory I_MEMORY
15484 #$i_stdlib I_STDLIB
15485 #$i_string I_STRING
15486 #$i_unistd I_UNISTD
15487 EOCP
15488         $cat >>try.c <<'EOCP'
15489 #include <stdio.h>
15490 #ifdef I_MEMORY
15491 #  include <memory.h>
15492 #endif
15493 #ifdef I_STDLIB
15494 #  include <stdlib.h>
15495 #endif
15496 #ifdef I_STRING
15497 #  include <string.h>
15498 #else
15499 #  include <strings.h>
15500 #endif
15501 #ifdef I_UNISTD
15502 #  include <unistd.h>  /* Needed for NetBSD */
15503 #endif
15504 int main()
15505 {
15506 char buf[128], abc[128];
15507 char *b;
15508 int len;
15509 int off;
15510 int align;
15511
15512 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15513    try to store the string in read-only memory. */
15514 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
15515
15516 for (align = 7; align >= 0; align--) {
15517         for (len = 36; len; len--) {
15518                 b = buf+align;
15519                 memcpy(b, abc, len);
15520                 for (off = 1; off <= len; off++) {
15521                         memcpy(b+off, b, len);
15522                         memcpy(b, b+off, len);
15523                         if (memcmp(b, abc, len))
15524                                 exit(1);
15525                 }
15526         }
15527 }
15528 exit(0);
15529 }
15530 EOCP
15531                 set try
15532                 if eval $compile_ok; then
15533                         if ./try 2>/dev/null; then
15534                                 echo "Yes, it can."
15535                                 val="$define"
15536                         else
15537                                 echo "It can't, sorry."
15538                         fi
15539                 else
15540                         echo "(I can't compile the test program, so we'll assume not...)"
15541                 fi
15542                 ;;
15543         esac
15544         $rm -f try.* try core
15545         ;;
15546 esac
15547 set d_safemcpy
15548 eval $setvar
15549
15550 : can memcmp be trusted to compare relative magnitude?
15551 val="$undef"
15552 case "$d_memcmp" in
15553 "$define")
15554         echo " "
15555         echo "Checking if your memcmp() can compare relative magnitude..." >&4
15556         $cat >try.c <<EOCP
15557 #$i_memory I_MEMORY
15558 #$i_stdlib I_STDLIB
15559 #$i_string I_STRING
15560 #$i_unistd I_UNISTD
15561 EOCP
15562         $cat >>try.c <<'EOCP'
15563 #include <stdio.h>
15564 #ifdef I_MEMORY
15565 #  include <memory.h>
15566 #endif
15567 #ifdef I_STDLIB
15568 #  include <stdlib.h>
15569 #endif
15570 #ifdef I_STRING
15571 #  include <string.h>
15572 #else
15573 #  include <strings.h>
15574 #endif
15575 #ifdef I_UNISTD
15576 #  include <unistd.h>  /* Needed for NetBSD */
15577 #endif
15578 int main()
15579 {
15580 char a = -1;
15581 char b = 0;
15582 if ((a < b) && memcmp(&a, &b, 1) < 0)
15583         exit(1);
15584 exit(0);
15585 }
15586 EOCP
15587         set try
15588         if eval $compile_ok; then
15589                 if $run ./try 2>/dev/null; then
15590                         echo "Yes, it can."
15591                         val="$define"
15592                 else
15593                         echo "No, it can't (it uses signed chars)."
15594                 fi
15595         else
15596                 echo "(I can't compile the test program, so we'll assume not...)"
15597         fi
15598         ;;
15599 esac
15600 $rm -f try.* try core
15601 set d_sanemcmp
15602 eval $setvar
15603
15604 : see if prototype for sbrk is available
15605 echo " "
15606 set d_sbrkproto sbrk $i_unistd unistd.h
15607 eval $hasproto
15608
15609 : see if select exists
15610 set select d_select
15611 eval $inlibc
15612
15613 : see if semctl exists
15614 set semctl d_semctl
15615 eval $inlibc
15616
15617 : see if semget exists
15618 set semget d_semget
15619 eval $inlibc
15620
15621 : see if semop exists
15622 set semop d_semop
15623 eval $inlibc
15624
15625 : see how much of the 'sem*(2)' library is present.
15626 h_sem=true
15627 echo " "
15628 case "$d_semctl$d_semget$d_semop" in
15629 *"$undef"*) h_sem=false;;
15630 esac
15631 case "$osname" in
15632 freebsd)
15633     case "`ipcs 2>&1`" in
15634     "SVID messages"*"not configured"*)
15635         echo "Your $osname does not have the sem*(2) configured." >&4
15636         h_sem=false
15637         val="$undef"
15638         set semctl d_semctl
15639         eval $setvar
15640         set semget d_semget
15641         eval $setvar
15642         set semop d_semop
15643         eval $setvar
15644         ;;
15645     esac
15646     ;;
15647 esac
15648 : we could also check for sys/ipc.h ...
15649 if $h_sem && $test `./findhdr sys/sem.h`; then
15650         echo "You have the full sem*(2) library." >&4
15651         val="$define"
15652 else
15653         echo "You don't have the full sem*(2) library." >&4
15654         val="$undef"
15655 fi
15656 set d_sem
15657 eval $setvar
15658
15659 : see whether sys/sem.h defines union semun
15660 echo " "
15661 $cat > try.c <<'END'
15662 #include <sys/types.h>
15663 #include <sys/ipc.h>
15664 #include <sys/sem.h>
15665 int main () { union semun semun; semun.buf = 0; }
15666 END
15667 set try
15668 if eval $compile; then
15669     echo "You have union semun in <sys/sem.h>." >&4
15670     val="$define"
15671 else
15672     echo "You do not have union semun in <sys/sem.h>." >&4
15673     val="$undef"
15674 fi
15675 $rm -f try try.c
15676 set d_union_semun
15677 eval $setvar
15678
15679 : see how to do semctl IPC_STAT
15680 case "$d_sem" in
15681 $define)
15682     echo " "
15683     $cat > try.h <<END
15684 #ifndef S_IRUSR
15685 #   ifdef S_IREAD
15686 #       define S_IRUSR S_IREAD
15687 #       define S_IWUSR S_IWRITE
15688 #       define S_IXUSR S_IEXEC
15689 #   else
15690 #       define S_IRUSR 0400
15691 #       define S_IWUSR 0200
15692 #       define S_IXUSR 0100
15693 #   endif
15694 #   define S_IRGRP (S_IRUSR>>3)
15695 #   define S_IWGRP (S_IWUSR>>3)
15696 #   define S_IXGRP (S_IXUSR>>3)
15697 #   define S_IROTH (S_IRUSR>>6)
15698 #   define S_IWOTH (S_IWUSR>>6)
15699 #   define S_IXOTH (S_IXUSR>>6)
15700 #endif
15701 #ifndef S_IRWXU
15702 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
15703 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
15704 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
15705 #endif
15706 END
15707     : see whether semctl IPC_STAT can use union semun
15708     val="$undef"
15709     case "$d_semctl_semun" in
15710     '')
15711       $cat > try.c <<END
15712 #include <sys/types.h>
15713 #include <sys/ipc.h>
15714 #include <sys/sem.h>
15715 #include <sys/stat.h>
15716 #include <stdio.h>
15717 #include <errno.h>
15718 #include "try.h"
15719 #ifndef errno
15720 extern int errno;
15721 #endif
15722 #$d_union_semun HAS_UNION_SEMUN
15723 int main() {
15724     union semun
15725 #ifndef HAS_UNION_SEMUN
15726     {
15727         int val;
15728         struct semid_ds *buf;
15729         unsigned short *array;
15730     }
15731 #endif
15732     arg;
15733     int sem, st;
15734
15735 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
15736     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15737     if (sem > -1) {
15738         struct semid_ds argbuf;
15739         arg.buf = &argbuf;
15740 #       ifdef IPC_STAT
15741         st = semctl(sem, 0, IPC_STAT, arg);
15742         if (st == 0)
15743             printf("semun\n");
15744         else
15745 #       endif /* IPC_STAT */
15746             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15747 #       ifdef IPC_RMID
15748         if (semctl(sem, 0, IPC_RMID, arg) != 0)
15749 #       endif /* IPC_RMID */
15750             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15751     } else
15752 #endif /* IPC_PRIVATE && ... */
15753         printf("semget failed: errno = %d\n", errno);
15754   return 0;
15755 }
15756 END
15757       set try
15758       if eval $compile; then
15759           xxx=`$run ./try`
15760           case "$xxx" in
15761           semun) val="$define" ;;
15762           esac
15763       fi
15764       $rm -f try try.c
15765       ;;
15766     esac
15767     set d_semctl_semun
15768     eval $setvar
15769     case "$d_semctl_semun" in
15770     $define)
15771         echo "You can use union semun for semctl IPC_STAT." >&4
15772         also='also'
15773         ;;
15774     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
15775         also=''
15776         ;;
15777     esac
15778
15779     : see whether semctl IPC_STAT can use struct semid_ds pointer
15780     val="$undef"
15781     case "$d_semctl_semid_ds" in
15782     '')
15783       $cat > try.c <<'END'
15784 #include <sys/types.h>
15785 #include <sys/ipc.h>
15786 #include <sys/sem.h>
15787 #include <sys/stat.h>
15788 #include "try.h"
15789 #include <stdio.h>
15790 #include <errno.h>
15791 #ifndef errno
15792 extern int errno;
15793 #endif
15794 int main() {
15795     struct semid_ds arg;
15796     int sem, st;
15797
15798 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
15799     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15800     if (sem > -1) {
15801 #       ifdef IPC_STAT
15802         st = semctl(sem, 0, IPC_STAT, &arg);
15803         if (st == 0)
15804             printf("semid_ds\n");
15805         else
15806 #       endif /* IPC_STAT */
15807             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15808 #       ifdef IPC_RMID
15809         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
15810 #       endif /* IPC_RMID */
15811             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15812     } else
15813 #endif /* IPC_PRIVATE && ... */
15814         printf("semget failed: errno = %d\n", errno);
15815
15816     return 0;
15817 }
15818 END
15819       set try
15820       if eval $compile; then
15821           xxx=`$run ./try`
15822           case "$xxx" in
15823           semid_ds) val="$define" ;;
15824           esac
15825       fi
15826       $rm -f try try.c
15827       ;;
15828     esac
15829     set d_semctl_semid_ds
15830     eval $setvar
15831     case "$d_semctl_semid_ds" in
15832     $define)
15833         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
15834         ;;
15835     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
15836         ;;
15837     esac
15838     $rm -f try.h
15839     ;;
15840 *)  val="$undef"
15841
15842     # We do not have the full sem*(2) library, so assume we can not
15843     # use either.
15844
15845     set d_semctl_semun
15846     eval $setvar
15847
15848     set d_semctl_semid_ds
15849     eval $setvar
15850     ;;
15851 esac
15852
15853 : see if sendmsg exists
15854 set sendmsg d_sendmsg
15855 eval $inlibc
15856
15857 : see if setegid exists
15858 set setegid d_setegid
15859 eval $inlibc
15860
15861 : see if seteuid exists
15862 set seteuid d_seteuid
15863 eval $inlibc
15864
15865 : see if setgrent exists
15866 set setgrent d_setgrent
15867 eval $inlibc
15868
15869 : see if setgrent_r exists
15870 set setgrent_r d_setgrent_r
15871 eval $inlibc
15872 case "$d_setgrent_r" in
15873 "$define")
15874         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
15875         case "$d_setgrent_r_proto:$usethreads" in
15876         ":define")      d_setgrent_r_proto=define
15877                 set d_setgrent_r_proto setgrent_r $hdrs
15878                 eval $hasproto ;;
15879         *)      ;;
15880         esac
15881         case "$d_setgrent_r_proto" in
15882         define)
15883         case "$setgrent_r_proto" in
15884         ''|0) try='int setgrent_r(FILE**);'
15885         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
15886         esac
15887         case "$setgrent_r_proto" in
15888         ''|0) try='void setgrent_r(FILE**);'
15889         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
15890         esac
15891         case "$setgrent_r_proto" in
15892         ''|0)   d_setgrent_r=undef
15893                 setgrent_r_proto=0
15894                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
15895         * )     case "$setgrent_r_proto" in
15896                 REENTRANT_PROTO*) ;;
15897                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
15898                 esac
15899                 echo "Prototype: $try" ;;
15900         esac
15901         ;;
15902         *)      case "$usethreads" in
15903                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
15904                 esac
15905                 d_setgrent_r=undef
15906                 setgrent_r_proto=0
15907                 ;;
15908         esac
15909         ;;
15910 *)      setgrent_r_proto=0
15911         ;;
15912 esac
15913
15914 : see if sethostent exists
15915 set sethostent d_sethent
15916 eval $inlibc
15917
15918 : see if sethostent_r exists
15919 set sethostent_r d_sethostent_r
15920 eval $inlibc
15921 case "$d_sethostent_r" in
15922 "$define")
15923         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15924         case "$d_sethostent_r_proto:$usethreads" in
15925         ":define")      d_sethostent_r_proto=define
15926                 set d_sethostent_r_proto sethostent_r $hdrs
15927                 eval $hasproto ;;
15928         *)      ;;
15929         esac
15930         case "$d_sethostent_r_proto" in
15931         define)
15932         case "$sethostent_r_proto" in
15933         ''|0) try='int sethostent_r(int, struct hostent_data*);'
15934         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
15935         esac
15936         case "$sethostent_r_proto" in
15937         ''|0) try='void sethostent_r(int, struct hostent_data*);'
15938         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
15939         esac
15940         case "$sethostent_r_proto" in
15941         ''|0)   d_sethostent_r=undef
15942                 sethostent_r_proto=0
15943                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
15944         * )     case "$sethostent_r_proto" in
15945                 REENTRANT_PROTO*) ;;
15946                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
15947                 esac
15948                 echo "Prototype: $try" ;;
15949         esac
15950         ;;
15951         *)      case "$usethreads" in
15952                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
15953                 esac
15954                 d_sethostent_r=undef
15955                 sethostent_r_proto=0
15956                 ;;
15957         esac
15958         ;;
15959 *)      sethostent_r_proto=0
15960         ;;
15961 esac
15962
15963 : see if setitimer exists
15964 set setitimer d_setitimer
15965 eval $inlibc
15966
15967 : see if setlinebuf exists
15968 set setlinebuf d_setlinebuf
15969 eval $inlibc
15970
15971 : see if setlocale exists
15972 set setlocale d_setlocale
15973 eval $inlibc
15974
15975 : see if locale.h is available
15976 set locale.h i_locale
15977 eval $inhdr
15978
15979 : see if setlocale_r exists
15980 set setlocale_r d_setlocale_r
15981 eval $inlibc
15982 case "$d_setlocale_r" in
15983 "$define")
15984         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
15985         case "$d_setlocale_r_proto:$usethreads" in
15986         ":define")      d_setlocale_r_proto=define
15987                 set d_setlocale_r_proto setlocale_r $hdrs
15988                 eval $hasproto ;;
15989         *)      ;;
15990         esac
15991         case "$d_setlocale_r_proto" in
15992         define)
15993         case "$setlocale_r_proto" in
15994         ''|0) try='int setlocale_r(int, const char*, char*, int);'
15995         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
15996         esac
15997         case "$setlocale_r_proto" in
15998         ''|0)   d_setlocale_r=undef
15999                 setlocale_r_proto=0
16000                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16001         * )     case "$setlocale_r_proto" in
16002                 REENTRANT_PROTO*) ;;
16003                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16004                 esac
16005                 echo "Prototype: $try" ;;
16006         esac
16007         ;;
16008         *)      case "$usethreads" in
16009                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16010                 esac
16011                 d_setlocale_r=undef
16012                 setlocale_r_proto=0
16013                 ;;
16014         esac
16015         ;;
16016 *)      setlocale_r_proto=0
16017         ;;
16018 esac
16019
16020 : see if setnetent exists
16021 set setnetent d_setnent
16022 eval $inlibc
16023
16024 : see if setnetent_r exists
16025 set setnetent_r d_setnetent_r
16026 eval $inlibc
16027 case "$d_setnetent_r" in
16028 "$define")
16029         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16030         case "$d_setnetent_r_proto:$usethreads" in
16031         ":define")      d_setnetent_r_proto=define
16032                 set d_setnetent_r_proto setnetent_r $hdrs
16033                 eval $hasproto ;;
16034         *)      ;;
16035         esac
16036         case "$d_setnetent_r_proto" in
16037         define)
16038         case "$setnetent_r_proto" in
16039         ''|0) try='int setnetent_r(int, struct netent_data*);'
16040         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16041         esac
16042         case "$setnetent_r_proto" in
16043         ''|0) try='void setnetent_r(int, struct netent_data*);'
16044         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16045         esac
16046         case "$setnetent_r_proto" in
16047         ''|0)   d_setnetent_r=undef
16048                 setnetent_r_proto=0
16049                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16050         * )     case "$setnetent_r_proto" in
16051                 REENTRANT_PROTO*) ;;
16052                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16053                 esac
16054                 echo "Prototype: $try" ;;
16055         esac
16056         ;;
16057         *)      case "$usethreads" in
16058                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16059                 esac
16060                 d_setnetent_r=undef
16061                 setnetent_r_proto=0
16062                 ;;
16063         esac
16064         ;;
16065 *)      setnetent_r_proto=0
16066         ;;
16067 esac
16068
16069 : see if setprotoent exists
16070 set setprotoent d_setpent
16071 eval $inlibc
16072
16073 : see if setpgid exists
16074 set setpgid d_setpgid
16075 eval $inlibc
16076
16077 : see if setpgrp2 exists
16078 set setpgrp2 d_setpgrp2
16079 eval $inlibc
16080
16081 : see if setpriority exists
16082 set setpriority d_setprior
16083 eval $inlibc
16084
16085 : see if setproctitle exists
16086 set setproctitle d_setproctitle
16087 eval $inlibc
16088
16089 : see if setprotoent_r exists
16090 set setprotoent_r d_setprotoent_r
16091 eval $inlibc
16092 case "$d_setprotoent_r" in
16093 "$define")
16094         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16095         case "$d_setprotoent_r_proto:$usethreads" in
16096         ":define")      d_setprotoent_r_proto=define
16097                 set d_setprotoent_r_proto setprotoent_r $hdrs
16098                 eval $hasproto ;;
16099         *)      ;;
16100         esac
16101         case "$d_setprotoent_r_proto" in
16102         define)
16103         case "$setprotoent_r_proto" in
16104         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16105         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16106         esac
16107         case "$setprotoent_r_proto" in
16108         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16109         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16110         esac
16111         case "$setprotoent_r_proto" in
16112         ''|0)   d_setprotoent_r=undef
16113                 setprotoent_r_proto=0
16114                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16115         * )     case "$setprotoent_r_proto" in
16116                 REENTRANT_PROTO*) ;;
16117                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16118                 esac
16119                 echo "Prototype: $try" ;;
16120         esac
16121         ;;
16122         *)      case "$usethreads" in
16123                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16124                 esac
16125                 d_setprotoent_r=undef
16126                 setprotoent_r_proto=0
16127                 ;;
16128         esac
16129         ;;
16130 *)      setprotoent_r_proto=0
16131         ;;
16132 esac
16133
16134 : see if setpwent exists
16135 set setpwent d_setpwent
16136 eval $inlibc
16137
16138 : see if setpwent_r exists
16139 set setpwent_r d_setpwent_r
16140 eval $inlibc
16141 case "$d_setpwent_r" in
16142 "$define")
16143         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16144         case "$d_setpwent_r_proto:$usethreads" in
16145         ":define")      d_setpwent_r_proto=define
16146                 set d_setpwent_r_proto setpwent_r $hdrs
16147                 eval $hasproto ;;
16148         *)      ;;
16149         esac
16150         case "$d_setpwent_r_proto" in
16151         define)
16152         case "$setpwent_r_proto" in
16153         ''|0) try='int setpwent_r(FILE**);'
16154         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16155         esac
16156         case "$setpwent_r_proto" in
16157         ''|0) try='void setpwent_r(FILE**);'
16158         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16159         esac
16160         case "$setpwent_r_proto" in
16161         ''|0)   d_setpwent_r=undef
16162                 setpwent_r_proto=0
16163                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16164         * )     case "$setpwent_r_proto" in
16165                 REENTRANT_PROTO*) ;;
16166                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16167                 esac
16168                 echo "Prototype: $try" ;;
16169         esac
16170         ;;
16171         *)      case "$usethreads" in
16172                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16173                 esac
16174                 d_setpwent_r=undef
16175                 setpwent_r_proto=0
16176                 ;;
16177         esac
16178         ;;
16179 *)      setpwent_r_proto=0
16180         ;;
16181 esac
16182
16183 : see if setregid exists
16184 set setregid d_setregid
16185 eval $inlibc
16186 set setresgid d_setresgid
16187 eval $inlibc
16188
16189 : see if setreuid exists
16190 set setreuid d_setreuid
16191 eval $inlibc
16192 set setresuid d_setresuid
16193 eval $inlibc
16194
16195 : see if setrgid exists
16196 set setrgid d_setrgid
16197 eval $inlibc
16198
16199 : see if setruid exists
16200 set setruid d_setruid
16201 eval $inlibc
16202
16203 : see if setservent exists
16204 set setservent d_setsent
16205 eval $inlibc
16206
16207 : see if setservent_r exists
16208 set setservent_r d_setservent_r
16209 eval $inlibc
16210 case "$d_setservent_r" in
16211 "$define")
16212         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16213         case "$d_setservent_r_proto:$usethreads" in
16214         ":define")      d_setservent_r_proto=define
16215                 set d_setservent_r_proto setservent_r $hdrs
16216                 eval $hasproto ;;
16217         *)      ;;
16218         esac
16219         case "$d_setservent_r_proto" in
16220         define)
16221         case "$setservent_r_proto" in
16222         ''|0) try='int setservent_r(int, struct servent_data*);'
16223         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16224         esac
16225         case "$setservent_r_proto" in
16226         ''|0) try='void setservent_r(int, struct servent_data*);'
16227         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16228         esac
16229         case "$setservent_r_proto" in
16230         ''|0)   d_setservent_r=undef
16231                 setservent_r_proto=0
16232                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16233         * )     case "$setservent_r_proto" in
16234                 REENTRANT_PROTO*) ;;
16235                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16236                 esac
16237                 echo "Prototype: $try" ;;
16238         esac
16239         ;;
16240         *)      case "$usethreads" in
16241                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16242                 esac
16243                 d_setservent_r=undef
16244                 setservent_r_proto=0
16245                 ;;
16246         esac
16247         ;;
16248 *)      setservent_r_proto=0
16249         ;;
16250 esac
16251
16252 : see if setsid exists
16253 set setsid d_setsid
16254 eval $inlibc
16255
16256 : see if setvbuf exists
16257 set setvbuf d_setvbuf
16258 eval $inlibc
16259
16260 : see if sfio.h is available
16261 set sfio.h i_sfio
16262 eval $inhdr
16263
16264
16265 : see if sfio library is available
16266 case "$i_sfio" in
16267 $define)
16268         val=''
16269         set sfreserve val
16270         eval $inlibc
16271         ;;
16272 *)
16273         val="$undef"
16274         ;;
16275 esac
16276 : Ok, but do we want to use it.
16277 case "$val" in
16278 $define)
16279         case "$usesfio" in
16280         true|$define|[yY]*) dflt='y';;
16281         *) dflt='n';;
16282         esac
16283         echo "$package can use the sfio library, but it is experimental."
16284         case "$useperlio" in
16285         "$undef")
16286             echo "For sfio also the PerlIO abstraction layer is needed."
16287             echo "Earlier you said you wouldn't want that."
16288             ;;
16289         esac
16290         rp="You seem to have sfio available, do you want to try using it?"
16291         . ./myread
16292         case "$ans" in
16293         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
16294                 useperlio="$define"
16295                 val="$define"
16296                 ;;
16297         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
16298                 val="$undef"
16299                 ;;
16300         esac
16301         ;;
16302 *)      case "$usesfio" in
16303         true|$define|[yY]*)
16304                 echo "Sorry, cannot find sfio on this machine." >&4
16305                 echo "Ignoring your setting of usesfio=$usesfio." >&4
16306                 val="$undef"
16307                 ;;
16308         esac
16309         ;;
16310 esac
16311 set d_sfio
16312 eval $setvar
16313 case "$d_sfio" in
16314 $define) usesfio='true';;
16315 *) usesfio='false';;
16316 esac
16317 case "$d_sfio" in
16318 $define) ;;
16319 *)      : Remove sfio from list of libraries to use
16320         case "$libs" in
16321         *-lsfio*)
16322                 echo "Removing unneeded -lsfio from library list" >&4
16323                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16324                 shift
16325                 libs="$*"
16326                 echo "libs = $libs" >&4
16327                 ;;
16328         esac
16329 ;;
16330 esac
16331
16332
16333 : see if shmctl exists
16334 set shmctl d_shmctl
16335 eval $inlibc
16336
16337 : see if shmget exists
16338 set shmget d_shmget
16339 eval $inlibc
16340
16341 : see if shmat exists
16342 set shmat d_shmat
16343 eval $inlibc
16344 : see what shmat returns
16345 case "$d_shmat" in
16346 "$define")
16347         $cat >shmat.c <<'END'
16348 #include <sys/shm.h>
16349 void *shmat();
16350 END
16351         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16352                 shmattype='void *'
16353         else
16354                 shmattype='char *'
16355         fi
16356         echo "and it returns ($shmattype)." >&4
16357         : see if a prototype for shmat is available
16358         xxx=`./findhdr sys/shm.h`
16359         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16360         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16361                 val="$define"
16362         else
16363                 val="$undef"
16364         fi
16365         $rm -f shmat.[co]
16366         ;;
16367 *)
16368         val="$undef"
16369         ;;
16370 esac
16371 set d_shmatprototype
16372 eval $setvar
16373
16374 : see if shmdt exists
16375 set shmdt d_shmdt
16376 eval $inlibc
16377
16378 : see how much of the 'shm*(2)' library is present.
16379 h_shm=true
16380 echo " "
16381 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16382 *"$undef"*) h_shm=false;;
16383 esac
16384 case "$osname" in
16385 freebsd)
16386     case "`ipcs 2>&1`" in
16387     "SVID shared memory"*"not configured"*)
16388         echo "Your $osname does not have the shm*(2) configured." >&4
16389         h_shm=false
16390         val="$undef"
16391         set shmctl d_shmctl
16392         evat $setvar
16393         set shmget d_shmget
16394         evat $setvar
16395         set shmat d_shmat
16396         evat $setvar
16397         set shmdt d_shmdt
16398         evat $setvar
16399         ;;
16400     esac
16401     ;;
16402 esac
16403 : we could also check for sys/ipc.h ...
16404 if $h_shm && $test `./findhdr sys/shm.h`; then
16405         echo "You have the full shm*(2) library." >&4
16406         val="$define"
16407 else
16408         echo "You don't have the full shm*(2) library." >&4
16409         val="$undef"
16410 fi
16411 set d_shm
16412 eval $setvar
16413
16414 echo " "
16415 : see if we have sigaction
16416 if set sigaction val -f d_sigaction; eval $csym; $val; then
16417         echo 'sigaction() found.' >&4
16418         $cat > try.c <<EOP
16419 #include <stdio.h>
16420 #include <sys/types.h>
16421 #include <signal.h>
16422 #$i_stdlib I_STDLIB
16423 #ifdef I_STDLIB
16424 #include <stdlib.h>
16425 #endif
16426 int main()
16427 {
16428     struct sigaction act, oact;
16429     act.sa_flags = 0;
16430     oact.sa_handler = 0;
16431     /* so that act and oact are used */
16432     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
16433 }
16434 EOP
16435         set try
16436         if eval $compile_ok; then
16437                 val="$define"
16438         else
16439                 echo "But you don't seem to have a useable struct sigaction." >&4
16440                 val="$undef"
16441         fi
16442 else
16443         echo 'sigaction NOT found.' >&4
16444         val="$undef"
16445 fi
16446 set d_sigaction; eval $setvar
16447 $rm -f try try$_o try.c
16448
16449 : see if sigprocmask exists
16450 set sigprocmask d_sigprocmask
16451 eval $inlibc
16452
16453 : see if sigsetjmp exists
16454 echo " "
16455 case "$d_sigsetjmp" in
16456 '')
16457         $cat >try.c <<EOP
16458 #include <setjmp.h>
16459 #$i_stdlib I_STDLIB
16460 #ifdef I_STDLIB
16461 #include <stdlib.h>
16462 #endif
16463 sigjmp_buf env;
16464 int set = 1;
16465 int main()
16466 {
16467         if (sigsetjmp(env,1))
16468                 exit(set);
16469         set = 0;
16470         siglongjmp(env, 1);
16471         exit(1);
16472 }
16473 EOP
16474         set try
16475         if eval $compile; then
16476                 if $run ./try >/dev/null 2>&1; then
16477                         echo "POSIX sigsetjmp found." >&4
16478                         val="$define"
16479                 else
16480                         $cat >&4 <<EOM
16481 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
16482 I'll ignore them.
16483 EOM
16484                         val="$undef"
16485                 fi
16486         else
16487                 echo "sigsetjmp not found." >&4
16488                 val="$undef"
16489         fi
16490         ;;
16491 *) val="$d_sigsetjmp"
16492         case "$d_sigsetjmp" in
16493         $define) echo "POSIX sigsetjmp found." >&4;;
16494         $undef) echo "sigsetjmp not found." >&4;;
16495         esac
16496         ;;
16497 esac
16498 set d_sigsetjmp
16499 eval $setvar
16500 $rm -f try.c try
16501
16502 : see if sockatmark exists
16503 set sockatmark d_sockatmark
16504 eval $inlibc
16505
16506 : see if prototype for sockatmark is available
16507 echo " "
16508 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
16509 eval $hasproto
16510
16511 : see if socks5_init exists
16512 set socks5_init d_socks5_init
16513 eval $inlibc
16514
16515 : see if srand48_r exists
16516 set srand48_r d_srand48_r
16517 eval $inlibc
16518 case "$d_srand48_r" in
16519 "$define")
16520         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16521         case "$d_srand48_r_proto:$usethreads" in
16522         ":define")      d_srand48_r_proto=define
16523                 set d_srand48_r_proto srand48_r $hdrs
16524                 eval $hasproto ;;
16525         *)      ;;
16526         esac
16527         case "$d_srand48_r_proto" in
16528         define)
16529         case "$srand48_r_proto" in
16530         ''|0) try='int srand48_r(long, struct drand48_data*);'
16531         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
16532         esac
16533         case "$srand48_r_proto" in
16534         ''|0)   d_srand48_r=undef
16535                 srand48_r_proto=0
16536                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
16537         * )     case "$srand48_r_proto" in
16538                 REENTRANT_PROTO*) ;;
16539                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
16540                 esac
16541                 echo "Prototype: $try" ;;
16542         esac
16543         ;;
16544         *)      case "$usethreads" in
16545                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
16546                 esac
16547                 d_srand48_r=undef
16548                 srand48_r_proto=0
16549                 ;;
16550         esac
16551         ;;
16552 *)      srand48_r_proto=0
16553         ;;
16554 esac
16555
16556 : see if srandom_r exists
16557 set srandom_r d_srandom_r
16558 eval $inlibc
16559 case "$d_srandom_r" in
16560 "$define")
16561         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16562         case "$d_srandom_r_proto:$usethreads" in
16563         ":define")      d_srandom_r_proto=define
16564                 set d_srandom_r_proto srandom_r $hdrs
16565                 eval $hasproto ;;
16566         *)      ;;
16567         esac
16568         case "$d_srandom_r_proto" in
16569         define)
16570         case "$srandom_r_proto" in
16571         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
16572         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
16573         esac
16574         case "$srandom_r_proto" in
16575         ''|0)   d_srandom_r=undef
16576                 srandom_r_proto=0
16577                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
16578         * )     case "$srandom_r_proto" in
16579                 REENTRANT_PROTO*) ;;
16580                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
16581                 esac
16582                 echo "Prototype: $try" ;;
16583         esac
16584         ;;
16585         *)      case "$usethreads" in
16586                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
16587                 esac
16588                 d_srandom_r=undef
16589                 srandom_r_proto=0
16590                 ;;
16591         esac
16592         ;;
16593 *)      srandom_r_proto=0
16594         ;;
16595 esac
16596
16597 : see if prototype for setresgid is available
16598 echo " "
16599 set d_sresgproto setresgid $i_unistd unistd.h
16600 eval $hasproto
16601
16602 : see if prototype for setresuid is available
16603 echo " "
16604 set d_sresuproto setresuid $i_unistd unistd.h
16605 eval $hasproto
16606
16607 : see if sys/stat.h is available
16608 set sys/stat.h i_sysstat
16609 eval $inhdr
16610
16611
16612 : see if stat knows about block sizes
16613 echo " "
16614 echo "Checking to see if your struct stat has st_blocks field..." >&4
16615 set d_statblks stat st_blocks $i_sysstat sys/stat.h
16616 eval $hasfield
16617
16618
16619 : see if this is a sys/vfs.h system
16620 set sys/vfs.h i_sysvfs
16621 eval $inhdr
16622
16623
16624 : see if this is a sys/statfs.h system
16625 set sys/statfs.h i_sysstatfs
16626 eval $inhdr
16627
16628
16629 echo " "
16630 echo "Checking to see if your system supports struct statfs..." >&4
16631 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
16632 eval $hasstruct
16633 case "$d_statfs_s" in
16634 "$define")      echo "Yes, it does."   ;;
16635 *)              echo "No, it doesn't." ;;
16636 esac
16637
16638
16639
16640 : see if struct statfs knows about f_flags
16641 case "$d_statfs_s" in
16642 define) 
16643         echo " "
16644         echo "Checking to see if your struct statfs has f_flags field..." >&4
16645         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
16646         eval $hasfield
16647         ;;
16648 *)      val="$undef"
16649         set d_statfs_f_flags
16650         eval $setvar
16651         ;;
16652 esac
16653 case "$d_statfs_f_flags" in
16654 "$define")      echo "Yes, it does."   ;;
16655 *)              echo "No, it doesn't." ;;
16656 esac
16657
16658 $cat >&4 <<EOM
16659 Checking how to access stdio streams by file descriptor number...
16660 EOM
16661 case "$stdio_stream_array" in
16662 '')     $cat >try.c <<EOCP
16663 #include <stdio.h>
16664 int main() {
16665   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
16666     printf("yes\n");
16667 }
16668 EOCP
16669         for s in _iob __iob __sF
16670         do
16671                 set try -DSTDIO_STREAM_ARRAY=$s
16672                 if eval $compile; then
16673                         case "`$run ./try`" in
16674                         yes)    stdio_stream_array=$s; break ;;
16675                         esac
16676                 fi
16677         done
16678         $rm -f try.* try$exe_ext
16679 esac
16680 case "$stdio_stream_array" in
16681 '')     $cat >&4 <<EOM
16682 I can't figure out how to access stdio streams by file descriptor number.
16683 EOM
16684         d_stdio_stream_array="$undef"
16685         ;;
16686 *)      $cat >&4 <<EOM
16687 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
16688 EOM
16689         d_stdio_stream_array="$define"
16690         ;;
16691 esac
16692
16693 : see if strcoll exists
16694 set strcoll d_strcoll
16695 eval $inlibc
16696
16697 : check for structure copying
16698 echo " "
16699 echo "Checking to see if your C compiler can copy structs..." >&4
16700 $cat >try.c <<'EOCP'
16701 int main()
16702 {
16703         struct blurfl {
16704                 int dyick;
16705         } foo, bar;
16706
16707         foo = bar;
16708 }
16709 EOCP
16710 if $cc -c try.c >/dev/null 2>&1 ; then
16711         val="$define"
16712         echo "Yup, it can."
16713 else
16714         val="$undef"
16715         echo "Nope, it can't."
16716 fi
16717 set d_strctcpy
16718 eval $setvar
16719 $rm -f try.*
16720
16721 : see if strerror and/or sys_errlist[] exist
16722 echo " "
16723 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
16724     if set strerror val -f d_strerror; eval $csym; $val; then
16725                 echo 'strerror() found.' >&4
16726                 d_strerror="$define"
16727                 d_strerrm='strerror(e)'
16728                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16729                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
16730                         d_syserrlst="$define"
16731                 else
16732                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
16733                         d_syserrlst="$undef"
16734                 fi
16735     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
16736                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
16737                 echo 'strerror() found in string header.' >&4
16738                 d_strerror="$define"
16739                 d_strerrm='strerror(e)'
16740                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16741                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
16742                                 d_syserrlst="$define"
16743                 else
16744                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
16745                         d_syserrlst="$undef"
16746                 fi
16747     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16748                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
16749                 d_strerror="$undef"
16750                 d_syserrlst="$define"
16751                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
16752     else
16753                 echo 'strerror() and sys_errlist[] NOT found.' >&4
16754                 d_strerror="$undef"
16755                 d_syserrlst="$undef"
16756                 d_strerrm='"unknown"'
16757     fi
16758 fi
16759
16760 : see if strerror_r exists
16761 set strerror_r d_strerror_r
16762 eval $inlibc
16763 case "$d_strerror_r" in
16764 "$define")
16765         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
16766         case "$d_strerror_r_proto:$usethreads" in
16767         ":define")      d_strerror_r_proto=define
16768                 set d_strerror_r_proto strerror_r $hdrs
16769                 eval $hasproto ;;
16770         *)      ;;
16771         esac
16772         case "$d_strerror_r_proto" in
16773         define)
16774         case "$strerror_r_proto" in
16775         ''|0) try='int strerror_r(int, char*, size_t);'
16776         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
16777         esac
16778         case "$strerror_r_proto" in
16779         ''|0) try='int strerror_r(int, char*, int);'
16780         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
16781         esac
16782         case "$strerror_r_proto" in
16783         ''|0) try='char* strerror_r(int, char*, size_t);'
16784         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
16785         esac
16786         case "$strerror_r_proto" in
16787         ''|0)   d_strerror_r=undef
16788                 strerror_r_proto=0
16789                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
16790         * )     case "$strerror_r_proto" in
16791                 REENTRANT_PROTO*) ;;
16792                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
16793                 esac
16794                 echo "Prototype: $try" ;;
16795         esac
16796         ;;
16797         *)      case "$usethreads" in
16798                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
16799                 esac
16800                 d_strerror_r=undef
16801                 strerror_r_proto=0
16802                 ;;
16803         esac
16804         ;;
16805 *)      strerror_r_proto=0
16806         ;;
16807 esac
16808
16809 : see if strftime exists
16810 set strftime d_strftime
16811 eval $inlibc
16812
16813 : see if strlcat exists
16814 set strlcat d_strlcat
16815 eval $inlibc
16816
16817 : see if strlcpy exists
16818 set strlcpy d_strlcpy
16819 eval $inlibc
16820
16821 : see if strtod exists
16822 set strtod d_strtod
16823 eval $inlibc
16824
16825 : see if strtol exists
16826 set strtol d_strtol
16827 eval $inlibc
16828
16829 : see if strtold exists
16830 set strtold d_strtold
16831 eval $inlibc
16832
16833 : see if strtoll exists
16834 set strtoll d_strtoll
16835 eval $inlibc
16836
16837 case "$d_longlong-$d_strtoll" in
16838 "$define-$define")
16839         $cat <<EOM
16840 Checking whether your strtoll() works okay...
16841 EOM
16842         $cat >try.c <<'EOCP'
16843 #include <errno.h>
16844 #ifdef __hpux
16845 #define strtoll __strtoll
16846 #endif
16847 #ifdef __EMX__
16848 #define strtoll _strtoll
16849 #endif
16850 #include <stdio.h>
16851 extern long long int strtoll(char *s, char **, int); 
16852 static int bad = 0;
16853 int check(char *s, long long ell, int een) {
16854         long long gll;
16855         errno = 0;
16856         gll = strtoll(s, 0, 10);
16857         if (!((gll == ell) && (errno == een)))
16858                 bad++;
16859 }
16860 int main() {
16861         check(" 1",                                      1LL, 0);
16862         check(" 0",                                      0LL, 0);
16863         check("-1",                                     -1LL, 0);
16864         check("-9223372036854775808", -9223372036854775808LL, 0);
16865         check("-9223372036854775808", -9223372036854775808LL, 0);
16866         check(" 9223372036854775807",  9223372036854775807LL, 0);
16867         check("-9223372036854775808", -9223372036854775808LL, 0);
16868         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
16869         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
16870         if (!bad)
16871                 printf("ok\n");
16872 }
16873 EOCP
16874         set try
16875         if eval $compile; then
16876                 yyy=`$run ./try`
16877                 case "$yyy" in
16878                 ok) echo "Your strtoll() seems to be working okay." ;;
16879                 *) cat <<EOM >&4
16880 Your strtoll() doesn't seem to be working okay.
16881 EOM
16882                    d_strtoll="$undef"
16883                    ;;
16884                 esac
16885         else
16886                 echo "(I can't seem to compile the test program--assuming it doesn't)"
16887                 d_strtoll="$undef"
16888         fi
16889         ;;
16890 esac
16891
16892 : see if strtoq exists
16893 set strtoq d_strtoq
16894 eval $inlibc
16895
16896 : see if strtoul exists
16897 set strtoul d_strtoul
16898 eval $inlibc
16899
16900 case "$d_strtoul" in
16901 "$define")
16902         $cat <<EOM
16903 Checking whether your strtoul() works okay...
16904 EOM
16905         $cat >try.c <<'EOCP'
16906 #include <errno.h>
16907 #include <stdio.h>
16908 extern unsigned long int strtoul(char *s, char **, int); 
16909 static int bad = 0;
16910 void check(char *s, unsigned long eul, int een) {
16911         unsigned long gul;
16912         errno = 0;
16913         gul = strtoul(s, 0, 10);
16914         if (!((gul == eul) && (errno == een)))
16915                 bad++;
16916 }
16917 int main() {
16918         check(" 1", 1L, 0);
16919         check(" 0", 0L, 0);
16920 EOCP
16921         case "$longsize" in
16922         8)
16923             $cat >>try.c <<'EOCP'
16924         check("18446744073709551615", 18446744073709551615UL, 0);
16925         check("18446744073709551616", 18446744073709551615UL, ERANGE);
16926 #if 0 /* strtoul() for /^-/ strings is undefined. */
16927         check("-1", 18446744073709551615UL, 0);
16928         check("-18446744073709551614", 2, 0);
16929         check("-18446744073709551615", 1, 0);
16930         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
16931         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
16932 #endif
16933 EOCP
16934                 ;;
16935         4)
16936                     $cat >>try.c <<'EOCP'
16937         check("4294967295", 4294967295UL, 0);
16938         check("4294967296", 4294967295UL, ERANGE);
16939 #if 0 /* strtoul() for /^-/ strings is undefined. */
16940         check("-1", 4294967295UL, 0);
16941         check("-4294967294", 2, 0);
16942         check("-4294967295", 1, 0);
16943         check("-4294967296", 4294967295UL, ERANGE);
16944         check("-4294967297", 4294967295UL, ERANGE);
16945 #endif
16946 EOCP
16947                 ;;
16948         *)
16949 : Should we write these tests to be more portable by sprintf-ing
16950 : ~0 and then manipulating that char string as input for strtol?
16951                 ;;
16952         esac
16953         $cat >>try.c <<'EOCP'
16954         if (!bad)
16955                 printf("ok\n");
16956         return 0;
16957 }
16958 EOCP
16959         set try
16960         if eval $compile; then
16961                 case "`$run ./try`" in
16962                 ok) echo "Your strtoul() seems to be working okay." ;;
16963                 *) cat <<EOM >&4
16964 Your strtoul() doesn't seem to be working okay.
16965 EOM
16966                    d_strtoul="$undef"
16967                    ;;
16968                 esac
16969         fi
16970         ;;
16971 esac
16972
16973 : see if strtoull exists
16974 set strtoull d_strtoull
16975 eval $inlibc
16976
16977 case "$d_longlong-$d_strtoull" in
16978 "$define-$define")
16979         $cat <<EOM
16980 Checking whether your strtoull() works okay...
16981 EOM
16982         $cat >try.c <<'EOCP'
16983 #include <errno.h>
16984 #ifdef __hpux
16985 #define strtoull __strtoull
16986 #endif
16987 #include <stdio.h>
16988 extern unsigned long long int strtoull(char *s, char **, int); 
16989 static int bad = 0;
16990 int check(char *s, long long eull, int een) {
16991         long long gull;
16992         errno = 0;
16993         gull = strtoull(s, 0, 10);
16994         if (!((gull == eull) && (errno == een)))
16995                 bad++;
16996 }
16997 int main() {
16998         check(" 1",                                        1LL, 0);
16999         check(" 0",                                        0LL, 0);
17000         check("18446744073709551615",  18446744073709551615ULL, 0);
17001         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17002 #if 0 /* strtoull() for /^-/ strings is undefined. */
17003         check("-1",                    18446744073709551615ULL, 0);
17004         check("-18446744073709551614",                     2LL, 0);
17005         check("-18446744073709551615",                     1LL, 0);
17006         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17007         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17008 #endif
17009         if (!bad)
17010                 printf("ok\n");
17011 }
17012 EOCP
17013         set try
17014         if eval $compile; then
17015                 case "`$run ./try`" in
17016                 ok) echo "Your strtoull() seems to be working okay." ;;
17017                 *) cat <<EOM >&4
17018 Your strtoull() doesn't seem to be working okay.
17019 EOM
17020                    d_strtoull="$undef"
17021                    ;;
17022                 esac
17023         fi
17024         ;;
17025 esac
17026
17027 : see if strtouq exists
17028 set strtouq d_strtouq
17029 eval $inlibc
17030
17031 case "$d_strtouq" in
17032 "$define")
17033         $cat <<EOM
17034 Checking whether your strtouq() works okay...
17035 EOM
17036         $cat >try.c <<'EOCP'
17037 #include <errno.h>
17038 #include <stdio.h>
17039 extern unsigned long long int strtouq(char *s, char **, int); 
17040 static int bad = 0;
17041 void check(char *s, unsigned long long eull, int een) {
17042         unsigned long long gull;
17043         errno = 0;
17044         gull = strtouq(s, 0, 10);
17045         if (!((gull == eull) && (errno == een)))
17046                 bad++;
17047 }
17048 int main() {
17049         check(" 1",                                        1LL, 0);
17050         check(" 0",                                        0LL, 0);
17051         check("18446744073709551615",  18446744073709551615ULL, 0);
17052         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17053 #if 0 /* strtouq() for /^-/ strings is undefined. */
17054         check("-1",                    18446744073709551615ULL, 0);
17055         check("-18446744073709551614",                     2LL, 0);
17056         check("-18446744073709551615",                     1LL, 0);
17057         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17058         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17059 #endif
17060         if (!bad)
17061                 printf("ok\n");
17062         return 0;
17063 }
17064 EOCP
17065         set try
17066         if eval $compile; then
17067                 case "`$run ./try`" in
17068                 ok) echo "Your strtouq() seems to be working okay." ;;
17069                 *) cat <<EOM >&4
17070 Your strtouq() doesn't seem to be working okay.
17071 EOM
17072                    d_strtouq="$undef"
17073                    ;;
17074                 esac
17075         fi
17076         ;;
17077 esac
17078
17079 : see if strxfrm exists
17080 set strxfrm d_strxfrm
17081 eval $inlibc
17082
17083 : see if symlink exists
17084 set symlink d_symlink
17085 eval $inlibc
17086
17087 : see if syscall exists
17088 set syscall d_syscall
17089 eval $inlibc
17090
17091 : see if prototype for syscall is available
17092 echo " "
17093 set d_syscallproto syscall $i_unistd unistd.h
17094 eval $hasproto
17095
17096 : see if sysconf exists
17097 set sysconf d_sysconf
17098 eval $inlibc
17099
17100 : see if system exists
17101 set system d_system
17102 eval $inlibc
17103
17104 : see if tcgetpgrp exists
17105 set tcgetpgrp d_tcgetpgrp
17106 eval $inlibc
17107
17108 : see if tcsetpgrp exists
17109 set tcsetpgrp d_tcsetpgrp
17110 eval $inlibc
17111
17112 : see if prototype for telldir is available
17113 echo " "
17114 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17115 eval $hasproto
17116
17117 : see if time exists
17118 echo " "
17119 if test "X$d_time" = X -o X"$timetype" = X; then
17120     if set time val -f d_time; eval $csym; $val; then
17121                 echo 'time() found.' >&4
17122                 val="$define"
17123                 rp="What is the type returned by time() on this system?"
17124                 set time_t timetype long stdio.h sys/types.h
17125                 eval $typedef_ask
17126     else
17127                 echo 'time() not found, hope that will do.' >&4
17128                 val="$undef"
17129                 timetype='int';
17130     fi
17131     set d_time
17132     eval $setvar
17133 fi
17134
17135 : see if this is a sys/times.h system
17136 set sys/times.h i_systimes
17137 eval $inhdr
17138
17139 : see if times exists
17140 echo " "
17141 if set times val -f d_times; eval $csym; $val; then
17142         echo 'times() found.' >&4
17143         d_times="$define"
17144         inc=''
17145         case "$i_systimes" in
17146         "$define") inc='sys/times.h';;
17147         esac
17148         rp="What is the type returned by times() on this system?"
17149         set clock_t clocktype long stdio.h sys/types.h $inc
17150         eval $typedef_ask
17151 else
17152         echo 'times() NOT found, hope that will do.' >&4
17153         d_times="$undef"
17154         clocktype='int'
17155 fi
17156
17157 : see if tmpnam_r exists
17158 set tmpnam_r d_tmpnam_r
17159 eval $inlibc
17160 case "$d_tmpnam_r" in
17161 "$define")
17162         hdrs="$i_systypes sys/types.h define stdio.h "
17163         case "$d_tmpnam_r_proto:$usethreads" in
17164         ":define")      d_tmpnam_r_proto=define
17165                 set d_tmpnam_r_proto tmpnam_r $hdrs
17166                 eval $hasproto ;;
17167         *)      ;;
17168         esac
17169         case "$d_tmpnam_r_proto" in
17170         define)
17171         case "$tmpnam_r_proto" in
17172         ''|0) try='char* tmpnam_r(char*);'
17173         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17174         esac
17175         case "$tmpnam_r_proto" in
17176         ''|0)   d_tmpnam_r=undef
17177                 tmpnam_r_proto=0
17178                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
17179         * )     case "$tmpnam_r_proto" in
17180                 REENTRANT_PROTO*) ;;
17181                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17182                 esac
17183                 echo "Prototype: $try" ;;
17184         esac
17185         ;;
17186         *)      case "$usethreads" in
17187                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17188                 esac
17189                 d_tmpnam_r=undef
17190                 tmpnam_r_proto=0
17191                 ;;
17192         esac
17193         ;;
17194 *)      tmpnam_r_proto=0
17195         ;;
17196 esac
17197
17198 : see if truncate exists
17199 set truncate d_truncate
17200 eval $inlibc
17201
17202 : see if ttyname_r exists
17203 set ttyname_r d_ttyname_r
17204 eval $inlibc
17205 case "$d_ttyname_r" in
17206 "$define")
17207         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
17208         case "$d_ttyname_r_proto:$usethreads" in
17209         ":define")      d_ttyname_r_proto=define
17210                 set d_ttyname_r_proto ttyname_r $hdrs
17211                 eval $hasproto ;;
17212         *)      ;;
17213         esac
17214         case "$d_ttyname_r_proto" in
17215         define)
17216         case "$ttyname_r_proto" in
17217         ''|0) try='int ttyname_r(int, char*, size_t);'
17218         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17219         esac
17220         case "$ttyname_r_proto" in
17221         ''|0) try='int ttyname_r(int, char*, int);'
17222         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17223         esac
17224         case "$ttyname_r_proto" in
17225         ''|0) try='char* ttyname_r(int, char*, int);'
17226         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17227         esac
17228         case "$ttyname_r_proto" in
17229         ''|0)   d_ttyname_r=undef
17230                 ttyname_r_proto=0
17231                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
17232         * )     case "$ttyname_r_proto" in
17233                 REENTRANT_PROTO*) ;;
17234                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17235                 esac
17236                 echo "Prototype: $try" ;;
17237         esac
17238         ;;
17239         *)      case "$usethreads" in
17240                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17241                 esac
17242                 d_ttyname_r=undef
17243                 ttyname_r_proto=0
17244                 ;;
17245         esac
17246         ;;
17247 *)      ttyname_r_proto=0
17248         ;;
17249 esac
17250
17251 : see if tzname[] exists
17252 echo " "
17253 if set tzname val -a d_tzname; eval $csym; $val; then
17254         val="$define"
17255         echo 'tzname[] found.' >&4
17256 else
17257         val="$undef"
17258         echo 'tzname[] NOT found.' >&4
17259 fi
17260 set d_tzname
17261 eval $setvar
17262
17263 case "$osname" in
17264 next|rhapsody|darwin) multiarch="$define" ;;
17265 esac
17266 case "$multiarch" in
17267 ''|[nN]*) multiarch="$undef" ;;
17268 esac
17269
17270 : check for ordering of bytes in a UV
17271 echo " "
17272 case "$usecrosscompile$multiarch" in
17273 *$define*)
17274         $cat <<EOM
17275 You seem to be either cross-compiling or doing a multiarchitecture build,
17276 skipping the byteorder check.
17277
17278 EOM
17279         byteorder='ffff'
17280         ;;
17281 *)
17282         case "$byteorder" in
17283         '')
17284                 $cat <<'EOM'
17285 In the following, larger digits indicate more significance.  A big-endian
17286 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17287 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17288 machines may have weird orders like 3412.  A Cray will report 87654321,
17289 an Alpha will report 12345678. If the test program works the default is
17290 probably right.
17291 I'm now running the test program...
17292 EOM
17293                 $cat >try.c <<EOCP
17294 #include <stdio.h>
17295 #$i_stdlib I_STDLIB
17296 #ifdef I_STDLIB
17297 #include <stdlib.h>
17298 #endif
17299 #include <sys/types.h>
17300 typedef $uvtype UV;
17301 int main()
17302 {
17303         int i;
17304         union {
17305                 UV l;
17306                 char c[$uvsize];
17307         } u;
17308
17309         if ($uvsize > 4)
17310                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
17311         else
17312                 u.l = (UV)0x04030201;
17313         for (i = 0; i < $uvsize; i++)
17314                 printf("%c", u.c[i]+'0');
17315         printf("\n");
17316         exit(0);
17317 }
17318 EOCP
17319                 xxx_prompt=y
17320                 set try
17321                 if eval $compile && ./try > /dev/null; then
17322                         dflt=`$run ./try`
17323                         case "$dflt" in
17324                         [1-4][1-4][1-4][1-4]|12345678|87654321)
17325                                 echo "(The test program ran ok.)"
17326                                 echo "byteorder=$dflt"
17327                                 xxx_prompt=n
17328                         ;;
17329                         ????|????????) echo "(The test program ran ok.)" ;;
17330                         *) echo "(The test program didn't run right for some reason.)" ;;
17331                         esac
17332                 else
17333                         dflt='4321'
17334                         cat <<'EOM'
17335 (I can't seem to compile the test program.  Guessing big-endian...)
17336 EOM
17337                 fi
17338                 case "$xxx_prompt" in
17339                 y)
17340                         rp="What is the order of bytes in $uvtype?"
17341                         . ./myread
17342                         byteorder="$ans"
17343                         ;;
17344                 *)      byteorder=$dflt
17345                         ;;
17346                 esac
17347                 ;;
17348         esac
17349         $rm -f try.c try
17350         ;;
17351 esac
17352
17353
17354 $cat <<EOM
17355
17356 Checking to see whether you can access character data unalignedly...
17357 EOM
17358 case "$d_u32align" in
17359 '')   $cat >try.c <<EOCP
17360 #include <stdio.h>
17361 #$i_stdlib I_STDLIB
17362 #ifdef I_STDLIB
17363 #include <stdlib.h>
17364 #endif
17365 #define U32 $u32type
17366 #define BYTEORDER 0x$byteorder
17367 #define U8 $u8type
17368 #include <signal.h>
17369 #ifdef SIGBUS
17370 $signal_t bletch(s) int s; { exit(4); }
17371 #endif
17372 int main() {
17373 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
17374     U8 buf[8];
17375     U32 *up;
17376     int i;
17377
17378     if (sizeof(U32) != 4) {
17379         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
17380         exit(1);
17381     }
17382
17383     fflush(stdout);
17384
17385 #ifdef SIGBUS
17386     signal(SIGBUS, bletch);
17387 #endif
17388
17389     buf[0] = 0;
17390     buf[1] = 0;
17391     buf[2] = 0;
17392     buf[3] = 1;
17393     buf[4] = 0;
17394     buf[5] = 0;
17395     buf[6] = 0;
17396     buf[7] = 1;
17397
17398     for (i = 0; i < 4; i++) {
17399         up = (U32*)(buf + i);
17400         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
17401                (*up == 1 << (8*(3-i)))  /* little-endian */
17402               )
17403            )
17404         {
17405             printf("read failed (%x)\n", *up);
17406             exit(2);
17407         }
17408     }
17409
17410     /* write test */
17411     for (i = 0; i < 4; i++) {
17412         up = (U32*)(buf + i);
17413         *up = 0xBeef;
17414         if (*up != 0xBeef) {
17415             printf("write failed (%x)\n", *up);
17416             exit(3);
17417         }
17418     }
17419
17420     exit(0);
17421 #else
17422     printf("1\n");
17423     exit(1);
17424 #endif
17425     return 0;
17426 }
17427 EOCP
17428 set try
17429 if eval $compile_ok; then
17430         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
17431         $run ./try 2>&1 >/dev/null
17432         case "$?" in
17433         0)      cat >&4 <<EOM
17434 You can access character data pretty unalignedly.
17435 EOM
17436                 d_u32align="$undef"
17437                 ;;
17438         *)      cat >&4 <<EOM
17439 It seems that you must access character data in an aligned manner.
17440 EOM
17441                 d_u32align="$define"
17442                 ;;
17443         esac
17444 else
17445         rp='Can you access character data at unaligned addresses?'
17446         dflt='n'
17447         . ./myread
17448         case "$ans" in
17449         [yY]*)  d_u32align="$undef"  ;;
17450         *)      d_u32align="$define" ;;
17451         esac
17452 fi
17453 $rm -f core core.try.* try.core
17454 ;;
17455 esac
17456
17457 : see if ualarm exists
17458 set ualarm d_ualarm
17459 eval $inlibc
17460
17461 : see if umask exists
17462 set umask d_umask
17463 eval $inlibc
17464
17465 : see if unordered exists
17466 set unordered d_unordered
17467 eval $inlibc
17468
17469 : see if unsetenv exists
17470 set unsetenv d_unsetenv
17471 eval $inlibc
17472
17473 : see if usleep exists
17474 set usleep d_usleep
17475 eval $inlibc
17476
17477 : see if prototype for usleep is available
17478 echo " "
17479 set d_usleepproto usleep $i_unistd unistd.h
17480 eval $hasproto
17481
17482 : see if ustat exists
17483 set ustat d_ustat
17484 eval $inlibc
17485
17486 : backward compatibility for d_hvfork
17487 if test X$d_hvfork != X; then
17488         d_vfork="$d_hvfork"
17489         d_hvfork=''
17490 fi
17491 : see if there is a vfork
17492 val=''
17493 set vfork val
17494 eval $inlibc
17495
17496 : Ok, but do we want to use it. vfork is reportedly unreliable in 
17497 : perl on Solaris 2.x, and probably elsewhere.
17498 case "$val" in
17499 $define)
17500         echo " "
17501         case "$usevfork" in
17502         false) dflt='n';;
17503         *) dflt='y';;
17504         esac
17505         cat <<'EOM'
17506  
17507 Perl can only use a vfork() that doesn't suffer from strict
17508 restrictions on calling functions or modifying global data in
17509 the child.  For example, glibc-2.1 contains such a vfork()
17510 that is unsuitable.  If your system provides a proper fork()
17511 call, chances are that you do NOT want perl to use vfork().
17512
17513 EOM
17514         rp="Do you still want to use vfork()?"
17515         . ./myread
17516         case "$ans" in
17517         y|Y) ;;
17518         *)
17519                 echo "Ok, we won't use vfork()."
17520                 val="$undef"
17521                 ;;
17522         esac
17523         ;;
17524 esac
17525 set d_vfork
17526 eval $setvar
17527 case "$d_vfork" in
17528 $define) usevfork='true';;
17529 *) usevfork='false';;
17530 esac
17531
17532 : see if closedir exists
17533 set closedir d_closedir
17534 eval $inlibc
17535
17536 case "$d_closedir" in
17537 "$define")
17538         echo " "
17539         echo "Checking whether closedir() returns a status..." >&4
17540         cat > try.c <<EOM
17541 #$i_dirent I_DIRENT             /**/
17542 #$i_sysdir I_SYS_DIR            /**/
17543 #$i_sysndir I_SYS_NDIR          /**/
17544 #$i_systypes I_SYS_TYPES        /**/
17545
17546 #if defined(I_SYS_TYPES)
17547 #include <sys/types.h>
17548 #endif
17549 #if defined(I_DIRENT)
17550 #include <dirent.h>
17551 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
17552 #include <sys/dir.h>
17553 #endif
17554 #else
17555 #ifdef I_SYS_NDIR
17556 #include <sys/ndir.h>
17557 #else
17558 #ifdef I_SYS_DIR
17559 #ifdef hp9000s500
17560 #include <ndir.h>       /* may be wrong in the future */
17561 #else
17562 #include <sys/dir.h>
17563 #endif
17564 #endif
17565 #endif
17566 #endif 
17567 int main() { return closedir(opendir(".")); }
17568 EOM
17569         set try
17570         if eval $compile_ok; then
17571                 if $run ./try > /dev/null 2>&1 ; then
17572                         echo "Yes, it does."
17573                         val="$undef"
17574                 else
17575                         echo "No, it doesn't."
17576                         val="$define"
17577                 fi
17578         else
17579                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17580                 val="$define"
17581         fi
17582         ;;
17583 *)
17584         val="$undef";
17585         ;;
17586 esac
17587 set d_void_closedir
17588 eval $setvar
17589 $rm -f try try.*
17590 : see if there is a wait4
17591 set wait4 d_wait4
17592 eval $inlibc
17593
17594 : see if waitpid exists
17595 set waitpid d_waitpid
17596 eval $inlibc
17597
17598 : see if wcstombs exists
17599 set wcstombs d_wcstombs
17600 eval $inlibc
17601
17602 : see if wctomb exists
17603 set wctomb d_wctomb
17604 eval $inlibc
17605
17606 : see if writev exists
17607 set writev d_writev
17608 eval $inlibc
17609
17610 : preserve RCS keywords in files with variable substitution, grrr
17611 Date='$Date'
17612 Id='$Id'
17613 Log='$Log'
17614 RCSfile='$RCSfile'
17615 Revision='$Revision'
17616
17617 : check for alignment requirements
17618 echo " "
17619 case "$usecrosscompile$multiarch" in
17620 *$define*)
17621         $cat <<EOM
17622 You seem to be either cross-compiling or doing a multiarchitecture build,
17623 skipping the memory alignment check.
17624
17625 EOM
17626         case "$alignbytes" in
17627         '') alignbytes=8 ;;
17628         esac
17629         ;;
17630 *)
17631         case "$alignbytes" in
17632         '') echo "Checking alignment constraints..." >&4
17633                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
17634                         $cat >try.c <<'EOCP'
17635 typedef long double NV;
17636 EOCP
17637                 else
17638                         $cat >try.c <<'EOCP'
17639 typedef double NV;
17640 EOCP
17641                 fi
17642                 $cat >>try.c <<'EOCP'
17643 #include <stdio.h>
17644 struct foobar {
17645         char foo;
17646         NV bar;
17647 } try_algn;
17648 int main()
17649 {
17650     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
17651     return(0);
17652 }
17653 EOCP
17654                 set try
17655                 if eval $compile_ok; then
17656                         dflt=`$run ./try`
17657                 else
17658                         dflt='8'
17659                         echo "(I can't seem to compile the test program...)"
17660                 fi
17661                 ;;
17662         *) dflt="$alignbytes"
17663                 ;;
17664         esac
17665         rp="Doubles must be aligned on a how-many-byte boundary?"
17666         . ./myread
17667         alignbytes="$ans"
17668         $rm -f try.c try
17669         ;;
17670 esac
17671
17672
17673 : set the base revision
17674 baserev=5.0
17675
17676 : how do we concatenate cpp tokens here?
17677 echo " "
17678 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
17679 $cat >cpp_stuff.c <<'EOCP'
17680 #define RCAT(a,b)a/**/b
17681 #define ACAT(a,b)a ## b
17682 RCAT(Rei,ser)
17683 ACAT(Cir,cus)
17684 EOCP
17685 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
17686 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
17687         echo "Oh!  Smells like ANSI's been here." >&4
17688         echo "We can catify or stringify, separately or together!"
17689         cpp_stuff=42
17690 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
17691         echo "Ah, yes!  The good old days!" >&4
17692         echo "However, in the good old days we don't know how to stringify and"
17693         echo "catify at the same time."
17694         cpp_stuff=1
17695 else
17696         $cat >&4 <<EOM
17697 Hmm, I don't seem to be able to concatenate tokens with your cpp.
17698 You're going to have to edit the values of CAT[2-5] in config.h...
17699 EOM
17700         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
17701 fi
17702 $rm -f cpp_stuff.*
17703
17704 : see if this is a db.h system
17705 set db.h i_db
17706 eval $inhdr
17707
17708 case "$i_db" in
17709 $define)
17710         : Check db version.
17711         echo " "
17712         echo "Checking Berkeley DB version ..." >&4
17713         $cat >try.c <<EOCP
17714 #$d_const HASCONST
17715 #ifndef HASCONST
17716 #define const
17717 #endif
17718 #include <sys/types.h>
17719 #include <stdio.h>
17720 #$i_stdlib I_STDLIB
17721 #ifdef I_STDLIB
17722 #include <stdlib.h>
17723 #endif
17724 #include <db.h>
17725 int main(int argc, char *argv[])
17726 {
17727 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
17728     int Major, Minor, Patch ;
17729     unsigned long Version ;
17730     (void)db_version(&Major, &Minor, &Patch) ;
17731     if (argc == 2) {
17732         printf("%d %d %d %d %d %d\n",
17733                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
17734                Major, Minor, Patch);
17735         exit(0);
17736     }
17737     printf("You have Berkeley DB Version 2 or greater.\n");
17738
17739     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
17740                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
17741     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
17742                 Major, Minor, Patch) ;
17743
17744     /* check that db.h & libdb are compatible */
17745     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
17746         printf("db.h and libdb are incompatible.\n") ;
17747         exit(3);        
17748     }
17749
17750     printf("db.h and libdb are compatible.\n") ;
17751
17752     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
17753                 + DB_VERSION_PATCH ;
17754
17755     /* needs to be >= 2.3.4 */
17756     if (Version < 2003004) {
17757     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
17758         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
17759         exit(2);        
17760     }
17761
17762     exit(0);
17763 #else
17764 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
17765     if (argc == 2) {
17766         printf("1 0 0\n");
17767         exit(0);
17768     }
17769     printf("You have Berkeley DB Version 1.\n");
17770     exit(0);    /* DB version < 2: the coast is clear. */
17771 #else
17772     exit(1);    /* <db.h> not Berkeley DB? */
17773 #endif
17774 #endif
17775 }
17776 EOCP
17777         set try
17778         if eval $compile_ok && $run ./try; then
17779                 echo 'Looks OK.' >&4
17780                 set `$run ./try 1`
17781                 db_version_major=$1
17782                 db_version_minor=$2
17783                 db_version_patch=$3
17784         else
17785                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
17786                 i_db=$undef
17787                 case " $libs " in
17788                 *"-ldb "*)
17789                         : Remove db from list of libraries to use
17790                         echo "Removing unusable -ldb from library list" >&4
17791                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
17792                         shift
17793                         libs="$*"
17794                         echo "libs = $libs" >&4
17795                         ;;
17796                 esac
17797         fi
17798         $rm -f try.*
17799         ;;
17800 esac
17801
17802 case "$i_db" in
17803 define)
17804         : Check the return type needed for hash 
17805         echo " "
17806         echo "Checking return type needed for hash for Berkeley DB ..." >&4
17807         $cat >try.c <<EOCP
17808 #$d_const HASCONST
17809 #ifndef HASCONST
17810 #define const
17811 #endif
17812 #include <sys/types.h>
17813 #include <db.h>
17814
17815 #ifndef DB_VERSION_MAJOR
17816 u_int32_t hash_cb (ptr, size)
17817 const void *ptr;
17818 size_t size;
17819 {
17820 }
17821 HASHINFO info;
17822 int main()
17823 {
17824         info.hash = hash_cb;
17825 }
17826 #endif
17827 EOCP
17828         if $cc $ccflags -c try.c >try.out 2>&1 ; then
17829                 if $contains warning try.out >>/dev/null 2>&1 ; then
17830                         db_hashtype='int'
17831                 else
17832                         db_hashtype='u_int32_t'
17833                 fi
17834         else
17835                 : XXX Maybe we should just give up here.
17836                 db_hashtype=u_int32_t
17837                 $cat try.out >&4
17838                 echo "Help:  I can't seem to compile the db test program." >&4
17839                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
17840         fi
17841         $rm -f try.*
17842         echo "Your version of Berkeley DB uses $db_hashtype for hash."
17843         ;;
17844 *)      db_hashtype=u_int32_t
17845         ;;
17846 esac
17847 case "$i_db" in
17848 define)
17849         : Check the return type needed for prefix 
17850         echo " "
17851         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
17852         cat >try.c <<EOCP
17853 #$d_const HASCONST
17854 #ifndef HASCONST
17855 #define const
17856 #endif
17857 #include <sys/types.h>
17858 #include <db.h>
17859
17860 #ifndef DB_VERSION_MAJOR
17861 size_t prefix_cb (key1, key2)
17862 const DBT *key1;
17863 const DBT *key2;
17864 {
17865 }
17866 BTREEINFO info;
17867 int main()
17868 {
17869         info.prefix = prefix_cb;
17870 }
17871 #endif
17872 EOCP
17873         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
17874                 if $contains warning try.out >>/dev/null 2>&1 ; then
17875                         db_prefixtype='int'
17876                 else
17877                         db_prefixtype='size_t'
17878                 fi
17879         else
17880                 db_prefixtype='size_t'
17881                 : XXX Maybe we should just give up here.
17882                 $cat try.out >&4
17883                 echo "Help:  I can't seem to compile the db test program." >&4
17884                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
17885         fi
17886         $rm -f try.*
17887         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
17888         ;;
17889 *)      db_prefixtype='size_t'
17890         ;;
17891 esac
17892
17893
17894 : How can we generate normalized random numbers ?
17895 echo " "
17896 echo "Looking for a random number function..." >&4
17897 case "$randfunc" in
17898 '')
17899         if set drand48 val -f; eval $csym; $val; then
17900                 dflt="drand48"
17901                 echo "Good, found drand48()." >&4
17902         elif set random val -f; eval $csym; $val; then
17903                 dflt="random"
17904                 echo "OK, found random()." >&4
17905         else
17906                 dflt="rand"
17907                 echo "Yick, looks like I have to use rand()." >&4
17908         fi
17909         echo " "
17910         ;;
17911 *)
17912         dflt="$randfunc"
17913         ;;
17914 esac
17915 cont=true
17916
17917 case "$ccflags" in
17918 *-Dmy_rand=*|*-Dmy_srand=*)
17919         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
17920         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
17921         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
17922         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
17923         ;;
17924 esac
17925
17926 while $test "$cont"; do
17927         rp="Use which function to generate random numbers?"
17928         . ./myread
17929         if $test "$ans" = "$dflt"; then
17930                 : null
17931         else
17932                 randbits=''
17933         fi
17934         randfunc="$ans"
17935         if set $ans val -f; eval $csym; $val; then
17936                 cont=''
17937         else
17938                 dflt=y
17939                 rp="I cannot find function $ans. Use that name anyway?"
17940                 . ./myread
17941                 dflt=rand
17942                 case "$ans" in
17943                         [yY]*) cont='';;
17944                 esac
17945         fi
17946         case "$cont" in
17947         '')
17948                 case "$randfunc" in
17949                 drand48)
17950                         drand01="drand48()"
17951                         seedfunc="srand48"
17952                         randbits=48
17953                         randseedtype=long
17954                         ;;
17955                 rand|random)
17956                         case "$randbits" in
17957                         '')
17958 echo "Checking to see how many bits your $randfunc() function produces..." >&4
17959                                 $cat >try.c <<EOCP
17960 #$i_unistd I_UNISTD
17961 #$i_stdlib I_STDLIB
17962 #include <stdio.h>
17963 #ifdef I_UNISTD
17964 #  include <unistd.h>
17965 #endif
17966 #ifdef I_STDLIB
17967 #  include <stdlib.h>
17968 #endif
17969 int main()
17970 {
17971         register int i;
17972         register unsigned long tmp;
17973         register unsigned long max = 0L;
17974
17975         for (i = 1000; i; i--) {
17976                 tmp = (unsigned long) $randfunc();
17977                 if (tmp > max) max = tmp;
17978         }
17979         for (i = 0; max; i++)
17980                 max /= 2;
17981         printf("%d\n",i);
17982 }
17983 EOCP
17984                                 set try
17985                                 if eval $compile_ok; then
17986                                         dflt=`try`
17987                                 else
17988                                         dflt='?'
17989                                         echo "(I can't seem to compile the test program...)"
17990                                 fi
17991                                 ;;
17992                         *)
17993                                 dflt="$randbits"
17994                                 ;;
17995                         esac
17996                         rp="How many bits does your $randfunc() function produce?"
17997                         . ./myread
17998                         randbits="$ans"
17999                         $rm -f try.c try
18000                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18001                         seedfunc="s$randfunc"
18002                         randseedtype=unsigned
18003                         ;;
18004                 *)
18005                         dflt="31"
18006                         rp="How many bits does your $randfunc() function produce?"
18007                         . ./myread
18008                         randbits="$ans"
18009                         seedfunc="s$randfunc"
18010                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18011                         if set $seedfunc val -f; eval $csym; $val; then
18012                                 echo "(Using $seedfunc() to seed random generator)"
18013                         else
18014                                 echo "(Warning: no $seedfunc() to seed random generator)"
18015                                 seedfunc=rand
18016                         fi
18017                         randseedtype=unsigned
18018                         ;;
18019                 esac
18020                 ;;
18021         esac
18022 done
18023
18024 echo " "
18025 echo "Determining whether or not we are on an EBCDIC system..." >&4
18026 $cat >try.c <<'EOM'
18027 int main()
18028 {
18029   if ('M'==0xd4) return 0;
18030   return 1;
18031 }
18032 EOM
18033
18034 val=$undef
18035 set try
18036 if eval $compile_ok; then
18037         if $run ./try; then
18038                 echo "You seem to speak EBCDIC." >&4
18039                 val="$define"
18040         else
18041                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18042         fi
18043 else
18044         echo "I'm unable to compile the test program." >&4
18045         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18046 fi
18047 $rm -f try try.*
18048 set ebcdic
18049 eval $setvar
18050
18051 echo " "
18052 $cat >&4 <<EOM
18053 Checking how to flush all pending stdio output...
18054 EOM
18055 # I only know how to find the first 32 possibly open files on SunOS.
18056 # See also hints/sunos_4_1.sh and util.c  --AD
18057 case "$osname" in
18058 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18059 esac
18060 $cat >>try.c <<EOCP
18061 #include <stdio.h>
18062 #$i_stdlib I_STDLIB
18063 #ifdef I_STDLIB
18064 #include <stdlib.h>
18065 #endif
18066 #$i_unistd I_UNISTD
18067 #ifdef I_UNISTD
18068 # include <unistd.h>
18069 #endif
18070 #$d_sysconf HAS_SYSCONF
18071 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18072 #ifdef HAS_STDIO_STREAM_ARRAY
18073 # define STDIO_STREAM_ARRAY $stdio_stream_array
18074 #endif
18075 int main() {
18076   FILE* p;
18077   unlink("try.out");
18078   p = fopen("try.out", "w");
18079 #ifdef TRY_FPUTC
18080   fputc('x', p);
18081 #else
18082 # ifdef TRY_FPRINTF
18083   fprintf(p, "x");
18084 # endif
18085 #endif
18086 #ifdef TRY_FFLUSH_NULL
18087   fflush(NULL);
18088 #endif
18089 #ifdef TRY_FFLUSH_ALL
18090   {
18091     long open_max = -1;
18092 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18093     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18094 # else
18095 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18096     open_max = sysconf(_SC_OPEN_MAX);
18097 #  else
18098 #   ifdef FOPEN_MAX
18099     open_max = FOPEN_MAX;
18100 #   else
18101 #    ifdef OPEN_MAX
18102     open_max = OPEN_MAX;
18103 #    else
18104 #     ifdef _NFILE
18105     open_max = _NFILE;
18106 #     endif
18107 #    endif
18108 #   endif
18109 #  endif
18110 # endif 
18111 # ifdef HAS_STDIO_STREAM_ARRAY
18112     if (open_max > 0) {
18113       long i;
18114       for (i = 0; i < open_max; i++)
18115             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18116                 STDIO_STREAM_ARRAY[i]._file < open_max &&
18117                 STDIO_STREAM_ARRAY[i]._flag)
18118                 fflush(&STDIO_STREAM_ARRAY[i]);
18119     }   
18120   }
18121 # endif
18122 #endif
18123   _exit(42);
18124 }
18125 EOCP
18126 : first we have to find out how _not_ to flush
18127 $to try.c
18128 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18129     output=''
18130     set try -DTRY_FPUTC
18131     if eval $compile; then
18132             $run ./try 2>/dev/null
18133             code="$?"
18134             $from try.out
18135             if $test ! -s try.out -a "X$code" = X42; then
18136                 output=-DTRY_FPUTC
18137             fi
18138     fi
18139     case "$output" in
18140     '')
18141             set try -DTRY_FPRINTF
18142             if eval $compile; then
18143                     $run ./try 2>/dev/null
18144                     code="$?"
18145                     $from try.out
18146                     if $test ! -s try.out -a "X$code" = X42; then
18147                         output=-DTRY_FPRINTF
18148                     fi
18149             fi
18150         ;;
18151     esac
18152 fi
18153 : check for fflush NULL behaviour
18154 case "$fflushNULL" in
18155 '')     set try -DTRY_FFLUSH_NULL $output
18156         if eval $compile; then
18157                 $run ./try 2>/dev/null
18158                 code="$?"
18159                 $from try.out
18160                 if $test -s try.out -a "X$code" = X42; then
18161                         fflushNULL="`$cat try.out`"
18162                 else
18163                         if $test "X$code" != X42; then
18164                                 $cat >&4 <<EOM
18165 (If this test failed, don't worry, we'll try another method shortly.)
18166 EOM
18167                         fi
18168                 fi
18169         fi
18170         $rm -f core try.core core.try.*
18171         case "$fflushNULL" in
18172         x)      $cat >&4 <<EOM
18173 Your fflush(NULL) works okay for output streams.
18174 Let's see if it clobbers input pipes...
18175 EOM
18176 # As of mid-March 2000 all versions of Solaris appear to have a stdio
18177 # bug that improperly flushes the input end of pipes.  So we avoid the
18178 # autoflush on fork/system/exec support for now. :-(
18179 $cat >tryp.c <<EOCP
18180 #include <stdio.h>
18181 int
18182 main(int argc, char **argv)
18183 {
18184     char buf[1024];
18185     int i;
18186     char *bp = buf;
18187     while (1) {
18188         while ((i = getc(stdin)) != -1
18189                && (*bp++ = i) != '\n'
18190                && bp < &buf[1024])
18191         /* DO NOTHING */ ;
18192         *bp = '\0';
18193         fprintf(stdout, "%s", buf);
18194         fflush(NULL);
18195         if (i == -1)
18196             return 0;
18197         bp = buf;
18198     }
18199 }
18200 EOCP
18201                 fflushNULL="$define"
18202                 set tryp
18203                 if eval $compile; then
18204                     $rm -f tryp.out
18205                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18206                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
18207                        $cat >&4 <<EOM
18208 fflush(NULL) seems to behave okay with input streams.
18209 EOM
18210                         fflushNULL="$define"
18211                     else
18212                         $cat >&4 <<EOM
18213 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
18214 EOM
18215                         fflushNULL="$undef"
18216                     fi
18217                 fi
18218                 $rm -f core tryp.c tryp.core core.tryp.*
18219                 ;;
18220         '')     $cat >&4 <<EOM
18221 Your fflush(NULL) isn't working (contrary to ANSI C).
18222 EOM
18223                 fflushNULL="$undef"
18224                 ;;
18225         *)      $cat >&4 <<EOM
18226 Cannot figure out whether your fflush(NULL) works or not.
18227 I'm assuming it doesn't (contrary to ANSI C).
18228 EOM
18229                 fflushNULL="$undef"
18230                 ;;
18231         esac
18232         ;;
18233 $define|true|[yY]*)
18234         fflushNULL="$define"
18235         ;;
18236 *)
18237         fflushNULL="$undef"
18238         ;;
18239 esac
18240 : check explicit looping only if NULL did not work, and if the pipe
18241 : bug does not show up on an explicit flush too
18242 case "$fflushNULL" in
18243 "$undef")
18244         $cat >tryp.c <<EOCP
18245 #include <stdio.h>
18246 int
18247 main(int argc, char **argv)
18248 {
18249     char buf[1024];
18250     int i;
18251     char *bp = buf;
18252     while (1) {
18253         while ((i = getc(stdin)) != -1
18254                && (*bp++ = i) != '\n'
18255                && bp < &buf[1024])
18256         /* DO NOTHING */ ;
18257         *bp = '\0';
18258         fprintf(stdout, "%s", buf);
18259         fflush(stdin);
18260         if (i == -1)
18261             return 0;
18262         bp = buf;
18263     }
18264 }
18265 EOCP
18266         set tryp
18267         if eval $compile; then
18268             $rm -f tryp.out
18269             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18270             if cmp tryp.c tryp.out >/dev/null 2>&1; then
18271                $cat >&4 <<EOM
18272 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18273 EOM
18274                 : now check for fflushall behaviour
18275                 case "$fflushall" in
18276                 '')     set try -DTRY_FFLUSH_ALL $output
18277                         if eval $compile; then
18278                                 $cat >&4 <<EOM
18279 (Now testing the other method--but note that this also may fail.)
18280 EOM
18281                                 $run ./try 2>/dev/null
18282                                 code=$?
18283                                 $from try.out
18284                                 if $test -s try.out -a "X$code" = X42; then
18285                                         fflushall="`$cat try.out`"
18286                                 fi
18287                         fi
18288                         $rm -f core try.core core.try.*
18289                         case "$fflushall" in
18290                         x)      $cat >&4 <<EOM
18291 Whew. Flushing explicitly all the stdio streams works.
18292 EOM
18293                                 fflushall="$define"
18294                                 ;;
18295                         '')     $cat >&4 <<EOM
18296 Sigh. Flushing explicitly all the stdio streams doesn't work.
18297 EOM
18298                                 fflushall="$undef"
18299                                 ;;
18300                         *)      $cat >&4 <<EOM
18301 Cannot figure out whether flushing stdio streams explicitly works or not.
18302 I'm assuming it doesn't.
18303 EOM
18304                                 fflushall="$undef"
18305                                 ;;
18306                         esac
18307                         ;;
18308                 "$define"|true|[yY]*)
18309                         fflushall="$define"
18310                         ;;
18311                 *)
18312                         fflushall="$undef"
18313                         ;;
18314                 esac
18315             else
18316                 $cat >&4 <<EOM
18317 All is futile.  Even fflush(stdin) clobbers input pipes!
18318 EOM
18319                 fflushall="$undef"
18320             fi
18321         else
18322             fflushall="$undef"
18323         fi
18324         $rm -f core tryp.c tryp.core core.tryp.*
18325         ;;
18326 *)      fflushall="$undef"
18327         ;;
18328 esac
18329
18330 case "$fflushNULL$fflushall" in
18331 undefundef)
18332         $cat <<EOM
18333 OK, I give up.  I cannot figure out how to flush pending stdio output.
18334 We won't be flushing handles at all before fork/exec/popen.
18335 EOM
18336         ;;
18337 esac
18338 $rm -f try.* try$exe_ext
18339
18340 : Store the full pathname to the ar program for use in the C program
18341 : Respect a hint or command line value for full_ar.
18342 case "$full_ar" in
18343 '') full_ar=$ar ;;
18344 esac
18345
18346 : Store the full pathname to the sed program for use in the C program
18347 full_sed=$sed
18348
18349 : see what type gids are declared as in the kernel
18350 echo " "
18351 echo "Looking for the type for group ids returned by getgid()."
18352 set gid_t gidtype xxx stdio.h sys/types.h
18353 eval $typedef
18354 case "$gidtype" in
18355 xxx)
18356         xxx=`./findhdr sys/user.h`
18357         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
18358         case $1 in
18359         unsigned) dflt="$1 $2" ;;
18360         *) dflt="$1" ;;
18361         esac
18362         ;;
18363 *) dflt="$gidtype";;
18364 esac
18365 case "$gidtype" in
18366 gid_t) echo "gid_t found." ;;
18367 *)      rp="What is the type for group ids returned by getgid()?"
18368         . ./myread
18369         gidtype="$ans"
18370         ;;
18371 esac
18372
18373 echo " "
18374 case "$gidtype" in
18375 *_t) zzz="$gidtype"     ;;
18376 *)   zzz="gid"          ;;
18377 esac
18378 echo "Checking the size of $zzz..." >&4 
18379 cat > try.c <<EOCP
18380 #include <sys/types.h>
18381 #include <stdio.h>
18382 #$i_stdlib I_STDLIB
18383 #ifdef I_STDLIB
18384 #include <stdlib.h>
18385 #endif
18386 int main() {
18387     printf("%d\n", (int)sizeof($gidtype));
18388     exit(0);
18389 }
18390 EOCP
18391 set try
18392 if eval $compile_ok; then
18393         yyy=`$run ./try`
18394         case "$yyy" in
18395         '')     gidsize=4
18396                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
18397                 ;;
18398         *)      gidsize=$yyy
18399                 echo "Your $zzz is $gidsize bytes long."
18400                 ;;
18401         esac
18402 else
18403         gidsize=4
18404         echo "(I can't compile the test program--guessing $gidsize.)" >&4
18405 fi
18406
18407
18408 echo " "
18409 case "$gidtype" in
18410 *_t) zzz="$gidtype"     ;;
18411 *)   zzz="gid"          ;;
18412 esac
18413 echo "Checking the sign of $zzz..." >&4 
18414 cat > try.c <<EOCP
18415 #include <sys/types.h>
18416 #include <stdio.h>
18417 int main() {
18418         $gidtype foo = -1;
18419         if (foo < 0)
18420                 printf("-1\n");
18421         else
18422                 printf("1\n");
18423 }
18424 EOCP
18425 set try
18426 if eval $compile; then
18427         yyy=`$run ./try`
18428         case "$yyy" in
18429         '')     gidsign=1
18430                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18431                 ;;
18432         *)      gidsign=$yyy
18433                 case "$gidsign" in
18434                  1) echo "Your $zzz is unsigned." ;;
18435                 -1) echo "Your $zzz is signed."   ;;
18436                 esac
18437                 ;;
18438         esac
18439 else
18440         gidsign=1
18441         echo "(I can't compile the test program--guessing unsigned.)" >&4
18442 fi
18443
18444
18445 echo " "
18446
18447 if $test X"$quadtype" != X; then
18448
18449 echo "Checking how to print 64-bit integers..." >&4
18450
18451 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
18452         $cat >try.c <<'EOCP'
18453 #include <sys/types.h>
18454 #include <stdio.h>
18455 int main() {
18456   int q = 12345678901;
18457   printf("%ld\n", q);
18458 }
18459 EOCP
18460         set try
18461         if eval $compile; then
18462                 yyy=`$run ./try`
18463                 case "$yyy" in
18464                 12345678901)
18465                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
18466                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
18467                         echo "We will use %d."
18468                         ;;
18469                 esac
18470         fi
18471 fi
18472
18473 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
18474         $cat >try.c <<'EOCP'
18475 #include <sys/types.h>
18476 #include <stdio.h>
18477 int main() {
18478   long q = 12345678901;
18479   printf("%ld\n", q);
18480 }
18481 EOCP
18482         set try
18483         if eval $compile; then
18484                 yyy=`$run ./try`
18485                 case "$yyy" in
18486                 12345678901)
18487                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
18488                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
18489                         echo "We will use %ld."
18490                         ;;
18491                 esac
18492         fi
18493 fi
18494
18495 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
18496         $cat >try.c <<'EOCP'
18497 #include <sys/types.h>
18498 #include <inttypes.h>
18499 #include <stdio.h>
18500 int main() {
18501   int64_t q = 12345678901;
18502   printf("%" PRId64 "\n", q);
18503 }
18504 EOCP
18505         set try
18506         if eval $compile; then
18507                 yyy=`$run ./try`
18508                 case "$yyy" in
18509                 12345678901)
18510                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
18511                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
18512                         echo "We will use the C9X style."
18513                         ;;
18514                 esac
18515         fi
18516 fi
18517
18518 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18519         $cat >try.c <<EOCP
18520 #include <sys/types.h>
18521 #include <stdio.h>
18522 int main() {
18523   $quadtype q = 12345678901;
18524   printf("%Ld\n", q);
18525 }
18526 EOCP
18527         set try
18528         if eval $compile; then
18529                 yyy=`$run ./try`
18530                 case "$yyy" in
18531                 12345678901)
18532                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
18533                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
18534                         echo "We will use %Ld."
18535                         ;;
18536                 esac
18537         fi
18538 fi
18539
18540 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
18541         $cat >try.c <<'EOCP'
18542 #include <sys/types.h>
18543 #include <stdio.h>
18544 int main() {
18545   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
18546   printf("%lld\n", q);
18547 }
18548 EOCP
18549         set try
18550         if eval $compile; then
18551                 yyy=`$run ./try`
18552                 case "$yyy" in
18553                 12345678901)
18554                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
18555                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
18556                         echo "We will use the %lld style."
18557                         ;;
18558                 esac
18559         fi
18560 fi
18561
18562 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18563         $cat >try.c <<EOCP
18564 #include <sys/types.h>
18565 #include <stdio.h>
18566 int main() {
18567   $quadtype q = 12345678901;
18568   printf("%qd\n", q);
18569 }
18570 EOCP
18571         set try
18572         if eval $compile; then
18573                 yyy=`$run ./try`
18574                 case "$yyy" in
18575                 12345678901)
18576                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
18577                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
18578                         echo "We will use %qd."
18579                         ;;
18580                 esac
18581         fi
18582 fi
18583
18584 if $test X"$sPRId64" = X; then
18585         echo "Cannot figure out how to print 64-bit integers." >&4
18586 fi
18587
18588 $rm -f try try.*
18589
18590 fi
18591
18592 case "$sPRId64" in
18593 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
18594         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
18595         ;;
18596 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
18597         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
18598         ;;
18599 esac
18600
18601
18602 echo " "
18603 $echo "Checking the format strings to be used for Perl's internal types..." >&4
18604
18605 if $test X"$ivsize" = X8; then
18606         ivdformat="$sPRId64"
18607         uvuformat="$sPRIu64"
18608         uvoformat="$sPRIo64"
18609         uvxformat="$sPRIx64"
18610         uvXUformat="$sPRIXU64"
18611 else
18612         if $test X"$ivsize" = X"$longsize"; then
18613                 ivdformat='"ld"'
18614                 uvuformat='"lu"'
18615                 uvoformat='"lo"'
18616                 uvxformat='"lx"'
18617                 uvXUformat='"lX"'
18618         else
18619                 if $test X"$ivsize" = X"$intsize"; then
18620                         ivdformat='"d"'
18621                         uvuformat='"u"'
18622                         uvoformat='"o"'
18623                         uvxformat='"x"'
18624                         uvXUformat='"X"'
18625                 else
18626                         : far out
18627                         if $test X"$ivsize" = X"$shortsize"; then
18628                                 ivdformat='"hd"'
18629                                 uvuformat='"hu"'
18630                                 uvoformat='"ho"'
18631                                 uvxformat='"hx"'
18632                                 uvXUformat='"hX"'
18633                         fi
18634                 fi
18635         fi
18636 fi
18637
18638 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
18639         nveformat="$sPRIeldbl"
18640         nvfformat="$sPRIfldbl"
18641         nvgformat="$sPRIgldbl"
18642         nvEUformat="$sPRIEUldbl"
18643         nvFUformat="$sPRIFUldbl"
18644         nvGUformat="$sPRIGUldbl"
18645 else
18646         nveformat='"e"'
18647         nvfformat='"f"'
18648         nvgformat='"g"'
18649         nvEUformat='"E"'
18650         nvFUformat='"F"'
18651         nvGUformat='"G"'
18652 fi
18653
18654 case "$ivdformat" in
18655 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
18656     exit 1
18657     ;;
18658 esac
18659
18660
18661 echo " "
18662 $echo "Checking the format string to be used for gids..." >&4
18663
18664 case "$gidsign" in
18665 -1)     if $test X"$gidsize" = X"$ivsize"; then
18666                 gidformat="$ivdformat"
18667         else
18668                 if $test X"$gidsize" = X"$longsize"; then
18669                         gidformat='"ld"'
18670                 else
18671                         if $test X"$gidsize" = X"$intsize"; then
18672                                 gidformat='"d"'
18673                         else
18674                                 if $test X"$gidsize" = X"$shortsize"; then
18675                                         gidformat='"hd"'
18676                                 fi
18677                         fi
18678                 fi
18679         fi
18680         ;;
18681 *)      if $test X"$gidsize" = X"$uvsize"; then
18682                 gidformat="$uvuformat"
18683         else
18684                 if $test X"$gidsize" = X"$longsize"; then
18685                         gidformat='"lu"'
18686                 else
18687                         if $test X"$gidsize" = X"$intsize"; then
18688                                 gidformat='"u"'
18689                         else
18690                                 if $test X"$gidsize" = X"$shortsize"; then
18691                                         gidformat='"hu"'
18692                                 fi
18693                         fi
18694                 fi
18695         fi
18696         ;;
18697 esac
18698
18699 : see if getgroups exists
18700 set getgroups d_getgrps
18701 eval $inlibc
18702
18703 : see if setgroups exists
18704 set setgroups d_setgrps
18705 eval $inlibc
18706
18707
18708 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
18709 echo " "
18710 case "$d_getgrps$d_setgrps" in
18711 *define*)
18712         case "$groupstype" in
18713         '') dflt="$gidtype" ;;
18714         *)  dflt="$groupstype" ;;
18715         esac
18716         $cat <<EOM
18717 What type of pointer is the second argument to getgroups() and setgroups()?
18718 Usually this is the same as group ids, $gidtype, but not always.
18719
18720 EOM
18721         rp='What type pointer is the second argument to getgroups() and setgroups()?'
18722         . ./myread
18723         groupstype="$ans"
18724         ;;
18725 *)  groupstype="$gidtype";;
18726 esac
18727
18728 echo " "
18729 echo "Checking if your $make program sets \$(MAKE)..." >&4
18730 case "$make_set_make" in
18731 '')
18732         $sed 's/^X //' > testmake.mak << 'EOF'
18733 Xall:
18734 X       @echo 'maketemp="$(MAKE)"'
18735 EOF
18736         case "`$make -f testmake.mak 2>/dev/null`" in
18737         *maketemp=*) make_set_make='#' ;;
18738         *)      make_set_make="MAKE=$make" ;;
18739         esac
18740         $rm -f testmake.mak
18741         ;;
18742 esac
18743 case "$make_set_make" in
18744 '#') echo "Yup, it does.";;
18745 *) echo "Nope, it doesn't.";;
18746 esac
18747
18748 : see what type is used for mode_t
18749 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
18750 set mode_t modetype int stdio.h sys/types.h
18751 eval $typedef_ask
18752
18753 : see if stdarg is available
18754 echo " "
18755 if $test `./findhdr stdarg.h`; then
18756         echo "<stdarg.h> found." >&4
18757         valstd="$define"
18758 else
18759         echo "<stdarg.h> NOT found." >&4
18760         valstd="$undef"
18761 fi
18762
18763 : see if varags is available
18764 echo " "
18765 if $test `./findhdr varargs.h`; then
18766         echo "<varargs.h> found." >&4
18767 else
18768         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
18769 fi
18770
18771 : set up the varargs testing programs
18772 $cat > varargs.c <<EOP
18773 #ifdef I_STDARG
18774 #include <stdarg.h>
18775 #endif
18776 #ifdef I_VARARGS
18777 #include <varargs.h>
18778 #endif
18779
18780 #ifdef I_STDARG
18781 int f(char *p, ...)
18782 #else
18783 int f(va_alist)
18784 va_dcl
18785 #endif
18786 {
18787         va_list ap;
18788 #ifndef I_STDARG
18789         char *p;
18790 #endif
18791 #ifdef I_STDARG
18792         va_start(ap,p);
18793 #else
18794         va_start(ap);
18795         p = va_arg(ap, char *);
18796 #endif
18797         va_end(ap);
18798 }
18799 EOP
18800 $cat > varargs <<EOP
18801 $startsh
18802 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
18803         echo "true"
18804 else
18805         echo "false"
18806 fi
18807 $rm -f varargs$_o
18808 EOP
18809 chmod +x varargs
18810
18811 : now check which varargs header should be included
18812 echo " "
18813 i_varhdr=''
18814 case "$valstd" in
18815 "$define")
18816         if `./varargs I_STDARG`; then
18817                 val='stdarg.h'
18818         elif `./varargs I_VARARGS`; then
18819                 val='varargs.h'
18820         fi
18821         ;;
18822 *)
18823         if `./varargs I_VARARGS`; then
18824                 val='varargs.h'
18825         fi
18826         ;;
18827 esac
18828 case "$val" in
18829 '')
18830 echo "I could not find the definition for va_dcl... You have problems..." >&4
18831         val="$undef"; set i_stdarg; eval $setvar
18832         val="$undef"; set i_varargs; eval $setvar
18833         ;;
18834 *) 
18835         set i_varhdr
18836         eval $setvar
18837         case "$i_varhdr" in
18838         stdarg.h)
18839                 val="$define"; set i_stdarg; eval $setvar
18840                 val="$undef"; set i_varargs; eval $setvar
18841                 ;;
18842         varargs.h)
18843                 val="$undef"; set i_stdarg; eval $setvar
18844                 val="$define"; set i_varargs; eval $setvar
18845                 ;;
18846         esac
18847         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
18848 esac
18849 $rm -f varargs*
18850
18851 : see if we need va_copy
18852 echo " "
18853 case "$i_stdarg" in
18854 "$define")
18855         $cat >try.c <<EOCP
18856 #include <stdarg.h>
18857 #include <stdio.h>
18858 #$i_stdlib I_STDLIB
18859 #ifdef I_STDLIB
18860 #include <stdlib.h>
18861 #endif
18862 #include <signal.h>
18863
18864 int
18865 ivfprintf(FILE *f, const char *fmt, va_list *valp)
18866 {
18867   return vfprintf(f, fmt, *valp);
18868 }
18869  
18870 int    
18871 myvfprintf(FILE *f, const  char *fmt, va_list val)
18872 {
18873   return ivfprintf(f, fmt, &val);
18874 }
18875       
18876 int
18877 myprintf(char *fmt, ...) 
18878 {
18879   va_list val;
18880   va_start(val, fmt);
18881   return myvfprintf(stdout, fmt, val); 
18882 }         
18883
18884 int
18885 main(int ac, char **av)
18886 {
18887   signal(SIGSEGV, exit);
18888
18889   myprintf("%s%cs all right, then\n", "that", '\'');                            
18890   exit(0);      
18891 }
18892 EOCP
18893         set try
18894         if eval $compile && $run ./try 2>&1 >/dev/null; then
18895                 case "`$run ./try`" in
18896                 "that's all right, then")
18897                         okay=yes
18898                         ;;
18899                 esac
18900         fi
18901         case "$okay" in
18902         yes)    echo "It seems that you don't need va_copy()." >&4
18903                 need_va_copy="$undef"
18904                 ;;
18905         *)      echo "It seems that va_copy() or similar will be needed." >&4
18906                 need_va_copy="$define"
18907                 ;;
18908         esac
18909         $rm -f try.* core core.* *.core *.core.*
18910         ;;
18911 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
18912         ;;
18913 esac
18914
18915 : see what type is used for size_t
18916 rp="What is the type used for the length parameter for string functions?"
18917 set size_t sizetype 'unsigned int' stdio.h sys/types.h
18918 eval $typedef_ask
18919
18920 : check for type of arguments to gethostbyaddr. 
18921 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
18922         case "$d_gethbyaddr" in
18923         $define)
18924                 $cat <<EOM
18925
18926 Checking to see what type of arguments are accepted by gethostbyaddr().
18927 EOM
18928                 hdrs="$define sys/types.h
18929                         $d_socket sys/socket.h 
18930                         $i_niin netinet/in.h 
18931                         $i_netdb netdb.h
18932                         $i_unistd unistd.h"
18933                 : The first arg can 'char *' or 'void *'
18934                 : The second arg is some of integral type
18935                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
18936                         for yyy in size_t long int; do
18937                                 case "$netdb_host_type" in
18938                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
18939                                         if ./protochk "$try" $hdrs; then
18940                                                 echo "Your system accepts $xxx for the first arg."
18941                                                 echo "...and $yyy for the second arg."
18942                                                 netdb_host_type="$xxx"
18943                                                 netdb_hlen_type="$yyy"
18944                                         fi
18945                                         ;;
18946                                 esac
18947                         done
18948                 done
18949                 : In case none of those worked, prompt the user.
18950                 case "$netdb_host_type" in
18951                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
18952                         dflt='char *'
18953                         . ./myread
18954                         netdb_host_type=$ans
18955                         rp='What is the type for the 2nd argument to gethostbyaddr?'
18956                         dflt="$sizetype"
18957                         . ./myread
18958                         netdb_hlen_type=$ans
18959                         ;;
18960                 esac
18961                 ;;
18962         *)      : no gethostbyaddr, so pick harmless defaults
18963                 netdb_host_type='char *'
18964                 netdb_hlen_type="$sizetype"
18965                 ;;
18966         esac
18967         # Remove the "const" if needed. -- but then we'll have a 
18968         # prototype clash!
18969         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
18970 fi
18971
18972 : check for type of argument to gethostbyname. 
18973 if test "X$netdb_name_type" = X ; then
18974         case "$d_gethbyname" in
18975         $define)
18976                 $cat <<EOM
18977
18978 Checking to see what type of argument is accepted by gethostbyname().
18979 EOM
18980                 hdrs="$define sys/types.h
18981                         $d_socket sys/socket.h 
18982                         $i_niin netinet/in.h 
18983                         $i_netdb netdb.h
18984                         $i_unistd unistd.h"
18985                 for xxx in "const char *" "char *"; do
18986                         case "$netdb_name_type" in
18987                         '')     try="extern struct hostent *gethostbyname($xxx);"
18988                                 if ./protochk "$try" $hdrs; then
18989                                         echo "Your system accepts $xxx."
18990                                         netdb_name_type="$xxx"
18991                                 fi
18992                                 ;;
18993                         esac
18994                 done
18995                 : In case none of those worked, prompt the user.
18996                 case "$netdb_name_type" in
18997                 '')     rp='What is the type for the 1st argument to gethostbyname?'
18998                         dflt='char *'
18999                         . ./myread
19000                         netdb_name_type=$ans
19001                         ;;
19002                 esac
19003                 ;;
19004         *)      : no gethostbyname, so pick harmless default
19005                 netdb_name_type='char *'
19006                 ;;
19007         esac
19008 fi
19009
19010 : check for type of 1st argument to getnetbyaddr. 
19011 if test "X$netdb_net_type" = X ; then
19012         case "$d_getnbyaddr" in
19013         $define)
19014                 $cat <<EOM
19015
19016 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19017 EOM
19018                 hdrs="$define sys/types.h
19019                         $d_socket sys/socket.h 
19020                         $i_niin netinet/in.h 
19021                         $i_netdb netdb.h
19022                         $i_unistd unistd.h"
19023                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19024                         case "$netdb_net_type" in
19025                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19026                                 if ./protochk "$try" $hdrs; then
19027                                         echo "Your system accepts $xxx."
19028                                         netdb_net_type="$xxx"
19029                                 fi
19030                                 ;;
19031                         esac
19032                 done
19033                 : In case none of those worked, prompt the user.
19034                 case "$netdb_net_type" in
19035                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19036                         dflt='long'
19037                         . ./myread
19038                         netdb_net_type=$ans
19039                         ;;
19040                 esac
19041                 ;;
19042         *)      : no getnetbyaddr, so pick harmless default
19043                 netdb_net_type='long'
19044                 ;;
19045         esac
19046 fi
19047 : locate the preferred pager for this system
19048 fn=f/
19049 case "$pager" in
19050 '')
19051         dflt=''
19052         case "$pg" in
19053         /*) dflt=$pg;;
19054         [a-zA-Z]:/*) dflt=$pg;;
19055         esac
19056         case "$more" in
19057         /*) dflt=$more;;
19058         [a-zA-Z]:/*) dflt=$more;;
19059         esac
19060         case "$less" in
19061         /*) dflt=$less;;
19062         [a-zA-Z]:/*) dflt=$less;;
19063         esac
19064         case "$dflt" in
19065         '') dflt=/usr/ucb/more;;
19066         esac
19067         ;;
19068 *)      dflt="$pager"
19069         : Instruct ./getfile to trust the hinted or previous pager value,
19070         : even if it does not begin with a slash.  For example, on os2,
19071         : pager might be cmd /c more.  See comments in UU/getfile.
19072         fn="f/($pager)"
19073         ;;
19074 esac
19075 echo " "
19076 rp='What pager is used on your system?'
19077 . ./getfile
19078 pager="$ans"
19079
19080 : see what type pids are declared as in the kernel
19081 rp="What is the type of process ids on this system?"
19082 set pid_t pidtype int stdio.h sys/types.h
19083 eval $typedef_ask
19084
19085 : see if ar generates random libraries by itself
19086 echo " "
19087 echo "Checking how to generate random libraries on your machine..." >&4
19088 echo 'int bar1() { return bar2(); }' > bar1.c
19089 echo 'int bar2() { return 2; }' > bar2.c
19090 $cat > foo.c <<EOP
19091 #$i_stdlib I_STDLIB
19092 #ifdef I_STDLIB
19093 #include <stdlib.h>
19094 #endif
19095 int main() { printf("%d\n", bar1()); exit(0); }
19096 EOP
19097 $cc $ccflags -c bar1.c >/dev/null 2>&1
19098 $cc $ccflags -c bar2.c >/dev/null 2>&1
19099 $cc $ccflags -c foo.c >/dev/null 2>&1
19100 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19101 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19102         $run ./foobar >/dev/null 2>&1; then
19103         echo "$ar appears to generate random libraries itself."
19104         orderlib=false
19105         if [ "X$ranlib" = "X" ]; then
19106             ranlib=":"
19107         fi
19108 elif $ar ts bar$_a >/dev/null 2>&1 &&
19109         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19110         $run ./foobar >/dev/null 2>&1; then
19111                 echo "a table of contents needs to be added with '$ar ts'."
19112                 orderlib=false
19113                 ranlib="$ar ts"
19114 else
19115         case "$ranlib" in
19116         :) ranlib='';;
19117         '')
19118                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19119                 $test -f $ranlib || ranlib=''
19120                 ;;
19121         esac
19122         if $test -n "$ranlib"; then
19123                 echo "your system has '$ranlib'; we'll use that."
19124                 orderlib=false
19125         else
19126                 echo "your system doesn't seem to support random libraries"
19127                 echo "so we'll use lorder and tsort to order the libraries."
19128                 orderlib=true
19129                 ranlib=":"
19130         fi
19131 fi
19132 $rm -f foo* bar* 
19133
19134 : check for type of arguments to select. 
19135 case "$selecttype" in
19136 '') case "$d_select" in
19137         $define)
19138                 echo " "
19139                 $cat <<EOM
19140 Checking to see what type of arguments are accepted by select().
19141 EOM
19142                 hdrs="$define sys/types.h
19143                         $i_systime sys/time.h 
19144                         $i_sysselct sys/select.h
19145                         $d_socket sys/socket.h"
19146                 : The first arg can be int, unsigned, or size_t
19147                 : The last arg may or may not be 'const'
19148                 val=''
19149                 : void pointer has been seen but using that
19150                 : breaks the selectminbits test
19151                 for xxx in 'fd_set *' 'int *'; do
19152                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19153                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
19154                                         case "$val" in
19155                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19156                                                 if ./protochk "$try" $hdrs; then
19157                                                         echo "Your system accepts $xxx."
19158                                                         val="$xxx"
19159                                                 fi
19160                                                 ;;
19161                                         esac
19162                                 done
19163                         done
19164                 done
19165                 case "$val" in
19166                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19167                         case "$d_fd_set" in
19168                                 $define) dflt="fd_set *" ;;
19169                                 *)              dflt="int *" ;;
19170                         esac
19171                         . ./myread
19172                         val=$ans
19173                         ;;
19174                 esac
19175                 selecttype="$val"
19176                 ;;
19177         *)      : no select, so pick a harmless default
19178                 selecttype='int *'
19179                 ;;
19180         esac
19181         ;;
19182 esac
19183
19184 : check for the select 'width'
19185 case "$selectminbits" in
19186 '') safebits=`expr $ptrsize \* 8`
19187     case "$d_select" in
19188         $define)
19189                 $cat <<EOM
19190
19191 Checking to see on how many bits at a time your select() operates...
19192 EOM
19193                 $cat >try.c <<EOCP
19194 #include <sys/types.h>
19195 #$i_time I_TIME
19196 #$i_systime I_SYS_TIME
19197 #$i_systimek I_SYS_TIME_KERNEL
19198 #ifdef I_TIME
19199 #   include <time.h>
19200 #endif
19201 #ifdef I_SYS_TIME
19202 #   ifdef I_SYS_TIME_KERNEL
19203 #       define KERNEL
19204 #   endif
19205 #   include <sys/time.h>
19206 #   ifdef I_SYS_TIME_KERNEL
19207 #       undef KERNEL
19208 #   endif
19209 #endif
19210 #$i_sysselct I_SYS_SELECT
19211 #ifdef I_SYS_SELECT
19212 #include <sys/select.h>
19213 #endif
19214 #$d_socket HAS_SOCKET
19215 #ifdef HAS_SOCKET
19216 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19217 #endif
19218 #include <stdio.h>
19219 #$i_stdlib I_STDLIB
19220 #ifdef I_STDLIB
19221 #include <stdlib.h>
19222 #endif
19223 $selecttype b;
19224 #define S sizeof(*(b))
19225 #define MINBITS 64
19226 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19227 #define NBITS  (NBYTES * 8)
19228 int main() {
19229     char *s = malloc(NBYTES);
19230     struct timeval t;
19231     int i;
19232     FILE* fp;
19233     int fd;
19234
19235     if (!s)
19236         exit(1);
19237     fclose(stdin);
19238     fp = fopen("try.c", "r");
19239     if (fp == 0)
19240       exit(2);
19241     fd = fileno(fp);
19242     if (fd < 0)
19243       exit(3);
19244     b = ($selecttype)s;
19245     for (i = 0; i < NBITS; i++)
19246         FD_SET(i, b);
19247     t.tv_sec  = 0;
19248     t.tv_usec = 0;
19249     select(fd + 1, b, 0, 0, &t);
19250     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
19251     free(s);
19252     printf("%d\n", i + 1);
19253     return 0;
19254 }
19255 EOCP
19256                 set try
19257                 if eval $compile_ok; then
19258                         selectminbits=`$run ./try`
19259                         case "$selectminbits" in
19260                         '')     cat >&4 <<EOM
19261 Cannot figure out on how many bits at a time your select() operates.
19262 I'll play safe and guess it is $safebits bits.
19263 EOM
19264                                 selectminbits=$safebits
19265                                 bits="$safebits bits"
19266                                 ;;
19267                         1)      bits="1 bit" ;;
19268                         *)      bits="$selectminbits bits" ;;
19269                         esac
19270                         echo "Your select() operates on $bits at a time." >&4
19271                 else
19272                         rp='What is the minimum number of bits your select() operates on?'
19273                         case "$byteorder" in
19274                         12345678)       dflt=64 ;;
19275                         1234)           dflt=32 ;;
19276                         *)              dflt=1  ;;
19277                         esac
19278                         . ./myread
19279                         val=$ans
19280                         selectminbits="$val"
19281                 fi
19282                 $rm -f try.* try
19283                 ;;
19284         *)      : no select, so pick a harmless default
19285                 selectminbits=$safebits
19286                 ;;
19287         esac
19288         ;;
19289 esac
19290
19291 : Trace out the files included by signal.h, then look for SIGxxx names.
19292 : Remove SIGARRAYSIZE used by HPUX.
19293 : Remove SIGSTKSIZE used by Linux.
19294 : Remove SIGSTKSZ used by Posix.
19295 : Remove SIGTYP void lines used by OS2.
19296 : Some cpps, like os390, dont give the file name anywhere
19297 if [ "X$fieldn" = X ]; then
19298         : Just make some guesses.  We check them later.
19299         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19300 else
19301         xxx=`echo '#include <signal.h>' |
19302         $cppstdin $cppminus $cppflags 2>/dev/null |
19303         $grep '^[       ]*#.*include' | 
19304         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
19305 fi
19306 : Check this list of files to be sure we have parsed the cpp output ok.
19307 : This will also avoid potentially non-existent files, such 
19308 : as ../foo/bar.h
19309 xxxfiles=''
19310 for xx in $xxx /dev/null ; do
19311         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19312 done
19313 : If we have found no files, at least try signal.h
19314 case "$xxxfiles" in
19315 '')     xxxfiles=`./findhdr signal.h` ;;
19316 esac
19317 xxx=`awk '
19318 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19319         print substr($2, 4, 20)
19320 }
19321 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19322         print substr($3, 4, 20)
19323 }' $xxxfiles`
19324 : Append some common names just in case the awk scan failed.
19325 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19326 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19327 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19328 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19329 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19330
19331 : generate a few handy files for later
19332 $cat > signal.c <<EOCP
19333 #include <sys/types.h>
19334 #include <signal.h>
19335 #$i_stdlib I_STDLIB
19336 #ifdef I_STDLIB
19337 #include <stdlib.h>
19338 #endif
19339 #include <stdio.h>
19340 int main() {
19341
19342 /* Strange style to avoid deeply-nested #if/#else/#endif */
19343 #ifndef NSIG
19344 #  ifdef _NSIG
19345 #    define NSIG (_NSIG)
19346 #  endif
19347 #endif
19348
19349 #ifndef NSIG
19350 #  ifdef SIGMAX
19351 #    define NSIG (SIGMAX+1)
19352 #  endif
19353 #endif
19354
19355 #ifndef NSIG
19356 #  ifdef SIG_MAX
19357 #    define NSIG (SIG_MAX+1)
19358 #  endif
19359 #endif
19360
19361 #ifndef NSIG
19362 #  ifdef _SIG_MAX
19363 #    define NSIG (_SIG_MAX+1)
19364 #  endif
19365 #endif
19366
19367 #ifndef NSIG
19368 #  ifdef MAXSIG
19369 #    define NSIG (MAXSIG+1)
19370 #  endif
19371 #endif
19372
19373 #ifndef NSIG
19374 #  ifdef MAX_SIG
19375 #    define NSIG (MAX_SIG+1)
19376 #  endif
19377 #endif
19378
19379 #ifndef NSIG
19380 #  ifdef SIGARRAYSIZE
19381 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
19382 #  endif
19383 #endif
19384
19385 #ifndef NSIG
19386 #  ifdef _sys_nsig
19387 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
19388 #  endif
19389 #endif
19390
19391 /* Default to some arbitrary number that's big enough to get most
19392    of the common signals.
19393 */
19394 #ifndef NSIG
19395 #    define NSIG 50
19396 #endif
19397
19398 printf("NSIG %d\n", NSIG);
19399
19400 #ifndef JUST_NSIG
19401
19402 EOCP
19403
19404 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19405 {
19406         printf "#ifdef SIG"; printf $1; printf "\n"
19407         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
19408         printf $1; printf ");\n"
19409         printf "#endif\n"
19410 }
19411 END {
19412         printf "#endif /* JUST_NSIG */\n";
19413         printf "exit(0);\n}\n";
19414 }
19415 ' >>signal.c
19416 $cat >signal.awk <<'EOP'
19417 BEGIN { ndups = 0 }
19418 $1 ~ /^NSIG$/ { nsig = $2 }
19419 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
19420     if ($2 > maxsig) { maxsig = $2 }
19421     if (sig_name[$2]) {
19422         dup_name[ndups] = $1
19423         dup_num[ndups] = $2
19424         ndups++ 
19425     }
19426     else {
19427         sig_name[$2] = $1
19428         sig_num[$2] = $2
19429     }
19430 }
19431 END { 
19432     if (nsig == 0) {
19433         nsig = maxsig + 1
19434     }
19435     printf("NSIG %d\n", nsig);
19436     for (n = 1; n < nsig; n++) {
19437         if (sig_name[n]) {
19438             printf("%s %d\n", sig_name[n], sig_num[n])
19439         }
19440         else {
19441             printf("NUM%d %d\n", n, n) 
19442         }
19443     }
19444     for (n = 0; n < ndups; n++) {
19445         printf("%s %d\n", dup_name[n], dup_num[n])
19446     }
19447 }
19448 EOP
19449 $cat >signal_cmd <<EOS
19450 $startsh
19451 if $test -s signal.lst; then
19452     echo "Using your existing signal.lst file"
19453         exit 0
19454 fi
19455 xxx="$xxx"
19456 EOS
19457 $cat >>signal_cmd <<'EOS'
19458
19459 set signal
19460 if eval $compile_ok; then
19461         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
19462 else
19463         echo "(I can't seem be able to compile the whole test program)" >&4
19464         echo "(I'll try it in little pieces.)" >&4
19465         set signal -DJUST_NSIG
19466         if eval $compile_ok; then
19467                 $run ./signal$_exe > signal.nsg
19468                 $cat signal.nsg
19469         else
19470                 echo "I can't seem to figure out how many signals you have." >&4
19471                 echo "Guessing 50." >&4
19472                 echo 'NSIG 50' > signal.nsg
19473         fi
19474         : Now look at all the signal names, one at a time.
19475         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
19476                 $cat > signal.c <<EOCP
19477 #include <sys/types.h>
19478 #include <signal.h>
19479 #include <stdio.h>
19480 int main() {
19481 printf("$xx %d\n", SIG${xx});
19482 return 0;
19483 }
19484 EOCP
19485                 set signal
19486                 if eval $compile; then
19487                         echo "SIG${xx} found."
19488                         $run ./signal$_exe  >> signal.ls1
19489                 else
19490                         echo "SIG${xx} NOT found."
19491                 fi
19492         done
19493         if $test -s signal.ls1; then
19494                 $cat signal.nsg signal.ls1 |
19495                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
19496         fi
19497
19498 fi
19499 if $test -s signal.lst; then
19500         :
19501 else
19502         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
19503         echo 'kill -l' >signal
19504         set X `csh -f <signal`
19505         $rm -f signal
19506         shift
19507         case $# in
19508         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
19509         esac
19510         echo $@ | $tr ' ' $trnl | \
19511             $awk '{ printf "%s %d\n", $1, ++s; }
19512                   END { printf "NSIG %d\n", ++s }' >signal.lst
19513 fi
19514 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
19515 EOS
19516 chmod a+x signal_cmd
19517 $eunicefix signal_cmd
19518
19519 : generate list of signal names
19520 echo " "
19521 case "$sig_name_init" in
19522 '') doinit=yes ;;
19523 *)  case "$sig_num_init" in
19524     ''|*,*) doinit=yes ;;
19525     esac ;;
19526 esac
19527 case "$doinit" in
19528 yes)
19529         echo "Generating a list of signal names and numbers..." >&4
19530         . ./signal_cmd
19531         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
19532         sig_name=`$awk 'BEGIN { printf "ZERO " }
19533                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
19534         sig_num=`$awk  'BEGIN { printf "0 " }
19535                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
19536         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
19537                              !/^NSIG/   { printf "\"%s\", ", $1 }
19538                              END        { printf "0\n" }' signal.lst`
19539         sig_num_init=`$awk  'BEGIN      { printf "0, " }
19540                              !/^NSIG/   { printf "%d, ", $2}
19541                              END        { printf "0\n"}' signal.lst`
19542         ;;
19543 esac
19544 echo "The following $sig_count signals are available:"
19545 echo " "
19546 echo $sig_name | $awk \
19547 'BEGIN { linelen = 0 }
19548 {
19549         for (i = 1; i <= NF; i++) {
19550                 name = "SIG" $i " "
19551                 linelen = linelen + length(name)
19552                 if (linelen > 70) {
19553                         printf "\n"
19554                         linelen = length(name)
19555                 }
19556                 printf "%s", name
19557         }
19558         printf "\n"
19559 }'
19560 sig_size=`echo $sig_name | awk '{print NF}'`
19561 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
19562
19563 echo " "
19564 case "$sizetype" in
19565 *_t) zzz="$sizetype"    ;;
19566 *)   zzz="filesize"     ;;
19567 esac
19568 echo "Checking the size of $zzz..." >&4 
19569 cat > try.c <<EOCP
19570 #include <sys/types.h>
19571 #include <stdio.h>
19572 #$i_stdlib I_STDLIB
19573 #ifdef I_STDLIB
19574 #include <stdlib.h>
19575 #endif
19576 int main() {
19577     printf("%d\n", (int)sizeof($sizetype));
19578     exit(0);
19579 }
19580 EOCP
19581 set try
19582 if eval $compile_ok; then
19583         yyy=`$run ./try`
19584         case "$yyy" in
19585         '')     sizesize=4
19586                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
19587                 ;;
19588         *)      sizesize=$yyy
19589                 echo "Your $zzz size is $sizesize bytes."
19590                 ;;
19591         esac
19592 else
19593         sizesize=4
19594         echo "(I can't compile the test program--guessing $sizesize.)" >&4
19595 fi
19596
19597
19598 : check for socklen_t
19599 echo " "
19600 echo "Checking to see if you have socklen_t..." >&4
19601 $cat >try.c <<EOCP
19602 #include <sys/types.h>
19603 #$d_socket HAS_SOCKET
19604 #ifdef HAS_SOCKET
19605 #include <sys/socket.h>
19606 #endif
19607 int main() { socklen_t x = 16; }
19608 EOCP
19609 set try
19610 if eval $compile; then
19611         val="$define"
19612         echo "You have socklen_t."
19613 else
19614         val="$undef"
19615         echo "You do not have socklen_t."
19616         case "$sizetype" in
19617         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
19618         esac
19619 fi
19620 $rm -f try try.*
19621 set d_socklen_t
19622 eval $setvar
19623
19624 : see if this is a socks.h system
19625 set socks.h i_socks
19626 eval $inhdr
19627
19628 : check for type of the size argument to socket calls
19629 case "$d_socket" in
19630 "$define")
19631         $cat <<EOM
19632
19633 Checking to see what type is the last argument of accept().
19634 EOM
19635         yyy=''
19636         case "$d_socklen_t" in
19637         "$define") yyy="$yyy socklen_t"
19638         esac
19639         yyy="$yyy $sizetype int long unsigned"
19640         for xxx in $yyy; do
19641                 case "$socksizetype" in
19642                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
19643                         case "$usesocks" in
19644                         "$define")
19645                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
19646                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19647                                         socksizetype="$xxx"
19648                                 fi
19649                                 ;;
19650                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
19651                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19652                                         socksizetype="$xxx"
19653                                 fi
19654                                 ;;
19655                         esac
19656                         ;;
19657                 esac
19658         done
19659 : In case none of those worked, prompt the user.
19660         case "$socksizetype" in
19661         '')     rp='What is the type for socket address structure sizes?'
19662                 dflt='int'
19663                 . ./myread
19664                 socksizetype=$ans
19665                 ;;
19666         esac
19667         ;;
19668 *)      : no sockets, so pick relatively harmless default
19669         socksizetype='int'
19670         ;;
19671 esac
19672
19673 : see what type is used for signed size_t
19674 set ssize_t ssizetype int stdio.h sys/types.h
19675 eval $typedef
19676 dflt="$ssizetype"
19677 $cat > try.c <<EOM
19678 #include <stdio.h>
19679 #$i_stdlib I_STDLIB
19680 #ifdef I_STDLIB
19681 #include <stdlib.h>
19682 #endif
19683 #include <sys/types.h>
19684 #define Size_t $sizetype
19685 #define SSize_t $dflt
19686 int main()
19687 {
19688         if (sizeof(Size_t) == sizeof(SSize_t))
19689                 printf("$dflt\n");
19690         else if (sizeof(Size_t) == sizeof(int))
19691                 printf("int\n");
19692         else 
19693                 printf("long\n");
19694         exit(0);
19695 }
19696 EOM
19697 echo " "
19698 set try
19699 if eval $compile_ok && $run ./try > /dev/null; then
19700         ssizetype=`$run ./try`
19701         echo "I'll be using $ssizetype for functions returning a byte count." >&4
19702 else
19703         $cat >&4 <<EOM
19704 Help! I can't compile and run the ssize_t test program: please enlighten me!
19705 (This is probably a misconfiguration in your system or libraries, and
19706 you really ought to fix it.  Still, I'll try anyway.)
19707
19708 I need a type that is the same size as $sizetype, but is guaranteed to
19709 be signed.  Common values are ssize_t, int and long.
19710
19711 EOM
19712         rp="What signed type is the same size as $sizetype?"
19713         . ./myread
19714         ssizetype="$ans"
19715 fi
19716 $rm -f try try.*
19717
19718 : see what type of char stdio uses.
19719 echo " "
19720 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
19721 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
19722         echo "Your stdio uses unsigned chars." >&4
19723         stdchar="unsigned char"
19724 else
19725         echo "Your stdio uses signed chars." >&4
19726         stdchar="char"
19727 fi
19728 $rm -f stdioh
19729
19730
19731
19732 : see what type uids are declared as in the kernel
19733 echo " "
19734 echo "Looking for the type for user ids returned by getuid()."
19735 set uid_t uidtype xxx stdio.h sys/types.h
19736 eval $typedef
19737 case "$uidtype" in
19738 xxx)
19739         xxx=`./findhdr sys/user.h`
19740         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
19741         case $1 in
19742         unsigned) dflt="$1 $2" ;;
19743         *) dflt="$1" ;;
19744         esac
19745         ;;
19746 *) dflt="$uidtype";;
19747 esac
19748 case "$uidtype" in
19749 uid_t)  echo "uid_t found." ;;
19750 *)      rp="What is the type for user ids returned by getuid()?"
19751         . ./myread
19752         uidtype="$ans"
19753         ;;
19754 esac
19755
19756 echo " "
19757 case "$uidtype" in
19758 *_t) zzz="$uidtype"     ;;
19759 *)   zzz="uid"          ;;
19760 esac
19761 echo "Checking the size of $zzz..." >&4 
19762 cat > try.c <<EOCP
19763 #include <sys/types.h>
19764 #include <stdio.h>
19765 #$i_stdlib I_STDLIB
19766 #ifdef I_STDLIB
19767 #include <stdlib.h>
19768 #endif
19769 int main() {
19770     printf("%d\n", (int)sizeof($uidtype));
19771     exit(0);
19772 }
19773 EOCP
19774 set try
19775 if eval $compile_ok; then
19776         yyy=`$run ./try`
19777         case "$yyy" in
19778         '')     uidsize=4
19779                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
19780                 ;;
19781         *)      uidsize=$yyy
19782                 echo "Your $zzz is $uidsize bytes long."
19783                 ;;
19784         esac
19785 else
19786         uidsize=4
19787         echo "(I can't compile the test program--guessing $uidsize.)" >&4
19788 fi
19789
19790 echo " "
19791 case "$uidtype" in
19792 *_t) zzz="$uidtype"     ;;
19793 *)   zzz="uid"          ;;
19794 esac
19795 echo "Checking the sign of $zzz..." >&4
19796 cat > try.c <<EOCP
19797 #include <sys/types.h>
19798 #include <stdio.h>
19799 int main() {
19800         $uidtype foo = -1;
19801         if (foo < 0)
19802                 printf("-1\n");
19803         else
19804                 printf("1\n");
19805 }
19806 EOCP
19807 set try
19808 if eval $compile; then
19809         yyy=`$run ./try`
19810         case "$yyy" in
19811         '')     uidsign=1
19812                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19813                 ;;
19814         *)      uidsign=$yyy
19815                 case "$uidsign" in
19816                  1) echo "Your $zzz is unsigned." ;;
19817                 -1) echo "Your $zzz is signed."   ;;
19818                 esac
19819                 ;;
19820         esac
19821 else
19822         uidsign=1
19823         echo "(I can't compile the test program--guessing unsigned.)" >&4
19824 fi
19825
19826
19827
19828 echo " "
19829 $echo "Checking the format string to be used for uids..." >&4
19830
19831 case "$uidsign" in
19832 -1)     if $test X"$uidsize" = X"$ivsize"; then
19833                 uidformat="$ivdformat"
19834         else
19835                 if $test X"$uidsize" = X"$longsize"; then
19836                         uidformat='"ld"'
19837                 else
19838                         if $test X"$uidsize" = X"$intsize"; then
19839                                 uidformat='"d"'
19840                         else
19841                                 if $test X"$uidsize" = X"$shortsize"; then
19842                                         uidformat='"hd"'
19843                                 fi
19844                         fi
19845                 fi
19846         fi
19847         ;;
19848 *)      if $test X"$uidsize" = X"$uvsize"; then
19849                 uidformat="$uvuformat"
19850         else
19851                 if $test X"$uidsize" = X"$longsize"; then
19852                         uidformat='"lu"'
19853                 else
19854                         if $test X"$uidsize" = X"$intsize"; then
19855                                 uidformat='"u"'
19856                         else
19857                                 if $test X"$uidsize" = X"$shortsize"; then
19858                                         uidformat='"hu"'
19859                                 fi
19860                         fi
19861                 fi
19862         fi
19863         ;;
19864 esac
19865
19866
19867 case "$usesitecustomize" in
19868     $define|true|[Yy]*)
19869         usesitecustomize="$define"
19870         ;;
19871     *)
19872         usesitecustomize="$undef"
19873         ;;
19874     esac
19875
19876 : determine compiler compiler
19877 case "$yacc" in
19878 '')
19879         dflt=yacc;;
19880 *)
19881         dflt="$yacc";;
19882 esac
19883 echo " "
19884 comp='yacc'
19885 if $test -f "$byacc$_exe"; then
19886         dflt="$byacc"
19887         comp="byacc or $comp"
19888 fi
19889 if $test -f "$bison$_exe"; then
19890         comp="$comp or bison -y"
19891 fi
19892 rp="Which compiler compiler ($comp) shall I use?"
19893 . ./myread
19894 yacc="$ans"
19895 case "$yacc" in
19896 *bis*)
19897         case "$yacc" in
19898         *-y*) ;;
19899         *)
19900                 yacc="$yacc -y"
19901                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
19902                 ;;
19903         esac
19904         ;;
19905 esac
19906
19907 : see if this is a fp.h system
19908 set fp.h i_fp
19909 eval $inhdr
19910
19911 : see if this is a fp_class.h system
19912 set fp_class.h i_fp_class
19913 eval $inhdr
19914
19915 : see if this is a ieeefp.h system
19916 case "$i_ieeefp" in
19917 '' ) set ieeefp.h i_ieeefp
19918      eval $inhdr
19919      ;;
19920 esac
19921
19922 : see if this is a libutil.h system
19923 set libutil.h i_libutil
19924 eval $inhdr
19925
19926 : see if mach cthreads are available
19927 if test "X$usethreads" = "X$define"; then
19928         set mach/cthreads.h i_machcthr
19929         eval $inhdr
19930 else
19931         i_machcthr="$undef"
19932 fi
19933
19934
19935
19936 : see if this is a mntent.h system
19937 set mntent.h i_mntent
19938 eval $inhdr
19939
19940 : see if ndbm.h is available
19941 set ndbm.h t_ndbm
19942 eval $inhdr
19943
19944 case "$t_ndbm" in
19945 $undef)
19946     # Some Linux distributions such as RedHat 7.1 put the
19947     # ndbm.h header in /usr/include/gdbm/ndbm.h.
19948     if $test -f /usr/include/gdbm/ndbm.h; then
19949         echo '<gdbm/ndbm.h> found.'
19950         ccflags="$ccflags -I/usr/include/gdbm"
19951         cppflags="$cppflags -I/usr/include/gdbm"
19952         t_ndbm=$define
19953     fi
19954     ;;
19955 esac
19956
19957 case "$t_ndbm" in
19958 $define)
19959         : see if dbm_open exists
19960         set dbm_open d_dbm_open
19961         eval $inlibc
19962         case "$d_dbm_open" in
19963         $undef)
19964                 t_ndbm="$undef"
19965                 echo "We won't be including <ndbm.h>"
19966                 ;;
19967         esac
19968         ;;
19969 esac
19970 val="$t_ndbm"
19971 set i_ndbm
19972 eval $setvar
19973
19974 : see if net/errno.h is available
19975 val=''
19976 set net/errno.h val
19977 eval $inhdr
19978
19979 : Unfortunately, it causes problems on some systems.  Arrgh.
19980 case "$val" in
19981 $define)
19982         cat > try.c <<'EOM'
19983 #include <stdio.h>
19984 #include <errno.h>
19985 #include <net/errno.h>
19986 int func()
19987 {
19988         return ENOTSOCK;
19989 }
19990 EOM
19991         if $cc $ccflags -c try.c >/dev/null 2>&1; then
19992                 echo "We'll be including <net/errno.h>." >&4
19993         else
19994                 echo "We won't be including <net/errno.h>." >&4
19995                 val="$undef"
19996         fi
19997         $rm -f try.* try
19998         ;;
19999 esac
20000 set i_neterrno
20001 eval $setvar
20002
20003 : see if netinet/tcp.h is available
20004 set netinet/tcp.h i_netinettcp
20005 eval $inhdr
20006
20007 : see if this is a poll.h system
20008 set poll.h i_poll
20009 eval $inhdr
20010
20011 : see if this is a prot.h system
20012 set prot.h i_prot
20013 eval $inhdr
20014
20015 echo " "
20016 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
20017 $cat <<'EOSH' > Cppsym.know
20018 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20019 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20020 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20021 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20022 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20023 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20024 bull c cadmus clipper CMU COFF COMPILER_VERSION
20025 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20026 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20027 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20028 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20029 GLIBC GLIBC_MINOR
20030 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20031 H3050R H3050RX hbullx20 hcx host_mips
20032 hp200 hp300 hp700 HP700 hp800 hp9000
20033 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20034 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20035 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20036 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20037 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20038 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20039 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20040 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20041 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20042 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20043 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20044 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20045 MATH_HAS_NO_SIDE_EFFECTS
20046 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20047 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20048 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20049 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20050 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20051 NetBSD news1500 news1700 news1800 news1900 news3700
20052 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20053 ns32016 ns32332 ns32k nsc32000
20054 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20055 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20056 pc532 pdp11 PGC PIC plexus PORTAR posix
20057 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20058 POSIX_C_SOURCE POSIX_SOURCE POWER
20059 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
20060 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20061 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20062 sony sony_news sonyrisc sparc sparclite spectrum
20063 stardent stdc STDC_EXT stratos sun sun3 sun386
20064 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20065 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20066 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20067 sysV68 sysV88 Tek4132 Tek4300 titan
20068 TM3200 TM5400 TM5600
20069 tower tower32 tower32_200 tower32_600 tower32_700
20070 tower32_800 tower32_850 tss
20071 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20072 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20073 unix UNIX95 UNIX99 unixpc unos
20074 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20075 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20076 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20077 USGr4 USGr4_2
20078 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20079 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20080 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20081 z8000
20082 EOSH
20083 # Maybe put other stuff here too.
20084 cat <<EOSH >>Cppsym.know
20085 $osname
20086 EOSH
20087 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20088 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20089 $cat Cppsym.know > Cppsym.c
20090 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20091 $rm -f Cppsym.a Cppsym.b Cppsym.c
20092 cat <<EOSH > Cppsym
20093 $startsh
20094 if $test \$# -gt 0; then
20095     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20096     if $test -s Cppsym.got; then
20097         $rm -f Cppsym.got
20098         exit 0
20099     fi
20100     $rm -f Cppsym.got
20101     exit 1
20102 else
20103     $tr " " "$trnl" | ./Cppsym.try
20104     exit 0
20105 fi
20106 EOSH
20107 chmod +x Cppsym
20108 $eunicefix Cppsym
20109 cat <<EOSH > Cppsym.try
20110 $startsh
20111 cat <<'EOCP' > try.c
20112 #include <stdio.h>
20113 int main() {
20114 EOCP
20115 $awk \\
20116 EOSH
20117 cat <<'EOSH' >> Cppsym.try
20118 'length($1) > 0 {
20119     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
20120     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
20121     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
20122     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
20123 }'       >> try.c
20124 echo 'return 0;}' >> try.c
20125 EOSH
20126 cat <<EOSH >> Cppsym.try
20127 ccflags="$ccflags"
20128 case "$osname-$gccversion" in
20129 irix-) ccflags="\$ccflags -woff 1178" ;;
20130 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20131 esac
20132 $cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
20133 EOSH
20134 chmod +x Cppsym.try
20135 $eunicefix Cppsym.try
20136 ./Cppsym < Cppsym.know > Cppsym.true
20137 : now check the C compiler for additional symbols
20138 postprocess_cc_v=''
20139 case "$osname" in
20140 aix) postprocess_cc_v="|$tr , ' '" ;;
20141 esac
20142 $cat >ccsym <<EOS
20143 $startsh
20144 $cat >tmp.c <<EOF
20145 extern int foo;
20146 EOF
20147 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20148 do
20149         case "\$i" in
20150         -D*) echo "\$i" | $sed 's/^-D//';;
20151         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
20152         esac
20153 done
20154 $rm -f try.c
20155 EOS
20156 postprocess_cc_v=''
20157 chmod +x ccsym
20158 $eunicefix ccsym
20159 ./ccsym > ccsym1.raw
20160 if $test -s ccsym1.raw; then
20161        $sort ccsym1.raw | $uniq >ccsym.raw
20162 else
20163        mv ccsym1.raw ccsym.raw
20164 fi
20165
20166 $awk '/\=/ { print $0; next }
20167         { print $0"=1" }' ccsym.raw >ccsym.list
20168 $awk '/\=/ { print $0; next }
20169         { print $0"=1" }' Cppsym.true >ccsym.true
20170 $comm -13 ccsym.true ccsym.list >ccsym.own
20171 $comm -12 ccsym.true ccsym.list >ccsym.com
20172 $comm -23 ccsym.true ccsym.list >ccsym.cpp
20173 also=''
20174 if $test -z ccsym.raw; then
20175         echo "Your C compiler doesn't seem to define any symbols!" >&4
20176         echo " "
20177         echo "However, your C preprocessor defines the following symbols:"
20178         $cat Cppsym.true
20179         ccsymbols=''
20180         cppsymbols=`$cat Cppsym.true`
20181         cppsymbols=`echo $cppsymbols`
20182         cppccsymbols="$cppsymbols"
20183 else
20184         if $test -s ccsym.com; then
20185                 echo "Your C compiler and pre-processor define these symbols:"
20186                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20187                 also='also '
20188                 symbols='ones'
20189                 cppccsymbols=`$cat ccsym.com`
20190                 cppccsymbols=`echo $cppccsymbols`
20191                 $test "$silent" || sleep 1
20192         fi
20193         if $test -s ccsym.cpp; then
20194                 $test "$also" && echo " "
20195                 echo "Your C pre-processor ${also}defines the following symbols:"
20196                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20197                 also='further '
20198                 cppsymbols=`$cat ccsym.cpp`
20199                 cppsymbols=`echo $cppsymbols`
20200                 $test "$silent" || sleep 1
20201         fi
20202         if $test -s ccsym.own; then
20203                 $test "$also" && echo " "
20204                 echo "Your C compiler ${also}defines the following cpp symbols:"
20205                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20206                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20207                 ccsymbols=`$cat ccsym.own`
20208                 ccsymbols=`echo $ccsymbols`
20209                 $test "$silent" || sleep 1
20210         fi
20211 fi
20212
20213 : see if this is a termio system
20214 val="$undef"
20215 val2="$undef"
20216 val3="$undef"
20217 if $test `./findhdr termios.h`; then
20218         set tcsetattr i_termios
20219         eval $inlibc
20220         val3="$i_termios"
20221 fi
20222 echo " "
20223 case "$val3" in
20224 "$define") echo "You have POSIX termios.h... good!" >&4;;
20225 *) if ./Cppsym pyr; then
20226                 case "`/bin/universe`" in
20227                 ucb) if $test `./findhdr sgtty.h`; then
20228                                 val2="$define"
20229                                 echo "<sgtty.h> found." >&4
20230                         else
20231                                 echo "System is pyramid with BSD universe."
20232                                 echo "<sgtty.h> not found--you could have problems." >&4
20233                         fi;;
20234                 *) if $test `./findhdr termio.h`; then
20235                                 val="$define"
20236                                 echo "<termio.h> found." >&4
20237                         else
20238                                 echo "System is pyramid with USG universe."
20239                                 echo "<termio.h> not found--you could have problems." >&4
20240                         fi;;
20241                 esac
20242         elif ./usg; then
20243                 if $test `./findhdr termio.h`; then
20244                         echo "<termio.h> found." >&4
20245                         val="$define"
20246                 elif $test `./findhdr sgtty.h`; then
20247                         echo "<sgtty.h> found." >&4
20248                         val2="$define"
20249                 else
20250 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20251                 fi
20252         else
20253                 if $test `./findhdr sgtty.h`; then
20254                         echo "<sgtty.h> found." >&4
20255                         val2="$define"
20256                 elif $test `./findhdr termio.h`; then
20257                         echo "<termio.h> found." >&4
20258                         val="$define"
20259                 else
20260 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20261                 fi
20262         fi;;
20263 esac
20264 set i_termio; eval $setvar
20265 val=$val2; set i_sgtty; eval $setvar
20266 val=$val3; set i_termios; eval $setvar
20267
20268 : see if stddef is available
20269 set stddef.h i_stddef
20270 eval $inhdr
20271
20272 : see if this is a sunmath.h system
20273 set sunmath.h i_sunmath
20274 eval $inhdr
20275
20276 : see if sys/access.h is available
20277 set sys/access.h i_sysaccess
20278 eval $inhdr
20279
20280 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20281 set sys/filio.h i_sysfilio
20282 eval $inhdr
20283 echo " "
20284 if $test `./findhdr sys/ioctl.h`; then
20285         val="$define"
20286         echo '<sys/ioctl.h> found.' >&4
20287 else
20288         val="$undef"
20289         if $test $i_sysfilio = "$define"; then
20290             echo '<sys/ioctl.h> NOT found.' >&4
20291         else
20292                 $test $i_sgtty = "$define" && xxx="sgtty.h"
20293                 $test $i_termio = "$define" && xxx="termio.h"
20294                 $test $i_termios = "$define" && xxx="termios.h"
20295 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20296         fi
20297 fi
20298 set i_sysioctl
20299 eval $setvar
20300
20301 : see if socket ioctl defs are in sys/sockio.h
20302 echo " "
20303 xxx=`./findhdr sys/sockio.h`
20304 if $test "$xxx"; then
20305         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20306                 val="$define"
20307                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20308         else
20309                 val="$undef"
20310                 echo "No socket ioctls found in <sys/sockio.h>." >&4
20311         fi
20312 else
20313         val="$undef"
20314         $cat <<EOM
20315 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20316 EOM
20317 fi
20318 set i_syssockio
20319 eval $setvar
20320
20321
20322 : see if this is a syslog.h system
20323 set syslog.h i_syslog
20324 eval $inhdr
20325
20326
20327 : see if this is a sys/mode.h system
20328 set sys/mode.h i_sysmode
20329 eval $inhdr
20330
20331 : see if sys/resource.h has to be included
20332 set sys/resource.h i_sysresrc
20333 eval $inhdr
20334
20335 : see if sys/security.h is available
20336 set sys/security.h i_syssecrt
20337 eval $inhdr
20338
20339 : see if this is a sys/statvfs.h system
20340 set sys/statvfs.h i_sysstatvfs
20341 eval $inhdr
20342
20343 : see if this is a sys/un.h system
20344 set sys/un.h i_sysun
20345 eval $inhdr
20346
20347
20348 : see if this is a sys/utsname.h system
20349 set sys/utsname.h i_sysutsname
20350 eval $inhdr
20351
20352 : see if this is a syswait system
20353 set sys/wait.h i_syswait
20354 eval $inhdr
20355
20356 : see if this is a ustat.h system
20357 set ustat.h i_ustat
20358 eval $inhdr
20359
20360 : see if this is an utime system
20361 set utime.h i_utime
20362 eval $inhdr
20363
20364 : see if this is a values.h system
20365 set values.h i_values
20366 eval $inhdr
20367
20368 : see if this is a vfork system
20369 case "$d_vfork" in
20370 "$define")
20371         set vfork.h i_vfork
20372         eval $inhdr
20373         ;;
20374 *)
20375         i_vfork="$undef"
20376         ;;
20377 esac
20378
20379 : see if gdbm.h is available
20380 set gdbm.h t_gdbm
20381 eval $inhdr
20382 case "$t_gdbm" in
20383 $define)
20384         : see if gdbm_open exists
20385         set gdbm_open d_gdbm_open
20386         eval $inlibc
20387         case "$d_gdbm_open" in
20388         $undef)
20389                 t_gdbm="$undef"
20390                 echo "We won't be including <gdbm.h>"
20391                 ;;
20392         esac
20393         ;;
20394 esac
20395 val="$t_gdbm"
20396 set i_gdbm
20397 eval $setvar
20398
20399 echo " "
20400 echo "Looking for extensions..." >&4
20401 : If we are using the old config.sh, known_extensions may contain
20402 : old or inaccurate or duplicate values.
20403 known_extensions=''
20404 nonxs_extensions=''
20405 : We do not use find because it might not be available.
20406 : We do not just use MANIFEST because the user may have dropped
20407 : some additional extensions into the source tree and expect them
20408 : to be built.
20409
20410 : Function to recursively find available extensions, ignoring DynaLoader
20411 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
20412 find_extensions='
20413     for xxx in *; do
20414        case "$xxx" in
20415            DynaLoader|dynaload) ;;
20416            *)
20417            if $test -f $xxx/$xxx.xs; then
20418                known_extensions="$known_extensions $1$xxx";
20419            elif $test -f $xxx/Makefile.PL; then
20420                nonxs_extensions="$nonxs_extensions $1$xxx";
20421            else
20422                if $test -d $xxx -a $# -lt 10; then
20423                    set $1$xxx/ $*;
20424                    cd "$xxx";
20425                    eval $find_extensions;
20426                    cd ..;
20427                    shift;
20428                fi;
20429            fi
20430            ;;
20431        esac;
20432     done'
20433 tdir=`pwd`
20434 cd "$rsrc/ext"
20435 set X
20436 shift
20437 eval $find_extensions
20438 # Special case:  Add in threads/shared since it is not picked up by the
20439 # recursive find above (and adding in general recursive finding breaks
20440 # SDBM_File/sdbm).  A.D.  10/25/2001.
20441 known_extensions="$known_extensions threads/shared"
20442 set X $nonxs_extensions
20443 shift
20444 nonxs_extensions="$*"
20445 set X $known_extensions
20446 shift
20447 known_extensions="$*"
20448 cd "$tdir"
20449
20450 : Now see which are supported on this system.
20451 avail_ext=''
20452 for xxx in $known_extensions ; do
20453         case "$xxx" in
20454         DB_File|db_file)
20455                 case "$i_db" in
20456                 $define) avail_ext="$avail_ext $xxx" ;;
20457                 esac
20458                 ;;
20459         GDBM_File|gdbm_fil)
20460                 case "$i_gdbm" in 
20461                 $define) avail_ext="$avail_ext $xxx" ;;
20462                 esac
20463                 ;;
20464         I18N/Langinfo|i18n_lan)
20465                 case "$i_langinfo$d_nl_langinfo" in 
20466                 $define$define) avail_ext="$avail_ext $xxx" ;;
20467                 esac
20468                 ;;
20469         NDBM_File|ndbm_fil)
20470                 case "$i_ndbm" in
20471                 $define)
20472                     case "$osname-$use64bitint" in
20473                     hpux-define)
20474                         case "$libs" in
20475                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
20476                         esac
20477                         ;;
20478                     *) avail_ext="$avail_ext $xxx" ;;
20479                     esac
20480                     ;;
20481                 esac
20482                 ;;
20483         ODBM_File|odbm_fil) 
20484                 case "${i_dbm}${i_rpcsvcdbm}" in
20485                 *"${define}"*)
20486                     case "$osname-$use64bitint" in
20487                     hpux-define)
20488                         case "$libs" in
20489                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
20490                         esac
20491                         ;;
20492                     *) avail_ext="$avail_ext $xxx" ;;
20493                     esac
20494                     ;;
20495                 esac
20496                 ;;
20497         POSIX|posix)
20498                 case "$useposix" in
20499                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20500                 esac
20501                 ;;
20502         Opcode|opcode)
20503                 case "$useopcode" in
20504                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20505                 esac
20506                 ;;
20507         Socket|socket)
20508                 case "$d_socket" in 
20509                 true|$define|y)
20510                     case "$osname" in
20511                     beos) ;; # not unless BONE
20512                     *) avail_ext="$avail_ext $xxx" ;;
20513                     esac
20514                     ;;
20515                 esac
20516                 ;;
20517         Sys/Syslog|sys/syslog)
20518                 : XXX syslog requires socket
20519                 case "$d_socket" in 
20520                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
20521                 esac
20522                 ;;
20523         Thread|thread)
20524                 case "$usethreads" in
20525                 true|$define|y)
20526                         case "$useithreads" in
20527                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
20528                         esac
20529                 esac
20530                 ;;
20531         XS/APItest|xs/apitest)
20532                 # This is just for testing.  Skip it unless we have dynamic loading.
20533
20534                 case "$usedl" in
20535                 $define) avail_ext="$avail_ext $xxx" ;;
20536                 esac
20537                 ;;
20538         XS/Typemap|xs/typemap)
20539                 # This is just for testing.  Skip it unless we have dynamic loading.
20540                 case "$usedl" in
20541                 $define) avail_ext="$avail_ext $xxx" ;;
20542                 esac
20543                 ;;
20544         threads|threads/shared)
20545                 # threads and threads::shared are special cases.
20546                 # To stop people from asking "Perl 5.8.0 was supposed
20547                 # to have this new fancy threads implementation but my
20548                 # perl doesn't have it" and from people trying to
20549                 # (re)install the threads module using CPAN.pm and
20550                 # CPAN.pm then offering to reinstall Perl 5.8.0,
20551                 # the threads.pm and threads/shared.pm will always be
20552                 # there, croaking informatively ("you need to rebuild
20553                 # all of Perl with threads, sorry") when threads haven't
20554                 # been compiled in.
20555                 # --jhi
20556                 avail_ext="$avail_ext $xxx"
20557                 ;;
20558         IPC/SysV|ipc/sysv)
20559                 : XXX Do we need a useipcsysv variable here
20560                 case "${d_msg}${d_sem}${d_shm}" in 
20561                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
20562                 esac
20563                 ;;
20564         *)      avail_ext="$avail_ext $xxx"
20565                 ;;
20566         esac
20567 done
20568
20569 set X $avail_ext
20570 shift
20571 avail_ext="$*"
20572
20573 case "$onlyextensions" in
20574 '') ;;
20575 *)  keepextensions=''
20576     echo "You have requested that only certains extensions be included..." >&4
20577     for i in $onlyextensions; do
20578         case " $avail_ext " in
20579         *" $i "*)
20580             echo "Keeping extension $i."
20581             keepextensions="$keepextensions $i"
20582             ;;
20583         *) echo "Ignoring extension $i." ;;
20584         esac
20585     done
20586     avail_ext="$keepextensions"
20587     ;;
20588 esac
20589
20590 case "$noextensions" in
20591 '') ;;
20592 *)  keepextensions=''
20593     echo "You have requested that certain extensions be ignored..." >&4
20594     for i in $avail_ext; do
20595         case " $noextensions " in
20596         *" $i "*) echo "Ignoring extension $i." ;;
20597         *) echo "Keeping extension $i.";
20598            keepextensions="$keepextensions $i"
20599            ;;
20600         esac
20601     done
20602     avail_ext="$keepextensions"
20603     ;;
20604 esac
20605
20606 : Now see which nonxs extensions are supported on this system.
20607 : For now assume all are.
20608 nonxs_ext=''
20609 for xxx in $nonxs_extensions ; do
20610         case "$xxx" in
20611         *)      nonxs_ext="$nonxs_ext $xxx"
20612                 ;;
20613         esac
20614 done
20615
20616 set X $nonxs_ext
20617 shift
20618 nonxs_ext="$*"
20619
20620 case $usedl in
20621 $define)
20622         $cat <<EOM
20623 A number of extensions are supplied with $package.  You may choose to
20624 compile these extensions for dynamic loading (the default), compile
20625 them into the $package executable (static loading), or not include
20626 them at all.  Answer "none" to include no extensions.
20627 Note that DynaLoader is always built and need not be mentioned here.
20628
20629 EOM
20630         case "$dynamic_ext" in
20631         '')
20632                 : Exclude those listed in static_ext
20633                 dflt=''
20634                 for xxx in $avail_ext; do
20635                         case " $static_ext " in
20636                         *" $xxx "*) ;;
20637                         *) dflt="$dflt $xxx" ;;
20638                         esac
20639                 done
20640                 set X $dflt
20641                 shift
20642                 dflt="$*"
20643                 ;;
20644         *)      dflt="$dynamic_ext"
20645                 # Perhaps we are reusing an old out-of-date config.sh.
20646                 case "$hint" in
20647                 previous)
20648                         if test X"$dynamic_ext" != X"$avail_ext"; then
20649                                 $cat <<EOM
20650 NOTICE:  Your previous config.sh list may be incorrect. 
20651 The extensions now available to you are 
20652         ${avail_ext}
20653 but the default list from your previous config.sh is
20654         ${dynamic_ext} 
20655
20656 EOM
20657                         fi
20658                         ;;
20659                 esac
20660                 ;;
20661         esac
20662         case "$dflt" in
20663         '')     dflt=none;;
20664         esac
20665         rp="What extensions do you wish to load dynamically?"
20666         . ./myread
20667         case "$ans" in
20668         none) dynamic_ext=' ' ;;
20669         *) dynamic_ext="$ans" ;;
20670         esac
20671
20672         case "$static_ext" in
20673         '')
20674                 : Exclude those already listed in dynamic linking
20675                 dflt=''
20676                 for xxx in $avail_ext; do
20677                         case " $dynamic_ext " in
20678                         *" $xxx "*) ;;
20679                         *) dflt="$dflt $xxx" ;;
20680                         esac
20681                 done
20682                 set X $dflt
20683                 shift
20684                 dflt="$*"
20685                 ;;
20686         *)  dflt="$static_ext" 
20687                 ;;
20688         esac
20689
20690         case "$dflt" in
20691         '')     dflt=none;;
20692         esac
20693         rp="What extensions do you wish to load statically?"
20694         . ./myread
20695         case "$ans" in
20696         none) static_ext=' ' ;;
20697         *) static_ext="$ans" ;;
20698         esac
20699         ;;
20700 *)
20701         $cat <<EOM
20702 A number of extensions are supplied with $package.  Answer "none" 
20703 to include no extensions. 
20704 Note that DynaLoader is always built and need not be mentioned here.
20705
20706 EOM
20707         case "$static_ext" in
20708         '') dflt="$avail_ext" ;;
20709         *)      dflt="$static_ext"
20710                 # Perhaps we are reusing an old out-of-date config.sh.
20711                 case "$hint" in
20712                 previous)
20713                         if test X"$static_ext" != X"$avail_ext"; then
20714                                 $cat <<EOM
20715 NOTICE:  Your previous config.sh list may be incorrect. 
20716 The extensions now available to you are 
20717         ${avail_ext}
20718 but the default list from your previous config.sh is
20719         ${static_ext} 
20720
20721 EOM
20722                         fi
20723                         ;;
20724                 esac
20725                 ;;
20726         esac
20727         : Exclude those that are not xs extensions
20728         case "$dflt" in
20729         '')     dflt=none;;
20730         esac
20731         rp="What extensions do you wish to include?"
20732         . ./myread
20733         case "$ans" in
20734         none) static_ext=' ' ;;
20735         *) static_ext="$ans" ;;
20736         esac
20737         ;;
20738 esac
20739 #        
20740 # Encode is a special case.  If we are building Encode as a static
20741 # extension, we need to explicitly list its subextensions as well.
20742 # For other nested extensions, this is handled automatically by
20743 # the appropriate Makefile.PL.
20744 case " $static_ext " in
20745         *" Encode "*) # Add the subextensions of Encode
20746         cd "$rsrc/ext"
20747         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
20748                 static_ext="$static_ext Encode/$xxx"
20749         done
20750         cd "$tdir"
20751         ;;
20752 esac
20753
20754 set X $dynamic_ext $static_ext $nonxs_ext
20755 shift
20756 extensions="$*"
20757
20758 # Sanity check:  We require an extension suitable for use with
20759 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
20760 # should show up as failures in the test suite, but it's helpful to
20761 # catch them now.) The 'extensions' list is normally sorted
20762 # alphabetically, so we need to accept either
20763 #    DB_File ... Fcntl ... IO  ....
20764 # or something like
20765 #    Fcntl ... NDBM_File ... IO  ....
20766 case " $extensions"  in
20767 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
20768 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
20769 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
20770 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
20771    echo "WARNING: The Perl you are building will be quite crippled." >& 4
20772    ;;
20773 esac
20774
20775 : Remove libraries needed only for extensions
20776 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
20777 : The exception is SunOS 4.x, which needs them.
20778 case "${osname}X${osvers}" in
20779 sunos*X4*)
20780     perllibs="$libs"
20781     ;;
20782 *) case "$usedl" in
20783     $define|true|[yY]*)
20784             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
20785             shift
20786             perllibs="$*"
20787             ;;
20788     *)  perllibs="$libs"
20789             ;;
20790     esac
20791     ;;
20792 esac
20793
20794 : Remove build directory name from cppstdin so it can be used from
20795 : either the present location or the final installed location.
20796 echo " "
20797 : Get out of the UU directory to get correct path name.
20798 cd ..
20799 case "$cppstdin" in
20800 `pwd`/cppstdin)
20801         echo "Stripping down cppstdin path name"
20802         cppstdin=cppstdin
20803         ;;
20804 esac
20805 cd UU
20806
20807 : end of configuration questions
20808 echo " "
20809 echo "End of configuration questions."
20810 echo " "
20811
20812 : back to where it started
20813 if test -d ../UU; then
20814         cd ..
20815 fi
20816
20817 : configuration may be patched via a 'config.arch' file
20818 if $test -f config.arch; then
20819         echo "I see a config.arch file, loading it."
20820         . ./config.arch
20821 fi
20822
20823 : configuration may be patched via a 'config.over' file
20824 if $test -f config.over; then
20825         echo " "
20826         dflt=y
20827         rp='I see a config.over file.  Do you wish to load it?'
20828         . UU/myread
20829         case "$ans" in
20830         n*) echo "OK, I'll ignore it.";;
20831         *)      . ./config.over
20832                 echo "Configuration override changes have been loaded."
20833                 ;;
20834         esac
20835 fi
20836
20837 : in case they want portability, strip down executable paths
20838 case "$d_portable" in
20839 "$define")
20840         echo " "
20841         echo "Stripping down executable paths..." >&4
20842         for file in $loclist $trylist; do
20843                 eval temp=\$$file
20844                 eval $file=`basename $temp`
20845         done
20846         ;;
20847 esac
20848
20849 : create config.sh file
20850 echo " "
20851 echo "Creating config.sh..." >&4
20852 $spitshell <<EOT >config.sh
20853 $startsh
20854 #
20855 # This file was produced by running the Configure script. It holds all the
20856 # definitions figured out by Configure. Should you modify one of these values,
20857 # do not forget to propagate your changes by running "Configure -der". You may
20858 # instead choose to run each of the .SH files by yourself, or "Configure -S".
20859 #
20860
20861 # Package name      : $package
20862 # Source directory  : $src
20863 # Configuration time: $cf_time
20864 # Configured by     : $cf_by
20865 # Target system     : $myuname
20866
20867 Author='$Author'
20868 Date='$Date'
20869 Header='$Header'
20870 Id='$Id'
20871 Locker='$Locker'
20872 Log='$Log'
20873 Mcc='$Mcc'
20874 RCSfile='$RCSfile'
20875 Revision='$Revision'
20876 Source='$Source'
20877 State='$State'
20878 _a='$_a'
20879 _exe='$_exe'
20880 _o='$_o'
20881 afs='$afs'
20882 afsroot='$afsroot'
20883 alignbytes='$alignbytes'
20884 ansi2knr='$ansi2knr'
20885 aphostname='$aphostname'
20886 api_revision='$api_revision'
20887 api_subversion='$api_subversion'
20888 api_version='$api_version'
20889 api_versionstring='$api_versionstring'
20890 ar='$ar'
20891 archlib='$archlib'
20892 archlibexp='$archlibexp'
20893 archname64='$archname64'
20894 archname='$archname'
20895 archobjs='$archobjs'
20896 asctime_r_proto='$asctime_r_proto'
20897 awk='$awk'
20898 baserev='$baserev'
20899 bash='$bash'
20900 bin='$bin'
20901 binexp='$binexp'
20902 bison='$bison'
20903 byacc='$byacc'
20904 byteorder='$byteorder'
20905 c='$c'
20906 castflags='$castflags'
20907 cat='$cat'
20908 cc='$cc'
20909 cccdlflags='$cccdlflags'
20910 ccdlflags='$ccdlflags'
20911 ccflags='$ccflags'
20912 ccflags_uselargefiles='$ccflags_uselargefiles'
20913 ccname='$ccname'
20914 ccsymbols='$ccsymbols'
20915 ccversion='$ccversion'
20916 cf_by='$cf_by'
20917 cf_email='$cf_email'
20918 cf_time='$cf_time'
20919 charsize='$charsize'
20920 chgrp='$chgrp'
20921 chmod='$chmod'
20922 chown='$chown'
20923 clocktype='$clocktype'
20924 comm='$comm'
20925 compress='$compress'
20926 contains='$contains'
20927 cp='$cp'
20928 cpio='$cpio'
20929 cpp='$cpp'
20930 cpp_stuff='$cpp_stuff'
20931 cppccsymbols='$cppccsymbols'
20932 cppflags='$cppflags'
20933 cpplast='$cpplast'
20934 cppminus='$cppminus'
20935 cpprun='$cpprun'
20936 cppstdin='$cppstdin'
20937 cppsymbols='$cppsymbols'
20938 crypt_r_proto='$crypt_r_proto'
20939 cryptlib='$cryptlib'
20940 csh='$csh'
20941 ctermid_r_proto='$ctermid_r_proto'
20942 ctime_r_proto='$ctime_r_proto'
20943 d_Gconvert='$d_Gconvert'
20944 d_PRIEUldbl='$d_PRIEUldbl'
20945 d_PRIFUldbl='$d_PRIFUldbl'
20946 d_PRIGUldbl='$d_PRIGUldbl'
20947 d_PRIXU64='$d_PRIXU64'
20948 d_PRId64='$d_PRId64'
20949 d_PRIeldbl='$d_PRIeldbl'
20950 d_PRIfldbl='$d_PRIfldbl'
20951 d_PRIgldbl='$d_PRIgldbl'
20952 d_PRIi64='$d_PRIi64'
20953 d_PRIo64='$d_PRIo64'
20954 d_PRIu64='$d_PRIu64'
20955 d_PRIx64='$d_PRIx64'
20956 d_SCNfldbl='$d_SCNfldbl'
20957 d__fwalk='$d__fwalk'
20958 d_access='$d_access'
20959 d_accessx='$d_accessx'
20960 d_aintl='$d_aintl'
20961 d_alarm='$d_alarm'
20962 d_archlib='$d_archlib'
20963 d_asctime_r='$d_asctime_r'
20964 d_atolf='$d_atolf'
20965 d_atoll='$d_atoll'
20966 d_attribute_format='$d_attribute_format'
20967 d_attribute_malloc='$d_attribute_malloc'
20968 d_attribute_nonnull='$d_attribute_nonnull'
20969 d_attribute_noreturn='$d_attribute_noreturn'
20970 d_attribute_pure='$d_attribute_pure'
20971 d_attribute_unused='$d_attribute_unused'
20972 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
20973 d_bcmp='$d_bcmp'
20974 d_bcopy='$d_bcopy'
20975 d_bsd='$d_bsd'
20976 d_bsdgetpgrp='$d_bsdgetpgrp'
20977 d_bsdsetpgrp='$d_bsdsetpgrp'
20978 d_bzero='$d_bzero'
20979 d_casti32='$d_casti32'
20980 d_castneg='$d_castneg'
20981 d_charvspr='$d_charvspr'
20982 d_chown='$d_chown'
20983 d_chroot='$d_chroot'
20984 d_chsize='$d_chsize'
20985 d_class='$d_class'
20986 d_clearenv='$d_clearenv'
20987 d_closedir='$d_closedir'
20988 d_cmsghdr_s='$d_cmsghdr_s'
20989 d_const='$d_const'
20990 d_copysignl='$d_copysignl'
20991 d_crypt='$d_crypt'
20992 d_crypt_r='$d_crypt_r'
20993 d_csh='$d_csh'
20994 d_ctermid_r='$d_ctermid_r'
20995 d_ctime_r='$d_ctime_r'
20996 d_cuserid='$d_cuserid'
20997 d_dbl_dig='$d_dbl_dig'
20998 d_dbminitproto='$d_dbminitproto'
20999 d_difftime='$d_difftime'
21000 d_dirfd='$d_dirfd'
21001 d_dirnamlen='$d_dirnamlen'
21002 d_dlerror='$d_dlerror'
21003 d_dlopen='$d_dlopen'
21004 d_dlsymun='$d_dlsymun'
21005 d_dosuid='$d_dosuid'
21006 d_drand48_r='$d_drand48_r'
21007 d_drand48proto='$d_drand48proto'
21008 d_dup2='$d_dup2'
21009 d_eaccess='$d_eaccess'
21010 d_endgrent='$d_endgrent'
21011 d_endgrent_r='$d_endgrent_r'
21012 d_endhent='$d_endhent'
21013 d_endhostent_r='$d_endhostent_r'
21014 d_endnent='$d_endnent'
21015 d_endnetent_r='$d_endnetent_r'
21016 d_endpent='$d_endpent'
21017 d_endprotoent_r='$d_endprotoent_r'
21018 d_endpwent='$d_endpwent'
21019 d_endpwent_r='$d_endpwent_r'
21020 d_endsent='$d_endsent'
21021 d_endservent_r='$d_endservent_r'
21022 d_eofnblk='$d_eofnblk'
21023 d_eunice='$d_eunice'
21024 d_faststdio='$d_faststdio'
21025 d_fchdir='$d_fchdir'
21026 d_fchmod='$d_fchmod'
21027 d_fchown='$d_fchown'
21028 d_fcntl='$d_fcntl'
21029 d_fcntl_can_lock='$d_fcntl_can_lock'
21030 d_fd_macros='$d_fd_macros'
21031 d_fd_set='$d_fd_set'
21032 d_fds_bits='$d_fds_bits'
21033 d_fgetpos='$d_fgetpos'
21034 d_finite='$d_finite'
21035 d_finitel='$d_finitel'
21036 d_flexfnam='$d_flexfnam'
21037 d_flock='$d_flock'
21038 d_flockproto='$d_flockproto'
21039 d_fork='$d_fork'
21040 d_fp_class='$d_fp_class'
21041 d_fpathconf='$d_fpathconf'
21042 d_fpclass='$d_fpclass'
21043 d_fpclassify='$d_fpclassify'
21044 d_fpclassl='$d_fpclassl'
21045 d_fpos64_t='$d_fpos64_t'
21046 d_frexpl='$d_frexpl'
21047 d_fs_data_s='$d_fs_data_s'
21048 d_fseeko='$d_fseeko'
21049 d_fsetpos='$d_fsetpos'
21050 d_fstatfs='$d_fstatfs'
21051 d_fstatvfs='$d_fstatvfs'
21052 d_fsync='$d_fsync'
21053 d_ftello='$d_ftello'
21054 d_ftime='$d_ftime'
21055 d_getcwd='$d_getcwd'
21056 d_getespwnam='$d_getespwnam'
21057 d_getfsstat='$d_getfsstat'
21058 d_getgrent='$d_getgrent'
21059 d_getgrent_r='$d_getgrent_r'
21060 d_getgrgid_r='$d_getgrgid_r'
21061 d_getgrnam_r='$d_getgrnam_r'
21062 d_getgrps='$d_getgrps'
21063 d_gethbyaddr='$d_gethbyaddr'
21064 d_gethbyname='$d_gethbyname'
21065 d_gethent='$d_gethent'
21066 d_gethname='$d_gethname'
21067 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21068 d_gethostbyname_r='$d_gethostbyname_r'
21069 d_gethostent_r='$d_gethostent_r'
21070 d_gethostprotos='$d_gethostprotos'
21071 d_getitimer='$d_getitimer'
21072 d_getlogin='$d_getlogin'
21073 d_getlogin_r='$d_getlogin_r'
21074 d_getmnt='$d_getmnt'
21075 d_getmntent='$d_getmntent'
21076 d_getnbyaddr='$d_getnbyaddr'
21077 d_getnbyname='$d_getnbyname'
21078 d_getnent='$d_getnent'
21079 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21080 d_getnetbyname_r='$d_getnetbyname_r'
21081 d_getnetent_r='$d_getnetent_r'
21082 d_getnetprotos='$d_getnetprotos'
21083 d_getpagsz='$d_getpagsz'
21084 d_getpbyname='$d_getpbyname'
21085 d_getpbynumber='$d_getpbynumber'
21086 d_getpent='$d_getpent'
21087 d_getpgid='$d_getpgid'
21088 d_getpgrp2='$d_getpgrp2'
21089 d_getpgrp='$d_getpgrp'
21090 d_getppid='$d_getppid'
21091 d_getprior='$d_getprior'
21092 d_getprotobyname_r='$d_getprotobyname_r'
21093 d_getprotobynumber_r='$d_getprotobynumber_r'
21094 d_getprotoent_r='$d_getprotoent_r'
21095 d_getprotoprotos='$d_getprotoprotos'
21096 d_getprpwnam='$d_getprpwnam'
21097 d_getpwent='$d_getpwent'
21098 d_getpwent_r='$d_getpwent_r'
21099 d_getpwnam_r='$d_getpwnam_r'
21100 d_getpwuid_r='$d_getpwuid_r'
21101 d_getsbyname='$d_getsbyname'
21102 d_getsbyport='$d_getsbyport'
21103 d_getsent='$d_getsent'
21104 d_getservbyname_r='$d_getservbyname_r'
21105 d_getservbyport_r='$d_getservbyport_r'
21106 d_getservent_r='$d_getservent_r'
21107 d_getservprotos='$d_getservprotos'
21108 d_getspnam='$d_getspnam'
21109 d_getspnam_r='$d_getspnam_r'
21110 d_gettimeod='$d_gettimeod'
21111 d_gmtime_r='$d_gmtime_r'
21112 d_gnulibc='$d_gnulibc'
21113 d_grpasswd='$d_grpasswd'
21114 d_hasmntopt='$d_hasmntopt'
21115 d_htonl='$d_htonl'
21116 d_ilogbl='$d_ilogbl'
21117 d_index='$d_index'
21118 d_inetaton='$d_inetaton'
21119 d_int64_t='$d_int64_t'
21120 d_isascii='$d_isascii'
21121 d_isfinite='$d_isfinite'
21122 d_isinf='$d_isinf'
21123 d_isnan='$d_isnan'
21124 d_isnanl='$d_isnanl'
21125 d_killpg='$d_killpg'
21126 d_lchown='$d_lchown'
21127 d_ldbl_dig='$d_ldbl_dig'
21128 d_libm_lib_version='$d_libm_lib_version'
21129 d_link='$d_link'
21130 d_localtime_r='$d_localtime_r'
21131 d_locconv='$d_locconv'
21132 d_lockf='$d_lockf'
21133 d_longdbl='$d_longdbl'
21134 d_longlong='$d_longlong'
21135 d_lseekproto='$d_lseekproto'
21136 d_lstat='$d_lstat'
21137 d_madvise='$d_madvise'
21138 d_malloc_good_size='$d_malloc_good_size'
21139 d_malloc_size='$d_malloc_size'
21140 d_mblen='$d_mblen'
21141 d_mbstowcs='$d_mbstowcs'
21142 d_mbtowc='$d_mbtowc'
21143 d_memchr='$d_memchr'
21144 d_memcmp='$d_memcmp'
21145 d_memcpy='$d_memcpy'
21146 d_memmove='$d_memmove'
21147 d_memset='$d_memset'
21148 d_mkdir='$d_mkdir'
21149 d_mkdtemp='$d_mkdtemp'
21150 d_mkfifo='$d_mkfifo'
21151 d_mkstemp='$d_mkstemp'
21152 d_mkstemps='$d_mkstemps'
21153 d_mktime='$d_mktime'
21154 d_mmap='$d_mmap'
21155 d_modfl='$d_modfl'
21156 d_modfl_pow32_bug='$d_modfl_pow32_bug'
21157 d_modflproto='$d_modflproto'
21158 d_mprotect='$d_mprotect'
21159 d_msg='$d_msg'
21160 d_msg_ctrunc='$d_msg_ctrunc'
21161 d_msg_dontroute='$d_msg_dontroute'
21162 d_msg_oob='$d_msg_oob'
21163 d_msg_peek='$d_msg_peek'
21164 d_msg_proxy='$d_msg_proxy'
21165 d_msgctl='$d_msgctl'
21166 d_msgget='$d_msgget'
21167 d_msghdr_s='$d_msghdr_s'
21168 d_msgrcv='$d_msgrcv'
21169 d_msgsnd='$d_msgsnd'
21170 d_msync='$d_msync'
21171 d_munmap='$d_munmap'
21172 d_mymalloc='$d_mymalloc'
21173 d_nice='$d_nice'
21174 d_nl_langinfo='$d_nl_langinfo'
21175 d_nv_preserves_uv='$d_nv_preserves_uv'
21176 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
21177 d_off64_t='$d_off64_t'
21178 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21179 d_oldpthreads='$d_oldpthreads'
21180 d_oldsock='$d_oldsock'
21181 d_open3='$d_open3'
21182 d_pathconf='$d_pathconf'
21183 d_pause='$d_pause'
21184 d_perl_otherlibdirs='$d_perl_otherlibdirs'
21185 d_phostname='$d_phostname'
21186 d_pipe='$d_pipe'
21187 d_poll='$d_poll'
21188 d_portable='$d_portable'
21189 d_procselfexe='$d_procselfexe'
21190 d_pthread_atfork='$d_pthread_atfork'
21191 d_pthread_attr_setscope='$d_pthread_attr_setscope'
21192 d_pthread_yield='$d_pthread_yield'
21193 d_pwage='$d_pwage'
21194 d_pwchange='$d_pwchange'
21195 d_pwclass='$d_pwclass'
21196 d_pwcomment='$d_pwcomment'
21197 d_pwexpire='$d_pwexpire'
21198 d_pwgecos='$d_pwgecos'
21199 d_pwpasswd='$d_pwpasswd'
21200 d_pwquota='$d_pwquota'
21201 d_qgcvt='$d_qgcvt'
21202 d_quad='$d_quad'
21203 d_random_r='$d_random_r'
21204 d_readdir64_r='$d_readdir64_r'
21205 d_readdir='$d_readdir'
21206 d_readdir_r='$d_readdir_r'
21207 d_readlink='$d_readlink'
21208 d_readv='$d_readv'
21209 d_recvmsg='$d_recvmsg'
21210 d_rename='$d_rename'
21211 d_rewinddir='$d_rewinddir'
21212 d_rmdir='$d_rmdir'
21213 d_safebcpy='$d_safebcpy'
21214 d_safemcpy='$d_safemcpy'
21215 d_sanemcmp='$d_sanemcmp'
21216 d_sbrkproto='$d_sbrkproto'
21217 d_scalbnl='$d_scalbnl'
21218 d_sched_yield='$d_sched_yield'
21219 d_scm_rights='$d_scm_rights'
21220 d_seekdir='$d_seekdir'
21221 d_select='$d_select'
21222 d_sem='$d_sem'
21223 d_semctl='$d_semctl'
21224 d_semctl_semid_ds='$d_semctl_semid_ds'
21225 d_semctl_semun='$d_semctl_semun'
21226 d_semget='$d_semget'
21227 d_semop='$d_semop'
21228 d_sendmsg='$d_sendmsg'
21229 d_setegid='$d_setegid'
21230 d_seteuid='$d_seteuid'
21231 d_setgrent='$d_setgrent'
21232 d_setgrent_r='$d_setgrent_r'
21233 d_setgrps='$d_setgrps'
21234 d_sethent='$d_sethent'
21235 d_sethostent_r='$d_sethostent_r'
21236 d_setitimer='$d_setitimer'
21237 d_setlinebuf='$d_setlinebuf'
21238 d_setlocale='$d_setlocale'
21239 d_setlocale_r='$d_setlocale_r'
21240 d_setnent='$d_setnent'
21241 d_setnetent_r='$d_setnetent_r'
21242 d_setpent='$d_setpent'
21243 d_setpgid='$d_setpgid'
21244 d_setpgrp2='$d_setpgrp2'
21245 d_setpgrp='$d_setpgrp'
21246 d_setprior='$d_setprior'
21247 d_setproctitle='$d_setproctitle'
21248 d_setprotoent_r='$d_setprotoent_r'
21249 d_setpwent='$d_setpwent'
21250 d_setpwent_r='$d_setpwent_r'
21251 d_setregid='$d_setregid'
21252 d_setresgid='$d_setresgid'
21253 d_setresuid='$d_setresuid'
21254 d_setreuid='$d_setreuid'
21255 d_setrgid='$d_setrgid'
21256 d_setruid='$d_setruid'
21257 d_setsent='$d_setsent'
21258 d_setservent_r='$d_setservent_r'
21259 d_setsid='$d_setsid'
21260 d_setvbuf='$d_setvbuf'
21261 d_sfio='$d_sfio'
21262 d_shm='$d_shm'
21263 d_shmat='$d_shmat'
21264 d_shmatprototype='$d_shmatprototype'
21265 d_shmctl='$d_shmctl'
21266 d_shmdt='$d_shmdt'
21267 d_shmget='$d_shmget'
21268 d_sigaction='$d_sigaction'
21269 d_sigprocmask='$d_sigprocmask'
21270 d_sigsetjmp='$d_sigsetjmp'
21271 d_sockatmark='$d_sockatmark'
21272 d_sockatmarkproto='$d_sockatmarkproto'
21273 d_socket='$d_socket'
21274 d_socklen_t='$d_socklen_t'
21275 d_sockpair='$d_sockpair'
21276 d_socks5_init='$d_socks5_init'
21277 d_sqrtl='$d_sqrtl'
21278 d_srand48_r='$d_srand48_r'
21279 d_srandom_r='$d_srandom_r'
21280 d_sresgproto='$d_sresgproto'
21281 d_sresuproto='$d_sresuproto'
21282 d_statblks='$d_statblks'
21283 d_statfs_f_flags='$d_statfs_f_flags'
21284 d_statfs_s='$d_statfs_s'
21285 d_statvfs='$d_statvfs'
21286 d_stdio_cnt_lval='$d_stdio_cnt_lval'
21287 d_stdio_ptr_lval='$d_stdio_ptr_lval'
21288 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21289 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
21290 d_stdio_stream_array='$d_stdio_stream_array'
21291 d_stdiobase='$d_stdiobase'
21292 d_stdstdio='$d_stdstdio'
21293 d_strchr='$d_strchr'
21294 d_strcoll='$d_strcoll'
21295 d_strctcpy='$d_strctcpy'
21296 d_strerrm='$d_strerrm'
21297 d_strerror='$d_strerror'
21298 d_strerror_r='$d_strerror_r'
21299 d_strftime='$d_strftime'
21300 d_strlcat='$d_strlcat'
21301 d_strlcpy='$d_strlcpy'
21302 d_strtod='$d_strtod'
21303 d_strtol='$d_strtol'
21304 d_strtold='$d_strtold'
21305 d_strtoll='$d_strtoll'
21306 d_strtoq='$d_strtoq'
21307 d_strtoul='$d_strtoul'
21308 d_strtoull='$d_strtoull'
21309 d_strtouq='$d_strtouq'
21310 d_strxfrm='$d_strxfrm'
21311 d_suidsafe='$d_suidsafe'
21312 d_symlink='$d_symlink'
21313 d_syscall='$d_syscall'
21314 d_syscallproto='$d_syscallproto'
21315 d_sysconf='$d_sysconf'
21316 d_sysernlst='$d_sysernlst'
21317 d_syserrlst='$d_syserrlst'
21318 d_system='$d_system'
21319 d_tcgetpgrp='$d_tcgetpgrp'
21320 d_tcsetpgrp='$d_tcsetpgrp'
21321 d_telldir='$d_telldir'
21322 d_telldirproto='$d_telldirproto'
21323 d_time='$d_time'
21324 d_times='$d_times'
21325 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21326 d_tm_tm_zone='$d_tm_tm_zone'
21327 d_tmpnam_r='$d_tmpnam_r'
21328 d_truncate='$d_truncate'
21329 d_ttyname_r='$d_ttyname_r'
21330 d_tzname='$d_tzname'
21331 d_u32align='$d_u32align'
21332 d_ualarm='$d_ualarm'
21333 d_umask='$d_umask'
21334 d_uname='$d_uname'
21335 d_union_semun='$d_union_semun'
21336 d_unordered='$d_unordered'
21337 d_unsetenv='$d_unsetenv'
21338 d_usleep='$d_usleep'
21339 d_usleepproto='$d_usleepproto'
21340 d_ustat='$d_ustat'
21341 d_vendorarch='$d_vendorarch'
21342 d_vendorbin='$d_vendorbin'
21343 d_vendorlib='$d_vendorlib'
21344 d_vendorscript='$d_vendorscript'
21345 d_vfork='$d_vfork'
21346 d_void_closedir='$d_void_closedir'
21347 d_voidsig='$d_voidsig'
21348 d_voidtty='$d_voidtty'
21349 d_volatile='$d_volatile'
21350 d_vprintf='$d_vprintf'
21351 d_wait4='$d_wait4'
21352 d_waitpid='$d_waitpid'
21353 d_wcstombs='$d_wcstombs'
21354 d_wctomb='$d_wctomb'
21355 d_writev='$d_writev'
21356 d_xenix='$d_xenix'
21357 date='$date'
21358 db_hashtype='$db_hashtype'
21359 db_prefixtype='$db_prefixtype'
21360 db_version_major='$db_version_major'
21361 db_version_minor='$db_version_minor'
21362 db_version_patch='$db_version_patch'
21363 defvoidused='$defvoidused'
21364 direntrytype='$direntrytype'
21365 dlext='$dlext'
21366 dlsrc='$dlsrc'
21367 doublesize='$doublesize'
21368 drand01='$drand01'
21369 drand48_r_proto='$drand48_r_proto'
21370 dynamic_ext='$dynamic_ext'
21371 eagain='$eagain'
21372 ebcdic='$ebcdic'
21373 echo='$echo'
21374 egrep='$egrep'
21375 emacs='$emacs'
21376 endgrent_r_proto='$endgrent_r_proto'
21377 endhostent_r_proto='$endhostent_r_proto'
21378 endnetent_r_proto='$endnetent_r_proto'
21379 endprotoent_r_proto='$endprotoent_r_proto'
21380 endpwent_r_proto='$endpwent_r_proto'
21381 endservent_r_proto='$endservent_r_proto'
21382 eunicefix='$eunicefix'
21383 exe_ext='$exe_ext'
21384 expr='$expr'
21385 extensions='$extensions'
21386 extras='$extras'
21387 fflushNULL='$fflushNULL'
21388 fflushall='$fflushall'
21389 find='$find'
21390 firstmakefile='$firstmakefile'
21391 flex='$flex'
21392 fpossize='$fpossize'
21393 fpostype='$fpostype'
21394 freetype='$freetype'
21395 from='$from'
21396 full_ar='$full_ar'
21397 full_csh='$full_csh'
21398 full_sed='$full_sed'
21399 gccansipedantic='$gccansipedantic'
21400 gccosandvers='$gccosandvers'
21401 gccversion='$gccversion'
21402 getgrent_r_proto='$getgrent_r_proto'
21403 getgrgid_r_proto='$getgrgid_r_proto'
21404 getgrnam_r_proto='$getgrnam_r_proto'
21405 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
21406 gethostbyname_r_proto='$gethostbyname_r_proto'
21407 gethostent_r_proto='$gethostent_r_proto'
21408 getlogin_r_proto='$getlogin_r_proto'
21409 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
21410 getnetbyname_r_proto='$getnetbyname_r_proto'
21411 getnetent_r_proto='$getnetent_r_proto'
21412 getprotobyname_r_proto='$getprotobyname_r_proto'
21413 getprotobynumber_r_proto='$getprotobynumber_r_proto'
21414 getprotoent_r_proto='$getprotoent_r_proto'
21415 getpwent_r_proto='$getpwent_r_proto'
21416 getpwnam_r_proto='$getpwnam_r_proto'
21417 getpwuid_r_proto='$getpwuid_r_proto'
21418 getservbyname_r_proto='$getservbyname_r_proto'
21419 getservbyport_r_proto='$getservbyport_r_proto'
21420 getservent_r_proto='$getservent_r_proto'
21421 getspnam_r_proto='$getspnam_r_proto'
21422 gidformat='$gidformat'
21423 gidsign='$gidsign'
21424 gidsize='$gidsize'
21425 gidtype='$gidtype'
21426 glibpth='$glibpth'
21427 gmake='$gmake'
21428 gmtime_r_proto='$gmtime_r_proto'
21429 gnulibc_version='$gnulibc_version'
21430 grep='$grep'
21431 groupcat='$groupcat'
21432 groupstype='$groupstype'
21433 gzip='$gzip'
21434 h_fcntl='$h_fcntl'
21435 h_sysfile='$h_sysfile'
21436 hint='$hint'
21437 hostcat='$hostcat'
21438 html1dir='$html1dir'
21439 html1direxp='$html1direxp'
21440 html3dir='$html3dir'
21441 html3direxp='$html3direxp'
21442 i16size='$i16size'
21443 i16type='$i16type'
21444 i32size='$i32size'
21445 i32type='$i32type'
21446 i64size='$i64size'
21447 i64type='$i64type'
21448 i8size='$i8size'
21449 i8type='$i8type'
21450 i_arpainet='$i_arpainet'
21451 i_bsdioctl='$i_bsdioctl'
21452 i_crypt='$i_crypt'
21453 i_db='$i_db'
21454 i_dbm='$i_dbm'
21455 i_dirent='$i_dirent'
21456 i_dld='$i_dld'
21457 i_dlfcn='$i_dlfcn'
21458 i_fcntl='$i_fcntl'
21459 i_float='$i_float'
21460 i_fp='$i_fp'
21461 i_fp_class='$i_fp_class'
21462 i_gdbm='$i_gdbm'
21463 i_grp='$i_grp'
21464 i_ieeefp='$i_ieeefp'
21465 i_inttypes='$i_inttypes'
21466 i_langinfo='$i_langinfo'
21467 i_libutil='$i_libutil'
21468 i_limits='$i_limits'
21469 i_locale='$i_locale'
21470 i_machcthr='$i_machcthr'
21471 i_malloc='$i_malloc'
21472 i_math='$i_math'
21473 i_memory='$i_memory'
21474 i_mntent='$i_mntent'
21475 i_ndbm='$i_ndbm'
21476 i_netdb='$i_netdb'
21477 i_neterrno='$i_neterrno'
21478 i_netinettcp='$i_netinettcp'
21479 i_niin='$i_niin'
21480 i_poll='$i_poll'
21481 i_prot='$i_prot'
21482 i_pthread='$i_pthread'
21483 i_pwd='$i_pwd'
21484 i_rpcsvcdbm='$i_rpcsvcdbm'
21485 i_sfio='$i_sfio'
21486 i_sgtty='$i_sgtty'
21487 i_shadow='$i_shadow'
21488 i_socks='$i_socks'
21489 i_stdarg='$i_stdarg'
21490 i_stddef='$i_stddef'
21491 i_stdlib='$i_stdlib'
21492 i_string='$i_string'
21493 i_sunmath='$i_sunmath'
21494 i_sysaccess='$i_sysaccess'
21495 i_sysdir='$i_sysdir'
21496 i_sysfile='$i_sysfile'
21497 i_sysfilio='$i_sysfilio'
21498 i_sysin='$i_sysin'
21499 i_sysioctl='$i_sysioctl'
21500 i_syslog='$i_syslog'
21501 i_sysmman='$i_sysmman'
21502 i_sysmode='$i_sysmode'
21503 i_sysmount='$i_sysmount'
21504 i_sysndir='$i_sysndir'
21505 i_sysparam='$i_sysparam'
21506 i_sysresrc='$i_sysresrc'
21507 i_syssecrt='$i_syssecrt'
21508 i_sysselct='$i_sysselct'
21509 i_syssockio='$i_syssockio'
21510 i_sysstat='$i_sysstat'
21511 i_sysstatfs='$i_sysstatfs'
21512 i_sysstatvfs='$i_sysstatvfs'
21513 i_systime='$i_systime'
21514 i_systimek='$i_systimek'
21515 i_systimes='$i_systimes'
21516 i_systypes='$i_systypes'
21517 i_sysuio='$i_sysuio'
21518 i_sysun='$i_sysun'
21519 i_sysutsname='$i_sysutsname'
21520 i_sysvfs='$i_sysvfs'
21521 i_syswait='$i_syswait'
21522 i_termio='$i_termio'
21523 i_termios='$i_termios'
21524 i_time='$i_time'
21525 i_unistd='$i_unistd'
21526 i_ustat='$i_ustat'
21527 i_utime='$i_utime'
21528 i_values='$i_values'
21529 i_varargs='$i_varargs'
21530 i_varhdr='$i_varhdr'
21531 i_vfork='$i_vfork'
21532 ignore_versioned_solibs='$ignore_versioned_solibs'
21533 inc_version_list='$inc_version_list'
21534 inc_version_list_init='$inc_version_list_init'
21535 incpath='$incpath'
21536 inews='$inews'
21537 installarchlib='$installarchlib'
21538 installbin='$installbin'
21539 installhtml1dir='$installhtml1dir'
21540 installhtml3dir='$installhtml3dir'
21541 installman1dir='$installman1dir'
21542 installman3dir='$installman3dir'
21543 installprefix='$installprefix'
21544 installprefixexp='$installprefixexp'
21545 installprivlib='$installprivlib'
21546 installscript='$installscript'
21547 installsitearch='$installsitearch'
21548 installsitebin='$installsitebin'
21549 installsitehtml1dir='$installsitehtml1dir'
21550 installsitehtml3dir='$installsitehtml3dir'
21551 installsitelib='$installsitelib'
21552 installsiteman1dir='$installsiteman1dir'
21553 installsiteman3dir='$installsiteman3dir'
21554 installsitescript='$installsitescript'
21555 installstyle='$installstyle'
21556 installusrbinperl='$installusrbinperl'
21557 installvendorarch='$installvendorarch'
21558 installvendorbin='$installvendorbin'
21559 installvendorhtml1dir='$installvendorhtml1dir'
21560 installvendorhtml3dir='$installvendorhtml3dir'
21561 installvendorlib='$installvendorlib'
21562 installvendorman1dir='$installvendorman1dir'
21563 installvendorman3dir='$installvendorman3dir'
21564 installvendorscript='$installvendorscript'
21565 intsize='$intsize'
21566 issymlink='$issymlink'
21567 ivdformat='$ivdformat'
21568 ivsize='$ivsize'
21569 ivtype='$ivtype'
21570 known_extensions='$known_extensions'
21571 ksh='$ksh'
21572 ld='$ld'
21573 lddlflags='$lddlflags'
21574 ldflags='$ldflags'
21575 ldflags_uselargefiles='$ldflags_uselargefiles'
21576 ldlibpthname='$ldlibpthname'
21577 less='$less'
21578 lib_ext='$lib_ext'
21579 libc='$libc'
21580 libperl='$libperl'
21581 libpth='$libpth'
21582 libs='$libs'
21583 libsdirs='$libsdirs'
21584 libsfiles='$libsfiles'
21585 libsfound='$libsfound'
21586 libspath='$libspath'
21587 libswanted='$libswanted'
21588 libswanted_uselargefiles='$libswanted_uselargefiles'
21589 line='$line'
21590 lint='$lint'
21591 lkflags='$lkflags'
21592 ln='$ln'
21593 lns='$lns'
21594 localtime_r_proto='$localtime_r_proto'
21595 locincpth='$locincpth'
21596 loclibpth='$loclibpth'
21597 longdblsize='$longdblsize'
21598 longlongsize='$longlongsize'
21599 longsize='$longsize'
21600 lp='$lp'
21601 lpr='$lpr'
21602 ls='$ls'
21603 lseeksize='$lseeksize'
21604 lseektype='$lseektype'
21605 mail='$mail'
21606 mailx='$mailx'
21607 make='$make'
21608 make_set_make='$make_set_make'
21609 mallocobj='$mallocobj'
21610 mallocsrc='$mallocsrc'
21611 malloctype='$malloctype'
21612 man1dir='$man1dir'
21613 man1direxp='$man1direxp'
21614 man1ext='$man1ext'
21615 man3dir='$man3dir'
21616 man3direxp='$man3direxp'
21617 man3ext='$man3ext'
21618 mips_type='$mips_type'
21619 mistrustnm='$mistrustnm'
21620 mkdir='$mkdir'
21621 mmaptype='$mmaptype'
21622 modetype='$modetype'
21623 more='$more'
21624 multiarch='$multiarch'
21625 mv='$mv'
21626 myarchname='$myarchname'
21627 mydomain='$mydomain'
21628 myhostname='$myhostname'
21629 myuname='$myuname'
21630 n='$n'
21631 need_va_copy='$need_va_copy'
21632 netdb_hlen_type='$netdb_hlen_type'
21633 netdb_host_type='$netdb_host_type'
21634 netdb_name_type='$netdb_name_type'
21635 netdb_net_type='$netdb_net_type'
21636 nm='$nm'
21637 nm_opt='$nm_opt'
21638 nm_so_opt='$nm_so_opt'
21639 nonxs_ext='$nonxs_ext'
21640 nroff='$nroff'
21641 nvEUformat='$nvEUformat'
21642 nvFUformat='$nvFUformat'
21643 nvGUformat='$nvGUformat'
21644 nv_preserves_uv_bits='$nv_preserves_uv_bits'
21645 nveformat='$nveformat'
21646 nvfformat='$nvfformat'
21647 nvgformat='$nvgformat'
21648 nvsize='$nvsize'
21649 nvtype='$nvtype'
21650 o_nonblock='$o_nonblock'
21651 obj_ext='$obj_ext'
21652 old_pthread_create_joinable='$old_pthread_create_joinable'
21653 optimize='$optimize'
21654 orderlib='$orderlib'
21655 osname='$osname'
21656 osvers='$osvers'
21657 otherlibdirs='$otherlibdirs'
21658 package='$package'
21659 pager='$pager'
21660 passcat='$passcat'
21661 patchlevel='$patchlevel'
21662 path_sep='$path_sep'
21663 perl5='$perl5'
21664 perl='$perl'
21665 perl_patchlevel='$perl_patchlevel'
21666 perladmin='$perladmin'
21667 perllibs='$perllibs'
21668 perlpath='$perlpath'
21669 pg='$pg'
21670 phostname='$phostname'
21671 pidtype='$pidtype'
21672 plibpth='$plibpth'
21673 pmake='$pmake'
21674 pr='$pr'
21675 prefix='$prefix'
21676 prefixexp='$prefixexp'
21677 privlib='$privlib'
21678 privlibexp='$privlibexp'
21679 procselfexe='$procselfexe'
21680 prototype='$prototype'
21681 ptrsize='$ptrsize'
21682 quadkind='$quadkind'
21683 quadtype='$quadtype'
21684 randbits='$randbits'
21685 randfunc='$randfunc'
21686 random_r_proto='$random_r_proto'
21687 randseedtype='$randseedtype'
21688 ranlib='$ranlib'
21689 rd_nodata='$rd_nodata'
21690 readdir64_r_proto='$readdir64_r_proto'
21691 readdir_r_proto='$readdir_r_proto'
21692 revision='$revision'
21693 rm='$rm'
21694 rmail='$rmail'
21695 run='$run'
21696 runnm='$runnm'
21697 sPRIEUldbl='$sPRIEUldbl'
21698 sPRIFUldbl='$sPRIFUldbl'
21699 sPRIGUldbl='$sPRIGUldbl'
21700 sPRIXU64='$sPRIXU64'
21701 sPRId64='$sPRId64'
21702 sPRIeldbl='$sPRIeldbl'
21703 sPRIfldbl='$sPRIfldbl'
21704 sPRIgldbl='$sPRIgldbl'
21705 sPRIi64='$sPRIi64'
21706 sPRIo64='$sPRIo64'
21707 sPRIu64='$sPRIu64'
21708 sPRIx64='$sPRIx64'
21709 sSCNfldbl='$sSCNfldbl'
21710 sched_yield='$sched_yield'
21711 scriptdir='$scriptdir'
21712 scriptdirexp='$scriptdirexp'
21713 sed='$sed'
21714 seedfunc='$seedfunc'
21715 selectminbits='$selectminbits'
21716 selecttype='$selecttype'
21717 sendmail='$sendmail'
21718 setgrent_r_proto='$setgrent_r_proto'
21719 sethostent_r_proto='$sethostent_r_proto'
21720 setlocale_r_proto='$setlocale_r_proto'
21721 setnetent_r_proto='$setnetent_r_proto'
21722 setprotoent_r_proto='$setprotoent_r_proto'
21723 setpwent_r_proto='$setpwent_r_proto'
21724 setservent_r_proto='$setservent_r_proto'
21725 sh='$sh'
21726 shar='$shar'
21727 sharpbang='$sharpbang'
21728 shmattype='$shmattype'
21729 shortsize='$shortsize'
21730 shrpenv='$shrpenv'
21731 shsharp='$shsharp'
21732 sig_count='$sig_count'
21733 sig_name='$sig_name'
21734 sig_name_init='$sig_name_init'
21735 sig_num='$sig_num'
21736 sig_num_init='$sig_num_init'
21737 sig_size='$sig_size'
21738 signal_t='$signal_t'
21739 sitearch='$sitearch'
21740 sitearchexp='$sitearchexp'
21741 sitebin='$sitebin'
21742 sitebinexp='$sitebinexp'
21743 sitehtml1dir='$sitehtml1dir'
21744 sitehtml1direxp='$sitehtml1direxp'
21745 sitehtml3dir='$sitehtml3dir'
21746 sitehtml3direxp='$sitehtml3direxp'
21747 sitelib='$sitelib'
21748 sitelib_stem='$sitelib_stem'
21749 sitelibexp='$sitelibexp'
21750 siteman1dir='$siteman1dir'
21751 siteman1direxp='$siteman1direxp'
21752 siteman3dir='$siteman3dir'
21753 siteman3direxp='$siteman3direxp'
21754 siteprefix='$siteprefix'
21755 siteprefixexp='$siteprefixexp'
21756 sitescript='$sitescript'
21757 sitescriptexp='$sitescriptexp'
21758 sizesize='$sizesize'
21759 sizetype='$sizetype'
21760 sleep='$sleep'
21761 smail='$smail'
21762 so='$so'
21763 sockethdr='$sockethdr'
21764 socketlib='$socketlib'
21765 socksizetype='$socksizetype'
21766 sort='$sort'
21767 spackage='$spackage'
21768 spitshell='$spitshell'
21769 srand48_r_proto='$srand48_r_proto'
21770 srandom_r_proto='$srandom_r_proto'
21771 src='$src'
21772 ssizetype='$ssizetype'
21773 startperl='$startperl'
21774 startsh='$startsh'
21775 static_ext='$static_ext'
21776 stdchar='$stdchar'
21777 stdio_base='$stdio_base'
21778 stdio_bufsiz='$stdio_bufsiz'
21779 stdio_cnt='$stdio_cnt'
21780 stdio_filbuf='$stdio_filbuf'
21781 stdio_ptr='$stdio_ptr'
21782 stdio_stream_array='$stdio_stream_array'
21783 strerror_r_proto='$strerror_r_proto'
21784 strings='$strings'
21785 submit='$submit'
21786 subversion='$subversion'
21787 sysman='$sysman'
21788 tail='$tail'
21789 tar='$tar'
21790 targetarch='$targetarch'
21791 tbl='$tbl'
21792 tee='$tee'
21793 test='$test'
21794 timeincl='$timeincl'
21795 timetype='$timetype'
21796 tmpnam_r_proto='$tmpnam_r_proto'
21797 to='$to'
21798 touch='$touch'
21799 tr='$tr'
21800 trnl='$trnl'
21801 troff='$troff'
21802 ttyname_r_proto='$ttyname_r_proto'
21803 u16size='$u16size'
21804 u16type='$u16type'
21805 u32size='$u32size'
21806 u32type='$u32type'
21807 u64size='$u64size'
21808 u64type='$u64type'
21809 u8size='$u8size'
21810 u8type='$u8type'
21811 uidformat='$uidformat'
21812 uidsign='$uidsign'
21813 uidsize='$uidsize'
21814 uidtype='$uidtype'
21815 uname='$uname'
21816 uniq='$uniq'
21817 uquadtype='$uquadtype'
21818 use5005threads='$use5005threads'
21819 use64bitall='$use64bitall'
21820 use64bitint='$use64bitint'
21821 usecrosscompile='$usecrosscompile'
21822 usedl='$usedl'
21823 usefaststdio='$usefaststdio'
21824 useithreads='$useithreads'
21825 uselargefiles='$uselargefiles'
21826 uselongdouble='$uselongdouble'
21827 usemallocwrap='$usemallocwrap'
21828 usemorebits='$usemorebits'
21829 usemultiplicity='$usemultiplicity'
21830 usemymalloc='$usemymalloc'
21831 usenm='$usenm'
21832 useopcode='$useopcode'
21833 useperlio='$useperlio'
21834 useposix='$useposix'
21835 usereentrant='$usereentrant'
21836 userelocatableinc='$userelocatableinc'
21837 usesfio='$usesfio'
21838 useshrplib='$useshrplib'
21839 usesitecustomize='$usesitecustomize'
21840 usesocks='$usesocks'
21841 usethreads='$usethreads'
21842 usevendorprefix='$usevendorprefix'
21843 usevfork='$usevfork'
21844 usrinc='$usrinc'
21845 uuname='$uuname'
21846 uvXUformat='$uvXUformat'
21847 uvoformat='$uvoformat'
21848 uvsize='$uvsize'
21849 uvtype='$uvtype'
21850 uvuformat='$uvuformat'
21851 uvxformat='$uvxformat'
21852 vendorarch='$vendorarch'
21853 vendorarchexp='$vendorarchexp'
21854 vendorbin='$vendorbin'
21855 vendorbinexp='$vendorbinexp'
21856 vendorhtml1dir='$vendorhtml1dir'
21857 vendorhtml1direxp='$vendorhtml1direxp'
21858 vendorhtml3dir='$vendorhtml3dir'
21859 vendorhtml3direxp='$vendorhtml3direxp'
21860 vendorlib='$vendorlib'
21861 vendorlib_stem='$vendorlib_stem'
21862 vendorlibexp='$vendorlibexp'
21863 vendorman1dir='$vendorman1dir'
21864 vendorman1direxp='$vendorman1direxp'
21865 vendorman3dir='$vendorman3dir'
21866 vendorman3direxp='$vendorman3direxp'
21867 vendorprefix='$vendorprefix'
21868 vendorprefixexp='$vendorprefixexp'
21869 vendorscript='$vendorscript'
21870 vendorscriptexp='$vendorscriptexp'
21871 version='$version'
21872 version_patchlevel_string='$version_patchlevel_string'
21873 versiononly='$versiononly'
21874 vi='$vi'
21875 voidflags='$voidflags'
21876 xlibpth='$xlibpth'
21877 yacc='$yacc'
21878 yaccflags='$yaccflags'
21879 zcat='$zcat'
21880 zip='$zip'
21881 EOT
21882
21883 : Add in command line options if available
21884 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
21885
21886 : add special variables
21887 $test -f $src/patchlevel.h && \
21888 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
21889 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
21890 echo "PERL_CONFIG_SH=true" >>config.sh
21891
21892 : propagate old symbols
21893 if $test -f UU/config.sh; then
21894         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
21895         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
21896         $sort | $uniq -u >UU/oldsyms
21897         set X `cat UU/oldsyms`
21898         shift
21899         case $# in
21900         0) ;;
21901         *)
21902                 cat <<EOM
21903 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
21904 EOM
21905                 echo "# Variables propagated from previous config.sh file." >>config.sh
21906                 for sym in `cat UU/oldsyms`; do
21907                         echo "    Propagating $hint variable "'$'"$sym..."
21908                         eval 'tmp="$'"${sym}"'"'
21909                         echo "$tmp" | \
21910                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
21911                 done
21912                 ;;
21913         esac
21914 fi
21915
21916 : Finish up by extracting the .SH files
21917 case "$alldone" in
21918 exit)
21919         $rm -rf UU
21920         echo "Extraction done."
21921         exit 0
21922         ;;
21923 cont)
21924         ;;
21925 '')
21926         dflt=''
21927         nostick=true
21928         $cat <<EOM
21929
21930 If you'd like to make any changes to the config.sh file before I begin
21931 to configure things, do it as a shell escape now (e.g. !vi config.sh).
21932
21933 EOM
21934         rp="Press return or use a shell escape to edit config.sh:"
21935         . UU/myread
21936         nostick=''
21937         case "$ans" in
21938         '') ;;
21939         *) : in case they cannot read
21940                 sh 1>&4 -c "$ans";;
21941         esac
21942         ;;
21943 esac
21944
21945 : if this fails, just run all the .SH files by hand
21946 . ./config.sh
21947
21948 echo " "
21949 exec 1>&4
21950 pwd=`pwd`
21951 . ./UU/extract
21952 cd "$pwd"
21953
21954 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
21955         dflt=y
21956         case "$silent" in
21957         true) ;;
21958         *)
21959                 $cat <<EOM
21960
21961 Now you need to generate make dependencies by running "$make depend".
21962 You might prefer to run it in background: "$make depend > makedepend.out &"
21963 It can take a while, so you might not want to run it right now.
21964
21965 EOM
21966                 ;;
21967         esac
21968         rp="Run $make depend now?"
21969         . UU/myread
21970         case "$ans" in
21971         y*)
21972                 $make depend && echo "Now you must run '$make'."
21973                 ;;
21974         *)
21975                 echo "You must run '$make depend' then '$make'."
21976                 ;;
21977         esac
21978 elif test -f [Mm]akefile; then
21979         echo " "
21980         echo "Now you must run a $make."
21981 else
21982         echo "Configure done."
21983 fi
21984
21985 if $test -f Policy.sh; then
21986     $cat <<EOM
21987
21988 If you compile $package on a different machine or from a different object
21989 directory, copy the Policy.sh file from this object directory to the
21990 new one before you run Configure -- this will help you with most of
21991 the policy defaults.
21992
21993 EOM
21994 fi
21995 if $test -f config.msg; then
21996     echo "Hmm.  I also noted the following information while running:"
21997     echo " "
21998     $cat config.msg >&4
21999     $rm -f config.msg
22000 fi
22001 $rm -f kit*isdone ark*isdone
22002 $rm -rf UU
22003
22004 : End of Configure
22005