This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Teach the alias mapping about new committers.
[perl5.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20 #
21 # Though this script was generated by metaconfig, it is OK to send
22 # patches against it. It's up to the Configure pumpkin to backport
23 # the patch to the metaunits if it is accepted.
24 # See Porting/pumpkin.pod for more information on metaconfig.
25 #
26
27 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
28 #
29 # Generated on Mon Sep 12 15:44:06 CEST 2005 [metaconfig 3.0 PL70]
30 # (with additional metaconfig patches by perlbug@perl.org)
31
32 cat >c1$$ <<EOF
33 ARGGGHHHH!!!!!
34
35 SCO csh still thinks true is false.  Write to SCO today and tell them that next
36 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
37
38 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
39 we'd have to do is go in and swap the && and || tokens, wherever they are.)
40
41 [End of diatribe. We now return you to your regularly scheduled programming...]
42 EOF
43 cat >c2$$ <<EOF
44
45 OOPS!  You naughty creature!  You didn't run Configure with sh!
46 I will attempt to remedy the situation by running sh for you...
47 EOF
48
49 true || cat c1$$ c2$$
50 true || exec sh $0 $argv:q
51
52 (exit $?0) || cat c2$$
53 (exit $?0) || exec sh $0 $argv:q
54 rm -f c1$$ c2$$
55
56 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
57         cat >&4 <<EOF
58 ***
59 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
60 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
61 *** Please read the README.plan9 for further instructions.
62 *** Cannot continue, aborting.
63 ***
64 EOF
65         exit 1
66 fi
67
68 : compute my invocation name
69 me=$0
70 case "$0" in
71 */*)
72         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
73         test "$me" || me=$0
74         ;;
75 esac
76
77 : Proper separator for the PATH environment variable
78 p_=:
79 : On OS/2 this directory should exist if this is not floppy only system :-]
80 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
81     if test -n "$OS2_SHELL"; then
82                 p_=\;
83                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
84                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
85                 is_os2=yes
86         elif test -n "$DJGPP"; then
87                 case "X${MACHTYPE:-nonesuchmach}" in
88                 *cygwin) ;;
89                 *) p_=\; ;;
90                 esac
91         fi
92 fi
93
94 : Proper PATH setting
95 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
96 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
97 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
98 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
99 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
100 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
101 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
102 paths="$paths /sbin /usr/sbin /usr/libexec"
103 paths="$paths /system/gnu_library/bin"
104
105 for p in $paths
106 do
107         case "$p_$PATH$p_" in
108         *$p_$p$p_*) ;;
109         *) test -d $p && PATH=$PATH$p_$p ;;
110         esac
111 done
112
113 PATH=.$p_$PATH
114 export PATH
115
116 : shall we be using ksh?
117 inksh=''
118 needksh=''
119 avoidksh=''
120 newsh=/bin/ksh
121 changesh=''
122 if (PATH=.; alias -x) >/dev/null 2>&1; then
123                 inksh=true
124 fi
125 if test -f /hp-ux -a -f /bin/ksh; then
126         needksh='to avoid sh bug in "here document" expansion'
127 fi
128 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
129         if test X`/usr/bin/uname -v` = X4; then
130                 avoidksh="to avoid AIX 4's /bin/sh"
131                 newsh=/usr/bin/bsh
132         fi
133 fi
134 if test -f /osf_boot -a -f /usr/sbin/setld; then
135         if test X`/usr/bin/uname -s` = XOSF1; then
136                 avoidksh="to avoid Digital UNIX' ksh"
137                 newsh=/bin/sh
138                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
139         fi
140 fi
141 case "$inksh/$needksh" in
142 /[a-z]*)
143                 ENV=''
144                 changesh=true
145                 reason="$needksh"
146         ;;
147 esac
148 case "$inksh/$avoidksh" in
149 true/[a-z]*)
150         changesh=true
151         reason="$avoidksh"
152         ;;
153 esac
154 case "$inksh/$needksh-$avoidksh-" in
155 true/--)
156                 cat <<EOM
157 (I see you are using the Korn shell.  Some ksh's blow up on $me,
158 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
159 EOM
160         ;;
161 esac
162 case "$changesh" in
163 true)
164         export newsh
165         echo "(Feeding myself to $newsh $reason.)"
166         case "$0" in
167         Configure|*/Configure) exec $newsh $0 "$@";;
168         *) exec $newsh Configure "$@";;
169         esac
170         ;;
171 esac
172
173 : if needed set CDPATH to a harmless value that is not chatty
174 : avoid bash 2.02 problems with empty CDPATH.
175 case "$CDPATH" in
176 '')     ;;
177 *)      case "$SHELL" in
178         *bash*) CDPATH='.' ;;
179         *)              CDPATH='' ;;
180         esac
181         ;;
182 esac
183 : Configure runs within the UU subdirectory
184 test -d UU || mkdir UU
185 cd UU && rm -f ./*
186
187 ccname=''
188 ccversion=''
189 ccsymbols=''
190 cppccsymbols=''
191 cppsymbols=''
192 from=''
193 run=''
194 targetarch=''
195 to=''
196 usecrosscompile=''
197 mistrustnm=''
198 perllibs=''
199 dynamic_ext=''
200 extensions=''
201 known_extensions=''
202 nonxs_ext=''
203 static_ext=''
204 useopcode=''
205 useposix=''
206 extras=''
207 d_bsd=''
208 d_eunice=''
209 d_xenix=''
210 eunicefix=''
211 Mcc=''
212 ar=''
213 awk=''
214 bash=''
215 bison=''
216 byacc=''
217 cat=''
218 chgrp=''
219 chmod=''
220 chown=''
221 comm=''
222 compress=''
223 cp=''
224 cpio=''
225 cpp=''
226 csh=''
227 date=''
228 echo=''
229 egrep=''
230 emacs=''
231 expr=''
232 find=''
233 flex=''
234 gmake=''
235 grep=''
236 gzip=''
237 inews=''
238 ksh=''
239 less=''
240 line=''
241 lint=''
242 ln=''
243 lp=''
244 lpr=''
245 ls=''
246 mail=''
247 mailx=''
248 make=''
249 mkdir=''
250 more=''
251 mv=''
252 nm=''
253 nroff=''
254 perl=''
255 pg=''
256 pmake=''
257 pr=''
258 rm=''
259 rmail=''
260 sed=''
261 sendmail=''
262 shar=''
263 sleep=''
264 smail=''
265 sort=''
266 submit=''
267 tail=''
268 tar=''
269 tbl=''
270 tee=''
271 test=''
272 touch=''
273 tr=''
274 troff=''
275 uname=''
276 uniq=''
277 uuname=''
278 vi=''
279 zcat=''
280 zip=''
281 full_ar=''
282 full_sed=''
283 libswanted=''
284 hint=''
285 myuname=''
286 osname=''
287 osvers=''
288 Author=''
289 Date=''
290 Header=''
291 Id=''
292 Locker=''
293 Log=''
294 RCSfile=''
295 Revision=''
296 Source=''
297 State=''
298 _a=''
299 _exe=''
300 _o=''
301 archobjs=''
302 exe_ext=''
303 firstmakefile=''
304 lib_ext=''
305 obj_ext=''
306 path_sep=''
307 afs=''
308 afsroot=''
309 alignbytes=''
310 ansi2knr=''
311 archlib=''
312 archlibexp=''
313 d_archlib=''
314 installarchlib=''
315 archname=''
316 myarchname=''
317 d_atolf=''
318 d_atoll=''
319 baserev=''
320 bin=''
321 binexp=''
322 installbin=''
323 byteorder=''
324 cc=''
325 ccflags=''
326 cppflags=''
327 ldflags=''
328 lkflags=''
329 locincpth=''
330 optimize=''
331 cf_email=''
332 cf_by=''
333 cf_time=''
334 charsize=''
335 contains=''
336 cpp_stuff=''
337 cpplast=''
338 cppminus=''
339 cpprun=''
340 cppstdin=''
341 d__fwalk=''
342 d_access=''
343 d_accessx=''
344 d_aintl=''
345 d_alarm=''
346 asctime_r_proto=''
347 d_asctime_r=''
348 d_attribute_format=''
349 d_attribute_malloc=''
350 d_attribute_nonnull=''
351 d_attribute_noreturn=''
352 d_attribute_pure=''
353 d_attribute_unused=''
354 d_attribute_warn_unused_result=''
355 d_bcmp=''
356 d_bcopy=''
357 d_bzero=''
358 d_casti32=''
359 castflags=''
360 d_castneg=''
361 d_chown=''
362 d_chroot=''
363 d_chsize=''
364 d_class=''
365 d_closedir=''
366 d_void_closedir=''
367 d_cmsghdr_s=''
368 d_const=''
369 d_copysignl=''
370 cryptlib=''
371 d_crypt=''
372 crypt_r_proto=''
373 d_crypt_r=''
374 d_csh=''
375 full_csh=''
376 ctermid_r_proto=''
377 d_ctermid_r=''
378 ctime_r_proto=''
379 d_ctime_r=''
380 d_cuserid=''
381 d_dbl_dig=''
382 d_dbminitproto=''
383 d_difftime=''
384 d_dirfd=''
385 d_dlerror=''
386 d_dlopen=''
387 d_dlsymun=''
388 d_dosuid=''
389 d_suidsafe=''
390 d_drand48_r=''
391 drand48_r_proto=''
392 d_drand48proto=''
393 d_dup2=''
394 d_eaccess=''
395 d_endgrent=''
396 d_endgrent_r=''
397 endgrent_r_proto=''
398 d_endhent=''
399 d_endhostent_r=''
400 endhostent_r_proto=''
401 d_endnent=''
402 d_endnetent_r=''
403 endnetent_r_proto=''
404 d_endpent=''
405 d_endprotoent_r=''
406 endprotoent_r_proto=''
407 d_endpwent=''
408 d_endpwent_r=''
409 endpwent_r_proto=''
410 d_endsent=''
411 d_endservent_r=''
412 endservent_r_proto=''
413 d_faststdio=''
414 d_fchdir=''
415 d_fchmod=''
416 d_fchown=''
417 d_fcntl=''
418 d_fcntl_can_lock=''
419 d_fd_macros=''
420 d_fd_set=''
421 d_fds_bits=''
422 d_fgetpos=''
423 d_finite=''
424 d_finitel=''
425 d_flexfnam=''
426 d_flock=''
427 d_flockproto=''
428 d_fork=''
429 d_fp_class=''
430 d_fpclass=''
431 d_fpclassify=''
432 d_fpclassl=''
433 d_fpos64_t=''
434 d_frexpl=''
435 d_fs_data_s=''
436 d_fseeko=''
437 d_fsetpos=''
438 d_fstatfs=''
439 d_fsync=''
440 d_ftello=''
441 d_ftime=''
442 d_gettimeod=''
443 d_Gconvert=''
444 d_getcwd=''
445 d_getespwnam=''
446 d_getfsstat=''
447 d_getgrent=''
448 d_getgrent_r=''
449 getgrent_r_proto=''
450 d_getgrgid_r=''
451 getgrgid_r_proto=''
452 d_getgrnam_r=''
453 getgrnam_r_proto=''
454 d_getgrps=''
455 d_gethbyaddr=''
456 d_gethbyname=''
457 d_gethent=''
458 aphostname=''
459 d_gethname=''
460 d_phostname=''
461 d_uname=''
462 d_gethostbyaddr_r=''
463 gethostbyaddr_r_proto=''
464 d_gethostbyname_r=''
465 gethostbyname_r_proto=''
466 d_gethostent_r=''
467 gethostent_r_proto=''
468 d_gethostprotos=''
469 d_getitimer=''
470 d_getlogin=''
471 d_getlogin_r=''
472 getlogin_r_proto=''
473 d_getmnt=''
474 d_getmntent=''
475 d_getnbyaddr=''
476 d_getnbyname=''
477 d_getnent=''
478 d_getnetbyaddr_r=''
479 getnetbyaddr_r_proto=''
480 d_getnetbyname_r=''
481 getnetbyname_r_proto=''
482 d_getnetent_r=''
483 getnetent_r_proto=''
484 d_getnetprotos=''
485 d_getpagsz=''
486 d_getpent=''
487 d_getpgid=''
488 d_getpgrp2=''
489 d_bsdgetpgrp=''
490 d_getpgrp=''
491 d_getppid=''
492 d_getprior=''
493 d_getpbyname=''
494 d_getpbynumber=''
495 d_getprotobyname_r=''
496 getprotobyname_r_proto=''
497 d_getprotobynumber_r=''
498 getprotobynumber_r_proto=''
499 d_getprotoent_r=''
500 getprotoent_r_proto=''
501 d_getprotoprotos=''
502 d_getprpwnam=''
503 d_getpwent=''
504 d_getpwent_r=''
505 getpwent_r_proto=''
506 d_getpwnam_r=''
507 getpwnam_r_proto=''
508 d_getpwuid_r=''
509 getpwuid_r_proto=''
510 d_getsent=''
511 d_getservbyname_r=''
512 getservbyname_r_proto=''
513 d_getservbyport_r=''
514 getservbyport_r_proto=''
515 d_getservent_r=''
516 getservent_r_proto=''
517 d_getservprotos=''
518 d_getspnam=''
519 d_getspnam_r=''
520 getspnam_r_proto=''
521 d_getsbyname=''
522 d_getsbyport=''
523 d_gmtime_r=''
524 gmtime_r_proto=''
525 d_gnulibc=''
526 gnulibc_version=''
527 d_hasmntopt=''
528 d_htonl=''
529 d_ilogbl=''
530 d_inetaton=''
531 d_int64_t=''
532 d_isascii=''
533 d_isfinite=''
534 d_isinf=''
535 d_isnan=''
536 d_isnanl=''
537 d_killpg=''
538 d_lchown=''
539 d_ldbl_dig=''
540 d_libm_lib_version=''
541 d_link=''
542 d_localtime_r=''
543 localtime_r_proto=''
544 d_locconv=''
545 d_lockf=''
546 d_longdbl=''
547 longdblsize=''
548 d_longlong=''
549 longlongsize=''
550 d_lseekproto=''
551 d_lstat=''
552 d_madvise=''
553 d_malloc_good_size=''
554 d_malloc_size=''
555 d_mblen=''
556 d_mbstowcs=''
557 d_mbtowc=''
558 d_memchr=''
559 d_memcmp=''
560 d_memcpy=''
561 d_memmove=''
562 d_memset=''
563 d_mkdir=''
564 d_mkdtemp=''
565 d_mkfifo=''
566 d_mkstemp=''
567 d_mkstemps=''
568 d_mktime=''
569 d_mmap=''
570 mmaptype=''
571 d_modfl=''
572 d_modfl_pow32_bug=''
573 d_modflproto=''
574 d_mprotect=''
575 d_msg=''
576 d_msgctl=''
577 d_msgget=''
578 d_msghdr_s=''
579 d_msgrcv=''
580 d_msgsnd=''
581 d_msync=''
582 d_munmap=''
583 d_nice=''
584 d_nl_langinfo=''
585 d_off64_t=''
586 d_open3=''
587 d_fpathconf=''
588 d_pathconf=''
589 d_pause=''
590 d_pipe=''
591 d_poll=''
592 d_portable=''
593 d_procselfexe=''
594 procselfexe=''
595 d_old_pthread_create_joinable=''
596 old_pthread_create_joinable=''
597 d_pthread_atfork=''
598 d_pthread_attr_setscope=''
599 d_pthread_yield=''
600 d_sched_yield=''
601 sched_yield=''
602 d_qgcvt=''
603 d_random_r=''
604 random_r_proto=''
605 d_readdir64_r=''
606 readdir64_r_proto=''
607 d_readdir=''
608 d_rewinddir=''
609 d_seekdir=''
610 d_telldir=''
611 d_readdir_r=''
612 readdir_r_proto=''
613 d_readlink=''
614 d_readv=''
615 d_recvmsg=''
616 d_rename=''
617 d_rmdir=''
618 d_safebcpy=''
619 d_safemcpy=''
620 d_sanemcmp=''
621 d_sbrkproto=''
622 d_scalbnl=''
623 d_select=''
624 d_sem=''
625 d_semctl=''
626 d_semget=''
627 d_semop=''
628 d_sendmsg=''
629 d_setegid=''
630 d_seteuid=''
631 d_setgrent=''
632 d_setgrent_r=''
633 setgrent_r_proto=''
634 d_setgrps=''
635 d_sethent=''
636 d_sethostent_r=''
637 sethostent_r_proto=''
638 d_setitimer=''
639 d_setlinebuf=''
640 d_setlocale=''
641 d_setlocale_r=''
642 setlocale_r_proto=''
643 d_setnent=''
644 d_setnetent_r=''
645 setnetent_r_proto=''
646 d_setpent=''
647 d_setpgid=''
648 d_setpgrp2=''
649 d_bsdsetpgrp=''
650 d_setpgrp=''
651 d_setprior=''
652 d_setproctitle=''
653 d_setprotoent_r=''
654 setprotoent_r_proto=''
655 d_setpwent=''
656 d_setpwent_r=''
657 setpwent_r_proto=''
658 d_setregid=''
659 d_setresgid=''
660 d_setresuid=''
661 d_setreuid=''
662 d_setrgid=''
663 d_setruid=''
664 d_setsent=''
665 d_setservent_r=''
666 setservent_r_proto=''
667 d_setsid=''
668 d_setvbuf=''
669 d_sfio=''
670 usesfio=''
671 d_shm=''
672 d_shmat=''
673 d_shmatprototype=''
674 shmattype=''
675 d_shmctl=''
676 d_shmdt=''
677 d_shmget=''
678 d_sigaction=''
679 d_sigprocmask=''
680 d_sigsetjmp=''
681 usesitecustomize=''
682 d_sockatmark=''
683 d_sockatmarkproto=''
684 d_msg_ctrunc=''
685 d_msg_dontroute=''
686 d_msg_oob=''
687 d_msg_peek=''
688 d_msg_proxy=''
689 d_oldsock=''
690 d_scm_rights=''
691 d_socket=''
692 d_sockpair=''
693 sockethdr=''
694 socketlib=''
695 d_socklen_t=''
696 d_socks5_init=''
697 d_sqrtl=''
698 d_srand48_r=''
699 srand48_r_proto=''
700 d_srandom_r=''
701 srandom_r_proto=''
702 d_sresgproto=''
703 d_sresuproto=''
704 d_statblks=''
705 d_statfs_f_flags=''
706 d_statfs_s=''
707 d_fstatvfs=''
708 d_statvfs=''
709 d_stdio_cnt_lval=''
710 d_stdio_ptr_lval=''
711 d_stdio_ptr_lval_nochange_cnt=''
712 d_stdio_ptr_lval_sets_cnt=''
713 d_stdiobase=''
714 d_stdstdio=''
715 stdio_base=''
716 stdio_bufsiz=''
717 stdio_cnt=''
718 stdio_filbuf=''
719 stdio_ptr=''
720 d_index=''
721 d_strchr=''
722 d_strcoll=''
723 d_strctcpy=''
724 d_strerrm=''
725 d_strerror=''
726 d_sysernlst=''
727 d_syserrlst=''
728 d_strerror_r=''
729 strerror_r_proto=''
730 d_strftime=''
731 d_strlcat=''
732 d_strlcpy=''
733 d_strtod=''
734 d_strtol=''
735 d_strtold=''
736 d_strtoll=''
737 d_strtoq=''
738 d_strtoul=''
739 d_strtoull=''
740 d_strtouq=''
741 d_strxfrm=''
742 d_symlink=''
743 d_syscall=''
744 d_syscallproto=''
745 d_sysconf=''
746 d_system=''
747 d_tcgetpgrp=''
748 d_tcsetpgrp=''
749 d_telldirproto=''
750 d_time=''
751 timetype=''
752 clocktype=''
753 d_times=''
754 d_tmpnam_r=''
755 tmpnam_r_proto=''
756 d_truncate=''
757 d_ttyname_r=''
758 ttyname_r_proto=''
759 d_tzname=''
760 d_u32align=''
761 d_ualarm=''
762 d_umask=''
763 d_semctl_semid_ds=''
764 d_semctl_semun=''
765 d_union_semun=''
766 d_unordered=''
767 d_usleep=''
768 d_usleepproto=''
769 d_ustat=''
770 d_vfork=''
771 usevfork=''
772 d_voidsig=''
773 signal_t=''
774 d_volatile=''
775 d_charvspr=''
776 d_vprintf=''
777 d_wait4=''
778 d_waitpid=''
779 d_wcstombs=''
780 d_wctomb=''
781 d_writev=''
782 dlext=''
783 cccdlflags=''
784 ccdlflags=''
785 dlsrc=''
786 ld=''
787 lddlflags=''
788 usedl=''
789 doublesize=''
790 ebcdic=''
791 fflushNULL=''
792 fflushall=''
793 fpossize=''
794 fpostype=''
795 gccansipedantic=''
796 gccosandvers=''
797 gccversion=''
798 gidformat=''
799 gidsign=''
800 gidsize=''
801 gidtype=''
802 groupstype=''
803 h_fcntl=''
804 h_sysfile=''
805 html1dir=''
806 html1direxp=''
807 installhtml1dir=''
808 html3dir=''
809 html3direxp=''
810 installhtml3dir=''
811 i_arpainet=''
812 i_crypt=''
813 db_hashtype=''
814 db_prefixtype=''
815 db_version_major=''
816 db_version_minor=''
817 db_version_patch=''
818 i_db=''
819 i_dbm=''
820 i_rpcsvcdbm=''
821 d_dirnamlen=''
822 direntrytype=''
823 i_dirent=''
824 i_dld=''
825 i_dlfcn=''
826 i_fcntl=''
827 i_float=''
828 i_fp=''
829 i_fp_class=''
830 i_gdbm=''
831 d_grpasswd=''
832 i_grp=''
833 i_ieeefp=''
834 i_inttypes=''
835 i_langinfo=''
836 i_libutil=''
837 i_limits=''
838 i_locale=''
839 i_machcthr=''
840 i_malloc=''
841 i_math=''
842 i_memory=''
843 i_mntent=''
844 i_ndbm=''
845 i_netdb=''
846 i_neterrno=''
847 i_netinettcp=''
848 i_niin=''
849 i_sysin=''
850 i_poll=''
851 i_prot=''
852 i_pthread=''
853 d_pwage=''
854 d_pwchange=''
855 d_pwclass=''
856 d_pwcomment=''
857 d_pwexpire=''
858 d_pwgecos=''
859 d_pwpasswd=''
860 d_pwquota=''
861 i_pwd=''
862 i_sfio=''
863 i_shadow=''
864 i_socks=''
865 i_stddef=''
866 i_stdlib=''
867 i_string=''
868 strings=''
869 i_sunmath=''
870 i_sysaccess=''
871 i_sysdir=''
872 i_sysfile=''
873 d_voidtty=''
874 i_bsdioctl=''
875 i_sysfilio=''
876 i_sysioctl=''
877 i_syssockio=''
878 i_syslog=''
879 i_sysmman=''
880 i_sysmode=''
881 i_sysmount=''
882 i_sysndir=''
883 i_sysparam=''
884 i_sysresrc=''
885 i_syssecrt=''
886 i_sysselct=''
887 i_sysstat=''
888 i_sysstatfs=''
889 i_sysstatvfs=''
890 i_systimes=''
891 i_systypes=''
892 i_sysuio=''
893 i_sysun=''
894 i_sysutsname=''
895 i_sysvfs=''
896 i_syswait=''
897 i_sgtty=''
898 i_termio=''
899 i_termios=''
900 d_tm_tm_gmtoff=''
901 d_tm_tm_zone=''
902 i_systime=''
903 i_systimek=''
904 i_time=''
905 timeincl=''
906 i_unistd=''
907 i_ustat=''
908 i_utime=''
909 i_values=''
910 i_stdarg=''
911 i_varargs=''
912 i_varhdr=''
913 i_vfork=''
914 inc_version_list=''
915 inc_version_list_init=''
916 installprefix=''
917 installprefixexp=''
918 installstyle=''
919 installusrbinperl=''
920 intsize=''
921 longsize=''
922 shortsize=''
923 issymlink=''
924 libc=''
925 ldlibpthname=''
926 libperl=''
927 shrpenv=''
928 useshrplib=''
929 glibpth=''
930 libpth=''
931 loclibpth=''
932 plibpth=''
933 xlibpth=''
934 ignore_versioned_solibs=''
935 libs=''
936 libsdirs=''
937 libsfiles=''
938 libsfound=''
939 libspath=''
940 lns=''
941 d_PRIEUldbl=''
942 d_PRIFUldbl=''
943 d_PRIGUldbl=''
944 d_PRIeldbl=''
945 d_PRIfldbl=''
946 d_PRIgldbl=''
947 d_SCNfldbl=''
948 sPRIEUldbl=''
949 sPRIFUldbl=''
950 sPRIGUldbl=''
951 sPRIeldbl=''
952 sPRIfldbl=''
953 sPRIgldbl=''
954 sSCNfldbl=''
955 lseeksize=''
956 lseektype=''
957 make_set_make=''
958 d_mymalloc=''
959 freetype=''
960 mallocobj=''
961 mallocsrc=''
962 malloctype=''
963 usemallocwrap=''
964 usemymalloc=''
965 installman1dir=''
966 man1dir=''
967 man1direxp=''
968 man1ext=''
969 installman3dir=''
970 man3dir=''
971 man3direxp=''
972 man3ext=''
973 modetype=''
974 multiarch=''
975 mydomain=''
976 myhostname=''
977 phostname=''
978 c=''
979 n=''
980 d_eofnblk=''
981 eagain=''
982 o_nonblock=''
983 rd_nodata=''
984 need_va_copy=''
985 netdb_hlen_type=''
986 netdb_host_type=''
987 netdb_name_type=''
988 netdb_net_type=''
989 groupcat=''
990 hostcat=''
991 passcat=''
992 orderlib=''
993 ranlib=''
994 d_perl_otherlibdirs=''
995 otherlibdirs=''
996 package=''
997 spackage=''
998 pager=''
999 api_revision=''
1000 api_subversion=''
1001 api_version=''
1002 api_versionstring=''
1003 patchlevel=''
1004 perl_patchlevel=''
1005 revision=''
1006 subversion=''
1007 version=''
1008 version_patchlevel_string=''
1009 perl5=''
1010 perladmin=''
1011 perlpath=''
1012 d_nv_preserves_uv=''
1013 d_nv_zero_is_allbits_zero=''
1014 i16size=''
1015 i16type=''
1016 i32size=''
1017 i32type=''
1018 i64size=''
1019 i64type=''
1020 i8size=''
1021 i8type=''
1022 ivsize=''
1023 ivtype=''
1024 nv_preserves_uv_bits=''
1025 nvsize=''
1026 nvtype=''
1027 u16size=''
1028 u16type=''
1029 u32size=''
1030 u32type=''
1031 u64size=''
1032 u64type=''
1033 u8size=''
1034 u8type=''
1035 uvsize=''
1036 uvtype=''
1037 ivdformat=''
1038 nvEUformat=''
1039 nvFUformat=''
1040 nvGUformat=''
1041 nveformat=''
1042 nvfformat=''
1043 nvgformat=''
1044 uvXUformat=''
1045 uvoformat=''
1046 uvuformat=''
1047 uvxformat=''
1048 pidtype=''
1049 prefix=''
1050 prefixexp=''
1051 installprivlib=''
1052 privlib=''
1053 privlibexp=''
1054 prototype=''
1055 ptrsize=''
1056 d_PRIXU64=''
1057 d_PRId64=''
1058 d_PRIi64=''
1059 d_PRIo64=''
1060 d_PRIu64=''
1061 d_PRIx64=''
1062 sPRIXU64=''
1063 sPRId64=''
1064 sPRIi64=''
1065 sPRIo64=''
1066 sPRIu64=''
1067 sPRIx64=''
1068 d_quad=''
1069 quadkind=''
1070 quadtype=''
1071 uquadtype=''
1072 drand01=''
1073 randbits=''
1074 randfunc=''
1075 randseedtype=''
1076 seedfunc=''
1077 installscript=''
1078 scriptdir=''
1079 scriptdirexp=''
1080 selectminbits=''
1081 selecttype=''
1082 sh=''
1083 sig_count=''
1084 sig_name=''
1085 sig_name_init=''
1086 sig_num=''
1087 sig_num_init=''
1088 sig_size=''
1089 installsitearch=''
1090 sitearch=''
1091 sitearchexp=''
1092 installsitebin=''
1093 sitebin=''
1094 sitebinexp=''
1095 installsitehtml1dir=''
1096 sitehtml1dir=''
1097 sitehtml1direxp=''
1098 installsitehtml3dir=''
1099 sitehtml3dir=''
1100 sitehtml3direxp=''
1101 installsitelib=''
1102 sitelib=''
1103 sitelib_stem=''
1104 sitelibexp=''
1105 installsiteman1dir=''
1106 siteman1dir=''
1107 siteman1direxp=''
1108 installsiteman3dir=''
1109 siteman3dir=''
1110 siteman3direxp=''
1111 siteprefix=''
1112 siteprefixexp=''
1113 installsitescript=''
1114 sitescript=''
1115 sitescriptexp=''
1116 sizesize=''
1117 sizetype=''
1118 so=''
1119 socksizetype=''
1120 sharpbang=''
1121 shsharp=''
1122 spitshell=''
1123 src=''
1124 ssizetype=''
1125 startperl=''
1126 startsh=''
1127 stdchar=''
1128 d_stdio_stream_array=''
1129 stdio_stream_array=''
1130 sysman=''
1131 trnl=''
1132 uidformat=''
1133 uidsign=''
1134 uidsize=''
1135 uidtype=''
1136 archname64=''
1137 use64bitall=''
1138 use64bitint=''
1139 usefaststdio=''
1140 ccflags_uselargefiles=''
1141 ldflags_uselargefiles=''
1142 libswanted_uselargefiles=''
1143 uselargefiles=''
1144 uselongdouble=''
1145 usemorebits=''
1146 usemultiplicity=''
1147 nm_opt=''
1148 nm_so_opt=''
1149 runnm=''
1150 usenm=''
1151 useperlio=''
1152 userelocatableinc=''
1153 usesocks=''
1154 d_oldpthreads=''
1155 use5005threads=''
1156 useithreads=''
1157 usereentrant=''
1158 usethreads=''
1159 incpath=''
1160 mips_type=''
1161 usrinc=''
1162 d_vendorarch=''
1163 installvendorarch=''
1164 vendorarch=''
1165 vendorarchexp=''
1166 d_vendorbin=''
1167 installvendorbin=''
1168 vendorbin=''
1169 vendorbinexp=''
1170 installvendorhtml1dir=''
1171 vendorhtml1dir=''
1172 vendorhtml1direxp=''
1173 installvendorhtml3dir=''
1174 vendorhtml3dir=''
1175 vendorhtml3direxp=''
1176 d_vendorlib=''
1177 installvendorlib=''
1178 vendorlib=''
1179 vendorlib_stem=''
1180 vendorlibexp=''
1181 installvendorman1dir=''
1182 vendorman1dir=''
1183 vendorman1direxp=''
1184 installvendorman3dir=''
1185 vendorman3dir=''
1186 vendorman3direxp=''
1187 usevendorprefix=''
1188 vendorprefix=''
1189 vendorprefixexp=''
1190 d_vendorscript=''
1191 installvendorscript=''
1192 vendorscript=''
1193 vendorscriptexp=''
1194 versiononly=''
1195 defvoidused=''
1196 voidflags=''
1197 yacc=''
1198 yaccflags=''
1199 CONFIG=''
1200
1201 define='define'
1202 undef='undef'
1203 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1204 rmlist=''
1205
1206 : We must find out about Eunice early
1207 eunicefix=':'
1208 if test -f /etc/unixtovms; then
1209         eunicefix=/etc/unixtovms
1210 fi
1211 if test -f /etc/unixtovms.exe; then
1212         eunicefix=/etc/unixtovms.exe
1213 fi
1214
1215 : Set executable suffix now -- needed before hints available
1216 if test -f "/libs/version.library"; then
1217 : Amiga OS
1218     _exe=""
1219 elif test -f "/system/gnu_library/bin/ar.pm"; then
1220 : Stratus VOS
1221     _exe=".pm"
1222 elif test -n "$DJGPP"; then
1223 : DOS DJGPP
1224     _exe=".exe"
1225 elif test -d c:/. -o -n "$is_os2" ; then
1226 : OS/2 or cygwin
1227     _exe=".exe"
1228 fi
1229
1230 i_whoami=''
1231 ccname=''
1232 ccversion=''
1233 perllibs=''
1234 : set useposix=false in your hint file to disable the POSIX extension.
1235 useposix=true
1236 : set useopcode=false in your hint file to disable the Opcode extension.
1237 useopcode=true
1238 : Trailing extension.  Override this in a hint file, if needed.
1239 : Extra object files, if any, needed on this platform.
1240 archobjs=''
1241 archname=''
1242 : Possible local include directories to search.
1243 : Set locincpth to "" in a hint file to defeat local include searches.
1244 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1245 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1246 :
1247 : no include file wanted by default
1248 inclwanted=''
1249
1250 groupstype=''
1251 libnames=''
1252 : change the next line if compiling for Xenix/286 on Xenix/386
1253 xlibpth='/usr/lib/386 /lib/386'
1254 : Possible local library directories to search.
1255 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1256 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1257
1258 : general looking path for locating libraries
1259 glibpth="/lib /usr/lib $xlibpth"
1260 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1261 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1262 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1263
1264 : Private path used by Configure to find libraries.  Its value
1265 : is prepended to libpth. This variable takes care of special
1266 : machines, like the mips.  Usually, it should be empty.
1267 plibpth=''
1268
1269 : default library list
1270 libswanted=''
1271 : some systems want to use only the non-versioned libso:s
1272 ignore_versioned_solibs=''
1273 siteman1dir=''
1274 siteman3dir=''
1275 sitescript=''
1276 archname64=''
1277 ccflags_uselargefiles=''
1278 ldflags_uselargefiles=''
1279 libswanted_uselargefiles=''
1280 : set usemultiplicity on the Configure command line to enable multiplicity.
1281 : set usesocks on the Configure command line to enable socks.
1282 : set usethreads on the Configure command line to enable threads.
1283 usereentrant='undef'
1284 : full support for void wanted by default
1285 defvoidused=15
1286
1287 : List of libraries we want.
1288 : If anyone needs extra -lxxx, put those in a hint file.
1289 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1290 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1291 : We probably want to search /usr/shlib before most other libraries.
1292 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1293 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1294 glibpth="/usr/shlib $glibpth"
1295 : Do not use vfork unless overridden by a hint file.
1296 usevfork=false
1297
1298 : Find the basic shell for Bourne shell scripts
1299 case "$sh" in
1300 '')
1301         case "$SYSTYPE" in
1302         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1303         *) xxx='/bin/sh';;
1304         esac
1305         if test -f "$xxx"; then
1306                 sh="$xxx"
1307         else
1308                 : Build up a list and do a single loop so we can 'break' out.
1309                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1310                 for xxx in sh bash ksh pdksh ash; do
1311                         for p in $pth; do
1312                                 try="$try ${p}/${xxx}"
1313                         done
1314                 done
1315                 for xxx in $try; do
1316                         if test -f "$xxx"; then
1317                                 sh="$xxx";
1318                                 break
1319                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1320                                 sh="$xxx";
1321                                 break
1322                         elif test -f "$xxx.exe"; then
1323                                 sh="$xxx";
1324                                 break
1325                         fi
1326                 done
1327         fi
1328         ;;
1329 esac
1330
1331 case "$sh" in
1332 '')     cat >&2 <<EOM
1333 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1334
1335 Usually it's in /bin/sh.  How did you even get this far?
1336 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1337 we'll try to straighten this all out.
1338 EOM
1339         exit 1
1340         ;;
1341 esac
1342
1343 : see if sh knows # comments
1344 if `$sh -c '#' >/dev/null 2>&1`; then
1345         shsharp=true
1346         spitshell=cat
1347         xcat=/bin/cat
1348         test -f $xcat$_exe || xcat=/usr/bin/cat
1349         if test ! -f $xcat$_exe; then
1350                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1351                         if test -f $p/cat$_exe; then
1352                                 xcat=$p/cat
1353                                 break
1354                         fi
1355                 done
1356                 if test ! -f $xcat$_exe; then
1357                         echo "Can't find cat anywhere!"
1358                         exit 1
1359                 fi
1360         fi
1361         echo "#!$xcat" >sharp
1362         $eunicefix sharp
1363         chmod +x sharp
1364         ./sharp > today
1365         if test -s today; then
1366                 sharpbang='#!'
1367         else
1368                 echo "#! $xcat" > sharp
1369                 $eunicefix sharp
1370                 chmod +x sharp
1371                 ./sharp > today
1372                 if test -s today; then
1373                         sharpbang='#! '
1374                 else
1375                         sharpbang=': use '
1376                 fi
1377         fi
1378 else
1379         echo " "
1380         echo "Your $sh doesn't grok # comments--I will strip them later on."
1381         shsharp=false
1382         cd ..
1383         echo "exec grep -v '^[  ]*#'" >spitshell
1384         chmod +x spitshell
1385         $eunicefix spitshell
1386         spitshell=`pwd`/spitshell
1387         cd UU
1388         echo "I presume that if # doesn't work, #! won't work either!"
1389         sharpbang=': use '
1390 fi
1391 rm -f sharp today
1392
1393 : figure out how to guarantee sh startup
1394 case "$startsh" in
1395 '') startsh=${sharpbang}${sh} ;;
1396 *)
1397 esac
1398 cat >sharp <<EOSS
1399 $startsh
1400 set abc
1401 test "$?abc" != 1
1402 EOSS
1403
1404 chmod +x sharp
1405 $eunicefix sharp
1406 if ./sharp; then
1407         : echo "Yup, it does."
1408 else
1409         echo "Hmm... '$startsh' does not guarantee sh startup..."
1410         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1411 fi
1412 rm -f sharp
1413
1414
1415 : Save command line options in file UU/cmdline.opt for later use in
1416 : generating config.sh.
1417 cat > cmdline.opt <<EOSH
1418 # Configure command line arguments.
1419 config_arg0='$0'
1420 config_args='$*'
1421 config_argc=$#
1422 EOSH
1423 argn=1
1424 args_exp=''
1425 args_sep=''
1426 for arg in "$@"; do
1427         cat >>cmdline.opt <<EOSH
1428 config_arg$argn='$arg'
1429 EOSH
1430         # Extreme backslashitis: replace each ' by '"'"'
1431         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1432 $arg
1433 EOC
1434         arg_exp=`cat cmdl.opt`
1435         args_exp="$args_exp$args_sep'$arg_exp'"
1436         argn=`expr $argn + 1`
1437         args_sep=' '
1438 done
1439 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1440 # used by ./hints/os2.sh
1441 rm -f cmdl.opt
1442
1443 : produce awk script to parse command line options
1444 cat >options.awk <<'EOF'
1445 BEGIN {
1446         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1447
1448         len = length(optstr);
1449         for (i = 1; i <= len; i++) {
1450                 c = substr(optstr, i, 1);
1451                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1452                 if (a == ":") {
1453                         arg[c] = 1;
1454                         i++;
1455                 }
1456                 opt[c] = 1;
1457         }
1458 }
1459 {
1460         expect = 0;
1461         str = $0;
1462         if (substr(str, 1, 1) != "-") {
1463                 printf("'%s'\n", str);
1464                 next;
1465         }
1466         len = length($0);
1467         for (i = 2; i <= len; i++) {
1468                 c = substr(str, i, 1);
1469                 if (!opt[c]) {
1470                         printf("-%s\n", substr(str, i));
1471                         next;
1472                 }
1473                 printf("-%s\n", c);
1474                 if (arg[c]) {
1475                         if (i < len)
1476                                 printf("'%s'\n", substr(str, i + 1));
1477                         else
1478                                 expect = 1;
1479                         next;
1480                 }
1481         }
1482 }
1483 END {
1484         if (expect)
1485                 print "?";
1486 }
1487 EOF
1488
1489 : process the command line options
1490 set X `for arg in "$@"; do echo "X$arg"; done |
1491         sed -e s/X// | awk -f options.awk`
1492 eval "set $*"
1493 shift
1494 rm -f options.awk
1495
1496 : set up default values
1497 fastread=''
1498 reuseval=false
1499 config_sh=''
1500 alldone=''
1501 error=''
1502 silent=''
1503 extractsh=''
1504 override=''
1505 knowitall=''
1506 rm -f optdef.sh posthint.sh
1507 cat >optdef.sh <<EOS
1508 $startsh
1509 EOS
1510
1511
1512 : option parsing
1513 while test $# -gt 0; do
1514         case "$1" in
1515         -d) shift; fastread=yes;;
1516         -e) shift; alldone=cont;;
1517         -f)
1518                 shift
1519                 cd ..
1520                 if test -r "$1"; then
1521                         config_sh="$1"
1522                 else
1523                         echo "$me: cannot read config file $1." >&2
1524                         error=true
1525                 fi
1526                 cd UU
1527                 shift;;
1528         -h) shift; error=true;;
1529         -r) shift; reuseval=true;;
1530         -s) shift; silent=true; realsilent=true;;
1531         -E) shift; alldone=exit;;
1532         -K) shift; knowitall=true;;
1533         -O) shift; override=true;;
1534         -S) shift; silent=true; extractsh=true;;
1535         -D)
1536                 shift
1537                 case "$1" in
1538                 *=)
1539                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1540                         echo "$me: ignoring -D $1" >&2
1541                         ;;
1542                 *=*) echo "$1" | \
1543                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1544                 *) echo "$1='define'" >> optdef.sh;;
1545                 esac
1546                 shift
1547                 ;;
1548         -U)
1549                 shift
1550                 case "$1" in
1551                 *=) echo "$1" >> optdef.sh;;
1552                 *=*)
1553                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1554                         echo "$me: ignoring -U $1" >&2
1555                         ;;
1556                 *) echo "$1='undef'" >> optdef.sh;;
1557                 esac
1558                 shift
1559                 ;;
1560         -A)
1561             shift
1562             xxx=''
1563             yyy="$1"
1564             zzz=''
1565             uuu=undef
1566             case "$yyy" in
1567             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1568                  case "$zzz" in
1569                  *:*) zzz='' ;;
1570                  *)   xxx=append
1571                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1572                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1573                  esac
1574                  ;;
1575             esac
1576             case "$xxx" in
1577             '')  case "$yyy" in
1578                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1579                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1580                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1581                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1582                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1583                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1584                  esac
1585                  ;;       
1586             esac
1587             case "$xxx" in
1588             append)
1589                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1590             clear)
1591                 echo "$yyy=''"                  >> posthint.sh ;;
1592             define)
1593                 case "$zzz" in
1594                 '') zzz=define ;;
1595                 esac
1596                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1597             eval)
1598                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1599             prepend)
1600                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1601             undef)
1602                 case "$zzz" in
1603                 '') zzz="$uuu" ;;
1604                 esac
1605                 echo "$yyy=$zzz"                >> posthint.sh ;;
1606             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1607             esac
1608             shift
1609             ;;
1610         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1611             exit 0;;
1612         --) break;;
1613         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1614         *) break;;
1615         esac
1616 done
1617
1618 case "$error" in
1619 true)
1620         cat >&2 <<EOM
1621 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1622                  [-U symbol] [-U symbol=] [-A command:symbol...]
1623   -d : use defaults for all answers.
1624   -e : go on without questioning past the production of config.sh.
1625   -f : specify an alternate default configuration file.
1626   -h : print this help message and exit (with an error status).
1627   -r : reuse C symbols value if possible (skips costly nm extraction).
1628   -s : silent mode, only echoes questions and essential information.
1629   -D : define symbol to have some value:
1630          -D symbol         symbol gets the value 'define'
1631          -D symbol=value   symbol gets the value 'value'
1632   -E : stop at the end of questions, after having produced config.sh.
1633   -K : do not use unless you know what you are doing.
1634   -O : let -D and -U override definitions from loaded configuration file.
1635   -S : perform variable substitutions on all .SH files (can mix with -f)
1636   -U : undefine symbol:
1637          -U symbol    symbol gets the value 'undef'
1638          -U symbol=   symbol gets completely empty
1639   -A : manipulate symbol after the platform specific hints have been applied:
1640          -A symbol=value                append " "value to symbol
1641          -A append:symbol=value         append value to symbol
1642          -A define:symbol=value         define symbol to have value
1643          -A clear:symbol                define symbol to be ''
1644          -A define:symbol               define symbol to be 'define'
1645          -A eval:symbol=value           define symbol to be eval of value
1646          -A prepend:symbol=value        prepend value to symbol
1647          -A undef:symbol                define symbol to be 'undef'
1648          -A undef:symbol=               define symbol to be ''
1649   -V : print version number and exit (with a zero status).
1650 EOM
1651         exit 1
1652         ;;
1653 esac
1654
1655 : Sanity checks
1656 case "$fastread$alldone" in
1657 yescont|yesexit) ;;
1658 *)
1659         case "$extractsh" in
1660         true) ;;
1661         *)
1662                 if test ! -t 0; then
1663                         echo "Say 'sh Configure', not 'sh <Configure'"
1664                         exit 1
1665                 fi
1666                 ;;
1667         esac
1668         ;;
1669 esac
1670
1671 exec 4>&1
1672 case "$silent" in
1673 true) exec 1>/dev/null;;
1674 esac
1675
1676 : run the defines and the undefines, if any, but leave the file out there...
1677 touch optdef.sh
1678 . ./optdef.sh
1679 : create the posthint manipulation script and leave the file out there...
1680 touch posthint.sh
1681
1682 : set package name
1683 package=perl5
1684 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1685 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1686 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1687 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1688 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1689 esac
1690
1691 : Some greps do not return status, grrr.
1692 echo "grimblepritz" >grimble
1693 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1694         contains=contains
1695 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1696         contains=grep
1697 else
1698         contains=contains
1699 fi
1700 rm -f grimble
1701 : the following should work in any shell
1702 case "$contains" in
1703 contains*)
1704         echo " "
1705         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1706         cat >contains <<'EOSS'
1707 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1708 EOSS
1709 chmod +x contains
1710 esac
1711
1712 : Find the path to the source tree
1713 case "$src" in
1714 '') case "$0" in
1715     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1716          case "$src" in
1717          /*)    ;;
1718          .)     ;;
1719          *)     src=`cd ../$src && pwd` ;;
1720          esac
1721          ;;
1722     *)   src='.';;
1723     esac;;
1724 esac
1725 case "$src" in
1726 '')     src=/
1727         rsrc=/
1728         ;;
1729 /*) rsrc="$src";;
1730 *) rsrc="../$src";;
1731 esac
1732 if test -f $rsrc/Configure && \
1733         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1734 then
1735    : found it, so we are ok.
1736 else
1737         rsrc=''
1738         for src in . .. ../.. ../../.. ../../../..; do
1739                 if test -f ../$src/Configure && \
1740                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1741                 then
1742                         rsrc=../$src
1743                         break
1744                 fi
1745         done
1746 fi
1747 case "$rsrc" in
1748 '')
1749         cat <<EOM >&4
1750
1751 Sorry, I can't seem to locate the source dir for $package.  Please start
1752 Configure with an explicit path -- i.e. /some/path/Configure.
1753
1754 EOM
1755         exit 1
1756         ;;
1757 ../.)   rsrc='..';;
1758 *)
1759         echo " "
1760         echo "Sources for $package found in \"$src\"." >&4
1761         ;;
1762 esac
1763
1764 : script used to extract .SH files with variable substitutions
1765 cat >extract <<'EOS'
1766 PERL_CONFIG_SH=true
1767 echo "Doing variable substitutions on .SH files..."
1768 if test -f MANIFEST; then
1769         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1770 else
1771         echo "(Looking for .SH files under the source directory.)"
1772         set x `(cd "$src"; find . -name "*.SH" -print)`
1773 fi
1774 shift
1775 case $# in
1776 0) set x `(cd "$src"; echo *.SH)`; shift;;
1777 esac
1778 if test ! -f "$src/$1"; then
1779         shift
1780 fi
1781 mkdir_p='
1782 name=$1;
1783 create="";
1784 while test $name; do
1785         if test ! -d "$name"; then
1786                 create="$name $create";
1787                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1788                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1789         else
1790                 name="";
1791         fi;
1792 done;
1793 for file in $create; do
1794         mkdir $file;
1795 done
1796 '
1797 for file in $*; do
1798         case "$src" in
1799         ".")
1800                 case "$file" in
1801                 */*)
1802                         dir=`expr X$file : 'X\(.*\)/'`
1803                         file=`expr X$file : 'X.*/\(.*\)'`
1804                         (cd "$dir" && . ./$file)
1805                         ;;
1806                 *)
1807                         . ./$file
1808                         ;;
1809                 esac
1810                 ;;
1811         *)
1812                 case "$file" in
1813                 */*)
1814                         dir=`expr X$file : 'X\(.*\)/'`
1815                         file=`expr X$file : 'X.*/\(.*\)'`
1816                         (set x $dir; shift; eval $mkdir_p)
1817                         sh <"$src/$dir/$file"
1818                         ;;
1819                 *)
1820                         sh <"$src/$file"
1821                         ;;
1822                 esac
1823                 ;;
1824         esac
1825 done
1826 if test -f "$src/config_h.SH"; then
1827         if test ! -f config.h; then
1828         : oops, they left it out of MANIFEST, probably, so do it anyway.
1829         . "$src/config_h.SH"
1830         fi
1831 fi
1832 EOS
1833
1834 : extract files and exit if asked to do so
1835 case "$extractsh" in
1836 true)
1837         case "$realsilent" in
1838         true) ;;
1839         *) exec 1>&4;;
1840         esac
1841         case "$config_sh" in
1842         '') config_sh='config.sh';;
1843         esac
1844         echo " "
1845         echo "Fetching answers from $config_sh..."
1846         cd ..
1847         . $config_sh
1848         test "$override" && . ./optdef.sh
1849         echo " "
1850         . UU/extract
1851         rm -rf UU
1852         echo "Extraction done."
1853         exit 0
1854         ;;
1855 esac
1856
1857 : Eunice requires " " instead of "", can you believe it
1858 echo " "
1859 : Here we go...
1860 echo "Beginning of configuration questions for $package."
1861
1862 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1863
1864 : first determine how to suppress newline on echo command
1865 echo " "
1866 echo "Checking echo to see how to suppress newlines..."
1867 (echo "hi there\c" ; echo " ") >.echotmp
1868 if $contains c .echotmp >/dev/null 2>&1 ; then
1869         echo "...using -n."
1870         n='-n'
1871         c=''
1872 else
1873         cat <<'EOM'
1874 ...using \c
1875 EOM
1876         n=''
1877         c='\c'
1878 fi
1879 echo $n "The star should be here-->$c"
1880 echo '*'
1881 rm -f .echotmp
1882
1883 : Now test for existence of everything in MANIFEST
1884 echo " "
1885 if test -f "$rsrc/MANIFEST"; then
1886         echo "First let's make sure your kit is complete.  Checking..." >&4
1887         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1888         rm -f missing
1889         tmppwd=`pwd`
1890         for filelist in x??; do
1891                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1892         done
1893         if test -s missing; then
1894                 cat missing >&4
1895                 cat >&4 <<'EOM'
1896
1897 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1898
1899 You have the option of continuing the configuration process, despite the
1900 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1901 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1902 and contact the author (perlbug@perl.org).
1903
1904 EOM
1905                 echo $n "Continue? [n] $c" >&4
1906                 read ans
1907                 case "$ans" in
1908                 y*)
1909                         echo "Continuing..." >&4
1910                         rm -f missing
1911                         ;;
1912                 *)
1913                         echo "ABORTING..." >&4
1914                         kill $$
1915                         ;;
1916                 esac
1917         else
1918                 echo "Looks good..."
1919         fi
1920 else
1921         echo "There is no MANIFEST file.  I hope your kit is complete !"
1922 fi
1923 rm -f missing x??
1924
1925 echo " "
1926 : Find the appropriate value for a newline for tr
1927 if test -n "$DJGPP"; then
1928        trnl='\012'
1929 fi
1930 if test X"$trnl" = X; then
1931         case "`echo foo|tr '\n' x 2>/dev/null`" in
1932         foox) trnl='\n' ;;
1933         esac
1934 fi
1935 if test X"$trnl" = X; then
1936         case "`echo foo|tr '\012' x 2>/dev/null`" in
1937         foox) trnl='\012' ;;
1938         esac
1939 fi
1940 if test X"$trnl" = X; then
1941        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1942        fooxy) trnl='\n\r' ;;
1943        esac
1944 fi
1945 if test X"$trnl" = X; then
1946         cat <<EOM >&2
1947
1948 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1949
1950 EOM
1951         exit 1
1952 fi
1953
1954 : compute the number of columns on the terminal for proper question formatting
1955 case "$COLUMNS" in
1956 '') COLUMNS='80';;
1957 esac
1958
1959 : set up the echo used in my read
1960 myecho="case \"\$xxxm\" in
1961 '') echo $n \"\$rp $c\" >&4;;
1962 *) case \"\$rp\" in
1963         '') echo $n \"[\$xxxm] $c\";;
1964         *)
1965                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1966                         echo \"\$rp\" >&4
1967                         echo $n \"[\$xxxm] $c\" >&4
1968                 else
1969                         echo $n \"\$rp [\$xxxm] $c\" >&4
1970                 fi
1971                 ;;
1972         esac;;
1973 esac"
1974
1975 : now set up to do reads with possible shell escape and default assignment
1976 cat <<EOSC >myread
1977 $startsh
1978 xxxm=\$dflt
1979 $myecho
1980 ans='!'
1981 case "\$fastread" in
1982 yes) case "\$dflt" in
1983         '') ;;
1984         *) ans='';
1985                 case "\$silent-\$rp" in
1986                 true-) ;;
1987                 *) echo " " >&4;;
1988                 esac;;
1989         esac;;
1990 *) case "\$silent" in
1991         true) case "\$rp" in
1992                 '') ans='';;
1993                 esac;;
1994         esac;;
1995 esac
1996 while expr "X\$ans" : "X!" >/dev/null; do
1997         read answ
1998         set x \$xxxm
1999         shift
2000         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2001         case  "\$answ" in
2002         "!")
2003                 sh 1>&4
2004                 echo " "
2005                 $myecho
2006                 ;;
2007         !*)
2008                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2009                 shift
2010                 sh 1>&4 -c "\$*"
2011                 echo " "
2012                 $myecho
2013                 ;;
2014         "\$ans")
2015                 case "\$ans" in
2016                 \\&*)
2017                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2018                         shift
2019                         case "\$1" in
2020                         -d)
2021                                 fastread=yes
2022                                 echo "(OK, I'll run with -d after this question.)" >&4
2023                                 ;;
2024                         -*)
2025                                 echo "*** Sorry, \$1 not supported yet." >&4
2026                                 ;;
2027                         esac
2028                         $myecho
2029                         ans=!
2030                         ;;
2031                 esac;;
2032         *)
2033                 case "\$aok" in
2034                 y)
2035                         echo "*** Substitution done -- please confirm."
2036                         xxxm="\$ans"
2037                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2038                         xxxm="\$ans"
2039                         ans=!
2040                         ;;
2041                 *)
2042                         echo "*** Error -- try again."
2043                         ans=!
2044                         ;;
2045                 esac
2046                 $myecho
2047                 ;;
2048         esac
2049         case "\$ans\$xxxm\$nostick" in
2050         '')
2051                 ans=!
2052                 $myecho
2053                 ;;
2054         esac
2055 done
2056 case "\$ans" in
2057 '') ans="\$xxxm";;
2058 esac
2059 EOSC
2060
2061 : create .config dir to save info across Configure sessions
2062 test -d ../.config || mkdir ../.config
2063 cat >../.config/README <<EOF
2064 This directory created by Configure to save information that should
2065 persist across sessions for $package.
2066
2067 You may safely delete it if you wish.
2068 EOF
2069
2070 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2071 case "$usedevel" in
2072 $define|true|[yY]*) ;;
2073 *) case "$xversion" in
2074    *[13579])
2075         cat >&4 <<EOH
2076 *** WHOA THERE!!! ***
2077
2078     This is an UNSTABLE DEVELOPMENT release.
2079     The version of this $package distribution is $xversion, that is, odd,
2080     (as opposed to even) and that signifies a development release.
2081     If you want a maintenance release, you want an even-numbered version.
2082
2083     Do ***NOT*** install this into production use.
2084     Data corruption and crashes are possible.
2085
2086     It is most seriously suggested that you do not continue any further
2087     unless you want to help in developing and debugging Perl.
2088
2089     If you *still* want to build perl, you can answer 'y' now,
2090     or pass -Dusedevel to Configure.
2091
2092 EOH
2093         rp='Do you really want to continue?'
2094         dflt='n'
2095         . ./myread
2096         case "$ans" in
2097         [yY]) echo >&4 "Okay, continuing."
2098               usedevel="$define" ;;
2099         *) echo >&4 "Okay, bye."
2100            exit 1
2101            ;;
2102         esac
2103         ;;
2104     esac
2105     ;;
2106 esac
2107 case "$usedevel" in
2108 $define|true|[yY]*)
2109         case "$versiononly" in
2110         '') versiononly="$define" ;;
2111         esac
2112         case "$installusrbinperl" in
2113         '') installusrbinperl="$undef" ;;
2114         esac
2115         ;;
2116 esac
2117
2118 : general instructions
2119 needman=true
2120 firsttime=true
2121 user=`(logname) 2>/dev/null`
2122 case "$user" in
2123 '') user=`whoami 2>&1`;;
2124 esac
2125 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2126         firsttime=false
2127         echo " "
2128         rp='Would you like to see the instructions?'
2129         dflt=n
2130         . ./myread
2131         case "$ans" in
2132         [yY]*) ;;
2133         *) needman=false;;
2134         esac
2135 fi
2136 if $needman; then
2137         cat <<EOH
2138
2139 This installation shell script will examine your system and ask you questions
2140 to determine how the perl5 package should be installed. If you get
2141 stuck on a question, you may use a ! shell escape to start a subshell or
2142 execute a command.  Many of the questions will have default answers in square
2143 brackets; typing carriage return will give you the default.
2144
2145 On some of the questions which ask for file or directory names you are allowed
2146 to use the ~name construct to specify the login directory belonging to "name",
2147 even if you don't have a shell which knows about that.  Questions where this is
2148 allowed will be marked "(~name ok)".
2149
2150 EOH
2151         rp=''
2152         dflt='Type carriage return to continue'
2153         . ./myread
2154         cat <<'EOH'
2155
2156 The prompter used in this script allows you to use shell variables and
2157 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2158 in the default answer, as if the default line was a set of arguments given to a
2159 script shell.  This means you may also use $* to repeat the whole default line,
2160 so you do not have to re-type everything to add something to the default.
2161
2162 Everytime there is a substitution, you will have to confirm.  If there is an
2163 error (e.g. an unmatched backtick), the default answer will remain unchanged
2164 and you will be prompted again.
2165
2166 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2167 the questions and use the computed defaults (or the previous answers if there
2168 was already a config.sh file). Type 'Configure -h' for a list of options.
2169 You may also start interactively and then answer '& -d' at any prompt to turn
2170 on the non-interactive behaviour for the remainder of the execution.
2171
2172 EOH
2173         . ./myread
2174         cat <<EOH
2175
2176 Much effort has been expended to ensure that this shell script will run on any
2177 Unix system.  If despite that it blows up on yours, your best bet is to edit
2178 Configure and run it again.  If you can't run Configure for some reason,
2179 you'll have to generate a config.sh file by hand.  Whatever problems you
2180 have, let me (perlbug@perl.org) know how I blew it.
2181
2182 This installation script affects things in two ways:
2183
2184 1) it may do direct variable substitutions on some of the files included
2185    in this kit.
2186 2) it builds a config.h file for inclusion in C programs.  You may edit
2187    any of these files as the need arises after running this script.
2188
2189 If you make a mistake on a question, there is no easy way to back up to it
2190 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2191 files.  Configure will offer to let you do this before it runs the SH files.
2192
2193 EOH
2194         dflt='Type carriage return to continue'
2195         . ./myread
2196         case "$firsttime" in
2197         true) echo $user >>../.config/instruct;;
2198         esac
2199 fi
2200
2201 : find out where common programs are
2202 echo " "
2203 echo "Locating common programs..." >&4
2204 cat <<EOSC >loc
2205 $startsh
2206 case \$# in
2207 0) exit 1;;
2208 esac
2209 thing=\$1
2210 shift
2211 dflt=\$1
2212 shift
2213 for dir in \$*; do
2214         case "\$thing" in
2215         .)
2216         if test -d \$dir/\$thing; then
2217                 echo \$dir
2218                 exit 0
2219         fi
2220         ;;
2221         *)
2222         for thisthing in \$dir/\$thing; do
2223                 : just loop through to pick last item
2224         done
2225         if test -f \$thisthing; then
2226                 echo \$thisthing
2227                 exit 0
2228         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2229                 echo \$thisthing
2230                 exit 0
2231         elif test -f \$dir/\$thing.exe; then
2232                 if test -n "$DJGPP"; then
2233                         echo \$dir/\$thing.exe
2234                 elif test "$eunicefix" != ":"; then
2235                         : on Eunice apparently
2236                         echo \$dir/\$thing
2237                         exit 0
2238                 fi
2239                 exit 0
2240         fi
2241         ;;
2242         esac
2243 done
2244 echo \$dflt
2245 exit 1
2246 EOSC
2247 chmod +x loc
2248 $eunicefix loc
2249 loclist="
2250 awk
2251 cat
2252 chmod
2253 comm
2254 cp
2255 echo
2256 expr
2257 grep
2258 ls
2259 mkdir
2260 rm
2261 sed
2262 sort
2263 touch
2264 tr
2265 uniq
2266 "
2267 trylist="
2268 Mcc
2269 ar
2270 bison
2271 byacc
2272 cpp
2273 csh
2274 date
2275 egrep
2276 gmake
2277 gzip
2278 less
2279 ln
2280 make
2281 more
2282 nm
2283 nroff
2284 pg
2285 test
2286 uname
2287 zip
2288 "
2289 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2290 pth="$pth /lib /usr/lib"
2291 for file in $loclist; do
2292         eval xxx=\$$file
2293         case "$xxx" in
2294         /*|?:[\\/]*)
2295                 if test -f "$xxx"; then
2296                         : ok
2297                 else
2298                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2299                         xxx=`./loc $file $file $pth`
2300                 fi
2301                 ;;
2302         '') xxx=`./loc $file $file $pth`;;
2303         *) xxx=`./loc $xxx $xxx $pth`;;
2304         esac
2305         eval $file=$xxx$_exe
2306         eval _$file=$xxx
2307         case "$xxx" in
2308         /*)
2309                 echo $file is in $xxx.
2310                 ;;
2311         ?:[\\/]*)
2312                 echo $file is in $xxx.
2313                 ;;
2314         *)
2315                 echo "I don't know where '$file' is, and my life depends on it." >&4
2316                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2317                 exit 1
2318                 ;;
2319         esac
2320 done
2321 echo " "
2322 echo "Don't worry if any of the following aren't found..."
2323 say=offhand
2324 for file in $trylist; do
2325         eval xxx=\$$file
2326         case "$xxx" in
2327         /*|?:[\\/]*)
2328                 if test -f "$xxx"; then
2329                         : ok
2330                 else
2331                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2332                         xxx=`./loc $file $file $pth`
2333                 fi
2334                 ;;
2335         '') xxx=`./loc $file $file $pth`;;
2336         *) xxx=`./loc $xxx $xxx $pth`;;
2337         esac
2338         eval $file=$xxx$_exe
2339         eval _$file=$xxx
2340         case "$xxx" in
2341         /*)
2342                 echo $file is in $xxx.
2343                 ;;
2344         ?:[\\/]*)
2345                 echo $file is in $xxx.
2346                 ;;
2347         *)
2348                 echo "I don't see $file out there, $say."
2349                 say=either
2350                 ;;
2351         esac
2352 done
2353 case "$egrep" in
2354 egrep)
2355         echo "Substituting grep for egrep."
2356         egrep=$grep
2357         _egrep=$grep
2358         ;;
2359 esac
2360 case "$ln" in
2361 ln)
2362         echo "Substituting cp for ln."
2363         ln=$cp
2364         _ln=$cp
2365         ;;
2366 esac
2367 case "$make" in
2368 make)   
2369         case "$gmake" in
2370         gmake)
2371         echo "I can't find make or gmake, and my life depends on it." >&4
2372         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2373         exit 1
2374         ;;
2375         esac
2376         ;;
2377 esac    
2378 case "$gmake" in
2379 gmake)  ;;
2380 *)      # We can't have osname yet.
2381         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2382                 # Assume that gmake, if found, is definitely GNU make
2383                 # and prefer it over the system make.
2384                 echo "Substituting gmake for make."
2385                 make=$gmake
2386                 _make=$gmake
2387         fi
2388         ;;
2389 esac
2390 case "$test" in
2391 test)
2392         echo "Hopefully test is built into your sh."
2393         ;;
2394 *)
2395         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2396                 echo "Using the test built into your sh."
2397                 test=test
2398                 _test=test
2399         fi
2400         ;;
2401 esac
2402 case "$echo" in
2403 echo)
2404         echo "Hopefully echo is built into your sh."
2405         ;;
2406 '') ;;
2407 *)
2408         echo " "
2409 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2410         $echo $n "hi there$c" >foo1
2411         echo $n "hi there$c" >foo2
2412         if cmp foo1 foo2 >/dev/null 2>&1; then
2413                 echo "They are compatible.  In fact, they may be identical."
2414         else
2415                 case "$n" in
2416                 '-n') n='' c='\c';;
2417                 *) n='-n' c='';;
2418                 esac
2419                 cat <<FOO
2420 They are not compatible!  You are probably running ksh on a non-USG system.
2421 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2422 have echo built in and we may have to run some Bourne shell scripts.  That
2423 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2424
2425 FOO
2426                 $echo $n "The star should be here-->$c"
2427                 $echo "*"
2428         fi
2429         $rm -f foo1 foo2
2430         ;;
2431 esac
2432
2433 cat <<EOS >trygcc
2434 $startsh
2435 EOS
2436 cat <<'EOSC' >>trygcc
2437 case "$cc" in
2438 '') ;;
2439 *)  $rm -f try try.*
2440     $cat >try.c <<EOM
2441 int main(int argc, char *argv[]) {
2442   return 0;
2443 }
2444 EOM
2445     if $cc -o try $ccflags $ldflags try.c; then
2446        :
2447     else
2448         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2449         despair=yes
2450         trygcc=yes
2451         case "$cc" in
2452         *gcc*) trygcc=no ;;
2453         esac
2454         case "`$cc -v -c try.c 2>&1`" in
2455         *gcc*) trygcc=no ;;
2456         esac
2457         if $test X"$trygcc" = Xyes; then
2458             if gcc -o try -c try.c; then
2459                 echo " "
2460                 echo "You seem to have a working gcc, though." >&4
2461                 rp="Would you like to use it?"
2462                 dflt=y
2463                 if $test -f myread; then
2464                     . ./myread
2465                 else
2466                     if $test -f UU/myread; then
2467                         . ./UU/myread
2468                     else
2469                         echo "Cannot find myread, sorry.  Aborting." >&2
2470                         exit 1
2471                     fi
2472                 fi  
2473                 case "$ans" in
2474                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2475                        if $test -f usethreads.cbu; then
2476                            $cat >&4 <<EOM 
2477
2478 *** However, any setting of the C compiler flags (e.g. for thread support)
2479 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2480 *** (together with e.g. -Dusethreads).
2481
2482 EOM
2483                        fi;;
2484                 esac
2485             fi
2486         fi
2487     fi
2488     $rm -f try try.*
2489     ;;
2490 esac
2491 EOSC
2492
2493 cat <<EOS >checkcc
2494 $startsh
2495 EOS
2496 cat <<'EOSC' >>checkcc
2497 case "$cc" in        
2498 '') ;;
2499 *)  $rm -f try try.*              
2500     $cat >try.c <<EOM
2501 int main(int argc, char *argv[]) {
2502   return 0;
2503 }
2504 EOM
2505     if $cc -o try $ccflags $ldflags try.c; then
2506        :
2507     else
2508         if $test X"$despair" = Xyes; then
2509            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2510         fi
2511         $cat >&4 <<EOM         
2512 You need to find a working C compiler.
2513 Either (purchase and) install the C compiler supplied by your OS vendor,
2514 or for a free C compiler try http://gcc.gnu.org/
2515 I cannot continue any further, aborting.
2516 EOM
2517         exit 1
2518     fi
2519     $rm -f try try.*
2520     ;;
2521 esac
2522 EOSC
2523
2524 : determine whether symbolic links are supported
2525 echo " "
2526 $touch blurfl
2527 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2528         echo "Symbolic links are supported." >&4
2529         lns="$ln -s"
2530 else
2531         echo "Symbolic links are NOT supported." >&4
2532         lns="$ln"
2533 fi
2534 $rm -f blurfl sym
2535
2536 : determine whether symbolic links are supported
2537 echo " "
2538 case "$lns" in
2539 *"ln"*" -s")
2540         echo "Checking how to test for symbolic links..." >&4
2541         $lns blurfl sym
2542         if $test "X$issymlink" = X; then
2543                 case "$newsh" in
2544                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2545                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2546                 esac
2547                 if test $? = 0; then
2548                         issymlink="test -h"
2549                 else
2550                         echo "Your builtin 'test -h' may be broken." >&4
2551                         case "$test" in
2552                         /*)     ;;
2553                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2554                                 for p in $pth
2555                                 do
2556                                         if test -f "$p/$test"; then
2557                                                 test="$p/$test"
2558                                                 break
2559                                         fi
2560                                 done
2561                                 ;;
2562                         esac
2563                         case "$test" in
2564                         /*)
2565                                 echo "Trying external '$test -h'." >&4
2566                                 issymlink="$test -h"
2567                                 if $test ! -h sym >/dev/null 2>&1; then
2568                                         echo "External '$test -h' is broken, too." >&4
2569                                         issymlink=''
2570                                 fi
2571                                 ;;
2572                         *)      issymlink='' ;;
2573                         esac
2574                 fi              
2575         fi
2576         if $test "X$issymlink" = X; then
2577                 if $test -L sym 2>/dev/null; then
2578                         issymlink="$test -L"
2579                         echo "The builtin '$test -L' worked." >&4
2580                 fi
2581         fi
2582         if $test "X$issymlink" != X; then
2583                 echo "You can test for symbolic links with '$issymlink'." >&4
2584         else
2585                 echo "I do not know how you can test for symbolic links." >&4
2586         fi
2587         $rm -f blurfl sym
2588         ;;
2589 *)      echo "No symbolic links, so not testing for their testing..." >&4
2590         ;;
2591 esac
2592 echo " "
2593
2594
2595 case "$mksymlinks" in
2596 $define|true|[yY]*)
2597         case "$src" in
2598         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2599                 exit 1
2600                 ;;
2601         *)      case "$lns:$issymlink" in
2602                 *"ln"*" -s:"*"test -"?)
2603                         echo "Creating the symbolic links..." >&4
2604                         echo "(First creating the subdirectories...)" >&4
2605                         cd ..
2606                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2607                                 read directory
2608                                 test -z "$directory" && break
2609                                 mkdir -p $directory
2610                         done
2611                         # Sanity check 1.
2612                         if test ! -d t/base; then
2613                                 echo "Failed to create the subdirectories.  Aborting." >&4
2614                                 exit 1
2615                         fi
2616                         echo "(Then creating the symlinks...)" >&4
2617                         awk '{print $1}' $src/MANIFEST | while true; do
2618                                 read filename
2619                                 test -z "$filename" && break
2620                                 if test -f $filename; then
2621                                         if $issymlink $filename; then
2622                                                 rm -f $filename
2623                                         fi
2624                                 fi
2625                                 if test -f $filename; then
2626                                         echo "$filename already exists, not symlinking."
2627                                 else
2628                                         ln -s $src/$filename $filename
2629                                 fi
2630                         done
2631                         # Sanity check 2.
2632                         if test ! -f t/base/lex.t; then
2633                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2634                                 exit 1
2635                         fi
2636                         cd UU
2637                         ;;
2638                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2639                         ;;
2640                 esac
2641                 ;;
2642         esac
2643         ;;
2644 esac
2645
2646
2647 case "$usecrosscompile" in
2648 $define|true|[yY]*)
2649         $echo "Cross-compiling..."
2650         croak=''
2651         case "$cc" in
2652         *-*-gcc) # A cross-compiling gcc, probably.
2653             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2654             ar=$targetarch-ar
2655             # leave out ld, choosing it is more complex
2656             nm=$targetarch-nm
2657             ranlib=$targetarch-ranlib
2658             $echo 'extern int foo;' > try.c
2659             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2660             shift
2661             if $test $# -gt 0; then
2662                 incpth="$incpth $*"
2663                 incpth="`$echo $incpth|$sed 's/^ //'`"
2664                 echo "Guessing incpth '$incpth'." >&4
2665                 for i in $*; do
2666                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2667                     if $test -d $j; then
2668                         libpth="$libpth $j"
2669                     fi
2670                 done   
2671                 libpth="`$echo $libpth|$sed 's/^ //'`"
2672                 echo "Guessing libpth '$libpth'." >&4
2673             fi
2674             $rm -f try.c
2675             ;;
2676         esac
2677         case "$targetarch" in
2678         '') echo "Targetarch not defined." >&4; croak=y ;;
2679         *)  echo "Using targetarch $targetarch." >&4 ;;
2680         esac
2681         case "$incpth" in
2682         '') echo "Incpth not defined." >&4; croak=y ;;
2683         *)  echo "Using incpth '$incpth'." >&4 ;;
2684         esac
2685         case "$libpth" in
2686         '') echo "Libpth not defined." >&4; croak=y ;;
2687         *)  echo "Using libpth '$libpth'." >&4 ;;
2688         esac
2689         case "$usrinc" in
2690         '') for i in $incpth; do
2691                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2692                     usrinc=$i
2693                     echo "Guessing usrinc $usrinc." >&4
2694                     break
2695                 fi
2696             done
2697             case "$usrinc" in
2698             '') echo "Usrinc not defined." >&4; croak=y ;;
2699             esac
2700             ;;
2701         *)  echo "Using usrinc $usrinc." >&4 ;;
2702         esac
2703         case "$targethost" in
2704         '') echo "Targethost not defined." >&4; croak=y ;;
2705         *)  echo "Using targethost $targethost." >&4
2706         esac
2707         locincpth=' '
2708         loclibpth=' '
2709         case "$croak" in
2710         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2711         esac
2712         case "$src" in
2713         /*) run=$src/Cross/run
2714             targetmkdir=$src/Cross/mkdir
2715             to=$src/Cross/to
2716             from=$src/Cross/from
2717             ;;
2718         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2719             run=$pwd/Cross/run
2720             targetmkdir=$pwd/Cross/mkdir
2721             to=$pwd/Cross/to
2722             from=$pwd/Cross/from
2723             ;;
2724         esac
2725         case "$targetrun" in
2726         '') targetrun=ssh ;;
2727         esac
2728         case "$targetto" in
2729         '') targetto=scp ;;
2730         esac
2731         case "$targetfrom" in
2732         '') targetfrom=scp ;;
2733         esac
2734         run=$run-$targetrun
2735         to=$to-$targetto
2736         from=$from-$targetfrom
2737         case "$targetdir" in
2738         '')  targetdir=/tmp
2739              echo "Guessing targetdir $targetdir." >&4
2740              ;;
2741         esac
2742         case "$targetuser" in
2743         '')  targetuser=root
2744              echo "Guessing targetuser $targetuser." >&4
2745              ;;
2746         esac
2747         case "$targetfrom" in
2748         scp)    q=-q ;;
2749         *)      q='' ;;
2750         esac
2751         case "$targetrun" in
2752         ssh|rsh)
2753             cat >$run <<EOF
2754 #!/bin/sh
2755 case "\$1" in
2756 -cwd)
2757   shift
2758   cwd=\$1
2759   shift
2760   ;;
2761 esac
2762 case "\$cwd" in
2763 '') cwd=$targetdir ;;
2764 esac
2765 exe=\$1
2766 shift
2767 if $test ! -f \$exe.xok; then
2768   $to \$exe
2769   $touch \$exe.xok
2770 fi
2771 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2772 EOF
2773             ;;
2774         *)  echo "Unknown targetrun '$targetrun'" >&4
2775             exit 1
2776             ;;
2777         esac
2778         case "$targetmkdir" in
2779         */Cross/mkdir)
2780             cat >$targetmkdir <<EOF
2781 #!/bin/sh
2782 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2783 EOF
2784             $chmod a+rx $targetmkdir
2785             ;;
2786         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2787             exit 1
2788             ;;
2789         esac
2790         case "$targetto" in
2791         scp|rcp)
2792             cat >$to <<EOF
2793 #!/bin/sh
2794 for f in \$@
2795 do
2796   case "\$f" in
2797   /*)
2798     $targetmkdir \`dirname \$f\`
2799     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2800     ;;
2801   *)
2802     $targetmkdir $targetdir/\`dirname \$f\`
2803     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2804     ;;
2805   esac
2806 done
2807 exit 0
2808 EOF
2809             ;;
2810         cp) cat >$to <<EOF
2811 #!/bin/sh
2812 for f in \$@
2813 do
2814   case "\$f" in
2815   /*)
2816     $mkdir -p $targetdir/\`dirname \$f\`
2817     $cp \$f $targetdir/\$f || exit 1
2818     ;;
2819   *)
2820     $targetmkdir $targetdir/\`dirname \$f\`
2821     $cp \$f $targetdir/\$f || exit 1
2822     ;;
2823   esac
2824 done
2825 exit 0
2826 EOF
2827             ;;
2828         *)  echo "Unknown targetto '$targetto'" >&4
2829             exit 1
2830             ;;
2831         esac
2832         case "$targetfrom" in
2833         scp|rcp)
2834           cat >$from <<EOF
2835 #!/bin/sh
2836 for f in \$@
2837 do
2838   $rm -f \$f
2839   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2840 done
2841 exit 0
2842 EOF
2843             ;;
2844         cp) cat >$from <<EOF
2845 #!/bin/sh
2846 for f in \$@
2847 do
2848   $rm -f \$f
2849   cp $targetdir/\$f . || exit 1
2850 done
2851 exit 0
2852 EOF
2853             ;;
2854         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2855             exit 1
2856             ;;
2857         esac
2858         if $test ! -f $run; then
2859             echo "Target 'run' script '$run' not found." >&4
2860         else
2861             $chmod a+rx $run
2862         fi
2863         if $test ! -f $to; then
2864             echo "Target 'to' script '$to' not found." >&4
2865         else
2866             $chmod a+rx $to
2867         fi
2868         if $test ! -f $from; then
2869             echo "Target 'from' script '$from' not found." >&4
2870         else
2871             $chmod a+rx $from
2872         fi
2873         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2874             exit 1
2875         fi
2876         cat >&4 <<EOF
2877 Using '$run' for remote execution,
2878 and '$from' and '$to'
2879 for remote file transfer.
2880 EOF
2881         ;;
2882 *)      run=''
2883         to=:
2884         from=:
2885         usecrosscompile='undef'
2886         targetarch=''
2887         ;;
2888 esac
2889
2890 : see whether [:lower:] and [:upper:] are supported character classes
2891 echo " "
2892 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2893 ABYZ)
2894         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2895         up='[:upper:]'
2896         low='[:lower:]'
2897         ;;
2898 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2899         # (0xd9 and 0xe2), therefore that is a nice testing point.
2900         if test "X$up" = X -o "X$low" = X; then
2901             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2902             rs) up='[A-Z]'
2903                 low='[a-z]'
2904                 ;;
2905             esac
2906         fi
2907         if test "X$up" = X -o "X$low" = X; then
2908             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2909             rs) up='A-Z'
2910                 low='a-z'
2911                 ;;
2912             esac
2913         fi
2914         if test "X$up" = X -o "X$low" = X; then
2915             case "`echo RS | od -x 2>/dev/null`" in
2916             *D9E2*|*d9e2*)
2917                 echo "Hey, this might be EBCDIC." >&4
2918                 if test "X$up" = X -o "X$low" = X; then
2919                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2920                     rs) up='[A-IJ-RS-Z]'
2921                         low='[a-ij-rs-z]'
2922                         ;;
2923                     esac
2924                 fi
2925                 if test "X$up" = X -o "X$low" = X; then
2926                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2927                     rs) up='A-IJ-RS-Z'
2928                         low='a-ij-rs-z'
2929                         ;;
2930                     esac
2931                 fi
2932                 ;;
2933             esac
2934         fi
2935 esac
2936 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2937 rs)
2938     echo "Using $up and $low to convert case." >&4
2939     ;;
2940 *)
2941     echo "I don't know how to translate letters from upper to lower case." >&4
2942     echo "Your tr is not acting any way I know of." >&4
2943     exit 1
2944     ;;
2945 esac
2946 : set up the translation script tr, must be called with ./tr of course
2947 cat >tr <<EOSC
2948 $startsh
2949 case "\$1\$2" in
2950 '[A-Z][a-z]') exec $tr '$up' '$low';;
2951 '[a-z][A-Z]') exec $tr '$low' '$up';;
2952 esac
2953 exec $tr "\$@"
2954 EOSC
2955 chmod +x tr
2956 $eunicefix tr
2957
2958 : Try to determine whether config.sh was made on this system
2959 case "$config_sh" in
2960 '')
2961 myuname=`$uname -a 2>/dev/null`
2962 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2963 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2964 # because the A-Z/a-z are not consecutive.
2965 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2966         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2967 newmyuname="$myuname"
2968 dflt=n
2969 case "$knowitall" in
2970 '')
2971         if test -f ../config.sh; then
2972                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2973                         eval "`grep myuname= ../config.sh`"
2974                 fi
2975                 if test "X$myuname" = "X$newmyuname"; then
2976                         dflt=y
2977                 fi
2978         fi
2979         ;;
2980 *) dflt=y;;
2981 esac
2982
2983 : Get old answers from old config file if Configure was run on the
2984 : same system, otherwise use the hints.
2985 hint=default
2986 cd ..
2987 if test -f config.sh; then
2988         echo " "
2989         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2990         . UU/myread
2991         case "$ans" in
2992         n*|N*) echo "OK, I'll ignore it."
2993                 mv config.sh config.sh.old
2994                 myuname="$newmyuname"
2995                 ;;
2996         *)  echo "Fetching default answers from your old config.sh file..." >&4
2997                 tmp_n="$n"
2998                 tmp_c="$c"
2999                 tmp_sh="$sh"
3000                 . ./config.sh
3001                 cp config.sh UU
3002                 n="$tmp_n"
3003                 c="$tmp_c"
3004                 : Older versions did not always set $sh.  Catch re-use of such
3005                 : an old config.sh.
3006                 case "$sh" in
3007                 '') sh="$tmp_sh" ;;
3008                 esac
3009                 hint=previous
3010                 ;;
3011         esac
3012 fi
3013 . ./UU/checkcc
3014 if test ! -f config.sh; then
3015         $cat <<EOM
3016
3017 First time through, eh?  I have some defaults handy for some systems
3018 that need some extra help getting the Configure answers right:
3019
3020 EOM
3021         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3022         dflt=''
3023         : Half the following guesses are probably wrong... If you have better
3024         : tests or hints, please send them to perlbug@perl.org
3025         : The metaconfig authors would also appreciate a copy...
3026         $test -f /irix && osname=irix
3027         $test -f /xenix && osname=sco_xenix
3028         $test -f /dynix && osname=dynix
3029         $test -f /dnix && osname=dnix
3030         $test -f /lynx.os && osname=lynxos
3031         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3032         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3033         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3034         $test -f /bin/mips && /bin/mips && osname=mips
3035         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3036                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3037         $test -d /usr/apollo/bin && osname=apollo
3038         $test -f /etc/saf/_sactab && osname=svr4
3039         $test -d /usr/include/minix && osname=minix
3040         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3041         if $test -d /MachTen -o -d /MachTen_Folder; then
3042                 osname=machten
3043                 if $test -x /sbin/version; then
3044                         osvers=`/sbin/version | $awk '{print $2}' |
3045                         $sed -e 's/[A-Za-z]$//'`
3046                 elif $test -x /usr/etc/version; then
3047                         osvers=`/usr/etc/version | $awk '{print $2}' |
3048                         $sed -e 's/[A-Za-z]$//'`
3049                 else
3050                         osvers="$2.$3"
3051                 fi
3052         fi
3053
3054         $test -f /sys/posix.dll &&
3055                 $test -f /usr/bin/what &&
3056                 set X `/usr/bin/what /sys/posix.dll` &&
3057                 $test "$3" = UWIN &&
3058                 osname=uwin &&
3059                 osvers="$5"
3060
3061         if $test -f $uname; then
3062                 set X $myuname
3063                 shift
3064
3065                 case "$5" in
3066                 fps*) osname=fps ;;
3067                 mips*)
3068                         case "$4" in
3069                         umips) osname=umips ;;
3070                         *) osname=mips ;;
3071                         esac;;
3072                 [23]100) osname=mips ;;
3073                 next*) osname=next ;;
3074                 i386*)
3075                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3076                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3077                                 osname='sco'
3078                                 osvers=$tmp
3079                         elif $test -f /etc/kconfig; then
3080                                 osname=isc
3081                                 if test "$lns" = "$ln -s"; then
3082                                         osvers=4
3083                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3084                                         osvers=3
3085                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3086                                         osvers=2
3087                                 fi
3088                         fi
3089                         tmp=''
3090                         ;;
3091                 pc*)
3092                         if test -n "$DJGPP"; then
3093                                 osname=dos
3094                                 osvers=djgpp
3095                         fi
3096                         ;;
3097                 esac
3098
3099                 case "$1" in
3100                 aix) osname=aix
3101                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3102                         case "$tmp" in
3103                         # oslevel can fail with:
3104                         # oslevel: Unable to acquire lock.
3105                         *not\ found) osvers="$4"."$3" ;;
3106                         '<3240'|'<>3240') osvers=3.2.0 ;;
3107                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3108                         '=3250'|'>3250') osvers=3.2.5 ;;
3109                         *) osvers=$tmp;;
3110                         esac
3111                         ;;
3112                 bsd386) osname=bsd386
3113                         osvers=`$uname -r`
3114                         ;;
3115                 cygwin*) osname=cygwin
3116                         osvers="$3"
3117                         ;;
3118                 *dc.osx) osname=dcosx
3119                         osvers="$3"
3120                         ;;
3121                 dnix) osname=dnix
3122                         osvers="$3"
3123                         ;;
3124                 domainos) osname=apollo
3125                         osvers="$3"
3126                         ;;
3127                 dgux)   osname=dgux 
3128                         osvers="$3"
3129                         ;;
3130                 dynixptx*) osname=dynixptx
3131                         osvers=`echo "$4"|sed 's/^v//'`
3132                         ;;
3133                 freebsd) osname=freebsd 
3134                         osvers="$3" ;;
3135                 genix)  osname=genix ;;
3136                 gnu)    osname=gnu
3137                         osvers="$3" ;;
3138                 hp*)    osname=hpux 
3139                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3140                         ;;
3141                 irix*)  osname=irix
3142                         case "$3" in
3143                         4*) osvers=4 ;;
3144                         5*) osvers=5 ;;
3145                         *)      osvers="$3" ;;
3146                         esac
3147                         ;;
3148                 linux)  osname=linux
3149                         case "$3" in
3150                         *)      osvers="$3" ;;
3151                         esac
3152                         ;;
3153                 MiNT)   osname=mint
3154                         ;;
3155                 netbsd*) osname=netbsd
3156                         osvers="$3"
3157                         ;;
3158                 news-os) osvers="$3"
3159                         case "$3" in
3160                         4*) osname=newsos4 ;;
3161                         *) osname=newsos ;;
3162                         esac
3163                         ;;
3164                 next*) osname=next ;;
3165                 nonstop-ux) osname=nonstopux ;;
3166                 openbsd) osname=openbsd
3167                         osvers="$3"
3168                         ;;
3169                 os2)    osname=os2
3170                         osvers="$4"
3171                         ;;
3172                 POSIX-BC | posix-bc ) osname=posix-bc
3173                         osvers="$3"
3174                         ;;
3175                 powerux | power_ux | powermax_os | powermaxos | \
3176                 powerunix | power_unix) osname=powerux
3177                         osvers="$3"
3178                         ;;
3179                 qnx) osname=qnx
3180                         osvers="$4"
3181                         ;;
3182                 solaris) osname=solaris
3183                         case "$3" in
3184                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3185                         *)      osvers="$3" ;;
3186                         esac
3187                         ;;
3188                 sunos) osname=sunos
3189                         case "$3" in
3190                         5*) osname=solaris
3191                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3192                         *)      osvers="$3" ;;
3193                         esac
3194                         ;;
3195                 titanos) osname=titanos
3196                         case "$3" in
3197                         1*) osvers=1 ;;
3198                         2*) osvers=2 ;;
3199                         3*) osvers=3 ;;
3200                         4*) osvers=4 ;;
3201                         *)      osvers="$3" ;;
3202                         esac
3203                         ;;
3204                 ultrix) osname=ultrix
3205                         osvers="$3"
3206                         ;;
3207                 osf1|mls+)      case "$5" in
3208                                 alpha)
3209                                         osname=dec_osf
3210                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3211                                         case "$osvers" in
3212                                         [1-9].[0-9]*) ;;
3213                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3214                                         esac
3215                                         ;;
3216                         hp*)    osname=hp_osf1  ;;
3217                         mips)   osname=mips_osf1 ;;
3218                         esac
3219                         ;;
3220                 # UnixWare 7.1.2 is known as Open UNIX 8
3221                 openunix|unixware) osname=svr5
3222                         osvers="$4"
3223                         ;;
3224                 uts)    osname=uts
3225                         osvers="$3"
3226                         ;;
3227                 vos) osvers="$3"
3228                         ;;
3229                 $2) case "$osname" in
3230                         *isc*) ;;
3231                         *freebsd*) ;;
3232                         svr*)
3233                                 : svr4.x or possibly later
3234                                 case "svr$3" in 
3235                                 ${osname}*)
3236                                         osname=svr$3
3237                                         osvers=$4
3238                                         ;;
3239                                 esac
3240                                 case "$osname" in
3241                                 svr4.0)
3242                                         : Check for ESIX
3243                                         if test -f /stand/boot ; then
3244                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3245                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3246                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3247                                                         if test -n "$isesix"; then
3248                                                                 osname=esix4
3249                                                         fi
3250                                                 fi
3251                                         fi
3252                                         ;;
3253                                 esac
3254                                 ;;
3255                         *)      if test -f /etc/systemid; then
3256                                         osname=sco
3257                                         set `echo $3 | $sed 's/\./ /g'` $4
3258                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3259                                                 osvers=$1.$2.$3
3260                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3261                                                 osvers=$1.$2
3262                                         elif $test -f $src/hints/sco_$1.sh; then
3263                                                 osvers=$1
3264                                         fi
3265                                 else
3266                                         case "$osname" in
3267                                         '') : Still unknown.  Probably a generic Sys V.
3268                                                 osname="sysv"
3269                                                 osvers="$3"
3270                                                 ;;
3271                                         esac
3272                                 fi
3273                                 ;;
3274                         esac
3275                         ;;
3276                 *)      case "$osname" in
3277                         '') : Still unknown.  Probably a generic BSD.
3278                                 osname="$1"
3279                                 osvers="$3"
3280                                 ;;
3281                         esac
3282                         ;;
3283                 esac
3284         else
3285                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3286                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3287                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3288                                 osname=news_os
3289                         fi
3290                         $rm -f UU/kernel.what
3291                 elif test -d c:/. -o -n "$is_os2" ; then
3292                         set X $myuname
3293                         osname=os2
3294                         osvers="$5"
3295                 fi
3296         fi
3297         
3298         case "$targetarch" in
3299         '') ;;
3300         *)  hostarch=$osname
3301             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3302             osvers=''
3303             ;;
3304         esac
3305
3306         : Now look for a hint file osname_osvers, unless one has been
3307         : specified already.
3308         case "$hintfile" in
3309         ''|' ')
3310                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3311                 : Also try without trailing minor version numbers.
3312                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3313                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3314                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3315                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3316                 case "$file" in
3317                 '') dflt=none ;;
3318                 *)  case "$osvers" in
3319                         '') dflt=$file
3320                                 ;;
3321                         *)  if $test -f $src/hints/$file.sh ; then
3322                                         dflt=$file
3323                                 elif $test -f $src/hints/$xfile.sh ; then
3324                                         dflt=$xfile
3325                                 elif $test -f $src/hints/$xxfile.sh ; then
3326                                         dflt=$xxfile
3327                                 elif $test -f $src/hints/$xxxfile.sh ; then
3328                                         dflt=$xxxfile
3329                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3330                                         dflt=$xxxxfile
3331                                 elif $test -f "$src/hints/${osname}.sh" ; then
3332                                         dflt="${osname}"
3333                                 else
3334                                         dflt=none
3335                                 fi
3336                                 ;;
3337                         esac
3338                         ;;
3339                 esac
3340                 if $test -f Policy.sh ; then
3341                         case "$dflt" in
3342                         *Policy*) ;;
3343                         none) dflt="Policy" ;;
3344                         *) dflt="Policy $dflt" ;;
3345                         esac
3346                 fi
3347                 ;;
3348         *)
3349                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3350                 ;;
3351         esac
3352
3353         if $test -f Policy.sh ; then
3354                 $cat <<EOM
3355
3356 There's also a Policy hint file available, which should make the
3357 site-specific (policy) questions easier to answer.
3358 EOM
3359
3360         fi
3361
3362         $cat <<EOM
3363
3364 You may give one or more space-separated answers, or "none" if appropriate.
3365 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3366 is a good thing.  DO NOT give a wrong version or a wrong OS.
3367
3368 EOM
3369
3370         rp="Which of these apply, if any?"
3371         . UU/myread
3372         tans=$ans
3373         for file in $tans; do
3374                 if $test X$file = XPolicy -a -f Policy.sh; then
3375                         . Policy.sh
3376                         $cat Policy.sh >> UU/config.sh
3377                 elif $test -f $src/hints/$file.sh; then
3378                         . $src/hints/$file.sh
3379                         $cat $src/hints/$file.sh >> UU/config.sh
3380                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3381                         : nothing
3382                 else
3383                         : Give one chance to correct a possible typo.
3384                         echo "$file.sh does not exist"
3385                         dflt=$file
3386                         rp="hint to use instead?"
3387                         . UU/myread
3388                         for file in $ans; do
3389                                 if $test -f "$src/hints/$file.sh"; then
3390                                         . $src/hints/$file.sh
3391                                         $cat $src/hints/$file.sh >> UU/config.sh
3392                                 elif $test X$ans = X -o X$ans = Xnone ; then
3393                                         : nothing
3394                                 else
3395                                         echo "$file.sh does not exist -- ignored."
3396                                 fi
3397                         done
3398                 fi
3399         done
3400
3401         hint=recommended
3402         : Remember our hint file for later.
3403         if $test -f "$src/hints/$file.sh" ; then
3404                 hintfile="$file"
3405         else
3406                 hintfile=''
3407         fi
3408 fi
3409 cd UU
3410 ;;
3411 *)
3412         echo " "
3413         echo "Fetching default answers from $config_sh..." >&4
3414         tmp_n="$n"
3415         tmp_c="$c"
3416         cd ..
3417         cp $config_sh config.sh 2>/dev/null
3418         chmod +w config.sh
3419         . ./config.sh
3420         cd UU
3421         cp ../config.sh .
3422         n="$tmp_n"
3423         c="$tmp_c"
3424         hint=previous
3425         ;;
3426 esac
3427 test "$override" && . ./optdef.sh
3428
3429 : Restore computed paths
3430 for file in $loclist $trylist; do
3431         eval $file="\$_$file"
3432 done
3433
3434 cat << EOM
3435
3436 Configure uses the operating system name and version to set some defaults.
3437 The default value is probably right if the name rings a bell. Otherwise,
3438 since spelling matters for me, either accept the default or answer "none"
3439 to leave it blank.
3440
3441 EOM
3442 case "$osname" in
3443         ''|' ')
3444                 case "$hintfile" in
3445                 ''|' '|none) dflt=none ;;
3446                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3447                 esac
3448                 ;;
3449         *) dflt="$osname" ;;
3450 esac
3451 rp="Operating system name?"
3452 . ./myread
3453 case "$ans" in
3454 none)  osname='' ;;
3455 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3456 esac
3457 echo " "
3458 case "$osvers" in
3459         ''|' ')
3460                 case "$hintfile" in
3461                 ''|' '|none) dflt=none ;;
3462                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3463                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3464                         case "$dflt" in
3465                         ''|' ') dflt=none ;;
3466                         esac
3467                         ;;
3468                 esac
3469                 ;;
3470         *) dflt="$osvers" ;;
3471 esac
3472 rp="Operating system version?"
3473 . ./myread
3474 case "$ans" in
3475 none)  osvers='' ;;
3476 *) osvers="$ans" ;;
3477 esac
3478
3479
3480 . ./posthint.sh
3481
3482 : who configured the system
3483 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3484 case "$cf_by" in
3485 "")
3486         cf_by=`(logname) 2>/dev/null`
3487         case "$cf_by" in
3488         "")
3489                 cf_by=`(whoami) 2>/dev/null`
3490                 case "$cf_by" in
3491                 "") cf_by=unknown ;;
3492                 esac ;;
3493         esac ;;
3494 esac
3495
3496 : set up the script used to warn in case of inconsistency
3497 cat <<EOS >whoa
3498 $startsh
3499 EOS
3500 cat <<'EOSC' >>whoa
3501 dflt=y
3502 echo " "
3503 echo "*** WHOA THERE!!! ***" >&4
3504 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3505 rp="    Keep the $hint value?"
3506 . ./myread
3507 case "$ans" in
3508 y) td=$was; tu=$was;;
3509 esac
3510 EOSC
3511
3512 : function used to set $1 to $val
3513 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3514 case "$val$was" in
3515 $define$undef) . ./whoa; eval "$var=\$td";;
3516 $undef$define) . ./whoa; eval "$var=\$tu";;
3517 *) eval "$var=$val";;
3518 esac'
3519
3520 case "$usesocks" in
3521 $define|true|[yY]*)     dflt='y';;
3522 *) dflt='n';;
3523 esac
3524 cat <<EOM
3525
3526 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3527 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3528 to use the PerlIO abstraction layer, this will be implicitly selected.
3529
3530 If this doesn't make any sense to you, just accept the default '$dflt'.
3531 EOM
3532 rp='Build Perl for SOCKS?'
3533 . ./myread
3534 case "$ans" in
3535 y|Y)    val="$define" ;;     
3536 *)      val="$undef" ;;
3537 esac
3538 set usesocks
3539 eval $setvar
3540
3541 case "$usesocks" in
3542 $define|true|[yY]*) useperlio="$define";;
3543 esac
3544
3545 case "$useperlio" in
3546 $define|true|[yY]*|'')  dflt='y';;
3547 *) dflt='n';;
3548 esac
3549 cat <<EOM
3550
3551 Previous version of $package used the standard IO mechanisms as
3552 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
3553 alternate IO mechanisms via the PerlIO abstraction layer, but the
3554 stdio mechanism is still available if needed.  The abstraction layer
3555 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3556 Using PerlIO with sfio may cause problems with some extension modules.
3557
3558 If this doesn't make any sense to you, just accept the default '$dflt'.
3559 EOM
3560 rp='Use the PerlIO abstraction layer?'
3561 . ./myread
3562 case "$ans" in
3563 y|Y) 
3564         val="$define"
3565         ;;
3566 *)      
3567         echo "Ok, doing things the stdio way."
3568         val="$undef"
3569         ;;
3570 esac
3571 set useperlio
3572 eval $setvar 
3573
3574 case "$usesocks" in
3575 $define|true|[yY]*)
3576         case "$useperlio" in
3577         $define|true|[yY]*) ;;
3578         *)      cat >&4 <<EOM
3579
3580 You are using the SOCKS proxy protocol library which means that you
3581 should also use the PerlIO layer.  You may be headed for trouble.
3582
3583 EOM
3584                 ;;
3585         esac
3586         ;;
3587 esac
3588
3589         
3590 case "$usethreads" in
3591 $define|true|[yY]*)     dflt='y';;
3592 *)     # Catch case where user specified ithreads or 5005threads but
3593        # forgot -Dusethreads (A.D. 4/2002)
3594        case "$useithreads$use5005threads" in
3595        *$define*)      
3596                 case "$useperlio" in
3597                 "$define")      dflt='y' ;;
3598                 *)              dflt='n' ;;
3599                 esac
3600                 ;;
3601        *)       dflt='n';;
3602        esac
3603        ;;
3604 esac
3605 cat <<EOM
3606
3607 Perl can be built to take advantage of threads on some systems.
3608 To do so, Configure can be run with -Dusethreads.
3609
3610 Note that Perl built with threading support runs slightly slower
3611 and uses more memory than plain Perl. The current implementation
3612 is believed to be stable, but it is fairly new, and so should be
3613 treated with caution.
3614
3615 If this doesn't make any sense to you, just accept the default '$dflt'.
3616 EOM
3617 rp='Build a threading Perl?'
3618 . ./myread
3619 case "$ans" in
3620 y|Y)    val="$define" ;;
3621 *)      val="$undef" ;;
3622 esac
3623 set usethreads
3624 eval $setvar
3625
3626 case "$usethreads" in
3627 $define)
3628         $cat <<EOM
3629
3630 Since release 5.6, Perl has had two different threading implementations,
3631 the newer interpreter-based version (ithreads) with one interpreter per
3632 thread, and the older 5.005 version (5005threads).
3633 The 5005threads version is effectively unmaintained and will probably be
3634 removed in Perl 5.10, so there should be no need to build a Perl using it
3635 unless needed for backwards compatibility with some existing 5.005threads
3636 code.
3637
3638 EOM
3639         : Default to ithreads unless overridden on command line or with
3640         : old config.sh
3641         dflt='y'
3642         case "$use5005threads" in
3643                 $define|true|[yY]*) dflt='n';;
3644         esac
3645         case "$useithreads" in
3646                 $undef|false|[nN]*) dflt='n';;
3647         esac
3648         rp='Use the newer interpreter-based ithreads?'
3649         . ./myread
3650         case "$ans" in
3651         y|Y)    val="$define" ;;
3652         *)      val="$undef" ;;
3653         esac
3654         set useithreads
3655         eval $setvar
3656         : Now set use5005threads to the opposite value.
3657         case "$useithreads" in
3658         $define) val="$undef" ;;
3659         *) val="$define" ;;
3660         esac
3661         set use5005threads
3662         eval $setvar
3663         ;;
3664 *)
3665         useithreads="$undef"
3666         use5005threads="$undef"
3667         ;;
3668 esac
3669
3670 case "$useithreads$use5005threads" in
3671 "$define$define")
3672         $cat >&4 <<EOM
3673
3674 You cannot have both the ithreads and the 5.005 threads enabled
3675 at the same time.  Disabling the 5.005 threads since they are
3676 much less stable than the ithreads.
3677
3678 EOM
3679         use5005threads="$undef"
3680         ;;
3681 esac
3682
3683 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
3684         cat >&4 <<EOF
3685 ***
3686 *** To build with ithreads you must also use the PerlIO layer.
3687 *** Cannot continue, aborting.
3688 ***
3689 EOF
3690         exit 1
3691 fi
3692
3693 case "$d_oldpthreads" in
3694 '')     : Configure tests would be welcome here.  For now, assume undef.
3695         val="$undef" ;;
3696 *)      val="$d_oldpthreads" ;;
3697 esac
3698 set d_oldpthreads
3699 eval $setvar
3700
3701
3702 : Look for a hint-file generated 'call-back-unit'.  If the
3703 : user has specified that a threading perl is to be built,
3704 : we may need to set or change some other defaults.
3705 if $test -f usethreads.cbu; then
3706     echo "Your platform has some specific hints regarding threaded builds, using them..."
3707     . ./usethreads.cbu
3708 else
3709     case "$usethreads" in
3710         "$define"|true|[yY]*)
3711                 $cat <<EOM
3712 (Your platform does not have any specific hints for threaded builds.
3713  Assuming POSIX threads, then.)
3714 EOM
3715         ;;
3716     esac
3717 fi
3718
3719 cat <<EOM
3720
3721 Perl can be built so that multiple Perl interpreters can coexist
3722 within the same Perl executable.
3723 EOM
3724
3725 case "$useithreads" in
3726 $define)
3727         cat <<EOM
3728 This multiple interpreter support is required for interpreter-based threads.
3729 EOM
3730         val="$define"
3731         ;;
3732 *)      case "$usemultiplicity" in
3733         $define|true|[yY]*)     dflt='y';;
3734         *) dflt='n';;
3735         esac
3736         echo " "
3737         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3738         rp='Build Perl for multiplicity?'
3739         . ./myread
3740         case "$ans" in
3741         y|Y)    val="$define" ;;
3742         *)      val="$undef" ;;
3743         esac
3744         ;;
3745 esac
3746 set usemultiplicity
3747 eval $setvar
3748
3749
3750 case "$usemorebits" in
3751 "$define"|true|[yY]*)
3752         use64bitint="$define"
3753         uselongdouble="$define"
3754         usemorebits="$define"
3755         ;;
3756 *)      usemorebits="$undef"
3757         ;;
3758 esac
3759
3760 : make some quick guesses about what we are up against
3761 echo " "
3762 $echo $n "Hmm...  $c"
3763 echo exit 1 >bsd
3764 echo exit 1 >usg
3765 echo exit 1 >v7
3766 echo exit 1 >osf1
3767 echo exit 1 >eunice
3768 echo exit 1 >xenix
3769 echo exit 1 >venix
3770 echo exit 1 >os2
3771 d_bsd="$undef"
3772 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3773 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3774 then
3775         echo "Looks kind of like an OSF/1 system, but we'll see..."
3776         echo exit 0 >osf1
3777 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3778         xxx=`./loc addbib blurfl $pth`
3779         if $test -f $xxx; then
3780         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3781                 echo exit 0 >bsd
3782                 echo exit 0 >usg
3783         else
3784                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3785                         echo "Looks kind of like an extended USG system, but we'll see..."
3786                 else
3787                         echo "Looks kind of like a USG system, but we'll see..."
3788                 fi
3789                 echo exit 0 >usg
3790         fi
3791 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3792         echo "Looks kind of like a BSD system, but we'll see..."
3793         d_bsd="$define"
3794         echo exit 0 >bsd
3795 else
3796         echo "Looks kind of like a Version 7 system, but we'll see..."
3797         echo exit 0 >v7
3798 fi
3799 case "$eunicefix" in
3800 *unixtovms*)
3801         $cat <<'EOI'
3802 There is, however, a strange, musty smell in the air that reminds me of
3803 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3804 EOI
3805         echo exit 0 >eunice
3806         d_eunice="$define"
3807 : it so happens the Eunice I know will not run shell scripts in Unix format
3808         ;;
3809 *)
3810         echo " "
3811         echo "Congratulations.  You aren't running Eunice."
3812         d_eunice="$undef"
3813         ;;
3814 esac
3815 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3816 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3817 : semicolon as a patch separator
3818 case "$p_" in
3819 :) ;;
3820 *)
3821         $cat <<'EOI'
3822 I have the feeling something is not exactly right, however...don't tell me...
3823 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3824 (Or you may be running DOS with DJGPP.)
3825 EOI
3826         echo exit 0 >os2
3827         ;;
3828 esac
3829 if test -f /xenix; then
3830         echo "Actually, this looks more like a XENIX system..."
3831         echo exit 0 >xenix
3832         d_xenix="$define"
3833 else
3834         echo " "
3835         echo "It's not Xenix..."
3836         d_xenix="$undef"
3837 fi
3838 chmod +x xenix
3839 $eunicefix xenix
3840 if test -f /venix; then
3841         echo "Actually, this looks more like a VENIX system..."
3842         echo exit 0 >venix
3843 else
3844         echo " "
3845         if ./xenix; then
3846                 : null
3847         else
3848                 echo "Nor is it Venix..."
3849         fi
3850 fi
3851 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3852 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3853 $rm -f foo
3854
3855 case "$cc" in
3856 '') dflt=cc;;
3857 *) dflt="$cc";;
3858 esac
3859 rp="Use which C compiler?"
3860 . ./myread
3861 cc="$ans"
3862
3863 : See if they have not cc but they do have gcc
3864 . ./trygcc
3865 : Look for a hint-file generated 'call-back-unit'.  Now that the
3866 : user has specified the compiler, we may need to set or change some
3867 : other defaults.
3868 if $test -f cc.cbu; then
3869     . ./cc.cbu
3870 fi
3871 . ./checkcc
3872
3873 echo " "
3874 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3875 $cat >try.c <<EOM
3876 #include <stdio.h>
3877 int main() {
3878 #ifdef __GNUC__
3879 #ifdef __VERSION__
3880         printf("%s\n", __VERSION__);
3881 #else
3882         printf("%s\n", "1");
3883 #endif
3884 #endif
3885         return(0);
3886 }
3887 EOM
3888 if $cc -o try $ccflags $ldflags try.c; then
3889         gccversion=`$run ./try`
3890         case "$gccversion" in
3891         '') echo "You are not using GNU cc." ;;
3892         *)  echo "You are using GNU cc $gccversion."
3893             ccname=gcc
3894             ;;
3895         esac
3896 else
3897         echo " "
3898         echo "*** WHOA THERE!!! ***" >&4
3899         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3900         case "$knowitall" in
3901         '')
3902         echo "    You'd better start hunting for one and let me know about it." >&4
3903                 exit 1
3904                 ;;
3905         esac
3906 fi
3907 $rm -f try try.*
3908 case "$gccversion" in
3909 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3910 esac
3911 case "$gccversion" in
3912 '') gccosandvers='' ;;
3913 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3914    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3915    gccshortvers=''
3916    case "$gccosandvers" in
3917    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3918    $osname$osvers) ;; # looking good
3919    $osname*) cat <<EOM >&4
3920
3921 *** WHOA THERE!!! ***
3922
3923     Your gcc has not been compiled for the exact release of
3924     your operating system ($gccosandvers versus $osname$osvers).
3925
3926     In general it is a good idea to keep gcc synchronized with
3927     the operating system because otherwise serious problems
3928     may ensue when trying to compile software, like Perl.
3929
3930     I'm trying to be optimistic here, though, and will continue.
3931     If later during the configuration and build icky compilation
3932     problems appear (headerfile conflicts being the most common
3933     manifestation), I suggest reinstalling the gcc to match
3934     your operating system release.
3935
3936 EOM
3937       ;;
3938    *) gccosandvers='' ;; # failed to parse, better be silent
3939    esac
3940    ;;
3941 esac
3942 case "$ccname" in
3943 '') ccname="$cc" ;;
3944 esac
3945
3946 # gcc 3.* complain about adding -Idirectories that they already know about,
3947 # so we will take those off from locincpth.
3948 case "$gccversion" in
3949 3*)
3950     echo "main(){}">try.c
3951     for incdir in $locincpth; do
3952        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
3953              grep '^c[cp]p*[01]: warning: changing search order '`
3954        if test "X$warn" != X; then
3955            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
3956        fi
3957     done
3958     $rm -f try try.*
3959 esac
3960
3961 : decide how portable to be.  Allow command line overrides.
3962 case "$d_portable" in
3963 "$undef") ;;
3964 *)      d_portable="$define" ;;
3965 esac
3966
3967 : set up shell script to do ~ expansion
3968 cat >filexp <<EOSS
3969 $startsh
3970 : expand filename
3971 case "\$1" in
3972  ~/*|~)
3973         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3974         ;;
3975  ~*)
3976         if $test -f /bin/csh; then
3977                 /bin/csh -f -c "glob \$1"
3978                 failed=\$?
3979                 echo ""
3980                 exit \$failed
3981         else
3982                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3983                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3984                 if $test ! -d "\$dir"; then
3985                         me=\`basename \$0\`
3986                         echo "\$me: can't locate home directory for: \$name" >&2
3987                         exit 1
3988                 fi
3989                 case "\$1" in
3990                 */*)
3991                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3992                         ;;
3993                 *)
3994                         echo \$dir
3995                         ;;
3996                 esac
3997         fi
3998         ;;
3999 *)
4000         echo \$1
4001         ;;
4002 esac
4003 EOSS
4004 chmod +x filexp
4005 $eunicefix filexp
4006
4007 : now set up to get a file name
4008 cat <<EOS >getfile
4009 $startsh
4010 EOS
4011 cat <<'EOSC' >>getfile
4012 tilde=''
4013 fullpath=''
4014 already=''
4015 skip=''
4016 none_ok=''
4017 exp_file=''
4018 nopath_ok=''
4019 orig_rp="$rp"
4020 orig_dflt="$dflt"
4021 case "$gfpth" in
4022 '') gfpth='.' ;;
4023 esac
4024
4025 case "$fn" in
4026 *\(*)
4027         : getfile will accept an answer from the comma-separated list
4028         : enclosed in parentheses even if it does not meet other criteria.
4029         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
4030         fn=`echo $fn | sed 's/(.*)//'`
4031         ;;
4032 esac
4033
4034 case "$fn" in
4035 *:*)
4036         loc_file=`expr $fn : '.*:\(.*\)'`
4037         fn=`expr $fn : '\(.*\):.*'`
4038         ;;
4039 esac
4040
4041 case "$fn" in
4042 *~*) tilde=true;;
4043 esac
4044 case "$fn" in
4045 */*) fullpath=true;;
4046 esac
4047 case "$fn" in
4048 *+*) skip=true;;
4049 esac
4050 case "$fn" in
4051 *n*) none_ok=true;;
4052 esac
4053 case "$fn" in
4054 *e*) exp_file=true;;
4055 esac
4056 case "$fn" in
4057 *p*) nopath_ok=true;;
4058 esac
4059
4060 case "$fn" in
4061 *f*) type='File';;
4062 *d*) type='Directory';;
4063 *l*) type='Locate';;
4064 esac
4065
4066 what="$type"
4067 case "$what" in
4068 Locate) what='File';;
4069 esac
4070
4071 case "$exp_file" in
4072 '')
4073         case "$d_portable" in
4074         "$define") ;;
4075         *) exp_file=true;;
4076         esac
4077         ;;
4078 esac
4079
4080 cd ..
4081 while test "$type"; do
4082         redo=''
4083         rp="$orig_rp"
4084         dflt="$orig_dflt"
4085         case "$tilde" in
4086         true) rp="$rp (~name ok)";;
4087         esac
4088         . UU/myread
4089         if test -f UU/getfile.ok && \
4090                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4091         then
4092                 value="$ans"
4093                 ansexp="$ans"
4094                 break
4095         fi
4096         case "$ans" in
4097         none)
4098                 value=''
4099                 ansexp=''
4100                 case "$none_ok" in
4101                 true) type='';;
4102                 esac
4103                 ;;
4104         *)
4105                 case "$tilde" in
4106                 '') value="$ans"
4107                         ansexp="$ans";;
4108                 *)
4109                         value=`UU/filexp $ans`
4110                         case $? in
4111                         0)
4112                                 if test "$ans" != "$value"; then
4113                                         echo "(That expands to $value on this system.)"
4114                                 fi
4115                                 ;;
4116                         *) value="$ans";;
4117                         esac
4118                         ansexp="$value"
4119                         case "$exp_file" in
4120                         '') value="$ans";;
4121                         esac
4122                         ;;
4123                 esac
4124                 case "$fullpath" in
4125                 true)
4126                         case "$ansexp" in
4127                         /*) value="$ansexp" ;;
4128                         [a-zA-Z]:/*) value="$ansexp" ;;
4129                         *)
4130                                 redo=true
4131                                 case "$already" in
4132                                 true)
4133                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4134                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4135                                         ;;
4136                                 *)
4137                                 echo "Please give a full path name, starting with slash." >&4
4138                                         case "$tilde" in
4139                                         true)
4140                                 echo "Note that using ~name is ok provided it expands well." >&4
4141                                                 already=true
4142                                                 ;;
4143                                         esac
4144                                 esac
4145                                 ;;
4146                         esac
4147                         ;;
4148                 esac
4149                 case "$redo" in
4150                 '')
4151                         case "$type" in
4152                         File)
4153                                 for fp in $gfpth; do
4154                                         if test "X$fp" = X.; then
4155                                             pf="$ansexp"
4156                                         else    
4157                                             pf="$fp/$ansexp"
4158                                         fi
4159                                         if test -f "$pf"; then
4160                                                 type=''
4161                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4162                                         then
4163                                                 echo "($value is not a plain file, but that's ok.)"
4164                                                 type=''
4165                                         fi
4166                                         if test X"$type" = X; then
4167                                             value="$pf"
4168                                             break
4169                                         fi
4170                                 done
4171                                 ;;
4172                         Directory)
4173                                 for fp in $gfpth; do
4174                                         if test "X$fp" = X.; then
4175                                             dir="$ans"
4176                                             direxp="$ansexp"
4177                                         else    
4178                                             dir="$fp/$ansexp"
4179                                             direxp="$fp/$ansexp"
4180                                         fi
4181                                         if test -d "$direxp"; then
4182                                                 type=''
4183                                                 value="$dir"
4184                                                 break
4185                                         fi
4186                                 done
4187                                 ;;
4188                         Locate)
4189                                 if test -d "$ansexp"; then
4190                                         echo "(Looking for $loc_file in directory $value.)"
4191                                         value="$value/$loc_file"
4192                                         ansexp="$ansexp/$loc_file"
4193                                 fi
4194                                 if test -f "$ansexp"; then
4195                                         type=''
4196                                 fi
4197                                 case "$nopath_ok" in
4198                                 true)   case "$value" in
4199                                         */*) ;;
4200                                         *)      echo "Assuming $value will be in people's path."
4201                                                 type=''
4202                                                 ;;
4203                                         esac
4204                                         ;;
4205                                 esac
4206                                 ;;
4207                         esac
4208
4209                         case "$skip" in
4210                         true) type='';
4211                         esac
4212
4213                         case "$type" in
4214                         '') ;;
4215                         *)
4216                                 if test "$fastread" = yes; then
4217                                         dflt=y
4218                                 else
4219                                         dflt=n
4220                                 fi
4221                                 rp="$what $value doesn't exist.  Use that name anyway?"
4222                                 . UU/myread
4223                                 dflt=''
4224                                 case "$ans" in
4225                                 y*) type='';;
4226                                 *) echo " ";;
4227                                 esac
4228                                 ;;
4229                         esac
4230                         ;;
4231                 esac
4232                 ;;
4233         esac
4234 done
4235 cd UU
4236 ans="$value"
4237 rp="$orig_rp"
4238 dflt="$orig_dflt"
4239 rm -f getfile.ok
4240 test "X$gfpthkeep" != Xy && gfpth=""
4241 EOSC
4242
4243 : What should the include directory be ?
4244 echo " "
4245 $echo $n "Hmm...  $c"
4246 dflt='/usr/include'
4247 incpath=''
4248 mips_type=''
4249 if $test -f /bin/mips && /bin/mips; then
4250         echo "Looks like a MIPS system..."
4251         $cat >usr.c <<'EOCP'
4252 #ifdef SYSTYPE_BSD43
4253 /bsd43
4254 #endif
4255 EOCP
4256         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4257                 dflt='/bsd43/usr/include'
4258                 incpath='/bsd43'
4259                 mips_type='BSD 4.3'
4260         else
4261                 mips_type='System V'
4262         fi
4263         $rm -f usr.c usr.out
4264         echo "and you're compiling with the $mips_type compiler and libraries."
4265         xxx_prompt=y
4266         echo "exit 0" >mips
4267 else
4268         echo "Doesn't look like a MIPS system."
4269         xxx_prompt=n
4270         echo "exit 1" >mips
4271 fi
4272 chmod +x mips
4273 $eunicefix mips
4274 case "$usrinc" in
4275 '') ;;
4276 *) dflt="$usrinc";;
4277 esac
4278 case "$xxx_prompt" in
4279 y)      fn=d/
4280         echo " "
4281         rp='Where are the include files you want to use?'
4282         . ./getfile
4283         usrinc="$ans"
4284         ;;
4285 *)      usrinc="$dflt"
4286         ;;
4287 esac
4288
4289 : see how we invoke the C preprocessor
4290 echo " "
4291 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4292 cat <<'EOT' >testcpp.c
4293 #define ABC abc
4294 #define XYZ xyz
4295 ABC.XYZ
4296 EOT
4297 cd ..
4298 if test ! -f cppstdin; then
4299         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4300                 # AIX cc -E doesn't show the absolute headerfile
4301                 # locations but we'll cheat by using the -M flag.
4302                 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
4303         else
4304                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4305         fi
4306 else
4307         echo "Keeping your $hint cppstdin wrapper."
4308 fi
4309 chmod 755 cppstdin
4310 wrapper=`pwd`/cppstdin
4311 ok='false'
4312 cd UU
4313
4314 if $test "X$cppstdin" != "X" && \
4315         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4316         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4317 then
4318         echo "You used to use $cppstdin $cppminus so we'll use that again."
4319         case "$cpprun" in
4320         '') echo "But let's see if we can live without a wrapper..." ;;
4321         *)
4322                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4323                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4324                 then
4325                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4326                         ok='true'
4327                 else
4328                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4329                 fi
4330                 ;;
4331         esac
4332 else
4333         case "$cppstdin" in
4334         '') ;;
4335         *)
4336                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4337                 ;;
4338         esac
4339 fi
4340
4341 if $ok; then
4342         : nothing
4343 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4344         $cc -E <testcpp.c >testcpp.out 2>&1; \
4345         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4346         echo "Yup, it does."
4347         x_cpp="$cc -E"
4348         x_minus='';
4349 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4350         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4351         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4352         echo "Yup, it does."
4353         x_cpp="$cc -E"
4354         x_minus='-';
4355 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4356         $cc -P <testcpp.c >testcpp.out 2>&1; \
4357         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4358         echo "Yipee, that works!"
4359         x_cpp="$cc -P"
4360         x_minus='';
4361 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4362         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4363         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4364         echo "At long last!"
4365         x_cpp="$cc -P"
4366         x_minus='-';
4367 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4368         $cpp <testcpp.c >testcpp.out 2>&1; \
4369         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4370         echo "It works!"
4371         x_cpp="$cpp"
4372         x_minus='';
4373 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4374         $cpp - <testcpp.c >testcpp.out 2>&1; \
4375         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4376         echo "Hooray, it works!  I was beginning to wonder."
4377         x_cpp="$cpp"
4378         x_minus='-';
4379 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4380         $wrapper <testcpp.c >testcpp.out 2>&1; \
4381         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4382         x_cpp="$wrapper"
4383         x_minus=''
4384         echo "Eureka!"
4385 else
4386         dflt=''
4387         rp="No dice.  I can't find a C preprocessor.  Name one:"
4388         . ./myread
4389         x_cpp="$ans"
4390         x_minus=''
4391         $x_cpp <testcpp.c >testcpp.out 2>&1
4392         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4393                 echo "OK, that will do." >&4
4394         else
4395 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4396                 exit 1
4397         fi
4398 fi
4399
4400 case "$ok" in
4401 false)
4402         cppstdin="$x_cpp"
4403         cppminus="$x_minus"
4404         cpprun="$x_cpp"
4405         cpplast="$x_minus"
4406         set X $x_cpp
4407         shift
4408         case "$1" in
4409         "$cpp")
4410                 echo "Perhaps can we force $cc -E using a wrapper..."
4411                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4412                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4413                 then
4414                         echo "Yup, we can."
4415                         cppstdin="$wrapper"
4416                         cppminus='';
4417                 else
4418                         echo "Nope, we'll have to live without it..."
4419                 fi
4420                 ;;
4421         esac
4422         case "$cpprun" in
4423         "$wrapper")
4424                 cpprun=''
4425                 cpplast=''
4426                 ;;
4427         esac
4428         ;;
4429 esac
4430
4431 case "$cppstdin" in
4432 "$wrapper"|'cppstdin') ;;
4433 *) $rm -f $wrapper;;
4434 esac
4435 $rm -f testcpp.c testcpp.out
4436
4437 : Set private lib path
4438 case "$plibpth" in
4439 '') if ./mips; then
4440                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4441         fi;;
4442 esac
4443 case "$libpth" in
4444 ' ') dlist='';;
4445 '') dlist="$loclibpth $plibpth $glibpth";;
4446 *) dlist="$libpth";;
4447 esac
4448
4449 : Now check and see which directories actually exist, avoiding duplicates
4450 libpth=''
4451 for xxx in $dlist
4452 do
4453     if $test -d $xxx; then
4454                 case " $libpth " in
4455                 *" $xxx "*) ;;
4456                 *) libpth="$libpth $xxx";;
4457                 esac
4458     fi
4459 done
4460 $cat <<'EOM'
4461
4462 Some systems have incompatible or broken versions of libraries.  Among
4463 the directories listed in the question below, please remove any you
4464 know not to be holding relevant libraries, and add any that are needed.
4465 Say "none" for none.
4466
4467 EOM
4468 case "$libpth" in
4469 '') dflt='none';;
4470 *)
4471         set X $libpth
4472         shift
4473         dflt=${1+"$@"}
4474         ;;
4475 esac
4476 rp="Directories to use for library searches?"
4477 . ./myread
4478 case "$ans" in
4479 none) libpth=' ';;
4480 *) libpth="$ans";;
4481 esac
4482
4483 : compute shared library extension
4484 case "$so" in
4485 '')
4486         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4487                 dflt='sl'
4488         else
4489                 dflt='so'
4490         fi
4491         ;;
4492 *) dflt="$so";;
4493 esac
4494 $cat <<EOM
4495
4496 On some systems, shared libraries may be available.  Answer 'none' if
4497 you want to suppress searching of shared libraries for the remainder
4498 of this configuration.
4499
4500 EOM
4501 rp='What is the file extension used for shared libraries?'
4502 . ./myread
4503 so="$ans"
4504
4505 : Define several unixisms.
4506 : Hints files or command line option can be used to override them.
4507 : The convoluted testing is in case hints files set either the old
4508 : or the new name.
4509 case "$_exe" in
4510 '')     case "$exe_ext" in
4511         '')     ;;
4512         *)      _exe="$exe_ext" ;;
4513         esac
4514         ;;
4515 esac
4516 case "$_a" in
4517 '')     case "$lib_ext" in
4518     '') _a='.a';;
4519         *)      _a="$lib_ext" ;;
4520         esac
4521         ;;
4522 esac
4523 case "$_o" in
4524 '') case "$obj_ext" in
4525         '')     _o='.o';;
4526         *)      _o="$obj_ext";;
4527         esac
4528         ;;
4529 esac
4530 case "$p_" in
4531 '') case "$path_sep" in
4532         '')     p_=':';;
4533         *)      p_="$path_sep";;
4534         esac
4535         ;;
4536 esac
4537 exe_ext=$_exe
4538 lib_ext=$_a
4539 obj_ext=$_o
4540 path_sep=$p_
4541
4542 : Which makefile gets called first.  This is used by make depend.
4543 case "$firstmakefile" in
4544 '') firstmakefile='makefile';;
4545 esac
4546
4547 case "$ccflags" in
4548 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4549 esac
4550
4551 case "$uselongdouble" in
4552 $define|true|[yY]*)     dflt='y';;
4553 *) dflt='n';;
4554 esac
4555 cat <<EOM
4556
4557 Perl can be built to take advantage of long doubles which
4558 (if available) may give more accuracy and range for floating point numbers.
4559
4560 If this doesn't make any sense to you, just accept the default '$dflt'.
4561 EOM
4562 rp='Try to use long doubles if available?'
4563 . ./myread
4564 case "$ans" in
4565 y|Y)    val="$define"   ;;
4566 *)      val="$undef"    ;;
4567 esac
4568 set uselongdouble
4569 eval $setvar
4570
4571 case "$uselongdouble" in
4572 true|[yY]*) uselongdouble="$define" ;;
4573 esac
4574
4575 : Look for a hint-file generated 'call-back-unit'.  If the
4576 : user has specified that long doubles should be used,
4577 : we may need to set or change some other defaults.
4578 if $test -f uselongdouble.cbu; then
4579     echo "Your platform has some specific hints regarding long doubles, using them..."
4580     . ./uselongdouble.cbu
4581 else
4582     case "$uselongdouble" in
4583         $define)
4584                 $cat <<EOM
4585 (Your platform does not have any specific hints for long doubles.)
4586 EOM
4587         ;;
4588     esac
4589 fi
4590
4591 : Looking for optional libraries
4592 echo " "
4593 echo "Checking for optional libraries..." >&4
4594 case "$libs" in
4595 ' '|'') dflt='';;
4596 *) dflt="$libs";;
4597 esac
4598 case "$libswanted" in
4599 '') libswanted='c_s';;
4600 esac
4601 case "$usesocks" in
4602 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4603 esac
4604 libsfound=''
4605 libsfiles=''
4606 libsdirs=''
4607 libspath=''
4608 for thisdir in $libpth $xlibpth; do
4609   test -d $thisdir && libspath="$libspath $thisdir"
4610 done
4611 for thislib in $libswanted; do
4612         for thisdir in $libspath; do
4613             xxx=''
4614             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4615                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4616                 $test -f "$xxx" && eval $libscheck
4617                 $test -f "$xxx" && libstyle=shared
4618             fi
4619             if test ! -f "$xxx"; then
4620                 xxx=$thisdir/lib$thislib.$so
4621                 $test -f "$xxx" && eval $libscheck
4622                 $test -f "$xxx" && libstyle=shared
4623             fi  
4624             if test ! -f "$xxx"; then
4625                 xxx=$thisdir/lib$thislib$_a
4626                 $test -f "$xxx" && eval $libscheck
4627                 $test -f "$xxx" && libstyle=static
4628             fi
4629             if test ! -f "$xxx"; then
4630                 xxx=$thisdir/$thislib$_a
4631                 $test -f "$xxx" && eval $libscheck
4632                 $test -f "$xxx" && libstyle=static
4633             fi
4634             if test ! -f "$xxx"; then
4635                 xxx=$thisdir/lib${thislib}_s$_a
4636                 $test -f "$xxx" && eval $libscheck
4637                 $test -f "$xxx" && libstyle=static
4638                 $test -f "$xxx" && thislib=${thislib}_s
4639             fi
4640             if test ! -f "$xxx"; then
4641                 xxx=$thisdir/Slib$thislib$_a
4642                 $test -f "$xxx" && eval $libscheck
4643                 $test -f "$xxx" && libstyle=static
4644             fi
4645             if $test -f "$xxx"; then
4646                 case "$libstyle" in
4647                 shared) echo "Found -l$thislib (shared)." ;;
4648                 static) echo "Found -l$thislib." ;;
4649                 *)      echo "Found -l$thislib ($libstyle)." ;;
4650                 esac
4651                 case " $dflt " in
4652                 *"-l$thislib "*);;
4653                 *) dflt="$dflt -l$thislib"
4654                    libsfound="$libsfound $xxx"
4655                    yyy=`basename $xxx`
4656                    libsfiles="$libsfiles $yyy"
4657                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4658                    case " $libsdirs " in
4659                    *" $yyy "*) ;;
4660                    *) libsdirs="$libsdirs $yyy" ;;
4661                    esac
4662                    ;;
4663                 esac
4664                 break
4665             fi  
4666         done
4667         if $test ! -f "$xxx"; then
4668             echo "No -l$thislib."
4669         fi
4670 done
4671 set X $dflt
4672 shift
4673 dflt="$*"
4674 case "$libs" in
4675 '') dflt="$dflt";;
4676 *) dflt="$libs";;
4677 esac
4678 case "$dflt" in
4679 ' '|'') dflt='none';;
4680 esac
4681
4682 $cat <<EOM
4683
4684 In order to compile $package on your machine, a number of libraries
4685 are usually needed.  Include any other special libraries here as well.
4686 Say "none" for none.  The default list is almost always right.
4687 EOM
4688
4689 echo " "
4690 rp="What libraries to use?"
4691 . ./myread
4692 case "$ans" in
4693 none) libs=' ';;
4694 *) libs="$ans";;
4695 esac
4696
4697 : determine optimization, if desired, or use for debug flag also
4698 case "$optimize" in
4699 ' '|$undef) dflt='none';;
4700 '') dflt='-O';;
4701 *) dflt="$optimize";;
4702 esac
4703 $cat <<EOH
4704
4705 By default, $package compiles with the -O flag to use the optimizer.
4706 Alternately, you might want to use the symbolic debugger, which uses
4707 the -g flag (on traditional Unix systems).  Either flag can be
4708 specified here.  To use neither flag, specify the word "none".
4709
4710 EOH
4711 rp="What optimizer/debugger flag should be used?"
4712 . ./myread
4713 optimize="$ans"
4714 case "$optimize" in
4715 'none') optimize=" ";;
4716 esac
4717
4718 dflt=''
4719 : We will not override a previous value, but we might want to
4720 : augment a hint file
4721 case "$hint" in
4722 default|recommended)
4723         case "$gccversion" in
4724         1*) dflt='-fpcc-struct-return' ;;
4725         esac
4726         case "$optimize" in
4727         *-g*) dflt="$dflt -DDEBUGGING";;
4728         esac
4729         case "$gccversion" in
4730         2*) if test -d /etc/conf/kconfig.d &&
4731                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4732                 then
4733                         # Interactive Systems (ISC) POSIX mode.
4734                         dflt="$dflt -posix"
4735                 fi
4736                 ;;
4737         esac
4738         case "$gccversion" in
4739         1*) ;;
4740         2.[0-8]*) ;;
4741         ?*)     echo " "
4742                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4743                 echo 'int main(void) { return 0; }' > gcctest.c
4744                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4745                         echo "Yes, it does." 2>&1
4746                         case "$ccflags" in
4747                         *strict-aliasing*)
4748                                 echo "Leaving current flags $ccflags alone." 2>&1
4749                                 ;;
4750                         *) dflt="$dflt -fno-strict-aliasing" ;;
4751                         esac
4752                 else
4753                         echo "Nope, it doesn't, but that's ok." 2>&1
4754                 fi
4755                 ;;
4756         esac
4757         # For gcc, adding -pipe speeds up compilations for some, but apparently
4758         # some assemblers can't read from stdin.  (It also slows down compilations
4759         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
4760         case "$gccversion" in
4761         ?*)     echo " "
4762                 echo "Checking if your compiler accepts -pipe" 2>&1
4763                 echo 'int main(void) { return 0; }' > gcctest.c
4764                 if $cc -pipe -o gcctest gcctest.c; then
4765                         echo "Yes, it does." 2>&1
4766                         case "$ccflags" in
4767                         *-pipe*)
4768                                 echo "Leaving current flags $ccflags alone." 2>&1
4769                                 ;;
4770                         *) dflt="$dflt -pipe" ;;
4771                         esac
4772                 else
4773                         echo "Nope, it doesn't, but that's ok." 2>&1
4774                 fi
4775
4776                 echo "Checking if your compiler accepts -Wdeclaration-after-statement" 2>&1
4777                 echo 'int main(void) { return 0; }' > gcctest.c
4778                 if $cc -Wdeclaration-after-statement -o gcctest gcctest.c; then
4779                         echo "Yes, it does." 2>&1
4780                         case "$ccflags" in
4781                         *-Wdeclaration-after-statement*)
4782                                 echo "Leaving current flags $ccflags alone." 2>&1
4783                                 ;;
4784                         *) dflt="$dflt -Wdeclaration-after-statement" ;;
4785                         esac
4786                 else
4787                         echo "Nope, it doesn't, but that's ok." 2>&1
4788                 fi
4789                 ;;
4790         esac
4791         ;;
4792 esac
4793
4794 case "$mips_type" in
4795 *BSD*|'') inclwanted="$locincpth $usrinc";;
4796 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4797 esac
4798 for thisincl in $inclwanted; do
4799         if $test -d $thisincl; then
4800                 if $test x$thisincl != x$usrinc; then
4801                         case "$dflt" in
4802                         *" -I$thisincl "*);;
4803                         *) dflt="$dflt -I$thisincl ";;
4804                         esac
4805                 fi
4806         fi
4807 done
4808
4809 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4810         xxx=true;
4811 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4812         xxx=true;
4813 else
4814         xxx=false;
4815 fi;
4816 if $xxx; then
4817         case "$dflt" in
4818         *$2*);;
4819         *) dflt="$dflt -D$2";;
4820         esac;
4821 fi'
4822
4823 set signal.h LANGUAGE_C; eval $inctest
4824
4825 case "$usesocks" in
4826 $define)
4827         ccflags="$ccflags -DSOCKS"
4828         ;;
4829 esac
4830
4831 case "$hint" in
4832 default|recommended) dflt="$ccflags $dflt" ;;
4833 *) dflt="$ccflags";;
4834 esac
4835
4836 case "$dflt" in
4837 ''|' ') dflt=none;;
4838 esac
4839
4840 $cat <<EOH
4841
4842 Your C compiler may want other flags.  For this question you should include
4843 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4844 but you should NOT include libraries or ld flags like -lwhatever.  If you
4845 want $package to honor its debug switch, you should include -DDEBUGGING here.
4846 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4847
4848 To use no flags, specify the word "none".
4849
4850 EOH
4851 set X $dflt
4852 shift
4853 dflt=${1+"$@"}
4854 rp="Any additional cc flags?"
4855 . ./myread
4856 case "$ans" in
4857 none) ccflags='';;
4858 *) ccflags="$ans";;
4859 esac
4860
4861 : the following weeds options from ccflags that are of no interest to cpp
4862 case "$cppflags" in
4863 '') cppflags="$ccflags" ;;
4864 *)  cppflags="$cppflags $ccflags" ;;
4865 esac
4866 case "$gccversion" in
4867 1*) cppflags="$cppflags -D__GNUC__"
4868 esac
4869 case "$mips_type" in
4870 '');;
4871 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4872 esac
4873 case "$cppflags" in
4874 '');;
4875 *)
4876         echo " "
4877         echo "Let me guess what the preprocessor flags are..." >&4
4878         set X $cppflags
4879         shift
4880         cppflags=''
4881         $cat >cpp.c <<'EOM'
4882 #define BLURFL foo
4883
4884 BLURFL xx LFRULB
4885 EOM
4886         previous=''
4887         for flag in $*
4888         do
4889                 case "$flag" in
4890                 -*) ftry="$flag";;
4891                 *) ftry="$previous $flag";;
4892                 esac
4893                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4894                         >cpp1.out 2>/dev/null && \
4895                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4896                         >cpp2.out 2>/dev/null && \
4897                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4898                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4899                 then
4900                         cppflags="$cppflags $ftry"
4901                         previous=''
4902                 else
4903                         previous="$flag"
4904                 fi
4905         done
4906         set X $cppflags
4907         shift
4908         cppflags=${1+"$@"}
4909         case "$cppflags" in
4910         *-*)  echo "They appear to be: $cppflags";;
4911         esac
4912         $rm -f cpp.c cpp?.out
4913         ;;
4914 esac
4915
4916 : flags used in final linking phase
4917 case "$ldflags" in
4918 '') if ./venix; then
4919                 dflt='-i -z'
4920         else
4921                 dflt=''
4922         fi
4923         case "$ccflags" in
4924         *-posix*) dflt="$dflt -posix" ;;
4925         esac
4926         ;;
4927 *) dflt="$ldflags";;
4928 esac
4929
4930 : Try to guess additional flags to pick up local libraries.
4931 for thislibdir in $libpth; do
4932         case " $loclibpth " in
4933         *" $thislibdir "*)
4934                 case "$dflt " in
4935                 *"-L$thislibdir "*) ;;
4936                 *)  dflt="$dflt -L$thislibdir" ;;
4937                 esac
4938                 ;;
4939         esac
4940 done
4941
4942 case "$dflt" in
4943 '') dflt='none' ;;
4944 esac
4945
4946 $cat <<EOH
4947
4948 Your C linker may need flags.  For this question you should
4949 include -L/whatever and any other flags used by the C linker, but you
4950 should NOT include libraries like -lwhatever.
4951
4952 Make sure you include the appropriate -L/path flags if your C linker
4953 does not normally search all of the directories you specified above,
4954 namely
4955         $libpth
4956 To use no flags, specify the word "none".
4957
4958 EOH
4959
4960 rp="Any additional ld flags (NOT including libraries)?"
4961 . ./myread
4962 case "$ans" in
4963 none) ldflags='';;
4964 *) ldflags="$ans";;
4965 esac
4966 rmlist="$rmlist pdp11"
4967
4968 : coherency check
4969 echo " "
4970 echo "Checking your choice of C compiler and flags for coherency..." >&4
4971 $cat > try.c <<'EOF'
4972 #include <stdio.h>
4973 int main() { printf("Ok\n"); return(0); }
4974 EOF
4975 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4976 shift
4977 $cat >try.msg <<'EOM'
4978 I've tried to compile and run the following simple program:
4979
4980 EOM
4981 $cat try.c >> try.msg
4982
4983 $cat >> try.msg <<EOM
4984
4985 I used the command:
4986
4987         $*
4988         $run ./try
4989
4990 and I got the following output:
4991
4992 EOM
4993 dflt=y
4994 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4995         if $sh -c "$run ./try" >>try.msg 2>&1; then
4996                 xxx=`$run ./try`
4997                 case "$xxx" in
4998                 "Ok") dflt=n ;;
4999                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5000                         case " $libs " in
5001                         *" -lsfio "*)
5002                                 cat >> try.msg <<'EOQS'
5003 If $libs contains -lsfio, and sfio is mis-configured, then it
5004 sometimes (apparently) runs and exits with a 0 status, but with no
5005 output!  It may have to do with sfio's use of _exit vs. exit.
5006
5007 EOQS
5008                                 rp="You have a big problem.  Shall I abort Configure"
5009                                 dflt=y
5010                                 ;;
5011                         esac
5012                         ;;
5013                 esac
5014         else
5015                 echo "The program compiled OK, but exited with status $?." >>try.msg
5016                 rp="You have a problem.  Shall I abort Configure"
5017                 dflt=y
5018         fi
5019 else
5020         echo "I can't compile the test program." >>try.msg
5021         rp="You have a BIG problem.  Shall I abort Configure"
5022         dflt=y
5023 fi
5024 case "$dflt" in
5025 y)
5026         $cat try.msg >&4
5027         case "$knowitall" in
5028         '')
5029                 echo "(The supplied flags or libraries might be incorrect.)"
5030                 ;;
5031         *) dflt=n;;
5032         esac
5033         echo " "
5034         . ./myread
5035         case "$ans" in
5036         n*|N*) ;;
5037         *)      echo "Ok.  Stopping Configure." >&4
5038                 exit 1
5039                 ;;
5040         esac
5041         ;;
5042 n) echo "OK, that should do.";;
5043 esac
5044 $rm -f try try.* core
5045
5046 : define a shorthand compile call
5047 compile='
5048 mc_file=$1;
5049 shift;
5050 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5051 : define a shorthand compile call for compilations that should be ok.
5052 compile_ok='
5053 mc_file=$1;
5054 shift;
5055 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5056
5057 : determine filename position in cpp output
5058 echo " "
5059 echo "Computing filename position in cpp output for #include directives..." >&4
5060 case "$osname" in
5061 vos) testaccess=-e ;;
5062 *)   testaccess=-r ;;
5063 esac
5064 echo '#include <stdio.h>' > foo.c
5065 $cat >fieldn <<EOF
5066 $startsh
5067 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5068 $grep '^[       ]*#.*stdio\.h' | \
5069 while read cline; do
5070         pos=1
5071         set \$cline
5072         while $test \$# -gt 0; do
5073                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5074                         echo "\$pos"
5075                         exit 0
5076                 fi
5077                 shift
5078                 pos=\`expr \$pos + 1\`
5079         done
5080 done
5081 EOF
5082 chmod +x fieldn
5083 fieldn=`./fieldn`
5084 $rm -f foo.c fieldn
5085 case $fieldn in
5086 '') pos='???';;
5087 1) pos=first;;
5088 2) pos=second;;
5089 3) pos=third;;
5090 *) pos="${fieldn}th";;
5091 esac
5092 echo "Your cpp writes the filename in the $pos field of the line."
5093
5094 case "$osname" in
5095 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5096 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5097 *)   cppfilter='' ;;
5098 esac
5099 : locate header file
5100 $cat >findhdr <<EOF
5101 $startsh
5102 wanted=\$1
5103 name=''
5104 for usrincdir in $usrinc
5105 do
5106         if test -f \$usrincdir/\$wanted; then
5107                 echo "\$usrincdir/\$wanted"
5108                 exit 0
5109         fi
5110 done
5111 awkprg='{ print \$$fieldn }'
5112 echo "#include <\$wanted>" > foo\$\$.c
5113 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5114 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5115 while read cline; do
5116         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5117         case "\$name" in
5118         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5119         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5120         *) exit 2;;
5121         esac;
5122 done;
5123 #
5124 # status = 0: grep returned 0 lines, case statement not executed
5125 # status = 1: headerfile found
5126 # status = 2: while loop executed, no headerfile found
5127 #
5128 status=\$?
5129 $rm -f foo\$\$.c;
5130 if test \$status -eq 1; then
5131         exit 0;
5132 fi
5133 exit 1
5134 EOF
5135 chmod +x findhdr
5136
5137 : define an alternate in-header-list? function
5138 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5139 cont=true; xxf="echo \"<\$1> found.\" >&4";
5140 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5141 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5142 esac;
5143 case $# in 4) instead=instead;; *) instead="at last";; esac;
5144 while $test "$cont"; do
5145         xxx=`./findhdr $1`
5146         var=$2; eval "was=\$$2";
5147         if $test "$xxx" && $test -r "$xxx";
5148         then eval $xxf;
5149         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5150                 cont="";
5151         else eval $xxnf;
5152         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5153         set $yyy; shift; shift; yyy=$@;
5154         case $# in 0) cont="";;
5155         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5156                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5157         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5158                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5159         esac;
5160 done;
5161 while $test "$yyy";
5162 do set $yyy; var=$2; eval "was=\$$2";
5163         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5164         set $yyy; shift; shift; yyy=$@;
5165 done'
5166
5167 : see if stdlib is available
5168 set stdlib.h i_stdlib
5169 eval $inhdr
5170
5171 : check for lengths of integral types
5172 echo " "
5173 case "$intsize" in
5174 '')
5175         echo "Checking to see how big your integers are..." >&4
5176         $cat >try.c <<EOCP
5177 #include <stdio.h>
5178 #$i_stdlib I_STDLIB
5179 #ifdef I_STDLIB
5180 #include <stdlib.h>
5181 #endif
5182 int main()
5183 {
5184         printf("intsize=%d;\n", (int)sizeof(int));
5185         printf("longsize=%d;\n", (int)sizeof(long));
5186         printf("shortsize=%d;\n", (int)sizeof(short));
5187         exit(0);
5188 }
5189 EOCP
5190         set try
5191         if eval $compile_ok && $run ./try > /dev/null; then
5192                 eval `$run ./try`
5193                 echo "Your integers are $intsize bytes long."
5194                 echo "Your long integers are $longsize bytes long."
5195                 echo "Your short integers are $shortsize bytes long."
5196         else
5197                 $cat >&4 <<EOM
5198 !
5199 Help! I can't compile and run the intsize test program: please enlighten me!
5200 (This is probably a misconfiguration in your system or libraries, and
5201 you really ought to fix it.  Still, I'll try anyway.)
5202 !
5203 EOM
5204                 dflt=4
5205                 rp="What is the size of an integer (in bytes)?"
5206                 . ./myread
5207                 intsize="$ans"
5208                 dflt=$intsize
5209                 rp="What is the size of a long integer (in bytes)?"
5210                 . ./myread
5211                 longsize="$ans"
5212                 dflt=2
5213                 rp="What is the size of a short integer (in bytes)?"
5214                 . ./myread
5215                 shortsize="$ans"
5216         fi
5217         ;;
5218 esac
5219 $rm -f try try.*
5220
5221 : check for long long
5222 echo " "
5223 echo "Checking to see if you have long long..." >&4
5224 echo 'int main() { long long x = 7; return 0; }' > try.c
5225 set try
5226 if eval $compile; then
5227         val="$define"
5228         echo "You have long long."
5229 else
5230         val="$undef"
5231         echo "You do not have long long."
5232 fi
5233 $rm try.*
5234 set d_longlong
5235 eval $setvar
5236
5237 : check for length of long long
5238 case "${d_longlong}${longlongsize}" in
5239 $define)
5240         echo " "
5241         echo "Checking to see how big your long longs are..." >&4
5242         $cat >try.c <<'EOCP'
5243 #include <stdio.h>
5244 int main()
5245 {
5246     printf("%d\n", (int)sizeof(long long));
5247     return(0);
5248 }
5249 EOCP
5250         set try
5251         if eval $compile_ok; then
5252                 longlongsize=`$run ./try`
5253                 echo "Your long longs are $longlongsize bytes long."
5254         else
5255                 dflt='8'
5256                 echo " "
5257                 echo "(I can't seem to compile the test program.  Guessing...)"
5258                 rp="What is the size of a long long (in bytes)?"
5259                 . ./myread
5260                 longlongsize="$ans"
5261         fi
5262         if $test "X$longsize" = "X$longlongsize"; then
5263                 echo "(That isn't any different from an ordinary long.)"
5264         fi      
5265         ;;
5266 esac
5267 $rm -f try.* try
5268
5269 : see if inttypes.h is available
5270 : we want a real compile instead of Inhdr because some systems
5271 : have an inttypes.h which includes non-existent headers
5272 echo " "
5273 $cat >try.c <<EOCP
5274 #include <inttypes.h>
5275 int main() {
5276         static int32_t foo32 = 0x12345678;
5277 }
5278 EOCP
5279 set try
5280 if eval $compile; then
5281         echo "<inttypes.h> found." >&4
5282         val="$define"
5283 else
5284         echo "<inttypes.h> NOT found." >&4
5285         val="$undef"
5286 fi
5287 $rm -f try.c try
5288 set i_inttypes
5289 eval $setvar
5290
5291 : check for int64_t
5292 echo " "
5293 echo "Checking to see if you have int64_t..." >&4
5294 $cat >try.c <<EOCP
5295 #include <sys/types.h>
5296 #$i_inttypes I_INTTYPES
5297 #ifdef I_INTTYPES
5298 #include <inttypes.h>
5299 #endif
5300 int main() { int64_t x = 7; }
5301 EOCP
5302 set try
5303 if eval $compile; then
5304         val="$define"
5305         echo "You have int64_t."
5306 else
5307         val="$undef"
5308         echo "You do not have int64_t."
5309 fi
5310 $rm -f try try.*
5311 set d_int64_t
5312 eval $setvar
5313
5314
5315 echo " "
5316 echo "Checking which 64-bit integer type we could use..." >&4
5317
5318 case "$intsize" in
5319 8) val=int
5320    set quadtype
5321    eval $setvar
5322    val='"unsigned int"'
5323    set uquadtype
5324    eval $setvar
5325    quadkind=1
5326    ;;
5327 *) case "$longsize" in
5328    8) val=long
5329       set quadtype
5330       eval $setvar
5331       val='"unsigned long"'
5332       set uquadtype
5333       eval $setvar
5334       quadkind=2
5335       ;;
5336    *) case "$d_longlong:$longlongsize" in
5337       define:8)
5338         val='"long long"'
5339         set quadtype
5340         eval $setvar
5341         val='"unsigned long long"'
5342         set uquadtype
5343         eval $setvar
5344         quadkind=3
5345         ;;
5346       *) case "$d_int64_t" in
5347          define)
5348            val=int64_t
5349            set quadtype
5350            eval $setvar
5351            val=uint64_t
5352            set uquadtype
5353            eval $setvar
5354            quadkind=4
5355            ;;
5356          esac
5357          ;;
5358       esac
5359       ;;
5360    esac
5361    ;;
5362 esac
5363
5364 case "$quadtype" in
5365 '')     echo "Alas, no 64-bit integer types in sight." >&4
5366         d_quad="$undef"
5367         ;;
5368 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5369         d_quad="$define"
5370         ;;
5371 esac
5372
5373
5374 case "$uselonglong" in
5375 "$define"|true|[yY]*)
5376         cat <<EOM >&4
5377
5378 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5379 EOM
5380         use64bitint="$define"
5381         ;;
5382 esac                          
5383 case "$use64bits" in
5384 "$define"|true|[yY]*)
5385         cat <<EOM >&4
5386
5387 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5388 EOM
5389         use64bitint="$define"
5390         ;;
5391 esac                          
5392 case "$use64bitints" in
5393 "$define"|true|[yY]*)
5394         cat <<EOM >&4
5395
5396 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5397 EOM
5398         use64bitint="$define"
5399         ;;
5400 esac                          
5401 case "$use64bitsint" in
5402 "$define"|true|[yY]*)
5403         cat <<EOM >&4
5404
5405 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5406 EOM
5407         use64bitint="$define"
5408         ;;
5409 esac                          
5410 case "$uselonglongs" in
5411 "$define"|true|[yY]*)
5412         cat <<EOM >&4
5413
5414 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5415 EOM
5416         use64bitint="$define"
5417         ;;
5418 esac                          
5419 case "$use64bitsall" in
5420 "$define"|true|[yY]*)
5421         cat <<EOM >&4
5422
5423 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5424 EOM
5425         use64bitall="$define"
5426         ;;
5427 esac                          
5428
5429 case "$ccflags" in
5430 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5431 esac
5432 case "$use64bitall" in
5433 "$define"|true|[yY]*) use64bitint="$define" ;;
5434 esac
5435
5436 case "$longsize" in
5437 8) cat <<EOM
5438
5439 You have natively 64-bit long integers.
5440 EOM
5441    val="$define"
5442    ;;
5443 *) case "$use64bitint" in
5444    "$define"|true|[yY]*) dflt='y';;
5445    *) dflt='n';;
5446    esac
5447    case "$d_quad" in
5448    "$define") ;;
5449    *) dflt='n' ;;
5450    esac
5451    cat <<EOM
5452
5453 Perl can be built to take advantage of 64-bit integer types
5454 on some systems.  To do so, Configure can be run with -Duse64bitint.
5455 Choosing this option will most probably introduce binary incompatibilities.
5456
5457 If this doesn't make any sense to you, just accept the default '$dflt'.
5458 (The default has been chosen based on your configuration.)
5459 EOM
5460    rp='Try to use 64-bit integers, if available?'
5461    . ./myread
5462    case "$ans" in
5463    [yY]*) val="$define" ;;
5464    *)     val="$undef"  ;;
5465    esac
5466    ;;
5467 esac
5468 set use64bitint
5469 eval $setvar
5470
5471 case "$use64bitall" in
5472 "$define"|true|[yY]*) dflt='y' ;;
5473 *) case "$longsize" in
5474    8) dflt='y' ;;
5475    *) dflt='n' ;;
5476    esac
5477    ;;
5478 esac    
5479 cat <<EOM
5480
5481 You may also choose to try maximal 64-bitness.  It means using as much
5482 64-bitness as possible on the platform.  This in turn means even more
5483 binary incompatibilities.  On the other hand, your platform may not
5484 have any more 64-bitness available than what you already have chosen.
5485
5486 If this doesn't make any sense to you, just accept the default '$dflt'.
5487 (The default has been chosen based on your configuration.)
5488 EOM
5489 rp='Try to use maximal 64-bit support, if available?'
5490 . ./myread
5491 case "$ans" in
5492 [yY]*) val="$define" ;;
5493 *)     val="$undef"  ;;
5494 esac
5495 set use64bitall
5496 eval $setvar
5497 case "$use64bitall" in
5498 "$define")
5499         case "$use64bitint" in
5500         "$undef")
5501                 cat <<EOM
5502
5503 Since you have chosen a maximally 64-bit build, I'm also turning on
5504 the use of 64-bit integers.
5505 EOM
5506                 use64bitint="$define" ;;
5507         esac
5508         ;;
5509 esac
5510
5511 : Look for a hint-file generated 'call-back-unit'.  If the
5512 : user has specified that a 64-bit perl is to be built,
5513 : we may need to set or change some other defaults.
5514 if $test -f use64bitint.cbu; then
5515         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5516         . ./use64bitint.cbu
5517 fi
5518 case "$use64bitint" in
5519 "$define"|true|[yY]*)
5520         case "$longsize" in
5521         4) case "$archname64" in
5522            '') archname64=64int ;;
5523            esac
5524            ;;
5525         esac
5526         ;;
5527 esac
5528
5529 : Look for a hint-file generated 'call-back-unit'.  If the
5530 : user has specified that a maximally 64-bit perl is to be built,
5531 : we may need to set or change some other defaults.
5532 if $test -f use64bitall.cbu; then
5533         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5534         . ./use64bitall.cbu
5535 fi
5536 case "$use64bitall" in
5537 "$define"|true|[yY]*)
5538         case "$longsize" in
5539         4) case "$archname64" in
5540            ''|64int) archname64=64all ;;
5541            esac
5542            ;;
5543         esac
5544         ;;
5545 esac
5546
5547 case "$d_quad:$use64bitint" in
5548 $undef:$define)
5549         cat >&4 <<EOF
5550
5551 *** You have chosen to use 64-bit integers,
5552 *** but none can be found.
5553 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5554 *** Cannot continue, aborting.
5555
5556 EOF
5557         exit 1
5558         ;;
5559 esac
5560
5561 : check for length of double
5562 echo " "
5563 case "$doublesize" in
5564 '')
5565         echo "Checking to see how big your double precision numbers are..." >&4
5566         $cat >try.c <<EOCP
5567 #include <stdio.h>
5568 #$i_stdlib I_STDLIB
5569 #ifdef I_STDLIB
5570 #include <stdlib.h>
5571 #endif
5572 int main()
5573 {
5574     printf("%d\n", (int)sizeof(double));
5575     exit(0);
5576 }
5577 EOCP
5578         set try
5579         if eval $compile_ok; then
5580                 doublesize=`$run ./try`
5581                 echo "Your double is $doublesize bytes long."
5582         else
5583                 dflt='8'
5584                 echo "(I can't seem to compile the test program.  Guessing...)"
5585                 rp="What is the size of a double precision number (in bytes)?"
5586                 . ./myread
5587                 doublesize="$ans"
5588         fi
5589         ;;
5590 esac
5591 $rm -f try.c try
5592
5593 : check for long doubles
5594 echo " "
5595 echo "Checking to see if you have long double..." >&4
5596 echo 'int main() { long double x = 7.0; }' > try.c
5597 set try
5598 if eval $compile; then
5599         val="$define"
5600         echo "You have long double."
5601 else
5602         val="$undef"
5603         echo "You do not have long double."
5604 fi
5605 $rm try.*
5606 set d_longdbl
5607 eval $setvar
5608
5609 : check for length of long double
5610 case "${d_longdbl}${longdblsize}" in
5611 $define)
5612         echo " "
5613         echo "Checking to see how big your long doubles are..." >&4
5614         $cat >try.c <<'EOCP'
5615 #include <stdio.h>
5616 int main()
5617 {
5618         printf("%d\n", sizeof(long double));
5619 }
5620 EOCP
5621         set try
5622         set try
5623         if eval $compile; then
5624                 longdblsize=`$run ./try`
5625                 echo "Your long doubles are $longdblsize bytes long."
5626         else
5627                 dflt='8'
5628                 echo " "
5629                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5630                 rp="What is the size of a long double (in bytes)?"
5631                 . ./myread
5632                 longdblsize="$ans"
5633         fi
5634         if $test "X$doublesize" = "X$longdblsize"; then
5635                 echo "That isn't any different from an ordinary double."
5636                 echo "I'll keep your setting anyway, but you may see some"
5637                 echo "harmless compilation warnings."
5638         fi      
5639         ;;
5640 esac
5641 $rm -f try.* try
5642
5643 : determine the architecture name
5644 echo " "
5645 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5646         tarch=`arch`"-$osname"
5647 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5648         if uname -m > tmparch 2>&1 ; then
5649                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5650                         -e 's/$/'"-$osname/" tmparch`
5651         else
5652                 tarch="$osname"
5653         fi
5654         $rm -f tmparch
5655 else
5656         tarch="$osname"
5657 fi
5658 case "$myarchname" in
5659 ''|"$tarch") ;;
5660 *)
5661         echo "(Your architecture name used to be $myarchname.)"
5662         archname=''
5663         ;;
5664 esac
5665 case "$targetarch" in
5666 '') ;;
5667 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5668 esac
5669 myarchname="$tarch"
5670 case "$archname" in
5671 '') dflt="$tarch";;
5672 *) dflt="$archname";;
5673 esac
5674 rp='What is your architecture name'
5675 . ./myread
5676 archname="$ans"
5677 case "$usethreads" in
5678 $define)
5679         echo "Threads selected." >&4
5680         case "$archname" in
5681         *-thread*) echo "...and architecture name already has -thread." >&4
5682                 ;;
5683         *)      archname="$archname-thread"
5684                 echo "...setting architecture name to $archname." >&4
5685                 ;;
5686         esac
5687         ;;
5688 esac
5689 case "$usemultiplicity" in
5690 $define)
5691         echo "Multiplicity selected." >&4
5692         case "$archname" in
5693         *-multi*) echo "...and architecture name already has -multi." >&4
5694                 ;;
5695         *)      archname="$archname-multi"
5696                 echo "...setting architecture name to $archname." >&4
5697                 ;;
5698         esac
5699         ;;
5700 esac
5701 case "$use64bitint$use64bitall" in
5702 *"$define"*)
5703         case "$archname64" in
5704         '')
5705                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5706                 ;;
5707         *)
5708                 case "$use64bitint" in
5709                 "$define") echo "64 bit integers selected." >&4 ;;
5710                 esac
5711                 case "$use64bitall" in
5712                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5713                 esac
5714                 case "$archname" in
5715                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5716                         ;;
5717                 *)      archname="$archname-$archname64"
5718                         echo "...setting architecture name to $archname." >&4
5719                         ;;
5720                 esac
5721                 ;;
5722         esac
5723 esac
5724 case "$uselongdouble" in
5725 $define)
5726         echo "Long doubles selected." >&4
5727         case "$longdblsize" in
5728         $doublesize)
5729                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
5730                 ;;
5731         *)
5732                 case "$archname" in
5733                 *-ld*) echo "...and architecture name already has -ld." >&4
5734                         ;;
5735                 *)      archname="$archname-ld"
5736                         echo "...setting architecture name to $archname." >&4
5737                         ;;
5738                 esac
5739                 ;;
5740         esac
5741         ;;
5742 esac
5743 case "$useperlio" in
5744 $define)
5745         echo "Perlio selected." >&4
5746         ;;
5747 *)
5748         echo "Perlio not selected, using stdio." >&4
5749         case "$archname" in
5750         *-stdio*) echo "...and architecture name already has -stdio." >&4
5751                 ;;
5752         *)      archname="$archname-stdio"
5753                 echo "...setting architecture name to $archname." >&4
5754                 ;;
5755         esac
5756         ;;
5757 esac
5758 if $test -f archname.cbu; then
5759         echo "Your platform has some specific hints for architecture name, using them..."
5760         . ./archname.cbu
5761 fi
5762
5763 : determine root of directory hierarchy where package will be installed.
5764 case "$prefix" in
5765 '')
5766         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5767         ;;
5768 *?/)
5769         dflt=`echo "$prefix" | sed 's/.$//'`
5770         ;;
5771 *)
5772         dflt="$prefix"
5773         ;;
5774 esac
5775 $cat <<EOM
5776
5777 By default, $package will be installed in $dflt/bin, manual pages
5778 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5779 installation directories. Typically this is something like /usr/local.
5780 If you wish to have binaries under /usr/bin but other parts of the
5781 installation under /usr/local, that's ok: you will be prompted
5782 separately for each of the installation directories, the prefix being
5783 only used to set the defaults.
5784
5785 EOM
5786 fn=d~
5787 rp='Installation prefix to use?'
5788 . ./getfile
5789 oldprefix=''
5790 case "$prefix" in
5791 '') ;;
5792 *)
5793         case "$ans" in
5794         "$prefix") ;;
5795         *) oldprefix="$prefix";;
5796         esac
5797         ;;
5798 esac
5799 prefix="$ans"
5800 prefixexp="$ansexp"
5801
5802 case "$afsroot" in
5803 '')     afsroot=/afs ;;
5804 *)      afsroot=$afsroot ;;
5805 esac
5806
5807 : is AFS running?
5808 echo " "
5809 case "$afs" in
5810 $define|true)   afs=true ;;
5811 $undef|false)   afs=false ;;
5812 *)      if test -d $afsroot; then
5813                 afs=true
5814         else
5815                 afs=false
5816         fi
5817         ;;
5818 esac
5819 if $afs; then
5820         echo "AFS may be running... I'll be extra cautious then..." >&4
5821 else
5822         echo "AFS does not seem to be running..." >&4
5823 fi
5824
5825 : determine installation prefix for where package is to be installed.
5826 if $afs; then 
5827 $cat <<EOM
5828
5829 Since you are running AFS, I need to distinguish the directory in which
5830 files will reside from the directory in which they are installed (and from
5831 which they are presumably copied to the former directory by occult means).
5832
5833 EOM
5834         case "$installprefix" in
5835         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5836         *) dflt="$installprefix";;
5837         esac
5838 else
5839 $cat <<EOM
5840
5841 In some special cases, particularly when building $package for distribution,
5842 it is convenient to distinguish the directory in which files should be
5843 installed from the directory ($prefix) in which they will
5844 eventually reside.  For most users, these two directories are the same.
5845
5846 EOM
5847         case "$installprefix" in
5848         '') dflt=$prefix ;;
5849         *) dflt=$installprefix;;
5850         esac
5851 fi
5852 fn=d~
5853 rp='What installation prefix should I use for installing files?'
5854 . ./getfile
5855 installprefix="$ans"
5856 installprefixexp="$ansexp"
5857
5858 : set the prefixit variable, to compute a suitable default value
5859 prefixit='case "$3" in
5860 ""|none)
5861         case "$oldprefix" in
5862         "") eval "$1=\"\$$2\"";;
5863         *)
5864                 case "$3" in
5865                 "") eval "$1=";;
5866                 none)
5867                         eval "tp=\"\$$2\"";
5868                         case "$tp" in
5869                         ""|" ") eval "$1=\"\$$2\"";;
5870                         *) eval "$1=";;
5871                         esac;;
5872                 esac;;
5873         esac;;
5874 *)
5875         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5876         case "$tp" in
5877         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5878         /*-$oldprefix/*|\~*-$oldprefix/*)
5879                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5880         *) eval "$1=\"\$$2\"";;
5881         esac;;
5882 esac'
5883
5884 : get the patchlevel
5885 echo " "
5886 echo "Getting the current patchlevel..." >&4
5887 if $test -r $rsrc/patchlevel.h;then
5888         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5889         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5890         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5891         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5892         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5893         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5894        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
5895 else
5896         revision=0
5897         patchlevel=0
5898         subversion=0
5899         api_revision=0
5900         api_version=0
5901         api_subversion=0
5902         perl_patchlevel=0
5903         $echo "(You do not have patchlevel.h.  Eek.)"
5904 fi
5905 if $test -r $rsrc/.patch ; then  
5906         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
5907                 perl_patchlevel=`cat $rsrc/.patch`
5908         fi
5909 fi
5910 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
5911 version_patchlevel_string="version $patchlevel subversion $subversion"
5912 case "$perl_patchlevel" in
5913 0|'') ;;
5914 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
5915 esac
5916
5917 $echo "(You have $package $version_patchlevel_string.)"
5918
5919 case "$osname" in
5920 dos|vms)
5921         : XXX Should be a Configure test for double-dots in filenames.
5922         version=`echo $revision $patchlevel $subversion | \
5923                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5924         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5925                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5926         ;;
5927 *)
5928         version=`echo $revision $patchlevel $subversion | \
5929                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5930         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5931                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5932         ;;
5933 esac
5934 : Special case the 5.005_xx maintenance series, which used 5.005
5935 : without any subversion label as a subdirectory in $sitelib
5936 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5937         api_versionstring='5.005'
5938 fi
5939
5940 : determine installation style
5941 : For now, try to deduce it from prefix unless it is already set.
5942 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5943 case "$installstyle" in
5944 '')     case "$prefix" in
5945                 *perl*) dflt='lib';;
5946                 *) dflt='lib/perl5' ;;
5947         esac
5948         ;;
5949 *)      dflt="$installstyle" ;;
5950 esac
5951 : Probably not worth prompting for this since we prompt for all
5952 : the directories individually, and the prompt would be too long and
5953 : confusing anyway.
5954 installstyle=$dflt
5955
5956 : determine where private library files go
5957 : Usual default is /usr/local/lib/perl5/$version.
5958 : Also allow things like /opt/perl/lib/$version, since 
5959 : /opt/perl/lib/perl5... would be redundant.
5960 : The default "style" setting is made in installstyle.U
5961 case "$installstyle" in
5962 *lib/perl5*) set dflt privlib lib/$package/$version ;;
5963 *)       set dflt privlib lib/$version ;;
5964 esac
5965 eval $prefixit
5966 $cat <<EOM
5967
5968 There are some auxiliary files for $package that need to be put into a
5969 private library directory that is accessible by everyone.
5970
5971 EOM
5972 fn=d~+
5973 rp='Pathname where the private library files will reside?'
5974 . ./getfile
5975 privlib="$ans"
5976 privlibexp="$ansexp"
5977 : Change installation prefix, if necessary.
5978 if $test X"$prefix" != X"$installprefix"; then
5979         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5980 else
5981         installprivlib="$privlibexp"
5982 fi
5983
5984 : set the prefixup variable, to restore leading tilda escape
5985 prefixup='case "$prefixexp" in
5986 "$prefix") ;;
5987 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5988 esac'
5989
5990 : determine where public architecture dependent libraries go
5991 set archlib archlib
5992 eval $prefixit
5993 : privlib default is /usr/local/lib/$package/$version
5994 : archlib default is /usr/local/lib/$package/$version/$archname
5995 : privlib may have an optional trailing /share.
5996 tdflt=`echo $privlib | $sed 's,/share$,,'`
5997 tdflt=$tdflt/$archname
5998 case "$archlib" in
5999 '')     dflt=$tdflt
6000         ;;
6001 *)      dflt="$archlib"
6002     ;;
6003 esac
6004 $cat <<EOM
6005
6006 $spackage contains architecture-dependent library files.  If you are
6007 sharing libraries in a heterogeneous environment, you might store
6008 these files in a separate location.  Otherwise, you can just include
6009 them with the rest of the public library files.
6010
6011 EOM
6012 fn=d+~
6013 rp='Where do you want to put the public architecture-dependent libraries?'
6014 . ./getfile
6015 archlib="$ans"
6016 archlibexp="$ansexp"
6017 if $test X"$archlib" = X"$privlib"; then
6018         d_archlib="$undef"
6019 else
6020         d_archlib="$define"
6021 fi
6022 : Change installation prefix, if necessary.
6023 if $test X"$prefix" != X"$installprefix"; then
6024         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6025 else
6026         installarchlib="$archlibexp"
6027 fi
6028
6029 : see if setuid scripts can be secure
6030 $cat <<EOM
6031
6032 Some kernels have a bug that prevents setuid #! scripts from being
6033 secure.  Some sites have disabled setuid #! scripts because of this.
6034
6035 First let's decide if your kernel supports secure setuid #! scripts.
6036 (If setuid #! scripts would be secure but have been disabled anyway,
6037 don't say that they are secure if asked.)
6038
6039 EOM
6040
6041 val="$undef"
6042 if $test -d /dev/fd; then
6043         echo "#!$ls" >reflect
6044         chmod +x,u+s reflect
6045         ./reflect >flect 2>&1
6046         if $contains "/dev/fd" flect >/dev/null; then
6047                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6048                 val="$define"
6049         else
6050                 $cat <<EOM
6051 If you are not sure if they are secure, I can check but I'll need a
6052 username and password different from the one you are using right now.
6053 If you don't have such a username or don't want me to test, simply
6054 enter 'none'.
6055
6056 EOM
6057                 rp='Other username to test security of setuid scripts with?'
6058                 dflt='none'
6059                 . ./myread
6060                 case "$ans" in
6061                 n|none)
6062                         case "$d_suidsafe" in
6063                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6064                                 dflt=n;;
6065                         "$undef")
6066                                 echo "Well, the $hint value is *not* secure." >&4
6067                                 dflt=n;;
6068                         *)      echo "Well, the $hint value *is* secure." >&4
6069                                 dflt=y;;
6070                         esac
6071                         ;;
6072                 *)
6073                         $rm -f reflect flect
6074                         echo "#!$ls" >reflect
6075                         chmod +x,u+s reflect
6076                         echo >flect
6077                         chmod a+w flect
6078                         echo '"su" will (probably) prompt you for '"$ans's password."
6079                         su $ans -c './reflect >flect'
6080                         if $contains "/dev/fd" flect >/dev/null; then
6081                                 echo "Okay, it looks like setuid scripts are secure." >&4
6082                                 dflt=y
6083                         else
6084                                 echo "I don't think setuid scripts are secure." >&4
6085                                 dflt=n
6086                         fi
6087                         ;;
6088                 esac
6089                 rp='Does your kernel have *secure* setuid scripts?'
6090                 . ./myread
6091                 case "$ans" in
6092                 [yY]*)  val="$define";;
6093                 *)      val="$undef";;
6094                 esac
6095         fi
6096 else
6097         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6098         echo "(That's for file descriptors, not floppy disks.)"
6099         val="$undef"
6100 fi
6101 set d_suidsafe
6102 eval $setvar
6103
6104 $rm -f reflect flect
6105
6106 : now see if they want to do setuid emulation
6107 echo " "
6108 val="$undef"
6109 case "$d_suidsafe" in
6110 "$define")
6111         val="$undef"
6112         echo "No need to emulate SUID scripts since they are secure here." >&4
6113         ;;
6114 *)
6115         $cat <<EOM
6116 Some systems have disabled setuid scripts, especially systems where
6117 setuid scripts cannot be secure.  On systems where setuid scripts have
6118 been disabled, the setuid/setgid bits on scripts are currently
6119 useless.  It is possible for $package to detect those bits and emulate
6120 setuid/setgid in a secure fashion.  This emulation will only work if
6121 setuid scripts have been disabled in your kernel.
6122
6123 EOM
6124         case "$d_dosuid" in
6125         "$define") dflt=y ;;
6126         *) dflt=n ;;
6127         esac
6128         rp="Do you want to do setuid/setgid emulation?"
6129         . ./myread
6130         case "$ans" in
6131         [yY]*)  val="$define";;
6132         *)      val="$undef";;
6133         esac
6134         ;;
6135 esac
6136 set d_dosuid
6137 eval $setvar
6138
6139 : see if this is a malloc.h system
6140 : we want a real compile instead of Inhdr because some systems have a
6141 : malloc.h that just gives a compile error saying to use stdlib.h instead
6142 echo " "
6143 $cat >try.c <<EOCP
6144 #include <stdlib.h>
6145 #include <malloc.h>
6146 int main () { return 0; }
6147 EOCP
6148 set try
6149 if eval $compile; then
6150     echo "<malloc.h> found." >&4
6151     val="$define"
6152 else
6153     echo "<malloc.h> NOT found." >&4
6154     val="$undef"
6155 fi
6156 $rm -f try.c try
6157 set i_malloc
6158 eval $setvar
6159
6160 : check for void type
6161 echo " "
6162 echo "Checking to see how well your C compiler groks the void type..." >&4
6163 case "$voidflags" in
6164 '')
6165         $cat >try.c <<EOCP
6166 #$i_stdlib I_STDLIB
6167 #ifdef I_STDLIB
6168 #include <stdlib.h>
6169 #endif
6170 #if TRY & 1
6171 void sub() {
6172 #else
6173 sub() {
6174 #endif
6175         extern void moo();      /* function returning void */
6176         void (*goo)();          /* ptr to func returning void */
6177 #if TRY & 8
6178         void *hue;              /* generic ptr */
6179 #endif
6180 #if TRY & 2
6181         void (*foo[10])();
6182 #endif
6183
6184 #if TRY & 4
6185         if(goo == moo) {
6186                 exit(0);
6187         }
6188 #endif
6189         exit(0);
6190 }
6191 int main() { sub(); }
6192 EOCP
6193         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6194                 voidflags=$defvoidused
6195         echo "Good.  It appears to support void to the level $package wants.">&4
6196                 if $contains warning .out >/dev/null 2>&1; then
6197                         echo "However, you might get some warnings that look like this:"
6198                         $cat .out
6199                 fi
6200         else
6201 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6202                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6203                         echo "It supports 1..."
6204                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6205                                 echo "It also supports 2..."
6206                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6207                                         voidflags=7
6208                                         echo "And it supports 4 but not 8 definitely."
6209                                 else
6210                                         echo "It doesn't support 4..."
6211                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6212                                                 voidflags=11
6213                                                 echo "But it supports 8."
6214                                         else
6215                                                 voidflags=3
6216                                                 echo "Neither does it support 8."
6217                                         fi
6218                                 fi
6219                         else
6220                                 echo "It does not support 2..."
6221                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6222                                         voidflags=13
6223                                         echo "But it supports 4 and 8."
6224                                 else
6225                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6226                                                 voidflags=5
6227                                                 echo "And it supports 4 but has not heard about 8."
6228                                         else
6229                                                 echo "However it supports 8 but not 4."
6230                                         fi
6231                                 fi
6232                         fi
6233                 else
6234                         echo "There is no support at all for void."
6235                         voidflags=0
6236                 fi
6237         fi
6238 esac
6239 case "$voidflags" in
6240 "$defvoidused") ;;
6241 *)      $cat >&4 <<'EOM'
6242   Support flag bits are:
6243     1: basic void declarations.
6244     2: arrays of pointers to functions returning void.
6245     4: operations between pointers to and addresses of void functions.
6246     8: generic void pointers.
6247 EOM
6248         dflt="$voidflags";
6249         rp="Your void support flags add up to what?"
6250         . ./myread
6251         voidflags="$ans"
6252         ;;
6253 esac
6254 $rm -f try.* .out
6255
6256 : check for length of pointer
6257 echo " "
6258 case "$ptrsize" in
6259 '')
6260         echo "Checking to see how big your pointers are..." >&4
6261         if test "$voidflags" -gt 7; then
6262                 echo '#define VOID_PTR char *' > try.c
6263         else
6264                 echo '#define VOID_PTR void *' > try.c
6265         fi
6266         $cat >>try.c <<EOCP
6267 #include <stdio.h>
6268 #$i_stdlib I_STDLIB
6269 #ifdef I_STDLIB
6270 #include <stdlib.h>
6271 #endif
6272 int main()
6273 {
6274     printf("%d\n", (int)sizeof(VOID_PTR));
6275     exit(0);
6276 }
6277 EOCP
6278         set try
6279         if eval $compile_ok; then
6280                 ptrsize=`$run ./try`
6281                 echo "Your pointers are $ptrsize bytes long."
6282         else
6283                 dflt='4'
6284                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6285                 rp="What is the size of a pointer (in bytes)?"
6286                 . ./myread
6287                 ptrsize="$ans"
6288         fi
6289         ;;
6290 esac
6291 $rm -f try.c try
6292 case "$use64bitall" in
6293 "$define"|true|[yY]*)
6294         case "$ptrsize" in
6295         4)      cat <<EOM >&4
6296
6297 *** You have chosen a maximally 64-bit build,
6298 *** but your pointers are only 4 bytes wide.
6299 *** Please rerun Configure without -Duse64bitall.
6300 EOM
6301                 case "$d_quad" in
6302                 define)
6303                         cat <<EOM >&4
6304 *** Since you have quads, you could possibly try with -Duse64bitint.
6305 EOM
6306                         ;;
6307                 esac
6308                 cat <<EOM >&4
6309 *** Cannot continue, aborting.
6310
6311 EOM
6312
6313                 exit 1
6314                 ;;
6315         esac
6316         ;;
6317 esac
6318
6319
6320 : determine whether to use malloc wrapping
6321 echo " "
6322 case "$usemallocwrap" in
6323 [yY]*|true|$define)     dflt='y' ;;
6324 [nN]*|false|$undef)     dflt='n' ;;
6325 *)      case "$usedevel" in
6326         [yY]*|true|$define)     dflt='y' ;;
6327         *) dflt='n' ;;
6328         esac
6329         ;;
6330 esac
6331 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6332 . ./myread
6333 usemallocwrap="$ans"
6334 case "$ans" in
6335 y*|true)
6336         usemallocwrap="$define" ;;
6337 *)
6338         usemallocwrap="$undef" ;;
6339 esac
6340
6341 : determine which malloc to compile in
6342 echo " "
6343 case "$usemymalloc" in
6344 [yY]*|true|$define)     dflt='y' ;;
6345 [nN]*|false|$undef)     dflt='n' ;;
6346 *)      case "$ptrsize" in
6347         4) dflt='y' ;;
6348         *) dflt='n' ;;
6349         esac
6350         ;;
6351 esac
6352 rp="Do you wish to attempt to use the malloc that comes with $package?"
6353 . ./myread
6354 usemymalloc="$ans"
6355 case "$ans" in
6356 y*|true)
6357         usemymalloc='y'
6358         mallocsrc='malloc.c'
6359         mallocobj="malloc$_o"
6360         d_mymalloc="$define"
6361         case "$libs" in
6362         *-lmalloc*)
6363                 : Remove malloc from list of libraries to use
6364                 echo "Removing unneeded -lmalloc from library list" >&4
6365                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6366                 shift
6367                 libs="$*"
6368                 echo "libs = $libs" >&4
6369                 ;;
6370         esac
6371         ;;
6372 *)
6373         usemymalloc='n'
6374         mallocsrc=''
6375         mallocobj=''
6376         d_mymalloc="$undef"
6377         ;;
6378 esac
6379
6380 : compute the return types of malloc and free
6381 echo " "
6382 $cat >malloc.c <<END
6383 #$i_malloc I_MALLOC
6384 #$i_stdlib I_STDLIB
6385 #include <stdio.h>
6386 #include <sys/types.h>
6387 #ifdef I_MALLOC
6388 #include <malloc.h>
6389 #endif
6390 #ifdef I_STDLIB
6391 #include <stdlib.h>
6392 #endif
6393 #ifdef TRY_MALLOC
6394 void *malloc();
6395 #endif
6396 #ifdef TRY_FREE
6397 void free();
6398 #endif
6399 END
6400 case "$malloctype" in
6401 '')
6402         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6403                 malloctype='void *'
6404         else
6405                 malloctype='char *'
6406         fi
6407         ;;
6408 esac
6409 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6410
6411 case "$freetype" in
6412 '')
6413         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6414                 freetype='void'
6415         else
6416                 freetype='int'
6417         fi
6418         ;;
6419 esac
6420 echo "Your system uses $freetype free(), it would seem." >&4
6421 $rm -f malloc.[co]
6422 $cat <<EOM
6423
6424 After $package is installed, you may wish to install various
6425 add-on modules and utilities.  Typically, these add-ons will
6426 be installed under $prefix with the rest
6427 of this package.  However, you may wish to install such add-ons
6428 elsewhere under a different prefix.
6429
6430 If you do not wish to put everything under a single prefix, that's
6431 ok.  You will be prompted for the individual locations; this siteprefix
6432 is only used to suggest the defaults.
6433
6434 The default should be fine for most people.
6435
6436 EOM
6437 fn=d~+
6438 rp='Installation prefix to use for add-on modules and utilities?'
6439 : XXX Here might be another good place for an installstyle setting.
6440 case "$siteprefix" in
6441 '') dflt=$prefix ;;
6442 *)  dflt=$siteprefix ;;
6443 esac
6444 . ./getfile
6445 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6446 oldsiteprefix=''
6447 case "$siteprefix" in
6448 '') ;;
6449 *)      case "$ans" in
6450         "$prefix") ;;
6451         *) oldsiteprefix="$prefix";;
6452         esac
6453         ;;
6454 esac
6455 siteprefix="$ans"
6456 siteprefixexp="$ansexp"
6457
6458 : determine where site specific libraries go.
6459 : Usual default is /usr/local/lib/perl5/site_perl/$version
6460 : The default "style" setting is made in installstyle.U
6461 : XXX No longer works with Prefixit stuff.
6462 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6463 case "$sitelib" in
6464 '') case "$installstyle" in
6465         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6466         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6467         esac
6468         ;;
6469 *)      dflt="$sitelib"
6470         ;;
6471 esac
6472 $cat <<EOM
6473
6474 The installation process will create a directory for
6475 site-specific extensions and modules.  Most users find it convenient
6476 to place all site-specific files in this directory rather than in the
6477 main distribution directory.
6478
6479 EOM
6480 fn=d~+
6481 rp='Pathname for the site-specific library files?'
6482 . ./getfile
6483 sitelib="$ans"
6484 sitelibexp="$ansexp"
6485 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6486 : Change installation prefix, if necessary.
6487 if $test X"$prefix" != X"$installprefix"; then
6488         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6489 else
6490         installsitelib="$sitelibexp"
6491 fi
6492
6493 : determine where site specific architecture-dependent libraries go.
6494 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6495 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6496 : sitelib may have an optional trailing /share.
6497 case "$sitearch" in
6498 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6499         dflt="$dflt/$archname"
6500         ;;
6501 *)      dflt="$sitearch"
6502         ;;
6503 esac
6504 set sitearch sitearch none
6505 eval $prefixit
6506 $cat <<EOM
6507
6508 The installation process will also create a directory for
6509 architecture-dependent site-specific extensions and modules.
6510
6511 EOM
6512 fn=d~+
6513 rp='Pathname for the site-specific architecture-dependent library files?'
6514 . ./getfile
6515 sitearch="$ans"
6516 sitearchexp="$ansexp"
6517 : Change installation prefix, if necessary.
6518 if $test X"$prefix" != X"$installprefix"; then
6519         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6520 else
6521         installsitearch="$sitearchexp"
6522 fi
6523
6524 $cat <<EOM
6525
6526 The installation process will also create a directory for
6527 vendor-supplied add-ons.  Vendors who supply perl with their system
6528 may find it convenient to place all vendor-supplied files in this
6529 directory rather than in the main distribution directory.  This will
6530 ease upgrades between binary-compatible maintenance versions of perl.
6531
6532 Of course you may also use these directories in whatever way you see
6533 fit.  For example, you might use them to access modules shared over a
6534 company-wide network.
6535
6536 The default answer should be fine for most people.
6537 This causes further questions about vendor add-ons to be skipped
6538 and no vendor-specific directories will be configured for perl.
6539
6540 EOM
6541 rp='Do you want to configure vendor-specific add-on directories?'
6542 case "$usevendorprefix" in
6543 define|true|[yY]*) dflt=y ;;
6544 *)      : User may have set vendorprefix directly on Configure command line.
6545         case "$vendorprefix" in
6546         ''|' ') dflt=n ;;
6547         *)      dflt=y ;;
6548         esac
6549         ;;
6550 esac
6551 . ./myread
6552 case "$ans" in
6553 [yY]*)  fn=d~+
6554         rp='Installation prefix to use for vendor-supplied add-ons?'
6555         case "$vendorprefix" in
6556         '') dflt='' ;;
6557         *)  dflt=$vendorprefix ;;
6558         esac
6559         . ./getfile
6560         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6561         oldvendorprefix=''
6562         case "$vendorprefix" in
6563         '') ;;
6564         *)      case "$ans" in
6565                 "$prefix") ;;
6566                 *) oldvendorprefix="$prefix";;
6567                 esac
6568                 ;;
6569         esac
6570         usevendorprefix="$define"
6571         vendorprefix="$ans"
6572         vendorprefixexp="$ansexp"
6573         ;;
6574 *)      usevendorprefix="$undef"
6575         vendorprefix=''
6576         vendorprefixexp=''
6577         ;;
6578 esac
6579
6580 case "$vendorprefix" in
6581 '')     d_vendorlib="$undef"
6582         vendorlib=''
6583         vendorlibexp=''
6584         ;;
6585 *)      d_vendorlib="$define"
6586         : determine where vendor-supplied modules go.
6587         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6588         case "$vendorlib" in
6589         '')
6590                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6591                 case "$installstyle" in
6592                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6593                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6594                 esac
6595                 ;;
6596         *)      dflt="$vendorlib"
6597                 ;;
6598         esac
6599         fn=d~+
6600         rp='Pathname for the vendor-supplied library files?'
6601         . ./getfile
6602         vendorlib="$ans"
6603         vendorlibexp="$ansexp"
6604         ;;
6605 esac
6606 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6607 : Change installation prefix, if necessary.
6608 if $test X"$prefix" != X"$installprefix"; then
6609         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6610 else
6611         installvendorlib="$vendorlibexp"
6612 fi
6613
6614 case "$vendorprefix" in
6615 '')     d_vendorarch="$undef"
6616         vendorarch=''
6617         vendorarchexp=''
6618         ;;
6619 *)      d_vendorarch="$define"
6620         : determine where vendor-supplied architecture-dependent libraries go.
6621         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6622         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6623         : vendorlib may have an optional trailing /share.
6624         case "$vendorarch" in
6625         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6626                 dflt="$dflt/$archname"
6627                 ;;
6628         *)      dflt="$vendorarch" ;;
6629         esac
6630         fn=d~+
6631         rp='Pathname for vendor-supplied architecture-dependent files?'
6632         . ./getfile
6633         vendorarch="$ans"
6634         vendorarchexp="$ansexp"
6635         ;;
6636 esac
6637 : Change installation prefix, if necessary.
6638 if $test X"$prefix" != X"$installprefix"; then
6639         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6640 else
6641         installvendorarch="$vendorarchexp"
6642 fi
6643
6644 : Final catch-all directories to search
6645 $cat <<EOM
6646
6647 Lastly, you can have perl look in other directories for extensions and
6648 modules in addition to those already specified.
6649 These directories will be searched after 
6650         $sitearch 
6651         $sitelib 
6652 EOM
6653 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6654 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6655 echo ' '
6656 case "$otherlibdirs" in
6657 ''|' ') dflt='none' ;;
6658 *)      dflt="$otherlibdirs" ;;
6659 esac
6660 $cat <<EOM
6661 Enter a colon-separated set of extra paths to include in perl's @INC
6662 search path, or enter 'none' for no extra paths.
6663
6664 EOM
6665
6666 rp='Colon-separated list of additional directories for perl to search?'
6667 . ./myread
6668 case "$ans" in
6669 ' '|''|none)    otherlibdirs=' ' ;;     
6670 *)      otherlibdirs="$ans" ;;
6671 esac
6672 case "$otherlibdirs" in
6673 ' ') val=$undef ;;
6674 *)      val=$define ;;
6675 esac
6676 set d_perl_otherlibdirs
6677 eval $setvar
6678
6679 : Cruising for prototypes
6680 echo " "
6681 echo "Checking out function prototypes..." >&4
6682 $cat >prototype.c <<EOCP
6683 #$i_stdlib I_STDLIB
6684 #ifdef I_STDLIB
6685 #include <stdlib.h>
6686 #endif
6687 int main(int argc, char *argv[]) {
6688         exit(0);}
6689 EOCP
6690 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6691         echo "Your C compiler appears to support function prototypes."
6692         val="$define"
6693 else
6694         echo "Your C compiler doesn't seem to understand function prototypes."
6695         val="$undef"
6696 fi
6697 set prototype
6698 eval $setvar
6699 $rm -f prototype*
6700
6701 case "$prototype" in
6702 "$define") ;;
6703 *)      ansi2knr='ansi2knr'
6704         echo " "
6705         cat <<EOM >&4
6706
6707 $me:  FATAL ERROR:
6708 This version of $package can only be compiled by a compiler that 
6709 understands function prototypes.  Unfortunately, your C compiler 
6710         $cc $ccflags
6711 doesn't seem to understand them.  Sorry about that.
6712
6713 If GNU cc is available for your system, perhaps you could try that instead.  
6714
6715 Eventually, we hope to support building Perl with pre-ANSI compilers.
6716 If you would like to help in that effort, please contact <perlbug@perl.org>.
6717
6718 Aborting Configure now.
6719 EOM
6720         exit 2
6721         ;;
6722 esac
6723
6724 : determine where public executables go
6725 echo " "
6726 set dflt bin bin
6727 eval $prefixit
6728 fn=d~
6729 rp='Pathname where the public executables will reside?'
6730 . ./getfile
6731 if $test "X$ansexp" != "X$binexp"; then
6732         installbin=''
6733 fi
6734 bin="$ans"
6735 binexp="$ansexp"
6736 : Change installation prefix, if necessary.
6737 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6738 if $test X"$prefix" != X"$installprefix"; then
6739         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6740 else
6741         installbin="$binexp"
6742 fi
6743
6744 echo " "
6745 case "$extras" in
6746 '') dflt='n';;
6747 *) dflt='y';;
6748 esac
6749 cat <<EOM
6750 Perl can be built with extra modules or bundles of modules which
6751 will be fetched from the CPAN and installed alongside Perl.
6752
6753 Notice that you will need access to the CPAN; either via the Internet,
6754 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
6755 be asked later to configure the CPAN.pm module which will in turn do
6756 the installation of the rest of the extra modules or bundles.)
6757
6758 Notice also that if the modules require any external software such as
6759 libraries and headers (the libz library and the zlib.h header for the
6760 Compress::Zlib module, for example) you MUST have any such software
6761 already installed, this configuration process will NOT install such
6762 things for you.
6763
6764 If this doesn't make any sense to you, just accept the default '$dflt'.
6765 EOM
6766 rp='Install any extra modules (y or n)?'
6767 . ./myread
6768 case "$ans" in
6769 y|Y)
6770         cat <<EOM
6771
6772 Please list any extra modules or bundles to be installed from CPAN,
6773 with spaces between the names.  The names can be in any format the
6774 'install' command of CPAN.pm will understand.  (Answer 'none',
6775 without the quotes, to install no extra modules or bundles.)
6776 EOM
6777         rp='Extras?'
6778         dflt="$extras"
6779         . ./myread
6780         extras="$ans"
6781 esac
6782 case "$extras" in
6783 ''|'none')
6784         val=''
6785         $rm -f ../extras.lst
6786         ;;
6787 *)      echo "(Saving the list of extras for later...)"
6788         echo "$extras" > ../extras.lst
6789         val="'$extras'"
6790         ;;
6791 esac
6792 set extras
6793 eval $setvar
6794 echo " "
6795
6796 : determine where html pages for programs go
6797 set html1dir html1dir none
6798 eval $prefixit
6799 $cat <<EOM
6800
6801 If you wish to install html files for programs in $spackage, indicate 
6802 the appropriate directory here.  To skip installing html files,
6803 answer "none".
6804 EOM
6805 case "$html1dir" in
6806 ''|none|$undef|' ') dflt=none ;;
6807 *) dflt=$html1dir ;;
6808 esac
6809 fn=dn+~
6810 rp="Directory for the main $spackage html pages?"
6811 . ./getfile
6812 html1dir="$ans"
6813 html1direxp="$ansexp"
6814 : Use ' ' for none so value is preserved next time through Configure
6815 $test X"$html1dir" = "X" && html1dir=' '
6816 : Change installation prefix, if necessary.
6817 if $test X"$prefix" != X"$installprefix"; then
6818         installhtml1dir=`echo $html1direxp | sed "s#^$prefix#$installprefix#"`
6819 else
6820         installhtml1dir="$html1direxp"
6821 fi
6822
6823 : determine where html pages for libraries and modules go
6824 set html3dir html3dir none
6825 eval $prefixit
6826 $cat <<EOM
6827
6828 If you wish to install html files for modules associated with $spackage,
6829 indicate the appropriate directory here.  To skip installing html files,
6830 answer "none".
6831 EOM
6832 : There is no obvious default.  If they have specified html1dir, then
6833 : try to key off that, possibly changing .../html1 into .../html3.
6834 case "$html3dir" in
6835 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
6836 *) dflt=$html3dir ;;
6837 esac
6838 fn=dn+~
6839 rp="Directory for the $spackage module html pages?"
6840 . ./getfile
6841 html3dir="$ans"
6842 html3direxp="$ansexp"
6843 : Use ' ' for none so value is preserved next time through Configure
6844 $test X"$html3dir" = "X" && html3dir=' '
6845 : Change installation prefix, if necessary.
6846 if $test X"$prefix" != X"$installprefix"; then
6847         installhtml3dir=`echo $html3direxp | sed "s#^$prefix#$installprefix#"`
6848 else
6849         installhtml3dir="$html3direxp"
6850 fi
6851
6852 : Find perl5.005 or later.
6853 echo "Looking for a previously installed perl5.005 or later... "
6854 case "$perl5" in
6855 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6856                 : Check if this perl is recent and can load a simple module
6857                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6858                         perl5=$tdir/perl
6859                         break;
6860                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6861                         perl5=$tdir/perl5
6862                         break;
6863                 fi
6864         done
6865         ;;
6866 *)      perl5="$perl5"
6867         ;;
6868 esac
6869 case "$perl5" in
6870 '')     echo "None found.  That's ok.";;
6871 *)      echo "Using $perl5." ;;
6872 esac
6873
6874 : Determine list of previous versions to include in @INC
6875 $cat > getverlist <<EOPL
6876 #!$perl5 -w
6877 use File::Basename;
6878 \$api_versionstring = "$api_versionstring";
6879 \$version = "$version";
6880 \$stem = "$sitelib_stem";
6881 \$archname = "$archname";
6882 EOPL
6883         $cat >> getverlist <<'EOPL'
6884 # Can't have leading @ because metaconfig interprets it as a command!
6885 ;@inc_version_list=();
6886 # XXX Redo to do opendir/readdir? 
6887 if (-d $stem) {
6888     chdir($stem);
6889     ;@candidates = glob("5.*");
6890 }
6891 else {
6892     ;@candidates = ();
6893 }
6894
6895 # XXX ToDo:  These comparisons must be reworked when two-digit
6896 # subversions come along, so that 5.7.10 compares as greater than
6897 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6898 # widespread that we can use the built-in version vectors rather
6899 # than reinventing them here.  For 5.6.0, however, we must
6900 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6901 foreach $d (@candidates) {
6902     if ($d lt $version) {
6903         if ($d ge $api_versionstring) {
6904             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6905         }
6906         elsif ($d ge "5.005") {
6907             unshift(@inc_version_list, grep { -d } $d);
6908         }
6909     }
6910     else {
6911         # Skip newer version.  I.e. don't look in
6912         # 5.7.0 if we're installing 5.6.1.
6913     }
6914 }
6915
6916 if (@inc_version_list) {
6917     print join(' ', @inc_version_list);
6918 }
6919 else {
6920     # Blank space to preserve value for next Configure run.
6921     print " ";
6922 }
6923 EOPL
6924 chmod +x getverlist
6925 case "$inc_version_list" in
6926 '')     if test -x "$perl5$exe_ext"; then
6927                 dflt=`$perl5 getverlist`
6928         else
6929                 dflt='none'
6930         fi
6931         ;;
6932 $undef) dflt='none' ;;
6933 *)  eval dflt=\"$inc_version_list\" ;;
6934 esac
6935 case "$dflt" in
6936 ''|' ') dflt=none ;;
6937 esac
6938 case "$dflt" in
6939 5.005) dflt=none ;;
6940 esac
6941 $cat <<EOM
6942
6943 In order to ease the process of upgrading, this version of perl 
6944 can be configured to use modules built and installed with earlier 
6945 versions of perl that were installed under $prefix.  Specify here
6946 the list of earlier versions that this version of perl should check.
6947 If Configure detected no earlier versions of perl installed under
6948 $prefix, then the list will be empty.  Answer 'none' to tell perl
6949 to not search earlier versions.
6950
6951 The default should almost always be sensible, so if you're not sure,
6952 just accept the default.
6953 EOM
6954
6955 rp='List of earlier versions to include in @INC?'
6956 . ./myread
6957 case "$ans" in
6958 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6959 *) inc_version_list="$ans" ;;
6960 esac
6961 case "$inc_version_list" in
6962 ''|' ') 
6963         inc_version_list_init='0';;
6964 *)      inc_version_list_init=`echo $inc_version_list |
6965                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6966         ;;
6967 esac
6968 $rm -f getverlist
6969
6970 : determine whether to install perl also as /usr/bin/perl
6971
6972 echo " "
6973 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6974         $cat <<EOM
6975 Many scripts expect perl to be installed as /usr/bin/perl.
6976
6977 If you want to, I can install the perl you are about to compile
6978 as /usr/bin/perl (in addition to $bin/perl).
6979 EOM
6980         if test -f /usr/bin/perl; then
6981             $cat <<EOM
6982
6983 However, please note that because you already have a /usr/bin/perl,
6984 overwriting that with a new Perl would very probably cause problems.
6985 Therefore I'm assuming you don't want to do that (unless you insist).
6986
6987 EOM
6988             case "$installusrbinperl" in
6989             "$define"|[yY]*)    dflt='y';;
6990             *)                  dflt='n';;
6991             esac
6992         else
6993             $cat <<EOM
6994
6995 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
6996
6997 EOM
6998             case "$installusrbinperl" in
6999             "$undef"|[nN]*)     dflt='n';;
7000             *)                  dflt='y';;
7001             esac
7002         fi
7003         rp="Do you want to install perl as /usr/bin/perl?"
7004         . ./myread
7005         case "$ans" in
7006         [yY]*)  val="$define";;
7007         *)      val="$undef" ;;
7008         esac
7009 else
7010         val="$undef"
7011 fi
7012 set installusrbinperl
7013 eval $setvar
7014
7015 echo " "
7016 echo "Checking for GNU C Library..." >&4
7017 cat >try.c <<'EOCP'
7018 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7019    alone are insufficient to distinguish different versions, such as
7020    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7021    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7022 */
7023 #include <stdio.h>
7024 int main(void)
7025 {
7026 #ifdef __GLIBC__
7027 #   ifdef __GLIBC_MINOR__
7028 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
7029 #           include <gnu/libc-version.h>
7030             printf("%s\n",  gnu_get_libc_version());
7031 #       else
7032             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7033 #       endif
7034 #   else
7035         printf("%d\n",  __GLIBC__);
7036 #   endif
7037     return 0;
7038 #else
7039     return 1;
7040 #endif
7041 }
7042 EOCP
7043 set try
7044 if eval $compile_ok && $run ./try > glibc.ver; then
7045         val="$define"
7046         gnulibc_version=`$cat glibc.ver`
7047         echo "You are using the GNU C Library version $gnulibc_version"
7048 else
7049         val="$undef"
7050         gnulibc_version=''
7051         echo "You are not using the GNU C Library"
7052 fi
7053 $rm -f try try.* glibc.ver
7054 set d_gnulibc
7055 eval $setvar
7056
7057 : see if nm is to be used to determine whether a symbol is defined or not
7058 case "$usenm" in
7059 '')
7060         dflt=''
7061         case "$d_gnulibc" in
7062         "$define")
7063                 echo " "
7064                 echo "nm probably won't work on the GNU C Library." >&4
7065                 dflt=n
7066                 ;;
7067         esac
7068         case "$dflt" in
7069         '') 
7070                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7071                         echo " "
7072                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7073                         echo "'nm' won't be sufficient on this sytem." >&4
7074                         dflt=n
7075                 fi
7076                 ;;
7077         esac
7078         case "$dflt" in
7079         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7080                 if $test $dflt -gt 20; then
7081                         dflt=y
7082                 else
7083                         dflt=n
7084                 fi
7085                 ;;
7086         esac
7087         ;;
7088 *)
7089         case "$usenm" in
7090         true|$define) dflt=y;;
7091         *) dflt=n;;
7092         esac
7093         ;;
7094 esac
7095 $cat <<EOM
7096
7097 I can use $nm to extract the symbols from your C libraries. This
7098 is a time consuming task which may generate huge output on the disk (up
7099 to 3 megabytes) but that should make the symbols extraction faster. The
7100 alternative is to skip the 'nm' extraction part and to compile a small
7101 test program instead to determine whether each symbol is present. If
7102 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7103 this may be the best solution.
7104
7105 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7106
7107 EOM
7108 rp="Shall I use $nm to extract C symbols from the libraries?"
7109 . ./myread
7110 case "$ans" in
7111 [Nn]*) usenm=false;;
7112 *) usenm=true;;
7113 esac
7114
7115 runnm=$usenm
7116 case "$reuseval" in
7117 true) runnm=false;;
7118 esac
7119
7120 : nm options which may be necessary
7121 case "$nm_opt" in
7122 '') if $test -f /mach_boot; then
7123                 nm_opt=''       # Mach
7124         elif $test -d /usr/ccs/lib; then
7125                 nm_opt='-p'     # Solaris (and SunOS?)
7126         elif $test -f /dgux; then
7127                 nm_opt='-p'     # DG-UX
7128         elif $test -f /lib64/rld; then
7129                 nm_opt='-p'     # 64-bit Irix
7130         else
7131                 nm_opt=''
7132         fi;;
7133 esac
7134
7135 : nm options which may be necessary for shared libraries but illegal
7136 : for archive libraries.  Thank you, Linux.
7137 case "$nm_so_opt" in
7138 '')     case "$myuname" in
7139         *linux*|gnu*)
7140                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7141                         nm_so_opt='--dynamic'
7142                 fi
7143                 ;;
7144         esac
7145         ;;
7146 esac
7147
7148 case "$runnm" in
7149 true)
7150 : get list of predefined functions in a handy place
7151 echo " "
7152 case "$libc" in
7153 '') libc=unknown
7154         case "$libs" in
7155         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7156         esac
7157         ;;
7158 esac
7159 case "$libs" in
7160 '') ;;
7161 *)  for thislib in $libs; do
7162         case "$thislib" in
7163         -lc|-lc_s)
7164                 : Handle C library specially below.
7165                 ;;
7166         -l*)
7167                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7168                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7169                         :
7170                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7171                         :
7172                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7173                         :
7174                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7175                         :
7176                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7177                         :
7178                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7179                         :
7180                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7181                         :
7182                 else
7183                         try=''
7184                 fi
7185                 libnames="$libnames $try"
7186                 ;;
7187         *) libnames="$libnames $thislib" ;;
7188         esac
7189         done
7190         ;;
7191 esac
7192 xxx=normal
7193 case "$libc" in
7194 unknown)
7195         set /lib/libc.$so
7196         for xxx in $libpth; do
7197                 $test -r $1 || set $xxx/libc.$so
7198                 : The messy sed command sorts on library version numbers.
7199                 $test -r $1 || \
7200                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7201                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7202                                 h
7203                                 s/[0-9][0-9]*/0000&/g
7204                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7205                                 G
7206                                 s/\n/ /' | \
7207                          $sort | $sed -e 's/^.* //'`
7208                 eval set \$$#
7209         done
7210         $test -r $1 || set /usr/ccs/lib/libc.$so
7211         $test -r $1 || set /lib/libsys_s$_a
7212         ;;
7213 *)
7214         set blurfl
7215         ;;
7216 esac
7217 if $test -r "$1"; then
7218         echo "Your (shared) C library seems to be in $1."
7219         libc="$1"
7220 elif $test -r /lib/libc && $test -r /lib/clib; then
7221         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7222         xxx=apollo
7223         libc='/lib/clib /lib/libc'
7224         if $test -r /lib/syslib; then
7225                 echo "(Your math library is in /lib/syslib.)"
7226                 libc="$libc /lib/syslib"
7227         fi
7228 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7229         echo "Your C library seems to be in $libc, as you said before."
7230 elif $test -r $incpath/usr/lib/libc$_a; then
7231         libc=$incpath/usr/lib/libc$_a;
7232         echo "Your C library seems to be in $libc.  That's fine."
7233 elif $test -r /lib/libc$_a; then
7234         libc=/lib/libc$_a;
7235         echo "Your C library seems to be in $libc.  You're normal."
7236 else
7237         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7238                 :
7239         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7240                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7241         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7242                 :
7243         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7244                 :
7245         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7246                 :
7247         else
7248                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7249         fi
7250         if $test -r "$tans"; then
7251                 echo "Your C library seems to be in $tans, of all places."
7252                 libc=$tans
7253         else
7254                 libc='blurfl'
7255         fi
7256 fi
7257 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7258         dflt="$libc"
7259         cat <<EOM
7260
7261 If the guess above is wrong (which it might be if you're using a strange
7262 compiler, or your machine supports multiple models), you can override it here.
7263
7264 EOM
7265 else
7266         dflt=''
7267         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7268         cat >&4 <<EOM
7269 I can't seem to find your C library.  I've looked in the following places:
7270
7271 EOM
7272         $sed 's/^/      /' libpath
7273         cat <<EOM
7274
7275 None of these seems to contain your C library. I need to get its name...
7276
7277 EOM
7278 fi
7279 fn=f
7280 rp='Where is your C library?'
7281 . ./getfile
7282 libc="$ans"
7283
7284 echo " "
7285 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7286 set X `cat libnames`
7287 shift
7288 xxx=files
7289 case $# in 1) xxx=file; esac
7290 echo "Extracting names from the following $xxx for later perusal:" >&4
7291 echo " "
7292 $sed 's/^/      /' libnames >&4
7293 echo " "
7294 $echo $n "This may take a while...$c" >&4
7295
7296 for file in $*; do
7297         case $file in
7298         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7299         *) $nm $nm_opt $file 2>/dev/null;;
7300         esac
7301 done >libc.tmp
7302
7303 $echo $n ".$c"
7304 $grep fprintf libc.tmp > libc.ptf
7305 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7306 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7307 xxx='[ADTSIW]'
7308 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7309         eval $xscan;\
7310         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7311                 eval $xrun
7312 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7313         eval $xscan;\
7314         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7315                 eval $xrun
7316 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7317         eval $xscan;\
7318         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7319                 eval $xrun
7320 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7321         eval $xscan;\
7322         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7323                 eval $xrun
7324 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7325         eval $xscan;\
7326         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7327                 eval $xrun
7328 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7329         eval $xscan;\
7330         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7331                 eval $xrun
7332 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7333                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7334         eval $xscan;\
7335         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7336                 eval $xrun
7337 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7338         eval $xscan;\
7339         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7340                 eval $xrun
7341 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7342         eval $xscan;\
7343         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7344                 eval $xrun
7345 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7346         eval $xscan;\
7347         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7348                 eval $xrun
7349 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7350         eval $xscan;\
7351         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7352                 eval $xrun
7353 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7354         eval $xscan;\
7355         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7356                 eval $xrun
7357 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7358         eval $xscan;\
7359         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7360                 eval $xrun
7361 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7362         eval $xscan;\
7363         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7364                 eval $xrun
7365 else
7366         $nm -p $* 2>/dev/null >libc.tmp
7367         $grep fprintf libc.tmp > libc.ptf
7368         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7369                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7370         then
7371                 nm_opt='-p'
7372                 eval $xrun
7373         else
7374                 echo " "
7375                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7376                 com=''
7377                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7378                         for thisname in $libnames $libc; do
7379                                 $ar t $thisname >>libc.tmp
7380                         done
7381                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7382                         echo "Ok." >&4
7383                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7384                         # Repeat libc to extract forwarders to DLL entries too
7385                         for thisname in $libnames $libc; do
7386                                 $ar tv $thisname >>libc.tmp
7387                                 # Revision 50 of EMX has bug in $ar.
7388                                 # it will not extract forwarders to DLL entries
7389                                 # Use emximp which will extract exactly them.
7390                                 emximp -o tmp.imp $thisname \
7391                                     2>/dev/null && \
7392                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7393                                     < tmp.imp >>libc.tmp
7394                                 $rm tmp.imp
7395                         done
7396                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7397                         echo "Ok." >&4
7398                 else
7399                         echo "$ar didn't seem to work right." >&4
7400                         echo "Maybe this is a Cray...trying bld instead..." >&4
7401                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7402                         then
7403                                 for thisname in $libnames; do
7404                                         bld t $libnames | \
7405                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7406                                         $ar t $thisname >>libc.tmp
7407                                 done
7408                                 echo "Ok." >&4
7409                         else
7410                                 echo "That didn't work either.  Giving up." >&4
7411                                 exit 1
7412                         fi
7413                 fi
7414         fi
7415 fi
7416 nm_extract="$com"
7417 case "$PASE" in
7418 define)
7419     echo " "
7420     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7421     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7422     ;;
7423 *)  if $test -f /lib/syscalls.exp; then
7424         echo " "
7425         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7426         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7427     fi
7428     ;;
7429 esac
7430 ;;
7431 esac
7432 $rm -f libnames libpath
7433
7434 : see if dld is available
7435 set dld.h i_dld
7436 eval $inhdr
7437
7438 : is a C symbol defined?
7439 csym='tlook=$1;
7440 case "$3" in
7441 -v) tf=libc.tmp; tdc="";;
7442 -a) tf=libc.tmp; tdc="[]";;
7443 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7444 esac;
7445 tx=yes;
7446 case "$reuseval-$4" in
7447 true-) ;;
7448 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7449 esac;
7450 case "$tx" in
7451 yes)
7452         tval=false;
7453         if $test "$runnm" = true; then
7454                 if $contains $tlook $tf >/dev/null 2>&1; then
7455                         tval=true;
7456                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7457                         echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7458                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7459                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7460                         $rm -f try$_exe try.c core core.* try.core;
7461                 fi;
7462         else
7463                 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7464                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7465                 $rm -f try$_exe try.c;
7466         fi;
7467         ;;
7468 *)
7469         case "$tval" in
7470         $define) tval=true;;
7471         *) tval=false;;
7472         esac;
7473         ;;
7474 esac;
7475 eval "$2=$tval"'
7476
7477 : define an is-in-libc? function
7478 inlibc='echo " "; td=$define; tu=$undef;
7479 sym=$1; var=$2; eval "was=\$$2";
7480 tx=yes;
7481 case "$reuseval$was" in
7482 true) ;;
7483 true*) tx=no;;
7484 esac;
7485 case "$tx" in
7486 yes)
7487         set $sym tres -f;
7488         eval $csym;
7489         case "$tres" in
7490         true)
7491                 echo "$sym() found." >&4;
7492                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7493         *)
7494                 echo "$sym() NOT found." >&4;
7495                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7496         esac;;
7497 *)
7498         case "$was" in
7499         $define) echo "$sym() found." >&4;;
7500         *) echo "$sym() NOT found." >&4;;
7501         esac;;
7502 esac'
7503
7504 : see if dlopen exists
7505 xxx_runnm="$runnm"
7506 runnm=false
7507 set dlopen d_dlopen
7508 eval $inlibc
7509 runnm="$xxx_runnm"
7510
7511 : determine which dynamic loading, if any, to compile in
7512 echo " "
7513 dldir="ext/DynaLoader"
7514 case "$usedl" in
7515 $define|y|true)
7516         dflt='y'
7517         usedl="$define"
7518         ;;
7519 $undef|n|false)
7520         dflt='n'
7521         usedl="$undef"
7522         ;;
7523 *) 
7524         dflt='n'
7525         case "$d_dlopen" in
7526             $define) dflt='y' ;;
7527         esac
7528         case "$i_dld" in
7529             $define) dflt='y' ;;
7530         esac
7531         : Does a dl_xxx.xs file exist for this operating system
7532         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7533         ;;
7534 esac
7535 rp="Do you wish to use dynamic loading?"
7536 . ./myread
7537 usedl="$ans"
7538 case "$ans" in
7539 y*) usedl="$define"
7540         case "$dlsrc" in
7541         '')
7542                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7543                         dflt="$dldir/dl_${osname}.xs"
7544                 elif $test "$d_dlopen" = "$define" ; then
7545                         dflt="$dldir/dl_dlopen.xs"
7546                 elif $test "$i_dld" = "$define" ; then
7547                         dflt="$dldir/dl_dld.xs"
7548                 else
7549                         dflt=''
7550                 fi
7551                 ;;
7552         *)      dflt="$dldir/$dlsrc"
7553                 ;;
7554         esac
7555     echo "The following dynamic loading files are available:"
7556         : Can not go over to $dldir because getfile has path hard-coded in.
7557         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7558         rp="Source file to use for dynamic loading"
7559         fn="fne"
7560         gfpth="$src"
7561         . ./getfile
7562         usedl="$define"
7563         : emulate basename
7564         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7565
7566         $cat << EOM
7567
7568 Some systems may require passing special flags to $cc -c to
7569 compile modules that will be used to create a shared library.
7570 To use no flags, say "none".
7571
7572 EOM
7573     case "$cccdlflags" in
7574     '') case "$gccversion" in
7575                 '') case "$osname" in
7576                         hpux)   dflt='+z' ;;
7577                         next)   dflt='none' ;;
7578                         irix*)  dflt='-KPIC' ;;
7579                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7580                         sunos)  dflt='-pic' ;;
7581                         *)      dflt='none' ;;
7582                     esac
7583                         ;;
7584                 *)  case "$osname" in
7585                         darwin) dflt='none' ;;
7586                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7587                         *)      dflt='-fpic' ;;
7588                     esac ;;
7589             esac ;;
7590         ' ') dflt='none' ;;
7591     *)  dflt="$cccdlflags" ;;
7592     esac
7593     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7594     . ./myread
7595     case "$ans" in
7596     none) cccdlflags=' ' ;;
7597     *) cccdlflags="$ans" ;;
7598     esac
7599
7600     cat << EOM
7601
7602 Some systems use ld to create libraries that can be dynamically loaded,
7603 while other systems (such as those using ELF) use $cc.
7604
7605 EOM
7606         case "$ld" in
7607         '')     $cat >try.c <<EOM
7608 /* Test for whether ELF binaries are produced */
7609 #include <fcntl.h>
7610 #$i_stdlib I_STDLIB
7611 #ifdef I_STDLIB
7612 #include <stdlib.h>
7613 #endif
7614 int main() {
7615         char b[4];
7616         int i = open("a.out",O_RDONLY);
7617         if(i == -1) 
7618                 exit(1); /* fail */
7619         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7620                 exit(0); /* succeed (yes, it's ELF) */
7621         else
7622                 exit(1); /* fail */
7623 }
7624 EOM
7625                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7626                         cat <<EOM
7627 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7628 EOM
7629                         dflt="$cc"
7630                 else
7631                         echo "I'll use ld to build dynamic libraries."
7632                         dflt='ld'
7633                 fi
7634                 rm -f try.c a.out
7635                 ;;
7636         *)      dflt="$ld"
7637                 ;;
7638         esac
7639
7640     rp="What command should be used to create dynamic libraries?"
7641     . ./myread
7642         ld="$ans"
7643
7644     cat << EOM
7645
7646 Some systems may require passing special flags to $ld to create a
7647 library that can be dynamically loaded.  If your ld flags include
7648 -L/other/path options to locate libraries outside your loader's normal
7649 search path, you may need to specify those -L options here as well.  To
7650 use no flags, say "none".
7651
7652 EOM
7653     case "$lddlflags" in
7654     '') case "$osname" in
7655                         beos) dflt='-nostart' ;;
7656                         hpux) dflt='-b';
7657                               case "$gccversion" in
7658                               '') dflt="$dflt +vnocompatwarnings" ;;
7659                               esac
7660                               ;;        
7661                         linux|irix*|gnu*)       dflt='-shared' ;;
7662                         next)  dflt='none' ;;
7663                         solaris) dflt='-G' ;;
7664                         sunos) dflt='-assert nodefinitions' ;;
7665                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7666                 *)     dflt='none' ;;
7667                         esac
7668                         ;;
7669     *) dflt="$lddlflags" ;;
7670     esac
7671
7672         : Try to guess additional flags to pick up local libraries.
7673         : Be careful not to append to a plain 'none'
7674         case "$dflt" in
7675         none) dflt='' ;;
7676         esac
7677         for thisflag in $ldflags; do
7678                 case "$thisflag" in
7679                 -L*|-R*|-Wl,-R*)
7680                         case " $dflt " in
7681                         *" $thisflag "*) ;;
7682                         *) dflt="$dflt $thisflag" ;;
7683                         esac
7684                         ;;
7685                 esac
7686         done
7687
7688         case "$dflt" in
7689         ''|' ') dflt='none' ;;
7690         esac
7691
7692     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7693     . ./myread
7694     case "$ans" in
7695     none) lddlflags=' ' ;;
7696     *) lddlflags="$ans" ;;
7697     esac
7698
7699         cat <<EOM
7700
7701 Some systems may require passing special flags to $cc to indicate that
7702 the resulting executable will use dynamic linking.  To use no flags,
7703 say "none".
7704
7705 EOM
7706     case "$ccdlflags" in
7707     '') case "$osname" in
7708             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
7709             next|sunos) dflt='none' ;;
7710             *)          dflt='none' ;;
7711             esac ;;
7712     ' ')  dflt='none' ;;
7713     *)  dflt="$ccdlflags" ;;
7714     esac
7715     rp="Any special flags to pass to $cc to use dynamic linking?"
7716     . ./myread
7717     case "$ans" in
7718     none) ccdlflags=' ' ;;
7719     *) ccdlflags="$ans" ;;
7720     esac
7721     ;;
7722 *)  usedl="$undef"
7723         ld='ld'
7724     dlsrc='dl_none.xs'
7725     lddlflags=''
7726     ccdlflags=''
7727     ;;
7728 esac
7729
7730 also=''
7731 case "$usedl" in
7732 $undef)
7733         # No dynamic loading being used, so don't bother even to prompt.
7734         useshrplib='false'
7735         ;;
7736 *)      case "$useshrplib" in
7737         '')     case "$osname" in
7738                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7739                         dflt=y
7740                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7741                         ;;
7742                 next*)
7743                         case "$osvers" in
7744                         4*)     dflt=y
7745                                 also='Building a shared libperl is needed for MAB support.'
7746                                 ;;
7747                         *)      dflt=n
7748                                 ;;
7749                         esac
7750                         ;;
7751                 *)      dflt=n
7752                         ;;
7753                 esac
7754                 ;;
7755         $define|true|[Yy]*)
7756                 dflt=y
7757                 ;;
7758         *)      dflt=n
7759                 ;;
7760         esac
7761         $cat << EOM
7762
7763 The perl executable is normally obtained by linking perlmain.c with
7764 libperl${_a}, any static extensions (usually just DynaLoader), and
7765 any other libraries needed on this system (such as -lm, etc.).  Since
7766 your system supports dynamic loading, it is probably possible to build
7767 a shared libperl.$so.  If you will have more than one executable linked
7768 to libperl.$so, this will significantly reduce the size of each
7769 executable, but it may have a noticeable effect on performance.  The
7770 default is probably sensible for your system.
7771 $also
7772
7773 EOM
7774         rp="Build a shared libperl.$so (y/n)"
7775         . ./myread
7776         case "$ans" in
7777         true|$define|[Yy]*)
7778                 useshrplib='true'  ;;
7779         *)      useshrplib='false' ;;
7780         esac
7781         ;;
7782 esac
7783
7784 case "$useshrplib" in
7785 true)
7786         case "$libperl" in
7787         '')
7788                 # Figure out a good name for libperl.so.  Since it gets stored in
7789                 # a version-specific architecture-dependent library, the version
7790                 # number isn't really that important, except for making cc/ld happy.
7791                 #
7792                 # A name such as libperl.so.3.1
7793                 majmin="libperl.$so.$patchlevel.$subversion"
7794                 # A name such as libperl.so.301
7795                 majonly=`echo $patchlevel $subversion |
7796                         $awk '{printf "%d%02d", $1, $2}'`
7797                 majonly=libperl.$so.$majonly
7798                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7799                 # rely on figuring it out from the naming of libc.
7800                 case "${osname}${osvers}" in
7801                 next4*)
7802                         dflt=libperl.5.$so
7803                         # XXX How handle the --version stuff for MAB?
7804                         ;;
7805                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
7806                         dflt=libperl.$so
7807                         ;;
7808                 cygwin*) # ld links against an importlib
7809                         dflt=libperl$lib_ext
7810                         ;;
7811                 *)      # Try to guess based on whether libc has major.minor.
7812                         case "$libc" in
7813                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7814                         *libc.$so.[0-9]*) dflt=$majonly ;;
7815                         *)      dflt=libperl.$so ;;
7816                         esac
7817                         ;;
7818                 esac
7819                 ;;
7820         *)      dflt=$libperl
7821                 ;;
7822         esac
7823         cat << EOM
7824
7825 I need to select a good name for the shared libperl.  If your system uses
7826 library names with major and minor numbers, then you might want something
7827 like $majmin.  Alternatively, if your system uses a single version
7828 number for shared libraries, then you might want to use $majonly.
7829 Or, your system might be quite happy with a simple libperl.$so.
7830
7831 Since the shared libperl will get installed into a version-specific
7832 architecture-dependent directory, the version number of the shared perl
7833 library probably isn't important, so the default should be o.k.
7834
7835 EOM
7836         rp='What name do you want to give to the shared libperl?'
7837         . ./myread
7838         libperl=$ans
7839         echo "Ok, I'll use $libperl"
7840         ;;
7841 *)
7842         libperl="libperl${_a}"
7843         ;;
7844 esac
7845
7846 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7847 case "$shrpdir" in
7848 '') ;;
7849 *)      $cat >&4 <<EOM
7850 WARNING:  Use of the shrpdir variable for the installation location of
7851 the shared $libperl is not supported.  It was never documented and
7852 will not work in this version.  Let me (perlbug@perl.org)
7853 know of any problems this may cause.
7854
7855 EOM
7856         case "$shrpdir" in
7857         "$archlibexp/CORE")
7858                 $cat >&4 <<EOM
7859 But your current setting of $shrpdir is
7860 the default anyway, so it's harmless.
7861 EOM
7862                 ;;
7863         *)
7864                 $cat >&4 <<EOM
7865 Further, your current attempted setting of $shrpdir
7866 conflicts with the value of $archlibexp/CORE
7867 that installperl will use.
7868 EOM
7869                 ;;
7870         esac
7871         ;;
7872 esac
7873
7874 # How will the perl executable find the installed shared $libperl?
7875 # Add $xxx to ccdlflags.
7876 # If we can't figure out a command-line option, use $shrpenv to
7877 # set env LD_RUN_PATH.  The main perl makefile uses this.
7878 shrpdir=$archlibexp/CORE
7879 xxx=''
7880 tmp_shrpenv=''
7881 if "$useshrplib"; then
7882     case "$osname" in 
7883         aix)
7884                 # We'll set it in Makefile.SH...
7885                 ;;
7886         solaris)
7887                 xxx="-R $shrpdir"
7888                 ;;
7889         freebsd|netbsd|openbsd|interix)
7890                 xxx="-Wl,-R$shrpdir"
7891                 ;;
7892         bsdos|linux|irix*|dec_osf|gnu*)
7893                 xxx="-Wl,-rpath,$shrpdir"
7894                 ;;
7895         next)
7896                 # next doesn't like the default...
7897                 ;;
7898         beos)
7899                 # beos doesn't like the default, either.
7900                 ;;
7901         hpux*)
7902                 # hpux doesn't like the default, either.
7903                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7904                 ;;
7905         *)
7906                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7907                 ;;
7908         esac
7909         case "$xxx" in
7910         '') ;;
7911         *)      
7912                 # Only add $xxx if it isn't already in ccdlflags.
7913                 case " $ccdlflags " in
7914                 *" $xxx "*)     ;;
7915                 *)      ccdlflags="$ccdlflags $xxx"
7916                         cat <<EOM >&4
7917
7918 Adding $xxx to the flags
7919 passed to $ld so that the perl executable will find the 
7920 installed shared $libperl.
7921
7922 EOM
7923                         ;;
7924                 esac
7925                 ;;
7926         esac
7927 fi
7928 # Fix ccdlflags in AIX for building external extensions.
7929 # (For building Perl itself bare -bE:perl.exp is needed,
7930 #  Makefile.SH takes care of this.)
7931 case "$osname" in
7932 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7933 esac
7934 # Respect a hint or command-line value.
7935 case "$shrpenv" in
7936 '') shrpenv="$tmp_shrpenv" ;;
7937 esac
7938 case "$ldlibpthname" in
7939 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7940 none)   ldlibpthname='' ;;
7941 esac
7942
7943 : determine where manual pages are on this system
7944 echo " "
7945 case "$sysman" in
7946 '') 
7947         syspath='/usr/share/man/man1 /usr/man/man1'
7948         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7949         syspath="$syspath /usr/man/u_man/man1"
7950         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7951         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7952         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7953         sysman=`./loc . /usr/man/man1 $syspath`
7954         ;;
7955 esac
7956 if $test -d "$sysman"; then
7957         echo "System manual is in $sysman." >&4
7958 else
7959         echo "Could not find manual pages in source form." >&4
7960 fi
7961
7962 : determine where manual pages go
7963 set man1dir man1dir none
7964 eval $prefixit
7965 $cat <<EOM
7966
7967 $spackage has manual pages available in source form.
7968 EOM
7969 case "$nroff" in
7970 nroff)
7971         echo "However, you don't have nroff, so they're probably useless to you."
7972         case "$man1dir" in
7973         '') man1dir="none";;
7974         esac;;
7975 esac
7976 echo "If you don't want the manual sources installed, answer 'none'."
7977 case "$man1dir" in
7978 ' ') dflt=none
7979         ;;
7980 '')
7981         lookpath="$prefixexp/share/man/man1"
7982         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
7983         lookpath="$lookpath $prefixexp/man/p_man/man1"
7984         lookpath="$lookpath $prefixexp/man/u_man/man1"
7985         lookpath="$lookpath $prefixexp/man/man.1"
7986         case "$sysman" in
7987         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7988         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7989         esac
7990         set dflt
7991         eval $prefixup
7992         ;;
7993 *)  dflt="$man1dir"
7994         ;;
7995 esac
7996 echo " "
7997 fn=dn+~
7998 rp="Where do the main $spackage manual pages (source) go?"
7999 . ./getfile
8000 if $test "X$man1direxp" != "X$ansexp"; then
8001         installman1dir=''
8002 fi
8003 man1dir="$ans"
8004 man1direxp="$ansexp"
8005 case "$man1dir" in
8006 '')     man1dir=' '
8007         installman1dir='';;
8008 esac
8009
8010 : Change installation prefix, if necessary.
8011 if $test X"$prefix" != X"$installprefix"; then
8012         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
8013 else
8014         installman1dir="$man1direxp"
8015 fi
8016
8017 : What suffix to use on installed man pages
8018
8019 case "$man1dir" in
8020 ' ')
8021         man1ext='0'
8022         ;;
8023 *)
8024         rp="What suffix should be used for the main $spackage man pages?"
8025         case "$man1ext" in
8026         '')     case "$man1dir" in
8027                 *1)  dflt=1 ;;
8028                 *1p) dflt=1p ;;
8029                 *1pm) dflt=1pm ;;
8030                 *l) dflt=l;;
8031                 *n) dflt=n;;
8032                 *o) dflt=o;;
8033                 *p) dflt=p;;
8034                 *C) dflt=C;;
8035                 *L) dflt=L;;
8036                 *L1) dflt=L1;;
8037                 *) dflt=1;;
8038                 esac
8039                 ;;
8040         *)      dflt="$man1ext";;
8041         esac
8042         . ./myread
8043         man1ext="$ans"
8044         ;;
8045 esac
8046
8047 : see if we can have long filenames
8048 echo " "
8049 first=123456789abcdef
8050 $rm -f $first
8051 if (echo hi >$first) 2>/dev/null; then
8052         if $test -f 123456789abcde; then
8053                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8054                 val="$undef"
8055         else
8056                 echo 'You can have filenames longer than 14 characters.'>&4
8057                 val="$define"
8058         fi
8059 else
8060         $cat <<'EOM'
8061 You can't have filenames longer than 14 chars.
8062 You can't even think about them!
8063 EOM
8064         val="$undef"
8065 fi 
8066 set d_flexfnam
8067 eval $setvar
8068 $rm -rf 123456789abcde*
8069
8070 : determine where library module manual pages go
8071 set man3dir man3dir none
8072 eval $prefixit
8073 $cat <<EOM
8074
8075 $spackage has manual pages for many of the library modules.
8076 EOM
8077
8078 case "$nroff" in
8079 nroff)
8080         $cat <<'EOM'
8081 However, you don't have nroff, so they're probably useless to you.
8082 EOM
8083         case "$man3dir" in
8084         '') man3dir="none";;
8085         esac;;
8086 esac
8087
8088 case "$d_flexfnam" in
8089 undef)
8090         $cat <<'EOM'
8091 However, your system can't handle the long file names like File::Basename.3. 
8092 EOM
8093         case "$man3dir" in
8094         '') man3dir="none";;
8095         esac;;
8096 esac
8097
8098 echo "If you don't want the manual sources installed, answer 'none'."
8099 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8100 case "$man3dir" in
8101 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8102         if $test -d "$privlib/man/man3"; then
8103                 cat <<EOM >&4
8104
8105 WARNING:  Previous versions of perl installed man3 pages into
8106 $privlib/man/man3.  This version will suggest a 
8107 new default of $dflt.  
8108 EOM
8109                 tdflt=$dflt
8110                 dflt='n'
8111                 rp='Do you wish to preserve the old behavior?(y/n)'
8112                 . ./myread
8113                 case "$ans" in
8114                 y*) dflt="$privlib/man/man3" ;;
8115                 *)  dflt=$tdflt ;;
8116                 esac
8117     fi
8118         ;;
8119 *)      dflt="$man3dir" ;;
8120 esac
8121 case "$dflt" in
8122 ' ') dflt=none ;;
8123 esac
8124 echo " "
8125 fn=dn+~
8126 rp="Where do the $package library man pages (source) go?"
8127 . ./getfile
8128 man3dir="$ans"
8129 man3direxp="$ansexp"
8130 case "$man3dir" in
8131 '')     man3dir=' '
8132         installman3dir='';;
8133 esac
8134
8135 : Change installation prefix, if necessary.
8136 if $test X"$prefix" != X"$installprefix"; then
8137         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8138 else
8139         installman3dir="$man3direxp"
8140 fi
8141
8142 : What suffix to use on installed man pages
8143 case "$man3dir" in
8144 ' ')
8145         man3ext='0'
8146         ;;
8147 *)
8148         rp="What suffix should be used for the $package library man pages?"
8149         case "$man3ext" in
8150         '')     case "$man3dir" in
8151                 *3)  dflt=3 ;;
8152                 *3p) dflt=3p ;;
8153                 *3pm) dflt=3pm ;;
8154                 *l) dflt=l;;
8155                 *n) dflt=n;;
8156                 *o) dflt=o;;
8157                 *p) dflt=p;;
8158                 *C) dflt=C;;
8159                 *L) dflt=L;;
8160                 *L3) dflt=L3;;
8161                 *) dflt=3;;
8162                 esac
8163                 ;;
8164         *)      dflt="$man3ext";;
8165         esac
8166         . ./myread
8167         man3ext="$ans"
8168         ;;
8169 esac
8170
8171 : see if we have to deal with yellow pages, now NIS.
8172 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8173         if $test -f /usr/etc/nibindd; then
8174                 echo " "
8175                 echo "I'm fairly confident you're on a NeXT."
8176                 echo " "
8177                 rp='Do you get the hosts file via NetInfo?'
8178                 dflt=y
8179                 case "$hostcat" in
8180                 nidump*) ;;
8181                 '') ;;
8182                 *) dflt=n;;
8183                 esac
8184                 . ./myread
8185                 case "$ans" in
8186                 y*) hostcat='nidump hosts .';;
8187                 *)      case "$hostcat" in
8188                         nidump*) hostcat='';;
8189                         esac
8190                         ;;
8191                 esac
8192         fi
8193         case "$hostcat" in
8194         nidump*) ;;
8195         *)
8196                 case "$hostcat" in
8197                 *ypcat*) dflt=y;;
8198                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8199                                 dflt=y
8200                         else
8201                                 dflt=n
8202                         fi;;
8203                 *) dflt=n;;
8204                 esac
8205                 echo " "
8206                 rp='Are you getting the hosts file via yellow pages?'
8207                 . ./myread
8208                 case "$ans" in
8209                 y*) hostcat='ypcat hosts';;
8210                 *) hostcat='cat /etc/hosts';;
8211                 esac
8212                 ;;
8213         esac
8214 fi
8215 case "$hostcat" in
8216 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8217 esac
8218 case "$groupcat" in
8219 '') test -f /etc/group && groupcat='cat /etc/group';;
8220 esac
8221 case "$passcat" in
8222 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8223 esac
8224
8225 : now get the host name
8226 echo " "
8227 echo "Figuring out host name..." >&4
8228 case "$myhostname" in
8229 '') cont=true
8230         echo 'Maybe "hostname" will work...'
8231         if tans=`sh -c hostname 2>&1` ; then
8232                 myhostname=$tans
8233                 phostname=hostname
8234                 cont=''
8235         fi
8236         ;;
8237 *) cont='';;
8238 esac
8239 if $test "$cont"; then
8240         if ./xenix; then
8241                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8242                 if tans=`cat /etc/systemid 2>&1` ; then
8243                         myhostname=$tans
8244                         phostname='cat /etc/systemid'
8245                         echo "Whadyaknow.  Xenix always was a bit strange..."
8246                         cont=''
8247                 fi
8248         elif $test -r /etc/systemid; then
8249                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8250         fi
8251 fi
8252 if $test "$cont"; then
8253         echo 'No, maybe "uuname -l" will work...'
8254         if tans=`sh -c 'uuname -l' 2>&1` ; then
8255                 myhostname=$tans
8256                 phostname='uuname -l'
8257         else
8258                 echo 'Strange.  Maybe "uname -n" will work...'
8259                 if tans=`sh -c 'uname -n' 2>&1` ; then
8260                         myhostname=$tans
8261                         phostname='uname -n'
8262                 else
8263                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8264                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8265                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8266                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8267                         else
8268                                 case "$myhostname" in
8269                                 '') echo "Does this machine have an identity crisis or something?"
8270                                         phostname='';;
8271                                 *)
8272                                         echo "Well, you said $myhostname before..."
8273                                         phostname='echo $myhostname';;
8274                                 esac
8275                         fi
8276                 fi
8277         fi
8278 fi
8279 case "$myhostname" in
8280 '') myhostname=noname ;;
8281 esac
8282 : you do not want to know about this
8283 set $myhostname
8284 myhostname=$1
8285
8286 : verify guess
8287 if $test "$myhostname" ; then
8288         dflt=y
8289         rp='Your host name appears to be "'$myhostname'".'" Right?"
8290         . ./myread
8291         case "$ans" in
8292         y*) ;;
8293         *) myhostname='';;
8294         esac
8295 fi
8296
8297 : bad guess or no guess
8298 while $test "X$myhostname" = X ; do
8299         dflt=''
8300         rp="Please type the (one word) name of your host:"
8301         . ./myread
8302         myhostname="$ans"
8303 done
8304
8305 : translate upper to lower if necessary
8306 case "$myhostname" in
8307 *[A-Z]*)
8308         echo "(Normalizing case in your host name)"
8309         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8310         ;;
8311 esac
8312
8313 case "$myhostname" in
8314 *.*)
8315         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8316         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8317         echo "(Trimming domain name from host name--host name is now $myhostname)"
8318         ;;
8319 *) case "$mydomain" in
8320         '')
8321                 {
8322                         test "X$hostcat" = "Xypcat hosts" &&
8323                         ypmatch "$myhostname" hosts 2>/dev/null |\
8324                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8325                         $test -s hosts
8326                 } || {
8327                         test "X$hostcat" != "X" &&
8328                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8329                                         /[       ]$myhostname[  . ]/p" > hosts
8330                 }
8331                 tmp_re="[       . ]"
8332                 if $test -f hosts; then
8333                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8334                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8335                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8336                                 hosts | $sort | $uniq | \
8337                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8338                         case `$echo X$dflt` in
8339                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8340                                 dflt=.
8341                                 ;;
8342                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8343                                 ;;
8344                         esac
8345                 else
8346                         echo "(I cannot locate a hosts database anywhere)"
8347                         dflt=.
8348                 fi
8349                 case "$dflt" in
8350                 .)
8351                         tans=`./loc resolv.conf X /etc /usr/etc`
8352                         if $test -f "$tans"; then
8353                                 echo "(Attempting domain name extraction from $tans)"
8354                                 dflt=.`$sed -n -e 's/   / /g' \
8355                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8356                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8357                                 case "$dflt" in
8358                                 .) dflt=.`$sed -n -e 's/        / /g' \
8359                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8360                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8361                                         ;;
8362                                 esac
8363                         fi
8364                         ;;
8365                 esac
8366                 case "$dflt" in
8367                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8368                         dflt=.`sh -c domainname 2>/dev/null`
8369                         case "$dflt" in
8370                         '') dflt='.';;
8371                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8372                         esac
8373                         ;;
8374                 esac
8375                 case "$dflt$osname" in
8376                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8377                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8378                         ;;
8379                 esac
8380                 case "$dflt" in
8381                 .) echo "(Lost all hope -- silly guess then)"
8382                         dflt='.nonet'
8383                         ;;
8384                 esac
8385                 $rm -f hosts
8386                 ;;
8387         *) dflt="$mydomain";;
8388         esac;;
8389 esac
8390 echo " "
8391 rp="What is your domain name?"
8392 . ./myread
8393 tans="$ans"
8394 case "$ans" in
8395 '') ;;
8396 .*) ;;
8397 *) tans=".$tans";;
8398 esac
8399 mydomain="$tans"
8400
8401 : translate upper to lower if necessary
8402 case "$mydomain" in
8403 *[A-Z]*)
8404         echo "(Normalizing case in your domain name)"
8405         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8406         ;;
8407 esac
8408
8409 : a little sanity check here
8410 case "$phostname" in
8411 '') ;;
8412 *)
8413         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8414         $myhostname$mydomain|$myhostname) ;;
8415         *)
8416                 case "$phostname" in
8417                 sed*)
8418                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8419                         ;;
8420                 *)
8421                         echo "(That doesn't agree with your $phostname command, by the way.)"
8422                         ;;
8423                 esac
8424         ;;
8425         esac
8426         ;;
8427 esac
8428
8429 $cat <<EOM
8430
8431 I need to get your e-mail address in Internet format if possible, i.e.
8432 something like user@host.domain. Please answer accurately since I have
8433 no easy means to double check it. The default value provided below
8434 is most probably close to reality but may not be valid from outside
8435 your organization...
8436
8437 EOM
8438 cont=x
8439 while test "$cont"; do
8440         case "$cf_email" in
8441         '') dflt="$cf_by@$myhostname$mydomain";;
8442         *) dflt="$cf_email";;
8443         esac
8444         rp='What is your e-mail address?'
8445         . ./myread
8446         cf_email="$ans"
8447         case "$cf_email" in
8448         *@*.*) cont='' ;;
8449         *)
8450                 rp='Address does not look like an Internet one.  Use it anyway?'
8451                 case "$fastread" in
8452                 yes) dflt=y ;;
8453                 *) dflt=n ;;
8454                 esac
8455                 . ./myread
8456                 case "$ans" in
8457                 y*) cont='' ;;
8458                 *) echo " " ;;
8459                 esac
8460                 ;;
8461         esac
8462 done
8463
8464 $cat <<EOM
8465
8466 If you or somebody else will be maintaining perl at your site, please
8467 fill in the correct e-mail address here so that they may be contacted
8468 if necessary. Currently, the "perlbug" program included with perl
8469 will send mail to this address in addition to perlbug@perl.org. You may
8470 enter "none" for no administrator.
8471
8472 EOM
8473 case "$perladmin" in
8474 '') dflt="$cf_email";;
8475 *) dflt="$perladmin";;
8476 esac
8477 rp='Perl administrator e-mail address'
8478 . ./myread
8479 perladmin="$ans"
8480
8481 : determine whether to only install version-specific parts.
8482 echo " "
8483 $cat <<EOM
8484 Do you want to install only the version-specific parts of the perl
8485 distribution?  Usually you do *not* want to do this.
8486 EOM
8487 case "$versiononly" in
8488 "$define"|[Yy]*|true) dflt='y' ;;
8489 *) dflt='n';
8490 esac
8491 rp="Do you want to install only the version-specific parts of perl?"
8492 . ./myread
8493 case "$ans" in
8494 [yY]*)  val="$define";;
8495 *)      val="$undef" ;;
8496 esac
8497 set versiononly
8498 eval $setvar
8499
8500 case "$versiononly" in
8501 "$define") inc_version_list=''
8502            inc_version_list_init=0
8503            ;;
8504 esac
8505
8506 : figure out how to guarantee perl startup
8507 case "$startperl" in
8508 '')
8509         case "$sharpbang" in
8510         *!)
8511                 $cat <<EOH
8512
8513 I can use the #! construct to start perl on your system. This will
8514 make startup of perl scripts faster, but may cause problems if you
8515 want to share those scripts and perl is not in a standard place
8516 ($binexp/perl) on all your platforms. The alternative is to force
8517 a shell by starting the script with a single ':' character.
8518
8519 EOH
8520                 case "$versiononly" in
8521                 "$define")      dflt="$binexp/perl$version";;  
8522                 *)              dflt="$binexp/perl";;
8523                 esac
8524                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8525                 . ./myread
8526                 case "$ans" in
8527                 none)   startperl=": # use perl";;
8528                 *)      startperl="#!$ans"
8529                         if $test 30 -lt `echo "$ans" | wc -c`; then
8530                                 $cat >&4 <<EOM
8531
8532 WARNING:  Some systems limit the #! command to 32 characters.
8533 If you experience difficulty running Perl scripts with #!, try
8534 installing Perl in a directory with a shorter pathname.
8535
8536 EOM
8537                         fi ;;
8538                 esac
8539                 ;;
8540         *) startperl=": # use perl"
8541                 ;;
8542         esac
8543         ;;
8544 esac
8545 echo "I'll use $startperl to start perl scripts."
8546
8547 : figure best path for perl in scripts
8548 case "$perlpath" in
8549 '')
8550         case "$versiononly" in
8551         "$define")      perlpath="$binexp/perl$version";;
8552         *)              perlpath="$binexp/perl";;
8553         esac
8554         case "$startperl" in
8555         *!*) ;;
8556         *)
8557                 $cat <<EOH
8558
8559 I will use the "eval 'exec'" idiom to start Perl on your system.
8560 I can use the full path of your Perl binary for this purpose, but
8561 doing so may cause problems if you want to share those scripts and
8562 Perl is not always in a standard place ($binexp/perl).
8563
8564 EOH
8565                 dflt="$binexp/perl"
8566                 rp="What path shall I use in \"eval 'exec'\"?"
8567                 . ./myread
8568                 perlpath="$ans"
8569                 ;;
8570         esac
8571         ;;
8572 esac
8573 case "$startperl" in
8574 *!*)    ;;
8575 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8576 esac
8577
8578 : determine where public executable scripts go
8579 set scriptdir scriptdir
8580 eval $prefixit
8581 case "$scriptdir" in
8582 '')
8583         dflt="$bin"
8584         : guess some guesses
8585         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8586         $test -d /usr/share/bin     && dflt=/usr/share/bin
8587         $test -d /usr/local/script  && dflt=/usr/local/script
8588         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8589         $test -d $prefixexp/script  && dflt=$prefixexp/script
8590         set dflt
8591         eval $prefixup
8592         ;;
8593 *)  dflt="$scriptdir"
8594         ;;
8595 esac
8596 $cat <<EOM
8597  
8598 Some installations have a separate directory just for executable scripts so
8599 that they can mount it across multiple architectures but keep the scripts in
8600 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8601 Or you might just lump your scripts in with all your other executables.
8602  
8603 EOM
8604 fn=d~
8605 rp='Where do you keep publicly executable scripts?'
8606 . ./getfile
8607 if $test "X$ansexp" != "X$scriptdirexp"; then
8608         installscript=''
8609 fi
8610 scriptdir="$ans"
8611 scriptdirexp="$ansexp"
8612 : Change installation prefix, if necessary.
8613 if $test X"$prefix" != X"$installprefix"; then
8614         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8615 else
8616         installscript="$scriptdirexp"
8617 fi
8618
8619 : determine where add-on public executables go
8620 case "$sitebin" in
8621 '')     dflt=$siteprefix/bin ;;
8622 *)      dflt=$sitebin ;;
8623 esac
8624 fn=d~
8625 rp='Pathname where the add-on public executables should be installed?'
8626 . ./getfile
8627 sitebin="$ans"
8628 sitebinexp="$ansexp"
8629 : Change installation prefix, if necessary.
8630 if $test X"$prefix" != X"$installprefix"; then
8631         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8632 else
8633         installsitebin="$sitebinexp"
8634 fi
8635
8636 : determine where add-on html pages go
8637 : There is no standard location, so try to copy the previously-selected
8638 : directory structure for the core html pages.
8639 case "$sitehtml1dir" in
8640 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8641 *)     dflt=$sitehtml1dir ;;
8642 esac
8643 case "$dflt" in
8644 ''|' ') dflt=none ;;
8645 esac
8646 fn=dn+~
8647 rp='Pathname where the site-specific html pages should be installed?'
8648 . ./getfile
8649 sitehtml1dir="$ans"
8650 sitehtml1direxp="$ansexp"
8651 : Change installation prefix, if necessary.
8652 if $test X"$prefix" != X"$installprefix"; then
8653         installsitehtml1dir=`echo $sitehtml1direxp | $sed "s#^$prefix#$installprefix#"`
8654 else
8655         installsitehtml1dir="$sitehtml1direxp"
8656 fi
8657
8658 : determine where add-on library html pages go
8659 : There is no standard location, so try to copy the previously-selected
8660 : directory structure for the core html pages.
8661 case "$sitehtml3dir" in
8662 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8663 *)     dflt=$sitehtml3dir ;;
8664 esac
8665 case "$dflt" in
8666 ''|' ') dflt=none ;;
8667 esac
8668 fn=dn+~
8669 rp='Pathname where the site-specific library html pages should be installed?'
8670 . ./getfile
8671 sitehtml3dir="$ans"
8672 sitehtml3direxp="$ansexp"
8673 : Change installation prefix, if necessary.
8674 if $test X"$prefix" != X"$installprefix"; then
8675         installsitehtml3dir=`echo $sitehtml3direxp | $sed "s#^$prefix#$installprefix#"`
8676 else
8677         installsitehtml3dir="$sitehtml3direxp"
8678 fi
8679
8680 : determine where add-on manual pages go
8681 case "$siteman1dir" in
8682 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8683 *)      dflt=$siteman1dir ;;
8684 esac
8685 case "$dflt" in
8686 ''|' ') dflt=none ;;
8687 esac
8688 fn=dn+~
8689 rp='Pathname where the site-specific manual pages should be installed?'
8690 . ./getfile
8691 siteman1dir="$ans"
8692 siteman1direxp="$ansexp"
8693 : Change installation prefix, if necessary.
8694 if $test X"$prefix" != X"$installprefix"; then
8695         installsiteman1dir=`echo $siteman1direxp | $sed "s#^$prefix#$installprefix#"`
8696 else
8697         installsiteman1dir="$siteman1direxp"
8698 fi
8699
8700 : determine where add-on library man pages go
8701 case "$siteman3dir" in
8702 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8703 *)      dflt=$siteman3dir ;;
8704 esac
8705 case "$dflt" in
8706 ''|' ') dflt=none ;;
8707 esac
8708 fn=dn+~
8709 rp='Pathname where the site-specific library manual pages should be installed?'
8710 . ./getfile
8711 siteman3dir="$ans"
8712 siteman3direxp="$ansexp"
8713 : Change installation prefix, if necessary.
8714 if $test X"$prefix" != X"$installprefix"; then
8715         installsiteman3dir=`echo $siteman3direxp | $sed "s#^$prefix#$installprefix#"`
8716 else
8717         installsiteman3dir="$siteman3direxp"
8718 fi
8719
8720 : determine where add-on public executable scripts go
8721 case "$sitescript" in
8722 '')     dflt=$siteprefix/script
8723         $test -d $dflt || dflt=$sitebin ;;
8724 *)  dflt="$sitescript" ;;
8725 esac
8726 fn=d~+
8727 rp='Pathname where add-on public executable scripts should be installed?'
8728 . ./getfile
8729 sitescript="$ans"
8730 sitescriptexp="$ansexp"
8731 : Change installation prefix, if necessary.
8732 if $test X"$prefix" != X"$installprefix"; then
8733         installsitescript=`echo $sitescriptexp | sed "s#^$prefix#$installprefix#"`
8734 else
8735         installsitescript="$sitescriptexp"
8736 fi
8737
8738 case "$usefaststdio" in
8739 $define|true|[yY]*|'')
8740         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8741         case "$xversion" in
8742         [68])   dflt='y' ;;
8743         *)      dflt='n' ;;
8744         esac
8745         ;;
8746 *) dflt='n';;
8747 esac
8748 cat <<EOM
8749
8750 Perl can be built to use 'fast stdio', which means using the stdio
8751 library but also directly manipulating the stdio buffers to enable
8752 faster I/O.  Using stdio is better for backward compatibility (especially
8753 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8754 interface has been preferred instead of stdio.
8755
8756 If this doesn't make any sense to you, just accept the default '$dflt'.
8757 EOM
8758 rp='Use the "fast stdio" if available?'
8759 . ./myread
8760 case "$ans" in
8761 y|Y)    val="$define" ;;     
8762 *)      val="$undef" ;;
8763 esac
8764 set usefaststdio
8765 eval $setvar
8766
8767
8768 : define an is-a-typedef? function
8769 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8770 case "$inclist" in
8771 "") inclist="sys/types.h";;
8772 esac;
8773 eval "varval=\$$var";
8774 case "$varval" in
8775 "")
8776         $rm -f temp.c;
8777         for inc in $inclist; do
8778                 echo "#include <$inc>" >>temp.c;
8779         done;
8780         echo "#ifdef $type" >> temp.c;
8781         echo "printf(\"We have $type\");" >> temp.c;
8782         echo "#endif" >> temp.c;
8783         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8784         if $contains $type temp.E >/dev/null 2>&1; then
8785                 eval "$var=\$type";
8786         else
8787                 eval "$var=\$def";
8788         fi;
8789         $rm -f temp.?;;
8790 *) eval "$var=\$varval";;
8791 esac'
8792
8793 : define an is-a-typedef? function that prompts if the type is not available.
8794 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8795 case "$inclist" in
8796 "") inclist="sys/types.h";;
8797 esac;
8798 eval "varval=\$$var";
8799 case "$varval" in
8800 "")
8801         $rm -f temp.c;
8802         for inc in $inclist; do
8803                 echo "#include <$inc>" >>temp.c;
8804         done;
8805         echo "#ifdef $type" >> temp.c;
8806         echo "printf(\"We have $type\");" >> temp.c;
8807         echo "#endif" >> temp.c;
8808         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8809         echo " " ;
8810         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8811         if $contains $type temp.E >/dev/null 2>&1; then
8812                 echo "$type found." >&4;
8813                 eval "$var=\$type";
8814         else
8815                 echo "$type NOT found." >&4;
8816                 dflt="$def";
8817                 . ./myread ;
8818                 eval "$var=\$ans";
8819         fi;
8820         $rm -f temp.?;;
8821 *) eval "$var=\$varval";;
8822 esac'
8823
8824 : see what type lseek is declared as in the kernel
8825 rp="What is the type used for lseek's offset on this system?"
8826 set off_t lseektype long stdio.h sys/types.h
8827 eval $typedef_ask
8828
8829 echo " "
8830 echo "Checking to see how big your file offsets are..." >&4
8831 $cat >try.c <<EOCP
8832 #include <sys/types.h>
8833 #include <stdio.h>
8834 int main()
8835 {
8836     printf("%d\n", (int)sizeof($lseektype));
8837     return(0); 
8838 }
8839 EOCP
8840 set try
8841 if eval $compile_ok; then
8842         lseeksize=`$run ./try`
8843         echo "Your file offsets are $lseeksize bytes long."
8844 else
8845         dflt=$longsize
8846         echo " "
8847         echo "(I can't seem to compile the test program.  Guessing...)"
8848         rp="What is the size of your file offsets (in bytes)?"
8849         . ./myread
8850         lseeksize="$ans"
8851 fi
8852 $rm -f try.c try
8853
8854 : see what type file positions are declared as in the library
8855 rp="What is the type for file position used by fsetpos()?"
8856 set fpos_t fpostype long stdio.h sys/types.h
8857 eval $typedef_ask
8858
8859 echo " "
8860 case "$fpostype" in
8861 *_t) zzz="$fpostype"    ;;
8862 *)   zzz="fpos_t"       ;;
8863 esac
8864 echo "Checking the size of $zzz..." >&4 
8865 cat > try.c <<EOCP
8866 #include <sys/types.h>
8867 #include <stdio.h>
8868 #$i_stdlib I_STDLIB
8869 #ifdef I_STDLIB
8870 #include <stdlib.h>
8871 #endif
8872 int main() {
8873     printf("%d\n", (int)sizeof($fpostype));
8874     exit(0);
8875 }
8876 EOCP
8877 set try
8878 if eval $compile_ok; then
8879         yyy=`$run ./try`
8880         case "$yyy" in
8881         '')     fpossize=4
8882                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8883                 ;;
8884         *)      fpossize=$yyy
8885                 echo "Your $zzz is $fpossize bytes long."
8886                 ;;
8887         esac
8888 else
8889         dflt="$longsize"
8890         echo " " >&4
8891         echo "(I can't compile the test program.  Guessing...)" >&4
8892         rp="What is the size of your file positions (in bytes)?"
8893         . ./myread
8894         fpossize="$ans"
8895 fi
8896
8897 # Backward compatibility (uselfs is deprecated).
8898 case "$uselfs" in
8899 "$define"|true|[yY]*)
8900         cat <<EOM >&4
8901
8902 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8903 EOM
8904         uselargefiles="$define"
8905         ;;
8906 esac                          
8907
8908 case "$lseeksize:$fpossize" in
8909 8:8) cat <<EOM
8910
8911 You can have files larger than 2 gigabytes.
8912 EOM
8913    val="$define" ;;
8914 *)    case "$uselargefiles" in
8915    "$undef"|false|[nN]*) dflt='n' ;;
8916    *)   dflt='y' ;;
8917    esac
8918    cat <<EOM
8919
8920 Perl can be built to understand large files (files larger than 2 gigabytes)
8921 on some systems.  To do so, Configure can be run with -Duselargefiles.
8922
8923 If this doesn't make any sense to you, just accept the default '$dflt'.
8924 EOM
8925    rp='Try to understand large files, if available?'
8926    . ./myread
8927    case "$ans" in
8928    y|Y)         val="$define" ;;
8929    *)           val="$undef"  ;;
8930    esac
8931    ;;
8932 esac
8933 set uselargefiles
8934 eval $setvar
8935 : Look for a hint-file generated 'call-back-unit'.  If the
8936 : user has specified that a large files perl is to be built,
8937 : we may need to set or change some other defaults.
8938 if $test -f uselargefiles.cbu; then
8939         echo "Your platform has some specific hints regarding large file builds, using them..."
8940         . ./uselargefiles.cbu
8941 fi
8942 case "$uselargefiles" in
8943 "$define")
8944         if $test -f uselargefiles.cbu; then
8945                 echo " "
8946                 echo "Rechecking to see how big your file offsets are..." >&4
8947                 $cat >try.c <<EOCP
8948 #include <sys/types.h>
8949 #include <stdio.h>
8950 int main()
8951 {
8952     printf("%d\n", (int)sizeof($lseektype));
8953     return(0); 
8954 }
8955 EOCP
8956                 set try
8957                 if eval $compile_ok; then
8958                         lseeksize=`$run ./try`
8959                         $echo "Your file offsets are now $lseeksize bytes long."
8960                 else
8961                         dflt="$lseeksize"
8962                         echo " "
8963                         echo "(I can't seem to compile the test program.  Guessing...)"
8964                         rp="What is the size of your file offsets (in bytes)?"
8965                         . ./myread
8966                         lseeksize="$ans"
8967                 fi
8968                 case "$fpostype" in
8969                 *_t) zzz="$fpostype"    ;;
8970                 *)   zzz="fpos_t"       ;;
8971                 esac
8972                 $echo $n "Rechecking the size of $zzz...$c" >&4 
8973                 $cat > try.c <<EOCP
8974 #include <sys/types.h>
8975 #include <stdio.h>
8976 #$i_stdlib I_STDLIB
8977 #ifdef I_STDLIB
8978 #include <stdlib.h>
8979 #endif
8980 int main() {
8981     printf("%d\n", (int)sizeof($fpostype));
8982     return(0);
8983 }
8984 EOCP
8985                 set try
8986                 if eval $compile_ok; then
8987                         yyy=`$run ./try`
8988                         dflt="$lseeksize"
8989                         case "$yyy" in
8990                         '')     echo " "
8991                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8992                                 ;;
8993                         *)      fpossize=$yyy
8994                                 echo " $fpossize bytes." >&4
8995                                 ;;
8996                         esac
8997                 else
8998                         dflt="$fpossize"
8999                         echo " "
9000                         echo "(I can't compile the test program.  Guessing...)" >&4
9001                         rp="What is the size of your file positions (in bytes)?"
9002                         . ./myread
9003                         fpossize="$ans"
9004                 fi
9005                 $rm -f try.c try
9006         fi
9007         ;;
9008 esac
9009
9010 # probably will refer to
9011 #   $archlib $privlib $sitearch $sitelib $vendorarch $vendorlib
9012 need_relocation=0
9013 userelocatableinc=undef
9014
9015 case "$vendorprefix" in
9016 '')     d_vendorbin="$undef"
9017         vendorbin=''
9018         vendorbinexp=''
9019         ;;
9020 *)      d_vendorbin="$define"
9021         : determine where vendor-supplied executables go.
9022         case "$vendorbin" in
9023         '') dflt=$vendorprefix/bin ;;
9024         *)      dflt="$vendorbin" ;;
9025         esac
9026         fn=d~+
9027         rp='Pathname for the vendor-supplied executables directory?'
9028         . ./getfile
9029         vendorbin="$ans"
9030         vendorbinexp="$ansexp"
9031         ;;
9032 esac
9033 : Change installation prefix, if necessary.
9034 if $test X"$prefix" != X"$installprefix"; then
9035         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
9036 else
9037         installvendorbin="$vendorbinexp"
9038 fi
9039
9040 case "$vendorprefix" in
9041 '')     vendorhtml1dir=''
9042         vendorhtml1direxp=''
9043         ;;
9044 *)      : determine where vendor-supplied html pages go.
9045         : There is no standard location, so try to copy the previously-selected
9046         : directory structure for the core html pages.
9047         : XXX Better default suggestions would be welcome.
9048         case "$vendorhtml1dir" in
9049         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9050         *)      dflt=$vendorhtml1dir ;;
9051         esac
9052         case "$dflt" in
9053         ''|' ') dflt=none ;;
9054         esac
9055         fn=dn+~
9056         rp='Pathname for the vendor-supplied html pages?'
9057         . ./getfile
9058         vendorhtml1dir="$ans"
9059         vendorhtml1direxp="$ansexp"
9060         ;;
9061 esac
9062 : Use ' ' for none so value is preserved next time through Configure
9063 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9064 : Change installation prefix, if necessary.
9065 if $test X"$prefix" != X"$installprefix"; then
9066         installvendorhtml1dir=`echo $vendorhtml1direxp | $sed "s#^$prefix#$installprefix#"`
9067 else
9068         installvendorhtml1dir="$vendorhtml1direxp"
9069 fi
9070
9071 case "$vendorprefix" in
9072 '')     vendorhtml3dir=''
9073         vendorhtml3direxp=''
9074         ;;
9075 *)      : determine where vendor-supplied module html pages go.
9076         : There is no standard location, so try to copy the previously-selected
9077         : directory structure for the core html pages.
9078         : XXX Better default suggestions would be welcome.
9079         case "$vendorhtml3dir" in
9080         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9081         *)      dflt=$vendorhtml3dir ;;
9082         esac
9083         case "$dflt" in
9084         ''|' ') dflt=none ;;
9085         esac
9086         fn=dn+~
9087         rp='Pathname for the vendor-supplied html pages?'
9088         . ./getfile
9089         vendorhtml3dir="$ans"
9090         vendorhtml3direxp="$ansexp"
9091         ;;
9092 esac
9093 : Use ' ' for none so value is preserved next time through Configure
9094 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9095 : Change installation prefix, if necessary.
9096 if $test X"$prefix" != X"$installprefix"; then
9097         installvendorhtml3dir=`echo $vendorhtml3direxp | $sed "s#^$prefix#$installprefix#"`
9098 else
9099         installvendorhtml3dir="$vendorhtml3direxp"
9100 fi
9101
9102 case "$vendorprefix" in
9103 '')     vendorman1dir=''
9104         vendorman1direxp=''
9105         ;;
9106 *)      : determine where vendor-supplied manual pages go.
9107         case "$vendorman1dir" in
9108         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9109         *)      dflt=$vendorman1dir ;;
9110         esac
9111         case "$dflt" in
9112         ''|' ') dflt=none ;;
9113         esac
9114         fn=nd~+
9115         rp='Pathname for the vendor-supplied manual section 1 pages?'
9116         . ./getfile
9117         vendorman1dir="$ans"
9118         vendorman1direxp="$ansexp"
9119         ;;
9120 esac
9121 : Use ' ' for none so value is preserved next time through Configure
9122 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9123 : Change installation prefix, if necessary.
9124 if $test X"$prefix" != X"$installprefix"; then
9125         installvendorman1dir=`echo "$vendorman1direxp" | $sed "s#^$prefix#$installprefix#"`
9126 else
9127         installvendorman1dir="$vendorman1direxp"
9128 fi
9129
9130 case "$vendorprefix" in
9131 '')     vendorman3dir=''
9132         vendorman3direxp=''
9133         ;;
9134 *)      : determine where vendor-supplied module manual pages go.
9135         case "$vendorman3dir" in
9136         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9137         *)      dflt=$vendorman3dir ;;
9138         esac
9139         case "$dflt" in
9140         ''|' ') dflt=none ;;
9141         esac
9142         fn=nd~+
9143         rp='Pathname for the vendor-supplied manual section 3 pages?'
9144         . ./getfile
9145         vendorman3dir="$ans"
9146         vendorman3direxp="$ansexp"
9147         ;;
9148 esac
9149 : Use ' ' for none so value is preserved next time through Configure
9150 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9151 : Change installation prefix, if necessary.
9152 if $test X"$prefix" != X"$installprefix"; then
9153         installvendorman3dir=`echo "$vendorman3direxp" | $sed "s#^$prefix#$installprefix#"`
9154 else
9155         installvendorman3dir="$vendorman3direxp"
9156 fi
9157
9158 case "$vendorprefix" in
9159 '')     d_vendorscript="$undef"
9160         vendorscript=''
9161         vendorscriptexp=''
9162         ;;
9163 *)      d_vendorscript="$define"
9164         : determine where vendor-supplied scripts go.
9165         case "$vendorscript" in
9166         '')     dflt=$vendorprefix/script
9167                 $test -d $dflt || dflt=$vendorbin ;;
9168         *)  dflt="$vendorscript" ;;
9169         esac
9170         $cat <<EOM
9171
9172 The installation process will create a directory for 
9173 vendor-supplied scripts.
9174
9175 EOM
9176         fn=d~+
9177         rp='Pathname for the vendor-supplied scripts directory?'
9178         . ./getfile
9179         vendorscript="$ans"
9180         vendorscriptexp="$ansexp"
9181         ;;
9182 esac
9183 : Change installation prefix, if necessary.
9184 if $test X"$prefix" != X"$installprefix"; then
9185         installvendorscript=`echo $vendorscriptexp | $sed "s#^$prefix#$installprefix#"`
9186 else
9187         installvendorscript="$vendorscriptexp"
9188 fi
9189
9190 : see if qgcvt exists
9191 set qgcvt d_qgcvt
9192 eval $inlibc
9193
9194 echo " "
9195
9196 if $test X"$d_longdbl" = X"$define"; then
9197
9198 echo "Checking how to print long doubles..." >&4
9199
9200 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9201         $cat >try.c <<'EOCP'
9202 #include <sys/types.h>
9203 #include <stdio.h>
9204 int main() {
9205   double d = 123.456;
9206   printf("%.3f\n", d);
9207 }
9208 EOCP
9209         set try
9210         if eval $compile; then
9211                 yyy=`$run ./try`
9212                 case "$yyy" in
9213                 123.456)
9214                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9215                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9216                         echo "We will use %f."
9217                         ;;
9218                 esac
9219         fi
9220 fi
9221
9222 if $test X"$sPRIfldbl" = X; then
9223         $cat >try.c <<'EOCP'
9224 #include <sys/types.h>
9225 #include <stdio.h>
9226 int main() {
9227   long double d = 123.456;
9228   printf("%.3Lf\n", d);
9229 }
9230 EOCP
9231         set try
9232         if eval $compile; then
9233                 yyy=`$run ./try`
9234                 case "$yyy" in
9235                 123.456)
9236                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9237                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9238                         echo "We will use %Lf."
9239                         ;;
9240                 esac
9241         fi
9242 fi
9243
9244 if $test X"$sPRIfldbl" = X; then
9245         $cat >try.c <<'EOCP'
9246 #include <sys/types.h>
9247 #include <stdio.h>
9248 int main() {
9249   long double d = 123.456;
9250   printf("%.3llf\n", d);
9251 }
9252 EOCP
9253         set try
9254         if eval $compile; then
9255                 yyy=`$run ./try`
9256                 case "$yyy" in
9257                 123.456)
9258                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9259                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9260                         echo "We will use %llf."
9261                         ;;
9262                 esac
9263         fi
9264 fi
9265
9266 if $test X"$sPRIfldbl" = X; then
9267         $cat >try.c <<'EOCP'
9268 #include <sys/types.h>
9269 #include <stdio.h>
9270 int main() {
9271   long double d = 123.456;
9272   printf("%.3lf\n", d);
9273 }
9274 EOCP
9275         set try
9276         if eval $compile; then
9277                 yyy=`$run ./try`
9278                 case "$yyy" in
9279                 123.456)
9280                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9281                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9282                         echo "We will use %lf."
9283                         ;;
9284                 esac
9285         fi
9286 fi
9287
9288 if $test X"$sPRIfldbl" = X; then
9289         echo "Cannot figure out how to print long doubles." >&4
9290 else
9291         sSCNfldbl=$sPRIfldbl    # expect consistency
9292 fi
9293
9294 $rm -f try try.*
9295
9296 fi # d_longdbl
9297
9298 case "$sPRIfldbl" in
9299 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
9300         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
9301         d_SCNfldbl="$undef";
9302         ;;
9303 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
9304         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
9305         d_SCNfldbl="$define";
9306         ;;
9307 esac
9308
9309 : Check how to convert floats to strings.
9310
9311 if test "X$d_Gconvert" = X; then
9312
9313 echo " "
9314 echo "Checking for an efficient way to convert floats to strings."
9315 echo " " > try.c
9316 case "$uselongdouble" in
9317 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9318 esac
9319 case "$d_longdbl" in
9320 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9321 esac
9322 case "$d_PRIgldbl" in
9323 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9324 esac
9325 $cat >>try.c <<EOP
9326 #ifdef TRY_gconvert
9327 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9328 char *myname = "gconvert";
9329 #endif
9330 #ifdef TRY_gcvt
9331 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9332 char *myname = "gcvt";
9333 #endif
9334 #ifdef TRY_qgcvt
9335 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9336 char *myname = "qgcvt";
9337 #define DOUBLETYPE long double
9338 #endif
9339 #ifdef TRY_sprintf
9340 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9341 #ifdef HAS_PRIgldbl
9342 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9343 #else
9344 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9345 #endif
9346 #else
9347 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9348 #endif
9349 char *myname = "sprintf";
9350 #endif
9351
9352 #ifndef DOUBLETYPE
9353 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9354 #define DOUBLETYPE long double
9355 #else
9356 #define DOUBLETYPE double
9357 #endif
9358 #endif
9359
9360 #include <stdio.h>
9361
9362 #define I_STDLIB $i_stdlib
9363 #ifdef I_STDLIB
9364 #include <stdlib.h>
9365 #endif
9366
9367 int
9368 checkit(expect, got)
9369 char *expect;
9370 char *got;
9371 {
9372     if (strcmp(expect, got)) {
9373                 printf("%s oddity:  Expected %s, got %s\n",
9374                         myname, expect, got);
9375                 exit(1);
9376         }
9377 }
9378
9379 int main()
9380
9381         char buf[64]; 
9382         buf[63] = '\0';
9383
9384         /* This must be 1st test on (which?) platform */
9385         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9386         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9387         checkit("0.1", buf);
9388
9389         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
9390         checkit("0.01", buf);
9391
9392         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
9393         checkit("0.001", buf);
9394
9395         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
9396         checkit("0.0001", buf);
9397
9398         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9399         if (strlen(buf) > 5)
9400             checkit("9e-005", buf); /* for Microsoft ?? */
9401         else
9402             checkit("9e-05", buf);
9403
9404         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
9405         checkit("1", buf);
9406
9407         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
9408         checkit("1.1", buf);
9409
9410         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
9411         checkit("1.01", buf);
9412
9413         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
9414         checkit("1.001", buf);
9415
9416         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
9417         checkit("1.0001", buf);
9418
9419         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
9420         checkit("1.00001", buf);
9421
9422         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
9423         checkit("1.000001", buf);
9424
9425         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
9426         checkit("0", buf);
9427
9428         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
9429         checkit("-1", buf);
9430
9431         /* Some Linux gcvt's give 1.e+5 here. */
9432         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
9433         checkit("100000", buf);
9434         
9435         /* Some Linux gcvt's give -1.e+5 here. */
9436         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
9437         checkit("-100000", buf);
9438
9439         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
9440         checkit("123.456", buf);
9441
9442         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9443         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9444         /* 34 should be enough to scare even long double
9445          * places into using the e notation. */
9446         if (strlen(buf) > 5)
9447             checkit("1e+034", buf); /* for Microsoft */
9448         else
9449             checkit("1e+34", buf);
9450
9451         /* For Perl, if you add additional tests here, also add them to
9452          * t/base/num.t for benefit of platforms not using Configure or
9453          * overriding d_Gconvert */
9454
9455         exit(0);
9456 }
9457 EOP
9458 : first add preferred functions to our list
9459 xxx_list=""
9460 for xxx_convert in $gconvert_preference; do
9461     case $xxx_convert in
9462     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9463     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9464     esac 
9465 done
9466 : then add any others
9467 for xxx_convert in gconvert gcvt sprintf; do
9468     case "$xxx_list" in
9469     *$xxx_convert*) ;;
9470     *) xxx_list="$xxx_list $xxx_convert" ;;
9471     esac 
9472 done
9473
9474 case "$d_longdbl$uselongdouble" in
9475 "$define$define")
9476     : again, add prefered functions to our list first
9477     xxx_ld_list=""
9478     for xxx_convert in $gconvert_ld_preference; do
9479         case $xxx_convert in
9480         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9481         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9482         esac
9483     done
9484     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9485     for xxx_convert in qgcvt sprintf $xxx_list; do
9486         case "$xxx_ld_list" in
9487         $xxx_convert*|*" $xxx_convert"*) ;;
9488         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9489         esac
9490     done
9491     : if sprintf cannot do long doubles, move it to the end
9492     if test "$d_PRIgldbl" != "$define"; then
9493         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9494     fi
9495     : if no qgcvt, remove it
9496     if test "$d_qgcvt" != "$define"; then
9497         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9498     fi
9499     : use the ld_list
9500     xxx_list="$xxx_ld_list"
9501     ;;
9502 esac
9503
9504 for xxx_convert in $xxx_list; do
9505         echo "Trying $xxx_convert..."
9506         $rm -f try try$_o
9507         set try -DTRY_$xxx_convert
9508         if eval $compile; then
9509                 echo "$xxx_convert() found." >&4
9510                 if $run ./try; then
9511                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9512                         break;
9513                 else
9514                         echo "...But $xxx_convert didn't work as I expected."
9515                         xxx_convert=''
9516                 fi
9517         else
9518                 echo "$xxx_convert NOT found." >&4
9519         fi
9520 done
9521
9522 if test X$xxx_convert = X; then
9523     echo "*** WHOA THERE!!! ***" >&4
9524     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9525     xxx_convert=sprintf
9526 fi
9527
9528 case "$xxx_convert" in
9529 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9530 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9531 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9532 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9533    "$define$define$define")
9534       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9535    "$define$define$undef")
9536       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9537    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9538    esac
9539    ;;  
9540 esac
9541
9542 fi
9543
9544 : see if _fwalk exists
9545 set fwalk d__fwalk
9546 eval $inlibc
9547
9548 : Initialize h_fcntl
9549 h_fcntl=false
9550
9551 : Initialize h_sysfile
9552 h_sysfile=false
9553
9554 : access call always available on UNIX
9555 set access d_access
9556 eval $inlibc
9557
9558 : locate the flags for 'access()'
9559 case "$d_access" in
9560 "$define")
9561         echo " "
9562         $cat >access.c <<EOCP
9563 #include <sys/types.h>
9564 #ifdef I_FCNTL
9565 #include <fcntl.h>
9566 #endif
9567 #ifdef I_SYS_FILE
9568 #include <sys/file.h>
9569 #endif
9570 #ifdef I_UNISTD
9571 #include <unistd.h>
9572 #endif
9573 #$i_stdlib I_STDLIB
9574 #ifdef I_STDLIB
9575 #include <stdlib.h>
9576 #endif
9577 int main() {
9578         exit(R_OK);
9579 }
9580 EOCP
9581         : check sys/file.h first, no particular reason here
9582         if $test `./findhdr sys/file.h` && \
9583                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9584                 h_sysfile=true;
9585                 echo "<sys/file.h> defines the *_OK access constants." >&4
9586         elif $test `./findhdr fcntl.h` && \
9587                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9588                 h_fcntl=true;
9589                 echo "<fcntl.h> defines the *_OK access constants." >&4
9590         elif $test `./findhdr unistd.h` && \
9591                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9592                 echo "<unistd.h> defines the *_OK access constants." >&4
9593         else
9594                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9595         fi
9596         ;;
9597 esac
9598 $rm -f access*
9599
9600 : see if accessx exists
9601 set accessx d_accessx
9602 eval $inlibc
9603
9604 : see if aintl exists
9605 set aintl d_aintl
9606 eval $inlibc
9607
9608 : see if alarm exists
9609 set alarm d_alarm
9610 eval $inlibc
9611
9612 : see if POSIX threads are available
9613 set pthread.h i_pthread
9614 eval $inhdr
9615
9616 : define a fucntion to check prototypes
9617 $cat > protochk <<EOSH
9618 $startsh
9619 cc="$cc"
9620 optimize="$optimize"
9621 ccflags="$ccflags"
9622 prototype="$prototype"
9623 define="$define"
9624 rm=$rm
9625 usethreads=$usethreads
9626 i_pthread=$i_pthread
9627 pthread_h_first=$pthread_h_first
9628 EOSH
9629
9630 $cat >> protochk <<'EOSH'
9631
9632 $rm -f try.c
9633 foo="$1"
9634 shift
9635 while test $# -ge 2; do
9636         case "$1" in
9637                 $define) echo "#include <$2>" >> try.c ;;
9638                 literal) echo "$2" >> try.c ;;
9639         esac
9640     # Extra magic for the benefit of systems that need pthread.h
9641     # to be included early to correctly detect threadsafe functions.
9642     # Such functions must guarantee themselves, though, that the usethreads
9643     # and i_pthread have been defined, before calling protochk.
9644     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9645         echo "#include <pthread.h>" >> try.c
9646         pthread_h_done=yes
9647     fi
9648     shift 2
9649 done
9650 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9651 cat >> try.c <<'EOCP'
9652 #ifdef CAN_PROTOTYPE
9653 #define _(args) args
9654 #else
9655 #define _(args) ()
9656 #endif
9657 EOCP
9658 echo "$foo" >> try.c
9659 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9660 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9661 status=$?
9662 $rm -f try.[co]
9663 exit $status
9664 EOSH
9665 chmod +x protochk
9666 $eunicefix protochk
9667
9668 hasproto='varname=$1; func=$2; shift; shift;
9669 while $test $# -ge 2; do
9670         case "$1" in
9671         $define) echo "#include <$2>";;
9672         esac ;
9673     shift 2;
9674 done > try.c;
9675 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9676 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9677         echo "$func() prototype found.";
9678         val="$define";
9679 else
9680         echo "$func() prototype NOT found.";
9681         val="$undef";
9682 fi;
9683 set $varname;
9684 eval $setvar;
9685 $rm -f try.c tryout.c'
9686
9687 : see if sys/types.h has to be included
9688 set sys/types.h i_systypes
9689 eval $inhdr
9690
9691 : see if sys/select.h has to be included
9692 set sys/select.h i_sysselct
9693 eval $inhdr
9694
9695 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9696 while $test $# -ge 2; do
9697         case "$1" in
9698         $define) echo "#include <$2>";;
9699         esac ;
9700     shift 2;
9701 done > try.c;
9702 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9703 set try;
9704 if eval $compile; then
9705         val="$define";
9706 else
9707         val="$undef";
9708 fi;
9709 set $varname;
9710 eval $setvar;
9711 $rm -f try.c try.o'
9712
9713 : see if we should include time.h, sys/time.h, or both
9714 echo " "
9715 if test "X$timeincl" = X; then
9716         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9717         $echo $n "I'm now running the test program...$c"
9718         $cat >try.c <<EOCP
9719 #include <sys/types.h>
9720 #ifdef I_TIME
9721 #include <time.h>
9722 #endif
9723 #ifdef I_SYSTIME
9724 #ifdef SYSTIMEKERNEL
9725 #define KERNEL
9726 #endif
9727 #include <sys/time.h>
9728 #endif
9729 #ifdef I_SYSSELECT
9730 #include <sys/select.h>
9731 #endif
9732 #$i_stdlib I_STDLIB
9733 #ifdef I_STDLIB
9734 #include <stdlib.h>
9735 #endif
9736 int main()
9737 {
9738         struct tm foo;
9739 #ifdef S_TIMEVAL
9740         struct timeval bar;
9741 #endif
9742 #ifdef S_TIMEZONE
9743         struct timezone tzp;
9744 #endif
9745         if (foo.tm_sec == foo.tm_sec)
9746                 exit(0);
9747 #ifdef S_TIMEVAL
9748         if (bar.tv_sec == bar.tv_sec)
9749                 exit(0);
9750 #endif
9751         exit(1);
9752 }
9753 EOCP
9754         flags=''
9755         for s_timezone in '-DS_TIMEZONE' ''; do
9756         sysselect=''
9757         for s_timeval in '-DS_TIMEVAL' ''; do
9758         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9759         for i_time in '' '-DI_TIME'; do
9760         for i_systime in '-DI_SYSTIME' ''; do
9761                 case "$flags" in
9762                 '') $echo $n ".$c"
9763                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9764                         if eval $compile; then
9765                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9766                                 shift
9767                                 flags="$*"
9768                                 echo " "
9769                                 $echo $n "Succeeded with $flags$c"
9770                         fi
9771                         ;;
9772                 esac
9773         done
9774         done
9775         done
9776         done
9777         done
9778         timeincl=''
9779         echo " "
9780         case "$flags" in
9781         *SYSTIMEKERNEL*) i_systimek="$define"
9782                 timeincl=`./findhdr sys/time.h`
9783                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9784         *) i_systimek="$undef";;
9785         esac
9786         case "$flags" in
9787         *I_TIME*) i_time="$define"
9788                 timeincl=`./findhdr time.h`" $timeincl"
9789                 echo "We'll include <time.h>." >&4;;
9790         *) i_time="$undef";;
9791         esac
9792         case "$flags" in
9793         *I_SYSTIME*) i_systime="$define"
9794                 timeincl=`./findhdr sys/time.h`" $timeincl"
9795                 echo "We'll include <sys/time.h>." >&4;;
9796         *) i_systime="$undef";;
9797         esac
9798         $rm -f try.c try
9799 fi
9800 : see if struct tm knows about tm_zone
9801 case "$i_systime$i_time" in
9802 *$define*) 
9803         echo " "
9804         echo "Checking to see if your struct tm has tm_zone field..." >&4
9805         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9806         eval $hasfield
9807         ;;
9808 *)      val="$undef"
9809         set d_tm_tm_zone
9810         eval $setvar
9811         ;;
9812 esac
9813 case "$d_tm_tm_zone" in
9814 "$define")      echo "Yes, it does."   ;;
9815 *)              echo "No, it doesn't." ;;
9816 esac
9817 : see if struct tm knows about tm_gmtoff
9818 case "$i_systime$i_time" in
9819 *$define*) 
9820         echo " "
9821         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9822         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9823         eval $hasfield
9824         ;;
9825 *)      val="$undef"
9826         set d_tm_tm_gmtoff
9827         eval $setvar
9828         ;;
9829 esac
9830 case "$d_tm_tm_gmtoff" in
9831 "$define")      echo "Yes, it does."   ;;
9832 *)              echo "No, it doesn't." ;;
9833 esac
9834
9835 : see if asctime_r exists
9836 set asctime_r d_asctime_r
9837 eval $inlibc
9838 case "$d_asctime_r" in
9839 "$define")
9840         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9841         case "$d_asctime_r_proto:$usethreads" in
9842         ":define")      d_asctime_r_proto=define
9843                 set d_asctime_r_proto asctime_r $hdrs
9844                 eval $hasproto ;;
9845         *)      ;;
9846         esac
9847         case "$d_asctime_r_proto" in
9848         define)
9849         case "$asctime_r_proto" in
9850         ''|0) try='char* asctime_r(const struct tm*, char*);'
9851         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9852         esac
9853         case "$asctime_r_proto" in
9854         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9855         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9856         esac
9857         case "$asctime_r_proto" in
9858         ''|0) try='int asctime_r(const struct tm*, char*);'
9859         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9860         esac
9861         case "$asctime_r_proto" in
9862         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9863         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9864         esac
9865         case "$asctime_r_proto" in
9866         ''|0)   d_asctime_r=undef
9867                 asctime_r_proto=0
9868                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9869         * )     case "$asctime_r_proto" in
9870                 REENTRANT_PROTO*) ;;
9871                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9872                 esac
9873                 echo "Prototype: $try" ;;
9874         esac
9875         ;;
9876         *)      case "$usethreads" in
9877                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9878                 esac
9879                 d_asctime_r=undef
9880                 asctime_r_proto=0
9881                 ;;
9882         esac
9883         ;;
9884 *)      asctime_r_proto=0
9885         ;;
9886 esac
9887
9888 : see if atolf exists
9889 set atolf d_atolf
9890 eval $inlibc
9891
9892 : see if atoll exists
9893 set atoll d_atoll
9894 eval $inlibc
9895
9896 : Look for GCC-style attribute format
9897 case "$d_attribute_format" in
9898 '')
9899 echo " "
9900 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
9901 $cat >attrib.c <<'EOCP'
9902 #include <stdio.h>
9903 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
9904 EOCP
9905 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9906         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9907                 echo "Your C compiler doesn't support __attribute__((format))."
9908                 val="$undef"
9909         else
9910                 echo "Your C compiler supports __attribute__((format))."
9911                 val="$define"
9912         fi
9913 else
9914         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9915         val="$undef"
9916 fi
9917 ;;
9918 *) val="$d_attribute_format" ;;
9919 esac
9920 set d_attribute_format
9921 eval $setvar
9922 $rm -f attrib*
9923
9924 : Look for GCC-style attribute malloc
9925 case "$d_attribute_malloc" in
9926 '')
9927 echo " "
9928 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
9929 $cat >attrib.c <<'EOCP'
9930 #include <stdio.h>
9931 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
9932 EOCP
9933 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9934         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9935                 echo "Your C compiler doesn't support __attribute__((malloc))."
9936                 val="$undef"
9937         else
9938                 echo "Your C compiler supports __attribute__((malloc))."
9939                 val="$define"
9940         fi
9941 else
9942         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9943         val="$undef"
9944 fi
9945 ;;
9946 *) val="$d_attribute_malloc" ;;
9947 esac
9948 set d_attribute_malloc
9949 eval $setvar
9950 $rm -f attrib*
9951
9952 : Look for GCC-style attribute nonnull
9953 case "$d_attribute_nonnull" in
9954 '')
9955 echo " "
9956 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
9957 $cat >attrib.c <<'EOCP'
9958 #include <stdio.h>
9959 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
9960 EOCP
9961 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9962         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9963                 echo "Your C compiler doesn't support __attribute__((nonnull))."
9964                 val="$undef"
9965         else
9966                 echo "Your C compiler supports __attribute__((nonnull))."
9967                 val="$define"
9968         fi
9969 else
9970         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9971         val="$undef"
9972 fi
9973 ;;
9974 *) val="$d_attribute_nonnull" ;;
9975 esac
9976 set d_attribute_nonnull
9977 eval $setvar
9978 $rm -f attrib*
9979
9980 : Look for GCC-style attribute noreturn
9981 case "$d_attribute_noreturn" in
9982 '')
9983 echo " "
9984 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
9985 $cat >attrib.c <<'EOCP'
9986 #include <stdio.h>
9987 void fall_over_dead( void ) __attribute__((noreturn));
9988 EOCP
9989 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9990         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9991                 echo "Your C compiler doesn't support __attribute__((noreturn))."
9992                 val="$undef"
9993         else
9994                 echo "Your C compiler supports __attribute__((noreturn))."
9995                 val="$define"
9996         fi
9997 else
9998         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9999         val="$undef"
10000 fi
10001 ;;
10002 *) val="$d_attribute_noreturn" ;;
10003 esac
10004 set d_attribute_noreturn
10005 eval $setvar
10006 $rm -f attrib*
10007
10008 : Look for GCC-style attribute pure
10009 case "$d_attribute_pure" in
10010 '')
10011 echo " "
10012 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10013 $cat >attrib.c <<'EOCP'
10014 #include <stdio.h>
10015 int square( int n ) __attribute__((pure));
10016 EOCP
10017 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10018         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10019                 echo "Your C compiler doesn't support __attribute__((pure))."
10020                 val="$undef"
10021         else
10022                 echo "Your C compiler supports __attribute__((pure))."
10023                 val="$define"
10024         fi
10025 else
10026         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10027         val="$undef"
10028 fi
10029 ;;
10030 *) val="$d_attribute_pure" ;;
10031 esac
10032 set d_attribute_pure
10033 eval $setvar
10034 $rm -f attrib*
10035
10036 : Look for GCC-style attribute unused
10037 case "$d_attribute_unused" in
10038 '')
10039 echo " "
10040 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10041 $cat >attrib.c <<'EOCP'
10042 #include <stdio.h>
10043 int do_something( int dummy __attribute__((unused)), int n );
10044 EOCP
10045 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10046         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10047                 echo "Your C compiler doesn't support __attribute__((unused))."
10048                 val="$undef"
10049         else
10050                 echo "Your C compiler supports __attribute__((unused))."
10051                 val="$define"
10052         fi
10053 else
10054         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10055         val="$undef"
10056 fi
10057 ;;
10058 *) val="$d_attribute_unused" ;;
10059 esac
10060 set d_attribute_unused
10061 eval $setvar
10062 $rm -f attrib*
10063
10064 : Look for GCC-style attribute warn_unused_result
10065 case "$d_attribute_warn_unused_result" in
10066 '')
10067 echo " "
10068 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10069 $cat >attrib.c <<'EOCP'
10070 #include <stdio.h>
10071 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10072 EOCP
10073 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10074         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10075                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10076                 val="$undef"
10077         else
10078                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10079                 val="$define"
10080         fi
10081 else
10082         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10083         val="$undef"
10084 fi
10085 ;;
10086 *) val="$d_attribute_warn_unused_result" ;;
10087 esac
10088 set d_attribute_warn_unused_result
10089 eval $setvar
10090 $rm -f attrib*
10091
10092 : see if bcmp exists
10093 set bcmp d_bcmp
10094 eval $inlibc
10095
10096 : see if bcopy exists
10097 set bcopy d_bcopy
10098 eval $inlibc
10099
10100 : see if this is a unistd.h system
10101 set unistd.h i_unistd
10102 eval $inhdr
10103
10104 : see if getpgrp exists
10105 set getpgrp d_getpgrp
10106 eval $inlibc
10107
10108 case "$d_getpgrp" in
10109 "$define")
10110         echo " "
10111         echo "Checking to see which flavor of getpgrp is in use..."
10112         $cat >try.c <<EOP
10113 #$i_unistd I_UNISTD
10114 #include <sys/types.h>
10115 #ifdef I_UNISTD
10116 #  include <unistd.h>
10117 #endif
10118 #$i_stdlib I_STDLIB
10119 #ifdef I_STDLIB
10120 #include <stdlib.h>
10121 #endif
10122 int main()
10123 {
10124         if (getuid() == 0) {
10125                 printf("(I see you are running Configure as super-user...)\n");
10126                 setuid(1);
10127         }
10128 #ifdef TRY_BSD_PGRP
10129         if (getpgrp(1) == 0)
10130                 exit(0);
10131 #else
10132         if (getpgrp() > 0)
10133                 exit(0);
10134 #endif
10135         exit(1);
10136 }
10137 EOP
10138         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10139                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10140                 val="$define"
10141         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10142                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10143                 val="$undef"
10144         else
10145                 echo "I can't seem to compile and run the test program."
10146                 if ./usg; then
10147                         xxx="a USG one, i.e. you use getpgrp()."
10148                 else
10149                         # SVR4 systems can appear rather BSD-ish.
10150                         case "$i_unistd" in
10151                         $undef)
10152                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10153                                 val="$define"
10154                                 ;;
10155                         $define)
10156                                 xxx="probably a USG one, i.e. you use getpgrp()."
10157                                 val="$undef"
10158                                 ;;
10159                         esac
10160                 fi
10161                 echo "Assuming your getpgrp is $xxx" >&4
10162         fi
10163         ;;
10164 *) val="$undef";;
10165 esac
10166 set d_bsdgetpgrp
10167 eval $setvar
10168 $rm -f try try.*
10169
10170 : see if setpgrp exists
10171 set setpgrp d_setpgrp
10172 eval $inlibc
10173
10174 case "$d_setpgrp" in
10175 "$define")
10176         echo " "
10177         echo "Checking to see which flavor of setpgrp is in use..."
10178         $cat >try.c <<EOP
10179 #$i_unistd I_UNISTD
10180 #include <sys/types.h>
10181 #ifdef I_UNISTD
10182 #  include <unistd.h>
10183 #endif
10184 #$i_stdlib I_STDLIB
10185 #ifdef I_STDLIB
10186 #include <stdlib.h>
10187 #endif
10188 int main()
10189 {
10190         if (getuid() == 0) {
10191                 printf("(I see you are running Configure as super-user...)\n");
10192                 setuid(1);
10193         }
10194 #ifdef TRY_BSD_PGRP
10195         if (-1 == setpgrp(1, 1))
10196                 exit(0);
10197 #else
10198         if (setpgrp() != -1)
10199                 exit(0);
10200 #endif
10201         exit(1);
10202 }
10203 EOP
10204         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10205                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10206                 val="$define"
10207         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10208                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10209                 val="$undef"
10210         else
10211                 echo "(I can't seem to compile and run the test program.)"
10212                 if ./usg; then
10213                         xxx="a USG one, i.e. you use setpgrp()."
10214                 else
10215                         # SVR4 systems can appear rather BSD-ish.
10216                         case "$i_unistd" in
10217                         $undef)
10218                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10219                                 val="$define"
10220                                 ;;
10221                         $define)
10222                                 xxx="probably a USG one, i.e. you use setpgrp()."
10223                                 val="$undef"
10224                                 ;;
10225                         esac
10226                 fi
10227                 echo "Assuming your setpgrp is $xxx" >&4
10228         fi
10229         ;;
10230 *) val="$undef";;
10231 esac
10232 set d_bsdsetpgrp
10233 eval $setvar
10234 $rm -f try try.*
10235 : see if bzero exists
10236 set bzero d_bzero
10237 eval $inlibc
10238
10239 : see if signal is declared as pointer to function returning int or void
10240 echo " "
10241 xxx=`./findhdr signal.h`
10242 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10243 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10244         echo "You have int (*signal())() instead of void." >&4
10245         val="$undef"
10246 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10247         echo "You have void (*signal())()." >&4
10248         val="$define"
10249 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10250         echo "You have int (*signal())() instead of void." >&4
10251         val="$undef"
10252 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10253         echo "You have void (*signal())()." >&4
10254         val="$define"
10255 else
10256         case "$d_voidsig" in
10257         '')
10258         echo "I can't determine whether signal handler returns void or int..." >&4
10259                 dflt=void
10260                 rp="What type does your signal handler return?"
10261                 . ./myread
10262                 case "$ans" in
10263                 v*) val="$define";;
10264                 *) val="$undef";;
10265                 esac;;
10266         "$define")
10267                 echo "As you already told me, signal handler returns void." >&4
10268                 val="$define"
10269                 ;;
10270         *)      echo "As you already told me, signal handler returns int." >&4
10271                 val="$undef"
10272                 ;;
10273         esac
10274 fi
10275 set d_voidsig
10276 eval $setvar
10277 case "$d_voidsig" in
10278 "$define") signal_t="void";;
10279 *) signal_t="int";;
10280 esac
10281 $rm -f $$.tmp
10282
10283 : check for ability to cast large floats to 32-bit ints.
10284 echo " "
10285 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10286 if $test "$intsize" -ge 4; then
10287         xxx=int
10288 else
10289         xxx=long
10290 fi
10291 $cat >try.c <<EOCP
10292 #include <stdio.h>
10293 #$i_stdlib I_STDLIB
10294 #ifdef I_STDLIB
10295 #include <stdlib.h>
10296 #endif
10297 #include <sys/types.h>
10298 #include <signal.h>
10299 $signal_t blech(s) int s; { exit(3); }
10300 int main()
10301 {
10302         $xxx i32;
10303         double f, g;
10304         int result = 0;
10305         char str[16];
10306         signal(SIGFPE, blech);
10307
10308         /* Don't let compiler optimize the test away.  Store the number 
10309            in a writable string for gcc to pass to sscanf under HP/UX.
10310         */
10311         sprintf(str, "2147483647");
10312         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10313         g = 10 * f;
10314         i32  = ($xxx) g;
10315
10316         /* x86 processors will probably give 0x8000 0000, which is a
10317            sign change.  We don't want that.  We want to mimic SPARC
10318            behavior here, which is to preserve the sign and give
10319            back 0x7fff ffff.
10320         */
10321         if (i32 != ($xxx) f)
10322                 result |= 1;
10323         exit(result);
10324 }
10325 EOCP
10326 set try
10327 if eval $compile_ok; then
10328         $run ./try
10329         yyy=$?
10330 else
10331         echo "(I can't seem to compile the test program--assuming it can't)"
10332         yyy=1
10333 fi
10334 case "$yyy" in
10335 0)      val="$define"
10336         echo "Yup, it can."
10337         ;;
10338 *)      val="$undef"
10339         echo "Nope, it can't."
10340         ;;
10341 esac
10342 set d_casti32
10343 eval $setvar
10344 $rm -f try try.*
10345
10346 : check for ability to cast negative floats to unsigned
10347 echo " "
10348 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10349 $cat >try.c <<EOCP
10350 #include <stdio.h>
10351 #$i_stdlib I_STDLIB
10352 #ifdef I_STDLIB
10353 #include <stdlib.h>
10354 #endif
10355 #include <sys/types.h>
10356 #include <signal.h>
10357 $signal_t blech(s) int s; { exit(7); }
10358 $signal_t blech_in_list(s) int s; { exit(4); }
10359 unsigned long dummy_long(p) unsigned long p; { return p; }
10360 unsigned int dummy_int(p) unsigned int p; { return p; }
10361 unsigned short dummy_short(p) unsigned short p; { return p; }
10362 int main()
10363 {
10364         double f;
10365         unsigned long along;
10366         unsigned int aint;
10367         unsigned short ashort;
10368         int result = 0;
10369         char str[16];
10370         
10371         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10372            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10373            optimized the whole file away
10374         */
10375         /* Store the number in a writable string for gcc to pass to 
10376            sscanf under HP/UX.
10377         */
10378         sprintf(str, "-123");
10379         sscanf(str, "%lf", &f);  /* f = -123.; */
10380
10381         signal(SIGFPE, blech);
10382         along = (unsigned long)f;
10383         aint = (unsigned int)f;
10384         ashort = (unsigned short)f;
10385         if (along != (unsigned long)-123)
10386                 result |= 1;
10387         if (aint != (unsigned int)-123)
10388                 result |= 1;
10389         if (ashort != (unsigned short)-123)
10390                 result |= 1;
10391         sprintf(str, "1073741824.");
10392         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10393         f = f + f;
10394         along = 0;
10395         along = (unsigned long)f;
10396         if (along != 0x80000000)
10397                 result |= 2;
10398         f -= 1.;
10399         along = 0;
10400         along = (unsigned long)f;
10401         if (along != 0x7fffffff)
10402                 result |= 1;
10403         f += 2.;
10404         along = 0;
10405         along = (unsigned long)f;
10406         if (along != 0x80000001)
10407                 result |= 2;
10408         if (result)
10409                 exit(result);
10410         signal(SIGFPE, blech_in_list);
10411         sprintf(str, "123.");
10412         sscanf(str, "%lf", &f);  /* f = 123.; */
10413         along = dummy_long((unsigned long)f);
10414         aint = dummy_int((unsigned int)f);
10415         ashort = dummy_short((unsigned short)f);
10416         if (along != (unsigned long)123)
10417                 result |= 4;
10418         if (aint != (unsigned int)123)
10419                 result |= 4;
10420         if (ashort != (unsigned short)123)
10421                 result |= 4;
10422         exit(result);
10423
10424 }
10425 EOCP
10426 set try
10427 if eval $compile_ok; then
10428         $run ./try
10429         castflags=$?
10430 else
10431         echo "(I can't seem to compile the test program--assuming it can't)"
10432         castflags=7
10433 fi
10434 case "$castflags" in
10435 0)      val="$define"
10436         echo "Yup, it can."
10437         ;;
10438 *)      val="$undef"
10439         echo "Nope, it can't."
10440         ;;
10441 esac
10442 set d_castneg
10443 eval $setvar
10444 $rm -f try.*
10445
10446 : see if vprintf exists
10447 echo " "
10448 if set vprintf val -f d_vprintf; eval $csym; $val; then
10449         echo 'vprintf() found.' >&4
10450         val="$define"
10451         $cat >try.c <<EOF
10452 #include <varargs.h>
10453 #$i_stdlib I_STDLIB
10454 #ifdef I_STDLIB
10455 #include <stdlib.h>
10456 #endif
10457
10458 int main() { xxx("foo"); }
10459
10460 xxx(va_alist)
10461 va_dcl
10462 {
10463         va_list args;
10464         char buf[10];
10465
10466         va_start(args);
10467         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10468 }
10469 EOF
10470         set try
10471         if eval $compile && $run ./try; then
10472                 echo "Your vsprintf() returns (int)." >&4
10473                 val2="$undef"
10474         else
10475                 echo "Your vsprintf() returns (char*)." >&4
10476                 val2="$define"
10477         fi
10478 else
10479         echo 'vprintf() NOT found.' >&4
10480                 val="$undef"
10481                 val2="$undef"
10482 fi
10483 $rm -f try try.*
10484 set d_vprintf
10485 eval $setvar
10486 val=$val2
10487 set d_charvspr
10488 eval $setvar
10489
10490 : see if chown exists
10491 set chown d_chown
10492 eval $inlibc
10493
10494 : see if chroot exists
10495 set chroot d_chroot
10496 eval $inlibc
10497
10498 : see if chsize exists
10499 set chsize d_chsize
10500 eval $inlibc
10501
10502 : see if class exists
10503 set class d_class
10504 eval $inlibc
10505
10506 hasstruct='varname=$1; struct=$2; shift; shift;
10507 while $test $# -ge 2; do
10508         case "$1" in
10509         $define) echo "#include <$2>";;
10510         esac ;
10511     shift 2;
10512 done > try.c;
10513 echo "int main () { struct $struct foo; }" >> try.c;
10514 set try;
10515 if eval $compile; then
10516         val="$define";
10517 else
10518         val="$undef";
10519 fi;
10520 set $varname;
10521 eval $setvar;
10522 $rm -f try.c try.o'
10523
10524 socketlib=''
10525 sockethdr=''
10526 : see whether socket exists
10527 echo " "
10528 $echo $n "Hmm... $c" >&4
10529 if set socket val -f d_socket; eval $csym; $val; then
10530         echo "Looks like you have Berkeley networking support." >&4
10531         d_socket="$define"
10532         if set setsockopt val -f; eval $csym; $val; then
10533                 d_oldsock="$undef"
10534         else
10535                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10536                 d_oldsock="$define"
10537         fi
10538 else
10539         if $contains socklib libc.list >/dev/null 2>&1; then
10540                 echo "Looks like you have Berkeley networking support." >&4
10541                 d_socket="$define"
10542                 : we will have to assume that it supports the 4.2 BSD interface
10543                 d_oldsock="$undef"
10544         else
10545                 echo "You don't have Berkeley networking in libc$_a..." >&4
10546                 if test "X$d_socket" = "X$define"; then
10547                    echo "...but you seem to believe that you have sockets." >&4
10548                 else
10549                         for net in net socket
10550                         do
10551                                 if test -f /usr/lib/lib$net$_a; then
10552                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10553                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10554                                         if $contains socket libc.list >/dev/null 2>&1; then
10555                                                 d_socket="$define"
10556                                                 socketlib="-l$net"
10557                                                 case "$net" in
10558                                                 net)
10559                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10560                                                         sockethdr="-I/usr/netinclude"
10561                                                         ;;
10562                                                 esac
10563                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
10564                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10565                                                         d_oldsock="$undef"
10566                                                 else
10567                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10568                                                         d_oldsock="$define"
10569                                                 fi
10570                                                 break
10571                                         fi
10572                                 fi
10573                         done
10574                         if test "X$d_socket" != "X$define"; then
10575                            echo "or anywhere else I see." >&4
10576                            d_socket="$undef"
10577                            d_oldsock="$undef"
10578                         fi
10579                 fi
10580         fi
10581 fi
10582
10583 : see if socketpair exists
10584 set socketpair d_sockpair
10585 eval $inlibc
10586
10587
10588 echo " "
10589 echo "Checking the availability of certain socket constants..." >&4
10590 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10591         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10592         $cat >try.c <<EOF
10593 #include <sys/types.h>
10594 #include <sys/socket.h>
10595 int main() {
10596     int i = $ENUM;
10597 }
10598 EOF
10599         val="$undef"
10600         set try; if eval $compile; then
10601                 val="$define"
10602         fi
10603         set d_${enum}; eval $setvar
10604         $rm -f try.c try
10605 done
10606
10607 : see if this is a sys/uio.h system
10608 set sys/uio.h i_sysuio
10609 eval $inhdr
10610
10611
10612 echo " "
10613 echo "Checking to see if your system supports struct cmsghdr..." >&4
10614 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10615 eval $hasstruct
10616 case "$d_cmsghdr_s" in
10617 "$define")      echo "Yes, it does."   ;;
10618 *)              echo "No, it doesn't." ;;
10619 esac
10620
10621
10622 : check for const keyword
10623 echo " "
10624 echo 'Checking to see if your C compiler knows about "const"...' >&4
10625 $cat >const.c <<'EOCP'
10626 typedef struct spug { int drokk; } spug;
10627 int main()
10628 {
10629         const char *foo;
10630         const spug y;
10631 }
10632 EOCP
10633 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10634         val="$define"
10635         echo "Yup, it does."
10636 else
10637         val="$undef"
10638         echo "Nope, it doesn't."
10639 fi
10640 set d_const
10641 eval $setvar
10642
10643 : see if copysignl exists
10644 set copysignl d_copysignl
10645 eval $inlibc
10646
10647 : see if crypt exists
10648 echo " "
10649 set crypt d_crypt
10650 eval $inlibc
10651 case "$d_crypt" in
10652 $define) cryptlib='' ;;
10653 *)      if set crypt val -f d_crypt; eval $csym; $val; then
10654                 echo 'crypt() found.' >&4
10655                 val="$define"
10656                 cryptlib=''
10657         else
10658                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10659                 if $test -z "$cryptlib"; then
10660                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10661                 else
10662                         cryptlib=-lcrypt
10663                 fi
10664                 if $test -z "$cryptlib"; then
10665                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10666                 else
10667                         cryptlib=-lcrypt
10668                 fi
10669                 if $test -z "$cryptlib"; then
10670                         cryptlib=`./loc libcrypt$_a "" $libpth`
10671                 else
10672                         cryptlib=-lcrypt
10673                 fi
10674                 if $test -z "$cryptlib"; then
10675                         echo 'crypt() NOT found.' >&4
10676                         val="$undef"
10677                 else
10678                         val="$define"
10679                 fi
10680         fi
10681         set d_crypt
10682         eval $setvar
10683         ;;
10684 esac
10685
10686 : see if this is a crypt.h system
10687 set crypt.h i_crypt
10688 eval $inhdr
10689
10690 : see if crypt_r exists
10691 set crypt_r d_crypt_r
10692 eval $inlibc
10693 case "$d_crypt_r" in
10694 "$define")
10695         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
10696         case "$d_crypt_r_proto:$usethreads" in
10697         ":define")      d_crypt_r_proto=define
10698                 set d_crypt_r_proto crypt_r $hdrs
10699                 eval $hasproto ;;
10700         *)      ;;
10701         esac
10702         case "$d_crypt_r_proto" in
10703         define)
10704         case "$crypt_r_proto" in
10705         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10706         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10707         esac
10708         case "$crypt_r_proto" in
10709         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10710         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10711         esac
10712         case "$crypt_r_proto" in
10713         ''|0)   d_crypt_r=undef
10714                 crypt_r_proto=0
10715                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10716         * )     case "$crypt_r_proto" in
10717                 REENTRANT_PROTO*) ;;
10718                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10719                 esac
10720                 echo "Prototype: $try" ;;
10721         esac
10722         ;;
10723         *)      case "$usethreads" in
10724                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10725                 esac
10726                 d_crypt_r=undef
10727                 crypt_r_proto=0
10728                 ;;
10729         esac
10730         ;;
10731 *)      crypt_r_proto=0
10732         ;;
10733 esac
10734
10735 : get csh whereabouts
10736 case "$csh" in
10737 'csh') val="$undef" ;;
10738 *) val="$define" ;;
10739 esac
10740 set d_csh
10741 eval $setvar
10742 : Respect a hint or command line value for full_csh.
10743 case "$full_csh" in
10744 '') full_csh=$csh ;;
10745 esac
10746
10747 : see if ctermid_r exists
10748 set ctermid_r d_ctermid_r
10749 eval $inlibc
10750 case "$d_ctermid_r" in
10751 "$define")
10752         hdrs="$i_systypes sys/types.h define stdio.h "
10753         case "$d_ctermid_r_proto:$usethreads" in
10754         ":define")      d_ctermid_r_proto=define
10755                 set d_ctermid_r_proto ctermid_r $hdrs
10756                 eval $hasproto ;;
10757         *)      ;;
10758         esac
10759         case "$d_ctermid_r_proto" in
10760         define)
10761         case "$ctermid_r_proto" in
10762         ''|0) try='char* ctermid_r(char*);'
10763         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10764         esac
10765         case "$ctermid_r_proto" in
10766         ''|0)   d_ctermid_r=undef
10767                 ctermid_r_proto=0
10768                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10769         * )     case "$ctermid_r_proto" in
10770                 REENTRANT_PROTO*) ;;
10771                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10772                 esac
10773                 echo "Prototype: $try" ;;
10774         esac
10775         ;;
10776         *)      case "$usethreads" in
10777                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10778                 esac
10779                 d_ctermid_r=undef
10780                 ctermid_r_proto=0
10781                 ;;
10782         esac
10783         ;;
10784 *)      ctermid_r_proto=0
10785         ;;
10786 esac
10787
10788 : see if ctime_r exists
10789 set ctime_r d_ctime_r
10790 eval $inlibc
10791 case "$d_ctime_r" in
10792 "$define")
10793         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10794         case "$d_ctime_r_proto:$usethreads" in
10795         ":define")      d_ctime_r_proto=define
10796                 set d_ctime_r_proto ctime_r $hdrs
10797                 eval $hasproto ;;
10798         *)      ;;
10799         esac
10800         case "$d_ctime_r_proto" in
10801         define)
10802         case "$ctime_r_proto" in
10803         ''|0) try='char* ctime_r(const time_t*, char*);'
10804         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10805         esac
10806         case "$ctime_r_proto" in
10807         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10808         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10809         esac
10810         case "$ctime_r_proto" in
10811         ''|0) try='int ctime_r(const time_t*, char*);'
10812         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10813         esac
10814         case "$ctime_r_proto" in
10815         ''|0) try='int ctime_r(const time_t*, char*, int);'
10816         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10817         esac
10818         case "$ctime_r_proto" in
10819         ''|0)   d_ctime_r=undef
10820                 ctime_r_proto=0
10821                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10822         * )     case "$ctime_r_proto" in
10823                 REENTRANT_PROTO*) ;;
10824                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10825                 esac
10826                 echo "Prototype: $try" ;;
10827         esac
10828         ;;
10829         *)      case "$usethreads" in
10830                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10831                 esac
10832                 d_ctime_r=undef
10833                 ctime_r_proto=0
10834                 ;;
10835         esac
10836         ;;
10837 *)      ctime_r_proto=0
10838         ;;
10839 esac
10840
10841 : see if cuserid exists
10842 set cuserid d_cuserid
10843 eval $inlibc
10844
10845 : see if this is a limits.h system
10846 set limits.h i_limits
10847 eval $inhdr
10848
10849 : see if this is a float.h system
10850 set float.h i_float
10851 eval $inhdr
10852
10853 : See if number of significant digits in a double precision number is known
10854 echo " "
10855 $cat >dbl_dig.c <<EOM
10856 #$i_limits I_LIMITS
10857 #$i_float I_FLOAT
10858 #ifdef I_LIMITS
10859 #include <limits.h>
10860 #endif
10861 #ifdef I_FLOAT
10862 #include <float.h>
10863 #endif
10864 #ifdef DBL_DIG
10865 printf("Contains DBL_DIG");
10866 #endif
10867 EOM
10868 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10869 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10870         echo "DBL_DIG found." >&4
10871         val="$define"
10872 else
10873         echo "DBL_DIG NOT found." >&4
10874         val="$undef"
10875 fi
10876 $rm -f dbl_dig.?
10877 set d_dbl_dig
10878 eval $setvar
10879
10880 : see if dbm.h is available
10881 : see if dbmclose exists
10882 set dbmclose d_dbmclose
10883 eval $inlibc
10884
10885 case "$d_dbmclose" in
10886 $define)
10887         set dbm.h i_dbm
10888         eval $inhdr
10889         case "$i_dbm" in
10890         $define)
10891                 val="$undef"
10892                 set i_rpcsvcdbm
10893                 eval $setvar
10894                 ;;
10895         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10896                 eval $inhdr
10897                 ;;
10898         esac
10899         ;;
10900 *)      echo "We won't be including <dbm.h>"
10901         val="$undef"
10902         set i_dbm
10903         eval $setvar
10904         val="$undef"
10905         set i_rpcsvcdbm
10906         eval $setvar
10907         ;;
10908 esac
10909
10910 : see if prototype for dbminit is available
10911 echo " "
10912 set d_dbminitproto dbminit $i_dbm dbm.h
10913 eval $hasproto
10914
10915 : see if difftime exists
10916 set difftime d_difftime
10917 eval $inlibc
10918
10919 : see if this is a dirent system
10920 echo " "
10921 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10922         val="$define"
10923         echo "<dirent.h> found." >&4
10924 else
10925         val="$undef"
10926         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10927                 echo "<sys/dir.h> found." >&4
10928                 echo " "
10929         else
10930                 xinc=`./findhdr sys/ndir.h`
10931         fi
10932         echo "<dirent.h> NOT found." >&4
10933 fi
10934 set i_dirent
10935 eval $setvar
10936
10937 : Look for type of directory structure.
10938 echo " "
10939 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10940
10941 case "$direntrytype" in
10942 ''|' ')
10943         case "$i_dirent" in
10944         $define) guess1='struct dirent' ;;
10945         *) guess1='struct direct'  ;;
10946         esac
10947         ;;
10948 *)      guess1="$direntrytype"
10949         ;;
10950 esac
10951
10952 case "$guess1" in
10953 'struct dirent') guess2='struct direct' ;;
10954 *) guess2='struct dirent' ;;
10955 esac
10956                 
10957 if $contains "$guess1" try.c >/dev/null 2>&1; then
10958         direntrytype="$guess1"
10959         echo "Your directory entries are $direntrytype." >&4
10960 elif $contains "$guess2" try.c >/dev/null 2>&1; then
10961         direntrytype="$guess2"
10962         echo "Your directory entries seem to be $direntrytype." >&4
10963 else
10964         echo "I don't recognize your system's directory entries." >&4
10965         rp="What type is used for directory entries on this system?"
10966         dflt="$guess1"
10967         . ./myread
10968         direntrytype="$ans"
10969 fi
10970 $rm -f try.c
10971
10972
10973 : see if the directory entry stores field length
10974 echo " "
10975 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10976 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10977         echo "Good, your directory entry keeps length information in d_namlen." >&4
10978         val="$define"
10979 else
10980         echo "Your directory entry does not know about the d_namlen field." >&4
10981         val="$undef"
10982 fi
10983 set d_dirnamlen
10984 eval $setvar
10985 $rm -f try.c
10986
10987 : see if this is an sysdir system
10988 set sys/dir.h i_sysdir
10989 eval $inhdr
10990
10991 : see if this is an sysndir system
10992 set sys/ndir.h i_sysndir
10993 eval $inhdr
10994
10995 : Look for dirfd
10996 echo " "
10997 $cat >dirfd.c <<EOM
10998 #include <stdio.h>
10999 #$i_stdlib I_STDLIB
11000 #ifdef I_STDLIB
11001 #include <stdlib.h>
11002 #endif
11003 #$i_dirent I_DIRENT             /**/
11004 #$i_sysdir I_SYS_DIR            /**/
11005 #$i_sysndir I_SYS_NDIR          /**/
11006 #$i_systypes I_SYS_TYPES        /**/
11007 #if defined(I_SYS_TYPES)
11008 #include <sys/types.h>
11009 #endif
11010 #if defined(I_DIRENT)
11011 #include <dirent.h>
11012 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11013 #include <sys/dir.h>
11014 #endif
11015 #else
11016 #ifdef I_SYS_NDIR
11017 #include <sys/ndir.h>
11018 #else
11019 #ifdef I_SYS_DIR
11020 #ifdef hp9000s500
11021 #include <ndir.h>       /* may be wrong in the future */
11022 #else
11023 #include <sys/dir.h>
11024 #endif
11025 #endif
11026 #endif
11027 #endif 
11028 int main() {
11029         DIR *dirp = opendir(".");
11030         if (dirfd(dirp) >= 0)
11031                 exit(0);
11032         else
11033                 exit(1);
11034 }
11035 EOM
11036 val=$undef
11037 set dirfd
11038 if eval $compile; then
11039         val="$define"
11040 fi
11041 case "$val" in
11042 $define)        echo "dirfd() found." >&4       ;;
11043 *)              echo "dirfd() NOT found." >&4   ;;
11044 esac
11045 set d_dirfd
11046 eval $setvar
11047 $rm -f dirfd*
11048
11049 : see if dlerror exists
11050 xxx_runnm="$runnm"
11051 runnm=false
11052 set dlerror d_dlerror
11053 eval $inlibc
11054 runnm="$xxx_runnm"
11055
11056 : see if dlfcn is available
11057 set dlfcn.h i_dlfcn
11058 eval $inhdr
11059
11060 case "$usedl" in
11061 $define|y|true)
11062         $cat << EOM
11063
11064 On a few systems, the dynamically loaded modules that perl generates and uses
11065 will need a different extension than shared libs. The default will probably
11066 be appropriate.
11067
11068 EOM
11069         case "$dlext" in
11070         '')     dflt="$so" ;;
11071         *)      dflt="$dlext" ;;
11072         esac
11073         rp='What is the extension of dynamically loaded modules'
11074         . ./myread
11075         dlext="$ans"
11076         ;;
11077 *)
11078         dlext="none"
11079         ;;
11080 esac
11081
11082 : Check if dlsym need a leading underscore
11083 echo " "
11084 val="$undef"
11085
11086 case "$dlsrc" in
11087 dl_dlopen.xs)
11088         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11089         $cat >dyna.c <<'EOM'
11090 fred () { }
11091 EOM
11092
11093 $cat >fred.c<<EOM
11094
11095 #include <stdio.h>
11096 #$i_stdlib I_STDLIB
11097 #ifdef I_STDLIB
11098 #include <stdlib.h>
11099 #endif
11100 #$i_dlfcn I_DLFCN
11101 #ifdef I_DLFCN
11102 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11103 #else
11104 #include <sys/types.h>
11105 #include <nlist.h>
11106 #include <link.h>
11107 #endif
11108
11109 extern int fred() ;
11110
11111 int main()
11112 {
11113     void * handle ;
11114     void * symbol ;
11115 #ifndef RTLD_LAZY
11116     int mode = 1 ;
11117 #else
11118     int mode = RTLD_LAZY ;
11119 #endif
11120     handle = dlopen("./dyna.$dlext", mode) ;
11121     if (handle == NULL) {
11122         printf ("1\n") ;
11123         fflush (stdout) ;
11124         exit(0);
11125     }
11126     symbol = dlsym(handle, "fred") ;
11127     if (symbol == NULL) {
11128         /* try putting a leading underscore */
11129         symbol = dlsym(handle, "_fred") ;
11130         if (symbol == NULL) {
11131             printf ("2\n") ;
11132             fflush (stdout) ;
11133             exit(0);
11134         }
11135         printf ("3\n") ;
11136     }
11137     else
11138         printf ("4\n") ;
11139     fflush (stdout) ;
11140     exit(0);
11141 }
11142 EOM
11143         : Call the object file tmp-dyna.o in case dlext=o.
11144         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
11145                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
11146                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
11147                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11148                 xxx=`$run ./fred`
11149                 case $xxx in
11150                 1)      echo "Test program failed using dlopen." >&4
11151                         echo "Perhaps you should not use dynamic loading." >&4;;
11152                 2)      echo "Test program failed using dlsym." >&4
11153                         echo "Perhaps you should not use dynamic loading." >&4;;
11154                 3)      echo "dlsym needs a leading underscore" >&4
11155                         val="$define" ;;
11156                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11157                 esac
11158         else
11159                 echo "I can't compile and run the test program." >&4
11160                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11161         fi
11162         ;;
11163 esac
11164                 
11165 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11166
11167 set d_dlsymun
11168 eval $setvar
11169
11170 : see if drand48_r exists
11171 set drand48_r d_drand48_r
11172 eval $inlibc
11173 case "$d_drand48_r" in
11174 "$define")
11175         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11176         case "$d_drand48_r_proto:$usethreads" in
11177         ":define")      d_drand48_r_proto=define
11178                 set d_drand48_r_proto drand48_r $hdrs
11179                 eval $hasproto ;;
11180         *)      ;;
11181         esac
11182         case "$d_drand48_r_proto" in
11183         define)
11184         case "$drand48_r_proto" in
11185         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11186         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11187         esac
11188         case "$drand48_r_proto" in
11189         ''|0)   d_drand48_r=undef
11190                 drand48_r_proto=0
11191                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11192         * )     case "$drand48_r_proto" in
11193                 REENTRANT_PROTO*) ;;
11194                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11195                 esac
11196                 echo "Prototype: $try" ;;
11197         esac
11198         ;;
11199         *)      case "$usethreads" in
11200                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11201                 esac
11202                 d_drand48_r=undef
11203                 drand48_r_proto=0
11204                 ;;
11205         esac
11206         ;;
11207 *)      drand48_r_proto=0
11208         ;;
11209 esac
11210
11211 : see if prototype for drand48 is available
11212 echo " "
11213 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11214 eval $hasproto
11215
11216 : see if dup2 exists
11217 set dup2 d_dup2
11218 eval $inlibc
11219
11220 : see if eaccess exists
11221 set eaccess d_eaccess
11222 eval $inlibc
11223
11224 : see if endgrent exists
11225 set endgrent d_endgrent
11226 eval $inlibc
11227
11228 : see if this is an grp system
11229 set grp.h i_grp
11230 eval $inhdr
11231
11232 case "$i_grp" in
11233 $define)
11234         xxx=`./findhdr grp.h`
11235         $cppstdin $cppflags $cppminus < $xxx >$$.h
11236
11237         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11238                 val="$define"
11239         else
11240                 val="$undef"
11241         fi
11242         set d_grpasswd
11243         eval $setvar
11244
11245         $rm -f $$.h
11246         ;;
11247 *)
11248         val="$undef";
11249         set d_grpasswd; eval $setvar
11250         ;;
11251 esac
11252
11253 : see if endgrent_r exists
11254 set endgrent_r d_endgrent_r
11255 eval $inlibc
11256 case "$d_endgrent_r" in
11257 "$define")
11258         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11259         case "$d_endgrent_r_proto:$usethreads" in
11260         ":define")      d_endgrent_r_proto=define
11261                 set d_endgrent_r_proto endgrent_r $hdrs
11262                 eval $hasproto ;;
11263         *)      ;;
11264         esac
11265         case "$d_endgrent_r_proto" in
11266         define)
11267         case "$endgrent_r_proto" in
11268         ''|0) try='int endgrent_r(FILE**);'
11269         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11270         esac
11271         case "$endgrent_r_proto" in
11272         ''|0) try='void endgrent_r(FILE**);'
11273         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11274         esac
11275         case "$endgrent_r_proto" in
11276         ''|0)   d_endgrent_r=undef
11277                 endgrent_r_proto=0
11278                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11279         * )     case "$endgrent_r_proto" in
11280                 REENTRANT_PROTO*) ;;
11281                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11282                 esac
11283                 echo "Prototype: $try" ;;
11284         esac
11285         ;;
11286         *)      case "$usethreads" in
11287                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11288                 esac
11289                 d_endgrent_r=undef
11290                 endgrent_r_proto=0
11291                 ;;
11292         esac
11293         ;;
11294 *)      endgrent_r_proto=0
11295         ;;
11296 esac
11297
11298 : see if endhostent exists
11299 set endhostent d_endhent
11300 eval $inlibc
11301
11302 : see if this is a netdb.h system
11303 set netdb.h i_netdb
11304 eval $inhdr
11305
11306 : see if endhostent_r exists
11307 set endhostent_r d_endhostent_r
11308 eval $inlibc
11309 case "$d_endhostent_r" in
11310 "$define")
11311         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11312         case "$d_endhostent_r_proto:$usethreads" in
11313         ":define")      d_endhostent_r_proto=define
11314                 set d_endhostent_r_proto endhostent_r $hdrs
11315                 eval $hasproto ;;
11316         *)      ;;
11317         esac
11318         case "$d_endhostent_r_proto" in
11319         define)
11320         case "$endhostent_r_proto" in
11321         ''|0) try='int endhostent_r(struct hostent_data*);'
11322         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11323         esac
11324         case "$endhostent_r_proto" in
11325         ''|0) try='void endhostent_r(struct hostent_data*);'
11326         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11327         esac
11328         case "$endhostent_r_proto" in
11329         ''|0)   d_endhostent_r=undef
11330                 endhostent_r_proto=0
11331                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11332         * )     case "$endhostent_r_proto" in
11333                 REENTRANT_PROTO*) ;;
11334                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11335                 esac
11336                 echo "Prototype: $try" ;;
11337         esac
11338         ;;
11339         *)      case "$usethreads" in
11340                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11341                 esac
11342                 d_endhostent_r=undef
11343                 endhostent_r_proto=0
11344                 ;;
11345         esac
11346         ;;
11347 *)      endhostent_r_proto=0
11348         ;;
11349 esac
11350
11351 : see if endnetent exists
11352 set endnetent d_endnent
11353 eval $inlibc
11354
11355 : see if endnetent_r exists
11356 set endnetent_r d_endnetent_r
11357 eval $inlibc
11358 case "$d_endnetent_r" in
11359 "$define")
11360         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11361         case "$d_endnetent_r_proto:$usethreads" in
11362         ":define")      d_endnetent_r_proto=define
11363                 set d_endnetent_r_proto endnetent_r $hdrs
11364                 eval $hasproto ;;
11365         *)      ;;
11366         esac
11367         case "$d_endnetent_r_proto" in
11368         define)
11369         case "$endnetent_r_proto" in
11370         ''|0) try='int endnetent_r(struct netent_data*);'
11371         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11372         esac
11373         case "$endnetent_r_proto" in
11374         ''|0) try='void endnetent_r(struct netent_data*);'
11375         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11376         esac
11377         case "$endnetent_r_proto" in
11378         ''|0)   d_endnetent_r=undef
11379                 endnetent_r_proto=0
11380                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11381         * )     case "$endnetent_r_proto" in
11382                 REENTRANT_PROTO*) ;;
11383                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11384                 esac
11385                 echo "Prototype: $try" ;;
11386         esac
11387         ;;
11388         *)      case "$usethreads" in
11389                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11390                 esac
11391                 d_endnetent_r=undef
11392                 endnetent_r_proto=0
11393                 ;;
11394         esac
11395         ;;
11396 *)      endnetent_r_proto=0
11397         ;;
11398 esac
11399
11400 : see if endprotoent exists
11401 set endprotoent d_endpent
11402 eval $inlibc
11403
11404 : see if endprotoent_r exists
11405 set endprotoent_r d_endprotoent_r
11406 eval $inlibc
11407 case "$d_endprotoent_r" in
11408 "$define")
11409         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11410         case "$d_endprotoent_r_proto:$usethreads" in
11411         ":define")      d_endprotoent_r_proto=define
11412                 set d_endprotoent_r_proto endprotoent_r $hdrs
11413                 eval $hasproto ;;
11414         *)      ;;
11415         esac
11416         case "$d_endprotoent_r_proto" in
11417         define)
11418         case "$endprotoent_r_proto" in
11419         ''|0) try='int endprotoent_r(struct protoent_data*);'
11420         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11421         esac
11422         case "$endprotoent_r_proto" in
11423         ''|0) try='void endprotoent_r(struct protoent_data*);'
11424         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11425         esac
11426         case "$endprotoent_r_proto" in
11427         ''|0)   d_endprotoent_r=undef
11428                 endprotoent_r_proto=0
11429                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11430         * )     case "$endprotoent_r_proto" in
11431                 REENTRANT_PROTO*) ;;
11432                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11433                 esac
11434                 echo "Prototype: $try" ;;
11435         esac
11436         ;;
11437         *)      case "$usethreads" in
11438                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11439                 esac
11440                 d_endprotoent_r=undef
11441                 endprotoent_r_proto=0
11442                 ;;
11443         esac
11444         ;;
11445 *)      endprotoent_r_proto=0
11446         ;;
11447 esac
11448
11449 : see if endpwent exists
11450 set endpwent d_endpwent
11451 eval $inlibc
11452
11453 : see if this is a pwd.h system
11454 set pwd.h i_pwd
11455 eval $inhdr
11456
11457 case "$i_pwd" in
11458 $define)
11459         xxx=`./findhdr pwd.h`
11460         $cppstdin $cppflags $cppminus < $xxx >$$.h
11461
11462         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11463                 val="$define"
11464         else
11465                 val="$undef"
11466         fi
11467         set d_pwquota
11468         eval $setvar
11469
11470         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11471                 val="$define"
11472         else
11473                 val="$undef"
11474         fi
11475         set d_pwage
11476         eval $setvar
11477
11478         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11479                 val="$define"
11480         else
11481                 val="$undef"
11482         fi
11483         set d_pwchange
11484         eval $setvar
11485
11486         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11487                 val="$define"
11488         else
11489                 val="$undef"
11490         fi
11491         set d_pwclass
11492         eval $setvar
11493
11494         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11495                 val="$define"
11496         else
11497                 val="$undef"
11498         fi
11499         set d_pwexpire
11500         eval $setvar
11501
11502         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11503                 val="$define"
11504         else
11505                 val="$undef"
11506         fi
11507         set d_pwcomment
11508         eval $setvar
11509
11510         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11511                 val="$define"
11512         else
11513                 val="$undef"
11514         fi
11515         set d_pwgecos
11516         eval $setvar
11517
11518         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11519                 val="$define"
11520         else
11521                 val="$undef"
11522         fi
11523         set d_pwpasswd
11524         eval $setvar
11525
11526         $rm -f $$.h
11527         ;;
11528 *)
11529         val="$undef"; 
11530         set d_pwquota; eval $setvar
11531         set d_pwage; eval $setvar
11532         set d_pwchange; eval $setvar
11533         set d_pwclass; eval $setvar
11534         set d_pwexpire; eval $setvar
11535         set d_pwcomment; eval $setvar
11536         set d_pwgecos; eval $setvar
11537         set d_pwpasswd; eval $setvar
11538         ;;
11539 esac
11540
11541 : see if endpwent_r exists
11542 set endpwent_r d_endpwent_r
11543 eval $inlibc
11544 case "$d_endpwent_r" in
11545 "$define")
11546         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11547         case "$d_endpwent_r_proto:$usethreads" in
11548         ":define")      d_endpwent_r_proto=define
11549                 set d_endpwent_r_proto endpwent_r $hdrs
11550                 eval $hasproto ;;
11551         *)      ;;
11552         esac
11553         case "$d_endpwent_r_proto" in
11554         define)
11555         case "$endpwent_r_proto" in
11556         ''|0) try='int endpwent_r(FILE**);'
11557         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11558         esac
11559         case "$endpwent_r_proto" in
11560         ''|0) try='void endpwent_r(FILE**);'
11561         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11562         esac
11563         case "$endpwent_r_proto" in
11564         ''|0)   d_endpwent_r=undef
11565                 endpwent_r_proto=0
11566                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
11567         * )     case "$endpwent_r_proto" in
11568                 REENTRANT_PROTO*) ;;
11569                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11570                 esac
11571                 echo "Prototype: $try" ;;
11572         esac
11573         ;;
11574         *)      case "$usethreads" in
11575                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11576                 esac
11577                 d_endpwent_r=undef
11578                 endpwent_r_proto=0
11579                 ;;
11580         esac
11581         ;;
11582 *)      endpwent_r_proto=0
11583         ;;
11584 esac
11585
11586 : see if endservent exists
11587 set endservent d_endsent
11588 eval $inlibc
11589
11590 : see if endservent_r exists
11591 set endservent_r d_endservent_r
11592 eval $inlibc
11593 case "$d_endservent_r" in
11594 "$define")
11595         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11596         case "$d_endservent_r_proto:$usethreads" in
11597         ":define")      d_endservent_r_proto=define
11598                 set d_endservent_r_proto endservent_r $hdrs
11599                 eval $hasproto ;;
11600         *)      ;;
11601         esac
11602         case "$d_endservent_r_proto" in
11603         define)
11604         case "$endservent_r_proto" in
11605         ''|0) try='int endservent_r(struct servent_data*);'
11606         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
11607         esac
11608         case "$endservent_r_proto" in
11609         ''|0) try='void endservent_r(struct servent_data*);'
11610         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
11611         esac
11612         case "$endservent_r_proto" in
11613         ''|0)   d_endservent_r=undef
11614                 endservent_r_proto=0
11615                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
11616         * )     case "$endservent_r_proto" in
11617                 REENTRANT_PROTO*) ;;
11618                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11619                 esac
11620                 echo "Prototype: $try" ;;
11621         esac
11622         ;;
11623         *)      case "$usethreads" in
11624                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11625                 esac
11626                 d_endservent_r=undef
11627                 endservent_r_proto=0
11628                 ;;
11629         esac
11630         ;;
11631 *)      endservent_r_proto=0
11632         ;;
11633 esac
11634
11635 : Locate the flags for 'open()'
11636 echo " "
11637 $cat >try.c <<EOCP
11638 #include <sys/types.h>
11639 #ifdef I_FCNTL
11640 #include <fcntl.h>
11641 #endif
11642 #ifdef I_SYS_FILE
11643 #include <sys/file.h>
11644 #endif
11645 #$i_stdlib I_STDLIB
11646 #ifdef I_STDLIB
11647 #include <stdlib.h>
11648 #endif
11649 int main() {
11650         if(O_RDONLY);
11651 #ifdef O_TRUNC
11652         exit(0);
11653 #else
11654         exit(1);
11655 #endif
11656 }
11657 EOCP
11658 : check sys/file.h first to get FREAD on Sun
11659 if $test `./findhdr sys/file.h` && \
11660                 set try -DI_SYS_FILE && eval $compile; then
11661         h_sysfile=true;
11662         echo "<sys/file.h> defines the O_* constants..." >&4
11663         if $run ./try; then
11664                 echo "and you have the 3 argument form of open()." >&4
11665                 val="$define"
11666         else
11667                 echo "but not the 3 argument form of open().  Oh, well." >&4
11668                 val="$undef"
11669         fi
11670 elif $test `./findhdr fcntl.h` && \
11671                 set try -DI_FCNTL && eval $compile; then
11672         h_fcntl=true;
11673         echo "<fcntl.h> defines the O_* constants..." >&4
11674         if $run ./try; then
11675                 echo "and you have the 3 argument form of open()." >&4
11676                 val="$define"
11677         else
11678                 echo "but not the 3 argument form of open().  Oh, well." >&4
11679                 val="$undef"
11680         fi
11681 else
11682         val="$undef"
11683         echo "I can't find the O_* constant definitions!  You got problems." >&4
11684 fi
11685 set d_open3
11686 eval $setvar
11687 $rm -f try try.*
11688
11689 : see which of string.h or strings.h is needed
11690 echo " "
11691 strings=`./findhdr string.h`
11692 if $test "$strings" && $test -r "$strings"; then
11693         echo "Using <string.h> instead of <strings.h>." >&4
11694         val="$define"
11695 else
11696         val="$undef"
11697         strings=`./findhdr strings.h`
11698         if $test "$strings" && $test -r "$strings"; then
11699                 echo "Using <strings.h> instead of <string.h>." >&4
11700         else
11701                 echo "No string header found -- You'll surely have problems." >&4
11702         fi
11703 fi
11704 set i_string
11705 eval $setvar
11706 case "$i_string" in
11707 "$undef") strings=`./findhdr strings.h`;;
11708 *)        strings=`./findhdr string.h`;;
11709 esac
11710
11711 : see if this is a sys/file.h system
11712 val=''
11713 set sys/file.h val
11714 eval $inhdr
11715
11716 : do we need to include sys/file.h ?
11717 case "$val" in
11718 "$define")
11719         echo " "
11720         if $h_sysfile; then
11721                 val="$define"
11722                 echo "We'll be including <sys/file.h>." >&4
11723         else
11724                 val="$undef"
11725                 echo "We won't be including <sys/file.h>." >&4
11726         fi
11727         ;;
11728 *)
11729         h_sysfile=false
11730         ;;
11731 esac
11732 set i_sysfile
11733 eval $setvar
11734
11735 : see if fcntl.h is there
11736 val=''
11737 set fcntl.h val
11738 eval $inhdr
11739
11740 : see if we can include fcntl.h
11741 case "$val" in
11742 "$define")
11743         echo " "
11744         if $h_fcntl; then
11745                 val="$define"
11746                 echo "We'll be including <fcntl.h>." >&4
11747         else
11748                 val="$undef"
11749                 if $h_sysfile; then
11750         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11751                 else
11752                         echo "We won't be including <fcntl.h>." >&4
11753                 fi
11754         fi
11755         ;;
11756 *)
11757         h_fcntl=false
11758         val="$undef"
11759         ;;
11760 esac
11761 set i_fcntl
11762 eval $setvar
11763
11764 : check for non-blocking I/O stuff
11765 case "$h_sysfile" in
11766 true) echo "#include <sys/file.h>" > head.c;;
11767 *)
11768        case "$h_fcntl" in
11769        true) echo "#include <fcntl.h>" > head.c;;
11770        *) echo "#include <sys/fcntl.h>" > head.c;;
11771        esac
11772        ;;
11773 esac
11774 echo " "
11775 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11776 case "$o_nonblock" in
11777 '')
11778         $cat head.c > try.c
11779         $cat >>try.c <<EOCP
11780 #include <stdio.h>
11781 #$i_stdlib I_STDLIB
11782 #ifdef I_STDLIB
11783 #include <stdlib.h>
11784 #endif
11785 #$i_fcntl I_FCNTL
11786 #ifdef I_FCNTL
11787 #include <fcntl.h>
11788 #endif
11789 int main() {
11790 #ifdef O_NONBLOCK
11791         printf("O_NONBLOCK\n");
11792         exit(0);
11793 #endif
11794 #ifdef O_NDELAY
11795         printf("O_NDELAY\n");
11796         exit(0);
11797 #endif
11798 #ifdef FNDELAY
11799         printf("FNDELAY\n");
11800         exit(0);
11801 #endif
11802         exit(0);
11803 }
11804 EOCP
11805         set try
11806         if eval $compile_ok; then
11807                 o_nonblock=`$run ./try`
11808                 case "$o_nonblock" in
11809                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11810                 *) echo "Seems like we can use $o_nonblock.";;
11811                 esac
11812         else
11813                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11814         fi
11815         ;;
11816 *) echo "Using $hint value $o_nonblock.";;
11817 esac
11818 $rm -f try try.* .out core
11819
11820 echo " "
11821 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11822 case "$eagain" in
11823 '')
11824         $cat head.c > try.c
11825         $cat >>try.c <<EOCP
11826 #include <errno.h>
11827 #include <sys/types.h>
11828 #include <signal.h>
11829 #include <stdio.h> 
11830 #$i_stdlib I_STDLIB
11831 #ifdef I_STDLIB
11832 #include <stdlib.h>
11833 #endif
11834 #$i_fcntl I_FCNTL
11835 #ifdef I_FCNTL
11836 #include <fcntl.h>
11837 #endif
11838 #define MY_O_NONBLOCK $o_nonblock
11839 #ifndef errno  /* XXX need better Configure test */
11840 extern int errno;
11841 #endif
11842 #$i_unistd I_UNISTD
11843 #ifdef I_UNISTD
11844 #include <unistd.h>
11845 #endif
11846 #$i_string I_STRING
11847 #ifdef I_STRING
11848 #include <string.h>
11849 #else
11850 #include <strings.h>
11851 #endif
11852 $signal_t blech(x) int x; { exit(3); }
11853 EOCP
11854         $cat >> try.c <<'EOCP'
11855 int main()
11856 {
11857         int pd[2];
11858         int pu[2];
11859         char buf[1];
11860         char string[100];
11861
11862         pipe(pd);       /* Down: child -> parent */
11863         pipe(pu);       /* Up: parent -> child */
11864         if (0 != fork()) {
11865                 int ret;
11866                 close(pd[1]);   /* Parent reads from pd[0] */
11867                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11868 #ifdef F_SETFL
11869                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11870                         exit(1);
11871 #else
11872                 exit(4);
11873 #endif
11874                 signal(SIGALRM, blech);
11875                 alarm(5);
11876                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11877                         exit(2);
11878                 sprintf(string, "%d\n", ret);
11879                 write(2, string, strlen(string));
11880                 alarm(0);
11881 #ifdef EAGAIN
11882                 if (errno == EAGAIN) {
11883                         printf("EAGAIN\n");
11884                         goto ok;
11885                 }
11886 #endif
11887 #ifdef EWOULDBLOCK
11888                 if (errno == EWOULDBLOCK)
11889                         printf("EWOULDBLOCK\n");
11890 #endif
11891         ok:
11892                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11893                 sleep(2);                               /* Give it time to close our pipe */
11894                 alarm(5);
11895                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11896                 alarm(0);
11897                 sprintf(string, "%d\n", ret);
11898                 write(4, string, strlen(string));
11899                 exit(0);
11900         }
11901
11902         close(pd[0]);                   /* We write to pd[1] */
11903         close(pu[1]);                   /* We read from pu[0] */
11904         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11905         close(pd[1]);                   /* Pipe pd is now fully closed! */
11906         exit(0);                                /* Bye bye, thank you for playing! */
11907 }
11908 EOCP
11909         set try
11910         if eval $compile_ok; then
11911                 echo "$startsh" >mtry
11912                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11913                 chmod +x mtry
11914                 ./mtry >/dev/null 2>&1
11915                 case $? in
11916                 0) eagain=`$cat try.out`;;
11917                 1) echo "Could not perform non-blocking setting!";;
11918                 2) echo "I did a successful read() for something that was not there!";;
11919                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
11920                 4) echo "Could not find F_SETFL!";;
11921                 *) echo "Something terribly wrong happened during testing.";;
11922                 esac
11923                 rd_nodata=`$cat try.ret`
11924                 echo "A read() system call with no data present returns $rd_nodata."
11925                 case "$rd_nodata" in
11926                 0|-1) ;;
11927                 *)
11928                         echo "(That's peculiar, fixing that to be -1.)"
11929                         rd_nodata=-1
11930                         ;;
11931                 esac
11932                 case "$eagain" in
11933                 '')
11934                         echo "Forcing errno EAGAIN on read() with no data available."
11935                         eagain=EAGAIN
11936                         ;;
11937                 *)
11938                         echo "Your read() sets errno to $eagain when no data is available."
11939                         ;;
11940                 esac
11941                 status=`$cat try.err`
11942                 case "$status" in
11943                 0) echo "And it correctly returns 0 to signal EOF.";;
11944                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11945                 *) echo "However, your read() returns '$status' on EOF??";;
11946                 esac
11947                 val="$define"
11948                 if test "$status" = "$rd_nodata"; then
11949                         echo "WARNING: you can't distinguish between EOF and no data!"
11950                         val="$undef"
11951                 fi
11952         else
11953                 echo "I can't compile the test program--assuming errno EAGAIN will do."
11954                 eagain=EAGAIN
11955         fi
11956         set d_eofnblk
11957         eval $setvar
11958         ;;
11959 *)
11960         echo "Using $hint value $eagain."
11961         echo "Your read() returns $rd_nodata when no data is present."
11962         case "$d_eofnblk" in
11963         "$define") echo "And you can see EOF because read() returns 0.";;
11964         "$undef") echo "But you can't see EOF status from read() returned value.";;
11965         *)
11966                 echo "(Assuming you can't see EOF status from read anyway.)"
11967                 d_eofnblk=$undef
11968                 ;;
11969         esac
11970         ;;
11971 esac
11972 $rm -f try try.* .out core head.c mtry
11973
11974 : see if _ptr and _cnt from stdio act std
11975 echo " "
11976
11977 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11978         echo "(Looks like you have stdio.h from BSD.)"
11979         case "$stdio_ptr" in
11980         '') stdio_ptr='((fp)->_p)'
11981                 ptr_lval=$define
11982                 ;;
11983         *)      ptr_lval=$d_stdio_ptr_lval;;
11984         esac
11985         case "$stdio_cnt" in
11986         '') stdio_cnt='((fp)->_r)'
11987                 cnt_lval=$define
11988                 ;;
11989         *)      cnt_lval=$d_stdio_cnt_lval;;
11990         esac
11991         case "$stdio_base" in
11992         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
11993         esac
11994         case "$stdio_bufsiz" in
11995         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
11996         esac
11997 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11998         echo "(Looks like you have stdio.h from Linux.)"
11999         case "$stdio_ptr" in
12000         '') stdio_ptr='((fp)->_IO_read_ptr)'
12001                 ptr_lval=$define
12002                 ;;
12003         *)      ptr_lval=$d_stdio_ptr_lval;;
12004         esac
12005         case "$stdio_cnt" in
12006         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12007                 cnt_lval=$undef
12008                 ;;
12009         *)      cnt_lval=$d_stdio_cnt_lval;;
12010         esac
12011         case "$stdio_base" in
12012         '') stdio_base='((fp)->_IO_read_base)';;
12013         esac
12014         case "$stdio_bufsiz" in
12015         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12016         esac
12017 else
12018         case "$stdio_ptr" in
12019         '') stdio_ptr='((fp)->_ptr)'
12020                 ptr_lval=$define
12021                 ;;
12022         *)      ptr_lval=$d_stdio_ptr_lval;;
12023         esac
12024         case "$stdio_cnt" in
12025         '') stdio_cnt='((fp)->_cnt)'
12026                 cnt_lval=$define
12027                 ;;
12028         *)      cnt_lval=$d_stdio_cnt_lval;;
12029         esac
12030         case "$stdio_base" in
12031         '') stdio_base='((fp)->_base)';;
12032         esac
12033         case "$stdio_bufsiz" in
12034         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12035         esac
12036 fi
12037
12038 : test whether _ptr and _cnt really work
12039 echo "Checking how std your stdio is..." >&4
12040 $cat >try.c <<EOP
12041 #include <stdio.h>
12042 #$i_stdlib I_STDLIB
12043 #ifdef I_STDLIB
12044 #include <stdlib.h>
12045 #endif
12046 #define FILE_ptr(fp)    $stdio_ptr
12047 #define FILE_cnt(fp)    $stdio_cnt
12048 int main() {
12049         FILE *fp = fopen("try.c", "r");
12050         char c = getc(fp);
12051         if (
12052                 18 <= FILE_cnt(fp) &&
12053                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12054         )
12055                 exit(0);
12056         exit(1);
12057 }
12058 EOP
12059 val="$undef"
12060 set try
12061 if eval $compile && $to try.c; then
12062         if $run ./try; then
12063                 echo "Your stdio acts pretty std."
12064                 val="$define"
12065         else
12066                 echo "Your stdio isn't very std."
12067         fi
12068 else
12069         echo "Your stdio doesn't appear very std."
12070 fi
12071 $rm -f try.c try
12072
12073 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12074 # direct buffer manipulation no longer works.  The Configure tests
12075 # should be changed to correctly detect this, but until then,
12076 # the following check should at least let perl compile and run.
12077 # (This quick fix should be updated before 5.8.1.)
12078 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12079 # A. Dougherty, June 3, 2002.
12080 case "$d_gnulibc" in
12081 $define)
12082         case "$gnulibc_version" in
12083         2.[01]*)  ;;
12084         2.2) ;;
12085         2.2.[0-9]) ;;
12086         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12087                 val="$undef"
12088                 ;;
12089         esac
12090         ;;
12091 esac
12092 set d_stdstdio
12093 eval $setvar
12094
12095 : Can _ptr be used as an lvalue?
12096 case "$d_stdstdio$ptr_lval" in
12097 $define$define) val=$define ;;
12098 *) val=$undef ;;
12099 esac
12100 set d_stdio_ptr_lval
12101 eval $setvar
12102
12103 : Can _cnt be used as an lvalue?
12104 case "$d_stdstdio$cnt_lval" in
12105 $define$define) val=$define ;;
12106 *) val=$undef ;;
12107 esac
12108 set d_stdio_cnt_lval
12109 eval $setvar
12110
12111
12112 : test whether setting _ptr sets _cnt as a side effect
12113 d_stdio_ptr_lval_sets_cnt="$undef"
12114 d_stdio_ptr_lval_nochange_cnt="$undef"
12115 case "$d_stdio_ptr_lval$d_stdstdio" in
12116 $define$define)
12117         echo "Checking to see what happens if we set the stdio ptr..." >&4
12118 $cat >try.c <<EOP
12119 #include <stdio.h>
12120 /* Can we scream? */
12121 /* Eat dust sed :-) */
12122 /* In the buffer space, no one can hear you scream. */
12123 #$i_stdlib I_STDLIB
12124 #ifdef I_STDLIB
12125 #include <stdlib.h>
12126 #endif
12127 #define FILE_ptr(fp)    $stdio_ptr
12128 #define FILE_cnt(fp)    $stdio_cnt
12129 #include <sys/types.h>
12130 int main() {
12131         FILE *fp = fopen("try.c", "r");
12132         int c;
12133         char *ptr;
12134         size_t cnt;
12135         if (!fp) {
12136             puts("Fail even to read");
12137             exit(1);
12138         }
12139         c = getc(fp); /* Read away the first # */
12140         if (c == EOF) {
12141             puts("Fail even to read");
12142             exit(1);
12143         }
12144         if (!(
12145                 18 <= FILE_cnt(fp) &&
12146                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12147         )) {
12148                 puts("Fail even to read");
12149                 exit (1);
12150         }
12151         ptr = (char*) FILE_ptr(fp);
12152         cnt = (size_t)FILE_cnt(fp);
12153
12154         FILE_ptr(fp) += 42;
12155
12156         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12157                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12158                 exit (1);
12159         }
12160         if (FILE_cnt(fp) <= 20) {
12161                 printf ("Fail (<20 chars to test)");
12162                 exit (1);
12163         }
12164         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12165                 puts("Fail compare");
12166                 exit (1);
12167         }
12168         if (cnt == FILE_cnt(fp)) {
12169                 puts("Pass_unchanged");
12170                 exit (0);
12171         }       
12172         if (FILE_cnt(fp) == (cnt - 42)) {
12173                 puts("Pass_changed");
12174                 exit (0);
12175         }
12176         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12177         return 1;
12178
12179 }
12180 EOP
12181         set try
12182         if eval $compile && $to try.c; then
12183                 case `$run ./try` in
12184                 Pass_changed)
12185                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12186                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12187                 Pass_unchanged)
12188                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12189                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12190                 Fail*)
12191                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12192                 *)
12193                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12194         esac
12195         else
12196                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12197         fi
12198         $rm -f try.c try
12199         ;;
12200 esac
12201
12202 : see if _base is also standard
12203 val="$undef"
12204 case "$d_stdstdio" in
12205 $define)
12206         $cat >try.c <<EOP
12207 #include <stdio.h>
12208 #$i_stdlib I_STDLIB
12209 #ifdef I_STDLIB
12210 #include <stdlib.h>
12211 #endif
12212 #define FILE_base(fp)   $stdio_base
12213 #define FILE_bufsiz(fp) $stdio_bufsiz
12214 int main() {
12215         FILE *fp = fopen("try.c", "r");
12216         char c = getc(fp);
12217         if (
12218                 19 <= FILE_bufsiz(fp) &&
12219                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12220         )
12221                 exit(0);
12222         exit(1);
12223 }
12224 EOP
12225         set try
12226         if eval $compile && $to try.c; then
12227                 if $run ./try; then
12228                         echo "And its _base field acts std."
12229                         val="$define"
12230                 else
12231                         echo "But its _base field isn't std."
12232                 fi
12233         else
12234                 echo "However, it seems to be lacking the _base field."
12235         fi
12236         $rm -f try.c try
12237         ;;
12238 esac
12239 set d_stdiobase
12240 eval $setvar
12241
12242 : see if fast_stdio exists
12243 val="$undef"
12244 case "$d_stdstdio:$d_stdio_ptr_lval" in
12245 "$define:$define")
12246         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12247         *$define*)
12248                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12249                 val="$define"
12250                 ;;
12251         esac
12252         ;;
12253 esac
12254 set d_faststdio
12255 eval $setvar
12256
12257
12258
12259 : see if fchdir exists
12260 set fchdir d_fchdir
12261 eval $inlibc
12262
12263 : see if fchmod exists
12264 set fchmod d_fchmod
12265 eval $inlibc
12266
12267 : see if fchown exists
12268 set fchown d_fchown
12269 eval $inlibc
12270
12271 : see if this is an fcntl system
12272 set fcntl d_fcntl
12273 eval $inlibc
12274
12275 echo " "
12276 : See if fcntl-based locking works.
12277 $cat >try.c <<EOCP
12278 #$i_stdlib I_STDLIB
12279 #ifdef I_STDLIB
12280 #include <stdlib.h>
12281 #endif
12282 #include <unistd.h>
12283 #include <fcntl.h>
12284 #include <signal.h>
12285 $signal_t blech(x) int x; { exit(3); }
12286 int main() {
12287 #if defined(F_SETLK) && defined(F_SETLKW)
12288      struct flock flock;
12289      int retval, fd;
12290      fd = open("try.c", O_RDONLY);
12291      flock.l_type = F_RDLCK;
12292      flock.l_whence = SEEK_SET;
12293      flock.l_start = flock.l_len = 0;
12294      signal(SIGALRM, blech);
12295      alarm(10);
12296      retval = fcntl(fd, F_SETLK, &flock);
12297      close(fd);
12298      (retval < 0 ? exit(2) : exit(0));
12299 #else
12300      exit(2);
12301 #endif
12302 }
12303 EOCP
12304 echo "Checking if fcntl-based file locking works... "
12305 case "$d_fcntl" in
12306 "$define")
12307         set try
12308         if eval $compile_ok; then
12309                 if $run ./try; then
12310                         echo "Yes, it seems to work."
12311                         val="$define"
12312                 else
12313                         echo "Nope, it didn't work."
12314                         val="$undef"
12315                         case "$?" in
12316                         3) $cat >&4 <<EOM
12317 ***
12318 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12319 *** This is (almost) impossible.
12320 *** If your NFS lock daemons are not feeling well, something like
12321 *** this may happen, please investigate.  Cannot continue, aborting.
12322 ***
12323 EOM
12324                                 exit 1
12325                                 ;;
12326                         esac
12327                 fi
12328         else
12329                 echo "I'm unable to compile the test program, so I'll assume not."
12330                 val="$undef"
12331         fi
12332         ;;
12333 *) val="$undef";
12334         echo "Nope, since you don't even have fcntl()."
12335         ;;
12336 esac
12337 set d_fcntl_can_lock
12338 eval $setvar
12339 $rm -f try*
12340
12341
12342 : check for fd_set items
12343 $cat <<EOM
12344
12345 Checking to see how well your C compiler handles fd_set and friends ...
12346 EOM
12347 $cat >try.c <<EOCP
12348 #$i_stdlib I_STDLIB
12349 #ifdef I_STDLIB
12350 #include <stdlib.h>
12351 #endif
12352 #$i_systime I_SYS_TIME
12353 #$i_sysselct I_SYS_SELECT
12354 #$d_socket HAS_SOCKET
12355 #include <sys/types.h>
12356 #ifdef HAS_SOCKET
12357 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12358 #endif
12359 #ifdef I_SYS_TIME
12360 #include <sys/time.h>
12361 #endif
12362 #ifdef I_SYS_SELECT
12363 #include <sys/select.h>
12364 #endif
12365 int main() {
12366         fd_set fds;
12367
12368 #ifdef TRYBITS
12369         if(fds.fds_bits);
12370 #endif
12371
12372 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12373         exit(0);
12374 #else
12375         exit(1);
12376 #endif
12377 }
12378 EOCP
12379 set try -DTRYBITS
12380 if eval $compile; then
12381         d_fds_bits="$define"
12382         d_fd_set="$define"
12383         echo "Well, your system knows about the normal fd_set typedef..." >&4
12384         if $run ./try; then
12385                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12386                 d_fd_macros="$define"
12387         else
12388                 $cat >&4 <<'EOM'
12389 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12390 EOM
12391                 d_fd_macros="$undef"
12392         fi
12393 else
12394         $cat <<'EOM'
12395 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12396 EOM
12397         set try
12398         if eval $compile; then
12399                 d_fds_bits="$undef"
12400                 d_fd_set="$define"
12401                 echo "Well, your system has some sort of fd_set available..." >&4
12402                 if $run ./try; then
12403                         echo "and you have the normal fd_set macros." >&4
12404                         d_fd_macros="$define"
12405                 else
12406                         $cat <<'EOM'
12407 but not the normal fd_set macros!  Gross!  More work for me...
12408 EOM
12409                         d_fd_macros="$undef"
12410                 fi
12411         else
12412         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
12413                 d_fd_set="$undef"
12414                 d_fds_bits="$undef"
12415                 d_fd_macros="$undef"
12416         fi
12417 fi
12418 $rm -f try try.*
12419
12420 : see if fgetpos exists
12421 set fgetpos d_fgetpos
12422 eval $inlibc
12423
12424 : see if finite exists
12425 set finite d_finite
12426 eval $inlibc
12427
12428 : see if finitel exists
12429 set finitel d_finitel
12430 eval $inlibc
12431
12432 : see if flock exists
12433 set flock d_flock
12434 eval $inlibc
12435
12436 : see if prototype for flock is available
12437 echo " "
12438 set d_flockproto flock $i_sysfile sys/file.h
12439 eval $hasproto
12440
12441 : see if fork exists
12442 set fork d_fork
12443 eval $inlibc
12444
12445 : see if fp_class exists
12446 set fp_class d_fp_class
12447 eval $inlibc
12448
12449 : see if pathconf exists
12450 set pathconf d_pathconf
12451 eval $inlibc
12452
12453 : see if fpathconf exists
12454 set fpathconf d_fpathconf
12455 eval $inlibc
12456
12457 : see if fpclass exists
12458 set fpclass d_fpclass
12459 eval $inlibc
12460
12461 : see if fpclassify exists
12462 set fpclassify d_fpclassify
12463 eval $inlibc
12464
12465 : see if fpclassl exists
12466 set fpclassl d_fpclassl
12467 eval $inlibc
12468
12469
12470 : check for fpos64_t
12471 echo " "
12472 echo "Checking to see if you have fpos64_t..." >&4
12473 $cat >try.c <<EOCP
12474 #include <stdio.h>
12475 int main() { fpos64_t x = 7; }
12476 EOCP
12477 set try
12478 if eval $compile; then
12479         val="$define"
12480         echo "You have fpos64_t."
12481 else
12482         val="$undef"
12483         echo "You do not have fpos64_t."
12484         case "$fpossize" in
12485         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12486         esac
12487 fi
12488 $rm -f try.* try
12489 set d_fpos64_t
12490 eval $setvar
12491
12492 : see if frexpl exists
12493 set frexpl d_frexpl
12494 eval $inlibc
12495
12496 : see if this is a sys/param system
12497 set sys/param.h i_sysparam
12498 eval $inhdr
12499
12500 : see if this is a sys/mount.h system
12501 set sys/mount.h i_sysmount
12502 eval $inhdr
12503
12504
12505 echo " "
12506 echo "Checking to see if your system supports struct fs_data..." >&4
12507 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12508 eval $hasstruct
12509 case "$d_fs_data_s" in
12510 "$define")      echo "Yes, it does."   ;;
12511 *)              echo "No, it doesn't." ;;
12512 esac
12513
12514 : see if fseeko exists
12515 set fseeko d_fseeko
12516 eval $inlibc
12517 case "$longsize" in
12518 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12519 esac
12520
12521 : see if fsetpos exists
12522 set fsetpos d_fsetpos
12523 eval $inlibc
12524
12525
12526 : see if fstatfs exists
12527 set fstatfs d_fstatfs
12528 eval $inlibc
12529
12530
12531 : see if statvfs exists
12532 set statvfs d_statvfs
12533 eval $inlibc
12534
12535 : see if fstatvfs exists
12536 set fstatvfs d_fstatvfs
12537 eval $inlibc
12538
12539
12540 : see if fsync exists
12541 set fsync d_fsync
12542 eval $inlibc
12543
12544 : see if ftello exists
12545 set ftello d_ftello
12546 eval $inlibc
12547 case "$longsize" in
12548 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12549 esac
12550
12551 : see if getcwd exists
12552 set getcwd d_getcwd
12553 eval $inlibc
12554
12555 : see if getespwnam exists
12556 set getespwnam d_getespwnam
12557 eval $inlibc
12558
12559
12560 : see if getfsstat exists
12561 set getfsstat d_getfsstat
12562 eval $inlibc
12563
12564 : see if getgrent exists
12565 set getgrent d_getgrent
12566 eval $inlibc
12567
12568 : see if getgrent_r exists
12569 set getgrent_r d_getgrent_r
12570 eval $inlibc
12571 case "$d_getgrent_r" in
12572 "$define")
12573         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12574         case "$d_getgrent_r_proto:$usethreads" in
12575         ":define")      d_getgrent_r_proto=define
12576                 set d_getgrent_r_proto getgrent_r $hdrs
12577                 eval $hasproto ;;
12578         *)      ;;
12579         esac
12580         case "$d_getgrent_r_proto" in
12581         define)
12582         case "$getgrent_r_proto" in
12583         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
12584         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
12585         esac
12586         case "$getgrent_r_proto" in
12587         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
12588         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
12589         esac
12590         case "$getgrent_r_proto" in
12591         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12592         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12593         esac
12594         case "$getgrent_r_proto" in
12595         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12596         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12597         esac
12598         case "$getgrent_r_proto" in
12599         ''|0) try='int getgrent_r(struct group*, char*, int);'
12600         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12601         esac
12602         case "$getgrent_r_proto" in
12603         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12604         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12605         esac
12606         case "$getgrent_r_proto" in
12607         ''|0)   d_getgrent_r=undef
12608                 getgrent_r_proto=0
12609                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
12610         * )     case "$getgrent_r_proto" in
12611                 REENTRANT_PROTO*) ;;
12612                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12613                 esac
12614                 echo "Prototype: $try" ;;
12615         esac
12616         ;;
12617         *)      case "$usethreads" in
12618                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12619                 esac
12620                 d_getgrent_r=undef
12621                 getgrent_r_proto=0
12622                 ;;
12623         esac
12624         ;;
12625 *)      getgrent_r_proto=0
12626         ;;
12627 esac
12628
12629 : see if getgrgid_r exists
12630 set getgrgid_r d_getgrgid_r
12631 eval $inlibc
12632 case "$d_getgrgid_r" in
12633 "$define")
12634         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12635         case "$d_getgrgid_r_proto:$usethreads" in
12636         ":define")      d_getgrgid_r_proto=define
12637                 set d_getgrgid_r_proto getgrgid_r $hdrs
12638                 eval $hasproto ;;
12639         *)      ;;
12640         esac
12641         case "$d_getgrgid_r_proto" in
12642         define)
12643         case "$getgrgid_r_proto" in
12644         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12645         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12646         esac
12647         case "$getgrgid_r_proto" in
12648         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12649         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12650         esac
12651         case "$getgrgid_r_proto" in
12652         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12653         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12654         esac
12655         case "$getgrgid_r_proto" in
12656         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12657         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12658         esac
12659         case "$getgrgid_r_proto" in
12660         ''|0)   d_getgrgid_r=undef
12661                 getgrgid_r_proto=0
12662                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
12663         * )     case "$getgrgid_r_proto" in
12664                 REENTRANT_PROTO*) ;;
12665                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12666                 esac
12667                 echo "Prototype: $try" ;;
12668         esac
12669         ;;
12670         *)      case "$usethreads" in
12671                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12672                 esac
12673                 d_getgrgid_r=undef
12674                 getgrgid_r_proto=0
12675                 ;;
12676         esac
12677         ;;
12678 *)      getgrgid_r_proto=0
12679         ;;
12680 esac
12681
12682 : see if getgrnam_r exists
12683 set getgrnam_r d_getgrnam_r
12684 eval $inlibc
12685 case "$d_getgrnam_r" in
12686 "$define")
12687         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12688         case "$d_getgrnam_r_proto:$usethreads" in
12689         ":define")      d_getgrnam_r_proto=define
12690                 set d_getgrnam_r_proto getgrnam_r $hdrs
12691                 eval $hasproto ;;
12692         *)      ;;
12693         esac
12694         case "$d_getgrnam_r_proto" in
12695         define)
12696         case "$getgrnam_r_proto" in
12697         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12698         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12699         esac
12700         case "$getgrnam_r_proto" in
12701         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12702         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12703         esac
12704         case "$getgrnam_r_proto" in
12705         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12706         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12707         esac
12708         case "$getgrnam_r_proto" in
12709         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
12710         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
12711         esac
12712         case "$getgrnam_r_proto" in
12713         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
12714         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
12715         esac
12716         case "$getgrnam_r_proto" in
12717         ''|0)   d_getgrnam_r=undef
12718                 getgrnam_r_proto=0
12719                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
12720         * )     case "$getgrnam_r_proto" in
12721                 REENTRANT_PROTO*) ;;
12722                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
12723                 esac
12724                 echo "Prototype: $try" ;;
12725         esac
12726         ;;
12727         *)      case "$usethreads" in
12728                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
12729                 esac
12730                 d_getgrnam_r=undef
12731                 getgrnam_r_proto=0
12732                 ;;
12733         esac
12734         ;;
12735 *)      getgrnam_r_proto=0
12736         ;;
12737 esac
12738
12739 : see if gethostbyaddr exists
12740 set gethostbyaddr d_gethbyaddr
12741 eval $inlibc
12742
12743 : see if gethostbyname exists
12744 set gethostbyname d_gethbyname
12745 eval $inlibc
12746
12747 : see if gethostent exists
12748 set gethostent d_gethent
12749 eval $inlibc
12750
12751 : see how we will look up host name
12752 echo " "
12753 call=''
12754 if set gethostname val -f d_gethname; eval $csym; $val; then
12755         echo 'gethostname() found.' >&4
12756         d_gethname="$define"
12757         call=gethostname
12758 fi
12759 if set uname val -f d_uname; eval $csym; $val; then
12760         if ./xenix; then
12761                 $cat <<'EOM'
12762 uname() was found, but you're running xenix, and older versions of xenix
12763 have a broken uname(). If you don't really know whether your xenix is old
12764 enough to have a broken system call, use the default answer.
12765
12766 EOM
12767                 dflt=y
12768                 case "$d_uname" in
12769                 "$define") dflt=n;;
12770                 esac
12771                 rp='Is your uname() broken?'
12772                 . ./myread
12773                 case "$ans" in
12774                 n*) d_uname="$define"; call=uname;;
12775                 esac
12776         else
12777                 echo 'uname() found.' >&4
12778                 d_uname="$define"
12779                 case "$call" in
12780                 '') call=uname ;;
12781                 esac
12782         fi
12783 fi
12784 case "$d_gethname" in
12785 '') d_gethname="$undef";;
12786 esac
12787 case "$d_uname" in
12788 '') d_uname="$undef";;
12789 esac
12790 case "$d_uname$d_gethname" in
12791 *define*)
12792         dflt=n
12793         cat <<EOM
12794  
12795 Every now and then someone has a $call() that lies about the hostname
12796 but can't be fixed for political or economic reasons.  If you wish, I can
12797 pretend $call() isn't there and maybe compute hostname at run-time
12798 thanks to the '$phostname' command.
12799
12800 EOM
12801         rp="Shall I ignore $call() from now on?"
12802         . ./myread
12803         case "$ans" in
12804         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
12805         esac;;
12806 esac
12807 case "$phostname" in
12808 '') aphostname='';;
12809 *) case "$aphostname" in
12810         /*) ;;
12811         *) set X $phostname
12812                 shift
12813                 file=$1
12814                 shift
12815                 file=`./loc $file $file $pth`
12816                 aphostname=`echo $file $*`
12817                 ;;
12818         esac
12819         ;;
12820 esac
12821 case "$d_uname$d_gethname" in
12822 *define*) ;;
12823 *)
12824         case "$phostname" in
12825         '')
12826                 echo "There will be no way for $package to get your hostname." >&4;;
12827         *)
12828         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
12829                 ;;
12830         esac;;
12831 esac
12832 case "$d_phostname" in
12833 '') d_phostname="$undef";;
12834 esac
12835
12836 : see if gethostbyaddr_r exists
12837 set gethostbyaddr_r d_gethostbyaddr_r
12838 eval $inlibc
12839 case "$d_gethostbyaddr_r" in
12840 "$define")
12841         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12842         case "$d_gethostbyaddr_r_proto:$usethreads" in
12843         ":define")      d_gethostbyaddr_r_proto=define
12844                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
12845                 eval $hasproto ;;
12846         *)      ;;
12847         esac
12848         case "$d_gethostbyaddr_r_proto" in
12849         define)
12850         case "$gethostbyaddr_r_proto" in
12851         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12852         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
12853         esac
12854         case "$gethostbyaddr_r_proto" in
12855         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
12856         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
12857         esac
12858         case "$gethostbyaddr_r_proto" in
12859         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
12860         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
12861         esac
12862         case "$gethostbyaddr_r_proto" in
12863         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
12864         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
12865         esac
12866         case "$gethostbyaddr_r_proto" in
12867         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
12868         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
12869         esac
12870         case "$gethostbyaddr_r_proto" in
12871         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
12872         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
12873         esac
12874         case "$gethostbyaddr_r_proto" in
12875         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
12876         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
12877         esac
12878         case "$gethostbyaddr_r_proto" in
12879         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
12880         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
12881         esac
12882         case "$gethostbyaddr_r_proto" in
12883         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
12884         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
12885         esac
12886         case "$gethostbyaddr_r_proto" in
12887         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
12888         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
12889         esac
12890         case "$gethostbyaddr_r_proto" in
12891         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12892         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
12893         esac
12894         case "$gethostbyaddr_r_proto" in
12895         ''|0)   d_gethostbyaddr_r=undef
12896                 gethostbyaddr_r_proto=0
12897                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
12898         * )     case "$gethostbyaddr_r_proto" in
12899                 REENTRANT_PROTO*) ;;
12900                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
12901                 esac
12902                 echo "Prototype: $try" ;;
12903         esac
12904         ;;
12905         *)      case "$usethreads" in
12906                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
12907                 esac
12908                 d_gethostbyaddr_r=undef
12909                 gethostbyaddr_r_proto=0
12910                 ;;
12911         esac
12912         ;;
12913 *)      gethostbyaddr_r_proto=0
12914         ;;
12915 esac
12916
12917 : see if gethostbyname_r exists
12918 set gethostbyname_r d_gethostbyname_r
12919 eval $inlibc
12920 case "$d_gethostbyname_r" in
12921 "$define")
12922         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12923         case "$d_gethostbyname_r_proto:$usethreads" in
12924         ":define")      d_gethostbyname_r_proto=define
12925                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
12926                 eval $hasproto ;;
12927         *)      ;;
12928         esac
12929         case "$d_gethostbyname_r_proto" in
12930         define)
12931         case "$gethostbyname_r_proto" in
12932         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
12933         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
12934         esac
12935         case "$gethostbyname_r_proto" in
12936         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
12937         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
12938         esac
12939         case "$gethostbyname_r_proto" in
12940         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
12941         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
12942         esac
12943         case "$gethostbyname_r_proto" in
12944         ''|0)   d_gethostbyname_r=undef
12945                 gethostbyname_r_proto=0
12946                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
12947         * )     case "$gethostbyname_r_proto" in
12948                 REENTRANT_PROTO*) ;;
12949                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
12950                 esac
12951                 echo "Prototype: $try" ;;
12952         esac
12953         ;;
12954         *)      case "$usethreads" in
12955                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
12956                 esac
12957                 d_gethostbyname_r=undef
12958                 gethostbyname_r_proto=0
12959                 ;;
12960         esac
12961         ;;
12962 *)      gethostbyname_r_proto=0
12963         ;;
12964 esac
12965
12966 : see if gethostent_r exists
12967 set gethostent_r d_gethostent_r
12968 eval $inlibc
12969 case "$d_gethostent_r" in
12970 "$define")
12971         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12972         case "$d_gethostent_r_proto:$usethreads" in
12973         ":define")      d_gethostent_r_proto=define
12974                 set d_gethostent_r_proto gethostent_r $hdrs
12975                 eval $hasproto ;;
12976         *)      ;;
12977         esac
12978         case "$d_gethostent_r_proto" in
12979         define)
12980         case "$gethostent_r_proto" in
12981         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
12982         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
12983         esac
12984         case "$gethostent_r_proto" in
12985         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
12986         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
12987         esac
12988         case "$gethostent_r_proto" in
12989         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
12990         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
12991         esac
12992         case "$gethostent_r_proto" in
12993         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
12994         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
12995         esac
12996         case "$gethostent_r_proto" in
12997         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
12998         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
12999         esac
13000         case "$gethostent_r_proto" in
13001         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13002         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13003         esac
13004         case "$gethostent_r_proto" in
13005         ''|0)   d_gethostent_r=undef
13006                 gethostent_r_proto=0
13007                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13008         * )     case "$gethostent_r_proto" in
13009                 REENTRANT_PROTO*) ;;
13010                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13011                 esac
13012                 echo "Prototype: $try" ;;
13013         esac
13014         ;;
13015         *)      case "$usethreads" in
13016                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13017                 esac
13018                 d_gethostent_r=undef
13019                 gethostent_r_proto=0
13020                 ;;
13021         esac
13022         ;;
13023 *)      gethostent_r_proto=0
13024         ;;
13025 esac
13026
13027 : see if prototypes for various gethostxxx netdb.h functions are available
13028 echo " "
13029 set d_gethostprotos gethostent $i_netdb netdb.h
13030 eval $hasproto
13031
13032 : see if getitimer exists
13033 set getitimer d_getitimer
13034 eval $inlibc
13035
13036 : see if getlogin exists
13037 set getlogin d_getlogin
13038 eval $inlibc
13039
13040 : see if getlogin_r exists
13041 set getlogin_r d_getlogin_r
13042 eval $inlibc
13043 case "$d_getlogin_r" in
13044 "$define")
13045         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13046         case "$d_getlogin_r_proto:$usethreads" in
13047         ":define")      d_getlogin_r_proto=define
13048                 set d_getlogin_r_proto getlogin_r $hdrs
13049                 eval $hasproto ;;
13050         *)      ;;
13051         esac
13052         case "$d_getlogin_r_proto" in
13053         define)
13054         case "$getlogin_r_proto" in
13055         ''|0) try='int getlogin_r(char*, size_t);'
13056         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13057         esac
13058         case "$getlogin_r_proto" in
13059         ''|0) try='int getlogin_r(char*, int);'
13060         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13061         esac
13062         case "$getlogin_r_proto" in
13063         ''|0) try='char* getlogin_r(char*, size_t);'
13064         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13065         esac
13066         case "$getlogin_r_proto" in
13067         ''|0) try='char* getlogin_r(char*, int);'
13068         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13069         esac
13070         case "$getlogin_r_proto" in
13071         ''|0)   d_getlogin_r=undef
13072                 getlogin_r_proto=0
13073                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13074         * )     case "$getlogin_r_proto" in
13075                 REENTRANT_PROTO*) ;;
13076                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13077                 esac
13078                 echo "Prototype: $try" ;;
13079         esac
13080         ;;
13081         *)      case "$usethreads" in
13082                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13083                 esac
13084                 d_getlogin_r=undef
13085                 getlogin_r_proto=0
13086                 ;;
13087         esac
13088         ;;
13089 *)      getlogin_r_proto=0
13090         ;;
13091 esac
13092
13093 : see if getmnt exists
13094 set getmnt d_getmnt
13095 eval $inlibc
13096
13097 : see if getmntent exists
13098 set getmntent d_getmntent
13099 eval $inlibc
13100
13101 : see if getnetbyaddr exists
13102 set getnetbyaddr d_getnbyaddr
13103 eval $inlibc
13104
13105 : see if getnetbyname exists
13106 set getnetbyname d_getnbyname
13107 eval $inlibc
13108
13109 : see if getnetent exists
13110 set getnetent d_getnent
13111 eval $inlibc
13112
13113 : see if getnetbyaddr_r exists
13114 set getnetbyaddr_r d_getnetbyaddr_r
13115 eval $inlibc
13116 case "$d_getnetbyaddr_r" in
13117 "$define")
13118         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13119         case "$d_getnetbyaddr_r_proto:$usethreads" in
13120         ":define")      d_getnetbyaddr_r_proto=define
13121                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13122                 eval $hasproto ;;
13123         *)      ;;
13124         esac
13125         case "$d_getnetbyaddr_r_proto" in
13126         define)
13127         case "$getnetbyaddr_r_proto" in
13128         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13129         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13130         esac
13131         case "$getnetbyaddr_r_proto" in
13132         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13133         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13134         esac
13135         case "$getnetbyaddr_r_proto" in
13136         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13137         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13138         esac
13139         case "$getnetbyaddr_r_proto" in
13140         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13141         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13142         esac
13143         case "$getnetbyaddr_r_proto" in
13144         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13145         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13146         esac
13147         case "$getnetbyaddr_r_proto" in
13148         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13149         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13150         esac
13151         case "$getnetbyaddr_r_proto" in
13152         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13153         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13154         esac
13155         case "$getnetbyaddr_r_proto" in
13156         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13157         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13158         esac
13159         case "$getnetbyaddr_r_proto" in
13160         ''|0)   d_getnetbyaddr_r=undef
13161                 getnetbyaddr_r_proto=0
13162                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13163         * )     case "$getnetbyaddr_r_proto" in
13164                 REENTRANT_PROTO*) ;;
13165                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13166                 esac
13167                 echo "Prototype: $try" ;;
13168         esac
13169         ;;
13170         *)      case "$usethreads" in
13171                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13172                 esac
13173                 d_getnetbyaddr_r=undef
13174                 getnetbyaddr_r_proto=0
13175                 ;;
13176         esac
13177         ;;
13178 *)      getnetbyaddr_r_proto=0
13179         ;;
13180 esac
13181
13182 : see if getnetbyname_r exists
13183 set getnetbyname_r d_getnetbyname_r
13184 eval $inlibc
13185 case "$d_getnetbyname_r" in
13186 "$define")
13187         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13188         case "$d_getnetbyname_r_proto:$usethreads" in
13189         ":define")      d_getnetbyname_r_proto=define
13190                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13191                 eval $hasproto ;;
13192         *)      ;;
13193         esac
13194         case "$d_getnetbyname_r_proto" in
13195         define)
13196         case "$getnetbyname_r_proto" in
13197         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13198         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13199         esac
13200         case "$getnetbyname_r_proto" in
13201         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13202         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13203         esac
13204         case "$getnetbyname_r_proto" in
13205         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13206         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13207         esac
13208         case "$getnetbyname_r_proto" in
13209         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13210         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13211         esac
13212         case "$getnetbyname_r_proto" in
13213         ''|0)   d_getnetbyname_r=undef
13214                 getnetbyname_r_proto=0
13215                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13216         * )     case "$getnetbyname_r_proto" in
13217                 REENTRANT_PROTO*) ;;
13218                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13219                 esac
13220                 echo "Prototype: $try" ;;
13221         esac
13222         ;;
13223         *)      case "$usethreads" in
13224                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13225                 esac
13226                 d_getnetbyname_r=undef
13227                 getnetbyname_r_proto=0
13228                 ;;
13229         esac
13230         ;;
13231 *)      getnetbyname_r_proto=0
13232         ;;
13233 esac
13234
13235 : see if getnetent_r exists
13236 set getnetent_r d_getnetent_r
13237 eval $inlibc
13238 case "$d_getnetent_r" in
13239 "$define")
13240         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13241         case "$d_getnetent_r_proto:$usethreads" in
13242         ":define")      d_getnetent_r_proto=define
13243                 set d_getnetent_r_proto getnetent_r $hdrs
13244                 eval $hasproto ;;
13245         *)      ;;
13246         esac
13247         case "$d_getnetent_r_proto" in
13248         define)
13249         case "$getnetent_r_proto" in
13250         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13251         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13252         esac
13253         case "$getnetent_r_proto" in
13254         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13255         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13256         esac
13257         case "$getnetent_r_proto" in
13258         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13259         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13260         esac
13261         case "$getnetent_r_proto" in
13262         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13263         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13264         esac
13265         case "$getnetent_r_proto" in
13266         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13267         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13268         esac
13269         case "$getnetent_r_proto" in
13270         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13271         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13272         esac
13273         case "$getnetent_r_proto" in
13274         ''|0)   d_getnetent_r=undef
13275                 getnetent_r_proto=0
13276                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13277         * )     case "$getnetent_r_proto" in
13278                 REENTRANT_PROTO*) ;;
13279                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13280                 esac
13281                 echo "Prototype: $try" ;;
13282         esac
13283         ;;
13284         *)      case "$usethreads" in
13285                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13286                 esac
13287                 d_getnetent_r=undef
13288                 getnetent_r_proto=0
13289                 ;;
13290         esac
13291         ;;
13292 *)      getnetent_r_proto=0
13293         ;;
13294 esac
13295
13296 : see if prototypes for various getnetxxx netdb.h functions are available
13297 echo " "
13298 set d_getnetprotos getnetent $i_netdb netdb.h
13299 eval $hasproto
13300
13301 : see if getpagesize exists
13302 set getpagesize d_getpagsz
13303 eval $inlibc
13304
13305
13306 : see if getprotobyname exists
13307 set getprotobyname d_getpbyname
13308 eval $inlibc
13309
13310 : see if getprotobynumber exists
13311 set getprotobynumber d_getpbynumber
13312 eval $inlibc
13313
13314 : see if getprotoent exists
13315 set getprotoent d_getpent
13316 eval $inlibc
13317
13318 : see if getpgid exists
13319 set getpgid d_getpgid
13320 eval $inlibc
13321
13322 : see if getpgrp2 exists
13323 set getpgrp2 d_getpgrp2
13324 eval $inlibc
13325
13326 : see if getppid exists
13327 set getppid d_getppid
13328 eval $inlibc
13329
13330 : see if getpriority exists
13331 set getpriority d_getprior
13332 eval $inlibc
13333
13334 : see if getprotobyname_r exists
13335 set getprotobyname_r d_getprotobyname_r
13336 eval $inlibc
13337 case "$d_getprotobyname_r" in
13338 "$define")
13339         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13340         case "$d_getprotobyname_r_proto:$usethreads" in
13341         ":define")      d_getprotobyname_r_proto=define
13342                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13343                 eval $hasproto ;;
13344         *)      ;;
13345         esac
13346         case "$d_getprotobyname_r_proto" in
13347         define)
13348         case "$getprotobyname_r_proto" in
13349         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13350         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13351         esac
13352         case "$getprotobyname_r_proto" in
13353         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13354         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13355         esac
13356         case "$getprotobyname_r_proto" in
13357         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13358         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13359         esac
13360         case "$getprotobyname_r_proto" in
13361         ''|0)   d_getprotobyname_r=undef
13362                 getprotobyname_r_proto=0
13363                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13364         * )     case "$getprotobyname_r_proto" in
13365                 REENTRANT_PROTO*) ;;
13366                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13367                 esac
13368                 echo "Prototype: $try" ;;
13369         esac
13370         ;;
13371         *)      case "$usethreads" in
13372                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13373                 esac
13374                 d_getprotobyname_r=undef
13375                 getprotobyname_r_proto=0
13376                 ;;
13377         esac
13378         ;;
13379 *)      getprotobyname_r_proto=0
13380         ;;
13381 esac
13382
13383 : see if getprotobynumber_r exists
13384 set getprotobynumber_r d_getprotobynumber_r
13385 eval $inlibc
13386 case "$d_getprotobynumber_r" in
13387 "$define")
13388         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13389         case "$d_getprotobynumber_r_proto:$usethreads" in
13390         ":define")      d_getprotobynumber_r_proto=define
13391                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13392                 eval $hasproto ;;
13393         *)      ;;
13394         esac
13395         case "$d_getprotobynumber_r_proto" in
13396         define)
13397         case "$getprotobynumber_r_proto" in
13398         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13399         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13400         esac
13401         case "$getprotobynumber_r_proto" in
13402         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13403         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13404         esac
13405         case "$getprotobynumber_r_proto" in
13406         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13407         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13408         esac
13409         case "$getprotobynumber_r_proto" in
13410         ''|0)   d_getprotobynumber_r=undef
13411                 getprotobynumber_r_proto=0
13412                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
13413         * )     case "$getprotobynumber_r_proto" in
13414                 REENTRANT_PROTO*) ;;
13415                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13416                 esac
13417                 echo "Prototype: $try" ;;
13418         esac
13419         ;;
13420         *)      case "$usethreads" in
13421                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13422                 esac
13423                 d_getprotobynumber_r=undef
13424                 getprotobynumber_r_proto=0
13425                 ;;
13426         esac
13427         ;;
13428 *)      getprotobynumber_r_proto=0
13429         ;;
13430 esac
13431
13432 : see if getprotoent_r exists
13433 set getprotoent_r d_getprotoent_r
13434 eval $inlibc
13435 case "$d_getprotoent_r" in
13436 "$define")
13437         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13438         case "$d_getprotoent_r_proto:$usethreads" in
13439         ":define")      d_getprotoent_r_proto=define
13440                 set d_getprotoent_r_proto getprotoent_r $hdrs
13441                 eval $hasproto ;;
13442         *)      ;;
13443         esac
13444         case "$d_getprotoent_r_proto" in
13445         define)
13446         case "$getprotoent_r_proto" in
13447         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13448         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13449         esac
13450         case "$getprotoent_r_proto" in
13451         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13452         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13453         esac
13454         case "$getprotoent_r_proto" in
13455         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13456         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13457         esac
13458         case "$getprotoent_r_proto" in
13459         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13460         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13461         esac
13462         case "$getprotoent_r_proto" in
13463         ''|0)   d_getprotoent_r=undef
13464                 getprotoent_r_proto=0
13465                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
13466         * )     case "$getprotoent_r_proto" in
13467                 REENTRANT_PROTO*) ;;
13468                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13469                 esac
13470                 echo "Prototype: $try" ;;
13471         esac
13472         ;;
13473         *)      case "$usethreads" in
13474                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13475                 esac
13476                 d_getprotoent_r=undef
13477                 getprotoent_r_proto=0
13478                 ;;
13479         esac
13480         ;;
13481 *)      getprotoent_r_proto=0
13482         ;;
13483 esac
13484
13485 : see if prototypes for various getprotoxxx netdb.h functions are available
13486 echo " "
13487 set d_getprotoprotos getprotoent $i_netdb netdb.h
13488 eval $hasproto
13489
13490 : see if getprpwnam exists
13491 set getprpwnam d_getprpwnam
13492 eval $inlibc
13493
13494 : see if getpwent exists
13495 set getpwent d_getpwent
13496 eval $inlibc
13497
13498 : see if getpwent_r exists
13499 set getpwent_r d_getpwent_r
13500 eval $inlibc
13501 case "$d_getpwent_r" in
13502 "$define")
13503         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13504         case "$d_getpwent_r_proto:$usethreads" in
13505         ":define")      d_getpwent_r_proto=define
13506                 set d_getpwent_r_proto getpwent_r $hdrs
13507                 eval $hasproto ;;
13508         *)      ;;
13509         esac
13510         case "$d_getpwent_r_proto" in
13511         define)
13512         case "$getpwent_r_proto" in
13513         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13514         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13515         esac
13516         case "$getpwent_r_proto" in
13517         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13518         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13519         esac
13520         case "$getpwent_r_proto" in
13521         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13522         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13523         esac
13524         case "$getpwent_r_proto" in
13525         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13526         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13527         esac
13528         case "$getpwent_r_proto" in
13529         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13530         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13531         esac
13532         case "$getpwent_r_proto" in
13533         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13534         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13535         esac
13536         case "$getpwent_r_proto" in
13537         ''|0)   d_getpwent_r=undef
13538                 getpwent_r_proto=0
13539                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
13540         * )     case "$getpwent_r_proto" in
13541                 REENTRANT_PROTO*) ;;
13542                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13543                 esac
13544                 echo "Prototype: $try" ;;
13545         esac
13546         ;;
13547         *)      case "$usethreads" in
13548                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13549                 esac
13550                 d_getpwent_r=undef
13551                 getpwent_r_proto=0
13552                 ;;
13553         esac
13554         ;;
13555 *)      getpwent_r_proto=0
13556         ;;
13557 esac
13558
13559 : see if getpwnam_r exists
13560 set getpwnam_r d_getpwnam_r
13561 eval $inlibc
13562 case "$d_getpwnam_r" in
13563 "$define")
13564         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13565         case "$d_getpwnam_r_proto:$usethreads" in
13566         ":define")      d_getpwnam_r_proto=define
13567                 set d_getpwnam_r_proto getpwnam_r $hdrs
13568                 eval $hasproto ;;
13569         *)      ;;
13570         esac
13571         case "$d_getpwnam_r_proto" in
13572         define)
13573         case "$getpwnam_r_proto" in
13574         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13575         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
13576         esac
13577         case "$getpwnam_r_proto" in
13578         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
13579         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
13580         esac
13581         case "$getpwnam_r_proto" in
13582         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
13583         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
13584         esac
13585         case "$getpwnam_r_proto" in
13586         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
13587         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
13588         esac
13589         case "$getpwnam_r_proto" in
13590         ''|0)   d_getpwnam_r=undef
13591                 getpwnam_r_proto=0
13592                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
13593         * )     case "$getpwnam_r_proto" in
13594                 REENTRANT_PROTO*) ;;
13595                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
13596                 esac
13597                 echo "Prototype: $try" ;;
13598         esac
13599         ;;
13600         *)      case "$usethreads" in
13601                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13602                 esac
13603                 d_getpwnam_r=undef
13604                 getpwnam_r_proto=0
13605                 ;;
13606         esac
13607         ;;
13608 *)      getpwnam_r_proto=0
13609         ;;
13610 esac
13611
13612 : see if getpwuid_r exists
13613 set getpwuid_r d_getpwuid_r
13614 eval $inlibc
13615 case "$d_getpwuid_r" in
13616 "$define")
13617         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13618         case "$d_getpwuid_r_proto:$usethreads" in
13619         ":define")      d_getpwuid_r_proto=define
13620                 set d_getpwuid_r_proto getpwuid_r $hdrs
13621                 eval $hasproto ;;
13622         *)      ;;
13623         esac
13624         case "$d_getpwuid_r_proto" in
13625         define)
13626         case "$getpwuid_r_proto" in
13627         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13628         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13629         esac
13630         case "$getpwuid_r_proto" in
13631         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13632         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13633         esac
13634         case "$getpwuid_r_proto" in
13635         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13636         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13637         esac
13638         case "$getpwuid_r_proto" in
13639         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13640         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13641         esac
13642         case "$getpwuid_r_proto" in
13643         ''|0)   d_getpwuid_r=undef
13644                 getpwuid_r_proto=0
13645                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
13646         * )     case "$getpwuid_r_proto" in
13647                 REENTRANT_PROTO*) ;;
13648                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13649                 esac
13650                 echo "Prototype: $try" ;;
13651         esac
13652         ;;
13653         *)      case "$usethreads" in
13654                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13655                 esac
13656                 d_getpwuid_r=undef
13657                 getpwuid_r_proto=0
13658                 ;;
13659         esac
13660         ;;
13661 *)      getpwuid_r_proto=0
13662         ;;
13663 esac
13664
13665
13666 : see if getservbyname exists
13667 set getservbyname d_getsbyname
13668 eval $inlibc
13669
13670 : see if getservbyport exists
13671 set getservbyport d_getsbyport
13672 eval $inlibc
13673
13674 : see if getservent exists
13675 set getservent d_getsent
13676 eval $inlibc
13677
13678 : see if getservbyname_r exists
13679 set getservbyname_r d_getservbyname_r
13680 eval $inlibc
13681 case "$d_getservbyname_r" in
13682 "$define")
13683         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13684         case "$d_getservbyname_r_proto:$usethreads" in
13685         ":define")      d_getservbyname_r_proto=define
13686                 set d_getservbyname_r_proto getservbyname_r $hdrs
13687                 eval $hasproto ;;
13688         *)      ;;
13689         esac
13690         case "$d_getservbyname_r_proto" in
13691         define)
13692         case "$getservbyname_r_proto" in
13693         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13694         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13695         esac
13696         case "$getservbyname_r_proto" in
13697         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13698         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13699         esac
13700         case "$getservbyname_r_proto" in
13701         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13702         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13703         esac
13704         case "$getservbyname_r_proto" in
13705         ''|0)   d_getservbyname_r=undef
13706                 getservbyname_r_proto=0
13707                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
13708         * )     case "$getservbyname_r_proto" in
13709                 REENTRANT_PROTO*) ;;
13710                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
13711                 esac
13712                 echo "Prototype: $try" ;;
13713         esac
13714         ;;
13715         *)      case "$usethreads" in
13716                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
13717                 esac
13718                 d_getservbyname_r=undef
13719                 getservbyname_r_proto=0
13720                 ;;
13721         esac
13722         ;;
13723 *)      getservbyname_r_proto=0
13724         ;;
13725 esac
13726
13727 : see if getservbyport_r exists
13728 set getservbyport_r d_getservbyport_r
13729 eval $inlibc
13730 case "$d_getservbyport_r" in
13731 "$define")
13732         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13733         case "$d_getservbyport_r_proto:$usethreads" in
13734         ":define")      d_getservbyport_r_proto=define
13735                 set d_getservbyport_r_proto getservbyport_r $hdrs
13736                 eval $hasproto ;;
13737         *)      ;;
13738         esac
13739         case "$d_getservbyport_r_proto" in
13740         define)
13741         case "$getservbyport_r_proto" in
13742         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
13743         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
13744         esac
13745         case "$getservbyport_r_proto" in
13746         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
13747         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
13748         esac
13749         case "$getservbyport_r_proto" in
13750         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
13751         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
13752         esac
13753         case "$getservbyport_r_proto" in
13754         ''|0)   d_getservbyport_r=undef
13755                 getservbyport_r_proto=0
13756                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
13757         * )     case "$getservbyport_r_proto" in
13758                 REENTRANT_PROTO*) ;;
13759                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
13760                 esac
13761                 echo "Prototype: $try" ;;
13762         esac
13763         ;;
13764         *)      case "$usethreads" in
13765                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
13766                 esac
13767                 d_getservbyport_r=undef
13768                 getservbyport_r_proto=0
13769                 ;;
13770         esac
13771         ;;
13772 *)      getservbyport_r_proto=0
13773         ;;
13774 esac
13775
13776 : see if getservent_r exists
13777 set getservent_r d_getservent_r
13778 eval $inlibc
13779 case "$d_getservent_r" in
13780 "$define")
13781         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13782         case "$d_getservent_r_proto:$usethreads" in
13783         ":define")      d_getservent_r_proto=define
13784                 set d_getservent_r_proto getservent_r $hdrs
13785                 eval $hasproto ;;
13786         *)      ;;
13787         esac
13788         case "$d_getservent_r_proto" in
13789         define)
13790         case "$getservent_r_proto" in
13791         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
13792         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
13793         esac
13794         case "$getservent_r_proto" in
13795         ''|0) try='int getservent_r(struct servent*, char*, int);'
13796         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
13797         esac
13798         case "$getservent_r_proto" in
13799         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
13800         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
13801         esac
13802         case "$getservent_r_proto" in
13803         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
13804         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
13805         esac
13806         case "$getservent_r_proto" in
13807         ''|0)   d_getservent_r=undef
13808                 getservent_r_proto=0
13809                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
13810         * )     case "$getservent_r_proto" in
13811                 REENTRANT_PROTO*) ;;
13812                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
13813                 esac
13814                 echo "Prototype: $try" ;;
13815         esac
13816         ;;
13817         *)      case "$usethreads" in
13818                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
13819                 esac
13820                 d_getservent_r=undef
13821                 getservent_r_proto=0
13822                 ;;
13823         esac
13824         ;;
13825 *)      getservent_r_proto=0
13826         ;;
13827 esac
13828
13829 : see if prototypes for various getservxxx netdb.h functions are available
13830 echo " "
13831 set d_getservprotos getservent $i_netdb netdb.h
13832 eval $hasproto
13833
13834 : see if getspnam exists
13835 set getspnam d_getspnam
13836 eval $inlibc
13837
13838 : see if this is a shadow.h system
13839 set shadow.h i_shadow
13840 eval $inhdr
13841
13842 : see if getspnam_r exists
13843 set getspnam_r d_getspnam_r
13844 eval $inlibc
13845 case "$d_getspnam_r" in
13846 "$define")
13847         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
13848         case "$d_getspnam_r_proto:$usethreads" in
13849         ":define")      d_getspnam_r_proto=define
13850                 set d_getspnam_r_proto getspnam_r $hdrs
13851                 eval $hasproto ;;
13852         *)      ;;
13853         esac
13854         case "$d_getspnam_r_proto" in
13855         define)
13856         case "$getspnam_r_proto" in
13857         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
13858         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
13859         esac
13860         case "$getspnam_r_proto" in
13861         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
13862         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
13863         esac
13864         case "$getspnam_r_proto" in
13865         ''|0)   d_getspnam_r=undef
13866                 getspnam_r_proto=0
13867                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
13868         * )     case "$getspnam_r_proto" in
13869                 REENTRANT_PROTO*) ;;
13870                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
13871                 esac
13872                 echo "Prototype: $try" ;;
13873         esac
13874         ;;
13875         *)      case "$usethreads" in
13876                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
13877                 esac
13878                 d_getspnam_r=undef
13879                 getspnam_r_proto=0
13880                 ;;
13881         esac
13882         ;;
13883 *)      getspnam_r_proto=0
13884         ;;
13885 esac
13886
13887 : see if gettimeofday or ftime exists
13888 set gettimeofday d_gettimeod
13889 eval $inlibc
13890 case "$d_gettimeod" in
13891 "$undef")
13892         set ftime d_ftime 
13893         eval $inlibc
13894         ;;
13895 *)
13896         val="$undef"; set d_ftime; eval $setvar
13897         ;;
13898 esac
13899 case "$d_gettimeod$d_ftime" in
13900 "$undef$undef")
13901         echo " "
13902         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
13903         ;;
13904 esac
13905
13906 : see if gmtime_r exists
13907 set gmtime_r d_gmtime_r
13908 eval $inlibc
13909 case "$d_gmtime_r" in
13910 "$define")
13911         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13912         case "$d_gmtime_r_proto:$usethreads" in
13913         ":define")      d_gmtime_r_proto=define
13914                 set d_gmtime_r_proto gmtime_r $hdrs
13915                 eval $hasproto ;;
13916         *)      ;;
13917         esac
13918         case "$d_gmtime_r_proto" in
13919         define)
13920         case "$gmtime_r_proto" in
13921         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
13922         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
13923         esac
13924         case "$gmtime_r_proto" in
13925         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
13926         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
13927         esac
13928         case "$gmtime_r_proto" in
13929         ''|0)   d_gmtime_r=undef
13930                 gmtime_r_proto=0
13931                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
13932         * )     case "$gmtime_r_proto" in
13933                 REENTRANT_PROTO*) ;;
13934                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
13935                 esac
13936                 echo "Prototype: $try" ;;
13937         esac
13938         ;;
13939         *)      case "$usethreads" in
13940                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
13941                 esac
13942                 d_gmtime_r=undef
13943                 gmtime_r_proto=0
13944                 ;;
13945         esac
13946         ;;
13947 *)      gmtime_r_proto=0
13948         ;;
13949 esac
13950
13951 : see if hasmntopt exists
13952 set hasmntopt d_hasmntopt
13953 eval $inlibc
13954
13955 : see if this is a netinet/in.h or sys/in.h system
13956 set netinet/in.h i_niin sys/in.h i_sysin
13957 eval $inhdr
13958
13959 : see if arpa/inet.h has to be included
13960 set arpa/inet.h i_arpainet
13961 eval $inhdr
13962
13963 : see if htonl --and friends-- exists
13964 val=''
13965 set htonl val
13966 eval $inlibc
13967
13968 : Maybe they are macros.
13969 case "$val" in
13970 $undef)
13971         $cat >htonl.c <<EOM
13972 #include <stdio.h>
13973 #include <sys/types.h>
13974 #$i_niin I_NETINET_IN
13975 #$i_sysin I_SYS_IN
13976 #$i_arpainet I_ARPA_INET
13977 #ifdef I_NETINET_IN
13978 #include <netinet/in.h>
13979 #endif
13980 #ifdef I_SYS_IN
13981 #include <sys/in.h>
13982 #endif
13983 #ifdef I_ARPA_INET
13984 #include <arpa/inet.h>
13985 #endif
13986 #ifdef htonl
13987 printf("Defined as a macro.");
13988 #endif
13989 EOM
13990         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
13991         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
13992                 val="$define"
13993                 echo "But it seems to be defined as a macro." >&4
13994         fi
13995         $rm -f htonl.?
13996         ;;
13997 esac
13998 set d_htonl
13999 eval $setvar
14000
14001 : see if ilogbl exists
14002 set ilogbl d_ilogbl
14003 eval $inlibc
14004
14005 : index or strchr
14006 echo " "
14007 if set index val -f; eval $csym; $val; then
14008         if set strchr val -f d_strchr; eval $csym; $val; then
14009                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14010                         val="$define"
14011                         vali="$undef"
14012                         echo "strchr() found." >&4
14013                 else
14014                         val="$undef"
14015                         vali="$define"
14016                         echo "index() found." >&4
14017                 fi
14018         else
14019                 val="$undef"
14020                 vali="$define"
14021                 echo "index() found." >&4
14022         fi
14023 else
14024         if set strchr val -f d_strchr; eval $csym; $val; then
14025                 val="$define"
14026                 vali="$undef"
14027                 echo "strchr() found." >&4
14028         else
14029                 echo "No index() or strchr() found!" >&4
14030                 val="$undef"
14031                 vali="$undef"
14032         fi
14033 fi
14034 set d_strchr; eval $setvar
14035 val="$vali"
14036 set d_index; eval $setvar
14037
14038 : check whether inet_aton exists
14039 set inet_aton d_inetaton
14040 eval $inlibc
14041
14042 : Look for isascii
14043 echo " "
14044 $cat >isascii.c <<EOCP
14045 #include <stdio.h>
14046 #include <ctype.h>
14047 #$i_stdlib I_STDLIB
14048 #ifdef I_STDLIB
14049 #include <stdlib.h>
14050 #endif
14051 int main() {
14052         int c = 'A';
14053         if (isascii(c))
14054                 exit(0);
14055         else
14056                 exit(1);
14057 }
14058 EOCP
14059 set isascii
14060 if eval $compile; then
14061         echo "isascii() found." >&4
14062         val="$define"
14063 else
14064         echo "isascii() NOT found." >&4
14065         val="$undef"
14066 fi
14067 set d_isascii
14068 eval $setvar
14069 $rm -f isascii*
14070
14071 : see if isfinite exists
14072 set isfinite d_isfinite
14073 eval $inlibc
14074
14075 : see if isinf exists
14076 set isinf d_isinf
14077 eval $inlibc
14078
14079 : see if isnan exists
14080 set isnan d_isnan
14081 eval $inlibc
14082
14083 : see if isnanl exists
14084 set isnanl d_isnanl
14085 eval $inlibc
14086
14087 : see if killpg exists
14088 set killpg d_killpg
14089 eval $inlibc
14090
14091 : see if lchown exists
14092 echo " "
14093 $cat > try.c <<'EOCP'
14094 /* System header to define __stub macros and hopefully few prototypes,
14095     which can conflict with char lchown(); below.  */
14096 #include <assert.h>
14097 /* Override any gcc2 internal prototype to avoid an error.  */
14098 /* We use char because int might match the return type of a gcc2
14099    builtin and then its argument prototype would still apply.  */
14100 char lchown();
14101 int main() {
14102     /*  The GNU C library defines this for functions which it implements
14103         to always fail with ENOSYS.  Some functions are actually named
14104         something starting with __ and the normal name is an alias.  */
14105 #if defined (__stub_lchown) || defined (__stub___lchown)
14106 choke me
14107 #else
14108 lchown();
14109 #endif
14110 ; return 0; }
14111 EOCP
14112 set try
14113 if eval $compile; then
14114     $echo "lchown() found." >&4
14115     val="$define"
14116 else
14117     $echo "lchown() NOT found." >&4
14118     val="$undef"
14119 fi
14120 set d_lchown
14121 eval $setvar
14122
14123 : See if number of significant digits in a double precision number is known
14124 echo " "
14125 $cat >ldbl_dig.c <<EOM
14126 #$i_limits I_LIMITS
14127 #$i_float I_FLOAT
14128 #ifdef I_LIMITS
14129 #include <limits.h>
14130 #endif
14131 #ifdef I_FLOAT
14132 #include <float.h>
14133 #endif
14134 #ifdef LDBL_DIG
14135 printf("Contains LDBL_DIG");
14136 #endif
14137 EOM
14138 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14139 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14140         echo "LDBL_DIG found." >&4
14141         val="$define"
14142 else
14143         echo "LDBL_DIG NOT found." >&4
14144         val="$undef"
14145 fi
14146 $rm -f ldbl_dig.?
14147 set d_ldbl_dig
14148 eval $setvar
14149
14150 : see if this is a math.h system
14151 set math.h i_math
14152 eval $inhdr
14153
14154 d_libm_lib_version="$undef"
14155 case $i_math in
14156     $define)
14157         : check to see if math.h defines _LIB_VERSION
14158         echo " "
14159         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14160         $cat >try.c <<EOCP
14161 #include <unistd.h>
14162 #include <math.h>
14163 int main (int argc, char *argv[])
14164 {
14165     printf ("%d\n", _LIB_VERSION);
14166     return (0);
14167     } /* main */
14168 EOCP
14169         set try
14170         if eval $compile; then
14171             foo=`$run ./try`
14172             echo "Yes, it does ($foo)" >&4
14173             d_libm_lib_version="$define"
14174         else
14175             echo "No, it does not (probably harmless)\n" >&4
14176             fi
14177         $rm -f try.* try core core.try.*
14178         ;;
14179
14180     esac
14181
14182 : see if link exists
14183 set link d_link
14184 eval $inlibc
14185
14186 : see if localtime_r exists
14187 set localtime_r d_localtime_r
14188 eval $inlibc
14189 case "$d_localtime_r" in
14190 "$define")
14191         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14192         case "$d_localtime_r_proto:$usethreads" in
14193         ":define")      d_localtime_r_proto=define
14194                 set d_localtime_r_proto localtime_r $hdrs
14195                 eval $hasproto ;;
14196         *)      ;;
14197         esac
14198         case "$d_localtime_r_proto" in
14199         define)
14200         case "$localtime_r_proto" in
14201         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14202         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14203         esac
14204         case "$localtime_r_proto" in
14205         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14206         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14207         esac
14208         case "$localtime_r_proto" in
14209         ''|0)   d_localtime_r=undef
14210                 localtime_r_proto=0
14211                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14212         * )     case "$localtime_r_proto" in
14213                 REENTRANT_PROTO*) ;;
14214                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14215                 esac
14216                 echo "Prototype: $try" ;;
14217         esac
14218         ;;
14219         *)      case "$usethreads" in
14220                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14221                 esac
14222                 d_localtime_r=undef
14223                 localtime_r_proto=0
14224                 ;;
14225         esac
14226         ;;
14227 *)      localtime_r_proto=0
14228         ;;
14229 esac
14230
14231 : see if localeconv exists
14232 set localeconv d_locconv
14233 eval $inlibc
14234
14235 : see if lockf exists
14236 set lockf d_lockf
14237 eval $inlibc
14238
14239 : see if prototype for lseek is available
14240 echo " "
14241 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14242 eval $hasproto
14243
14244 : see if lstat exists
14245 set lstat d_lstat
14246 eval $inlibc
14247
14248 : see if madvise exists
14249 set madvise d_madvise
14250 eval $inlibc
14251
14252 : see if malloc_size exists
14253 set malloc_size d_malloc_size
14254 eval $inlibc
14255
14256 : see if malloc_size_good exists
14257 set malloc_good_size d_malloc_good_size
14258 eval $inlibc
14259
14260 : see if mblen exists
14261 set mblen d_mblen
14262 eval $inlibc
14263
14264 : see if mbstowcs exists
14265 set mbstowcs d_mbstowcs
14266 eval $inlibc
14267
14268 : see if mbtowc exists
14269 set mbtowc d_mbtowc
14270 eval $inlibc
14271
14272 : see if memchr exists
14273 set memchr d_memchr
14274 eval $inlibc
14275
14276 : see if memcmp exists
14277 set memcmp d_memcmp
14278 eval $inlibc
14279
14280 : see if memcpy exists
14281 set memcpy d_memcpy
14282 eval $inlibc
14283
14284 : see if memmove exists
14285 set memmove d_memmove
14286 eval $inlibc
14287
14288 : see if memset exists
14289 set memset d_memset
14290 eval $inlibc
14291
14292 : see if mkdir exists
14293 set mkdir d_mkdir
14294 eval $inlibc
14295
14296 : see if mkdtemp exists
14297 set mkdtemp d_mkdtemp
14298 eval $inlibc
14299
14300 : see if mkfifo exists
14301 set mkfifo d_mkfifo
14302 eval $inlibc
14303
14304 : see if mkstemp exists
14305 set mkstemp d_mkstemp
14306 eval $inlibc
14307
14308 : see if mkstemps exists
14309 set mkstemps d_mkstemps
14310 eval $inlibc
14311
14312 : see if mktime exists
14313 set mktime d_mktime
14314 eval $inlibc
14315
14316 : see if this is a sys/mman.h system
14317 set sys/mman.h i_sysmman
14318 eval $inhdr
14319
14320 : see if mmap exists
14321 set mmap d_mmap
14322 eval $inlibc
14323 : see what shmat returns
14324 : default to something harmless
14325 mmaptype='void *'
14326 case "$i_sysmman$d_mmap" in
14327 "$define$define")
14328         $cat >mmap.c <<'END'
14329 #include <sys/mman.h>
14330 void *mmap();
14331 END
14332         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14333                 mmaptype='void *'
14334         else
14335                 mmaptype='caddr_t'
14336         fi
14337         echo "and it returns ($mmaptype)." >&4
14338         ;;
14339 esac
14340
14341
14342
14343 : see if sqrtl exists
14344 set sqrtl d_sqrtl
14345 eval $inlibc
14346
14347 : see if scalbnl exists
14348 set scalbnl d_scalbnl
14349 eval $inlibc
14350
14351 : see if modfl exists
14352 set modfl d_modfl
14353 eval $inlibc
14354
14355 : see if prototype for modfl is available
14356 echo " "
14357 set d_modflproto modfl $i_math math.h
14358 eval $hasproto
14359
14360 d_modfl_pow32_bug="$undef"
14361
14362 case "$d_longdbl$d_modfl" in
14363 $define$define)
14364         $cat <<EOM
14365 Checking to see whether your modfl() is okay for large values...
14366 EOM
14367 $cat >try.c <<EOCP
14368 #include <math.h> 
14369 #include <stdio.h>
14370 EOCP
14371 if $test "X$d_modflproto" != "X$define"; then
14372         $cat >>try.c <<EOCP
14373 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
14374 long double modfl (long double, long double *);
14375 EOCP
14376 fi
14377 $cat >>try.c <<EOCP
14378 int main() {
14379     long double nv = 4294967303.15;
14380     long double v, w;
14381     v = modfl(nv, &w);         
14382 #ifdef __GLIBC__
14383     printf("glibc");
14384 #endif
14385     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14386     return 0;
14387 }
14388 EOCP
14389         case "$osname:$gccversion" in
14390         aix:)   saveccflags="$ccflags"
14391                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14392         esac
14393         set try
14394         if eval $compile; then
14395                 foo=`$run ./try`
14396                 case "$foo" in
14397                 *" 4294967303.150000 1.150000 4294967302.000000")
14398                         echo >&4 "Your modfl() is broken for large values."
14399                         d_modfl_pow32_bug="$define"
14400                         case "$foo" in
14401                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14402                         ;;
14403                         esac
14404                         ;;
14405                 *" 4294967303.150000 0.150000 4294967303.000000")
14406                         echo >&4 "Your modfl() seems okay for large values."
14407                         ;;
14408                 *)      echo >&4 "I don't understand your modfl() at all."
14409                         d_modfl="$undef"
14410                         ;;
14411                 esac
14412                 $rm -f try.* try core core.try.*
14413         else
14414                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14415                 d_modfl="$undef"
14416         fi
14417         case "$osname:$gccversion" in
14418         aix:)   ccflags="$saveccflags" ;; # restore
14419         esac
14420         ;;
14421 esac
14422
14423 if $test "$uselongdouble" = "$define"; then
14424     message=""
14425     if $test "$d_sqrtl" != "$define"; then
14426         message="$message sqrtl"
14427     fi
14428     if $test "$d_modfl" != "$define"; then
14429         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14430             echo "You have both aintl and copysignl, so I can emulate modfl."
14431         else
14432             message="$message modfl"
14433         fi
14434     fi
14435     if $test "$d_frexpl" != "$define"; then
14436         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14437             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14438         else
14439             message="$message frexpl"
14440         fi
14441     fi
14442
14443     if $test "$message" != ""; then
14444         $cat <<EOM >&4
14445
14446 *** You requested the use of long doubles but you do not seem to have
14447 *** the following mathematical functions needed for long double support:
14448 ***    $message
14449 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14450 *** Cannot continue, aborting.
14451
14452 EOM
14453
14454         exit 1
14455     fi
14456 fi
14457
14458 : see if mprotect exists
14459 set mprotect d_mprotect
14460 eval $inlibc
14461
14462 : see if msgctl exists
14463 set msgctl d_msgctl
14464 eval $inlibc
14465
14466 : see if msgget exists
14467 set msgget d_msgget
14468 eval $inlibc
14469
14470 : see if msgsnd exists
14471 set msgsnd d_msgsnd
14472 eval $inlibc
14473
14474 : see if msgrcv exists
14475 set msgrcv d_msgrcv
14476 eval $inlibc
14477
14478 : see how much of the 'msg*(2)' library is present.
14479 h_msg=true
14480 echo " "
14481 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14482 *"$undef"*) h_msg=false;;
14483 esac
14484 case "$osname" in
14485 freebsd)
14486     case "`ipcs 2>&1`" in
14487     "SVID messages"*"not configured"*)
14488         echo "Your $osname does not have the msg*(2) configured." >&4
14489         h_msg=false
14490         val="$undef"
14491         set msgctl d_msgctl
14492         eval $setvar
14493         set msgget d_msgget
14494         eval $setvar
14495         set msgsnd d_msgsnd
14496         eval $setvar
14497         set msgrcv d_msgrcv
14498         eval $setvar
14499         ;;
14500     esac
14501     ;;
14502 esac
14503 : we could also check for sys/ipc.h ...
14504 if $h_msg && $test `./findhdr sys/msg.h`; then
14505         echo "You have the full msg*(2) library." >&4
14506         val="$define"
14507 else
14508         echo "You don't have the full msg*(2) library." >&4
14509         val="$undef"
14510 fi
14511 set d_msg
14512 eval $setvar
14513
14514
14515 echo " "
14516 echo "Checking to see if your system supports struct msghdr..." >&4
14517 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14518 eval $hasstruct
14519 case "$d_msghdr_s" in
14520 "$define")      echo "Yes, it does."   ;;
14521 *)              echo "No, it doesn't." ;;
14522 esac
14523
14524
14525 : see if msync exists
14526 set msync d_msync
14527 eval $inlibc
14528
14529 : see if munmap exists
14530 set munmap d_munmap
14531 eval $inlibc
14532
14533 : see if nice exists
14534 set nice d_nice
14535 eval $inlibc
14536
14537 : see if this is a langinfo.h system
14538 set langinfo.h i_langinfo
14539 eval $inhdr
14540
14541 : see if nl_langinfo exists
14542 set nl_langinfo d_nl_langinfo
14543 eval $inlibc
14544
14545 : check for length of character
14546 echo " "
14547 case "$charsize" in
14548 '')
14549         echo "Checking to see how big your characters are (hey, you never know)..." >&4
14550         $cat >try.c <<EOCP
14551 #include <stdio.h>
14552 #$i_stdlib I_STDLIB
14553 #ifdef I_STDLIB
14554 #include <stdlib.h>
14555 #endif
14556 int main()
14557 {
14558     printf("%d\n", (int)sizeof(char));
14559     exit(0);
14560 }
14561 EOCP
14562         set try
14563         if eval $compile_ok; then
14564                 dflt=`$run ./try`
14565         else
14566                 dflt='1'
14567                 echo "(I can't seem to compile the test program.  Guessing...)"
14568         fi
14569         ;;
14570 *)
14571         dflt="$charsize"
14572         ;;
14573 esac
14574 rp="What is the size of a character (in bytes)?"
14575 . ./myread
14576 charsize="$ans"
14577 $rm -f try.c try
14578
14579 : check for volatile keyword
14580 echo " "
14581 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
14582 $cat >try.c <<'EOCP'
14583 int main()
14584 {
14585         typedef struct _goo_struct goo_struct;
14586         goo_struct * volatile goo = ((goo_struct *)0);
14587         struct _goo_struct {
14588                 long long_int;
14589                 int reg_int;
14590                 char char_var;
14591         };
14592         typedef unsigned short foo_t;
14593         char *volatile foo;
14594         volatile int bar;
14595         volatile foo_t blech;
14596         foo = foo;
14597 }
14598 EOCP
14599 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
14600         val="$define"
14601         echo "Yup, it does."
14602 else
14603         val="$undef"
14604         echo "Nope, it doesn't."
14605 fi
14606 set d_volatile
14607 eval $setvar
14608 $rm -f try.*
14609
14610
14611 echo " "
14612 $echo "Choosing the C types to be used for Perl's internal types..." >&4
14613
14614 case "$use64bitint:$d_quad:$quadtype" in
14615 define:define:?*)
14616         ivtype="$quadtype"
14617         uvtype="$uquadtype"
14618         ivsize=8
14619         uvsize=8
14620         ;;
14621 *)      ivtype="long"
14622         uvtype="unsigned long"
14623         ivsize=$longsize
14624         uvsize=$longsize
14625         ;;
14626 esac
14627
14628 case "$uselongdouble:$d_longdbl" in
14629 define:define)
14630         nvtype="long double"
14631         nvsize=$longdblsize
14632         ;;
14633 *)      nvtype=double
14634         nvsize=$doublesize
14635         ;;
14636 esac
14637
14638 $echo "(IV will be "$ivtype", $ivsize bytes)"
14639 $echo "(UV will be "$uvtype", $uvsize bytes)"
14640 $echo "(NV will be "$nvtype", $nvsize bytes)"
14641
14642 $cat >try.c <<EOCP
14643 #$i_inttypes I_INTTYPES
14644 #ifdef I_INTTYPES
14645 #include <inttypes.h>
14646 #endif
14647 #include <stdio.h>
14648 int main() {
14649 #ifdef INT8
14650    int8_t i =  INT8_MAX;
14651   uint8_t u = UINT8_MAX;
14652   printf("int8_t\n");
14653 #endif
14654 #ifdef INT16
14655    int16_t i =  INT16_MAX;
14656   uint16_t i = UINT16_MAX;
14657   printf("int16_t\n");
14658 #endif
14659 #ifdef INT32
14660    int32_t i =  INT32_MAX;
14661   uint32_t u = UINT32_MAX;
14662   printf("int32_t\n");
14663 #endif
14664 }
14665 EOCP
14666
14667 case "$i8type" in
14668 '')     case "$charsize" in
14669         1)      i8type=char
14670                 u8type="unsigned char"
14671                 i8size=$charsize
14672                 u8size=$charsize
14673                 ;;
14674         esac
14675         ;;
14676 esac
14677 case "$i8type" in
14678 '')     set try -DINT8
14679         if eval $compile; then
14680                 case "`$run ./try`" in
14681                 int8_t) i8type=int8_t
14682                         u8type=uint8_t
14683                         i8size=1
14684                         u8size=1
14685                         ;;
14686                 esac
14687         fi
14688         ;;
14689 esac
14690 case "$i8type" in
14691 '')     if $test $charsize -ge 1; then
14692                 i8type=char
14693                 u8type="unsigned char"
14694                 i8size=$charsize
14695                 u8size=$charsize
14696         fi
14697         ;;
14698 esac
14699
14700 case "$i16type" in
14701 '')     case "$shortsize" in
14702         2)      i16type=short
14703                 u16type="unsigned short"
14704                 i16size=$shortsize
14705                 u16size=$shortsize
14706                 ;;
14707         esac
14708         ;;
14709 esac
14710 case "$i16type" in
14711 '')     set try -DINT16
14712         if eval $compile; then
14713                 case "`$run ./try`" in
14714                 int16_t)
14715                         i16type=int16_t
14716                         u16type=uint16_t
14717                         i16size=2
14718                         u16size=2
14719                         ;;
14720                 esac
14721         fi
14722         ;;
14723 esac
14724 case "$i16type" in
14725 '')     if $test $shortsize -ge 2; then
14726                 i16type=short
14727                 u16type="unsigned short"
14728                 i16size=$shortsize
14729                 u16size=$shortsize
14730         fi
14731         ;;
14732 esac
14733
14734 case "$i32type" in
14735 '')     case "$longsize" in
14736         4)      i32type=long
14737                 u32type="unsigned long"
14738                 i32size=$longsize
14739                 u32size=$longsize
14740                 ;;
14741         *)      case "$intsize" in
14742                 4)      i32type=int
14743                         u32type="unsigned int"
14744                         i32size=$intsize
14745                         u32size=$intsize
14746                         ;;
14747                 esac
14748                 ;;
14749         esac
14750         ;;
14751 esac
14752 case "$i32type" in
14753 '')     set try -DINT32
14754         if eval $compile; then
14755                 case "`$run ./try`" in
14756                 int32_t)
14757                         i32type=int32_t
14758                         u32type=uint32_t
14759                         i32size=4
14760                         u32size=4
14761                         ;;
14762                 esac
14763         fi
14764         ;;
14765 esac
14766 case "$i32type" in
14767 '')     if $test $intsize -ge 4; then
14768                 i32type=int
14769                 u32type="unsigned int"
14770                 i32size=$intsize
14771                 u32size=$intsize
14772         fi
14773         ;;
14774 esac
14775
14776 case "$i64type" in
14777 '')     case "$d_quad:$quadtype" in
14778         define:?*)
14779                 i64type="$quadtype"
14780                 u64type="$uquadtype"
14781                 i64size=8
14782                 u64size=8
14783                 ;;
14784         esac
14785         ;;
14786 esac
14787
14788 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
14789 : volatile so that the compiler has to store it out to memory.
14790 if test X"$d_volatile" = X"$define"; then
14791         volatile=volatile
14792 fi
14793 $cat <<EOP >try.c
14794 #include <stdio.h>
14795 #$i_stdlib I_STDLIB
14796 #ifdef I_STDLIB
14797 #include <stdlib.h>
14798 #endif
14799 #include <sys/types.h>
14800 #include <signal.h>
14801 #ifdef SIGFPE
14802 $volatile int bletched = 0;
14803 $signal_t blech(s) int s; { bletched = 1; }
14804 #endif
14805 int main() {
14806     $uvtype u = 0;
14807     $nvtype d;
14808     int     n = 8 * $uvsize;
14809     int     i;
14810 #ifdef SIGFPE
14811     signal(SIGFPE, blech);
14812 #endif
14813
14814     for (i = 0; i < n; i++) {
14815       u = u << 1 | ($uvtype)1;
14816       d = ($nvtype)u;
14817       if (($uvtype)d != u)
14818         break;
14819       if (d <= 0)
14820         break;
14821       d = ($nvtype)(u - 1);
14822       if (($uvtype)d != (u - 1))
14823         break;
14824 #ifdef SIGFPE
14825       if (bletched) {
14826         break;
14827 #endif
14828       } 
14829     }
14830     printf("%d\n", ((i == n) ? -n : i));
14831     exit(0);
14832 }
14833 EOP
14834 set try
14835
14836 d_nv_preserves_uv="$undef"
14837 if eval $compile; then
14838         nv_preserves_uv_bits="`$run ./try`"
14839 fi
14840 case "$nv_preserves_uv_bits" in
14841 \-[1-9]*)       
14842         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
14843         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
14844         d_nv_preserves_uv="$define"
14845         ;;
14846 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
14847         d_nv_preserves_uv="$undef" ;;
14848 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
14849         nv_preserves_uv_bits="$undef" ;;
14850 esac
14851
14852 $rm -f try.* try
14853
14854 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
14855 : volatile so that the compiler has to store it out to memory.
14856 if test X"$d_volatile" = X"$define"; then
14857         volatile=volatile
14858 fi
14859 $cat <<EOP >try.c
14860 #include <stdio.h>
14861 #$i_stdlib I_STDLIB
14862 #ifdef I_STDLIB
14863 #include <stdlib.h>
14864 #endif
14865 #$i_string I_STRING
14866 #ifdef I_STRING
14867 #  include <string.h>
14868 #else
14869 #  include <strings.h>
14870 #endif
14871 #include <sys/types.h>
14872 #include <signal.h>
14873 #ifdef SIGFPE
14874 $volatile int bletched = 0;
14875 $signal_t blech(s) int s; { bletched = 1; }
14876 #endif
14877
14878 int checkit($nvtype d, char *where) {
14879     unsigned char *p = (char *)&d;
14880     unsigned char *end = p + sizeof(d);
14881     int fail = 0;
14882
14883     while (p < end)
14884         fail += *p++;
14885
14886     if (!fail)
14887         return 0;
14888
14889     p = (char *)&d;
14890     printf("No - %s: 0x", where);
14891     while (p < end)
14892         printf ("%02X", *p++);
14893     printf("\n");
14894     return 1;
14895 }
14896
14897 int main(int argc, char **argv) {
14898     $nvtype d = 0.0;
14899     int fail = 0;
14900     fail += checkit(d, "0.0");
14901
14902     /* The compiler shouldn't be assuming that bletched is 0  */
14903     d = bletched;
14904
14905     fail += checkit(d, "bleched");
14906
14907 #ifdef SIGFPE
14908     signal(SIGFPE, blech);
14909 #endif
14910
14911     /* Paranoia - the compiler should have no way of knowing that ANSI says
14912        that argv[argc] will always be NULL.  Actually, if it did assume this it
14913        would be buggy, as this is C and main() can be called from elsewhere in
14914        the program.  */
14915     d = argv[argc] ? 1 : 0;
14916
14917     if (d) {
14918         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
14919     }
14920
14921     fail += checkit(d, "ternary");
14922
14923     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
14924
14925     if (d != 0.0) {
14926         printf("No - memset doesn't give 0.0\n");
14927         /* This might just blow up:  */
14928         printf("(gives %g)\n", d);
14929         return 1;
14930     }
14931     
14932 #ifdef SIGFPE
14933     if (bletched) {
14934         printf("No - something bleched\n");
14935         return 1;
14936     }
14937 #endif
14938     if (fail) {
14939       printf("No - %d fail(s)\n", fail);
14940       return 1;
14941     }
14942     printf("Yes\n");
14943     return 0;
14944 }
14945 EOP
14946 set try
14947
14948 d_nv_zero_is_allbits_zero="$undef"
14949 if eval $compile; then
14950     xxx="`$run ./try`"
14951     case "$?" in
14952         0)
14953             case "$xxx" in
14954                 Yes)  cat >&4 <<EOM
14955 0.0 is represented as all bits zero in memory
14956 EOM
14957                     d_nv_zero_is_allbits_zero="$define"
14958                     ;;
14959                 *)  cat >&4 <<EOM
14960 0.0 is not represented as all bits zero in memory
14961 EOM
14962                     d_nv_zero_is_allbits_zero="$undef"
14963                     ;;
14964             esac
14965             ;;
14966         *)  cat >&4 <<EOM
14967 0.0 is not represented as all bits zero in memory
14968 EOM
14969             d_nv_zero_is_allbits_zero="$undef"
14970             ;;
14971     esac
14972 fi
14973
14974 $rm -f try.* try
14975
14976
14977 : check for off64_t
14978 echo " "
14979 echo "Checking to see if you have off64_t..." >&4
14980 $cat >try.c <<EOCP
14981 #include <sys/types.h>
14982 #include <unistd.h>
14983 int main() { off64_t x = 7; }
14984 EOCP
14985 set try
14986 if eval $compile; then
14987         val="$define"
14988         echo "You have off64_t."
14989 else
14990         val="$undef"
14991         echo "You do not have off64_t."
14992         case "$lseeksize" in
14993         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
14994         esac
14995 fi
14996 $rm -f try.* try
14997 set d_off64_t
14998 eval $setvar
14999
15000 : how to create joinable pthreads
15001 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15002         echo " "
15003         echo "Checking what constant to use for creating joinable pthreads..." >&4 
15004         $cat >try.c <<'EOCP'
15005 #include <pthread.h>
15006 int main() {
15007     int detachstate = JOINABLE;
15008 }
15009 EOCP
15010         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15011         if eval $compile; then
15012                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15013                 val="$undef" # Yes, undef.
15014                 set d_old_pthread_create_joinable
15015                 eval $setvar
15016                 val=""
15017                 set old_pthread_create_joinable
15018                 eval $setvar
15019         else
15020                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15021                 if eval $compile; then
15022                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15023                         val="$define"
15024                         set d_old_pthread_create_joinable
15025                         eval $setvar
15026                         val=PTHREAD_CREATE_UNDETACHED
15027                         set old_pthread_create_joinable
15028                         eval $setvar
15029                 else            
15030                         set try -DJOINABLE=__UNDETACHED
15031                         if eval $compile; then
15032                                 echo "You seem to use __UNDETACHED." >&4
15033                                 val="$define"
15034                                 set d_old_pthread_create_joinable
15035                                 eval $setvar
15036                                 val=__UNDETACHED
15037                                 set old_pthread_create_joinable
15038                                 eval $setvar
15039                         else
15040                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15041                                 val="$define"
15042                                 set d_old_pthread_create_joinable
15043                                 eval $setvar
15044                                 val=0
15045                                 set old_pthread_create_joinable
15046                                 eval $setvar
15047                         fi
15048                 fi
15049         fi
15050         $rm -f try try.*
15051 else
15052     d_old_pthread_create_joinable="$undef"
15053     old_pthread_create_joinable=""
15054 fi
15055
15056 : see if pause exists
15057 set pause d_pause
15058 eval $inlibc
15059
15060 : see if pipe exists
15061 set pipe d_pipe
15062 eval $inlibc
15063
15064 : see if poll exists
15065 set poll d_poll
15066 eval $inlibc
15067
15068 : see if readlink exists
15069 set readlink d_readlink
15070 eval $inlibc
15071
15072 echo " "
15073 procselfexe=''
15074 val="$undef"
15075 case "$d_readlink" in
15076 "$define")
15077         if $issymlink /proc/self/exe ; then
15078                 $ls -l /proc/self/exe > reflect
15079                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15080                         echo "You have Linux-like /proc/self/exe."
15081                         procselfexe='"/proc/self/exe"'
15082                         val="$define"
15083                 fi
15084         fi
15085         if $issymlink /proc/curproc/file ; then
15086                 $ls -l /proc/curproc/file > reflect
15087                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15088                         echo "You have BSD-like /proc/curproc/file."
15089                         procselfexe='"/proc/curproc/file"'
15090                         val="$define"
15091                 fi
15092         fi
15093         ;;
15094 esac
15095 $rm -f reflect
15096 set d_procselfexe
15097 eval $setvar
15098
15099 : see whether the pthread_atfork exists
15100 $cat >try.c <<EOP
15101 #include <pthread.h>
15102 #include <stdio.h>
15103 int main() {
15104 #ifdef  PTHREAD_ATFORK
15105         pthread_atfork(NULL,NULL,NULL);
15106 #endif
15107 }
15108 EOP
15109
15110 : see if pthread_atfork exists
15111 set try -DPTHREAD_ATFORK
15112 if eval $compile; then
15113     val="$define"
15114 else
15115     val="$undef"
15116 fi
15117 case "$usethreads" in
15118 $define)
15119         case "$val" in
15120         $define) echo 'pthread_atfork found.' >&4        ;;
15121         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15122         esac
15123 esac
15124 set d_pthread_atfork
15125 eval $setvar
15126
15127 : see if pthread_attr_setscope exists
15128 set pthread_attr_setscope d_pthread_attr_setscope
15129 eval $inlibc
15130
15131
15132 : see whether the various POSIXish _yields exist
15133 $cat >try.c <<EOP
15134 #include <pthread.h>
15135 #include <stdio.h>
15136 int main() {
15137 #ifdef SCHED_YIELD
15138         sched_yield();
15139 #else
15140 #ifdef PTHREAD_YIELD
15141         pthread_yield();
15142 #else
15143 #ifdef PTHREAD_YIELD_NULL
15144         pthread_yield(NULL);
15145 #endif
15146 #endif
15147 #endif
15148 }
15149 EOP
15150 : see if sched_yield exists
15151 set try -DSCHED_YIELD
15152 if eval $compile; then
15153     val="$define"
15154     sched_yield='sched_yield()'
15155 else
15156     val="$undef"
15157 fi
15158 case "$usethreads" in
15159 $define)
15160         case "$val" in
15161         $define) echo 'sched_yield() found.' >&4        ;;
15162         *)       echo 'sched_yield() NOT found.' >&4    ;;
15163         esac
15164 esac
15165 set d_sched_yield
15166 eval $setvar
15167
15168 : see if pthread_yield exists
15169 set try -DPTHREAD_YIELD
15170 if eval $compile; then
15171     val="$define"
15172     case "$sched_yield" in
15173     '') sched_yield='pthread_yield()' ;;
15174     esac
15175 else
15176     set try -DPTHREAD_YIELD_NULL
15177     if eval $compile; then
15178         val="$define"
15179         case "$sched_yield" in
15180         '') sched_yield='pthread_yield(NULL)' ;;
15181         esac
15182     else
15183         val="$undef"
15184     fi
15185 fi
15186 case "$usethreads" in
15187 $define)
15188         case "$val" in
15189         $define) echo 'pthread_yield() found.' >&4      ;;
15190         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15191         esac
15192         ;;
15193 esac
15194 set d_pthread_yield
15195 eval $setvar
15196
15197 case "$sched_yield" in
15198 '') sched_yield=undef ;;
15199 esac
15200
15201 $rm -f try try.*
15202
15203 : see if random_r exists
15204 set random_r d_random_r
15205 eval $inlibc
15206 case "$d_random_r" in
15207 "$define")
15208         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15209         case "$d_random_r_proto:$usethreads" in
15210         ":define")      d_random_r_proto=define
15211                 set d_random_r_proto random_r $hdrs
15212                 eval $hasproto ;;
15213         *)      ;;
15214         esac
15215         case "$d_random_r_proto" in
15216         define)
15217         case "$random_r_proto" in
15218         ''|0) try='int random_r(int*, struct random_data*);'
15219         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15220         esac
15221         case "$random_r_proto" in
15222         ''|0) try='int random_r(long*, struct random_data*);'
15223         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15224         esac
15225         case "$random_r_proto" in
15226         ''|0) try='int random_r(struct random_data*, int32_t*);'
15227         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15228         esac
15229         case "$random_r_proto" in
15230         ''|0)   d_random_r=undef
15231                 random_r_proto=0
15232                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
15233         * )     case "$random_r_proto" in
15234                 REENTRANT_PROTO*) ;;
15235                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15236                 esac
15237                 echo "Prototype: $try" ;;
15238         esac
15239         ;;
15240         *)      case "$usethreads" in
15241                 define) echo "random_r has no prototype, not using it." >&4 ;;
15242                 esac
15243                 d_random_r=undef
15244                 random_r_proto=0
15245                 ;;
15246         esac
15247         ;;
15248 *)      random_r_proto=0
15249         ;;
15250 esac
15251
15252 : see if readdir and friends exist
15253 set readdir d_readdir
15254 eval $inlibc
15255 set seekdir d_seekdir
15256 eval $inlibc
15257 set telldir d_telldir
15258 eval $inlibc
15259 set rewinddir d_rewinddir
15260 eval $inlibc
15261
15262 : see if readdir64_r exists
15263 set readdir64_r d_readdir64_r
15264 eval $inlibc
15265 case "$d_readdir64_r" in
15266 "$define")
15267         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15268         case "$d_readdir64_r_proto:$usethreads" in
15269         ":define")      d_readdir64_r_proto=define
15270                 set d_readdir64_r_proto readdir64_r $hdrs
15271                 eval $hasproto ;;
15272         *)      ;;
15273         esac
15274         case "$d_readdir64_r_proto" in
15275         define)
15276         case "$readdir64_r_proto" in
15277         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15278         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15279         esac
15280         case "$readdir64_r_proto" in
15281         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15282         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15283         esac
15284         case "$readdir64_r_proto" in
15285         ''|0)   d_readdir64_r=undef
15286                 readdir64_r_proto=0
15287                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
15288         * )     case "$readdir64_r_proto" in
15289                 REENTRANT_PROTO*) ;;
15290                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15291                 esac
15292                 echo "Prototype: $try" ;;
15293         esac
15294         ;;
15295         *)      case "$usethreads" in
15296                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15297                 esac
15298                 d_readdir64_r=undef
15299                 readdir64_r_proto=0
15300                 ;;
15301         esac
15302         ;;
15303 *)      readdir64_r_proto=0
15304         ;;
15305 esac
15306
15307 : see if readdir_r exists
15308 set readdir_r d_readdir_r
15309 eval $inlibc
15310 case "$d_readdir_r" in
15311 "$define")
15312         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15313         case "$d_readdir_r_proto:$usethreads" in
15314         ":define")      d_readdir_r_proto=define
15315                 set d_readdir_r_proto readdir_r $hdrs
15316                 eval $hasproto ;;
15317         *)      ;;
15318         esac
15319         case "$d_readdir_r_proto" in
15320         define)
15321         case "$readdir_r_proto" in
15322         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15323         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15324         esac
15325         case "$readdir_r_proto" in
15326         ''|0) try='int readdir_r(DIR*, struct dirent*);'
15327         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15328         esac
15329         case "$readdir_r_proto" in
15330         ''|0)   d_readdir_r=undef
15331                 readdir_r_proto=0
15332                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
15333         * )     case "$readdir_r_proto" in
15334                 REENTRANT_PROTO*) ;;
15335                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15336                 esac
15337                 echo "Prototype: $try" ;;
15338         esac
15339         ;;
15340         *)      case "$usethreads" in
15341                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15342                 esac
15343                 d_readdir_r=undef
15344                 readdir_r_proto=0
15345                 ;;
15346         esac
15347         ;;
15348 *)      readdir_r_proto=0
15349         ;;
15350 esac
15351
15352 : see if readv exists
15353 set readv d_readv
15354 eval $inlibc
15355
15356 : see if recvmsg exists
15357 set recvmsg d_recvmsg
15358 eval $inlibc
15359
15360 : see if rename exists
15361 set rename d_rename
15362 eval $inlibc
15363
15364 : see if rmdir exists
15365 set rmdir d_rmdir
15366 eval $inlibc
15367
15368 : see if memory.h is available.
15369 val=''
15370 set memory.h val
15371 eval $inhdr
15372
15373 : See if it conflicts with string.h
15374 case "$val" in
15375 $define)
15376         case "$strings" in
15377         '') ;;
15378         *)
15379                 $cppstdin $cppflags $cppminus < $strings > mem.h
15380                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15381                         echo " "
15382                         echo "We won't be including <memory.h>."
15383                         val="$undef"
15384                 fi
15385                 $rm -f mem.h
15386                 ;;
15387         esac
15388 esac
15389 set i_memory
15390 eval $setvar
15391
15392 : can bcopy handle overlapping blocks?
15393 echo " "
15394 val="$undef"
15395 case "$d_memmove" in
15396 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15397 *)      case "$d_bcopy" in
15398         "$define")
15399                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15400                 $cat >try.c <<EOCP
15401 #$i_memory I_MEMORY
15402 #$i_stdlib I_STDLIB
15403 #$i_string I_STRING
15404 #$i_unistd I_UNISTD
15405 EOCP
15406         $cat >>try.c <<'EOCP'
15407 #include <stdio.h>
15408 #ifdef I_MEMORY
15409 #  include <memory.h>
15410 #endif
15411 #ifdef I_STDLIB
15412 #  include <stdlib.h>
15413 #endif
15414 #ifdef I_STRING
15415 #  include <string.h>
15416 #else
15417 #  include <strings.h>
15418 #endif
15419 #ifdef I_UNISTD
15420 #  include <unistd.h>  /* Needed for NetBSD */
15421 #endif
15422 int main()
15423 {
15424 char buf[128], abc[128];
15425 char *b;
15426 int len;
15427 int off;
15428 int align;
15429
15430 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15431    try to store the string in read-only memory. */
15432 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15433
15434 for (align = 7; align >= 0; align--) {
15435         for (len = 36; len; len--) {
15436                 b = buf+align;
15437                 bcopy(abc, b, len);
15438                 for (off = 1; off <= len; off++) {
15439                         bcopy(b, b+off, len);
15440                         bcopy(b+off, b, len);
15441                         if (bcmp(b, abc, len))
15442                                 exit(1);
15443                 }
15444         }
15445 }
15446 exit(0);
15447 }
15448 EOCP
15449                 set try
15450                 if eval $compile_ok; then
15451                         if ./try 2>/dev/null; then
15452                                 echo "Yes, it can."
15453                                 val="$define"
15454                         else
15455                                 echo "It can't, sorry."
15456                         fi
15457                 else
15458                         echo "(I can't compile the test program, so we'll assume not...)"
15459                 fi
15460                 ;;
15461         esac
15462         $rm -f try.* try core
15463         ;;
15464 esac
15465 set d_safebcpy
15466 eval $setvar
15467
15468 : can memcpy handle overlapping blocks?
15469 echo " "
15470 val="$undef"
15471 case "$d_memmove" in
15472 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15473 *)      case "$d_memcpy" in
15474         "$define")
15475                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
15476                 $cat >try.c <<EOCP
15477 #$i_memory I_MEMORY
15478 #$i_stdlib I_STDLIB
15479 #$i_string I_STRING
15480 #$i_unistd I_UNISTD
15481 EOCP
15482         $cat >>try.c <<'EOCP'
15483 #include <stdio.h>
15484 #ifdef I_MEMORY
15485 #  include <memory.h>
15486 #endif
15487 #ifdef I_STDLIB
15488 #  include <stdlib.h>
15489 #endif
15490 #ifdef I_STRING
15491 #  include <string.h>
15492 #else
15493 #  include <strings.h>
15494 #endif
15495 #ifdef I_UNISTD
15496 #  include <unistd.h>  /* Needed for NetBSD */
15497 #endif
15498 int main()
15499 {
15500 char buf[128], abc[128];
15501 char *b;
15502 int len;
15503 int off;
15504 int align;
15505
15506 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15507    try to store the string in read-only memory. */
15508 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
15509
15510 for (align = 7; align >= 0; align--) {
15511         for (len = 36; len; len--) {
15512                 b = buf+align;
15513                 memcpy(b, abc, len);
15514                 for (off = 1; off <= len; off++) {
15515                         memcpy(b+off, b, len);
15516                         memcpy(b, b+off, len);
15517                         if (memcmp(b, abc, len))
15518                                 exit(1);
15519                 }
15520         }
15521 }
15522 exit(0);
15523 }
15524 EOCP
15525                 set try
15526                 if eval $compile_ok; then
15527                         if ./try 2>/dev/null; then
15528                                 echo "Yes, it can."
15529                                 val="$define"
15530                         else
15531                                 echo "It can't, sorry."
15532                         fi
15533                 else
15534                         echo "(I can't compile the test program, so we'll assume not...)"
15535                 fi
15536                 ;;
15537         esac
15538         $rm -f try.* try core
15539         ;;
15540 esac
15541 set d_safemcpy
15542 eval $setvar
15543
15544 : can memcmp be trusted to compare relative magnitude?
15545 val="$undef"
15546 case "$d_memcmp" in
15547 "$define")
15548         echo " "
15549         echo "Checking if your memcmp() can compare relative magnitude..." >&4
15550         $cat >try.c <<EOCP
15551 #$i_memory I_MEMORY
15552 #$i_stdlib I_STDLIB
15553 #$i_string I_STRING
15554 #$i_unistd I_UNISTD
15555 EOCP
15556         $cat >>try.c <<'EOCP'
15557 #include <stdio.h>
15558 #ifdef I_MEMORY
15559 #  include <memory.h>
15560 #endif
15561 #ifdef I_STDLIB
15562 #  include <stdlib.h>
15563 #endif
15564 #ifdef I_STRING
15565 #  include <string.h>
15566 #else
15567 #  include <strings.h>
15568 #endif
15569 #ifdef I_UNISTD
15570 #  include <unistd.h>  /* Needed for NetBSD */
15571 #endif
15572 int main()
15573 {
15574 char a = -1;
15575 char b = 0;
15576 if ((a < b) && memcmp(&a, &b, 1) < 0)
15577         exit(1);
15578 exit(0);
15579 }
15580 EOCP
15581         set try
15582         if eval $compile_ok; then
15583                 if $run ./try 2>/dev/null; then
15584                         echo "Yes, it can."
15585                         val="$define"
15586                 else
15587                         echo "No, it can't (it uses signed chars)."
15588                 fi
15589         else
15590                 echo "(I can't compile the test program, so we'll assume not...)"
15591         fi
15592         ;;
15593 esac
15594 $rm -f try.* try core
15595 set d_sanemcmp
15596 eval $setvar
15597
15598 : see if prototype for sbrk is available
15599 echo " "
15600 set d_sbrkproto sbrk $i_unistd unistd.h
15601 eval $hasproto
15602
15603 : see if select exists
15604 set select d_select
15605 eval $inlibc
15606
15607 : see if semctl exists
15608 set semctl d_semctl
15609 eval $inlibc
15610
15611 : see if semget exists
15612 set semget d_semget
15613 eval $inlibc
15614
15615 : see if semop exists
15616 set semop d_semop
15617 eval $inlibc
15618
15619 : see how much of the 'sem*(2)' library is present.
15620 h_sem=true
15621 echo " "
15622 case "$d_semctl$d_semget$d_semop" in
15623 *"$undef"*) h_sem=false;;
15624 esac
15625 case "$osname" in
15626 freebsd)
15627     case "`ipcs 2>&1`" in
15628     "SVID messages"*"not configured"*)
15629         echo "Your $osname does not have the sem*(2) configured." >&4
15630         h_sem=false
15631         val="$undef"
15632         set semctl d_semctl
15633         eval $setvar
15634         set semget d_semget
15635         eval $setvar
15636         set semop d_semop
15637         eval $setvar
15638         ;;
15639     esac
15640     ;;
15641 esac
15642 : we could also check for sys/ipc.h ...
15643 if $h_sem && $test `./findhdr sys/sem.h`; then
15644         echo "You have the full sem*(2) library." >&4
15645         val="$define"
15646 else
15647         echo "You don't have the full sem*(2) library." >&4
15648         val="$undef"
15649 fi
15650 set d_sem
15651 eval $setvar
15652
15653 : see whether sys/sem.h defines union semun
15654 echo " "
15655 $cat > try.c <<'END'
15656 #include <sys/types.h>
15657 #include <sys/ipc.h>
15658 #include <sys/sem.h>
15659 int main () { union semun semun; semun.buf = 0; }
15660 END
15661 set try
15662 if eval $compile; then
15663     echo "You have union semun in <sys/sem.h>." >&4
15664     val="$define"
15665 else
15666     echo "You do not have union semun in <sys/sem.h>." >&4
15667     val="$undef"
15668 fi
15669 $rm -f try try.c
15670 set d_union_semun
15671 eval $setvar
15672
15673 : see how to do semctl IPC_STAT
15674 case "$d_sem" in
15675 $define)
15676     echo " "
15677     $cat > try.h <<END
15678 #ifndef S_IRUSR
15679 #   ifdef S_IREAD
15680 #       define S_IRUSR S_IREAD
15681 #       define S_IWUSR S_IWRITE
15682 #       define S_IXUSR S_IEXEC
15683 #   else
15684 #       define S_IRUSR 0400
15685 #       define S_IWUSR 0200
15686 #       define S_IXUSR 0100
15687 #   endif
15688 #   define S_IRGRP (S_IRUSR>>3)
15689 #   define S_IWGRP (S_IWUSR>>3)
15690 #   define S_IXGRP (S_IXUSR>>3)
15691 #   define S_IROTH (S_IRUSR>>6)
15692 #   define S_IWOTH (S_IWUSR>>6)
15693 #   define S_IXOTH (S_IXUSR>>6)
15694 #endif
15695 #ifndef S_IRWXU
15696 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
15697 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
15698 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
15699 #endif
15700 END
15701     : see whether semctl IPC_STAT can use union semun
15702     val="$undef"
15703     case "$d_semctl_semun" in
15704     '')
15705       $cat > try.c <<END
15706 #include <sys/types.h>
15707 #include <sys/ipc.h>
15708 #include <sys/sem.h>
15709 #include <sys/stat.h>
15710 #include <stdio.h>
15711 #include <errno.h>
15712 #include "try.h"
15713 #ifndef errno
15714 extern int errno;
15715 #endif
15716 #$d_union_semun HAS_UNION_SEMUN
15717 int main() {
15718     union semun
15719 #ifndef HAS_UNION_SEMUN
15720     {
15721         int val;
15722         struct semid_ds *buf;
15723         unsigned short *array;
15724     }
15725 #endif
15726     arg;
15727     int sem, st;
15728
15729 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
15730     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15731     if (sem > -1) {
15732         struct semid_ds argbuf;
15733         arg.buf = &argbuf;
15734 #       ifdef IPC_STAT
15735         st = semctl(sem, 0, IPC_STAT, arg);
15736         if (st == 0)
15737             printf("semun\n");
15738         else
15739 #       endif /* IPC_STAT */
15740             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15741 #       ifdef IPC_RMID
15742         if (semctl(sem, 0, IPC_RMID, arg) != 0)
15743 #       endif /* IPC_RMID */
15744             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15745     } else
15746 #endif /* IPC_PRIVATE && ... */
15747         printf("semget failed: errno = %d\n", errno);
15748   return 0;
15749 }
15750 END
15751       set try
15752       if eval $compile; then
15753           xxx=`$run ./try`
15754           case "$xxx" in
15755           semun) val="$define" ;;
15756           esac
15757       fi
15758       $rm -f try try.c
15759       ;;
15760     esac
15761     set d_semctl_semun
15762     eval $setvar
15763     case "$d_semctl_semun" in
15764     $define)
15765         echo "You can use union semun for semctl IPC_STAT." >&4
15766         also='also'
15767         ;;
15768     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
15769         also=''
15770         ;;
15771     esac
15772
15773     : see whether semctl IPC_STAT can use struct semid_ds pointer
15774     val="$undef"
15775     case "$d_semctl_semid_ds" in
15776     '')
15777       $cat > try.c <<'END'
15778 #include <sys/types.h>
15779 #include <sys/ipc.h>
15780 #include <sys/sem.h>
15781 #include <sys/stat.h>
15782 #include "try.h"
15783 #include <stdio.h>
15784 #include <errno.h>
15785 #ifndef errno
15786 extern int errno;
15787 #endif
15788 int main() {
15789     struct semid_ds arg;
15790     int sem, st;
15791
15792 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
15793     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15794     if (sem > -1) {
15795 #       ifdef IPC_STAT
15796         st = semctl(sem, 0, IPC_STAT, &arg);
15797         if (st == 0)
15798             printf("semid_ds\n");
15799         else
15800 #       endif /* IPC_STAT */
15801             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15802 #       ifdef IPC_RMID
15803         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
15804 #       endif /* IPC_RMID */
15805             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15806     } else
15807 #endif /* IPC_PRIVATE && ... */
15808         printf("semget failed: errno = %d\n", errno);
15809
15810     return 0;
15811 }
15812 END
15813       set try
15814       if eval $compile; then
15815           xxx=`$run ./try`
15816           case "$xxx" in
15817           semid_ds) val="$define" ;;
15818           esac
15819       fi
15820       $rm -f try try.c
15821       ;;
15822     esac
15823     set d_semctl_semid_ds
15824     eval $setvar
15825     case "$d_semctl_semid_ds" in
15826     $define)
15827         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
15828         ;;
15829     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
15830         ;;
15831     esac
15832     $rm -f try.h
15833     ;;
15834 *)  val="$undef"
15835
15836     # We do not have the full sem*(2) library, so assume we can not
15837     # use either.
15838
15839     set d_semctl_semun
15840     eval $setvar
15841
15842     set d_semctl_semid_ds
15843     eval $setvar
15844     ;;
15845 esac
15846
15847 : see if sendmsg exists
15848 set sendmsg d_sendmsg
15849 eval $inlibc
15850
15851 : see if setegid exists
15852 set setegid d_setegid
15853 eval $inlibc
15854
15855 : see if seteuid exists
15856 set seteuid d_seteuid
15857 eval $inlibc
15858
15859 : see if setgrent exists
15860 set setgrent d_setgrent
15861 eval $inlibc
15862
15863 : see if setgrent_r exists
15864 set setgrent_r d_setgrent_r
15865 eval $inlibc
15866 case "$d_setgrent_r" in
15867 "$define")
15868         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
15869         case "$d_setgrent_r_proto:$usethreads" in
15870         ":define")      d_setgrent_r_proto=define
15871                 set d_setgrent_r_proto setgrent_r $hdrs
15872                 eval $hasproto ;;
15873         *)      ;;
15874         esac
15875         case "$d_setgrent_r_proto" in
15876         define)
15877         case "$setgrent_r_proto" in
15878         ''|0) try='int setgrent_r(FILE**);'
15879         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
15880         esac
15881         case "$setgrent_r_proto" in
15882         ''|0) try='void setgrent_r(FILE**);'
15883         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
15884         esac
15885         case "$setgrent_r_proto" in
15886         ''|0)   d_setgrent_r=undef
15887                 setgrent_r_proto=0
15888                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
15889         * )     case "$setgrent_r_proto" in
15890                 REENTRANT_PROTO*) ;;
15891                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
15892                 esac
15893                 echo "Prototype: $try" ;;
15894         esac
15895         ;;
15896         *)      case "$usethreads" in
15897                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
15898                 esac
15899                 d_setgrent_r=undef
15900                 setgrent_r_proto=0
15901                 ;;
15902         esac
15903         ;;
15904 *)      setgrent_r_proto=0
15905         ;;
15906 esac
15907
15908 : see if sethostent exists
15909 set sethostent d_sethent
15910 eval $inlibc
15911
15912 : see if sethostent_r exists
15913 set sethostent_r d_sethostent_r
15914 eval $inlibc
15915 case "$d_sethostent_r" in
15916 "$define")
15917         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15918         case "$d_sethostent_r_proto:$usethreads" in
15919         ":define")      d_sethostent_r_proto=define
15920                 set d_sethostent_r_proto sethostent_r $hdrs
15921                 eval $hasproto ;;
15922         *)      ;;
15923         esac
15924         case "$d_sethostent_r_proto" in
15925         define)
15926         case "$sethostent_r_proto" in
15927         ''|0) try='int sethostent_r(int, struct hostent_data*);'
15928         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
15929         esac
15930         case "$sethostent_r_proto" in
15931         ''|0) try='void sethostent_r(int, struct hostent_data*);'
15932         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
15933         esac
15934         case "$sethostent_r_proto" in
15935         ''|0)   d_sethostent_r=undef
15936                 sethostent_r_proto=0
15937                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
15938         * )     case "$sethostent_r_proto" in
15939                 REENTRANT_PROTO*) ;;
15940                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
15941                 esac
15942                 echo "Prototype: $try" ;;
15943         esac
15944         ;;
15945         *)      case "$usethreads" in
15946                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
15947                 esac
15948                 d_sethostent_r=undef
15949                 sethostent_r_proto=0
15950                 ;;
15951         esac
15952         ;;
15953 *)      sethostent_r_proto=0
15954         ;;
15955 esac
15956
15957 : see if setitimer exists
15958 set setitimer d_setitimer
15959 eval $inlibc
15960
15961 : see if setlinebuf exists
15962 set setlinebuf d_setlinebuf
15963 eval $inlibc
15964
15965 : see if setlocale exists
15966 set setlocale d_setlocale
15967 eval $inlibc
15968
15969 : see if locale.h is available
15970 set locale.h i_locale
15971 eval $inhdr
15972
15973 : see if setlocale_r exists
15974 set setlocale_r d_setlocale_r
15975 eval $inlibc
15976 case "$d_setlocale_r" in
15977 "$define")
15978         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
15979         case "$d_setlocale_r_proto:$usethreads" in
15980         ":define")      d_setlocale_r_proto=define
15981                 set d_setlocale_r_proto setlocale_r $hdrs
15982                 eval $hasproto ;;
15983         *)      ;;
15984         esac
15985         case "$d_setlocale_r_proto" in
15986         define)
15987         case "$setlocale_r_proto" in
15988         ''|0) try='int setlocale_r(int, const char*, char*, int);'
15989         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
15990         esac
15991         case "$setlocale_r_proto" in
15992         ''|0)   d_setlocale_r=undef
15993                 setlocale_r_proto=0
15994                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
15995         * )     case "$setlocale_r_proto" in
15996                 REENTRANT_PROTO*) ;;
15997                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
15998                 esac
15999                 echo "Prototype: $try" ;;
16000         esac
16001         ;;
16002         *)      case "$usethreads" in
16003                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16004                 esac
16005                 d_setlocale_r=undef
16006                 setlocale_r_proto=0
16007                 ;;
16008         esac
16009         ;;
16010 *)      setlocale_r_proto=0
16011         ;;
16012 esac
16013
16014 : see if setnetent exists
16015 set setnetent d_setnent
16016 eval $inlibc
16017
16018 : see if setnetent_r exists
16019 set setnetent_r d_setnetent_r
16020 eval $inlibc
16021 case "$d_setnetent_r" in
16022 "$define")
16023         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16024         case "$d_setnetent_r_proto:$usethreads" in
16025         ":define")      d_setnetent_r_proto=define
16026                 set d_setnetent_r_proto setnetent_r $hdrs
16027                 eval $hasproto ;;
16028         *)      ;;
16029         esac
16030         case "$d_setnetent_r_proto" in
16031         define)
16032         case "$setnetent_r_proto" in
16033         ''|0) try='int setnetent_r(int, struct netent_data*);'
16034         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16035         esac
16036         case "$setnetent_r_proto" in
16037         ''|0) try='void setnetent_r(int, struct netent_data*);'
16038         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16039         esac
16040         case "$setnetent_r_proto" in
16041         ''|0)   d_setnetent_r=undef
16042                 setnetent_r_proto=0
16043                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16044         * )     case "$setnetent_r_proto" in
16045                 REENTRANT_PROTO*) ;;
16046                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16047                 esac
16048                 echo "Prototype: $try" ;;
16049         esac
16050         ;;
16051         *)      case "$usethreads" in
16052                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16053                 esac
16054                 d_setnetent_r=undef
16055                 setnetent_r_proto=0
16056                 ;;
16057         esac
16058         ;;
16059 *)      setnetent_r_proto=0
16060         ;;
16061 esac
16062
16063 : see if setprotoent exists
16064 set setprotoent d_setpent
16065 eval $inlibc
16066
16067 : see if setpgid exists
16068 set setpgid d_setpgid
16069 eval $inlibc
16070
16071 : see if setpgrp2 exists
16072 set setpgrp2 d_setpgrp2
16073 eval $inlibc
16074
16075 : see if setpriority exists
16076 set setpriority d_setprior
16077 eval $inlibc
16078
16079 : see if setproctitle exists
16080 set setproctitle d_setproctitle
16081 eval $inlibc
16082
16083 : see if setprotoent_r exists
16084 set setprotoent_r d_setprotoent_r
16085 eval $inlibc
16086 case "$d_setprotoent_r" in
16087 "$define")
16088         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16089         case "$d_setprotoent_r_proto:$usethreads" in
16090         ":define")      d_setprotoent_r_proto=define
16091                 set d_setprotoent_r_proto setprotoent_r $hdrs
16092                 eval $hasproto ;;
16093         *)      ;;
16094         esac
16095         case "$d_setprotoent_r_proto" in
16096         define)
16097         case "$setprotoent_r_proto" in
16098         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16099         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16100         esac
16101         case "$setprotoent_r_proto" in
16102         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16103         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16104         esac
16105         case "$setprotoent_r_proto" in
16106         ''|0)   d_setprotoent_r=undef
16107                 setprotoent_r_proto=0
16108                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16109         * )     case "$setprotoent_r_proto" in
16110                 REENTRANT_PROTO*) ;;
16111                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16112                 esac
16113                 echo "Prototype: $try" ;;
16114         esac
16115         ;;
16116         *)      case "$usethreads" in
16117                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16118                 esac
16119                 d_setprotoent_r=undef
16120                 setprotoent_r_proto=0
16121                 ;;
16122         esac
16123         ;;
16124 *)      setprotoent_r_proto=0
16125         ;;
16126 esac
16127
16128 : see if setpwent exists
16129 set setpwent d_setpwent
16130 eval $inlibc
16131
16132 : see if setpwent_r exists
16133 set setpwent_r d_setpwent_r
16134 eval $inlibc
16135 case "$d_setpwent_r" in
16136 "$define")
16137         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16138         case "$d_setpwent_r_proto:$usethreads" in
16139         ":define")      d_setpwent_r_proto=define
16140                 set d_setpwent_r_proto setpwent_r $hdrs
16141                 eval $hasproto ;;
16142         *)      ;;
16143         esac
16144         case "$d_setpwent_r_proto" in
16145         define)
16146         case "$setpwent_r_proto" in
16147         ''|0) try='int setpwent_r(FILE**);'
16148         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16149         esac
16150         case "$setpwent_r_proto" in
16151         ''|0) try='void setpwent_r(FILE**);'
16152         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16153         esac
16154         case "$setpwent_r_proto" in
16155         ''|0)   d_setpwent_r=undef
16156                 setpwent_r_proto=0
16157                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16158         * )     case "$setpwent_r_proto" in
16159                 REENTRANT_PROTO*) ;;
16160                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16161                 esac
16162                 echo "Prototype: $try" ;;
16163         esac
16164         ;;
16165         *)      case "$usethreads" in
16166                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16167                 esac
16168                 d_setpwent_r=undef
16169                 setpwent_r_proto=0
16170                 ;;
16171         esac
16172         ;;
16173 *)      setpwent_r_proto=0
16174         ;;
16175 esac
16176
16177 : see if setregid exists
16178 set setregid d_setregid
16179 eval $inlibc
16180 set setresgid d_setresgid
16181 eval $inlibc
16182
16183 : see if setreuid exists
16184 set setreuid d_setreuid
16185 eval $inlibc
16186 set setresuid d_setresuid
16187 eval $inlibc
16188
16189 : see if setrgid exists
16190 set setrgid d_setrgid
16191 eval $inlibc
16192
16193 : see if setruid exists
16194 set setruid d_setruid
16195 eval $inlibc
16196
16197 : see if setservent exists
16198 set setservent d_setsent
16199 eval $inlibc
16200
16201 : see if setservent_r exists
16202 set setservent_r d_setservent_r
16203 eval $inlibc
16204 case "$d_setservent_r" in
16205 "$define")
16206         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16207         case "$d_setservent_r_proto:$usethreads" in
16208         ":define")      d_setservent_r_proto=define
16209                 set d_setservent_r_proto setservent_r $hdrs
16210                 eval $hasproto ;;
16211         *)      ;;
16212         esac
16213         case "$d_setservent_r_proto" in
16214         define)
16215         case "$setservent_r_proto" in
16216         ''|0) try='int setservent_r(int, struct servent_data*);'
16217         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16218         esac
16219         case "$setservent_r_proto" in
16220         ''|0) try='void setservent_r(int, struct servent_data*);'
16221         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16222         esac
16223         case "$setservent_r_proto" in
16224         ''|0)   d_setservent_r=undef
16225                 setservent_r_proto=0
16226                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16227         * )     case "$setservent_r_proto" in
16228                 REENTRANT_PROTO*) ;;
16229                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16230                 esac
16231                 echo "Prototype: $try" ;;
16232         esac
16233         ;;
16234         *)      case "$usethreads" in
16235                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16236                 esac
16237                 d_setservent_r=undef
16238                 setservent_r_proto=0
16239                 ;;
16240         esac
16241         ;;
16242 *)      setservent_r_proto=0
16243         ;;
16244 esac
16245
16246 : see if setsid exists
16247 set setsid d_setsid
16248 eval $inlibc
16249
16250 : see if setvbuf exists
16251 set setvbuf d_setvbuf
16252 eval $inlibc
16253
16254 : see if sfio.h is available
16255 set sfio.h i_sfio
16256 eval $inhdr
16257
16258
16259 : see if sfio library is available
16260 case "$i_sfio" in
16261 $define)
16262         val=''
16263         set sfreserve val
16264         eval $inlibc
16265         ;;
16266 *)
16267         val="$undef"
16268         ;;
16269 esac
16270 : Ok, but do we want to use it.
16271 case "$val" in
16272 $define)
16273         case "$usesfio" in
16274         true|$define|[yY]*) dflt='y';;
16275         *) dflt='n';;
16276         esac
16277         echo "$package can use the sfio library, but it is experimental."
16278         case "$useperlio" in
16279         "$undef")
16280             echo "For sfio also the PerlIO abstraction layer is needed."
16281             echo "Earlier you said you wouldn't want that."
16282             ;;
16283         esac
16284         rp="You seem to have sfio available, do you want to try using it?"
16285         . ./myread
16286         case "$ans" in
16287         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
16288                 useperlio="$define"
16289                 val="$define"
16290                 ;;
16291         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
16292                 val="$undef"
16293                 ;;
16294         esac
16295         ;;
16296 *)      case "$usesfio" in
16297         true|$define|[yY]*)
16298                 echo "Sorry, cannot find sfio on this machine." >&4
16299                 echo "Ignoring your setting of usesfio=$usesfio." >&4
16300                 val="$undef"
16301                 ;;
16302         esac
16303         ;;
16304 esac
16305 set d_sfio
16306 eval $setvar
16307 case "$d_sfio" in
16308 $define) usesfio='true';;
16309 *) usesfio='false';;
16310 esac
16311 case "$d_sfio" in
16312 $define) ;;
16313 *)      : Remove sfio from list of libraries to use
16314         case "$libs" in
16315         *-lsfio*)
16316                 echo "Removing unneeded -lsfio from library list" >&4
16317                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16318                 shift
16319                 libs="$*"
16320                 echo "libs = $libs" >&4
16321                 ;;
16322         esac
16323 ;;
16324 esac
16325
16326
16327 : see if shmctl exists
16328 set shmctl d_shmctl
16329 eval $inlibc
16330
16331 : see if shmget exists
16332 set shmget d_shmget
16333 eval $inlibc
16334
16335 : see if shmat exists
16336 set shmat d_shmat
16337 eval $inlibc
16338 : see what shmat returns
16339 case "$d_shmat" in
16340 "$define")
16341         $cat >shmat.c <<'END'
16342 #include <sys/shm.h>
16343 void *shmat();
16344 END
16345         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16346                 shmattype='void *'
16347         else
16348                 shmattype='char *'
16349         fi
16350         echo "and it returns ($shmattype)." >&4
16351         : see if a prototype for shmat is available
16352         xxx=`./findhdr sys/shm.h`
16353         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16354         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16355                 val="$define"
16356         else
16357                 val="$undef"
16358         fi
16359         $rm -f shmat.[co]
16360         ;;
16361 *)
16362         val="$undef"
16363         ;;
16364 esac
16365 set d_shmatprototype
16366 eval $setvar
16367
16368 : see if shmdt exists
16369 set shmdt d_shmdt
16370 eval $inlibc
16371
16372 : see how much of the 'shm*(2)' library is present.
16373 h_shm=true
16374 echo " "
16375 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16376 *"$undef"*) h_shm=false;;
16377 esac
16378 case "$osname" in
16379 freebsd)
16380     case "`ipcs 2>&1`" in
16381     "SVID shared memory"*"not configured"*)
16382         echo "Your $osname does not have the shm*(2) configured." >&4
16383         h_shm=false
16384         val="$undef"
16385         set shmctl d_shmctl
16386         evat $setvar
16387         set shmget d_shmget
16388         evat $setvar
16389         set shmat d_shmat
16390         evat $setvar
16391         set shmdt d_shmdt
16392         evat $setvar
16393         ;;
16394     esac
16395     ;;
16396 esac
16397 : we could also check for sys/ipc.h ...
16398 if $h_shm && $test `./findhdr sys/shm.h`; then
16399         echo "You have the full shm*(2) library." >&4
16400         val="$define"
16401 else
16402         echo "You don't have the full shm*(2) library." >&4
16403         val="$undef"
16404 fi
16405 set d_shm
16406 eval $setvar
16407
16408 echo " "
16409 : see if we have sigaction
16410 if set sigaction val -f d_sigaction; eval $csym; $val; then
16411         echo 'sigaction() found.' >&4
16412         $cat > try.c <<EOP
16413 #include <stdio.h>
16414 #include <sys/types.h>
16415 #include <signal.h>
16416 #$i_stdlib I_STDLIB
16417 #ifdef I_STDLIB
16418 #include <stdlib.h>
16419 #endif
16420 int main()
16421 {
16422     struct sigaction act, oact;
16423     act.sa_flags = 0;
16424     oact.sa_handler = 0;
16425     /* so that act and oact are used */
16426     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
16427 }
16428 EOP
16429         set try
16430         if eval $compile_ok; then
16431                 val="$define"
16432         else
16433                 echo "But you don't seem to have a useable struct sigaction." >&4
16434                 val="$undef"
16435         fi
16436 else
16437         echo 'sigaction NOT found.' >&4
16438         val="$undef"
16439 fi
16440 set d_sigaction; eval $setvar
16441 $rm -f try try$_o try.c
16442
16443 : see if sigprocmask exists
16444 set sigprocmask d_sigprocmask
16445 eval $inlibc
16446
16447 : see if sigsetjmp exists
16448 echo " "
16449 case "$d_sigsetjmp" in
16450 '')
16451         $cat >try.c <<EOP
16452 #include <setjmp.h>
16453 #$i_stdlib I_STDLIB
16454 #ifdef I_STDLIB
16455 #include <stdlib.h>
16456 #endif
16457 sigjmp_buf env;
16458 int set = 1;
16459 int main()
16460 {
16461         if (sigsetjmp(env,1))
16462                 exit(set);
16463         set = 0;
16464         siglongjmp(env, 1);
16465         exit(1);
16466 }
16467 EOP
16468         set try
16469         if eval $compile; then
16470                 if $run ./try >/dev/null 2>&1; then
16471                         echo "POSIX sigsetjmp found." >&4
16472                         val="$define"
16473                 else
16474                         $cat >&4 <<EOM
16475 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
16476 I'll ignore them.
16477 EOM
16478                         val="$undef"
16479                 fi
16480         else
16481                 echo "sigsetjmp not found." >&4
16482                 val="$undef"
16483         fi
16484         ;;
16485 *) val="$d_sigsetjmp"
16486         case "$d_sigsetjmp" in
16487         $define) echo "POSIX sigsetjmp found." >&4;;
16488         $undef) echo "sigsetjmp not found." >&4;;
16489         esac
16490         ;;
16491 esac
16492 set d_sigsetjmp
16493 eval $setvar
16494 $rm -f try.c try
16495
16496 : see if sockatmark exists
16497 set sockatmark d_sockatmark
16498 eval $inlibc
16499
16500 : see if prototype for sockatmark is available
16501 echo " "
16502 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
16503 eval $hasproto
16504
16505 : see if socks5_init exists
16506 set socks5_init d_socks5_init
16507 eval $inlibc
16508
16509 : see if srand48_r exists
16510 set srand48_r d_srand48_r
16511 eval $inlibc
16512 case "$d_srand48_r" in
16513 "$define")
16514         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16515         case "$d_srand48_r_proto:$usethreads" in
16516         ":define")      d_srand48_r_proto=define
16517                 set d_srand48_r_proto srand48_r $hdrs
16518                 eval $hasproto ;;
16519         *)      ;;
16520         esac
16521         case "$d_srand48_r_proto" in
16522         define)
16523         case "$srand48_r_proto" in
16524         ''|0) try='int srand48_r(long, struct drand48_data*);'
16525         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
16526         esac
16527         case "$srand48_r_proto" in
16528         ''|0)   d_srand48_r=undef
16529                 srand48_r_proto=0
16530                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
16531         * )     case "$srand48_r_proto" in
16532                 REENTRANT_PROTO*) ;;
16533                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
16534                 esac
16535                 echo "Prototype: $try" ;;
16536         esac
16537         ;;
16538         *)      case "$usethreads" in
16539                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
16540                 esac
16541                 d_srand48_r=undef
16542                 srand48_r_proto=0
16543                 ;;
16544         esac
16545         ;;
16546 *)      srand48_r_proto=0
16547         ;;
16548 esac
16549
16550 : see if srandom_r exists
16551 set srandom_r d_srandom_r
16552 eval $inlibc
16553 case "$d_srandom_r" in
16554 "$define")
16555         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16556         case "$d_srandom_r_proto:$usethreads" in
16557         ":define")      d_srandom_r_proto=define
16558                 set d_srandom_r_proto srandom_r $hdrs
16559                 eval $hasproto ;;
16560         *)      ;;
16561         esac
16562         case "$d_srandom_r_proto" in
16563         define)
16564         case "$srandom_r_proto" in
16565         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
16566         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
16567         esac
16568         case "$srandom_r_proto" in
16569         ''|0)   d_srandom_r=undef
16570                 srandom_r_proto=0
16571                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
16572         * )     case "$srandom_r_proto" in
16573                 REENTRANT_PROTO*) ;;
16574                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
16575                 esac
16576                 echo "Prototype: $try" ;;
16577         esac
16578         ;;
16579         *)      case "$usethreads" in
16580                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
16581                 esac
16582                 d_srandom_r=undef
16583                 srandom_r_proto=0
16584                 ;;
16585         esac
16586         ;;
16587 *)      srandom_r_proto=0
16588         ;;
16589 esac
16590
16591 : see if prototype for setresgid is available
16592 echo " "
16593 set d_sresgproto setresgid $i_unistd unistd.h
16594 eval $hasproto
16595
16596 : see if prototype for setresuid is available
16597 echo " "
16598 set d_sresuproto setresuid $i_unistd unistd.h
16599 eval $hasproto
16600
16601 : see if sys/stat.h is available
16602 set sys/stat.h i_sysstat
16603 eval $inhdr
16604
16605
16606 : see if stat knows about block sizes
16607 echo " "
16608 echo "Checking to see if your struct stat has st_blocks field..." >&4
16609 set d_statblks stat st_blocks $i_sysstat sys/stat.h
16610 eval $hasfield
16611
16612
16613 : see if this is a sys/vfs.h system
16614 set sys/vfs.h i_sysvfs
16615 eval $inhdr
16616
16617
16618 : see if this is a sys/statfs.h system
16619 set sys/statfs.h i_sysstatfs
16620 eval $inhdr
16621
16622
16623 echo " "
16624 echo "Checking to see if your system supports struct statfs..." >&4
16625 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
16626 eval $hasstruct
16627 case "$d_statfs_s" in
16628 "$define")      echo "Yes, it does."   ;;
16629 *)              echo "No, it doesn't." ;;
16630 esac
16631
16632
16633
16634 : see if struct statfs knows about f_flags
16635 case "$d_statfs_s" in
16636 define) 
16637         echo " "
16638         echo "Checking to see if your struct statfs has f_flags field..." >&4
16639         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
16640         eval $hasfield
16641         ;;
16642 *)      val="$undef"
16643         set d_statfs_f_flags
16644         eval $setvar
16645         ;;
16646 esac
16647 case "$d_statfs_f_flags" in
16648 "$define")      echo "Yes, it does."   ;;
16649 *)              echo "No, it doesn't." ;;
16650 esac
16651
16652 $cat >&4 <<EOM
16653 Checking how to access stdio streams by file descriptor number...
16654 EOM
16655 case "$stdio_stream_array" in
16656 '')     $cat >try.c <<EOCP
16657 #include <stdio.h>
16658 int main() {
16659   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
16660     printf("yes\n");
16661 }
16662 EOCP
16663         for s in _iob __iob __sF
16664         do
16665                 set try -DSTDIO_STREAM_ARRAY=$s
16666                 if eval $compile; then
16667                         case "`$run ./try`" in
16668                         yes)    stdio_stream_array=$s; break ;;
16669                         esac
16670                 fi
16671         done
16672         $rm -f try.* try$exe_ext
16673 esac
16674 case "$stdio_stream_array" in
16675 '')     $cat >&4 <<EOM
16676 I can't figure out how to access stdio streams by file descriptor number.
16677 EOM
16678         d_stdio_stream_array="$undef"
16679         ;;
16680 *)      $cat >&4 <<EOM
16681 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
16682 EOM
16683         d_stdio_stream_array="$define"
16684         ;;
16685 esac
16686
16687 : see if strcoll exists
16688 set strcoll d_strcoll
16689 eval $inlibc
16690
16691 : check for structure copying
16692 echo " "
16693 echo "Checking to see if your C compiler can copy structs..." >&4
16694 $cat >try.c <<'EOCP'
16695 int main()
16696 {
16697         struct blurfl {
16698                 int dyick;
16699         } foo, bar;
16700
16701         foo = bar;
16702 }
16703 EOCP
16704 if $cc -c try.c >/dev/null 2>&1 ; then
16705         val="$define"
16706         echo "Yup, it can."
16707 else
16708         val="$undef"
16709         echo "Nope, it can't."
16710 fi
16711 set d_strctcpy
16712 eval $setvar
16713 $rm -f try.*
16714
16715 : see if strerror and/or sys_errlist[] exist
16716 echo " "
16717 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
16718     if set strerror val -f d_strerror; eval $csym; $val; then
16719                 echo 'strerror() found.' >&4
16720                 d_strerror="$define"
16721                 d_strerrm='strerror(e)'
16722                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16723                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
16724                         d_syserrlst="$define"
16725                 else
16726                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
16727                         d_syserrlst="$undef"
16728                 fi
16729     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
16730                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
16731                 echo 'strerror() found in string header.' >&4
16732                 d_strerror="$define"
16733                 d_strerrm='strerror(e)'
16734                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16735                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
16736                                 d_syserrlst="$define"
16737                 else
16738                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
16739                         d_syserrlst="$undef"
16740                 fi
16741     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16742                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
16743                 d_strerror="$undef"
16744                 d_syserrlst="$define"
16745                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
16746     else
16747                 echo 'strerror() and sys_errlist[] NOT found.' >&4
16748                 d_strerror="$undef"
16749                 d_syserrlst="$undef"
16750                 d_strerrm='"unknown"'
16751     fi
16752 fi
16753
16754 : see if strerror_r exists
16755 set strerror_r d_strerror_r
16756 eval $inlibc
16757 case "$d_strerror_r" in
16758 "$define")
16759         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
16760         case "$d_strerror_r_proto:$usethreads" in
16761         ":define")      d_strerror_r_proto=define
16762                 set d_strerror_r_proto strerror_r $hdrs
16763                 eval $hasproto ;;
16764         *)      ;;
16765         esac
16766         case "$d_strerror_r_proto" in
16767         define)
16768         case "$strerror_r_proto" in
16769         ''|0) try='int strerror_r(int, char*, size_t);'
16770         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
16771         esac
16772         case "$strerror_r_proto" in
16773         ''|0) try='int strerror_r(int, char*, int);'
16774         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
16775         esac
16776         case "$strerror_r_proto" in
16777         ''|0) try='char* strerror_r(int, char*, size_t);'
16778         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
16779         esac
16780         case "$strerror_r_proto" in
16781         ''|0)   d_strerror_r=undef
16782                 strerror_r_proto=0
16783                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
16784         * )     case "$strerror_r_proto" in
16785                 REENTRANT_PROTO*) ;;
16786                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
16787                 esac
16788                 echo "Prototype: $try" ;;
16789         esac
16790         ;;
16791         *)      case "$usethreads" in
16792                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
16793                 esac
16794                 d_strerror_r=undef
16795                 strerror_r_proto=0
16796                 ;;
16797         esac
16798         ;;
16799 *)      strerror_r_proto=0
16800         ;;
16801 esac
16802
16803 : see if strftime exists
16804 set strftime d_strftime
16805 eval $inlibc
16806
16807 : see if strlcat exists
16808 set strlcat d_strlcat
16809 eval $inlibc
16810
16811 : see if strlcpy exists
16812 set strlcpy d_strlcpy
16813 eval $inlibc
16814
16815 : see if strtod exists
16816 set strtod d_strtod
16817 eval $inlibc
16818
16819 : see if strtol exists
16820 set strtol d_strtol
16821 eval $inlibc
16822
16823 : see if strtold exists
16824 set strtold d_strtold
16825 eval $inlibc
16826
16827 : see if strtoll exists
16828 set strtoll d_strtoll
16829 eval $inlibc
16830
16831 case "$d_longlong-$d_strtoll" in
16832 "$define-$define")
16833         $cat <<EOM
16834 Checking whether your strtoll() works okay...
16835 EOM
16836         $cat >try.c <<'EOCP'
16837 #include <errno.h>
16838 #ifdef __hpux
16839 #define strtoll __strtoll
16840 #endif
16841 #ifdef __EMX__
16842 #define strtoll _strtoll
16843 #endif
16844 #include <stdio.h>
16845 extern long long int strtoll(char *s, char **, int); 
16846 static int bad = 0;
16847 int check(char *s, long long ell, int een) {
16848         long long gll;
16849         errno = 0;
16850         gll = strtoll(s, 0, 10);
16851         if (!((gll == ell) && (errno == een)))
16852                 bad++;
16853 }
16854 int main() {
16855         check(" 1",                                      1LL, 0);
16856         check(" 0",                                      0LL, 0);
16857         check("-1",                                     -1LL, 0);
16858         check("-9223372036854775808", -9223372036854775808LL, 0);
16859         check("-9223372036854775808", -9223372036854775808LL, 0);
16860         check(" 9223372036854775807",  9223372036854775807LL, 0);
16861         check("-9223372036854775808", -9223372036854775808LL, 0);
16862         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
16863         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
16864         if (!bad)
16865                 printf("ok\n");
16866 }
16867 EOCP
16868         set try
16869         if eval $compile; then
16870                 yyy=`$run ./try`
16871                 case "$yyy" in
16872                 ok) echo "Your strtoll() seems to be working okay." ;;
16873                 *) cat <<EOM >&4
16874 Your strtoll() doesn't seem to be working okay.
16875 EOM
16876                    d_strtoll="$undef"
16877                    ;;
16878                 esac
16879         else
16880                 echo "(I can't seem to compile the test program--assuming it doesn't)"
16881                 d_strtoll="$undef"
16882         fi
16883         ;;
16884 esac
16885
16886 : see if strtoq exists
16887 set strtoq d_strtoq
16888 eval $inlibc
16889
16890 : see if strtoul exists
16891 set strtoul d_strtoul
16892 eval $inlibc
16893
16894 case "$d_strtoul" in
16895 "$define")
16896         $cat <<EOM
16897 Checking whether your strtoul() works okay...
16898 EOM
16899         $cat >try.c <<'EOCP'
16900 #include <errno.h>
16901 #include <stdio.h>
16902 extern unsigned long int strtoul(char *s, char **, int); 
16903 static int bad = 0;
16904 void check(char *s, unsigned long eul, int een) {
16905         unsigned long gul;
16906         errno = 0;
16907         gul = strtoul(s, 0, 10);
16908         if (!((gul == eul) && (errno == een)))
16909                 bad++;
16910 }
16911 int main() {
16912         check(" 1", 1L, 0);
16913         check(" 0", 0L, 0);
16914 EOCP
16915         case "$longsize" in
16916         8)
16917             $cat >>try.c <<'EOCP'
16918         check("18446744073709551615", 18446744073709551615UL, 0);
16919         check("18446744073709551616", 18446744073709551615UL, ERANGE);
16920 #if 0 /* strtoul() for /^-/ strings is undefined. */
16921         check("-1", 18446744073709551615UL, 0);
16922         check("-18446744073709551614", 2, 0);
16923         check("-18446744073709551615", 1, 0);
16924         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
16925         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
16926 #endif
16927 EOCP
16928                 ;;
16929         4)
16930                     $cat >>try.c <<'EOCP'
16931         check("4294967295", 4294967295UL, 0);
16932         check("4294967296", 4294967295UL, ERANGE);
16933 #if 0 /* strtoul() for /^-/ strings is undefined. */
16934         check("-1", 4294967295UL, 0);
16935         check("-4294967294", 2, 0);
16936         check("-4294967295", 1, 0);
16937         check("-4294967296", 4294967295UL, ERANGE);
16938         check("-4294967297", 4294967295UL, ERANGE);
16939 #endif
16940 EOCP
16941                 ;;
16942         *)
16943 : Should we write these tests to be more portable by sprintf-ing
16944 : ~0 and then manipulating that char string as input for strtol?
16945                 ;;
16946         esac
16947         $cat >>try.c <<'EOCP'
16948         if (!bad)
16949                 printf("ok\n");
16950         return 0;
16951 }
16952 EOCP
16953         set try
16954         if eval $compile; then
16955                 case "`$run ./try`" in
16956                 ok) echo "Your strtoul() seems to be working okay." ;;
16957                 *) cat <<EOM >&4
16958 Your strtoul() doesn't seem to be working okay.
16959 EOM
16960                    d_strtoul="$undef"
16961                    ;;
16962                 esac
16963         fi
16964         ;;
16965 esac
16966
16967 : see if strtoull exists
16968 set strtoull d_strtoull
16969 eval $inlibc
16970
16971 case "$d_longlong-$d_strtoull" in
16972 "$define-$define")
16973         $cat <<EOM
16974 Checking whether your strtoull() works okay...
16975 EOM
16976         $cat >try.c <<'EOCP'
16977 #include <errno.h>
16978 #ifdef __hpux
16979 #define strtoull __strtoull
16980 #endif
16981 #include <stdio.h>
16982 extern unsigned long long int strtoull(char *s, char **, int); 
16983 static int bad = 0;
16984 int check(char *s, long long eull, int een) {
16985         long long gull;
16986         errno = 0;
16987         gull = strtoull(s, 0, 10);
16988         if (!((gull == eull) && (errno == een)))
16989                 bad++;
16990 }
16991 int main() {
16992         check(" 1",                                        1LL, 0);
16993         check(" 0",                                        0LL, 0);
16994         check("18446744073709551615",  18446744073709551615ULL, 0);
16995         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
16996 #if 0 /* strtoull() for /^-/ strings is undefined. */
16997         check("-1",                    18446744073709551615ULL, 0);
16998         check("-18446744073709551614",                     2LL, 0);
16999         check("-18446744073709551615",                     1LL, 0);
17000         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17001         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17002 #endif
17003         if (!bad)
17004                 printf("ok\n");
17005 }
17006 EOCP
17007         set try
17008         if eval $compile; then
17009                 case "`$run ./try`" in
17010                 ok) echo "Your strtoull() seems to be working okay." ;;
17011                 *) cat <<EOM >&4
17012 Your strtoull() doesn't seem to be working okay.
17013 EOM
17014                    d_strtoull="$undef"
17015                    ;;
17016                 esac
17017         fi
17018         ;;
17019 esac
17020
17021 : see if strtouq exists
17022 set strtouq d_strtouq
17023 eval $inlibc
17024
17025 case "$d_strtouq" in
17026 "$define")
17027         $cat <<EOM
17028 Checking whether your strtouq() works okay...
17029 EOM
17030         $cat >try.c <<'EOCP'
17031 #include <errno.h>
17032 #include <stdio.h>
17033 extern unsigned long long int strtouq(char *s, char **, int); 
17034 static int bad = 0;
17035 void check(char *s, unsigned long long eull, int een) {
17036         unsigned long long gull;
17037         errno = 0;
17038         gull = strtouq(s, 0, 10);
17039         if (!((gull == eull) && (errno == een)))
17040                 bad++;
17041 }
17042 int main() {
17043         check(" 1",                                        1LL, 0);
17044         check(" 0",                                        0LL, 0);
17045         check("18446744073709551615",  18446744073709551615ULL, 0);
17046         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17047 #if 0 /* strtouq() for /^-/ strings is undefined. */
17048         check("-1",                    18446744073709551615ULL, 0);
17049         check("-18446744073709551614",                     2LL, 0);
17050         check("-18446744073709551615",                     1LL, 0);
17051         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17052         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17053 #endif
17054         if (!bad)
17055                 printf("ok\n");
17056         return 0;
17057 }
17058 EOCP
17059         set try
17060         if eval $compile; then
17061                 case "`$run ./try`" in
17062                 ok) echo "Your strtouq() seems to be working okay." ;;
17063                 *) cat <<EOM >&4
17064 Your strtouq() doesn't seem to be working okay.
17065 EOM
17066                    d_strtouq="$undef"
17067                    ;;
17068                 esac
17069         fi
17070         ;;
17071 esac
17072
17073 : see if strxfrm exists
17074 set strxfrm d_strxfrm
17075 eval $inlibc
17076
17077 : see if symlink exists
17078 set symlink d_symlink
17079 eval $inlibc
17080
17081 : see if syscall exists
17082 set syscall d_syscall
17083 eval $inlibc
17084
17085 : see if prototype for syscall is available
17086 echo " "
17087 set d_syscallproto syscall $i_unistd unistd.h
17088 eval $hasproto
17089
17090 : see if sysconf exists
17091 set sysconf d_sysconf
17092 eval $inlibc
17093
17094 : see if system exists
17095 set system d_system
17096 eval $inlibc
17097
17098 : see if tcgetpgrp exists
17099 set tcgetpgrp d_tcgetpgrp
17100 eval $inlibc
17101
17102 : see if tcsetpgrp exists
17103 set tcsetpgrp d_tcsetpgrp
17104 eval $inlibc
17105
17106 : see if prototype for telldir is available
17107 echo " "
17108 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17109 eval $hasproto
17110
17111 : see if time exists
17112 echo " "
17113 if test "X$d_time" = X -o X"$timetype" = X; then
17114     if set time val -f d_time; eval $csym; $val; then
17115                 echo 'time() found.' >&4
17116                 val="$define"
17117                 rp="What is the type returned by time() on this system?"
17118                 set time_t timetype long stdio.h sys/types.h
17119                 eval $typedef_ask
17120     else
17121                 echo 'time() not found, hope that will do.' >&4
17122                 val="$undef"
17123                 timetype='int';
17124     fi
17125     set d_time
17126     eval $setvar
17127 fi
17128
17129 : see if this is a sys/times.h system
17130 set sys/times.h i_systimes
17131 eval $inhdr
17132
17133 : see if times exists
17134 echo " "
17135 if set times val -f d_times; eval $csym; $val; then
17136         echo 'times() found.' >&4
17137         d_times="$define"
17138         inc=''
17139         case "$i_systimes" in
17140         "$define") inc='sys/times.h';;
17141         esac
17142         rp="What is the type returned by times() on this system?"
17143         set clock_t clocktype long stdio.h sys/types.h $inc
17144         eval $typedef_ask
17145 else
17146         echo 'times() NOT found, hope that will do.' >&4
17147         d_times="$undef"
17148         clocktype='int'
17149 fi
17150
17151 : see if tmpnam_r exists
17152 set tmpnam_r d_tmpnam_r
17153 eval $inlibc
17154 case "$d_tmpnam_r" in
17155 "$define")
17156         hdrs="$i_systypes sys/types.h define stdio.h "
17157         case "$d_tmpnam_r_proto:$usethreads" in
17158         ":define")      d_tmpnam_r_proto=define
17159                 set d_tmpnam_r_proto tmpnam_r $hdrs
17160                 eval $hasproto ;;
17161         *)      ;;
17162         esac
17163         case "$d_tmpnam_r_proto" in
17164         define)
17165         case "$tmpnam_r_proto" in
17166         ''|0) try='char* tmpnam_r(char*);'
17167         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17168         esac
17169         case "$tmpnam_r_proto" in
17170         ''|0)   d_tmpnam_r=undef
17171                 tmpnam_r_proto=0
17172                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
17173         * )     case "$tmpnam_r_proto" in
17174                 REENTRANT_PROTO*) ;;
17175                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17176                 esac
17177                 echo "Prototype: $try" ;;
17178         esac
17179         ;;
17180         *)      case "$usethreads" in
17181                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17182                 esac
17183                 d_tmpnam_r=undef
17184                 tmpnam_r_proto=0
17185                 ;;
17186         esac
17187         ;;
17188 *)      tmpnam_r_proto=0
17189         ;;
17190 esac
17191
17192 : see if truncate exists
17193 set truncate d_truncate
17194 eval $inlibc
17195
17196 : see if ttyname_r exists
17197 set ttyname_r d_ttyname_r
17198 eval $inlibc
17199 case "$d_ttyname_r" in
17200 "$define")
17201         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
17202         case "$d_ttyname_r_proto:$usethreads" in
17203         ":define")      d_ttyname_r_proto=define
17204                 set d_ttyname_r_proto ttyname_r $hdrs
17205                 eval $hasproto ;;
17206         *)      ;;
17207         esac
17208         case "$d_ttyname_r_proto" in
17209         define)
17210         case "$ttyname_r_proto" in
17211         ''|0) try='int ttyname_r(int, char*, size_t);'
17212         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17213         esac
17214         case "$ttyname_r_proto" in
17215         ''|0) try='int ttyname_r(int, char*, int);'
17216         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17217         esac
17218         case "$ttyname_r_proto" in
17219         ''|0) try='char* ttyname_r(int, char*, int);'
17220         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17221         esac
17222         case "$ttyname_r_proto" in
17223         ''|0)   d_ttyname_r=undef
17224                 ttyname_r_proto=0
17225                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
17226         * )     case "$ttyname_r_proto" in
17227                 REENTRANT_PROTO*) ;;
17228                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17229                 esac
17230                 echo "Prototype: $try" ;;
17231         esac
17232         ;;
17233         *)      case "$usethreads" in
17234                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17235                 esac
17236                 d_ttyname_r=undef
17237                 ttyname_r_proto=0
17238                 ;;
17239         esac
17240         ;;
17241 *)      ttyname_r_proto=0
17242         ;;
17243 esac
17244
17245 : see if tzname[] exists
17246 echo " "
17247 if set tzname val -a d_tzname; eval $csym; $val; then
17248         val="$define"
17249         echo 'tzname[] found.' >&4
17250 else
17251         val="$undef"
17252         echo 'tzname[] NOT found.' >&4
17253 fi
17254 set d_tzname
17255 eval $setvar
17256
17257 case "$osname" in
17258 next|rhapsody|darwin) multiarch="$define" ;;
17259 esac
17260 case "$multiarch" in
17261 ''|[nN]*) multiarch="$undef" ;;
17262 esac
17263
17264 : check for ordering of bytes in a UV
17265 echo " "
17266 case "$usecrosscompile$multiarch" in
17267 *$define*)
17268         $cat <<EOM
17269 You seem to be either cross-compiling or doing a multiarchitecture build,
17270 skipping the byteorder check.
17271
17272 EOM
17273         byteorder='ffff'
17274         ;;
17275 *)
17276         case "$byteorder" in
17277         '')
17278                 $cat <<'EOM'
17279 In the following, larger digits indicate more significance.  A big-endian
17280 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17281 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17282 machines may have weird orders like 3412.  A Cray will report 87654321,
17283 an Alpha will report 12345678. If the test program works the default is
17284 probably right.
17285 I'm now running the test program...
17286 EOM
17287                 $cat >try.c <<EOCP
17288 #include <stdio.h>
17289 #$i_stdlib I_STDLIB
17290 #ifdef I_STDLIB
17291 #include <stdlib.h>
17292 #endif
17293 #include <sys/types.h>
17294 typedef $uvtype UV;
17295 int main()
17296 {
17297         int i;
17298         union {
17299                 UV l;
17300                 char c[$uvsize];
17301         } u;
17302
17303         if ($uvsize > 4)
17304                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
17305         else
17306                 u.l = (UV)0x04030201;
17307         for (i = 0; i < $uvsize; i++)
17308                 printf("%c", u.c[i]+'0');
17309         printf("\n");
17310         exit(0);
17311 }
17312 EOCP
17313                 xxx_prompt=y
17314                 set try
17315                 if eval $compile && ./try > /dev/null; then
17316                         dflt=`$run ./try`
17317                         case "$dflt" in
17318                         [1-4][1-4][1-4][1-4]|12345678|87654321)
17319                                 echo "(The test program ran ok.)"
17320                                 echo "byteorder=$dflt"
17321                                 xxx_prompt=n
17322                         ;;
17323                         ????|????????) echo "(The test program ran ok.)" ;;
17324                         *) echo "(The test program didn't run right for some reason.)" ;;
17325                         esac
17326                 else
17327                         dflt='4321'
17328                         cat <<'EOM'
17329 (I can't seem to compile the test program.  Guessing big-endian...)
17330 EOM
17331                 fi
17332                 case "$xxx_prompt" in
17333                 y)
17334                         rp="What is the order of bytes in $uvtype?"
17335                         . ./myread
17336                         byteorder="$ans"
17337                         ;;
17338                 *)      byteorder=$dflt
17339                         ;;
17340                 esac
17341                 ;;
17342         esac
17343         $rm -f try.c try
17344         ;;
17345 esac
17346
17347
17348 $cat <<EOM
17349
17350 Checking to see whether you can access character data unalignedly...
17351 EOM
17352 case "$d_u32align" in
17353 '')   $cat >try.c <<EOCP
17354 #include <stdio.h>
17355 #$i_stdlib I_STDLIB
17356 #ifdef I_STDLIB
17357 #include <stdlib.h>
17358 #endif
17359 #define U32 $u32type
17360 #define BYTEORDER 0x$byteorder
17361 #define U8 $u8type
17362 #include <signal.h>
17363 #ifdef SIGBUS
17364 $signal_t bletch(s) int s; { exit(4); }
17365 #endif
17366 int main() {
17367 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
17368     U8 buf[8];
17369     U32 *up;
17370     int i;
17371
17372     if (sizeof(U32) != 4) {
17373         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
17374         exit(1);
17375     }
17376
17377     fflush(stdout);
17378
17379 #ifdef SIGBUS
17380     signal(SIGBUS, bletch);
17381 #endif
17382
17383     buf[0] = 0;
17384     buf[1] = 0;
17385     buf[2] = 0;
17386     buf[3] = 1;
17387     buf[4] = 0;
17388     buf[5] = 0;
17389     buf[6] = 0;
17390     buf[7] = 1;
17391
17392     for (i = 0; i < 4; i++) {
17393         up = (U32*)(buf + i);
17394         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
17395                (*up == 1 << (8*(3-i)))  /* little-endian */
17396               )
17397            )
17398         {
17399             printf("read failed (%x)\n", *up);
17400             exit(2);
17401         }
17402     }
17403
17404     /* write test */
17405     for (i = 0; i < 4; i++) {
17406         up = (U32*)(buf + i);
17407         *up = 0xBeef;
17408         if (*up != 0xBeef) {
17409             printf("write failed (%x)\n", *up);
17410             exit(3);
17411         }
17412     }
17413
17414     exit(0);
17415 #else
17416     printf("1\n");
17417     exit(1);
17418 #endif
17419     return 0;
17420 }
17421 EOCP
17422 set try
17423 if eval $compile_ok; then
17424         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
17425         $run ./try 2>&1 >/dev/null
17426         case "$?" in
17427         0)      cat >&4 <<EOM
17428 You can access character data pretty unalignedly.
17429 EOM
17430                 d_u32align="$undef"
17431                 ;;
17432         *)      cat >&4 <<EOM
17433 It seems that you must access character data in an aligned manner.
17434 EOM
17435                 d_u32align="$define"
17436                 ;;
17437         esac
17438 else
17439         rp='Can you access character data at unaligned addresses?'
17440         dflt='n'
17441         . ./myread
17442         case "$ans" in
17443         [yY]*)  d_u32align="$undef"  ;;
17444         *)      d_u32align="$define" ;;
17445         esac
17446 fi
17447 $rm -f core core.try.* try.core
17448 ;;
17449 esac
17450
17451 : see if ualarm exists
17452 set ualarm d_ualarm
17453 eval $inlibc
17454
17455 : see if umask exists
17456 set umask d_umask
17457 eval $inlibc
17458
17459 : see if unordered exists
17460 set unordered d_unordered
17461 eval $inlibc
17462
17463 : see if usleep exists
17464 set usleep d_usleep
17465 eval $inlibc
17466
17467 : see if prototype for usleep is available
17468 echo " "
17469 set d_usleepproto usleep $i_unistd unistd.h
17470 eval $hasproto
17471
17472 : see if ustat exists
17473 set ustat d_ustat
17474 eval $inlibc
17475
17476 : backward compatibility for d_hvfork
17477 if test X$d_hvfork != X; then
17478         d_vfork="$d_hvfork"
17479         d_hvfork=''
17480 fi
17481 : see if there is a vfork
17482 val=''
17483 set vfork val
17484 eval $inlibc
17485
17486 : Ok, but do we want to use it. vfork is reportedly unreliable in 
17487 : perl on Solaris 2.x, and probably elsewhere.
17488 case "$val" in
17489 $define)
17490         echo " "
17491         case "$usevfork" in
17492         false) dflt='n';;
17493         *) dflt='y';;
17494         esac
17495         cat <<'EOM'
17496  
17497 Perl can only use a vfork() that doesn't suffer from strict
17498 restrictions on calling functions or modifying global data in
17499 the child.  For example, glibc-2.1 contains such a vfork()
17500 that is unsuitable.  If your system provides a proper fork()
17501 call, chances are that you do NOT want perl to use vfork().
17502
17503 EOM
17504         rp="Do you still want to use vfork()?"
17505         . ./myread
17506         case "$ans" in
17507         y|Y) ;;
17508         *)
17509                 echo "Ok, we won't use vfork()."
17510                 val="$undef"
17511                 ;;
17512         esac
17513         ;;
17514 esac
17515 set d_vfork
17516 eval $setvar
17517 case "$d_vfork" in
17518 $define) usevfork='true';;
17519 *) usevfork='false';;
17520 esac
17521
17522 : see if closedir exists
17523 set closedir d_closedir
17524 eval $inlibc
17525
17526 case "$d_closedir" in
17527 "$define")
17528         echo " "
17529         echo "Checking whether closedir() returns a status..." >&4
17530         cat > try.c <<EOM
17531 #$i_dirent I_DIRENT             /**/
17532 #$i_sysdir I_SYS_DIR            /**/
17533 #$i_sysndir I_SYS_NDIR          /**/
17534 #$i_systypes I_SYS_TYPES        /**/
17535
17536 #if defined(I_SYS_TYPES)
17537 #include <sys/types.h>
17538 #endif
17539 #if defined(I_DIRENT)
17540 #include <dirent.h>
17541 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
17542 #include <sys/dir.h>
17543 #endif
17544 #else
17545 #ifdef I_SYS_NDIR
17546 #include <sys/ndir.h>
17547 #else
17548 #ifdef I_SYS_DIR
17549 #ifdef hp9000s500
17550 #include <ndir.h>       /* may be wrong in the future */
17551 #else
17552 #include <sys/dir.h>
17553 #endif
17554 #endif
17555 #endif
17556 #endif 
17557 int main() { return closedir(opendir(".")); }
17558 EOM
17559         set try
17560         if eval $compile_ok; then
17561                 if $run ./try > /dev/null 2>&1 ; then
17562                         echo "Yes, it does."
17563                         val="$undef"
17564                 else
17565                         echo "No, it doesn't."
17566                         val="$define"
17567                 fi
17568         else
17569                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17570                 val="$define"
17571         fi
17572         ;;
17573 *)
17574         val="$undef";
17575         ;;
17576 esac
17577 set d_void_closedir
17578 eval $setvar
17579 $rm -f try try.*
17580 : see if there is a wait4
17581 set wait4 d_wait4
17582 eval $inlibc
17583
17584 : see if waitpid exists
17585 set waitpid d_waitpid
17586 eval $inlibc
17587
17588 : see if wcstombs exists
17589 set wcstombs d_wcstombs
17590 eval $inlibc
17591
17592 : see if wctomb exists
17593 set wctomb d_wctomb
17594 eval $inlibc
17595
17596 : see if writev exists
17597 set writev d_writev
17598 eval $inlibc
17599
17600 : preserve RCS keywords in files with variable substitution, grrr
17601 Date='$Date'
17602 Id='$Id'
17603 Log='$Log'
17604 RCSfile='$RCSfile'
17605 Revision='$Revision'
17606
17607 : check for alignment requirements
17608 echo " "
17609 case "$usecrosscompile$multiarch" in
17610 *$define*)
17611         $cat <<EOM
17612 You seem to be either cross-compiling or doing a multiarchitecture build,
17613 skipping the memory alignment check.
17614
17615 EOM
17616         case "$alignbytes" in
17617         '') alignbytes=8 ;;
17618         esac
17619         ;;
17620 *)
17621         case "$alignbytes" in
17622         '') echo "Checking alignment constraints..." >&4
17623                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
17624                         $cat >try.c <<'EOCP'
17625 typedef long double NV;
17626 EOCP
17627                 else
17628                         $cat >try.c <<'EOCP'
17629 typedef double NV;
17630 EOCP
17631                 fi
17632                 $cat >>try.c <<'EOCP'
17633 #include <stdio.h>
17634 struct foobar {
17635         char foo;
17636         NV bar;
17637 } try_algn;
17638 int main()
17639 {
17640     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
17641     return(0);
17642 }
17643 EOCP
17644                 set try
17645                 if eval $compile_ok; then
17646                         dflt=`$run ./try`
17647                 else
17648                         dflt='8'
17649                         echo "(I can't seem to compile the test program...)"
17650                 fi
17651                 ;;
17652         *) dflt="$alignbytes"
17653                 ;;
17654         esac
17655         rp="Doubles must be aligned on a how-many-byte boundary?"
17656         . ./myread
17657         alignbytes="$ans"
17658         $rm -f try.c try
17659         ;;
17660 esac
17661
17662
17663 : set the base revision
17664 baserev=5.0
17665
17666 : how do we concatenate cpp tokens here?
17667 echo " "
17668 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
17669 $cat >cpp_stuff.c <<'EOCP'
17670 #define RCAT(a,b)a/**/b
17671 #define ACAT(a,b)a ## b
17672 RCAT(Rei,ser)
17673 ACAT(Cir,cus)
17674 EOCP
17675 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
17676 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
17677         echo "Oh!  Smells like ANSI's been here." >&4
17678         echo "We can catify or stringify, separately or together!"
17679         cpp_stuff=42
17680 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
17681         echo "Ah, yes!  The good old days!" >&4
17682         echo "However, in the good old days we don't know how to stringify and"
17683         echo "catify at the same time."
17684         cpp_stuff=1
17685 else
17686         $cat >&4 <<EOM
17687 Hmm, I don't seem to be able to concatenate tokens with your cpp.
17688 You're going to have to edit the values of CAT[2-5] in config.h...
17689 EOM
17690         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
17691 fi
17692 $rm -f cpp_stuff.*
17693
17694 : see if this is a db.h system
17695 set db.h i_db
17696 eval $inhdr
17697
17698 case "$i_db" in
17699 $define)
17700         : Check db version.
17701         echo " "
17702         echo "Checking Berkeley DB version ..." >&4
17703         $cat >try.c <<EOCP
17704 #$d_const HASCONST
17705 #ifndef HASCONST
17706 #define const
17707 #endif
17708 #include <sys/types.h>
17709 #include <stdio.h>
17710 #$i_stdlib I_STDLIB
17711 #ifdef I_STDLIB
17712 #include <stdlib.h>
17713 #endif
17714 #include <db.h>
17715 int main(int argc, char *argv[])
17716 {
17717 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
17718     int Major, Minor, Patch ;
17719     unsigned long Version ;
17720     (void)db_version(&Major, &Minor, &Patch) ;
17721     if (argc == 2) {
17722         printf("%d %d %d %d %d %d\n",
17723                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
17724                Major, Minor, Patch);
17725         exit(0);
17726     }
17727     printf("You have Berkeley DB Version 2 or greater.\n");
17728
17729     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
17730                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
17731     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
17732                 Major, Minor, Patch) ;
17733
17734     /* check that db.h & libdb are compatible */
17735     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
17736         printf("db.h and libdb are incompatible.\n") ;
17737         exit(3);        
17738     }
17739
17740     printf("db.h and libdb are compatible.\n") ;
17741
17742     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
17743                 + DB_VERSION_PATCH ;
17744
17745     /* needs to be >= 2.3.4 */
17746     if (Version < 2003004) {
17747     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
17748         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
17749         exit(2);        
17750     }
17751
17752     exit(0);
17753 #else
17754 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
17755     if (argc == 2) {
17756         printf("1 0 0\n");
17757         exit(0);
17758     }
17759     printf("You have Berkeley DB Version 1.\n");
17760     exit(0);    /* DB version < 2: the coast is clear. */
17761 #else
17762     exit(1);    /* <db.h> not Berkeley DB? */
17763 #endif
17764 #endif
17765 }
17766 EOCP
17767         set try
17768         if eval $compile_ok && $run ./try; then
17769                 echo 'Looks OK.' >&4
17770                 set `$run ./try 1`
17771                 db_version_major=$1
17772                 db_version_minor=$2
17773                 db_version_patch=$3
17774         else
17775                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
17776                 i_db=$undef
17777                 case " $libs " in
17778                 *"-ldb "*)
17779                         : Remove db from list of libraries to use
17780                         echo "Removing unusable -ldb from library list" >&4
17781                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
17782                         shift
17783                         libs="$*"
17784                         echo "libs = $libs" >&4
17785                         ;;
17786                 esac
17787         fi
17788         $rm -f try.*
17789         ;;
17790 esac
17791
17792 case "$i_db" in
17793 define)
17794         : Check the return type needed for hash 
17795         echo " "
17796         echo "Checking return type needed for hash for Berkeley DB ..." >&4
17797         $cat >try.c <<EOCP
17798 #$d_const HASCONST
17799 #ifndef HASCONST
17800 #define const
17801 #endif
17802 #include <sys/types.h>
17803 #include <db.h>
17804
17805 #ifndef DB_VERSION_MAJOR
17806 u_int32_t hash_cb (ptr, size)
17807 const void *ptr;
17808 size_t size;
17809 {
17810 }
17811 HASHINFO info;
17812 int main()
17813 {
17814         info.hash = hash_cb;
17815 }
17816 #endif
17817 EOCP
17818         if $cc $ccflags -c try.c >try.out 2>&1 ; then
17819                 if $contains warning try.out >>/dev/null 2>&1 ; then
17820                         db_hashtype='int'
17821                 else
17822                         db_hashtype='u_int32_t'
17823                 fi
17824         else
17825                 : XXX Maybe we should just give up here.
17826                 db_hashtype=u_int32_t
17827                 $cat try.out >&4
17828                 echo "Help:  I can't seem to compile the db test program." >&4
17829                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
17830         fi
17831         $rm -f try.*
17832         echo "Your version of Berkeley DB uses $db_hashtype for hash."
17833         ;;
17834 *)      db_hashtype=u_int32_t
17835         ;;
17836 esac
17837 case "$i_db" in
17838 define)
17839         : Check the return type needed for prefix 
17840         echo " "
17841         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
17842         cat >try.c <<EOCP
17843 #$d_const HASCONST
17844 #ifndef HASCONST
17845 #define const
17846 #endif
17847 #include <sys/types.h>
17848 #include <db.h>
17849
17850 #ifndef DB_VERSION_MAJOR
17851 size_t prefix_cb (key1, key2)
17852 const DBT *key1;
17853 const DBT *key2;
17854 {
17855 }
17856 BTREEINFO info;
17857 int main()
17858 {
17859         info.prefix = prefix_cb;
17860 }
17861 #endif
17862 EOCP
17863         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
17864                 if $contains warning try.out >>/dev/null 2>&1 ; then
17865                         db_prefixtype='int'
17866                 else
17867                         db_prefixtype='size_t'
17868                 fi
17869         else
17870                 db_prefixtype='size_t'
17871                 : XXX Maybe we should just give up here.
17872                 $cat try.out >&4
17873                 echo "Help:  I can't seem to compile the db test program." >&4
17874                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
17875         fi
17876         $rm -f try.*
17877         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
17878         ;;
17879 *)      db_prefixtype='size_t'
17880         ;;
17881 esac
17882
17883
17884 : How can we generate normalized random numbers ?
17885 echo " "
17886 echo "Looking for a random number function..." >&4
17887 case "$randfunc" in
17888 '')
17889         if set drand48 val -f; eval $csym; $val; then
17890                 dflt="drand48"
17891                 echo "Good, found drand48()." >&4
17892         elif set random val -f; eval $csym; $val; then
17893                 dflt="random"
17894                 echo "OK, found random()." >&4
17895         else
17896                 dflt="rand"
17897                 echo "Yick, looks like I have to use rand()." >&4
17898         fi
17899         echo " "
17900         ;;
17901 *)
17902         dflt="$randfunc"
17903         ;;
17904 esac
17905 cont=true
17906
17907 case "$ccflags" in
17908 *-Dmy_rand=*|*-Dmy_srand=*)
17909         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
17910         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
17911         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
17912         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
17913         ;;
17914 esac
17915
17916 while $test "$cont"; do
17917         rp="Use which function to generate random numbers?"
17918         . ./myread
17919         if $test "$ans" = "$dflt"; then
17920                 : null
17921         else
17922                 randbits=''
17923         fi
17924         randfunc="$ans"
17925         if set $ans val -f; eval $csym; $val; then
17926                 cont=''
17927         else
17928                 dflt=y
17929                 rp="I cannot find function $ans. Use that name anyway?"
17930                 . ./myread
17931                 dflt=rand
17932                 case "$ans" in
17933                         [yY]*) cont='';;
17934                 esac
17935         fi
17936         case "$cont" in
17937         '')
17938                 case "$randfunc" in
17939                 drand48)
17940                         drand01="drand48()"
17941                         seedfunc="srand48"
17942                         randbits=48
17943                         randseedtype=long
17944                         ;;
17945                 rand|random)
17946                         case "$randbits" in
17947                         '')
17948 echo "Checking to see how many bits your $randfunc() function produces..." >&4
17949                                 $cat >try.c <<EOCP
17950 #$i_unistd I_UNISTD
17951 #$i_stdlib I_STDLIB
17952 #include <stdio.h>
17953 #ifdef I_UNISTD
17954 #  include <unistd.h>
17955 #endif
17956 #ifdef I_STDLIB
17957 #  include <stdlib.h>
17958 #endif
17959 int main()
17960 {
17961         register int i;
17962         register unsigned long tmp;
17963         register unsigned long max = 0L;
17964
17965         for (i = 1000; i; i--) {
17966                 tmp = (unsigned long) $randfunc();
17967                 if (tmp > max) max = tmp;
17968         }
17969         for (i = 0; max; i++)
17970                 max /= 2;
17971         printf("%d\n",i);
17972 }
17973 EOCP
17974                                 set try
17975                                 if eval $compile_ok; then
17976                                         dflt=`try`
17977                                 else
17978                                         dflt='?'
17979                                         echo "(I can't seem to compile the test program...)"
17980                                 fi
17981                                 ;;
17982                         *)
17983                                 dflt="$randbits"
17984                                 ;;
17985                         esac
17986                         rp="How many bits does your $randfunc() function produce?"
17987                         . ./myread
17988                         randbits="$ans"
17989                         $rm -f try.c try
17990                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17991                         seedfunc="s$randfunc"
17992                         randseedtype=unsigned
17993                         ;;
17994                 *)
17995                         dflt="31"
17996                         rp="How many bits does your $randfunc() function produce?"
17997                         . ./myread
17998                         randbits="$ans"
17999                         seedfunc="s$randfunc"
18000                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18001                         if set $seedfunc val -f; eval $csym; $val; then
18002                                 echo "(Using $seedfunc() to seed random generator)"
18003                         else
18004                                 echo "(Warning: no $seedfunc() to seed random generator)"
18005                                 seedfunc=rand
18006                         fi
18007                         randseedtype=unsigned
18008                         ;;
18009                 esac
18010                 ;;
18011         esac
18012 done
18013
18014 echo " "
18015 echo "Determining whether or not we are on an EBCDIC system..." >&4
18016 $cat >try.c <<'EOM'
18017 int main()
18018 {
18019   if ('M'==0xd4) return 0;
18020   return 1;
18021 }
18022 EOM
18023
18024 val=$undef
18025 set try
18026 if eval $compile_ok; then
18027         if $run ./try; then
18028                 echo "You seem to speak EBCDIC." >&4
18029                 val="$define"
18030         else
18031                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18032         fi
18033 else
18034         echo "I'm unable to compile the test program." >&4
18035         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18036 fi
18037 $rm -f try try.*
18038 set ebcdic
18039 eval $setvar
18040
18041 echo " "
18042 $cat >&4 <<EOM
18043 Checking how to flush all pending stdio output...
18044 EOM
18045 # I only know how to find the first 32 possibly open files on SunOS.
18046 # See also hints/sunos_4_1.sh and util.c  --AD
18047 case "$osname" in
18048 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18049 esac
18050 $cat >>try.c <<EOCP
18051 #include <stdio.h>
18052 #$i_stdlib I_STDLIB
18053 #ifdef I_STDLIB
18054 #include <stdlib.h>
18055 #endif
18056 #$i_unistd I_UNISTD
18057 #ifdef I_UNISTD
18058 # include <unistd.h>
18059 #endif
18060 #$d_sysconf HAS_SYSCONF
18061 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18062 #ifdef HAS_STDIO_STREAM_ARRAY
18063 # define STDIO_STREAM_ARRAY $stdio_stream_array
18064 #endif
18065 int main() {
18066   FILE* p;
18067   unlink("try.out");
18068   p = fopen("try.out", "w");
18069 #ifdef TRY_FPUTC
18070   fputc('x', p);
18071 #else
18072 # ifdef TRY_FPRINTF
18073   fprintf(p, "x");
18074 # endif
18075 #endif
18076 #ifdef TRY_FFLUSH_NULL
18077   fflush(NULL);
18078 #endif
18079 #ifdef TRY_FFLUSH_ALL
18080   {
18081     long open_max = -1;
18082 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18083     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18084 # else
18085 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18086     open_max = sysconf(_SC_OPEN_MAX);
18087 #  else
18088 #   ifdef FOPEN_MAX
18089     open_max = FOPEN_MAX;
18090 #   else
18091 #    ifdef OPEN_MAX
18092     open_max = OPEN_MAX;
18093 #    else
18094 #     ifdef _NFILE
18095     open_max = _NFILE;
18096 #     endif
18097 #    endif
18098 #   endif
18099 #  endif
18100 # endif 
18101 # ifdef HAS_STDIO_STREAM_ARRAY
18102     if (open_max > 0) {
18103       long i;
18104       for (i = 0; i < open_max; i++)
18105             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18106                 STDIO_STREAM_ARRAY[i]._file < open_max &&
18107                 STDIO_STREAM_ARRAY[i]._flag)
18108                 fflush(&STDIO_STREAM_ARRAY[i]);
18109     }   
18110   }
18111 # endif
18112 #endif
18113   _exit(42);
18114 }
18115 EOCP
18116 : first we have to find out how _not_ to flush
18117 $to try.c
18118 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18119     output=''
18120     set try -DTRY_FPUTC
18121     if eval $compile; then
18122             $run ./try 2>/dev/null
18123             code="$?"
18124             $from try.out
18125             if $test ! -s try.out -a "X$code" = X42; then
18126                 output=-DTRY_FPUTC
18127             fi
18128     fi
18129     case "$output" in
18130     '')
18131             set try -DTRY_FPRINTF
18132             if eval $compile; then
18133                     $run ./try 2>/dev/null
18134                     code="$?"
18135                     $from try.out
18136                     if $test ! -s try.out -a "X$code" = X42; then
18137                         output=-DTRY_FPRINTF
18138                     fi
18139             fi
18140         ;;
18141     esac
18142 fi
18143 : check for fflush NULL behaviour
18144 case "$fflushNULL" in
18145 '')     set try -DTRY_FFLUSH_NULL $output
18146         if eval $compile; then
18147                 $run ./try 2>/dev/null
18148                 code="$?"
18149                 $from try.out
18150                 if $test -s try.out -a "X$code" = X42; then
18151                         fflushNULL="`$cat try.out`"
18152                 else
18153                         if $test "X$code" != X42; then
18154                                 $cat >&4 <<EOM
18155 (If this test failed, don't worry, we'll try another method shortly.)
18156 EOM
18157                         fi
18158                 fi
18159         fi
18160         $rm -f core try.core core.try.*
18161         case "$fflushNULL" in
18162         x)      $cat >&4 <<EOM
18163 Your fflush(NULL) works okay for output streams.
18164 Let's see if it clobbers input pipes...
18165 EOM
18166 # As of mid-March 2000 all versions of Solaris appear to have a stdio
18167 # bug that improperly flushes the input end of pipes.  So we avoid the
18168 # autoflush on fork/system/exec support for now. :-(
18169 $cat >tryp.c <<EOCP
18170 #include <stdio.h>
18171 int
18172 main(int argc, char **argv)
18173 {
18174     char buf[1024];
18175     int i;
18176     char *bp = buf;
18177     while (1) {
18178         while ((i = getc(stdin)) != -1
18179                && (*bp++ = i) != '\n'
18180                && bp < &buf[1024])
18181         /* DO NOTHING */ ;
18182         *bp = '\0';
18183         fprintf(stdout, "%s", buf);
18184         fflush(NULL);
18185         if (i == -1)
18186             return 0;
18187         bp = buf;
18188     }
18189 }
18190 EOCP
18191                 fflushNULL="$define"
18192                 set tryp
18193                 if eval $compile; then
18194                     $rm -f tryp.out
18195                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18196                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
18197                        $cat >&4 <<EOM
18198 fflush(NULL) seems to behave okay with input streams.
18199 EOM
18200                         fflushNULL="$define"
18201                     else
18202                         $cat >&4 <<EOM
18203 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
18204 EOM
18205                         fflushNULL="$undef"
18206                     fi
18207                 fi
18208                 $rm -f core tryp.c tryp.core core.tryp.*
18209                 ;;
18210         '')     $cat >&4 <<EOM
18211 Your fflush(NULL) isn't working (contrary to ANSI C).
18212 EOM
18213                 fflushNULL="$undef"
18214                 ;;
18215         *)      $cat >&4 <<EOM
18216 Cannot figure out whether your fflush(NULL) works or not.
18217 I'm assuming it doesn't (contrary to ANSI C).
18218 EOM
18219                 fflushNULL="$undef"
18220                 ;;
18221         esac
18222         ;;
18223 $define|true|[yY]*)
18224         fflushNULL="$define"
18225         ;;
18226 *)
18227         fflushNULL="$undef"
18228         ;;
18229 esac
18230 : check explicit looping only if NULL did not work, and if the pipe
18231 : bug does not show up on an explicit flush too
18232 case "$fflushNULL" in
18233 "$undef")
18234         $cat >tryp.c <<EOCP
18235 #include <stdio.h>
18236 int
18237 main(int argc, char **argv)
18238 {
18239     char buf[1024];
18240     int i;
18241     char *bp = buf;
18242     while (1) {
18243         while ((i = getc(stdin)) != -1
18244                && (*bp++ = i) != '\n'
18245                && bp < &buf[1024])
18246         /* DO NOTHING */ ;
18247         *bp = '\0';
18248         fprintf(stdout, "%s", buf);
18249         fflush(stdin);
18250         if (i == -1)
18251             return 0;
18252         bp = buf;
18253     }
18254 }
18255 EOCP
18256         set tryp
18257         if eval $compile; then
18258             $rm -f tryp.out
18259             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18260             if cmp tryp.c tryp.out >/dev/null 2>&1; then
18261                $cat >&4 <<EOM
18262 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18263 EOM
18264                 : now check for fflushall behaviour
18265                 case "$fflushall" in
18266                 '')     set try -DTRY_FFLUSH_ALL $output
18267                         if eval $compile; then
18268                                 $cat >&4 <<EOM
18269 (Now testing the other method--but note that this also may fail.)
18270 EOM
18271                                 $run ./try 2>/dev/null
18272                                 code=$?
18273                                 $from try.out
18274                                 if $test -s try.out -a "X$code" = X42; then
18275                                         fflushall="`$cat try.out`"
18276                                 fi
18277                         fi
18278                         $rm -f core try.core core.try.*
18279                         case "$fflushall" in
18280                         x)      $cat >&4 <<EOM
18281 Whew. Flushing explicitly all the stdio streams works.
18282 EOM
18283                                 fflushall="$define"
18284                                 ;;
18285                         '')     $cat >&4 <<EOM
18286 Sigh. Flushing explicitly all the stdio streams doesn't work.
18287 EOM
18288                                 fflushall="$undef"
18289                                 ;;
18290                         *)      $cat >&4 <<EOM
18291 Cannot figure out whether flushing stdio streams explicitly works or not.
18292 I'm assuming it doesn't.
18293 EOM
18294                                 fflushall="$undef"
18295                                 ;;
18296                         esac
18297                         ;;
18298                 "$define"|true|[yY]*)
18299                         fflushall="$define"
18300                         ;;
18301                 *)
18302                         fflushall="$undef"
18303                         ;;
18304                 esac
18305             else
18306                 $cat >&4 <<EOM
18307 All is futile.  Even fflush(stdin) clobbers input pipes!
18308 EOM
18309                 fflushall="$undef"
18310             fi
18311         else
18312             fflushall="$undef"
18313         fi
18314         $rm -f core tryp.c tryp.core core.tryp.*
18315         ;;
18316 *)      fflushall="$undef"
18317         ;;
18318 esac
18319
18320 case "$fflushNULL$fflushall" in
18321 undefundef)
18322         $cat <<EOM
18323 OK, I give up.  I cannot figure out how to flush pending stdio output.
18324 We won't be flushing handles at all before fork/exec/popen.
18325 EOM
18326         ;;
18327 esac
18328 $rm -f try.* try$exe_ext
18329
18330 : Store the full pathname to the ar program for use in the C program
18331 : Respect a hint or command line value for full_ar.
18332 case "$full_ar" in
18333 '') full_ar=$ar ;;
18334 esac
18335
18336 : Store the full pathname to the sed program for use in the C program
18337 full_sed=$sed
18338
18339 : see what type gids are declared as in the kernel
18340 echo " "
18341 echo "Looking for the type for group ids returned by getgid()."
18342 set gid_t gidtype xxx stdio.h sys/types.h
18343 eval $typedef
18344 case "$gidtype" in
18345 xxx)
18346         xxx=`./findhdr sys/user.h`
18347         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
18348         case $1 in
18349         unsigned) dflt="$1 $2" ;;
18350         *) dflt="$1" ;;
18351         esac
18352         ;;
18353 *) dflt="$gidtype";;
18354 esac
18355 case "$gidtype" in
18356 gid_t) echo "gid_t found." ;;
18357 *)      rp="What is the type for group ids returned by getgid()?"
18358         . ./myread
18359         gidtype="$ans"
18360         ;;
18361 esac
18362
18363 echo " "
18364 case "$gidtype" in
18365 *_t) zzz="$gidtype"     ;;
18366 *)   zzz="gid"          ;;
18367 esac
18368 echo "Checking the size of $zzz..." >&4 
18369 cat > try.c <<EOCP
18370 #include <sys/types.h>
18371 #include <stdio.h>
18372 #$i_stdlib I_STDLIB
18373 #ifdef I_STDLIB
18374 #include <stdlib.h>
18375 #endif
18376 int main() {
18377     printf("%d\n", (int)sizeof($gidtype));
18378     exit(0);
18379 }
18380 EOCP
18381 set try
18382 if eval $compile_ok; then
18383         yyy=`$run ./try`
18384         case "$yyy" in
18385         '')     gidsize=4
18386                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
18387                 ;;
18388         *)      gidsize=$yyy
18389                 echo "Your $zzz is $gidsize bytes long."
18390                 ;;
18391         esac
18392 else
18393         gidsize=4
18394         echo "(I can't compile the test program--guessing $gidsize.)" >&4
18395 fi
18396
18397
18398 echo " "
18399 case "$gidtype" in
18400 *_t) zzz="$gidtype"     ;;
18401 *)   zzz="gid"          ;;
18402 esac
18403 echo "Checking the sign of $zzz..." >&4 
18404 cat > try.c <<EOCP
18405 #include <sys/types.h>
18406 #include <stdio.h>
18407 int main() {
18408         $gidtype foo = -1;
18409         if (foo < 0)
18410                 printf("-1\n");
18411         else
18412                 printf("1\n");
18413 }
18414 EOCP
18415 set try
18416 if eval $compile; then
18417         yyy=`$run ./try`
18418         case "$yyy" in
18419         '')     gidsign=1
18420                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18421                 ;;
18422         *)      gidsign=$yyy
18423                 case "$gidsign" in
18424                  1) echo "Your $zzz is unsigned." ;;
18425                 -1) echo "Your $zzz is signed."   ;;
18426                 esac
18427                 ;;
18428         esac
18429 else
18430         gidsign=1
18431         echo "(I can't compile the test program--guessing unsigned.)" >&4
18432 fi
18433
18434
18435 echo " "
18436
18437 if $test X"$quadtype" != X; then
18438
18439 echo "Checking how to print 64-bit integers..." >&4
18440
18441 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
18442         $cat >try.c <<'EOCP'
18443 #include <sys/types.h>
18444 #include <stdio.h>
18445 int main() {
18446   int q = 12345678901;
18447   printf("%ld\n", q);
18448 }
18449 EOCP
18450         set try
18451         if eval $compile; then
18452                 yyy=`$run ./try`
18453                 case "$yyy" in
18454                 12345678901)
18455                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
18456                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
18457                         echo "We will use %d."
18458                         ;;
18459                 esac
18460         fi
18461 fi
18462
18463 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
18464         $cat >try.c <<'EOCP'
18465 #include <sys/types.h>
18466 #include <stdio.h>
18467 int main() {
18468   long q = 12345678901;
18469   printf("%ld\n", q);
18470 }
18471 EOCP
18472         set try
18473         if eval $compile; then
18474                 yyy=`$run ./try`
18475                 case "$yyy" in
18476                 12345678901)
18477                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
18478                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
18479                         echo "We will use %ld."
18480                         ;;
18481                 esac
18482         fi
18483 fi
18484
18485 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
18486         $cat >try.c <<'EOCP'
18487 #include <sys/types.h>
18488 #include <inttypes.h>
18489 #include <stdio.h>
18490 int main() {
18491   int64_t q = 12345678901;
18492   printf("%" PRId64 "\n", q);
18493 }
18494 EOCP
18495         set try
18496         if eval $compile; then
18497                 yyy=`$run ./try`
18498                 case "$yyy" in
18499                 12345678901)
18500                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
18501                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
18502                         echo "We will use the C9X style."
18503                         ;;
18504                 esac
18505         fi
18506 fi
18507
18508 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18509         $cat >try.c <<EOCP
18510 #include <sys/types.h>
18511 #include <stdio.h>
18512 int main() {
18513   $quadtype q = 12345678901;
18514   printf("%Ld\n", q);
18515 }
18516 EOCP
18517         set try
18518         if eval $compile; then
18519                 yyy=`$run ./try`
18520                 case "$yyy" in
18521                 12345678901)
18522                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
18523                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
18524                         echo "We will use %Ld."
18525                         ;;
18526                 esac
18527         fi
18528 fi
18529
18530 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
18531         $cat >try.c <<'EOCP'
18532 #include <sys/types.h>
18533 #include <stdio.h>
18534 int main() {
18535   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
18536   printf("%lld\n", q);
18537 }
18538 EOCP
18539         set try
18540         if eval $compile; then
18541                 yyy=`$run ./try`
18542                 case "$yyy" in
18543                 12345678901)
18544                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
18545                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
18546                         echo "We will use the %lld style."
18547                         ;;
18548                 esac
18549         fi
18550 fi
18551
18552 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18553         $cat >try.c <<EOCP
18554 #include <sys/types.h>
18555 #include <stdio.h>
18556 int main() {
18557   $quadtype q = 12345678901;
18558   printf("%qd\n", q);
18559 }
18560 EOCP
18561         set try
18562         if eval $compile; then
18563                 yyy=`$run ./try`
18564                 case "$yyy" in
18565                 12345678901)
18566                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
18567                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
18568                         echo "We will use %qd."
18569                         ;;
18570                 esac
18571         fi
18572 fi
18573
18574 if $test X"$sPRId64" = X; then
18575         echo "Cannot figure out how to print 64-bit integers." >&4
18576 fi
18577
18578 $rm -f try try.*
18579
18580 fi
18581
18582 case "$sPRId64" in
18583 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
18584         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
18585         ;;
18586 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
18587         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
18588         ;;
18589 esac
18590
18591
18592 echo " "
18593 $echo "Checking the format strings to be used for Perl's internal types..." >&4
18594
18595 if $test X"$ivsize" = X8; then
18596         ivdformat="$sPRId64"
18597         uvuformat="$sPRIu64"
18598         uvoformat="$sPRIo64"
18599         uvxformat="$sPRIx64"
18600         uvXUformat="$sPRIXU64"
18601 else
18602         if $test X"$ivsize" = X"$longsize"; then
18603                 ivdformat='"ld"'
18604                 uvuformat='"lu"'
18605                 uvoformat='"lo"'
18606                 uvxformat='"lx"'
18607                 uvXUformat='"lX"'
18608         else
18609                 if $test X"$ivsize" = X"$intsize"; then
18610                         ivdformat='"d"'
18611                         uvuformat='"u"'
18612                         uvoformat='"o"'
18613                         uvxformat='"x"'
18614                         uvXUformat='"X"'
18615                 else
18616                         : far out
18617                         if $test X"$ivsize" = X"$shortsize"; then
18618                                 ivdformat='"hd"'
18619                                 uvuformat='"hu"'
18620                                 uvoformat='"ho"'
18621                                 uvxformat='"hx"'
18622                                 uvXUformat='"hX"'
18623                         fi
18624                 fi
18625         fi
18626 fi
18627
18628 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
18629         nveformat="$sPRIeldbl"
18630         nvfformat="$sPRIfldbl"
18631         nvgformat="$sPRIgldbl"
18632         nvEUformat="$sPRIEUldbl"
18633         nvFUformat="$sPRIFUldbl"
18634         nvGUformat="$sPRIGUldbl"
18635 else
18636         nveformat='"e"'
18637         nvfformat='"f"'
18638         nvgformat='"g"'
18639         nvEUformat='"E"'
18640         nvFUformat='"F"'
18641         nvGUformat='"G"'
18642 fi
18643
18644 case "$ivdformat" in
18645 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
18646     exit 1
18647     ;;
18648 esac
18649
18650
18651 echo " "
18652 $echo "Checking the format string to be used for gids..." >&4
18653
18654 case "$gidsign" in
18655 -1)     if $test X"$gidsize" = X"$ivsize"; then
18656                 gidformat="$ivdformat"
18657         else
18658                 if $test X"$gidsize" = X"$longsize"; then
18659                         gidformat='"ld"'
18660                 else
18661                         if $test X"$gidsize" = X"$intsize"; then
18662                                 gidformat='"d"'
18663                         else
18664                                 if $test X"$gidsize" = X"$shortsize"; then
18665                                         gidformat='"hd"'
18666                                 fi
18667                         fi
18668                 fi
18669         fi
18670         ;;
18671 *)      if $test X"$gidsize" = X"$uvsize"; then
18672                 gidformat="$uvuformat"
18673         else
18674                 if $test X"$gidsize" = X"$longsize"; then
18675                         gidformat='"lu"'
18676                 else
18677                         if $test X"$gidsize" = X"$intsize"; then
18678                                 gidformat='"u"'
18679                         else
18680                                 if $test X"$gidsize" = X"$shortsize"; then
18681                                         gidformat='"hu"'
18682                                 fi
18683                         fi
18684                 fi
18685         fi
18686         ;;
18687 esac
18688
18689 : see if getgroups exists
18690 set getgroups d_getgrps
18691 eval $inlibc
18692
18693 : see if setgroups exists
18694 set setgroups d_setgrps
18695 eval $inlibc
18696
18697
18698 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
18699 echo " "
18700 case "$d_getgrps$d_setgrps" in
18701 *define*)
18702         case "$groupstype" in
18703         '') dflt="$gidtype" ;;
18704         *)  dflt="$groupstype" ;;
18705         esac
18706         $cat <<EOM
18707 What type of pointer is the second argument to getgroups() and setgroups()?
18708 Usually this is the same as group ids, $gidtype, but not always.
18709
18710 EOM
18711         rp='What type pointer is the second argument to getgroups() and setgroups()?'
18712         . ./myread
18713         groupstype="$ans"
18714         ;;
18715 *)  groupstype="$gidtype";;
18716 esac
18717
18718 echo " "
18719 echo "Checking if your $make program sets \$(MAKE)..." >&4
18720 case "$make_set_make" in
18721 '')
18722         $sed 's/^X //' > testmake.mak << 'EOF'
18723 Xall:
18724 X       @echo 'maketemp="$(MAKE)"'
18725 EOF
18726         case "`$make -f testmake.mak 2>/dev/null`" in
18727         *maketemp=*) make_set_make='#' ;;
18728         *)      make_set_make="MAKE=$make" ;;
18729         esac
18730         $rm -f testmake.mak
18731         ;;
18732 esac
18733 case "$make_set_make" in
18734 '#') echo "Yup, it does.";;
18735 *) echo "Nope, it doesn't.";;
18736 esac
18737
18738 : see what type is used for mode_t
18739 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
18740 set mode_t modetype int stdio.h sys/types.h
18741 eval $typedef_ask
18742
18743 : see if stdarg is available
18744 echo " "
18745 if $test `./findhdr stdarg.h`; then
18746         echo "<stdarg.h> found." >&4
18747         valstd="$define"
18748 else
18749         echo "<stdarg.h> NOT found." >&4
18750         valstd="$undef"
18751 fi
18752
18753 : see if varags is available
18754 echo " "
18755 if $test `./findhdr varargs.h`; then
18756         echo "<varargs.h> found." >&4
18757 else
18758         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
18759 fi
18760
18761 : set up the varargs testing programs
18762 $cat > varargs.c <<EOP
18763 #ifdef I_STDARG
18764 #include <stdarg.h>
18765 #endif
18766 #ifdef I_VARARGS
18767 #include <varargs.h>
18768 #endif
18769
18770 #ifdef I_STDARG
18771 int f(char *p, ...)
18772 #else
18773 int f(va_alist)
18774 va_dcl
18775 #endif
18776 {
18777         va_list ap;
18778 #ifndef I_STDARG
18779         char *p;
18780 #endif
18781 #ifdef I_STDARG
18782         va_start(ap,p);
18783 #else
18784         va_start(ap);
18785         p = va_arg(ap, char *);
18786 #endif
18787         va_end(ap);
18788 }
18789 EOP
18790 $cat > varargs <<EOP
18791 $startsh
18792 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
18793         echo "true"
18794 else
18795         echo "false"
18796 fi
18797 $rm -f varargs$_o
18798 EOP
18799 chmod +x varargs
18800
18801 : now check which varargs header should be included
18802 echo " "
18803 i_varhdr=''
18804 case "$valstd" in
18805 "$define")
18806         if `./varargs I_STDARG`; then
18807                 val='stdarg.h'
18808         elif `./varargs I_VARARGS`; then
18809                 val='varargs.h'
18810         fi
18811         ;;
18812 *)
18813         if `./varargs I_VARARGS`; then
18814                 val='varargs.h'
18815         fi
18816         ;;
18817 esac
18818 case "$val" in
18819 '')
18820 echo "I could not find the definition for va_dcl... You have problems..." >&4
18821         val="$undef"; set i_stdarg; eval $setvar
18822         val="$undef"; set i_varargs; eval $setvar
18823         ;;
18824 *) 
18825         set i_varhdr
18826         eval $setvar
18827         case "$i_varhdr" in
18828         stdarg.h)
18829                 val="$define"; set i_stdarg; eval $setvar
18830                 val="$undef"; set i_varargs; eval $setvar
18831                 ;;
18832         varargs.h)
18833                 val="$undef"; set i_stdarg; eval $setvar
18834                 val="$define"; set i_varargs; eval $setvar
18835                 ;;
18836         esac
18837         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
18838 esac
18839 $rm -f varargs*
18840
18841 : see if we need va_copy
18842 echo " "
18843 case "$i_stdarg" in
18844 "$define")
18845         $cat >try.c <<EOCP
18846 #include <stdarg.h>
18847 #include <stdio.h>
18848 #$i_stdlib I_STDLIB
18849 #ifdef I_STDLIB
18850 #include <stdlib.h>
18851 #endif
18852 #include <signal.h>
18853
18854 int
18855 ivfprintf(FILE *f, const char *fmt, va_list *valp)
18856 {
18857   return vfprintf(f, fmt, *valp);
18858 }
18859  
18860 int    
18861 myvfprintf(FILE *f, const  char *fmt, va_list val)
18862 {
18863   return ivfprintf(f, fmt, &val);
18864 }
18865       
18866 int
18867 myprintf(char *fmt, ...) 
18868 {
18869   va_list val;
18870   va_start(val, fmt);
18871   return myvfprintf(stdout, fmt, val); 
18872 }         
18873
18874 int
18875 main(int ac, char **av)
18876 {
18877   signal(SIGSEGV, exit);
18878
18879   myprintf("%s%cs all right, then\n", "that", '\'');                            
18880   exit(0);      
18881 }
18882 EOCP
18883         set try
18884         if eval $compile && $run ./try 2>&1 >/dev/null; then
18885                 case "`$run ./try`" in
18886                 "that's all right, then")
18887                         okay=yes
18888                         ;;
18889                 esac
18890         fi
18891         case "$okay" in
18892         yes)    echo "It seems that you don't need va_copy()." >&4
18893                 need_va_copy="$undef"
18894                 ;;
18895         *)      echo "It seems that va_copy() or similar will be needed." >&4
18896                 need_va_copy="$define"
18897                 ;;
18898         esac
18899         $rm -f try.* core core.* *.core *.core.*
18900         ;;
18901 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
18902         ;;
18903 esac
18904
18905 : see what type is used for size_t
18906 rp="What is the type used for the length parameter for string functions?"
18907 set size_t sizetype 'unsigned int' stdio.h sys/types.h
18908 eval $typedef_ask
18909
18910 : check for type of arguments to gethostbyaddr. 
18911 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
18912         case "$d_gethbyaddr" in
18913         $define)
18914                 $cat <<EOM
18915
18916 Checking to see what type of arguments are accepted by gethostbyaddr().
18917 EOM
18918                 hdrs="$define sys/types.h
18919                         $d_socket sys/socket.h 
18920                         $i_niin netinet/in.h 
18921                         $i_netdb netdb.h
18922                         $i_unistd unistd.h"
18923                 : The first arg can 'char *' or 'void *'
18924                 : The second arg is some of integral type
18925                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
18926                         for yyy in size_t long int; do
18927                                 case "$netdb_host_type" in
18928                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
18929                                         if ./protochk "$try" $hdrs; then
18930                                                 echo "Your system accepts $xxx for the first arg."
18931                                                 echo "...and $yyy for the second arg."
18932                                                 netdb_host_type="$xxx"
18933                                                 netdb_hlen_type="$yyy"
18934                                         fi
18935                                         ;;
18936                                 esac
18937                         done
18938                 done
18939                 : In case none of those worked, prompt the user.
18940                 case "$netdb_host_type" in
18941                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
18942                         dflt='char *'
18943                         . ./myread
18944                         netdb_host_type=$ans
18945                         rp='What is the type for the 2nd argument to gethostbyaddr?'
18946                         dflt="$sizetype"
18947                         . ./myread
18948                         netdb_hlen_type=$ans
18949                         ;;
18950                 esac
18951                 ;;
18952         *)      : no gethostbyaddr, so pick harmless defaults
18953                 netdb_host_type='char *'
18954                 netdb_hlen_type="$sizetype"
18955                 ;;
18956         esac
18957         # Remove the "const" if needed. -- but then we'll have a 
18958         # prototype clash!
18959         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
18960 fi
18961
18962 : check for type of argument to gethostbyname. 
18963 if test "X$netdb_name_type" = X ; then
18964         case "$d_gethbyname" in
18965         $define)
18966                 $cat <<EOM
18967
18968 Checking to see what type of argument is accepted by gethostbyname().
18969 EOM
18970                 hdrs="$define sys/types.h
18971                         $d_socket sys/socket.h 
18972                         $i_niin netinet/in.h 
18973                         $i_netdb netdb.h
18974                         $i_unistd unistd.h"
18975                 for xxx in "const char *" "char *"; do
18976                         case "$netdb_name_type" in
18977                         '')     try="extern struct hostent *gethostbyname($xxx);"
18978                                 if ./protochk "$try" $hdrs; then
18979                                         echo "Your system accepts $xxx."
18980                                         netdb_name_type="$xxx"
18981                                 fi
18982                                 ;;
18983                         esac
18984                 done
18985                 : In case none of those worked, prompt the user.
18986                 case "$netdb_name_type" in
18987                 '')     rp='What is the type for the 1st argument to gethostbyname?'
18988                         dflt='char *'
18989                         . ./myread
18990                         netdb_name_type=$ans
18991                         ;;
18992                 esac
18993                 ;;
18994         *)      : no gethostbyname, so pick harmless default
18995                 netdb_name_type='char *'
18996                 ;;
18997         esac
18998 fi
18999
19000 : check for type of 1st argument to getnetbyaddr. 
19001 if test "X$netdb_net_type" = X ; then
19002         case "$d_getnbyaddr" in
19003         $define)
19004                 $cat <<EOM
19005
19006 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19007 EOM
19008                 hdrs="$define sys/types.h
19009                         $d_socket sys/socket.h 
19010                         $i_niin netinet/in.h 
19011                         $i_netdb netdb.h
19012                         $i_unistd unistd.h"
19013                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19014                         case "$netdb_net_type" in
19015                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19016                                 if ./protochk "$try" $hdrs; then
19017                                         echo "Your system accepts $xxx."
19018                                         netdb_net_type="$xxx"
19019                                 fi
19020                                 ;;
19021                         esac
19022                 done
19023                 : In case none of those worked, prompt the user.
19024                 case "$netdb_net_type" in
19025                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19026                         dflt='long'
19027                         . ./myread
19028                         netdb_net_type=$ans
19029                         ;;
19030                 esac
19031                 ;;
19032         *)      : no getnetbyaddr, so pick harmless default
19033                 netdb_net_type='long'
19034                 ;;
19035         esac
19036 fi
19037 : locate the preferred pager for this system
19038 fn=f/
19039 case "$pager" in
19040 '')
19041         dflt=''
19042         case "$pg" in
19043         /*) dflt=$pg;;
19044         [a-zA-Z]:/*) dflt=$pg;;
19045         esac
19046         case "$more" in
19047         /*) dflt=$more;;
19048         [a-zA-Z]:/*) dflt=$more;;
19049         esac
19050         case "$less" in
19051         /*) dflt=$less;;
19052         [a-zA-Z]:/*) dflt=$less;;
19053         esac
19054         case "$dflt" in
19055         '') dflt=/usr/ucb/more;;
19056         esac
19057         ;;
19058 *)      dflt="$pager"
19059         : Instruct ./getfile to trust the hinted or previous pager value,
19060         : even if it does not begin with a slash.  For example, on os2,
19061         : pager might be cmd /c more.  See comments in UU/getfile.
19062         fn="f/($pager)"
19063         ;;
19064 esac
19065 echo " "
19066 rp='What pager is used on your system?'
19067 . ./getfile
19068 pager="$ans"
19069
19070 : see what type pids are declared as in the kernel
19071 rp="What is the type of process ids on this system?"
19072 set pid_t pidtype int stdio.h sys/types.h
19073 eval $typedef_ask
19074
19075 : see if ar generates random libraries by itself
19076 echo " "
19077 echo "Checking how to generate random libraries on your machine..." >&4
19078 echo 'int bar1() { return bar2(); }' > bar1.c
19079 echo 'int bar2() { return 2; }' > bar2.c
19080 $cat > foo.c <<EOP
19081 #$i_stdlib I_STDLIB
19082 #ifdef I_STDLIB
19083 #include <stdlib.h>
19084 #endif
19085 int main() { printf("%d\n", bar1()); exit(0); }
19086 EOP
19087 $cc $ccflags -c bar1.c >/dev/null 2>&1
19088 $cc $ccflags -c bar2.c >/dev/null 2>&1
19089 $cc $ccflags -c foo.c >/dev/null 2>&1
19090 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19091 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19092         $run ./foobar >/dev/null 2>&1; then
19093         echo "$ar appears to generate random libraries itself."
19094         orderlib=false
19095         if [ "X$ranlib" = "X" ]; then
19096             ranlib=":"
19097         fi
19098 elif $ar ts bar$_a >/dev/null 2>&1 &&
19099         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19100         $run ./foobar >/dev/null 2>&1; then
19101                 echo "a table of contents needs to be added with '$ar ts'."
19102                 orderlib=false
19103                 ranlib="$ar ts"
19104 else
19105         case "$ranlib" in
19106         :) ranlib='';;
19107         '')
19108                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19109                 $test -f $ranlib || ranlib=''
19110                 ;;
19111         esac
19112         if $test -n "$ranlib"; then
19113                 echo "your system has '$ranlib'; we'll use that."
19114                 orderlib=false
19115         else
19116                 echo "your system doesn't seem to support random libraries"
19117                 echo "so we'll use lorder and tsort to order the libraries."
19118                 orderlib=true
19119                 ranlib=":"
19120         fi
19121 fi
19122 $rm -f foo* bar* 
19123
19124 : check for type of arguments to select. 
19125 case "$selecttype" in
19126 '') case "$d_select" in
19127         $define)
19128                 echo " "
19129                 $cat <<EOM
19130 Checking to see what type of arguments are accepted by select().
19131 EOM
19132                 hdrs="$define sys/types.h
19133                         $i_systime sys/time.h 
19134                         $i_sysselct sys/select.h
19135                         $d_socket sys/socket.h"
19136                 : The first arg can be int, unsigned, or size_t
19137                 : The last arg may or may not be 'const'
19138                 val=''
19139                 : void pointer has been seen but using that
19140                 : breaks the selectminbits test
19141                 for xxx in 'fd_set *' 'int *'; do
19142                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19143                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
19144                                         case "$val" in
19145                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19146                                                 if ./protochk "$try" $hdrs; then
19147                                                         echo "Your system accepts $xxx."
19148                                                         val="$xxx"
19149                                                 fi
19150                                                 ;;
19151                                         esac
19152                                 done
19153                         done
19154                 done
19155                 case "$val" in
19156                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19157                         case "$d_fd_set" in
19158                                 $define) dflt="fd_set *" ;;
19159                                 *)              dflt="int *" ;;
19160                         esac
19161                         . ./myread
19162                         val=$ans
19163                         ;;
19164                 esac
19165                 selecttype="$val"
19166                 ;;
19167         *)      : no select, so pick a harmless default
19168                 selecttype='int *'
19169                 ;;
19170         esac
19171         ;;
19172 esac
19173
19174 : check for the select 'width'
19175 case "$selectminbits" in
19176 '') safebits=`expr $ptrsize \* 8`
19177     case "$d_select" in
19178         $define)
19179                 $cat <<EOM
19180
19181 Checking to see on how many bits at a time your select() operates...
19182 EOM
19183                 $cat >try.c <<EOCP
19184 #include <sys/types.h>
19185 #$i_time I_TIME
19186 #$i_systime I_SYS_TIME
19187 #$i_systimek I_SYS_TIME_KERNEL
19188 #ifdef I_TIME
19189 #   include <time.h>
19190 #endif
19191 #ifdef I_SYS_TIME
19192 #   ifdef I_SYS_TIME_KERNEL
19193 #       define KERNEL
19194 #   endif
19195 #   include <sys/time.h>
19196 #   ifdef I_SYS_TIME_KERNEL
19197 #       undef KERNEL
19198 #   endif
19199 #endif
19200 #$i_sysselct I_SYS_SELECT
19201 #ifdef I_SYS_SELECT
19202 #include <sys/select.h>
19203 #endif
19204 #$d_socket HAS_SOCKET
19205 #ifdef HAS_SOCKET
19206 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19207 #endif
19208 #include <stdio.h>
19209 #$i_stdlib I_STDLIB
19210 #ifdef I_STDLIB
19211 #include <stdlib.h>
19212 #endif
19213 $selecttype b;
19214 #define S sizeof(*(b))
19215 #define MINBITS 64
19216 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19217 #define NBITS  (NBYTES * 8)
19218 int main() {
19219     char *s = malloc(NBYTES);
19220     struct timeval t;
19221     int i;
19222     FILE* fp;
19223     int fd;
19224
19225     if (!s)
19226         exit(1);
19227     fclose(stdin);
19228     fp = fopen("try.c", "r");
19229     if (fp == 0)
19230       exit(2);
19231     fd = fileno(fp);
19232     if (fd < 0)
19233       exit(3);
19234     b = ($selecttype)s;
19235     for (i = 0; i < NBITS; i++)
19236         FD_SET(i, b);
19237     t.tv_sec  = 0;
19238     t.tv_usec = 0;
19239     select(fd + 1, b, 0, 0, &t);
19240     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
19241     free(s);
19242     printf("%d\n", i + 1);
19243     return 0;
19244 }
19245 EOCP
19246                 set try
19247                 if eval $compile_ok; then
19248                         selectminbits=`$run ./try`
19249                         case "$selectminbits" in
19250                         '')     cat >&4 <<EOM
19251 Cannot figure out on how many bits at a time your select() operates.
19252 I'll play safe and guess it is $safebits bits.
19253 EOM
19254                                 selectminbits=$safebits
19255                                 bits="$safebits bits"
19256                                 ;;
19257                         1)      bits="1 bit" ;;
19258                         *)      bits="$selectminbits bits" ;;
19259                         esac
19260                         echo "Your select() operates on $bits at a time." >&4
19261                 else
19262                         rp='What is the minimum number of bits your select() operates on?'
19263                         case "$byteorder" in
19264                         12345678)       dflt=64 ;;
19265                         1234)           dflt=32 ;;
19266                         *)              dflt=1  ;;
19267                         esac
19268                         . ./myread
19269                         val=$ans
19270                         selectminbits="$val"
19271                 fi
19272                 $rm -f try.* try
19273                 ;;
19274         *)      : no select, so pick a harmless default
19275                 selectminbits=$safebits
19276                 ;;
19277         esac
19278         ;;
19279 esac
19280
19281 : Trace out the files included by signal.h, then look for SIGxxx names.
19282 : Remove SIGARRAYSIZE used by HPUX.
19283 : Remove SIGSTKSIZE used by Linux.
19284 : Remove SIGSTKSZ used by Posix.
19285 : Remove SIGTYP void lines used by OS2.
19286 : Some cpps, like os390, dont give the file name anywhere
19287 if [ "X$fieldn" = X ]; then
19288         : Just make some guesses.  We check them later.
19289         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19290 else
19291         xxx=`echo '#include <signal.h>' |
19292         $cppstdin $cppminus $cppflags 2>/dev/null |
19293         $grep '^[       ]*#.*include' | 
19294         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
19295 fi
19296 : Check this list of files to be sure we have parsed the cpp output ok.
19297 : This will also avoid potentially non-existent files, such 
19298 : as ../foo/bar.h
19299 xxxfiles=''
19300 for xx in $xxx /dev/null ; do
19301         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19302 done
19303 : If we have found no files, at least try signal.h
19304 case "$xxxfiles" in
19305 '')     xxxfiles=`./findhdr signal.h` ;;
19306 esac
19307 xxx=`awk '
19308 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19309         print substr($2, 4, 20)
19310 }
19311 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19312         print substr($3, 4, 20)
19313 }' $xxxfiles`
19314 : Append some common names just in case the awk scan failed.
19315 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19316 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19317 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19318 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19319 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19320
19321 : generate a few handy files for later
19322 $cat > signal.c <<EOCP
19323 #include <sys/types.h>
19324 #include <signal.h>
19325 #$i_stdlib I_STDLIB
19326 #ifdef I_STDLIB
19327 #include <stdlib.h>
19328 #endif
19329 #include <stdio.h>
19330 int main() {
19331
19332 /* Strange style to avoid deeply-nested #if/#else/#endif */
19333 #ifndef NSIG
19334 #  ifdef _NSIG
19335 #    define NSIG (_NSIG)
19336 #  endif
19337 #endif
19338
19339 #ifndef NSIG
19340 #  ifdef SIGMAX
19341 #    define NSIG (SIGMAX+1)
19342 #  endif
19343 #endif
19344
19345 #ifndef NSIG
19346 #  ifdef SIG_MAX
19347 #    define NSIG (SIG_MAX+1)
19348 #  endif
19349 #endif
19350
19351 #ifndef NSIG
19352 #  ifdef _SIG_MAX
19353 #    define NSIG (_SIG_MAX+1)
19354 #  endif
19355 #endif
19356
19357 #ifndef NSIG
19358 #  ifdef MAXSIG
19359 #    define NSIG (MAXSIG+1)
19360 #  endif
19361 #endif
19362
19363 #ifndef NSIG
19364 #  ifdef MAX_SIG
19365 #    define NSIG (MAX_SIG+1)
19366 #  endif
19367 #endif
19368
19369 #ifndef NSIG
19370 #  ifdef SIGARRAYSIZE
19371 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
19372 #  endif
19373 #endif
19374
19375 #ifndef NSIG
19376 #  ifdef _sys_nsig
19377 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
19378 #  endif
19379 #endif
19380
19381 /* Default to some arbitrary number that's big enough to get most
19382    of the common signals.
19383 */
19384 #ifndef NSIG
19385 #    define NSIG 50
19386 #endif
19387
19388 printf("NSIG %d\n", NSIG);
19389
19390 #ifndef JUST_NSIG
19391
19392 EOCP
19393
19394 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19395 {
19396         printf "#ifdef SIG"; printf $1; printf "\n"
19397         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
19398         printf $1; printf ");\n"
19399         printf "#endif\n"
19400 }
19401 END {
19402         printf "#endif /* JUST_NSIG */\n";
19403         printf "exit(0);\n}\n";
19404 }
19405 ' >>signal.c
19406 $cat >signal.awk <<'EOP'
19407 BEGIN { ndups = 0 }
19408 $1 ~ /^NSIG$/ { nsig = $2 }
19409 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
19410     if ($2 > maxsig) { maxsig = $2 }
19411     if (sig_name[$2]) {
19412         dup_name[ndups] = $1
19413         dup_num[ndups] = $2
19414         ndups++ 
19415     }
19416     else {
19417         sig_name[$2] = $1
19418         sig_num[$2] = $2
19419     }
19420 }
19421 END { 
19422     if (nsig == 0) {
19423         nsig = maxsig + 1
19424     }
19425     printf("NSIG %d\n", nsig);
19426     for (n = 1; n < nsig; n++) {
19427         if (sig_name[n]) {
19428             printf("%s %d\n", sig_name[n], sig_num[n])
19429         }
19430         else {
19431             printf("NUM%d %d\n", n, n) 
19432         }
19433     }
19434     for (n = 0; n < ndups; n++) {
19435         printf("%s %d\n", dup_name[n], dup_num[n])
19436     }
19437 }
19438 EOP
19439 $cat >signal_cmd <<EOS
19440 $startsh
19441 if $test -s signal.lst; then
19442     echo "Using your existing signal.lst file"
19443         exit 0
19444 fi
19445 xxx="$xxx"
19446 EOS
19447 $cat >>signal_cmd <<'EOS'
19448
19449 set signal
19450 if eval $compile_ok; then
19451         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
19452 else
19453         echo "(I can't seem be able to compile the whole test program)" >&4
19454         echo "(I'll try it in little pieces.)" >&4
19455         set signal -DJUST_NSIG
19456         if eval $compile_ok; then
19457                 $run ./signal$_exe > signal.nsg
19458                 $cat signal.nsg
19459         else
19460                 echo "I can't seem to figure out how many signals you have." >&4
19461                 echo "Guessing 50." >&4
19462                 echo 'NSIG 50' > signal.nsg
19463         fi
19464         : Now look at all the signal names, one at a time.
19465         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
19466                 $cat > signal.c <<EOCP
19467 #include <sys/types.h>
19468 #include <signal.h>
19469 #include <stdio.h>
19470 int main() {
19471 printf("$xx %d\n", SIG${xx});
19472 return 0;
19473 }
19474 EOCP
19475                 set signal
19476                 if eval $compile; then
19477                         echo "SIG${xx} found."
19478                         $run ./signal$_exe  >> signal.ls1
19479                 else
19480                         echo "SIG${xx} NOT found."
19481                 fi
19482         done
19483         if $test -s signal.ls1; then
19484                 $cat signal.nsg signal.ls1 |
19485                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
19486         fi
19487
19488 fi
19489 if $test -s signal.lst; then
19490         :
19491 else
19492         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
19493         echo 'kill -l' >signal
19494         set X `csh -f <signal`
19495         $rm -f signal
19496         shift
19497         case $# in
19498         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
19499         esac
19500         echo $@ | $tr ' ' $trnl | \
19501             $awk '{ printf "%s %d\n", $1, ++s; }
19502                   END { printf "NSIG %d\n", ++s }' >signal.lst
19503 fi
19504 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
19505 EOS
19506 chmod a+x signal_cmd
19507 $eunicefix signal_cmd
19508
19509 : generate list of signal names
19510 echo " "
19511 case "$sig_name_init" in
19512 '') doinit=yes ;;
19513 *)  case "$sig_num_init" in
19514     ''|*,*) doinit=yes ;;
19515     esac ;;
19516 esac
19517 case "$doinit" in
19518 yes)
19519         echo "Generating a list of signal names and numbers..." >&4
19520         . ./signal_cmd
19521         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
19522         sig_name=`$awk 'BEGIN { printf "ZERO " }
19523                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
19524         sig_num=`$awk  'BEGIN { printf "0 " }
19525                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
19526         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
19527                              !/^NSIG/   { printf "\"%s\", ", $1 }
19528                              END        { printf "0\n" }' signal.lst`
19529         sig_num_init=`$awk  'BEGIN      { printf "0, " }
19530                              !/^NSIG/   { printf "%d, ", $2}
19531                              END        { printf "0\n"}' signal.lst`
19532         ;;
19533 esac
19534 echo "The following $sig_count signals are available:"
19535 echo " "
19536 echo $sig_name | $awk \
19537 'BEGIN { linelen = 0 }
19538 {
19539         for (i = 1; i <= NF; i++) {
19540                 name = "SIG" $i " "
19541                 linelen = linelen + length(name)
19542                 if (linelen > 70) {
19543                         printf "\n"
19544                         linelen = length(name)
19545                 }
19546                 printf "%s", name
19547         }
19548         printf "\n"
19549 }'
19550 sig_size=`echo $sig_name | awk '{print NF}'`
19551 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
19552
19553 echo " "
19554 case "$sizetype" in
19555 *_t) zzz="$sizetype"    ;;
19556 *)   zzz="filesize"     ;;
19557 esac
19558 echo "Checking the size of $zzz..." >&4 
19559 cat > try.c <<EOCP
19560 #include <sys/types.h>
19561 #include <stdio.h>
19562 #$i_stdlib I_STDLIB
19563 #ifdef I_STDLIB
19564 #include <stdlib.h>
19565 #endif
19566 int main() {
19567     printf("%d\n", (int)sizeof($sizetype));
19568     exit(0);
19569 }
19570 EOCP
19571 set try
19572 if eval $compile_ok; then
19573         yyy=`$run ./try`
19574         case "$yyy" in
19575         '')     sizesize=4
19576                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
19577                 ;;
19578         *)      sizesize=$yyy
19579                 echo "Your $zzz size is $sizesize bytes."
19580                 ;;
19581         esac
19582 else
19583         sizesize=4
19584         echo "(I can't compile the test program--guessing $sizesize.)" >&4
19585 fi
19586
19587
19588 : check for socklen_t
19589 echo " "
19590 echo "Checking to see if you have socklen_t..." >&4
19591 $cat >try.c <<EOCP
19592 #include <sys/types.h>
19593 #$d_socket HAS_SOCKET
19594 #ifdef HAS_SOCKET
19595 #include <sys/socket.h>
19596 #endif
19597 int main() { socklen_t x = 16; }
19598 EOCP
19599 set try
19600 if eval $compile; then
19601         val="$define"
19602         echo "You have socklen_t."
19603 else
19604         val="$undef"
19605         echo "You do not have socklen_t."
19606         case "$sizetype" in
19607         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
19608         esac
19609 fi
19610 $rm -f try try.*
19611 set d_socklen_t
19612 eval $setvar
19613
19614 : see if this is a socks.h system
19615 set socks.h i_socks
19616 eval $inhdr
19617
19618 : check for type of the size argument to socket calls
19619 case "$d_socket" in
19620 "$define")
19621         $cat <<EOM
19622
19623 Checking to see what type is the last argument of accept().
19624 EOM
19625         yyy=''
19626         case "$d_socklen_t" in
19627         "$define") yyy="$yyy socklen_t"
19628         esac
19629         yyy="$yyy $sizetype int long unsigned"
19630         for xxx in $yyy; do
19631                 case "$socksizetype" in
19632                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
19633                         case "$usesocks" in
19634                         "$define")
19635                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
19636                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19637                                         socksizetype="$xxx"
19638                                 fi
19639                                 ;;
19640                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
19641                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19642                                         socksizetype="$xxx"
19643                                 fi
19644                                 ;;
19645                         esac
19646                         ;;
19647                 esac
19648         done
19649 : In case none of those worked, prompt the user.
19650         case "$socksizetype" in
19651         '')     rp='What is the type for socket address structure sizes?'
19652                 dflt='int'
19653                 . ./myread
19654                 socksizetype=$ans
19655                 ;;
19656         esac
19657         ;;
19658 *)      : no sockets, so pick relatively harmless default
19659         socksizetype='int'
19660         ;;
19661 esac
19662
19663 : see what type is used for signed size_t
19664 set ssize_t ssizetype int stdio.h sys/types.h
19665 eval $typedef
19666 dflt="$ssizetype"
19667 $cat > try.c <<EOM
19668 #include <stdio.h>
19669 #$i_stdlib I_STDLIB
19670 #ifdef I_STDLIB
19671 #include <stdlib.h>
19672 #endif
19673 #include <sys/types.h>
19674 #define Size_t $sizetype
19675 #define SSize_t $dflt
19676 int main()
19677 {
19678         if (sizeof(Size_t) == sizeof(SSize_t))
19679                 printf("$dflt\n");
19680         else if (sizeof(Size_t) == sizeof(int))
19681                 printf("int\n");
19682         else 
19683                 printf("long\n");
19684         exit(0);
19685 }
19686 EOM
19687 echo " "
19688 set try
19689 if eval $compile_ok && $run ./try > /dev/null; then
19690         ssizetype=`$run ./try`
19691         echo "I'll be using $ssizetype for functions returning a byte count." >&4
19692 else
19693         $cat >&4 <<EOM
19694 Help! I can't compile and run the ssize_t test program: please enlighten me!
19695 (This is probably a misconfiguration in your system or libraries, and
19696 you really ought to fix it.  Still, I'll try anyway.)
19697
19698 I need a type that is the same size as $sizetype, but is guaranteed to
19699 be signed.  Common values are ssize_t, int and long.
19700
19701 EOM
19702         rp="What signed type is the same size as $sizetype?"
19703         . ./myread
19704         ssizetype="$ans"
19705 fi
19706 $rm -f try try.*
19707
19708 : see what type of char stdio uses.
19709 echo " "
19710 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
19711 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
19712         echo "Your stdio uses unsigned chars." >&4
19713         stdchar="unsigned char"
19714 else
19715         echo "Your stdio uses signed chars." >&4
19716         stdchar="char"
19717 fi
19718 $rm -f stdioh
19719
19720
19721
19722 : see what type uids are declared as in the kernel
19723 echo " "
19724 echo "Looking for the type for user ids returned by getuid()."
19725 set uid_t uidtype xxx stdio.h sys/types.h
19726 eval $typedef
19727 case "$uidtype" in
19728 xxx)
19729         xxx=`./findhdr sys/user.h`
19730         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
19731         case $1 in
19732         unsigned) dflt="$1 $2" ;;
19733         *) dflt="$1" ;;
19734         esac
19735         ;;
19736 *) dflt="$uidtype";;
19737 esac
19738 case "$uidtype" in
19739 uid_t)  echo "uid_t found." ;;
19740 *)      rp="What is the type for user ids returned by getuid()?"
19741         . ./myread
19742         uidtype="$ans"
19743         ;;
19744 esac
19745
19746 echo " "
19747 case "$uidtype" in
19748 *_t) zzz="$uidtype"     ;;
19749 *)   zzz="uid"          ;;
19750 esac
19751 echo "Checking the size of $zzz..." >&4 
19752 cat > try.c <<EOCP
19753 #include <sys/types.h>
19754 #include <stdio.h>
19755 #$i_stdlib I_STDLIB
19756 #ifdef I_STDLIB
19757 #include <stdlib.h>
19758 #endif
19759 int main() {
19760     printf("%d\n", (int)sizeof($uidtype));
19761     exit(0);
19762 }
19763 EOCP
19764 set try
19765 if eval $compile_ok; then
19766         yyy=`$run ./try`
19767         case "$yyy" in
19768         '')     uidsize=4
19769                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
19770                 ;;
19771         *)      uidsize=$yyy
19772                 echo "Your $zzz is $uidsize bytes long."
19773                 ;;
19774         esac
19775 else
19776         uidsize=4
19777         echo "(I can't compile the test program--guessing $uidsize.)" >&4
19778 fi
19779
19780 echo " "
19781 case "$uidtype" in
19782 *_t) zzz="$uidtype"     ;;
19783 *)   zzz="uid"          ;;
19784 esac
19785 echo "Checking the sign of $zzz..." >&4
19786 cat > try.c <<EOCP
19787 #include <sys/types.h>
19788 #include <stdio.h>
19789 int main() {
19790         $uidtype foo = -1;
19791         if (foo < 0)
19792                 printf("-1\n");
19793         else
19794                 printf("1\n");
19795 }
19796 EOCP
19797 set try
19798 if eval $compile; then
19799         yyy=`$run ./try`
19800         case "$yyy" in
19801         '')     uidsign=1
19802                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19803                 ;;
19804         *)      uidsign=$yyy
19805                 case "$uidsign" in
19806                  1) echo "Your $zzz is unsigned." ;;
19807                 -1) echo "Your $zzz is signed."   ;;
19808                 esac
19809                 ;;
19810         esac
19811 else
19812         uidsign=1
19813         echo "(I can't compile the test program--guessing unsigned.)" >&4
19814 fi
19815
19816
19817
19818 echo " "
19819 $echo "Checking the format string to be used for uids..." >&4
19820
19821 case "$uidsign" in
19822 -1)     if $test X"$uidsize" = X"$ivsize"; then
19823                 uidformat="$ivdformat"
19824         else
19825                 if $test X"$uidsize" = X"$longsize"; then
19826                         uidformat='"ld"'
19827                 else
19828                         if $test X"$uidsize" = X"$intsize"; then
19829                                 uidformat='"d"'
19830                         else
19831                                 if $test X"$uidsize" = X"$shortsize"; then
19832                                         uidformat='"hd"'
19833                                 fi
19834                         fi
19835                 fi
19836         fi
19837         ;;
19838 *)      if $test X"$uidsize" = X"$uvsize"; then
19839                 uidformat="$uvuformat"
19840         else
19841                 if $test X"$uidsize" = X"$longsize"; then
19842                         uidformat='"lu"'
19843                 else
19844                         if $test X"$uidsize" = X"$intsize"; then
19845                                 uidformat='"u"'
19846                         else
19847                                 if $test X"$uidsize" = X"$shortsize"; then
19848                                         uidformat='"hu"'
19849                                 fi
19850                         fi
19851                 fi
19852         fi
19853         ;;
19854 esac
19855
19856
19857 case "$usesitecustomize" in
19858     $define|true|[Yy]*)
19859         usesitecustomize="$define"
19860         ;;
19861     *)
19862         usesitecustomize="$undef"
19863         ;;
19864     esac
19865
19866 : determine compiler compiler
19867 case "$yacc" in
19868 '')
19869         dflt=yacc;;
19870 *)
19871         dflt="$yacc";;
19872 esac
19873 echo " "
19874 comp='yacc'
19875 if $test -f "$byacc$_exe"; then
19876         dflt="$byacc"
19877         comp="byacc or $comp"
19878 fi
19879 if $test -f "$bison$_exe"; then
19880         comp="$comp or bison -y"
19881 fi
19882 rp="Which compiler compiler ($comp) shall I use?"
19883 . ./myread
19884 yacc="$ans"
19885 case "$yacc" in
19886 *bis*)
19887         case "$yacc" in
19888         *-y*) ;;
19889         *)
19890                 yacc="$yacc -y"
19891                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
19892                 ;;
19893         esac
19894         ;;
19895 esac
19896
19897 : see if this is a fp.h system
19898 set fp.h i_fp
19899 eval $inhdr
19900
19901 : see if this is a fp_class.h system
19902 set fp_class.h i_fp_class
19903 eval $inhdr
19904
19905 : see if this is a ieeefp.h system
19906 case "$i_ieeefp" in
19907 '' ) set ieeefp.h i_ieeefp
19908      eval $inhdr
19909      ;;
19910 esac
19911
19912 : see if this is a libutil.h system
19913 set libutil.h i_libutil
19914 eval $inhdr
19915
19916 : see if mach cthreads are available
19917 if test "X$usethreads" = "X$define"; then
19918         set mach/cthreads.h i_machcthr
19919         eval $inhdr
19920 else
19921         i_machcthr="$undef"
19922 fi
19923
19924
19925
19926 : see if this is a mntent.h system
19927 set mntent.h i_mntent
19928 eval $inhdr
19929
19930 : see if ndbm.h is available
19931 set ndbm.h t_ndbm
19932 eval $inhdr
19933
19934 case "$t_ndbm" in
19935 $undef)
19936     # Some Linux distributions such as RedHat 7.1 put the
19937     # ndbm.h header in /usr/include/gdbm/ndbm.h.
19938     if $test -f /usr/include/gdbm/ndbm.h; then
19939         echo '<gdbm/ndbm.h> found.'
19940         ccflags="$ccflags -I/usr/include/gdbm"
19941         cppflags="$cppflags -I/usr/include/gdbm"
19942         t_ndbm=$define
19943     fi
19944     ;;
19945 esac
19946
19947 case "$t_ndbm" in
19948 $define)
19949         : see if dbm_open exists
19950         set dbm_open d_dbm_open
19951         eval $inlibc
19952         case "$d_dbm_open" in
19953         $undef)
19954                 t_ndbm="$undef"
19955                 echo "We won't be including <ndbm.h>"
19956                 ;;
19957         esac
19958         ;;
19959 esac
19960 val="$t_ndbm"
19961 set i_ndbm
19962 eval $setvar
19963
19964 : see if net/errno.h is available
19965 val=''
19966 set net/errno.h val
19967 eval $inhdr
19968
19969 : Unfortunately, it causes problems on some systems.  Arrgh.
19970 case "$val" in
19971 $define)
19972         cat > try.c <<'EOM'
19973 #include <stdio.h>
19974 #include <errno.h>
19975 #include <net/errno.h>
19976 int func()
19977 {
19978         return ENOTSOCK;
19979 }
19980 EOM
19981         if $cc $ccflags -c try.c >/dev/null 2>&1; then
19982                 echo "We'll be including <net/errno.h>." >&4
19983         else
19984                 echo "We won't be including <net/errno.h>." >&4
19985                 val="$undef"
19986         fi
19987         $rm -f try.* try
19988         ;;
19989 esac
19990 set i_neterrno
19991 eval $setvar
19992
19993 : see if netinet/tcp.h is available
19994 set netinet/tcp.h i_netinettcp
19995 eval $inhdr
19996
19997 : see if this is a poll.h system
19998 set poll.h i_poll
19999 eval $inhdr
20000
20001 : see if this is a prot.h system
20002 set prot.h i_prot
20003 eval $inhdr
20004
20005 echo " "
20006 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
20007 $cat <<'EOSH' > Cppsym.know
20008 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20009 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20010 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20011 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20012 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20013 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20014 bull c cadmus clipper CMU COFF COMPILER_VERSION
20015 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20016 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20017 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20018 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20019 GLIBC GLIBC_MINOR
20020 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20021 H3050R H3050RX hbullx20 hcx host_mips
20022 hp200 hp300 hp700 HP700 hp800 hp9000
20023 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20024 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20025 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20026 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20027 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20028 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20029 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20030 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20031 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20032 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20033 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20034 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20035 MATH_HAS_NO_SIDE_EFFECTS
20036 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20037 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20038 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20039 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20040 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20041 NetBSD news1500 news1700 news1800 news1900 news3700
20042 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20043 ns32016 ns32332 ns32k nsc32000
20044 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20045 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20046 pc532 pdp11 PGC PIC plexus PORTAR posix
20047 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20048 POSIX_C_SOURCE POSIX_SOURCE POWER
20049 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
20050 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20051 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20052 sony sony_news sonyrisc sparc sparclite spectrum
20053 stardent stdc STDC_EXT stratos sun sun3 sun386
20054 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20055 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20056 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20057 sysV68 sysV88 Tek4132 Tek4300 titan
20058 TM3200 TM5400 TM5600
20059 tower tower32 tower32_200 tower32_600 tower32_700
20060 tower32_800 tower32_850 tss
20061 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20062 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20063 unix UNIX95 UNIX99 unixpc unos
20064 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20065 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20066 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20067 USGr4 USGr4_2
20068 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20069 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20070 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20071 z8000
20072 EOSH
20073 # Maybe put other stuff here too.
20074 cat <<EOSH >>Cppsym.know
20075 $osname
20076 EOSH
20077 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20078 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20079 $cat Cppsym.know > Cppsym.c
20080 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20081 $rm -f Cppsym.a Cppsym.b Cppsym.c
20082 cat <<EOSH > Cppsym
20083 $startsh
20084 if $test \$# -gt 0; then
20085     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20086     if $test -s Cppsym.got; then
20087         $rm -f Cppsym.got
20088         exit 0
20089     fi
20090     $rm -f Cppsym.got
20091     exit 1
20092 else
20093     $tr " " "$trnl" | ./Cppsym.try
20094     exit 0
20095 fi
20096 EOSH
20097 chmod +x Cppsym
20098 $eunicefix Cppsym
20099 cat <<EOSH > Cppsym.try
20100 $startsh
20101 cat <<'EOCP' > try.c
20102 #include <stdio.h>
20103 int main() {
20104 EOCP
20105 $awk \\
20106 EOSH
20107 cat <<'EOSH' >> Cppsym.try
20108 'length($1) > 0 {
20109     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
20110     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
20111     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
20112     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
20113 }'       >> try.c
20114 echo 'return 0;}' >> try.c
20115 EOSH
20116 cat <<EOSH >> Cppsym.try
20117 ccflags="$ccflags"
20118 case "$osname-$gccversion" in
20119 irix-) ccflags="\$ccflags -woff 1178" ;;
20120 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20121 esac
20122 $cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
20123 EOSH
20124 chmod +x Cppsym.try
20125 $eunicefix Cppsym.try
20126 ./Cppsym < Cppsym.know > Cppsym.true
20127 : now check the C compiler for additional symbols
20128 postprocess_cc_v=''
20129 case "$osname" in
20130 aix) postprocess_cc_v="|$tr , ' '" ;;
20131 esac
20132 $cat >ccsym <<EOS
20133 $startsh
20134 $cat >tmp.c <<EOF
20135 extern int foo;
20136 EOF
20137 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20138 do
20139         case "\$i" in
20140         -D*) echo "\$i" | $sed 's/^-D//';;
20141         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
20142         esac
20143 done
20144 $rm -f try.c
20145 EOS
20146 postprocess_cc_v=''
20147 chmod +x ccsym
20148 $eunicefix ccsym
20149 ./ccsym > ccsym1.raw
20150 if $test -s ccsym1.raw; then
20151        $sort ccsym1.raw | $uniq >ccsym.raw
20152 else
20153        mv ccsym1.raw ccsym.raw
20154 fi
20155
20156 $awk '/\=/ { print $0; next }
20157         { print $0"=1" }' ccsym.raw >ccsym.list
20158 $awk '/\=/ { print $0; next }
20159         { print $0"=1" }' Cppsym.true >ccsym.true
20160 $comm -13 ccsym.true ccsym.list >ccsym.own
20161 $comm -12 ccsym.true ccsym.list >ccsym.com
20162 $comm -23 ccsym.true ccsym.list >ccsym.cpp
20163 also=''
20164 if $test -z ccsym.raw; then
20165         echo "Your C compiler doesn't seem to define any symbols!" >&4
20166         echo " "
20167         echo "However, your C preprocessor defines the following symbols:"
20168         $cat Cppsym.true
20169         ccsymbols=''
20170         cppsymbols=`$cat Cppsym.true`
20171         cppsymbols=`echo $cppsymbols`
20172         cppccsymbols="$cppsymbols"
20173 else
20174         if $test -s ccsym.com; then
20175                 echo "Your C compiler and pre-processor define these symbols:"
20176                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20177                 also='also '
20178                 symbols='ones'
20179                 cppccsymbols=`$cat ccsym.com`
20180                 cppccsymbols=`echo $cppccsymbols`
20181                 $test "$silent" || sleep 1
20182         fi
20183         if $test -s ccsym.cpp; then
20184                 $test "$also" && echo " "
20185                 echo "Your C pre-processor ${also}defines the following symbols:"
20186                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20187                 also='further '
20188                 cppsymbols=`$cat ccsym.cpp`
20189                 cppsymbols=`echo $cppsymbols`
20190                 $test "$silent" || sleep 1
20191         fi
20192         if $test -s ccsym.own; then
20193                 $test "$also" && echo " "
20194                 echo "Your C compiler ${also}defines the following cpp symbols:"
20195                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20196                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20197                 ccsymbols=`$cat ccsym.own`
20198                 ccsymbols=`echo $ccsymbols`
20199                 $test "$silent" || sleep 1
20200         fi
20201 fi
20202
20203 : see if this is a termio system
20204 val="$undef"
20205 val2="$undef"
20206 val3="$undef"
20207 if $test `./findhdr termios.h`; then
20208         set tcsetattr i_termios
20209         eval $inlibc
20210         val3="$i_termios"
20211 fi
20212 echo " "
20213 case "$val3" in
20214 "$define") echo "You have POSIX termios.h... good!" >&4;;
20215 *) if ./Cppsym pyr; then
20216                 case "`/bin/universe`" in
20217                 ucb) if $test `./findhdr sgtty.h`; then
20218                                 val2="$define"
20219                                 echo "<sgtty.h> found." >&4
20220                         else
20221                                 echo "System is pyramid with BSD universe."
20222                                 echo "<sgtty.h> not found--you could have problems." >&4
20223                         fi;;
20224                 *) if $test `./findhdr termio.h`; then
20225                                 val="$define"
20226                                 echo "<termio.h> found." >&4
20227                         else
20228                                 echo "System is pyramid with USG universe."
20229                                 echo "<termio.h> not found--you could have problems." >&4
20230                         fi;;
20231                 esac
20232         elif ./usg; then
20233                 if $test `./findhdr termio.h`; then
20234                         echo "<termio.h> found." >&4
20235                         val="$define"
20236                 elif $test `./findhdr sgtty.h`; then
20237                         echo "<sgtty.h> found." >&4
20238                         val2="$define"
20239                 else
20240 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20241                 fi
20242         else
20243                 if $test `./findhdr sgtty.h`; then
20244                         echo "<sgtty.h> found." >&4
20245                         val2="$define"
20246                 elif $test `./findhdr termio.h`; then
20247                         echo "<termio.h> found." >&4
20248                         val="$define"
20249                 else
20250 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20251                 fi
20252         fi;;
20253 esac
20254 set i_termio; eval $setvar
20255 val=$val2; set i_sgtty; eval $setvar
20256 val=$val3; set i_termios; eval $setvar
20257
20258 : see if stddef is available
20259 set stddef.h i_stddef
20260 eval $inhdr
20261
20262 : see if this is a sunmath.h system
20263 set sunmath.h i_sunmath
20264 eval $inhdr
20265
20266 : see if sys/access.h is available
20267 set sys/access.h i_sysaccess
20268 eval $inhdr
20269
20270 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20271 set sys/filio.h i_sysfilio
20272 eval $inhdr
20273 echo " "
20274 if $test `./findhdr sys/ioctl.h`; then
20275         val="$define"
20276         echo '<sys/ioctl.h> found.' >&4
20277 else
20278         val="$undef"
20279         if $test $i_sysfilio = "$define"; then
20280             echo '<sys/ioctl.h> NOT found.' >&4
20281         else
20282                 $test $i_sgtty = "$define" && xxx="sgtty.h"
20283                 $test $i_termio = "$define" && xxx="termio.h"
20284                 $test $i_termios = "$define" && xxx="termios.h"
20285 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20286         fi
20287 fi
20288 set i_sysioctl
20289 eval $setvar
20290
20291 : see if socket ioctl defs are in sys/sockio.h
20292 echo " "
20293 xxx=`./findhdr sys/sockio.h`
20294 if $test "$xxx"; then
20295         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20296                 val="$define"
20297                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20298         else
20299                 val="$undef"
20300                 echo "No socket ioctls found in <sys/sockio.h>." >&4
20301         fi
20302 else
20303         val="$undef"
20304         $cat <<EOM
20305 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20306 EOM
20307 fi
20308 set i_syssockio
20309 eval $setvar
20310
20311
20312 : see if this is a syslog.h system
20313 set syslog.h i_syslog
20314 eval $inhdr
20315
20316
20317 : see if this is a sys/mode.h system
20318 set sys/mode.h i_sysmode
20319 eval $inhdr
20320
20321 : see if sys/resource.h has to be included
20322 set sys/resource.h i_sysresrc
20323 eval $inhdr
20324
20325 : see if sys/security.h is available
20326 set sys/security.h i_syssecrt
20327 eval $inhdr
20328
20329 : see if this is a sys/statvfs.h system
20330 set sys/statvfs.h i_sysstatvfs
20331 eval $inhdr
20332
20333 : see if this is a sys/un.h system
20334 set sys/un.h i_sysun
20335 eval $inhdr
20336
20337
20338 : see if this is a sys/utsname.h system
20339 set sys/utsname.h i_sysutsname
20340 eval $inhdr
20341
20342 : see if this is a syswait system
20343 set sys/wait.h i_syswait
20344 eval $inhdr
20345
20346 : see if this is a ustat.h system
20347 set ustat.h i_ustat
20348 eval $inhdr
20349
20350 : see if this is an utime system
20351 set utime.h i_utime
20352 eval $inhdr
20353
20354 : see if this is a values.h system
20355 set values.h i_values
20356 eval $inhdr
20357
20358 : see if this is a vfork system
20359 case "$d_vfork" in
20360 "$define")
20361         set vfork.h i_vfork
20362         eval $inhdr
20363         ;;
20364 *)
20365         i_vfork="$undef"
20366         ;;
20367 esac
20368
20369 : see if gdbm.h is available
20370 set gdbm.h t_gdbm
20371 eval $inhdr
20372 case "$t_gdbm" in
20373 $define)
20374         : see if gdbm_open exists
20375         set gdbm_open d_gdbm_open
20376         eval $inlibc
20377         case "$d_gdbm_open" in
20378         $undef)
20379                 t_gdbm="$undef"
20380                 echo "We won't be including <gdbm.h>"
20381                 ;;
20382         esac
20383         ;;
20384 esac
20385 val="$t_gdbm"
20386 set i_gdbm
20387 eval $setvar
20388
20389 echo " "
20390 echo "Looking for extensions..." >&4
20391 : If we are using the old config.sh, known_extensions may contain
20392 : old or inaccurate or duplicate values.
20393 known_extensions=''
20394 nonxs_extensions=''
20395 : We do not use find because it might not be available.
20396 : We do not just use MANIFEST because the user may have dropped
20397 : some additional extensions into the source tree and expect them
20398 : to be built.
20399
20400 : Function to recursively find available extensions, ignoring DynaLoader
20401 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
20402 find_extensions='
20403     for xxx in *; do
20404        case "$xxx" in
20405            DynaLoader|dynaload) ;;
20406            *)
20407            if $test -f $xxx/$xxx.xs; then
20408                known_extensions="$known_extensions $1$xxx";
20409            elif $test -f $xxx/Makefile.PL; then
20410                nonxs_extensions="$nonxs_extensions $1$xxx";
20411            else
20412                if $test -d $xxx -a $# -lt 10; then
20413                    set $1$xxx/ $*;
20414                    cd "$xxx";
20415                    eval $find_extensions;
20416                    cd ..;
20417                    shift;
20418                fi;
20419            fi
20420            ;;
20421        esac;
20422     done'
20423 tdir=`pwd`
20424 cd "$rsrc/ext"
20425 set X
20426 shift
20427 eval $find_extensions
20428 # Special case:  Add in threads/shared since it is not picked up by the
20429 # recursive find above (and adding in general recursive finding breaks
20430 # SDBM_File/sdbm).  A.D.  10/25/2001.
20431 known_extensions="$known_extensions threads/shared"
20432 set X $nonxs_extensions
20433 shift
20434 nonxs_extensions="$*"
20435 set X $known_extensions
20436 shift
20437 known_extensions="$*"
20438 cd "$tdir"
20439
20440 : Now see which are supported on this system.
20441 avail_ext=''
20442 for xxx in $known_extensions ; do
20443         case "$xxx" in
20444         DB_File|db_file)
20445                 case "$i_db" in
20446                 $define) avail_ext="$avail_ext $xxx" ;;
20447                 esac
20448                 ;;
20449         GDBM_File|gdbm_fil)
20450                 case "$i_gdbm" in 
20451                 $define) avail_ext="$avail_ext $xxx" ;;
20452                 esac
20453                 ;;
20454         I18N/Langinfo|i18n_lan)
20455                 case "$i_langinfo$d_nl_langinfo" in 
20456                 $define$define) avail_ext="$avail_ext $xxx" ;;
20457                 esac
20458                 ;;
20459         NDBM_File|ndbm_fil)
20460                 case "$i_ndbm" in
20461                 $define)
20462                     case "$osname-$use64bitint" in
20463                     hpux-define)
20464                         case "$libs" in
20465                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
20466                         esac
20467                         ;;
20468                     *) avail_ext="$avail_ext $xxx" ;;
20469                     esac
20470                     ;;
20471                 esac
20472                 ;;
20473         ODBM_File|odbm_fil) 
20474                 case "${i_dbm}${i_rpcsvcdbm}" in
20475                 *"${define}"*)
20476                     case "$osname-$use64bitint" in
20477                     hpux-define)
20478                         case "$libs" in
20479                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
20480                         esac
20481                         ;;
20482                     *) avail_ext="$avail_ext $xxx" ;;
20483                     esac
20484                     ;;
20485                 esac
20486                 ;;
20487         POSIX|posix)
20488                 case "$useposix" in
20489                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20490                 esac
20491                 ;;
20492         Opcode|opcode)
20493                 case "$useopcode" in
20494                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20495                 esac
20496                 ;;
20497         Socket|socket)
20498                 case "$d_socket" in 
20499                 true|$define|y)
20500                     case "$osname" in
20501                     beos) ;; # not unless BONE
20502                     *) avail_ext="$avail_ext $xxx" ;;
20503                     esac
20504                     ;;
20505                 esac
20506                 ;;
20507         Sys/Syslog|sys/syslog)
20508                 : XXX syslog requires socket
20509                 case "$d_socket" in 
20510                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
20511                 esac
20512                 ;;
20513         Thread|thread)
20514                 case "$usethreads" in
20515                 true|$define|y)
20516                         case "$useithreads" in
20517                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
20518                         esac
20519                 esac
20520                 ;;
20521         XS/APItest|xs/apitest)
20522                 # This is just for testing.  Skip it unless we have dynamic loading.
20523
20524                 case "$usedl" in
20525                 $define) avail_ext="$avail_ext $xxx" ;;
20526                 esac
20527                 ;;
20528         XS/Typemap|xs/typemap)
20529                 # This is just for testing.  Skip it unless we have dynamic loading.
20530                 case "$usedl" in
20531                 $define) avail_ext="$avail_ext $xxx" ;;
20532                 esac
20533                 ;;
20534         threads|threads/shared)
20535                 # threads and threads::shared are special cases.
20536                 # To stop people from asking "Perl 5.8.0 was supposed
20537                 # to have this new fancy threads implementation but my
20538                 # perl doesn't have it" and from people trying to
20539                 # (re)install the threads module using CPAN.pm and
20540                 # CPAN.pm then offering to reinstall Perl 5.8.0,
20541                 # the threads.pm and threads/shared.pm will always be
20542                 # there, croaking informatively ("you need to rebuild
20543                 # all of Perl with threads, sorry") when threads haven't
20544                 # been compiled in.
20545                 # --jhi
20546                 avail_ext="$avail_ext $xxx"
20547                 ;;
20548         IPC/SysV|ipc/sysv)
20549                 : XXX Do we need a useipcsysv variable here
20550                 case "${d_msg}${d_sem}${d_shm}" in 
20551                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
20552                 esac
20553                 ;;
20554         *)      avail_ext="$avail_ext $xxx"
20555                 ;;
20556         esac
20557 done
20558
20559 set X $avail_ext
20560 shift
20561 avail_ext="$*"
20562
20563 case "$onlyextensions" in
20564 '') ;;
20565 *)  keepextensions=''
20566     echo "You have requested that only certains extensions be included..." >&4
20567     for i in $onlyextensions; do
20568         case " $avail_ext " in
20569         *" $i "*)
20570             echo "Keeping extension $i."
20571             keepextensions="$keepextensions $i"
20572             ;;
20573         *) echo "Ignoring extension $i." ;;
20574         esac
20575     done
20576     avail_ext="$keepextensions"
20577     ;;
20578 esac
20579
20580 case "$noextensions" in
20581 '') ;;
20582 *)  keepextensions=''
20583     echo "You have requested that certain extensions be ignored..." >&4
20584     for i in $avail_ext; do
20585         case " $noextensions " in
20586         *" $i "*) echo "Ignoring extension $i." ;;
20587         *) echo "Keeping extension $i.";
20588            keepextensions="$keepextensions $i"
20589            ;;
20590         esac
20591     done
20592     avail_ext="$keepextensions"
20593     ;;
20594 esac
20595
20596 : Now see which nonxs extensions are supported on this system.
20597 : For now assume all are.
20598 nonxs_ext=''
20599 for xxx in $nonxs_extensions ; do
20600         case "$xxx" in
20601         *)      nonxs_ext="$nonxs_ext $xxx"
20602                 ;;
20603         esac
20604 done
20605
20606 set X $nonxs_ext
20607 shift
20608 nonxs_ext="$*"
20609
20610 case $usedl in
20611 $define)
20612         $cat <<EOM
20613 A number of extensions are supplied with $package.  You may choose to
20614 compile these extensions for dynamic loading (the default), compile
20615 them into the $package executable (static loading), or not include
20616 them at all.  Answer "none" to include no extensions.
20617 Note that DynaLoader is always built and need not be mentioned here.
20618
20619 EOM
20620         case "$dynamic_ext" in
20621         '')
20622                 : Exclude those listed in static_ext
20623                 dflt=''
20624                 for xxx in $avail_ext; do
20625                         case " $static_ext " in
20626                         *" $xxx "*) ;;
20627                         *) dflt="$dflt $xxx" ;;
20628                         esac
20629                 done
20630                 set X $dflt
20631                 shift
20632                 dflt="$*"
20633                 ;;
20634         *)      dflt="$dynamic_ext"
20635                 # Perhaps we are reusing an old out-of-date config.sh.
20636                 case "$hint" in
20637                 previous)
20638                         if test X"$dynamic_ext" != X"$avail_ext"; then
20639                                 $cat <<EOM
20640 NOTICE:  Your previous config.sh list may be incorrect. 
20641 The extensions now available to you are 
20642         ${avail_ext}
20643 but the default list from your previous config.sh is
20644         ${dynamic_ext} 
20645
20646 EOM
20647                         fi
20648                         ;;
20649                 esac
20650                 ;;
20651         esac
20652         case "$dflt" in
20653         '')     dflt=none;;
20654         esac
20655         rp="What extensions do you wish to load dynamically?"
20656         . ./myread
20657         case "$ans" in
20658         none) dynamic_ext=' ' ;;
20659         *) dynamic_ext="$ans" ;;
20660         esac
20661
20662         case "$static_ext" in
20663         '')
20664                 : Exclude those already listed in dynamic linking
20665                 dflt=''
20666                 for xxx in $avail_ext; do
20667                         case " $dynamic_ext " in
20668                         *" $xxx "*) ;;
20669                         *) dflt="$dflt $xxx" ;;
20670                         esac
20671                 done
20672                 set X $dflt
20673                 shift
20674                 dflt="$*"
20675                 ;;
20676         *)  dflt="$static_ext" 
20677                 ;;
20678         esac
20679
20680         case "$dflt" in
20681         '')     dflt=none;;
20682         esac
20683         rp="What extensions do you wish to load statically?"
20684         . ./myread
20685         case "$ans" in
20686         none) static_ext=' ' ;;
20687         *) static_ext="$ans" ;;
20688         esac
20689         ;;
20690 *)
20691         $cat <<EOM
20692 A number of extensions are supplied with $package.  Answer "none" 
20693 to include no extensions. 
20694 Note that DynaLoader is always built and need not be mentioned here.
20695
20696 EOM
20697         case "$static_ext" in
20698         '') dflt="$avail_ext" ;;
20699         *)      dflt="$static_ext"
20700                 # Perhaps we are reusing an old out-of-date config.sh.
20701                 case "$hint" in
20702                 previous)
20703                         if test X"$static_ext" != X"$avail_ext"; then
20704                                 $cat <<EOM
20705 NOTICE:  Your previous config.sh list may be incorrect. 
20706 The extensions now available to you are 
20707         ${avail_ext}
20708 but the default list from your previous config.sh is
20709         ${static_ext} 
20710
20711 EOM
20712                         fi
20713                         ;;
20714                 esac
20715                 ;;
20716         esac
20717         : Exclude those that are not xs extensions
20718         case "$dflt" in
20719         '')     dflt=none;;
20720         esac
20721         rp="What extensions do you wish to include?"
20722         . ./myread
20723         case "$ans" in
20724         none) static_ext=' ' ;;
20725         *) static_ext="$ans" ;;
20726         esac
20727         ;;
20728 esac
20729 #        
20730 # Encode is a special case.  If we are building Encode as a static
20731 # extension, we need to explicitly list its subextensions as well.
20732 # For other nested extensions, this is handled automatically by
20733 # the appropriate Makefile.PL.
20734 case " $static_ext " in
20735         *" Encode "*) # Add the subextensions of Encode
20736         cd "$rsrc/ext"
20737         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
20738                 static_ext="$static_ext Encode/$xxx"
20739         done
20740         cd "$tdir"
20741         ;;
20742 esac
20743
20744 set X $dynamic_ext $static_ext $nonxs_ext
20745 shift
20746 extensions="$*"
20747
20748 # Sanity check:  We require an extension suitable for use with
20749 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
20750 # should show up as failures in the test suite, but it's helpful to
20751 # catch them now.) The 'extensions' list is normally sorted
20752 # alphabetically, so we need to accept either
20753 #    DB_File ... Fcntl ... IO  ....
20754 # or something like
20755 #    Fcntl ... NDBM_File ... IO  ....
20756 case " $extensions"  in
20757 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
20758 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
20759 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
20760 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
20761    echo "WARNING: The Perl you are building will be quite crippled." >& 4
20762    ;;
20763 esac
20764
20765 : Remove libraries needed only for extensions
20766 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
20767 : The exception is SunOS 4.x, which needs them.
20768 case "${osname}X${osvers}" in
20769 sunos*X4*)
20770     perllibs="$libs"
20771     ;;
20772 *) case "$usedl" in
20773     $define|true|[yY]*)
20774             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
20775             shift
20776             perllibs="$*"
20777             ;;
20778     *)  perllibs="$libs"
20779             ;;
20780     esac
20781     ;;
20782 esac
20783
20784 : Remove build directory name from cppstdin so it can be used from
20785 : either the present location or the final installed location.
20786 echo " "
20787 : Get out of the UU directory to get correct path name.
20788 cd ..
20789 case "$cppstdin" in
20790 `pwd`/cppstdin)
20791         echo "Stripping down cppstdin path name"
20792         cppstdin=cppstdin
20793         ;;
20794 esac
20795 cd UU
20796
20797 : end of configuration questions
20798 echo " "
20799 echo "End of configuration questions."
20800 echo " "
20801
20802 : back to where it started
20803 if test -d ../UU; then
20804         cd ..
20805 fi
20806
20807 : configuration may be patched via a 'config.arch' file
20808 if $test -f config.arch; then
20809         echo "I see a config.arch file, loading it."
20810         . ./config.arch
20811 fi
20812
20813 : configuration may be patched via a 'config.over' file
20814 if $test -f config.over; then
20815         echo " "
20816         dflt=y
20817         rp='I see a config.over file.  Do you wish to load it?'
20818         . UU/myread
20819         case "$ans" in
20820         n*) echo "OK, I'll ignore it.";;
20821         *)      . ./config.over
20822                 echo "Configuration override changes have been loaded."
20823                 ;;
20824         esac
20825 fi
20826
20827 : in case they want portability, strip down executable paths
20828 case "$d_portable" in
20829 "$define")
20830         echo " "
20831         echo "Stripping down executable paths..." >&4
20832         for file in $loclist $trylist; do
20833                 eval temp=\$$file
20834                 eval $file=`basename $temp`
20835         done
20836         ;;
20837 esac
20838
20839 : create config.sh file
20840 echo " "
20841 echo "Creating config.sh..." >&4
20842 $spitshell <<EOT >config.sh
20843 $startsh
20844 #
20845 # This file was produced by running the Configure script. It holds all the
20846 # definitions figured out by Configure. Should you modify one of these values,
20847 # do not forget to propagate your changes by running "Configure -der". You may
20848 # instead choose to run each of the .SH files by yourself, or "Configure -S".
20849 #
20850
20851 # Package name      : $package
20852 # Source directory  : $src
20853 # Configuration time: $cf_time
20854 # Configured by     : $cf_by
20855 # Target system     : $myuname
20856
20857 Author='$Author'
20858 Date='$Date'
20859 Header='$Header'
20860 Id='$Id'
20861 Locker='$Locker'
20862 Log='$Log'
20863 Mcc='$Mcc'
20864 RCSfile='$RCSfile'
20865 Revision='$Revision'
20866 Source='$Source'
20867 State='$State'
20868 _a='$_a'
20869 _exe='$_exe'
20870 _o='$_o'
20871 afs='$afs'
20872 afsroot='$afsroot'
20873 alignbytes='$alignbytes'
20874 ansi2knr='$ansi2knr'
20875 aphostname='$aphostname'
20876 api_revision='$api_revision'
20877 api_subversion='$api_subversion'
20878 api_version='$api_version'
20879 api_versionstring='$api_versionstring'
20880 ar='$ar'
20881 archlib='$archlib'
20882 archlibexp='$archlibexp'
20883 archname64='$archname64'
20884 archname='$archname'
20885 archobjs='$archobjs'
20886 asctime_r_proto='$asctime_r_proto'
20887 awk='$awk'
20888 baserev='$baserev'
20889 bash='$bash'
20890 bin='$bin'
20891 binexp='$binexp'
20892 bison='$bison'
20893 byacc='$byacc'
20894 byteorder='$byteorder'
20895 c='$c'
20896 castflags='$castflags'
20897 cat='$cat'
20898 cc='$cc'
20899 cccdlflags='$cccdlflags'
20900 ccdlflags='$ccdlflags'
20901 ccflags='$ccflags'
20902 ccflags_uselargefiles='$ccflags_uselargefiles'
20903 ccname='$ccname'
20904 ccsymbols='$ccsymbols'
20905 ccversion='$ccversion'
20906 cf_by='$cf_by'
20907 cf_email='$cf_email'
20908 cf_time='$cf_time'
20909 charsize='$charsize'
20910 chgrp='$chgrp'
20911 chmod='$chmod'
20912 chown='$chown'
20913 clocktype='$clocktype'
20914 comm='$comm'
20915 compress='$compress'
20916 contains='$contains'
20917 cp='$cp'
20918 cpio='$cpio'
20919 cpp='$cpp'
20920 cpp_stuff='$cpp_stuff'
20921 cppccsymbols='$cppccsymbols'
20922 cppflags='$cppflags'
20923 cpplast='$cpplast'
20924 cppminus='$cppminus'
20925 cpprun='$cpprun'
20926 cppstdin='$cppstdin'
20927 cppsymbols='$cppsymbols'
20928 crypt_r_proto='$crypt_r_proto'
20929 cryptlib='$cryptlib'
20930 csh='$csh'
20931 ctermid_r_proto='$ctermid_r_proto'
20932 ctime_r_proto='$ctime_r_proto'
20933 d_Gconvert='$d_Gconvert'
20934 d_PRIEUldbl='$d_PRIEUldbl'
20935 d_PRIFUldbl='$d_PRIFUldbl'
20936 d_PRIGUldbl='$d_PRIGUldbl'
20937 d_PRIXU64='$d_PRIXU64'
20938 d_PRId64='$d_PRId64'
20939 d_PRIeldbl='$d_PRIeldbl'
20940 d_PRIfldbl='$d_PRIfldbl'
20941 d_PRIgldbl='$d_PRIgldbl'
20942 d_PRIi64='$d_PRIi64'
20943 d_PRIo64='$d_PRIo64'
20944 d_PRIu64='$d_PRIu64'
20945 d_PRIx64='$d_PRIx64'
20946 d_SCNfldbl='$d_SCNfldbl'
20947 d__fwalk='$d__fwalk'
20948 d_access='$d_access'
20949 d_accessx='$d_accessx'
20950 d_aintl='$d_aintl'
20951 d_alarm='$d_alarm'
20952 d_archlib='$d_archlib'
20953 d_asctime_r='$d_asctime_r'
20954 d_atolf='$d_atolf'
20955 d_atoll='$d_atoll'
20956 d_attribute_format='$d_attribute_format'
20957 d_attribute_malloc='$d_attribute_malloc'
20958 d_attribute_nonnull='$d_attribute_nonnull'
20959 d_attribute_noreturn='$d_attribute_noreturn'
20960 d_attribute_pure='$d_attribute_pure'
20961 d_attribute_unused='$d_attribute_unused'
20962 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
20963 d_bcmp='$d_bcmp'
20964 d_bcopy='$d_bcopy'
20965 d_bsd='$d_bsd'
20966 d_bsdgetpgrp='$d_bsdgetpgrp'
20967 d_bsdsetpgrp='$d_bsdsetpgrp'
20968 d_bzero='$d_bzero'
20969 d_casti32='$d_casti32'
20970 d_castneg='$d_castneg'
20971 d_charvspr='$d_charvspr'
20972 d_chown='$d_chown'
20973 d_chroot='$d_chroot'
20974 d_chsize='$d_chsize'
20975 d_class='$d_class'
20976 d_closedir='$d_closedir'
20977 d_cmsghdr_s='$d_cmsghdr_s'
20978 d_const='$d_const'
20979 d_copysignl='$d_copysignl'
20980 d_crypt='$d_crypt'
20981 d_crypt_r='$d_crypt_r'
20982 d_csh='$d_csh'
20983 d_ctermid_r='$d_ctermid_r'
20984 d_ctime_r='$d_ctime_r'
20985 d_cuserid='$d_cuserid'
20986 d_dbl_dig='$d_dbl_dig'
20987 d_dbminitproto='$d_dbminitproto'
20988 d_difftime='$d_difftime'
20989 d_dirfd='$d_dirfd'
20990 d_dirnamlen='$d_dirnamlen'
20991 d_dlerror='$d_dlerror'
20992 d_dlopen='$d_dlopen'
20993 d_dlsymun='$d_dlsymun'
20994 d_dosuid='$d_dosuid'
20995 d_drand48_r='$d_drand48_r'
20996 d_drand48proto='$d_drand48proto'
20997 d_dup2='$d_dup2'
20998 d_eaccess='$d_eaccess'
20999 d_endgrent='$d_endgrent'
21000 d_endgrent_r='$d_endgrent_r'
21001 d_endhent='$d_endhent'
21002 d_endhostent_r='$d_endhostent_r'
21003 d_endnent='$d_endnent'
21004 d_endnetent_r='$d_endnetent_r'
21005 d_endpent='$d_endpent'
21006 d_endprotoent_r='$d_endprotoent_r'
21007 d_endpwent='$d_endpwent'
21008 d_endpwent_r='$d_endpwent_r'
21009 d_endsent='$d_endsent'
21010 d_endservent_r='$d_endservent_r'
21011 d_eofnblk='$d_eofnblk'
21012 d_eunice='$d_eunice'
21013 d_faststdio='$d_faststdio'
21014 d_fchdir='$d_fchdir'
21015 d_fchmod='$d_fchmod'
21016 d_fchown='$d_fchown'
21017 d_fcntl='$d_fcntl'
21018 d_fcntl_can_lock='$d_fcntl_can_lock'
21019 d_fd_macros='$d_fd_macros'
21020 d_fd_set='$d_fd_set'
21021 d_fds_bits='$d_fds_bits'
21022 d_fgetpos='$d_fgetpos'
21023 d_finite='$d_finite'
21024 d_finitel='$d_finitel'
21025 d_flexfnam='$d_flexfnam'
21026 d_flock='$d_flock'
21027 d_flockproto='$d_flockproto'
21028 d_fork='$d_fork'
21029 d_fp_class='$d_fp_class'
21030 d_fpathconf='$d_fpathconf'
21031 d_fpclass='$d_fpclass'
21032 d_fpclassify='$d_fpclassify'
21033 d_fpclassl='$d_fpclassl'
21034 d_fpos64_t='$d_fpos64_t'
21035 d_frexpl='$d_frexpl'
21036 d_fs_data_s='$d_fs_data_s'
21037 d_fseeko='$d_fseeko'
21038 d_fsetpos='$d_fsetpos'
21039 d_fstatfs='$d_fstatfs'
21040 d_fstatvfs='$d_fstatvfs'
21041 d_fsync='$d_fsync'
21042 d_ftello='$d_ftello'
21043 d_ftime='$d_ftime'
21044 d_getcwd='$d_getcwd'
21045 d_getespwnam='$d_getespwnam'
21046 d_getfsstat='$d_getfsstat'
21047 d_getgrent='$d_getgrent'
21048 d_getgrent_r='$d_getgrent_r'
21049 d_getgrgid_r='$d_getgrgid_r'
21050 d_getgrnam_r='$d_getgrnam_r'
21051 d_getgrps='$d_getgrps'
21052 d_gethbyaddr='$d_gethbyaddr'
21053 d_gethbyname='$d_gethbyname'
21054 d_gethent='$d_gethent'
21055 d_gethname='$d_gethname'
21056 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21057 d_gethostbyname_r='$d_gethostbyname_r'
21058 d_gethostent_r='$d_gethostent_r'
21059 d_gethostprotos='$d_gethostprotos'
21060 d_getitimer='$d_getitimer'
21061 d_getlogin='$d_getlogin'
21062 d_getlogin_r='$d_getlogin_r'
21063 d_getmnt='$d_getmnt'
21064 d_getmntent='$d_getmntent'
21065 d_getnbyaddr='$d_getnbyaddr'
21066 d_getnbyname='$d_getnbyname'
21067 d_getnent='$d_getnent'
21068 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21069 d_getnetbyname_r='$d_getnetbyname_r'
21070 d_getnetent_r='$d_getnetent_r'
21071 d_getnetprotos='$d_getnetprotos'
21072 d_getpagsz='$d_getpagsz'
21073 d_getpbyname='$d_getpbyname'
21074 d_getpbynumber='$d_getpbynumber'
21075 d_getpent='$d_getpent'
21076 d_getpgid='$d_getpgid'
21077 d_getpgrp2='$d_getpgrp2'
21078 d_getpgrp='$d_getpgrp'
21079 d_getppid='$d_getppid'
21080 d_getprior='$d_getprior'
21081 d_getprotobyname_r='$d_getprotobyname_r'
21082 d_getprotobynumber_r='$d_getprotobynumber_r'
21083 d_getprotoent_r='$d_getprotoent_r'
21084 d_getprotoprotos='$d_getprotoprotos'
21085 d_getprpwnam='$d_getprpwnam'
21086 d_getpwent='$d_getpwent'
21087 d_getpwent_r='$d_getpwent_r'
21088 d_getpwnam_r='$d_getpwnam_r'
21089 d_getpwuid_r='$d_getpwuid_r'
21090 d_getsbyname='$d_getsbyname'
21091 d_getsbyport='$d_getsbyport'
21092 d_getsent='$d_getsent'
21093 d_getservbyname_r='$d_getservbyname_r'
21094 d_getservbyport_r='$d_getservbyport_r'
21095 d_getservent_r='$d_getservent_r'
21096 d_getservprotos='$d_getservprotos'
21097 d_getspnam='$d_getspnam'
21098 d_getspnam_r='$d_getspnam_r'
21099 d_gettimeod='$d_gettimeod'
21100 d_gmtime_r='$d_gmtime_r'
21101 d_gnulibc='$d_gnulibc'
21102 d_grpasswd='$d_grpasswd'
21103 d_hasmntopt='$d_hasmntopt'
21104 d_htonl='$d_htonl'
21105 d_ilogbl='$d_ilogbl'
21106 d_index='$d_index'
21107 d_inetaton='$d_inetaton'
21108 d_int64_t='$d_int64_t'
21109 d_isascii='$d_isascii'
21110 d_isfinite='$d_isfinite'
21111 d_isinf='$d_isinf'
21112 d_isnan='$d_isnan'
21113 d_isnanl='$d_isnanl'
21114 d_killpg='$d_killpg'
21115 d_lchown='$d_lchown'
21116 d_ldbl_dig='$d_ldbl_dig'
21117 d_libm_lib_version='$d_libm_lib_version'
21118 d_link='$d_link'
21119 d_localtime_r='$d_localtime_r'
21120 d_locconv='$d_locconv'
21121 d_lockf='$d_lockf'
21122 d_longdbl='$d_longdbl'
21123 d_longlong='$d_longlong'
21124 d_lseekproto='$d_lseekproto'
21125 d_lstat='$d_lstat'
21126 d_madvise='$d_madvise'
21127 d_malloc_good_size='$d_malloc_good_size'
21128 d_malloc_size='$d_malloc_size'
21129 d_mblen='$d_mblen'
21130 d_mbstowcs='$d_mbstowcs'
21131 d_mbtowc='$d_mbtowc'
21132 d_memchr='$d_memchr'
21133 d_memcmp='$d_memcmp'
21134 d_memcpy='$d_memcpy'
21135 d_memmove='$d_memmove'
21136 d_memset='$d_memset'
21137 d_mkdir='$d_mkdir'
21138 d_mkdtemp='$d_mkdtemp'
21139 d_mkfifo='$d_mkfifo'
21140 d_mkstemp='$d_mkstemp'
21141 d_mkstemps='$d_mkstemps'
21142 d_mktime='$d_mktime'
21143 d_mmap='$d_mmap'
21144 d_modfl='$d_modfl'
21145 d_modfl_pow32_bug='$d_modfl_pow32_bug'
21146 d_modflproto='$d_modflproto'
21147 d_mprotect='$d_mprotect'
21148 d_msg='$d_msg'
21149 d_msg_ctrunc='$d_msg_ctrunc'
21150 d_msg_dontroute='$d_msg_dontroute'
21151 d_msg_oob='$d_msg_oob'
21152 d_msg_peek='$d_msg_peek'
21153 d_msg_proxy='$d_msg_proxy'
21154 d_msgctl='$d_msgctl'
21155 d_msgget='$d_msgget'
21156 d_msghdr_s='$d_msghdr_s'
21157 d_msgrcv='$d_msgrcv'
21158 d_msgsnd='$d_msgsnd'
21159 d_msync='$d_msync'
21160 d_munmap='$d_munmap'
21161 d_mymalloc='$d_mymalloc'
21162 d_nice='$d_nice'
21163 d_nl_langinfo='$d_nl_langinfo'
21164 d_nv_preserves_uv='$d_nv_preserves_uv'
21165 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
21166 d_off64_t='$d_off64_t'
21167 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21168 d_oldpthreads='$d_oldpthreads'
21169 d_oldsock='$d_oldsock'
21170 d_open3='$d_open3'
21171 d_pathconf='$d_pathconf'
21172 d_pause='$d_pause'
21173 d_perl_otherlibdirs='$d_perl_otherlibdirs'
21174 d_phostname='$d_phostname'
21175 d_pipe='$d_pipe'
21176 d_poll='$d_poll'
21177 d_portable='$d_portable'
21178 d_procselfexe='$d_procselfexe'
21179 d_pthread_atfork='$d_pthread_atfork'
21180 d_pthread_attr_setscope='$d_pthread_attr_setscope'
21181 d_pthread_yield='$d_pthread_yield'
21182 d_pwage='$d_pwage'
21183 d_pwchange='$d_pwchange'
21184 d_pwclass='$d_pwclass'
21185 d_pwcomment='$d_pwcomment'
21186 d_pwexpire='$d_pwexpire'
21187 d_pwgecos='$d_pwgecos'
21188 d_pwpasswd='$d_pwpasswd'
21189 d_pwquota='$d_pwquota'
21190 d_qgcvt='$d_qgcvt'
21191 d_quad='$d_quad'
21192 d_random_r='$d_random_r'
21193 d_readdir64_r='$d_readdir64_r'
21194 d_readdir='$d_readdir'
21195 d_readdir_r='$d_readdir_r'
21196 d_readlink='$d_readlink'
21197 d_readv='$d_readv'
21198 d_recvmsg='$d_recvmsg'
21199 d_rename='$d_rename'
21200 d_rewinddir='$d_rewinddir'
21201 d_rmdir='$d_rmdir'
21202 d_safebcpy='$d_safebcpy'
21203 d_safemcpy='$d_safemcpy'
21204 d_sanemcmp='$d_sanemcmp'
21205 d_sbrkproto='$d_sbrkproto'
21206 d_scalbnl='$d_scalbnl'
21207 d_sched_yield='$d_sched_yield'
21208 d_scm_rights='$d_scm_rights'
21209 d_seekdir='$d_seekdir'
21210 d_select='$d_select'
21211 d_sem='$d_sem'
21212 d_semctl='$d_semctl'
21213 d_semctl_semid_ds='$d_semctl_semid_ds'
21214 d_semctl_semun='$d_semctl_semun'
21215 d_semget='$d_semget'
21216 d_semop='$d_semop'
21217 d_sendmsg='$d_sendmsg'
21218 d_setegid='$d_setegid'
21219 d_seteuid='$d_seteuid'
21220 d_setgrent='$d_setgrent'
21221 d_setgrent_r='$d_setgrent_r'
21222 d_setgrps='$d_setgrps'
21223 d_sethent='$d_sethent'
21224 d_sethostent_r='$d_sethostent_r'
21225 d_setitimer='$d_setitimer'
21226 d_setlinebuf='$d_setlinebuf'
21227 d_setlocale='$d_setlocale'
21228 d_setlocale_r='$d_setlocale_r'
21229 d_setnent='$d_setnent'
21230 d_setnetent_r='$d_setnetent_r'
21231 d_setpent='$d_setpent'
21232 d_setpgid='$d_setpgid'
21233 d_setpgrp2='$d_setpgrp2'
21234 d_setpgrp='$d_setpgrp'
21235 d_setprior='$d_setprior'
21236 d_setproctitle='$d_setproctitle'
21237 d_setprotoent_r='$d_setprotoent_r'
21238 d_setpwent='$d_setpwent'
21239 d_setpwent_r='$d_setpwent_r'
21240 d_setregid='$d_setregid'
21241 d_setresgid='$d_setresgid'
21242 d_setresuid='$d_setresuid'
21243 d_setreuid='$d_setreuid'
21244 d_setrgid='$d_setrgid'
21245 d_setruid='$d_setruid'
21246 d_setsent='$d_setsent'
21247 d_setservent_r='$d_setservent_r'
21248 d_setsid='$d_setsid'
21249 d_setvbuf='$d_setvbuf'
21250 d_sfio='$d_sfio'
21251 d_shm='$d_shm'
21252 d_shmat='$d_shmat'
21253 d_shmatprototype='$d_shmatprototype'
21254 d_shmctl='$d_shmctl'
21255 d_shmdt='$d_shmdt'
21256 d_shmget='$d_shmget'
21257 d_sigaction='$d_sigaction'
21258 d_sigprocmask='$d_sigprocmask'
21259 d_sigsetjmp='$d_sigsetjmp'
21260 d_sockatmark='$d_sockatmark'
21261 d_sockatmarkproto='$d_sockatmarkproto'
21262 d_socket='$d_socket'
21263 d_socklen_t='$d_socklen_t'
21264 d_sockpair='$d_sockpair'
21265 d_socks5_init='$d_socks5_init'
21266 d_sqrtl='$d_sqrtl'
21267 d_srand48_r='$d_srand48_r'
21268 d_srandom_r='$d_srandom_r'
21269 d_sresgproto='$d_sresgproto'
21270 d_sresuproto='$d_sresuproto'
21271 d_statblks='$d_statblks'
21272 d_statfs_f_flags='$d_statfs_f_flags'
21273 d_statfs_s='$d_statfs_s'
21274 d_statvfs='$d_statvfs'
21275 d_stdio_cnt_lval='$d_stdio_cnt_lval'
21276 d_stdio_ptr_lval='$d_stdio_ptr_lval'
21277 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21278 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
21279 d_stdio_stream_array='$d_stdio_stream_array'
21280 d_stdiobase='$d_stdiobase'
21281 d_stdstdio='$d_stdstdio'
21282 d_strchr='$d_strchr'
21283 d_strcoll='$d_strcoll'
21284 d_strctcpy='$d_strctcpy'
21285 d_strerrm='$d_strerrm'
21286 d_strerror='$d_strerror'
21287 d_strerror_r='$d_strerror_r'
21288 d_strftime='$d_strftime'
21289 d_strlcat='$d_strlcat'
21290 d_strlcpy='$d_strlcpy'
21291 d_strtod='$d_strtod'
21292 d_strtol='$d_strtol'
21293 d_strtold='$d_strtold'
21294 d_strtoll='$d_strtoll'
21295 d_strtoq='$d_strtoq'
21296 d_strtoul='$d_strtoul'
21297 d_strtoull='$d_strtoull'
21298 d_strtouq='$d_strtouq'
21299 d_strxfrm='$d_strxfrm'
21300 d_suidsafe='$d_suidsafe'
21301 d_symlink='$d_symlink'
21302 d_syscall='$d_syscall'
21303 d_syscallproto='$d_syscallproto'
21304 d_sysconf='$d_sysconf'
21305 d_sysernlst='$d_sysernlst'
21306 d_syserrlst='$d_syserrlst'
21307 d_system='$d_system'
21308 d_tcgetpgrp='$d_tcgetpgrp'
21309 d_tcsetpgrp='$d_tcsetpgrp'
21310 d_telldir='$d_telldir'
21311 d_telldirproto='$d_telldirproto'
21312 d_time='$d_time'
21313 d_times='$d_times'
21314 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21315 d_tm_tm_zone='$d_tm_tm_zone'
21316 d_tmpnam_r='$d_tmpnam_r'
21317 d_truncate='$d_truncate'
21318 d_ttyname_r='$d_ttyname_r'
21319 d_tzname='$d_tzname'
21320 d_u32align='$d_u32align'
21321 d_ualarm='$d_ualarm'
21322 d_umask='$d_umask'
21323 d_uname='$d_uname'
21324 d_union_semun='$d_union_semun'
21325 d_unordered='$d_unordered'
21326 d_usleep='$d_usleep'
21327 d_usleepproto='$d_usleepproto'
21328 d_ustat='$d_ustat'
21329 d_vendorarch='$d_vendorarch'
21330 d_vendorbin='$d_vendorbin'
21331 d_vendorlib='$d_vendorlib'
21332 d_vendorscript='$d_vendorscript'
21333 d_vfork='$d_vfork'
21334 d_void_closedir='$d_void_closedir'
21335 d_voidsig='$d_voidsig'
21336 d_voidtty='$d_voidtty'
21337 d_volatile='$d_volatile'
21338 d_vprintf='$d_vprintf'
21339 d_wait4='$d_wait4'
21340 d_waitpid='$d_waitpid'
21341 d_wcstombs='$d_wcstombs'
21342 d_wctomb='$d_wctomb'
21343 d_writev='$d_writev'
21344 d_xenix='$d_xenix'
21345 date='$date'
21346 db_hashtype='$db_hashtype'
21347 db_prefixtype='$db_prefixtype'
21348 db_version_major='$db_version_major'
21349 db_version_minor='$db_version_minor'
21350 db_version_patch='$db_version_patch'
21351 defvoidused='$defvoidused'
21352 direntrytype='$direntrytype'
21353 dlext='$dlext'
21354 dlsrc='$dlsrc'
21355 doublesize='$doublesize'
21356 drand01='$drand01'
21357 drand48_r_proto='$drand48_r_proto'
21358 dynamic_ext='$dynamic_ext'
21359 eagain='$eagain'
21360 ebcdic='$ebcdic'
21361 echo='$echo'
21362 egrep='$egrep'
21363 emacs='$emacs'
21364 endgrent_r_proto='$endgrent_r_proto'
21365 endhostent_r_proto='$endhostent_r_proto'
21366 endnetent_r_proto='$endnetent_r_proto'
21367 endprotoent_r_proto='$endprotoent_r_proto'
21368 endpwent_r_proto='$endpwent_r_proto'
21369 endservent_r_proto='$endservent_r_proto'
21370 eunicefix='$eunicefix'
21371 exe_ext='$exe_ext'
21372 expr='$expr'
21373 extensions='$extensions'
21374 extras='$extras'
21375 fflushNULL='$fflushNULL'
21376 fflushall='$fflushall'
21377 find='$find'
21378 firstmakefile='$firstmakefile'
21379 flex='$flex'
21380 fpossize='$fpossize'
21381 fpostype='$fpostype'
21382 freetype='$freetype'
21383 from='$from'
21384 full_ar='$full_ar'
21385 full_csh='$full_csh'
21386 full_sed='$full_sed'
21387 gccansipedantic='$gccansipedantic'
21388 gccosandvers='$gccosandvers'
21389 gccversion='$gccversion'
21390 getgrent_r_proto='$getgrent_r_proto'
21391 getgrgid_r_proto='$getgrgid_r_proto'
21392 getgrnam_r_proto='$getgrnam_r_proto'
21393 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
21394 gethostbyname_r_proto='$gethostbyname_r_proto'
21395 gethostent_r_proto='$gethostent_r_proto'
21396 getlogin_r_proto='$getlogin_r_proto'
21397 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
21398 getnetbyname_r_proto='$getnetbyname_r_proto'
21399 getnetent_r_proto='$getnetent_r_proto'
21400 getprotobyname_r_proto='$getprotobyname_r_proto'
21401 getprotobynumber_r_proto='$getprotobynumber_r_proto'
21402 getprotoent_r_proto='$getprotoent_r_proto'
21403 getpwent_r_proto='$getpwent_r_proto'
21404 getpwnam_r_proto='$getpwnam_r_proto'
21405 getpwuid_r_proto='$getpwuid_r_proto'
21406 getservbyname_r_proto='$getservbyname_r_proto'
21407 getservbyport_r_proto='$getservbyport_r_proto'
21408 getservent_r_proto='$getservent_r_proto'
21409 getspnam_r_proto='$getspnam_r_proto'
21410 gidformat='$gidformat'
21411 gidsign='$gidsign'
21412 gidsize='$gidsize'
21413 gidtype='$gidtype'
21414 glibpth='$glibpth'
21415 gmake='$gmake'
21416 gmtime_r_proto='$gmtime_r_proto'
21417 gnulibc_version='$gnulibc_version'
21418 grep='$grep'
21419 groupcat='$groupcat'
21420 groupstype='$groupstype'
21421 gzip='$gzip'
21422 h_fcntl='$h_fcntl'
21423 h_sysfile='$h_sysfile'
21424 hint='$hint'
21425 hostcat='$hostcat'
21426 html1dir='$html1dir'
21427 html1direxp='$html1direxp'
21428 html3dir='$html3dir'
21429 html3direxp='$html3direxp'
21430 i16size='$i16size'
21431 i16type='$i16type'
21432 i32size='$i32size'
21433 i32type='$i32type'
21434 i64size='$i64size'
21435 i64type='$i64type'
21436 i8size='$i8size'
21437 i8type='$i8type'
21438 i_arpainet='$i_arpainet'
21439 i_bsdioctl='$i_bsdioctl'
21440 i_crypt='$i_crypt'
21441 i_db='$i_db'
21442 i_dbm='$i_dbm'
21443 i_dirent='$i_dirent'
21444 i_dld='$i_dld'
21445 i_dlfcn='$i_dlfcn'
21446 i_fcntl='$i_fcntl'
21447 i_float='$i_float'
21448 i_fp='$i_fp'
21449 i_fp_class='$i_fp_class'
21450 i_gdbm='$i_gdbm'
21451 i_grp='$i_grp'
21452 i_ieeefp='$i_ieeefp'
21453 i_inttypes='$i_inttypes'
21454 i_langinfo='$i_langinfo'
21455 i_libutil='$i_libutil'
21456 i_limits='$i_limits'
21457 i_locale='$i_locale'
21458 i_machcthr='$i_machcthr'
21459 i_malloc='$i_malloc'
21460 i_math='$i_math'
21461 i_memory='$i_memory'
21462 i_mntent='$i_mntent'
21463 i_ndbm='$i_ndbm'
21464 i_netdb='$i_netdb'
21465 i_neterrno='$i_neterrno'
21466 i_netinettcp='$i_netinettcp'
21467 i_niin='$i_niin'
21468 i_poll='$i_poll'
21469 i_prot='$i_prot'
21470 i_pthread='$i_pthread'
21471 i_pwd='$i_pwd'
21472 i_rpcsvcdbm='$i_rpcsvcdbm'
21473 i_sfio='$i_sfio'
21474 i_sgtty='$i_sgtty'
21475 i_shadow='$i_shadow'
21476 i_socks='$i_socks'
21477 i_stdarg='$i_stdarg'
21478 i_stddef='$i_stddef'
21479 i_stdlib='$i_stdlib'
21480 i_string='$i_string'
21481 i_sunmath='$i_sunmath'
21482 i_sysaccess='$i_sysaccess'
21483 i_sysdir='$i_sysdir'
21484 i_sysfile='$i_sysfile'
21485 i_sysfilio='$i_sysfilio'
21486 i_sysin='$i_sysin'
21487 i_sysioctl='$i_sysioctl'
21488 i_syslog='$i_syslog'
21489 i_sysmman='$i_sysmman'
21490 i_sysmode='$i_sysmode'
21491 i_sysmount='$i_sysmount'
21492 i_sysndir='$i_sysndir'
21493 i_sysparam='$i_sysparam'
21494 i_sysresrc='$i_sysresrc'
21495 i_syssecrt='$i_syssecrt'
21496 i_sysselct='$i_sysselct'
21497 i_syssockio='$i_syssockio'
21498 i_sysstat='$i_sysstat'
21499 i_sysstatfs='$i_sysstatfs'
21500 i_sysstatvfs='$i_sysstatvfs'
21501 i_systime='$i_systime'
21502 i_systimek='$i_systimek'
21503 i_systimes='$i_systimes'
21504 i_systypes='$i_systypes'
21505 i_sysuio='$i_sysuio'
21506 i_sysun='$i_sysun'
21507 i_sysutsname='$i_sysutsname'
21508 i_sysvfs='$i_sysvfs'
21509 i_syswait='$i_syswait'
21510 i_termio='$i_termio'
21511 i_termios='$i_termios'
21512 i_time='$i_time'
21513 i_unistd='$i_unistd'
21514 i_ustat='$i_ustat'
21515 i_utime='$i_utime'
21516 i_values='$i_values'
21517 i_varargs='$i_varargs'
21518 i_varhdr='$i_varhdr'
21519 i_vfork='$i_vfork'
21520 ignore_versioned_solibs='$ignore_versioned_solibs'
21521 inc_version_list='$inc_version_list'
21522 inc_version_list_init='$inc_version_list_init'
21523 incpath='$incpath'
21524 inews='$inews'
21525 installarchlib='$installarchlib'
21526 installbin='$installbin'
21527 installhtml1dir='$installhtml1dir'
21528 installhtml3dir='$installhtml3dir'
21529 installman1dir='$installman1dir'
21530 installman3dir='$installman3dir'
21531 installprefix='$installprefix'
21532 installprefixexp='$installprefixexp'
21533 installprivlib='$installprivlib'
21534 installscript='$installscript'
21535 installsitearch='$installsitearch'
21536 installsitebin='$installsitebin'
21537 installsitehtml1dir='$installsitehtml1dir'
21538 installsitehtml3dir='$installsitehtml3dir'
21539 installsitelib='$installsitelib'
21540 installsiteman1dir='$installsiteman1dir'
21541 installsiteman3dir='$installsiteman3dir'
21542 installsitescript='$installsitescript'
21543 installstyle='$installstyle'
21544 installusrbinperl='$installusrbinperl'
21545 installvendorarch='$installvendorarch'
21546 installvendorbin='$installvendorbin'
21547 installvendorhtml1dir='$installvendorhtml1dir'
21548 installvendorhtml3dir='$installvendorhtml3dir'
21549 installvendorlib='$installvendorlib'
21550 installvendorman1dir='$installvendorman1dir'
21551 installvendorman3dir='$installvendorman3dir'
21552 installvendorscript='$installvendorscript'
21553 intsize='$intsize'
21554 issymlink='$issymlink'
21555 ivdformat='$ivdformat'
21556 ivsize='$ivsize'
21557 ivtype='$ivtype'
21558 known_extensions='$known_extensions'
21559 ksh='$ksh'
21560 ld='$ld'
21561 lddlflags='$lddlflags'
21562 ldflags='$ldflags'
21563 ldflags_uselargefiles='$ldflags_uselargefiles'
21564 ldlibpthname='$ldlibpthname'
21565 less='$less'
21566 lib_ext='$lib_ext'
21567 libc='$libc'
21568 libperl='$libperl'
21569 libpth='$libpth'
21570 libs='$libs'
21571 libsdirs='$libsdirs'
21572 libsfiles='$libsfiles'
21573 libsfound='$libsfound'
21574 libspath='$libspath'
21575 libswanted='$libswanted'
21576 libswanted_uselargefiles='$libswanted_uselargefiles'
21577 line='$line'
21578 lint='$lint'
21579 lkflags='$lkflags'
21580 ln='$ln'
21581 lns='$lns'
21582 localtime_r_proto='$localtime_r_proto'
21583 locincpth='$locincpth'
21584 loclibpth='$loclibpth'
21585 longdblsize='$longdblsize'
21586 longlongsize='$longlongsize'
21587 longsize='$longsize'
21588 lp='$lp'
21589 lpr='$lpr'
21590 ls='$ls'
21591 lseeksize='$lseeksize'
21592 lseektype='$lseektype'
21593 mail='$mail'
21594 mailx='$mailx'
21595 make='$make'
21596 make_set_make='$make_set_make'
21597 mallocobj='$mallocobj'
21598 mallocsrc='$mallocsrc'
21599 malloctype='$malloctype'
21600 man1dir='$man1dir'
21601 man1direxp='$man1direxp'
21602 man1ext='$man1ext'
21603 man3dir='$man3dir'
21604 man3direxp='$man3direxp'
21605 man3ext='$man3ext'
21606 mips_type='$mips_type'
21607 mistrustnm='$mistrustnm'
21608 mkdir='$mkdir'
21609 mmaptype='$mmaptype'
21610 modetype='$modetype'
21611 more='$more'
21612 multiarch='$multiarch'
21613 mv='$mv'
21614 myarchname='$myarchname'
21615 mydomain='$mydomain'
21616 myhostname='$myhostname'
21617 myuname='$myuname'
21618 n='$n'
21619 need_va_copy='$need_va_copy'
21620 netdb_hlen_type='$netdb_hlen_type'
21621 netdb_host_type='$netdb_host_type'
21622 netdb_name_type='$netdb_name_type'
21623 netdb_net_type='$netdb_net_type'
21624 nm='$nm'
21625 nm_opt='$nm_opt'
21626 nm_so_opt='$nm_so_opt'
21627 nonxs_ext='$nonxs_ext'
21628 nroff='$nroff'
21629 nvEUformat='$nvEUformat'
21630 nvFUformat='$nvFUformat'
21631 nvGUformat='$nvGUformat'
21632 nv_preserves_uv_bits='$nv_preserves_uv_bits'
21633 nveformat='$nveformat'
21634 nvfformat='$nvfformat'
21635 nvgformat='$nvgformat'
21636 nvsize='$nvsize'
21637 nvtype='$nvtype'
21638 o_nonblock='$o_nonblock'
21639 obj_ext='$obj_ext'
21640 old_pthread_create_joinable='$old_pthread_create_joinable'
21641 optimize='$optimize'
21642 orderlib='$orderlib'
21643 osname='$osname'
21644 osvers='$osvers'
21645 otherlibdirs='$otherlibdirs'
21646 package='$package'
21647 pager='$pager'
21648 passcat='$passcat'
21649 patchlevel='$patchlevel'
21650 path_sep='$path_sep'
21651 perl5='$perl5'
21652 perl='$perl'
21653 perl_patchlevel='$perl_patchlevel'
21654 perladmin='$perladmin'
21655 perllibs='$perllibs'
21656 perlpath='$perlpath'
21657 pg='$pg'
21658 phostname='$phostname'
21659 pidtype='$pidtype'
21660 plibpth='$plibpth'
21661 pmake='$pmake'
21662 pr='$pr'
21663 prefix='$prefix'
21664 prefixexp='$prefixexp'
21665 privlib='$privlib'
21666 privlibexp='$privlibexp'
21667 procselfexe='$procselfexe'
21668 prototype='$prototype'
21669 ptrsize='$ptrsize'
21670 quadkind='$quadkind'
21671 quadtype='$quadtype'
21672 randbits='$randbits'
21673 randfunc='$randfunc'
21674 random_r_proto='$random_r_proto'
21675 randseedtype='$randseedtype'
21676 ranlib='$ranlib'
21677 rd_nodata='$rd_nodata'
21678 readdir64_r_proto='$readdir64_r_proto'
21679 readdir_r_proto='$readdir_r_proto'
21680 revision='$revision'
21681 rm='$rm'
21682 rmail='$rmail'
21683 run='$run'
21684 runnm='$runnm'
21685 sPRIEUldbl='$sPRIEUldbl'
21686 sPRIFUldbl='$sPRIFUldbl'
21687 sPRIGUldbl='$sPRIGUldbl'
21688 sPRIXU64='$sPRIXU64'
21689 sPRId64='$sPRId64'
21690 sPRIeldbl='$sPRIeldbl'
21691 sPRIfldbl='$sPRIfldbl'
21692 sPRIgldbl='$sPRIgldbl'
21693 sPRIi64='$sPRIi64'
21694 sPRIo64='$sPRIo64'
21695 sPRIu64='$sPRIu64'
21696 sPRIx64='$sPRIx64'
21697 sSCNfldbl='$sSCNfldbl'
21698 sched_yield='$sched_yield'
21699 scriptdir='$scriptdir'
21700 scriptdirexp='$scriptdirexp'
21701 sed='$sed'
21702 seedfunc='$seedfunc'
21703 selectminbits='$selectminbits'
21704 selecttype='$selecttype'
21705 sendmail='$sendmail'
21706 setgrent_r_proto='$setgrent_r_proto'
21707 sethostent_r_proto='$sethostent_r_proto'
21708 setlocale_r_proto='$setlocale_r_proto'
21709 setnetent_r_proto='$setnetent_r_proto'
21710 setprotoent_r_proto='$setprotoent_r_proto'
21711 setpwent_r_proto='$setpwent_r_proto'
21712 setservent_r_proto='$setservent_r_proto'
21713 sh='$sh'
21714 shar='$shar'
21715 sharpbang='$sharpbang'
21716 shmattype='$shmattype'
21717 shortsize='$shortsize'
21718 shrpenv='$shrpenv'
21719 shsharp='$shsharp'
21720 sig_count='$sig_count'
21721 sig_name='$sig_name'
21722 sig_name_init='$sig_name_init'
21723 sig_num='$sig_num'
21724 sig_num_init='$sig_num_init'
21725 sig_size='$sig_size'
21726 signal_t='$signal_t'
21727 sitearch='$sitearch'
21728 sitearchexp='$sitearchexp'
21729 sitebin='$sitebin'
21730 sitebinexp='$sitebinexp'
21731 sitehtml1dir='$sitehtml1dir'
21732 sitehtml1direxp='$sitehtml1direxp'
21733 sitehtml3dir='$sitehtml3dir'
21734 sitehtml3direxp='$sitehtml3direxp'
21735 sitelib='$sitelib'
21736 sitelib_stem='$sitelib_stem'
21737 sitelibexp='$sitelibexp'
21738 siteman1dir='$siteman1dir'
21739 siteman1direxp='$siteman1direxp'
21740 siteman3dir='$siteman3dir'
21741 siteman3direxp='$siteman3direxp'
21742 siteprefix='$siteprefix'
21743 siteprefixexp='$siteprefixexp'
21744 sitescript='$sitescript'
21745 sitescriptexp='$sitescriptexp'
21746 sizesize='$sizesize'
21747 sizetype='$sizetype'
21748 sleep='$sleep'
21749 smail='$smail'
21750 so='$so'
21751 sockethdr='$sockethdr'
21752 socketlib='$socketlib'
21753 socksizetype='$socksizetype'
21754 sort='$sort'
21755 spackage='$spackage'
21756 spitshell='$spitshell'
21757 srand48_r_proto='$srand48_r_proto'
21758 srandom_r_proto='$srandom_r_proto'
21759 src='$src'
21760 ssizetype='$ssizetype'
21761 startperl='$startperl'
21762 startsh='$startsh'
21763 static_ext='$static_ext'
21764 stdchar='$stdchar'
21765 stdio_base='$stdio_base'
21766 stdio_bufsiz='$stdio_bufsiz'
21767 stdio_cnt='$stdio_cnt'
21768 stdio_filbuf='$stdio_filbuf'
21769 stdio_ptr='$stdio_ptr'
21770 stdio_stream_array='$stdio_stream_array'
21771 strerror_r_proto='$strerror_r_proto'
21772 strings='$strings'
21773 submit='$submit'
21774 subversion='$subversion'
21775 sysman='$sysman'
21776 tail='$tail'
21777 tar='$tar'
21778 targetarch='$targetarch'
21779 tbl='$tbl'
21780 tee='$tee'
21781 test='$test'
21782 timeincl='$timeincl'
21783 timetype='$timetype'
21784 tmpnam_r_proto='$tmpnam_r_proto'
21785 to='$to'
21786 touch='$touch'
21787 tr='$tr'
21788 trnl='$trnl'
21789 troff='$troff'
21790 ttyname_r_proto='$ttyname_r_proto'
21791 u16size='$u16size'
21792 u16type='$u16type'
21793 u32size='$u32size'
21794 u32type='$u32type'
21795 u64size='$u64size'
21796 u64type='$u64type'
21797 u8size='$u8size'
21798 u8type='$u8type'
21799 uidformat='$uidformat'
21800 uidsign='$uidsign'
21801 uidsize='$uidsize'
21802 uidtype='$uidtype'
21803 uname='$uname'
21804 uniq='$uniq'
21805 uquadtype='$uquadtype'
21806 use5005threads='$use5005threads'
21807 use64bitall='$use64bitall'
21808 use64bitint='$use64bitint'
21809 usecrosscompile='$usecrosscompile'
21810 usedl='$usedl'
21811 usefaststdio='$usefaststdio'
21812 useithreads='$useithreads'
21813 uselargefiles='$uselargefiles'
21814 uselongdouble='$uselongdouble'
21815 usemallocwrap='$usemallocwrap'
21816 usemorebits='$usemorebits'
21817 usemultiplicity='$usemultiplicity'
21818 usemymalloc='$usemymalloc'
21819 usenm='$usenm'
21820 useopcode='$useopcode'
21821 useperlio='$useperlio'
21822 useposix='$useposix'
21823 usereentrant='$usereentrant'
21824 userelocatableinc='$userelocatableinc'
21825 usesfio='$usesfio'
21826 useshrplib='$useshrplib'
21827 usesitecustomize='$usesitecustomize'
21828 usesocks='$usesocks'
21829 usethreads='$usethreads'
21830 usevendorprefix='$usevendorprefix'
21831 usevfork='$usevfork'
21832 usrinc='$usrinc'
21833 uuname='$uuname'
21834 uvXUformat='$uvXUformat'
21835 uvoformat='$uvoformat'
21836 uvsize='$uvsize'
21837 uvtype='$uvtype'
21838 uvuformat='$uvuformat'
21839 uvxformat='$uvxformat'
21840 vendorarch='$vendorarch'
21841 vendorarchexp='$vendorarchexp'
21842 vendorbin='$vendorbin'
21843 vendorbinexp='$vendorbinexp'
21844 vendorhtml1dir='$vendorhtml1dir'
21845 vendorhtml1direxp='$vendorhtml1direxp'
21846 vendorhtml3dir='$vendorhtml3dir'
21847 vendorhtml3direxp='$vendorhtml3direxp'
21848 vendorlib='$vendorlib'
21849 vendorlib_stem='$vendorlib_stem'
21850 vendorlibexp='$vendorlibexp'
21851 vendorman1dir='$vendorman1dir'
21852 vendorman1direxp='$vendorman1direxp'
21853 vendorman3dir='$vendorman3dir'
21854 vendorman3direxp='$vendorman3direxp'
21855 vendorprefix='$vendorprefix'
21856 vendorprefixexp='$vendorprefixexp'
21857 vendorscript='$vendorscript'
21858 vendorscriptexp='$vendorscriptexp'
21859 version='$version'
21860 version_patchlevel_string='$version_patchlevel_string'
21861 versiononly='$versiononly'
21862 vi='$vi'
21863 voidflags='$voidflags'
21864 xlibpth='$xlibpth'
21865 yacc='$yacc'
21866 yaccflags='$yaccflags'
21867 zcat='$zcat'
21868 zip='$zip'
21869 EOT
21870
21871 : Add in command line options if available
21872 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
21873
21874 : add special variables
21875 $test -f $src/patchlevel.h && \
21876 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
21877 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
21878 echo "PERL_CONFIG_SH=true" >>config.sh
21879
21880 : propagate old symbols
21881 if $test -f UU/config.sh; then
21882         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
21883         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
21884         $sort | $uniq -u >UU/oldsyms
21885         set X `cat UU/oldsyms`
21886         shift
21887         case $# in
21888         0) ;;
21889         *)
21890                 cat <<EOM
21891 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
21892 EOM
21893                 echo "# Variables propagated from previous config.sh file." >>config.sh
21894                 for sym in `cat UU/oldsyms`; do
21895                         echo "    Propagating $hint variable "'$'"$sym..."
21896                         eval 'tmp="$'"${sym}"'"'
21897                         echo "$tmp" | \
21898                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
21899                 done
21900                 ;;
21901         esac
21902 fi
21903
21904 : Finish up by extracting the .SH files
21905 case "$alldone" in
21906 exit)
21907         $rm -rf UU
21908         echo "Extraction done."
21909         exit 0
21910         ;;
21911 cont)
21912         ;;
21913 '')
21914         dflt=''
21915         nostick=true
21916         $cat <<EOM
21917
21918 If you'd like to make any changes to the config.sh file before I begin
21919 to configure things, do it as a shell escape now (e.g. !vi config.sh).
21920
21921 EOM
21922         rp="Press return or use a shell escape to edit config.sh:"
21923         . UU/myread
21924         nostick=''
21925         case "$ans" in
21926         '') ;;
21927         *) : in case they cannot read
21928                 sh 1>&4 -c "$ans";;
21929         esac
21930         ;;
21931 esac
21932
21933 : if this fails, just run all the .SH files by hand
21934 . ./config.sh
21935
21936 echo " "
21937 exec 1>&4
21938 pwd=`pwd`
21939 . ./UU/extract
21940 cd "$pwd"
21941
21942 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
21943         dflt=y
21944         case "$silent" in
21945         true) ;;
21946         *)
21947                 $cat <<EOM
21948
21949 Now you need to generate make dependencies by running "$make depend".
21950 You might prefer to run it in background: "$make depend > makedepend.out &"
21951 It can take a while, so you might not want to run it right now.
21952
21953 EOM
21954                 ;;
21955         esac
21956         rp="Run $make depend now?"
21957         . UU/myread
21958         case "$ans" in
21959         y*)
21960                 $make depend && echo "Now you must run '$make'."
21961                 ;;
21962         *)
21963                 echo "You must run '$make depend' then '$make'."
21964                 ;;
21965         esac
21966 elif test -f [Mm]akefile; then
21967         echo " "
21968         echo "Now you must run a $make."
21969 else
21970         echo "Configure done."
21971 fi
21972
21973 if $test -f Policy.sh; then
21974     $cat <<EOM
21975
21976 If you compile $package on a different machine or from a different object
21977 directory, copy the Policy.sh file from this object directory to the
21978 new one before you run Configure -- this will help you with most of
21979 the policy defaults.
21980
21981 EOM
21982 fi
21983 if $test -f config.msg; then
21984     echo "Hmm.  I also noted the following information while running:"
21985     echo " "
21986     $cat config.msg >&4
21987     $rm -f config.msg
21988 fi
21989 $rm -f kit*isdone ark*isdone
21990 $rm -rf UU
21991
21992 : End of Configure
21993